dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / policykit / libpolkit / common / libpolkit.h
blob28b4319c7eb5ca53deeb3550829b4760117fa09e
1 /***************************************************************************
3 * libpolkit.h : Wraps a subset of methods on the PolicyKit daemon
5 * Copyright (C) 2006 David Zeuthen, <david@fubar.dk>
7 * Licensed under the Academic Free License version 2.1
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 **************************************************************************/
25 #ifndef LIBPOLKIT_H
26 #define LIBPOLKIT_H
28 #include <stdio.h>
29 #include <unistd.h>
30 #include <sys/types.h>
31 #include <glib.h>
32 #include <dbus/dbus.h>
34 typedef enum {
35 LIBPOLKIT_RESULT_OK,
36 LIBPOLKIT_RESULT_ERROR,
37 LIBPOLKIT_RESULT_INVALID_CONTEXT,
38 LIBPOLKIT_RESULT_NOT_PRIVILEGED,
39 LIBPOLKIT_RESULT_NO_SUCH_PRIVILEGE,
40 LIBPOLKIT_RESULT_NO_SUCH_USER
41 } LibPolKitResult;
43 struct LibPolKitContext_s;
44 typedef struct LibPolKitContext_s LibPolKitContext;
46 LibPolKitContext *libpolkit_new_context (DBusConnection *connection);
48 gboolean libpolkit_free_context (LibPolKitContext *ctx);
50 LibPolKitResult libpolkit_get_privilege_list (LibPolKitContext *ctx,
51 GList **result);
53 LibPolKitResult libpolkit_is_uid_allowed_for_privilege (LibPolKitContext *ctx,
54 const char *system_bus_unique_name,
55 const char *user,
56 const char *privilege,
57 const char *resource,
58 gboolean *out_is_allowed,
59 gboolean *out_is_temporary,
60 char **out_is_privileged_but_restricted_to_system_bus_unique_name);
62 LibPolKitResult libpolkit_revoke_temporary_privilege (LibPolKitContext *ctx,
63 const char *user,
64 const char *privilege,
65 const char *resource,
66 gboolean *result);
68 LibPolKitResult libpolkit_get_allowed_resources_for_privilege_for_uid (LibPolKitContext *ctx,
69 const char *user,
70 const char *privilege,
71 GList **resources,
72 GList **restrictions,
73 int *num_non_temporary);
75 #endif /* LIBPOLKIT_H */