Change in libosmo-sccp[master]: vty: use install_lib_element() and install_lib_element_ve()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Tue Oct 6 17:52:27 UTC 2020


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/20465 )


Change subject: vty: use install_lib_element() and install_lib_element_ve()
......................................................................

vty: use install_lib_element() and install_lib_element_ve()

See https://lists.osmocom.org/pipermail/openbsc/2020-October/013278.html.

Change-Id: If77aea2223891663d465f162614ce8db18168c09
Related: SYS#4937
---
M src/osmo_ss7_vty.c
M src/sccp_vty.c
2 files changed, 288 insertions(+), 233 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/65/20465/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 2692209..7e9b871 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -68,10 +68,11 @@
 	1,
 };
 
-DEFUN(cs7_instance, cs7_instance_cmd,
-	"cs7 instance <0-15>",
-	CS7_STR "Configure a SS7 Instance\n" INST_STR
-	"Number of the instance\n")
+DEFUN_ATTR(cs7_instance, cs7_instance_cmd,
+	   "cs7 instance <0-15>",
+	   CS7_STR "Configure a SS7 Instance\n" INST_STR
+	   "Number of the instance\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	int id = atoi(argv[0]);
 	struct osmo_ss7_instance *inst;
@@ -98,13 +99,14 @@
 };
 
 /* cs7 network-indicator */
-DEFUN(cs7_net_ind, cs7_net_ind_cmd,
-	"network-indicator (international | national | reserved | spare)",
-	"Configure the Network Indicator\n"
-	"International Network\n"
-	"National Network\n"
-	"Reserved Network\n"
-	"Spare Network\n")
+DEFUN_ATTR(cs7_net_ind, cs7_net_ind_cmd,
+	   "network-indicator (international | national | reserved | spare)",
+	   "Configure the Network Indicator\n"
+	   "International Network\n"
+	   "National Network\n"
+	   "Reserved Network\n"
+	   "Spare Network\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 	int ni = get_string_value(ss7_network_indicator_vals, argv[0]);
@@ -114,12 +116,13 @@
 }
 
 /* TODO: cs7 point-code format */
