aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_client_vty.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-11-08 23:50:10 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-11-09 01:04:04 +0100
commit0a94e57b72e5d1445b8a92538c8091b474fef445 (patch)
tree6d5ccb8f84e7f4973a355092f2a93c54a057f564 /src/osmo_client_vty.c
parentd7ab53dc168ff2aac4d0eea8f0ecb3377e03103b (diff)
client: Allow to stop and remove a connection
Diffstat (limited to 'src/osmo_client_vty.c')
-rw-r--r--src/osmo_client_vty.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/osmo_client_vty.c b/src/osmo_client_vty.c
index 88b7140..5cf3aa1 100644
--- a/src/osmo_client_vty.c
+++ b/src/osmo_client_vty.c
@@ -411,6 +411,23 @@ DEFUN(cfg_pcap_store,
return CMD_SUCCESS;
}
+DEFUN(cfg_no_pcap_store,
+ cfg_no_pcap_store_cmd,
+ "no pcap-store-connection .NAME",
+ NO_STR "Configure additional PCAP store server\n" "Name of server\n")
+{
+ struct osmo_pcap_client_conn *conn;
+ conn = osmo_client_find_conn(pcap_client, argv[0]);
+ if (!conn) {
+ vty_out(vty, "%%Failed to find connection %s%ss",
+ argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ osmo_client_free(conn);
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_client_connect,
cfg_client_connect_cmd,
"connect",
@@ -422,6 +439,17 @@ DEFUN(cfg_client_connect,
return CMD_SUCCESS;
}
+DEFUN(cfg_client_disconnect,
+ cfg_client_disconnect_cmd,
+ "disconnect",
+ "Disconnect to the storage\n")
+{
+ struct osmo_pcap_client_conn *conn = get_conn(vty);
+
+ osmo_client_disconnect(conn);
+ return CMD_SUCCESS;
+}
+
int vty_client_init(struct osmo_pcap_client *pcap)
{
install_element(CONFIG_NODE, &cfg_client_cmd);
@@ -460,6 +488,7 @@ int vty_client_init(struct osmo_pcap_client *pcap)
/* per server confiug*/
install_element(CLIENT_NODE, &cfg_pcap_store_cmd);
+ install_element(CLIENT_NODE, &cfg_no_pcap_store_cmd);
install_element(CLIENT_SERVER_NODE, &cfg_server_ip_cmd);
install_element(CLIENT_SERVER_NODE, &cfg_server_port_cmd);
install_element(CLIENT_SERVER_NODE, &cfg_enable_tls_cmd);
@@ -478,6 +507,7 @@ int vty_client_init(struct osmo_pcap_client *pcap)
install_element(CLIENT_SERVER_NODE, &cfg_no_tls_priority_cmd);
install_element(CLIENT_SERVER_NODE, &cfg_tls_log_level_cmd);
install_element(CLIENT_SERVER_NODE, &cfg_client_connect_cmd);
+ install_element(CLIENT_SERVER_NODE, &cfg_client_disconnect_cmd);
return 0;
}