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)
29 #define LIKELY(_x) __builtin_expect(!!(_x), 1)
30 #define UNLIKELY(_x) __builtin_expect(!!(_x), 0)
32 #define ATTRIBUTE(x) /**/
33 #define LIKELY(_x) !!(_x)
34 #define UNLIKELY(_x) !!(_x)
37 #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
38 #define COLD __attribute__ ((cold))
44 #include <sys/socket.h>
49 #include <valgrind/memcheck.h>
51 #ifndef VALGRIND_MAKE_MEM_UNDEFINED
52 #define VALGRIND_MAKE_MEM_UNDEFINED(a, b) do {} while(0)
54 #ifndef VALGRIND_CHECK_MEM_IS_DEFINED
55 #define VALGRIND_CHECK_MEM_IS_DEFINED(a, b) do {} while(0)
60 #define BABEL_VTY_PORT 2609
61 #define BABEL_DEFAULT_CONFIG "babeld.conf"
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
67 #define BABEL_DEFAULT_RTT_DECAY 42
69 /* Values in microseconds */
70 #define BABEL_DEFAULT_RTT_MIN 10000
71 #define BABEL_DEFAULT_RTT_MAX 120000
73 /* In units of seconds */
74 #define BABEL_DEFAULT_SMOOTHING_HALF_LIFE 4
76 /* In units of 1/256. */
77 #define BABEL_DEFAULT_DIVERSITY_FACTOR 256
79 #define BABEL_DEFAULT_RXCOST_WIRED 96
80 #define BABEL_DEFAULT_RXCOST_WIRELESS 256
81 #define BABEL_DEFAULT_MAX_RTT_PENALTY 150
83 /* Babel structure. */
87 struct event
*t_read
; /* on Babel protocol's socket */
88 struct event
*t_update
; /* timers */
90 struct distribute_ctx
*distribute_ctx
;
93 extern struct zebra_privs_t babeld_privs
;
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
);
105 extern struct babel
*babel_lookup(void);
107 #endif /* BABEL_BABELD_H */