diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-05-11 18:48:39 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-12-02 12:09:16 +0000 |
commit | b90eabfb46aaf5efcc3b5f16fe89b914db4542ea (patch) | |
tree | 560bc4da553e66e0c02d5a9e882ea9e7e052ec74 /openbsc/src/libbsc/bsc_vty.c | |
parent | 2c05f75bbf3d9a69eee1fe78eb5552acf1d7671d (diff) |
move to libcommon-cs: global vty gsm_network pointer
Move gsmnet_from_vty() and the bsc_gsmnet global to common_cs_vty.c.
Rename bsc_gsmnet to vty_global_gsm_network and make it static to common_cs_vty.c, to
clearly mark the global variable for VTY use only.
Introduce common_cs_vty_init() to set vty_global_gsm_network.
Change-Id: I26c5c47de08f899b896813d09612d5cb2f8e42d6
Diffstat (limited to 'openbsc/src/libbsc/bsc_vty.c')
-rw-r--r-- | openbsc/src/libbsc/bsc_vty.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 9ed19aa1f..c8aa43c94 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -131,21 +131,6 @@ struct cmd_node ts_node = { 1, }; -extern struct gsm_network *bsc_gsmnet; - -struct gsm_network *gsmnet_from_vty(struct vty *v) -{ - /* In case we read from the config file, the vty->priv cannot - * point to a struct telnet_connection, and thus conn->priv - * will not point to the gsm_network structure */ -#if 0 - struct telnet_connection *conn = v->priv; - return (struct gsm_network *) conn->priv; -#else - return bsc_gsmnet; -#endif -} - static int dummy_config_write(struct vty *v) { return CMD_SUCCESS; @@ -3989,7 +3974,7 @@ DEFUN(smscb_cmd, smscb_cmd_cmd, uint8_t buf[88]; int rc; - bts = gsm_bts_num(bsc_gsmnet, bts_nr); + bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr); if (!bts) { vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE); return CMD_WARNING; @@ -4040,7 +4025,7 @@ DEFUN(pdch_act, pdch_act_cmd, int ts_nr = atoi(argv[2]); int activate; - bts = gsm_bts_num(bsc_gsmnet, bts_nr); + bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr); if (!bts) { vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE); return CMD_WARNING; @@ -4102,6 +4087,7 @@ int bsc_vty_init(const struct log_info *cat, struct gsm_network *network) "BTS Vendor/Type\n", "\n", "", 0); + common_cs_vty_init(network); install_element_ve(&show_net_cmd); install_element_ve(&show_bts_cmd); |