X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Fdbus-common.h;h=e141c9ec9003e681b13b0c32bef88a0d030f1d15;hp=edb8107347a7d538e257b2149f9a75b8acd574ab;hb=71645acac27da55d510f2e4d61cc61b4e5b93035;hpb=6e476bc9d18c706564d797882df6a27ab2d45b8b diff --git a/src/shared/dbus-common.h b/src/shared/dbus-common.h index edb810734..e141c9ec9 100644 --- a/src/shared/dbus-common.h +++ b/src/shared/dbus-common.h @@ -1,7 +1,6 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -#ifndef foodbuscommonhfoo -#define foodbuscommonhfoo +#pragma once /*** This file is part of systemd. @@ -23,6 +22,8 @@ ***/ #include +#include +#include #ifndef DBUS_ERROR_UNKNOWN_OBJECT #define DBUS_ERROR_UNKNOWN_OBJECT "org.freedesktop.DBus.Error.UnknownObject" @@ -91,6 +92,7 @@ int bus_connect_system_ssh(const char *user, const char *host, DBusConnection ** int bus_connect_system_polkit(DBusConnection **_bus, DBusError *error); const char *bus_error_message(const DBusError *error); +const char *bus_error_message_or_strerror(const DBusError *error, int err); typedef int (*BusPropertyCallback)(DBusMessageIter *iter, const char *property, void *data); typedef int (*BusPropertySetCallback)(DBusMessageIter *iter, const char *property, void *data); @@ -112,6 +114,10 @@ typedef struct BusBoundProperties { const void *const base; /* base pointer to which the offset must be added to reach data */ } BusBoundProperties; +dbus_bool_t bus_maybe_send_reply (DBusConnection *c, + DBusMessage *message, + DBusMessage *reply); + DBusHandlerResult bus_send_error_reply( DBusConnection *c, DBusMessage *message, @@ -191,6 +197,7 @@ unsigned bus_events_to_flags(uint32_t events); int bus_parse_strv(DBusMessage *m, char ***_l); int bus_parse_strv_iter(DBusMessageIter *iter, char ***_l); +int bus_parse_strv_pairs_iter(DBusMessageIter *iter, char ***_l); int bus_append_strv_iter(DBusMessageIter *iter, char **l); @@ -204,4 +211,19 @@ DBusHandlerResult bus_exit_idle_filter(DBusConnection *bus, DBusMessage *m, void pid_t bus_get_unix_process_id(DBusConnection *connection, const char *name, DBusError *error); -#endif +bool bus_error_is_no_service(const DBusError *error); +int bus_method_call_with_reply(DBusConnection *bus, + const char *destination, + const char *path, + const char *interface, + const char *method, + DBusMessage **return_reply, + DBusError *return_error, + int first_arg_type, ...); + +const char *bus_message_get_sender_with_fallback(DBusMessage *m); + +void bus_message_unrefp(DBusMessage **reply); + +#define _cleanup_dbus_message_unref_ __attribute__((cleanup(bus_message_unrefp))) +#define _cleanup_dbus_error_free_ __attribute__((cleanup(dbus_error_free)))