0.01.00
ot::Tlv Class Reference

This class implements TLV generation and parsing. More...

#include <src/core/common/tlvs.hpp>

Inheritance diagram for ot::Tlv:
ot::ExtendedTlv ot::MeshCoP::Tlv ot::Mle::Tlv ot::NetworkDiagnostic::NetworkDiagnosticTlv ot::ThreadTlv ot::MeshCoP::ActiveTimestampTlv ot::MeshCoP::BorderAgentLocatorTlv ot::MeshCoP::ChannelMaskTlv ot::MeshCoP::ChannelTlv ot::MeshCoP::CommissionerIdTlv ot::MeshCoP::CommissionerSessionIdTlv ot::MeshCoP::CountTlv ot::MeshCoP::DelayTimerTlv ot::MeshCoP::DiscoveryRequestTlv ot::MeshCoP::DiscoveryResponseTlv ot::MeshCoP::EnergyListTlv ot::MeshCoP::ExtendedPanIdTlv ot::MeshCoP::JoinerIidTlv ot::MeshCoP::JoinerRouterKekTlv ot::MeshCoP::JoinerRouterLocatorTlv ot::MeshCoP::JoinerUdpPortTlv ot::MeshCoP::MeshLocalPrefixTlv ot::MeshCoP::NetworkKeySequenceTlv ot::MeshCoP::NetworkMasterKeyTlv ot::MeshCoP::NetworkNameTlv ot::MeshCoP::PanIdTlv ot::MeshCoP::PendingTimestampTlv ot::MeshCoP::PeriodTlv ot::MeshCoP::ProvisioningUrlTlv ot::MeshCoP::PSKcTlv ot::MeshCoP::ScanDurationTlv ot::MeshCoP::SecurityPolicyTlv ot::MeshCoP::StateTlv ot::MeshCoP::SteeringDataTlv ot::MeshCoP::VendorDataTlv ot::MeshCoP::VendorModelTlv ot::MeshCoP::VendorNameTlv ot::MeshCoP::VendorStackVersionTlv ot::MeshCoP::VendorSwVersionTlv ot::Mle::ActiveTimestampTlv ot::Mle::Address16Tlv ot::Mle::AddressRegistrationTlv ot::Mle::ChallengeTlv ot::Mle::ChannelTlv ot::Mle::ConnectivityTlv ot::Mle::LeaderDataTlv ot::Mle::LinkFrameCounterTlv ot::Mle::LinkMarginTlv ot::Mle::MleFrameCounterTlv ot::Mle::ModeTlv ot::Mle::NetworkDataTlv ot::Mle::PanIdTlv ot::Mle::PendingTimestampTlv ot::Mle::ResponseTlv ot::Mle::RouteTlv ot::Mle::ScanMaskTlv ot::Mle::SourceAddressTlv ot::Mle::StatusTlv ot::Mle::TimeoutTlv ot::Mle::TlvRequestTlv ot::Mle::VersionTlv ot::NetworkDiagnostic::Address16Tlv ot::NetworkDiagnostic::BatteryLevelTlv ot::NetworkDiagnostic::ChannelPagesTlv ot::NetworkDiagnostic::ChildTableTlv ot::NetworkDiagnostic::ConnectivityTlv ot::NetworkDiagnostic::ExtMacAddressTlv ot::NetworkDiagnostic::Ip6AddressListTlv ot::NetworkDiagnostic::LeaderDataTlv ot::NetworkDiagnostic::MacCountersTlv ot::NetworkDiagnostic::MaxChildTimeoutTlv ot::NetworkDiagnostic::ModeTlv ot::NetworkDiagnostic::NetworkDataTlv ot::NetworkDiagnostic::RouteTlv ot::NetworkDiagnostic::SupplyVoltageTlv ot::NetworkDiagnostic::TimeoutTlv ot::NetworkDiagnostic::TypeListTlv ot::ThreadExtMacAddressTlv ot::ThreadLastTransactionTimeTlv ot::ThreadMeshLocalEidTlv ot::ThreadNetworkDataTlv ot::ThreadRloc16Tlv ot::ThreadRouterMaskTlv ot::ThreadStatusTlv ot::ThreadTargetTlv

Public Member Functions

 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...
 
TlvGetNext (void)
 This method returns a pointer to the next TLV. More...
 
const TlvGetNext (void) const
 This method returns a pointer to the next TLV. More...
 

Static Public Member Functions

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...
 

Protected Types

enum  { kExtendedLength = 255 }
 Length values. More...
 

Detailed Description

This class implements TLV generation and parsing.

Member Enumeration Documentation

§ anonymous enum

anonymous enum
protected

Length values.

Enumerator
kExtendedLength 

Extended Length value.

Member Function Documentation

§ 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]aMessageA reference to the message.
[in]aTypeThe Type value to search for.
[in]aMaxLengthMaximum number of bytes to read.
[out]aTlvA reference to the TLV that will be copied to.
Return values
OT_ERROR_NONESuccessfully copied the TLV.
OT_ERROR_NOT_FOUNDCould 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]aMessageA reference to the message.
[in]aTypeThe Type value to search for.
[out]aOffsetA reference to the offset of the TLV.
Return values
OT_ERROR_NONESuccessfully copied the TLV.
OT_ERROR_NOT_FOUNDCould 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]aMessageA reference to the message.
[in]aTypeThe Type value to search for.
[out]aOffsetThe offset where the value starts.
[out]aLengthThe length of the value.
Return values
OT_ERROR_NONESuccessfully found the TLV.
OT_ERROR_NOT_FOUNDCould not find the TLV with Type aType.

§ SetLength()

void ot::Tlv::SetLength ( uint8_t  aLength)
inline

This method sets the Length value.

Parameters
[in]aLengthThe Length value.

§ SetType()

void ot::Tlv::SetType ( uint8_t  aType)
inline

This method sets the Type value.

Parameters
[in]aTypeThe Type value.

The documentation for this class was generated from the following files: