Add synchronous subcalls
[src/app-framework-binder.git] / src / afb-subcall.h
index 0de51da..bf3d8cd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 "IoT.bzh"
+ * Copyright (C) 2016, 2017 "IoT.bzh"
  * Author: José Bollo <jose.bollo@iot.bzh>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
 
 #pragma once
 
-struct afb_context;
-struct afb_req;
+struct afb_xreq;
 struct json_object;
 
-extern void afb_subcall(struct afb_context *context, const char *api, const char *verb, struct json_object *args, void (*callback)(void*, int, struct json_object*), void *closure, struct afb_req req);
+extern void afb_subcall(
+               struct afb_xreq *caller,
+               const char *api,
+               const char *verb,
+               struct json_object *args,
+               void (*callback)(void*, int, struct json_object*),
+               void *closure);
 
-extern void afb_subcall_internal_error(void (*callback)(void*, int, struct json_object*), void *closure);
+extern int afb_subcall_sync(
+               struct afb_xreq *caller,
+               const char *api,
+               const char *verb,
+               struct json_object *args,
+               struct json_object **result);