3 * The olsr.org Optimized Link-State Routing daemon(olsrd)
4 * Copyright (c) 2004, Andreas Tonnesen(andreto@olsr.org)
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of olsr.org, olsrd nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
34 * Visit http://www.olsr.org for more information.
36 * If you find this software useful feel free to make a donation
37 * to the project. For more information see the website or contact
38 * the copyright holders.
43 *Values and packet formats as proposed in RFC3626 and misc. values and
44 *data structures used by the olsr.org OLSR daemon.
50 #if !defined linux && !defined __MacOSX__ && !defined WIN32 && !defined __FreeBSD__ && !defined __FreeBSD_kernel__ && !defined __NetBSD__ && !defined __OpenBSD__
51 # error "Unsupported system"
56 typedef unsigned char uint8_t;
57 typedef unsigned short uint16_t;
58 typedef unsigned int uint32_t;
59 typedef signed char int8_t;
60 typedef signed short int16_t;
61 typedef signed int int32_t;
66 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
68 /* we have a C99 environment */
70 #elif defined __GNUC__
72 /* we simulate a C99 environment */
76 #define __bool_true_false_are_defined 1
79 /* add some safe-gaurds */
81 #if !defined bool || !defined true || !defined false || !defined __bool_true_false_are_defined
82 #error You have no C99-like boolean types. Please extend src/olsr_type.h!
86 /* user defined cookies */
87 typedef uint16_t olsr_cookie_t;
92 /* manpage says: fd_set is in sys/select.h with posix (at least with the Android-NDK) */
93 #include <sys/select.h>
96 /* OpenBSD wants this here */
97 #include <sys/types.h>
98 #include <sys/socket.h>
100 /* IPv6 address format in6_addr */
102 #include <netinet/in.h>
105 union olsr_sockaddr {
106 struct sockaddr_storage storage;
108 struct sockaddr_in in4;
109 struct sockaddr_in6 in6;
117 struct olsr_ip_prefix {
118 union olsr_ip_addr prefix;
122 typedef uint32_t olsr_linkcost;
129 * indent-tabs-mode: nil