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>
diff --git a/bgpd/bgp_advertise.c b/bgpd/bgp_advertise.c
index be9b480..ecf531f 100644
--- a/bgpd/bgp_advertise.c
+++ b/bgpd/bgp_advertise.c
@@ -25,6 +25,7 @@
#include "prefix.h"
#include "hash.h"
#include "thread.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_table.h"
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index 9d49f34..6ab2937 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -29,6 +29,7 @@
#include "log.h"
#include "stream.h"
#include "jhash.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_aspath.h"
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index ef19bc4..ce8f8a0 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -29,6 +29,7 @@
#include "log.h"
#include "hash.h"
#include "jhash.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_attr.h"
diff --git a/bgpd/bgp_btoa.c b/bgpd/bgp_btoa.c
index b9ff67c..284b280 100644
--- a/bgpd/bgp_btoa.c
+++ b/bgpd/bgp_btoa.c
@@ -27,6 +27,7 @@
#include "command.h"
#include "memory.h"
#include "privs.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_dump.h"
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c
index db2cfa4..bb06028 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -23,6 +23,7 @@
#include "command.h"
#include "prefix.h"
#include "memory.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_community.h"
diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c
index 359fce3..ac64723 100644
--- a/bgpd/bgp_damp.c
+++ b/bgpd/bgp_damp.c
@@ -26,6 +26,7 @@
#include "command.h"
#include "log.h"
#include "thread.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_damp.h"
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index 1d09769..e3e5ca4 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -28,6 +28,7 @@
#include "str.h"
#include "log.h"
#include "sockunion.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_aspath.h"
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c
index 227fc7a..1fa0e65 100644
--- a/bgpd/bgp_dump.c
+++ b/bgpd/bgp_dump.c
@@ -27,8 +27,9 @@
#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"
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index 04957d4..c76f01e 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -24,6 +24,7 @@
#include "memory.h"
#include "prefix.h"
#include "command.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_ecommunity.h"
diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c
index fd8ece6..26819fc 100644
--- a/bgpd/bgp_filter.c
+++ b/bgpd/bgp_filter.c
@@ -24,6 +24,7 @@
#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 @@
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;
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 1823336..c4cfd58 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -31,6 +31,7 @@
#include "memory.h"
#include "plist.h"
#include "workqueue.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_attr.h"
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c
index 98b75b6..9eaf3c2 100644
--- a/bgpd/bgp_mpath.c
+++ b/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"
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 75c90cd..0c4533b 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -25,6 +25,7 @@
#include "log.h"
#include "memory.h"
#include "stream.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_table.h"
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index 3c5e6c5..81a6a79 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -31,6 +31,7 @@
#include "privs.h"
#include "linklist.h"
#include "network.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_fsm.h"
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 607d99b..fa2f488 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -30,6 +30,7 @@
#include "memory.h"
#include "hash.h"
#include "jhash.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_table.h"
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 23090eb..7a5f5ce 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -27,6 +27,7 @@
#include "log.h"
#include "command.h"
#include "memory.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_attr.h"
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 0639f4d..ec60069 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -31,6 +31,7 @@
#include "sockopt.h"
#include "linklist.h"
#include "plist.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_table.h"
diff --git a/bgpd/bgp_regex.c b/bgpd/bgp_regex.c
index 9b65f7c..13fa829 100644
--- a/bgpd/bgp_regex.c
+++ b/bgpd/bgp_regex.c
@@ -23,6 +23,7 @@
#include "log.h"
#include "command.h"
#include "memory.h"
+#include "filter.h"
#include "bgpd.h"
#include "bgp_aspath.h"
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 662186b..c4490bf 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -30,6 +30,7 @@
#include "command.h"
#include "thread.h"
#include "smux.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_table.h"
diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c
index 7a6c675..92bb957 100644
--- a/bgpd/bgp_table.c
+++ b/bgpd/bgp_table.c
@@ -24,6 +24,7 @@
#include "memory.h"
#include "sockunion.h"
#include "vty.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_table.h"
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 36fd263..efbd8db 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -30,6 +30,7 @@
#include "log.h"
#include "memory.h"
#include "hash.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_advertise.h"
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 186657b..4a25aa9 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -29,6 +29,7 @@
#include "zclient.h"
#include "routemap.h"
#include "thread.h"
+#include "filter.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_route.h"
diff --git a/lib/filter.h b/lib/filter.h
index 37535cb..e6ccd33 100644
--- a/lib/filter.h
+++ b/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
{
diff --git a/lib/zebra.h b/lib/zebra.h
index a9c76c6..5f45a3a 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -491,11 +491,6 @@
#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
diff --git a/tests/aspath_test.c b/tests/aspath_test.c
index 0aa3e47..5a0899e 100644
--- a/tests/aspath_test.c
+++ b/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"
diff --git a/tests/bgp_capability_test.c b/tests/bgp_capability_test.c
index 3cfc198..a381351 100644
--- a/tests/bgp_capability_test.c
+++ b/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"
diff --git a/tests/bgp_mp_attr_test.c b/tests/bgp_mp_attr_test.c
index d649e14..6dc6757 100644
--- a/tests/bgp_mp_attr_test.c
+++ b/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"
diff --git a/tests/bgp_mpath_test.c b/tests/bgp_mpath_test.c
index dbbf0dd..a953ce9 100644
--- a/tests/bgp_mpath_test.c
+++ b/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"
diff --git a/tests/ecommunity_test.c b/tests/ecommunity_test.c
index f12aa71..23ee405 100644
--- a/tests/ecommunity_test.c
+++ b/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"