From 02da206f3971ad2022a161fc647d3e944bee476b Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Tue, 16 Jul 2019 12:18:34 -0700 Subject: [PATCH] [config] remaining configure options (#4020) --- .travis/script.sh | 80 ++++----- Android.mk | 2 +- Makefile.am | 1 - configure.ac | 164 ------------------ examples/apps/cli/main.c | 8 +- examples/apps/ncp/main.c | 8 +- examples/common-switches.mk | 10 +- include/openthread-config-android.h | 6 +- include/openthread/jam_detection.h | 4 +- include/openthread/udp.h | 3 +- src/cli/cli.cpp | 6 +- src/cli/cli_uart.cpp | 2 +- src/core/api/crypto_api.cpp | 4 +- src/core/api/instance_api.cpp | 4 +- src/core/api/jam_detection_api.cpp | 4 +- src/core/api/logging_api.cpp | 6 +- src/core/api/udp_api.cpp | 4 +- src/core/common/instance.cpp | 14 +- src/core/common/instance.hpp | 12 +- src/core/common/locator-getters.hpp | 2 +- src/core/common/locator.hpp | 14 +- src/core/common/logging.hpp | 4 +- .../config/openthread-core-config-check.h | 6 +- .../config/openthread-core-default-config.h | 92 +++++++++- src/core/crypto/ecdsa.cpp | 4 +- src/core/crypto/mbedtls.cpp | 8 +- src/core/meshcop/commissioner.cpp | 4 +- src/core/meshcop/joiner.cpp | 6 +- src/core/meshcop/joiner.hpp | 2 +- src/core/net/udp6.cpp | 4 +- src/core/net/udp6.hpp | 6 +- src/core/thread/thread_netif.cpp | 4 +- src/core/thread/thread_netif.hpp | 8 +- src/core/utils/jam_detector.cpp | 4 +- src/ncp/changed_props_set.cpp | 4 +- src/ncp/ncp_base.cpp | 10 +- src/ncp/ncp_base.hpp | 10 +- src/ncp/ncp_base_dispatcher.cpp | 10 +- src/ncp/ncp_base_mtd.cpp | 22 +-- tests/toranj/build.sh | 2 - tests/toranj/openthread-core-toranj-config.h | 16 ++ tests/unit/test_platform.cpp | 6 +- third_party/mbedtls/mbedtls-config.h | 4 +- 43 files changed, 264 insertions(+), 330 deletions(-) diff --git a/.travis/script.sh b/.travis/script.sh index 03fdd0206..40ea33bd5 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -55,40 +55,40 @@ python --version || die export CPPFLAGS="${CPPFLAGS} -DMBEDTLS_CONFIG_FILE=\\\"mbedtls-config.h\\\"" # UART transport - export CPPFLAGS="${CPPFLAGS} \ - -DOPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1 \ - -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1 \ - -DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1 \ - -DOPENTHREAD_CONFIG_COAP_API_ENABLE=1 \ - -DOPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1 \ - -DOPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1 \ - -DOPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_DIAG_ENABLE=1 \ - -DOPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1 \ - -DOPENTHREAD_CONFIG_JOINER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_LINK_RAW_ENABLE=1 \ - -DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1 \ - -DOPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1 \ - -DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1 \ - -DOPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1" + export CPPFLAGS="${CPPFLAGS} \ + -DOPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1 \ + -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1 \ + -DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1 \ + -DOPENTHREAD_CONFIG_COAP_API_ENABLE=1 \ + -DOPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1 \ + -DOPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1 \ + -DOPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_DIAG_ENABLE=1 \ + -DOPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1 \ + -DOPENTHREAD_CONFIG_ECDSA_ENABLE=1 \ + -DOPENTHREAD_CONFIG_LEGACY_ENABLE=1 \ + -DOPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1 \ + -DOPENTHREAD_CONFIG_JOINER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_LINK_RAW_ENABLE=1 \ + -DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1 \ + -DOPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=1 \ + -DOPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1 \ + -DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1 \ + -DOPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1 \ + -DOPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1" scan-build ./configure \ --enable-builtin-mbedtls=no \ - --enable-cert-log \ --enable-cli \ - --enable-ecdsa \ --enable-executable=no \ --enable-ftd \ - --enable-jam-detection \ - --enable-legacy \ --enable-mtd \ --enable-ncp \ --enable-radio-only \ - --enable-udp-forward \ --with-examples=posix || die scan-build --status-bugs -analyze-headers -v make -j2 || die @@ -96,17 +96,12 @@ python --version || die # SPI transport scan-build ./configure \ --enable-builtin-mbedtls=no \ - --enable-cert-log \ --enable-cli \ - --enable-ecdsa \ --enable-executable=no \ --enable-ftd \ - --enable-jam-detection \ - --enable-legacy \ --enable-mtd \ --enable-ncp \ --enable-radio-only \ - --enable-udp-forward \ --with-examples=posix || die scan-build --status-bugs -analyze-headers -v make -j2 || die @@ -345,14 +340,16 @@ build_samr21() { ./bootstrap || die CPPFLAGS=-DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG make -f examples/Makefile-posix || die - export CPPFLAGS=" \ - -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1 \ - -DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1 \ - -DOPENTHREAD_CONFIG_DIAG_ENABLE=1 \ - -DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1 \ + export CPPFLAGS=" \ + -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1 \ + -DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1 \ + -DOPENTHREAD_CONFIG_DIAG_ENABLE=1 \ + -DOPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1 \ + -DOPENTHREAD_CONFIG_LEGACY_ENABLE=1 \ + -DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1 \ -DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1" git checkout -- . || die @@ -363,8 +360,6 @@ build_samr21() { --enable-ftd \ --enable-mtd \ --with-examples=posix \ - --enable-jam-detection \ - --enable-legacy \ --disable-docs \ --disable-tests \ --with-vendor-extension=./src/core/common/extension_example.cpp || die @@ -377,14 +372,13 @@ build_samr21() { --enable-cli \ --enable-mtd \ --with-examples=posix \ - --enable-legacy \ --disable-docs \ --disable-tests || die make -j 8 || die - export CPPFLAGS=" \ + export CPPFLAGS=" \ -DOPENTHREAD_CONFIG_ANOUNCE_SENDER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1 \ + -DOPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1 \ -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1" git checkout -- . || die diff --git a/Android.mk b/Android.mk index 9c1bbea92..1c5ef30d0 100644 --- a/Android.mk +++ b/Android.mk @@ -58,8 +58,8 @@ OPENTHREAD_COMMON_FLAGS += \ -DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1 \ -DOPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1 \ -DOPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1 \ + -DOPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=0 \ -DOPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1 \ - -DOPENTHREAD_ENABLE_REFERENCE_DEVICE=0 \ $(NULL) endif diff --git a/Makefile.am b/Makefile.am index b96a30992..2073c16fa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,7 +32,6 @@ AM_MAKEFLAGS = --no-print-directory AM_DISTCHECK_CONFIGURE_FLAGS = \ --enable-address-sanitizer \ - --enable-cert-log \ --enable-cli \ --enable-ftd \ --enable-mtd \ diff --git a/configure.ac b/configure.ac index ebe60ac58..9852cc4bb 100644 --- a/configure.ac +++ b/configure.ac @@ -378,37 +378,6 @@ NL_ENABLE_TESTS([yes]) AM_CONDITIONAL([OPENTHREAD_BUILD_TESTS], [test "${nl_cv_build_tests}" = "yes"]) -# -# Multiple OpenThread Instances -# - -AC_ARG_ENABLE(multiple-instances, - [AS_HELP_STRING([--enable-multiple-instances],[Enable support for multiple OpenThread instances @<:@default=no@:>@.])], - [ - case "${enableval}" in - - no|yes) - enable_multiple_instances=${enableval} - ;; - - *) - AC_MSG_ERROR([Invalid value ${enable_multiple_instances} for --enable-multiple-instances]) - ;; - esac - ], - [enable_multiple_instances=no]) - -if test "$enable_multiple_instances" = "yes"; then - OPENTHREAD_ENABLE_MULTIPLE_INSTANCES=1 -else - OPENTHREAD_ENABLE_MULTIPLE_INSTANCES=0 -fi - -AC_MSG_RESULT(${enable_multiple_instances}) -AC_SUBST(OPENTHREAD_ENABLE_MULTIPLE_INSTANCES) -AM_CONDITIONAL([OPENTHREAD_ENABLE_MULTIPLE_INSTANCES], [test "${enable_multiple_instances}" = "yes"]) -AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_MULTIPLE_INSTANCES],[${OPENTHREAD_ENABLE_MULTIPLE_INSTANCES}],[Define to 1 if you want to enable support for multiple OpenThread instances.]) - # # Builtin mbedtls # @@ -732,70 +701,6 @@ case "${with_readline}" in ;; esac -# -# Thread UDP forward -# - -AC_MSG_CHECKING([whether to enable UDP forward]) -AC_ARG_ENABLE(udp_forward, - [AS_HELP_STRING([--enable-udp-forward], [Enable UDP forward support @<:@default=no@:>@.])], - [ - case "${enableval}" in - - no|yes) - enable_udp_forward=${enableval} - ;; - - *) - AC_MSG_ERROR([Invalid value ${enable_udp_forward} for --enable-udp-forward]) - ;; - esac - ], - [enable_udp_forward=no]) - -if test "$enable_udp_forward" = "yes"; then - OPENTHREAD_ENABLE_UDP_FORWARD=1 -else - OPENTHREAD_ENABLE_UDP_FORWARD=0 -fi - -AC_MSG_RESULT(${enable_udp_forward}) -AC_SUBST(OPENTHREAD_ENABLE_UDP_FORWARD) -AM_CONDITIONAL([OPENTHREAD_ENABLE_UDP_FORWARD], [test "${enable_udp_forward}" = "yes"]) -AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_UDP_FORWARD], [${OPENTHREAD_ENABLE_UDP_FORWARD}], [Define to 1 to enable the UDP forward feature.]) - -# -# Jam Detection -# - -AC_ARG_ENABLE(jam_detection, - [AS_HELP_STRING([--enable-jam-detection],[Enable Jam Detection support @<:@default=no@:>@.])], - [ - case "${enableval}" in - - no|yes) - enable_jam_detection=${enableval} - ;; - - *) - AC_MSG_ERROR([Invalid value ${enable_jam_detection} for --enable-jam-detection]) - ;; - esac - ], - [enable_jam_detection=no]) - -if test "$enable_jam_detection" = "yes"; then - OPENTHREAD_ENABLE_JAM_DETECTION=1 -else - OPENTHREAD_ENABLE_JAM_DETECTION=0 -fi - -AC_MSG_CHECKING([whether to enable jam detection]) -AC_MSG_RESULT(${enable_jam_detection}) -AC_SUBST(OPENTHREAD_ENABLE_JAM_DETECTION) -AM_CONDITIONAL([OPENTHREAD_ENABLE_JAM_DETECTION], [test "${enable_jam_detection}" = "yes"]) -AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_JAM_DETECTION],[${OPENTHREAD_ENABLE_JAM_DETECTION}],[Define to 1 if you want to use jam detection feature]) - # # Vendor Extension - Specify a C++ source file which will be built as part of OpenThread core library. # @@ -826,38 +731,6 @@ AC_SUBST(OPENTHREAD_VENDOR_EXTENSION_SOURCE) AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_VENDOR_EXTENSION],[${OPENTHREAD_ENABLE_VENDOR_EXTENSION}],[Define to 1 if using vendor extension]) AM_CONDITIONAL([OPENTHREAD_ENABLE_VENDOR_EXTENSION], [test "${OPENTHREAD_ENABLE_VENDOR_EXTENSION}" = "1"]) -# -# Legacy Network -# - -AC_ARG_ENABLE(legacy, - [AS_HELP_STRING([--enable-legacy],[Enable legacy network support @<:@default=no@:>@.])], - [ - case "${enableval}" in - - no|yes) - enable_legacy=${enableval} - ;; - - *) - AC_MSG_ERROR([Invalid value ${enable_legacy} for --enable-legacy]) - ;; - esac - ], - [enable_legacy=no]) - -if test "$enable_legacy" = "yes"; then - OPENTHREAD_ENABLE_LEGACY=1 -else - OPENTHREAD_ENABLE_LEGACY=0 -fi - -AC_MSG_CHECKING([whether to enable legacy]) -AC_MSG_RESULT(${enable_legacy}) -AC_SUBST(OPENTHREAD_ENABLE_LEGACY) -AM_CONDITIONAL([OPENTHREAD_ENABLE_LEGACY], [test "${enable_legacy}" = "yes"]) -AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_LEGACY],[${OPENTHREAD_ENABLE_LEGACY}],[Define to 1 if you want to use legacy network support]) - # # NCP Vendor Hook Source - Specify a C++ file that implements the NCP vendor hook. # @@ -956,38 +829,6 @@ AC_ARG_WITH( AC_SUBST(OPENTHREAD_CUSTOM_LINKER_FILE) AM_CONDITIONAL([OPENTHREAD_ENABLE_CUSTOM_LINKER_FILE], [test "${with_custom_linker_file}" = "yes"]) -# -# Support for ECDSA -# - -AC_MSG_CHECKING([whether to build with ECDSA support]) -AC_ARG_ENABLE(ecdsa, - [AS_HELP_STRING([--enable-ecdsa], [Enable ECDSA support @<:@default=no@:>@.])], - [ - case "${enableval}" in - - no|yes) - enable_ecdsa=${enableval} - ;; - - *) - AC_MSG_ERROR([Invalid value ${enable_ecdsa} for --enable-ecdsa]) - ;; - esac - ], - [enable_ecdsa=no]) - -if test "$enable_ecdsa" = "yes"; then - OPENTHREAD_ENABLE_ECDSA=1 -else - OPENTHREAD_ENABLE_ECDSA=0 -fi - -AC_MSG_RESULT(${enable_ecdsa}) -AC_SUBST(OPENTHREAD_ENABLE_ECDSA) -AM_CONDITIONAL([OPENTHREAD_ENABLE_ECDSA], [test "${enable_ecdsa}" = "yes"]) -AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_ECDSA], [${OPENTHREAD_ENABLE_ECDSA}], [Define to 1 if you want to enable ECDSA support]) - # # Examples # @@ -1368,12 +1209,7 @@ AC_MSG_NOTICE([ OpenThread NCP Vendor Hook Source : ${with_ncp_vendor_hook_source} OpenThread NCP Spinel Encrypter : ${with_ncp_spinel_encrypter_libs} OpenThread Vendor Extension Source : ${with_vendor_extension} - OpenThread Multiple Instances support : ${enable_multiple_instances} OpenThread builtin mbedtls support : ${enable_builtin_mbedtls} - OpenThread UDP forward support : ${enable_udp_forward} - OpenThread Jam Detection support : ${enable_jam_detection} - OpenThread Legacy network support : ${enable_legacy} - OpenThread ECDSA support : ${enable_ecdsa} OpenThread Examples : ${with_examples} OpenThread POSIX Application : ${enable_posix_app} diff --git a/examples/apps/cli/main.c b/examples/apps/cli/main.c index 312082c97..357964114 100644 --- a/examples/apps/cli/main.c +++ b/examples/apps/cli/main.c @@ -46,7 +46,7 @@ jmp_buf gResetJump; void __gcov_flush(); #endif -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE void *otPlatCAlloc(size_t aNum, size_t aSize) { return calloc(aNum, aSize); @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) } #endif -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE size_t otInstanceBufferLength = 0; uint8_t *otInstanceBuffer = NULL; #endif @@ -87,7 +87,7 @@ pseudo_reset: otSysInit(argc, argv); -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE // Call to query the buffer size (void)otInstanceInit(NULL, &otInstanceBufferLength); @@ -111,7 +111,7 @@ pseudo_reset: } otInstanceFinalize(instance); -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE free(otInstanceBuffer); #endif diff --git a/examples/apps/ncp/main.c b/examples/apps/ncp/main.c index b71aa49fa..d98221532 100644 --- a/examples/apps/ncp/main.c +++ b/examples/apps/ncp/main.c @@ -45,7 +45,7 @@ jmp_buf gResetJump; void __gcov_flush(); #endif -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE void *otPlatCAlloc(size_t aNum, size_t aSize) { return calloc(aNum, aSize); @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) } #endif -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE size_t otInstanceBufferLength = 0; uint8_t *otInstanceBuffer = NULL; #endif @@ -86,7 +86,7 @@ pseudo_reset: otSysInit(argc, argv); -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE // Call to query the buffer size (void)otInstanceInit(NULL, &otInstanceBufferLength); @@ -110,7 +110,7 @@ pseudo_reset: } otInstanceFinalize(instance); -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE free(otInstanceBuffer); #endif diff --git a/examples/common-switches.mk b/examples/common-switches.mk index 80d0b2e10..0ac5ce5b5 100644 --- a/examples/common-switches.mk +++ b/examples/common-switches.mk @@ -127,11 +127,11 @@ COMMONCFLAGS += -DOPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1 endif ifeq ($(ECDSA),1) -configure_OPTIONS += --enable-ecdsa +COMMONCFLAGS += -DOPENTHREAD_CONFIG_ECDSA_ENABLE=1 endif ifeq ($(JAM_DETECTION),1) -configure_OPTIONS += --enable-jam-detection +COMMONCFLAGS += -DOPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1 endif ifeq ($(JOINER),1) @@ -139,7 +139,7 @@ COMMONCFLAGS += -DOPENTHREAD_CONFIG_JOINER_ENABLE=1 endif ifeq ($(LEGACY),1) -configure_OPTIONS += --enable-legacy +COMMONCFLAGS += -DOPENTHREAD_CONFIG_LEGACY_ENABLE=1 endif ifeq ($(LINK_RAW),1) @@ -161,7 +161,7 @@ endif # Enable features only required for reference device during certification. ifeq ($(REFERENCE_DEVICE),1) COMMONCFLAGS += -DOPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_APP -COMMONCFLAGS += -DOPENTHREAD_ENABLE_REFERENCE_DEVICE=1 +COMMONCFLAGS += -DOPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=1 endif ifeq ($(SERVICE),1) @@ -181,7 +181,7 @@ COMMONCFLAGS += -DOPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1 -DOPENT endif ifeq ($(UDP_FORWARD),1) -configure_OPTIONS += --enable-udp-forward +COMMONCFLAGS += -DOPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1 endif ifeq ($(DISABLE_BUILTIN_MBEDTLS),1) diff --git a/include/openthread-config-android.h b/include/openthread-config-android.h index 7f7042938..02acf9eaa 100644 --- a/include/openthread-config-android.h +++ b/include/openthread-config-android.h @@ -45,13 +45,13 @@ #define OPENTHREAD_CONFIG_DTLS_ENABLE 1 /* Define to 1 if you want to use jam detection feature */ -#define OPENTHREAD_ENABLE_JAM_DETECTION 1 +#define OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE 1 /* Define to 1 to enable the joiner role. */ #define OPENTHREAD_CONFIG_JOINER_ENABLE 1 /* Define to 1 if you want to use legacy network support */ -#define OPENTHREAD_ENABLE_LEGACY 1 +#define OPENTHREAD_CONFIG_LEGACY_ENABLE 1 /* Define to 1 to enable the NCP UART interface. */ #define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1 @@ -63,7 +63,7 @@ #define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 1 /* Define to 1 to enable the UDP forward feature. */ -#define OPENTHREAD_ENABLE_UDP_FORWARD 1 +#define OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 1 /* OpenThread examples */ #define OPENTHREAD_EXAMPLES none diff --git a/include/openthread/jam_detection.h b/include/openthread/jam_detection.h index 0dc11f882..f27669ce0 100644 --- a/include/openthread/jam_detection.h +++ b/include/openthread/jam_detection.h @@ -47,8 +47,8 @@ extern "C" { * @brief * This module includes functions for signal jamming detection feature. * - * The functions in this module are available when jam-detection feature (`OPENTHREAD_ENABLE_JAM_DETECTION`) is - * enabled. + * The functions in this module are available when jam-detection feature (`OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE`) + * is enabled. * * @{ * diff --git a/include/openthread/udp.h b/include/openthread/udp.h index 496239985..168c63cda 100644 --- a/include/openthread/udp.h +++ b/include/openthread/udp.h @@ -251,7 +251,8 @@ otError otUdpSend(otUdpSocket *aSocket, otMessage *aMessage, const otMessageInfo * @brief * This module includes functions for UDP forward feature. * - * The functions in this module are available when udp-forward feature (`OPENTHREAD_ENABLE_UDP_FORWARD`) is enabled. + * The functions in this module are available when udp-forward feature (`OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE`) is + * enabled. * * @{ * diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index ab04a0fc3..1fa6ed457 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -3555,7 +3555,7 @@ void Interpreter::SetUserCommands(const otCliCommand *aCommands, uint8_t aLength Interpreter &Interpreter::GetOwner(OwnerLocator &aOwnerLocator) { -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE Interpreter &interpreter = (aOwnerLocator.GetOwner()); #else OT_UNUSED_VARIABLE(aOwnerLocator); @@ -3610,7 +3610,7 @@ exit: } // namespace Cli } // namespace ot -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE OT_TOOL_WEAK void otNcpRegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers) { OT_UNUSED_VARIABLE(aHandlers); @@ -3625,4 +3625,4 @@ OT_TOOL_WEAK void otNcpHandleLegacyNodeDidJoin(const otExtAddress *aExtAddr) { OT_UNUSED_VARIABLE(aExtAddr); } -#endif // OPENTHREAD_ENABLE_LEGACY +#endif // OPENTHREAD_CONFIG_LEGACY_ENABLE diff --git a/src/cli/cli_uart.cpp b/src/cli/cli_uart.cpp index 1366aa193..327150fee 100644 --- a/src/cli/cli_uart.cpp +++ b/src/cli/cli_uart.cpp @@ -218,7 +218,7 @@ otError Uart::ProcessCommand(void) * Thus this is here to affirmatively LOG exactly when the CLI * command is being executed. */ -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE /* TODO: how exactly do we get the instance here? */ #else otLogInfoCli("execute command: %s", mRxBuffer); diff --git a/src/core/api/crypto_api.cpp b/src/core/api/crypto_api.cpp index 2c2c2776b..835979d32 100644 --- a/src/core/api/crypto_api.cpp +++ b/src/core/api/crypto_api.cpp @@ -95,7 +95,7 @@ exit: return; } -#if OPENTHREAD_ENABLE_ECDSA +#if OPENTHREAD_CONFIG_ECDSA_ENABLE otError otCryptoEcdsaSign(uint8_t * aOutput, uint16_t * aOutputLength, @@ -107,4 +107,4 @@ otError otCryptoEcdsaSign(uint8_t * aOutput, return Ecdsa::Sign(aOutput, aOutputLength, aInputHash, aInputHashLength, aPrivateKey, aPrivateKeyLength); } -#endif // OPENTHREAD_ENABLE_ECDSA +#endif // OPENTHREAD_CONFIG_ECDSA_ENABLE diff --git a/src/core/api/instance_api.cpp b/src/core/api/instance_api.cpp index 2c95ea5c5..13525113a 100644 --- a/src/core/api/instance_api.cpp +++ b/src/core/api/instance_api.cpp @@ -44,7 +44,7 @@ using namespace ot; -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE otInstance *otInstanceInit(void *aInstanceBuffer, size_t *aInstanceBufferSize) { Instance *instance; @@ -59,7 +59,7 @@ otInstance *otInstanceInitSingle(void) { return &Instance::InitSingle(); } -#endif // #if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#endif // #if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE bool otInstanceIsInitialized(otInstance *aInstance) { diff --git a/src/core/api/jam_detection_api.cpp b/src/core/api/jam_detection_api.cpp index 738dccc2c..6adcb14ea 100644 --- a/src/core/api/jam_detection_api.cpp +++ b/src/core/api/jam_detection_api.cpp @@ -40,7 +40,7 @@ using namespace ot; -#if OPENTHREAD_ENABLE_JAM_DETECTION +#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE otError otJamDetectionSetRssiThreshold(otInstance *aInstance, int8_t aRssiThreshold) { @@ -121,4 +121,4 @@ uint64_t otJamDetectionGetHistoryBitmap(otInstance *aInstance) return instance.Get().GetHistoryBitmap(); } -#endif // OPENTHREAD_ENABLE_JAM_DETECTION +#endif // OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE diff --git a/src/core/api/logging_api.cpp b/src/core/api/logging_api.cpp index 1dfb2f2ee..31a88f545 100644 --- a/src/core/api/logging_api.cpp +++ b/src/core/api/logging_api.cpp @@ -40,7 +40,7 @@ using namespace ot; otLogLevel otLoggingGetLevel(void) -#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL && !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL && !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE { return Instance::Get().GetLogLevel(); } @@ -57,8 +57,8 @@ otError otLoggingSetLevel(otLogLevel aLogLevel) otError error = OT_ERROR_DISABLED_FEATURE; #if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES -#warning "Dynamic log level is not supported along with multiple OT instance feature (`ENABLE_MULTIPLE_INSTANCES`)" +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE +#warning "Dynamic log level is not supported along with multiple OT instance feature" #else Instance::Get().SetLogLevel(aLogLevel); error = OT_ERROR_NONE; diff --git a/src/core/api/udp_api.cpp b/src/core/api/udp_api.cpp index 30d08156f..1b38cd6d2 100644 --- a/src/core/api/udp_api.cpp +++ b/src/core/api/udp_api.cpp @@ -97,7 +97,7 @@ otError otUdpSend(otUdpSocket *aSocket, otMessage *aMessage, const otMessageInfo return socket.SendTo(*static_cast(aMessage), *static_cast(aMessageInfo)); } -#if OPENTHREAD_ENABLE_UDP_FORWARD +#if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE void otUdpForwardSetForwarder(otInstance *aInstance, otUdpForwarder aForwarder, void *aContext) { Instance &instance = *static_cast(aInstance); @@ -126,7 +126,7 @@ void otUdpForwardReceive(otInstance * aInstance, static_cast(aMessage)->Free(); } -#endif // OPENTHREAD_ENABLE_UDP_FORWARD +#endif // OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE #if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE otUdpSocket *otUdpGetSockets(otInstance *aInstance) diff --git a/src/core/common/instance.cpp b/src/core/common/instance.cpp index 2c2745efd..7d6fe2f43 100644 --- a/src/core/common/instance.cpp +++ b/src/core/common/instance.cpp @@ -41,7 +41,7 @@ namespace ot { -#if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE // Define the raw storage used for OpenThread instance (in single-instance case). otDEFINE_ALIGNED_VAR(gInstanceRaw, sizeof(Instance), uint64_t); @@ -55,7 +55,7 @@ Instance::Instance(void) , mTimerMicroScheduler(*this) #endif #if OPENTHREAD_MTD || OPENTHREAD_FTD -#if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE , mHeap() #endif , mMbedTls() @@ -103,7 +103,7 @@ Instance::Instance(void) { } -#if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE Instance &Instance::InitSingle(void) { @@ -126,7 +126,7 @@ Instance &Instance::Get(void) return *static_cast(instance); } -#else // #if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#else // #if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE Instance *Instance::Init(void *aBuffer, size_t *aBufferSize) { @@ -147,7 +147,7 @@ exit: return instance; } -#endif // OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#endif // OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE void Instance::Reset(void) { @@ -185,7 +185,7 @@ void Instance::Finalize(void) Get().Deinit(); #endif -#if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE /** * Object was created on buffer, so instead of deleting @@ -193,7 +193,7 @@ void Instance::Finalize(void) */ this->~Instance(); -#endif // !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#endif // !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE exit: return; diff --git a/src/core/common/instance.hpp b/src/core/common/instance.hpp index 7cc65ab15..ec4e0ebc8 100644 --- a/src/core/common/instance.hpp +++ b/src/core/common/instance.hpp @@ -54,7 +54,7 @@ #include "coap/coap.hpp" #include "common/code_utils.hpp" #include "crypto/mbedtls.hpp" -#if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE #include "utils/heap.hpp" #endif #include "common/notifier.hpp" @@ -104,7 +104,7 @@ namespace ot { class Instance : public otInstance { public: -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE /** * This static method initializes the OpenThread instance. * @@ -119,7 +119,7 @@ public: */ static Instance *Init(void *aBuffer, size_t *aBufferSize); -#else // OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#else // OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE /** * This static method initializes the single OpenThread instance. @@ -249,7 +249,7 @@ public: */ void InvokeEnergyScanCallback(otEnergyScanResult *aResult) const; -#if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE /** * This method returns a reference to the Heap object. * @@ -315,7 +315,7 @@ private: #if OPENTHREAD_MTD || OPENTHREAD_FTD // RandomManager is initialized before other objects. Note that it // requires MbedTls which itself may use Heap. -#if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE Utils::Heap mHeap; #endif Crypto::MbedTls mMbedTls; @@ -619,7 +619,7 @@ template <> inline Utils::Slaac &Instance::Get(void) } #endif -#if OPENTHREAD_ENABLE_JAM_DETECTION +#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE template <> inline Utils::JamDetector &Instance::Get(void) { return mThreadNetif.mJamDetector; diff --git a/src/core/common/locator-getters.hpp b/src/core/common/locator-getters.hpp index 7e22a9851..43ed54cf0 100644 --- a/src/core/common/locator-getters.hpp +++ b/src/core/common/locator-getters.hpp @@ -63,7 +63,7 @@ template inline Type &InstanceLocator::Get(void) const return GetInstance().Get(); } -#if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE template OwnerType &OwnerLocator::GetOwner(void) { diff --git a/src/core/common/locator.hpp b/src/core/common/locator.hpp index f9e27ddf5..cf2201313 100644 --- a/src/core/common/locator.hpp +++ b/src/core/common/locator.hpp @@ -44,7 +44,7 @@ namespace ot { class Instance; -#if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE extern uint64_t gInstanceRaw[]; #endif @@ -78,7 +78,7 @@ public: * @returns A reference to the parent otInstance. * */ -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE Instance &GetInstance(void) const { return mInstance; } #else Instance &GetInstance(void) const { return *reinterpret_cast(&gInstanceRaw); } @@ -105,14 +105,14 @@ protected: * */ explicit InstanceLocator(Instance &aInstance) -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE : mInstance(aInstance) #endif { OT_UNUSED_VARIABLE(aInstance); } -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE private: Instance &mInstance; #endif @@ -136,7 +136,7 @@ public: * */ template OwnerType &GetOwner(void) -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE { return *static_cast(mOwner); } @@ -153,14 +153,14 @@ protected: * */ explicit OwnerLocator(void *aOwner) -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE : mOwner(aOwner) #endif { OT_UNUSED_VARIABLE(aOwner); } -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE private: void *mOwner; #endif diff --git a/src/core/common/logging.hpp b/src/core/common/logging.hpp index eb41d1797..4b19e5661 100644 --- a/src/core/common/logging.hpp +++ b/src/core/common/logging.hpp @@ -1020,7 +1020,7 @@ extern "C" { * * */ -#if OPENTHREAD_ENABLE_REFERENCE_DEVICE +#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE #define otLogCertMeshCoP(aFormat, ...) \ _otLogFormatter(OT_LOG_LEVEL_NONE, OT_LOG_REGION_MESH_COP, aFormat, ##__VA_ARGS__) #else @@ -1858,7 +1858,7 @@ extern "C" { * @param[in] aLength Number of bytes to print. * */ -#if OPENTHREAD_ENABLE_REFERENCE_DEVICE +#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE #define otDumpCertMeshCoP(aId, aBuf, aLength) otDump(OT_LOG_LEVEL_NONE, OT_LOG_REGION_MESH_COP, aId, aBuf, aLength) #else #define otDumpCertMeshCoP(aId, aBuf, aLength) diff --git a/src/core/config/openthread-core-config-check.h b/src/core/config/openthread-core-config-check.h index b9632f23d..9718b9957 100644 --- a/src/core/config/openthread-core-config-check.h +++ b/src/core/config/openthread-core-config-check.h @@ -34,8 +34,8 @@ #ifndef OPENTHREAD_CORE_CONFIG_CHECK_H_ #define OPENTHREAD_CORE_CONFIG_CHECK_H_ -#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE && OPENTHREAD_ENABLE_UDP_FORWARD -#error "OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE and OPENTHREAD_ENABLE_UDP_FORWARD must not both be set." +#if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE && OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE +#error "OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE and OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE must not both be set." #endif /* @@ -66,6 +66,6 @@ #endif #ifdef OPENTHREAD_ENABLE_CERT_LOG -#error "OPENTHREAD_ENABLE_CERT_LOG was replaced by OPENTHREAD_ENABLE_REFERENCE_DEVICE." +#error "OPENTHREAD_ENABLE_CERT_LOG was replaced by OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE." #endif #endif // OPENTHREAD_CORE_CONFIG_CHECK_H_ diff --git a/src/core/config/openthread-core-default-config.h b/src/core/config/openthread-core-default-config.h index 4658935a1..950b54d07 100644 --- a/src/core/config/openthread-core-default-config.h +++ b/src/core/config/openthread-core-default-config.h @@ -6,7 +6,7 @@ * 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 + >* 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 @@ -75,6 +75,86 @@ #define OPENTHREAD_CONFIG_STACK_VERSION_MINOR 1 #endif +/** + * @def OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE + * + * Define to 1 to enable the Border Agent service. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE +#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE + * + * Define to 1 to enable the Border Router service. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE +#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 0 +#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_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_ENABLE_POSIX_APP_DAEMON + * + * Define to 1 to enable posix-app daemon support. + * + */ +#ifndef OPENTHREAD_ENABLE_POSIX_APP_DAEMON +#define OPENTHREAD_ENABLE_POSIX_APP_DAEMON 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_NUM_MESSAGE_BUFFERS * @@ -326,4 +406,14 @@ #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 + #endif // OPENTHREAD_CORE_DEFAULT_CONFIG_H_ diff --git a/src/core/crypto/ecdsa.cpp b/src/core/crypto/ecdsa.cpp index 58d8fa981..1d84efd51 100644 --- a/src/core/crypto/ecdsa.cpp +++ b/src/core/crypto/ecdsa.cpp @@ -44,7 +44,7 @@ namespace ot { namespace Crypto { -#if OPENTHREAD_ENABLE_ECDSA +#if OPENTHREAD_CONFIG_ECDSA_ENABLE otError Ecdsa::Sign(uint8_t * aOutput, uint16_t * aOutputLength, @@ -98,7 +98,7 @@ exit: return error; } -#endif // OPENTHREAD_ENABLE_ECDSA +#endif // OPENTHREAD_CONFIG_ECDSA_ENABLE } // namespace Crypto } // namespace ot diff --git a/src/core/crypto/mbedtls.cpp b/src/core/crypto/mbedtls.cpp index 768fb35a4..a1113c3be 100644 --- a/src/core/crypto/mbedtls.cpp +++ b/src/core/crypto/mbedtls.cpp @@ -49,7 +49,7 @@ namespace ot { namespace Crypto { -#if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES && OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS +#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE && OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS static void *CAlloc(size_t aCount, size_t aSize) { @@ -61,17 +61,17 @@ static void Free(void *aPointer) Instance::Get().GetHeap().Free(aPointer); } -#endif // !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES && OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS +#endif // !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE && OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS MbedTls::MbedTls(void) { -#if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES && OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS +#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE && OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS #ifdef MBEDTLS_DEBUG_C // mbedTLS's debug level is almost the same as OpenThread's mbedtls_debug_set_threshold(OPENTHREAD_CONFIG_LOG_LEVEL); #endif mbedtls_platform_set_calloc_free(CAlloc, Free); -#endif // !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES && OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS +#endif // !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE && OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS } otError MbedTls::MapError(int rval) diff --git a/src/core/meshcop/commissioner.cpp b/src/core/meshcop/commissioner.cpp index c55225483..a22294c22 100644 --- a/src/core/meshcop/commissioner.cpp +++ b/src/core/meshcop/commissioner.cpp @@ -953,7 +953,7 @@ void Commissioner::HandleJoinerFinalize(Coap::Message &aMessage, const Ip6::Mess } } -#if OPENTHREAD_ENABLE_REFERENCE_DEVICE +#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE if (aMessage.GetLength() <= OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE) { uint8_t buf[OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE]; @@ -990,7 +990,7 @@ void Commissioner::SendJoinFinalizeResponse(const Coap::Message &aRequest, State joinerMessageInfo.GetPeerAddr().SetIid(mJoinerIid); joinerMessageInfo.SetPeerPort(mJoinerPort); -#if OPENTHREAD_ENABLE_REFERENCE_DEVICE +#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE uint8_t buf[OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE]; VerifyOrExit(message->GetLength() <= sizeof(buf)); diff --git a/src/core/meshcop/joiner.cpp b/src/core/meshcop/joiner.cpp index c0bdc2637..c3b56e189 100644 --- a/src/core/meshcop/joiner.cpp +++ b/src/core/meshcop/joiner.cpp @@ -463,7 +463,7 @@ void Joiner::SendJoinerFinalize(void) { assert(mFinalizeMessage != NULL); -#if OPENTHREAD_ENABLE_REFERENCE_DEVICE +#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE LogCertMessage("[THCI] direction=send | type=JOIN_FIN.req |", *mFinalizeMessage); #endif @@ -504,7 +504,7 @@ void Joiner::HandleJoinerFinalizeResponse(Coap::Message & aMessage, otLogInfoMeshCoP("Joiner received finalize response %d", static_cast(state.GetState())); -#if OPENTHREAD_ENABLE_REFERENCE_DEVICE +#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE LogCertMessage("[THCI] direction=recv | type=JOIN_FIN.rsp |", aMessage); #endif @@ -668,7 +668,7 @@ const char *Joiner::JoinerStateToString(otJoinerState aState) return str; } -#if OPENTHREAD_ENABLE_REFERENCE_DEVICE +#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE void Joiner::LogCertMessage(const char *aText, const Coap::Message &aMessage) const { uint8_t buf[OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE]; diff --git a/src/core/meshcop/joiner.hpp b/src/core/meshcop/joiner.hpp index 5e83c61f0..95bf0360a 100644 --- a/src/core/meshcop/joiner.hpp +++ b/src/core/meshcop/joiner.hpp @@ -162,7 +162,7 @@ private: void SendJoinerFinalize(void); void SendJoinerEntrustResponse(const Coap::Message &aRequest, const Ip6::MessageInfo &aRequestInfo); -#if OPENTHREAD_ENABLE_REFERENCE_DEVICE +#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE void LogCertMessage(const char *aText, const Coap::Message &aMessage) const; #endif diff --git a/src/core/net/udp6.cpp b/src/core/net/udp6.cpp index 13f0c2fcf..d583f5ff6 100644 --- a/src/core/net/udp6.cpp +++ b/src/core/net/udp6.cpp @@ -206,7 +206,7 @@ Udp::Udp(Instance &aInstance) , mEphemeralPort(kDynamicPortMin) , mReceivers(NULL) , mSockets(NULL) -#if OPENTHREAD_ENABLE_UDP_FORWARD +#if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE , mUdpForwarderContext(NULL) , mUdpForwarder(NULL) #endif @@ -322,7 +322,7 @@ otError Udp::SendDatagram(Message &aMessage, MessageInfo &aMessageInfo, IpProto { otError error = OT_ERROR_NONE; -#if OPENTHREAD_ENABLE_UDP_FORWARD +#if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE if (aMessageInfo.IsHostInterface()) { VerifyOrExit(mUdpForwarder != NULL, error = OT_ERROR_NO_ROUTE); diff --git a/src/core/net/udp6.hpp b/src/core/net/udp6.hpp index 4512624e0..51402bffc 100644 --- a/src/core/net/udp6.hpp +++ b/src/core/net/udp6.hpp @@ -332,7 +332,7 @@ public: otUdpSocket *GetUdpSockets(void) { return mSockets; } #endif -#if OPENTHREAD_ENABLE_UDP_FORWARD +#if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE /** * This method sets the forward sender. * @@ -345,7 +345,7 @@ public: mUdpForwarder = aForwarder; mUdpForwarderContext = aContext; } -#endif // OPENTHREAD_ENABLE_UDP_FORWARD +#endif // OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE private: enum @@ -357,7 +357,7 @@ private: uint16_t mEphemeralPort; UdpReceiver *mReceivers; UdpSocket * mSockets; -#if OPENTHREAD_ENABLE_UDP_FORWARD +#if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE void * mUdpForwarderContext; otUdpForwarder mUdpForwarder; #endif diff --git a/src/core/thread/thread_netif.cpp b/src/core/thread/thread_netif.cpp index 741af5239..0bd37680c 100644 --- a/src/core/thread/thread_netif.cpp +++ b/src/core/thread/thread_netif.cpp @@ -92,9 +92,9 @@ ThreadNetif::ThreadNetif(Instance &aInstance) #if OPENTHREAD_CONFIG_JOINER_ENABLE , mJoiner(aInstance) #endif // OPENTHREAD_CONFIG_JOINER_ENABLE -#if OPENTHREAD_ENABLE_JAM_DETECTION +#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE , mJamDetector(aInstance) -#endif // OPENTHREAD_ENABLE_JAM_DETECTION +#endif // OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE #if OPENTHREAD_FTD , mJoinerRouter(aInstance) , mLeader(aInstance) diff --git a/src/core/thread/thread_netif.hpp b/src/core/thread/thread_netif.hpp index 8d0eee66e..46aa3d025 100644 --- a/src/core/thread/thread_netif.hpp +++ b/src/core/thread/thread_netif.hpp @@ -79,9 +79,9 @@ #include "utils/slaac_address.hpp" #endif -#if OPENTHREAD_ENABLE_JAM_DETECTION +#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE #include "utils/jam_detector.hpp" -#endif // OPENTHREAD_ENABLE_JAM_DETECTION +#endif // OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE namespace ot { @@ -211,9 +211,9 @@ private: MeshCoP::Joiner mJoiner; #endif // OPENTHREAD_CONFIG_JOINER_ENABLE -#if OPENTHREAD_ENABLE_JAM_DETECTION +#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE Utils::JamDetector mJamDetector; -#endif // OPENTHREAD_ENABLE_JAM_DETECTION +#endif // OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE #if OPENTHREAD_FTD MeshCoP::JoinerRouter mJoinerRouter; diff --git a/src/core/utils/jam_detector.cpp b/src/core/utils/jam_detector.cpp index 39a7d5a34..35b7ec9e3 100644 --- a/src/core/utils/jam_detector.cpp +++ b/src/core/utils/jam_detector.cpp @@ -40,7 +40,7 @@ #include "common/random.hpp" #include "thread/thread_netif.hpp" -#if OPENTHREAD_ENABLE_JAM_DETECTION +#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE namespace ot { namespace Utils { @@ -286,4 +286,4 @@ void JamDetector::HandleStateChanged(otChangedFlags aFlags) } // namespace Utils } // namespace ot -#endif // OPENTHREAD_ENABLE_JAM_DETECTION +#endif // OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE diff --git a/src/ncp/changed_props_set.cpp b/src/ncp/changed_props_set.cpp index 5c4bac523..c266053f7 100644 --- a/src/ncp/changed_props_set.cpp +++ b/src/ncp/changed_props_set.cpp @@ -65,10 +65,10 @@ const ChangedPropsSet::Entry ChangedPropsSet::mSupportedProps[] = { {SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING, SPINEL_STATUS_OK, true}, {SPINEL_PROP_LAST_STATUS, SPINEL_STATUS_NOMEM, true}, {SPINEL_PROP_LAST_STATUS, SPINEL_STATUS_DROPPED, true}, -#if OPENTHREAD_ENABLE_JAM_DETECTION +#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE {SPINEL_PROP_JAM_DETECTED, SPINEL_STATUS_OK, true}, #endif -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE {SPINEL_PROP_NEST_LEGACY_ULA_PREFIX, SPINEL_STATUS_OK, true}, {SPINEL_PROP_NEST_LEGACY_LAST_NODE_JOINED, SPINEL_STATUS_OK, true}, #endif diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index a9504d0c3..801c3d51f 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -269,7 +269,7 @@ NcpBase::NcpBase(Instance *aInstance) #if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE otNetworkTimeSyncSetCallback(mInstance, &NcpBase::HandleTimeSyncUpdate, this); #endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE -#if OPENTHREAD_ENABLE_UDP_FORWARD +#if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE otUdpForwardSetForwarder(mInstance, &NcpBase::HandleUdpForwardStream, this); #endif otIcmp6SetEchoMode(mInstance, OT_ICMP6_ECHO_HANDLER_DISABLED); @@ -280,7 +280,7 @@ NcpBase::NcpBase(Instance *aInstance) #endif otThreadRegisterParentResponseCallback(mInstance, &NcpBase::HandleParentResponseInfo, static_cast(this)); #endif // OPENTHREAD_FTD -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE mLegacyNodeDidJoin = false; mLegacyHandlers = NULL; memset(mLegacyUlaPrefix, 0, sizeof(mLegacyUlaPrefix)); @@ -1761,7 +1761,7 @@ template <> otError NcpBase::HandlePropertyGet(void) SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_MAC_WHITELIST)); #endif -#if OPENTHREAD_ENABLE_JAM_DETECTION +#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_JAM_DETECT)); #endif @@ -1803,7 +1803,7 @@ template <> otError NcpBase::HandlePropertyGet(void) SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_ROLE_SLEEPY)); -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_NEST_LEGACY_INTERFACE)); #endif @@ -1819,7 +1819,7 @@ template <> otError NcpBase::HandlePropertyGet(void) SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_THREAD_BORDER_ROUTER)); #endif -#if OPENTHREAD_ENABLE_UDP_FORWARD +#if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_THREAD_UDP_FORWARD)); #endif diff --git a/src/ncp/ncp_base.hpp b/src/ncp/ncp_base.hpp index c75a4c3ad..f640c2130 100644 --- a/src/ncp/ncp_base.hpp +++ b/src/ncp/ncp_base.hpp @@ -130,7 +130,7 @@ public: #endif #if OPENTHREAD_MTD || OPENTHREAD_FTD -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE /** * This callback is invoked by the legacy stack to notify that a new * legacy node did join the network. @@ -336,14 +336,14 @@ protected: otError EncodeChildInfo(const otChildInfo &aChildInfo); #endif -#if OPENTHREAD_ENABLE_UDP_FORWARD +#if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE static void HandleUdpForwardStream(otMessage * aMessage, uint16_t aPeerPort, otIp6Address *aPeerAddr, uint16_t aSockPort, void * aContext); void HandleUdpForwardStream(otMessage *aMessage, uint16_t aPeerPort, otIp6Address &aPeerAddr, uint16_t aPort); -#endif // OPENTHREAD_ENABLE_UDP_FORWARD +#endif // OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE #endif // OPENTHREAD_MTD || OPENTHREAD_FTD otError CommandHandler_NOOP(uint8_t aHeader); @@ -424,7 +424,7 @@ protected: otError HandlePropertySet_SPINEL_PROP_STREAM_RAW(uint8_t aHeader); #endif -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE void StartLegacy(void); void StopLegacy(void); #else @@ -581,7 +581,7 @@ protected: uint32_t mOutboundInsecureIpFrameCounter; // Number of insecure outbound data/IP frames. uint32_t mDroppedOutboundIpFrameCounter; // Number of dropped outbound data/IP frames. uint32_t mDroppedInboundIpFrameCounter; // Number of dropped inbound data/IP frames. -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE const otNcpLegacyHandlers *mLegacyHandlers; uint8_t mLegacyUlaPrefix[OT_NCP_LEGACY_ULA_PREFIX_LENGTH]; otExtAddress mLegacyLastJoinedNode; diff --git a/src/ncp/ncp_base_dispatcher.cpp b/src/ncp/ncp_base_dispatcher.cpp index 21595d904..cf17708d7 100644 --- a/src/ncp/ncp_base_dispatcher.cpp +++ b/src/ncp/ncp_base_dispatcher.cpp @@ -313,7 +313,7 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey) case SPINEL_PROP_IPV6_ROUTE_TABLE: handler = &NcpBase::HandlePropertyGet; break; -#if OPENTHREAD_ENABLE_JAM_DETECTION +#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE case SPINEL_PROP_JAM_DETECT_ENABLE: handler = &NcpBase::HandlePropertyGet; break; @@ -350,7 +350,7 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey) handler = &NcpBase::HandlePropertyGet; break; #endif -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE case SPINEL_PROP_NEST_LEGACY_ULA_PREFIX: handler = &NcpBase::HandlePropertyGet; break; @@ -837,7 +837,7 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey) handler = &NcpBase::HandlePropertySet; break; -#if OPENTHREAD_ENABLE_JAM_DETECTION +#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE case SPINEL_PROP_JAM_DETECT_ENABLE: handler = &NcpBase::HandlePropertySet; break; @@ -851,7 +851,7 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey) handler = &NcpBase::HandlePropertySet; break; #endif -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE case SPINEL_PROP_NEST_LEGACY_ULA_PREFIX: handler = &NcpBase::HandlePropertySet; break; @@ -918,7 +918,7 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey) handler = &NcpBase::HandlePropertySet; break; #endif -#if OPENTHREAD_ENABLE_UDP_FORWARD +#if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE case SPINEL_PROP_THREAD_UDP_FORWARD_STREAM: handler = &NcpBase::HandlePropertySet; break; diff --git a/src/ncp/ncp_base_mtd.cpp b/src/ncp/ncp_base_mtd.cpp index 2dcc5d1fa..cf0f43239 100644 --- a/src/ncp/ncp_base_mtd.cpp +++ b/src/ncp/ncp_base_mtd.cpp @@ -45,7 +45,7 @@ #endif #include #include -#if OPENTHREAD_ENABLE_JAM_DETECTION +#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE #include #endif #include @@ -1992,7 +1992,7 @@ exit: return error; } -#if OPENTHREAD_ENABLE_JAM_DETECTION +#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE template <> otError NcpBase::HandlePropertyGet(void) { @@ -2096,7 +2096,7 @@ void NcpBase::HandleJamStateChange(bool aJamState) mUpdateChangedPropsTask.Post(); } -#endif // OPENTHREAD_ENABLE_JAM_DETECTION +#endif // OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE #if OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE @@ -3076,7 +3076,7 @@ exit: #endif // OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE void NcpBase::RegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers) { @@ -3183,7 +3183,7 @@ void NcpBase::StopLegacy(void) } } -#endif // OPENTHREAD_ENABLE_LEGACY +#endif // OPENTHREAD_CONFIG_LEGACY_ENABLE #if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE template <> otError NcpBase::HandlePropertyGet(void) @@ -3435,7 +3435,7 @@ exit: return error; } -#if OPENTHREAD_ENABLE_UDP_FORWARD +#if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE template <> otError NcpBase::HandlePropertySet(void) { const uint8_t * framePtr = NULL; @@ -3509,7 +3509,7 @@ exit: otMessageFree(aMessage); } } -#endif // OPENTHREAD_ENABLE_UDP_FORWARD +#endif // OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE // ---------------------------------------------------------------------------- // MARK: Pcap frame handling @@ -3646,7 +3646,7 @@ void NcpBase::ProcessThreadChangedFlags(void) } if ((otThreadGetDeviceRole(mInstance) == OT_DEVICE_ROLE_LEADER) && otThreadIsSingleton(mInstance) -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE && !mLegacyNodeDidJoin #endif ) @@ -3718,7 +3718,7 @@ exit: void otNcpRegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers) { -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE ot::Ncp::NcpBase *ncp = ot::Ncp::NcpBase::GetNcpInstance(); if (ncp != NULL) @@ -3733,7 +3733,7 @@ void otNcpRegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers) void otNcpHandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix) { -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE ot::Ncp::NcpBase *ncp = ot::Ncp::NcpBase::GetNcpInstance(); if (ncp != NULL) @@ -3748,7 +3748,7 @@ void otNcpHandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix) void otNcpHandleLegacyNodeDidJoin(const otExtAddress *aExtAddr) { -#if OPENTHREAD_ENABLE_LEGACY +#if OPENTHREAD_CONFIG_LEGACY_ENABLE ot::Ncp::NcpBase *ncp = ot::Ncp::NcpBase::GetNcpInstance(); if (ncp != NULL) diff --git a/tests/toranj/build.sh b/tests/toranj/build.sh index 7ea8d4a8b..7187a1650 100755 --- a/tests/toranj/build.sh +++ b/tests/toranj/build.sh @@ -79,8 +79,6 @@ configure_options=" \ --disable-tests \ --enable-coverage=$coverage \ --enable-ftd \ - --enable-jam-detection \ - --enable-legacy \ --enable-ncp \ " diff --git a/tests/toranj/openthread-core-toranj-config.h b/tests/toranj/openthread-core-toranj-config.h index db728468c..c525418b9 100644 --- a/tests/toranj/openthread-core-toranj-config.h +++ b/tests/toranj/openthread-core-toranj-config.h @@ -88,6 +88,22 @@ */ #define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 1 +/** + * @def OPENTHREAD_CONFIG_LEGACY_ENABLE + * + * Define to 1 to enable legacy network support. + * + */ +#define OPENTHREAD_CONFIG_LEGACY_ENABLE 1 + +/** + * @def OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE + * + * Define to 1 to enable the Jam Detection service. + * + */ +#define OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE 1 + /** * @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS * diff --git a/tests/unit/test_platform.cpp b/tests/unit/test_platform.cpp index 2143ce4ed..3e1df85f5 100644 --- a/tests/unit/test_platform.cpp +++ b/tests/unit/test_platform.cpp @@ -71,7 +71,7 @@ ot::Instance *testInitInstance(void) { otInstance *instance = NULL; -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE size_t instanceBufferLength = 0; uint8_t *instanceBuffer = NULL; @@ -96,7 +96,7 @@ void testFreeInstance(otInstance *aInstance) { otInstanceFinalize(aInstance); -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE free(aInstance); #endif } @@ -105,7 +105,7 @@ bool sDiagMode = false; extern "C" { -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE void *otPlatCAlloc(size_t aNum, size_t aSize) { return calloc(aNum, aSize); diff --git a/third_party/mbedtls/mbedtls-config.h b/third_party/mbedtls/mbedtls-config.h index ee2fad91b..b933933a2 100644 --- a/third_party/mbedtls/mbedtls-config.h +++ b/third_party/mbedtls/mbedtls-config.h @@ -99,7 +99,7 @@ #define MBEDTLS_X509_CRT_PARSE_C #endif -#if OPENTHREAD_ENABLE_ECDSA +#if OPENTHREAD_ECDSA_ENABLE #define MBEDTLS_BASE64_C #define MBEDTLS_ECDH_C #define MBEDTLS_ECDSA_C @@ -114,7 +114,7 @@ #define MBEDTLS_ECP_FIXED_POINT_OPTIM 0 /**< Enable fixed-point speed-up */ #define MBEDTLS_ENTROPY_MAX_SOURCES 1 /**< Maximum number of sources supported */ -#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE #define MBEDTLS_PLATFORM_STD_CALLOC otPlatCAlloc /**< Default allocator to use, can be undefined */ #define MBEDTLS_PLATFORM_STD_FREE otPlatFree /**< Default free to use, can be undefined */ #else