/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foodbuscommonhfoo
-#define foodbuscommonhfoo
+#pragma once
/***
This file is part of systemd.
***/
#include <dbus/dbus.h>
+#include <inttypes.h>
+#include <sys/types.h>
+
+#include "macro.h"
#ifndef DBUS_ERROR_UNKNOWN_OBJECT
#define DBUS_ERROR_UNKNOWN_OBJECT "org.freedesktop.DBus.Error.UnknownObject"
int bus_connect_system_polkit(DBusConnection **_bus, DBusError *error);
const char *bus_error_message(const DBusError *error);
+const char *bus_error(const DBusError *e, int r);
typedef int (*BusPropertyCallback)(DBusMessageIter *iter, const char *property, void *data);
typedef int (*BusPropertySetCallback)(DBusMessageIter *iter, const char *property, void *data);
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,
return 0; \
}
-const char *bus_errno_to_dbus(int error);
+const char *bus_errno_to_dbus(int error) _const_;
DBusMessage* bus_properties_changed_new(const char *path, const char *interface, const char *properties);
DBusMessage* bus_properties_changed_one_new(const char *path, const char *interface, const char *property);
-uint32_t bus_flags_to_events(DBusWatch *bus_watch);
-unsigned bus_events_to_flags(uint32_t events);
+uint32_t bus_flags_to_events(DBusWatch *bus_watch) _pure_;
+unsigned bus_events_to_flags(uint32_t events) _const_;
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);
+
+struct unit_info {
+ const char *id;
+ const char *description;
+ const char *load_state;
+ const char *active_state;
+ const char *sub_state;
+ const char *following;
+ const char *unit_path;
+ uint32_t job_id;
+ const char *job_type;
+ const char *job_path;
+};
+
+int bus_parse_unit_info(DBusMessageIter *iter, struct unit_info *u);
int bus_append_strv_iter(DBusMessageIter *iter, char **l);
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)))