Add wrappers for accesses to internals
[src/app-framework-binder.git] / include / afb / afb-request.h
index 052cbab..fcab03c 100644 (file)
 
 #include "afb-request-itf.h"
 
-typedef struct afb_request afb_request;
+static inline struct afb_dynapi *afb_request_get_dynapi(struct afb_request *request)
+{
+       return request->dynapi;
+}
+
+static inline void *afb_request_get_vcbdata(struct afb_request *request)
+{
+       return request->vcbdata;
+}
 
-#include "afb-event.h"
+static inline const char *afb_request_get_api(struct afb_request *request)
+{
+       return request->api;
+}
+
+static inline const char *afb_request_get_verb(struct afb_request *request)
+{
+       return request->verb;
+}
 
 /*
  * Gets from the request 'request' the argument of 'name'.
@@ -204,9 +220,9 @@ static inline void afb_request_context_clear(struct afb_request *request)
  * This function MUST be called by asynchronous implementations
  * of verbs if no reply was sent before returning.
  */
-static inline void afb_request_addref(struct afb_request *request)
+static inline struct afb_request *afb_request_addref(struct afb_request *request)
 {
-       request->itf->addref(request);
+       return request->itf->addref(request);
 }
 
 /*
@@ -244,9 +260,9 @@ static inline int afb_request_session_set_LOA(struct afb_request *request, unsig
  * to the 'event'.
  * Returns 0 in case of successful subscription or -1 in case of error.
  */
-static inline int afb_request_subscribe(struct afb_request *request, struct afb_event event)
+static inline int afb_request_subscribe(struct afb_request *request, struct afb_eventid *eventid)
 {
-       return request->itf->subscribe(request, event);
+       return request->itf->subscribe_eventid(request, eventid);
 }
 
 /*
@@ -254,9 +270,9 @@ static inline int afb_request_subscribe(struct afb_request *request, struct afb_
  * link identified by 'request'.
  * Returns 0 in case of successful subscription or -1 in case of error.
  */
-static inline int afb_request_unsubscribe(struct afb_request *request, struct afb_event event)
+static inline int afb_request_unsubscribe(struct afb_request *request, struct afb_eventid *eventid)
 {
-       return request->itf->unsubscribe(request, event);
+       return request->itf->unsubscribe_eventid(request, eventid);
 }
 
 /*
@@ -276,9 +292,9 @@ static inline int afb_request_unsubscribe(struct afb_request *request, struct af
  *  - 'afb_request_subcall_req' that is convenient to keep request alive automatically.
  *  - 'afb_request_subcall_sync' the synchronous version
  */
-static inline void afb_request_subcall(struct afb_request *request, const char *api, const char *verb, struct json_object *args, void (*callback)(void *closure, int iserror, struct json_object *result), void *closure)
+static inline void afb_request_subcall(struct afb_request *request, const char *api, const char *verb, struct json_object *args, void (*callback)(void *closure, int iserror, struct json_object *result, struct afb_request *request), void *closure)
 {
-       request->itf->subcall(request, api, verb, args, callback, closure);
+       request->itf->subcall_request(request, api, verb, args, callback, closure);
 }
 
 /*