1 /* 2 * Copyright (c) 2019, The OpenThread Authors. 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 are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 3. Neither the name of the copyright holder nor the 13 * names of its contributors may be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /** 30 * @file 31 * This file includes compile-time configurations for the MLE service. 32 * 33 */ 34 35 #ifndef CONFIG_MLE_H_ 36 #define CONFIG_MLE_H_ 37 38 /** 39 * @def OPENTHREAD_CONFIG_MLE_MAX_ROUTERS 40 * 41 * The maximum number of routers in a Thread network. 42 * 43 * @note Thread specifies this value to be 32. Changing this value may cause interoperability issues with standard 44 * Thread 1.1 devices. 45 * 46 */ 47 #ifndef OPENTHREAD_CONFIG_MLE_MAX_ROUTERS 48 #define OPENTHREAD_CONFIG_MLE_MAX_ROUTERS 32 49 #endif 50 51 /** 52 * @def OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 53 * 54 * The maximum number of children. 55 * 56 */ 57 #ifndef OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 58 #define OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 10 59 #endif 60 61 /** 62 * @def OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT 63 * 64 * The default child timeout value (in seconds). 65 * 66 */ 67 #ifndef OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT 68 #define OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT 240 69 #endif 70 71 /** 72 * @def OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 73 * 74 * The maximum number of supported IPv6 address registrations per child. 75 * 76 */ 77 #ifndef OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 78 #define OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 4 79 #endif 80 81 /** 82 * @def OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER 83 * 84 * The maximum number of IPv6 address registrations for MTD. 85 * 86 */ 87 #ifndef OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER 88 #define OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER (OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD) 89 #endif 90 91 /** 92 * @def OPENTHREAD_CONFIG_MLE_DEFAULT_LEADER_WEIGHT_ADJUSTMENT 93 * 94 * Specifies the default value for `mLeaderWeightAdjustment` in `otDeviceProperties`. MUST be from -16 up to +16. 95 * 96 * This value is used to adjust the calculated Leader Weight from `otDeviceProperties`. 97 * 98 */ 99 #ifndef OPENTHREAD_CONFIG_MLE_DEFAULT_LEADER_WEIGHT_ADJUSTMENT 100 #define OPENTHREAD_CONFIG_MLE_DEFAULT_LEADER_WEIGHT_ADJUSTMENT 0 101 #endif 102 103 /** 104 * @def OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 105 * 106 * Enable setting steering data out of band. 107 * 108 */ 109 #ifndef OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 110 #define OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 0 111 #endif 112 113 /** 114 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 115 * 116 * Define as 1 to enable attach backoff feature 117 * 118 * When this feature is enabled, an exponentially increasing backoff wait time is added between attach attempts. 119 * If device is sleepy, the radio will be put to sleep during the wait time. This ensures that a battery-powered sleepy 120 * end-device does not drain its battery by continuously searching for a parent to attach to (when there is no 121 * router/parent for it to attach). 122 * 123 * The backoff time starts from a minimum interval specified by 124 * `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL`, and every attach attempt the wait time is doubled up to 125 * `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL` which specifies the maximum wait time. 126 * 127 * Once the wait time reaches the maximum, a random jitter interval is added to it. The maximum value for jitter is 128 * specified by `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL`. The random jitter is selected uniformly within 129 * range `[-JITTER, +JITTER]`. It is only added when the backoff wait interval is at maximum value. 130 * 131 */ 132 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 133 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 1 134 #endif 135 136 /** 137 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 138 * 139 * Specifies the minimum backoff wait interval (in milliseconds) used by attach backoff feature. 140 * 141 * Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`). 142 * 143 * Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details. 144 * 145 */ 146 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 147 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 251 148 #endif 149 150 /** 151 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 152 * 153 * Specifies the maximum backoff wait interval (in milliseconds) used by attach backoff feature. 154 * 155 * Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`). 156 * 157 * Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details. 158 * 159 */ 160 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 161 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 1200000 // 1200 seconds = 20 minutes 162 #endif 163 164 /** 165 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 166 * 167 * Specifies the maximum jitter interval (in milliseconds) used by attach backoff feature. 168 * 169 * Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`). 170 * 171 * Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details. 172 * 173 */ 174 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 175 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 2000 176 #endif 177 178 /** 179 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 180 * 181 * Specifies the delay wait interval (in milliseconds) used by attach backoff feature after a successful attach before 182 * it resets the current backoff interval back to the minimum value. 183 * 184 * If it is set to zero then the device resets its backoff attach interval immediately after a successful attach. With 185 * a non-zero value, if after a successful attach, the device happens to detach within the delay interval, the reattach 186 * process resumes with the previous backoff interval (as if the attach did not happen). 187 * 188 * This behavior is helpful in the situation where a battery-powered device has poor link quality to its parent and 189 * therefore attaches and detaches frequently from the parent. Using a non-zero wait interval ensures that the attach 190 * backoff interval does not reset on each attach and that the device does not drain its battery quickly trying to 191 * re-attach too frequently. 192 * 193 */ 194 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 195 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 20000 196 #endif 197 198 /** 199 * @def OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT 200 * 201 * Define to 1 to send an MLE Link Request when MAX_NEIGHBOR_AGE is reached for a neighboring router. 202 * 203 */ 204 #ifndef OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT 205 #define OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT 1 206 #endif 207 208 /** 209 * @def OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 210 * 211 * Specifies the minimum link margin in dBm required before attempting to establish a link with a neighboring router. 212 * 213 */ 214 #ifndef OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 215 #define OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 10 216 #endif 217 218 /** 219 * @def OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 220 * 221 * Specifies the minimum link margin in dBm required before attempting to merge to a different partition. 222 * 223 */ 224 #ifndef OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 225 #define OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 10 226 #endif 227 228 /** 229 * @def OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 230 * 231 * Specifies the desired number of router links that a REED / FED attempts to maintain. 232 * 233 */ 234 #ifndef OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 235 #define OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 3 236 #endif 237 238 /** 239 * @def OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 240 * 241 * Enable experimental mode for 'deep' networks, allowing packet routes up to 32 nodes. 242 * This mode is incompatible with Thread 1.1.1 and older. 243 * 244 */ 245 #ifndef OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 246 #define OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 0 247 #endif 248 249 /** 250 * @def OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 251 * 252 * Define as 1 to enable sending of a unicast MLE Announce message in response to a received Announce message from 253 * a device. 254 * 255 * @note The unicast MLE announce message is sent in addition to (and after) the multicast MLE Announce. 256 * 257 */ 258 #ifndef OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 259 #define OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 1 260 #endif 261 262 /** 263 * @def OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 264 * 265 * Define as 1 for a child to inform its previous parent when it attaches to a new parent. 266 * 267 * If this feature is enabled, when a device attaches to a new parent, it will send an IP message (with empty payload 268 * and mesh-local IP address as the source address) to its previous parent. 269 * 270 */ 271 #ifndef OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 272 #define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 273 #endif 274 275 /** 276 * @def OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE 277 * 278 * Define as 1 to support `otThreadRegisterParentResponseCallback()` API which registers a callback to notify user 279 * of received Parent Response message(s) during attach. This API is mainly intended for debugging and therefore is 280 * disabled by default. 281 * 282 */ 283 #ifndef OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE 284 #define OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE 0 285 #endif 286 287 /** 288 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 289 * 290 * Define as 1 to enable Link Metrics initiator feature. 291 * 292 */ 293 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 294 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 0 295 #endif 296 297 /** 298 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 299 * 300 * Define as 1 to enable Link Metrics subject feature. 301 * 302 */ 303 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 304 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 305 #endif 306 307 /** 308 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED 309 * 310 * The max number of series that a Link Metrics Subject can track simultaneously. 311 * 312 */ 313 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED 314 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 315 #endif 316 317 #endif // CONFIG_MLE_H_ 318