diff --git a/src/core/api/thread_api.cpp b/src/core/api/thread_api.cpp index 54960cc2c..ca157c853 100644 --- a/src/core/api/thread_api.cpp +++ b/src/core/api/thread_api.cpp @@ -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) diff --git a/src/core/common/settings.cpp b/src/core/common/settings.cpp index 67f76e205..e88e19550 100644 --- a/src/core/common/settings.cpp +++ b/src/core/common/settings.cpp @@ -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(GetRole())), GetDeviceMode(), GetVersion(), + Mle::RoleToString(static_cast(GetRole())), GetDeviceMode(), GetVersion(), GetKeySequence()); LogInfo("... pid:0x%x, mlecntr:0x%x, maccntr:0x%x, mliid:%s}", GetPreviousPartitionId(), GetMleFrameCounter(), diff --git a/src/core/thread/address_resolver.cpp b/src/core/thread/address_resolver.cpp index 997276b84..34938a3a0 100644 --- a/src/core/thread/address_resolver.cpp +++ b/src/core/thread/address_resolver.cpp @@ -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); diff --git a/src/core/thread/child_table.cpp b/src/core/thread/child_table.cpp index 29a85142d..19462b085 100644 --- a/src/core/thread/child_table.cpp +++ b/src/core/thread/child_table.cpp @@ -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().GetShortAddress() | aChildId; diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index d1b41a2c9..5668d7e7f 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -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().RemoveRouterLink(static_cast(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().IsRouterOrLeader() && static_cast(aNeighbor)->IsCslSynchronized()) { version = Mac::Frame::kFcfFrameVersion2015; diff --git a/src/core/thread/mesh_forwarder_ftd.cpp b/src/core/thread/mesh_forwarder_ftd.cpp index 5820444b7..3132e199c 100644 --- a/src/core/thread/mesh_forwarder_ftd.cpp +++ b/src/core/thread/mesh_forwarder_ftd.cpp @@ -432,7 +432,7 @@ void MeshForwarder::EvaluateRoutingCost(uint16_t aDest, uint8_t &aBestCost, uint // Path cost curCost = Get().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().GetLinkCost(Mle::Mle::RouterIdFromRloc16(aDest)); + cost = Get().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().GetRloc16())) + if (!(Mle::IsActiveRouter(bestDest) || Mle::Rloc16FromRouterId(routerId) == Get().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().FindNeighbor(ip6Headers.GetSourceAddress()); VerifyOrExit(neighbor != nullptr && !neighbor->IsFullThreadDevice()); - if (!Mle::Mle::RouterIdMatch(aMeshAddrs.mSource.GetShort(), Get().GetShortAddress())) + if (!Mle::RouterIdMatch(aMeshAddrs.mSource.GetShort(), Get().GetShortAddress())) { Get().RemoveNeighbor(*neighbor); } diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 852f21ed7..bbc94297c 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -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) diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index 39cb03d22..bb063be56 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -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(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(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((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(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. * diff --git a/src/core/thread/mle_types.cpp b/src/core/thread/mle_types.cpp index 28233bab5..f820e5785 100644 --- a/src/core/thread/mle_types.cpp +++ b/src/core/thread/mle_types.cpp @@ -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 diff --git a/src/core/thread/mle_types.hpp b/src/core/thread/mle_types.hpp index aae57d89b..19f577867 100644 --- a/src/core/thread/mle_types.hpp +++ b/src/core/thread/mle_types.hpp @@ -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(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(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((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(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); + /** * @} * diff --git a/src/core/thread/network_data.cpp b/src/core/thread/network_data.cpp index 3c96a9284..9f15cb6af 100644 --- a/src/core/thread/network_data.cpp +++ b/src/core/thread/network_data.cpp @@ -486,7 +486,7 @@ void MutableNetworkData::RemoveTemporaryDataIn(ServiceTlv &aService) switch (cur->GetType()) { case NetworkDataTlv::kTypeServer: - As(cur)->SetServer16(Mle::Mle::ServiceAlocFromId(aService.GetServiceId())); + As(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; } diff --git a/src/core/thread/network_data_leader_ftd.cpp b/src/core/thread/network_data_leader_ftd.cpp index dac504d76..8197c9143 100644 --- a/src/core/thread/network_data_leader_ftd.cpp +++ b/src/core/thread/network_data_leader_ftd.cpp @@ -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().IsAllocated(Mle::Mle::RouterIdFromRloc16(aRloc16)), error = kErrorNoRoute); + VerifyOrExit(Get().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().GetRloc16(), rloc16) && + if (!Mle::IsActiveRouter(rloc16) && Mle::RouterIdMatch(Get().GetRloc16(), rloc16) && Get().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. diff --git a/src/core/thread/network_data_publisher.cpp b/src/core/thread/network_data_publisher.cpp index 8141c760a..25bb2b25e 100644 --- a/src/core/thread/network_data_publisher.cpp +++ b/src/core/thread/network_data_publisher.cpp @@ -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().IsRouterOrLeader() == isOtherRouter) ? (aRloc16 < Get().GetRloc16()) : isOtherRouter; diff --git a/src/core/thread/network_data_service.cpp b/src/core/thread/network_data_service.cpp index 618812bb5..4bc60da48 100644 --- a/src/core/thread/network_data_service.cpp +++ b/src/core/thread/network_data_service.cpp @@ -152,7 +152,7 @@ bool Manager::IsBackboneRouterPreferredTo(const ServerTlv & aSer const BackboneRouter::ServerData &aOtherServerData) const { bool isPreferred; - uint16_t leaderRloc16 = Mle::Mle::Rloc16FromRouterId(Get().GetLeaderId()); + uint16_t leaderRloc16 = Mle::Rloc16FromRouterId(Get().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().GetMeshLocalPrefix(), - Mle::Mle::ServiceAlocFromId(tlv->GetServiceId())); + Mle::ServiceAlocFromId(tlv->GetServiceId())); aInfo.mSequenceNumber = reinterpret_cast(serviceData.GetBytes())->GetSequenceNumber(); diff --git a/src/core/thread/network_diagnostic.cpp b/src/core/thread/network_diagnostic.cpp index 738e904ab..5eaab1c56 100644 --- a/src/core/thread/network_diagnostic.cpp +++ b/src/core/thread/network_diagnostic.cpp @@ -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)); diff --git a/src/core/thread/router_table.cpp b/src/core/thread/router_table.cpp index 33595de82..8175e694f 100644 --- a/src/core/thread/router_table.cpp +++ b/src/core/thread/router_table.cpp @@ -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); } diff --git a/src/core/thread/topology.cpp b/src/core/thread/topology.cpp index f6c5307f1..5eac7761e 100644 --- a/src/core/thread/topology.cpp +++ b/src/core/thread/topology.cpp @@ -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();