OpenThread  1.05.02.06
Data Structures | Typedefs | Enumerations | Enumerator | Functions | Variables | Friends

This module includes definitions for managing Thread Network Data. More...

+ Collaboration diagram for Core:

Data Structures

struct  NetworkData::Config
 
class  MutableNetworkData
 
class  NetworkData
 
class  NetworkData::NetworkDataIterator
 

Typedefs

typedef otNetworkDataIterator Iterator
 

Enumerations

enum  ServiceMatchMode : uint8_t { kServicePrefixMatch, kServiceExactMatch }
 

Functions

void AdvaceSubTlv (const NetworkDataTlv *aSubTlvs)
 
void AdvanceTlv (const uint8_t *aTlvs)
 
NetworkDataTlvAppendTlv (uint16_t aTlvSize)
 
bool CanInsert (uint16_t aSize) const
 
void Clear (void)
 
bool ContainsEntriesFrom (const NetworkData &aCompare, uint16_t aRloc16) const
 
bool ContainsExternalRoute (const ExternalRouteConfig &aRoute) const
 
bool ContainsOnMeshPrefix (const OnMeshPrefixConfig &aPrefix) const
 
bool ContainsService (const ServiceConfig &aService) const
 
Error CopyNetworkData (Type aType, uint8_t *aData, uint8_t &aDataLength) const
 
Error CopyNetworkData (Type aType, MutableNetworkData &aNetworkData) const
 
uint8_t CountBorderRouters (RoleFilter aRoleFilter) const
 
Error FindBorderRouters (RoleFilter aRoleFilter, uint16_t aRlocs[], uint8_t &aRlocsLength) const
 
const ServiceTlvFindNextService (const ServiceTlv *aPrevServiceTlv, uint32_t aEnterpriseNumber, const ServiceData &aServiceData, ServiceMatchMode aServiceMatchMode) const
 
const ServiceTlvFindNextThreadService (const ServiceTlv *aPrevServiceTlv, const ServiceData &aServiceData, ServiceMatchMode aServiceMatchMode) const
 
const PrefixTlvFindPrefix (const uint8_t *aPrefix, uint8_t aPrefixLength) const
 
const PrefixTlvFindPrefix (const Ip6::Prefix &aPrefix) const
 
PrefixTlvFindPrefix (const uint8_t *aPrefix, uint8_t aPrefixLength)
 
PrefixTlvFindPrefix (const Ip6::Prefix &aPrefix)
 
const ServiceTlvFindService (uint32_t aEnterpriseNumber, const ServiceData &aServiceData, ServiceMatchMode aServiceMatchMode) const
 
ServiceTlvFindService (uint32_t aEnterpriseNumber, const ServiceData &aServiceData, ServiceMatchMode aServiceMatchMode)
 
uint8_t GetAndAdvanceIndex (void)
 
const uint8_t * GetBytes (void) const
 
uint8_t * GetBytes (void)
 
uint8_t GetEntryIndex (void) const
 
uint8_t GetLength (void) const
 
Error GetNextExternalRoute (Iterator &aIterator, ExternalRouteConfig &aConfig) const
 
Error GetNextExternalRoute (Iterator &aIterator, uint16_t aRloc16, ExternalRouteConfig &aConfig) const
 
Error GetNextOnMeshPrefix (Iterator &aIterator, OnMeshPrefixConfig &aConfig) const
 
Error GetNextOnMeshPrefix (Iterator &aIterator, uint16_t aRloc16, OnMeshPrefixConfig &aConfig) const
 
Error GetNextServer (Iterator &aIterator, uint16_t &aRloc16) const
 
Error GetNextService (Iterator &aIterator, ServiceConfig &aConfig) const
 
Error GetNextService (Iterator &aIterator, uint16_t aRloc16, ServiceConfig &aConfig) const
 
uint8_t GetSize (void) const
 
const NetworkDataTlvGetSubTlv (const NetworkDataTlv *aSubTlvs) const
 
uint8_t GetSubTlvOffset (void) const
 
const NetworkDataTlvGetTlv (const uint8_t *aTlvs) const
 
uint8_t GetTlvOffset (void) const
 
const NetworkDataTlvGetTlvsEnd (void) const
 
NetworkDataTlvGetTlvsEnd (void)
 
const NetworkDataTlvGetTlvsStart (void) const
 
NetworkDataTlvGetTlvsStart (void)
 
void Insert (void *aStart, uint8_t aLength)
 
bool IsNewEntry (void) const
 
Error Iterate (Iterator &aIterator, uint16_t aRloc16, Config &aConfig) const
 
void MarkEntryAsNotNew (void)
 
