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_STEERING_DATA_SET_OOB_ENABLE 93 * 94 * Enable setting steering data out of band. 95 * 96 */ 97 #ifndef OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 98 #define OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 0 99 #endif 100 101 /** 102 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 103 * 104 * Define as 1 to enable attach backoff feature 105 * 106 * When this feature is enabled, an exponentially increasing backoff wait time is added between attach attempts. 107 * If device is sleepy, the radio will be put to sleep during the wait time. This ensures that a battery-powered sleepy 108 * end-device does not drain its battery by continuously searching for a parent to attach to (when there is no 109 * router/parent for it to attach). 110 * 111 * The backoff time starts from a minimum interval specified by 112 * `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL`, and every attach attempt the wait time is doubled up to 113 * `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL` which specifies the maximum wait time. 114 * 115 * Once the wait time reaches the maximum, a random jitter interval is added to it. The maximum value for jitter is 116 * specified by `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL`. The random jitter is selected uniformly within 117 * range `[-JITTER, +JITTER]`. It is only added when the backoff wait interval is at maximum value. 118 * 119 */ 120 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 121 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE 1 122 #endif 123 124 /** 125 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 126 * 127 * Specifies the minimum backoff wait interval (in milliseconds) used by attach backoff feature. 128 * 129 * Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`). 130 * 131 * Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details. 132 * 133 */ 134 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 135 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MINIMUM_INTERVAL 251 136 #endif 137 138 /** 139 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 140 * 141 * Specifies the maximum backoff wait interval (in milliseconds) used by attach backoff feature. 142 * 143 * Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`). 144 * 145 * Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details. 146 * 147 */ 148 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 149 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 1200000 // 1200 seconds = 20 minutes 150 #endif 151 152 /** 153 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 154 * 155 * Specifies the maximum jitter interval (in milliseconds) used by attach backoff feature. 156 * 157 * Applicable only if attach backoff feature is enabled (see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE`). 158 * 159 * Please see `OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE` description for more details. 160 * 161 */ 162 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 163 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_JITTER_INTERVAL 2000 164 #endif 165 166 /** 167 * @def OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 168 * 169 * Specifies the delay wait interval (in milliseconds) used by attach backoff feature after a successful attach before 170 * it resets the current backoff interval back to the minimum value. 171 * 172 * If it is set to zero then the device resets its backoff attach interval immediately after a successful attach. With 173 * a non-zero value, if after a successful attach, the device happens to detach within the delay interval, the reattach 174 * process resumes with the previous backoff interval (as if the attach did not happen). 175 * 176 * This behavior is helpful in the situation where a battery-powered device has poor link quality to its parent and 177 * therefore attaches and detaches frequently from the parent. Using a non-zero wait interval ensures that the attach 178 * backoff interval does not reset on each attach and that the device does not drain its battery quickly trying to 179 * re-attach too frequently. 180 * 181 */ 182 #ifndef OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 183 #define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_DELAY_TO_RESET_BACKOFF_INTERVAL 20000 184 #endif 185 186 /** 187 * @def OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT 188 * 189 * Define to 1 to send an MLE Link Request when MAX_NEIGHBOR_AGE is reached for a neighboring router. 190 * 191 */ 192 #ifndef OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT 193 #define OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT 1 194 #endif 195 196 /** 197 * @def OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 198 * 199 * Specifies the minimum link margin in dBm required before attempting to establish a link with a neighboring router. 200 * 201 */ 202 #ifndef OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 203 #define OPENTHREAD_CONFIG_MLE_LINK_REQUEST_MARGIN_MIN 10 204 #endif 205 206 /** 207 * @def OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 208 * 209 * Specifies the minimum link margin in dBm required before attempting to merge to a different partition. 210 * 211 */ 212 #ifndef OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 213 #define OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN 10 214 #endif 215 216 /** 217 * @def OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 218 * 219 * Specifies the desired number of router links that a REED / FED attempts to maintain. 220 * 221 */ 222 #ifndef OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 223 #define OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS 3 224 #endif 225 226 /** 227 * @def OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 228 * 229 * Enable experimental mode for 'deep' networks, allowing packet routes up to 32 nodes. 230 * This mode is incompatible with Thread 1.1.1 and older. 231 * 232 */ 233 #ifndef OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 234 #define OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE 0 235 #endif 236 237 /** 238 * @def OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 239 * 240 * Define as 1 to enable sending of a unicast MLE Announce message in response to a received Announce message from 241 * a device. 242 * 243 * @note The unicast MLE announce message is sent in addition to (and after) the multicast MLE Announce. 244 * 245 */ 246 #ifndef OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 247 #define OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE 1 248 #endif 249 250 /** 251 * @def OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 252 * 253 * Define as 1 for a child to inform its previous parent when it attaches to a new parent. 254 * 255 * If this feature is enabled, when a device attaches to a new parent, it will send an IP message (with empty payload 256 * and mesh-local IP address as the source address) to its previous parent. 257 * 258 */ 259 #ifndef OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 260 #define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 0 261 #endif 262 263 /** 264 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 265 * 266 * Define as 1 to enable Link Metrics initiator feature. 267 * 268 */ 269 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 270 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 0 271 #endif 272 273 /** 274 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 275 * 276 * Define as 1 to enable Link Metrics subject feature. 277 * 278 */ 279 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 280 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 281 #endif 282 283 /** 284 * @def OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED 285 * 286 * The max number of series that a Link Metrics Subject can track simultaneously. 287 * 288 */ 289 #ifndef OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED 290 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_MAX_SERIES_SUPPORTED OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 291 #endif 292 293 #endif // CONFIG_MLE_H_ 294