X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fdbus.h;h=f93ad6203b5ebcaa756bcb8b24a03018d05fdc99;hp=af837f283f8f86a3cb582237c123ce52c4a67e33;hb=07e833bc1d60e282b062eb205bb13215dc0e8cdf;hpb=5e8d1c9a9f15b7453474dc4879bdb4021c3f50a1 diff --git a/src/dbus.h b/src/dbus.h index af837f283..f93ad6203 100644 --- a/src/dbus.h +++ b/src/dbus.h @@ -1,4 +1,4 @@ -/*-*- Mode: C; c-basic-offset: 8 -*-*/ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ #ifndef foodbushfoo #define foodbushfoo @@ -24,9 +24,26 @@ #include +#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,16 @@ typedef struct BusProperty { " \n" \ " \n" \ " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ " \n" #define BUS_INTROSPECTABLE_INTERFACE \ @@ -56,7 +84,20 @@ typedef struct BusProperty { " \n" \ " \n" -int bus_init(Manager *m); +#define BUS_PEER_INTERFACE \ + "\n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + "\n" + +#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); @@ -66,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); @@ -77,6 +118,8 @@ int bus_property_append_bool(Manager *m, DBusMessageIter *i, const char *propert int bus_property_append_int32(Manager *m, DBusMessageIter *i, const char *property, void *data); int bus_property_append_uint32(Manager *m, DBusMessageIter *i, const char *property, void *data); int bus_property_append_uint64(Manager *m, DBusMessageIter *i, const char *property, void *data); +int bus_property_append_size(Manager *m, DBusMessageIter *i, const char *property, void *data); +int bus_property_append_ul(Manager *m, DBusMessageIter *i, const char *property, void *data); #define bus_property_append_int bus_property_append_int32 #define bus_property_append_pid bus_property_append_uint32 @@ -103,6 +146,14 @@ int bus_property_append_uint64(Manager *m, DBusMessageIter *i, const char *prope 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) + extern const char * const bus_interface_table[]; #endif