36 RibEntry::RouteList::iterator
42 RibEntry::RouteList::const_iterator
48 std::pair<RibEntry::iterator, bool>
55 m_nRoutesWithCaptureSet++;
58 m_routes.push_back(route);
59 return {std::prev(m_routes.end()),
true};
91 return m_routes.size();
97 BOOST_ASSERT(!child->getParent());
98 child->setParent(this->shared_from_this());
105 BOOST_ASSERT(child->getParent().get() ==
this);
106 child->setParent(
nullptr);
107 m_children.remove(child);
110 RibEntry::RouteList::iterator
113 if (route != m_routes.end()) {
115 m_nRoutesWithCaptureSet--;
119 NFD_LOG_TRACE(
"Cancelling expiration event: " << route->getExpirationEvent());
120 route->cancelExpirationEvent();
122 return m_routes.erase(route);
125 return m_routes.end();
131 m_inheritedRoutes.push_back(route);
140 RibEntry::RouteList::const_iterator
143 return std::find_if(m_inheritedRoutes.begin(), m_inheritedRoutes.end(),
156 return m_nRoutesWithCaptureSet > 0;
162 for (
const Route& route : m_routes) {
174 const Route* candidate =
nullptr;
176 for (
const Route& route : m_routes) {
178 if (route.faceId == faceId) {
180 if (candidate ==
nullptr) {
183 else if (route.cost < candidate->
cost) {
196 std::vector<const Route*> matches;
199 for (
const Route& route : m_routes) {
200 if (route.faceId == faceId) {
201 matches.push_back(&route);
206 if (matches.size() < 2) {
211 std::nth_element(matches.begin(), matches.begin() + 1, matches.end(),
212 [] (
const Route* lhs,
const Route* rhs) { return lhs->cost < rhs->cost; });
214 return matches.at(1);
220 const Route* candidate =
nullptr;
222 for (
const Route& route : m_routes) {
224 if (route.faceId == faceId &&
228 if (candidate ==
nullptr) {
231 else if (route.cost < candidate->
cost) {
243 time::milliseconds maxExpiration)
const
245 const Route* bestAnnRoute =
nullptr;
246 auto entryExpiry = time::steady_clock::TimePoint::min();
248 for (
const Route& route : *
this) {
250 entryExpiry = std::max(entryExpiry, *route.
expires);
252 if (bestAnnRoute ==
nullptr || *route.
expires > *bestAnnRoute->
expires) {
253 bestAnnRoute = &route;
258 entryExpiry = time::steady_clock::TimePoint::max();
262 if (bestAnnRoute !=
nullptr) {
270 minExpiration, maxExpiration));
277 os <<
"RibEntry {\n";
278 os <<
" Name: " << entry.
getName() <<
"\n";
280 for (
const Route& route : entry) {
281 os <<
" " << route <<
"\n";