diff --git a/configure.ac b/configure.ac index 71a5d9b2d..581fa4dad 100644 --- a/configure.ac +++ b/configure.ac @@ -1024,20 +1024,6 @@ AC_SUBST(OPENTHREAD_ENABLE_JOINER) AM_CONDITIONAL([OPENTHREAD_ENABLE_JOINER], [test "${enable_joiner}" = "yes"]) AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_JOINER],[${OPENTHREAD_ENABLE_JOINER}],[Define to 1 to enable the joiner role.]) -if test "${enable_commissioner}" = "yes" -o "${enable_joiner}" = "yes" -o "${enable_border_agent}" = "yes" -o "${enable_application_coap_secure}" = "yes"; then - enable_dtls="yes" - OPENTHREAD_ENABLE_DTLS=1 -else - enable_dtls="no" - OPENTHREAD_ENABLE_DTLS=0 -fi - -AC_MSG_CHECKING([whether to enable DTLS due to joiner/commissioner]) -AC_MSG_RESULT(${enable_dtls}) -AC_SUBST(OPENTHREAD_ENABLE_DTLS) -AM_CONDITIONAL([OPENTHREAD_ENABLE_DTLS], [test "${enable_dtls}" = "yes"]) -AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_DTLS],[${OPENTHREAD_ENABLE_DTLS}],[Define to 1 to enable dtls support.]) - # # Jam Detection # @@ -2048,7 +2034,6 @@ AC_MSG_NOTICE([ OpenThread UDP forward support : ${enable_udp_forward} OpenThread Commissioner support : ${enable_commissioner} OpenThread Joiner support : ${enable_joiner} - OpenThread DTLS support : ${enable_dtls} OpenThread Jam Detection support : ${enable_jam_detection} OpenThread Channel Monitor support : ${enable_channel_monitor} OpenThread Channel Manager support : ${enable_channel_manager} diff --git a/include/openthread-config-android.h b/include/openthread-config-android.h index 614e3964c..c0a093ef3 100644 --- a/include/openthread-config-android.h +++ b/include/openthread-config-android.h @@ -42,7 +42,7 @@ #define OPENTHREAD_ENABLE_CHILD_SUPERVISION 1 /* Define to 1 to enable dtls support. */ -#define OPENTHREAD_ENABLE_DTLS 1 +#define OPENTHREAD_CONFIG_DTLS_ENABLE 1 /* Define to 1 if you want to use jam detection feature */ #define OPENTHREAD_ENABLE_JAM_DETECTION 1 diff --git a/src/core/api/message_api.cpp b/src/core/api/message_api.cpp index c25e9c6d4..75600cdf7 100644 --- a/src/core/api/message_api.cpp +++ b/src/core/api/message_api.cpp @@ -196,7 +196,7 @@ void otMessageGetBufferInfo(otInstance *aInstance, otBufferInfo *aBufferInfo) aBufferInfo->mCoapMessages += messages; aBufferInfo->mCoapBuffers += buffers; -#if OPENTHREAD_ENABLE_DTLS +#if OPENTHREAD_CONFIG_DTLS_ENABLE instance.Get().GetRequestMessages().GetInfo(aBufferInfo->mCoapSecureMessages, aBufferInfo->mCoapSecureBuffers); instance.Get().GetCachedResponses().GetInfo(messages, buffers); diff --git a/src/core/coap/coap_secure.cpp b/src/core/coap/coap_secure.cpp index 0f999e1ac..219f420fe 100644 --- a/src/core/coap/coap_secure.cpp +++ b/src/core/coap/coap_secure.cpp @@ -35,7 +35,7 @@ #include "meshcop/dtls.hpp" #include "thread/thread_netif.hpp" -#if OPENTHREAD_ENABLE_DTLS +#if OPENTHREAD_CONFIG_DTLS_ENABLE /** * @file @@ -265,4 +265,4 @@ exit: } // namespace Coap } // namespace ot -#endif // OPENTHREAD_ENABLE_DTLS +#endif // OPENTHREAD_CONFIG_DTLS_ENABLE diff --git a/src/core/common/instance.hpp b/src/core/common/instance.hpp index f481c1b2a..16288401a 100644 --- a/src/core/common/instance.hpp +++ b/src/core/common/instance.hpp @@ -546,7 +546,7 @@ template <> inline Coap::Coap &Instance::Get(void) return mThreadNetif.mCoap; } -#if OPENTHREAD_ENABLE_DTLS +#if OPENTHREAD_CONFIG_DTLS_ENABLE template <> inline Coap::CoapSecure &Instance::Get(void) { return mThreadNetif.mCoapSecure; diff --git a/src/core/meshcop/dtls.cpp b/src/core/meshcop/dtls.cpp index 6e8b6fc16..5433313a6 100644 --- a/src/core/meshcop/dtls.cpp +++ b/src/core/meshcop/dtls.cpp @@ -51,7 +51,7 @@ #include "crypto/sha256.hpp" #include "thread/thread_netif.hpp" -#if OPENTHREAD_ENABLE_DTLS +#if OPENTHREAD_CONFIG_DTLS_ENABLE namespace ot { namespace MeshCoP { @@ -956,4 +956,4 @@ exit: } // namespace MeshCoP } // namespace ot -#endif // OPENTHREAD_ENABLE_DTLS +#endif // OPENTHREAD_CONFIG_DTLS_ENABLE diff --git a/src/core/openthread-core-config.h b/src/core/openthread-core-config.h index efe6689a8..64e63240f 100644 --- a/src/core/openthread-core-config.h +++ b/src/core/openthread-core-config.h @@ -44,6 +44,11 @@ #include "config/openthread-core-default-config.h" +#if OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE || OPENTHREAD_ENABLE_BORDER_AGENT || OPENTHREAD_ENABLE_COMMISSIONER || \ + OPENTHREAD_ENABLE_JOINER +#define OPENTHREAD_CONFIG_DTLS_ENABLE 1 +#endif + #undef OPENTHREAD_CORE_CONFIG_H_IN #include "config/openthread-core-config-check.h" diff --git a/src/core/thread/thread_netif.cpp b/src/core/thread/thread_netif.cpp index bf51327a7..7092143cc 100644 --- a/src/core/thread/thread_netif.cpp +++ b/src/core/thread/thread_netif.cpp @@ -86,7 +86,7 @@ ThreadNetif::ThreadNetif(Instance &aInstance) #if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD , mCommissioner(aInstance) #endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD -#if OPENTHREAD_ENABLE_DTLS +#if OPENTHREAD_CONFIG_DTLS_ENABLE , mCoapSecure(aInstance) #endif #if OPENTHREAD_ENABLE_JOINER @@ -150,7 +150,7 @@ void ThreadNetif::Down(void) #if OPENTHREAD_ENABLE_SNTP_CLIENT Get().Stop(); #endif -#if OPENTHREAD_ENABLE_DTLS +#if OPENTHREAD_CONFIG_DTLS_ENABLE Get().Stop(); #endif Get().Stop(); diff --git a/src/core/thread/thread_netif.hpp b/src/core/thread/thread_netif.hpp index 0b374bb1a..48fe47cbe 100644 --- a/src/core/thread/thread_netif.hpp +++ b/src/core/thread/thread_netif.hpp @@ -203,9 +203,9 @@ private: MeshCoP::Commissioner mCommissioner; #endif // OPENTHREAD_ENABLE_COMMISSIONER -#if OPENTHREAD_ENABLE_DTLS +#if OPENTHREAD_CONFIG_DTLS_ENABLE Coap::CoapSecure mCoapSecure; -#endif // OPENTHREAD_ENABLE_DTLS +#endif // OPENTHREAD_CONFIG_DTLS_ENABLE #if OPENTHREAD_ENABLE_JOINER MeshCoP::Joiner mJoiner; diff --git a/src/core/utils/heap.hpp b/src/core/utils/heap.hpp index 4b489cc1e..0cc677dfd 100644 --- a/src/core/utils/heap.hpp +++ b/src/core/utils/heap.hpp @@ -229,7 +229,7 @@ public: private: enum { -#if OPENTHREAD_ENABLE_DTLS +#if OPENTHREAD_CONFIG_DTLS_ENABLE kMemorySize = OPENTHREAD_CONFIG_HEAP_SIZE, ///< Size of memory buffer (bytes). #else kMemorySize = OPENTHREAD_CONFIG_HEAP_SIZE_NO_DTLS, ///< Size of memory buffer (bytes).