chiark / gitweb /
add org.freedesktop.DBus.Properies.Set method
[elogind.git] / src / dbus.h
index f15a3f99f6de42cbff9fa2fd32684c7f27fa9b94..255b653376e9b924d2962bd31e498790232d461b 100644 (file)
@@ -27,6 +27,7 @@
 #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 +35,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 +49,16 @@ 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"        \
+        "   <arg type=\"as\" name=\"invalidated_properties\"/>\n"       \
+        "  </signal>\n"                                                 \
         " </interface>\n"
 
 #define BUS_INTROSPECTABLE_INTERFACE                                    \
@@ -56,7 +68,15 @@ typedef struct BusProperty {
         "  </method>\n"                                                 \
         " </interface>\n"
 
-int bus_init(Manager *m);
+#define BUS_PEER_INTERFACE                                              \
+        "<interface name=\"org.freedesktop.DBus.Peer\">\n"              \
+        " <method name=\"Ping\"/>\n"                                    \
+        " <method name=\"GetMachineId\">\n"                             \
+        "  <arg type=\"s\" name=\"machine_uuid\" direction=\"out\"/>\n" \
+        " </method>\n"                                                  \
+        "</interface>\n"
+
+int bus_init(Manager *m, bool try_bus_connect);
 void bus_done(Manager *m);
 
 unsigned bus_dispatch(Manager *m);
@@ -108,6 +128,8 @@ int bus_parse_strv(DBusMessage *m, char ***_l);
 bool bus_has_subscriber(Manager *m);
 bool bus_connection_has_subscriber(Manager *m, DBusConnection *c);
 
+DBusMessage* bus_properties_changed_new(const char *path, const char *interface, const char *properties);
+
 #define BUS_CONNECTION_SUBSCRIBED(m, c) dbus_connection_get_data((c), (m)->subscribed_data_slot)
 #define BUS_PENDING_CALL_NAME(m, p) dbus_pending_call_get_data((p), (m)->name_data_slot)