]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/zebra.h
Merge pull request #5778 from ton31337/fix/add_doc_for_ebgp_connected_route_check
[mirror_frr.git] / lib / zebra.h
index 2f9ada09beb7c5665fedc7a5afc37cdf1e2a494c..b2f0202c53865ee73bda6b114a4685ee38056bf7 100644 (file)
@@ -54,8 +54,9 @@ typedef unsigned char uint8_t;
 #ifdef HAVE_SYS_SYSCTL_H
 #ifdef GNU_LINUX
 #include <linux/types.h>
-#endif
+#else
 #include <sys/sysctl.h>
+#endif
 #endif /* HAVE_SYS_SYSCTL_H */
 #include <sys/ioctl.h>
 #ifdef HAVE_SYS_CONF_H
@@ -134,6 +135,11 @@ typedef unsigned char uint8_t;
 #endif
 #endif
 
+#ifdef CRYPTO_OPENSSL
+#include <openssl/evp.h>
+#include <openssl/hmac.h>
+#endif
+
 #include "openbsd-tree.h"
 
 #include <netinet/in.h>
@@ -244,13 +250,6 @@ size_t strlcpy(char *__restrict dest,
               const char *__restrict src, size_t destsize);
 #endif
 
-/* GCC have printf type attribute check.  */
-#ifdef __GNUC__
-#define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b)))
-#else
-#define PRINTF_ATTRIBUTE(a,b)
-#endif /* __GNUC__ */
-
 /*
  * RFC 3542 defines several macros for using struct cmsghdr.
  * Here, we define those that are not present
@@ -361,8 +360,11 @@ typedef enum {
        AFI_MAX = 4
 } afi_t;
 
+#define IS_VALID_AFI(a) ((a) > AFI_UNSPEC && (a) < AFI_MAX)
+
 /* Subsequent Address Family Identifier. */
 typedef enum {
+       SAFI_UNSPEC = 0,
        SAFI_UNICAST = 1,
        SAFI_MULTICAST = 2,
        SAFI_MPLS_VPN = 3,
@@ -373,35 +375,6 @@ typedef enum {
        SAFI_MAX = 8
 } safi_t;
 
-/*
- * The above AFI and SAFI definitions are for internal use. The protocol
- * definitions (IANA values) as for example used in BGP protocol packets
- * are defined below and these will get mapped to/from the internal values
- * in the appropriate places.
- * The rationale is that the protocol (IANA) values may be sparse and are
- * not optimal for use in data-structure sizing.
- * Note: Only useful (i.e., supported) values are defined below.
- */
-typedef enum {
-       IANA_AFI_RESERVED = 0,
-       IANA_AFI_IPV4 = 1,
-       IANA_AFI_IPV6 = 2,
-       IANA_AFI_L2VPN = 25,
-       IANA_AFI_IPMR = 128,
-       IANA_AFI_IP6MR = 129
-} iana_afi_t;
-
-typedef enum {
-       IANA_SAFI_RESERVED = 0,
-       IANA_SAFI_UNICAST = 1,
-       IANA_SAFI_MULTICAST = 2,
-       IANA_SAFI_LABELED_UNICAST = 4,
-       IANA_SAFI_ENCAP = 7,
-       IANA_SAFI_EVPN = 70,
-       IANA_SAFI_MPLS_VPN = 128,
-       IANA_SAFI_FLOWSPEC = 133
-} iana_safi_t;
-
 /* Default Administrative Distance of each protocol. */
 #define ZEBRA_KERNEL_DISTANCE_DEFAULT      0
 #define ZEBRA_CONNECT_DISTANCE_DEFAULT     0
@@ -439,76 +412,4 @@ typedef uint32_t route_tag_t;
 #define ROUTE_TAG_MAX UINT32_MAX
 #define ROUTE_TAG_PRI PRIu32
 
-static inline afi_t afi_iana2int(iana_afi_t afi)
-{
-       switch (afi) {
-       case IANA_AFI_IPV4:
-               return AFI_IP;
-       case IANA_AFI_IPV6:
-               return AFI_IP6;
-       case IANA_AFI_L2VPN:
-               return AFI_L2VPN;
-       default:
-               return AFI_MAX;
-       }
-}
-
-static inline iana_afi_t afi_int2iana(afi_t afi)
-{
-       switch (afi) {
-       case AFI_IP:
-               return IANA_AFI_IPV4;
-       case AFI_IP6:
-               return IANA_AFI_IPV6;
-       case AFI_L2VPN:
-               return IANA_AFI_L2VPN;
-       default:
-               return IANA_AFI_RESERVED;
-       }
-}
-
-static inline safi_t safi_iana2int(iana_safi_t safi)
-{
-       switch (safi) {
-       case IANA_SAFI_UNICAST:
-               return SAFI_UNICAST;
-       case IANA_SAFI_MULTICAST:
-               return SAFI_MULTICAST;
-       case IANA_SAFI_MPLS_VPN:
-               return SAFI_MPLS_VPN;
-       case IANA_SAFI_ENCAP:
-               return SAFI_ENCAP;
-       case IANA_SAFI_EVPN:
-               return SAFI_EVPN;
-       case IANA_SAFI_LABELED_UNICAST:
-               return SAFI_LABELED_UNICAST;
-       case IANA_SAFI_FLOWSPEC:
-               return SAFI_FLOWSPEC;
-       default:
-               return SAFI_MAX;
-       }
-}
-
-static inline iana_safi_t safi_int2iana(safi_t safi)
-{
-       switch (safi) {
-       case SAFI_UNICAST:
-               return IANA_SAFI_UNICAST;
-       case SAFI_MULTICAST:
-               return IANA_SAFI_MULTICAST;
-       case SAFI_MPLS_VPN:
-               return IANA_SAFI_MPLS_VPN;
-       case SAFI_ENCAP:
-               return IANA_SAFI_ENCAP;
-       case SAFI_EVPN:
-               return IANA_SAFI_EVPN;
-       case SAFI_LABELED_UNICAST:
-               return IANA_SAFI_LABELED_UNICAST;
-       case SAFI_FLOWSPEC:
-               return IANA_SAFI_FLOWSPEC;
-       default:
-               return IANA_SAFI_RESERVED;
-       }
-}
-
 #endif /* _ZEBRA_H */