summaryrefslogtreecommitdiffstats
path: root/include/afb
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-08-08 13:57:21 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-08-08 13:58:58 +0200
commit69162a9bf492fea52021e0b8d93454bbf496dedc (patch)
treec0c5ad3e812f99657d2d0a5595ebe00b7b272dd2 /include/afb
parent2f585aedc463109b3d59ad63a9a6c82f324dd500 (diff)
add validity functions
Change-Id: I56f4f6aebe673363c8b07c55f68ebbb1362b04fc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'include/afb')
-rw-r--r--include/afb/afb-event-itf.h10
-rw-r--r--include/afb/afb-req-itf.h10
2 files changed, 20 insertions, 0 deletions
diff --git a/include/afb/afb-event-itf.h b/include/afb/afb-event-itf.h
index e31f22c1..5f7b8370 100644
--- a/include/afb/afb-event-itf.h
+++ b/include/afb/afb-event-itf.h
@@ -43,6 +43,16 @@ struct afb_event {
};
/*
+ * Checks wether the 'event' is valid or not.
+ *
+ * Returns 0 if not valid or 1 if valid.
+ */
+static inline int afb_event_is_valid(struct afb_event event)
+{
+ return event.itf != NULL;
+}
+
+/*
* Broadcasts widely the 'event' with the data 'object'.
* 'object' can be NULL.
*
diff --git a/include/afb/afb-req-itf.h b/include/afb/afb-req-itf.h
index bc4b618c..153887b0 100644
--- a/include/afb/afb-req-itf.h
+++ b/include/afb/afb-req-itf.h
@@ -83,6 +83,16 @@ struct afb_req {
};
/*
+ * Checks wether the request 'req' is valid or not.
+ *
+ * Returns 0 if not valid or 1 if valid.
+ */
+static inline int afb_req_is_valid(struct afb_req req)
+{
+ return req.itf != NULL;
+}
+
+/*
* Gets from the request 'req' the argument of 'name'.
* Returns a PLAIN structure of type 'struct afb_arg'.
* When the argument of 'name' is not found, all fields of result are set to NULL.