aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-09-04 13:00:19 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-09-04 13:00:35 +0700
commitf68fa093766d729eaa38079c1f852b6249bade77 (patch)
tree3df446171f572ac987f1062ca96a132ea8815b6c /src
parent49ad9f9375a52ce9ad6271f336b70b01c6293b4c (diff)
vty: add 'gsmtap-sapi (enable-all|disable-all)' command
It's more convenient to use one command to enable/disable sending of all kinds of UL/DL messages at once, rather than specifying all of them individually. Adjust config_write_bts_single(), so it would not print unknown GSMTAP SAPI entries if gsmtap_sapi_mask is set to UINT32_MAX. Change-Id: Icd7fce860ecdcf8ffa107bdfee7ec94ea9ea6cb2
Diffstat (limited to 'src')
-rw-r--r--src/common/vty.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/common/vty.c b/src/common/vty.c
index 49e6edf2..d5993d66 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -251,9 +251,12 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
bts->agch_queue.thresh_level, bts->agch_queue.low_level,
bts->agch_queue.high_level, VTY_NEWLINE);
- for (i = 0; i < 32; i++) {
+ for (i = 0; i < sizeof(uint32_t) * 8; i++) {
if (gsmtap_sapi_mask & ((uint32_t) 1 << i)) {
- sapi_buf = osmo_str_tolower(get_value_string(gsmtap_sapi_names, i));
+ sapi_buf = get_value_string_or_null(gsmtap_sapi_names, i);
+ if (sapi_buf == NULL)
+ continue;
+ sapi_buf = osmo_str_tolower(sapi_buf);
vty_out(vty, " gsmtap-sapi %s%s", sapi_buf, VTY_NEWLINE);
}
}
@@ -1410,6 +1413,23 @@ static struct gsm_lchan *resolve_lchan(struct gsm_network *net,
"logical channel commands\n" \
"logical channel number\n"
+DEFUN(cfg_trx_gsmtap_sapi_all, cfg_trx_gsmtap_sapi_all_cmd,
+ "gsmtap-sapi (enable-all|disable-all)",
+ "Enable/disable sending of UL/DL messages over GSMTAP\n"
+ "Enable all kinds of messages (all SAPI)\n"
+ "Disable all kinds of messages (all SAPI)\n")
+{
+ if (argv[0][0] == 'e') {
+ gsmtap_sapi_mask = UINT32_MAX;
+ gsmtap_sapi_acch = 1;
+ } else {
+ gsmtap_sapi_mask = 0x00;
+ gsmtap_sapi_acch = 0;
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_trx_gsmtap_sapi, cfg_trx_gsmtap_sapi_cmd,
"HIDDEN", "HIDDEN")
{
@@ -1721,6 +1741,7 @@ int bts_vty_init(struct gsm_bts *bts)
install_element(BTS_NODE, &cfg_bts_smscb_tgt_qlen_cmd);
install_element(BTS_NODE, &cfg_bts_smscb_qhyst_cmd);
+ install_element(BTS_NODE, &cfg_trx_gsmtap_sapi_all_cmd);
install_element(BTS_NODE, &cfg_trx_gsmtap_sapi_cmd);
install_element(BTS_NODE, &cfg_trx_no_gsmtap_sapi_cmd);