mirror of
https://github.com/espressif/openthread.git
synced 2026-06-06 05:24:51 +00:00
[router-table] rename FindNextHopOf() to FindNextHopTowards() (#13008)
This commit renames the `RouterTable::FindNextHopOf()` method to `RouterTable::FindNextHopTowards()` to more accurately reflect its purpose: finding the next hop on the path towards a given destination router.
This commit is contained in:
committed by
GitHub
parent
d145aafeea
commit
a97fa5bd32
@@ -1799,7 +1799,7 @@ void Mle::HandleTimeTick(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IsLeader() && (mRouterTable.FindNextHopOf(router) == nullptr) &&
|
||||
if (IsLeader() && (mRouterTable.FindNextHopTowards(router) == nullptr) &&
|
||||
(mRouterTable.GetLinkCost(router) >= kMaxRouteCost) && (age >= kMaxLeaderToRouterTimeout))
|
||||
{
|
||||
LogInfo("Router 0x%04x ID timeout expired (no route)", router.GetRloc16());
|
||||
|
||||
@@ -317,7 +317,10 @@ const Router *RouterTable::FindRouterByRloc16(uint16_t aRloc16) const
|
||||
return FindRouterById(Mle::RouterIdFromRloc16(aRloc16));
|
||||
}
|
||||
|
||||
const Router *RouterTable::FindNextHopOf(const Router &aRouter) const { return FindRouterById(aRouter.GetNextHop()); }
|
||||
const Router *RouterTable::FindNextHopTowards(const Router &aRouter) const
|
||||
{
|
||||
return FindRouterById(aRouter.GetNextHop());
|
||||
}
|
||||
|
||||
Router *RouterTable::FindRouter(const Mac::ExtAddress &aExtAddress)
|
||||
{
|
||||
@@ -431,7 +434,7 @@ void RouterTable::GetNextHopAndPathCost(uint16_t aDestRloc16, uint16_t &aNextHop
|
||||
}
|
||||
|
||||
router = FindRouterById(Mle::RouterIdFromRloc16(aDestRloc16));
|
||||
nextHop = (router != nullptr) ? FindNextHopOf(*router) : nullptr;
|
||||
nextHop = (router != nullptr) ? FindNextHopTowards(*router) : nullptr;
|
||||
|
||||
if (Get<Mle::Mle>().IsChild())
|
||||
{
|
||||
@@ -663,7 +666,7 @@ void RouterTable::UpdateRoutes(const Mle::RouteTlv &aRouteTlv, uint8_t aNeighbor
|
||||
continue;
|
||||
}
|
||||
|
||||
nextHop = FindNextHopOf(*router);
|
||||
nextHop = FindNextHopTowards(*router);
|
||||
|
||||
cost = aRouteTlv.GetRouteCost(index);
|
||||
cost = (cost == 0) ? Mle::kMaxRouteCost : cost;
|
||||
|
||||
@@ -242,22 +242,22 @@ public:
|
||||
const Router *FindRouterByRloc16(uint16_t aRloc16) const;
|
||||
|
||||
/**
|
||||
* Finds the router that is the next hop of a given router.
|
||||
* Finds the router that is the next hop towards a given router.
|
||||
*
|
||||
* @param[in] aRouter The router to find next hop of.
|
||||
* @param[in] aRouter The destination router.
|
||||
*
|
||||
* @returns A pointer to the router or `nullptr` if the router could not be found.
|
||||
*/
|
||||
Router *FindNextHopOf(const Router &aRouter) { return AsNonConst(AsConst(this)->FindNextHopOf(aRouter)); }
|
||||
Router *FindNextHopTowards(const Router &aRouter) { return AsNonConst(AsConst(this)->FindNextHopTowards(aRouter)); }
|
||||
|
||||
/**
|
||||
* Finds the router that is the next hop of a given router.
|
||||
* Finds the router that is the next hop towards a given router.
|
||||
*
|
||||
* @param[in] aRouter The router to find next hop of.
|
||||
* @param[in] aRouter The destination router.
|
||||
*
|
||||
* @returns A pointer to the router or `nullptr` if the router could not be found.
|
||||
*/
|
||||
const Router *FindNextHopOf(const Router &aRouter) const;
|
||||
const Router *FindNextHopTowards(const Router &aRouter) const;
|
||||
|
||||
/**
|
||||
* Find the router for a given MAC Extended Address.
|
||||
|
||||
Reference in New Issue
Block a user