diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-06-28 16:08:37 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-06-30 15:09:35 +0200 |
commit | 807542beceb75b1461ad39538c6a0504e3cfef8d (patch) | |
tree | 1dbe60ecff4956df9bb872e25db2284a0fd3dd49 /src/shared/bus-map-properties.h | |
parent | 9b71e4ab90b4e1cb048f4cd13e0fde6f999cf6e8 (diff) | |
download | systemd-807542beceb75b1461ad39538c6a0504e3cfef8d.tar.gz |
shared: split out code that maps properties to local structs
Just some refactoring, no code changes.
Diffstat (limited to 'src/shared/bus-map-properties.h')
-rw-r--r-- | src/shared/bus-map-properties.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/shared/bus-map-properties.h b/src/shared/bus-map-properties.h new file mode 100644 index 0000000000..11b899227b --- /dev/null +++ b/src/shared/bus-map-properties.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ +#pragma once + +#include "sd-bus.h" + +typedef int (*bus_property_set_t) (sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata); + +struct bus_properties_map { + const char *member; + const char *signature; + bus_property_set_t set; + size_t offset; +}; + +enum { + BUS_MAP_STRDUP = 1 << 0, /* If set, each "s" message is duplicated. Thus, each pointer needs to be freed. */ + BUS_MAP_BOOLEAN_AS_BOOL = 1 << 1, /* If set, each "b" message is written to a bool pointer. If not set, "b" is written to a int pointer. */ +}; + +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_message *m, const struct bus_properties_map *map, unsigned flags, sd_bus_error *error, void *userdata); +int bus_map_all_properties(sd_bus *bus, const char *destination, const char *path, const struct bus_properties_map *map, + unsigned flags, sd_bus_error *error, sd_bus_message **reply, void *userdata); |