[mle] rename Mle::Handle{Command}() methods to indicate constraints (#10721)

This commit renames `Mle::Handle{Command}()` methods where different
overloads are provided (e.g. in `Mle` and `MleRouter`) based on
device role or being an FTD. The method names now explicitly mention
the constraints (e.g. `HandleChildUpdateRequestOnChild()` or
`HandleAdvertisementOnFtd()`). This change aims to improve code
readability, making it easier to determine the purpose of each
method.
This commit is contained in:
Abtin Keshavarzian
2024-09-17 18:20:37 -07:00
committed by GitHub
parent 62df7e9267
commit f07bcc2bfe
4 changed files with 39 additions and 29 deletions
+31 -23
View File
@@ -2567,31 +2567,11 @@ void Mle::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageIn
break;
case kCommandChildUpdateRequest:
#if OPENTHREAD_FTD
if (IsRouterOrLeader())
{
Get<MleRouter>().HandleChildUpdateRequest(rxInfo);
}
else
#endif
{
HandleChildUpdateRequest(rxInfo);
}
HandleChildUpdateRequest(rxInfo);
break;
case kCommandChildUpdateResponse:
#if OPENTHREAD_FTD
if (IsRouterOrLeader())
{
Get<MleRouter>().HandleChildUpdateResponse(rxInfo);
}
else
#endif
{
HandleChildUpdateResponse(rxInfo);
}
HandleChildUpdateResponse(rxInfo);
break;
#if OPENTHREAD_FTD
@@ -2786,7 +2766,7 @@ void Mle::HandleAdvertisement(RxInfo &aRxInfo)
#if OPENTHREAD_FTD
if (IsFullThreadDevice())
{
SuccessOrExit(error = Get<MleRouter>().HandleAdvertisement(aRxInfo, sourceAddress, leaderData));
SuccessOrExit(error = Get<MleRouter>().HandleAdvertisementOnFtd(aRxInfo, sourceAddress, leaderData));
}
#endif
@@ -3389,6 +3369,20 @@ exit:
}
void Mle::HandleChildUpdateRequest(RxInfo &aRxInfo)
{
#if OPENTHREAD_FTD
if (IsRouterOrLeader())
{
Get<MleRouter>().HandleChildUpdateRequestOnParent(aRxInfo);
}
else
#endif
{
HandleChildUpdateRequestOnChild(aRxInfo);
}
}
void Mle::HandleChildUpdateRequestOnChild(RxInfo &aRxInfo)
{
Error error = kErrorNone;
uint16_t sourceAddress;
@@ -3498,6 +3492,20 @@ exit:
}
void Mle::HandleChildUpdateResponse(RxInfo &aRxInfo)
{
#if OPENTHREAD_FTD
if (IsRouterOrLeader())
{
Get<MleRouter>().HandleChildUpdateResponseOnParent(aRxInfo);
}
else
#endif
{
HandleChildUpdateResponseOnChild(aRxInfo);
}
}
void Mle::HandleChildUpdateResponseOnChild(RxInfo &aRxInfo)
{
Error error = kErrorNone;
uint8_t status;
+2
View File
@@ -1315,7 +1315,9 @@ private:
void HandleAdvertisement(RxInfo &aRxInfo);
void HandleChildIdResponse(RxInfo &aRxInfo);
void HandleChildUpdateRequest(RxInfo &aRxInfo);
void HandleChildUpdateRequestOnChild(RxInfo &aRxInfo);
void HandleChildUpdateResponse(RxInfo &aRxInfo);
void HandleChildUpdateResponseOnChild(RxInfo &aRxInfo);
void HandleDataResponse(RxInfo &aRxInfo);
void HandleParentResponse(RxInfo &aRxInfo);
void HandleAnnounce(RxInfo &aRxInfo);
+3 -3
View File
@@ -1174,7 +1174,7 @@ exit:
return rval;
}
Error MleRouter::HandleAdvertisement(RxInfo &aRxInfo, uint16_t aSourceAddress, const LeaderData &aLeaderData)
Error MleRouter::HandleAdvertisementOnFtd(RxInfo &aRxInfo, uint16_t aSourceAddress, const LeaderData &aLeaderData)
{
// This method processes a received MLE Advertisement message on
// an FTD device. It is called from `Mle::HandleAdvertisement()`
@@ -2149,7 +2149,7 @@ exit:
LogProcessError(kTypeChildIdRequest, error);
}
void MleRouter::HandleChildUpdateRequest(RxInfo &aRxInfo)
void MleRouter::HandleChildUpdateRequestOnParent(RxInfo &aRxInfo)
{
Error error = kErrorNone;
Mac::ExtAddress extAddr;
@@ -2367,7 +2367,7 @@ exit:
LogProcessError(kTypeChildUpdateRequestOfChild, error);
}
void MleRouter::HandleChildUpdateResponse(RxInfo &aRxInfo)
void MleRouter::HandleChildUpdateResponseOnParent(RxInfo &aRxInfo)
{
Error error = kErrorNone;
uint16_t sourceAddress;
+3 -3
View File
@@ -607,11 +607,11 @@ private:
void HandleLinkAccept(RxInfo &aRxInfo);
Error HandleLinkAccept(RxInfo &aRxInfo, bool aRequest);
void HandleLinkAcceptAndRequest(RxInfo &aRxInfo);
Error HandleAdvertisement(RxInfo &aRxInfo, uint16_t aSourceAddress, const LeaderData &aLeaderData);
Error HandleAdvertisementOnFtd(RxInfo &aRxInfo, uint16_t aSourceAddress, const LeaderData &aLeaderData);
void HandleParentRequest(RxInfo &aRxInfo);
void HandleChildIdRequest(RxInfo &aRxInfo);
void HandleChildUpdateRequest(RxInfo &aRxInfo);
void HandleChildUpdateResponse(RxInfo &aRxInfo);
void HandleChildUpdateRequestOnParent(RxInfo &aRxInfo);
void HandleChildUpdateResponseOnParent(RxInfo &aRxInfo);
void HandleDataRequest(RxInfo &aRxInfo);
void HandleNetworkDataUpdateRouter(void);
void HandleDiscoveryRequest(RxInfo &aRxInfo);