aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
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/include
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/include')
-rw-r--r--openbsc/include/openbsc/telnet_interface.h9
-rw-r--r--openbsc/include/vty/vty.h2
2 files changed, 4 insertions, 7 deletions
diff --git a/openbsc/include/openbsc/telnet_interface.h b/openbsc/include/openbsc/telnet_interface.h
index b8c36b6a1..5a3e17930 100644
--- a/openbsc/include/openbsc/telnet_interface.h
+++ b/openbsc/include/openbsc/telnet_interface.h
@@ -21,23 +21,20 @@
#ifndef TELNET_INTERFACE_H
#define TELNET_INTERFACE_H
-#include "gsm_data.h"
-#include <openbsc/debug.h>
+#include <osmocore/logging.h>
#include <osmocore/select.h>
#include <vty/vty.h>
struct telnet_connection {
struct llist_head entry;
- struct gsm_network *network;
+ void *priv;
struct bsc_fd fd;
struct vty *vty;
struct log_target *dbg;
};
-void telnet_init(struct gsm_network *network, int port);
-
-int bsc_vty_init(struct gsm_network *net);
+int telnet_init(void *tall_ctx, void *priv, int port);
#endif
diff --git a/openbsc/include/vty/vty.h b/openbsc/include/vty/vty.h
index 23430d5e7..f82ada1cc 100644
--- a/openbsc/include/vty/vty.h
+++ b/openbsc/include/vty/vty.h
@@ -129,7 +129,7 @@ static inline char *vty_newline(struct vty *vty)
/* Prototypes. */
void vty_init(const char *name, const char *version, const char *copyright);
-int vty_read_config_file(const char *file_name);
+int vty_read_config_file(const char *file_name, void *priv);
void vty_init_vtysh (void);
void vty_reset (void);
struct vty *vty_new (void);