46 using ot::Encoding::BigEndian::HostSwap16;
47 using ot::Encoding::BigEndian::HostSwap32;
73 uint8_t
GetType(
void)
const {
return mType; }
81 void SetType(uint8_t aType) { mType = aType; }
97 void SetLength(uint8_t aLength) { mLength = aLength; }
105 uint8_t
GetSize(
void)
const {
return sizeof(
Tlv) + mLength; }
113 uint8_t *
GetValue(
void) {
return reinterpret_cast<uint8_t *
>(
this) +
sizeof(
Tlv); }
121 const uint8_t *
GetValue(
void)
const {
return reinterpret_cast<const uint8_t *
>(
this) +
sizeof(
Tlv); }
130 return reinterpret_cast<Tlv *
>(
reinterpret_cast<uint8_t *
>(
this) +
sizeof(*
this) + mLength);
140 return reinterpret_cast<const Tlv *
>(
reinterpret_cast<const uint8_t *
>(
this) +
sizeof(*
this) + mLength);
207 uint16_t
GetLength(
void)
const {
return HostSwap16(mLength); }
This file defines the types and structures used in the OpenThread library API.
This file is a wrapper for the standard "string.h" file Some platforms provide all required functions...
const Tlv * GetNext(void) const
This method returns a pointer to the next TLV.
Definition: tlvs.hpp:139
Extended Length value.
Definition: tlvs.hpp:191
static otError Get(const Message &aMessage, uint8_t aType, uint16_t aMaxLength, Tlv &aTlv)
This static method reads the requested TLV out of aMessage.
Definition: tlvs.cpp:41
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.
Definition: tlvs.cpp:100
void SetType(uint8_t aType)
This method sets the Type value.
Definition: tlvs.hpp:81
uint16_t GetLength(void) const
This method returns the Length value.
Definition: tlvs.hpp:207
This class represents a message.
Definition: message.hpp:195
This file includes definitions for the message buffer pool and message buffers.
const uint8_t * GetValue(void) const
This method returns a pointer to the Value.
Definition: tlvs.hpp:121
uint8_t * GetValue(void)
This method returns a pointer to the Value.
Definition: tlvs.hpp:113
This file includes definitions for byte-ordering encoding.
Tlv * GetNext(void)
This method returns a pointer to the next TLV.
Definition: tlvs.hpp:129
void SetLength(uint16_t aLength)
This method sets the Length value.
Definition: tlvs.hpp:215
static otError GetOffset(const Message &aMessage, uint8_t aType, uint16_t &aOffset)
This static method obtains the offset of a TLV within aMessage.
Definition: tlvs.cpp:60
Tlv(void)
Default constructor.
Definition: tlvs.hpp:63
void SetLength(uint8_t aLength)
This method sets the Length value.
Definition: tlvs.hpp:97
uint8_t GetType(void) const
This method returns the Type value.
Definition: tlvs.hpp:73
This class implements TLV generation and parsing.
Definition: tlvs.hpp:56
uint8_t GetSize(void) const
This method returns the total size including Type, Length, and Value fields.
Definition: tlvs.hpp:105
otError
This enumeration represents error codes used throughout OpenThread.
Definition: types.h:107
uint8_t GetLength(void) const
This method returns the Length value.
Definition: tlvs.hpp:89
This file includes compile-time configuration constants for OpenThread.