chiark / gitweb /
bus-proxy: implement org.freedesktop.DBus.ReloadConfig()
[elogind.git] / src / bus-proxyd / bus-xml-policy.h
index 933a53ceb596f5d04444a0ac46706a945b1116a3..9716772e68ac6bb4b71385f548b89b4aa6517363 100644 (file)
@@ -22,6 +22,7 @@
 ***/
 
 #include <inttypes.h>
+#include <pthread.h>
 
 #include "list.h"
 #include "hashmap.h"
@@ -69,10 +70,22 @@ struct PolicyItem {
 typedef struct Policy {
         LIST_HEAD(PolicyItem, default_items);
         LIST_HEAD(PolicyItem, mandatory_items);
+        LIST_HEAD(PolicyItem, on_console_items);
+        LIST_HEAD(PolicyItem, no_console_items);
         Hashmap *user_items;
         Hashmap *group_items;
 } Policy;
 
+typedef struct SharedPolicy {
+        char **configuration;
+        pthread_mutex_t lock;
+        pthread_rwlock_t rwlock;
+        Policy buffer;
+        Policy *policy;
+} SharedPolicy;
+
+/* policy */
+
 int policy_load(Policy *p, char **files);
 void policy_free(Policy *p);
 
@@ -85,7 +98,8 @@ bool policy_check_recv(Policy *p,
                        const char *name,
                        const char *path,
                        const char *interface,
-                       const char *member);
+                       const char *member,
+                       bool dbus_to_kernel);
 bool policy_check_send(Policy *p,
                        uid_t uid,
                        gid_t gid,
@@ -93,7 +107,8 @@ bool policy_check_send(Policy *p,
                        const char *name,
                        const char *path,
                        const char *interface,
-                       const char *member);
+                       const char *member,
+                       bool dbus_to_kernel);
 
 void policy_dump(Policy *p);
 
@@ -102,3 +117,15 @@ PolicyItemType policy_item_type_from_string(const char *s) _pure_;
 
 const char* policy_item_class_to_string(PolicyItemClass t) _const_;
 PolicyItemClass policy_item_class_from_string(const char *s) _pure_;
+
+/* shared policy */
+
+int shared_policy_new(SharedPolicy **out);
+SharedPolicy *shared_policy_free(SharedPolicy *sp);
+
+int shared_policy_reload(SharedPolicy *sp);
+int shared_policy_preload(SharedPolicy *sp, char **configuration);
+Policy *shared_policy_acquire(SharedPolicy *sp);
+void shared_policy_release(SharedPolicy *sp, Policy *p);
+
+DEFINE_TRIVIAL_CLEANUP_FUNC(SharedPolicy*, shared_policy_free);