mirror of
https://github.com/espressif/openthread.git
synced 2026-07-27 06:17:47 +00:00
[message] extend buffer info provided by otMessageGetBufferInfo() (#2249)
* Include application CoAP messages and buffers * Include cached messages and buffers * Set unused buffer info fields to zero
This commit is contained in:
@@ -1007,6 +1007,8 @@ typedef struct otBufferInfo
|
||||
uint16_t mCoapBuffers; ///< The number of buffers in the CoAP send queue.
|
||||
uint16_t mCoapSecureMessages; ///< The number of messages in the CoAP secure send queue.
|
||||
uint16_t mCoapSecureBuffers; ///< The number of buffers in the CoAP secure send queue.
|
||||
uint16_t mApplicationCoapMessages;///< The number of messages in the application CoAP send queue.
|
||||
uint16_t mApplicationCoapBuffers; ///< The number of buffers in the application CoAP send queue.
|
||||
} otBufferInfo;
|
||||
|
||||
/**
|
||||
|
||||
@@ -441,6 +441,8 @@ void Interpreter::ProcessBufferInfo(int argc, char *argv[])
|
||||
mServer->OutputFormat("arp: %d %d\r\n", bufferInfo.mArpMessages, bufferInfo.mArpBuffers);
|
||||
mServer->OutputFormat("coap: %d %d\r\n", bufferInfo.mCoapMessages, bufferInfo.mCoapBuffers);
|
||||
mServer->OutputFormat("coap secure: %d %d\r\n", bufferInfo.mCoapSecureMessages, bufferInfo.mCoapSecureBuffers);
|
||||
mServer->OutputFormat("application coap: %d %d\r\n", bufferInfo.mApplicationCoapMessages,
|
||||
bufferInfo.mApplicationCoapBuffers);
|
||||
|
||||
AppendResult(OT_ERROR_NONE);
|
||||
}
|
||||
|
||||
@@ -152,6 +152,8 @@ exit:
|
||||
|
||||
void otMessageGetBufferInfo(otInstance *aInstance, otBufferInfo *aBufferInfo)
|
||||
{
|
||||
uint16_t messages, buffers;
|
||||
|
||||
aBufferInfo->mTotalBuffers = OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS;
|
||||
|
||||
aBufferInfo->mFreeBuffers = aInstance->mMessagePool.GetFreeBufferCount();
|
||||
@@ -176,4 +178,18 @@ void otMessageGetBufferInfo(otInstance *aInstance, otBufferInfo *aBufferInfo)
|
||||
|
||||
aInstance->mThreadNetif.GetCoap().GetRequestMessages().GetInfo(aBufferInfo->mCoapMessages,
|
||||
aBufferInfo->mCoapBuffers);
|
||||
aInstance->mThreadNetif.GetCoap().GetCachedResponses().GetInfo(messages, buffers);
|
||||
aBufferInfo->mCoapMessages += messages;
|
||||
aBufferInfo->mCoapBuffers += buffers;
|
||||
|
||||
#if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
aInstance->mApplicationCoap.GetRequestMessages().GetInfo(aBufferInfo->mApplicationCoapMessages,
|
||||
aBufferInfo->mApplicationCoapBuffers);
|
||||
aInstance->mApplicationCoap.GetCachedResponses().GetInfo(messages, buffers);
|
||||
aBufferInfo->mApplicationCoapMessages += messages;
|
||||
aBufferInfo->mApplicationCoapBuffers += buffers;
|
||||
#else
|
||||
aBufferInfo->mApplicationCoapMessages = 0;
|
||||
aBufferInfo->mApplicationCoapBuffers = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user