blob: c73c7f69a31b45c20e35898eedf5bd419e56700f [file] [log] [blame]
/*
* Copyright (c) 2016, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* This file includes default compile-time configuration constants
* for OpenThread.
*/
#ifndef OPENTHREAD_CORE_DEFAULT_CONFIG_H_
#define OPENTHREAD_CORE_DEFAULT_CONFIG_H_
#include "config/coap.h"
#include "config/srp_server.h"
/**
* @def OPENTHREAD_CONFIG_STACK_VENDOR_OUI
*
* The Organizationally Unique Identifier for the Thread stack.
*
*/
#ifndef OPENTHREAD_CONFIG_STACK_VENDOR_OUI
#define OPENTHREAD_CONFIG_STACK_VENDOR_OUI 0x18b430
#endif
/**
* @def OPENTHREAD_CONFIG_STACK_VERSION_REV
*
* The Stack Version Revision for the Thread stack.
*
*/
#ifndef OPENTHREAD_CONFIG_STACK_VERSION_REV
#define OPENTHREAD_CONFIG_STACK_VERSION_REV 0
#endif
/**
* @def OPENTHREAD_CONFIG_STACK_VERSION_MAJOR
*
* The Stack Version Major for the Thread stack.
*
*/
#ifndef OPENTHREAD_CONFIG_STACK_VERSION_MAJOR
#define OPENTHREAD_CONFIG_STACK_VERSION_MAJOR 0
#endif
/**
* @def OPENTHREAD_CONFIG_STACK_VERSION_MINOR
*
* The Stack Version Minor for the Thread stack.
*
*/
#ifndef OPENTHREAD_CONFIG_STACK_VERSION_MINOR
#define OPENTHREAD_CONFIG_STACK_VERSION_MINOR 1
#endif
/**
* @def OPENTHREAD_CONFIG_ECDSA_ENABLE
*
* Define to 1 to enable ECDSA support.
*
*/
#ifndef OPENTHREAD_CONFIG_ECDSA_ENABLE
#define OPENTHREAD_CONFIG_ECDSA_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_UPTIME_ENABLE
*
* Define to 1 to enable tracking the uptime of OpenThread instance.
*
*/
#ifndef OPENTHREAD_CONFIG_UPTIME_ENABLE
#define OPENTHREAD_CONFIG_UPTIME_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE
*
* Define to 1 to enable the Jam Detection service.
*
*/
#ifndef OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE
#define OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
*
* Define to 1 to enable multiple instance support.
*
*/
#ifndef OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
#define OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
*
* Define to 1 to enable Thread Test Harness reference device support.
*
*/
#ifndef OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
#define OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE
*
* Define to 1 to enable UDP forward support.
*
*/
#ifndef OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE
#define OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE
*
* Whether use heap allocator for message buffers.
*
* @note If this is set, OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS is ignored.
*
*/
#ifndef OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE
#define OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS
*
* The number of message buffers in the buffer pool.
*
*/
#ifndef OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS
#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 44
#endif
/**
* @def OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE
*
* The size of a message buffer in bytes.
*
* Message buffers store pointers which have different sizes on different
* system. Setting message buffer size according to the CPU word length
* so that message buffer size will be doubled on 64bit system compared
* to that on 32bit system. As a result, the first message always have some
* bytes left for small packets.
*
*/
#ifndef OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE
#define OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE (sizeof(void *) * 32)
#endif
/**
* @def OPENTHREAD_CONFIG_DEFAULT_TRANSMIT_POWER
*
* The default IEEE 802.15.4 transmit power (dBm).
*
*/
#ifndef OPENTHREAD_CONFIG_DEFAULT_TRANSMIT_POWER
#define OPENTHREAD_CONFIG_DEFAULT_TRANSMIT_POWER 0
#endif
/**
* @def OPENTHREAD_CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE
*
* Define as 1 for OpenThread to drop a message (and not send any remaining fragments of the message) if all transmit
* attempts fail for a fragment of the message. For a direct transmission, a failure occurs after all MAC transmission
* attempts for a given fragment are unsuccessful. For an indirect transmission, a failure occurs after all data poll
* triggered transmission attempts for a given fragment fail.
*
* If set to zero (disabled), OpenThread will attempt to send subsequent fragments, whether or not all transmission
* attempts fail for a given fragment.
*
*/
#ifndef OPENTHREAD_CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE
#define OPENTHREAD_CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE 1
#endif
/**
* @def OPENTHREAD_CONFIG_6LOWPAN_REASSEMBLY_TIMEOUT
*
* The reassembly timeout between 6LoWPAN fragments in seconds.
*
*/
#ifndef OPENTHREAD_CONFIG_6LOWPAN_REASSEMBLY_TIMEOUT
#define OPENTHREAD_CONFIG_6LOWPAN_REASSEMBLY_TIMEOUT 2
#endif
/**
* @def OPENTHREAD_CONFIG_JOINER_UDP_PORT
*
* The default Joiner UDP port.
*
*/
#ifndef OPENTHREAD_CONFIG_JOINER_UDP_PORT
#define OPENTHREAD_CONFIG_JOINER_UDP_PORT 1000
#endif
/**
* @def OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS
*
* The maximum number of state-changed callback handlers (set using `otSetStateChangedCallback()`).
*
*/
#ifndef OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS
#define OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 1
#endif
/**
* @def OPENTHREAD_CONFIG_STORE_FRAME_COUNTER_AHEAD
*
* The value ahead of the current frame counter for persistent storage.
*
*/
#ifndef OPENTHREAD_CONFIG_STORE_FRAME_COUNTER_AHEAD
#define OPENTHREAD_CONFIG_STORE_FRAME_COUNTER_AHEAD 1000
#endif
/**
* @def OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS
*
* Define as 1 to enable bultin-mbedtls.
*
* Note that the OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS determines whether to use bultin-mbedtls as well as
* whether to manage mbedTLS internally, such as memory allocation and debug.
*
*/
#ifndef OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS
#define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 1
#endif
/**
* @def OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT
*
* Define as 1 to enable bultin mbedtls management.
*
* OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT determines whether to manage mbedTLS memory
* allocation and debug config internally. If not configured, the default is to enable builtin
* management if builtin mbedtls is enabled and disable it otherwise.
*
*/
#ifndef OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT
#define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS
#endif
/**
* @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE
*
* The size of heap buffer when DTLS is enabled.
*
*/
#ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE
#if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE
// Internal heap doesn't support size larger than 64K bytes.
#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (63 * 1024)
#elif OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (3136 * sizeof(void *))
#else
#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (1616 * sizeof(void *))
#endif
#endif
/**
* @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS
*
* The size of heap buffer when DTLS is disabled.
*
*/
#ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS
#if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE
// Internal heap doesn't support size larger than 64K bytes.
#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS (63 * 1024)
#elif OPENTHREAD_CONFIG_ECDSA_ENABLE
#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS 2600
#else
#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS 384
#endif
#endif
/**
* @def OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
*
* Enable the external heap.
*
*/
#ifndef OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_DTLS_APPLICATION_DATA_MAX_LENGTH
*
* The size of dtls application data when the CoAP Secure API is enabled.
*
*/
#ifndef OPENTHREAD_CONFIG_DTLS_APPLICATION_DATA_MAX_LENGTH
#define OPENTHREAD_CONFIG_DTLS_APPLICATION_DATA_MAX_LENGTH 1400
#endif
/**
* @def OPENTHREAD_CONFIG_ASSERT_ENABLE
*
* Define as 1 to enable assert function `OT_ASSERT()` within OpenThread code and its libraries.
*
*/
#ifndef OPENTHREAD_CONFIG_ASSERT_ENABLE
#define OPENTHREAD_CONFIG_ASSERT_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_ENABLE_DEBUG_UART
*
* Enable the "Debug Uart" platform feature.
*
* In the embedded world, the CLI application uses a UART as a console
* and the NCP application can be configured to use either a UART or
* a SPI type device to transfer data to the host.
*
* The Debug UART is or requires a second uart on the platform.
*
* The Debug Uart has two uses:
*
* Use #1 - for random 'debug printf' type messages a developer may need
* Use #2 (selected via DEBUG_LOG_OUTPUT) is a log output.
*
* See #include <openthread/platform/debug_uart.h> for more details
*/
#ifndef OPENTHREAD_CONFIG_ENABLE_DEBUG_UART
#define OPENTHREAD_CONFIG_ENABLE_DEBUG_UART 0
#endif
/**
* @def OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH
*
* The settings storage path on posix platform.
*
*/
#ifndef OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH
#define OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH "tmp"
#endif
/**
* @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
*
* Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
*
* When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs.
*
*/
#ifndef OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_FAILED_CHILD_TRANSMISSIONS
*
* This setting configures the number of consecutive MCPS.DATA-Confirms having Status NO_ACK
* that cause a Child-to-Parent link to be considered broken.
*
*/
#ifndef OPENTHREAD_CONFIG_FAILED_CHILD_TRANSMISSIONS
#define OPENTHREAD_CONFIG_FAILED_CHILD_TRANSMISSIONS 4
#endif
/**
* @def OPENTHREAD_CONFIG_DEFAULT_SED_BUFFER_SIZE
*
* This setting configures the default buffer size for IPv6 datagram destined for an attached SED.
* A Thread Router MUST be able to buffer at least one 1280-octet IPv6 datagram for an attached SED according to
* the Thread Conformance Specification.
*
*/
#ifndef OPENTHREAD_CONFIG_DEFAULT_SED_BUFFER_SIZE
#define OPENTHREAD_CONFIG_DEFAULT_SED_BUFFER_SIZE 1280
#endif
/**
* @def OPENTHREAD_CONFIG_DEFAULT_SED_DATAGRAM_COUNT
*
* This setting configures the default datagram count of 106-octet IPv6 datagram per attached SED.
* A Thread Router MUST be able to buffer at least one 106-octet IPv6 datagram per attached SED according to
* the Thread Conformance Specification.
*
*/
#ifndef OPENTHREAD_CONFIG_DEFAULT_SED_DATAGRAM_COUNT
#define OPENTHREAD_CONFIG_DEFAULT_SED_DATAGRAM_COUNT 1
#endif
/**
* @def OPENTHREAD_CONFIG_NUM_FRAGMENT_PRIORITY_ENTRIES
*
* The number of fragment priority entries.
*
*/
#ifndef OPENTHREAD_CONFIG_NUM_FRAGMENT_PRIORITY_ENTRIES
#define OPENTHREAD_CONFIG_NUM_FRAGMENT_PRIORITY_ENTRIES 8
#endif
/**
* @def OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT
*
* Define to 1 to support proprietary radio configurations defined by platform.
*
* @note If this setting is set to 1, the channel range is defined by the platform. Choosing this option requires
* the following configuration options to be defined by Platform:
* OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_PAGE,
* OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MIN,
* OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MAX and,
* OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MASK.
*
* @def OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
*
* Define to 1 to support OQPSK modulation in 915MHz frequency band. The physical layer parameters are defined in
* section 6 of IEEE802.15.4-2006.
*
* @note If this setting is set to 1, the IEEE 802.15.4 channel range is 1 to 10.
*
* @def OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT
*
* Define to 1 to support OQPSK modulation in 2.4GHz frequency band. The physical layer parameters are defined in
* section 6 of IEEE802.15.4-2006.
*
* @note If this settings is set to 1, the IEEE 802.15.4 channel range is 11 to 26.
*
* @note At least one of these settings must be set to 1. The platform must support the modulation and frequency
* band configured by the setting.
*/
#ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT
#ifndef OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
#ifndef OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT
#define OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT 0
#define OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 0
#define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 1
#endif
#endif
#endif
/**
* @def OPENTHREAD_CONFIG_DEFAULT_CHANNEL
*
* The default IEEE 802.15.4 channel.
*
*/
#ifndef OPENTHREAD_CONFIG_DEFAULT_CHANNEL
#if OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT
#define OPENTHREAD_CONFIG_DEFAULT_CHANNEL 11
#else
#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
#define OPENTHREAD_CONFIG_DEFAULT_CHANNEL 1
#endif // OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
#endif // OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT
#endif // OPENTHREAD_CONFIG_DEFAULT_CHANNEL
/**
* @def OPENTHREAD_CONFIG_LEGACY_ENABLE
*
* Define to 1 to enable legacy network support.
*
*/
#ifndef OPENTHREAD_CONFIG_LEGACY_ENABLE
#define OPENTHREAD_CONFIG_LEGACY_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_OTNS_ENABLE
*
* Define to 1 to enable OTNS interactions.
*
*/
#ifndef OPENTHREAD_CONFIG_OTNS_ENABLE
#define OPENTHREAD_CONFIG_OTNS_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_DUA_ENABLE
*
* Define as 1 to support Thread 1.2 Domain Unicast Address feature.
*
*/
#ifndef OPENTHREAD_CONFIG_DUA_ENABLE
#define OPENTHREAD_CONFIG_DUA_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_MLR_ENABLE
*
* Define as 1 to support Thread 1.2 Multicast Listener Registration feature.
*
*/
#ifndef OPENTHREAD_CONFIG_MLR_ENABLE
#define OPENTHREAD_CONFIG_MLR_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE
*
* Define as 1 to enable support for Neighbor Discover Agent.
*
*/
#ifndef OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE
#define OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE 0
#endif
#endif // OPENTHREAD_CORE_DEFAULT_CONFIG_H_