Cleanup legacy internal functions
[src/app-framework-binder.git] / include / afb / afb-req-itf.h
index 8f8dc8a..34d73dd 100644 (file)
@@ -56,8 +56,8 @@ struct afb_req_itf {
        void (*success)(void *closure, struct json_object *obj, const char *info);
        void (*fail)(void *closure, const char *status, const char *info);
 
-       const char *(*raw)(void *closure, size_t *size);
-       void (*send)(void *closure, const char *buffer, size_t size);
+       /*legacy raw */void (*spare1)(void *closure);
+       /*legacy send*/void (*spare2)(void *closure);
 
        void *(*context_get)(void *closure);
        void (*context_set)(void *closure, void *value, void (*free_value)(void*));
@@ -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,21 +378,13 @@ 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)
 {
        return req.itf->subcallsync(req.closure, api, verb, args, result);
 }
 
-/* internal use */
-static inline const char *afb_req_raw(struct afb_req req, size_t *size)
-{
-       return req.itf->raw(req.closure, size);
-}
-
-/* internal use */
-static inline void afb_req_send(struct afb_req req, const char *buffer, size_t size)
-{
-       req.itf->send(req.closure, buffer, size);
-}
-