static bool MatchService (const ServiceTlv &aServiceTlv, uint32_t aEnterpriseNumber, const ServiceData &aServiceData, ServiceMatchMode aServiceMatchMode)
 
 MutableNetworkData (Instance &aInstance, uint8_t *aTlvs, uint8_t aLength, uint8_t aSize)
 
 NetworkData (Instance &aInstance, const uint8_t *aTlvs=nullptr, uint8_t aLength=0)
 
 NetworkData (Instance &aInstance, const NetworkDataTlv *aStartTlv, const NetworkDataTlv *aEndTlv)
 
 NetworkDataIterator (Iterator &aIterator)
 
void Remove (void *aRemoveStart, uint8_t aRemoveLength)
 
void RemoveTemporaryData (void)
 
void RemoveTemporaryDataIn (PrefixTlv &aPrefix)
 
void RemoveTemporaryDataIn (ServiceTlv &aService)
 
void RemoveTlv (NetworkDataTlv *aTlv)
 
void SaveSubTlvOffset (const NetworkDataTlv *aSubTlv, const NetworkDataTlv *aSubTlvs)
 
void SaveTlvOffset (const NetworkDataTlv *aTlv, const uint8_t *aTlvs)
 
Error SendServerDataNotification (uint16_t aRloc16, bool aAppendNetDataTlv, Coap::ResponseHandler aHandler, void *aContext) const
 
void SetEntryIndex (uint8_t aIndex)
 
void SetLength (uint8_t aLength)
 
void SetSubTlvOffset (uint8_t aOffset)
 
void SetTlvOffset (uint8_t aOffset)
 

Variables

static constexpr uint8_t kEntryPosition = 2
 
constexpr Iterator kIteratorInit = OT_NETWORK_DATA_ITERATOR_INIT
 Initializer for Iterator type. More...
 
static constexpr uint8_t kMaxSize = 254
 Maximum size of Thread Network Data in bytes. More...
 
static constexpr uint8_t kSubTlvPosition = 1
 
static constexpr uint8_t kTlvPosition = 0
 
ExternalRouteConfigmExternalRoute
 
uint8_t * mIteratorBuffer
 
uint8_t mLength
 
OnMeshPrefixConfigmOnMeshPrefix
 
ServiceConfigmService
 
uint8_t mSize
 
const uint8_t * mTlvs
 

Friends

class Leader
 
class MutableNetworkData
 
class NetworkData
 
class Publisher
 
class Publisher
 
class Service::Manager
 
class Service::Manager
 

Detailed Description

This module includes definitions for managing Thread Network Data.

Typedef Documentation

§ Iterator

This type represents a Iterator used to iterate through Network Data info (e.g., see GetNextOnMeshPrefix())

Enumeration Type Documentation

§ ServiceMatchMode

enum ServiceMatchMode : uint8_t
protected

This enumeration defines Service Data match mode.

Enumerator
kServicePrefixMatch 

Match the Service Data by prefix.

kServiceExactMatch 

Match the full Service Data exactly.

Function Documentation

§ NetworkData() [1/2]

NetworkData ( Instance aInstance,
const uint8_t *  aTlvs = nullptr,
uint8_t  aLength = 0 
)
inlineexplicit

This constructor initializes the NetworkData from a given pointer to a buffer and length.

Parameters
[in]aInstanceA reference to the OpenThread instance.
[in]aTlvsA pointer to the buffer containing the TLVs.
[in]aLengthThe length (number of bytes) of aTlvs buffer.

Referenced by NetworkData::FindNextService().

§ NetworkData() [2/2]

NetworkData ( Instance aInstance,
const NetworkDataTlv aStartTlv,
const NetworkDataTlv aEndTlv 
)
inline

This constructor initializes the NetworkData from a range of TLVs (given as pair of start and end pointers).

Parameters
[in]aInstanceA reference to the OpenThread instance.
[in]aStartTlvA pointer to the start of the TLVs buffer.
[in]aEndTlvA pointer to the end of the TLVs buffer.

§ GetLength()

uint8_t GetLength ( void  ) const
inline

This method returns the length of NetworkData (number of bytes).

Returns
The length of NetworkData (number of bytes).

Referenced by NetworkData::CopyNetworkData(), NetworkData::FindBorderRouters(), MutableNetworkData::MutableNetworkData(), and LeaderBase::SetNetworkData().

§ GetBytes() [1/2]

const uint8_t* GetBytes ( void  ) const
inline

This method returns a pointer to the start of the TLVs in NetworkData.

Returns
A pointer to the start of the TLVs.

Referenced by MutableNetworkData::MutableNetworkData(), and MutableNetworkData::Remove().

§ CopyNetworkData() [1/2]

Error CopyNetworkData ( Type  aType,
uint8_t *  aData,
uint8_t &  aDataLength 
) const

This method provides full or stable copy of the Thread Network Data.