-DEFUN(cs7_pc_format, cs7_pc_format_cmd,
-	"point-code format <1-24> [<1-23>] [<1-22>]",
-	PC_STR "Configure Point Code Format\n"
-	"Length of first PC component\n"
-	"Length of second PC component\n"
-	"Length of third PC component\n")
+DEFUN_ATTR(cs7_pc_format, cs7_pc_format_cmd,
+	   "point-code format <1-24> [<1-23>] [<1-22>]",
+	   PC_STR "Configure Point Code Format\n"
+	   "Length of first PC component\n"
+	   "Length of second PC component\n"
+	   "Length of third PC component\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 	int argind = 0;
@@ -139,10 +142,11 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(cs7_pc_format_def, cs7_pc_format_def_cmd,
-	"point-code format default",
-	PC_STR "Configure Point Code Format\n"
-	"Default Point Code Format (3.8.3)\n")
+DEFUN_ATTR(cs7_pc_format_def, cs7_pc_format_def_cmd,
+	   "point-code format default",
+	   PC_STR "Configure Point Code Format\n"
+	   "Default Point Code Format (3.8.3)\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 	inst->cfg.pc_fmt.component_len[0] = 3;
@@ -153,11 +157,12 @@
 
 
 /* cs7 point-code delimiter */
-DEFUN(cs7_pc_delimiter, cs7_pc_delimiter_cmd,
-	"point-code delimiter (default|dash)",
-	PC_STR "Configure Point Code Delimiter\n"
-	"Use dot as delimiter\n"
-	"User dash as delimiter\n")
+DEFUN_ATTR(cs7_pc_delimiter, cs7_pc_delimiter_cmd,
+	   "point-code delimiter (default|dash)",
+	   PC_STR "Configure Point Code Delimiter\n"
+	   "Use dot as delimiter\n"
+	   "User dash as delimiter\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 
@@ -169,10 +174,11 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(cs7_point_code, cs7_point_code_cmd,
-	"point-code POINT_CODE",
-	"Configure the local Point Code\n"
-	"Point Code\n")
+DEFUN_ATTR(cs7_point_code, cs7_point_code_cmd,
+	   "point-code POINT_CODE",
+	   "Configure the local Point Code\n"
+	   "Point Code\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 	int pc = osmo_ss7_pointcode_parse(inst, argv[0]);
@@ -187,13 +193,13 @@
 
 /* TODO: cs7 secondary-pc */
 /* TODO: cs7 capability-pc */
-
-DEFUN(cs7_permit_dyn_rkm, cs7_permit_dyn_rkm_cmd,
-	"xua rkm routing-key-allocation (static-only|dynamic-permitted)",
-	"SIGTRAN xxxUA related\n" "Routing Key Management\n"
-	"Routing Key Management Allocation Policy\n"
-	"Only static (pre-confgured) Routing Keys permitted\n"
-	"Dynamically allocate Routing Keys for what ASPs request\n")
+DEFUN_ATTR(cs7_permit_dyn_rkm, cs7_permit_dyn_rkm_cmd,
+	   "xua rkm routing-key-allocation (static-only|dynamic-permitted)",
+	   "SIGTRAN xxxUA related\n" "Routing Key Management\n"
+	   "Routing Key Management Allocation Policy\n"
+	   "Only static (pre-confgured) Routing Keys permitted\n"
+	   "Dynamically allocate Routing Keys for what ASPs request\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 
@@ -222,9 +228,10 @@
 	return write_all_cs7(vty, false);
 }
 
-DEFUN(show_cs7_user, show_cs7_user_cmd,
-	"show cs7 instance <0-15> users",
-	SHOW_STR CS7_STR INST_STR INST_STR "User Table\n")
+DEFUN_ATTR(show_cs7_user, show_cs7_user_cmd,
+	   "show cs7 instance <0-15> users",
+	   SHOW_STR CS7_STR INST_STR INST_STR "User Table\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	int id = atoi(argv[0]);
 	struct osmo_ss7_instance *inst;
@@ -258,10 +265,11 @@
 	1,
 };
 
-DEFUN(cs7_route_table, cs7_route_table_cmd,
-	"route-table system",
-	"Specify the name of the route table\n"
-	"Name of the route table\n")
+DEFUN_ATTR(cs7_route_table, cs7_route_table_cmd,
+	   "route-table system",
+	   "Specify the name of the route table\n"
+	   "Name of the route table\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 	struct osmo_ss7_route_table *rtable;
@@ -274,20 +282,21 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(cs7_rt_upd, cs7_rt_upd_cmd,
-	"update route POINT_CODE MASK linkset LS_NAME [priority PRIO] [qos-class (CLASS|default)]",
-	"Update the Route\n"
-	"Update the Route\n"
-	"Destination Point Code\n"
-	"Point Code Mask\n"
-	"Point Code Length\n"
-	"Specify Destination Linkset\n"
-	"Linkset Name\n"
-	"Specify Priority\n"
-	"Priority\n"
-	"Specify QoS Class\n"
-	"QoS Class\n"
-	"Default QoS Class\n")
+DEFUN_ATTR(cs7_rt_upd, cs7_rt_upd_cmd,
+	   "update route POINT_CODE MASK linkset LS_NAME [priority PRIO] [qos-class (CLASS|default)]",
+	   "Update the Route\n"
+	   "Update the Route\n"
+	   "Destination Point Code\n"
+	   "Point Code Mask\n"
+	   "Point Code Length\n"
+	   "Specify Destination Linkset\n"
+	   "Linkset Name\n"
+	   "Specify Priority\n"
+	   "Priority\n"
+	   "Specify QoS Class\n"
+	   "QoS Class\n"
+	   "Default QoS Class\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_route_table *rtable = vty->index;
 	struct osmo_ss7_route *rt;
@@ -327,13 +336,14 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(cs7_rt_rem, cs7_rt_rem_cmd,
-	"remove route POINT_CODE MASK",
-	"Remove a Route\n"
-	"Remove a Route\n"
-	"Destination Point Code\n"
-	"Point Code Mask\n"
-	"Point Code Length\n")
+DEFUN_ATTR(cs7_rt_rem, cs7_rt_rem_cmd,
+	   "remove route POINT_CODE MASK",
+	   "Remove a Route\n"
+	   "Remove a Route\n"
+	   "Destination Point Code\n"
+	   "Point Code Mask\n"
+	   "Point Code Length\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_route_table *rtable = vty->index;
 	struct osmo_ss7_route *rt;
@@ -397,9 +407,10 @@
 	}
 }
 
-DEFUN(show_cs7_route, show_cs7_route_cmd,
-	"show cs7 instance <0-15> route",
-	SHOW_STR CS7_STR INST_STR INST_STR "Routing Table\n")
+DEFUN_ATTR(show_cs7_route, show_cs7_route_cmd,
+	   "show cs7 instance <0-15> route",
+	   SHOW_STR CS7_STR INST_STR INST_STR "Routing Table\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	int id = atoi(argv[0]);
 	struct osmo_ss7_instance *inst;
@@ -429,10 +440,11 @@
 	1,
 };
 
-DEFUN(cs7_xua, cs7_xua_cmd,
-	"listen " XUA_VAR_STR " <0-65534>",
-	"Configure/Enable xUA Listener\n"
-	XUA_VAR_HELP_STR "SCTP Port number\n")
+DEFUN_ATTR(cs7_xua, cs7_xua_cmd,
+	   "listen " XUA_VAR_STR " <0-65534>",
+	   "Configure/Enable xUA Listener\n"
+	   XUA_VAR_HELP_STR "SCTP Port number\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 	struct osmo_xua_server *xs;
@@ -453,10 +465,11 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(no_cs7_xua, no_cs7_xua_cmd,
-	"no listen " XUA_VAR_STR " <0-65534>",
-	NO_STR "Disable xUA Listener on given SCTP Port\n"
-	XUA_VAR_HELP_STR "SCTP Port number\n")
+DEFUN_ATTR(no_cs7_xua, no_cs7_xua_cmd,
+	   "no listen " XUA_VAR_STR " <0-65534>",
+	   NO_STR "Disable xUA Listener on given SCTP Port\n"
+	   XUA_VAR_HELP_STR "SCTP Port number\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 	struct osmo_xua_server *xs;
@@ -472,11 +485,12 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(xua_local_ip, xua_local_ip_cmd,
-	"local-ip " VTY_IPV46_CMD,
-	"Configure the Local IP Address for xUA\n"
-	"IPv4 Address to use for XUA\n"
-	"IPv6 Address to use for XUA\n")
+DEFUN_ATTR(xua_local_ip, xua_local_ip_cmd,
+	   "local-ip " VTY_IPV46_CMD,
+	   "Configure the Local IP Address for xUA\n"
+	   "IPv4 Address to use for XUA\n"
+	   "IPv6 Address to use for XUA\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_xua_server *xs = vty->index;
 
@@ -485,11 +499,12 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(xua_accept_dyn_asp, xua_accept_dyn_asp_cmd,
-	"accept-asp-connections (pre-configured|dynamic-permitted)",
-	"Define what kind of ASP connections to accept\n"
-	"Accept only pre-confiugred ASPs (source IP/prt)\n"
-	"Accept any connection and dynamically create an ASP definition\n")
+DEFUN_ATTR(xua_accept_dyn_asp, xua_accept_dyn_asp_cmd,
+	   "accept-asp-connections (pre-configured|dynamic-permitted)",
+	   "Define what kind of ASP connections to accept\n"
+	   "Accept only pre-confiugred ASPs (source IP/prt)\n"
+	   "Accept any connection and dynamically create an ASP definition\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_xua_server *xs = vty->index;
 
@@ -571,13 +586,14 @@
 	1,
 };
 
-DEFUN(cs7_asp, cs7_asp_cmd,
-	"asp NAME <0-65535> <0-65535> " XUA_VAR_STR,
-	"Configure Application Server Process\n"
-	"Name of ASP\n"
-	"Remote SCTP port number\n"
-	"Local SCTP port number\n"
-	XUA_VAR_HELP_STR)
+DEFUN_ATTR(cs7_asp, cs7_asp_cmd,
+	   "asp NAME <0-65535> <0-65535> " XUA_VAR_STR,
+	   "Configure Application Server Process\n"
+	   "Name of ASP\n"
+	   "Remote SCTP port number\n"
+	   "Local SCTP port number\n"
+	   XUA_VAR_HELP_STR,
+	   CMD_ATTR_NODE_EXIT)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 	const char *name = argv[0];
@@ -608,10 +624,11 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(no_cs7_asp, no_cs7_asp_cmd,
-	"no asp NAME",
-	NO_STR "Disable Application Server Process\n"
-	"Name of ASP\n")
+DEFUN_ATTR(no_cs7_asp, no_cs7_asp_cmd,
+	   "no asp NAME",
+	   NO_STR "Disable Application Server Process\n"
+	   "Name of ASP\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 	const char *name = argv[0];
@@ -626,11 +643,12 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(asp_local_ip, asp_local_ip_cmd,
-	"local-ip " VTY_IPV46_CMD,
-	"Specify Local IP Address from which to contact ASP\n"
-	"Local IPv4 Address from which to contact of ASP\n"
-	"Local IPv6 Address from which to contact of ASP\n")
+DEFUN_ATTR(asp_local_ip, asp_local_ip_cmd,
+	   "local-ip " VTY_IPV46_CMD,
+	   "Specify Local IP Address from which to contact ASP\n"
+	   "Local IPv4 Address from which to contact of ASP\n"
+	   "Local IPv6 Address from which to contact of ASP\n",
+	   CMD_ATTR_NODE_EXIT)
 {
 	struct osmo_ss7_asp *asp = vty->index;
 	if (osmo_ss7_asp_peer_add_host(&asp->cfg.local, asp, argv[0]) != 0) {
@@ -640,11 +658,12 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(asp_remote_ip, asp_remote_ip_cmd,
-	"remote-ip " VTY_IPV46_CMD,
-	"Specify Remote IP Address of ASP\n"
-	"Remote IPv4 Address of ASP\n"
-	"Remote IPv6 Address of ASP\n")
+DEFUN_ATTR(asp_remote_ip, asp_remote_ip_cmd,
+	   "remote-ip " VTY_IPV46_CMD,
+	   "Specify Remote IP Address of ASP\n"
+	   "Remote IPv4 Address of ASP\n"
+	   "Remote IPv6 Address of ASP\n",
+	   CMD_ATTR_NODE_EXIT)
 {
 	struct osmo_ss7_asp *asp = vty->index;
 	if (osmo_ss7_asp_peer_add_host(&asp->cfg.remote, asp, argv[0]) != 0) {
@@ -654,22 +673,24 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(asp_qos_clas, asp_qos_class_cmd,
-	"qos-class <0-255>",
-	"Specify QoS Class of ASP\n"
-	"QoS Class of ASP\n")
+DEFUN_ATTR(asp_qos_clas, asp_qos_class_cmd,
+	   "qos-class <0-255>",
+	   "Specify QoS Class of ASP\n"
+	   "QoS Class of ASP\n",
+	   CMD_ATTR_NODE_EXIT)
 {
 	struct osmo_ss7_asp *asp = vty->index;
 	asp->cfg.qos_class = atoi(argv[0]);
 	return CMD_SUCCESS;
 }
 
-DEFUN(asp_role, asp_role_cmd,
-	"role (sg|asp|ipsp)",
-	"Specify the xUA role for this ASP\n"
-	"SG (Signaling Gateway)\n"
-	"ASP (Application Server Process)\n"
-	"IPSP (IP Signalling Point)\n")
+DEFUN_ATTR(asp_role, asp_role_cmd,
+	   "role (sg|asp|ipsp)",
+	   "Specify the xUA role for this ASP\n"
+	   "SG (Signaling Gateway)\n"
+	   "ASP (Application Server Process)\n"
+	   "IPSP (IP Signalling Point)\n",
+	   CMD_ATTR_NODE_EXIT)
 {
 	struct osmo_ss7_asp *asp = vty->index;
 
@@ -687,11 +708,12 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(sctp_role, asp_sctp_role_cmd,
-	"sctp-role (client|server)",
-	"Specify the SCTP role for this ASP\n"
-	"Operate as SCTP client; connect to a server\n"
-	"Operate as SCTP server; wait for client connections\n")
+DEFUN_ATTR(sctp_role, asp_sctp_role_cmd,
+	   "sctp-role (client|server)",
+	   "Specify the SCTP role for this ASP\n"
+	   "Operate as SCTP client; connect to a server\n"
+	   "Operate as SCTP server; wait for client connections\n",
+	   CMD_ATTR_NODE_EXIT)
 {
 	struct osmo_ss7_asp *asp = vty->index;
 
@@ -705,18 +727,20 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(asp_block, asp_block_cmd,
-	"block",
-	"Allows a SCTP Association with ASP, but doesn't let it become active\n")
+DEFUN_ATTR(asp_block, asp_block_cmd,
+	   "block",
+	   "Allows a SCTP Association with ASP, but doesn't let it become active\n",
+	   CMD_ATTR_NODE_EXIT)
 {
 	/* TODO */
 	vty_out(vty, "Not supported yet%s", VTY_NEWLINE);
 	return CMD_WARNING;
 }
 
-DEFUN(asp_shutdown, asp_shutdown_cmd,
-	"shutdown",
-	"Terminates SCTP association; New associations will be rejected\n")
+DEFUN_ATTR(asp_shutdown, asp_shutdown_cmd,
+	   "shutdown",
+	   "Terminates SCTP association; New associations will be rejected\n",
+	   CMD_ATTR_NODE_EXIT)
 {
 	/* TODO */
 	vty_out(vty, "Not supported yet%s", VTY_NEWLINE);
@@ -795,11 +819,12 @@
 	1,
 };
 
-DEFUN(cs7_as, cs7_as_cmd,
-	"as NAME " XUA_VAR_STR,
-	"Configure an Application Server\n"
-	"Name of the Application Server\n"
-	XUA_VAR_HELP_STR)
+DEFUN_ATTR(cs7_as, cs7_as_cmd,
+	   "as NAME " XUA_VAR_STR,
+	   "Configure an Application Server\n"
+	   "Name of the Application Server\n"
+	   XUA_VAR_HELP_STR,
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 	struct osmo_ss7_as *as;
@@ -826,10 +851,11 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(no_cs7_as, no_cs7_as_cmd,
-	"no as NAME",
-	NO_STR "Disable Application Server\n"
-	"Name of AS\n")
+DEFUN_ATTR(no_cs7_as, no_cs7_as_cmd,
+	   "no as NAME",
+	   NO_STR "Disable Application Server\n"
+	   "Name of AS\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = vty->index;
 	const char *name = argv[0];
@@ -845,10 +871,11 @@
 }
 
 /* TODO: routing-key */
-DEFUN(as_asp, as_asp_cmd,
-	"asp NAME",
-	"Specify that a given ASP is part of this AS\n"
-	"Name of ASP to be added to AS\n")
+DEFUN_ATTR(as_asp, as_asp_cmd,
+	   "asp NAME",
+	   "Specify that a given ASP is part of this AS\n"
+	   "Name of ASP to be added to AS\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_as *as = vty->index;
 
@@ -860,10 +887,11 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(as_no_asp, as_no_asp_cmd,
-	"no asp NAME",
-	NO_STR "Specify ASP to be removed from this AS\n"
-	"Name of ASP to be removed\n")
+DEFUN_ATTR(as_no_asp, as_no_asp_cmd,
+	   "no asp NAME",
+	   NO_STR "Specify ASP to be removed from this AS\n"
+	   "Name of ASP to be removed\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_as *as = vty->index;
 
@@ -875,13 +903,14 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(as_traf_mode, as_traf_mode_cmd,
-	"traffic-mode (broadcast | loadshare | roundrobin | override)",
-	"Specifies traffic mode of operation of the ASP within the AS\n"
-	"Broadcast to all ASP within AS\n"
-	"Share Load among all ASP within AS\n"
-	"Round-Robin between all ASP within AS\n"
-	"Override\n")
+DEFUN_USRATTR(as_traf_mode, as_traf_mode_cmd,
+	      OSMO_SCCP_LIB_ATTR_RSTRT_ASP,
+	      "traffic-mode (broadcast | loadshare | roundrobin | override)",
+	      "Specifies traffic mode of operation of the ASP within the AS\n"
+	      "Broadcast to all ASP within AS\n"
+	      "Share Load among all ASP within AS\n"
+	      "Round-Robin between all ASP within AS\n"
+	      "Override\n")
 {
 	struct osmo_ss7_as *as = vty->index;
 
@@ -890,9 +919,10 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(as_no_traf_mode, as_no_traf_mode_cmd,
-	"no traffic-mode",
-	NO_STR "Remove explicit traffic mode of operation of this AS\n")
+DEFUN_USRATTR(as_no_traf_mode, as_no_traf_mode_cmd,
+	      OSMO_SCCP_LIB_ATTR_RSTRT_ASP,
+	      "no traffic-mode",
+	      NO_STR "Remove explicit traffic mode of operation of this AS\n")
 {
 	struct osmo_ss7_as *as = vty->index;
 
@@ -901,20 +931,22 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(as_recov_tout, as_recov_tout_cmd,
-	"recovery-timeout <1-2000>",
-	"Specifies the recovery timeout value in milliseconds\n"
-	"Recovery Timeout in Milliseconds\n")
+DEFUN_ATTR(as_recov_tout, as_recov_tout_cmd,
+	   "recovery-timeout <1-2000>",
+	   "Specifies the recovery timeout value in milliseconds\n"
+	   "Recovery Timeout in Milliseconds\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_as *as = vty->index;
 	as->cfg.recovery_timeout_msec = atoi(argv[0]);
 	return CMD_SUCCESS;
 }
 
-DEFUN(as_qos_clas, as_qos_class_cmd,
-	"qos-class <0-255>",
-	"Specity QoS Class of AS\n"
-	"QoS Class of AS\n")
+DEFUN_ATTR(as_qos_clas, as_qos_class_cmd,
+	   "qos-class <0-255>",
+	   "Specity QoS Class of AS\n"
+	   "QoS Class of AS\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_as *as = vty->index;
 	as->cfg.qos_class = atoi(argv[0]);
@@ -984,41 +1016,46 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(as_rout_key, as_rout_key_cmd,
-      ROUTING_KEY_CMD,
-      ROUTING_KEY_CMD_STRS)
+DEFUN_ATTR(as_rout_key, as_rout_key_cmd,
+	   ROUTING_KEY_CMD,
+	   ROUTING_KEY_CMD_STRS,
+	   CMD_ATTR_IMMEDIATE)
 {
 	return _rout_key(vty, argv[0], argv[1], NULL, NULL);
 }
 
-DEFUN(as_rout_key_si, as_rout_key_si_cmd,
-      ROUTING_KEY_CMD      ROUTING_KEY_SI_ARG,
-      ROUTING_KEY_CMD_STRS ROUTING_KEY_SI_ARG_STRS)
+DEFUN_ATTR(as_rout_key_si, as_rout_key_si_cmd,
+	   ROUTING_KEY_CMD      ROUTING_KEY_SI_ARG,
+	   ROUTING_KEY_CMD_STRS ROUTING_KEY_SI_ARG_STRS,
+	   CMD_ATTR_IMMEDIATE)
 {
 	return _rout_key(vty, argv[0], argv[1], argv[2], NULL);
 }
 
-DEFUN(as_rout_key_ssn, as_rout_key_ssn_cmd,
-      ROUTING_KEY_CMD      ROUTING_KEY_SSN_ARG,
-      ROUTING_KEY_CMD_STRS ROUTING_KEY_SSN_ARG_STRS)
+DEFUN_ATTR(as_rout_key_ssn, as_rout_key_ssn_cmd,
+	   ROUTING_KEY_CMD      ROUTING_KEY_SSN_ARG,
+	   ROUTING_KEY_CMD_STRS ROUTING_KEY_SSN_ARG_STRS,
+	   CMD_ATTR_IMMEDIATE)
 {
 	return _rout_key(vty, argv[0], argv[1], NULL, argv[2]);
 }
 
-DEFUN(as_rout_key_si_ssn, as_rout_key_si_ssn_cmd,
-      ROUTING_KEY_CMD      ROUTING_KEY_SI_ARG      ROUTING_KEY_SSN_ARG,
-      ROUTING_KEY_CMD_STRS ROUTING_KEY_SI_ARG_STRS ROUTING_KEY_SSN_ARG_STRS)
+DEFUN_ATTR(as_rout_key_si_ssn, as_rout_key_si_ssn_cmd,
+	   ROUTING_KEY_CMD      ROUTING_KEY_SI_ARG      ROUTING_KEY_SSN_ARG,
+	   ROUTING_KEY_CMD_STRS ROUTING_KEY_SI_ARG_STRS ROUTING_KEY_SSN_ARG_STRS,
+	   CMD_ATTR_IMMEDIATE)
 {
 	return _rout_key(vty, argv[0], argv[1], argv[2], argv[3]);
 }
 
-DEFUN(as_pc_override, as_pc_override_cmd,
-	"point-code override dpc PC",
-	"Point Code Specific Features\n"
-	"Override (force) a point-code to hard-coded value\n"
-	"Override Source Point Code\n"
-	"Override Destination Point Code\n"
-	"New Point Code\n")
+DEFUN_ATTR(as_pc_override, as_pc_override_cmd,
+	   "point-code override dpc PC",
+	   "Point Code Specific Features\n"
+	   "Override (force) a point-code to hard-coded value\n"
+	   "Override Source Point Code\n"
+	   "Override Destination Point Code\n"
+	   "New Point Code\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_as *as = vty->index;
 	int pc = osmo_ss7_pointcode_parse(as->inst, argv[0]);
@@ -1038,13 +1075,14 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(as_pc_patch_sccp, as_pc_patch_sccp_cmd,
-	"point-code override patch-sccp (disabled|both)",
-	"Point Code Specific Features\n"
-	"Override (force) a point-code to hard-coded value\n"
-	"Patch point code values into SCCP called/calling address\n"
-	"Don't patch any point codes into SCCP called/calling address\n"
-	"Patch both origin and destination point codes into SCCP called/calling address\n")
+DEFUN_ATTR(as_pc_patch_sccp, as_pc_patch_sccp_cmd,
+	   "point-code override patch-sccp (disabled|both)",
+	   "Point Code Specific Features\n"
+	   "Override (force) a point-code to hard-coded value\n"
+	   "Patch point code values into SCCP called/calling address\n"
+	   "Don't patch any point codes into SCCP called/calling address\n"
+	   "Patch both origin and destination point codes into SCCP called/calling address\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_as *as = vty->index;
 
@@ -1423,9 +1461,10 @@
 }
 
 /* Create a new addressbook entry and switch nodes */
-DEFUN(cs7_sccpaddr, cs7_sccpaddr_cmd,
-      "sccp-address NAME",
-      "Create/Modify an SCCP addressbook entry\n" "Name of the SCCP Address\n")
+DEFUN_ATTR(cs7_sccpaddr, cs7_sccpaddr_cmd,
+	   "sccp-address NAME",
+	   "Create/Modify an SCCP addressbook entry\n" "Name of the SCCP Address\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = (struct osmo_ss7_instance *)vty->index;
 	struct osmo_sccp_addr_entry *entry;
@@ -1466,9 +1505,10 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(cs7_sccpaddr_del, cs7_sccpaddr_del_cmd,
-      "no sccp-address NAME",
-      NO_STR "Delete an SCCP addressbook entry\n" "Name of the SCCP Address\n")
+DEFUN_ATTR(cs7_sccpaddr_del, cs7_sccpaddr_del_cmd,
+	   "no sccp-address NAME",
+	   NO_STR "Delete an SCCP addressbook entry\n" "Name of the SCCP Address\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *inst = (struct osmo_ss7_instance *)vty->index;
 	struct osmo_sccp_addr_entry *entry;
@@ -1488,10 +1528,11 @@
 }
 
 /* Set routing indicator of sccp address */
-DEFUN(cs7_sccpaddr_ri, cs7_sccpaddr_ri_cmd,
-      "routing-indicator (GT|PC|IP)",
-      "Add Routing Indicator\n"
-      "by global-title\n" "by point-code\n" "by ip-address\n")
+DEFUN_ATTR(cs7_sccpaddr_ri, cs7_sccpaddr_ri_cmd,
+	   "routing-indicator (GT|PC|IP)",
+	   "Add Routing Indicator\n"
+	   "by global-title\n" "by point-code\n" "by ip-address\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1511,8 +1552,9 @@
 }
 
 /* Set point-code number of sccp address */
-DEFUN(cs7_sccpaddr_pc, cs7_sccpaddr_pc_cmd,
-      "point-code POINT_CODE", "Add point-code Number\n" "PC\n")
+DEFUN_ATTR(cs7_sccpaddr_pc, cs7_sccpaddr_pc_cmd,
+	   "point-code POINT_CODE", "Add point-code Number\n" "PC\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	int pc;
 	struct osmo_sccp_addr_entry *entry =
@@ -1533,8 +1575,9 @@
 }
 
 /* Remove point-code number from sccp address */
-DEFUN(cs7_sccpaddr_pc_del, cs7_sccpaddr_pc_del_cmd,
-      "no point-code", NO_STR "Remove point-code Number\n")
+DEFUN_ATTR(cs7_sccpaddr_pc_del, cs7_sccpaddr_pc_del_cmd,
+	   "no point-code", NO_STR "Remove point-code Number\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1545,8 +1588,9 @@
 }
 
 /* Set subsystem number of sccp address */
-DEFUN(cs7_sccpaddr_ssn, cs7_sccpaddr_ssn_cmd,
-      "subsystem-number <0-4294967295>", "Add Subsystem Number\n" "SSN\n")
+DEFUN_ATTR(cs7_sccpaddr_ssn, cs7_sccpaddr_ssn_cmd,
+	   "subsystem-number <0-4294967295>", "Add Subsystem Number\n" "SSN\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1557,8 +1601,9 @@
 }
 
 /* Remove subsystem number from sccp address */
-DEFUN(cs7_sccpaddr_ssn_del, cs7_sccpaddr_ssn_del_cmd,
-      "no subsystem-number", NO_STR "Remove Subsystem Number\n")
+DEFUN_ATTR(cs7_sccpaddr_ssn_del, cs7_sccpaddr_ssn_del_cmd,
+	   "no subsystem-number", NO_STR "Remove Subsystem Number\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1573,9 +1618,10 @@
  * so we leave the related VTY options out for now */
 
 /* Set IP Address (V4) of sccp address */
-DEFUN(cs7_sccpaddr_ipv4, cs7_sccpaddr_ipv4_cmd,
-      "ip-address V4 A.B.C.D",
-      "Add IP-Address\n" "Protocol version 4\n" "IP-Address digits\n")
+DEFUN_ATTR(cs7_sccpaddr_ipv4, cs7_sccpaddr_ipv4_cmd,
+	   "ip-address V4 A.B.C.D",
+	   "Add IP-Address\n" "Protocol version 4\n" "IP-Address digits\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1603,9 +1649,10 @@
 }
 
 /* Set IP Address (V6) of sccp address */
-DEFUN(cs7_sccpaddr_ipv6, cs7_sccpaddr_ipv6_cmd,
-      "ip-address V6 A:B:C:D:E:F:G:H",
-      "Add IP-Address\n" "Protocol version 6\n" "IP-Address digits\n")
+DEFUN_ATTR(cs7_sccpaddr_ipv6, cs7_sccpaddr_ipv6_cmd,
+	   "ip-address V6 A:B:C:D:E:F:G:H",
+	   "Add IP-Address\n" "Protocol version 6\n" "IP-Address digits\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1633,8 +1680,9 @@
 }
 
 /* Remove IP Address from sccp address */
-DEFUN(cs7_sccpaddr_ip_del, cs7_sccpaddr_ip_del_cmd,
-      "no ip-address", NO_STR "Remove IP-Address\n")
+DEFUN_ATTR(cs7_sccpaddr_ip_del, cs7_sccpaddr_ip_del_cmd,
+	   "no ip-address", NO_STR "Remove IP-Address\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1647,8 +1695,9 @@
 #endif
 
 /* Configure global title and switch nodes */
-DEFUN(cs7_sccpaddr_gt, cs7_sccpaddr_gt_cmd,
-      "global-title", "Add/Modify Global Title\n")
+DEFUN_ATTR(cs7_sccpaddr_gt, cs7_sccpaddr_gt_cmd,
+	   "global-title", "Add/Modify Global Title\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1658,8 +1707,9 @@
 }
 
 /* Remove global title from sccp address */
-DEFUN(cs7_sccpaddr_gt_del, cs7_sccpaddr_gt_del_cmd,
-      "no global-title", NO_STR "Remove Global Title\n")
+DEFUN_ATTR(cs7_sccpaddr_gt_del, cs7_sccpaddr_gt_del_cmd,
+	   "no global-title", NO_STR "Remove Global Title\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1670,8 +1720,9 @@
 }
 
 /* Set global title inicator of the sccp address gt */
-DEFUN(cs7_sccpaddr_gt_gti, cs7_sccpaddr_gt_gti_cmd,
-      "global-title-indicator <0-15>", "Set Global Title Indicator\n" "GTI\n")
+DEFUN_ATTR(cs7_sccpaddr_gt_gti, cs7_sccpaddr_gt_gti_cmd,
+	   "global-title-indicator <0-15>", "Set Global Title Indicator\n" "GTI\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1681,8 +1732,9 @@
 }
 
 /* Set global title translation type of the sccp address gt */
-DEFUN(cs7_sccpaddr_gt_tt, cs7_sccpaddr_gt_tt_cmd,
-      "translation-type <0-255>", "Set Global Title Translation Type\n" "TT\n")
+DEFUN_ATTR(cs7_sccpaddr_gt_tt, cs7_sccpaddr_gt_tt_cmd,
+	   "translation-type <0-255>", "Set Global Title Translation Type\n" "TT\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1692,9 +1744,10 @@
 }
 
 /* Set global title numbering plan indicator of the sccp address gt */
-DEFUN(cs7_sccpaddr_gt_npi, cs7_sccpaddr_gt_npi_cmd,
-      "numbering-plan-indicator <0-15>",
-      "Set Global Title Numbering Plan Indicator\n" "NPI\n")
+DEFUN_ATTR(cs7_sccpaddr_gt_npi, cs7_sccpaddr_gt_npi_cmd,
+	   "numbering-plan-indicator <0-15>",
+	   "Set Global Title Numbering Plan Indicator\n" "NPI\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1704,9 +1757,10 @@
 }
 
 /* Set global title nature of address indicator of the sccp address gt */
-DEFUN(cs7_sccpaddr_gt_nai, cs7_sccpaddr_gt_nai_cmd,
-      "nature-of-address-indicator <0-127>",
-      "Set Global Title Nature of Address Indicator\n" "NAI\n")
+DEFUN_ATTR(cs7_sccpaddr_gt_nai, cs7_sccpaddr_gt_nai_cmd,
+	   "nature-of-address-indicator <0-127>",
+	   "Set Global Title Nature of Address Indicator\n" "NAI\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
@@ -1716,8 +1770,9 @@
 }
 
 /* Set global title digits of the sccp address gt */
-DEFUN(cs7_sccpaddr_gt_digits, cs7_sccpaddr_gt_digits_cmd,
-      "digits DIGITS", "Set Global Title Digits\n" "Number digits\n")
+DEFUN_ATTR(cs7_sccpaddr_gt_digits, cs7_sccpaddr_gt_digits_cmd,
+	   "digits DIGITS", "Set Global Title Digits\n" "Number digits\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_sccp_addr_entry *entry =
 	    (struct osmo_sccp_addr_entry *)vty->index;
diff --git a/src/sccp_vty.c b/src/sccp_vty.c
index 2e5b345..13fe402 100644
--- a/src/sccp_vty.c
+++ b/src/sccp_vty.c
@@ -143,8 +143,8 @@
 
 /* sccp-timer <name> <1-999999>
  * (cmdstr and doc are dynamically generated from osmo_sccp_timer_names.) */
-DEFUN(sccp_timer, sccp_timer_cmd,
-      NULL, NULL)
+DEFUN_ATTR(sccp_timer, sccp_timer_cmd,
+	   NULL, NULL, CMD_ATTR_IMMEDIATE)
 {
 	struct osmo_ss7_instance *ss7 = vty->index;
 	enum osmo_sccp_timer timer = get_string_value(osmo_sccp_timer_names, argv[0]);

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/20465
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: If77aea2223891663d465f162614ce8db18168c09
Gerrit-Change-Number: 20465
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201006/3e1faa1e/attachment.htm>


More information about the gerrit-log mailing list