Contiki-NG
rpl-conf.h
1/*
2 * Copyright (c) 2010, 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
30/*
31 * \file
32 * Public configuration and API declarations for ContikiRPL.
33 * \author
34 * Joakim Eriksson <joakime@sics.se> & Nicolas Tsiftes <nvt@sics.se>
35 *
36 */
37
38#ifndef RPL_CONF_H
39#define RPL_CONF_H
40
41#include "contiki.h"
43
44/* DAG Mode of Operation */
45#define RPL_MOP_NO_DOWNWARD_ROUTES 0
46#define RPL_MOP_NON_STORING 1
47#define RPL_MOP_STORING_NO_MULTICAST 2
48#define RPL_MOP_STORING_MULTICAST 3
49
50/* RPL Mode of operation */
51#ifdef RPL_CONF_MOP
52#define RPL_MOP_DEFAULT RPL_CONF_MOP
53#else /* RPL_CONF_MOP */
54#if RPL_WITH_MULTICAST
55#define RPL_MOP_DEFAULT RPL_MOP_STORING_MULTICAST
56#else
57#define RPL_MOP_DEFAULT RPL_MOP_STORING_NO_MULTICAST
58#endif /* RPL_WITH_MULTICAST */
59#endif /* RPL_CONF_MOP */
60
61/*
62 * Embed support for storing mode
63 */
64#ifdef RPL_CONF_WITH_STORING
65#define RPL_WITH_STORING RPL_CONF_WITH_STORING
66#else /* RPL_CONF_WITH_STORING */
67/* By default: embed support for non-storing if and only if the
68 configured MOP is not non-storing. */
69#define RPL_WITH_STORING (RPL_MOP_DEFAULT != RPL_MOP_NON_STORING)
70#endif /* RPL_CONF_WITH_STORING */
71
72/*
73 * Embed support for non-storing mode
74 */
75#ifdef RPL_CONF_WITH_NON_STORING
76#define RPL_WITH_NON_STORING RPL_CONF_WITH_NON_STORING
77#else /* RPL_CONF_WITH_NON_STORING */
78/* By default: embed support for non-storing if and only if the
79 configured MOP is non-storing. */
80#define RPL_WITH_NON_STORING (RPL_MOP_DEFAULT == RPL_MOP_NON_STORING)
81#endif /* RPL_CONF_WITH_NON_STORING */
82
83#define RPL_IS_STORING(instance) (RPL_WITH_STORING && ((instance) != NULL) && ((instance)->mop > RPL_MOP_NON_STORING))
84#define RPL_IS_NON_STORING(instance) (RPL_WITH_NON_STORING && ((instance) != NULL) && ((instance)->mop == RPL_MOP_NON_STORING))
85
86/* Emit a pre-processor error if the user configured multicast with bad MOP */
87#if RPL_WITH_MULTICAST && (RPL_MOP_DEFAULT != RPL_MOP_STORING_MULTICAST)
88#error "RPL Multicast requires RPL_MOP_DEFAULT==3. Check contiki-conf.h"
89#endif
90
91/* Set to 1 to enable RPL statistics */
92#ifndef RPL_CONF_STATS
93#define RPL_CONF_STATS 0
94#endif /* RPL_CONF_STATS */
95
96/*
97 * The objective function (OF) used by a RPL root is configurable through
98 * the RPL_CONF_OF_OCP parameter. This is defined as the objective code
99 * point (OCP) of the OF, RPL_OCP_OF0 or RPL_OCP_MRHOF. This flag is of
100 * no relevance to non-root nodes, which run the OF advertised in the
101 * instance they join.
102 * Make sure the selected of is in RPL_SUPPORTED_OFS.
103 */
104#ifdef RPL_CONF_OF_OCP
105#define RPL_OF_OCP RPL_CONF_OF_OCP
106#else /* RPL_CONF_OF_OCP */
107#define RPL_OF_OCP RPL_OCP_MRHOF
108#endif /* RPL_CONF_OF_OCP */
109
110/*
111 * The set of objective functions supported at runtime. Nodes are only
112 * able to join instances that advertise an OF in this set. To include
113 * both OF0 and MRHOF, use {&rpl_of0, &rpl_mrhof}.
114 */
115#ifdef RPL_CONF_SUPPORTED_OFS
116#define RPL_SUPPORTED_OFS RPL_CONF_SUPPORTED_OFS
117#else /* RPL_CONF_SUPPORTED_OFS */
118#define RPL_SUPPORTED_OFS {&rpl_mrhof}
119#endif /* RPL_CONF_SUPPORTED_OFS */
120
121/*
122 * Enable/disable RPL Metric Containers (MC). The actual MC in use for
123 * a given DODAG is decided at runtime, when joining. Note that OF0
124 * (RFC6552) operates without MC, and so does MRHOF (RFC6719) when
125 * used with ETX as a metric (the rank is the metric). We disable MC
126 * by default, but note that it must be enabled to support joining a
127 * DODAG that requires MC (e.g., MRHOF with a metric other than ETX).
128 */
129#ifdef RPL_CONF_WITH_MC
130#define RPL_WITH_MC RPL_CONF_WITH_MC
131#else /* RPL_CONF_WITH_MC */
132#define RPL_WITH_MC 0
133#endif /* RPL_CONF_WITH_MC */
134
135/* The MC advertised in DIOs and propagating from the root. */
136#ifdef RPL_CONF_DAG_MC
137#define RPL_DAG_MC RPL_CONF_DAG_MC
138#else
139#define RPL_DAG_MC RPL_DAG_MC_NONE
140#endif /* RPL_CONF_DAG_MC */
141
142/* This value decides which DAG instance we should participate in by default. */
143#ifdef RPL_CONF_DEFAULT_INSTANCE
144#define RPL_DEFAULT_INSTANCE RPL_CONF_DEFAULT_INSTANCE
145#else
146#define RPL_DEFAULT_INSTANCE 0x1e
147#endif /* RPL_CONF_DEFAULT_INSTANCE */
148
149/*
150 * This value decides if this node must stay as a leaf or not
151 * as allowed by draft-ietf-roll-rpl-19#section-8.5
152 */
153#ifdef RPL_CONF_LEAF_ONLY
154#define RPL_LEAF_ONLY RPL_CONF_LEAF_ONLY
155#else
156#define RPL_LEAF_ONLY 0
157#endif
158
159/*
160 * Maximum number of concurrent RPL instances.
161 */
162#ifdef RPL_CONF_MAX_INSTANCES
163#define RPL_MAX_INSTANCES RPL_CONF_MAX_INSTANCES
164#else
165#define RPL_MAX_INSTANCES 1
166#endif /* RPL_CONF_MAX_INSTANCES */
167
168/*
169 * Maximum number of DAGs within an instance.
170 */
171#ifdef RPL_CONF_MAX_DAG_PER_INSTANCE
172#define RPL_MAX_DAG_PER_INSTANCE RPL_CONF_MAX_DAG_PER_INSTANCE
173#else
174#define RPL_MAX_DAG_PER_INSTANCE 2
175#endif /* RPL_CONF_MAX_DAG_PER_INSTANCE */
176
177/*
178 * RPL Default route lifetime
179 *
180 * The RPL route lifetime is used for the downward routes and for the
181 * default route. In a high density network with DIO suppression
182 * activated, it may happen that a node will never send a DIO once the
183 * DIO interval becomes high as it has heard DIOs from many neighbors
184 * already.
185 *
186 * As the default route to the preferred parent has a lifetime reset
187 * by receiving a DIO from the parent, it means that the default route
188 * can be destroyed after a while. Setting the default route with
189 * infinite lifetime secures the upstream route.
190 */
191#ifdef RPL_CONF_DEFAULT_ROUTE_INFINITE_LIFETIME
192#define RPL_DEFAULT_ROUTE_INFINITE_LIFETIME RPL_CONF_DEFAULT_ROUTE_INFINITE_LIFETIME
193#else
194#define RPL_DEFAULT_ROUTE_INFINITE_LIFETIME 1
195#endif /* RPL_CONF_DEFAULT_ROUTE_INFINITE_LIFETIME */
196
197/*
198 * Maximum lifetime of a DAG
199 *
200 * When a DODAG has not been updated for a period of
201 * <RPL_CONF_DAG_LIFETIME times the DODAG maximum DIO interval>, the
202 * DODAG is removed from the list of DODAGs of the related instance,
203 * except if it is the currently joined DODAG.
204 */
205#ifdef RPL_CONF_DAG_LIFETIME
206#define RPL_DAG_LIFETIME RPL_CONF_DAG_LIFETIME
207#else
208#define RPL_DAG_LIFETIME 3
209#endif /* RPL_CONF_DAG_LIFETIME */
210
211/*
212 *
213 */
214#ifndef RPL_CONF_DAO_SPECIFY_DAG
215 #if RPL_MAX_DAG_PER_INSTANCE > 1
216 #define RPL_DAO_SPECIFY_DAG 1
217 #else
218 #define RPL_DAO_SPECIFY_DAG 0
219 #endif /* RPL_MAX_DAG_PER_INSTANCE > 1 */
220#else
221 #define RPL_DAO_SPECIFY_DAG RPL_CONF_DAO_SPECIFY_DAG
222#endif /* RPL_CONF_DAO_SPECIFY_DAG */
223
224/*
225 * The DIO interval (n) represents 2^n ms.
226 *
227 * According to the specification, the default value is 3, which
228 * means 8 milliseconds. That is far too low when using duty cycling
229 * with wake-up intervals that are typically hundreds of milliseconds.
230 * ContikiRPL thus sets the default to 2^12 ms = 4.096 s.
231 */
232#ifdef RPL_CONF_DIO_INTERVAL_MIN
233#define RPL_DIO_INTERVAL_MIN RPL_CONF_DIO_INTERVAL_MIN
234#else
235#define RPL_DIO_INTERVAL_MIN 12
236#endif
237
238/*
239 * Maximum amount of timer doublings.
240 *
241 * The maximum interval will by default be 2^(12+8) ms = 1048.576 s.
242 * RFC 6550 suggests a default value of 20, which of course would be
243 * unsuitable when we start with a minimum interval of 2^12.
244 */
245#ifdef RPL_CONF_DIO_INTERVAL_DOUBLINGS
246#define RPL_DIO_INTERVAL_DOUBLINGS RPL_CONF_DIO_INTERVAL_DOUBLINGS
247#else
248#define RPL_DIO_INTERVAL_DOUBLINGS 8
249#endif
250
251/*
252 * DIO redundancy. To learn more about this, see RFC 6206.
253 *
254 * RFC 6550 suggests a default value of 10. It is unclear what the basis
255 * of this suggestion is. Network operators might attain more efficient
256 * operation by tuning this parameter for specific deployments.
257 */
258#ifdef RPL_CONF_DIO_REDUNDANCY
259#define RPL_DIO_REDUNDANCY RPL_CONF_DIO_REDUNDANCY
260#else
261#define RPL_DIO_REDUNDANCY 10
262#endif
263
264/*
265 * Default route lifetime unit. This is the granularity of time
266 * used in RPL lifetime values, in seconds.
267 */
268#ifndef RPL_CONF_DEFAULT_LIFETIME_UNIT
269#define RPL_DEFAULT_LIFETIME_UNIT 60
270#else
271#define RPL_DEFAULT_LIFETIME_UNIT RPL_CONF_DEFAULT_LIFETIME_UNIT
272#endif
273
274/*
275 * Default route lifetime as a multiple of the lifetime unit.
276 */
277#ifndef RPL_CONF_DEFAULT_LIFETIME
278#define RPL_DEFAULT_LIFETIME 30
279#else
280#define RPL_DEFAULT_LIFETIME RPL_CONF_DEFAULT_LIFETIME
281#endif
282
283/*
284 * DAG preference field.
285 */
286#ifdef RPL_CONF_PREFERENCE
287#define RPL_PREFERENCE RPL_CONF_PREFERENCE
288#else
289#define RPL_PREFERENCE 0
290#endif
291
292/*
293 * RPL DAO-ACK support. When enabled, DAO-ACKs will be sent and
294 * requested. This will also enable retransmission of DAO when no ack
295 * has been received.
296 */
297#ifdef RPL_CONF_WITH_DAO_ACK
298#define RPL_WITH_DAO_ACK RPL_CONF_WITH_DAO_ACK
299#else
300#define RPL_WITH_DAO_ACK 0
301#endif /* RPL_CONF_WITH_DAO_ACK */
302
303/*
304 * RPL REPAIR ON DAO NACK. When enabled, DAO NACK will trigger a local
305 * repair in order to quickly find a new parent to send DAOs to.
306 *
307 * NOTE: this is too agressive in some cases, so use with care.
308 * */
309#ifdef RPL_CONF_RPL_REPAIR_ON_DAO_NACK
310#define RPL_REPAIR_ON_DAO_NACK RPL_CONF_RPL_REPAIR_ON_DAO_NACK
311#else
312#define RPL_REPAIR_ON_DAO_NACK 0
313#endif /* RPL_CONF_RPL_REPAIR_ON_DAO_NACK */
314
315/*
316 * Setting the DIO_REFRESH_DAO_ROUTES will make the RPL root always
317 * increase the DTSN (Destination Advertisement Trigger Sequence Number)
318 * when sending multicast DIO. This is to get all children to re-register
319 * their DAO route. This is needed when DAO-ACK is not enabled to add
320 * reliability to route maintenance.
321 * */
322#ifdef RPL_CONF_DIO_REFRESH_DAO_ROUTES
323#define RPL_DIO_REFRESH_DAO_ROUTES RPL_CONF_DIO_REFRESH_DAO_ROUTES
324#else
325#define RPL_DIO_REFRESH_DAO_ROUTES 1
326#endif /* RPL_CONF_DIO_REFRESH_DAO_ROUTES */
327
328/*
329 * RPL probing. When enabled, probes will be sent periodically to keep
330 * parent link estimates up to date.
331 */
332#ifdef RPL_CONF_WITH_PROBING
333#define RPL_WITH_PROBING RPL_CONF_WITH_PROBING
334#else
335#define RPL_WITH_PROBING 1
336#endif
337
338/*
339 * RPL probing interval.
340 */
341#ifdef RPL_CONF_PROBING_INTERVAL
342#define RPL_PROBING_INTERVAL RPL_CONF_PROBING_INTERVAL
343#else
344#define RPL_PROBING_INTERVAL (60 * CLOCK_SECOND)
345#endif
346
347/*
348 * Function used to select the next parent to be probed.
349 */
350#ifdef RPL_CONF_PROBING_SELECT_FUNC
351#define RPL_PROBING_SELECT_FUNC RPL_CONF_PROBING_SELECT_FUNC
352#else
353#define RPL_PROBING_SELECT_FUNC get_probing_target
354#endif
355
356/*
357 * Function used to send RPL probes.
358 *
359 * To probe with DIO, use:
360 * #define RPL_CONF_PROBING_SEND_FUNC(instance, addr) dio_output((instance), (addr))
361 *
362 * To probe with DIS, use:
363 * #define RPL_CONF_PROBING_SEND_FUNC(instance, addr) dis_output((addr))
364 *
365 * Any other custom probing function is also acceptable.
366 */
367#ifdef RPL_CONF_PROBING_SEND_FUNC
368#define RPL_PROBING_SEND_FUNC RPL_CONF_PROBING_SEND_FUNC
369#else
370#define RPL_PROBING_SEND_FUNC(instance, addr) dio_output((instance), (addr))
371#endif
372
373/*
374 * Function used to calculate next RPL probing interval.
375 */
376#ifdef RPL_CONF_PROBING_DELAY_FUNC
377#define RPL_PROBING_DELAY_FUNC RPL_CONF_PROBING_DELAY_FUNC
378#else
379#define RPL_PROBING_DELAY_FUNC get_probing_delay
380#endif
381
382/*
383 * Interval of DIS transmission.
384 */
385#ifdef RPL_CONF_DIS_INTERVAL
386#define RPL_DIS_INTERVAL RPL_CONF_DIS_INTERVAL
387#else
388#define RPL_DIS_INTERVAL 60
389#endif
390
391/*
392 * Added delay of first DIS transmission after boot.
393 */
394#ifdef RPL_CONF_DIS_START_DELAY
395#define RPL_DIS_START_DELAY RPL_CONF_DIS_START_DELAY
396#else
397#define RPL_DIS_START_DELAY 5
398#endif
399
400#endif /* RPL_CONF_H */
This header file contains configuration directives for uIPv6 multicast support.