- /* retrieves the register function */
- pluginRegisterFct = dlsym(desc->handle, plugin_register_function);
- if (!pluginRegisterFct) {
- ERROR("plugin [%s] is not an AFB plugin", path);
- goto error3;
- }
- INFO("plugin [%s] is a valid AFB plugin", path);
-
- /* init the interface */
- desc->interface.verbosity = 0;
- desc->interface.mode = AFB_MODE_LOCAL;
- desc->interface.daemon.itf = &daemon_itf;
- desc->interface.daemon.closure = desc;
-
- /* init the plugin */
- desc->plugin = pluginRegisterFct(&desc->interface);
- if (desc->plugin == NULL) {
- ERROR("plugin [%s] register function failed. continuing...", path);
- goto error3;
- }
-
- /* check the returned structure */
- if (desc->plugin->type != AFB_PLUGIN_JSON) {
- ERROR("plugin [%s] invalid type %d...", path, desc->plugin->type);
- goto error3;
- }
- if (desc->plugin->prefix == NULL || *desc->plugin->prefix == 0) {
- ERROR("plugin [%s] bad prefix...", path);
- goto error3;
- }
- if (desc->plugin->info == NULL || *desc->plugin->info == 0) {
- ERROR("plugin [%s] bad description...", path);
- goto error3;
- }
- if (desc->plugin->apis == NULL) {
- ERROR("plugin [%s] no APIs...", path);
- goto error3;
+ /* try the version 1 */
+ rc = afb_api_so_v1_add(path, handle, apiset);
+ if (rc < 0) {
+ /* error when loading a valid v1 binding */
+ goto error2;