xreq: export a function to get req
[src/app-framework-binder.git] / src / afb-xreq.h
index 4e79686..6da614e 100644 (file)
@@ -18,6 +18,7 @@
 #pragma once
 
 #include <afb/afb-request-itf.h>
+#include <afb/afb-req-itf.h>
 #include "afb-context.h"
 
 struct json_object;
@@ -147,6 +148,13 @@ extern void afb_xreq_call_verb_v1(struct afb_xreq *xreq, const struct afb_verb_d
 extern void afb_xreq_call_verb_v2(struct afb_xreq *xreq, const struct afb_verb_v2 *verb);
 extern void afb_xreq_call_verb_vdyn(struct afb_xreq *xreq, const struct afb_api_dyn_verb *verb);
 
+/******************************************************************************/
+
+static inline struct afb_req xreq_to_req(struct afb_xreq *xreq)
+{
+       return (struct afb_req){ .itf = xreq->request.itf, .closure = &xreq->request };
+}
+
 static inline struct afb_request *xreq_to_request(struct afb_xreq *xreq)
 {
        return &xreq->request;