]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: MIT |
ca10883e DS |
2 | /* |
3 | Copyright (c) 2007, 2008 by Juliusz Chroboczek | |
4 | Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek | |
ca10883e DS |
5 | */ |
6 | ||
7 | #ifndef BABEL_BABELD_H | |
8 | #define BABEL_BABELD_H | |
9 | ||
10 | #include <zebra.h> | |
11 | #include "vty.h" | |
12 | ||
13 | #define INFINITY ((unsigned short)(~0)) | |
14 | ||
15 | #ifndef RTPROT_BABEL | |
16 | #define RTPROT_BABEL 42 | |
17 | #endif | |
18 | ||
19 | #define RTPROT_BABEL_LOCAL -2 | |
20 | ||
21 | #undef MAX | |
22 | #undef MIN | |
23 | ||
24 | #define MAX(x,y) ((x)<=(y)?(y):(x)) | |
25 | #define MIN(x,y) ((x)<=(y)?(x):(y)) | |
26 | ||
ca10883e DS |
27 | #if defined(__GNUC__) && (__GNUC__ >= 3) |
28 | #define ATTRIBUTE(x) __attribute__ (x) | |
29 | #define LIKELY(_x) __builtin_expect(!!(_x), 1) | |
30 | #define UNLIKELY(_x) __builtin_expect(!!(_x), 0) | |
31 | #else | |
32 | #define ATTRIBUTE(x) /**/ | |
33 | #define LIKELY(_x) !!(_x) | |
34 | #define UNLIKELY(_x) !!(_x) | |
35 | #endif | |
36 | ||
37 | #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) | |
38 | #define COLD __attribute__ ((cold)) | |
39 | #else | |
40 | #define COLD /**/ | |
41 | #endif | |
42 | ||
43 | #ifndef IF_NAMESIZE | |
44 | #include <sys/socket.h> | |
45 | #include <net/if.h> | |
46 | #endif | |
47 | ||
48 | #ifdef HAVE_VALGRIND | |
49 | #include <valgrind/memcheck.h> | |
50 | #else | |
51 | #ifndef VALGRIND_MAKE_MEM_UNDEFINED | |
52 | #define VALGRIND_MAKE_MEM_UNDEFINED(a, b) do {} while(0) | |
53 | #endif | |
54 | #ifndef VALGRIND_CHECK_MEM_IS_DEFINED | |
55 | #define VALGRIND_CHECK_MEM_IS_DEFINED(a, b) do {} while(0) | |
56 | #endif | |
57 | #endif | |
58 | ||
59 | ||
e763afa5 | 60 | #define BABEL_VTY_PORT 2609 |
ca10883e | 61 | #define BABEL_DEFAULT_CONFIG "babeld.conf" |
ca10883e DS |
62 | |
63 | /* Values in milliseconds */ | |
64 | #define BABEL_DEFAULT_HELLO_INTERVAL 4000 | |
65 | #define BABEL_DEFAULT_UPDATE_INTERVAL 16000 | |
66 | #define BABEL_DEFAULT_RESEND_DELAY 2000 | |
aa3ba071 AMR |
67 | #define BABEL_DEFAULT_RTT_DECAY 42 |
68 | ||
69 | /* Values in microseconds */ | |
70 | #define BABEL_DEFAULT_RTT_MIN 10000 | |
71 | #define BABEL_DEFAULT_RTT_MAX 120000 | |
ca10883e DS |
72 | |
73 | /* In units of seconds */ | |
74 | #define BABEL_DEFAULT_SMOOTHING_HALF_LIFE 4 | |
75 | ||
76 | /* In units of 1/256. */ | |
77 | #define BABEL_DEFAULT_DIVERSITY_FACTOR 256 | |
78 | ||
79 | #define BABEL_DEFAULT_RXCOST_WIRED 96 | |
80 | #define BABEL_DEFAULT_RXCOST_WIRELESS 256 | |
aa3ba071 | 81 | #define BABEL_DEFAULT_MAX_RTT_PENALTY 150 |
ca10883e DS |
82 | |
83 | /* Babel structure. */ | |
84 | struct babel | |
85 | { | |
86 | /* Babel threads. */ | |
87 | struct thread *t_read; /* on Babel protocol's socket */ | |
88 | struct thread *t_update; /* timers */ | |
03a38493 PG |
89 | /* distribute_ctx */ |
90 | struct distribute_ctx *distribute_ctx; | |
ca10883e DS |
91 | }; |
92 | ||
346526cc DS |
93 | extern struct zebra_privs_t babeld_privs; |
94 | ||
ca10883e DS |
95 | extern void babeld_quagga_init(void); |
96 | extern int input_filter(const unsigned char *id, | |
97 | const unsigned char *prefix, unsigned short plen, | |
98 | const unsigned char *neigh, unsigned int ifindex); | |
99 | extern int output_filter(const unsigned char *id, const unsigned char *prefix, | |
100 | unsigned short plen, unsigned int ifindex); | |
101 | extern int redistribute_filter(const unsigned char *prefix, unsigned short plen, | |
102 | unsigned int ifindex, int proto); | |
103 | extern int resize_receive_buffer(int size); | |
104 | extern void schedule_neighbours_check(int msecs, int override); | |
03a38493 | 105 | extern struct babel *babel_lookup(void); |
ca10883e DS |
106 | |
107 | #endif /* BABEL_BABELD_H */ |