Skip to content

Commit

Permalink
[cleanup] Make command nodes static
Browse files Browse the repository at this point in the history
The cmd_nodes used to configure vty, can mostly be static so
(basic data hiding 101).
  • Loading branch information
Stephen Hemminger authored and pjakma committed Jun 12, 2009
1 parent 66e5cd8 commit 7fc626d
Show file tree
Hide file tree
Showing 29 changed files with 61 additions and 68 deletions.
2 changes: 1 addition & 1 deletion bgpd/bgp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
"",
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
"",
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
"",
Expand Down
14 changes: 7 additions & 7 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down Expand Up @@ -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,
"",
Expand Down
2 changes: 1 addition & 1 deletion isisd/isis_circuit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion isisd/isisd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions lib/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down
4 changes: 2 additions & 2 deletions lib/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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,
"",
Expand Down
4 changes: 2 additions & 2 deletions lib/keychain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down
4 changes: 2 additions & 2 deletions lib/plist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion lib/routemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down
2 changes: 1 addition & 1 deletion lib/smux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion ospf6d/ospf6_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down
2 changes: 1 addition & 1 deletion ospf6d/ospf6_top.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down
2 changes: 1 addition & 1 deletion ospf6d/ospf6_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down
2 changes: 1 addition & 1 deletion ospf6d/ospf6d.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ DEFUN (show_version_ospf6,
return CMD_SUCCESS;
}

struct cmd_node debug_node =
static struct cmd_node debug_node =
{
DEBUG_NODE,
"",
Expand Down
2 changes: 1 addition & 1 deletion ospfd/ospf_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ DEFUN (show_debugging_ospf,
}

/* Debug node. */
struct cmd_node debug_node =
static struct cmd_node debug_node =
{
DEBUG_NODE,
"",
Expand Down
11 changes: 2 additions & 9 deletions ospfd/ospf_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)# ",
Expand Down
2 changes: 1 addition & 1 deletion ripd/rip_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion ripd/rip_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down
2 changes: 1 addition & 1 deletion ripd/rip_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down
2 changes: 1 addition & 1 deletion ripd/ripd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down
2 changes: 1 addition & 1 deletion ripngd/ripng_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion ripngd/ripng_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down
2 changes: 1 addition & 1 deletion ripngd/ripng_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down
2 changes: 1 addition & 1 deletion ripngd/ripngd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)# ",
Expand Down
Loading

0 comments on commit 7fc626d

Please sign in to comment.