Parameters
[in]aTypeThe Network Data type to copy, the full set or stable subset.
[out]aDataA pointer to the data buffer to copy the Network Data into.
[in,out]aDataLengthOn entry, size of the data buffer pointed to by aData. On exit, number of copied bytes.
Return values
kErrorNoneSuccessfully copied Thread Network Data.
kErrorNoBufsNot enough space in aData to fully copy Thread Network Data.

References InstanceLocator::GetInstance(), NetworkData::GetLength(), and SuccessOrExit.

§ CopyNetworkData() [2/2]

Error CopyNetworkData ( Type  aType,
MutableNetworkData aNetworkData 
) const

This method provides full or stable copy of the Thread Network Data.

Parameters
[in]aTypeThe Network Data type to copy, the full set or stable subset.
[out]aNetworkDataA reference to a MutableNetworkData to copy the Network Data into.
Return values
kErrorNoneSuccessfully copied Thread Network Data.
kErrorNoBufsNot enough space in aNetworkData to fully copy Thread Network Data.

References MutableNetworkData::GetBytes(), MutableNetworkData::GetSize(), ot::kErrorNoBufs, ot::kErrorNone, ot::NetworkData::kStableSubset, NetworkData::mLength, NetworkData::mTlvs, MutableNetworkData::RemoveTemporaryData(), MutableNetworkData::SetLength(), and VerifyOrExit.

§ GetNextOnMeshPrefix() [1/2]

Error GetNextOnMeshPrefix ( Iterator aIterator,
OnMeshPrefixConfig aConfig 
) const

This method provides the next On Mesh prefix in the Thread Network Data.

Parameters
[in,out]aIteratorA reference to the Network Data iterator.
[out]aConfigA reference to a config variable where the On Mesh Prefix information will be placed.
Return values
kErrorNoneSuccessfully found the next On Mesh prefix.
kErrorNotFoundNo subsequent On Mesh prefix exists in the Thread Network Data.

References ot::Mac::kShortAddrBroadcast.

Referenced by NetworkData::ContainsOnMeshPrefix(), and NetworkData::FindBorderRouters().

§ GetNextOnMeshPrefix() [2/2]

Error GetNextOnMeshPrefix ( Iterator aIterator,
uint16_t  aRloc16,
OnMeshPrefixConfig aConfig 
) const

This method provides the next On Mesh prefix in the Thread Network Data for a given RLOC16.

Parameters
[in,out]aIteratorA reference to the Network Data iterator.
[in]aRloc16The RLOC16 value.
[out]aConfigA reference to a config variable where the On Mesh Prefix information will be placed.
Return values
kErrorNoneSuccessfully found the next On Mesh prefix.
kErrorNotFoundNo subsequent On Mesh prefix exists in the Thread Network Data.

References NetworkData::Iterate(), NetworkData::Config::mExternalRoute, NetworkData::Config::mOnMeshPrefix, and NetworkData::Config::mService.

§ GetNextExternalRoute() [1/2]

Error GetNextExternalRoute ( Iterator aIterator,
ExternalRouteConfig aConfig 
) const

This method provides the next external route in the Thread Network Data.

Parameters
[in,out]aIteratorA reference to the Network Data iterator.
[out]aConfigA reference to a config variable where the external route information will be placed.
Return values
kErrorNoneSuccessfully found the next external route.
kErrorNotFoundNo subsequent external route exists in the Thread Network Data.

References ot::Mac::kShortAddrBroadcast.

Referenced by NetworkData::ContainsExternalRoute(), NetworkData::FindBorderRouters(), and LeaderBase::GetPreferredNat64Prefix().

§ GetNextExternalRoute() [2/2]

Error GetNextExternalRoute ( Iterator aIterator,
uint16_t  aRloc16,
ExternalRouteConfig aConfig 
) const

This method provides the next external route in the Thread Network Data for a given RLOC16.

Parameters
[in,out]aIteratorA reference to the Network Data iterator.
[in]aRloc16The RLOC16 value.
[out]aConfigA reference to a config variable where the external route information will be placed.
Return values
kErrorNoneSuccessfully found the next external route.
kErrorNotFoundNo subsequent external route exists in the Thread Network Data.

References NetworkData::Iterate(), NetworkData::Config::mExternalRoute, NetworkData::Config::mOnMeshPrefix, and NetworkData::Config::mService.

§ GetNextService() [1/2]

Error GetNextService ( Iterator aIterator,
ServiceConfig aConfig 
) const

This method provides the next service in the Thread Network Data.

Parameters
[in,out]aIteratorA reference to the Network Data iterator.
[out]aConfigA reference to a config variable where the service information will be placed.
Return values
kErrorNoneSuccessfully found the next service.
kErrorNotFoundNo subsequent service exists in the Thread Network Data.

