[mle] update SendParentResponse() to use Child & input (#10801)

This commit updates `SendParentResponse()` to accept `aChild` as a
`Child &` instead of a `Child *`, as it will always expect a valid
child object and won't handle a `nullptr` input.
This commit is contained in:
Abtin Keshavarzian
2024-10-08 18:10:39 -07:00
committed by GitHub
parent ce57c5a969
commit 0e81aa1014
2 changed files with 9 additions and 9 deletions
+8 -8
View File
@@ -1440,7 +1440,7 @@ void MleRouter::HandleParentRequest(RxInfo &aRxInfo)
aRxInfo.mClass = RxInfo::kPeerMessage;
ProcessKeySequence(aRxInfo);
SendParentResponse(child, challenge, !ScanMaskTlv::IsEndDeviceFlagSet(scanMask));
SendParentResponse(*child, challenge, !ScanMaskTlv::IsEndDeviceFlagSet(scanMask));
exit:
LogProcessError(kTypeParentRequest, error);
@@ -1673,7 +1673,7 @@ exit:
return;
}
void MleRouter::SendParentResponse(Child *aChild, const RxChallenge &aChallenge, bool aRoutersOnlyRequest)
void MleRouter::SendParentResponse(Child &aChild, const RxChallenge &aChallenge, bool aRoutersOnlyRequest)
{
Error error = kErrorNone;
Ip6::Address destination;
@@ -1688,24 +1688,24 @@ void MleRouter::SendParentResponse(Child *aChild, const RxChallenge &aChallenge,
SuccessOrExit(error = message->AppendLinkAndMleFrameCounterTlvs());
SuccessOrExit(error = message->AppendResponseTlv(aChallenge));
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
if (aChild->IsTimeSyncEnabled())
if (aChild.IsTimeSyncEnabled())
{
SuccessOrExit(error = message->AppendTimeParameterTlv());
}
#endif
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
if (aChild->IsThreadVersionCslCapable())
if (aChild.IsThreadVersionCslCapable())
{
SuccessOrExit(error = message->AppendCslClockAccuracyTlv());
}
#endif
aChild->GenerateChallenge();
SuccessOrExit(error = message->AppendChallengeTlv(aChild->GetChallenge()));
SuccessOrExit(error = message->AppendLinkMarginTlv(aChild->GetLinkInfo().GetLinkMargin()));
aChild.GenerateChallenge();
SuccessOrExit(error = message->AppendChallengeTlv(aChild.GetChallenge()));
SuccessOrExit(error = message->AppendLinkMarginTlv(aChild.GetLinkInfo().GetLinkMargin()));
SuccessOrExit(error = message->AppendConnectivityTlv());
SuccessOrExit(error = message->AppendVersionTlv());
destination.SetToLinkLocalAddress(aChild->GetExtAddress());
destination.SetToLinkLocalAddress(aChild.GetExtAddress());
delay = 1 + Random::NonCrypto::GetUint16InRange(0, aRoutersOnlyRequest ? kParentResponseMaxDelayRouters
: kParentResponseMaxDelayAll);
+1 -1
View File
@@ -592,7 +592,7 @@ private:
Neighbor *aNeighbor,
const TlvList &aRequestedTlvList,
const RxChallenge &aChallenge);
void SendParentResponse(Child *aChild, const RxChallenge &aChallenge, bool aRoutersOnlyRequest);
void SendParentResponse(Child &aChild, const RxChallenge &aChallenge, bool aRoutersOnlyRequest);
Error SendChildIdResponse(Child &aChild);
Error SendChildUpdateRequest(Child &aChild);
void SendChildUpdateResponse(Child *aChild,