diff options
author | José Bollo <jose.bollo@iot.bzh> | 2016-06-17 22:31:33 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2016-06-23 11:04:23 +0200 |
commit | d8ef25780bffa6f91f013ef71b1ede908325e59d (patch) | |
tree | fb0d3aef9cdf0775dcadd2c062741519c4d4fcad /src/afb-evt.h | |
parent | b0848149c1ef5236791c0ba5196540d05d9f15fd (diff) |
evt: handles broadcasting and tracking
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-evt.h')
-rw-r--r-- | src/afb-evt.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/afb-evt.h b/src/afb-evt.h index 157a7776..8ebb2ec0 100644 --- a/src/afb-evt.h +++ b/src/afb-evt.h @@ -22,7 +22,15 @@ struct AFB_clientCtx; struct afb_evt_listener; -extern struct afb_evt_listener *afb_evt_listener_create(void (*send)(void *closure, const char *event, struct json_object *object), void *closure); +struct afb_evt_itf +{ + void (*push)(void *closure, const char *event, int eventid, struct json_object *object); + void (*broadcast)(void *closure, const char *event, int eventid, struct json_object *object); + void (*add)(void *closure, const char *event, int eventid); + void (*remove)(void *closure, const char *event, int eventid); +}; + +extern struct afb_evt_listener *afb_evt_listener_create(const struct afb_evt_itf *itf, void *closure); extern int afb_evt_broadcast(const char *event, struct json_object *object); @@ -31,6 +39,7 @@ extern void afb_evt_listener_unref(struct afb_evt_listener *listener); extern struct afb_event afb_evt_create_event(const char *name); extern const char *afb_evt_event_name(struct afb_event event); +extern int afb_evt_event_id(struct afb_event event); extern int afb_evt_add_watch(struct afb_evt_listener *listener, struct afb_event event); extern int afb_evt_remove_watch(struct afb_evt_listener *listener, struct afb_event event); |