class FrameData

Defined at line 51 of file ../../third_party/openthread/src/core/common/frame_data.hpp

Represents a frame `Data` which is simply a wrapper over a pointer to a buffer with a given frame length.

It provide helper method to parse the content. As data is parsed and read, the `FrameData` is updated to skip over

the read content.

Public Methods

bool CanRead (uint16_t aLength)

Indicates whether or not there are enough bytes remaining in the `FrameData` to read a given number

of bytes.

Parameters

aLength [in] The read length to check.

Defined at line 63 of file ../../third_party/openthread/src/core/common/frame_data.hpp

template <typename ObjectType>
Error Read (ObjectType & aObject)

Reads an object from the `FrameData`.

Parameters

aObject [out] A reference to the object to read into.

Template Parameters

ObjectType The object type to read from the message.

Defined at line 118 of file ../../third_party/openthread/src/core/common/frame_data.hpp

template <typename ObjectType>
const ObjectType * Read ()

Reads an object from the `FrameData` without copying.

Template Parameters

ObjectType The object type to read from the `FrameData`.

Defined at line 133 of file ../../third_party/openthread/src/core/common/frame_data.hpp

Error ReadUint8 (uint8_t & aUint8)

Reads an `uint8_t` value from the `FrameData`.

If read successfully, the `FrameData` is updated to skip over the read content.

Parameters

aUint8 [out] A reference to an `uint8_t` to return the read value.
template <Encoding kEncoding, typename UintType>
Error ReadUint (UintType & aUint)

Reads an integer value with a specified encoding from the `FrameData`.

The value is read from the frame data, converted from the specified

byte order to

host byte order, and returned in

If read successfully, the `FrameData` is updated to skip over the read content.

Parameters

aUint [out] A reference to the integer to return the read value.

Template Parameters

kEncoding The encoding of the integer in the frame data (big or little endian).
UintType The unsigned integer type.
Error ReadBytes (void * aBuffer, uint16_t aLength)

Reads a given number of bytes from the `FrameData`.

If read successfully, the `FrameData` is updated to skip over the read content.

Parameters

aBuffer [out] The buffer to copy the read bytes into.
aLength [in] Number of bytes to read.
void SkipOver (uint16_t aLength)

Skips over a given number of bytes from `FrameData`.

The caller MUST make sure that the

is smaller than current data length. Otherwise the behavior of

this method is undefined.

Parameters

aLength [in] The length (number of bytes) to skip over.
Error RemoveFooter (uint16_t aLength)

Removes a footer of a given length from the end of the `FrameData`.

Parameters

aLength [in] The length of the footer (number of bytes) to remove.