mirror of
https://github.com/espressif/openthread.git
synced 2026-10-11 10:17:35 +00:00
[mesh-forwarder] add method ResetCounters to clear IP counter (#4286)
This commit also adds a public API `otThreadResetIp6Counters()`.
This commit is contained in:
committed by
Jonathan Hui
parent
795cd14f8c
commit
bf03f40bd7
@@ -730,6 +730,14 @@ otError otThreadSendDiagnosticReset(otInstance * aInstance,
|
|||||||
*/
|
*/
|
||||||
const otIpCounters *otThreadGetIp6Counters(otInstance *aInstance);
|
const otIpCounters *otThreadGetIp6Counters(otInstance *aInstance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the IPv6 counters.
|
||||||
|
*
|
||||||
|
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void otThreadResetIp6Counters(otInstance *aInstance);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Thread MLE counters.
|
* Get the Thread MLE counters.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -454,6 +454,13 @@ const otIpCounters *otThreadGetIp6Counters(otInstance *aInstance)
|
|||||||
return &instance.Get<MeshForwarder>().GetCounters();
|
return &instance.Get<MeshForwarder>().GetCounters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void otThreadResetIp6Counters(otInstance *aInstance)
|
||||||
|
{
|
||||||
|
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||||
|
|
||||||
|
instance.Get<MeshForwarder>().ResetCounters();
|
||||||
|
}
|
||||||
|
|
||||||
const otMleCounters *otThreadGetMleCounters(otInstance *aInstance)
|
const otMleCounters *otThreadGetMleCounters(otInstance *aInstance)
|
||||||
{
|
{
|
||||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||||
|
|||||||
@@ -78,10 +78,7 @@ MeshForwarder::MeshForwarder(Instance &aInstance)
|
|||||||
{
|
{
|
||||||
mFragTag = Random::NonCrypto::GetUint16();
|
mFragTag = Random::NonCrypto::GetUint16();
|
||||||
|
|
||||||
mIpCounters.mTxSuccess = 0;
|
ResetCounters();
|
||||||
mIpCounters.mRxSuccess = 0;
|
|
||||||
mIpCounters.mTxFailure = 0;
|
|
||||||
mIpCounters.mRxFailure = 0;
|
|
||||||
|
|
||||||
#if OPENTHREAD_FTD
|
#if OPENTHREAD_FTD
|
||||||
memset(mFragmentEntries, 0, sizeof(mFragmentEntries));
|
memset(mFragmentEntries, 0, sizeof(mFragmentEntries));
|
||||||
|
|||||||
@@ -297,6 +297,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
const otIpCounters &GetCounters(void) const { return mIpCounters; }
|
const otIpCounters &GetCounters(void) const { return mIpCounters; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method resets the IP level counters.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void ResetCounters(void) { memset(&mIpCounters, 0, sizeof(mIpCounters)); }
|
||||||
|
|
||||||
#if OPENTHREAD_FTD
|
#if OPENTHREAD_FTD
|
||||||
/**
|
/**
|
||||||
* This method returns a reference to the resolving queue.
|
* This method returns a reference to the resolving queue.
|
||||||
|
|||||||
Reference in New Issue
Block a user