]> git.proxmox.com Git - mirror_frr.git/blob - babeld/babeld.h
Merge pull request #5793 from ton31337/fix/formatting_show_bgp_summary_failed
[mirror_frr.git] / babeld / babeld.h
1 /*
2 Copyright (c) 2007, 2008 by Juliusz Chroboczek
3 Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
4
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 THE SOFTWARE.
22 */
23
24 #ifndef BABEL_BABELD_H
25 #define BABEL_BABELD_H
26
27 #include <zebra.h>
28 #include "vty.h"
29
30 #define INFINITY ((unsigned short)(~0))
31
32 #ifndef RTPROT_BABEL
33 #define RTPROT_BABEL 42
34 #endif
35
36 #define RTPROT_BABEL_LOCAL -2
37
38 #undef MAX
39 #undef MIN
40
41 #define MAX(x,y) ((x)<=(y)?(y):(x))
42 #define MIN(x,y) ((x)<=(y)?(x):(y))
43
44 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
45 /* nothing */
46 #elif defined(__GNUC__)
47 #define inline __inline
48 #if (__GNUC__ >= 3)
49 #define restrict __restrict
50 #else
51 #define restrict /**/
52 #endif
53 #else
54 #define inline /**/
55 #define restrict /**/
56 #endif
57
58 #if defined(__GNUC__) && (__GNUC__ >= 3)
59 #define ATTRIBUTE(x) __attribute__ (x)
60 #define LIKELY(_x) __builtin_expect(!!(_x), 1)
61 #define UNLIKELY(_x) __builtin_expect(!!(_x), 0)
62 #else
63 #define ATTRIBUTE(x) /**/
64 #define LIKELY(_x) !!(_x)
65 #define UNLIKELY(_x) !!(_x)
66 #endif
67
68 #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
69 #define COLD __attribute__ ((cold))
70 #else
71 #define COLD /**/
72 #endif
73
74 #ifndef IF_NAMESIZE
75 #include <sys/socket.h>
76 #include <net/if.h>
77 #endif
78
79 #ifdef HAVE_VALGRIND
80 #include <valgrind/memcheck.h>
81 #else
82 #ifndef VALGRIND_MAKE_MEM_UNDEFINED
83 #define VALGRIND_MAKE_MEM_UNDEFINED(a, b) do {} while(0)
84 #endif
85 #ifndef VALGRIND_CHECK_MEM_IS_DEFINED
86 #define VALGRIND_CHECK_MEM_IS_DEFINED(a, b) do {} while(0)
87 #endif
88 #endif
89
90
91 #define BABEL_VTY_PORT 2609
92 #define BABEL_DEFAULT_CONFIG "babeld.conf"
93
94 /* Values in milliseconds */
95 #define BABEL_DEFAULT_HELLO_INTERVAL 4000
96 #define BABEL_DEFAULT_UPDATE_INTERVAL 16000
97 #define BABEL_DEFAULT_RESEND_DELAY 2000
98
99 /* In units of seconds */
100 #define BABEL_DEFAULT_SMOOTHING_HALF_LIFE 4
101
102 /* In units of 1/256. */
103 #define BABEL_DEFAULT_DIVERSITY_FACTOR 256
104
105 #define BABEL_DEFAULT_RXCOST_WIRED 96
106 #define BABEL_DEFAULT_RXCOST_WIRELESS 256
107
108 /* Babel structure. */
109 struct babel
110 {
111 /* Babel threads. */
112 struct thread *t_read; /* on Babel protocol's socket */
113 struct thread *t_update; /* timers */
114 /* distribute_ctx */
115 struct distribute_ctx *distribute_ctx;
116 };
117
118 extern struct zebra_privs_t babeld_privs;
119
120 extern void babeld_quagga_init(void);
121 extern int input_filter(const unsigned char *id,
122 const unsigned char *prefix, unsigned short plen,
123 const unsigned char *neigh, unsigned int ifindex);
124 extern int output_filter(const unsigned char *id, const unsigned char *prefix,
125 unsigned short plen, unsigned int ifindex);
126 extern int redistribute_filter(const unsigned char *prefix, unsigned short plen,
127 unsigned int ifindex, int proto);
128 extern int resize_receive_buffer(int size);
129 extern void schedule_neighbours_check(int msecs, int override);
130 extern struct babel *babel_lookup(void);
131
132 #endif /* BABEL_BABELD_H */