- /* allocates the interface */
- interface = calloc(1, sizeof *interface);
- if (interface == NULL) {
- fprintf(stderr, "ERROR: plugin [%s] memory missing. continuing...\n", path);
- goto error2;
- }
- interface->verbosity = 0;
- interface->mode = AFB_MODE_LOCAL;
- interface->poll_open = itf_poll_open;
-
- /* init the plugin */
- plugin = pluginRegisterFct(interface);
- if (plugin == NULL) {
- fprintf(stderr, "ERROR: plugin [%s] register function failed. continuing...\n", path);
- goto error3;
- }
-
- /* check the returned structure */
- if (plugin->type != AFB_PLUGIN_JSON) {
- fprintf(stderr, "ERROR: plugin [%s] invalid type %d...\n", path, plugin->type);
- goto error3;
- }
- if (plugin->prefix == NULL || *plugin->prefix == 0) {
- fprintf(stderr, "ERROR: plugin [%s] bad prefix...\n", path);
- goto error3;
- }
- if (plugin->info == NULL || *plugin->info == 0) {
- fprintf(stderr, "ERROR: plugin [%s] bad description...\n", path);
- goto error3;
- }
- if (plugin->apis == NULL) {
- fprintf(stderr, "ERROR: plugin [%s] no APIs...\n", path);
- goto error3;
- }
-
- /* check previously existing plugin */
- for (i = 0 ; i < apis_count ; i++) {
- if (!strcasecmp(apis_array[i].prefix, plugin->prefix)) {
- fprintf(stderr, "ERROR: plugin [%s] prefix %s duplicated...\n", path, plugin->prefix);
- goto error2;
- }
- }
-