From 7a2c86b67d6df9bc0ff132211f4fc6608f44131b Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 26 Aug 2010 15:38:42 +0800 Subject: vty: Provide a is_config_node for the VTY and use it for the bsc Right now only bsc_hack and osmo_bsc need to have a custom config handling as they use the subscr/oml nodes. --- openbsc/configure.in | 2 +- openbsc/include/openbsc/vty.h | 2 ++ openbsc/src/bsc/osmo_bsc_main.c | 3 ++- openbsc/src/bsc_hack.c | 4 ++-- openbsc/src/common_vty.c | 12 ++++++++++++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/openbsc/configure.in b/openbsc/configure.in index 0167725ae..6adee335c 100644 --- a/openbsc/configure.in +++ b/openbsc/configure.in @@ -44,7 +44,7 @@ AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo B AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes") PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.1.18) -PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.1.9) +PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.1.19) dnl checks for header files AC_HEADER_STDC diff --git a/openbsc/include/openbsc/vty.h b/openbsc/include/openbsc/vty.h index 2b9fccc3f..8c75c5812 100644 --- a/openbsc/include/openbsc/vty.h +++ b/openbsc/include/openbsc/vty.h @@ -33,4 +33,6 @@ enum bsc_vty_node { NAT_BSC_NODE, }; +extern int bsc_vty_is_config_node(struct vty *vty, int node); + #endif diff --git a/openbsc/src/bsc/osmo_bsc_main.c b/openbsc/src/bsc/osmo_bsc_main.c index 7ddf91d26..e84450fa2 100644 --- a/openbsc/src/bsc/osmo_bsc_main.c +++ b/openbsc/src/bsc/osmo_bsc_main.c @@ -22,8 +22,8 @@ #include #include #include +#include -#include #include #include @@ -137,6 +137,7 @@ static struct vty_app_info vty_info = { .name = "OpenBSC Osmo BSC", .version = PACKAGE_VERSION, .go_parent_cb = bsc_vty_go_parent, + .is_config_node = bsc_vty_is_config_node, }; diff --git a/openbsc/src/bsc_hack.c b/openbsc/src/bsc_hack.c index 4e8309b03..61b79477d 100644 --- a/openbsc/src/bsc_hack.c +++ b/openbsc/src/bsc_hack.c @@ -38,8 +38,7 @@ #include #include #include - -#include +#include #include "../bscconfig.h" @@ -212,6 +211,7 @@ static struct vty_app_info vty_info = { .name = "OpenBSC", .version = PACKAGE_VERSION, .go_parent_cb = bsc_vty_go_parent, + .is_config_node = bsc_vty_is_config_node, }; int main(int argc, char **argv) diff --git a/openbsc/src/common_vty.c b/openbsc/src/common_vty.c index 3c257a871..9d2214675 100644 --- a/openbsc/src/common_vty.c +++ b/openbsc/src/common_vty.c @@ -185,3 +185,15 @@ gDEFUN(ournode_end, return CMD_SUCCESS; } +int bsc_vty_is_config_node(struct vty *vty, int node) +{ + switch (node) { + /* add items that are not config */ + case OML_NODE: + case SUBSCR_NODE: + return 0; + + default: + return 1; + } +} -- cgit v1.2.3