1 /* 2 * Copyright (c) 2016, 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 default compile-time configuration constants 32 * for OpenThread. 33 */ 34 35 #ifndef OPENTHREAD_CORE_DEFAULT_CONFIG_H_ 36 #define OPENTHREAD_CORE_DEFAULT_CONFIG_H_ 37 38 #include "config/coap.h" 39 #include "config/srp_server.h" 40 41 /** 42 * @def OPENTHREAD_CONFIG_STACK_VENDOR_OUI 43 * 44 * The Organizationally Unique Identifier for the Thread stack. 45 * 46 */ 47 #ifndef OPENTHREAD_CONFIG_STACK_VENDOR_OUI 48 #define OPENTHREAD_CONFIG_STACK_VENDOR_OUI 0x18b430 49 #endif 50 51 /** 52 * @def OPENTHREAD_CONFIG_STACK_VERSION_REV 53 * 54 * The Stack Version Revision for the Thread stack. 55 * 56 */ 57 #ifndef OPENTHREAD_CONFIG_STACK_VERSION_REV 58 #define OPENTHREAD_CONFIG_STACK_VERSION_REV 0 59 #endif 60 61 /** 62 * @def OPENTHREAD_CONFIG_STACK_VERSION_MAJOR 63 * 64 * The Stack Version Major for the Thread stack. 65 * 66 */ 67 #ifndef OPENTHREAD_CONFIG_STACK_VERSION_MAJOR 68 #define OPENTHREAD_CONFIG_STACK_VERSION_MAJOR 0 69 #endif 70 71 /** 72 * @def OPENTHREAD_CONFIG_STACK_VERSION_MINOR 73 * 74 * The Stack Version Minor for the Thread stack. 75 * 76 */ 77 #ifndef OPENTHREAD_CONFIG_STACK_VERSION_MINOR 78 #define OPENTHREAD_CONFIG_STACK_VERSION_MINOR 1 79 #endif 80 81 /** 82 * @def OPENTHREAD_CONFIG_ECDSA_ENABLE 83 * 84 * Define to 1 to enable ECDSA support. 85 * 86 */ 87 #ifndef OPENTHREAD_CONFIG_ECDSA_ENABLE 88 #define OPENTHREAD_CONFIG_ECDSA_ENABLE 0 89 #endif 90 91 /** 92 * @def OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE 93 * 94 * Define to 1 to enable the Jam Detection service. 95 * 96 */ 97 #ifndef OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE 98 #define OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE 0 99 #endif 100 101 /** 102 * @def OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE 103 * 104 * Define to 1 to enable multiple instance support. 105 * 106 */ 107 #ifndef OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE 108 #define OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE 0 109 #endif 110 111 /** 112 * @def OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE 113 * 114 * Define to 1 to enable Thread Test Harness reference device support. 115 * 116 */ 117 #ifndef OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE 118 #define OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE 0 119 #endif 120 121 /** 122 * @def OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 123 * 124 * Define to 1 to enable UDP forward support. 125 * 126 */ 127 #ifndef OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 128 #define OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 0 129 #endif 130 131 /** 132 * @def OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE 133 * 134 * Whether use heap allocator for message buffers. 135 * 136 * @note If this is set, OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS is ignored. 137 * 138 */ 139 #ifndef OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE 140 #define OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE 0 141 #endif 142 143 /** 144 * @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 145 * 146 * The number of message buffers in the buffer pool. 147 * 148 */ 149 #ifndef OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 150 #define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 44 151 #endif 152 153 /** 154 * @def OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE 155 * 156 * The size of a message buffer in bytes. 157 * 158 * Message buffers store pointers which have different sizes on different 159 * system. Setting message buffer size according to the CPU word length 160 * so that message buffer size will be doubled on 64bit system compared 161 * to that on 32bit system. As a result, the first message always have some 162 * bytes left for small packets. 163 * 164 */ 165 #ifndef OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE 166 #define OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE (sizeof(void *) * 32) 167 #endif 168 169 /** 170 * @def OPENTHREAD_CONFIG_DEFAULT_TRANSMIT_POWER 171 * 172 * The default IEEE 802.15.4 transmit power (dBm). 173 * 174 */ 175 #ifndef OPENTHREAD_CONFIG_DEFAULT_TRANSMIT_POWER 176 #define OPENTHREAD_CONFIG_DEFAULT_TRANSMIT_POWER 0 177 #endif 178 179 /** 180 * @def OPENTHREAD_CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE 181 * 182 * Define as 1 for OpenThread to drop a message (and not send any remaining fragments of the message) if all transmit 183 * attempts fail for a fragment of the message. For a direct transmission, a failure occurs after all MAC transmission 184 * attempts for a given fragment are unsuccessful. For an indirect transmission, a failure occurs after all data poll 185 * triggered transmission attempts for a given fragment fail. 186 * 187 * If set to zero (disabled), OpenThread will attempt to send subsequent fragments, whether or not all transmission 188 * attempts fail for a given fragment. 189 * 190 */ 191 #ifndef OPENTHREAD_CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE 192 #define OPENTHREAD_CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE 1 193 #endif 194 195 /** 196 * @def OPENTHREAD_CONFIG_6LOWPAN_REASSEMBLY_TIMEOUT 197 * 198 * The reassembly timeout between 6LoWPAN fragments in seconds. 199 * 200 */ 201 #ifndef OPENTHREAD_CONFIG_6LOWPAN_REASSEMBLY_TIMEOUT 202 #define OPENTHREAD_CONFIG_6LOWPAN_REASSEMBLY_TIMEOUT 2 203 #endif 204 205 /** 206 * @def OPENTHREAD_CONFIG_JOINER_UDP_PORT 207 * 208 * The default Joiner UDP port. 209 * 210 */ 211 #ifndef OPENTHREAD_CONFIG_JOINER_UDP_PORT 212 #define OPENTHREAD_CONFIG_JOINER_UDP_PORT 1000 213 #endif 214 215 /** 216 * @def OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 217 * 218 * The maximum number of state-changed callback handlers (set using `otSetStateChangedCallback()`). 219 * 220 */ 221 #ifndef OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 222 #define OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 1 223 #endif 224 225 /** 226 * @def OPENTHREAD_CONFIG_STORE_FRAME_COUNTER_AHEAD 227 * 228 * The value ahead of the current frame counter for persistent storage. 229 * 230 */ 231 #ifndef OPENTHREAD_CONFIG_STORE_FRAME_COUNTER_AHEAD 232 #define OPENTHREAD_CONFIG_STORE_FRAME_COUNTER_AHEAD 1000 233 #endif 234 235 /** 236 * @def OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 237 * 238 * Define as 1 to enable bultin-mbedtls. 239 * 240 * Note that the OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS determines whether to use bultin-mbedtls as well as 241 * whether to manage mbedTLS internally, such as memory allocation and debug. 242 * 243 */ 244 #ifndef OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 245 #define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 1 246 #endif 247 248 /** 249 * @def OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT 250 * 251 * Define as 1 to enable bultin mbedtls management. 252 * 253 * OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT determines whether to manage mbedTLS memory 254 * allocation and debug config internally. If not configured, the default is to enable builtin 255 * management if builtin mbedtls is enabled and disable it otherwise. 256 * 257 */ 258 #ifndef OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT 259 #define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 260 #endif 261 262 /** 263 * @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE 264 * 265 * The size of heap buffer when DTLS is enabled. 266 * 267 */ 268 #ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE 269 #if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 270 // Internal heap doesn't support size larger than 64K bytes. 271 #define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (63 * 1024) 272 #elif OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE 273 #define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (3136 * sizeof(void *)) 274 #else 275 #define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (1616 * sizeof(void *)) 276 #endif 277 #endif 278 279 /** 280 * @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS 281 * 282 * The size of heap buffer when DTLS is disabled. 283 * 284 */ 285 #ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS 286 #if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 287 // Internal heap doesn't support size larger than 64K bytes. 288 #define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS (63 * 1024) 289 #elif OPENTHREAD_CONFIG_ECDSA_ENABLE 290 #define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS 2600 291 #else 292 #define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS 384 293 #endif 294 #endif 295 296 /** 297 * @def OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 298 * 299 * Enable the external heap. 300 * 301 */ 302 #ifndef OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 303 #define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0 304 #endif 305 306 /** 307 * @def OPENTHREAD_CONFIG_DTLS_APPLICATION_DATA_MAX_LENGTH 308 * 309 * The size of dtls application data when the CoAP Secure API is enabled. 310 * 311 */ 312 #ifndef OPENTHREAD_CONFIG_DTLS_APPLICATION_DATA_MAX_LENGTH 313 #define OPENTHREAD_CONFIG_DTLS_APPLICATION_DATA_MAX_LENGTH 1400 314 #endif 315 316 /** 317 * @def OPENTHREAD_CONFIG_ASSERT_ENABLE 318 * 319 * Define as 1 to enable assert function `OT_ASSERT()` within OpenThread code and its libraries. 320 * 321 */ 322 #ifndef OPENTHREAD_CONFIG_ASSERT_ENABLE 323 #define OPENTHREAD_CONFIG_ASSERT_ENABLE 1 324 #endif 325 326 /** 327 * @def OPENTHREAD_CONFIG_ENABLE_DEBUG_UART 328 * 329 * Enable the "Debug Uart" platform feature. 330 * 331 * In the embedded world, the CLI application uses a UART as a console 332 * and the NCP application can be configured to use either a UART or 333 * a SPI type device to transfer data to the host. 334 * 335 * The Debug UART is or requires a second uart on the platform. 336 * 337 * The Debug Uart has two uses: 338 * 339 * Use #1 - for random 'debug printf' type messages a developer may need 340 * Use #2 (selected via DEBUG_LOG_OUTPUT) is a log output. 341 * 342 * See #include <openthread/platform/debug_uart.h> for more details 343 */ 344 #ifndef OPENTHREAD_CONFIG_ENABLE_DEBUG_UART 345 #define OPENTHREAD_CONFIG_ENABLE_DEBUG_UART 0 346 #endif 347 348 /** 349 * @def OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH 350 * 351 * The settings storage path on posix platform. 352 * 353 */ 354 #ifndef OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH 355 #define OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH "tmp" 356 #endif 357 358 /** 359 * @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 360 * 361 * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage. 362 * 363 * When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs. 364 * 365 */ 366 #ifndef OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 367 #define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0 368 #endif 369 370 /** 371 * @def OPENTHREAD_CONFIG_FAILED_CHILD_TRANSMISSIONS 372 * 373 * This setting configures the number of consecutive MCPS.DATA-Confirms having Status NO_ACK 374 * that cause a Child-to-Parent link to be considered broken. 375 * 376 */ 377 #ifndef OPENTHREAD_CONFIG_FAILED_CHILD_TRANSMISSIONS 378 #define OPENTHREAD_CONFIG_FAILED_CHILD_TRANSMISSIONS 4 379 #endif 380 381 /** 382 * @def OPENTHREAD_CONFIG_DEFAULT_SED_BUFFER_SIZE 383 * 384 * This setting configures the default buffer size for IPv6 datagram destined for an attached SED. 385 * A Thread Router MUST be able to buffer at least one 1280-octet IPv6 datagram for an attached SED according to 386 * the Thread Conformance Specification. 387 * 388 */ 389 #ifndef OPENTHREAD_CONFIG_DEFAULT_SED_BUFFER_SIZE 390 #define OPENTHREAD_CONFIG_DEFAULT_SED_BUFFER_SIZE 1280 391 #endif 392 393 /** 394 * @def OPENTHREAD_CONFIG_DEFAULT_SED_DATAGRAM_COUNT 395 * 396 * This setting configures the default datagram count of 106-octet IPv6 datagram per attached SED. 397 * A Thread Router MUST be able to buffer at least one 106-octet IPv6 datagram per attached SED according to 398 * the Thread Conformance Specification. 399 * 400 */ 401 #ifndef OPENTHREAD_CONFIG_DEFAULT_SED_DATAGRAM_COUNT 402 #define OPENTHREAD_CONFIG_DEFAULT_SED_DATAGRAM_COUNT 1 403 #endif 404 405 /** 406 * @def OPENTHREAD_CONFIG_NUM_FRAGMENT_PRIORITY_ENTRIES 407 * 408 * The number of fragment priority entries. 409 * 410 */ 411 #ifndef OPENTHREAD_CONFIG_NUM_FRAGMENT_PRIORITY_ENTRIES 412 #define OPENTHREAD_CONFIG_NUM_FRAGMENT_PRIORITY_ENTRIES 8 413 #endif 414 415 /** 416 * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT 417 * 418 * Define to 1 to support proprietary radio configurations defined by platform. 419 * 420 * @note If this setting is set to 1, the channel range is defined by the platform. Choosing this option requires 421 * the following configuration options to be defined by Platform: 422 * OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_PAGE, 423 * OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MIN, 424 * OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MAX and, 425 * OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MASK. 426 * 427 * @def OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 428 * 429 * Define to 1 to support OQPSK modulation in 915MHz frequency band. The physical layer parameters are defined in 430 * section 6 of IEEE802.15.4-2006. 431 * 432 * @note If this setting is set to 1, the IEEE 802.15.4 channel range is 1 to 10. 433 * 434 * @def OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 435 * 436 * Define to 1 to support OQPSK modulation in 2.4GHz frequency band. The physical layer parameters are defined in 437 * section 6 of IEEE802.15.4-2006. 438 * 439 * @note If this settings is set to 1, the IEEE 802.15.4 channel range is 11 to 26. 440 * 441 * @note At least one of these settings must be set to 1. The platform must support the modulation and frequency 442 * band configured by the setting. 443 */ 444 #ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT 445 #ifndef OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 446 #ifndef OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 447 #define OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT 0 448 #define OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 0 449 #define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 1 450 #endif 451 #endif 452 #endif 453 454 /** 455 * @def OPENTHREAD_CONFIG_DEFAULT_CHANNEL 456 * 457 * The default IEEE 802.15.4 channel. 458 * 459 */ 460 #ifndef OPENTHREAD_CONFIG_DEFAULT_CHANNEL 461 #if OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 462 #define OPENTHREAD_CONFIG_DEFAULT_CHANNEL 11 463 #else 464 #if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 465 #define OPENTHREAD_CONFIG_DEFAULT_CHANNEL 1 466 #endif // OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 467 #endif // OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 468 #endif // OPENTHREAD_CONFIG_DEFAULT_CHANNEL 469 470 /** 471 * @def OPENTHREAD_CONFIG_LEGACY_ENABLE 472 * 473 * Define to 1 to enable legacy network support. 474 * 475 */ 476 #ifndef OPENTHREAD_CONFIG_LEGACY_ENABLE 477 #define OPENTHREAD_CONFIG_LEGACY_ENABLE 0 478 #endif 479 480 /** 481 * @def OPENTHREAD_CONFIG_OTNS_ENABLE 482 * 483 * Define to 1 to enable OTNS interactions. 484 * 485 */ 486 #ifndef OPENTHREAD_CONFIG_OTNS_ENABLE 487 #define OPENTHREAD_CONFIG_OTNS_ENABLE 0 488 #endif 489 490 /** 491 * @def OPENTHREAD_CONFIG_DUA_ENABLE 492 * 493 * Define as 1 to support Thread 1.2 Domain Unicast Address feature. 494 * 495 */ 496 #ifndef OPENTHREAD_CONFIG_DUA_ENABLE 497 #define OPENTHREAD_CONFIG_DUA_ENABLE 0 498 #endif 499 500 /** 501 * @def OPENTHREAD_CONFIG_MLR_ENABLE 502 * 503 * Define as 1 to support Thread 1.2 Multicast Listener Registration feature. 504 * 505 */ 506 #ifndef OPENTHREAD_CONFIG_MLR_ENABLE 507 #define OPENTHREAD_CONFIG_MLR_ENABLE 0 508 #endif 509 510 /** 511 * @def OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE 512 * 513 * Define as 1 to enable support for Neighbor Discover Agent. 514 * 515 */ 516 #ifndef OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE 517 #define OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE 0 518 #endif 519 520 #endif // OPENTHREAD_CORE_DEFAULT_CONFIG_H_ 521