]>
Commit | Line | Data |
---|---|---|
ca10883e DS |
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 | ||
ca10883e DS |
44 | #if defined(__GNUC__) && (__GNUC__ >= 3) |
45 | #define ATTRIBUTE(x) __attribute__ (x) | |
46 | #define LIKELY(_x) __builtin_expect(!!(_x), 1) | |
47 | #define UNLIKELY(_x) __builtin_expect(!!(_x), 0) | |
48 | #else | |
49 | #define ATTRIBUTE(x) /**/ | |
50 | #define LIKELY(_x) !!(_x) | |
51 | #define UNLIKELY(_x) !!(_x) | |
52 | #endif | |
53 | ||
54 | #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) | |
55 | #define COLD __attribute__ ((cold)) | |
56 | #else | |
57 | #define COLD /**/ | |
58 | #endif | |
59 | ||
60 | #ifndef IF_NAMESIZE | |
61 | #include <sys/socket.h> | |
62 | #include <net/if.h> | |
63 | #endif | |
64 | ||
65 | #ifdef HAVE_VALGRIND | |
66 | #include <valgrind/memcheck.h> | |
67 | #else | |
68 | #ifndef VALGRIND_MAKE_MEM_UNDEFINED | |
69 | #define VALGRIND_MAKE_MEM_UNDEFINED(a, b) do {} while(0) | |
70 | #endif | |
71 | #ifndef VALGRIND_CHECK_MEM_IS_DEFINED | |
72 | #define VALGRIND_CHECK_MEM_IS_DEFINED(a, b) do {} while(0) | |
73 | #endif | |
74 | #endif | |
75 | ||
76 | ||
e763afa5 | 77 | #define BABEL_VTY_PORT 2609 |
ca10883e | 78 | #define BABEL_DEFAULT_CONFIG "babeld.conf" |
ca10883e DS |
79 | |
80 | /* Values in milliseconds */ | |
81 | #define BABEL_DEFAULT_HELLO_INTERVAL 4000 | |
82 | #define BABEL_DEFAULT_UPDATE_INTERVAL 16000 | |
83 | #define BABEL_DEFAULT_RESEND_DELAY 2000 | |
aa3ba071 AMR |
84 | #define BABEL_DEFAULT_RTT_DECAY 42 |
85 | ||
86 | /* Values in microseconds */ | |
87 | #define BABEL_DEFAULT_RTT_MIN 10000 | |
88 | #define BABEL_DEFAULT_RTT_MAX 120000 | |
ca10883e DS |
89 | |
90 | /* In units of seconds */ | |
91 | #define BABEL_DEFAULT_SMOOTHING_HALF_LIFE 4 | |
92 | ||
93 | /* In units of 1/256. */ | |
94 | #define BABEL_DEFAULT_DIVERSITY_FACTOR 256 | |
95 | ||
96 | #define BABEL_DEFAULT_RXCOST_WIRED 96 | |
97 | #define BABEL_DEFAULT_RXCOST_WIRELESS 256 | |
aa3ba071 | 98 | #define BABEL_DEFAULT_MAX_RTT_PENALTY 150 |
ca10883e DS |
99 | |
100 | /* Babel structure. */ | |
101 | struct babel | |
102 | { | |
103 | /* Babel threads. */ | |
104 | struct thread *t_read; /* on Babel protocol's socket */ | |
105 | struct thread *t_update; /* timers */ | |
03a38493 PG |
106 | /* distribute_ctx */ |
107 | struct distribute_ctx *distribute_ctx; | |
ca10883e DS |
108 | }; |
109 | ||
346526cc DS |
110 | extern struct zebra_privs_t babeld_privs; |
111 | ||
ca10883e DS |
112 | extern void babeld_quagga_init(void); |
113 | extern int input_filter(const unsigned char *id, | |
114 | const unsigned char *prefix, unsigned short plen, | |
115 | const unsigned char *neigh, unsigned int ifindex); | |
116 | extern int output_filter(const unsigned char *id, const unsigned char *prefix, | |
117 | unsigned short plen, unsigned int ifindex); | |
118 | extern int redistribute_filter(const unsigned char *prefix, unsigned short plen, | |
119 | unsigned int ifindex, int proto); | |
120 | extern int resize_receive_buffer(int size); | |
121 | extern void schedule_neighbours_check(int msecs, int override); | |
03a38493 | 122 | extern struct babel *babel_lookup(void); |
ca10883e DS |
123 | |
124 | #endif /* BABEL_BABELD_H */ |