babel.h 2.31 KB
Newer Older
Juliusz Chroboczek's avatar
Juliusz Chroboczek committed
1
/*
2
Copyright (c) 2007, 2008 by Juliusz Chroboczek
Juliusz Chroboczek's avatar
Juliusz Chroboczek committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

23
#define MAXSRCS 256
Juliusz Chroboczek's avatar
Juliusz Chroboczek committed
24 25 26

#define INFINITY ((unsigned short)(~0))

27 28 29 30
#ifndef RTPROT_BABEL
#define RTPROT_BABEL 42
#endif

31 32
#define RTPROT_BABEL_LOCAL -2

Juliusz Chroboczek's avatar
Juliusz Chroboczek committed
33 34 35 36 37 38 39 40 41 42 43 44 45
#undef MAX
#undef MIN

#define MAX(x,y) ((x)<=(y)?(y):(x))
#define MIN(x,y) ((x)<=(y)?(x):(y))

#if defined(__GNUC__) && (__GNUC__ >= 3)
#define ATTRIBUTE(x) __attribute__(x)
#else
#define ATTRIBUTE(x) /**/
#endif

#ifndef IF_NAMESIZE
46
#include <sys/socket.h>
Juliusz Chroboczek's avatar
Juliusz Chroboczek committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
#include <net/if.h>
#endif

#ifdef HAVE_VALGRIND
#include <valgrind/memcheck.h>
#else
#ifndef VALGRIND_MAKE_MEM_UNDEFINED
#define VALGRIND_MAKE_MEM_UNDEFINED(a, b) do {} while(0)
#endif
#ifndef VALGRIND_CHECK_MEM_IS_DEFINED
#define VALGRIND_CHECK_MEM_IS_DEFINED(a, b) do {} while(0)
#endif
#endif

extern struct timeval now;
extern int debug;
63
extern time_t reboot_time;
64 65
extern int wireless_hello_interval, wired_hello_interval, idle_hello_interval;
extern int idle_time;
66
extern int link_detect;
Juliusz Chroboczek's avatar
Juliusz Chroboczek committed
67
extern int all_wireless;
Juliusz Chroboczek's avatar
Juliusz Chroboczek committed
68 69 70

extern unsigned char myid[16];

71
extern const unsigned char zeroes[16], ones[16];
Juliusz Chroboczek's avatar
Juliusz Chroboczek committed
72

Juliusz Chroboczek's avatar
Juliusz Chroboczek committed
73 74 75
extern int protocol_port;
extern unsigned char protocol_group[16];
extern int protocol_socket;
76
extern int kernel_socket;
77
extern int max_request_hopcount;
78
extern int update_interval;
79

80
void schedule_neighbours_check(int msecs, int override);
81
void resize_receive_buffer(int size);