afb-session: redefine the function 'afb_session_create'
[src/app-framework-binder.git] / src / afb-export.c
index 5688cfe..3a898bb 100644 (file)
@@ -173,7 +173,7 @@ static struct afb_eventid *eventid_make_cb(void *closure, const char *name)
        memcpy(event + plen + 1, name, nlen + 1);
 
        /* create the event */
-       return afb_evt_create_event(event);
+       return afb_evt_eventid_create(event);
 }
 
 static struct afb_event event_make_cb(void *closure, const char *name)
@@ -255,11 +255,12 @@ static int api_new_api_cb(
                void *closure,
                const char *api,
                const char *info,
+               int noconcurrency,
                int (*preinit)(void*, struct afb_dynapi *),
                void *preinit_closure)
 {
        struct afb_export *export = closure;
-       return afb_api_dyn_add(export->apiset, api, info, preinit, preinit_closure);
+       return afb_api_dyn_add(export->apiset, api, info, noconcurrency, preinit, preinit_closure);
 }
 
 /**********************************************
@@ -376,11 +377,12 @@ static int hooked_api_new_api_cb(
                void *closure,
                const char *api,
                const char *info,
+               int noconcurrency,
                int (*preinit)(void*, struct afb_dynapi *),
                void *preinit_closure)
 {
        /* TODO */
-       return api_new_api_cb(closure, api, info, preinit, preinit_closure);
+       return api_new_api_cb(closure, api, info, noconcurrency, preinit, preinit_closure);
 }
 /**********************************************
 * vectors
@@ -568,10 +570,10 @@ static struct call_req *callreq_create(
                callreq->xreq.context.validated = 1;
                copy = (char*)&callreq[1];
                memcpy(copy, api, lenapi);
-               callreq->xreq.api = copy;
+               callreq->xreq.request.api = copy;
                copy = &copy[lenapi];
                memcpy(copy, verb, lenverb);
-               callreq->xreq.verb = copy;
+               callreq->xreq.request.verb = copy;
                callreq->xreq.listener = export->listener;
                callreq->xreq.json = args;
                callreq->export = export;
@@ -841,13 +843,14 @@ static int api_add_verb_cb(
                const char *verb,
                const char *info,
                void (*callback)(struct afb_request *request),
+               void *vcbdata,
                const struct afb_auth *auth,
                uint32_t session)
 {
        struct afb_export *export = from_dynapi(dynapi);
 
        if (export->apidyn)
-               return afb_api_dyn_add_verb(export->apidyn, verb, info, callback, auth, session);
+               return afb_api_dyn_add_verb(export->apidyn, verb, info, callback, vcbdata, auth, session);
 
        errno = EPERM;
        return -1;
@@ -904,11 +907,12 @@ static int hooked_api_add_verb_cb(
                const char *verb,
                const char *info,
                void (*callback)(struct afb_request *request),
+               void *vcbdata,
                const struct afb_auth *auth,
                uint32_t session)
 {
        /* TODO */
-       return api_add_verb_cb(dynapi, verb, info, callback, auth, session);
+       return api_add_verb_cb(dynapi, verb, info, callback, vcbdata, auth, session);
 }
 
 static int hooked_api_sub_verb_cb(
@@ -1068,7 +1072,7 @@ static struct afb_export *create(struct afb_apiset *apiset, const char *apiname,
 
        /* session shared with other exports */
        if (common_session == NULL) {
-               common_session = afb_session_create (NULL, 0);
+               common_session = afb_session_create (0);
                if (common_session == NULL)
                        return NULL;
        }
@@ -1078,6 +1082,7 @@ static struct afb_export *create(struct afb_apiset *apiset, const char *apiname,
        else {
                memset(export, 0, sizeof *export);
                export->apiname = strdup(apiname);
+               export->dynapi.apiname = export->apiname;
                export->version = version;
                export->state = Api_State_Pre_Init;
                export->session = afb_session_addref(common_session);
@@ -1142,6 +1147,7 @@ void afb_export_rename(struct afb_export *export, const char *apiname)
 {
        free(export->apiname);
        export->apiname = strdup(apiname);
+       export->dynapi.apiname = export->apiname;
        afb_export_update_hook(export);
 }
 
@@ -1175,7 +1181,7 @@ struct afb_binding_interface_v1 *afb_export_get_interface_v1(struct afb_export *
 int afb_export_unshare_session(struct afb_export *export)
 {
        if (export->session == common_session) {
-               export->session = afb_session_create (NULL, 0);
+               export->session = afb_session_create (0);
                if (export->session)
                        afb_session_unref(common_session);
                else {