summaryrefslogtreecommitdiffstats
path: root/binding
diff options
context:
space:
mode:
Diffstat (limited to 'binding')
-rw-r--r--binding/network-api.c92
-rw-r--r--binding/network-common.h18
-rw-r--r--binding/network-connman.c2
-rw-r--r--binding/network-util.c2
4 files changed, 57 insertions, 57 deletions
diff --git a/binding/network-api.c b/binding/network-api.c
index 90b132e..47dbfd0 100644
--- a/binding/network-api.c
+++ b/binding/network-api.c
@@ -31,7 +31,7 @@
#include <json-c/json.h>
-#define AFB_BINDING_VERSION 2
+#define AFB_BINDING_VERSION 3
#include <afb/afb-binding.h>
#include "network-api.h"
@@ -223,29 +223,29 @@ void call_work_destroy(struct call_work *cw)
g_mutex_unlock(&ns->cw_mutex);
}
-static struct afb_event *get_event_from_value(struct network_state *ns,
+static afb_event_t get_event_from_value(struct network_state *ns,
const char *value)
{
if (!g_strcmp0(value, "global_state"))
- return &ns->global_state_event;
+ return ns->global_state_event;
if (!g_strcmp0(value, "technologies"))
- return &ns->technologies_event;
+ return ns->technologies_event;
if (!g_strcmp0(value, "technology_properties"))
- return &ns->technology_properties_event;
+ return ns->technology_properties_event;
if (!g_strcmp0(value, "services"))
- return &ns->services_event;
+ return ns->services_event;
if (!g_strcmp0(value, "service_properties"))
- return &ns->service_properties_event;
+ return ns->service_properties_event;
if (!g_strcmp0(value, "counter"))
- return &ns->counter_event;
+ return ns->counter_event;
if (!g_strcmp0(value, "agent"))
- return &ns->agent_event;
+ return ns->agent_event;
return NULL;
}
@@ -267,7 +267,7 @@ static void network_manager_signal_callback(
const gchar *key = NULL;
const gchar *basename;
json_object *jarray = NULL, *jresp = NULL, *jobj, *jprop;
- struct afb_event *event = NULL;
+ afb_event_t event = NULL;
GVariantIter *array;
gboolean is_config, ret;
@@ -305,7 +305,7 @@ static void network_manager_signal_callback(
json_object_object_add(jresp, "properties", jobj);
- event = &ns->technologies_event;
+ event = ns->technologies_event;
} else if (!g_strcmp0(signal_name, "TechnologyRemoved")) {
@@ -322,7 +322,7 @@ static void network_manager_signal_callback(
json_object_object_add(jresp, "action",
json_object_new_string("removed"));
- event = &ns->technologies_event;
+ event = ns->technologies_event;
} else if (!g_strcmp0(signal_name, "ServicesChanged")) {
@@ -387,7 +387,7 @@ static void network_manager_signal_callback(
g_variant_iter_free(array2);
g_variant_iter_free(array1);
- event = &ns->services_event;
+ event = ns->services_event;
} else if (!g_strcmp0(signal_name, "PropertyChanged")) {
@@ -405,7 +405,7 @@ static void network_manager_signal_callback(
json_object_put(jresp);
jresp = NULL;
} else
- event = &ns->global_state_event;
+ event = ns->global_state_event;
}
/* if (jresp)
@@ -414,7 +414,7 @@ static void network_manager_signal_callback(
JSON_C_TO_STRING_PRETTY)); */
if (event && jresp) {
- afb_event_push(*event, jresp);
+ afb_event_push(event, jresp);
jresp = NULL;
}
@@ -436,7 +436,7 @@ static void network_technology_signal_callback(
const gchar *key = NULL;
const gchar *basename;
json_object *jresp = NULL, *jobj;
- struct afb_event *event = NULL;
+ afb_event_t event = NULL;
gboolean is_config, ret;
/* AFB_INFO("sender=%s", sender_name);
@@ -473,7 +473,7 @@ static void network_technology_signal_callback(
json_object_new_string(basename));
json_object_object_add(jresp, "properties", jobj);
- event = &ns->technology_properties_event;
+ event = ns->technology_properties_event;
}
/* if (jresp)
@@ -482,7 +482,7 @@ static void network_technology_signal_callback(
JSON_C_TO_STRING_PRETTY)); */
if (event && jresp) {
- afb_event_push(*event, jresp);
+ afb_event_push(event, jresp);
jresp = NULL;
}
@@ -504,7 +504,7 @@ static void network_service_signal_callback(
const gchar *key = NULL;
const gchar *basename;
json_object *jresp = NULL, *jobj;
- struct afb_event *event = NULL;
+ afb_event_t event = NULL;
gboolean is_config, ret;
/* AFB_INFO("sender=%s", sender_name);
@@ -542,7 +542,7 @@ static void network_service_signal_callback(
json_object_object_add(jresp, "properties",
jobj);
- event = &ns->service_properties_event;
+ event = ns->service_properties_event;
}
/* if (jresp)
@@ -551,7 +551,7 @@ static void network_service_signal_callback(
JSON_C_TO_STRING_PRETTY)); */
if (event && jresp) {
- afb_event_push(*event, jresp);
+ afb_event_push(event, jresp);
jresp = NULL;
}
@@ -1022,7 +1022,7 @@ err_no_loop:
return NULL;
}
-static int init(void)
+static int init(afb_api_t api)
{
struct init_data init_data, *id = &init_data;
gint64 end_time;
@@ -1062,13 +1062,13 @@ static int init(void)
return id->rc;
}
-static void network_subscribe_unsubscribe(struct afb_req request,
+static void network_subscribe_unsubscribe(afb_req_t request,
gboolean unsub)
{
struct network_state *ns = global_ns;
json_object *jresp = json_object_new_object();
const char *value;
- struct afb_event *event;
+ afb_event_t event;
int rc;
/* if value exists means to set offline mode */
@@ -1086,9 +1086,9 @@ static void network_subscribe_unsubscribe(struct afb_req request,
}
if (!unsub)
- rc = afb_req_subscribe(request, *event);
+ rc = afb_req_subscribe(request, event);
else
- rc = afb_req_unsubscribe(request, *event);
+ rc = afb_req_unsubscribe(request, event);
if (rc != 0) {
afb_req_fail_f(request, "failed",
"%s error on \"value\" event \"%s\"",
@@ -1102,17 +1102,17 @@ static void network_subscribe_unsubscribe(struct afb_req request,
value);
}
-static void network_subscribe(struct afb_req request)
+static void network_subscribe(afb_req_t request)
{
network_subscribe_unsubscribe(request, FALSE);
}
-static void network_unsubscribe(struct afb_req request)
+static void network_unsubscribe(afb_req_t request)
{
network_subscribe_unsubscribe(request, TRUE);
}
-static void network_state(struct afb_req request)
+static void network_state(afb_req_t request)
{
struct network_state *ns = global_ns;
GError *error = NULL;
@@ -1128,7 +1128,7 @@ static void network_state(struct afb_req request)
afb_req_success(request, jresp, "Network - state");
}
-static void network_offline(struct afb_req request)
+static void network_offline(afb_req_t request)
{
struct network_state *ns = global_ns;
GError *error = NULL;
@@ -1168,7 +1168,7 @@ static void network_offline(struct afb_req request)
afb_req_success(request, jresp, "Network - offline mode");
}
-static void network_technologies(struct afb_req request)
+static void network_technologies(afb_req_t request)
{
struct network_state *ns = global_ns;
json_object *jresp;
@@ -1186,7 +1186,7 @@ static void network_technologies(struct afb_req request)
afb_req_success(request, jresp, "Network - Network Technologies");
}
-static void network_services(struct afb_req request)
+static void network_services(afb_req_t request)
{
struct network_state *ns = global_ns;
json_object *jresp;
@@ -1203,7 +1203,7 @@ static void network_services(struct afb_req request)
afb_req_success(request, jresp, "Network - Network Services");
}
-static void network_technology_set_powered(struct afb_req request,
+static void network_technology_set_powered(afb_req_t request,
gboolean powered)
{
struct network_state *ns = global_ns;
@@ -1255,17 +1255,17 @@ static void network_technology_set_powered(struct afb_req request,
technology, powered ? "enabled" : "disabled");
}
-static void network_enable_technology(struct afb_req request)
+static void network_enable_technology(afb_req_t request)
{
return network_technology_set_powered(request, TRUE);
}
-static void network_disable_technology(struct afb_req request)
+static void network_disable_technology(afb_req_t request)
{
return network_technology_set_powered(request, FALSE);
}
-static void network_scan_services(struct afb_req request)
+static void network_scan_services(afb_req_t request)
{
struct network_state *ns = global_ns;
GVariant *reply = NULL;
@@ -1294,7 +1294,7 @@ static void network_scan_services(struct afb_req request)
technology);
}
-static void network_move_service(struct afb_req request)
+static void network_move_service(afb_req_t request)
{
struct network_state *ns = global_ns;
GVariant *reply = NULL;
@@ -1341,7 +1341,7 @@ static void network_move_service(struct afb_req request)
service, before_after ? "before" : "after", other_service);
}
-static void network_remove_service(struct afb_req request)
+static void network_remove_service(afb_req_t request)
{
struct network_state *ns = global_ns;
GVariant *reply = NULL;
@@ -1395,7 +1395,7 @@ out_free:
call_work_destroy(cw);
}
-static void network_reset_counters(struct afb_req request)
+static void network_reset_counters(afb_req_t request)
{
struct network_state *ns = global_ns;
GError *error = NULL;
@@ -1476,7 +1476,7 @@ out_free:
call_work_destroy(cw);
}
-static void network_connect_service(struct afb_req request)
+static void network_connect_service(afb_req_t request)
{
struct network_state *ns = global_ns;
GError *error = NULL;
@@ -1514,7 +1514,7 @@ static void network_connect_service(struct afb_req request)
}
}
-static void network_disconnect_service(struct afb_req request)
+static void network_disconnect_service(afb_req_t request)
{
struct network_state *ns = global_ns;
json_object *jresp;
@@ -1544,7 +1544,7 @@ static void network_disconnect_service(struct afb_req request)
service);
}
-static void network_get_property(struct afb_req request)
+static void network_get_property(afb_req_t request)
{
struct network_state *ns = global_ns;
json_object *jobj = afb_req_json(request);
@@ -1602,7 +1602,7 @@ static void network_get_property(struct afb_req request)
access_type);
}
-static void network_set_property(struct afb_req request)
+static void network_set_property(afb_req_t request)
{
struct network_state *ns = global_ns;
json_object *jobj = afb_req_json(request);
@@ -1666,7 +1666,7 @@ static void network_set_property(struct afb_req request)
access_type, count, count > 1 ? "ies" : "y");
}
-static void network_agent_response(struct afb_req request)
+static void network_agent_response(afb_req_t request)
{
struct network_state *ns = global_ns;
json_object *jobj = afb_req_json(request);
@@ -1765,7 +1765,7 @@ static void network_agent_response(struct afb_req request)
afb_req_success_f(request, NULL, "Network - agent response sent");
}
-static const struct afb_verb_v2 network_verbs[] = {
+static const struct afb_verb_v3 network_verbs[] = {
{
.verb = "subscribe",
.session = AFB_SESSION_NONE,
@@ -1859,7 +1859,7 @@ static const struct afb_verb_v2 network_verbs[] = {
/*
* description of the binding for afb-daemon
*/
-const struct afb_binding_v2 afbBindingV2 = {
+const struct afb_binding_v3 afbBindingV3 = {
.api = "network-manager", /* the API name (or binding name or prefix) */
.specification = "networking API", /* short description of of the binding */
.verbs = network_verbs, /* the array describing the verbs of the API */
diff --git a/binding/network-common.h b/binding/network-common.h
index 83c2e0f..b95350f 100644
--- a/binding/network-common.h
+++ b/binding/network-common.h
@@ -28,7 +28,7 @@
#include <json-c/json.h>
-#define AFB_BINDING_VERSION 2
+#define AFB_BINDING_VERSION 3
#include <afb/afb-binding.h>
struct call_work;
@@ -39,13 +39,13 @@ struct network_state {
guint manager_sub;
guint technology_sub;
guint service_sub;
- struct afb_event global_state_event;
- struct afb_event technologies_event;
- struct afb_event technology_properties_event;
- struct afb_event services_event;
- struct afb_event service_properties_event;
- struct afb_event counter_event;
- struct afb_event agent_event;
+ afb_event_t global_state_event;
+ afb_event_t technologies_event;
+ afb_event_t technology_properties_event;
+ afb_event_t services_event;
+ afb_event_t service_properties_event;
+ afb_event_t counter_event;
+ afb_event_t agent_event;
int ping_counter;
/* NOTE: single connection allowed for now */
@@ -71,7 +71,7 @@ struct call_work {
gchar *method;
gchar *connman_method;
struct connman_pending_work *cpw;
- struct afb_req request;
+ afb_req_t request;
gchar *agent_method;
GDBusMethodInvocation *invocation;
};
diff --git a/binding/network-connman.c b/binding/network-connman.c
index 0e51fa2..f68c8c7 100644
--- a/binding/network-connman.c
+++ b/binding/network-connman.c
@@ -31,7 +31,7 @@
#include <json-c/json.h>
-#define AFB_BINDING_VERSION 2
+#define AFB_BINDING_VERSION 3
#include <afb/afb-binding.h>
#include "network-api.h"
diff --git a/binding/network-util.c b/binding/network-util.c
index b487501..02740e8 100644
--- a/binding/network-util.c
+++ b/binding/network-util.c
@@ -31,7 +31,7 @@
#include <json-c/json.h>
-#define AFB_BINDING_VERSION 2
+#define AFB_BINDING_VERSION 3
#include <afb/afb-binding.h>
#include "network-api.h"