3 * The olsr.org Optimized Link-State Routing daemon(olsrd)
4 * Copyright (c) 2004-2009, the olsr.org team - see HISTORY file
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.
45 /* Default values not declared in olsr_protocol.h */
46 #define DEF_POLLRATE 50
47 #define DEF_NICCHGPOLLRT 2500
48 #define DEF_WILL_AUTO true
49 #define DEF_ALLOW_NO_INTS true
51 #define DEF_DEBUGLVL "0"
52 #define DEF_IPC_CONNECTIONS 0
53 #define DEF_USE_HYST false
54 #define DEF_FIB_METRIC FIBM_FLAT
55 #define DEF_LQ_ALWAYS_SEND_TC true
57 #define DEF_LQ_DIJK_LIMIT 255
58 #define DEF_LQ_DIJK_INTER 0
59 #define DEF_LQ_NAT_THRESH 1000
60 #define DEF_LQ_AGING 0.1
61 #define DEF_CLEAR_SCREEN false
62 #define DEF_HTTPPORT 8080
63 #define DEF_HTTPLIMIT 3
64 #define DEF_TXTPORT 2006
65 #define DEF_TXTLIMIT 3
69 #define MIN_INTERVAL 0.01
71 #define MAX_POLLRATE 10000
72 #define MIN_POLLRATE 10
73 #define MAX_NICCHGPOLLRT 100000
74 #define MIN_NICCHGPOLLRT 1000
75 #define MAX_DEBUGLVL 3
76 #define MIN_DEBUGLVL -2
78 #define MAX_WILLINGNESS 7
79 #define MIN_WILLINGNESS 0
80 #define MAX_MPR_COVERAGE 20
81 #define MIN_MPR_COVERAGE 1
82 #define MAX_TC_REDUNDANCY 2
83 #define MAX_HYST_PARAM 1.0
84 #define MIN_HYST_PARAM 0.0
85 #define MAX_LQ_AGING 1.0
86 #define MIN_LQ_AGING 0.01
89 #define CFG_FIBM_FLAT "flat"
90 #define CFG_FIBM_CORRECT "correct"
91 #define CFG_FIBM_APPROX "approx"
93 #define CFG_IP6T_AUTO "auto"
94 #define CFG_IP6T_SITELOCAL "site-local"
95 #define CFG_IP6T_UNIQUELOCAL "unique-local"
96 #define CFG_IP6T_GLOBAL "global"
98 #define OLSR_IP6T_AUTO 0
99 #define OLSR_IP6T_SITELOCAL 1
100 #define OLSR_IP6T_UNIQUELOCAL 2
101 #define OLSR_IP6T_GLOBAL 3
103 #ifndef IPV6_ADDR_GLOBAL
104 #define IPV6_ADDR_GLOBAL 0x0000U
107 #ifndef IPV6_ADDR_SITELOCAL
108 #define IPV6_ADDR_SITELOCAL 0x0040U
111 #include "interfaces.h"
112 #include "olsr_ip_acl.h"
113 #include "olsr_cfg_data.h"
115 struct olsr_msg_params {
116 olsr_reltime emission_interval;
117 olsr_reltime validity_time;
120 struct olsr_lq_mult {
121 union olsr_ip_addr addr;
123 struct olsr_lq_mult *next;
126 struct olsr_if_weight {
131 struct olsr_if_options {
132 union olsr_ip_addr ipv4_broadcast;
134 union olsr_ip_addr ipv6_multi_site;
135 union olsr_ip_addr ipv6_multi_glbl;
136 struct olsr_if_weight weight;
137 struct olsr_msg_params hello_params;
138 struct olsr_msg_params tc_params;
139 struct olsr_msg_params mid_params;
140 struct olsr_msg_params hna_params;
141 struct olsr_lq_mult *lq_mult;
143 enum interface_mode mode;
146 struct olsr_if_config {
149 struct interface *interf;
150 struct olsr_if_options *cnf;
151 struct olsr_if_config *next;
154 struct plugin_param {
157 struct plugin_param *next;
160 struct plugin_entry {
162 struct plugin_param *params;
163 struct plugin_entry *next;
170 } olsr_fib_metric_options;
177 int ip_version; /* AF_INET of AF_INET6 */
178 size_t ipsize; /* Size of address */
180 unsigned char no_fork:1; /* Should olsrd run in foreground? */
181 unsigned char allow_no_interfaces:1; /* Should olsrd stop if no ifaces? */
182 unsigned char willingness_auto:1; /* Willingness in auto mode? */
183 unsigned char clear_screen:1; /* Clear screen during debug output? */
184 unsigned char del_gws:1; /* Delete InternetGWs at startup? */
185 unsigned char fixed_origaddr:1; /* Use a fixed originator addr == Node ID? */
186 unsigned char source_ip_mode:1; /* Run OLSR routing in sourceip mode */
188 uint16_t tos; /* IP Type of Service Byte */
189 uint8_t rtproto; /* Policy routing proto, 0 == operating sys default */
190 uint8_t rttable; /* Policy routing table, 254(main) is default */
191 uint8_t rttable_default; /* Polroute table for default route, 0==use rttable */
192 olsr_fib_metric_options fib_metric; /* Determines route metrics update mode */
194 /* logging information */
195 bool log_event[LOG_SEVERITY_COUNT][LOG_SOURCE_COUNT]; /* New style */
196 bool log_target_stderr; /* Log output to stderr? */
197 char *log_target_file; /* Filename for log output file, NULL if unused */
198 bool log_target_syslog; /* Log output also to syslog? */
200 struct plugin_entry *plugins; /* List of plugins to load with plparams */
201 struct list_node hna_entries; /* List of manually configured HNA entries */
202 struct ip_acl ipc_nets; /* List of allowed IPC peer IPs */
203 struct olsr_if_config *if_configs; /* List of devices to be used by olsrd */
205 olsr_reltime pollrate; /* Main loop poll rate, in milliseconds */
206 olsr_reltime nic_chgs_pollrate; /* Interface poll rate */
207 uint32_t lq_nat_thresh; /* Link quality NAT threshold, 1000 == unused */
208 uint8_t tc_redundancy; /* TC anncoument mode, 0=only MPR, 1=MPR+MPRS, 2=All sym neighs */
209 uint8_t mpr_coverage; /* How many additional MPRs should be selected */
210 uint8_t lq_fish; /* 0==Fisheye off, 1=Fisheye on */
211 olsr_reltime lq_dinter; /* Dijkstra Calculation interval */
212 uint8_t lq_dlimit; /* Dijkstra Calculation limit */
213 uint8_t willingness; /* Manual Configured Willingness value */
215 uint16_t olsr_port; /* port number used for OLSR packages */
216 char *dlPath; /* absolute path for dynamic libraries */
218 uint16_t comport_http; /* communication port for http connections */
219 uint16_t comport_http_limit; /* maximum number of connections (including interactive ones) */
220 uint16_t comport_txt; /* communication port for txt connections */
221 uint16_t comport_txt_limit; /* maximum number of interactive connections */
224 * Someone has added global variables to the config struct.
225 * Because this saves binary link info we keep it that way.
226 * ========= Please add globals below this line. =========
229 union olsr_ip_addr router_id; /* Main address of this node */
230 olsr_reltime will_int; /* Willingness update interval if willingness_auto */
231 int exit_value; /* Global return value for process termination */
233 int ioctl_s; /* Socket used for ioctl calls */
235 int rts_linux; /* Socket used for rtnetlink messages */
237 #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__
238 int rts_bsd; /* Socket used for route changes on BSDs */
243 * Global olsrd configuragtion
245 extern struct olsr_config *EXPORT(olsr_cnf);
248 * Interface to parser
252 CFG_ERROR, /* Severe parsing error, e.g. file not found, mixed up args */
253 CFG_WARN, /* Non-severe error, e.g. use of deprecated option */
254 CFG_EXIT, /* Given options will exit() e.g. "--version" or "--help" */
255 CFG_OK /* Config is parsed and does not have any errors */
256 } olsr_parse_cfg_result;
258 olsr_parse_cfg_result olsr_parse_cfg(int argc, char *argv[], const char *file, char *rmsg, struct olsr_config **rcfg);
259 struct olsr_if_options *olsr_get_default_if_options(void);
260 struct olsr_config *olsr_get_default_cfg(void);
261 int olsr_sanity_check_cfg(struct olsr_config *cfg);
262 void olsr_free_cfg(struct olsr_config *cfg);
264 #endif /* _OLSRD_CFG_H */
269 * indent-tabs-mode: nil