Change-Id: Ie437a6987df7f27a4a68b9c022d8cad8ab4f2cfe
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
}
/* get the event handler if any */
}
/* get the event handler if any */
- desc->service = afb_svc_create_v1(apiset, share_session, init, onevent);
+ desc->service = afb_svc_create_v1(desc->binding->v1.prefix, apiset, share_session, init, onevent);
if (desc->service == NULL) {
/* starting error */
ERROR("Starting service %s failed", desc->binding->v1.prefix);
if (desc->service == NULL) {
/* starting error */
ERROR("Starting service %s failed", desc->binding->v1.prefix);
}
/* get the event handler if any */
}
/* get the event handler if any */
- desc->service = afb_svc_create_v2(apiset, share_session, start, onevent, desc->data);
+ desc->service = afb_svc_create_v2(desc->binding->api, apiset, share_session, start, onevent, desc->data);
if (desc->service == NULL) {
/* starting error */
ERROR("Starting service %s failed", desc->binding->api);
if (desc->service == NULL) {
/* starting error */
ERROR("Starting service %s failed", desc->binding->api);
+ /* api/prefix */
+ const char *api;
+
/* session of the service */
struct afb_session *session;
/* session of the service */
struct afb_session *session;
* Allocates a new service
*/
static struct afb_svc *afb_svc_alloc(
* Allocates a new service
*/
static struct afb_svc *afb_svc_alloc(
struct afb_apiset *apiset,
int share_session
)
struct afb_apiset *apiset,
int share_session
)
}
/* instanciate the apiset */
}
/* instanciate the apiset */
svc->apiset = afb_apiset_addref(apiset);
/* instanciate the session */
svc->apiset = afb_apiset_addref(apiset);
/* instanciate the session */
* Creates a new service
*/
struct afb_svc *afb_svc_create_v1(
* Creates a new service
*/
struct afb_svc *afb_svc_create_v1(
- struct afb_apiset *apiset,
- int share_session,
- int (*start)(struct afb_service service),
- void (*on_event)(const char *event, struct json_object *object)
+ const char *api,
+ struct afb_apiset *apiset,
+ int share_session,
+ int (*start)(struct afb_service service),
+ void (*on_event)(const char *event, struct json_object *object)
)
{
int rc;
struct afb_svc *svc;
/* allocates the svc handler */
)
{
int rc;
struct afb_svc *svc;
/* allocates the svc handler */
- svc = afb_svc_alloc(apiset, share_session);
+ svc = afb_svc_alloc(api, apiset, share_session);
if (svc == NULL)
goto error;
if (svc == NULL)
goto error;
* Creates a new service
*/
struct afb_svc *afb_svc_create_v2(
* Creates a new service
*/
struct afb_svc *afb_svc_create_v2(
struct afb_apiset *apiset,
int share_session,
int (*start)(),
struct afb_apiset *apiset,
int share_session,
int (*start)(),
struct afb_svc *svc;
/* allocates the svc handler */
struct afb_svc *svc;
/* allocates the svc handler */
- svc = afb_svc_alloc(apiset, share_session);
+ svc = afb_svc_alloc(api, apiset, share_session);
if (svc == NULL)
goto error;
data->service = to_afb_service(svc);
if (svc == NULL)
goto error;
data->service = to_afb_service(svc);
struct afb_binding_data_v2;
extern struct afb_svc *afb_svc_create_v1(
struct afb_binding_data_v2;
extern struct afb_svc *afb_svc_create_v1(
struct afb_apiset *apiset,
int share_session,
int (*start)(struct afb_service service),
void (*on_event)(const char *event, struct json_object *object));
extern struct afb_svc *afb_svc_create_v2(
struct afb_apiset *apiset,
int share_session,
int (*start)(struct afb_service service),
void (*on_event)(const char *event, struct json_object *object));
extern struct afb_svc *afb_svc_create_v2(
struct afb_apiset *apiset,
int share_session,
int (*start)(),
struct afb_apiset *apiset,
int share_session,
int (*start)(),