]> git.proxmox.com Git - mirror_frr.git/blame - babeld/babeld.h
lib: enforce vrf_name_to_id by returning default_vrf when name is null
[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
44#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
45/* nothing */
46#elif defined(__GNUC__)
47#define inline __inline
48#if (__GNUC__ >= 3)
49#define restrict __restrict
50#else
51#define restrict /**/
52#endif
53#else
54#define inline /**/
55#define restrict /**/
56#endif
57
58#if defined(__GNUC__) && (__GNUC__ >= 3)
59#define ATTRIBUTE(x) __attribute__ (x)
60#define LIKELY(_x) __builtin_expect(!!(_x), 1)
61#define UNLIKELY(_x) __builtin_expect(!!(_x), 0)
62#else
63#define ATTRIBUTE(x) /**/
64#define LIKELY(_x) !!(_x)
65#define UNLIKELY(_x) !!(_x)
66#endif
67
68#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
69#define COLD __attribute__ ((cold))
70#else
71#define COLD /**/
72#endif
73
74#ifndef IF_NAMESIZE
75#include <sys/socket.h>
76#include <net/if.h>
77#endif
78
79#ifdef HAVE_VALGRIND
80#include <valgrind/memcheck.h>
81#else
82#ifndef VALGRIND_MAKE_MEM_UNDEFINED
83#define VALGRIND_MAKE_MEM_UNDEFINED(a, b) do {} while(0)
84#endif
85#ifndef VALGRIND_CHECK_MEM_IS_DEFINED
86#define VALGRIND_CHECK_MEM_IS_DEFINED(a, b) do {} while(0)
87#endif
88#endif
89
90
e763afa5 91#define BABEL_VTY_PORT 2609
ca10883e 92#define BABEL_DEFAULT_CONFIG "babeld.conf"
ca10883e
DS
93
94/* Values in milliseconds */
95#define BABEL_DEFAULT_HELLO_INTERVAL 4000
96#define BABEL_DEFAULT_UPDATE_INTERVAL 16000
97#define BABEL_DEFAULT_RESEND_DELAY 2000
98
99/* In units of seconds */
100#define BABEL_DEFAULT_SMOOTHING_HALF_LIFE 4
101
102/* In units of 1/256. */
103#define BABEL_DEFAULT_DIVERSITY_FACTOR 256
104
105#define BABEL_DEFAULT_RXCOST_WIRED 96
106#define BABEL_DEFAULT_RXCOST_WIRELESS 256
107
108/* Babel structure. */
109struct babel
110{
111 /* Babel threads. */
112 struct thread *t_read; /* on Babel protocol's socket */
113 struct thread *t_update; /* timers */
114};
115
346526cc
DS
116extern struct zebra_privs_t babeld_privs;
117
ca10883e
DS
118extern void babeld_quagga_init(void);
119extern int input_filter(const unsigned char *id,
120 const unsigned char *prefix, unsigned short plen,
121 const unsigned char *neigh, unsigned int ifindex);
122extern int output_filter(const unsigned char *id, const unsigned char *prefix,
123 unsigned short plen, unsigned int ifindex);
124extern int redistribute_filter(const unsigned char *prefix, unsigned short plen,
125 unsigned int ifindex, int proto);
126extern int resize_receive_buffer(int size);
127extern void schedule_neighbours_check(int msecs, int override);
128
129
130#endif /* BABEL_BABELD_H */