nat: Add vty command to show the endpoint allocation status

This commit is contained in:
Holger Hans Peter Freyther 2010-08-28 18:33:34 +08:00
parent 45fd07dc33
commit 0d8330c8cc
1 changed files with 26 additions and 0 deletions

View File

@ -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);