add functionality for registering anonymous objects as event listeners
[project/ubus.git] / ubusd_obj.h
index 6e5c2c9..b268792 100644 (file)
@@ -26,7 +26,7 @@ struct ubus_object {
        struct ubus_id id;
        struct list_head list;
 
-       struct list_head event_patterns;
+       struct list_head events;
 
        struct ubus_object_type *type;
        struct avl_node path;
@@ -39,4 +39,17 @@ struct ubus_object *ubusd_create_object(struct ubus_client *cl, struct blob_attr
 struct ubus_object *ubusd_create_object_internal(struct ubus_object_type *type, uint32_t id);
 void ubusd_free_object(struct ubus_object *obj);
 
+static inline struct ubus_object *ubusd_find_object(uint32_t objid)
+{
+       struct ubus_object *obj;
+       struct ubus_id *id;
+
+       id = ubus_find_id(&objects, objid);
+       if (!id)
+               return NULL;
+
+       obj = container_of(id, struct ubus_object, id);
+       return obj;
+}
+
 #endif