mirror of
https://github.com/espressif/openthread.git
synced 2026-08-12 05:37:46 +00:00
[mle] inline AddLeaderAloc() (#4941)
Also move Mle::AddLeaderAloc() to MleRouter::AddLeaderAloc().
This commit is contained in:
@@ -1081,20 +1081,6 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Mle::AddLeaderAloc(void)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
VerifyOrExit(IsLeader(), error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
SuccessOrExit(error = GetLeaderAloc(mLeaderAloc.GetAddress()));
|
||||
|
||||
error = Get<ThreadNetif>().AddUnicastAddress(mLeaderAloc);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
const LeaderData &Mle::GetLeaderData(void)
|
||||
{
|
||||
mLeaderData.SetDataVersion(Get<NetworkData::Leader>().GetVersion());
|
||||
|
||||
+2
-12
@@ -793,16 +793,6 @@ public:
|
||||
*/
|
||||
otError GetServiceAloc(uint8_t aServiceId, Ip6::Address &aAddress) const;
|
||||
|
||||
/**
|
||||
* This method adds Leader's ALOC to its Thread interface.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully added the Leader's ALOC.
|
||||
* @retval OT_ERROR_BUSY The Leader's ALOC address was already added.
|
||||
* @retval OT_ERROR_INVALID_STATE The device's role is not Leader.
|
||||
*
|
||||
*/
|
||||
otError AddLeaderAloc(void);
|
||||
|
||||
/**
|
||||
* This method returns the most recently received Leader Data.
|
||||
*
|
||||
@@ -1643,6 +1633,8 @@ protected:
|
||||
static const char *ReattachStateToString(ReattachState aState);
|
||||
#endif
|
||||
|
||||
Ip6::NetifUnicastAddress mLeaderAloc; ///< Leader anycast locator
|
||||
|
||||
LeaderData mLeaderData; ///< Last received Leader Data TLV.
|
||||
bool mRetrieveNewNetworkData; ///< Indicating new Network Data is needed if set.
|
||||
DeviceRole mRole; ///< Current Thread role.
|
||||
@@ -1822,8 +1814,6 @@ private:
|
||||
uint16_t mAlternatePanId;
|
||||
uint64_t mAlternateTimestamp;
|
||||
|
||||
Ip6::NetifUnicastAddress mLeaderAloc;
|
||||
|
||||
#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
|
||||
Ip6::NetifUnicastAddress mServiceAlocs[kMaxServiceAlocs];
|
||||
#endif
|
||||
|
||||
@@ -346,7 +346,8 @@ void MleRouter::SetStateLeader(uint16_t aRloc16)
|
||||
mMessageTransmissionTimer.Stop();
|
||||
StopAdvertiseTimer();
|
||||
ResetAdvertiseInterval();
|
||||
IgnoreError(AddLeaderAloc());
|
||||
IgnoreError(GetLeaderAloc(mLeaderAloc.GetAddress()));
|
||||
IgnoreError(Get<ThreadNetif>().AddUnicastAddress(mLeaderAloc));
|
||||
|
||||
IgnoreError(Get<ThreadNetif>().SubscribeAllRoutersMulticast());
|
||||
mPreviousPartitionIdRouter = mLeaderData.GetPartitionId();
|
||||
|
||||
Reference in New Issue
Block a user