aboutsummaryrefslogtreecommitdiffstats
path: root/include/afb
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-10-14 15:13:43 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-10-14 15:13:43 +0200
commit91d08eedaa810edfd38dcb8ce67c66813e5e3dce (patch)
tree26ef779d40ebb7d38af10ff3e87ca6e0db05306a /include/afb
parent98a5bca16007a7c4740c4326ef83768d034aed3e (diff)
event: add ability to get the event name
Change-Id: Iecfeb4ab07c07715093d729710669abecee722de Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'include/afb')
-rw-r--r--include/afb/afb-event-itf.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/afb/afb-event-itf.h b/include/afb/afb-event-itf.h
index 5f7b8370..ad9206a9 100644
--- a/include/afb/afb-event-itf.h
+++ b/include/afb/afb-event-itf.h
@@ -32,6 +32,7 @@ struct afb_event_itf {
int (*broadcast)(void *closure, struct json_object *obj);
int (*push)(void *closure, struct json_object *obj);
void (*drop)(void *closure);
+ const char *(*name)(void *closure);
};
/*
@@ -83,7 +84,7 @@ static inline int afb_event_push(struct afb_event event, struct json_object *obj
}
/*
- * Drops the data associated to the event
+ * Drops the data associated to the 'event'
* After calling this function, the event
* MUST NOT BE USED ANYMORE.
*/
@@ -92,3 +93,11 @@ static inline void afb_event_drop(struct afb_event event)
event.itf->drop(event.closure);
}
+/*
+ * Gets the name associated to the 'event'.
+ */
+static inline const char *afb_event_name(struct afb_event event)
+{
+ return event.itf->name(event.closure);
+}
+