diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-08-28 18:33:34 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-08-29 16:36:01 +0800 |
commit | 0d8330c8cc066ce6609286fe58de3f7962ef7736 (patch) | |
tree | 392683363db2e2e5845cf8555cf4726ec8d3c3e9 | |
parent | 45fd07dc33b5dd845e2b266adda5d24a4d500f96 (diff) |
nat: Add vty command to show the endpoint allocation status
-rw-r--r-- | openbsc/src/nat/bsc_nat_vty.c | 26 |
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); |