Contiki-NG
orchestra-conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, 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 /**
32  * \file
33  * Orchestra configuration
34  *
35  * \author Simon Duquennoy <simonduq@sics.se>
36  */
37 
38 #ifndef __ORCHESTRA_CONF_H__
39 #define __ORCHESTRA_CONF_H__
40 
41 #ifdef ORCHESTRA_CONF_RULES
42 #define ORCHESTRA_RULES ORCHESTRA_CONF_RULES
43 #else /* ORCHESTRA_CONF_RULES */
44 /* A default configuration with:
45  * - a sender-based slotframe for EB transmission
46  * - a sender-based or receiver-based slotframe for unicast to RPL parents and children
47  * - a common shared slotframe for any other traffic (mostly broadcast)
48  * */
49 #define ORCHESTRA_RULES { &eb_per_time_source, &unicast_per_neighbor_rpl_ns, &default_common }
50 /* Example configuration for RPL non-storing mode: */
51 /* #define ORCHESTRA_RULES { &eb_per_time_source, &unicast_per_neighbor_rpl_ns, &default_common } */
52 
53 #endif /* ORCHESTRA_CONF_RULES */
54 
55 /* Length of the various slotframes. Tune to balance network capacity,
56  * contention, energy, latency. */
57 #ifdef ORCHESTRA_CONF_EBSF_PERIOD
58 #define ORCHESTRA_EBSF_PERIOD ORCHESTRA_CONF_EBSF_PERIOD
59 #else /* ORCHESTRA_CONF_EBSF_PERIOD */
60 #define ORCHESTRA_EBSF_PERIOD 397
61 #endif /* ORCHESTRA_CONF_EBSF_PERIOD */
62 
63 #ifdef ORCHESTRA_CONF_COMMON_SHARED_PERIOD
64 #define ORCHESTRA_COMMON_SHARED_PERIOD ORCHESTRA_CONF_COMMON_SHARED_PERIOD
65 #else /* ORCHESTRA_CONF_COMMON_SHARED_PERIOD */
66 #define ORCHESTRA_COMMON_SHARED_PERIOD 31
67 #endif /* ORCHESTRA_CONF_COMMON_SHARED_PERIOD */
68 
69 #ifdef ORCHESTRA_CONF_UNICAST_PERIOD
70 #define ORCHESTRA_UNICAST_PERIOD ORCHESTRA_CONF_UNICAST_PERIOD
71 #else /* ORCHESTRA_CONF_UNICAST_PERIOD */
72 #define ORCHESTRA_UNICAST_PERIOD 17
73 #endif /* ORCHESTRA_CONF_UNICAST_PERIOD */
74 
75 /* Is the per-neighbor unicast slotframe sender-based (if not, it is receiver-based).
76  * Note: sender-based works only with RPL storing mode as it relies on DAO and
77  * routing entries to keep track of children and parents. */
78 #ifdef ORCHESTRA_CONF_UNICAST_SENDER_BASED
79 #define ORCHESTRA_UNICAST_SENDER_BASED ORCHESTRA_CONF_UNICAST_SENDER_BASED
80 #else /* ORCHESTRA_CONF_UNICAST_SENDER_BASED */
81 #define ORCHESTRA_UNICAST_SENDER_BASED 0
82 #endif /* ORCHESTRA_CONF_UNICAST_SENDER_BASED */
83 
84 /* The hash function used to assign timeslot to a given node (based on its link-layer address).
85  * For rules with multiple channel offsets, it is also used to select the channel offset. */
86 #ifdef ORCHESTRA_CONF_LINKADDR_HASH
87 #define ORCHESTRA_LINKADDR_HASH ORCHESTRA_CONF_LINKADDR_HASH
88 #else /* ORCHESTRA_CONF_LINKADDR_HASH */
89 #define ORCHESTRA_LINKADDR_HASH(addr) ((addr != NULL) ? (addr)->u8[LINKADDR_SIZE - 1] : -1)
90 #endif /* ORCHESTRA_CONF_LINKADDR_HASH */
91 
92 /* The maximum hash */
93 #ifdef ORCHESTRA_CONF_MAX_HASH
94 #define ORCHESTRA_MAX_HASH ORCHESTRA_CONF_MAX_HASH
95 #else /* ORCHESTRA_CONF_MAX_HASH */
96 #define ORCHESTRA_MAX_HASH 0x7fff
97 #endif /* ORCHESTRA_CONF_MAX_HASH */
98 
99 /* Is the "hash" function collision-free? (e.g. it maps to unique node-ids) */
100 #ifdef ORCHESTRA_CONF_COLLISION_FREE_HASH
101 #define ORCHESTRA_COLLISION_FREE_HASH ORCHESTRA_CONF_COLLISION_FREE_HASH
102 #else /* ORCHESTRA_CONF_COLLISION_FREE_HASH */
103 #define ORCHESTRA_COLLISION_FREE_HASH 0 /* Set to 1 if ORCHESTRA_LINKADDR_HASH returns unique hashes */
104 #endif /* ORCHESTRA_CONF_COLLISION_FREE_HASH */
105 
106 /* Channel offset for the EB rule, default 0 */
107 #ifdef ORCHESTRA_CONF_EB_CHANNEL_OFFSET
108 #define ORCHESTRA_EB_CHANNEL_OFFSET ORCHESTRA_CONF_EB_CHANNEL_OFFSET
109 #else
110 #define ORCHESTRA_EB_CHANNEL_OFFSET 0
111 #endif
112 
113 /* Channel offset for the default common rule, default 1 */
114 #ifdef ORCHESTRA_CONF_DEFAULT_COMMON_CHANNEL_OFFSET
115 #define ORCHESTRA_DEFAULT_COMMON_CHANNEL_OFFSET ORCHESTRA_CONF_DEFAULT_COMMON_CHANNEL_OFFSET
116 #else
117 #define ORCHESTRA_DEFAULT_COMMON_CHANNEL_OFFSET 1
118 #endif
119 
120 /* Min channel offset for the unicast rules; the default min/max range is [2, 255] */
121 #ifdef ORCHESTRA_CONF_UNICAST_MIN_CHANNEL_OFFSET
122 #define ORCHESTRA_UNICAST_MIN_CHANNEL_OFFSET ORCHESTRA_CONF_UNICAST_MIN_CHANNEL_OFFSET
123 #else
124 #define ORCHESTRA_UNICAST_MIN_CHANNEL_OFFSET 2
125 #endif
126 
127 /* Max channel offset for the unicast rules */
128 #ifdef ORCHESTRA_CONF_UNICAST_MAX_CHANNEL_OFFSET
129 #define ORCHESTRA_UNICAST_MAX_CHANNEL_OFFSET ORCHESTRA_CONF_UNICAST_MAX_CHANNEL_OFFSET
130 #else
131 #define ORCHESTRA_UNICAST_MAX_CHANNEL_OFFSET 255
132 #endif
133 
134 #endif /* __ORCHESTRA_CONF_H__ */