+extern int afb_xreq_subscribe(struct afb_xreq *xreq, struct afb_event_x2 *event);
+extern int afb_xreq_unsubscribe(struct afb_xreq *xreq, struct afb_event_x2 *event);
+
+extern void afb_xreq_legacy_subcall(
+ struct afb_xreq *xreq,
+ const char *api,
+ const char *verb,
+ struct json_object *args,
+ void (*callback)(void*, int, struct json_object*, struct afb_req_x2 *),
+ void *cb_closure);
+extern void afb_xreq_unhooked_legacy_subcall(
+ struct afb_xreq *xreq,
+ const char *api,
+ const char *verb,
+ struct json_object *args,
+ void (*callback)(void*, int, struct json_object*, struct afb_req_x2 *),
+ void *cb_closure);
+
+extern void afb_xreq_subcall(
+ struct afb_xreq *xreq,
+ const char *api,
+ const char *verb,
+ struct json_object *args,
+ int flags,
+ void (*callback)(void*, struct json_object*, const char*, const char*, struct afb_req_x2 *),
+ void *closure);
+extern void afb_xreq_unhooked_subcall(
+ struct afb_xreq *xreq,
+ const char *api,
+ const char *verb,
+ struct json_object *args,
+ int flags,
+ void (*callback)(void*, struct json_object*, const char*, const char*, struct afb_req_x2 *),
+ void *closure);
+
+extern int afb_xreq_unhooked_legacy_subcall_sync(
+ struct afb_xreq *xreq,
+ const char *api,
+ const char *verb,
+ struct json_object *args,
+ struct json_object **result);
+extern int afb_xreq_legacy_subcall_sync(
+ struct afb_xreq *xreq,
+ const char *api,
+ const char *verb,
+ struct json_object *args,
+ struct json_object **result);
+
+/* initialisation and processing of xreq */
+extern void afb_xreq_init(struct afb_xreq *xreq, const struct afb_xreq_query_itf *queryitf);
+
+extern void afb_xreq_process(struct afb_xreq *xreq, struct afb_apiset *apiset);
+
+#if WITH_LEGACY_BINDING_V1
+extern void afb_xreq_call_verb_v1(struct afb_xreq *xreq, const struct afb_verb_desc_v1 *verb);
+#endif
+#if WITH_LEGACY_BINDING_V2
+extern void afb_xreq_call_verb_v2(struct afb_xreq *xreq, const struct afb_verb_v2 *verb);
+#endif
+
+extern void afb_xreq_call_verb_v3(struct afb_xreq *xreq, const struct afb_verb_v3 *verb);
+
+extern const char *xreq_on_behalf_cred_export(struct afb_xreq *xreq);
+
+/******************************************************************************/
+
+static inline struct afb_req_x1 xreq_to_req_x1(struct afb_xreq *xreq)
+{
+ return (struct afb_req_x1){ .itf = xreq->request.itf, .closure = &xreq->request };
+}
+
+static inline struct afb_req_x2 *xreq_to_req_x2(struct afb_xreq *xreq)
+{
+ return &xreq->request;
+}
+
+static inline struct afb_xreq *xreq_from_req_x2(struct afb_req_x2 *req)
+{
+ return CONTAINER_OF(struct afb_xreq, request, req);
+}