diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 9ff77af46..4fad3a71c 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -259,6 +259,14 @@ exit: } } +void Mle::ResetCounters(void) +{ + memset(&mCounters, 0, sizeof(mCounters)); +#if OPENTHREAD_CONFIG_UPTIME_ENABLE + mLastUpdatedTimestamp = Get().GetUptime(); +#endif +} + #if OPENTHREAD_CONFIG_UPTIME_ENABLE void Mle::UpdateRoleTimeCounters(DeviceRole aRole) { diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index aa011e515..517ab094b 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -610,7 +610,7 @@ public: * @returns A reference to the MLE counters. * */ - const otMleCounters &GetCounters(void) + const Counters &GetCounters(void) { #if OPENTHREAD_CONFIG_UPTIME_ENABLE UpdateRoleTimeCounters(mRole); @@ -622,7 +622,7 @@ public: * This method resets the MLE counters. * */ - void ResetCounters(void) { memset(&mCounters, 0, sizeof(mCounters)); } + void ResetCounters(void); #if OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE /** @@ -2122,10 +2122,11 @@ private: ServiceAloc mServiceAlocs[kMaxServiceAlocs]; #endif - otMleCounters mCounters; + Counters mCounters; #if OPENTHREAD_CONFIG_UPTIME_ENABLE uint64_t mLastUpdatedTimestamp; #endif + static const otMeshLocalPrefix sMeshLocalPrefixInit; Ip6::Netif::UnicastAddress mLinkLocal64; diff --git a/src/core/thread/mle_types.hpp b/src/core/thread/mle_types.hpp index b4543970d..286e63ae6 100644 --- a/src/core/thread/mle_types.hpp +++ b/src/core/thread/mle_types.hpp @@ -646,6 +646,12 @@ typedef Mac::KeyMaterial KeyMaterial; */ typedef Mac::Key Key; +/** + * This structure represents the Thread MLE counters. + * + */ +typedef otMleCounters Counters; + /** * This function derives the Child ID from a given RLOC16. *