Contiki 3.x
contiki-conf.h
1 /*
2  * Copyright (c) 2005, Swedish Institute of Computer Science
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * This file is part of the Contiki operating system.
30  *
31  */
32 
33 #ifndef CONTIKI_CONF_H_
34 #define CONTIKI_CONF_H_
35 
36 #include <inttypes.h>
37 #include <limits.h>
38 #ifndef _WIN32
39 #include <sys/select.h>
40 #endif
41 
42 struct select_callback {
43  int (* set_fd)(fd_set *fdr, fd_set *fdw);
44  void (* handle_fd)(fd_set *fdr, fd_set *fdw);
45 };
46 int select_set_callback(int fd, const struct select_callback *callback);
47 
48 #define CC_CONF_REGISTER_ARGS 1
49 #define CC_CONF_FUNCTION_POINTER_ARGS 1
50 #define CC_CONF_VA_ARGS 1
51 
52 #define CCIF
53 #define CLIF
54 
55 #ifndef EEPROM_CONF_SIZE
56 #define EEPROM_CONF_SIZE 1024
57 #endif
58 
59 /* These names are deprecated, use C99 names. */
60 typedef uint8_t u8_t;
61 typedef uint16_t u16_t;
62 typedef uint32_t u32_t;
63 typedef int32_t s32_t;
64 
65 typedef unsigned short uip_stats_t;
66 
67 
68 #if NETSTACK_CONF_WITH_IPV6
69 /* The Windows build uses wpcap to connect to a host interface. It finds the interface by scanning for
70  * an address, which can be specified here and overridden with the command line.
71  * An ip4 or ip6 address can be used; this allows turning off the ip4 protocol on the interface.
72  * The existing turorials use an ipv4 address, so we leave that as the default.
73  * Non-windows builds don't use this define.
74  */
75 //#define WPCAP_INTERFACE_ADDRESS "fdfd::1" //10.10.10.10 is the default (even for ipv6)
76 
77 /* Minimal-net gets a 6 byte ethernet MAC assigned in uip.c, currently {0x00,0x06,0x98,0x00,0x02,0x32}
78  * This gets converted to a link layer address of [fe80::206:98ff:fe00:232]
79  * You could change the uip.c address when running multiple instances, however HARD_CODED_ADDRESS
80  * can also specify a different MAC address if any of the last three bytes are non-zero. It can also
81  * specify a prefix if any of the first four longs are nonzero. RPL builds use this to pass a prefix
82  * to the border router and also to ensure it has a different link-layer address from the RPL end node.
83  * HARD_CODED_ADDRESS can also be changed in /platform/minimal-net/contiki-main.c so as not to force complete
84  * rebuilds when making multiple instances of a minimal-net client.
85 */
86 //#define HARD_CODED_ADDRESS "::10" //assign link-layer address fe80::ff:fe00:10, wait for RA or RPL prefix
87 //#define HARD_CODED_ADDRESS "fdfd::" //assign prefix; address becomes fdfd::206:98ff:fe00:232
88 //#define HARD_CODED_ADDRESS "fdfd::10" //assign prefix and ipv6 address fdfd::ff:fe00:10
89 
90 /* The status.shtml page shows addresses, neighbors, and routes on ipv6 builds. Use this define to enable
91  * the needed routines in httpd-cgi.c on the webserver6 build. The status page is present in
92  * /apps/webserver/httpd-fs/ but not in the default /apps/webserver/httpd-fsdata.c file.
93  * To include it run the PERL script /../../tools/makefsdata from the /apps/webserver/ directory.
94  * NB: Webserver builds on all platforms will use the current httpd-fsdata.c file. The added 160 bytes
95  * could overflow memory on the smaller platforms.
96  */
97 #define WEBSERVER_CONF_STATUSPAGE 1
98 
99 /* RPL currently works only on Windows. *nix would require converting the tun interface to two pcap tees. */
100 //#define RPL_BORDER_ROUTER 0
101 #endif
102 
103 #if UIP_CONF_IPV6_RPL
104 /* RPL motes use the uip.c link layer address or optionally the harded coded address (but without the prefix!)
105  * Different instances can be made by changing the link layer portion of HARD_CODED_ADDRESS in contiki-main.c
106  * Rename them to e.g. webserver6.10, webserver6.11, ...
107  * They should all attach to a minimal-net rpl border that uses the same primary interface.
108  * For multihop testing, configure intermediate notes as routers.
109  */
110 #define HARD_CODED_ADDRESS "bbbb::10" //the prefix is ignored for a rpl node
111 #define UIP_CONF_ROUTER 0
112 #define UIP_CONF_ND6_SEND_RA 0
113 #define UIP_CONF_ND6_REACHABLE_TIME 600000
114 #define UIP_CONF_ND6_RETRANS_TIMER 10000
115 
116 #if RPL_BORDER_ROUTER
117 /* RPL border router accepts packets from the host through the fallback and directs them to
118  * the primary interface. Thus the fallback and rpl dag prefix must be the same. The prefix of
119  * the primary interface does not matter!
120  * Rename this build to e.g. webrouter. Then on Windows create two loopback interfaces, bbbb:: and fdfd::
121  * Attach the RPL end nodes to fdfd:: and the webrouter to fdfd:: with bbbb:: as the fallback.
122  * Direct browser to bbbb::ff:fe00:1/status.html, bbbb::ff:fe00:10/status.html, bbbb::ff:fe00:20/status.html.
123  * The traffic will go through the bbbb:: interface to the router, then out the fdfd:: interface to the end
124  * nodes. The end nodes must be explicitly added as neighbors to avoid a blocking NS
125  * netsh interface ipv6 add neighbor bbbb::ff:fe00:10 33-33-ff-33-44-10 interface=16 (# of the bbbb interface)
126  * netsh interface ipv6 add neighbor bbbb::ff:fe00:20 33-33-ff-33-44-20 interface=16 (# of the bbbb interface)
127  *
128  * Instead of using the fdfd:: loopback it is also possible to attach the border router to another interface,
129  * e.g. the jackdaw RNDIS <-> repeater. Then RPL will configure on the radio network and the RF motes will
130  * be reached through bbbb::<mote link layer address>.
131  * Possibly minimal-net RPL motes could also be added to this interface?
132  *
133  */
134 #undef UIP_CONF_ROUTER
135 #define UIP_CONF_ROUTER 1
136 //#define RPL_CONF_STATS 0
137 //#define UIP_CONF_BUFFER_SIZE 1300
138 #undef UIP_FALLBACK_INTERFACE
139 #define UIP_FALLBACK_INTERFACE rpl_interface
140 //#define WPCAP_FALLBACK_ADDRESS "bbbb::1" //bbbb::1 is the default fallback prefix
141 #undef HARD_CODED_ADDRESS
142 #define HARD_CODED_ADDRESS "bbbb::1" //bbbb::ff:fe00:1 is the RPL border router default
143 //#define UIP_CONF_ND6_SEND_RA 0
144 //#define UIP_CONF_ND6_REACHABLE_TIME 600000
145 //#define UIP_CONF_ND6_RETRANS_TIMER 10000
146 #endif
147 
148 #endif
149 
150 #define UIP_CONF_LLH_LEN 14
151 #define UIP_CONF_MAX_LISTENPORTS 40
152 #define UIP_CONF_MAX_CONNECTIONS 40
153 #define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
154 #define UIP_CONF_TCP_SPLIT 0
155 #define UIP_CONF_IP_FORWARD 0
156 #define UIP_CONF_LOGGING 0
157 #define UIP_CONF_UDP_CHECKSUMS 1
158 
159 /* Not used but avoids compile errors while sicslowpan.c is being developed */
160 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
161 
162 #define NETSTACK_CONF_LINUXRADIO_DEV "wpan0"
163 
164 #define UIP_CONF_UDP 1
165 #define UIP_CONF_TCP 1
166 
167 #if NETSTACK_CONF_WITH_IPV6
168 #define UIP_CONF_IPV6_QUEUE_PKT 1
169 #define UIP_CONF_IPV6_CHECKS 1
170 #define UIP_CONF_IPV6_REASSEMBLY 1
171 //#define UIP_CONF_NETIF_MAX_ADDRESSES 5
172 #define NBR_TABLE_CONF_MAX_NEIGHBORS 100
173 #define UIP_CONF_DS6_DEFRT_NBU 2
174 #define UIP_CONF_DS6_PREFIX_NBU 5
175 #define UIP_CONF_MAX_ROUTES 100
176 #define UIP_CONF_DS6_ADDR_NBU 10
177 #define UIP_CONF_DS6_MADDR_NBU 0
178 #define UIP_CONF_DS6_AADDR_NBU 0
179 #endif /* NETSTACK_CONF_WITH_IPV6 */
180 
181 typedef unsigned long clock_time_t;
182 #define CLOCK_CONF_SECOND 1000
183 #define INFINITE_TIME ULONG_MAX
184 
185 #define LOG_CONF_ENABLED 1
186 
187 /* Not part of C99 but actually present */
188 int strcasecmp(const char*, const char*);
189 
190 #endif /* CONTIKI_CONF_H_ */