Denislam Valeev / Mbed OS Nucleo_rtos_basic
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers thread_constants.h Source File

thread_constants.h

00001 /*
00002  * Copyright (c) 2016-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 #ifndef THREAD_CONSTANTS_H_
00031 #define THREAD_CONSTANTS_H_
00032 
00033 /**
00034  * Constants defined in Thread specifications
00035  */
00036 
00037 /**
00038  * Default management port assigned by IANA.
00039  * nick:MM
00040  */
00041 #define THREAD_MANAGEMENT_PORT 61631
00042 
00043 /**
00044  * Default joiner port. Joiner must learn this from Discovery response during network discovery.
00045  * nick:MJ
00046  */
00047 #define THREAD_DEFAULT_JOINER_PORT 49153
00048 
00049 /**
00050  * Default Commissioning port. This can be changed if this is not available and advertised in network discovery.
00051  * nick: MC
00052  */
00053 #define THREAD_COMMISSIONING_PORT 49191
00054 
00055 /**
00056  *  End device default timeout.
00057  */
00058 #define THREAD_END_DEVICE_DEFAULT_TIMEOUT 240
00059 
00060 /**
00061  *  COAP Status TLV values (TLV TYPE 4)
00062  */
00063 #define THREAD_COAP_STATUS_TLV_SUCCESS                  0
00064 #define THREAD_COAP_STATUS_TLV_NO_ADDRESS_AVAILABLE     1
00065 #define THREAD_COAP_STATUS_TLV_TOO_FEW_ROUTERS          2
00066 #define THREAD_COAP_STATUS_TLV_HAVE_CHILD_ID_REQUEST    3
00067 #define THREAD_COAP_STATUS_TLV_PARENT_PARTITION_CHANGE  4
00068 
00069 
00070 /**
00071  * Constants for Connectivity TLV (TLV TYPE 15)
00072  */
00073 #define THREAD_CONNECTIVITY_TLV_PARENT_PRIORITY_HIGH     1
00074 #define THREAD_CONNECTIVITY_TLV_PARENT_PRIORITY_MEDIUM   0
00075 #define THREAD_CONNECTIVITY_TLV_PARENT_PRIORITY_LOW      -1
00076 
00077 /**
00078  * per-SED IPv6 buffer sizes and datagram count specified in the Thread Conformance specification
00079  */
00080 #define THREAD_SED_BUFFER_MIN_SIZE          106
00081 #define THREAD_SED_DATAGRAM_MIN_COUNT       1
00082 
00083 
00084 /**
00085  * Thread TLV length
00086  */
00087 #define THREAD_HAS_ROUTE_TLV_LENGTH         3
00088 #define THREAD_BORDER_ROUTER_TLV_LENGTH     4
00089 #define THREAD_6LOWPAN_ID_TLV_LENGTH        2
00090 #define THREAD_IPV6_ADDRESS_TLV_LENGTH      16
00091 
00092 /**
00093  * Uris defined by thread specifications
00094  */
00095 #define THREAD_URI_NETWORK_DATA                 "a/sd"   //<* Leader
00096 #define THREAD_URI_NEIGHBOR_DISCOVERY_DATA_REQ  "a/nd"   //<* 1.1 feature
00097 
00098 #define THREAD_URI_ROUTER_ID_ASSIGNMENT         "a/as"   //<* Leader
00099 #define THREAD_URI_ROUTER_ID_RELEASE            "a/ar"   //<* Leader
00100 
00101 #define THREAD_URI_ADDRESS_QUERY_REQUEST        "a/aq"   //<* All Routers
00102 #define THREAD_URI_ADDRESS_NOTIFICATION         "a/an"   //<* All Routers
00103 #define THREAD_URI_ADDRESS_ERROR                "a/ae"   //<* All Nodes
00104 
00105 #define THREAD_URI_DIAGNOSTIC_RESET             "d/dr"   //<* All Nodes
00106 #define THREAD_URI_DIAGNOSTIC_REQUEST           "d/dg"   //<* All Nodes
00107 #define THREAD_URI_DIAGNOSTIC_QUERY             "d/dq"   //<* All Routers
00108 #define THREAD_URI_DIAGNOSTIC_ANSWER            "d/da"   //<* All Routers
00109 
00110 
00111 #define THREAD_URI_MANAGEMENT_GET               "c/mg"  //<* Leader
00112 #define THREAD_URI_MANAGEMENT_SET               "c/ms"  //<* Leader
00113 #define THREAD_URI_LEADER_PETITION              "c/lp"  //<* Leader
00114 #define THREAD_URI_LEADER_KEEP_ALIVE            "c/la"  //<* Leader
00115 
00116 #define THREAD_URI_RELAY_TRANSMIT               "c/tx"  //<* Joiner router
00117 #define THREAD_URI_RELAY_RECEIVE                "c/rx"  //<* Border router, native commissioner
00118 
00119 #define THREAD_URI_JOINER_ENTRUST               "c/je"  //<* Joiner
00120 #define THREAD_URI_JOINER_FINALIZATION          "c/jf"  //<* Commissioner, native commissioner
00121 #define THREAD_URI_JOINER_APPLICATION_REQUEST   "c/ja"  //<* Any thread device
00122 
00123 #define THREAD_URI_COMMISSIONER_PETITION        "c/cp"  //<* Border router
00124 #define THREAD_URI_COMMISSIONER_KEEP_ALIVE      "c/ca"  //<* Border router
00125 
00126 #define THREAD_URI_UDP_RECVEIVE_NOTIFICATION    "c/ur"  //<* Commissioner
00127 #define THREAD_URI_UDP_TRANSMIT_NOTIFICATION    "c/ut"  //<* Border router
00128 
00129 #define THREAD_URI_PANID_QUERY                  "c/pq"  //<* 1.1 feature
00130 #define THREAD_URI_PANID_CONFLICT               "c/pc"  //<* 1.1 feature
00131 #define THREAD_URI_ED_SCAN                      "c/es"  //<* 1.1 feature
00132 #define THREAD_URI_ED_REPORT                    "c/er"  //<* 1.1 feature
00133 #define THREAD_URI_MANAGEMENT_ANNOUNCE_NTF      "c/an"  //<* 1.1 feature
00134 #define THREAD_URI_MANAGEMENT_ANNOUNCE_BEGIN    "c/ab"  //<* 1.1 feature
00135 
00136 #define THREAD_URI_ACTIVE_GET                   "c/ag"  //<* 1.1 feature
00137 #define THREAD_URI_ACTIVE_SET                   "c/as"  //<* 1.1 feature
00138 #define THREAD_URI_PENDING_GET                  "c/pg"  //<* 1.1 feature
00139 #define THREAD_URI_PENDING_SET                  "c/ps"  //<* 1.1 feature
00140 #define THREAD_URI_COMMISSIONER_GET             "c/cg"  //<* 1.1 feature
00141 #define THREAD_URI_COMMISSIONER_SET             "c/cs"  //<* 1.1 feature
00142 #define THREAD_URI_DATASET_CHANGED              "c/dc"  //<* 1.1 feature
00143 
00144 #define THREAD_DEFAULT_COAP_RESOLUTION 1
00145 #define THREAD_DEFAULT_KEY_SWITCH_GUARD_TIME 624 // Hours
00146 #define THREAD_DEFAULT_KEY_ROTATION 672 // Hours
00147 #define THREAD_COMMISSIONER_KEEP_ALIVE_INTERVAL 50000    // Default thread commissioner keep-alive message interval (milliseconds)
00148 
00149 #define THREAD_FAILED_CHILD_TRANSMISSIONS 4
00150 #define THREAD_FAILED_ROUTER_TRANSMISSIONS 4
00151 #define THREAD_MAC_TRANSMISSIONS 4
00152 
00153 #define THREAD_MAX_NETWORK_DATA_SIZE 254
00154 
00155 // How many seconds a server MUST wait after a data update has been rejected by the Leader before resending the update
00156 #define THREAD_DATA_RESUBMIT_DELAY  300
00157 
00158 // The maximum length of Commissioning Data TLV (including type & length)
00159 //   - Commissioner Session ID, Border Agent Locator TLV, Steering Data TLV
00160 #define THREAD_MAX_COMM_DATA_TLV_LEN 28
00161 
00162 // Channel page 0 super frame duration is used to convert times from ms time to exponent value in MAC
00163 #define CHANNEL_PAGE_0_SUPERFRAME_DURATION  15.36
00164 
00165 #define THREAD_ENTERPRISE_NUMBER 44970
00166 
00167 #define THREAD_ADDR_REG_TIMEOUT_BASE 300
00168 #define THREAD_PROACTIVE_AN_INTERVAL 3600
00169 
00170 // Router defines
00171 #define ROUTER_SELECTION_JITTER 120
00172 #define REED_ADVERTISEMENT_INTERVAL 570
00173 #define REED_ADVERTISEMENT_MAX_JITTER 60
00174 #define MIN_DOWNGRADE_NEIGHBORS 7
00175 #define THREAD_REED_ADVERTISEMENT_DELAY 5000
00176 
00177 /** Default Threshold for router Selection */
00178 #define ROUTER_DOWNGRADE_THRESHOLD 23 // Define downGrade Threshold when active router is higher than this
00179 #define ROUTER_UPGRADE_THRESHOLD 16 // Define upgrade Threshold fort REED when Active Router Count is smaller than this upgrade is possible
00180 
00181 /** Thread prefix minimum lifetime in seconds */
00182 #define THREAD_MIN_PREFIX_LIFETIME  3600
00183 
00184 #endif /* THREAD_CONSTANTS_H_ */