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