References ot::Mac::kShortAddrBroadcast.

Referenced by NetworkData::ContainsService(), and LeaderBase::GetServiceId().

§ GetNextService() [2/2]

Error GetNextService ( Iterator aIterator,
uint16_t  aRloc16,
ServiceConfig aConfig 
) const

This method provides the next service in the Thread Network Data for a given RLOC16.

Parameters
[in,out]aIteratorA reference to the Network Data iterator.
[in]aRloc16The RLOC16 value.
[out]aConfigA reference to a config variable where the service information will be placed.
Return values
kErrorNoneSuccessfully found the next service.
kErrorNotFoundNo subsequent service exists in the Thread Network Data.

References NetworkData::Iterate(), NetworkData::Config::mExternalRoute, NetworkData::Config::mOnMeshPrefix, and NetworkData::Config::mService.

§ ContainsOnMeshPrefix()

bool ContainsOnMeshPrefix ( const OnMeshPrefixConfig aPrefix) const

This method indicates whether or not the Thread Network Data contains a given on mesh prefix entry.

Parameters
[in]aPrefixThe on mesh prefix config to check.
Return values
TRUEif Network Data contains an on mesh prefix matching aPrefix.
FALSEif Network Data does not contain an on mesh prefix matching aPrefix.

References NetworkData::GetNextOnMeshPrefix(), ot::kErrorNone, ot::NetworkData::kIteratorInit, and otBorderRouterConfig::mRloc16.

Referenced by NetworkData::ContainsEntriesFrom().

§ ContainsExternalRoute()

bool ContainsExternalRoute ( const ExternalRouteConfig aRoute) const

This method indicates whether or not the Thread Network Data contains a given external route entry.

Parameters
[in]aRouteThe external route config to check.
Return values
TRUEif Network Data contains an external route matching aRoute.
FALSEif Network Data does not contain an external route matching aRoute.

References NetworkData::GetNextExternalRoute(), ot::kErrorNone, ot::NetworkData::kIteratorInit, and otExternalRouteConfig::mRloc16.

Referenced by NetworkData::ContainsEntriesFrom().

§ ContainsService()

bool ContainsService ( const ServiceConfig aService) const

This method indicates whether or not the Thread Network Data contains a given service entry.

Parameters
[in]aServiceThe service config to check.
Return values
TRUEif Network Data contains a service matching aService.
FALSEif Network Data does not contain a service matching aService.

References NetworkData::GetNextService(), ServiceConfig::GetServerConfig(), ot::kErrorNone, ot::NetworkData::kIteratorInit, and otServerConfig::mRloc16.

Referenced by NetworkData::ContainsEntriesFrom().

§ ContainsEntriesFrom()

bool ContainsEntriesFrom ( const NetworkData aCompare,
uint16_t  aRloc16 
) const

This method indicates whether or not the Thread Network Data contains all the on mesh prefixes, external routes, and service entries as in another given Network Data associated with a given RLOC16.

Parameters
[in]aCompareThe Network Data to compare with.
[in]aRloc16The RLOC16 to consider.
Return values
TRUEif Network Data contains all the same entries as in aCompare for aRloc16.
FALSEif Network Data does not contains all the same entries as in aCompare for aRloc16.

References NetworkData::ContainsExternalRoute(), NetworkData::ContainsOnMeshPrefix(), NetworkData::ContainsService(), ExitNow, NetworkData::Iterate(), ot::NetworkData::kIteratorInit, NetworkData::Config::mExternalRoute, NetworkData::Config::mOnMeshPrefix, NetworkData::Config::mService, and SuccessOrExit.

§ GetNextServer()

Error GetNextServer ( Iterator aIterator,
uint16_t &  aRloc16 
) const

This method provides the next server RLOC16 in the Thread Network Data.

Parameters
[in,out]aIteratorA reference to the Network Data iterator.
[out]aRloc16The RLOC16 value.
Return values
kErrorNoneSuccessfully found the next server.
kErrorNotFoundNo subsequent server exists in the Thread Network Data.

References NetworkData::Iterate(), ot::Mac::kShortAddrBroadcast, NetworkData::Config::mExternalRoute, NetworkData::Config::mOnMeshPrefix, otBorderRouterConfig::mRloc16, otExternalRouteConfig::mRloc16, otServerConfig::mRloc16, otServiceConfig::mServerConfig, NetworkData::Config::mService, OT_ASSERT, and SuccessOrExit.

§ FindBorderRouters()

Error FindBorderRouters ( RoleFilter  aRoleFilter,
uint16_t  aRlocs[],
uint8_t &  aRlocsLength 
) const

This method finds and returns the list of RLOCs of border routers providing external IPv6 connectivity.

