diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2014-05-21 21:29:15 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-05-27 10:43:36 +0200 |
commit | 4f7f714e118e95896fac5239c7a8b529c39a4758 (patch) | |
tree | 41a78f39f2fe9bcec0d9394525500cc43b3f41ec /src/monitor | |
parent | 886d29fced0bcc1668a3cb99a5bca66ea486b3a4 (diff) | |
download | sssd-4f7f714e118e95896fac5239c7a8b529c39a4758.tar.gz sssd-4f7f714e118e95896fac5239c7a8b529c39a4758.tar.xz sssd-4f7f714e118e95896fac5239c7a8b529c39a4758.zip |
SBUS: Implement org.freedesktop.DBus.Properties.GetAll for primitive types
This patch implements the GetAll method of the
org.freedesktop.DBus.Properties interface by iterating over the
available getters and putting all the results into a single getter.
The patch includes a unit test that exercies all currently supported
array types.
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/monitor')
-rw-r--r-- | src/monitor/monitor_iface_generated.c | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/src/monitor/monitor_iface_generated.c b/src/monitor/monitor_iface_generated.c index e9c3c1d52..ee59242c1 100644 --- a/src/monitor/monitor_iface_generated.c +++ b/src/monitor/monitor_iface_generated.c @@ -24,12 +24,39 @@ const struct sbus_method_meta mon_srv_iface__methods[] = { { NULL, } }; +/* invokes GetAll for the 'org.freedesktop.sssd.monitor' interface */ +static int invoke_mon_srv_iface_get_all(struct sbus_request *dbus_req, void *function_ptr) +{ + DBusMessage *reply; + dbus_bool_t dbret; + DBusMessageIter iter; + DBusMessageIter iter_dict; + + reply = dbus_message_new_method_return(dbus_req->message); + if (!reply) return ENOMEM; + dbus_message_iter_init_append(reply, &iter); + dbret = dbus_message_iter_open_container( + &iter, DBUS_TYPE_ARRAY, + DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING + DBUS_TYPE_STRING_AS_STRING + DBUS_TYPE_VARIANT_AS_STRING + DBUS_DICT_ENTRY_END_CHAR_AS_STRING, + &iter_dict); + if (!dbret) return ENOMEM; + + dbret = dbus_message_iter_close_container(&iter, &iter_dict); + if (!dbret) return ENOMEM; + + return sbus_request_finish(dbus_req, reply); +} + /* interface info for org.freedesktop.sssd.monitor */ const struct sbus_interface_meta mon_srv_iface_meta = { "org.freedesktop.sssd.monitor", /* name */ mon_srv_iface__methods, NULL, /* no signals */ - NULL, /* no propetries */ + NULL, /* no properties */ + invoke_mon_srv_iface_get_all, /* GetAll invoker */ }; /* methods for org.freedesktop.sssd.service */ @@ -93,10 +120,37 @@ const struct sbus_method_meta mon_cli_iface__methods[] = { { NULL, } }; +/* invokes GetAll for the 'org.freedesktop.sssd.service' interface */ +static int invoke_mon_cli_iface_get_all(struct sbus_request *dbus_req, void *function_ptr) +{ + DBusMessage *reply; + dbus_bool_t dbret; + DBusMessageIter iter; + DBusMessageIter iter_dict; + + reply = dbus_message_new_method_return(dbus_req->message); + if (!reply) return ENOMEM; + dbus_message_iter_init_append(reply, &iter); + dbret = dbus_message_iter_open_container( + &iter, DBUS_TYPE_ARRAY, + DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING + DBUS_TYPE_STRING_AS_STRING + DBUS_TYPE_VARIANT_AS_STRING + DBUS_DICT_ENTRY_END_CHAR_AS_STRING, + &iter_dict); + if (!dbret) return ENOMEM; + + dbret = dbus_message_iter_close_container(&iter, &iter_dict); + if (!dbret) return ENOMEM; + + return sbus_request_finish(dbus_req, reply); +} + /* interface info for org.freedesktop.sssd.service */ const struct sbus_interface_meta mon_cli_iface_meta = { "org.freedesktop.sssd.service", /* name */ mon_cli_iface__methods, NULL, /* no signals */ - NULL, /* no propetries */ + NULL, /* no properties */ + invoke_mon_cli_iface_get_all, /* GetAll invoker */ }; |