[cleanup] Make command nodes static

The cmd_nodes used to configure vty, can mostly be static so
(basic data hiding 101).
This commit is contained in:
Stephen Hemminger 2008-12-01 11:10:34 -08:00 committed by Paul Jakma
parent 66e5cd8719
commit 7fc626de5f
29 changed files with 61 additions and 68 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2030,10 +2030,10 @@ static int config_write_protocol(struct vty *vty)
} }
/* table node for protocol filtering */ /* 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. */ /* IP node for static routes. */
struct cmd_node ip_node = { IP_NODE, "", 1 }; static struct cmd_node ip_node = { IP_NODE, "", 1 };
/* Route VTY. */ /* Route VTY. */
void void

View File

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