summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-11-20 19:27:49 +0100
committerHarald Welte <laforge@gnumonks.org>2017-11-20 20:48:39 +0000
commit646f47d5a33b945397acea833b326c1e244e827a (patch)
treebd6786215ed184aaadb03a57bf47df3d40d8e408
parent116dfb662158b45ff374cc91ee6bbb74aacf8b7e (diff)
Add "show cs7 (m3ua}sua}ipa)" command to show xUA servers
-rw-r--r--src/osmo_ss7_vty.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index cbbb9e3..403a9ac 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -497,6 +497,42 @@ static void write_one_xua(struct vty *vty, struct osmo_xua_server *xs)
vty_out(vty, " accept-asp-connections dynamic-permitted%s", VTY_NEWLINE);
}
+static void vty_dump_xua_server(struct vty *vty, struct osmo_xua_server *xs)
+{
+ vty_out(vty, "xUA server for %s on %s:%u%s",
+ get_value_string(osmo_ss7_asp_protocol_vals, xs->cfg.proto),
+ xs->cfg.local.host ? xs->cfg.local.host : "0.0.0.0",
+ xs->cfg.local.port, VTY_NEWLINE);
+}
+
+/* List all addressbook entries */
+DEFUN(show_cs7_xua, show_cs7_xua_cmd,
+ "show cs7 "XUA_VAR_STR" [<0-65534>]",
+ SHOW_STR CS7_STR XUA_VAR_HELP_STR "Port Number")
+{
+ struct osmo_ss7_instance *inst;
+ struct osmo_xua_server *xs;
+ enum osmo_ss7_asp_protocol proto = parse_asp_proto(argv[0]);
+
+ llist_for_each_entry(inst, &osmo_ss7_instances, list) {
+ if (argc > 1) {
+ int port = atoi(argv[1]);
+ xs = osmo_ss7_xua_server_find(inst, proto, port);
+ if (!xs) {
+ vty_out(vty, "%% No matching server found%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ vty_dump_xua_server(vty, xs);
+ } else {
+ llist_for_each_entry(xs, &inst->xua_servers, list) {
+ if (xs->cfg.proto == proto)
+ vty_dump_xua_server(vty, xs);
+ }
+ }
+ }
+ return CMD_SUCCESS;
+}
+
/***********************************************************************
* Application Server Process
@@ -1721,6 +1757,7 @@ static void vty_init_shared(void *ctx)
g_ctx = ctx;
install_element_ve(&show_cs7_user_cmd);
+ install_element_ve(&show_cs7_xua_cmd);
/* the mother of all VTY config nodes */
install_element(CONFIG_NODE, &cs7_instance_cmd);