Browse Source

[cleanup] Make command nodes static

The cmd_nodes used to configure vty, can mostly be static so
(basic data hiding 101).
Stephen Hemminger 11 years ago
parent
commit
7fc626de5f

+ 1 - 1
bgpd/bgp_debug.c

@@ -856,7 +856,7 @@ bgp_config_write_debug (struct vty *vty)
   return write;
 }
 
-struct cmd_node debug_node =
+static struct cmd_node debug_node =
 {
   DEBUG_NODE,
   "",

+ 1 - 1
bgpd/bgp_dump.c

@@ -773,7 +773,7 @@ DEFUN (no_dump_bgp_routes,
 }
 
 /* BGP node structure. */
-struct cmd_node bgp_dump_node =
+static struct cmd_node bgp_dump_node =
 {
   DUMP_NODE,
   "",

+ 1 - 1
bgpd/bgp_filter.c

@@ -671,7 +671,7 @@ config_write_as_list (struct vty *vty)
   return write;
 }
 
-struct cmd_node as_list_node =
+static struct cmd_node as_list_node =
 {
   AS_LIST_NODE,
   "",

+ 7 - 7
bgpd/bgp_vty.c

@@ -8775,42 +8775,42 @@ bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
 }
 
 /* BGP node structure. */
-struct cmd_node bgp_node =
+static struct cmd_node bgp_node =
 {
   BGP_NODE,
   "%s(config-router)# ",
   1,
 };
 
-struct cmd_node bgp_ipv4_unicast_node =
+static struct cmd_node bgp_ipv4_unicast_node =
 {
   BGP_IPV4_NODE,
   "%s(config-router-af)# ",
   1,
 };
 
-struct cmd_node bgp_ipv4_multicast_node =
+static struct cmd_node bgp_ipv4_multicast_node =
 {
   BGP_IPV4M_NODE,
   "%s(config-router-af)# ",
   1,
 };
 
-struct cmd_node bgp_ipv6_unicast_node = 
+static struct cmd_node bgp_ipv6_unicast_node =
 {
   BGP_IPV6_NODE,
   "%s(config-router-af)# ",
   1,
 };
 
-struct cmd_node bgp_ipv6_multicast_node =
+static struct cmd_node bgp_ipv6_multicast_node =
 {
   BGP_IPV6M_NODE,
   "%s(config-router-af)# ",
   1,
 };
 
-struct cmd_node bgp_vpnv4_node =
+static struct cmd_node bgp_vpnv4_node =
 {
   BGP_VPNV4_NODE,
   "%s(config-router-af)# ",
@@ -10734,7 +10734,7 @@ community_list_config_write (struct vty *vty)
   return write;
 }
 
-struct cmd_node community_list_node =
+static struct cmd_node community_list_node =
 {
   COMMUNITY_LIST_NODE,
   "",

+ 1 - 1
isisd/isis_circuit.c

@@ -2028,7 +2028,7 @@ DEFUN (no_ipv6_router_isis,
 }
 #endif /* HAVE_IPV6 */
 
-struct cmd_node interface_node = {
+static struct cmd_node interface_node = {
   INTERFACE_NODE,
   "%s(config-if)# ",
   1,

+ 1 - 1
isisd/isisd.c

@@ -2076,7 +2076,7 @@ isis_config_write (struct vty *vty)
   return write;
 }
 
-struct cmd_node isis_node = {
+static struct cmd_node isis_node = {
   ISIS_NODE,
   "%s(config-router)# ",
   1

+ 6 - 6
lib/command.c

@@ -41,37 +41,37 @@ vector cmdvec = NULL;
 struct host host;
 
 /* Standard command node structures. */
-struct cmd_node auth_node =
+static struct cmd_node auth_node =
 {
   AUTH_NODE,
   "Password: ",
 };
 
-struct cmd_node view_node =
+static struct cmd_node view_node =
 {
   VIEW_NODE,
   "%s> ",
 };
 
-struct cmd_node restricted_node =
+static struct cmd_node restricted_node =
 {
   RESTRICTED_NODE,
   "%s$ ",
 };
 
-struct cmd_node auth_enable_node =
+static struct cmd_node auth_enable_node =
 {
   AUTH_ENABLE_NODE,
   "Password: ",
 };
 
-struct cmd_node enable_node =
+static struct cmd_node enable_node =
 {
   ENABLE_NODE,
   "%s# ",
 };
 
-struct cmd_node config_node =
+static struct cmd_node config_node =
 {
   CONFIG_NODE,
   "%s(config)# ",

+ 2 - 2
lib/filter.c

@@ -1857,7 +1857,7 @@ config_write_access (struct vty *vty, afi_t afi)
 }
 
 /* Access-list node. */
-struct cmd_node access_node =
+static struct cmd_node access_node =
 {
   ACCESS_NODE,
   "",				/* Access list has no interface. */
@@ -1953,7 +1953,7 @@ access_list_init_ipv4 (void)
 }
 
 #ifdef HAVE_IPV6
-struct cmd_node access_ipv6_node =
+static struct cmd_node access_ipv6_node =
 {
   ACCESS_IPV6_NODE,
   "",

+ 2 - 2
lib/keychain.c

@@ -848,14 +848,14 @@ DEFUN (send_lifetime_duration_month_day,
 				    argv[3], argv[4]);
 }
 
-struct cmd_node keychain_node =
+static struct cmd_node keychain_node =
 {
   KEYCHAIN_NODE,
   "%s(config-keychain)# ",
   1
 };
 
-struct cmd_node keychain_key_node =
+static struct cmd_node keychain_key_node =
 {
   KEYCHAIN_KEY_NODE,
   "%s(config-keychain-key)# ",

+ 2 - 2
lib/plist.c

@@ -2623,7 +2623,7 @@ prefix_list_reset_orf (void)
 
 
 /* Prefix-list node. */
-struct cmd_node prefix_node =
+static struct cmd_node prefix_node =
 {
   PREFIX_NODE,
   "",				/* Prefix list has no interface. */
@@ -2732,7 +2732,7 @@ prefix_list_init_ipv4 (void)
 
 #ifdef HAVE_IPV6
 /* Prefix-list node. */
-struct cmd_node prefix_ipv6_node =
+static struct cmd_node prefix_ipv6_node =
 {
   PREFIX_IPV6_NODE,
   "",				/* Prefix list has no interface. */

+ 1 - 1
lib/routemap.c

@@ -1280,7 +1280,7 @@ route_map_config_write (struct vty *vty)
 }
 
 /* Route map node structure. */
-struct cmd_node rmap_node =
+static struct cmd_node rmap_node =
 {
   RMAP_NODE,
   "%s(config-route-map)# ",

+ 1 - 1
lib/smux.c

@@ -73,7 +73,7 @@ int debug_smux = 0;
 int fail = 0;
 
 /* SMUX node. */
-struct cmd_node smux_node =
+static struct cmd_node smux_node =
 {
   SMUX_NODE,
   ""                            /* SMUX has no interface. */

+ 1 - 1
ospf6d/ospf6_interface.c

@@ -1509,7 +1509,7 @@ config_write_ospf6_interface (struct vty *vty)
   return 0;
 }
 
-struct cmd_node interface_node =
+static struct cmd_node interface_node =
 {
   INTERFACE_NODE,
   "%s(config-if)# ",

+ 1 - 1
ospf6d/ospf6_top.c

@@ -650,7 +650,7 @@ config_write_ospf6 (struct vty *vty)
 }
 
 /* OSPF6 node structure. */
-struct cmd_node ospf6_node =
+static struct cmd_node ospf6_node =
 {
   OSPF6_NODE,
   "%s(config-ospf6)# ",

+ 1 - 1
ospf6d/ospf6_zebra.c

@@ -335,7 +335,7 @@ config_write_ospf6_zebra (struct vty *vty)
 }
 
 /* Zebra node structure. */
-struct cmd_node zebra_node =
+static struct cmd_node zebra_node =
 {
   ZEBRA_NODE,
   "%s(config-zebra)# ",

+ 1 - 1
ospf6d/ospf6d.c

@@ -92,7 +92,7 @@ DEFUN (show_version_ospf6,
   return CMD_SUCCESS;
 }
 
-struct cmd_node debug_node =
+static struct cmd_node debug_node =
 {
   DEBUG_NODE,
   "",

+ 1 - 1
ospfd/ospf_dump.c

@@ -1509,7 +1509,7 @@ DEFUN (show_debugging_ospf,
 }
 
 /* Debug node. */
-struct cmd_node debug_node =
+static struct cmd_node debug_node =
 {
   DEBUG_NODE,
   "",

+ 2 - 9
ospfd/ospf_vty.c

@@ -8073,7 +8073,7 @@ ospf_vty_show_init (void)
 
 
 /* ospfd's interface node. */
-struct cmd_node interface_node =
+static struct cmd_node interface_node =
 {
   INTERFACE_NODE,
   "%s(config-if)# ",
@@ -8184,13 +8184,6 @@ ospf_vty_if_init (void)
   install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd);
 }
 
-/* Zebra node structure. */
-struct cmd_node zebra_node =
-{
-  ZEBRA_NODE,
-  "%s(config-router)#",
-};
-
 static void
 ospf_vty_zebra_init (void)
 {
@@ -8283,7 +8276,7 @@ ospf_vty_zebra_init (void)
 #endif /* 0 */
 }
 
-struct cmd_node ospf_node =
+static struct cmd_node ospf_node =
 {
   OSPF_NODE,
   "%s(config-router)# ",

+ 1 - 1
ripd/rip_debug.c

@@ -203,7 +203,7 @@ DEFUN (no_debug_rip_zebra,
 }
 
 /* Debug node. */
-struct cmd_node debug_node =
+static struct cmd_node debug_node =
 {
   DEBUG_NODE,
   "",				/* Debug node has no interface. */

+ 1 - 1
ripd/rip_interface.c

@@ -2051,7 +2051,7 @@ config_write_rip_network (struct vty *vty, int config_mode)
   return 0;
 }
 
-struct cmd_node interface_node =
+static struct cmd_node interface_node =
 {
   INTERFACE_NODE,
   "%s(config-if)# ",

+ 1 - 1
ripd/rip_zebra.c

@@ -651,7 +651,7 @@ config_write_rip_redistribute (struct vty *vty, int config_mode)
 }
 
 /* Zebra node structure. */
-struct cmd_node zebra_node =
+static struct cmd_node zebra_node =
 {
   ZEBRA_NODE,
   "%s(config-router)# ",

+ 1 - 1
ripd/ripd.c

@@ -3680,7 +3680,7 @@ config_write_rip (struct vty *vty)
 }
 
 /* RIP node structure. */
-struct cmd_node rip_node =
+static struct cmd_node rip_node =
 {
   RIP_NODE,
   "%s(config-router)# ",

+ 1 - 1
ripngd/ripng_debug.c

@@ -204,7 +204,7 @@ DEFUN (no_debug_ripng_zebra,
 }
 
 /* Debug node. */
-struct cmd_node debug_node =
+static struct cmd_node debug_node =
 {
   DEBUG_NODE,
   "",				/* Debug node has no interface. */

+ 1 - 1
ripngd/ripng_interface.c

@@ -1200,7 +1200,7 @@ interface_config_write (struct vty *vty)
 }
 
 /* ripngd's interface node. */
-struct cmd_node interface_node =
+static struct cmd_node interface_node =
 {
   INTERFACE_NODE,
   "%s(config-if)# ",

+ 1 - 1
ripngd/ripng_zebra.c

@@ -538,7 +538,7 @@ zebra_config_write (struct vty *vty)
 }
 
 /* Zebra node structure. */
-struct cmd_node zebra_node =
+static struct cmd_node zebra_node =
 {
   ZEBRA_NODE,
   "%s(config-router)# ",

+ 1 - 1
ripngd/ripngd.c

@@ -2682,7 +2682,7 @@ ripng_config_write (struct vty *vty)
 }
 
 /* RIPng node structure. */
-struct cmd_node cmd_ripng_node =
+static struct cmd_node cmd_ripng_node =
 {
   RIPNG_NODE,
   "%s(config-router)# ",

+ 16 - 16
vtysh/vtysh.c

@@ -711,97 +711,97 @@ vtysh_completion (char *text, int start, int end)
 #endif
 
 /* Vty node structures. */
-struct cmd_node bgp_node =
+static struct cmd_node bgp_node =
 {
   BGP_NODE,
   "%s(config-router)# ",
 };
 
-struct cmd_node rip_node =
+static struct cmd_node rip_node =
 {
   RIP_NODE,
   "%s(config-router)# ",
 };
 
-struct cmd_node isis_node =
+static struct cmd_node isis_node =
 {
   ISIS_NODE,
   "%s(config-router)# ",
 };
 
-struct cmd_node interface_node =
+static struct cmd_node interface_node =
 {
   INTERFACE_NODE,
   "%s(config-if)# ",
 };
 
-struct cmd_node rmap_node =
+static struct cmd_node rmap_node =
 {
   RMAP_NODE,
   "%s(config-route-map)# "
 };
 
-struct cmd_node zebra_node =
+static struct cmd_node zebra_node =
 {
   ZEBRA_NODE,
   "%s(config-router)# "
 };
 
-struct cmd_node bgp_vpnv4_node =
+static struct cmd_node bgp_vpnv4_node =
 {
   BGP_VPNV4_NODE,
   "%s(config-router-af)# "
 };
 
-struct cmd_node bgp_ipv4_node =
+static struct cmd_node bgp_ipv4_node =
 {
   BGP_IPV4_NODE,
   "%s(config-router-af)# "
 };
 
-struct cmd_node bgp_ipv4m_node =
+static struct cmd_node bgp_ipv4m_node =
 {
   BGP_IPV4M_NODE,
   "%s(config-router-af)# "
 };
 
-struct cmd_node bgp_ipv6_node =
+static struct cmd_node bgp_ipv6_node =
 {
   BGP_IPV6_NODE,
   "%s(config-router-af)# "
 };
 
-struct cmd_node bgp_ipv6m_node =
+static struct cmd_node bgp_ipv6m_node =
 {
   BGP_IPV6M_NODE,
   "%s(config-router-af)# "
 };
 
-struct cmd_node ospf_node =
+static struct cmd_node ospf_node =
 {
   OSPF_NODE,
   "%s(config-router)# "
 };
 
-struct cmd_node ripng_node =
+static struct cmd_node ripng_node =
 {
   RIPNG_NODE,
   "%s(config-router)# "
 };
 
-struct cmd_node ospf6_node =
+static struct cmd_node ospf6_node =
 {
   OSPF6_NODE,
   "%s(config-ospf6)# "
 };
 
-struct cmd_node keychain_node =
+static struct cmd_node keychain_node =
 {
   KEYCHAIN_NODE,
   "%s(config-keychain)# "
 };
 
-struct cmd_node keychain_key_node =
+static struct cmd_node keychain_key_node =
 {
   KEYCHAIN_KEY_NODE,
   "%s(config-keychain-key)# "

+ 2 - 2
zebra/zebra_vty.c

@@ -2030,10 +2030,10 @@ static int config_write_protocol(struct vty *vty)
 }   
 
 /* table node for protocol filtering */
-struct cmd_node protocol_node = { PROTOCOL_NODE, "", 1 };
+static struct cmd_node protocol_node = { PROTOCOL_NODE, "", 1 };
 
 /* IP node for static routes. */
-struct cmd_node ip_node = { IP_NODE,  "",  1 };
+static struct cmd_node ip_node = { IP_NODE,  "",  1 };
 
 /* Route VTY.  */
 void

+ 2 - 2
zebra/zserv.c

@@ -1569,7 +1569,7 @@ config_write_table (struct vty *vty)
 }
 
 /* table node for routing tables. */
-struct cmd_node table_node =
+static struct cmd_node table_node =
 {
   TABLE_NODE,
   "",				/* This node has no interface. */
@@ -1689,7 +1689,7 @@ config_write_forwarding (struct vty *vty)
 }
 
 /* table node for routing tables. */
-struct cmd_node forwarding_node =
+static struct cmd_node forwarding_node =
 {
   FORWARDING_NODE,
   "",				/* This node has no interface. */