struct json_object;
-struct afb_evmgr_itf {
- void (*push)(void *evmgr, const char *name, struct json_object *object);
+struct afb_event_sender_itf {
+ void (*push)(void *event_sender, const char *name, struct json_object *object);
};
-struct afb_evmgr {
- const struct afb_evmgr_itf *itf;
+struct afb_event_sender {
+ const struct afb_event_sender_itf *itf;
void *closure;
};
-static inline void afb_evmgr_push(struct afb_evmgr mgr, const char *name, struct json_object *object)
+static inline void afb_event_sender_push(struct afb_event_sender mgr, const char *name, struct json_object *object)
{
return mgr.itf->push(mgr.closure, name, object);
}
#pragma once
#include <afb/afb-req-itf.h>
-#include <afb/afb-evmgr-itf.h>
+#include <afb/afb-event-sender-itf.h>
/*
* Definition of the versions of the plugin.
* Definition of the facilities provided by the daemon.
*/
struct afb_daemon_itf {
- struct afb_evmgr (*get_evmgr)(void *closure); /* get the event manager */
+ struct afb_event_sender (*get_event_sender)(void *closure); /* get the event manager */
struct sd_event *(*get_event_loop)(void *closure); /* get the common systemd's event loop */
struct sd_bus *(*get_user_bus)(void *closure); /* get the common systemd's user d-bus */
struct sd_bus *(*get_system_bus)(void *closure); /* get the common systemd's system d-bus */
/*
* Structure for accessing daemon.
- * See also: afb_daemon_get_evmgr, afb_daemon_get_event_loop, afb_daemon_get_user_bus, afb_daemon_get_system_bus
+ * See also: afb_daemon_get_event_sender, afb_daemon_get_event_loop, afb_daemon_get_user_bus, afb_daemon_get_system_bus
*/
struct afb_daemon {
const struct afb_daemon_itf *itf; /* the interfacing functions */
* Retrieves the event sender of AFB
* 'daemon' MUST be the daemon given in interface when activating the plugin.
*/
-static inline struct afb_evmgr afb_daemon_get_evmgr(struct afb_daemon daemon)
+static inline struct afb_event_sender afb_daemon_get_event_sender(struct afb_daemon daemon)
{
- return daemon.itf->get_evmgr(daemon.closure);
+ return daemon.itf->get_event_sender(daemon.closure);
}
/*
static const char _uri_[] = "uri";
static const struct AFB_interface *afb_interface;
-static struct afb_evmgr evmgr;
+static struct afb_event_sender event_sender;
static struct jbus *jbus;
static void application_list_changed(const char *data, void *closure)
{
- afb_evmgr_push(evmgr, "application-list-changed", NULL);
+ afb_event_sender_push(event_sender, "application-list-changed", NULL);
}
static struct json_object *embed(const char *tag, struct json_object *obj)
/* records the interface */
assert (afb_interface == NULL);
afb_interface = itf;
- evmgr = afb_daemon_get_evmgr(itf->daemon);
+ event_sender = afb_daemon_get_event_sender(itf->daemon);
/* creates the jbus for accessing afm-user-daemon */
sbus = afb_daemon_get_user_bus(itf->daemon);
static void pingEvent(struct afb_req request)
{
json_object *query = afb_req_json(request);
- afb_evmgr_push(afb_daemon_get_evmgr(interface->daemon), "event", query);
+ afb_event_sender_push(afb_daemon_get_event_sender(interface->daemon), "event", query);
ping(request, json_object_get(query), "event");
}
#include <afb/afb-plugin.h>
#include <afb/afb-req-itf.h>
-#include <afb/afb-evmgr-itf.h>
+#include <afb/afb-event-sender-itf.h>
#include "session.h"
#include "afb-common.h"
static const char plugin_register_function[] = "pluginAfbV1Entry";
-static void afb_api_so_evmgr_push(struct api_so_desc *desc, const char *name, struct json_object *object)
+static void afb_api_so_event_sender_push(struct api_so_desc *desc, const char *name, struct json_object *object)
{
size_t length;
char *event;
ctxClientEventSend(NULL, event, object);
}
-static const struct afb_evmgr_itf evmgr_itf = {
- .push = (void*)afb_api_so_evmgr_push
+static const struct afb_event_sender_itf event_sender_itf = {
+ .push = (void*)afb_api_so_event_sender_push
};
-static struct afb_evmgr afb_api_so_get_evmgr(struct api_so_desc *desc)
+static struct afb_event_sender afb_api_so_get_event_sender(struct api_so_desc *desc)
{
- return (struct afb_evmgr){ .itf = &evmgr_itf, .closure = desc };
+ return (struct afb_event_sender){ .itf = &event_sender_itf, .closure = desc };
}
static const struct afb_daemon_itf daemon_itf = {
- .get_evmgr = (void*)afb_api_so_get_evmgr,
+ .get_event_sender = (void*)afb_api_so_get_event_sender,
.get_event_loop = (void*)afb_common_get_event_loop,
.get_user_bus = (void*)afb_common_get_user_bus,
.get_system_bus = (void*)afb_common_get_system_bus