aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gb_proxy_main.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-16 20:52:23 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-16 20:52:23 +0200
commitdcccb1818da12041d08469ce2ab2ccd191187100 (patch)
treef2bb70dd3b130e8afa4c8c4c2a8e7689867843ec /openbsc/src/gprs/gb_proxy_main.c
parent88907a2f92523c56bf5250c3c75230601eb2f604 (diff)
VTY: decouple telnet_interface from 'struct gsmnet'
We want the VTY and telnet code to be independent from the BSC application(s). As a side note, we also like to eliminate static global variables for 'struct gsm_network' all over the code. As such, telnet_init() is now passed along a "private" pointer, which getst stored in telnet_connection.priv. This telnet_connection is then stored in vty->priv, which in turn gets dereferenced if anyone needs a reference to 'struct gsm_network' from the BSC vty code. Also: * vty_init() now calls cmd_init() * the ugliness that telnet_init() calls back into the application by means of bsc_vty_init() function has been removed. * telnet_init() now returns any errors, so the main program can exit e.g. if the port is already in use.
Diffstat (limited to 'openbsc/src/gprs/gb_proxy_main.c')
-rw-r--r--openbsc/src/gprs/gb_proxy_main.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/openbsc/src/gprs/gb_proxy_main.c b/openbsc/src/gprs/gb_proxy_main.c
index 9cd73e17d..e450d1fe6 100644
--- a/openbsc/src/gprs/gb_proxy_main.c
+++ b/openbsc/src/gprs/gb_proxy_main.c
@@ -205,12 +205,18 @@ int main(int argc, char **argv)
log_add_target(stderr_target);
log_set_all_filter(stderr_target, 1);
- telnet_init(&dummy_network, 4246);
+ vty_init("Osmocom Gb Proxy", PACKAGE_VERSION, openbsc_copyright);
+ openbsc_vty_add_cmds();
+ gbproxy_vty_init();
handle_options(argc, argv);
rate_ctr_init(tall_bsc_ctx);
+ rc = telnet_init(tall_bsc_ctx, &dummy_network, 4246);
+ if (rc < 0)
+ exit(1);
+
bssgp_nsi = gprs_ns_instantiate(&proxy_ns_cb);
if (!bssgp_nsi) {
LOGP(DGPRS, LOGL_ERROR, "Unable to instantiate NS\n");
@@ -247,15 +253,3 @@ int main(int argc, char **argv)
exit(0);
}
-
-struct gsm_network;
-int bsc_vty_init(struct gsm_network *dummy)
-{
- cmd_init(1);
- vty_init("Osmocom Gb Proxy", PACKAGE_VERSION, openbsc_copyright);
-
- openbsc_vty_add_cmds();
- gbproxy_vty_init();
- return 0;
-}
-