aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libbsc/bsc_vty.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-08-17 12:42:06 +0200
committerHarald Welte <laforge@gnumonks.org>2012-08-17 12:42:06 +0200
commit4ab9d7c0129e7920351965b9cfdfdea9b7093758 (patch)
treec53e275f3e9629eaf01680cfc4d8b53977ba2334 /openbsc/src/libbsc/bsc_vty.c
parent13fe21939cc735529aa456fe0ccfb755a487c1e9 (diff)
dynamically generate a proper VTY reference for phys_chan_config
this uses vty_cmd_string_from_valstr() from _very_ recent libosmocore, so you have to update the library, sorry.
Diffstat (limited to 'openbsc/src/libbsc/bsc_vty.c')
-rw-r--r--openbsc/src/libbsc/bsc_vty.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 4031cec13..7c434b94d 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -25,6 +25,7 @@
#include <osmocom/vty/vty.h>
#include <osmocom/vty/logging.h>
#include <osmocom/vty/telnet_interface.h>
+#include <osmocom/vty/misc.h>
#include <arpa/inet.h>
@@ -2555,6 +2556,25 @@ DEFUN(cfg_ts,
DEFUN(cfg_ts_pchan,
cfg_ts_pchan_cmd,
+ "phys_chan_config PCHAN", /* dynamically generated! */
+ "Physical Channel configuration (TCH/SDCCH/...)")
+{
+ struct gsm_bts_trx_ts *ts = vty->index;
+ int pchanc;
+
+ pchanc = gsm_pchan_parse(argv[0]);
+ if (pchanc < 0)
+ return CMD_WARNING;
+
+ ts->pchan = pchanc;
+
+ return CMD_SUCCESS;
+}
+
+/* used for backwards compatibility with old config files that still
+ * have uppercase pchan type names */
+DEFUN_HIDDEN(cfg_ts_pchan_compat,
+ cfg_ts_pchan_compat_cmd,
"phys_chan_config PCHAN",
"Physical Channel configuration (TCH/SDCCH/...)")
{
@@ -2570,6 +2590,8 @@ DEFUN(cfg_ts_pchan,
return CMD_SUCCESS;
}
+
+
DEFUN(cfg_ts_tsc,
cfg_ts_tsc_cmd,
"training_sequence_code <0-7>",
@@ -2821,6 +2843,17 @@ extern const char *openbsc_copyright;
int bsc_vty_init(const struct log_info *cat)
{
+ cfg_ts_pchan_cmd.string =
+ vty_cmd_string_from_valstr(tall_bsc_ctx,
+ gsm_pchant_names,
+ "phys_chan_config (", "|", ")",
+ VTY_DO_LOWER);
+ cfg_ts_pchan_cmd.doc =
+ vty_cmd_string_from_valstr(tall_bsc_ctx,
+ gsm_pchant_descs,
+ "Physical Channel Combination\n",
+ "\n", "", 0);
+
install_element_ve(&show_net_cmd);
install_element_ve(&show_bts_cmd);
install_element_ve(&show_trx_cmd);
@@ -2948,6 +2981,7 @@ int bsc_vty_init(const struct log_info *cat)
install_element(TS_NODE, &ournode_exit_cmd);
install_element(TS_NODE, &ournode_end_cmd);
install_element(TS_NODE, &cfg_ts_pchan_cmd);
+ install_element(TS_NODE, &cfg_ts_pchan_compat_cmd);
install_element(TS_NODE, &cfg_ts_tsc_cmd);
install_element(TS_NODE, &cfg_ts_hopping_cmd);
install_element(TS_NODE, &cfg_ts_hsn_cmd);