@@ -207,6 +207,10 @@ bool _dbus_object_tree_remove_interface(struct _dbus_object_tree *tree,
void *_dbus_object_tree_get_interface_data(struct _dbus_object_tree *tree,
const char *path,
const char *interface);
+bool _dbus_object_tree_set_interface_data(struct _dbus_object_tree *tree,
+ const char *path,
+ const char *interface,
+ void *user_data);
void _dbus_object_tree_introspect(struct _dbus_object_tree *tree,
const char *path, struct l_string *buf);
@@ -1568,25 +1568,50 @@ bool _dbus_object_tree_add_interface(struct _dbus_object_tree *tree,
return true;
}
-void *_dbus_object_tree_get_interface_data(struct _dbus_object_tree *tree,
+static struct interface_instance *_dbus_object_tree_find_interface(
+ struct _dbus_object_tree *tree,
const char *path,
const char *interface)
{
struct object_node *object;
- struct interface_instance *instance;
object = l_hashmap_lookup(tree->objects, path);
if (!object)
return NULL;
- instance = l_queue_find(object->instances, match_interface_instance,
- (char *) interface);
+ return l_queue_find(object->instances, match_interface_instance,
+ interface);
+}
+
+void *_dbus_object_tree_get_interface_data(struct _dbus_object_tree *tree,
+ const char *path,
+ const char *interface)
+{
+ struct interface_instance *instance;
+
+ instance = _dbus_object_tree_find_interface(tree, path, interface);
if (!instance)
return NULL;
return instance->user_data;
}
+bool _dbus_object_tree_set_interface_data(struct _dbus_object_tree *tree,
+ const char *path,
+ const char *interface,
+ void *user_data)
+{
+ struct interface_instance *instance;
+
+ instance = _dbus_object_tree_find_interface(tree, path, interface);
+ if (!instance)
+ return false;
+
+ instance->user_data = user_data;
+
+ return true;
+}
+
static bool match_object_manager_path(const void *a, const void *b)
{
const struct object_manager *manager = a;