Provision is made here to convert, trivially:
afb_event -> afb_eventid*
afb_req -> afb_request*
The opposite conversions aren't provided to
favor new interfaces.
Change-Id: Ib67c2317f782e2edfd1ba0e49e10b321a3b770a3
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
struct afb_eventid *closure; /* the closure argument for functions of 'itf' */
};
struct afb_eventid *closure; /* the closure argument for functions of 'itf' */
};
+/*
+ * Converts the 'event' to an afb_eventid.
+ */
+static inline struct afb_eventid *afb_event_to_eventid(struct afb_event event)
+{
+ return event.closure;
+}
+
/*
* Checks wether the 'event' is valid or not.
*
/*
* Checks wether the 'event' is valid or not.
*
struct afb_request *closure; /* the closure argument for functions of 'itf' */
};
struct afb_request *closure; /* the closure argument for functions of 'itf' */
};
+/*
+ * Converts the 'req' to an afb_request.
+ */
+static inline struct afb_request *afb_req_to_request(struct afb_req req)
+{
+ return req.closure;
+}
+
/*
* Checks whether the request 'req' is valid or not.
*
/*
* Checks whether the request 'req' is valid or not.
*
#include <pthread.h>
#include <json-c/json.h>
#include <pthread.h>
#include <json-c/json.h>
-#include <afb/afb-binding-v2.h>
+#define AFB_BINDING_VERSION 0
+#include <afb/afb-binding.h>
#include "afb-hook.h"
#include "afb-cred.h"
#include "afb-hook.h"
#include "afb-cred.h"
*/
static struct event *trace_get_event(struct afb_trace *trace, const char *name, int alloc)
{
*/
static struct event *trace_get_event(struct afb_trace *trace, const char *name, int alloc)
{
struct event *event;
/* search the event */
struct event *event;
/* search the event */
if (!event && alloc) {
event = malloc(sizeof * event);
if (event) {
if (!event && alloc) {
event = malloc(sizeof * event);
if (event) {
- event->evtid = afb_evt_to_evtid(trace->daemon->itf->event_make(trace->daemon->closure, name).closure);
+ e = afb_daemon_make_event_v1(*trace->daemon, name);
+ event->evtid = afb_evt_to_evtid(afb_event_to_eventid(e));
if (event->evtid) {
event->next = trace->events;
trace->events = event;
if (event->evtid) {
event->next = trace->events;
trace->events = event;
static int xreq_subscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid);
static int xreq_subscribe_cb(struct afb_request *closure, struct afb_event event)
{
static int xreq_subscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid);
static int xreq_subscribe_cb(struct afb_request *closure, struct afb_event event)
{
- return xreq_subscribe_eventid_cb(closure, event.closure);
+ return xreq_subscribe_eventid_cb(closure, afb_event_to_eventid(event));
}
static int xreq_subscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid)
}
static int xreq_subscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid)
static int xreq_unsubscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid);
static int xreq_unsubscribe_cb(struct afb_request *closure, struct afb_event event)
{
static int xreq_unsubscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid);
static int xreq_unsubscribe_cb(struct afb_request *closure, struct afb_event event)
{
- return xreq_unsubscribe_eventid_cb(closure, event.closure);
+ return xreq_unsubscribe_eventid_cb(closure, afb_event_to_eventid(event));
}
static int xreq_unsubscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid)
}
static int xreq_unsubscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid)
static int xreq_hooked_subscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid);
static int xreq_hooked_subscribe_cb(struct afb_request *closure, struct afb_event event)
{
static int xreq_hooked_subscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid);
static int xreq_hooked_subscribe_cb(struct afb_request *closure, struct afb_event event)
{
- return xreq_hooked_subscribe_eventid_cb(closure, event.closure);
+ return xreq_hooked_subscribe_eventid_cb(closure, afb_event_to_eventid(event));
}
static int xreq_hooked_subscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid)
}
static int xreq_hooked_subscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid)
static int xreq_hooked_unsubscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid);
static int xreq_hooked_unsubscribe_cb(struct afb_request *closure, struct afb_event event)
{
static int xreq_hooked_unsubscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid);
static int xreq_hooked_unsubscribe_cb(struct afb_request *closure, struct afb_event event)
{
- return xreq_hooked_unsubscribe_eventid_cb(closure, event.closure);
+ return xreq_hooked_unsubscribe_eventid_cb(closure, afb_event_to_eventid(event));
}
static int xreq_hooked_unsubscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid)
}
static int xreq_hooked_unsubscribe_eventid_cb(struct afb_request *closure, struct afb_eventid *eventid)