From 9eccb29ef3ea2fdf628fcac8ae793d5acec92496 Mon Sep 17 00:00:00 2001 From: Tim Kourt Date: Fri, 14 Apr 2017 10:52:42 -0700 Subject: [PATCH] client: Proxy accessors --- client/dbus-proxy.c | 19 +++++++++++++++++++ client/dbus-proxy.h | 7 +++++++ 2 files changed, 26 insertions(+) diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c index bea53ae6..d0f5ab3a 100644 --- a/client/dbus-proxy.c +++ b/client/dbus-proxy.c @@ -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) { diff --git a/client/dbus-proxy.h b/client/dbus-proxy.h index ba8467c0..f2b0bf55 100644 --- a/client/dbus-proxy.h +++ b/client/dbus-proxy.h @@ -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(