Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers thread_config.h Source File

thread_config.h

00001 /*
00002  * Copyright (c) 2015-2018, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: BSD-3-Clause
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the copyright holder nor the
00014  *    names of its contributors may be used to endorse or promote products
00015  *    derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  */
00029 
00030 
00031 #ifndef THREAD_CONFIG_H_
00032 #define THREAD_CONFIG_H_
00033 
00034 /**
00035  * Thread stack configuration values. All constants that are specified in Thread specification can be found from thread_constants.h
00036  */
00037 
00038 #include "thread_constants.h"
00039 
00040 /**
00041  * Threshold for when the mac frame counter is stored to nvm.
00042  */
00043 #define MAC_FRAME_COUNTER_LIMIT 1000
00044 /**
00045  * Threshold for when the mle frame counter is stored to nvm.
00046  */
00047 #define MLE_FRAME_COUNTER_LIMIT 100
00048 
00049 /**
00050  * Organisational Unique Identifier for ARM.
00051  */
00052 #define THREAD_ARM_OUI 0x0002f7
00053 
00054 /**
00055  * Build number value of 12 bit.
00056  */
00057 #define THREAD_BUILD_NUMBER 100
00058 
00059 /**
00060  * Stack revision number 4 bit.
00061  */
00062 #define THREAD_REVISION_NUMBER 100
00063 
00064 /**
00065  * Stack Major version number 4 bit.
00066  */
00067 #define THREAD_VERSION_MAJ 1
00068 
00069 /**
00070  * Stack Minor version number 4 bit.
00071  */
00072 #define THREAD_VERSION_MIN 0
00073 
00074 /**
00075  * Default vendor name.
00076  */
00077 #define THREAD_VENDOR_NAME "ARM ltd"
00078 
00079 /**
00080  * Default vendor model.
00081  */
00082 #define THREAD_VENDOR_MODEL "MbedOS"
00083 
00084 /**
00085  * Default SW Version.
00086  */
00087 #define THREAD_SW_VERSION "1.1"
00088 
00089 /**
00090  * Protocol ID in beacon for thread network discovery.
00091  */
00092 #define THREAD_PROTOCOL_ID  3
00093 
00094 /**
00095  * Protocol version present in version tlvs and in beacons
00096  */
00097 #define THREAD_PROTOCOL_VERSION 2
00098 
00099 /**
00100  * Default Maximum child count.
00101  */
00102 #define THREAD_MAX_CHILD_COUNT 26
00103 
00104 /**
00105  * Default Maximum child id count for router parent.
00106  */
00107 #define THREAD_MAX_CHILD_ID_COUNT 511
00108 
00109 /**
00110  *  Default Link lifetime for Router and Host.
00111  */
00112 #define THREAD_DEFAULT_LINK_LIFETIME 100
00113 
00114 /**
00115  * Default network instance weighting (average).
00116  */
00117 #define THREAD_DEFAULT_WEIGHTING 64
00118 
00119 /**
00120  * Context re use timer in 48 hours in seconds
00121  */
00122 #define THREAD_CONTEXT_ID_REUSE_TIMEOUT (48 * 3600)
00123 
00124 /**
00125  * Timeout for Leader to set commissioner session to obsolete.
00126  */
00127 #define COMMISSIONER_OBSOLETE_TIMEOUT (THREAD_COMMISSIONER_KEEP_ALIVE_INTERVAL)
00128 
00129 /**
00130  * Timeout for Leader to remove commissioner session.
00131  * This is a delay before commissioner is removed after Thread defined keep alive value.
00132  */
00133 #define COMMISSIONER_REMOVE_TIMEOUT (1000)
00134 
00135 /**
00136  * Router selection jitter
00137  * default 120
00138  */
00139 #define THREAD_ROUTER_SELECTION_JITTER 120
00140 
00141 /**
00142  * Maximum parallel Link requests
00143  * default 4
00144  */
00145 #define THREAD_MAX_PARALLEL_MLE_LINK_REQUEST 4
00146 
00147 /**
00148  * Number of free MLE entries for parent priority adjustment
00149  * default 4
00150  */
00151 #define THREAD_FREE_MLE_ENTRY_THRESHOLD 4
00152 
00153 /**
00154  * Maximum parallel Parent Requests
00155  * default 8
00156  */
00157 #define THREAD_MAX_PARALLEL_MLE_PARENT_REQUEST 8
00158 
00159 /**
00160  * Minimum pending delay for commissioner
00161  * default 30
00162  */
00163 #define THREAD_DELAY_TIMER_MINIMAL_SECONDS (30)
00164 
00165 /**
00166  * Minimum pending delay for end device
00167  * default 1800
00168  */
00169 
00170 #define THREAD_DELAY_TIMER_DEFAULT_SECONDS (300)
00171 
00172 /**
00173  * Minimum pending delay for end device
00174  * default 1800
00175  */
00176 #define THREAD_MIN_DELAY_TIMER_THREAD_DEVICE_MASTER_KEY_CHANGE_SECONDS (1800)
00177 
00178 /**
00179  * Maximum pending delay timer in seconds
00180  */
00181 #define THREAD_MAX_DELAY_TIMER_SECONDS (72 * 3600)
00182 
00183 /**
00184  * Maximum neighbor links for reeds and end devices
00185  */
00186 #define THREAD_REED_AND_END_DEVICE_NEIGHBOR_LINKS 5
00187 
00188 /**
00189  * Maximum data size of commissioner data set parameter - Border agent locator, Commissioner session id and Steering data TLVs are
00190  * minimum required TLVs at this point
00191  */
00192 #define THREAD_MAX_COMMISSIONER_DATA_SIZE 50
00193 
00194 /**
00195  * Trace group for THCI traces
00196  */
00197 #define THCI_TRACE_GROUP "THCI"
00198 
00199 #define THREAD_MAX_FRAME_RETRIES 3
00200 
00201 /**
00202  * Thread discovery timeout for discovery response
00203  */
00204 
00205 #define THREAD_DISCOVERY_TIMEOUT 300
00206 
00207 #define THREAD_DISCOVERY_MAX_JITTER 250
00208 
00209 /**
00210  *  Interval between increments of ID sequence number by the Leader.
00211  */
00212 #define ID_SEQUENCE_PERIOD 10 /* 10 second */
00213 
00214 /**
00215  *  Delay before new network data is being updated after update (seconds).
00216  */
00217 #define THREAD_COMMISSION_DATA_UPDATE_DELAY 1
00218 
00219 /**
00220  * SED configuration (used in Connectivity TLV).
00221  * -Buffer capacity in octets for all IPv6 datagrams destined to a given SED
00222  * -Queue capacity in IPv6 datagrams destined to a given SED
00223  */
00224 #define THREAD_SED_BUFFER_SIZE     THREAD_SED_BUFFER_MIN_SIZE
00225 #define THREAD_SED_DATAGRAM_COUNT  THREAD_SED_DATAGRAM_MIN_COUNT
00226 
00227 #define THREAD_DISCOVERY_SECURITY_KEY_INDEX 0xff
00228 #define THREAD_DISCOVERY_SECURITY_KEY_SOURCE 0xffffffff
00229 
00230 /**
00231  * The threshold value that must be exceed by a packet to be
00232  * considered big. Thread conformance document specifies the
00233  * threshold as 106.
00234  */
00235 #define THREAD_INDIRECT_BIG_PACKET_THRESHOLD 106
00236 
00237 /**
00238  * Thread conformance document says: "A Thread Router MUST be able
00239  * to buffer at least one (1) 1280-octet IPv6 datagram destined for
00240  * an attached SED" and "A Thread Router MUST be able to buffer at
00241  * least one (1) 106-octet IPv6 datagram per attached SED".
00242  *
00243  * The defines below tell how many small (i.e. up to the big packet
00244  * threshold) packets per sleepy child and big (i.e. over the big
00245  * packet threshold) packets total we buffer in the indirect TX
00246  * queue. The minimum values are 1 for both, but here we use larger
00247  * value for better performance.
00248  */
00249 #define THREAD_INDIRECT_BIG_PACKETS_TOTAL 10
00250 #define THREAD_INDIRECT_SMALL_PACKETS_PER_CHILD 3
00251 
00252 /**
00253  * Maximum number of MTD children, default 16
00254  * Thread conformance minimum is 10
00255  */
00256 #define THREAD_MAX_MTD_CHILDREN 16
00257 
00258 /**
00259  * Maximum number of sleepy children, default 10
00260  * Thread conformance minimum is 6
00261  */
00262 #define THREAD_MAX_SED_CHILDREN 10
00263 
00264 /**
00265  * Base value for blacklist interval value
00266  */
00267 #define THREAD_BLACKLIST_TIMER_TIMEOUT 4
00268 
00269 /**
00270  * Maximum value for blacklist interval value
00271  */
00272 #define THREAD_BLACKLIST_TIMER_MAX_TIMEOUT 500
00273 
00274 /**
00275  * Base value for blacklist entry lifetime
00276  */
00277 #define THREAD_BLACKLIST_ENTRY_LIFETIME 8
00278 
00279 /**
00280  * Maximum number of entries in the blacklist table
00281  */
00282 #define THREAD_BLACKLIST_ENTRY_MAX_NBR 15
00283 
00284 /**
00285  * Number of extra entries to purge from the blacklist table
00286  */
00287 #define THREAD_BLACKLIST_PURGE_NBR 3
00288 
00289 /**
00290  * Timeout value for purging extra blacklist entries
00291  */
00292 #define THREAD_BLACKLIST_PURGE_TIMER_TIMEOUT 6
00293 
00294 /**
00295  * Base value for commission blacklist interval value
00296  */
00297 #define THREAD_COMM_BLACKLIST_TIMER_TIMEOUT 60
00298 
00299 /**
00300  * Maximum value for commission blacklist interval value
00301  */
00302 #define THREAD_COMM_BLACKLIST_TIMER_MAX_TIMEOUT 600
00303 
00304 /**
00305  * Base value for commission blacklist entry lifetime
00306  */
00307 #define THREAD_COMM_BLACKLIST_ENTRY_LIFETIME 600
00308 
00309 /**
00310  * Delay value for sending proactive address notification after router upgrade
00311  */
00312 #define THREAD_PROACTIVE_AN_SEND_DELAY 2
00313 
00314 /*
00315  * Parent response wait time (in 100ms) when "R" bit is set in scan mask TLV (rounded up from  0.75 seconds)
00316  */
00317 #define THREAD_PARENT_REQ_SCANMASK_R_TIMEOUT 9
00318 
00319 /*
00320  * Parent response wait time (in 100ms) when both "R" and "E" bit is set in scan mask TLV (rounded up from 1.25 seconds)
00321  */
00322 #define THREAD_PARENT_REQ_SCANMASK_RE_TIMEOUT 15
00323 
00324 /*
00325  * When BBR is started, router address is requested from leader with following status
00326  */
00327 #define THREAD_BBR_ROUTER_ID_REQUEST_STATUS THREAD_COAP_STATUS_TLV_HAVE_CHILD_ID_REQUEST
00328 
00329 /* Border Router IPv6 neighbour and destination cache configuration
00330  * Number of neighbor cache entries assuming 250 thread devices (worst case) connecting to cloud service.
00331  * Six entries reserved for backbone devices.
00332  */
00333 #define THREAD_BBR_IPV6_NEIGHBOUR_CACHE_SIZE                256
00334 #define THREAD_BBR_IPV6_NEIGHBOUR_CACHE_SHORT_TERM          128
00335 #define THREAD_BBR_IPV6_NEIGHBOUR_CACHE_LONG_TERM           32
00336 #define THREAD_BBR_IPV6_NEIGHBOUR_CACHE_LIFETIME            600
00337 
00338 /* Router IPv6 neighbour and destination cache configuration */
00339 #define THREAD_ROUTER_IPV6_NEIGHBOUR_CACHE_SIZE             128
00340 #define THREAD_ROUTER_IPV6_NEIGHBOUR_CACHE_SHORT_TERM       64
00341 #define THREAD_ROUTER_IPV6_NEIGHBOUR_CACHE_LONG_TERM        8
00342 #define THREAD_ROUTER_IPV6_NEIGHBOUR_CACHE_LIFETIME         600
00343 #define THREAD_ROUTER_IPV6_DESTINATION_CACHE_SIZE           32
00344 #define THREAD_ROUTER_IPV6_DESTINATION_CACHE_SHORT_TERM     16
00345 #define THREAD_ROUTER_IPV6_DESTINATION_CACHE_LONG_TERM      4
00346 #define THREAD_ROUTER_IPV6_DESTINATION_CACHE_LIFETIME       600
00347 
00348 /* End device IPv6 neighbour and destination cache configuration */
00349 #define THREAD_END_DEVICE_IPV6_NEIGHBOUR_CACHE_SIZE         32
00350 #define THREAD_END_DEVICE_IPV6_NEIGHBOUR_CACHE_SHORT_TERM   16
00351 #define THREAD_END_DEVICE_IPV6_NEIGHBOUR_CACHE_LONG_TERM    4
00352 #define THREAD_END_DEVICE_IPV6_NEIGHBOUR_CACHE_LIFETIME     600
00353 #define THREAD_END_DEVICE_IPV6_DESTINATION_CACHE_SIZE       16
00354 #define THREAD_END_DEVICE_IPV6_DESTINATION_CACHE_SHORT_TERM 8
00355 #define THREAD_END_DEVICE_IPV6_DESTINATION_CACHE_LONG_TERM  4
00356 #define THREAD_END_DEVICE_IPV6_DESTINATION_CACHE_LIFETIME   600
00357 
00358 /*
00359  * Timeout to solicit address from DHCP if previous request fails.
00360  */
00361 #define THREAD_MAINTENANCE_TIMER_INTERVAL 300
00362 
00363 /**
00364  * Build time flag to enable THCI special traces for test harness purposes
00365  */
00366 #ifdef THREAD_THCI_SUPPORT
00367 #define thci_trace(...) mbed_tracef(TRACE_LEVEL_INFO, THCI_TRACE_GROUP, __VA_ARGS__ );
00368 #else
00369 #define thci_trace(...)
00370 #endif
00371 
00372 #endif /* THREAD_CONFIG_H_ */