aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/src/nat/bsc_nat_vty.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/openbsc/src/nat/bsc_nat_vty.c b/openbsc/src/nat/bsc_nat_vty.c
index b72eb4e26..0bbd313a9 100644
--- a/openbsc/src/nat/bsc_nat_vty.c
+++ b/openbsc/src/nat/bsc_nat_vty.c
@@ -29,6 +29,7 @@
#include <osmocore/talloc.h>
#include <osmocore/rate_ctr.h>
+#include <osmocore/utils.h>
#include <osmocom/sccp/sccp.h>
@@ -148,6 +149,30 @@ DEFUN(show_bsc, show_bsc_cmd, "show bsc connections",
return CMD_SUCCESS;
}
+DEFUN(show_bsc_mgcp, show_bsc_mgcp_cmd, "show bsc mgcp NR",
+ SHOW_STR "Display the MGCP status for a given BSC")
+{
+ struct bsc_connection *con;
+ int nr = atoi(argv[0]);
+ int i;
+
+ llist_for_each_entry(con, &_nat->bsc_connections, list_entry) {
+ if (!con->cfg)
+ continue;
+ if (con->cfg->nr != nr)
+ continue;
+
+ vty_out(vty, "MGCP Status for %d%s", con->cfg->nr, VTY_NEWLINE);
+ for (i = 1; i < ARRAY_SIZE(con->endpoint_status); ++i)
+ vty_out(vty, " Endpoint 0x%x %s%s", i,
+ con->endpoint_status[i] == 0 ? "free" : "allocated",
+ VTY_NEWLINE);
+ break;
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN(show_bsc_cfg, show_bsc_cfg_cmd, "show bsc config",
SHOW_STR "Display information about known BSC configs")
{
@@ -564,6 +589,7 @@ int bsc_nat_vty_init(struct bsc_nat *nat)
install_element_ve(&close_bsc_cmd);
install_element_ve(&show_msc_cmd);
install_element_ve(&test_regex_cmd);
+ install_element_ve(&show_bsc_mgcp_cmd);
/* nat group */
install_element(CONFIG_NODE, &cfg_nat_cmd);