aboutsummaryrefslogtreecommitdiffstats
path: root/include/afb/afb-req-itf.h
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-05-29 14:16:13 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-05-29 14:16:13 +0200
commit090379fdaf6ed1860dcff21424135ad71ead0cd2 (patch)
treeb7c9bde501e86a9fcf4a801444a670de3339208a /include/afb/afb-req-itf.h
parentce8d87d91aa710702b02a371278f4e1f39ea195c (diff)
Add 'afb_service_call_sync' function
This new function allows to call features for the services synchronously. Also refactoring how are handled arguments to calls. The call to 'json_object_put' is now always done by the binder. Change-Id: I910517da75b179aeafc824da4ce29bc299711990 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'include/afb/afb-req-itf.h')
-rw-r--r--include/afb/afb-req-itf.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/afb/afb-req-itf.h b/include/afb/afb-req-itf.h
index 8f8dc8a9..1d60daee 100644
--- a/include/afb/afb-req-itf.h
+++ b/include/afb/afb-req-itf.h
@@ -359,7 +359,12 @@ static inline int afb_req_unsubscribe(struct afb_req req, struct afb_event event
* On completion, the function 'callback' is invoked with the
* 'closure' given at call and two other parameters: 'iserror' and 'result'.
* 'iserror' is a boolean that indicates if the reply is an error reply.
- * 'result' is the json object of the reply.
+ * 'result' is the json object of the reply, you must not call json_object_put
+ * on the result.
+ *
+ * For convenience, the function calls 'json_object_put' for 'args'.
+ * Thus, in the case where 'args' should remain available after
+ * the function returns, the function 'json_object_get' shall be used.
*/
static inline void afb_req_subcall(struct afb_req req, const char *api, const char *verb, struct json_object *args, void (*callback)(void *closure, int iserror, struct json_object *result), void *closure)
{
@@ -373,6 +378,10 @@ static inline void afb_req_subcall(struct afb_req req, const char *api, const ch
* It returns 0 on an error answer and returns 1 when no error was detected.
* The object pointed by 'result' is filled and must be released by the caller
* after its use by calling 'json_object_put'.
+ *
+ * For convenience, the function calls 'json_object_put' for 'args'.
+ * Thus, in the case where 'args' should remain available after
+ * the function returns, the function 'json_object_get' shall be used.
*/
static inline int afb_req_subcall_sync(struct afb_req req, const char *api, const char *verb, struct json_object *args, struct json_object **result)
{