static struct afb_eventid *eventid_make_cb(void *closure, const char *name)
{
- size_t plen, nlen;
- char *event;
struct afb_export *export = closure;
/* check daemon state */
return NULL;
}
- /* makes the event name */
- plen = strlen(export->apiname);
- nlen = strlen(name);
- event = alloca(nlen + plen + 2);
- memcpy(event, export->apiname, plen);
- event[plen] = '/';
- memcpy(event + plen + 1, name, nlen + 1);
-
/* create the event */
- return afb_evt_eventid_create(event);
+ return afb_evt_eventid_create2(export->apiname, name);
}
static struct afb_event event_make_cb(void *closure, const char *name)
{
struct afb_eventid *eventid = eventid_make_cb(closure, name);
- return (struct afb_event){ .itf = eventid ? eventid->itf : NULL, .closure = eventid };
+ return afb_evt_event_from_evtid(afb_evt_eventid_to_evtid(eventid));
}
static int event_broadcast_cb(void *closure, const char *name, struct json_object *object)
errno = EINVAL;
return -1;
}
- if (!afb_api_is_valid_name(name)) {
+ if (!afb_api_is_valid_name(name, 1)) {
ERROR("[API %s] Can't rename to %s: bad API name", export->apiname, name);
errno = EINVAL;
return -1;
/* 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;
}
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 {