aboutsummaryrefslogtreecommitdiffstats
path: root/src/libbsc/bsc_ctrl_lookup.c
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-01-03 16:59:44 +0100
committerStefan Sperling <ssperling@sysmocom.de>2018-01-09 11:18:10 +0000
commit55a954bba14f1625d3bb0ca80bdb501998c06309 (patch)
treec0ef88410d2ba304bf43183d5628b726db5e82d1 /src/libbsc/bsc_ctrl_lookup.c
parentff3fad1aa8beda19cc66d6f376ddcbca52e7cc6b (diff)
Support control connection status query for a particular MSC.
Add a new control command 'msc.N.connection_status' which can be used to query the connection status of a particular MSC with number N. Keep the old control command 'msc_connection_status', which always queries MSC 0, for backwards compatibility. Change-Id: Ibd41474a1be80e782b19ec337c856b5efc593fa8 Related: OS#2729
Diffstat (limited to 'src/libbsc/bsc_ctrl_lookup.c')
-rw-r--r--src/libbsc/bsc_ctrl_lookup.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/libbsc/bsc_ctrl_lookup.c b/src/libbsc/bsc_ctrl_lookup.c
index d1d9b0aae..38d1ba4ea 100644
--- a/src/libbsc/bsc_ctrl_lookup.c
+++ b/src/libbsc/bsc_ctrl_lookup.c
@@ -1,4 +1,4 @@
-/* SNMP-like status interface. Look-up of BTS/TRX
+/* SNMP-like status interface. Look-up of BTS/TRX/MSC
*
* (C) 2010-2011 by Daniel Willmann <daniel@totalueberwachung.de>
* (C) 2010-2011 by On-Waves
@@ -25,12 +25,14 @@
#include <osmocom/vty/command.h>
#include <osmocom/ctrl/control_if.h>
+#include <osmocom/bsc/ctrl.h>
#include <osmocom/bsc/debug.h>
#include <osmocom/bsc/gsm_data.h>
+#include <osmocom/bsc/bsc_msc_data.h>
extern vector ctrl_node_vec;
-/*! \brief control interface lookup function for bsc/bts gsm_data
+/*! \brief control interface lookup function for bsc/bts/msc gsm_data
* \param[in] data Private data passed to controlif_setup()
* \param[in] vline Vector of the line holding the command string
* \param[out] node_type type (CTRL_NODE_) that was determined
@@ -44,6 +46,7 @@ static int bsc_ctrl_node_lookup(void *data, vector vline, int *node_type,
struct gsm_bts *bts = NULL;
struct gsm_bts_trx *trx = NULL;
struct gsm_bts_trx_ts *ts = NULL;
+ struct bsc_msc_data *msc = NULL;
char *token = vector_slot(vline, *i);
long num;
@@ -89,6 +92,18 @@ static int bsc_ctrl_node_lookup(void *data, vector vline, int *node_type,
goto err_missing;
*node_data = ts;
*node_type = CTRL_NODE_TS;
+ } else if (!strcmp(token, "msc")) {
+ if (*node_type != CTRL_NODE_ROOT || !net)
+ goto err_missing;
+ (*i)++;
+ if (!ctrl_parse_get_num(vline, *i, &num))
+ goto err_index;
+
+ msc = osmo_msc_data_find(net, num);
+ if (!msc)
+ goto err_missing;
+ *node_data = msc;
+ *node_type = CTRL_NODE_MSC;
} else
return 0;
@@ -102,6 +117,7 @@ err_index:
struct ctrl_handle *bsc_controlif_setup(struct gsm_network *net,
const char *bind_addr, uint16_t port)
{
- return ctrl_interface_setup_dynip(net, bind_addr, port,
- bsc_ctrl_node_lookup);
+ return ctrl_interface_setup_dynip2(net, bind_addr, port,
+ bsc_ctrl_node_lookup,
+ _LAST_CTRL_NODE_BSC);
}