[mle] inline AddLeaderAloc() (#4941)

Also move Mle::AddLeaderAloc() to MleRouter::AddLeaderAloc().
This commit is contained in:
Jonathan Hui
2020-05-11 12:44:54 -07:00
parent 3f299d3701
commit 532a44b76d
3 changed files with 4 additions and 27 deletions
-14
View File
@@ -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
View File
@@ -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
+2 -1
View File
@@ -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();