]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/zebra.h
'neighbor <if-name> interface' config support in BGP including RA/Zebra changes.
[mirror_frr.git] / lib / zebra.h
index 1c9eb39ff81533c1271520090ac9d647bc2d783a..7d68530baa4885b03875f6f81f88e340b22a69f1 100644 (file)
@@ -40,6 +40,7 @@ typedef int socklen_t;
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stddef.h>
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -50,12 +51,10 @@ typedef int socklen_t;
 #ifdef HAVE_STROPTS_H
 #include <stropts.h>
 #endif /* HAVE_STROPTS_H */
-#include <sys/fcntl.h>
 #ifdef HAVE_SYS_SELECT_H
 #include <sys/select.h>
 #endif /* HAVE_SYS_SELECT_H */
 #include <sys/stat.h>
-#include <sys/time.h>
 #include <sys/types.h>
 #include <sys/param.h>
 #ifdef HAVE_SYS_SYSCTL_H
@@ -72,7 +71,16 @@ typedef int socklen_t;
 #include <sys/ksym.h>
 #endif /* HAVE_SYS_KSYM_H */
 #include <syslog.h>
-#include <time.h>
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif /* TIME_WITH_SYS_TIME */
 #include <sys/uio.h>
 #include <sys/utsname.h>
 #ifdef HAVE_RUSAGE
@@ -116,9 +124,6 @@ typedef int socklen_t;
 #endif /* !va_copy */
 #endif /* !C99 */
 
-#ifdef HAVE_BSD_LINK_DETECT
-#include <net/if_media.h>
-#endif /* HAVE_BSD_LINK_DETECT*/
 
 #ifdef HAVE_LCAPS
 #include <sys/capability.h>
@@ -137,6 +142,10 @@ typedef int socklen_t;
 #include <sys/sockio.h>
 #endif /* HAVE_SYS_SOCKIO_H */
 
+#ifdef __APPLE__
+#define __APPLE_USE_RFC_3542
+#endif
+
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif /* HAVE_NETINET_IN_H */
@@ -165,6 +174,7 @@ typedef int socklen_t;
 #ifdef HAVE_NETLINK
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
+#include <linux/filter.h>
 #else
 #define RT_TABLE_MAIN          0
 #endif /* HAVE_NETLINK */
@@ -230,10 +240,6 @@ typedef int socklen_t;
 #define UINT32_MAX     (4294967295U)
 #endif
 
-#ifdef HAVE_LIBUTIL_H
-#include <libutil.h>
-#endif /* HAVE_LIBUTIL_H */
-
 #ifdef HAVE_GLIBC_BACKTRACE
 #include <execinfo.h>
 #endif /* HAVE_GLIBC_BACKTRACE */
@@ -354,6 +360,7 @@ struct in_pktinfo
  */
 #if defined(__NetBSD__) || defined(__FreeBSD__) \
    || (defined(__OpenBSD__) && (OpenBSD < 200311)) \
+   || (defined(__APPLE__)) \
    || (defined(SUNOS_5) && defined(WORDS_BIGENDIAN))
 #define HAVE_IP_HDRINCL_BSD_ORDER
 #endif
@@ -383,6 +390,8 @@ struct in_pktinfo
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 #endif
 
+#define ZEBRA_NUM_OF(x) (sizeof (x) / sizeof (x[0]))
+
 /* For old definition. */
 #ifndef IN6_ARE_ADDR_EQUAL
 #define IN6_ARE_ADDR_EQUAL IN6_IS_ADDR_EQUAL
@@ -414,7 +423,13 @@ struct in_pktinfo
 #define ZEBRA_ROUTER_ID_ADD               20
 #define ZEBRA_ROUTER_ID_DELETE            21
 #define ZEBRA_ROUTER_ID_UPDATE            22
-#define ZEBRA_MESSAGE_MAX                 23
+#define ZEBRA_HELLO                       23
+#define ZEBRA_NEXTHOP_REGISTER            24
+#define ZEBRA_NEXTHOP_UNREGISTER          25
+#define ZEBRA_NEXTHOP_UPDATE              26
+#define ZEBRA_INTERFACE_NBR_ADDRESS_ADD   27
+#define ZEBRA_INTERFACE_NBR_ADDRESS_DELETE 28
+#define ZEBRA_MESSAGE_MAX                 29
 
 /* Marker value used in new Zserv, in the byte location corresponding
  * the command value in the old zserv header. To allow old and new
@@ -422,19 +437,8 @@ struct in_pktinfo
  */
 #define ZEBRA_HEADER_MARKER              255
 
-/* Zebra route's types. */
-#define ZEBRA_ROUTE_SYSTEM               0
-#define ZEBRA_ROUTE_KERNEL               1
-#define ZEBRA_ROUTE_CONNECT              2
-#define ZEBRA_ROUTE_STATIC               3
-#define ZEBRA_ROUTE_RIP                  4
-#define ZEBRA_ROUTE_RIPNG                5
-#define ZEBRA_ROUTE_OSPF                 6
-#define ZEBRA_ROUTE_OSPF6                7
-#define ZEBRA_ROUTE_ISIS                 8
-#define ZEBRA_ROUTE_BGP                  9
-#define ZEBRA_ROUTE_HSLS                10
-#define ZEBRA_ROUTE_MAX                  11
+/* Zebra route's types are defined in route_types.h */
+#include "route_types.h"
 
 /* Note: whenever a new route-type or zserv-command is added the
  * corresponding {command,route}_types[] table in lib/log.c MUST be
@@ -448,6 +452,10 @@ extern char zebra_route_char(unsigned int route_type);
  * e.g. ZEBRA_INTERFACE_ADD -> "ZEBRA_INTERFACE_ADD" */
 /* Map a protocol name to its number. e.g. ZEBRA_ROUTE_BGP->9*/
 extern int proto_name2num(const char *s);
+/* Map redistribute X argument to protocol number.
+ * unlike proto_name2num, this accepts shorthands and takes
+ * an AFI value to restrict input */
+extern int proto_redistnum(int afi, const char *s);
 
 extern const char *zserv_command_string (unsigned int command);
 
@@ -497,7 +505,7 @@ extern const char *zserv_command_string (unsigned int command);
 /* Subsequent Address Family Identifier. */
 #define SAFI_UNICAST              1
 #define SAFI_MULTICAST            2
-#define SAFI_UNICAST_MULTICAST    3
+#define SAFI_RESERVED_3           3
 #define SAFI_MPLS_VPN             4
 #define SAFI_MAX                  5
 
@@ -522,6 +530,7 @@ extern const char *zserv_command_string (unsigned int command);
 #define CHECK_FLAG(V,F)      ((V) & (F))
 #define SET_FLAG(V,F)        (V) |= (F)
 #define UNSET_FLAG(V,F)      (V) &= ~(F)
+#define RESET_FLAG(V)        (V) = 0
 
 /* AFI and SAFI type. */
 typedef u_int16_t afi_t;