A border router is considered to provide external IPv6 connectivity if it has added at least one external route entry, or an on-mesh prefix with default-route and on-mesh flags set.

This method should be used when the RLOC16s are present in the Network Data (when the Network Data contains the full set and not the stable subset).

Parameters
[in]aRoleFilterIndicates which devices to include (any role, router role only, or child only).
[out]aRlocsArray to output the list of RLOCs.
[in,out]aRlocsLengthOn entry, aRlocs array length (max number of elements). On exit, number RLOC16 entries added in aRlocs.
Return values
kErrorNoneSuccessfully found all RLOC16s and updated aRlocs and aRlocsLength.
kErrorNoBufsRan out of space in aRlocs array. aRlocs and aRlocsLength are still updated up to the maximum array length.

References NetworkData::GetLength(), NetworkData::GetNextExternalRoute(), NetworkData::GetNextOnMeshPrefix(), Mle::IsActiveRouter(), ot::NetworkData::kAnyRole, ot::NetworkData::kChildRoleOnly, ot::kErrorNoBufs, ot::kErrorNone, ot::NetworkData::kIteratorInit, ot::NetworkData::kRouterRoleOnly, otBorderRouterConfig::mDefaultRoute, NetworkData::mLength, otBorderRouterConfig::mOnMesh, otBorderRouterConfig::mRloc16, otExternalRouteConfig::mRloc16, SuccessOrExit, and VerifyOrExit.

Referenced by NetworkData::CountBorderRouters().

§ CountBorderRouters()

uint8_t CountBorderRouters ( RoleFilter  aRoleFilter) const

This method counts the number of border routers providing external IPv6 connectivity.

A border router is considered to provide external IPv6 connectivity if it has added at least one external route entry, or an on-mesh prefix with default-route and on-mesh flags set.

This method should be used when the RLOC16s are present in the Network Data (when the Network Data contains the full set and not the stable subset).

Parameters
[in]aRoleFilterIndicates which RLOCs to include (any role, router only, or child only).
Returns
The number of border routers in Thread Network Data matching aRoleFilter.

References NetworkData::FindBorderRouters(), and SuccessOrAssert.

§ GetTlvsStart() [1/2]

const NetworkDataTlv* GetTlvsStart ( void  ) const
inlineprotected

This method returns a pointer to the start of Network Data TLV sequence.

Returns
A pointer to the start of Network Data TLV sequence.

Referenced by MutableNetworkData::RemoveTemporaryData(), and MutableNetworkData::SetLength().

§ GetTlvsEnd() [1/2]

const NetworkDataTlv* GetTlvsEnd ( void  ) const
inlineprotected

This method returns a pointer to the end of Network Data TLV sequence.

Returns
A pointer to the end of Network Data TLV sequence.

Referenced by MutableNetworkData::AppendTlv(), MutableNetworkData::GetTlvsStart(), NetworkData::Iterate(), and MutableNetworkData::RemoveTemporaryData().

§ FindPrefix() [1/4]

const PrefixTlv * FindPrefix ( const uint8_t *  aPrefix,
uint8_t  aPrefixLength 
) const
protected

This method returns a pointer to a Prefix TLV.

Parameters
[in]aPrefixA pointer to an IPv6 prefix.
[in]aPrefixLengthThe prefix length pointed to by aPrefix (in bits).
Returns
A pointer to the Prefix TLV if one is found or nullptr if no matching Prefix TLV exists.

References PrefixTlv::IsEqual(), TlvIterator::Iterate(), NetworkData::mLength, and NetworkData::mTlvs.

Referenced by MutableNetworkData::GetTlvsEnd().

§ FindPrefix() [2/4]

const PrefixTlv* FindPrefix ( const Ip6::Prefix aPrefix) const
inlineprotected

This method returns a pointer to a Prefix TLV.

Parameters
[in]aPrefixAn IPv6 prefix.
Returns
A pointer to the Prefix TLV if one is found or nullptr if no matching Prefix TLV exists.

References Prefix::GetBytes(), and Prefix::GetLength().

§ FindService() [1/2]

const ServiceTlv * FindService ( uint32_t  aEnterpriseNumber,
const ServiceData aServiceData,
ServiceMatchMode  aServiceMatchMode 
) const
protected

This method returns a pointer to a matching Service TLV.

Parameters
[in]aEnterpriseNumberEnterprise Number.
[in]aServiceDataA Service Data.
[in]aServiceMatchModeThe Service Data match mode.
Returns
A pointer to the Service TLV if one is found or nullptr if no matching Service TLV exists.

References TlvIterator::Iterate(), NetworkData::MatchService(), NetworkData::mLength, and NetworkData::mTlvs.

Referenced by MutableNetworkData::FindPrefix().

§ FindNextService()

