sssd_dbus_properties.c revision c43ed56bc5d29e189e529235a3ba4bc17cd1a95f
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter Stef Walter <stefw@redhat.com>
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter Copyright (C) 2014 Red Hat
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter This program is free software; you can redistribute it and/or modify
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter it under the terms of the GNU General Public License as published by
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter the Free Software Foundation; either version 3 of the License, or
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter (at your option) any later version.
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter This program is distributed in the hope that it will be useful,
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter but WITHOUT ANY WARRANTY; without even the implied warranty of
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter GNU General Public License for more details.
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter You should have received a copy of the GNU General Public License
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter along with this program. If not, see <http://www.gnu.org/licenses/>.
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozekstatic char *
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek if (l != 1) {
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozekint sbus_add_variant_to_dict(DBusMessageIter *iter_dict,
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek const char *key,
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek dbret = dbus_message_iter_open_container(iter_dict,
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek /* Start by appending the key */
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek dbret = dbus_message_iter_append_basic(&iter_dict_entry,
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek dbret = dbus_message_iter_open_container(&iter_dict_entry,
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek /* Now add the value */
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek dbret = dbus_message_iter_append_basic(&iter_dict_val, type, value);
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek dbret = dbus_message_iter_close_container(&iter_dict_entry,
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek dbret = dbus_message_iter_close_container(iter_dict,
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walterdispatch_properties_set(struct sbus_connection *conn,
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter const char *type;
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter signature = dbus_message_get_signature(message);
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter "Invalid argument types passed " \
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter "to Set method"));
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter dbus_message_iter_get_basic (&iter, &interface_name);
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter dbus_message_iter_get_basic (&iter, &property_name);
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter "No such interface"));
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter property = sbus_meta_find_property (intf->vtable->meta, property_name);
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter "No such property"));
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter if (!(property->flags & SBUS_PROPERTY_WRITABLE)) {
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter "Property is not writable"));
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter type = dbus_message_iter_get_signature (&variant);
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter "Invalid data type for property"));
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter handler_fn = VTABLE_FUNC(intf->vtable, property->vtable_offset_set);
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter "Not implemented"));
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozekdispatch_properties_get(struct sbus_connection *conn,
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozek signature = dbus_message_get_signature(message);
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozek /* Interface name, property name */
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozek "Invalid argument types passed to Get method"));
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozek dbus_message_iter_get_basic(&iter, &interface_name);
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozek dbus_message_iter_get_basic(&iter, &property_name);
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozek "No such interface"));
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozek property = sbus_meta_find_property(intf->vtable->meta, property_name);
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozek "No such property"));
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozek if (!(property->flags & SBUS_PROPERTY_READABLE)) {
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozek "Property is not readable"));
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozek handler_fn = VTABLE_FUNC(intf->vtable, property->vtable_offset_get);
90e04eae7e54ec892a6f239783df94dab5d1ed9aJakub Hrozek "Not implemented"));
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozekdispatch_properties_get_all(struct sbus_connection *conn,
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek signature = dbus_message_get_signature(message);
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek /* Interface name */
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek "Invalid argument types passed " \
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek "to Set method"));
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek dbus_message_iter_get_basic(&iter, &interface_name);
c43ed56bc5d29e189e529235a3ba4bc17cd1a95fJakub Hrozek "No such interface"));
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walterint sbus_properties_dispatch(struct sbus_request *dbus_req)
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter member = dbus_message_get_member(dbus_req->message);
1319e71fd1680ca4864afe0b1aca2b8c8e4a1ee4Stef Walter /* Set is handled a lot like a method invocation */