00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef _OLSRD_CFG_H
00043 #define _OLSRD_CFG_H
00044
00045
00046 #define DEF_POLLRATE 50
00047 #define DEF_NICCHGPOLLRT 2500
00048 #define DEF_WILL_AUTO false
00049 #define DEF_WILL 3
00050 #define DEF_ALLOW_NO_INTS true
00051 #define DEF_TOS 16
00052 #define DEF_DEBUGLVL "1"
00053 #define DEF_IPC_CONNECTIONS 0
00054 #define DEF_FIB_METRIC FIBM_FLAT
00055 #define DEF_LQ_ALWAYS_SEND_TC true
00056 #define DEF_LQ_FISH 1
00057 #define DEF_LQ_NAT_THRESH 1000
00058 #define DEF_CLEAR_SCREEN true
00059 #define DEF_HTTPPORT 8080
00060 #define DEF_HTTPLIMIT 3
00061 #define DEF_TXTPORT 2006
00062 #define DEF_TXTLIMIT 3
00063
00064
00065
00066 #define MIN_INTERVAL 0.01
00067
00068 #define MAX_POLLRATE 10000
00069 #define MIN_POLLRATE 10
00070 #define MAX_NICCHGPOLLRT 100000
00071 #define MIN_NICCHGPOLLRT 1000
00072 #define MAX_DEBUGLVL 3
00073 #define MIN_DEBUGLVL -2
00074 #define MAX_TOS 16
00075 #define MAX_WILLINGNESS 7
00076 #define MIN_WILLINGNESS 0
00077 #define MAX_MPR_COVERAGE 20
00078 #define MIN_MPR_COVERAGE 1
00079 #define MAX_TC_REDUNDANCY 2
00080 #define MAX_HYST_PARAM 1.0
00081 #define MIN_HYST_PARAM 0.0
00082 #define MAX_LQ_AGING 1.0
00083 #define MIN_LQ_AGING 0.01
00084
00085
00086 #define CFG_FIBM_FLAT "flat"
00087 #define CFG_FIBM_CORRECT "correct"
00088 #define CFG_FIBM_APPROX "approx"
00089
00090 #define CFG_IP6T_AUTO "auto"
00091 #define CFG_IP6T_SITELOCAL "site-local"
00092 #define CFG_IP6T_UNIQUELOCAL "unique-local"
00093 #define CFG_IP6T_GLOBAL "global"
00094
00095 #define OLSR_IP6T_AUTO 0
00096 #define OLSR_IP6T_SITELOCAL 1
00097 #define OLSR_IP6T_UNIQUELOCAL 2
00098 #define OLSR_IP6T_GLOBAL 3
00099
00100 #ifndef IPV6_ADDR_GLOBAL
00101 #define IPV6_ADDR_GLOBAL 0x0000U
00102 #endif
00103
00104 #ifndef IPV6_ADDR_SITELOCAL
00105 #define IPV6_ADDR_SITELOCAL 0x0040U
00106 #endif
00107
00108
00109 struct olsr_if_config;
00110
00111 #include "interfaces.h"
00112 #include "olsr_ip_acl.h"
00113 #include "olsr_logging.h"
00114
00115 enum smart_gw_uplinktype {
00116 GW_UPLINK_NONE,
00117 GW_UPLINK_IPV4,
00118 GW_UPLINK_IPV6,
00119 GW_UPLINK_IPV46,
00120 GW_UPLINK_CNT,
00121 };
00122
00123 struct olsr_msg_params {
00124 uint32_t emission_interval;
00125 uint32_t validity_time;
00126 };
00127
00128 struct olsr_lq_mult {
00129 union olsr_ip_addr addr;
00130 uint32_t value;
00131 struct olsr_lq_mult *next;
00132 };
00133
00134 struct olsr_if_weight {
00135 int value;
00136 bool fixed;
00137 };
00138
00139 struct olsr_if_options {
00140 union olsr_ip_addr ipv4_broadcast;
00141 int ipv6_addrtype;
00142 union olsr_ip_addr ipv6_multi_site;
00143 union olsr_ip_addr ipv6_multi_glbl;
00144 struct olsr_if_weight weight;
00145 struct olsr_msg_params hello_params;
00146 struct olsr_lq_mult *lq_mult;
00147 bool autodetect_chg;
00148 enum interface_mode mode;
00149 };
00150
00151 struct olsr_if_config {
00152 char *name;
00153 char *config;
00154 struct interface *interf;
00155 struct olsr_if_options *cnf;
00156 struct olsr_if_config *next;
00157 };
00158
00159 struct plugin_param {
00160 char *key;
00161 char *value;
00162 struct plugin_param *next;
00163 };
00164
00165 struct plugin_entry {
00166 char *name;
00167 struct plugin_param *params;
00168 struct plugin_entry *next;
00169 };
00170
00171 typedef enum {
00172 FIBM_FLAT,
00173 FIBM_CORRECT,
00174 FIBM_APPROX
00175 } olsr_fib_metric_options;
00176
00177
00178
00179
00180
00181 struct olsr_config {
00182 int ip_version;
00183 size_t ipsize;
00184
00185 unsigned char no_fork:1;
00186 unsigned char allow_no_interfaces:1;
00187 unsigned char willingness_auto:1;
00188 unsigned char clear_screen:1;
00189 unsigned char source_ip_mode:1;
00190
00191 uint16_t tos;
00192 uint8_t rt_proto;
00193 uint8_t rt_table;
00194 uint8_t rt_table_default;
00195 olsr_fib_metric_options fib_metric;
00196
00197
00198 bool log_event[LOG_SEVERITY_COUNT][LOG_SOURCE_COUNT];
00199 bool log_target_stderr;
00200 char *log_target_file;
00201 bool log_target_syslog;
00202
00203 struct plugin_entry *plugins;
00204 struct list_entity hna_entries;
00205 struct olsr_if_config *if_configs;
00206
00207 uint32_t pollrate;
00208 uint32_t nic_chgs_pollrate;
00209 uint32_t lq_nat_thresh;
00210 uint8_t tc_redundancy;
00211 uint8_t mpr_coverage;
00212 uint8_t lq_fish;
00213 uint8_t willingness;
00214
00215 uint16_t olsr_port;
00216 char *dlPath;
00217
00218 uint16_t comport_http;
00219 uint16_t comport_http_limit;
00220 uint16_t comport_txt;
00221 uint16_t comport_txt_limit;
00222
00223 struct olsr_msg_params tc_params;
00224 struct olsr_msg_params mid_params;
00225 struct olsr_msg_params hna_params;
00226
00227
00228
00229
00230
00231
00232
00233 union olsr_ip_addr router_id;
00234 uint32_t will_int;
00235 int exit_value;
00236
00237 int ioctl_s;
00238
00239 union olsr_ip_addr main_addr, unicast_src_ip;
00240
00241 #if defined linux
00242 uint8_t rt_table_tunnel;
00243 int32_t rt_table_pri, rt_table_tunnel_pri;
00244 int32_t rt_table_defaultolsr_pri, rt_table_default_pri;
00245
00246 bool use_niit;
00247 bool use_src_ip_routes;
00248
00249 bool smart_gw_active, smart_gw_allow_nat, smart_gw_uplink_nat;
00250 enum smart_gw_uplinktype smart_gw_type;
00251 uint32_t smart_gw_uplink, smart_gw_downlink;
00252 struct olsr_ip_prefix smart_gw_prefix;
00253
00254 int rtnl_s;
00255 int rt_monitor_socket;
00256
00257 int niit4to6_if_index, niit6to4_if_index;
00258
00259
00260 bool has_ipv4_gateway, has_ipv6_gateway;
00261 #endif
00262 #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__
00263 int rts_bsd;
00264 #endif
00265 };
00266
00267
00268
00269
00270 extern struct olsr_config *EXPORT(olsr_cnf);
00271
00272
00273
00274
00275
00276 void olsr_parse_cfg(int argc, char *argv[], const char *file, struct olsr_config **rcfg);
00277 struct olsr_if_options *olsr_get_default_if_options(void);
00278 struct olsr_config *olsr_get_default_cfg(void);
00279 int olsr_sanity_check_cfg(struct olsr_config *cfg);
00280 void olsr_free_cfg(struct olsr_config *cfg);
00281
00282 #endif
00283
00284
00285
00286
00287
00288
00289