|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
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";
iterator findRoute(const Route &route)
bool hasRoute(const Route &route)
const Name & getName() const
size_t getNRoutes() const
Represents a RIB entry, which contains one or more Routes with the same prefix.
static time_point now() noexcept
PrefixAnnouncement & setExpiration(time::milliseconds expiration)
Set relative expiration period.
const Route * getRouteWithSecondLowestCostByFaceId(uint64_t faceId) const
void eraseRoute(const Route &route)
erases a Route with the same faceId and origin
A prefix announcement object that represents an application's intent of registering a prefix toward i...
const Route * getRouteWithLowestCostAndChildInheritByFaceId(uint64_t faceId) const
Returns the route with the lowest cost that has the passed face ID and its child inherit flag set.
const Route * getRouteWithLowestCostByFaceId(uint64_t faceId) const
Returns the route with the lowest cost that has the passed face ID.
bool hasChildInheritOnFaceId(uint64_t faceId) const
Determines if the entry has an inherited route with the passed face ID and its child inherit flag set...
Copyright (c) 2011-2015 Regents of the University of California.
bool compareFaceId(const Route &route, const uint64_t faceId)
RouteList::const_iterator const_iterator
RouteList::iterator iterator
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
bool compareFaceIdAndOrigin(const Route &lhs, const Route &rhs)
void addInheritedRoute(const Route &route)
ndn::PrefixAnnouncement getPrefixAnnouncement(time::milliseconds minExpiration=15_s, time::milliseconds maxExpiration=1_h) const
Retrieve a prefix announcement suitable for readvertising this route.
bool hasFaceId(const uint64_t faceId) const
bool hasInheritedRoute(const Route &route) const
Determines if the entry has an inherited route with a matching face ID.
void addChild(shared_ptr< RibEntry > child)
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)
RouteList::const_iterator findInheritedRoute(const Route &route) const
Finds an inherited route with a matching face ID.
optional< ndn::PrefixAnnouncement > announcement
The prefix announcement that caused the creation of this route.
const_iterator end() const
void removeChild(shared_ptr< RibEntry > child)
std::underlying_type_t< ndn::nfd::RouteFlags > flags
represents a route for a name prefix
optional< time::steady_clock::TimePoint > expires
const_iterator begin() const
std::pair< RibEntry::iterator, bool > insertRoute(const Route &route)
inserts a new route into the entry's route list If another route already exists with the same faceId ...
void removeInheritedRoute(const Route &route)
PrefixAnnouncement & setAnnouncedName(Name name)
Set announced name.
#define NFD_LOG_INIT(name)
@ ROUTE_FLAG_CHILD_INHERIT