X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fubus.git;a=blobdiff_plain;f=ubusd_event.c;h=984f341eecea25f27731ef4678fc303753543e0a;hp=85031a6fc150c94847b1db9b3381f8ff485ea72b;hb=5dfd3c16fa1cc9e288c41ef6e3e4c3bc63acf612;hpb=95062c1ef74695d138bbc4b9efc5910b1436bd9c diff --git a/ubusd_event.c b/ubusd_event.c index 85031a6..984f341 100644 --- a/ubusd_event.c +++ b/ubusd_event.c @@ -103,8 +103,6 @@ static int ubusd_alloc_event_pattern(struct ubus_client *cl, struct blob_attr *m return 0; } -typedef struct ubus_msg_buf *(*event_fill_cb)(void *priv, const char *id); - static void ubusd_send_event_msg(struct ubus_msg_buf **ub, struct ubus_client *cl, struct ubus_object *obj, const char *id, event_fill_cb fill_cb, void *cb_priv) @@ -143,8 +141,8 @@ static bool strmatch_len(const char *s1, const char *s2, int *len) return false; } -static int ubusd_send_event(struct ubus_client *cl, const char *id, - event_fill_cb fill_cb, void *cb_priv) +int ubusd_send_event(struct ubus_client *cl, const char *id, + event_fill_cb fill_cb, void *cb_priv) { struct ubus_msg_buf *ub = NULL; struct event_source *ev; @@ -228,7 +226,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); } -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); @@ -267,6 +265,7 @@ void ubusd_event_init(void) { ubus_init_string_tree(&patterns, true); event_obj = ubusd_create_object_internal(NULL, UBUS_SYSTEM_OBJECT_EVENT); - event_obj->recv_msg = ubusd_event_recv; + if (event_obj != NULL) + event_obj->recv_msg = ubusd_event_recv; }