]> git.proxmox.com Git - mirror_frr.git/blob - babeld/babeld.h
Merge pull request #13326 from opensourcerouting/feature/rip_topotest_distribute_list
[mirror_frr.git] / babeld / babeld.h
1 // SPDX-License-Identifier: MIT
2 /*
3 Copyright (c) 2007, 2008 by Juliusz Chroboczek
4 Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
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
27 #if defined(__GNUC__) && (__GNUC__ >= 3)
28 #define ATTRIBUTE(x) __attribute__ (x)
29 #else
30 #define ATTRIBUTE(x) /**/
31 #endif
32
33 #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
34 #define COLD __attribute__ ((cold))
35 #else
36 #define COLD /**/
37 #endif
38
39 #ifndef IF_NAMESIZE
40 #include <sys/socket.h>
41 #include <net/if.h>
42 #endif
43
44 #ifdef HAVE_VALGRIND
45 #include <valgrind/memcheck.h>
46 #else
47 #ifndef VALGRIND_MAKE_MEM_UNDEFINED
48 #define VALGRIND_MAKE_MEM_UNDEFINED(a, b) do {} while(0)
49 #endif
50 #ifndef VALGRIND_CHECK_MEM_IS_DEFINED
51 #define VALGRIND_CHECK_MEM_IS_DEFINED(a, b) do {} while(0)
52 #endif
53 #endif
54
55
56 #define BABEL_VTY_PORT 2609
57 #define BABEL_DEFAULT_CONFIG "babeld.conf"
58
59 /* Values in milliseconds */
60 #define BABEL_DEFAULT_HELLO_INTERVAL 4000
61 #define BABEL_DEFAULT_UPDATE_INTERVAL 16000
62 #define BABEL_DEFAULT_RESEND_DELAY 2000
63 #define BABEL_DEFAULT_RTT_DECAY 42
64
65 /* Values in microseconds */
66 #define BABEL_DEFAULT_RTT_MIN 10000
67 #define BABEL_DEFAULT_RTT_MAX 120000
68
69 /* In units of seconds */
70 #define BABEL_DEFAULT_SMOOTHING_HALF_LIFE 4
71
72 /* In units of 1/256. */
73 #define BABEL_DEFAULT_DIVERSITY_FACTOR 256
74
75 #define BABEL_DEFAULT_RXCOST_WIRED 96
76 #define BABEL_DEFAULT_RXCOST_WIRELESS 256
77 #define BABEL_DEFAULT_MAX_RTT_PENALTY 150
78
79 /* Babel structure. */
80 struct babel
81 {
82 /* Babel threads. */
83 struct event *t_read; /* on Babel protocol's socket */
84 struct event *t_update; /* timers */
85 /* distribute_ctx */
86 struct distribute_ctx *distribute_ctx;
87 };
88
89 extern struct zebra_privs_t babeld_privs;
90
91 extern void babeld_quagga_init(void);
92 extern int input_filter(const unsigned char *id,
93 const unsigned char *prefix, unsigned short plen,
94 const unsigned char *neigh, unsigned int ifindex);
95 extern int output_filter(const unsigned char *id, const unsigned char *prefix,
96 unsigned short plen, unsigned int ifindex);
97 extern int redistribute_filter(const unsigned char *prefix, unsigned short plen,
98 unsigned int ifindex, int proto);
99 extern int resize_receive_buffer(int size);
100 extern void schedule_neighbours_check(int msecs, int override);
101 extern struct babel *babel_lookup(void);
102
103 #endif /* BABEL_BABELD_H */