mirror of
https://github.com/espressif/openthread.git
synced 2026-08-04 18:07:47 +00:00
[ip6] expose static multicast address getters and remove wrapper methods (#12416)
This commit updates `Ip6::Address` to expose `static` getter methods for common multicast addresses (e.g., `GetLinkLocalAllNodesMulticast()`) as public API. Consequentially, the wrapper `SetTo...` and `Is...` methods for these multicast addresses are removed. Callers are updated to use the `static` getters directly. This change simplifies usage by allowing direct access to the constant address instances, often eliminating the need for local `Ip6::Address` variables.
This commit is contained in:
@@ -498,13 +498,7 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
void Mle::SendMulticastAdvertisement(void)
|
||||
{
|
||||
Ip6::Address destination;
|
||||
|
||||
destination.SetToLinkLocalAllNodesMulticast();
|
||||
SendAdvertisement(destination);
|
||||
}
|
||||
void Mle::SendMulticastAdvertisement(void) { SendAdvertisement(Ip6::Address::GetLinkLocalAllNodesMulticast()); }
|
||||
|
||||
void Mle::ScheduleUnicastAdvertisementTo(const Router &aRouter)
|
||||
{
|
||||
@@ -615,7 +609,7 @@ void Mle::SendLinkRequest(Router *aRouter)
|
||||
{
|
||||
mPrevRoleRestorer.GenerateRandomChallenge();
|
||||
SuccessOrExit(error = message->AppendChallengeTlv(mPrevRoleRestorer.GetChallenge()));
|
||||
destination.SetToLinkLocalAllRoutersMulticast();
|
||||
destination = Ip6::Address::GetLinkLocalAllRoutersMulticast();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3104,12 +3098,10 @@ exit:
|
||||
|
||||
void Mle::SendMulticastDataResponse(void)
|
||||
{
|
||||
Ip6::Address destination;
|
||||
TlvList tlvList;
|
||||
TlvList tlvList;
|
||||
|
||||
destination.SetToLinkLocalAllNodesMulticast();
|
||||
tlvList.Add(Tlv::kNetworkData);
|
||||
SendDataResponse(destination, tlvList);
|
||||
SendDataResponse(Ip6::Address::GetLinkLocalAllNodesMulticast(), tlvList);
|
||||
}
|
||||
|
||||
void Mle::SendDataResponse(const Ip6::Address &aDestination, const TlvList &aTlvList, const Message *aRequestMessage)
|
||||
@@ -3913,7 +3905,7 @@ Error Mle::SendTimeSync(void)
|
||||
|
||||
message->SetTimeSync(true);
|
||||
|
||||
destination.SetToLinkLocalAllNodesMulticast();
|
||||
destination = Ip6::Address::GetLinkLocalAllNodesMulticast();
|
||||
SuccessOrExit(error = message->SendTo(destination));
|
||||
|
||||
Log(kMessageSend, kTypeTimeSync, destination);
|
||||
|
||||
Reference in New Issue
Block a user