diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-10-16 06:10:04 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-10-16 06:15:02 +0200 |
commit | 40ca29a1370379d43e44c0ed425eecc7218dcbca (patch) | |
tree | 39cde46c8166bd79471b0111251693edddfae3c4 /src/libsystemd-bus/bus-util.h | |
parent | 7a37d62501c97eb3b48a418ef764d0308e0c3fb9 (diff) |
timedated: use libsystemd-bus instead of libdbus for bus communication
Among other things this also adds a few things necessary for the change:
- Considerably more powerful error returning APIs in libsystemd-bus
- Adapter for connecting an sd_bus to an sd_event
- As I reworked the PolicyKit logic to the new library I also made it
asynchronous, so that PolicyKit requests of one user cannot block out
another user anymore.
- We always use the macro names for common bus error. That way it is
harder to mistype them since the compiler will notice
Diffstat (limited to 'src/libsystemd-bus/bus-util.h')
-rw-r--r-- | src/libsystemd-bus/bus-util.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/libsystemd-bus/bus-util.h b/src/libsystemd-bus/bus-util.h new file mode 100644 index 0000000000..354183f690 --- /dev/null +++ b/src/libsystemd-bus/bus-util.h @@ -0,0 +1,45 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#pragma once + +/*** + This file is part of systemd. + + Copyright 2013 Lennart Poettering + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include "sd-event.h" +#include "sd-bus.h" +#include "hashmap.h" +#include "time-util.h" +#include "util.h" + +int bus_async_unregister_and_quit(sd_event *e, sd_bus *bus, const char *name); + +int bus_event_loop_with_idle(sd_event *e, sd_bus *bus, const char *name, usec_t timeout); +int bus_property_get_tristate(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, sd_bus_error *error, void *userdata); + +int bus_verify_polkit(sd_bus *bus, sd_bus_message *m, const char *action, bool interactive, bool *_challenge, sd_bus_error *e); + +int bus_verify_polkit_async(sd_bus *bus, Hashmap **registry, sd_bus_message *m, const char *action, bool interactive, sd_bus_error *error, sd_bus_message_handler_t callback, void *userdata); +void bus_verify_polkit_async_registry_free(sd_bus *bus, Hashmap *registry); + +DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_unref); +DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_message*, sd_bus_message_unref); + +#define _cleanup_bus_unref_ _cleanup_(sd_bus_unrefp) +#define _cleanup_bus_error_free_ _cleanup_(sd_bus_error_free) +#define _cleanup_bus_message_unref_ _cleanup_(sd_bus_message_unrefp) |