mirror of
https://github.com/espressif/openthread.git
synced 2026-08-07 19:27:46 +00:00
[mle] define IsRouterIdValid() helper in mle_types.hpp (#9598)
This commit is contained in:
@@ -511,7 +511,7 @@ Error MeshForwarder::UpdateIp6RouteFtd(const Ip6::Header &aIp6Header, Message &a
|
||||
else if (mle.IsRoutingLocator(aIp6Header.GetDestination()))
|
||||
{
|
||||
uint16_t rloc16 = aIp6Header.GetDestination().GetIid().GetLocator();
|
||||
VerifyOrExit(mle.IsRouterIdValid(Mle::RouterIdFromRloc16(rloc16)), error = kErrorDrop);
|
||||
VerifyOrExit(Mle::IsRouterIdValid(Mle::RouterIdFromRloc16(rloc16)), error = kErrorDrop);
|
||||
mMeshDest = rloc16;
|
||||
}
|
||||
else if (mle.IsAnycastLocator(aIp6Header.GetDestination()))
|
||||
|
||||
@@ -421,17 +421,6 @@ public:
|
||||
*/
|
||||
void ResolveRoutingLoops(uint16_t aSourceMac, uint16_t aDestRloc16);
|
||||
|
||||
/**
|
||||
* Checks if a given Router ID has correct value.
|
||||
*
|
||||
* @param[in] aRouterId The Router ID value.
|
||||
*
|
||||
* @retval TRUE If @p aRouterId is in correct range [0..62].
|
||||
* @retval FALSE If @p aRouterId is not a valid Router ID.
|
||||
*
|
||||
*/
|
||||
static bool IsRouterIdValid(uint8_t aRouterId) { return aRouterId <= kMaxRouterId; }
|
||||
|
||||
/**
|
||||
* Fills an ConnectivityTlv.
|
||||
*
|
||||
@@ -799,8 +788,6 @@ public:
|
||||
Error RemoveNeighbor(Neighbor &) { return BecomeDetached(); }
|
||||
void RemoveRouterLink(Router &) { IgnoreError(BecomeDetached()); }
|
||||
|
||||
static bool IsRouterIdValid(uint8_t aRouterId) { return aRouterId <= kMaxRouterId; }
|
||||
|
||||
Error SendChildUpdateRequest(void) { return Mle::SendChildUpdateRequest(); }
|
||||
|
||||
Error CheckReachability(uint16_t aMeshDest, const Ip6::Header &aIp6Header)
|
||||
|
||||
@@ -616,6 +616,17 @@ inline uint16_t ChildIdFromRloc16(uint16_t aRloc16) { return aRloc16 & kMaxChild
|
||||
*/
|
||||
inline uint8_t RouterIdFromRloc16(uint16_t aRloc16) { return aRloc16 >> kRouterIdOffset; }
|
||||
|
||||
/**
|
||||
* Indicates whether or not a given Router ID is valid.
|
||||
*
|
||||
* @param[in] aRouterId The Router ID value to check.
|
||||
*
|
||||
* @retval TRUE If @p aRouterId is in correct range [0..62].
|
||||
* @retval FALSE If @p aRouterId is not a valid Router ID.
|
||||
*
|
||||
*/
|
||||
inline bool IsRouterIdValid(uint8_t aRouterId) { return aRouterId <= kMaxRouterId; }
|
||||
|
||||
/**
|
||||
* Returns whether the two RLOC16 have the same Router ID.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user