Update copyright dates
[src/app-framework-binder.git] / src / afb-api-so-vdyn.c
index 300aa13..c5aa1db 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016, 2017, 2018 "IoT.bzh"
+ * Copyright (C) 2015-2020 "IoT.bzh"
  * Author José Bollo <jose.bollo@iot.bzh>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * limitations under the License.
  */
 
+#if WITH_LEGACY_BINDING_VDYN && WITH_DYNAMIC_BINDING
+
 #define _GNU_SOURCE
 
 #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"
  */
 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 +52,14 @@ 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;
 }
 
+#endif
+