const ServiceTlv * FindNextService ( const ServiceTlv aPrevServiceTlv,
uint32_t  aEnterpriseNumber,
const ServiceData aServiceData,
ServiceMatchMode  aServiceMatchMode 
) const
protected

This method returns the next pointer to a matching Service TLV.

This method can be used to iterate over all Service TLVs that start with a given Service Data.

Parameters
[in]aPrevServiceTlvSet to nullptr to start from the beginning of the TLVs (finding the first matching Service TLV), or a pointer to the previous Service TLV returned from this method to iterate to the next matching Service TLV.
[in]aEnterpriseNumberEnterprise Number.
[in]aServiceDataA Service Data to match with Service TLVs.
[in]aServiceMatchModeThe Service Data match mode.
Returns
A pointer to the next matching Service TLV if one is found or nullptr if it cannot be found.

References InstanceLocator::GetInstance(), NetworkDataTlv::GetNext(), NetworkData::mLength, NetworkData::mTlvs, and NetworkData::NetworkData().

Referenced by NetworkData::FindNextThreadService().

§ FindNextThreadService()

const ServiceTlv * FindNextThreadService ( const ServiceTlv aPrevServiceTlv,
const ServiceData aServiceData,
ServiceMatchMode  aServiceMatchMode 
) const
protected

This method returns the next pointer to a matching Thread Service TLV (with Thread Enterprise number).

This method can be used to iterate over all Thread Service TLVs that start with a given Service Data.

Parameters
[in]aPrevServiceTlvSet to nullptr to start from the beginning of the TLVs (finding the first matching Service TLV), or a pointer to the previous Service TLV returned from this method to iterate to the next matching Service TLV.
[in]aServiceDataA Service Data to match with Service TLVs.
[in]aServiceMatchModeThe Service Data match mode.
Returns
A pointer to the next matching Thread Service TLV if one is found or nullptr if it cannot be found.

References NetworkData::FindNextService(), and ServiceTlv::kThreadEnterpriseNumber.

§ SendServerDataNotification()

Error SendServerDataNotification ( uint16_t  aRloc16,
bool  aAppendNetDataTlv,
Coap::ResponseHandler  aHandler,
void *  aContext 
) const
protected

This method sends a Server Data Notification message to the Leader.

Parameters
[in]aRloc16The old RLOC16 value that was previously registered.
[in]aAppendNetDataTlvIndicates whether or not to append Thread Network Data TLV to the message.
[in]aHandlerA function pointer that is called when the transaction ends.
[in]aContextA pointer to arbitrary context information.
Return values
kErrorNoneSuccessfully enqueued the notification message.
kErrorNoBufsInsufficient message buffers to generate the notification message.

References Message::Append(), Message::AppendBytes(), FreeMessageOnError, InstanceLocator::GetInstance(), IgnoreError(), Message::InitAsConfirmablePost(), ot::kErrorNoBufs, ot::kErrorNone, UriPath::kServerData, ot::Mac::kShortAddrInvalid, ThreadTlv::kThreadNetworkData, LogInfo, NetworkData::mLength, NetworkData::mTlvs, Tlv::SetLength(), Message::SetPayloadMarker(), MessageInfo::SetSockAddrToRlocPeerAddrToLeaderAloc(), ThreadTlv::SetType(), SuccessOrExit, and VerifyOrExit.

§ NetworkDataIterator()

NetworkDataIterator ( Iterator aIterator)
inlineexplicit

§ GetTlv()

const NetworkDataTlv* GetTlv ( const uint8_t *  aTlvs) const
inline

Referenced by NetworkData::Iterate().

§ AdvanceTlv()

void AdvanceTlv ( const uint8_t *  aTlvs)
inline

Referenced by NetworkData::Iterate().

§ GetSubTlv()

const NetworkDataTlv* GetSubTlv ( const NetworkDataTlv aSubTlvs) const
inline

Referenced by NetworkData::Iterate().

§ AdvaceSubTlv()

void AdvaceSubTlv ( const NetworkDataTlv aSubTlvs)
inline

Referenced by NetworkData::Iterate().

§ GetAndAdvanceIndex()

uint8_t GetAndAdvanceIndex ( void  )
inline

Referenced by NetworkData::Iterate().

§ IsNewEntry()

bool IsNewEntry ( void  ) const
inline

Referenced by NetworkData::Iterate().

§ MarkEntryAsNotNew()

void MarkEntryAsNotNew ( void  )
inline

Referenced by NetworkData::Iterate().

§ GetTlvOffset()

uint8_t GetTlvOffset ( void  ) const
inlineprivate

§ GetSubTlvOffset()

uint8_t GetSubTlvOffset ( void  ) const
inlineprivate

§ SetSubTlvOffset()

void SetSubTlvOffset ( uint8_t  aOffset)
inlineprivate

