diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-01-16 02:00:32 -0800 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-01-16 02:25:02 -0800 |
commit | 099e3b5d041cdd6ac34f7c63949a66e9a66e51ac (patch) | |
tree | 3a4f51bbdb8e4fbd11e2e10f3ac4408ef24784b0 | |
parent | d491059697d351fa99720a13555c90ef914ecc8b (diff) |
binding: network: remove unimplemented counter functionalityguppy_6.99.4guppy/6.99.46.99.4
counter_event wasn't implemented, and the respective reset_counters
verb doesn't really have any use.
Change-Id: Ibc2142b7f58c06e67430b31307bc7139837c9866
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r-- | binding/network-api.c | 76 | ||||
-rw-r--r-- | binding/network-common.h | 2 | ||||
-rw-r--r-- | test/agl-service-network-ctl.c | 9 |
3 files changed, 0 insertions, 87 deletions
diff --git a/binding/network-api.c b/binding/network-api.c index 6ee7510..bf8edca 100644 --- a/binding/network-api.c +++ b/binding/network-api.c @@ -245,9 +245,6 @@ static afb_event_t get_event_from_value(struct network_state *ns, if (!g_strcmp0(value, "service_properties")) return ns->service_properties_event; - if (!g_strcmp0(value, "counter")) - return ns->counter_event; - if (!g_strcmp0(value, "agent")) return ns->agent_event; @@ -872,8 +869,6 @@ static struct network_state *network_init(GMainLoop *loop) afb_daemon_make_event("services"); ns->service_properties_event = afb_daemon_make_event("service_properties"); - ns->counter_event = - afb_daemon_make_event("counter"); ns->agent_event = afb_daemon_make_event("agent"); @@ -882,7 +877,6 @@ static struct network_state *network_init(GMainLoop *loop) !afb_event_is_valid(ns->technology_properties_event) || !afb_event_is_valid(ns->services_event) || !afb_event_is_valid(ns->service_properties_event) || - !afb_event_is_valid(ns->counter_event) || !afb_event_is_valid(ns->agent_event)) { AFB_ERROR("Cannot create events"); goto err_no_events; @@ -1373,71 +1367,6 @@ static void network_remove_service(afb_req_t request) service); } -/* reset_counters as async implementation for illustrative purposes */ - -static void reset_counters_callback(void *user_data, - GVariant *result, GError **error) -{ - struct call_work *cw = user_data; - struct network_state *ns = cw->ns; - - connman_decode_call_error(ns, - cw->access_type, cw->type_arg, cw->connman_method, - error); - if (error && *error) { - afb_req_fail_f(cw->request, "failed", "%s error %s", - cw->method, (*error)->message); - goto out_free; - } - - if (result) - g_variant_unref(result); - - afb_req_success_f(cw->request, NULL, "Network - service %s %s", - cw->type_arg, cw->method); -out_free: - afb_req_unref(cw->request); - call_work_destroy(cw); -} - -static void network_reset_counters(afb_req_t request) -{ - struct network_state *ns = network_get_userdata(request); - GError *error = NULL; - const char *service; - struct call_work *cw; - - /* first service */ - service = afb_req_value(request, "service"); - if (!service) { - afb_req_fail(request, "failed", - "No service given"); - return; - } - - cw = call_work_create(ns, "service", service, - "reset_counters", "ResetCounters", &error); - if (!cw) { - afb_req_fail_f(request, "failed", "can't queue work %s", - error->message); - g_error_free(error); - return; - } - - cw->request = request; - afb_req_addref(request); - cw->cpw = connman_call_async(ns, "service", service, - "ResetCounters", NULL, &error, - reset_counters_callback, cw); - if (!cw->cpw) { - afb_req_fail_f(request, "failed", "reset counters error %s", - error->message); - call_work_destroy(cw); - g_error_free(error); - return; - } -} - static void connect_service_callback(void *user_data, GVariant *result, GError **error) { @@ -1827,11 +1756,6 @@ static const struct afb_verb_v3 network_verbs[] = { .callback = network_remove_service, .info ="Remove service" }, { - .verb = "reset_counters", - .session = AFB_SESSION_NONE, - .callback = network_reset_counters, - .info ="Reset service counters" - }, { .verb = "connect_service", .session = AFB_SESSION_NONE, .callback = network_connect_service, diff --git a/binding/network-common.h b/binding/network-common.h index b95350f..25d599b 100644 --- a/binding/network-common.h +++ b/binding/network-common.h @@ -44,9 +44,7 @@ struct network_state { 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 */ /* NOTE: needs locking and a list */ diff --git a/test/agl-service-network-ctl.c b/test/agl-service-network-ctl.c index 91f86d4..6808b8d 100644 --- a/test/agl-service-network-ctl.c +++ b/test/agl-service-network-ctl.c @@ -142,11 +142,6 @@ static void on_state_reply(void *closure, struct afb_wsj1_msg *msg) on_reply(closure, "state", msg); } -static void on_reset_counters_reply(void *closure, struct afb_wsj1_msg *msg) -{ - on_reply(closure, "reset_counters", msg); -} - static void on_technologies_reply(void *closure, struct afb_wsj1_msg *msg) { on_reply(closure, "technologies", msg); @@ -602,10 +597,6 @@ static const struct cmd cmds[] = { .call = call_void, .reply = on_state_reply, }, { - .verb = "reset_counters", - .call = call_service_arg, - .reply = on_reset_counters_reply, - }, { .verb = "technologies", .call = call_void, .reply = on_technologies_reply, |