X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fdbus.h;h=bd539d0e72998dc706f801d906a90ca1d5a572e8;hp=2aaeb4745ff776afd200a2e3f56cacca18cd2d14;hb=490e567dbb12928528d395d2c759b80960312e8f;hpb=08672cb5071af320127f6fe8d0916f62bedd82f3 diff --git a/src/dbus.h b/src/dbus.h index 2aaeb4745..bd539d0e7 100644 --- a/src/dbus.h +++ b/src/dbus.h @@ -24,66 +24,8 @@ #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 - #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 */ - const char *property; /* name of the property */ - 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 \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" - -#define BUS_INTROSPECTABLE_INTERFACE \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" - -#define BUS_PEER_INTERFACE \ - "\n" \ - " \n" \ - " \n" \ - " \n" \ - " \n" \ - "\n" - int bus_init(Manager *m, bool try_bus_connect); void bus_done(Manager *m); @@ -94,49 +36,14 @@ 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_send_error_reply(Manager *m, DBusConnection *c, DBusMessage *message, DBusError *bus_error, int error); - int bus_broadcast(Manager *m, DBusMessage *message); -int bus_property_append_string(Manager *m, DBusMessageIter *i, const char *property, void *data); -int bus_property_append_strv(Manager *m, DBusMessageIter *i, const char *property, void *data); -int bus_property_append_bool(Manager *m, DBusMessageIter *i, const char *property, void *data); -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 -#define bus_property_append_mode bus_property_append_uint32 -#define bus_property_append_unsigned bus_property_append_uint32 -#define bus_property_append_usec bus_property_append_uint64 - -#define DEFINE_BUS_PROPERTY_APPEND_ENUM(function,name,type) \ - int function(Manager *m, DBusMessageIter *i, const char *property, void *data) { \ - const char *value; \ - type *field = data; \ - \ - assert(m); \ - assert(i); \ - assert(property); \ - \ - value = name##_to_string(*field); \ - \ - if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &value)) \ - return -ENOMEM; \ - \ - return 0; \ - } - -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); +int bus_fdset_add_all(Manager *m, FDSet *fds); + +void bus_broadcast_finished(Manager *m, usec_t kernel_usec, usec_t initrd_usec, usec_t userspace_usec, usec_t total_usec); #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)