From 638cddd8f18e3f362a1bbb18ccc986c174a015a6 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Wed, 4 Nov 2020 17:32:11 +0100 Subject: osmo-gbproxy: Implement nsvc-state ctrl command Change-Id: I0beb572103803f3ee4ecb28d9bf2e3139e0f8aa4 --- src/gbproxy/gb_proxy_ctrl.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/gbproxy/gb_proxy_ctrl.c b/src/gbproxy/gb_proxy_ctrl.c index 3ebc7d174..957738301 100644 --- a/src/gbproxy/gb_proxy_ctrl.c +++ b/src/gbproxy/gb_proxy_ctrl.c @@ -33,12 +33,20 @@ extern vector ctrl_node_vec; +struct nsvc_cb_data { + struct ctrl_cmd *cmd; + uint16_t nsei; + bool is_sgsn; +}; + static int ctrl_nsvc_state_cb(struct gprs_ns2_vc *nsvc, void *ctx) { -/* FIXME: Can't get NSVC state in ns2 - struct ctrl_cmd *cmd = (struct ctrl_cmd *)ctx; + struct nsvc_cb_data *data = (struct nsvc_cb_data *)ctx; + struct ctrl_cmd *cmd = (struct ctrl_cmd *)data->cmd; + + cmd->reply = talloc_asprintf_append(cmd->reply, "%u,%s,%s,%s\n", + data->nsei, gprs_ns2_ll_str(nsvc), gprs_ns2_nsvc_state_name(nsvc), + data->is_sgsn ? "SGSN" : "BSS" ); - cmd->reply = gprs_ns2_vc_state_append(cmd->reply, nsvc); -*/ return 0; } @@ -66,8 +74,8 @@ static int get_nsvc_state(struct ctrl_cmd *cmd, void *data) if (nse) gprs_ns2_nse_foreach_nsvc(nse, &ctrl_nsvc_state_cb, cmd); } - cmd->reply = "Getting NSVC state not yet implemented for NS2"; - return CTRL_CMD_ERROR; + + return CTRL_CMD_REPLY; } CTRL_CMD_DEFINE_RO(nsvc_state, "nsvc-state"); -- cgit v1.2.3