template <class T>
inline void call(const char *api, const char *verb, struct json_object *args, void (*callback)(T*closure, struct json_object *result, const char *error, const char *info, afb_api_t api), T *closure)
{
- afb_service_call(api, verb, args, reinterpret_cast<void(*)(void*,int,json_object*,afb_api_t)>(callback), reinterpret_cast<void*>(closure));
+ afb_service_call(api, verb, args, reinterpret_cast<void(*)(void*,json_object*,const char*, const char*,afb_api_t)>(callback), reinterpret_cast<void*>(closure));
}
inline bool callsync(const char *api, const char *verb, struct json_object *args, struct json_object *&result, char *&error, char *&info)
return r;
}
+#if AFB_BINDING_VERSION >= 3
+void __afb__verb__cb__for__global__(afb_req_t r)
+{
+ void *vcbdata;
+ void (*callback)(req);
+
+ vcbdata = afb_req_get_vcbdata(r);
+ callback = reinterpret_cast<void(*)(req)>(vcbdata);
+ callback(req(r));
+}
+
+constexpr afb_verb_t verb(
+ const char *name,
+ void (&callback)(req),
+ const char *info = nullptr,
+ uint16_t session = 0,
+ const afb_auth *auth = nullptr
+ ,
+ bool glob = false,
+ void *vcbdata = nullptr
+)
+{
+ return verb(
+ name,
+ __afb__verb__cb__for__global__,
+ info,
+ session,
+ auth,
+ glob,
+ reinterpret_cast<void*>(&callback)
+ );
+}
+#endif
+
constexpr afb_verb_t verbend()
{
afb_verb_t r = verb(nullptr, nullptr);