aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/mgcp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-08-08 16:39:57 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-08-08 16:39:57 +0800
commit5508fe332016983a490b68bb6e14cd861d87a3c0 (patch)
tree0a595a78dba5c6bcce77e92195d65756f958f306 /openbsc/src/mgcp
parent9e9392d5b30ec71750af8d2c621a07fc2618fd68 (diff)
mgcp: Add a vty command to free a given endpoint.
Diffstat (limited to 'openbsc/src/mgcp')
-rw-r--r--openbsc/src/mgcp/mgcp_vty.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/openbsc/src/mgcp/mgcp_vty.c b/openbsc/src/mgcp/mgcp_vty.c
index 02eda237e..e86ce7d7d 100644
--- a/openbsc/src/mgcp/mgcp_vty.c
+++ b/openbsc/src/mgcp/mgcp_vty.c
@@ -355,11 +355,30 @@ DEFUN(tap_call,
return CMD_SUCCESS;
}
+DEFUN(free_endp, free_endp_cmd,
+ "free-endpoint NUMBER",
+ "Free the given endpoint\n" "Endpoint number in hex.\n")
+{
+ struct mgcp_endpoint *endp;
+
+ int endp_no = strtoul(argv[0], NULL, 16);
+ if (endp_no < 1 || endp_no >= g_cfg->number_endpoints) {
+ vty_out(vty, "Endpoint number %s/%d is invalid.%s",
+ argv[0], endp_no, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ endp = &g_cfg->endpoints[endp_no];
+ mgcp_free_endp(endp);
+ return CMD_SUCCESS;
+}
+
int mgcp_vty_init(void)
{
install_element_ve(&show_mgcp_cmd);
install_element(ENABLE_NODE, &loop_endp_cmd);
install_element(ENABLE_NODE, &tap_call_cmd);
+ install_element(ENABLE_NODE, &free_endp_cmd);
install_element(CONFIG_NODE, &cfg_mgcp_cmd);
install_node(&mgcp_node, config_write_mgcp);