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.
This commit is contained in:
Holger Hans Peter Freyther 2010-08-26 15:38:42 +08:00
parent 2c869efcd3
commit 7a2c86b67d
5 changed files with 19 additions and 4 deletions

View File

@ -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

View File

@ -33,4 +33,6 @@ enum bsc_vty_node {
NAT_BSC_NODE,
};
extern int bsc_vty_is_config_node(struct vty *vty, int node);
#endif

View File

@ -22,8 +22,8 @@
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
#include <openbsc/osmo_bsc_rf.h>
#include <openbsc/vty.h>
#include <osmocom/vty/command.h>
#include <osmocore/talloc.h>
#include <osmocore/process.h>
@ -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,
};

View File

@ -38,8 +38,7 @@
#include <osmocore/talloc.h>
#include <openbsc/signal.h>
#include <openbsc/osmo_msc.h>
#include <osmocom/vty/command.h>
#include <openbsc/vty.h>
#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)

View File

@ -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;
}
}