From 0d8330c8cc066ce6609286fe58de3f7962ef7736 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 28 Aug 2010 18:33:34 +0800 Subject: nat: Add vty command to show the endpoint allocation status --- openbsc/src/nat/bsc_nat_vty.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'openbsc') 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 #include +#include #include @@ -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); -- cgit v1.2.3