[core] use RLOC16-related constants and methods consistently across modules (#10434)

This commit aims to make the use of RLOC16-related constants and
methods consistent across different modules.

- It replaces `Mac::kShortAddrInvalid` with `Mle::kInvalidRloc16` to
  refer to an invalid RLOC16 value (note that these constants use the
  same value `0xfffe`).
- It uses `Get<Mle::Mle>().GetRloc16()` to retrieve the device's
  RLOC16 instead of `Get<Mac::Mac>().GetShortAddress()`.
- It updates `AddressResolver` to consistently use `uint16_t` for
  RLOC16 (instead of the `Mac::ShortAddress` typedef).
This commit is contained in:
Abtin Keshavarzian
2024-06-25 13:09:35 -07:00
committed by GitHub
parent dc69fb1ace
commit cc8f66c56f
21 changed files with 85 additions and 87 deletions
+2 -2
View File
@@ -81,7 +81,7 @@ otError otThreadGetLeaderRloc(otInstance *aInstance, otIp6Address *aLeaderRloc)
{
Error error = kErrorNone;
VerifyOrExit(AsCoreType(aInstance).Get<Mle::Mle>().GetRloc16() != Mac::kShortAddrInvalid, error = kErrorDetached);
VerifyOrExit(AsCoreType(aInstance).Get<Mle::Mle>().GetRloc16() != Mle::kInvalidRloc16, error = kErrorDetached);
AsCoreType(aInstance).Get<Mle::Mle>().GetLeaderRloc(AsCoreType(aLeaderRloc));
exit:
@@ -197,7 +197,7 @@ otError otThreadGetServiceAloc(otInstance *aInstance, uint8_t aServiceId, otIp6A
{
Error error = kErrorNone;
VerifyOrExit(AsCoreType(aInstance).Get<Mle::Mle>().GetRloc16() != Mac::kShortAddrInvalid, error = kErrorDetached);
VerifyOrExit(AsCoreType(aInstance).Get<Mle::Mle>().GetRloc16() != Mle::kInvalidRloc16, error = kErrorDetached);
AsCoreType(aInstance).Get<Mle::Mle>().GetServiceAloc(aServiceId, AsCoreType(aServiceAloc));
exit: