This class implements TLV generation and parsing.
More...
#include <src/core/common/tlvs.hpp>
|
| Tlv (void) |
| Default constructor.
|
|
uint8_t | GetType (void) const |
| This method returns the Type value. More...
|
|
void | SetType (uint8_t aType) |
| This method sets the Type value. More...
|
|
uint8_t | GetLength (void) const |
| This method returns the Length value. More...
|
|
void | SetLength (uint8_t aLength) |
| This method sets the Length value. More...
|
|
uint8_t | GetSize (void) const |
| This method returns the total size including Type, Length, and Value fields. More...
|
|
uint8_t * | GetValue (void) |
| This method returns a pointer to the Value. More...
|
|
const uint8_t * | GetValue (void) const |
| This method returns a pointer to the Value. More...
|
|
Tlv * | GetNext (void) |
| This method returns a pointer to the next TLV. More...
|
|
const Tlv * | GetNext (void) const |
| This method returns a pointer to the next TLV. More...
|
|
|
static otError | Get (const Message &aMessage, uint8_t aType, uint16_t aMaxLength, Tlv &aTlv) |
| This static method reads the requested TLV out of aMessage . More...
|
|
static otError | GetOffset (const Message &aMessage, uint8_t aType, uint16_t &aOffset) |
| This static method obtains the offset of a TLV within aMessage . More...
|
|
static otError | GetValueOffset (const Message &aMesasge, uint8_t aType, uint16_t &aOffset, uint16_t &aLength) |
| This static method finds the offset and length of a given TLV type. More...
|
|
This class implements TLV generation and parsing.
§ anonymous enum
Length values.
Enumerator |
---|
kExtendedLength | Extended Length value.
|
§ Get()
otError ot::Tlv::Get |
( |
const Message & |
aMessage, |
|
|
uint8_t |
aType, |
|
|
uint16_t |
aMaxLength, |
|
|
Tlv & |
aTlv |
|
) |
| |
|
static |
This static method reads the requested TLV out of aMessage
.
- Parameters
-
[in] | aMessage | A reference to the message. |
[in] | aType | The Type value to search for. |
[in] | aMaxLength | Maximum number of bytes to read. |
[out] | aTlv | A reference to the TLV that will be copied to. |
- Return values
-
OT_ERROR_NONE | Successfully copied the TLV. |
OT_ERROR_NOT_FOUND | Could not find the TLV with Type aType . |
§ GetLength()
uint8_t ot::Tlv::GetLength |
( |
void |
| ) |
const |
|
inline |
This method returns the Length value.
- Returns
- The Length value.
§ GetNext() [1/2]
Tlv* ot::Tlv::GetNext |
( |
void |
| ) |
|
|
inline |
This method returns a pointer to the next TLV.
- Returns
- A pointer to the next TLV.
§ GetNext() [2/2]
const Tlv* ot::Tlv::GetNext |
( |
void |
| ) |
const |
|
inline |
This method returns a pointer to the next TLV.
- Returns
- A pointer to the next TLV.
§ GetOffset()
otError ot::Tlv::GetOffset |
( |
const Message & |
aMessage, |
|
|
uint8_t |
aType, |
|
|
uint16_t & |
aOffset |
|
) |
| |
|
static |
This static method obtains the offset of a TLV within aMessage
.
- Parameters
-
[in] | aMessage | A reference to the message. |
[in] | aType | The Type value to search for. |
[out] | aOffset | A reference to the offset of the TLV. |
- Return values
-
OT_ERROR_NONE | Successfully copied the TLV. |
OT_ERROR_NOT_FOUND | Could not find the TLV with Type aType . |
§ GetSize()
uint8_t ot::Tlv::GetSize |
( |
void |
| ) |
const |
|
inline |
This method returns the total size including Type, Length, and Value fields.
- Returns
- The total size include Type, Length, and Value fields.
§ GetType()
uint8_t ot::Tlv::GetType |
( |
void |
| ) |
const |
|
inline |
This method returns the Type value.
- Returns
- The Type value.
§ GetValue() [1/2]
uint8_t* ot::Tlv::GetValue |
( |
void |
| ) |
|
|
inline |
This method returns a pointer to the Value.
- Returns
- A pointer to the value.
§ GetValue() [2/2]
const uint8_t* ot::Tlv::GetValue |
( |
void |
| ) |
const |
|
inline |
This method returns a pointer to the Value.
- Returns
- A pointer to the value.
§ GetValueOffset()
otError ot::Tlv::GetValueOffset |
( |
const Message & |
aMesasge, |
|
|
uint8_t |
aType, |
|
|
uint16_t & |
aOffset, |
|
|
uint16_t & |
aLength |
|
) |
| |
|
static |
This static method finds the offset and length of a given TLV type.
- Parameters
-
[in] | aMessage | A reference to the message. |
[in] | aType | The Type value to search for. |
[out] | aOffset | The offset where the value starts. |
[out] | aLength | The length of the value. |
- Return values
-
OT_ERROR_NONE | Successfully found the TLV. |
OT_ERROR_NOT_FOUND | Could not find the TLV with Type aType . |
§ SetLength()
void ot::Tlv::SetLength |
( |
uint8_t |
aLength | ) |
|
|
inline |
This method sets the Length value.
- Parameters
-
[in] | aLength | The Length value. |
§ SetType()
void ot::Tlv::SetType |
( |
uint8_t |
aType | ) |
|
|
inline |
This method sets the Type value.
- Parameters
-
The documentation for this class was generated from the following files: