sssd_dbus_properties.c revision df4e1db5d41c903ae57fd880acc76a0ad84aa7b2
/*
Authors:
Stef Walter <stefw@redhat.com>
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2014 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "sbus/sssd_dbus.h"
#include "sbus/sssd_dbus_meta.h"
#include "sbus/sssd_dbus_private.h"
#include "sbus/sssd_dbus_invokers.h"
const char *__sig; \
goto label; \
} \
} while (0)
struct iface_properties {
};
struct sbus_vtable *
sbus_properties_vtable(void)
{
/* Properties.Get */
static const struct sbus_arg_meta get_args_in[] = {
{ "interface_name", "s" },
{ "property_name", "s" },
{ NULL, }
};
static const struct sbus_arg_meta get_args_out[] = {
{ "value", "v" },
{ NULL, }
};
/* Properties.Set */
static const struct sbus_arg_meta set_args_in[] = {
{ "interface_name", "s" },
{ "property_name", "s" },
{ "value", "v" },
{ NULL, }
};
/* Properties.GetAll */
static const struct sbus_arg_meta getall_args_in[] = {
{ "interface_name", "s" },
{ NULL, }
};
static const struct sbus_arg_meta getall_args_out[] = {
{ "props", "a{sv}" },
{ NULL, }
};
static const struct sbus_method_meta iface_methods[] = {
{
"Get", /* name */
NULL, /* no invoker */
},
{
"Set", /* name */
NULL, /* no out_args */
NULL, /* no invoker */
},
{
"GetAll", /* name */
NULL, /* no invoker */
},
{ NULL, }
};
static const struct sbus_interface_meta iface_meta = {
"org.freedesktop.DBus.Properties", /* name */
NULL, /* no signals */
NULL, /* no properties */
NULL, /* no GetAll invoker */
};
static struct iface_properties iface = {
{ &iface_meta, 0 },
};
}
static struct sbus_request *
struct sbus_interface *iface)
{
struct sbus_request *sbus_subreq;
/* Create new sbus_request to so it contain given interface. The
* old sbus_request talloc context will be attached to this new one
* so it is freed together. */
if (sbus_subreq == NULL) {
return NULL;
}
return sbus_subreq;
}
{
struct sbus_request *sbus_subreq;
struct sbus_connection *conn;
struct sbus_interface *iface;
const struct sbus_property_meta *prop;
const char *interface_name;
const char *property_name;
bool bret;
if (!bret) {
/* request was handled */
return EOK;
}
/* find interface */
"Unknown interface");
goto fail;
}
/* find property handler */
"Unknown property");
goto fail;
}
"Property is not readable");
goto fail;
}
if (handler_fn == NULL) {
"Getter is not implemented");
goto fail;
}
if (sbus_subreq == NULL) {
goto fail;
}
return EOK;
fail:
}
/*
* We don't implement any handlers for setters yet. This code is for future
* use and it is likely it will need some changes.
*/
{
struct sbus_request *sbus_subreq;
struct sbus_connection *conn;
struct sbus_interface *iface;
const struct sbus_property_meta *prop;
const char *interface_name;
const char *property_name;
const char *variant_sig;
/* get interface and property */
/* find interface */
"Unknown interface");
goto fail;
}
/* find property handler */
"Unknown property");
goto fail;
}
"Property is not writable");
goto fail;
}
if (handler_fn == NULL) {
"Setter is not implemented");
goto fail;
}
/* check variant type */
"Invalid data type for property");
goto fail;
}
if (sbus_subreq == NULL) {
goto fail;
}
return EOK;
fail:
}
{
struct sbus_request *sbus_subreq;
struct sbus_connection *conn;
struct sbus_interface *iface;
const char *interface_name;
bool bret;
if (!bret) {
/* request was handled */
return EOK;
}
/* find interface */
"Unknown interface");
goto fail;
}
if (sbus_subreq == NULL) {
goto fail;
}
return EOK;
fail:
}
static char *
{
int l;
if (l != 1) {
return NULL;
}
return str;
}
const char *key,
int type,
const void *value)
{
char strtype[2];
if (!dbret) {
return ENOMEM;
}
/* Start by appending the key */
DBUS_TYPE_STRING, &key);
if (!dbret) {
return ENOMEM;
}
if (!dbret) {
return ENOMEM;
}
/* Now add the value */
if (!dbret) {
return ENOMEM;
}
if (!dbret) {
return ENOMEM;
}
if (!dbret) {
return ENOMEM;
}
return EOK;
}
const char *key,
int type,
const int len,
const unsigned int item_size)
{
int i;
if (!dbret) {
return ENOMEM;
}
/* Start by appending the key */
DBUS_TYPE_STRING, &key);
if (!dbret) {
return ENOMEM;
}
&iter_variant);
if (!dbret) {
return ENOMEM;
}
&iter_array);
if (!dbret) {
return ENOMEM;
}
/* Now add the value */
for (i = 0; i < len; i++) {
if (!dbret) {
return ENOMEM;
}
}
&iter_array);
if (!dbret) {
return ENOMEM;
}
&iter_variant);
if (!dbret) {
return ENOMEM;
}
if (!dbret) {
return ENOMEM;
}
return EOK;
}