pass ubus_msg_buf to callback of internal object
[project/ubus.git] / ubusd_obj.h
index d0573f0..5ed5ba8 100644 (file)
@@ -35,10 +35,9 @@ struct ubus_method {
        struct blob_attr data[];
 };
 
-struct ubus_watch {
-       struct list_head watcher_list, watched_list;
-       struct ubus_object *watcher, *watched;
-       char method[];
+struct ubus_subscription {
+       struct list_head list, target_list;
+       struct ubus_object *subscriber, *target;
 };
 
 struct ubus_object {
@@ -47,13 +46,14 @@ struct ubus_object {
 
        struct list_head events;
 
-       struct list_head watchers, watched;
+       struct list_head subscribers, target_list;
 
        struct ubus_object_type *type;
        struct avl_node path;
 
        struct ubus_client *client;
-       int (*recv_msg)(struct ubus_client *client, const char *method, struct blob_attr *msg);
+       int (*recv_msg)(struct ubus_client *client, struct ubus_msg_buf *ub,
+                       const char *method, struct blob_attr *msg);
 
        int event_seen;
        unsigned int invoke_seq;
@@ -76,8 +76,9 @@ static inline struct ubus_object *ubusd_find_object(uint32_t objid)
        return obj;
 }
 
-void ubus_watch_new(struct ubus_object *obj, struct ubus_object *target, const char *method);
-void ubus_watch_free(struct ubus_watch *w);
-void ubus_proto_notify_watch(struct ubus_watch *w);
+void ubus_subscribe(struct ubus_object *obj, struct ubus_object *target);
+void ubus_unsubscribe(struct ubus_subscription *s);
+void ubus_notify_unsubscribe(struct ubus_subscription *s);
+void ubus_notify_subscription(struct ubus_object *obj);
 
 #endif