-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbgpdump.h
68 lines (53 loc) · 2.23 KB
/
bgpdump.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
Copyright (c) 2007 - 2010 RIPE NCC - All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, provided
that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation, and that the name of the author not be used in advertising or
publicity pertaining to distribution of the software without specific,
written prior permission.
THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Parts of this code have been engineered after analiyzing GNU Zebra's
source code and therefore might contain declarations/code from GNU
Zebra, Copyright (C) 1999 Kunihiro Ishiguro. Zebra is a free routing
software, distributed under the GNU General Public License. A copy of
this license is included with libbgpdump.
Original Author: Dan Ardelean ([email protected])
*/
#ifndef _BGPDUMP_H
#define _BGPDUMP_H
#include "bgpdump-config.h"
#include <sys/types.h>
#include <netinet/in.h>
typedef u_int32_t as_t;
typedef union union_BGPDUMP_IP_ADDRESS {
struct in_addr v4_addr;
#ifdef BGPDUMP_HAVE_IPV6
struct in6_addr v6_addr;
#endif
} BGPDUMP_IP_ADDRESS;
/* cygwin doesn't define INET[6]_ADDRSTRLEN */
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
#endif
#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#endif
#ifdef BGPDUMP_HAVE_IPV6
#define BGPDUMP_ADDRSTRLEN INET6_ADDRSTRLEN
#else
#define BGPDUMP_ADDRSTRLEN INET_ADDRSTRLEN
#endif
#define ASN16_LEN sizeof(u_int16_t)
#define ASN32_LEN sizeof(u_int32_t)
#define AS_TRAN 23456
/* If no aspath was present as a string in the packet, return an empty string
* so everything stays machine parsable */
#define ATTR_ASPATH(a) ( ((a->flag & ATTR_FLAG_BIT(BGP_ATTR_AS_PATH)) != 0 ) && a->aspath && a->aspath->str ? a->aspath->str : "")
#endif