client: Proxy accessors

This commit is contained in:
Tim Kourt 2017-04-14 10:52:42 -07:00 committed by Denis Kenzior
parent 57fed9e5d2
commit 9eccb29ef3
2 changed files with 26 additions and 0 deletions

View File

@ -317,6 +317,25 @@ static void proxy_interface_destroy(void *data)
l_free(proxy);
}
void *proxy_interface_get_data(const struct proxy_interface *proxy)
{
return proxy->data;
}
const char *proxy_interface_get_interface(const struct proxy_interface *proxy)
{
return proxy->type->interface;
}
const char *proxy_interface_get_identity_str(
const struct proxy_interface *proxy)
{
if (proxy->type->ops && proxy->type->ops->identity)
return proxy->type->ops->identity(proxy->data);
return NULL;
}
static void interfaces_added_callback(struct l_dbus_message *message,
void *user_data)
{

View File

@ -45,6 +45,8 @@ struct proxy_interface_type_ops {
const struct proxy_interface *dependency);
bool (*unbind_interface)(const struct proxy_interface *proxy,
const struct proxy_interface *dependency);
const char *(*identity)(void *data);
void (*display)(const char *margin, const void *data);
};
struct proxy_interface_type {
@ -56,6 +58,11 @@ struct proxy_interface_type {
struct proxy_interface *proxy_interface_find(const char *interface,
const char *path);
void *proxy_interface_get_data(const struct proxy_interface *proxy);
const char *proxy_interface_get_interface(const struct proxy_interface *proxy);
const char *proxy_interface_get_identity_str(
const struct proxy_interface *proxy);
void proxy_interface_type_register(
const struct proxy_interface_type *interface_type);
void proxy_interface_type_unregister(