Contiki-NG
roll-tm.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011, Loughborough University - 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 * \addtogroup uip-multicast
34 * @{
35 */
36/**
37 * \defgroup roll-tm ROLL Trickle Multicast
38 *
39 * IPv6 multicast according to the algorithm in the
40 * "MCAST Forwarding Using Trickle" internet draft.
41 *
42 * The current version of the draft can always be found in
43 * http://tools.ietf.org/html/draft-ietf-roll-trickle-mcast
44 *
45 * This implementation is based on the draft version stored in
46 * ROLL_TM_VER.
47 *
48 * In draft v2, the document was renamed to
49 * "Multicast Protocol for Low power and Lossy Networks (MPL)"
50 * Due to very significant changes between draft versions 1 and 2,
51 * MPL will be implemented as a separate engine and this file here
52 * will provide legacy support for Draft v1.
53 * @{
54 */
55/**
56 * \file
57 * Header file for the implementation of the ROLL-TM multicast engine
58 * \author
59 * George Oikonomou - <oikonomou@users.sourceforge.net>
60 */
61
62#ifndef ROLL_TM_H_
63#define ROLL_TM_H_
64
65#include "contiki.h"
67
68#include <stdint.h>
69/*---------------------------------------------------------------------------*/
70/* Protocol Constants */
71/*---------------------------------------------------------------------------*/
72#define ROLL_TM_VER 1 /**< Supported Draft Version */
73#define ROLL_TM_ICMP_CODE 0 /**< ROLL TM ICMPv6 code field */
74#define ROLL_TM_IP_HOP_LIMIT 0xFF /**< Hop limit for ICMP messages */
75#define ROLL_TM_INFINITE_REDUNDANCY 0xFF
76#define ROLL_TM_DGRAM_OUT 0
77#define ROLL_TM_DGRAM_IN 1
78
79/*
80 * The draft does not currently specify a default number for the trickle
81 * interval nor a way to derive it. Examples however hint at 100 msec.
82 *
83 * In draft terminology, we use an 'aggressive' policy (M=0) and a conservative
84 * one (M=1).
85 *
86 * When experimenting with the two policies on the sky platform,
87 * an interval of 125ms proves to be way too low: When we have traffic,
88 * doublings happen after the interval end and periodics fire after point T
89 * within the interval (and sometimes even after interval end). When traffic
90 * settles down, the code compensates the offsets.
91 *
92 * We consider 125, 250ms etc because they are nice divisors of 1 sec
93 * (quotient is power of two). For some machines (e.g sky/msp430),
94 * this is also a nice number of clock ticks
95 *
96 * After experimentation, the values of Imin leading to best performance are:
97 * ContikiMAC: Imin=64 (500ms)
98 * Null RDC: imin=16 (125ms)
99 */
100
101/* Configuration for Timer with M=0 (aggressive) */
102#ifdef ROLL_TM_CONF_IMIN_0
103#define ROLL_TM_IMIN_0 ROLL_TM_CONF_IMIN_0
104#else
105#define ROLL_TM_IMIN_0 32 /* 250 msec */
106#endif
107
108#ifdef ROLL_TM_CONF_IMAX_0
109#define ROLL_TM_IMAX_0 ROLL_TM_CONF_IMAX_0
110#else
111#define ROLL_TM_IMAX_0 1 /* Imax = 500ms */
112#endif
113
114#ifdef ROLL_TM_CONF_K_0
115#define ROLL_TM_K_0 ROLL_TM_CONF_K_0
116#else
117#define ROLL_TM_K_0 ROLL_TM_INFINITE_REDUNDANCY
118#endif
119
120#ifdef ROLL_TM_CONF_T_ACTIVE_0
121#define ROLL_TM_T_ACTIVE_0 ROLL_TM_CONF_T_ACTIVE_0
122#else
123#define ROLL_TM_T_ACTIVE_0 3
124#endif
125
126#ifdef ROLL_TM_CONF_T_DWELL_0
127#define ROLL_TM_T_DWELL_0 ROLL_TM_CONF_T_DWELL_0
128#else
129#define ROLL_TM_T_DWELL_0 11
130#endif
131
132/* Configuration for Timer with M=1 (conservative) */
133#ifdef ROLL_TM_CONF_IMIN_1
134#define ROLL_TM_IMIN_1 ROLL_TM_CONF_IMIN_1
135#else
136#define ROLL_TM_IMIN_1 64 /* 500 msec */
137#endif
138
139#ifdef ROLL_TM_CONF_IMAX_1
140#define ROLL_TM_IMAX_1 ROLL_TM_CONF_IMAX_1
141#else
142#define ROLL_TM_IMAX_1 9 /* Imax = 256 secs */
143#endif
144
145#ifdef ROLL_TM_CONF_K_1
146#define ROLL_TM_K_1 ROLL_TM_CONF_K_1
147#else
148#define ROLL_TM_K_1 1
149#endif
150
151#ifdef ROLL_TM_CONF_T_ACTIVE_1
152#define ROLL_TM_T_ACTIVE_1 ROLL_TM_CONF_T_ACTIVE_1
153#else
154#define ROLL_TM_T_ACTIVE_1 3
155#endif
156
157#ifdef ROLL_TM_CONF_T_DWELL_1
158#define ROLL_TM_T_DWELL_1 ROLL_TM_CONF_T_DWELL_1
159#else
160#define ROLL_TM_T_DWELL_1 12
161#endif
162/*---------------------------------------------------------------------------*/
163/* Configuration */
164/*---------------------------------------------------------------------------*/
165/**
166 * Number of Sliding Windows
167 * In essence: How many unique sources of simultaneous multicast traffic do we
168 * want to support for our lowpan
169 * If a node is seeding two multicast streams, parametrized on different M
170 * values, then this seed will occupy two different sliding windows
171 */
172#ifdef ROLL_TM_CONF_WINS
173#define ROLL_TM_WINS ROLL_TM_CONF_WINS
174#else
175#define ROLL_TM_WINS 2
176#endif
177/*---------------------------------------------------------------------------*/
178/**
179 * Maximum Number of Buffered Multicast Messages
180 * This buffer is shared across all Seed IDs, therefore a new very active Seed
181 * may eventually occupy all slots. It would make little sense (if any) to
182 * define support for fewer buffered messages than seeds*2
183 */
184#ifdef ROLL_TM_CONF_BUFF_NUM
185#define ROLL_TM_BUFF_NUM ROLL_TM_CONF_BUFF_NUM
186#else
187#define ROLL_TM_BUFF_NUM 6
188#endif
189/*---------------------------------------------------------------------------*/
190/**
191 * Use Short Seed IDs [short: 2, long: 16 (default)]
192 * It can be argued that we should (and it would be easy to) support both at
193 * the same time but the draft doesn't list this as a MUST so we opt for
194 * code/ram savings
195 */
196#ifdef ROLL_TM_CONF_SHORT_SEEDS
197#define ROLL_TM_SHORT_SEEDS ROLL_TM_CONF_SHORT_SEEDS
198#else
199#define ROLL_TM_SHORT_SEEDS 0
200#endif
201/*---------------------------------------------------------------------------*/
202/**
203 * Destination address for our ICMPv6 advertisements. The draft gives us a
204 * choice between LL all-nodes or LL all-routers
205 *
206 * We use allrouters unless a conf directive chooses otherwise
207 */
208#ifdef ROLL_TM_CONF_DEST_ALL_NODES
209#define ROLL_TM_DEST_ALL_NODES ROLL_TM_CONF_DEST_ALL_NODES
210#else
211#define ROLL_TM_DEST_ALL_NODES 0
212#endif
213/*---------------------------------------------------------------------------*/
214/**
215 * M param for our outgoing messages
216 * By default, we set the M bit (conservative). Define this as 0 to clear the
217 * M bit in our outgoing messages (aggressive)
218 */
219#ifdef ROLL_TM_CONF_SET_M_BIT
220#define ROLL_TM_SET_M_BIT ROLL_TM_CONF_SET_M_BIT
221#else
222#define ROLL_TM_SET_M_BIT 1
223#endif
224/*---------------------------------------------------------------------------*/
225/* Stats datatype */
226/*---------------------------------------------------------------------------*/
227/**
228 * \brief Multicast stats extension for the ROLL TM engine
229 */
231 /** Number of received ICMP datagrams */
232 UIP_MCAST6_STATS_DATATYPE icmp_in;
233
234 /** Number of ICMP datagrams sent */
235 UIP_MCAST6_STATS_DATATYPE icmp_out;
236
237 /** Number of malformed ICMP datagrams seen by us */
238 UIP_MCAST6_STATS_DATATYPE icmp_bad;
239};
240/*---------------------------------------------------------------------------*/
241#endif /* ROLL_TM_H_ */
242/*---------------------------------------------------------------------------*/
243/** @} */
244/** @} */
Multicast stats extension for the ROLL TM engine.
Definition: roll-tm.h:230
UIP_MCAST6_STATS_DATATYPE icmp_in
Number of received ICMP datagrams.
Definition: roll-tm.h:232
UIP_MCAST6_STATS_DATATYPE icmp_out
Number of ICMP datagrams sent.
Definition: roll-tm.h:235
UIP_MCAST6_STATS_DATATYPE icmp_bad
Number of malformed ICMP datagrams seen by us.
Definition: roll-tm.h:238
Header file for IPv6 multicast forwarding stats maintenance.