version 1.1, 2012/02/21 17:26:12
|
version 1.1.1.4, 2016/11/02 10:09:11
|
Line 27 Software Foundation, Inc., 59 Temple Place - Suite 330
|
Line 27 Software Foundation, Inc., 59 Temple Place - Suite 330
|
|
|
#ifdef SUNOS_5 |
#ifdef SUNOS_5 |
#define _XPG4_2 |
#define _XPG4_2 |
#define __EXTENSIONS__ |
|
typedef unsigned int u_int32_t; |
typedef unsigned int u_int32_t; |
typedef unsigned short u_int16_t; |
typedef unsigned short u_int16_t; |
typedef unsigned char u_int8_t; |
typedef unsigned char u_int8_t; |
Line 40 typedef int socklen_t;
|
Line 39 typedef int socklen_t;
|
#include <unistd.h> |
#include <unistd.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
|
#include <stddef.h> |
#include <ctype.h> |
#include <ctype.h> |
#include <errno.h> |
#include <errno.h> |
#include <fcntl.h> |
#include <fcntl.h> |
Line 50 typedef int socklen_t;
|
Line 50 typedef int socklen_t;
|
#ifdef HAVE_STROPTS_H |
#ifdef HAVE_STROPTS_H |
#include <stropts.h> |
#include <stropts.h> |
#endif /* HAVE_STROPTS_H */ |
#endif /* HAVE_STROPTS_H */ |
#include <sys/fcntl.h> |
|
#ifdef HAVE_SYS_SELECT_H |
#ifdef HAVE_SYS_SELECT_H |
#include <sys/select.h> |
#include <sys/select.h> |
#endif /* HAVE_SYS_SELECT_H */ |
#endif /* HAVE_SYS_SELECT_H */ |
Line 92 typedef int socklen_t;
|
Line 91 typedef int socklen_t;
|
#ifdef HAVE_INTTYPES_H |
#ifdef HAVE_INTTYPES_H |
#include <inttypes.h> |
#include <inttypes.h> |
#endif /* HAVE_INTTYPES_H */ |
#endif /* HAVE_INTTYPES_H */ |
|
#ifdef HAVE_STDBOOL_H |
|
#include <stdbool.h> |
|
#endif |
|
|
/* machine dependent includes */ |
/* machine dependent includes */ |
#ifdef SUNOS_5 |
#ifdef SUNOS_5 |
Line 142 typedef int socklen_t;
|
Line 144 typedef int socklen_t;
|
#include <sys/sockio.h> |
#include <sys/sockio.h> |
#endif /* HAVE_SYS_SOCKIO_H */ |
#endif /* HAVE_SYS_SOCKIO_H */ |
|
|
|
#ifdef __APPLE__ |
|
#define __APPLE_USE_RFC_3542 |
|
#endif |
|
|
#ifdef HAVE_NETINET_IN_H |
#ifdef HAVE_NETINET_IN_H |
#include <netinet/in.h> |
#include <netinet/in.h> |
#endif /* HAVE_NETINET_IN_H */ |
#endif /* HAVE_NETINET_IN_H */ |
Line 171 typedef int socklen_t;
|
Line 177 typedef int socklen_t;
|
#include <linux/netlink.h> |
#include <linux/netlink.h> |
#include <linux/rtnetlink.h> |
#include <linux/rtnetlink.h> |
#include <linux/filter.h> |
#include <linux/filter.h> |
#include <stddef.h> |
|
#else |
#else |
#define RT_TABLE_MAIN 0 |
#define RT_TABLE_MAIN 0 |
#endif /* HAVE_NETLINK */ |
#endif /* HAVE_NETLINK */ |
Line 241 typedef int socklen_t;
|
Line 246 typedef int socklen_t;
|
#include <execinfo.h> |
#include <execinfo.h> |
#endif /* HAVE_GLIBC_BACKTRACE */ |
#endif /* HAVE_GLIBC_BACKTRACE */ |
|
|
#ifdef BSDI_NRL |
|
|
|
#ifdef HAVE_NETINET6_IN6_H |
|
#include <netinet6/in6.h> |
|
#endif /* HAVE_NETINET6_IN6_H */ |
|
|
|
#ifdef NRL |
|
#include <netinet6/in6.h> |
|
#endif /* NRL */ |
|
|
|
#define IN6_ARE_ADDR_EQUAL IN6_IS_ADDR_EQUAL |
|
|
|
#endif /* BSDI_NRL */ |
|
|
|
/* Local includes: */ |
/* Local includes: */ |
#if !(defined(__GNUC__) || defined(VTYSH_EXTRACT_PL)) |
#if !(defined(__GNUC__) || defined(VTYSH_EXTRACT_PL)) |
#define __attribute__(x) |
#define __attribute__(x) |
Line 355 struct in_pktinfo
|
Line 346 struct in_pktinfo
|
* OpenBSD: network byte order, apart from older versions which are as per |
* OpenBSD: network byte order, apart from older versions which are as per |
* *BSD |
* *BSD |
*/ |
*/ |
#if defined(__NetBSD__) || defined(__FreeBSD__) \ | #if defined(__NetBSD__) \ |
| || (defined(__FreeBSD__) && (__FreeBSD_version < 1100030)) \ |
|| (defined(__OpenBSD__) && (OpenBSD < 200311)) \ |
|| (defined(__OpenBSD__) && (OpenBSD < 200311)) \ |
|
|| (defined(__APPLE__)) \ |
|| (defined(SUNOS_5) && defined(WORDS_BIGENDIAN)) |
|| (defined(SUNOS_5) && defined(WORDS_BIGENDIAN)) |
#define HAVE_IP_HDRINCL_BSD_ORDER |
#define HAVE_IP_HDRINCL_BSD_ORDER |
#endif |
#endif |
Line 386 struct in_pktinfo
|
Line 379 struct in_pktinfo
|
#define MIN(a, b) ((a) < (b) ? (a) : (b)) |
#define MIN(a, b) ((a) < (b) ? (a) : (b)) |
#endif |
#endif |
|
|
|
#define ZEBRA_NUM_OF(x) (sizeof (x) / sizeof (x[0])) |
|
|
/* For old definition. */ |
/* For old definition. */ |
#ifndef IN6_ARE_ADDR_EQUAL |
#ifndef IN6_ARE_ADDR_EQUAL |
#define IN6_ARE_ADDR_EQUAL IN6_IS_ADDR_EQUAL |
#define IN6_ARE_ADDR_EQUAL IN6_IS_ADDR_EQUAL |
Line 417 struct in_pktinfo
|
Line 412 struct in_pktinfo
|
#define ZEBRA_ROUTER_ID_ADD 20 |
#define ZEBRA_ROUTER_ID_ADD 20 |
#define ZEBRA_ROUTER_ID_DELETE 21 |
#define ZEBRA_ROUTER_ID_DELETE 21 |
#define ZEBRA_ROUTER_ID_UPDATE 22 |
#define ZEBRA_ROUTER_ID_UPDATE 22 |
#define ZEBRA_MESSAGE_MAX 23 | #define ZEBRA_HELLO 23 |
| #define ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB 24 |
| #define ZEBRA_VRF_UNREGISTER 25 |
| #define ZEBRA_MESSAGE_MAX 26 |
|
|
/* Marker value used in new Zserv, in the byte location corresponding |
/* Marker value used in new Zserv, in the byte location corresponding |
* the command value in the old zserv header. To allow old and new |
* the command value in the old zserv header. To allow old and new |
Line 425 struct in_pktinfo
|
Line 423 struct in_pktinfo
|
*/ |
*/ |
#define ZEBRA_HEADER_MARKER 255 |
#define ZEBRA_HEADER_MARKER 255 |
|
|
/* Zebra route's types. */ | /* Zebra route's types are defined in route_types.h */ |
#define ZEBRA_ROUTE_SYSTEM 0 | #include "route_types.h" |
#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 | |
|
|
/* Note: whenever a new route-type or zserv-command is added the |
/* Note: whenever a new route-type or zserv-command is added the |
* corresponding {command,route}_types[] table in lib/log.c MUST be |
* corresponding {command,route}_types[] table in lib/log.c MUST be |
Line 451 extern char zebra_route_char(unsigned int route_type);
|
Line 438 extern char zebra_route_char(unsigned int route_type);
|
* e.g. ZEBRA_INTERFACE_ADD -> "ZEBRA_INTERFACE_ADD" */ |
* e.g. ZEBRA_INTERFACE_ADD -> "ZEBRA_INTERFACE_ADD" */ |
/* Map a protocol name to its number. e.g. ZEBRA_ROUTE_BGP->9*/ |
/* Map a protocol name to its number. e.g. ZEBRA_ROUTE_BGP->9*/ |
extern int proto_name2num(const char *s); |
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); |
extern const char *zserv_command_string (unsigned int command); |
|
|
/* Zebra's family types. */ |
|
#define ZEBRA_FAMILY_IPV4 1 |
|
#define ZEBRA_FAMILY_IPV6 2 |
|
#define ZEBRA_FAMILY_MAX 3 |
|
|
|
/* Error codes of zebra. */ |
/* Error codes of zebra. */ |
#define ZEBRA_ERR_NOERROR 0 |
#define ZEBRA_ERR_NOERROR 0 |
#define ZEBRA_ERR_RTEXIST -1 |
#define ZEBRA_ERR_RTEXIST -1 |
Line 473 extern const char *zserv_command_string (unsigned int
|
Line 459 extern const char *zserv_command_string (unsigned int
|
#define ZEBRA_FLAG_BLACKHOLE 0x04 |
#define ZEBRA_FLAG_BLACKHOLE 0x04 |
#define ZEBRA_FLAG_IBGP 0x08 |
#define ZEBRA_FLAG_IBGP 0x08 |
#define ZEBRA_FLAG_SELECTED 0x10 |
#define ZEBRA_FLAG_SELECTED 0x10 |
#define ZEBRA_FLAG_CHANGED 0x20 | #define ZEBRA_FLAG_FIB_OVERRIDE 0x20 |
#define ZEBRA_FLAG_STATIC 0x40 |
#define ZEBRA_FLAG_STATIC 0x40 |
#define ZEBRA_FLAG_REJECT 0x80 |
#define ZEBRA_FLAG_REJECT 0x80 |
|
|
Line 493 extern const char *zserv_command_string (unsigned int
|
Line 479 extern const char *zserv_command_string (unsigned int
|
#endif |
#endif |
|
|
/* Address family numbers from RFC1700. */ |
/* Address family numbers from RFC1700. */ |
#define AFI_IP 1 | typedef enum { |
#define AFI_IP6 2 | AFI_IP = 1, |
#define AFI_MAX 3 | AFI_IP6 = 2, |
| #define AFI_MAX 3 |
| } afi_t; |
|
|
/* Subsequent Address Family Identifier. */ |
/* Subsequent Address Family Identifier. */ |
#define SAFI_UNICAST 1 |
#define SAFI_UNICAST 1 |
#define SAFI_MULTICAST 2 |
#define SAFI_MULTICAST 2 |
#define SAFI_UNICAST_MULTICAST 3 | #define SAFI_RESERVED_3 3 |
#define SAFI_MPLS_VPN 4 |
#define SAFI_MPLS_VPN 4 |
#define SAFI_MAX 5 | #define SAFI_ENCAP 7 /* per IANA */ |
| #define SAFI_MAX 8 |
|
|
/* Filter direction. */ |
|
#define FILTER_IN 0 |
|
#define FILTER_OUT 1 |
|
#define FILTER_MAX 2 |
|
|
|
/* Default Administrative Distance of each protocol. */ |
/* Default Administrative Distance of each protocol. */ |
#define ZEBRA_KERNEL_DISTANCE_DEFAULT 0 |
#define ZEBRA_KERNEL_DISTANCE_DEFAULT 0 |
#define ZEBRA_CONNECT_DISTANCE_DEFAULT 0 |
#define ZEBRA_CONNECT_DISTANCE_DEFAULT 0 |
Line 526 extern const char *zserv_command_string (unsigned int
|
Line 510 extern const char *zserv_command_string (unsigned int
|
#define SET_FLAG(V,F) (V) |= (F) |
#define SET_FLAG(V,F) (V) |= (F) |
#define UNSET_FLAG(V,F) (V) &= ~(F) |
#define UNSET_FLAG(V,F) (V) &= ~(F) |
|
|
/* AFI and SAFI type. */ |
|
typedef u_int16_t afi_t; |
|
typedef u_int8_t safi_t; |
typedef u_int8_t safi_t; |
|
|
/* Zebra types. Used in Zserv message header. */ |
/* Zebra types. Used in Zserv message header. */ |
typedef u_int16_t zebra_size_t; |
typedef u_int16_t zebra_size_t; |
typedef u_int16_t zebra_command_t; |
typedef u_int16_t zebra_command_t; |
|
|
/* FIFO -- first in first out structure and macros. */ | /* VRF ID type. */ |
struct fifo | typedef u_int16_t vrf_id_t; |
{ | |
struct fifo *next; | |
struct fifo *prev; | |
}; | |
| |
#define FIFO_INIT(F) \ | |
do { \ | |
struct fifo *Xfifo = (struct fifo *)(F); \ | |
Xfifo->next = Xfifo->prev = Xfifo; \ | |
} while (0) | |
| |
#define FIFO_ADD(F,N) \ | |
do { \ | |
struct fifo *Xfifo = (struct fifo *)(F); \ | |
struct fifo *Xnode = (struct fifo *)(N); \ | |
Xnode->next = Xfifo; \ | |
Xnode->prev = Xfifo->prev; \ | |
Xfifo->prev = Xfifo->prev->next = Xnode; \ | |
} while (0) | |
| |
#define FIFO_DEL(N) \ | |
do { \ | |
struct fifo *Xnode = (struct fifo *)(N); \ | |
Xnode->prev->next = Xnode->next; \ | |
Xnode->next->prev = Xnode->prev; \ | |
} while (0) | |
| |
#define FIFO_HEAD(F) \ | |
((((struct fifo *)(F))->next == (struct fifo *)(F)) \ | |
? NULL : (F)->next) | |
| |
#define FIFO_EMPTY(F) \ | |
(((struct fifo *)(F))->next == (struct fifo *)(F)) | |
| |
#define FIFO_TOP(F) \ | |
(FIFO_EMPTY(F) ? NULL : ((struct fifo *)(F))->next) | |
|
|
#endif /* _ZEBRA_H */ |
#endif /* _ZEBRA_H */ |