diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-05-19 21:09:35 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-05-19 21:09:35 +0200 |
commit | c6f705451527e6e5e8f5a2715f11478eeb8799e4 (patch) | |
tree | f995b4b0aefd441c8038f5f4eb3a5fb44bd7d9c1 /libubus.h | |
parent | 9f911f14bf5febf67d70114b4afb152c6b596ed6 (diff) | |
download | ubus-c6f705451527e6e5e8f5a2715f11478eeb8799e4.tar.gz |
ubusd: add support for watching objects to get notified when they go away
Diffstat (limited to 'libubus.h')
-rw-r--r-- | libubus.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -26,6 +26,7 @@ struct ubus_request; struct ubus_request_data; struct ubus_object_data; struct ubus_event_handler; +struct ubus_watch_object; typedef void (*ubus_lookup_handler_t)(struct ubus_context *ctx, struct ubus_object_data *obj, @@ -35,6 +36,8 @@ typedef int (*ubus_handler_t)(struct ubus_context *ctx, struct ubus_object *obj, const char *method, struct blob_attr *msg); typedef void (*ubus_event_handler_t)(struct ubus_context *ctx, struct ubus_event_handler *ev, const char *type, struct blob_attr *msg); +typedef void (*ubus_watch_handler_t)(struct ubus_context *ctx, struct ubus_watch_object *w, + uint32_t id); typedef void (*ubus_data_handler_t)(struct ubus_request *req, int type, struct blob_attr *msg); typedef void (*ubus_complete_handler_t)(struct ubus_request *req, int ret); @@ -84,6 +87,12 @@ struct ubus_object { int n_methods; }; +struct ubus_watch_object { + struct ubus_object obj; + + ubus_watch_handler_t cb; +}; + struct ubus_event_handler { struct ubus_object obj; @@ -185,6 +194,13 @@ int ubus_add_object(struct ubus_context *ctx, struct ubus_object *obj); /* remove the object from the ubus connection */ int ubus_remove_object(struct ubus_context *ctx, struct ubus_object *obj); +/* add an object for watching other object state changes */ +int ubus_register_watch_object(struct ubus_context *ctx, struct ubus_watch_object *obj); + +int ubus_watch_object_add(struct ubus_context *ctx, struct ubus_watch_object *obj, uint32_t id); + +int ubus_watch_object_remove(struct ubus_context *ctx, struct ubus_watch_object *obj, uint32_t id); + /* ----------- rpc ----------- */ /* invoke a method on a specific object */ |