Browse Source

lib, bgpd, tests: Refactor FILTER_X in zebra.h

lib/zebra.h has FILTER_X #define's.  These do not belong there.
Put them in lib/filter.h where they belong.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp 3 years ago
parent
commit
0490729cc0

+ 1 - 0
bgpd/bgp_advertise.c

@@ -25,6 +25,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "prefix.h"
 #include "hash.h"
 #include "thread.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_table.h"

+ 1 - 0
bgpd/bgp_aspath.c

@@ -29,6 +29,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "log.h"
 #include "stream.h"
 #include "jhash.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_aspath.h"

+ 1 - 0
bgpd/bgp_attr.c

@@ -29,6 +29,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "log.h"
 #include "hash.h"
 #include "jhash.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_attr.h"

+ 1 - 0
bgpd/bgp_btoa.c

@@ -27,6 +27,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "command.h"
 #include "memory.h"
 #include "privs.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_dump.h"

+ 1 - 0
bgpd/bgp_clist.c

@@ -23,6 +23,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "command.h"
 #include "prefix.h"
 #include "memory.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_community.h"

+ 1 - 0
bgpd/bgp_damp.c

@@ -26,6 +26,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "command.h"
 #include "log.h"
 #include "thread.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_damp.h"

+ 1 - 0
bgpd/bgp_debug.c

@@ -28,6 +28,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "str.h"
 #include "log.h"
 #include "sockunion.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_aspath.h"

+ 2 - 1
bgpd/bgp_dump.c

@@ -27,8 +27,9 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "prefix.h"
 #include "thread.h"
 #include "linklist.h"
-#include "bgpd/bgp_table.h"
+#include "filter.h"
 
+#include "bgpd/bgp_table.h"
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_route.h"
 #include "bgpd/bgp_attr.h"

+ 1 - 0
bgpd/bgp_ecommunity.c

@@ -24,6 +24,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "memory.h"
 #include "prefix.h"
 #include "command.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_ecommunity.h"

+ 2 - 7
bgpd/bgp_filter.c

@@ -24,6 +24,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "log.h"
 #include "memory.h"
 #include "buffer.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_aspath.h"
@@ -65,18 +66,12 @@ struct as_filter
   char *reg_str;
 };
 
-enum as_list_type
-{
-  ACCESS_TYPE_STRING,
-  ACCESS_TYPE_NUMBER
-};
-
 /* AS path filter list. */
 struct as_list
 {
   char *name;
 
-  enum as_list_type type;
+  enum access_type type;
 
   struct as_list *next;
   struct as_list *prev;

+ 1 - 0
bgpd/bgp_fsm.c

@@ -31,6 +31,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "memory.h"
 #include "plist.h"
 #include "workqueue.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_attr.h"

+ 1 - 0
bgpd/bgp_mpath.c

@@ -28,6 +28,7 @@
 #include "linklist.h"
 #include "sockunion.h"
 #include "memory.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_table.h"

+ 1 - 0
bgpd/bgp_mplsvpn.c

@@ -25,6 +25,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "log.h"
 #include "memory.h"
 #include "stream.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_table.h"

+ 1 - 0
bgpd/bgp_network.c

@@ -31,6 +31,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "privs.h"
 #include "linklist.h"
 #include "network.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_fsm.h"

+ 1 - 0
bgpd/bgp_nexthop.c

@@ -30,6 +30,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "memory.h"
 #include "hash.h"
 #include "jhash.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_table.h"

+ 1 - 0
bgpd/bgp_open.c

@@ -27,6 +27,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "log.h"
 #include "command.h"
 #include "memory.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_attr.h"

+ 1 - 0
bgpd/bgp_packet.c

@@ -31,6 +31,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "sockopt.h"
 #include "linklist.h"
 #include "plist.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_table.h"

+ 1 - 0
bgpd/bgp_regex.c

@@ -23,6 +23,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "log.h"
 #include "command.h"
 #include "memory.h"
+#include "filter.h"
 
 #include "bgpd.h"
 #include "bgp_aspath.h"

+ 1 - 0
bgpd/bgp_snmp.c

@@ -30,6 +30,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "command.h"
 #include "thread.h"
 #include "smux.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_table.h"

+ 1 - 0
bgpd/bgp_table.c

@@ -24,6 +24,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "memory.h"
 #include "sockunion.h"
 #include "vty.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_table.h"

+ 1 - 0
bgpd/bgp_vty.c

@@ -30,6 +30,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "log.h"
 #include "memory.h"
 #include "hash.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_advertise.h"

+ 1 - 0
bgpd/bgp_zebra.c

@@ -29,6 +29,7 @@ Boston, MA 02111-1307, USA.  */
 #include "zclient.h"
 #include "routemap.h"
 #include "thread.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_route.h"

+ 5 - 0
lib/filter.h

@@ -25,6 +25,11 @@
 
 #include "if.h"
 
+/* Filter direction.  */
+#define FILTER_IN                 0
+#define FILTER_OUT                1
+#define FILTER_MAX                2
+
 /* Filter type is made by `permit', `deny' and `dynamic'. */
 enum filter_type 
 {

+ 0 - 5
lib/zebra.h

@@ -491,11 +491,6 @@ typedef enum {
 #define SAFI_MPLS_VPN             4
 #define SAFI_MAX                  5
 
-/* Filter direction.  */
-#define FILTER_IN                 0
-#define FILTER_OUT                1
-#define FILTER_MAX                2
-
 /* Default Administrative Distance of each protocol. */
 #define ZEBRA_KERNEL_DISTANCE_DEFAULT      0
 #define ZEBRA_CONNECT_DISTANCE_DEFAULT     0

+ 1 - 0
tests/aspath_test.c

@@ -24,6 +24,7 @@
 #include "vty.h"
 #include "stream.h"
 #include "privs.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_aspath.h"

+ 1 - 0
tests/bgp_capability_test.c

@@ -25,6 +25,7 @@
 #include "stream.h"
 #include "privs.h"
 #include "memory.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_open.h"

+ 1 - 0
tests/bgp_mp_attr_test.c

@@ -25,6 +25,7 @@
 #include "stream.h"
 #include "privs.h"
 #include "memory.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_attr.h"

+ 1 - 0
tests/bgp_mpath_test.c

@@ -29,6 +29,7 @@
 #include "linklist.h"
 #include "memory.h"
 #include "zclient.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_table.h"

+ 1 - 0
tests/ecommunity_test.c

@@ -24,6 +24,7 @@
 #include "stream.h"
 #include "privs.h"
 #include "memory.h"
+#include "filter.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_ecommunity.h"