- /* 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 = pluginAfbV1RegisterFct(&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_VERSION_1) {
- ERROR("plugin [%s] invalid type %d...", path, desc->plugin->type);
- goto error3;
- }
- if (desc->plugin->v1.prefix == NULL || *desc->plugin->v1.prefix == 0) {
- ERROR("plugin [%s] bad prefix...", path);
- goto error3;
- }
- if (!afb_apis_is_valid_api_name(desc->plugin->v1.prefix)) {
- ERROR("plugin [%s] invalid prefix...", path);
- goto error3;
- }
- if (desc->plugin->v1.info == NULL || *desc->plugin->v1.info == 0) {
- ERROR("plugin [%s] bad description...", path);
- goto error3;
- }
- if (desc->plugin->v1.verbs == NULL) {
- ERROR("plugin [%s] no APIs...", path);
- goto error3;
- }
-
- /* records the plugin */
- desc->apilength = strlen(desc->plugin->v1.prefix);
- if (afb_apis_add(desc->plugin->v1.prefix, (struct afb_api){
- .closure = desc,
- .call = (void*)call}) < 0) {
- ERROR("plugin [%s] can't be registered...", path);
- goto error3;
- }
- NOTICE("plugin %s loaded with API prefix %s", path, desc->plugin->v1.prefix);
- return 0;