X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-api-so.c;h=88246b58c33758d914e35c9d9ae32cf9b85511ae;hb=5eaa2c12a8b89f8a16f0759db88d65b56c82918c;hp=c3cb08d724fedb147ba79c266bd6fced4193f65b;hpb=46d9538587a3521caa1e3b20bf337a53ed400777;p=src%2Fapp-framework-binder.git diff --git a/src/afb-api-so.c b/src/afb-api-so.c index c3cb08d7..88246b58 100644 --- a/src/afb-api-so.c +++ b/src/afb-api-so.c @@ -46,6 +46,7 @@ extern __thread sigjmp_buf *error_handler; struct api_so_desc { struct AFB_plugin *plugin; /* descriptor */ + size_t apilength; void *handle; /* context of dlopen */ struct AFB_interface interface; /* interface */ }; @@ -65,6 +66,16 @@ static const struct afb_pollmgr_itf pollmgr_itf = { static void afb_api_so_evmgr_push(struct api_so_desc *desc, const char *name, struct json_object *object) { + size_t length; + char *event; + + assert(desc->plugin != NULL); + length = strlen(name); + event = alloca(length + 2 + desc->apilength); + memcpy(event, desc->plugin->prefix, desc->apilength); + event[desc->apilength] = '/'; + memcpy(event + desc->apilength + 1, name, length + 1); + ctxClientEventSend(NULL, event, object); } static const struct afb_evmgr_itf evmgr_itf = { @@ -224,6 +235,7 @@ int afb_api_so_add_plugin(const char *path) } /* records the plugin */ + desc->apilength = strlen(desc->plugin->prefix); if (afb_apis_add(desc->plugin->prefix, (struct afb_api){ .closure = desc, .call = (void*)call}) < 0) {