chiark / gitweb /
condition: add ConditionSecurity
[elogind.git] / src / dbus.h
index 7c0da3320b33714749db9ee17af8fb1b1aa79c5b..f93ad6203b5ebcaa756bcb8b24a03018d05fdc99 100644 (file)
 
 #include <dbus/dbus.h>
 
+#ifndef DBUS_ERROR_UNKNOWN_OBJECT
+#define DBUS_ERROR_UNKNOWN_OBJECT "org.freedesktop.DBus.Error.UnknownObject"
+#endif
+
+#ifndef DBUS_ERROR_UNKNOWN_INTERFACE
+#define DBUS_ERROR_UNKNOWN_INTERFACE "org.freedesktop.DBus.Error.UnknownInterface"
+#endif
+
+#ifndef DBUS_ERROR_UNKNOWN_PROPERTY
+#define DBUS_ERROR_UNKNOWN_PROPERTY "org.freedesktop.DBus.Error.UnknownProperty"
+#endif
+
+#ifndef DBUS_ERROR_PROPERTY_READ_ONLY
+#define DBUS_ERROR_PROPERTY_READ_ONLY "org.freedesktop.DBus.Error.PropertyReadOnly"
+#endif
+
 #include "manager.h"
 
 typedef int (*BusPropertyCallback)(Manager *m, DBusMessageIter *iter, const char *property, void *data);
+typedef int (*BusPropertySetCallback)(Manager *m, DBusMessageIter *iter, const char *property);
 
 typedef struct BusProperty {
         const char *interface;           /* interface of the property */
@@ -34,6 +51,7 @@ typedef struct BusProperty {
         BusPropertyCallback append;      /* Function that is called to serialize this property */
         const char *signature;
         const void *data;                /* The data of this property */
+        BusPropertySetCallback set;      /* Function that is called to set this property */
 } BusProperty;
 
 #define BUS_PROPERTIES_INTERFACE                                        \
@@ -47,6 +65,11 @@ typedef struct BusProperty {
         "   <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"    \
         "   <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>\n" \
         "  </method>\n"                                                 \
+        "  <method name=\"Set\">\n"                                     \
+        "   <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"    \
+        "   <arg name=\"property\" direction=\"in\" type=\"s\"/>\n"     \
+        "   <arg name=\"value\" direction=\"in\" type=\"v\"/>\n"       \
+        "  </method>\n"                                                 \
         "  <signal name=\"PropertiesChanged\">\n"                       \
         "   <arg type=\"s\" name=\"interface\"/>\n"                     \
         "   <arg type=\"a{sv}\" name=\"changed_properties\"/>\n"        \
@@ -69,7 +92,12 @@ typedef struct BusProperty {
         " </method>\n"                                                  \
         "</interface>\n"
 
-int bus_init(Manager *m);
+#define BUS_GENERIC_INTERFACES_LIST             \
+        "org.freedesktop.DBus.Properties\0"     \
+        "org.freedesktop.DBus.Introspectable\0" \
+        "org.freedesktop.DBus.Peer\0"
+
+int bus_init(Manager *m, bool try_bus_connect);
 void bus_done(Manager *m);
 
 unsigned bus_dispatch(Manager *m);
@@ -79,7 +107,7 @@ void bus_timeout_event(Manager *m, Watch *w, int events);
 
 int bus_query_pid(Manager *m, const char *name);
 
-DBusHandlerResult bus_default_message_handler(Manager *m, DBusConnection *c, DBusMessage *message, const char* introspection, const BusProperty *properties);
+DBusHandlerResult bus_default_message_handler(Manager *m, DBusConnection *c, DBusMessage *message, const char* introspection, const char *interfaces, const BusProperty *properties);
 DBusHandlerResult bus_send_error_reply(Manager *m, DBusConnection *c, DBusMessage *message, DBusError *bus_error, int error);
 
 int bus_broadcast(Manager *m, DBusMessage *message);