mirror of
https://github.com/espressif/openthread.git
synced 2026-08-03 17:37:46 +00:00
[network-diagnostic] fix sed capacity when skipped in Connectivity Tlv (#4654)
This commit is contained in:
@@ -368,11 +368,19 @@ public:
|
||||
*/
|
||||
bool IsValid(void) const
|
||||
{
|
||||
return ((GetLength() >= sizeof(*this) - sizeof(NetworkDiagnosticTlv)) ||
|
||||
(GetLength() ==
|
||||
sizeof(*this) - sizeof(NetworkDiagnosticTlv) - sizeof(mSedBufferSize) - sizeof(mSedDatagramCount)));
|
||||
return IsSedBufferingIncluded() || (GetLength() == sizeof(*this) - sizeof(NetworkDiagnosticTlv) -
|
||||
sizeof(mSedBufferSize) - sizeof(mSedDatagramCount));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method indicates whether or not the sed buffer size and datagram count are included.
|
||||
*
|
||||
* @retval TRUE If the sed buffer size and datagram count are included.
|
||||
* @retval FALSE If the sed buffer size and datagram count are not included.
|
||||
*
|
||||
*/
|
||||
bool IsSedBufferingIncluded(void) const { return GetLength() >= sizeof(*this) - sizeof(Tlv); }
|
||||
|
||||
/**
|
||||
* This method returns the Parent Priority value.
|
||||
*
|
||||
@@ -494,7 +502,16 @@ public:
|
||||
* @returns The SED Buffer Size value.
|
||||
*
|
||||
*/
|
||||
uint16_t GetSedBufferSize(void) const { return HostSwap16(mSedBufferSize); }
|
||||
uint16_t GetSedBufferSize(void) const
|
||||
{
|
||||
uint16_t buffersize = OPENTHREAD_CONFIG_DEFAULT_SED_BUFFER_SIZE;
|
||||
|
||||
if (IsSedBufferingIncluded())
|
||||
{
|
||||
buffersize = HostSwap16(mSedBufferSize);
|
||||
}
|
||||
return buffersize;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the SED Buffer Size value.
|
||||
@@ -510,7 +527,16 @@ public:
|
||||
* @returns The SED Datagram Count value.
|
||||
*
|
||||
*/
|
||||
uint8_t GetSedDatagramCount(void) const { return mSedDatagramCount; }
|
||||
uint8_t GetSedDatagramCount(void) const
|
||||
{
|
||||
uint8_t count = OPENTHREAD_CONFIG_DEFAULT_SED_DATAGRAM_COUNT;
|
||||
|
||||
if (IsSedBufferingIncluded())
|
||||
{
|
||||
count = mSedDatagramCount;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the SED Datagram Count value.
|
||||
|
||||
Reference in New Issue
Block a user