[mle] move simple RLOC to Router ID conversion functions to mle_types.hpp (#8060)

This commit moves simple `static` member methods from `Mle` class to
`mle_types.hpp` (under `Mle` namespace).
This commit is contained in:
Abtin Keshavarzian
2022-08-23 16:14:09 -07:00
committed by GitHub
parent 2c3a10d67a
commit d17bde5b2d
17 changed files with 172 additions and 156 deletions
+1 -1
View File
@@ -305,7 +305,7 @@ otDeviceRole otThreadGetDeviceRole(otInstance *aInstance)
const char *otThreadDeviceRoleToString(otDeviceRole aRole)
{
return Mle::Mle::RoleToString(MapEnum(aRole));
return Mle::RoleToString(MapEnum(aRole));
}
otError otThreadGetLeaderData(otInstance *aInstance, otLeaderData *aLeaderData)
+1 -1
View File
@@ -55,7 +55,7 @@ void SettingsBase::NetworkInfo::Log(Action aAction) const
{
LogInfo("%s NetworkInfo {rloc:0x%04x, extaddr:%s, role:%s, mode:0x%02x, version:%hu, keyseq:0x%x, ...",
ActionToString(aAction), GetRloc16(), GetExtAddress().ToString().AsCString(),
Mle::Mle::RoleToString(static_cast<Mle::DeviceRole>(GetRole())), GetDeviceMode(), GetVersion(),
Mle::RoleToString(static_cast<Mle::DeviceRole>(GetRole())), GetDeviceMode(), GetVersion(),
GetKeySequence());
LogInfo("... pid:0x%x, mlecntr:0x%x, maccntr:0x%x, mliid:%s}", GetPreviousPartitionId(), GetMleFrameCounter(),
+2 -2
View File
@@ -172,7 +172,7 @@ exit:
void AddressResolver::Remove(uint8_t aRouterId)
{
Remove(Mle::Mle::Rloc16FromRouterId(aRouterId), /* aMatchRouterId */ true);
Remove(Mle::Rloc16FromRouterId(aRouterId), /* aMatchRouterId */ true);
}
void AddressResolver::Remove(uint16_t aRloc16)
@@ -196,7 +196,7 @@ void AddressResolver::Remove(Mac::ShortAddress aRloc16, bool aMatchRouterId)
while ((entry = GetEntryAfter(prev, *list)) != nullptr)
{
if ((aMatchRouterId && Mle::Mle::RouterIdMatch(entry->GetRloc16(), aRloc16)) ||
if ((aMatchRouterId && Mle::RouterIdMatch(entry->GetRloc16(), aRloc16)) ||
(!aMatchRouterId && (entry->GetRloc16() == aRloc16)))
{
RemoveCacheEntry(*entry, *list, prev, aMatchRouterId ? kReasonRemovingRouterId : kReasonRemovingRloc16);
+1 -1
View File
@@ -189,7 +189,7 @@ Error ChildTable::GetChildInfoById(uint16_t aChildId, Child::Info &aChildInfo)
if ((aChildId & ~Mle::kMaxChildId) != 0)
{
aChildId = Mle::Mle::ChildIdFromRloc16(aChildId);
aChildId = Mle::ChildIdFromRloc16(aChildId);
}
rloc16 = Get<Mac::Mac>().GetShortAddress() | aChildId;
+5 -5
View File
@@ -1015,18 +1015,18 @@ start:
if (hopsLeft != Mle::kMaxRouteCost)
{
hopsLeft += mle.GetLinkCost(Mle::Mle::RouterIdFromRloc16(mle.GetNextHop(aMeshDest)));
hopsLeft += mle.GetLinkCost(Mle::RouterIdFromRloc16(mle.GetNextHop(aMeshDest)));
}
else
{
// In case there is no route to the destination router (only link).
hopsLeft = mle.GetLinkCost(Mle::Mle::RouterIdFromRloc16(aMeshDest));
hopsLeft = mle.GetLinkCost(Mle::RouterIdFromRloc16(aMeshDest));
}
}
// The hopsLft field MUST be incremented by one if the
// destination RLOC16 is not that of an active Router.
if (!Mle::Mle::IsActiveRouter(aMeshDest))
if (!Mle::IsActiveRouter(aMeshDest))
{
hopsLeft += 1;
}
@@ -1204,7 +1204,7 @@ void MeshForwarder::UpdateNeighborLinkFailures(Neighbor &aNeighbor,
{
aNeighbor.IncrementLinkFailures();
if (aAllowNeighborRemove && (Mle::Mle::IsActiveRouter(aNeighbor.GetRloc16())) &&
if (aAllowNeighborRemove && (Mle::IsActiveRouter(aNeighbor.GetRloc16())) &&
(aNeighbor.GetLinkFailures() >= aFailLimit))
{
Get<Mle::MleRouter>().RemoveRouterLink(static_cast<Router &>(aNeighbor));
@@ -1839,7 +1839,7 @@ uint16_t MeshForwarder::CalcFrameVersion(const Neighbor *aNeighbor, bool aIePres
version = Mac::Frame::kFcfFrameVersion2015;
}
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
else if (aNeighbor != nullptr && !Mle::MleRouter::IsActiveRouter(aNeighbor->GetRloc16()) &&
else if (aNeighbor != nullptr && !Mle::IsActiveRouter(aNeighbor->GetRloc16()) &&
Get<Mle::MleRouter>().IsRouterOrLeader() && static_cast<const Child *>(aNeighbor)->IsCslSynchronized())
{
version = Mac::Frame::kFcfFrameVersion2015;
+9 -10
View File
@@ -432,7 +432,7 @@ void MeshForwarder::EvaluateRoutingCost(uint16_t aDest, uint8_t &aBestCost, uint
// Path cost
curCost = Get<Mle::MleRouter>().GetCost(aDest);
if (!Mle::MleRouter::IsActiveRouter(aDest))
if (!Mle::IsActiveRouter(aDest))
{
// Assume best link between remote child server and its parent.
curCost += 1;
@@ -445,7 +445,7 @@ void MeshForwarder::EvaluateRoutingCost(uint16_t aDest, uint8_t &aBestCost, uint
{
uint8_t cost;
if (!Mle::MleRouter::IsActiveRouter(aDest))
if (!Mle::IsActiveRouter(aDest))
{
// Cost calculated only from Link Quality In as the parent only maintains
// one-direction link info.
@@ -453,7 +453,7 @@ void MeshForwarder::EvaluateRoutingCost(uint16_t aDest, uint8_t &aBestCost, uint
}
else
{
cost = Get<Mle::MleRouter>().GetLinkCost(Mle::Mle::RouterIdFromRloc16(aDest));
cost = Get<Mle::MleRouter>().GetLinkCost(Mle::RouterIdFromRloc16(aDest));
}
// Choose the minimum cost
@@ -533,14 +533,13 @@ Error MeshForwarder::AnycastRouteLookup(uint8_t aServiceId, AnycastType aType, u
}
}
routerId = Mle::Mle::RouterIdFromRloc16(bestDest);
routerId = Mle::RouterIdFromRloc16(bestDest);
if (!(Mle::Mle::IsActiveRouter(bestDest) ||
Mle::Mle::Rloc16FromRouterId(routerId) == Get<Mle::MleRouter>().GetRloc16()))
if (!(Mle::IsActiveRouter(bestDest) || Mle::Rloc16FromRouterId(routerId) == Get<Mle::MleRouter>().GetRloc16()))
{
// if agent is neither active router nor child of this device
// use the parent of the ED Agent as Dest
bestDest = Mle::Mle::Rloc16FromRouterId(routerId);
bestDest = Mle::Rloc16FromRouterId(routerId);
}
aMeshDest = bestDest;
@@ -562,7 +561,7 @@ Error MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header, Message &aMessage
else if (mle.IsRoutingLocator(ip6Header.GetDestination()))
{
uint16_t rloc16 = ip6Header.GetDestination().GetIid().GetLocator();
VerifyOrExit(mle.IsRouterIdValid(Mle::Mle::RouterIdFromRloc16(rloc16)), error = kErrorDrop);
VerifyOrExit(mle.IsRouterIdValid(Mle::RouterIdFromRloc16(rloc16)), error = kErrorDrop);
mMeshDest = rloc16;
}
else if (mle.IsAnycastLocator(ip6Header.GetDestination()))
@@ -571,7 +570,7 @@ Error MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header, Message &aMessage
if (aloc16 == Mle::kAloc16Leader)
{
mMeshDest = Mle::Mle::Rloc16FromRouterId(mle.GetLeaderId());
mMeshDest = Mle::Rloc16FromRouterId(mle.GetLeaderId());
}
else if (aloc16 <= Mle::kAloc16DhcpAgentEnd)
{
@@ -809,7 +808,7 @@ void MeshForwarder::UpdateRoutes(const FrameData &aFrameData, const Mac::Address
neighbor = Get<NeighborTable>().FindNeighbor(ip6Headers.GetSourceAddress());
VerifyOrExit(neighbor != nullptr && !neighbor->IsFullThreadDevice());
if (!Mle::Mle::RouterIdMatch(aMeshAddrs.mSource.GetShort(), Get<Mac::Mac>().GetShortAddress()))
if (!Mle::RouterIdMatch(aMeshAddrs.mSource.GetShort(), Get<Mac::Mac>().GetShortAddress()))
{
Get<Mle::MleRouter>().RemoveNeighbor(*neighbor);
}
-19
View File
@@ -4189,25 +4189,6 @@ const char *Mle::MessageTypeActionToSuffixString(MessageType aType, MessageActio
#endif // #if OT_SHOULD_LOG_AT( OT_LOG_LEVEL_WARN)
const char *Mle::RoleToString(DeviceRole aRole)
{
static const char *const kRoleStrings[] = {
"disabled", // (0) kRoleDisabled
"detached", // (1) kRoleDetached
"child", // (2) kRoleChild
"router", // (3) kRoleRouter
"leader", // (4) kRoleLeader
};
static_assert(kRoleDisabled == 0, "kRoleDisabled value is incorrect");
static_assert(kRoleDetached == 1, "kRoleDetached value is incorrect");
static_assert(kRoleChild == 2, "kRoleChild value is incorrect");
static_assert(kRoleRouter == 3, "kRoleRouter value is incorrect");
static_assert(kRoleLeader == 4, "kRoleLeader value is incorrect");
return (aRole < GetArrayLength(kRoleStrings)) ? kRoleStrings[aRole] : "invalid";
}
// LCOV_EXCL_START
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_NOTE)
-100
View File
@@ -578,100 +578,6 @@ public:
*/
const LeaderData &GetLeaderData(void);
/**
* This method derives the Child ID from a given RLOC16.
*
* @param[in] aRloc16 The RLOC16 value.
*
* @returns The Child ID portion of an RLOC16.
*
*/
static uint16_t ChildIdFromRloc16(uint16_t aRloc16) { return aRloc16 & kMaxChildId; }
/**
* This method derives the Router ID portion from a given RLOC16.
*
* @param[in] aRloc16 The RLOC16 value.
*
* @returns The Router ID portion of an RLOC16.
*
*/
static uint8_t RouterIdFromRloc16(uint16_t aRloc16) { return aRloc16 >> kRouterIdOffset; }
/**
* This method returns whether the two RLOC16 have the same Router ID.
*
* @param[in] aRloc16A The first RLOC16 value.
* @param[in] aRloc16B The second RLOC16 value.
*
* @returns true if the two RLOC16 have the same Router ID, false otherwise.
*
*/
static bool RouterIdMatch(uint16_t aRloc16A, uint16_t aRloc16B)
{
return RouterIdFromRloc16(aRloc16A) == RouterIdFromRloc16(aRloc16B);
}
/**
* This method returns the Service ID corresponding to a Service ALOC16.
*
* @param[in] aAloc16 The Service ALOC16 value.
*
* @returns The Service ID corresponding to given ALOC16.
*
*/
static uint8_t ServiceIdFromAloc(uint16_t aAloc16) { return static_cast<uint8_t>(aAloc16 - kAloc16ServiceStart); }
/**
* This method returns the Service ALOC16 corresponding to a Service ID.
*
* @param[in] aServiceId The Service ID value.
*
* @returns The Service ALOC16 corresponding to given ID.
*
*/
static uint16_t ServiceAlocFromId(uint8_t aServiceId)
{
return static_cast<uint16_t>(aServiceId + kAloc16ServiceStart);
}
/**
* This method returns the Commissioner Aloc corresponding to a Commissioner Session ID.
*
* @param[in] aSessionId The Commissioner Session ID value.
*
* @returns The Commissioner ALOC16 corresponding to given ID.
*
*/
static uint16_t CommissionerAloc16FromId(uint16_t aSessionId)
{
return static_cast<uint16_t>((aSessionId & kAloc16CommissionerMask) + kAloc16CommissionerStart);
}
/**
* This method derives RLOC16 from a given Router ID.
*
* @param[in] aRouterId The Router ID value.
*
* @returns The RLOC16 corresponding to the given Router ID.
*
*/
static uint16_t Rloc16FromRouterId(uint8_t aRouterId)
{
return static_cast<uint16_t>(aRouterId << kRouterIdOffset);
}
/**
* This method indicates whether or not @p aRloc16 refers to an active router.
*
* @param[in] aRloc16 The RLOC16 value.
*
* @retval TRUE If @p aRloc16 refers to an active router.
* @retval FALSE If @p aRloc16 does not refer to an active router.
*
*/
static bool IsActiveRouter(uint16_t aRloc16) { return ChildIdFromRloc16(aRloc16) == 0; }
/**
* This method returns a reference to the send queue.
*
@@ -686,12 +592,6 @@ public:
*/
void RemoveDelayedDataResponseMessage(void);
/**
* This method converts a device role into a human-readable string.
*
*/
static const char *RoleToString(DeviceRole aRole);
/**
* This method gets the MLE counters.
*
+20
View File
@@ -33,6 +33,7 @@
#include "mle_types.hpp"
#include "common/array.hpp"
#include "common/code_utils.hpp"
namespace ot {
@@ -63,5 +64,24 @@ DeviceMode::InfoString DeviceMode::ToString(void) const
return string;
}
const char *RoleToString(DeviceRole aRole)
{
static const char *const kRoleStrings[] = {
"disabled", // (0) kRoleDisabled
"detached", // (1) kRoleDetached
"child", // (2) kRoleChild
"router", // (3) kRoleRouter
"leader", // (4) kRoleLeader
};
static_assert(kRoleDisabled == 0, "kRoleDisabled value is incorrect");
static_assert(kRoleDetached == 1, "kRoleDetached value is incorrect");
static_assert(kRoleChild == 2, "kRoleChild value is incorrect");
static_assert(kRoleRouter == 3, "kRoleRouter value is incorrect");
static_assert(kRoleLeader == 4, "kRoleLeader value is incorrect");
return (aRole < GetArrayLength(kRoleStrings)) ? kRoleStrings[aRole] : "invalid";
}
} // namespace Mle
} // namespace ot
+116
View File
@@ -572,6 +572,122 @@ typedef Mac::KeyMaterial KeyMaterial;
*/
typedef Mac::Key Key;
/**
* This function derives the Child ID from a given RLOC16.
*
* @param[in] aRloc16 The RLOC16 value.
*
* @returns The Child ID portion of an RLOC16.
*
*/
inline uint16_t ChildIdFromRloc16(uint16_t aRloc16)
{
return aRloc16 & kMaxChildId;
}
/**
* This function derives the Router ID portion from a given RLOC16.
*
* @param[in] aRloc16 The RLOC16 value.
*
* @returns The Router ID portion of an RLOC16.
*
*/
inline uint8_t RouterIdFromRloc16(uint16_t aRloc16)
{
return aRloc16 >> kRouterIdOffset;
}
/**
* This function returns whether the two RLOC16 have the same Router ID.
*
* @param[in] aRloc16A The first RLOC16 value.
* @param[in] aRloc16B The second RLOC16 value.
*
* @returns true if the two RLOC16 have the same Router ID, false otherwise.
*
*/
inline bool RouterIdMatch(uint16_t aRloc16A, uint16_t aRloc16B)
{
return RouterIdFromRloc16(aRloc16A) == RouterIdFromRloc16(aRloc16B);
}
/**
* This function returns the Service ID corresponding to a Service ALOC16.
*
* @param[in] aAloc16 The Service ALOC16 value.
*
* @returns The Service ID corresponding to given ALOC16.
*
*/
inline uint8_t ServiceIdFromAloc(uint16_t aAloc16)
{
return static_cast<uint8_t>(aAloc16 - kAloc16ServiceStart);
}
/**
* This function returns the Service ALOC16 corresponding to a Service ID.
*
* @param[in] aServiceId The Service ID value.
*
* @returns The Service ALOC16 corresponding to given ID.
*
*/
inline uint16_t ServiceAlocFromId(uint8_t aServiceId)
{
return static_cast<uint16_t>(aServiceId + kAloc16ServiceStart);
}
/**
* This function returns the Commissioner Aloc corresponding to a Commissioner Session ID.
*
* @param[in] aSessionId The Commissioner Session ID value.
*
* @returns The Commissioner ALOC16 corresponding to given ID.
*
*/
inline uint16_t CommissionerAloc16FromId(uint16_t aSessionId)
{
return static_cast<uint16_t>((aSessionId & kAloc16CommissionerMask) + kAloc16CommissionerStart);
}
/**
* This function derives RLOC16 from a given Router ID.
*
* @param[in] aRouterId The Router ID value.
*
* @returns The RLOC16 corresponding to the given Router ID.
*
*/
inline uint16_t Rloc16FromRouterId(uint8_t aRouterId)
{
return static_cast<uint16_t>(aRouterId << kRouterIdOffset);
}
/**
* This function indicates whether or not @p aRloc16 refers to an active router.
*
* @param[in] aRloc16 The RLOC16 value.
*
* @retval TRUE If @p aRloc16 refers to an active router.
* @retval FALSE If @p aRloc16 does not refer to an active router.
*
*/
inline bool IsActiveRouter(uint16_t aRloc16)
{
return ChildIdFromRloc16(aRloc16) == 0;
}
/**
* This function converts a device role into a human-readable string.
*
* @param[in] aRole The device role to convert.
*
* @returns The string representation of @p aRole.
*
*/
const char *RoleToString(DeviceRole aRole);
/**
* @}
*
+3 -3
View File
@@ -486,7 +486,7 @@ void MutableNetworkData::RemoveTemporaryDataIn(ServiceTlv &aService)
switch (cur->GetType())
{
case NetworkDataTlv::kTypeServer:
As<ServerTlv>(cur)->SetServer16(Mle::Mle::ServiceAlocFromId(aService.GetServiceId()));
As<ServerTlv>(cur)->SetServer16(Mle::ServiceAlocFromId(aService.GetServiceId()));
break;
default:
@@ -736,11 +736,11 @@ Error NetworkData::FindBorderRouters(RoleFilter aRoleFilter, uint16_t aRlocs[],
break;
case kRouterRoleOnly:
VerifyOrExit(Mle::Mle::IsActiveRouter(aRloc16));
VerifyOrExit(Mle::IsActiveRouter(aRloc16));
break;
case kChildRoleOnly:
VerifyOrExit(!Mle::Mle::IsActiveRouter(aRloc16));
VerifyOrExit(!Mle::IsActiveRouter(aRloc16));
break;
}
+3 -3
View File
@@ -393,7 +393,7 @@ bool Leader::RlocMatch(uint16_t aFirstRloc16, uint16_t aSecondRloc16, MatchMode
break;
case kMatchModeRouterId:
matched = Mle::Mle::RouterIdMatch(aFirstRloc16, aSecondRloc16);
matched = Mle::RouterIdMatch(aFirstRloc16, aSecondRloc16);
break;
}
@@ -707,7 +707,7 @@ void Leader::RegisterNetworkData(uint16_t aRloc16, const NetworkData &aNetworkDa
Error error = kErrorNone;
ChangedFlags flags;
VerifyOrExit(Get<RouterTable>().IsAllocated(Mle::Mle::RouterIdFromRloc16(aRloc16)), error = kErrorNoRoute);
VerifyOrExit(Get<RouterTable>().IsAllocated(Mle::RouterIdFromRloc16(aRloc16)), error = kErrorNoRoute);
// Validate that the `aNetworkData` contains well-formed TLVs, sub-TLVs,
// and entries all matching `aRloc16` (no other RLOCs).
@@ -1390,7 +1390,7 @@ Error Leader::RemoveStaleChildEntries(Coap::ResponseHandler aHandler, void *aCon
while (GetNextServer(iterator, rloc16) == kErrorNone)
{
if (!Mle::Mle::IsActiveRouter(rloc16) && Mle::Mle::RouterIdMatch(Get<Mle::MleRouter>().GetRloc16(), rloc16) &&
if (!Mle::IsActiveRouter(rloc16) && Mle::RouterIdMatch(Get<Mle::MleRouter>().GetRloc16(), rloc16) &&
Get<ChildTable>().FindChild(rloc16, Child::kInStateValid) == nullptr)
{
// In Thread 1.1 Specification 5.15.6.1, only one RLOC16 TLV entry may appear in SRV_DATA.ntf.
+1 -1
View File
@@ -262,7 +262,7 @@ bool Publisher::Entry::IsPreferred(uint16_t aRloc16) const
// router over an entry from an end-device (e.g., a REED). If both
// are the same type, then the one with smaller RLOC16 is preferred.
bool isOtherRouter = Mle::Mle::IsActiveRouter(aRloc16);
bool isOtherRouter = Mle::IsActiveRouter(aRloc16);
return (Get<Mle::Mle>().IsRouterOrLeader() == isOtherRouter) ? (aRloc16 < Get<Mle::Mle>().GetRloc16())
: isOtherRouter;
+2 -2
View File
@@ -152,7 +152,7 @@ bool Manager::IsBackboneRouterPreferredTo(const ServerTlv & aSer
const BackboneRouter::ServerData &aOtherServerData) const
{
bool isPreferred;
uint16_t leaderRloc16 = Mle::Mle::Rloc16FromRouterId(Get<Mle::MleRouter>().GetLeaderId());
uint16_t leaderRloc16 = Mle::Rloc16FromRouterId(Get<Mle::MleRouter>().GetLeaderId());
VerifyOrExit(aServerTlv.GetServer16() != leaderRloc16, isPreferred = true);
VerifyOrExit(aOtherServerTlv.GetServer16() != leaderRloc16, isPreferred = false);
@@ -183,7 +183,7 @@ Error Manager::GetNextDnsSrpAnycastInfo(Iterator &aIterator, DnsSrpAnycast::Info
tlv->GetServiceData(serviceData);
aInfo.mAnycastAddress.SetToAnycastLocator(Get<Mle::Mle>().GetMeshLocalPrefix(),
Mle::Mle::ServiceAlocFromId(tlv->GetServiceId()));
Mle::ServiceAlocFromId(tlv->GetServiceId()));
aInfo.mSequenceNumber =
reinterpret_cast<const DnsSrpAnycast::ServiceData *>(serviceData.GetBytes())->GetSequenceNumber();
+1 -1
View File
@@ -247,7 +247,7 @@ Error NetworkDiagnostic::AppendChildTable(Message &aMessage)
entry.SetReserved(0);
entry.SetTimeout(timeout + 4);
entry.SetChildId(Mle::Mle::ChildIdFromRloc16(child.GetRloc16()));
entry.SetChildId(Mle::ChildIdFromRloc16(child.GetRloc16()));
entry.SetMode(child.GetDeviceMode());
SuccessOrExit(error = aMessage.Append(entry));
+5 -5
View File
@@ -188,7 +188,7 @@ void RouterTable::UpdateAllocation(void)
if (router.GetRouterId() != routerId)
{
router.Clear();
router.SetRloc16(Mle::Mle::Rloc16FromRouterId(routerId));
router.SetRloc16(Mle::Rloc16FromRouterId(routerId));
router.SetNextHop(Mle::kInvalidRouterId);
}
}
@@ -269,7 +269,7 @@ exit:
Error RouterTable::Release(uint8_t aRouterId)
{
Error error = kErrorNone;
uint16_t rloc16 = Mle::Mle::Rloc16FromRouterId(aRouterId);
uint16_t rloc16 = Mle::Rloc16FromRouterId(aRouterId);
Router * router;
OT_ASSERT(aRouterId <= Mle::kMaxRouterId);
@@ -401,7 +401,7 @@ const Router *RouterTable::GetRouter(uint8_t aRouterId) const
// Skip if invalid router id is passed.
VerifyOrExit(aRouterId < Mle::kInvalidRouterId);
rloc16 = Mle::Mle::Rloc16FromRouterId(aRouterId);
rloc16 = Mle::Rloc16FromRouterId(aRouterId);
router = FindRouter(Router::AddressMatcher(rloc16, Router::kInStateAny));
exit:
@@ -425,8 +425,8 @@ Error RouterTable::GetRouterInfo(uint16_t aRouterId, Router::Info &aRouterInfo)
}
else
{
VerifyOrExit(Mle::Mle::IsActiveRouter(aRouterId), error = kErrorInvalidArgs);
routerId = Mle::Mle::RouterIdFromRloc16(aRouterId);
VerifyOrExit(Mle::IsActiveRouter(aRouterId), error = kErrorInvalidArgs);
routerId = Mle::RouterIdFromRloc16(aRouterId);
VerifyOrExit(routerId <= Mle::kMaxRouterId, error = kErrorInvalidArgs);
}
+2 -2
View File
@@ -244,7 +244,7 @@ void Child::Info::SetFrom(const Child &aChild)
mExtAddress = aChild.GetExtAddress();
mTimeout = aChild.GetTimeout();
mRloc16 = aChild.GetRloc16();
mChildId = Mle::Mle::ChildIdFromRloc16(aChild.GetRloc16());
mChildId = Mle::ChildIdFromRloc16(aChild.GetRloc16());
mNetworkDataVersion = aChild.GetNetworkDataVersion();
mAge = Time::MsecToSec(TimerMilli::GetNow() - aChild.GetLastHeard());
mLinkQualityIn = aChild.GetLinkQualityIn();
@@ -516,7 +516,7 @@ void Router::Info::SetFrom(const Router &aRouter)
{
Clear();
mRloc16 = aRouter.GetRloc16();
mRouterId = Mle::Mle::RouterIdFromRloc16(mRloc16);
mRouterId = Mle::RouterIdFromRloc16(mRloc16);
mExtAddress = aRouter.GetExtAddress();
mAllocated = true;
mNextHop = aRouter.GetNextHop();