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 #ifdef ORCHESTRA_CONF_LINKADDR_HASH
86 #define ORCHESTRA_LINKADDR_HASH ORCHESTRA_CONF_LINKADDR_HASH
87 #else /* ORCHESTRA_CONF_LINKADDR_HASH */
88 #define ORCHESTRA_LINKADDR_HASH(addr) ((addr != NULL) ? (addr)->u8[LINKADDR_SIZE - 1] : -1)
89 #endif /* ORCHESTRA_CONF_LINKADDR_HASH */
90 
91 /* The maximum hash */
92 #ifdef ORCHESTRA_CONF_MAX_HASH
93 #define ORCHESTRA_MAX_HASH ORCHESTRA_CONF_MAX_HASH
94 #else /* ORCHESTRA_CONF_MAX_HASH */
95 #define ORCHESTRA_MAX_HASH 0x7fff
96 #endif /* ORCHESTRA_CONF_MAX_HASH */
97 
98 /* Is the "hash" function collision-free? (e.g. it maps to unique node-ids) */
99 #ifdef ORCHESTRA_CONF_COLLISION_FREE_HASH
100 #define ORCHESTRA_COLLISION_FREE_HASH ORCHESTRA_CONF_COLLISION_FREE_HASH
101 #else /* ORCHESTRA_CONF_COLLISION_FREE_HASH */
102 #define ORCHESTRA_COLLISION_FREE_HASH 0 /* Set to 1 if ORCHESTRA_LINKADDR_HASH returns unique hashes */
103 #endif /* ORCHESTRA_CONF_COLLISION_FREE_HASH */
104 
105 #endif /* __ORCHESTRA_CONF_H__ */