summaryrefslogtreecommitdiff
path: root/src/shared/bus-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-08-26 19:20:02 +0200
committerLennart Poettering <lennart@poettering.net>2016-10-07 20:14:38 +0200
commit766c94ad6b6d6101520a02aa2906ca7a446f4863 (patch)
treeb91c31ffa69bc4761cafe5ac29e5daf784f79a29 /src/shared/bus-util.c
parent4a39c774196f1a694477432f845e8bd62efee245 (diff)
bus-util: generalize helper for ID128 prpoerties
This way, we can make use of this in other code, too.
Diffstat (limited to 'src/shared/bus-util.c')
-rw-r--r--src/shared/bus-util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index e2a216a5cc..64fcf9295f 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -1324,6 +1324,23 @@ int bus_property_get_bool(
return sd_bus_message_append_basic(reply, 'b', &b);
}
+int bus_property_get_id128(
+ sd_bus *bus,
+ const char *path,
+ const char *interface,
+ const char *property,
+ sd_bus_message *reply,
+ void *userdata,
+ sd_bus_error *error) {
+
+ sd_id128_t *id = userdata;
+
+ if (sd_id128_is_null(*id)) /* Add an empty array if the ID is zero */
+ return sd_bus_message_append(reply, "ay", 0);
+ else
+ return sd_bus_message_append_array(reply, 'b', id->bytes, 16);
+}
+
#if __SIZEOF_SIZE_T__ != 8
int bus_property_get_size(
sd_bus *bus,