From 149640da499509c64a4ab9a0ebaf3abb3b6b01c5 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Tue, 16 Jul 2019 11:06:03 -0700 Subject: [PATCH] [config] tmf (#4020) --- .travis/script.sh | 13 +- Android.mk | 2 +- Makefile.am | 1 - configure.ac | 64 ------- examples/common-switches.mk | 4 +- .../openthread-core-nrf52811-config.h | 6 +- .../openthread-core-nrf52840-config.h | 6 +- include/openthread-config-android.h | 2 +- src/cli/cli.cpp | 24 +-- src/cli/cli.hpp | 8 +- src/core/Makefile.am | 1 + src/core/api/server_api.cpp | 6 +- src/core/api/thread_api.cpp | 4 +- src/core/common/instance.hpp | 4 +- .../config/openthread-core-config-check.h | 2 +- .../config/openthread-core-default-config.h | 92 ---------- src/core/config/tmf.h | 163 ++++++++++++++++++ src/core/meshcop/energy_scan_client.cpp | 2 +- src/core/meshcop/meshcop_tlvs.hpp | 4 +- src/core/openthread-core-config.h | 1 + src/core/thread/address_resolver.hpp | 8 +- src/core/thread/energy_scan_server.hpp | 2 +- src/core/thread/mesh_forwarder_ftd.cpp | 6 +- src/core/thread/mle.cpp | 14 +- src/core/thread/mle.hpp | 8 +- src/core/thread/mle_router.cpp | 2 +- src/core/thread/network_data.cpp | 12 +- src/core/thread/network_data.hpp | 8 +- src/core/thread/network_data_leader_ftd.cpp | 22 +-- src/core/thread/network_data_leader_ftd.hpp | 6 +- src/core/thread/network_data_local.cpp | 14 +- src/core/thread/network_data_local.hpp | 6 +- src/core/thread/network_diagnostic.cpp | 4 +- src/core/thread/thread_netif.cpp | 4 +- src/core/thread/thread_netif.hpp | 8 +- src/ncp/ncp_base.cpp | 4 +- src/ncp/ncp_base.hpp | 2 +- src/ncp/ncp_base_dispatcher.cpp | 8 +- src/ncp/ncp_base_mtd.cpp | 6 +- tests/toranj/build.sh | 1 - tests/toranj/openthread-core-toranj-config.h | 20 ++- 41 files changed, 293 insertions(+), 281 deletions(-) create mode 100644 src/core/config/tmf.h diff --git a/.travis/script.sh b/.travis/script.sh index 9ad0ae6b2..03fdd0206 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -72,7 +72,9 @@ python --version || die -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_SNTP_CLIENT_ENABLE=1 \ + -DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1 \ + -DOPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1" scan-build ./configure \ --enable-builtin-mbedtls=no \ @@ -84,10 +86,8 @@ python --version || die --enable-jam-detection \ --enable-legacy \ --enable-mtd \ - --enable-mtd-network-diagnostic \ --enable-ncp \ --enable-radio-only \ - --enable-service \ --enable-udp-forward \ --with-examples=posix || die @@ -104,10 +104,8 @@ python --version || die --enable-jam-detection \ --enable-legacy \ --enable-mtd \ - --enable-mtd-network-diagnostic \ --enable-ncp \ --enable-radio-only \ - --enable-service \ --enable-udp-forward \ --with-examples=posix || die @@ -354,7 +352,8 @@ build_samr21() { -DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1 \ -DOPENTHREAD_CONFIG_DIAG_ENABLE=1 \ -DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1" + -DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1 \ + -DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1" git checkout -- . || die git clean -xfd || die @@ -366,7 +365,6 @@ build_samr21() { --with-examples=posix \ --enable-jam-detection \ --enable-legacy \ - --enable-service \ --disable-docs \ --disable-tests \ --with-vendor-extension=./src/core/common/extension_example.cpp || die @@ -380,7 +378,6 @@ build_samr21() { --enable-mtd \ --with-examples=posix \ --enable-legacy \ - --enable-service \ --disable-docs \ --disable-tests || die make -j 8 || die diff --git a/Android.mk b/Android.mk index f8154a886..9c1bbea92 100644 --- a/Android.mk +++ b/Android.mk @@ -58,7 +58,7 @@ OPENTHREAD_COMMON_FLAGS += \ -DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1 \ -DOPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1 \ -DOPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1 \ - -DOPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC=1 \ + -DOPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1 \ -DOPENTHREAD_ENABLE_REFERENCE_DEVICE=0 \ $(NULL) endif diff --git a/Makefile.am b/Makefile.am index 166b212e3..b96a30992 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,7 +38,6 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \ --enable-mtd \ --enable-ncp \ --enable-radio-only \ - --enable-service \ --with-examples=posix \ $(NULL) diff --git a/configure.ac b/configure.ac index f1c2966ff..ebe60ac58 100644 --- a/configure.ac +++ b/configure.ac @@ -764,38 +764,6 @@ 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.]) -# -# Thread Network Diagnostic for MTD -# - -AC_ARG_ENABLE(mtd_network_diagnostic, - [AS_HELP_STRING([--enable-mtd-network-diagnostic],[Enable network diagnostic support for MTD @<:@default=no@:>@.])], - [ - case "${enableval}" in - - no|yes) - enable_mtd_network_diagnostic=${enableval} - ;; - - *) - AC_MSG_ERROR([Invalid value ${enable_mtd_network_diagnostic} for --enable-mtd-network-diagnostic]) - ;; - esac - ], - [enable_mtd_network_diagnostic=no]) - -if test "$enable_mtd_network_diagnostic" = "yes"; then - OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC=1 -else - OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC=0 -fi - -AC_MSG_CHECKING([whether to enable the network diagnostic for MTD]) -AC_MSG_RESULT(${enable_mtd_network_diagnostic}) -AC_SUBST(OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC) -AM_CONDITIONAL([OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC], [test "${enable_mtd_network_diagnostic}" = "yes"]) -AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC],[${OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC}],[Define to 1 to enable network diagnostic for MTD.]) - # # Jam Detection # @@ -946,36 +914,6 @@ AC_SUBST(OPENTHREAD_NCP_SPINEL_ENCRYPTER_LIBS) AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER],[${OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER}],[Define to 1 if using NCP Spinel Encrypter]) AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER], [test "${OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER}" = "1"]) -# -# Service -# - -AC_ARG_ENABLE(service, - [AS_HELP_STRING([--enable-service],[Enable Service @<:@default=no@:>@.])], - [ - case "${enableval}" in - - no|yes) - enable_service=${enableval} - ;; - - *) - AC_MSG_ERROR([Invalid value ${enable_service} for --enable-service]) - ;; - esac - ], - [enable_service=no]) - -if test "$enable_service" = "yes"; then - OPENTHREAD_ENABLE_SERVICE=1 -else - OPENTHREAD_ENABLE_SERVICE=0 -fi - -AC_SUBST(OPENTHREAD_ENABLE_SERVICE) -AM_CONDITIONAL([OPENTHREAD_ENABLE_SERVICE], [test "${enable_service}" = "yes"]) -AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_SERVICE],[${OPENTHREAD_ENABLE_SERVICE}],[Define to 1 if you want to enable Service]) - # # Linker Map Output # @@ -1431,12 +1369,10 @@ AC_MSG_NOTICE([ OpenThread NCP Spinel Encrypter : ${with_ncp_spinel_encrypter_libs} OpenThread Vendor Extension Source : ${with_vendor_extension} OpenThread Multiple Instances support : ${enable_multiple_instances} - OpenThread MTD Network Diagnostic support : ${enable_mtd_network_diagnostic} 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 Service support : ${enable_service} OpenThread ECDSA support : ${enable_ecdsa} OpenThread Examples : ${with_examples} OpenThread POSIX Application : ${enable_posix_app} diff --git a/examples/common-switches.mk b/examples/common-switches.mk index 1f34ea37f..80d0b2e10 100644 --- a/examples/common-switches.mk +++ b/examples/common-switches.mk @@ -151,7 +151,7 @@ COMMONCFLAGS += -DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1 endif ifeq ($(MTD_NETDIAG),1) -configure_OPTIONS += --enable-mtd-network-diagnostic +COMMONCFLAGS += -DOPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1 endif ifeq ($(PLATFORM_UDP),1) @@ -165,7 +165,7 @@ COMMONCFLAGS += -DOPENTHREAD_ENABLE_REFERENCE_DEVICE=1 endif ifeq ($(SERVICE),1) -configure_OPTIONS += --enable-service +COMMONCFLAGS += -DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1 endif ifeq ($(SLAAC),1) diff --git a/examples/platforms/nrf52811/openthread-core-nrf52811-config.h b/examples/platforms/nrf52811/openthread-core-nrf52811-config.h index f956aaaef..0c86237a8 100644 --- a/examples/platforms/nrf52811/openthread-core-nrf52811-config.h +++ b/examples/platforms/nrf52811/openthread-core-nrf52811-config.h @@ -91,13 +91,13 @@ #endif /** - * @def OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES * * The number of EID-to-RLOC cache entries. * */ -#ifndef OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES -#define OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES 20 +#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES +#define OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES 20 #endif /** diff --git a/examples/platforms/nrf52840/openthread-core-nrf52840-config.h b/examples/platforms/nrf52840/openthread-core-nrf52840-config.h index 25682bd7c..2e84405d8 100644 --- a/examples/platforms/nrf52840/openthread-core-nrf52840-config.h +++ b/examples/platforms/nrf52840/openthread-core-nrf52840-config.h @@ -113,13 +113,13 @@ #endif /** - * @def OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES * * The number of EID-to-RLOC cache entries. * */ -#ifndef OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES -#define OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES 32 +#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES +#define OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES 32 #endif /** diff --git a/include/openthread-config-android.h b/include/openthread-config-android.h index 72a3e7a19..7f7042938 100644 --- a/include/openthread-config-android.h +++ b/include/openthread-config-android.h @@ -60,7 +60,7 @@ #define OPENTHREAD_PLATFORM_POSIX_APP 1 /* Define to 1 if you want to enable Service */ -#define OPENTHREAD_ENABLE_SERVICE 1 +#define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 1 /* Define to 1 to enable the UDP forward feature. */ #define OPENTHREAD_ENABLE_UDP_FORWARD 1 diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 3e95430d3..ab04a0fc3 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -55,7 +55,7 @@ #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE #include #endif -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE #include #endif @@ -160,15 +160,15 @@ const struct Command Interpreter::sCommands[] = { #if OPENTHREAD_FTD {"neighbor", &Interpreter::ProcessNeighbor}, #endif -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE {"netdataregister", &Interpreter::ProcessNetworkDataRegister}, #endif -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE {"netdatashow", &Interpreter::ProcessNetworkDataShow}, #endif -#if OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE {"networkdiagnostic", &Interpreter::ProcessNetworkDiagnostic}, -#endif // OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#endif // OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE #if OPENTHREAD_FTD {"networkidtimeout", &Interpreter::ProcessNetworkIdTimeout}, #endif @@ -204,7 +204,7 @@ const struct Command Interpreter::sCommands[] = { {"routerupgradethreshold", &Interpreter::ProcessRouterUpgradeThreshold}, #endif {"scan", &Interpreter::ProcessScan}, -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE {"service", &Interpreter::ProcessService}, #endif {"singleton", &Interpreter::ProcessSingleton}, @@ -245,7 +245,7 @@ Interpreter::Interpreter(Instance *aInstance) #endif , mInstance(aInstance) { -#if OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE otThreadSetReceiveDiagnosticGetCallback(mInstance, &Interpreter::HandleDiagnosticGetResponse, this); #endif @@ -1627,7 +1627,7 @@ exit: } #endif -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE void Interpreter::ProcessNetworkDataShow(int argc, char *argv[]) { OT_UNUSED_VARIABLE(argc); @@ -1699,7 +1699,7 @@ exit: } #endif -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE void Interpreter::ProcessNetworkDataRegister(int argc, char *argv[]) { OT_UNUSED_VARIABLE(argc); @@ -1715,7 +1715,7 @@ void Interpreter::ProcessNetworkDataRegister(int argc, char *argv[]) exit: AppendResult(error); } -#endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE #if OPENTHREAD_FTD void Interpreter::ProcessNetworkIdTimeout(int argc, char *argv[]) @@ -3472,7 +3472,7 @@ exit: return; } -#if OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE void Interpreter::ProcessNetworkDiagnostic(int argc, char *argv[]) { otError error = OT_ERROR_NONE; @@ -3516,7 +3516,7 @@ exit: AppendResult(error); } } -#endif // OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#endif // OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE void Interpreter::HandleDiagnosticGetResponse(otMessage *aMessage, const otMessageInfo *aMessageInfo, void *aContext) { diff --git a/src/cli/cli.hpp b/src/cli/cli.hpp index 5715822d7..6ccecda03 100644 --- a/src/cli/cli.hpp +++ b/src/cli/cli.hpp @@ -263,16 +263,16 @@ private: #if OPENTHREAD_FTD void ProcessNeighbor(int argc, char *argv[]); #endif -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE void ProcessNetworkDataRegister(int argc, char *argv[]); #endif -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE void ProcessNetworkDataShow(int argc, char *argv[]); void ProcessService(int argc, char *argv[]); #endif -#if OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE void ProcessNetworkDiagnostic(int argc, char *argv[]); -#endif // OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#endif // OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE #if OPENTHREAD_FTD void ProcessNetworkIdTimeout(int argc, char *argv[]); #endif diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 59b21ceb1..8ca9c4d10 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -342,6 +342,7 @@ HEADERS_COMMON = \ config/platform.h \ config/sntp_client.h \ config/time_sync.h \ + config/tmf.h \ crypto/aes_ccm.hpp \ crypto/aes_ecb.hpp \ crypto/ecdsa.hpp \ diff --git a/src/core/api/server_api.cpp b/src/core/api/server_api.cpp index 5ec29119c..a10edc27a 100644 --- a/src/core/api/server_api.cpp +++ b/src/core/api/server_api.cpp @@ -31,9 +31,9 @@ * This file implements the OpenThread Server API. */ -#include +#include "openthread-core-config.h" -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE #include @@ -108,4 +108,4 @@ otError otServerRegister(otInstance *aInstance) return instance.Get().SendServerDataNotification(); } -#endif // OPENTHREAD_ENABLE_SERVICE +#endif // OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE diff --git a/src/core/api/thread_api.cpp b/src/core/api/thread_api.cpp index 51af5fb7e..ac8f8ade9 100644 --- a/src/core/api/thread_api.cpp +++ b/src/core/api/thread_api.cpp @@ -365,7 +365,7 @@ exit: return error; } -#if OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE void otThreadSetReceiveDiagnosticGetCallback(otInstance * aInstance, otReceiveDiagnosticGetCallback aCallback, void * aCallbackContext) @@ -396,7 +396,7 @@ otError otThreadSendDiagnosticReset(otInstance * aInstance, return instance.Get().SendDiagnosticReset( *static_cast(aDestination), aTlvTypes, aCount); } -#endif // OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#endif // OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE otError otThreadSetEnabled(otInstance *aInstance, bool aEnabled) { diff --git a/src/core/common/instance.hpp b/src/core/common/instance.hpp index ff42f3375..7cc65ab15 100644 --- a/src/core/common/instance.hpp +++ b/src/core/common/instance.hpp @@ -514,7 +514,7 @@ template <> inline PanIdQueryServer &Instance::Get(void) return mThreadNetif.mPanIdQuery; } -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE template <> inline NetworkData::Local &Instance::Get(void) { return mThreadNetif.mNetworkDataLocal; @@ -591,7 +591,7 @@ template <> inline Dns::Client &Instance::Get(void) } #endif -#if OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE template <> inline NetworkDiagnostic::NetworkDiagnostic &Instance::Get(void) { return mThreadNetif.mNetworkDiagnostic; diff --git a/src/core/config/openthread-core-config-check.h b/src/core/config/openthread-core-config-check.h index a5103631d..b9632f23d 100644 --- a/src/core/config/openthread-core-config-check.h +++ b/src/core/config/openthread-core-config-check.h @@ -58,7 +58,7 @@ #endif #ifdef OPENTHREAD_CONFIG_MAX_SERVER_ALOCS -#error "OPENTHREAD_CONFIG_MAX_SERVER_ALOCS was replaced by OPENTHREAD_CONFIG_MAX_SERVICE_ALOCS." +#error "OPENTHREAD_CONFIG_MAX_SERVER_ALOCS was replaced by OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_MAX_ALOCS." #endif #ifdef OPENTHREAD_CONFIG_ENABLE_AUTO_START_SUPPORT diff --git a/src/core/config/openthread-core-default-config.h b/src/core/config/openthread-core-default-config.h index 15f985bbd..4658935a1 100644 --- a/src/core/config/openthread-core-default-config.h +++ b/src/core/config/openthread-core-default-config.h @@ -121,62 +121,6 @@ #define OPENTHREAD_CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE 1 #endif -/** - * @def OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES - * - * The number of EID-to-RLOC cache entries. - * - */ -#ifndef OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES -#define OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES 10 -#endif - -/** - * @def OPENTHREAD_CONFIG_ADDRESS_QUERY_TIMEOUT - * - * The timeout value (in seconds) waiting for a address notification response after sending an address query. - * - * Default: 3 seconds - * - */ -#ifndef OPENTHREAD_CONFIG_ADDRESS_QUERY_TIMEOUT -#define OPENTHREAD_CONFIG_ADDRESS_QUERY_TIMEOUT 3 -#endif - -/** - * @def OPENTHREAD_CONFIG_ADDRESS_QUERY_INITIAL_RETRY_DELAY - * - * Initial retry delay for address query (in seconds). - * - * Default: 15 seconds - * - */ -#ifndef OPENTHREAD_CONFIG_ADDRESS_QUERY_INITIAL_RETRY_DELAY -#define OPENTHREAD_CONFIG_ADDRESS_QUERY_INITIAL_RETRY_DELAY 15 -#endif - -/** - * @def OPENTHREAD_CONFIG_ADDRESS_QUERY_MAX_RETRY_DELAY - * - * Maximum retry delay for address query (in seconds). - * - * Default: 28800 seconds (480 minutes or 8 hours) - * - */ -#ifndef OPENTHREAD_CONFIG_ADDRESS_QUERY_MAX_RETRY_DELAY -#define OPENTHREAD_CONFIG_ADDRESS_QUERY_MAX_RETRY_DELAY 28800 -#endif - -/** - * @def OPENTHREAD_CONFIG_MAX_SERVICE_ALOCS - * - * The maximum number of supported Service ALOCs registrations for this device. - * - */ -#ifndef OPENTHREAD_CONFIG_MAX_SERVICE_ALOCS -#define OPENTHREAD_CONFIG_MAX_SERVICE_ALOCS 1 -#endif - /** * @def OPENTHREAD_CONFIG_6LOWPAN_REASSEMBLY_TIMEOUT * @@ -197,16 +141,6 @@ #define OPENTHREAD_CONFIG_JOINER_UDP_PORT 1000 #endif -/** - * @def OPENTHREAD_CONFIG_MAX_ENERGY_RESULTS - * - * The maximum number of Energy List entries. - * - */ -#ifndef OPENTHREAD_CONFIG_MAX_ENERGY_RESULTS -#define OPENTHREAD_CONFIG_MAX_ENERGY_RESULTS 64 -#endif - /** * @def OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS * @@ -227,32 +161,6 @@ #define OPENTHREAD_CONFIG_STORE_FRAME_COUNTER_AHEAD 1000 #endif -/** - * @def OPENTHREAD_CONFIG_MESHCOP_PENDING_DATASET_MINIMUM_DELAY - * - * Minimum Delay Timer value for a Pending Operational Dataset (in ms). - * - * Thread specification defines this value as 30,000 ms. Changing from the specified value should be done for testing - * only. - * - */ -#ifndef OPENTHREAD_CONFIG_MESHCOP_PENDING_DATASET_MINIMUM_DELAY -#define OPENTHREAD_CONFIG_MESHCOP_PENDING_DATASET_MINIMUM_DELAY 30000 -#endif - -/** - * @def OPENTHREAD_CONFIG_MESHCOP_PENDING_DATASET_DEFAULT_DELAY - * - * Default Delay Timer value for a Pending Operational Dataset (in ms). - * - * Thread specification defines this value as 300,000 ms. Changing from the specified value should be done for testing - * only. - * - */ -#ifndef OPENTHREAD_CONFIG_MESHCOP_PENDING_DATASET_DEFAULT_DELAY -#define OPENTHREAD_CONFIG_MESHCOP_PENDING_DATASET_DEFAULT_DELAY 300000 -#endif - /** * @def OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS * diff --git a/src/core/config/tmf.h b/src/core/config/tmf.h new file mode 100644 index 000000000..139f73369 --- /dev/null +++ b/src/core/config/tmf.h @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2019, 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 compile-time configurations for the Thread Management Framework service. + * + */ + +#ifndef CONFIG_TMF_H_ +#define CONFIG_TMF_H_ + +/** + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES + * + * The number of EID-to-RLOC cache entries. + * + */ +#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES +#define OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES 10 +#endif + +/** + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT + * + * The timeout value (in seconds) waiting for a address notification response after sending an address query. + * + * Default: 3 seconds + * + */ +#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT +#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT 3 +#endif + +/** + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY + * + * Initial retry delay for address query (in seconds). + * + * Default: 15 seconds + * + */ +#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY +#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY 15 +#endif + +/** + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY + * + * Maximum retry delay for address query (in seconds). + * + * Default: 28800 seconds (480 minutes or 8 hours) + * + */ +#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY +#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 28800 +#endif + +/** + * @def OPENTHREAD_CONFIG_TMF_PENDING_DATASET_MINIMUM_DELAY + * + * Minimum Delay Timer value for a Pending Operational Dataset (in ms). + * + * Thread specification defines this value as 30,000 ms. Changing from the specified value should be done for testing + * only. + * + */ +#ifndef OPENTHREAD_CONFIG_TMF_PENDING_DATASET_MINIMUM_DELAY +#define OPENTHREAD_CONFIG_TMF_PENDING_DATASET_MINIMUM_DELAY 30000 +#endif + +/** + * @def OPENTHREAD_CONFIG_TMF_PENDING_DATASET_DEFAULT_DELAY + * + * Default Delay Timer value for a Pending Operational Dataset (in ms). + * + * Thread specification defines this value as 300,000 ms. Changing from the specified value should be done for testing + * only. + * + */ +#ifndef OPENTHREAD_CONFIG_TMF_PENDING_DATASET_DEFAULT_DELAY +#define OPENTHREAD_CONFIG_TMF_PENDING_DATASET_DEFAULT_DELAY 300000 +#endif + +/** + * @def OPENTHREAD_CONFIG_TMF_ENERGY_SCAN_MAX_RESULTS + * + * The maximum number of Energy List entries. + * + */ +#ifndef OPENTHREAD_CONFIG_TMF_ENERGY_SCAN_MAX_RESULTS +#define OPENTHREAD_CONFIG_TMF_ENERGY_SCAN_MAX_RESULTS 64 +#endif + +/** + * @def OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE + * + * Define to 1 to support injecting Service entries into the Thread Network Data. + * + */ +#ifndef OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE +#define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_MAX_ALOCS + * + * The maximum number of supported Service ALOCs registrations for this device. + * + */ +#ifndef OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_MAX_ALOCS +#define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_MAX_ALOCS 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE + * + * Define to 1 to enable TMF network diagnostics on MTDs. + * + */ +#ifndef OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE +#define OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_INFORM_PREVIOUS_PARENT_ON_REATTACH + * + * Define as 1 for a child to inform its previous parent when it attaches to a new parent. + * + * If this feature is enabled, when a device attaches to a new parent, it will send an IP message (with empty payload + * and mesh-local IP address as the source address) to its previous parent. + * + */ +#ifndef OPENTHREAD_CONFIG_INFORM_PREVIOUS_PARENT_ON_REATTACH +#define OPENTHREAD_CONFIG_INFORM_PREVIOUS_PARENT_ON_REATTACH 0 +#endif + +#endif // CONFIG_TMF_H_ diff --git a/src/core/meshcop/energy_scan_client.cpp b/src/core/meshcop/energy_scan_client.cpp index 11c709c5a..0d3bf6cf0 100644 --- a/src/core/meshcop/energy_scan_client.cpp +++ b/src/core/meshcop/energy_scan_client.cpp @@ -137,7 +137,7 @@ void EnergyScanClient::HandleReport(Coap::Message &aMessage, const Ip6::MessageI struct { MeshCoP::EnergyListTlv tlv; - uint8_t list[OPENTHREAD_CONFIG_MAX_ENERGY_RESULTS]; + uint8_t list[OPENTHREAD_CONFIG_TMF_ENERGY_SCAN_MAX_RESULTS]; } OT_TOOL_PACKED_END energyList; VerifyOrExit(aMessage.GetType() == OT_COAP_TYPE_CONFIRMABLE && aMessage.GetCode() == OT_COAP_CODE_POST); diff --git a/src/core/meshcop/meshcop_tlvs.hpp b/src/core/meshcop/meshcop_tlvs.hpp index 8e8f7f0c6..6ed186498 100644 --- a/src/core/meshcop/meshcop_tlvs.hpp +++ b/src/core/meshcop/meshcop_tlvs.hpp @@ -1395,13 +1395,13 @@ public: * Minimum Delay Timer value for a Pending Operational Dataset (ms) * */ - kDelayTimerMinimal = OPENTHREAD_CONFIG_MESHCOP_PENDING_DATASET_MINIMUM_DELAY, + kDelayTimerMinimal = OPENTHREAD_CONFIG_TMF_PENDING_DATASET_MINIMUM_DELAY, /** * Default Delay Timer value for a Pending Operational Dataset (ms) * */ - kDelayTimerDefault = OPENTHREAD_CONFIG_MESHCOP_PENDING_DATASET_DEFAULT_DELAY, + kDelayTimerDefault = OPENTHREAD_CONFIG_TMF_PENDING_DATASET_DEFAULT_DELAY, }; private: diff --git a/src/core/openthread-core-config.h b/src/core/openthread-core-config.h index e1aff8aef..e670a79e8 100644 --- a/src/core/openthread-core-config.h +++ b/src/core/openthread-core-config.h @@ -66,6 +66,7 @@ #include "config/platform.h" #include "config/sntp_client.h" #include "config/time_sync.h" +#include "config/tmf.h" #if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE || OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE || \ OPENTHREAD_CONFIG_COMMISSIONER_ENABLE || OPENTHREAD_CONFIG_JOINER_ENABLE diff --git a/src/core/thread/address_resolver.hpp b/src/core/thread/address_resolver.hpp index 7968c3d90..dc83a018d 100644 --- a/src/core/thread/address_resolver.hpp +++ b/src/core/thread/address_resolver.hpp @@ -128,7 +128,7 @@ public: private: enum { - kCacheEntries = OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES, + kCacheEntries = OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES, kStateUpdatePeriod = 1000u, ///< State update period in milliseconds. }; @@ -138,9 +138,9 @@ private: */ enum { - kAddressQueryTimeout = OPENTHREAD_CONFIG_ADDRESS_QUERY_TIMEOUT, // in seconds - kAddressQueryInitialRetryDelay = OPENTHREAD_CONFIG_ADDRESS_QUERY_INITIAL_RETRY_DELAY, // in seconds - kAddressQueryMaxRetryDelay = OPENTHREAD_CONFIG_ADDRESS_QUERY_MAX_RETRY_DELAY, // in seconds + kAddressQueryTimeout = OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT, // in seconds + kAddressQueryInitialRetryDelay = OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY, // in seconds + kAddressQueryMaxRetryDelay = OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY, // in seconds }; enum diff --git a/src/core/thread/energy_scan_server.hpp b/src/core/thread/energy_scan_server.hpp index 3856d1980..0852b5d59 100644 --- a/src/core/thread/energy_scan_server.hpp +++ b/src/core/thread/energy_scan_server.hpp @@ -88,7 +88,7 @@ private: uint8_t mCount; bool mActive; - int8_t mScanResults[OPENTHREAD_CONFIG_MAX_ENERGY_RESULTS]; + int8_t mScanResults[OPENTHREAD_CONFIG_TMF_ENERGY_SCAN_MAX_RESULTS]; uint8_t mScanResultsLength; TimerMilli mTimer; diff --git a/src/core/thread/mesh_forwarder_ftd.cpp b/src/core/thread/mesh_forwarder_ftd.cpp index 56b006134..845e862ec 100644 --- a/src/core/thread/mesh_forwarder_ftd.cpp +++ b/src/core/thread/mesh_forwarder_ftd.cpp @@ -420,7 +420,7 @@ otError MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header) } #endif // OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE || OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE else if ((aloc16 >= Mle::kAloc16ServiceStart) && (aloc16 <= Mle::kAloc16ServiceEnd)) { SuccessOrExit(error = GetDestinationRlocByServiceAloc(aloc16, mMeshDest)); @@ -756,7 +756,7 @@ exit: return error; } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE otError MeshForwarder::GetDestinationRlocByServiceAloc(uint16_t aServiceAloc, uint16_t &aMeshDest) { otError error = OT_ERROR_NONE; @@ -814,7 +814,7 @@ otError MeshForwarder::GetDestinationRlocByServiceAloc(uint16_t aServiceAloc, ui exit: return error; } -#endif // OPENTHREAD_ENABLE_SERVICE +#endif // OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE // LCOV_EXCL_START diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index db4d1cf16..2f09b0efe 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -142,7 +142,7 @@ Mle::Mle(Instance &aInstance) mLeaderAloc.mScopeOverride = Ip6::Address::kRealmLocalScope; mLeaderAloc.mScopeOverrideValid = true; -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE // Service Alocs for (size_t i = 0; i < OT_ARRAY_LENGTH(mServiceAlocs); i++) @@ -760,7 +760,7 @@ void Mle::SetStateChild(uint16_t aRloc16) Get().HandleChildStart(mParentRequestMode); } -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE Get().ClearResubmitDelayTimer(); #endif Get().SetForwardingEnabled(false); @@ -900,7 +900,7 @@ exit: void Mle::ApplyMeshLocalPrefix(void) { -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mServiceAlocs); i++) { @@ -1010,7 +1010,7 @@ exit: return error; } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE otError Mle::GetServiceAloc(uint8_t aServiceId, Ip6::Address &aAddress) const { otError error = OT_ERROR_NONE; @@ -1548,9 +1548,9 @@ void Mle::HandleStateChanged(otChangedFlags aFlags) ScheduleMessageTransmissionTimer(); } -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE Get().SendServerDataNotification(); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE this->UpdateServiceAlocs(); #endif #endif @@ -1585,7 +1585,7 @@ exit: return; } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE void Mle::UpdateServiceAlocs(void) { uint16_t rloc = GetRloc16(); diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index 28f39d3b1..0deb1f189 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -880,7 +880,7 @@ public: return GetAlocAddress(aAddress, GetCommissionerAloc16FromId(aSessionId)); } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE /** * This method retrieves the Service ALOC for given Service ID. * @@ -1729,7 +1729,7 @@ private: void ResetParentCandidate(void); otError GetAlocAddress(Ip6::Address &aAddress, uint16_t aAloc16) const; -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE /** * This method scans for network data from the leader and updates IP addresses assigned to this * interface to make sure that all Service ALOCs (0xfc10-0xfc1f) are properly set. @@ -1810,8 +1810,8 @@ private: Ip6::NetifUnicastAddress mLeaderAloc; -#if OPENTHREAD_ENABLE_SERVICE - Ip6::NetifUnicastAddress mServiceAlocs[OPENTHREAD_CONFIG_MAX_SERVICE_ALOCS]; +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE + Ip6::NetifUnicastAddress mServiceAlocs[OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_MAX_ALOCS]; #endif otMleCounters mCounters; diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index 246db1de0..8b7444599 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -1405,7 +1405,7 @@ otError MleRouter::HandleAdvertisement(const Message &aMessage, const Ip6::Messa UpdateRoutes(route, routerId); -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE Get().SendServerDataNotification(); #endif diff --git a/src/core/thread/network_data.cpp b/src/core/thread/network_data.cpp index 53f625552..6273ca2e1 100644 --- a/src/core/thread/network_data.cpp +++ b/src/core/thread/network_data.cpp @@ -232,7 +232,7 @@ exit: return error; } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE otError NetworkData::GetNextService(otNetworkDataIterator *aIterator, otServiceConfig *aConfig) { return GetNextService(aIterator, Mac::kShortAddrBroadcast, aConfig); @@ -436,7 +436,7 @@ exit: return rval; } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE bool NetworkData::ContainsServices(NetworkData &aCompare, uint16_t aRloc16) { otNetworkDataIterator outerIterator = OT_NETWORK_DATA_ITERATOR_INIT; @@ -530,7 +530,7 @@ void NetworkData::RemoveTemporaryData(uint8_t *aData, uint8_t &aDataLength) NetworkDataTlv *cur = reinterpret_cast(aData); NetworkDataTlv *end; PrefixTlv * prefix; -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE ServiceTlv *service; #endif uint8_t length; @@ -567,7 +567,7 @@ void NetworkData::RemoveTemporaryData(uint8_t *aData, uint8_t &aDataLength) break; } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE case NetworkDataTlv::kTypeService: { @@ -705,7 +705,7 @@ void NetworkData::RemoveTemporaryData(uint8_t *aData, uint8_t &aDataLength, Pref } } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE void NetworkData::RemoveTemporaryData(uint8_t *aData, uint8_t &aDataLength, ServiceTlv &aService) { NetworkDataTlv *cur = aService.GetSubTlvs(); @@ -932,7 +932,7 @@ int8_t NetworkData::PrefixMatch(const uint8_t *a, const uint8_t *b, uint8_t aLen return (rval >= aLength) ? rval : -1; } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE ServiceTlv *NetworkData::FindService(uint32_t aEnterpriseNumber, const uint8_t *aServiceData, uint8_t aServiceDataLength) diff --git a/src/core/thread/network_data.hpp b/src/core/thread/network_data.hpp index 6ca2bcbc0..b5d2d3605 100644 --- a/src/core/thread/network_data.hpp +++ b/src/core/thread/network_data.hpp @@ -184,7 +184,7 @@ public: */ otError GetNextExternalRoute(otNetworkDataIterator *aIterator, uint16_t aRloc16, otExternalRouteConfig *aConfig); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE /** * This method provides the next service in the Thread Network Data. * @@ -250,7 +250,7 @@ public: */ bool ContainsExternalRoutes(NetworkData &aCompare, uint16_t aRloc16); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE /** * This method indicates whether or not the Thread Network Data contains all of the service information * in @p aCompare associated with @p aRloc16. @@ -361,7 +361,7 @@ protected: */ PrefixTlv *FindPrefix(const uint8_t *aPrefix, uint8_t aPrefixLength, uint8_t *aTlvs, uint8_t aTlvsLength); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE /** * This method returns a pointer to a matching Service TLV. * @@ -432,7 +432,7 @@ protected: */ void RemoveTemporaryData(uint8_t *aData, uint8_t &aDataLength, PrefixTlv &aPrefix); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE /** * This method strips non-stable Sub-TLVs from a Service TLV. * diff --git a/src/core/thread/network_data_leader_ftd.cpp b/src/core/thread/network_data_leader_ftd.cpp index e4685bbac..7a862d546 100644 --- a/src/core/thread/network_data_leader_ftd.cpp +++ b/src/core/thread/network_data_leader_ftd.cpp @@ -440,7 +440,7 @@ otError Leader::RlocLookup(uint16_t aRloc16, HasRouteTlv * hasRoute; BorderRouterEntry *borderRouterEntry; HasRouteEntry * hasRouteEntry; -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE ServiceTlv *service; ServerTlv * server; #endif @@ -529,7 +529,7 @@ otError Leader::RlocLookup(uint16_t aRloc16, } break; -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE case NetworkDataTlv::kTypeService: { @@ -600,7 +600,7 @@ bool Leader::IsStableUpdated(uint8_t *aTlvs, uint8_t aTlvsLength, uint8_t *aTlvs bool rval = false; NetworkDataTlv *cur = reinterpret_cast(aTlvs); NetworkDataTlv *end = reinterpret_cast(aTlvs + aTlvsLength); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE ServiceTlv *service; #endif @@ -653,7 +653,7 @@ bool Leader::IsStableUpdated(uint8_t *aTlvs, uint8_t aTlvsLength, uint8_t *aTlvs break; } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE case NetworkDataTlv::kTypeService: service = static_cast(cur); @@ -794,7 +794,7 @@ exit: otError Leader::AddNetworkData(uint8_t *aTlvs, uint8_t aTlvsLength, uint8_t *aOldTlvs, uint8_t aOldTlvsLength) { -#if !OPENTHREAD_ENABLE_SERVICE +#if !OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE OT_UNUSED_VARIABLE(aOldTlvs); OT_UNUSED_VARIABLE(aOldTlvsLength); #endif @@ -814,7 +814,7 @@ otError Leader::AddNetworkData(uint8_t *aTlvs, uint8_t aTlvsLength, uint8_t *aOl otDumpDebgNetData("add prefix done", mTlvs, mLength); break; -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE case NetworkDataTlv::kTypeService: SuccessOrExit(error = AddService(*static_cast(cur), aOldTlvs, aOldTlvsLength)); @@ -870,7 +870,7 @@ exit: return error; } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE otError Leader::AddService(ServiceTlv &aService, uint8_t *aOldTlvs, uint8_t aOldTlvsLength) { otError error = OT_ERROR_NONE; @@ -965,7 +965,7 @@ exit: return error; } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE otError Leader::AddServer(ServiceTlv &aService, ServerTlv &aServer, uint8_t *aOldTlvs, uint8_t aOldTlvsLength) { otError error = OT_ERROR_NONE; @@ -1236,7 +1236,7 @@ void Leader::RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode) NetworkDataTlv *cur = reinterpret_cast(mTlvs); NetworkDataTlv *end; PrefixTlv * prefix; -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE ServiceTlv *service; #endif @@ -1266,7 +1266,7 @@ void Leader::RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode) break; } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE case NetworkDataTlv::kTypeService: { @@ -1361,7 +1361,7 @@ void Leader::RemoveRloc(PrefixTlv &aPrefix, uint16_t aRloc16, MatchMode aMatchMo } } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE void Leader::RemoveRloc(ServiceTlv &aService, uint16_t aRloc16, MatchMode aMatchMode) { NetworkDataTlv *cur = aService.GetSubTlvs(); diff --git a/src/core/thread/network_data_leader_ftd.hpp b/src/core/thread/network_data_leader_ftd.hpp index 6b2d06592..72998b078 100644 --- a/src/core/thread/network_data_leader_ftd.hpp +++ b/src/core/thread/network_data_leader_ftd.hpp @@ -159,7 +159,7 @@ public: */ void UpdateContextsAfterReset(void); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE /** * This method scans network data for given service ID and returns pointer to the respective TLV, if present. * @@ -183,7 +183,7 @@ private: otError AddBorderRouter(PrefixTlv &aPrefix, BorderRouterTlv &aBorderRouter); otError AddNetworkData(uint8_t *aTlvs, uint8_t aTlvsLength, uint8_t *aOldTlvs, uint8_t aOldTlvsLength); otError AddPrefix(PrefixTlv &aPrefix); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE otError AddServer(ServiceTlv &aService, ServerTlv &aServer, uint8_t *aOldTlvs, uint8_t aOldTlvsLength); otError AddService(ServiceTlv &aService, uint8_t *aOldTlvs, uint8_t aOldTlvsLength); #endif @@ -200,7 +200,7 @@ private: void RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode); void RemoveRloc(PrefixTlv &aPrefix, uint16_t aRloc16, MatchMode aMatchMode); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE void RemoveRloc(ServiceTlv &aService, uint16_t aRloc16, MatchMode aMatchMode); #endif void RemoveRloc(PrefixTlv &aPrefix, HasRouteTlv &aHasRoute, uint16_t aRloc16, MatchMode aMatchMode); diff --git a/src/core/thread/network_data_local.cpp b/src/core/thread/network_data_local.cpp index 87472fdfb..6c965b3b3 100644 --- a/src/core/thread/network_data_local.cpp +++ b/src/core/thread/network_data_local.cpp @@ -41,7 +41,7 @@ #include "mac/mac_frame.hpp" #include "thread/thread_netif.hpp" -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE namespace ot { namespace NetworkData { @@ -175,7 +175,7 @@ exit: return error; } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE otError Local::AddService(uint32_t aEnterpriseNumber, const uint8_t *aServiceData, uint8_t aServiceDataLength, @@ -253,7 +253,7 @@ void Local::UpdateRloc(void) UpdateRloc(*static_cast(cur)); break; -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE case NetworkDataTlv::kTypeService: UpdateRloc(*static_cast(cur)); @@ -302,7 +302,7 @@ void Local::UpdateRloc(BorderRouterTlv &aBorderRouter) entry->SetRloc(Get().GetRloc16()); } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE void Local::UpdateRloc(ServiceTlv &aService) { for (NetworkDataTlv *cur = aService.GetSubTlvs(); cur < aService.GetNext(); cur = cur->GetNext()) @@ -338,7 +338,7 @@ bool Local::IsExternalRouteConsistent(void) ContainsExternalRoutes(Get(), Get().GetRloc16())); } -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE bool Local::IsServiceConsistent(void) { return (Get().ContainsServices(*this, Get().GetRloc16()) && @@ -365,7 +365,7 @@ otError Local::SendServerDataNotification(void) UpdateRloc(); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE VerifyOrExit(!IsOnMeshPrefixConsistent() || !IsExternalRouteConsistent() || !IsServiceConsistent(), ClearResubmitDelayTimer()); #else @@ -387,4 +387,4 @@ exit: } // namespace NetworkData } // namespace ot -#endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE diff --git a/src/core/thread/network_data_local.hpp b/src/core/thread/network_data_local.hpp index d83946cd3..90c743464 100644 --- a/src/core/thread/network_data_local.hpp +++ b/src/core/thread/network_data_local.hpp @@ -120,7 +120,7 @@ public: */ otError RemoveHasRoutePrefix(const uint8_t *aPrefix, uint8_t aPrefixLength); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE /** * This method adds a Service entry to the Thread Network local data. * @@ -170,14 +170,14 @@ private: void UpdateRloc(PrefixTlv &aPrefix); void UpdateRloc(HasRouteTlv &aHasRoute); void UpdateRloc(BorderRouterTlv &aBorderRouter); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE void UpdateRloc(ServiceTlv &aService); void UpdateRloc(ServerTlv &aServer); #endif bool IsOnMeshPrefixConsistent(void); bool IsExternalRouteConsistent(void); -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE bool IsServiceConsistent(void); #endif diff --git a/src/core/thread/network_diagnostic.cpp b/src/core/thread/network_diagnostic.cpp index f82ce3eda..c05a6b664 100644 --- a/src/core/thread/network_diagnostic.cpp +++ b/src/core/thread/network_diagnostic.cpp @@ -49,7 +49,7 @@ #include "thread/thread_tlvs.hpp" #include "thread/thread_uri_paths.hpp" -#if OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE namespace ot { @@ -695,4 +695,4 @@ exit: } // namespace ot -#endif // OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#endif // OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE diff --git a/src/core/thread/thread_netif.cpp b/src/core/thread/thread_netif.cpp index f76be1754..741af5239 100644 --- a/src/core/thread/thread_netif.cpp +++ b/src/core/thread/thread_netif.cpp @@ -72,11 +72,11 @@ ThreadNetif::ThreadNetif(Instance &aInstance) , mMac(aInstance) , mMeshForwarder(aInstance) , mMleRouter(aInstance) -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE , mNetworkDataLocal(aInstance) #endif , mNetworkDataLeader(aInstance) -#if OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE , mNetworkDiagnostic(aInstance) #endif , mIsUp(false) diff --git a/src/core/thread/thread_netif.hpp b/src/core/thread/thread_netif.hpp index e2a020bbc..8d0eee66e 100644 --- a/src/core/thread/thread_netif.hpp +++ b/src/core/thread/thread_netif.hpp @@ -187,13 +187,13 @@ private: Mac::Mac mMac; MeshForwarder mMeshForwarder; Mle::MleRouter mMleRouter; -#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE NetworkData::Local mNetworkDataLocal; -#endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_ENABLE_SERVICE +#endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE NetworkData::Leader mNetworkDataLeader; -#if OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE NetworkDiagnostic::NetworkDiagnostic mNetworkDiagnostic; -#endif // OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC +#endif // OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE bool mIsUp; #if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index ff923cd0a..a9504d0c3 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -228,7 +228,7 @@ NcpBase::NcpBase(Instance *aInstance) , mPcapEnabled(false) , mDisableStreamWrite(false) , mShouldEmitChildTableUpdate(false) -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE , mAllowLocalServerDataChange(false) #endif #if OPENTHREAD_FTD @@ -1823,7 +1823,7 @@ template <> otError NcpBase::HandlePropertyGet(void) SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_THREAD_UDP_FORWARD)); #endif -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_THREAD_SERVICE)); #endif diff --git a/src/ncp/ncp_base.hpp b/src/ncp/ncp_base.hpp index 424a6d816..c75a4c3ad 100644 --- a/src/ncp/ncp_base.hpp +++ b/src/ncp/ncp_base.hpp @@ -555,7 +555,7 @@ protected: bool mPcapEnabled; bool mDisableStreamWrite; bool mShouldEmitChildTableUpdate; -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE bool mAllowLocalServerDataChange; #endif diff --git a/src/ncp/ncp_base_dispatcher.cpp b/src/ncp/ncp_base_dispatcher.cpp index 14289237f..21595d904 100644 --- a/src/ncp/ncp_base_dispatcher.cpp +++ b/src/ncp/ncp_base_dispatcher.cpp @@ -519,7 +519,7 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey) handler = &NcpBase::HandlePropertyGet; break; #endif -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE case SPINEL_PROP_SERVER_ALLOW_LOCAL_DATA_CHANGE: handler = &NcpBase::HandlePropertyGet; break; @@ -869,7 +869,7 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey) handler = &NcpBase::HandlePropertySet; break; #endif -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE case SPINEL_PROP_SERVER_ALLOW_LOCAL_DATA_CHANGE: handler = &NcpBase::HandlePropertySet; break; @@ -1057,7 +1057,7 @@ NcpBase::PropertyHandler NcpBase::FindInsertPropertyHandler(spinel_prop_key_t aK handler = &NcpBase::HandlePropertyInsert; break; #endif -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE case SPINEL_PROP_SERVER_SERVICES: handler = &NcpBase::HandlePropertyInsert; break; @@ -1142,7 +1142,7 @@ NcpBase::PropertyHandler NcpBase::FindRemovePropertyHandler(spinel_prop_key_t aK handler = &NcpBase::HandlePropertyRemove; break; #endif -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE case SPINEL_PROP_SERVER_SERVICES: handler = &NcpBase::HandlePropertyRemove; break; diff --git a/src/ncp/ncp_base_mtd.cpp b/src/ncp/ncp_base_mtd.cpp index 1287c0bee..2dcc5d1fa 100644 --- a/src/ncp/ncp_base_mtd.cpp +++ b/src/ncp/ncp_base_mtd.cpp @@ -57,7 +57,7 @@ #if OPENTHREAD_FTD #include #endif -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE #include #endif @@ -826,7 +826,7 @@ exit: } #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE -#if OPENTHREAD_ENABLE_SERVICE +#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE template <> otError NcpBase::HandlePropertyGet(void) { @@ -958,7 +958,7 @@ exit: return error; } -#endif // OPENTHREAD_ENABLE_SERVICE +#endif // OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE template <> otError NcpBase::HandlePropertyGet(void) { diff --git a/tests/toranj/build.sh b/tests/toranj/build.sh index 8ba466680..7ea8d4a8b 100755 --- a/tests/toranj/build.sh +++ b/tests/toranj/build.sh @@ -82,7 +82,6 @@ configure_options=" \ --enable-jam-detection \ --enable-legacy \ --enable-ncp \ - --enable-service \ " cppflags_config='-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"../tests/toranj/openthread-core-toranj-config.h\"' diff --git a/tests/toranj/openthread-core-toranj-config.h b/tests/toranj/openthread-core-toranj-config.h index 5c04faeaa..db728468c 100644 --- a/tests/toranj/openthread-core-toranj-config.h +++ b/tests/toranj/openthread-core-toranj-config.h @@ -80,6 +80,14 @@ */ #define OPENTHREAD_CONFIG_JOINER_ENABLE 1 +/** + * @def OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE + * + * Define to 1 to support injecting Service entries into the Thread Network Data. + * + */ +#define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 1 + /** * @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS * @@ -89,22 +97,22 @@ #define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 256 /** - * @def OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES * * The number of EID-to-RLOC cache entries. * */ -#define OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES 32 +#define OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES 32 /** - * @def OPENTHREAD_CONFIG_ADDRESS_QUERY_MAX_RETRY_DELAY + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY * * Maximum retry delay for address query (in seconds). * * Default: 28800 seconds (480 minutes or 8 hours) * */ -#define OPENTHREAD_CONFIG_ADDRESS_QUERY_MAX_RETRY_DELAY 120 +#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 /** * @def OPENTHREAD_CONFIG_MLE_MAX_CHILDREN @@ -330,7 +338,7 @@ #define OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE 1 /** - * @def OPENTHREAD_CONFIG_MESHCOP_PENDING_DATASET_MINIMUM_DELAY + * @def OPENTHREAD_CONFIG_TMF_PENDING_DATASET_MINIMUM_DELAY * * Minimum Delay Timer value for a Pending Operational Dataset (in ms). * @@ -339,7 +347,7 @@ * For `toranj` test script the value is decreased so that the tests can be run faster. * */ -#define OPENTHREAD_CONFIG_MESHCOP_PENDING_DATASET_MINIMUM_DELAY 1000 +#define OPENTHREAD_CONFIG_TMF_PENDING_DATASET_MINIMUM_DELAY 1000 /** * @def OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL