diff options
author | José Bollo <jose.bollo@iot.bzh> | 2018-04-09 18:16:07 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2018-06-15 17:57:36 +0200 |
commit | 4521c1e7ae5371ab9d639adc617d17fb4e8ded0c (patch) | |
tree | a8a1416a2d58c16ab3993c7e4dc405fc71daab6a /src/afb-api-so-vdyn.c | |
parent | 63682b4da9d3e892d1d0a671de860adc43068142 (diff) |
api-v3: First draft
This commit introduces the bindings v3 API for bindings.
The documentation has still to be improved and will come
very soon.
Change-Id: I8f9007370e29f671fdfd1da87fff7372a17db7af
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-api-so-vdyn.c')
-rw-r--r-- | src/afb-api-so-vdyn.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/afb-api-so-vdyn.c b/src/afb-api-so-vdyn.c index 300aa130..17344945 100644 --- a/src/afb-api-so-vdyn.c +++ b/src/afb-api-so-vdyn.c @@ -20,6 +20,10 @@ #include <stdlib.h> #include <dlfcn.h> +#define AFB_BINDING_VERSION 0 +#include <afb/afb-binding.h> + +#include "afb-api-so-v3.h" #include "afb-api-so-vdyn.h" #include "afb-export.h" #include "verbose.h" @@ -29,19 +33,15 @@ */ static const char afb_api_so_vdyn_entry[] = "afbBindingVdyn"; -/* - * Description of a binding - */ -static int vdyn_preinit(void *closure, struct afb_dynapi *dynapi) +static int preinit(void *closure, struct afb_api_x3 *api) { - int (*entry)(struct afb_dynapi*) = closure; - return entry(dynapi); + int (*entry)(struct afb_api_x3*) = closure; + return entry(api); } -int afb_api_so_vdyn_add(const char *path, void *handle, struct afb_apiset *apiset) +int afb_api_so_vdyn_add(const char *path, void *handle, struct afb_apiset *declare_set, struct afb_apiset * call_set) { - int rc; - int (*entry)(void*, struct afb_dynapi*); + int (*entry)(struct afb_api_x3*); struct afb_export *export; entry = dlsym(handle, afb_api_so_vdyn_entry); @@ -50,15 +50,12 @@ int afb_api_so_vdyn_add(const char *path, void *handle, struct afb_apiset *apise INFO("binding [%s] looks like an AFB binding Vdyn", path); - export = afb_export_create_vdyn(apiset, path, NULL); + export = afb_export_create_none_for_path(declare_set, call_set, path, preinit, entry); if (!export) { - ERROR("can't create export for %s", path); + INFO("binding [%s] creation failed", path); return -1; } - INFO("binding [%s] calling dynamic initialisation %s", path, afb_api_so_vdyn_entry); - rc = afb_export_preinit_vdyn(export, vdyn_preinit, entry); - afb_export_destroy(export); - return rc < 0 ? rc : 1; + return 1; } |