§ SetTlvOffset()

void SetTlvOffset ( uint8_t  aOffset)
inlineprivate

§ GetEntryIndex()

uint8_t GetEntryIndex ( void  ) const
inlineprivate

§ SetEntryIndex()

void SetEntryIndex ( uint8_t  aIndex)
inlineprivate

§ SaveTlvOffset()

void SaveTlvOffset ( const NetworkDataTlv aTlv,
const uint8_t *  aTlvs 
)
inlineprivate

§ SaveSubTlvOffset()

void SaveSubTlvOffset ( const NetworkDataTlv aSubTlv,
const NetworkDataTlv aSubTlvs 
)
inlineprivate

§ Iterate()

Error Iterate ( Iterator aIterator,
uint16_t  aRloc16,
Config aConfig 
) const
private

§ MatchService()

bool MatchService ( const ServiceTlv aServiceTlv,
uint32_t  aEnterpriseNumber,
const ServiceData aServiceData,
ServiceMatchMode  aServiceMatchMode 
)
staticprivate

§ MutableNetworkData()

MutableNetworkData ( Instance aInstance,
uint8_t *  aTlvs,
uint8_t  aLength,
uint8_t  aSize 
)
inline

This constructor initializes the MutableNetworkData

Parameters
[in]aInstanceA reference to the OpenThread instance.
[in]aTlvsA pointer to the buffer to store the TLVs.
[in]aLengthThe current length of the Network Data.
[in]aSizeSize of the buffer aTlvs (maximum length).

References NetworkData::GetBytes(), and NetworkData::GetLength().

§ GetSize()

uint8_t GetSize ( void  ) const
inline

This method returns the size of the buffer to store the mutable Network Data.

Returns
The size of the buffer.

Referenced by NetworkData::CopyNetworkData().

§ GetBytes() [2/2]

uint8_t* GetBytes ( void  )
inline

This method returns a pointer to start of the TLVs in NetworkData.

Returns
A pointer to start of the TLVs.

References ot::AsConst(), ot::AsNonConst(), and MutableNetworkData::GetBytes().

Referenced by NetworkData::CopyNetworkData(), MutableNetworkData::GetBytes(), and LeaderBase::SetNetworkData().

§ Clear()

void Clear ( void  )
inline

This method clears the network data.

§ SetLength()

void SetLength ( uint8_t  aLength)
inlineprotected

This method sets the Network Data length.

Parameters
[in]aLengthThe length.

References NetworkData::GetTlvsStart().

Referenced by NetworkData::CopyNetworkData(), LeaderBase::Reset(), and LeaderBase::SetNetworkData().

§ GetTlvsStart() [2/2]

NetworkDataTlv* GetTlvsStart ( void  )
inlineprotected

This method returns a pointer to the start of Network Data TLV sequence.

Returns
A pointer to the start of Network Data TLV sequence.

References ot::AsConst(), ot::AsNonConst(), NetworkData::GetTlvsEnd(), and MutableNetworkData::GetTlvsStart().

Referenced by LeaderBase::ExternalRouteLookup(), LeaderBase::FindNextMatchingPrefix(), LeaderBase::GetCommissioningData(), LeaderBase::GetContext(), and MutableNetworkData::GetTlvsStart().

§ GetTlvsEnd() [2/2]

NetworkDataTlv* GetTlvsEnd ( void  )
inlineprotected

This method returns a pointer to the end of Network Data TLV sequence.

Returns
A pointer to the end of Network Data TLV sequence.

References ot::AsConst(), ot::AsNonConst(), NetworkData::FindPrefix(), and MutableNetworkData::GetTlvsEnd().

Referenced by LeaderBase::ExternalRouteLookup(), LeaderBase::FindNextMatchingPrefix(), LeaderBase::GetCommissioningData(), LeaderBase::GetContext(), and MutableNetworkData::GetTlvsEnd().

§ FindPrefix() [3/4]

PrefixTlv* FindPrefix ( const uint8_t *  aPrefix,
uint8_t  aPrefixLength 
)
inlineprotected

This method returns a pointer to a Prefix TLV.

Parameters
[in]aPrefixA pointer to an IPv6 prefix.
[in]aPrefixLengthThe prefix length pointed to by aPrefix (in bits).
Returns
A pointer to the Prefix TLV if one is found or nullptr if no matching Prefix TLV exists.

References ot::AsConst(), and ot::AsNonConst().

§ FindPrefix() [4/4]

PrefixTlv* FindPrefix ( const Ip6::Prefix aPrefix)
inlineprotected

This method returns a pointer to a Prefix TLV.

Parameters
[in]aPrefixAn IPv6 prefix.
Returns
A pointer to the Prefix TLV if one is found or nullptr if no matching Prefix TLV exists.

