From b2f0fa552bf1a8523b7f94fd6c758f4a720b62b6 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Fri, 20 Jan 2017 11:44:18 +0100 Subject: [PATCH] bgpd: move bgp_show_type enumerate to bgp_route.h This bgp_show_type enumerate was duplicated and modified in several places. The commit takes the enumerate with the biggest enumerate, so that it can be used by all the functions using this enumerate. Signed-off-by: Philippe Guibert --- bgpd/bgp_encap.c | 16 ---------------- bgpd/bgp_main.c | 1 + bgpd/bgp_mplsvpn.c | 16 ---------------- bgpd/bgp_route.c | 21 --------------------- bgpd/bgp_route.h | 22 ++++++++++++++++++++++ bgpd/rfapi/rfapi_vty.c | 1 + bgpd/rfapi/vnc_import_bgp.c | 1 + 7 files changed, 25 insertions(+), 53 deletions(-) diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c index fe08dbf991..201f7bde06 100644 --- a/bgpd/bgp_encap.c +++ b/bgpd/bgp_encap.c @@ -332,22 +332,6 @@ show_adj_route_encap (struct vty *vty, struct peer *peer, struct prefix_rd *prd) return CMD_SUCCESS; } -enum bgp_show_type -{ - bgp_show_type_normal, - bgp_show_type_regexp, - bgp_show_type_prefix_list, - bgp_show_type_filter_list, - bgp_show_type_neighbor, - bgp_show_type_cidr_only, - bgp_show_type_prefix_longer, - bgp_show_type_community_all, - bgp_show_type_community, - bgp_show_type_community_exact, - bgp_show_type_community_list, - bgp_show_type_community_list_exact -}; - int bgp_show_encap ( struct vty *vty, diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 33191f0a98..23514dece4 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -43,6 +43,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgpd.h" #include "bgpd/bgp_attr.h" +#include "bgpd/bgp_route.h" #include "bgpd/bgp_mplsvpn.h" #include "bgpd/bgp_aspath.h" #include "bgpd/bgp_dump.h" diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 51f2984a4e..7a2717acc0 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -733,22 +733,6 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u return CMD_SUCCESS; } -enum bgp_show_type -{ - bgp_show_type_normal, - bgp_show_type_regexp, - bgp_show_type_prefix_list, - bgp_show_type_filter_list, - bgp_show_type_neighbor, - bgp_show_type_cidr_only, - bgp_show_type_prefix_longer, - bgp_show_type_community_all, - bgp_show_type_community, - bgp_show_type_community_exact, - bgp_show_type_community_list, - bgp_show_type_community_list_exact -}; - int bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd, enum bgp_show_type type, void *output_arg, int tags, u_char use_json) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index c462d1ee16..f9cdc1a0db 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7214,27 +7214,6 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p, #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s" #define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path%s" -enum bgp_show_type -{ - bgp_show_type_normal, - bgp_show_type_regexp, - bgp_show_type_prefix_list, - bgp_show_type_filter_list, - bgp_show_type_route_map, - bgp_show_type_neighbor, - bgp_show_type_cidr_only, - bgp_show_type_prefix_longer, - bgp_show_type_community_all, - bgp_show_type_community, - bgp_show_type_community_exact, - bgp_show_type_community_list, - bgp_show_type_community_list_exact, - bgp_show_type_flap_statistics, - bgp_show_type_flap_neighbor, - bgp_show_type_dampend_paths, - bgp_show_type_damp_neighbor -}; - static int bgp_show_prefix_list (struct vty *vty, const char *name, const char *prefix_list_str, afi_t afi, diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index 3c7aa83a0e..f2e6273b84 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -26,6 +26,28 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA struct bgp_nexthop_cache; +enum bgp_show_type +{ + bgp_show_type_normal, + bgp_show_type_regexp, + bgp_show_type_prefix_list, + bgp_show_type_filter_list, + bgp_show_type_route_map, + bgp_show_type_neighbor, + bgp_show_type_cidr_only, + bgp_show_type_prefix_longer, + bgp_show_type_community_all, + bgp_show_type_community, + bgp_show_type_community_exact, + bgp_show_type_community_list, + bgp_show_type_community_list_exact, + bgp_show_type_flap_statistics, + bgp_show_type_flap_neighbor, + bgp_show_type_dampend_paths, + bgp_show_type_damp_neighbor +}; + + #define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, "\ "h history, * valid, > best, = multipath,%s"\ " i internal, r RIB-failure, S Stale, R Removed%s" diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 3e179b7f72..1e7941a41d 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -35,6 +35,7 @@ #include "bgpd/bgpd.h" #include "bgpd/bgp_ecommunity.h" #include "bgpd/bgp_attr.h" +#include "bgpd/bgp_route.h" #include "bgpd/bgp_mplsvpn.h" #include "bgpd/rfapi/bgp_rfapi_cfg.h" diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c index 4801e2906a..62c31a662a 100644 --- a/bgpd/rfapi/vnc_import_bgp.c +++ b/bgpd/rfapi/vnc_import_bgp.c @@ -37,6 +37,7 @@ #include "bgpd/bgpd.h" #include "bgpd/bgp_ecommunity.h" #include "bgpd/bgp_attr.h" +#include "bgpd/bgp_route.h" #include "bgpd/bgp_mplsvpn.h" /* for RD_TYPE_IP */ #include "bgpd/rfapi/vnc_export_bgp.h" -- 2.39.5