mirror of
https://github.com/espressif/openthread.git
synced 2026-08-17 16:09:51 +00:00
[tmf] add method to read entry from ChildTableTlv (#4147)
This commit add a method to read entry from ChildTableTlv. The GetEntry() cannot be used because the current read ChildTableTlv operation doesn't read child table entries.
This commit is contained in:
@@ -1348,6 +1348,26 @@ public:
|
||||
return *reinterpret_cast<ChildTableEntry *>(GetValue() + (aIndex * sizeof(ChildTableEntry)));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method reads the Child Table entry at @p aIndex.
|
||||
*
|
||||
* @param[out] aEntry A reference to a ChildTableEntry.
|
||||
* @param[in] aMessage A reference to the message.
|
||||
* @param[in] aOffset The offset of the ChildTableTLV in aMessage.
|
||||
* @param[in] aIndex The index into the Child Table list.
|
||||
*
|
||||
* @retval OT_ERROR_NOT_FOUND No such entry is found.
|
||||
* @retval OT_ERROR_NONE Successfully read the entry.
|
||||
*/
|
||||
otError ReadEntry(ChildTableEntry &aEntry, Message &aMessage, uint16_t aOffset, uint8_t aIndex) const
|
||||
{
|
||||
return (aIndex < GetNumEntries() &&
|
||||
aMessage.Read(aOffset + sizeof(ChildTableTlv) + (aIndex * sizeof(ChildTableEntry)),
|
||||
sizeof(ChildTableEntry), &aEntry) == sizeof(ChildTableEntry))
|
||||
? OT_ERROR_NONE
|
||||
: OT_ERROR_INVALID_ARGS;
|
||||
}
|
||||
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user