References MutableNetworkData::FindPrefix(), NetworkData::FindService(), Prefix::GetBytes(), and Prefix::GetLength().

Referenced by MutableNetworkData::FindPrefix().

§ FindService() [2/2]

ServiceTlv* FindService ( uint32_t  aEnterpriseNumber,
const ServiceData aServiceData,
ServiceMatchMode  aServiceMatchMode 
)
inlineprotected

This method returns a pointer to a matching Service TLV.

Parameters
[in]aEnterpriseNumberEnterprise Number.
[in]aServiceDataA Service Data.
[in]aServiceMatchModeThe Service Data match mode.
Returns
A pointer to the Service TLV if one is found or nullptr if no matching Service TLV exists.

References ot::AsConst(), and ot::AsNonConst().

§ CanInsert()

bool CanInsert ( uint16_t  aSize) const
inlineprotected

This method indicates whether there is space in Network Data to insert/append new info and grow it by a given number of bytes.

Parameters
[in]aSizeThe number of bytes to grow the Network Data.
Return values
TRUEThere is space to grow Network Data by aSize bytes.
FALSEThere is no space left to grow Network Data by aSize bytes.

§ AppendTlv()

NetworkDataTlv * AppendTlv ( uint16_t  aTlvSize)
protected

This method grows the Network Data to append a TLV with a requested size.

On success, the returned TLV is not initialized (i.e., the TLV Length field is not set) but the requested size for it (aTlvSize number of bytes) is reserved in the Network Data.

Parameters
[in]aTlvSizeThe size of TLV (total number of bytes including Type, Length, and Value fields)
Returns
A pointer to the TLV if there is space to grow Network Data, or nullptr if no space to grow the Network Data with requested aTlvSize number of bytes.

References NetworkData::GetTlvsEnd(), NetworkData::mLength, and VerifyOrExit.

Referenced by LeaderBase::SetCommissioningData().

§ Insert()

void Insert ( void *  aStart,
uint8_t  aLength 
)
protected

This method inserts bytes into the Network Data.

Parameters
[in]aStartA pointer to the beginning of the insertion.
[in]aLengthThe number of bytes to insert.

References NetworkData::mLength, NetworkData::mTlvs, and OT_ASSERT.

§ Remove()

void Remove ( void *  aRemoveStart,
uint8_t  aRemoveLength 
)
protected

This method removes bytes from the Network Data.

Parameters
[in]aRemoveStartA pointer to the beginning of the removal.
[in]aRemoveLengthThe number of bytes to remove.

References NetworkData::GetBytes(), NetworkData::mLength, and OT_ASSERT.

§ RemoveTlv()

void RemoveTlv ( NetworkDataTlv aTlv)
protected

This method removes a TLV from the Network Data.

Parameters
[in]aTlvThe TLV to remove.

References NetworkDataTlv::GetSize().

Referenced by LeaderBase::RemoveCommissioningData().

§ RemoveTemporaryData()

void RemoveTemporaryData ( void  )
protected

§ RemoveTemporaryDataIn() [1/2]

void RemoveTemporaryDataIn ( PrefixTlv aPrefix)
private

§ RemoveTemporaryDataIn() [2/2]

void RemoveTemporaryDataIn ( ServiceTlv aService)
private

Variable Documentation

§ kIteratorInit

constexpr Iterator kIteratorInit = OT_NETWORK_DATA_ITERATOR_INIT

§ kMaxSize

constexpr uint8_t kMaxSize = 254
static

Maximum size of Thread Network Data in bytes.

Referenced by Mle::AppendNetworkData(), and LeaderBase::SetCommissioningData().

§ kTlvPosition

constexpr uint8_t kTlvPosition = 0
staticprivate

§ kSubTlvPosition

constexpr uint8_t kSubTlvPosition = 1
staticprivate

§ kEntryPosition

constexpr uint8_t kEntryPosition = 2
staticprivate

§ mIteratorBuffer

uint8_t* mIteratorBuffer
private

§ mOnMeshPrefix

OnMeshPrefixConfig* mOnMeshPrefix

§ mExternalRoute

ExternalRouteConfig* mExternalRoute

§ mService

ServiceConfig* mService

§ mTlvs

const uint8_t* mTlvs
private

§ mLength

uint8_t mLength
private

§ mSize

uint8_t mSize
private

Friends

§ Leader

friend class Leader
friend

§ Publisher [1/2]

friend class Publisher
friend

§ MutableNetworkData

friend class MutableNetworkData
friend

§ Service::Manager [1/2]

friend class Service::Manager
friend

§ NetworkData

friend class NetworkData
friend

§ Service::Manager [2/2]

friend class Service::Manager
friend

§ Publisher [2/2]

friend class Publisher
friend
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale