Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers thread_config.h Source File

thread_config.h

00001 /*
00002  * Copyright (c) 2015-2017, 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 #include "thread_constants.h"
00035 
00036 /**
00037  * Threshold for when the mac frame counter is stored to nvm.
00038  */
00039 #define MAC_FRAME_COUNTER_LIMIT 1000
00040 /**
00041  * Threshold for when the mle frame counter is stored to nvm.
00042  */
00043 #define MLE_FRAME_COUNTER_LIMIT 100
00044 
00045 /**
00046  * Organisational Unique Identifier for ARM.
00047  */
00048 #define THREAD_ARM_OUI 0x0002f7
00049 
00050 /**
00051  * Build number value of 12 bit.
00052  */
00053 #define THREAD_BUILD_NUMBER 100
00054 
00055 /**
00056  * Stack revision number 4 bit.
00057  */
00058 #define THREAD_REVISION_NUMBER 100
00059 
00060 /**
00061  * Stack Major version number 4 bit.
00062  */
00063 #define THREAD_VERSION_MAJ 1
00064 
00065 /**
00066  * Stack Minor version number 4 bit.
00067  */
00068 #define THREAD_VERSION_MIN 0
00069 
00070 /**
00071  * Default vendor name.
00072  */
00073 #define THREAD_VENDOR_NAME "ARM ltd"
00074 
00075 /**
00076  * Default vendor model.
00077  */
00078 #define THREAD_VENDOR_MODEL "MbedOS"
00079 
00080 /**
00081  * Default SW Version.
00082  */
00083 #define THREAD_SW_VERSION "1.1"
00084 
00085 /**
00086  * Protocol ID in beacon for thread network discovery.
00087  */
00088 #define THREAD_PROTOCOL_ID  3
00089 
00090 /**
00091  * Protocol version present in version tlvs and in beacons
00092  */
00093 #define THREAD_PROTOCOL_VERSION 2
00094 
00095 /**
00096  * Default Maximum child count.
00097  */
00098 #define THREAD_MAX_CHILD_COUNT 26
00099 
00100 /**
00101  * Default Maximum child id count for router parent.
00102  */
00103 #define THREAD_MAX_CHILD_ID_COUNT 511
00104 
00105 /**
00106  *  Default Link lifetime for Router and Host.
00107  */
00108 #define THREAD_DEFAULT_LINK_LIFETIME 100
00109 
00110 /**
00111  * Default network instance weighting (average).
00112  */
00113 #define THREAD_DEFAULT_WEIGHTING 64
00114 
00115 /**
00116  * Context re use timer in 48 hours in seconds
00117  */
00118 #define THREAD_CONTEXT_ID_REUSE_TIMEOUT (48 * 3600)
00119 
00120 /**
00121  * Timeout for Leader to set commissioner session to obsolete.
00122  */
00123 #define COMMISSIONER_OBSOLETE_TIMEOUT (THREAD_COMMISSIONER_KEEP_ALIVE_INTERVAL)
00124 
00125 /**
00126  * Timeout for Leader to remove commissioner session.
00127  * This is a delay before commissioner is removed after Thread defined keep alive value.
00128  */
00129 #define COMMISSIONER_REMOVE_TIMEOUT (1000)
00130 
00131 /**
00132  * Router selection jitter
00133  * default 120
00134  */
00135 #define THREAD_ROUTER_SELECTION_JITTER 120
00136 
00137 /**
00138  * Maximum parallel Link requests
00139  * default 4
00140  */
00141 #define THREAD_MAX_PARALLEL_MLE_LINK_REQUEST 4
00142 
00143 /**
00144  * Number of free MLE entries for parent priority adjustment
00145  * default 4
00146  */
00147 #define THREAD_FREE_MLE_ENTRY_THRESHOLD 4
00148 
00149 /**
00150  * Maximum parallel Parent Requests
00151  * default 8
00152  */
00153 #define THREAD_MAX_PARALLEL_MLE_PARENT_REQUEST 8
00154 
00155 /**
00156  * Minimum pending delay for commissioner
00157  * default 30
00158  */
00159 #define THREAD_DELAY_TIMER_MINIMAL_SECONDS (30)
00160 
00161 /**
00162  * Minimum pending delay for end device
00163  * default 1800
00164  */
00165 
00166 #define THREAD_DELAY_TIMER_DEFAULT_SECONDS (300)
00167 
00168 /**
00169  * Minimum pending delay for end device
00170  * default 1800
00171  */
00172 #define THREAD_MIN_DELAY_TIMER_THREAD_DEVICE_MASTER_KEY_CHANGE_SECONDS (1800)
00173 
00174 /**
00175  * Maximum pending delay timer in seconds
00176  */
00177 #define THREAD_MAX_DELAY_TIMER_SECONDS (72 * 3600)
00178 
00179 /**
00180  * Maximum neighbor links for reeds and end devices
00181  */
00182 #define THREAD_REED_AND_END_DEVICE_NEIGHBOR_LINKS 5
00183 
00184 /**
00185  * Maximum data size of commissioner data set parameter - Border agent locator, Commissioner session id and Steering data TLVs are
00186  * minimum required TLVs at this point
00187  */
00188 #define THREAD_MAX_COMMISSIONER_DATA_SIZE 50
00189 
00190 /**
00191  * Trace group for THCI traces
00192  */
00193 #define THCI_TRACE_GROUP "THCI"
00194 
00195 #define THREAD_MAX_FRAME_RETRIES 3
00196 
00197 /**
00198  * Thread discovery timeout for discovery response
00199  */
00200 
00201 #define THREAD_DISCOVERY_TIMEOUT 300
00202 
00203 #define THREAD_DISCOVERY_MAX_JITTER 250
00204 
00205 /**
00206  *  Interval between increments of ID sequence number by the Leader.
00207  */
00208 #define ID_SEQUENCE_PERIOD 10 /* 10 second */
00209 
00210 /**
00211  *  Delay before new network data is being updated after update (seconds).
00212  */
00213 #define THREAD_COMMISSION_DATA_UPDATE_DELAY 1
00214 
00215 /**
00216  * SED configuration (used in Connectivity TLV).
00217  * -Buffer capacity in octets for all IPv6 datagrams destined to a given SED
00218  * -Queue capacity in IPv6 datagrams destined to a given SED
00219  */
00220 #define THREAD_SED_BUFFER_SIZE     THREAD_SED_BUFFER_MIN_SIZE
00221 #define THREAD_SED_DATAGRAM_COUNT  THREAD_SED_DATAGRAM_MIN_COUNT
00222 
00223 #define THREAD_DISCOVERY_SECURITY_KEY_INDEX 0xff
00224 #define THREAD_DISCOVERY_SECURITY_KEY_SOURCE 0xffffffff
00225 
00226 /**
00227  * The threshold value that must be exceed by a packet to be
00228  * considered big. Thread conformance document specifies the
00229  * threshold as 106.
00230  */
00231 #define THREAD_INDIRECT_BIG_PACKET_THRESHOLD 106
00232 
00233 /**
00234  * Thread conformance document says: "A Thread Router MUST be able
00235  * to buffer at least one (1) 1280-octet IPv6 datagram destined for
00236  * an attached SED" and "A Thread Router MUST be able to buffer at
00237  * least one (1) 106-octet IPv6 datagram per attached SED".
00238  *
00239  * The defines below tell how many small (i.e. up to the big packet
00240  * threshold) packets per sleepy child and big (i.e. over the big 
00241  * packet threshold) packets total we buffer in the indirect TX 
00242  * queue. The minimum values are 1 for both, but here we use larger
00243  * value for better performance.
00244  */
00245 #define THREAD_INDIRECT_BIG_PACKETS_TOTAL 10
00246 #define THREAD_INDIRECT_SMALL_PACKETS_PER_CHILD 2
00247 
00248 /**
00249  * Maximum number of MTD children, default 16
00250  * Thread conformance minimum is 10
00251  */
00252 #define THREAD_MAX_MTD_CHILDREN 16
00253 
00254 /**
00255  * Maximum number of sleepy children, default 10
00256  * Thread conformance minimum is 6
00257  */
00258 #define THREAD_MAX_SED_CHILDREN 10
00259 
00260 /**
00261  * Base value for blacklist interval value
00262  */
00263 #define THREAD_BLACKLIST_TIMER_TIMEOUT 4
00264 
00265 /**
00266  * Maximum value for blacklist interval value
00267  */
00268 #define THREAD_BLACKLIST_TIMER_MAX_TIMEOUT 500
00269 
00270 /**
00271  * Base value for blacklist entry lifetime
00272  */
00273 #define THREAD_BLACKLIST_ENTRY_LIFETIME 8
00274 
00275 /**
00276  * Maximum number of entries in the blacklist table
00277  */
00278 #define THREAD_BLACKLIST_ENTRY_MAX_NBR 15
00279 
00280 /**
00281  * Number of extra entries to purge from the blacklist table
00282  */
00283 #define THREAD_BLACKLIST_PURGE_NBR 3
00284 
00285 /**
00286  * Timeout value for purging extra blacklist entries
00287  */
00288 #define THREAD_BLACKLIST_PURGE_TIMER_TIMEOUT 6
00289 
00290 /**
00291  * Base value for commission blacklist interval value
00292  */
00293 #define THREAD_COMM_BLACKLIST_TIMER_TIMEOUT 60
00294 
00295 /**
00296  * Maximum value for commission blacklist interval value
00297  */
00298 #define THREAD_COMM_BLACKLIST_TIMER_MAX_TIMEOUT 600
00299 
00300 /**
00301  * Base value for commission blacklist entry lifetime
00302  */
00303 #define THREAD_COMM_BLACKLIST_ENTRY_LIFETIME 600
00304 
00305 /**
00306  * Delay value for sending proactive address notification after router upgrade
00307  */
00308 #define THREAD_PROACTIVE_AN_SEND_DELAY 2
00309 
00310 /**
00311  * Build time flag to enable THCI special traces for test harness purposes
00312  */
00313 #ifdef THREAD_THCI_SUPPORT
00314 #define thci_trace(...) mbed_tracef(TRACE_LEVEL_INFO, THCI_TRACE_GROUP, __VA_ARGS__ );
00315 #else
00316 #define thci_trace(...)
00317 #endif
00318 
00319 #endif /* THREAD_CONFIG_H_ */