1 // SPDX-License-Identifier: MIT
3 Copyright (c) 2007, 2008 by Juliusz Chroboczek
4 Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
13 #define INFINITY ((unsigned short)(~0))
16 #define RTPROT_BABEL 42
19 #define RTPROT_BABEL_LOCAL -2
24 #define MAX(x,y) ((x)<=(y)?(y):(x))
25 #define MIN(x,y) ((x)<=(y)?(x):(y))
27 #if defined(__GNUC__) && (__GNUC__ >= 3)
28 #define ATTRIBUTE(x) __attribute__ (x)
30 #define ATTRIBUTE(x) /**/
33 #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
34 #define COLD __attribute__ ((cold))
40 #include <sys/socket.h>
45 #include <valgrind/memcheck.h>
47 #ifndef VALGRIND_MAKE_MEM_UNDEFINED
48 #define VALGRIND_MAKE_MEM_UNDEFINED(a, b) do {} while(0)
50 #ifndef VALGRIND_CHECK_MEM_IS_DEFINED
51 #define VALGRIND_CHECK_MEM_IS_DEFINED(a, b) do {} while(0)
56 #define BABEL_VTY_PORT 2609
57 #define BABEL_DEFAULT_CONFIG "babeld.conf"
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
65 /* Values in microseconds */
66 #define BABEL_DEFAULT_RTT_MIN 10000
67 #define BABEL_DEFAULT_RTT_MAX 120000
69 /* In units of seconds */
70 #define BABEL_DEFAULT_SMOOTHING_HALF_LIFE 4
72 /* In units of 1/256. */
73 #define BABEL_DEFAULT_DIVERSITY_FACTOR 256
75 #define BABEL_DEFAULT_RXCOST_WIRED 96
76 #define BABEL_DEFAULT_RXCOST_WIRELESS 256
77 #define BABEL_DEFAULT_MAX_RTT_PENALTY 150
79 /* Babel structure. */
83 struct event
*t_read
; /* on Babel protocol's socket */
84 struct event
*t_update
; /* timers */
86 struct distribute_ctx
*distribute_ctx
;
89 extern struct zebra_privs_t babeld_privs
;
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);
103 #endif /* BABEL_BABELD_H */