diff --git a/src/core/api/commissioner_api.cpp b/src/core/api/commissioner_api.cpp index b08fa7416..4463d4c19 100644 --- a/src/core/api/commissioner_api.cpp +++ b/src/core/api/commissioner_api.cpp @@ -299,12 +299,12 @@ otError otCommissionerGeneratePSKc(otInstance * aInstance, const otExtendedPanId *aExtPanId, uint8_t * aPSKc) { + OT_UNUSED_VARIABLE(aInstance); + otError error = OT_ERROR_DISABLED_FEATURE; #if OPENTHREAD_FTD && OPENTHREAD_ENABLE_COMMISSIONER - Instance &instance = *static_cast(aInstance); - - error = instance.GetThreadNetif().GetCommissioner().GeneratePSKc(aPassPhrase, aNetworkName, *aExtPanId, aPSKc); + error = MeshCoP::Commissioner::GeneratePSKc(aPassPhrase, aNetworkName, *aExtPanId, aPSKc); #else OT_UNUSED_VARIABLE(aInstance); OT_UNUSED_VARIABLE(aPassPhrase); diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index 66056d0b4..8e704a393 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -840,19 +840,18 @@ otError MeshForwarder::SendFragment(Message &aMessage, Mac::Frame &aFrame) if (hopsLeft != Mle::kMaxRouteCost) { - hopsLeft += - netif.GetMle().GetLinkCost(netif.GetMle().GetRouterId(netif.GetMle().GetNextHop(mMeshDest))); + hopsLeft += netif.GetMle().GetLinkCost(Mle::Mle::GetRouterId(netif.GetMle().GetNextHop(mMeshDest))); } else { // In case there is no route to the destination router (only link). - hopsLeft = netif.GetMle().GetLinkCost(netif.GetMle().GetRouterId(mMeshDest)); + hopsLeft = netif.GetMle().GetLinkCost(Mle::Mle::GetRouterId(mMeshDest)); } } // The hopsLft field MUST be incremented by one if the destination RLOC16 // is not that of an active Router. - if (!netif.GetMle().IsActiveRouter(mMeshDest)) + if (!Mle::Mle::IsActiveRouter(mMeshDest)) { hopsLeft += 1; } @@ -1036,7 +1035,7 @@ void MeshForwarder::HandleSentFrame(Mac::Frame &aFrame, otError aError) case OT_ERROR_NO_ACK: neighbor->IncrementLinkFailures(); - if (netif.GetMle().IsActiveRouter(neighbor->GetRloc16())) + if (Mle::Mle::IsActiveRouter(neighbor->GetRloc16())) { if (neighbor->GetLinkFailures() >= Mle::kFailedRouterTransmissions) { @@ -1593,7 +1592,7 @@ otError MeshForwarder::GetFramePriority(const uint8_t * aFrame, SuccessOrExit(error = DecompressIp6Header(aFrame, aFrameLength, aMacSource, aMacDest, ip6Header, headerLength, nextHeaderCompressed)); - aPriority = GetNetif().GetIp6().DscpToPriority(ip6Header.GetDscp()); + aPriority = Ip6::Ip6::DscpToPriority(ip6Header.GetDscp()); VerifyOrExit(ip6Header.GetNextHeader() == Ip6::kProtoUdp); aFrame += headerLength; diff --git a/src/core/thread/mesh_forwarder_ftd.cpp b/src/core/thread/mesh_forwarder_ftd.cpp index 3a0b50a62..a9a4936f6 100644 --- a/src/core/thread/mesh_forwarder_ftd.cpp +++ b/src/core/thread/mesh_forwarder_ftd.cpp @@ -804,7 +804,7 @@ otError MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header) if (aloc16 == Mle::kAloc16Leader) { - mMeshDest = netif.GetMle().GetRloc16(netif.GetMle().GetLeaderId()); + mMeshDest = Mle::Mle::GetRloc16(netif.GetMle().GetLeaderId()); } else if ((aloc16 >= Mle::kAloc16CommissionerStart) && (aloc16 <= Mle::kAloc16CommissionerEnd)) { @@ -820,18 +820,18 @@ otError MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header) static_cast(aloc16 & Mle::kAloc16DhcpAgentMask), agentRloc16) == OT_ERROR_NONE), error = OT_ERROR_DROP); - routerId = netif.GetMle().GetRouterId(agentRloc16); + routerId = Mle::Mle::GetRouterId(agentRloc16); // if agent is active router or the child of the device - if ((netif.GetMle().IsActiveRouter(agentRloc16)) || - (netif.GetMle().GetRloc16(routerId) == netif.GetMle().GetRloc16())) + if ((Mle::Mle::IsActiveRouter(agentRloc16)) || + (Mle::Mle::GetRloc16(routerId) == netif.GetMle().GetRloc16())) { mMeshDest = agentRloc16; } else { // use the parent of the ED Agent as Dest - mMeshDest = netif.GetMle().GetRloc16(routerId); + mMeshDest = Mle::Mle::GetRloc16(routerId); } } @@ -1179,7 +1179,7 @@ otError MeshForwarder::GetDestinationRlocByServiceAloc(uint16_t aServiceAloc, ui { otError error = OT_ERROR_NONE; ThreadNetif & netif = GetNetif(); - uint8_t serviceId = netif.GetMle().GetServiceIdFromAloc(aServiceAloc); + uint8_t serviceId = Mle::Mle::GetServiceIdFromAloc(aServiceAloc); NetworkData::ServiceTlv *serviceTlv = netif.GetNetworkDataLeader().FindServiceById(serviceId); if (serviceTlv != NULL) diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 557ded179..65b8eb258 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -3173,8 +3173,8 @@ otError Mle::HandleParentResponse(const Message &aMessage, const Ip6::MessageInf case kAttachBetter: VerifyOrExit(leaderData.GetPartitionId() != mLeaderData.GetPartitionId()); - VerifyOrExit(netif.GetMle().ComparePartitions(connectivity.GetActiveRouters() <= 1, leaderData, - netif.GetMle().IsSingleton(), mLeaderData) > 0); + VerifyOrExit(MleRouter::ComparePartitions(connectivity.GetActiveRouters() <= 1, leaderData, + netif.GetMle().IsSingleton(), mLeaderData) > 0); break; } } @@ -3187,8 +3187,8 @@ otError Mle::HandleParentResponse(const Message &aMessage, const Ip6::MessageInf if (IsFullThreadDevice()) { - compare = netif.GetMle().ComparePartitions(connectivity.GetActiveRouters() <= 1, leaderData, - mParentIsSingleton, mParentLeaderData); + compare = MleRouter::ComparePartitions(connectivity.GetActiveRouters() <= 1, leaderData, mParentIsSingleton, + mParentLeaderData); } // only consider partitions that are the same or better diff --git a/src/core/thread/network_diagnostic.cpp b/src/core/thread/network_diagnostic.cpp index 7c41c09a2..459df1c96 100644 --- a/src/core/thread/network_diagnostic.cpp +++ b/src/core/thread/network_diagnostic.cpp @@ -250,7 +250,7 @@ otError NetworkDiagnostic::AppendChildTable(Message &aMessage) entry.SetReserved(0); entry.SetTimeout(timeout + 4); - entry.SetChildId(netif.GetMle().GetChildId(child.GetRloc16())); + entry.SetChildId(Mle::Mle::GetChildId(child.GetRloc16())); entry.SetMode(child.GetDeviceMode()); SuccessOrExit(error = aMessage.Append(&entry, sizeof(ChildTableEntry)));