pass ubus_msg_buf to callback of internal object
authorJohn Crispin <blogic@openwrt.org>
Mon, 20 Apr 2015 09:08:26 +0000 (11:08 +0200)
committerJohn Crispin <blogic@openwrt.org>
Thu, 18 Jun 2015 17:01:17 +0000 (19:01 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
ubusd_event.c
ubusd_obj.h
ubusd_proto.c

index 6d4ddcf..6d0ae30 100644 (file)
@@ -228,7 +228,7 @@ static int ubusd_forward_event(struct ubus_client *cl, struct blob_attr *msg)
        return ubusd_send_event(cl, id, ubusd_create_event_from_msg, data);
 }
 
        return ubusd_send_event(cl, id, ubusd_create_event_from_msg, data);
 }
 
-static int ubusd_event_recv(struct ubus_client *cl, const char *method, struct blob_attr *msg)
+static int ubusd_event_recv(struct ubus_client *cl, struct ubus_msg_buf *ub, const char *method, struct blob_attr *msg)
 {
        if (!strcmp(method, "register"))
                return ubusd_alloc_event_pattern(cl, msg);
 {
        if (!strcmp(method, "register"))
                return ubusd_alloc_event_pattern(cl, msg);
index a21f47c..5ed5ba8 100644 (file)
@@ -52,7 +52,8 @@ struct ubus_object {
        struct avl_node path;
 
        struct ubus_client *client;
        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;
 
        int event_seen;
        unsigned int invoke_seq;
index 8954682..caede10 100644 (file)
@@ -244,7 +244,7 @@ static int ubusd_handle_invoke(struct ubus_client *cl, struct ubus_msg_buf *ub,
        method = blob_data(attr[UBUS_ATTR_METHOD]);
 
        if (!obj->client)
        method = blob_data(attr[UBUS_ATTR_METHOD]);
 
        if (!obj->client)
-               return obj->recv_msg(cl, method, attr[UBUS_ATTR_DATA]);
+               return obj->recv_msg(cl, ub, method, attr[UBUS_ATTR_DATA]);
 
        ub->hdr.peer = cl->id.id;
        blob_buf_init(&b, 0);
 
        ub->hdr.peer = cl->id.id;
        blob_buf_init(&b, 0);