summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/afm-main-plugin/afm-main-plugin.c37
-rw-r--r--plugins/samples/ClientCtx.c1
-rw-r--r--plugins/samples/HelloWorld.c1
-rw-r--r--plugins/samples/SamplePost.c1
-rw-r--r--plugins/session/token-api.c1
5 files changed, 27 insertions, 14 deletions
diff --git a/plugins/afm-main-plugin/afm-main-plugin.c b/plugins/afm-main-plugin/afm-main-plugin.c
index 2d350df2..d7ef198d 100644
--- a/plugins/afm-main-plugin/afm-main-plugin.c
+++ b/plugins/afm-main-plugin/afm-main-plugin.c
@@ -18,17 +18,17 @@
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <stdio.h>
#include <string.h>
+#include <assert.h>
#include <json.h>
#include "afb-plugin.h"
-#include "afb-req-itf.h"
-#include "afb-poll-itf.h"
#include "utils-sbus.h"
#include "utils-jbus.h"
static const char _auto_[] = "auto";
static const char _continue_[] = "continue";
+static const char _changed_[] = "changed";
static const char _detail_[] = "detail";
static const char _id_[] = "id";
static const char _install_[] = "install";
@@ -46,9 +46,15 @@ static const char _uninstall_[] = "uninstall";
static const char _uri_[] = "uri";
static const struct AFB_interface *interface;
+static struct afb_evmgr evmgr;
static struct jbus *jbus;
+static void application_list_changed(const char *data, void *closure)
+{
+ afb_evmgr_push(evmgr, "application-list-changed", NULL);
+}
+
static struct json_object *embed(const char *tag, struct json_object *obj)
{
struct json_object *result;
@@ -285,19 +291,24 @@ static struct sbus_itf sbusitf;
const struct AFB_plugin *pluginRegister(const struct AFB_interface *itf)
{
+ int rc;
+ struct afb_pollmgr pollmgr;
struct sbus *sbus;
/* records the interface */
assert (interface == NULL);
+ interface = itf;
+ evmgr = afb_daemon_get_evmgr(itf->daemon);
/* creates the sbus for session */
- sbusitf.wait = itf->pollitf->wait;
- sbusitf.open = itf->pollitf->open;
- sbusitf.on_readable = itf->pollitf->on_readable;
- sbusitf.on_writable = itf->pollitf->on_writable;
- sbusitf.on_hangup = itf->pollitf->on_hangup;
- sbusitf.close = itf->pollitf->close;
- sbus = sbus_session(&sbusitf, itf->pollclosure);
+ pollmgr = afb_daemon_get_pollmgr(itf->daemon);
+ sbusitf.wait = pollmgr.itf->wait;
+ sbusitf.open = pollmgr.itf->open;
+ sbusitf.on_readable = pollmgr.itf->on_readable;
+ sbusitf.on_writable = pollmgr.itf->on_writable;
+ sbusitf.on_hangup = pollmgr.itf->on_hangup;
+ sbusitf.close = pollmgr.itf->close;
+ sbus = sbus_session(&sbusitf, pollmgr.closure);
if (sbus == NULL) {
fprintf(stderr, "ERROR: %s:%d: can't connect to DBUS session\n", __FILE__, __LINE__);
return NULL;
@@ -310,7 +321,13 @@ const struct AFB_plugin *pluginRegister(const struct AFB_interface *itf)
return NULL;
}
-
+ /* records the signal handler */
+ rc = jbus_on_signal_s(jbus, _changed_, application_list_changed, NULL);
+ if (rc < 0) {
+ jbus_unref(jbus);
+ return NULL;
+ }
+
return &plug_desc;
}
diff --git a/plugins/samples/ClientCtx.c b/plugins/samples/ClientCtx.c
index 2d5ebfe1..24cb4f30 100644
--- a/plugins/samples/ClientCtx.c
+++ b/plugins/samples/ClientCtx.c
@@ -20,7 +20,6 @@
#include <json.h>
#include "afb-plugin.h"
-#include "afb-req-itf.h"
typedef struct {
/*
diff --git a/plugins/samples/HelloWorld.c b/plugins/samples/HelloWorld.c
index d02fd117..bf809cc3 100644
--- a/plugins/samples/HelloWorld.c
+++ b/plugins/samples/HelloWorld.c
@@ -20,7 +20,6 @@
#include <json.h>
#include "afb-plugin.h"
-#include "afb-req-itf.h"
// Sample Generic Ping Debug API
static void ping(struct afb_req request, json_object *jresp, const char *tag)
diff --git a/plugins/samples/SamplePost.c b/plugins/samples/SamplePost.c
index 6def3b9c..f484d131 100644
--- a/plugins/samples/SamplePost.c
+++ b/plugins/samples/SamplePost.c
@@ -21,7 +21,6 @@
#include <json.h>
#include "afb-plugin.h"
-#include "afb-req-itf.h"
// Sample Generic Ping Debug API
diff --git a/plugins/session/token-api.c b/plugins/session/token-api.c
index 7633b950..91f9cd8f 100644
--- a/plugins/session/token-api.c
+++ b/plugins/session/token-api.c
@@ -20,7 +20,6 @@
#include <json.h>
#include "afb-plugin.h"
-#include "afb-req-itf.h"
// Dummy sample of Client Application Context
typedef struct {