]> git.proxmox.com Git - mirror_frr.git/blame - babeld/babeld.h
Merge pull request #10996 from donaldsharp/watchfrr_systemd_interactions
[mirror_frr.git] / babeld / babeld.h
CommitLineData
ca10883e
DS
1/*
2Copyright (c) 2007, 2008 by Juliusz Chroboczek
3Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21THE 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. */
101struct 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
110extern struct zebra_privs_t babeld_privs;
111
ca10883e
DS
112extern void babeld_quagga_init(void);
113extern int input_filter(const unsigned char *id,
114 const unsigned char *prefix, unsigned short plen,
115 const unsigned char *neigh, unsigned int ifindex);
116extern int output_filter(const unsigned char *id, const unsigned char *prefix,
117 unsigned short plen, unsigned int ifindex);
118extern int redistribute_filter(const unsigned char *prefix, unsigned short plen,
119 unsigned int ifindex, int proto);
120extern int resize_receive_buffer(int size);
121extern void schedule_neighbours_check(int msecs, int override);
03a38493 122extern struct babel *babel_lookup(void);
ca10883e
DS
123
124#endif /* BABEL_BABELD_H */