Change-Id: I058eaee990e34990d0860a316ba8c348c23eff5f
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
/* allocates the description */
init = dlsym(handle, afb_api_so_v1_service_init);
onevent = dlsym(handle, afb_api_so_v1_service_event);
/* allocates the description */
init = dlsym(handle, afb_api_so_v1_service_init);
onevent = dlsym(handle, afb_api_so_v1_service_event);
- export = afb_export_create_v1(path, init, onevent);
+ export = afb_export_create_v1(apiset, path, init, onevent);
desc = calloc(1, sizeof *desc);
if (desc == NULL || export == NULL) {
ERROR("out of memory");
desc = calloc(1, sizeof *desc);
if (desc == NULL || export == NULL) {
ERROR("out of memory");
assert(data);
/* allocates the description */
assert(data);
/* allocates the description */
- export = afb_export_create_v2(binding->api, data, binding->init, binding->onevent);
+ export = afb_export_create_v2(apiset, binding->api, data, binding->init, binding->onevent);
desc = calloc(1, sizeof *desc);
if (!desc || !export) {
ERROR("out of memory");
desc = calloc(1, sizeof *desc);
if (!desc || !export) {
ERROR("out of memory");
#include "jobs.h"
#include "verbose.h"
#include "jobs.h"
#include "verbose.h"
-extern struct afb_apiset *main_apiset;
/*************************************************************************
* internal types and structures
/*************************************************************************
* internal types and structures
errno = EINVAL;
return -1;
}
errno = EINVAL;
return -1;
}
- return -!(initialized ? afb_apiset_lookup_started : afb_apiset_lookup)(main_apiset, name, 1);
+ return -!(initialized ? afb_apiset_lookup_started : afb_apiset_lookup)(export->apiset, name, 1);
}
static int rename_api_cb(void *closure, const char *name)
}
static int rename_api_cb(void *closure, const char *name)
*************************************************************************************************************
*************************************************************************************************************/
*************************************************************************************************************
*************************************************************************************************************/
-static struct afb_export *create(const char *apiname, enum afb_api_version version)
+static struct afb_export *create(struct afb_apiset *apiset, const char *apiname, enum afb_api_version version)
{
struct afb_export *export;
{
struct afb_export *export;
export->version = version;
export->state = Api_State_Pre_Init;
export->session = afb_session_addref(common_session);
export->version = version;
export->state = Api_State_Pre_Init;
export->session = afb_session_addref(common_session);
- export->apiset = afb_apiset_addref(main_apiset);
+ export->apiset = afb_apiset_addref(apiset);
-struct afb_export *afb_export_create_v1(const char *apiname, int (*init)(struct afb_service), void (*onevent)(const char*, struct json_object*))
+struct afb_export *afb_export_create_v1(struct afb_apiset *apiset, const char *apiname, int (*init)(struct afb_service), void (*onevent)(const char*, struct json_object*))
- struct afb_export *export = create(apiname, Api_Version_1);
+ struct afb_export *export = create(apiset, apiname, Api_Version_1);
if (export) {
export->init.v1 = init;
export->on_event.v12 = onevent;
if (export) {
export->init.v1 = init;
export->on_event.v12 = onevent;
-struct afb_export *afb_export_create_v2(const char *apiname, struct afb_binding_data_v2 *data, int (*init)(), void (*onevent)(const char*, struct json_object*))
+struct afb_export *afb_export_create_v2(struct afb_apiset *apiset, const char *apiname, struct afb_binding_data_v2 *data, int (*init)(), void (*onevent)(const char*, struct json_object*))
- struct afb_export *export = create(apiname, Api_Version_2);
+ struct afb_export *export = create(apiset, apiname, Api_Version_2);
if (export) {
export->init.v2 = init;
export->on_event.v12 = onevent;
if (export) {
export->init.v2 = init;
export->on_event.v12 = onevent;
struct afb_binding_data_v2;
struct afb_binding_interface_v1;
struct afb_binding_data_v2;
struct afb_binding_interface_v1;
-extern struct afb_export *afb_export_create_v1(const char *apiname, int (*init)(struct afb_service), void (*onevent)(const char*, struct json_object*));
-extern struct afb_export *afb_export_create_v2(const char *apiname, struct afb_binding_data_v2 *data, int (*init)(), void (*onevent)(const char*, struct json_object*));
+extern struct afb_export *afb_export_create_v1(struct afb_apiset *apiset, const char *apiname, int (*init)(struct afb_service), void (*onevent)(const char*, struct json_object*));
+extern struct afb_export *afb_export_create_v2(struct afb_apiset *apiset, const char *apiname, struct afb_binding_data_v2 *data, int (*init)(), void (*onevent)(const char*, struct json_object*));
+
extern void afb_export_destroy(struct afb_export *export);
extern const char *afb_export_apiname(const struct afb_export *export);
extern void afb_export_destroy(struct afb_export *export);
extern const char *afb_export_apiname(const struct afb_export *export);