[mle] refactor Tx/RxMessage method definitions (#7812)

This commit is a cosmetic change and contains no change in the code
logic. It is a follow-up from #7689 which added `Mle::Tx/RxMessage`
types. This commit moves all `TxMessage` and `RxMessage` method
definitions close to one another (at the end of `mle.cpp`).
This commit is contained in:
Abtin Keshavarzian
2022-06-15 13:35:40 -07:00
committed by GitHub
parent 49b9846632
commit d5926a2445
2 changed files with 658 additions and 640 deletions
+658 -568
View File
File diff suppressed because it is too large Load Diff
-72
View File
@@ -4161,58 +4161,6 @@ void MleRouter::FillConnectivityTlv(ConnectivityTlv &aTlv)
aTlv.SetSedDatagramCount(OPENTHREAD_CONFIG_DEFAULT_SED_DATAGRAM_COUNT);
}
Error Mle::TxMessage::AppendConnectivityTlv(void)
{
ConnectivityTlv tlv;
tlv.Init();
Get<MleRouter>().FillConnectivityTlv(tlv);
return tlv.AppendTo(*this);
}
Error Mle::TxMessage::AppendAddresseRegisterationTlv(Child &aChild)
{
Error error;
Tlv tlv;
AddressRegistrationEntry entry;
Lowpan::Context context;
uint8_t length = 0;
uint16_t startOffset = GetLength();
tlv.SetType(Tlv::kAddressRegistration);
SuccessOrExit(error = Append(tlv));
for (const Ip6::Address &address : aChild.IterateIp6Addresses())
{
if (address.IsMulticast() || Get<NetworkData::Leader>().GetContext(address, context) != kErrorNone)
{
// uncompressed entry
entry.SetUncompressed();
entry.SetIp6Address(address);
}
else if (context.mContextId != kMeshLocalPrefixContextId)
{
// compressed entry
entry.SetContextId(context.mContextId);
entry.SetIid(address.GetIid());
}
else
{
continue;
}
SuccessOrExit(error = AppendBytes(&entry, entry.GetLength()));
length += entry.GetLength();
}
tlv.SetLength(length);
Write(startOffset, tlv);
exit:
return error;
}
void MleRouter::FillRouteTlv(RouteTlv &aTlv, Neighbor *aNeighbor)
{
uint8_t routerIdSequence = mRouterTable.GetRouterIdSequence();
@@ -4314,26 +4262,6 @@ void MleRouter::FillRouteTlv(RouteTlv &aTlv, Neighbor *aNeighbor)
aTlv.SetRouteDataLength(routerCount);
}
Error Mle::TxMessage::AppendRouteTlv(Neighbor *aNeighbor)
{
RouteTlv tlv;
tlv.Init();
Get<MleRouter>().FillRouteTlv(tlv, aNeighbor);
return tlv.AppendTo(*this);
}
Error Mle::TxMessage::AppendActiveDatasetTlv(void)
{
return Get<MeshCoP::ActiveDatasetManager>().AppendMleDatasetTlv(*this);
}
Error Mle::TxMessage::AppendPendingDatasetTlv(void)
{
return Get<MeshCoP::PendingDatasetManager>().AppendMleDatasetTlv(*this);
}
bool MleRouter::HasMinDowngradeNeighborRouters(void)
{
uint8_t linkQuality;