uint64_t msgid;
int rc;
- rc = afb_evt_event_x2_add_watch(dreq->listener->listener, event);
+ rc = afb_evt_listener_watch_x2(dreq->listener->listener, event);
sd_bus_message_get_cookie(dreq->message, &msgid);
afb_api_dbus_server_event_send(dreq->listener->origin, 'S', afb_evt_event_x2_fullname(event), afb_evt_event_x2_id(event), "", msgid);
return rc;
sd_bus_message_get_cookie(dreq->message, &msgid);
afb_api_dbus_server_event_send(dreq->listener->origin, 'U', afb_evt_event_x2_fullname(event), afb_evt_event_x2_id(event), "", msgid);
- rc = afb_evt_event_x2_remove_watch(dreq->listener->listener, event);
+ rc = afb_evt_listener_unwatch_x2(dreq->listener->listener, event);
return rc;
}
* Makes the 'listener' watching 'evtid'
* Returns 0 in case of success or else -1.
*/
-int afb_evt_watch_add_evtid(struct afb_evt_listener *listener, struct afb_evtid *evtid)
+int afb_evt_listener_watch_evt(struct afb_evt_listener *listener, struct afb_evtid *evtid)
{
struct afb_evt_watch *watch;
* Avoids the 'listener' to watch 'evtid'
* Returns 0 in case of success or else -1.
*/
-int afb_evt_watch_sub_evtid(struct afb_evt_listener *listener, struct afb_evtid *evtid)
+int afb_evt_listener_unwatch_evt(struct afb_evt_listener *listener, struct afb_evtid *evtid)
{
struct afb_evt_watch *watch;
* Avoids the 'listener' to watch 'eventid'
* Returns 0 in case of success or else -1.
*/
-int afb_evt_watch_sub_eventid(struct afb_evt_listener *listener, uint16_t eventid)
+int afb_evt_listener_unwatch_id(struct afb_evt_listener *listener, uint16_t eventid)
{
struct afb_evt_watch *watch;
struct afb_evtid *evtid;
* Makes the 'listener' watching 'eventid'
* Returns 0 in case of success or else -1.
*/
-int afb_evt_event_x2_add_watch(struct afb_evt_listener *listener, struct afb_event_x2 *eventid)
+int afb_evt_listener_watch_x2(struct afb_evt_listener *listener, struct afb_event_x2 *eventid)
{
struct afb_evtid *evtid = afb_evt_event_x2_to_evtid(eventid);
}
/* search the existing watch for the listener */
- return afb_evt_watch_add_evtid(listener, evtid);
+ return afb_evt_listener_watch_evt(listener, evtid);
}
/*
* Avoids the 'listener' to watch 'eventid'
* Returns 0 in case of success or else -1.
*/
-int afb_evt_event_x2_remove_watch(struct afb_evt_listener *listener, struct afb_event_x2 *eventid)
+int afb_evt_listener_unwatch_x2(struct afb_evt_listener *listener, struct afb_event_x2 *eventid)
{
struct afb_evtid *evtid = afb_evt_event_x2_to_evtid(eventid);
}
/* search the existing watch */
- return afb_evt_watch_sub_evtid(listener, evtid);
+ return afb_evt_listener_unwatch_evt(listener, evtid);
}
int afb_evt_event_x2_push(struct afb_event_x2 *eventid, struct json_object *object)
extern int afb_evt_evtid_broadcast(struct afb_evtid *evtid, struct json_object *object);
-extern int afb_evt_watch_add_evtid(struct afb_evt_listener *listener, struct afb_evtid *evtid);
-extern int afb_evt_watch_sub_evtid(struct afb_evt_listener *listener, struct afb_evtid *evtid);
-extern int afb_evt_watch_sub_eventid(struct afb_evt_listener *listener, uint16_t eventid);
-
+extern int afb_evt_listener_watch_evt(struct afb_evt_listener *listener, struct afb_evtid *evtid);
+extern int afb_evt_listener_unwatch_evt(struct afb_evt_listener *listener, struct afb_evtid *evtid);
+extern int afb_evt_listener_unwatch_id(struct afb_evt_listener *listener, uint16_t eventid);
extern struct afb_event_x2 *afb_evt_event_x2_create(const char *fullname);
extern struct afb_event_x2 *afb_evt_event_x2_create2(const char *prefix, const char *name);
extern int afb_evt_event_x2_push(struct afb_event_x2 *eventid, struct json_object *object);
extern int afb_evt_event_x2_unhooked_push(struct afb_event_x2 *eventid, struct json_object *object);
-extern int afb_evt_event_x2_add_watch(struct afb_evt_listener *listener, struct afb_event_x2 *eventid);
-extern int afb_evt_event_x2_remove_watch(struct afb_evt_listener *listener, struct afb_event_x2 *eventid);
+extern int afb_evt_listener_watch_x2(struct afb_evt_listener *listener, struct afb_event_x2 *eventid);
+extern int afb_evt_listener_unwatch_x2(struct afb_evt_listener *listener, struct afb_event_x2 *eventid);
extern struct afb_evtid *afb_evt_event_x2_to_evtid(struct afb_event_x2 *eventid);
extern struct afb_event_x2 *afb_evt_event_x2_from_evtid(struct afb_evtid *evtid);
int afb_export_subscribe(struct afb_export *export, struct afb_event_x2 *event)
{
- return afb_evt_event_x2_add_watch(export->listener, event);
+ return afb_evt_listener_watch_x2(export->listener, event);
}
int afb_export_unsubscribe(struct afb_export *export, struct afb_event_x2 *event)
{
- return afb_evt_event_x2_remove_watch(export->listener, event);
+ return afb_evt_listener_unwatch_x2(export->listener, event);
}
void afb_export_process_xreq(struct afb_export *export, struct afb_xreq *xreq)
int rc;
struct server_req *wreq = CONTAINER_OF_XREQ(struct server_req, xreq);
- rc = afb_evt_event_x2_add_watch(wreq->stubws->listener, event);
+ rc = afb_evt_listener_watch_x2(wreq->stubws->listener, event);
if (rc >= 0)
rc = afb_proto_ws_call_subscribe(wreq->call, afb_evt_event_x2_id(event));
if (rc < 0)
struct server_req *wreq = CONTAINER_OF_XREQ(struct server_req, xreq);
rc = afb_proto_ws_call_unsubscribe(wreq->call, afb_evt_event_x2_id(event));
- rc2 = afb_evt_event_x2_remove_watch(wreq->stubws->listener, event);
+ rc2 = afb_evt_listener_unwatch_x2(wreq->stubws->listener, event);
if (rc >= 0 && rc2 < 0)
rc = rc2;
if (rc < 0)
{
struct afb_stub_ws *stubws = closure;
- afb_evt_watch_sub_eventid(stubws->listener, eventid);
+ afb_evt_listener_unwatch_id(stubws->listener, eventid);
}
static void server_on_call_cb(void *closure, struct afb_proto_ws_call *call, const char *verb, struct json_object *args, uint16_t sessionid, uint16_t tokenid, const char *user_creds)
{
struct afb_wsreq *wsreq = CONTAINER_OF_XREQ(struct afb_wsreq, xreq);
- return afb_evt_event_x2_add_watch(wsreq->aws->listener, event);
+ return afb_evt_listener_watch_x2(wsreq->aws->listener, event);
}
static int wsreq_unsubscribe(struct afb_xreq *xreq, struct afb_event_x2 *event)
{
struct afb_wsreq *wsreq = CONTAINER_OF_XREQ(struct afb_wsreq, xreq);
- return afb_evt_event_x2_remove_watch(wsreq->aws->listener, event);
+ return afb_evt_listener_unwatch_x2(wsreq->aws->listener, event);
}