summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-util.h
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-08-24 18:55:58 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-08-27 18:42:28 +0200
commitaae2b488d084cf2af9a552a55e1d9cc614f2a12a (patch)
treec5aae783e9b099b00d62e1172d890726bf50355e /src/libsystemd/sd-bus/bus-util.h
parentf1566e63da92cee5cbc0074df9cd9a8dc078a62e (diff)
bus: split bus_map_all_properties into multiple helpers
The bus_map_all_properties() helper calls org.freedesktop.DBus.Properties.GetAll() on a given target and parses the result according to a given property-table. This simplifies dealing with DBus.Properties significantly. However, the function is blocking and thus not really useful in many situations. This patch extracts the core of this function and adds two new helpers which directly take dbus-messages as arguments. This way, you can issue asynchronous requests and parse the result via these helpers: bus_message_map_all_properties(): This is the same as bus_map_all_properties() but takes the result message from a GetAll() request as argument. You can thus issue an asynchronous GetAll() request and then use this helper once you got the result. bus_message_map_properties_changed(): This function takes a signal-message that was retrieved via a PropertiesChanged signal and then parses it like if you retrieved it via GetAll(). Furthermore, this function returns the number of matched properties that got invalidated by the PropertiesChanged signal, but didn't carry the new value. This way, the caller can issue a new GetAll() request and then parse the result. The old function bus_map_all_properties() is functionally unchanged, but now uses bus_message_map_all_properties() internally.
Diffstat (limited to 'src/libsystemd/sd-bus/bus-util.h')
-rw-r--r--src/libsystemd/sd-bus/bus-util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/bus-util.h b/src/libsystemd/sd-bus/bus-util.h
index faf1775809..696daa1f03 100644
--- a/src/libsystemd/sd-bus/bus-util.h
+++ b/src/libsystemd/sd-bus/bus-util.h
@@ -46,6 +46,14 @@ struct bus_properties_map {
int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata);
+int bus_message_map_all_properties(sd_bus *bus,
+ sd_bus_message *m,
+ const struct bus_properties_map *map,
+ void *userdata);
+int bus_message_map_properties_changed(sd_bus *bus,
+ sd_bus_message *m,
+ const struct bus_properties_map *map,
+ void *userdata);
int bus_map_all_properties(sd_bus *bus,
const char *destination,
const char *path,