rib: Rename FaceEntry to Route
refs: #2159
Change-Id: Ia324a47816cac514dacc4a69a29fd30d08932e5b
diff --git a/rib/rib-entry.cpp b/rib/rib-entry.cpp
index 3e24275..4ded689 100644
--- a/rib/rib-entry.cpp
+++ b/rib/rib-entry.cpp
@@ -34,25 +34,25 @@
namespace nfd {
namespace rib {
-RibEntry::FaceList::iterator
-RibEntry::findFace(const FaceEntry& face)
+RibEntry::RouteList::iterator
+RibEntry::findRoute(const Route& route)
{
- return std::find_if(begin(), end(), bind(&compareFaceIdAndOrigin, _1, face));
+ return std::find_if(begin(), end(), bind(&compareFaceIdAndOrigin, _1, route));
}
bool
-RibEntry::insertFace(const FaceEntry& entry)
+RibEntry::insertRoute(const Route& route)
{
- iterator it = findFace(entry);
+ iterator it = findRoute(route);
if (it == end())
{
- if (entry.flags & ndn::nfd::ROUTE_FLAG_CAPTURE)
+ if (route.flags & ndn::nfd::ROUTE_FLAG_CAPTURE)
{
- m_nFacesWithCaptureSet++;
+ m_nRoutesWithCaptureSet++;
}
- m_faces.push_back(entry);
+ m_routes.push_back(route);
return true;
}
else
@@ -62,27 +62,26 @@
}
void
-RibEntry::eraseFace(const FaceEntry& face)
+RibEntry::eraseRoute(const Route& route)
{
- RibEntry::iterator it = std::find_if(begin(), end(), bind(&compareFaceIdAndOrigin, _1, face));
- eraseFace(it);
+ RibEntry::iterator it = findRoute(route);
+ eraseRoute(it);
}
bool
-RibEntry::hasFace(const FaceEntry& face)
+RibEntry::hasRoute(const Route& route)
{
- RibEntry::const_iterator it = std::find_if(cbegin(), cend(),
- bind(&compareFaceIdAndOrigin, _1, face));
+ RibEntry::const_iterator it = findRoute(route);
- return it != cend();
+ return it != end();
}
bool
RibEntry::hasFaceId(const uint64_t faceId) const
{
- RibEntry::const_iterator it = std::find_if(cbegin(), cend(), bind(&compareFaceId, _1, faceId));
+ RibEntry::const_iterator it = std::find_if(begin(), end(), bind(&compareFaceId, _1, faceId));
- return it != cend();
+ return it != end();
}
void
@@ -101,64 +100,64 @@
m_children.remove(child);
}
-RibEntry::FaceList::iterator
-RibEntry::eraseFace(FaceList::iterator face)
+RibEntry::RouteList::iterator
+RibEntry::eraseRoute(RouteList::iterator route)
{
- if (face != m_faces.end())
+ if (route != m_routes.end())
{
- if (face->flags & ndn::nfd::ROUTE_FLAG_CAPTURE)
+ if (route->flags & ndn::nfd::ROUTE_FLAG_CAPTURE)
{
- m_nFacesWithCaptureSet--;
+ m_nRoutesWithCaptureSet--;
}
//cancel any scheduled event
- NFD_LOG_TRACE("Cancelling expiration eventId: " << face->getExpirationEvent());
- scheduler::cancel(face->getExpirationEvent());
+ NFD_LOG_TRACE("Cancelling expiration eventId: " << route->getExpirationEvent());
+ scheduler::cancel(route->getExpirationEvent());
- return m_faces.erase(face);
+ return m_routes.erase(route);
}
- return m_faces.end();
+ return m_routes.end();
}
void
-RibEntry::addInheritedFace(const FaceEntry& face)
+RibEntry::addInheritedRoute(const Route& route)
{
- m_inheritedFaces.push_back(face);
+ m_inheritedRoutes.push_back(route);
}
void
-RibEntry::removeInheritedFace(const FaceEntry& face)
+RibEntry::removeInheritedRoute(const Route& route)
{
- FaceList::iterator it = findInheritedFace(face);
- m_inheritedFaces.erase(it);
+ RouteList::iterator it = findInheritedRoute(route);
+ m_inheritedRoutes.erase(it);
}
-RibEntry::FaceList::iterator
-RibEntry::findInheritedFace(const FaceEntry& face)
+RibEntry::RouteList::iterator
+RibEntry::findInheritedRoute(const Route& route)
{
- return std::find_if(m_inheritedFaces.begin(), m_inheritedFaces.end(),
- bind(&compareFaceId, _1, face.faceId));
+ return std::find_if(m_inheritedRoutes.begin(), m_inheritedRoutes.end(),
+ bind(&compareFaceId, _1, route.faceId));
}
bool
-RibEntry::hasInheritedFace(const FaceEntry& face)
+RibEntry::hasInheritedRoute(const Route& route)
{
- FaceList::const_iterator it = findInheritedFace(face);
+ RouteList::const_iterator it = findInheritedRoute(route);
- return (it != m_inheritedFaces.end());
+ return (it != m_inheritedRoutes.end());
}
bool
RibEntry::hasCapture() const
{
- return m_nFacesWithCaptureSet > 0;
+ return m_nRoutesWithCaptureSet > 0;
}
bool
RibEntry::hasChildInheritOnFaceId(uint64_t faceId) const
{
- for (RibEntry::const_iterator it = m_faces.begin(); it != m_faces.end(); ++it)
+ for (RibEntry::const_iterator it = m_routes.begin(); it != m_routes.end(); ++it)
{
if (it->faceId == faceId && (it->flags & ndn::nfd::ROUTE_FLAG_CHILD_INHERIT))
{
@@ -169,66 +168,67 @@
return false;
}
-shared_ptr<FaceEntry>
-RibEntry::getFaceWithLowestCostByFaceId(uint64_t faceId)
+shared_ptr<Route>
+RibEntry::getRouteWithLowestCostByFaceId(uint64_t faceId)
{
- shared_ptr<FaceEntry> face;
+ shared_ptr<Route> candidate;
- for (FaceList::iterator it = begin(); it != end(); ++it)
+ for (const Route& route : m_routes)
{
// Correct face ID
- if (it->faceId == faceId)
+ if (route.faceId == faceId)
{
- // If this is the first face with this ID found
- if (!static_cast<bool>(face))
+ // If this is the first route with this Face ID found
+ if (candidate == nullptr)
{
- face = make_shared<FaceEntry>(*it);
+ candidate = make_shared<Route>(route);
}
- else if (it->cost < face->cost) // Found a face with a lower cost
+ else if (route.cost < candidate->cost) // Found a route with a lower cost
{
- face = make_shared<FaceEntry>(*it);
+ candidate = make_shared<Route>(route);
}
}
}
- return face;
+ return candidate;
}
-shared_ptr<FaceEntry>
-RibEntry::getFaceWithLowestCostAndChildInheritByFaceId(uint64_t faceId)
+shared_ptr<Route>
+RibEntry::getRouteWithLowestCostAndChildInheritByFaceId(uint64_t faceId)
{
- shared_ptr<FaceEntry> face;
+ shared_ptr<Route> candidate;
- for (FaceList::iterator it = begin(); it != end(); ++it)
+ for (const Route& route : m_routes)
{
// Correct face ID and Child Inherit flag set
- if (it->faceId == faceId && it->flags & ndn::nfd::ROUTE_FLAG_CHILD_INHERIT)
+ if (route.faceId == faceId &&
+ (route.flags & ndn::nfd::ROUTE_FLAG_CHILD_INHERIT) == ndn::nfd::ROUTE_FLAG_CHILD_INHERIT)
{
- // If this is the first face with this ID found
- if (!static_cast<bool>(face))
+ // If this is the first route with this Face ID found
+ if (candidate == nullptr)
{
- face = make_shared<FaceEntry>(*it);
+ candidate = make_shared<Route>(route);
}
- else if (it->cost < face->cost) // Found a face with a lower cost
+ else if (route.cost < candidate->cost) // Found a route with a lower cost
{
- face = make_shared<FaceEntry>(*it);
+ candidate = make_shared<Route>(route);
}
}
}
- return face;
+ return candidate;
}
std::ostream&
-operator<<(std::ostream& os, const FaceEntry& entry)
+operator<<(std::ostream& os, const Route& route)
{
- os << "FaceEntry("
- << "faceid: " << entry.faceId
- << ", origin: " << entry.origin
- << ", cost: " << entry.cost
- << ", flags: " << entry.flags;
- if (entry.expires != time::steady_clock::TimePoint::max()) {
- os << ", expires in: " << (entry.expires - time::steady_clock::now());
+ os << "Route("
+ << "faceid: " << route.faceId
+ << ", origin: " << route.origin
+ << ", cost: " << route.cost
+ << ", flags: " << route.flags;
+ if (route.expires != time::steady_clock::TimePoint::max()) {
+ os << ", expires in: " << (route.expires - time::steady_clock::now());
}
else {
os << ", never expires";
@@ -244,9 +244,9 @@
os << "RibEntry {\n";
os << "\tName: " << entry.getName() << "\n";
- for (RibEntry::FaceList::const_iterator faceIt = entry.cbegin(); faceIt != entry.cend(); ++faceIt)
+ for (const Route& route : entry)
{
- os << "\t" << (*faceIt) << "\n";
+ os << "\t" << route << "\n";
}
os << "}";
diff --git a/rib/rib-entry.hpp b/rib/rib-entry.hpp
index b17085a..4cfecc1 100644
--- a/rib/rib-entry.hpp
+++ b/rib/rib-entry.hpp
@@ -26,23 +26,22 @@
#ifndef NFD_RIB_RIB_ENTRY_HPP
#define NFD_RIB_RIB_ENTRY_HPP
-#include "face-entry.hpp"
+#include "route.hpp"
namespace nfd {
namespace rib {
-/** \class RibEntry
- * \brief represents a namespace
+/** \brief represents a RIB entry, which contains one or more Routes with the same prefix
*/
class RibEntry : public enable_shared_from_this<RibEntry>
{
public:
- typedef std::list<FaceEntry> FaceList;
- typedef FaceList::iterator iterator;
- typedef FaceList::const_iterator const_iterator;
+ typedef std::list<Route> RouteList;
+ typedef RouteList::iterator iterator;
+ typedef RouteList::const_iterator const_iterator;
RibEntry()
- : m_nFacesWithCaptureSet(0)
+ : m_nRoutesWithCaptureSet(0)
{
}
@@ -64,99 +63,99 @@
void
removeChild(shared_ptr<RibEntry> child);
- std::list<shared_ptr<RibEntry> >&
+ std::list<shared_ptr<RibEntry>>&
getChildren();
bool
hasChildren() const;
- /** \brief inserts a new face into the entry's face list
- * If another entry already exists with the same faceId and origin,
- * the new face is not inserted.
- * \return{ true if the face is inserted, false otherwise }
+ /** \brief inserts a new route into the entry's route list
+ * If another route already exists with the same faceId and origin,
+ * the new route is not inserted.
+ * \return{ true if the route is inserted, false otherwise }
*/
bool
- insertFace(const FaceEntry& face);
+ insertRoute(const Route& route);
- /** \brief erases a FaceEntry with the same faceId and origin
+ /** \brief erases a Route with the same faceId and origin
*/
void
- eraseFace(const FaceEntry& face);
+ eraseRoute(const Route& route);
- /** \brief erases a FaceEntry with the passed iterator
+ /** \brief erases a Route with the passed iterator
* \return{ an iterator to the element that followed the erased iterator }
*/
iterator
- eraseFace(FaceList::iterator face);
+ eraseRoute(RouteList::iterator route);
bool
hasFaceId(const uint64_t faceId) const;
- FaceList&
- getFaces();
+ RouteList&
+ getRoutes();
iterator
- findFace(const FaceEntry& face);
+ findRoute(const Route& route);
bool
- hasFace(const FaceEntry& face);
+ hasRoute(const Route& route);
void
- addInheritedFace(const FaceEntry& face);
+ addInheritedRoute(const Route& route);
void
- removeInheritedFace(const FaceEntry& face);
+ removeInheritedRoute(const Route& route);
- /** \brief Returns the faces this namespace has inherited.
- * The inherited faces returned represent inherited entries this namespace has in the FIB.
- * \return{ faces inherited by this namespace }
+ /** \brief Returns the routes this namespace has inherited.
+ * The inherited routes returned represent inherited routes this namespace has in the FIB.
+ * \return{ routes inherited by this namespace }
*/
- FaceList&
- getInheritedFaces();
+ RouteList&
+ getInheritedRoutes();
- /** \brief Finds an inherited face with a matching face ID.
- * \return{ An iterator to the matching face if one is found;
+ /** \brief Finds an inherited route with a matching face ID.
+ * \return{ An iterator to the matching route if one is found;
* otherwise, an iterator to the end of the entry's
- * inherited face list }
+ * inherited route list }
*/
- FaceList::iterator
- findInheritedFace(const FaceEntry& face);
+ RouteList::iterator
+ findInheritedRoute(const Route& route);
- /** \brief Determines if the entry has an inherited face with a matching face ID.
- * \return{ True, if a matching inherited face is found; otherwise, false. }
+ /** \brief Determines if the entry has an inherited route with a matching face ID.
+ * \return{ True, if a matching inherited route is found; otherwise, false. }
*/
bool
- hasInheritedFace(const FaceEntry& face);
+ hasInheritedRoute(const Route& route);
bool
hasCapture() const;
- /** \brief Determines if the entry has an inherited face with the passed
+ /** \brief Determines if the entry has an inherited route with the passed
* face ID and its child inherit flag set.
- * \return{ True, if a matching inherited face is found; otherwise, false. }
+ * \return{ True, if a matching inherited route is found; otherwise, false. }
*/
bool
hasChildInheritOnFaceId(uint64_t faceId) const;
- /** \brief Returns the face with the lowest cost that has the passed face ID.
- * \return{ The face with with the lowest cost that has the passed face ID}
+ /** \brief Returns the route with the lowest cost that has the passed face ID.
+ * \return{ The route with the lowest cost that has the passed face ID}
*/
- shared_ptr<FaceEntry>
- getFaceWithLowestCostByFaceId(uint64_t faceId);
+ shared_ptr<Route>
+ getRouteWithLowestCostByFaceId(uint64_t faceId);
- /** \brief Returns the face with the lowest cost that has the passed face ID
+ /** \brief Returns the route with the lowest cost that has the passed face ID
* and its child inherit flag set.
- * \return{ The face with with the lowest cost that has the passed face ID
+ * \return{ The route with the lowest cost that has the passed face ID
* and its child inherit flag set }
*/
- shared_ptr<FaceEntry>
- getFaceWithLowestCostAndChildInheritByFaceId(uint64_t faceId);
+ shared_ptr<Route>
+ getRouteWithLowestCostAndChildInheritByFaceId(uint64_t faceId);
const_iterator
- cbegin() const;
+ begin() const;
const_iterator
- cend() const;
+ end() const;
iterator
begin();
@@ -170,18 +169,18 @@
private:
Name m_name;
- std::list<shared_ptr<RibEntry> > m_children;
+ std::list<shared_ptr<RibEntry>> m_children;
shared_ptr<RibEntry> m_parent;
- FaceList m_faces;
- FaceList m_inheritedFaces;
+ RouteList m_routes;
+ RouteList m_inheritedRoutes;
- /** \brief The number of faces on this namespace with the capture flag set.
+ /** \brief The number of routes on this namespace with the capture flag set.
*
- * This count is used to check if the namespace will block inherited faces.
+ * This count is used to check if the namespace will block inherited routes.
* If the number is greater than zero, a route on the namespace has it's capture
- * flag set which means the namespace should not inherit any faces.
+ * flag set which means the namespace should not inherit any routes.
*/
- uint64_t m_nFacesWithCaptureSet;
+ uint64_t m_nRoutesWithCaptureSet;
};
inline void
@@ -208,46 +207,46 @@
return m_parent;
}
-inline std::list<shared_ptr<RibEntry> >&
+inline std::list<shared_ptr<RibEntry>>&
RibEntry::getChildren()
{
return m_children;
}
-inline RibEntry::FaceList&
-RibEntry::getFaces()
+inline RibEntry::RouteList&
+RibEntry::getRoutes()
{
- return m_faces;
+ return m_routes;
}
-inline RibEntry::FaceList&
-RibEntry::getInheritedFaces()
+inline RibEntry::RouteList&
+RibEntry::getInheritedRoutes()
{
- return m_inheritedFaces;
+ return m_inheritedRoutes;
}
inline RibEntry::const_iterator
-RibEntry::cbegin() const
+RibEntry::begin() const
{
- return m_faces.begin();
+ return m_routes.begin();
}
inline RibEntry::const_iterator
-RibEntry::cend() const
+RibEntry::end() const
{
- return m_faces.end();
+ return m_routes.end();
}
inline RibEntry::iterator
RibEntry::begin()
{
- return m_faces.begin();
+ return m_routes.begin();
}
inline RibEntry::iterator
RibEntry::end()
{
- return m_faces.end();
+ return m_routes.end();
}
std::ostream&
diff --git a/rib/rib-manager.cpp b/rib/rib-manager.cpp
index 809b301..44214a3 100644
--- a/rib/rib-manager.cpp
+++ b/rib/rib-manager.cpp
@@ -286,35 +286,35 @@
parameters.setFaceId(request->getIncomingFaceId());
}
- FaceEntry faceEntry;
- faceEntry.faceId = parameters.getFaceId();
- faceEntry.origin = parameters.getOrigin();
- faceEntry.cost = parameters.getCost();
- faceEntry.flags = parameters.getFlags();
+ Route route;
+ route.faceId = parameters.getFaceId();
+ route.origin = parameters.getOrigin();
+ route.cost = parameters.getCost();
+ route.flags = parameters.getFlags();
if (parameters.hasExpirationPeriod() &&
parameters.getExpirationPeriod() != time::milliseconds::max())
{
- faceEntry.expires = time::steady_clock::now() + parameters.getExpirationPeriod();
+ route.expires = time::steady_clock::now() + parameters.getExpirationPeriod();
// Schedule a new event, the old one will be cancelled during rib insertion.
scheduler::EventId eventId = scheduler::schedule(parameters.getExpirationPeriod(),
bind(&RibManager::expireEntry, this, shared_ptr<Interest>(), parameters));
- NFD_LOG_TRACE("Scheduled unregistration at: " << faceEntry.expires <<
+ NFD_LOG_TRACE("Scheduled unregistration at: " << route.expires <<
" with EventId: " << eventId);
//set the NewEventId of this entry
- faceEntry.setExpirationEvent(eventId);
+ route.setExpirationEvent(eventId);
}
else
{
- faceEntry.expires = time::steady_clock::TimePoint::max();
+ route.expires = time::steady_clock::TimePoint::max();
}
- NFD_LOG_TRACE("register prefix: " << faceEntry);
+ NFD_LOG_TRACE("register prefix: " << route);
- m_managedRib.insert(parameters.getName(), faceEntry);
- m_registeredFaces.insert(faceEntry.faceId);
+ m_managedRib.insert(parameters.getName(), route);
+ m_registeredFaces.insert(route.faceId);
sendUpdatesToFib(request, parameters);
}
@@ -322,13 +322,13 @@
void
RibManager::expireEntry(const shared_ptr<const Interest>& request, ControlParameters& params)
{
- FaceEntry face;
- face.faceId = params.getFaceId();
- face.origin = params.getOrigin();
- face.cost = params.getCost();
- face.flags = params.getFlags();
+ Route route;
+ route.faceId = params.getFaceId();
+ route.origin = params.getOrigin();
+ route.cost = params.getCost();
+ route.flags = params.getFlags();
- NFD_LOG_DEBUG(face << " for " << params.getName() << " has expired");
+ NFD_LOG_DEBUG(route << " for " << params.getName() << " has expired");
unregisterEntry(request, params);
}
@@ -361,13 +361,13 @@
parameters.setFaceId(request->getIncomingFaceId());
}
- FaceEntry faceEntry;
- faceEntry.faceId = parameters.getFaceId();
- faceEntry.origin = parameters.getOrigin();
+ Route route;
+ route.faceId = parameters.getFaceId();
+ route.origin = parameters.getOrigin();
- NFD_LOG_TRACE("unregister prefix: " << faceEntry);
+ NFD_LOG_TRACE("unregister prefix: " << route);
- m_managedRib.erase(parameters.getName(), faceEntry);
+ m_managedRib.erase(parameters.getName(), route);
sendUpdatesToFib(request, parameters);
}
@@ -421,7 +421,7 @@
void
RibManager::onCommandError(uint32_t code, const std::string& error,
const shared_ptr<const Interest>& request,
- const FaceEntry& faceEntry)
+ const Route& route)
{
NFD_LOG_ERROR("NFD returned an error: " << error << " (code: " << code << ")");
@@ -447,7 +447,7 @@
void
RibManager::onRegSuccess(const shared_ptr<const Interest>& request,
const ControlParameters& parameters,
- const FaceEntry& faceEntry)
+ const Route& route)
{
ControlResponse response;
@@ -455,7 +455,7 @@
response.setText("Success");
response.setBody(parameters.wireEncode());
- NFD_LOG_TRACE("onRegSuccess: registered " << faceEntry);
+ NFD_LOG_TRACE("onRegSuccess: registered " << route);
if (static_cast<bool>(request))
sendResponse(request->getName(), response);
@@ -465,7 +465,7 @@
void
RibManager::onUnRegSuccess(const shared_ptr<const Interest>& request,
const ControlParameters& parameters,
- const FaceEntry& faceEntry)
+ const Route& route)
{
ControlResponse response;
@@ -473,7 +473,7 @@
response.setText("Success");
response.setBody(parameters.wireEncode());
- NFD_LOG_TRACE("onUnRegSuccess: unregistered " << faceEntry);
+ NFD_LOG_TRACE("onUnRegSuccess: unregistered " << route);
if (static_cast<bool>(request))
sendResponse(request->getName(), response);
@@ -717,15 +717,15 @@
if (update->action == FibUpdate::ADD_NEXTHOP)
{
- FaceEntry faceEntry;
- faceEntry.faceId = update->faceId;
- faceEntry.cost = update->cost;
+ Route route;
+ route.faceId = update->faceId;
+ route.cost = update->cost;
m_nfdController.start<ndn::nfd::FibAddNextHopCommand>(
ControlParameters()
.setName(update->name)
- .setFaceId(faceEntry.faceId)
- .setCost(faceEntry.cost),
+ .setFaceId(route.faceId)
+ .setCost(route.cost),
bind(&RibManager::onAddNextHopSuccess, this, request,
parameters,
currentTransactionId,
@@ -735,13 +735,13 @@
}
else if (update->action == FibUpdate::REMOVE_NEXTHOP)
{
- FaceEntry faceEntry;
- faceEntry.faceId = update->faceId;
+ Route route;
+ route.faceId = update->faceId;
m_nfdController.start<ndn::nfd::FibRemoveNextHopCommand>(
ControlParameters()
.setName(update->name)
- .setFaceId(faceEntry.faceId),
+ .setFaceId(route.faceId),
bind(&RibManager::onRemoveNextHopSuccess, this, request,
parameters,
currentTransactionId,
diff --git a/rib/rib-manager.hpp b/rib/rib-manager.hpp
index e3750b1..efaf760 100644
--- a/rib/rib-manager.hpp
+++ b/rib/rib-manager.hpp
@@ -130,17 +130,17 @@
void
onCommandError(uint32_t code, const std::string& error,
const shared_ptr<const Interest>& request,
- const FaceEntry& faceEntry);
+ const Route& route);
void
onRegSuccess(const shared_ptr<const Interest>& request,
const ControlParameters& parameters,
- const FaceEntry& faceEntry);
+ const Route& route);
void
onUnRegSuccess(const shared_ptr<const Interest>& request,
const ControlParameters& parameters,
- const FaceEntry& faceEntry);
+ const Route& route);
void
onNrdCommandPrefixAddNextHopSuccess(const Name& prefix);
diff --git a/rib/rib-status-publisher.cpp b/rib/rib-status-publisher.cpp
index 76a164c..0b8ede4 100644
--- a/rib/rib-status-publisher.cpp
+++ b/rib/rib-status-publisher.cpp
@@ -61,24 +61,21 @@
size_t ribEntryLength = 0;
ndn::nfd::RibEntry tlvEntry;
- const RibEntry::FaceList& faces = entry.getFaces();
- for (RibEntry::FaceList::const_iterator faceIt = faces.begin();
- faceIt != faces.end(); ++faceIt)
+ for (const Route& route : entry)
{
- const FaceEntry& face = *faceIt;
+ ndn::nfd::Route routeEle;
+ routeEle.setFaceId(route.faceId)
+ .setOrigin(route.origin)
+ .setCost(route.cost)
+ .setFlags(route.flags);
- ndn::nfd::Route route;
- route
- .setFaceId(face.faceId)
- .setOrigin(face.origin)
- .setCost(face.cost)
- .setFlags(face.flags);
- if (face.expires < time::steady_clock::TimePoint::max()) {
- route.setExpirationPeriod(time::duration_cast<time::milliseconds>
- (face.expires - time::steady_clock::now()));
+ if (route.expires < time::steady_clock::TimePoint::max()) {
+ routeEle.setExpirationPeriod(time::duration_cast<time::milliseconds>(
+ route.expires - time::steady_clock::now()));
}
- tlvEntry.addRoute(route);
+
+ tlvEntry.addRoute(routeEle);
}
tlvEntry.setName(prefix);
diff --git a/rib/rib.cpp b/rib/rib.cpp
index 02df45e..0110b19 100644
--- a/rib/rib.cpp
+++ b/rib/rib.cpp
@@ -33,9 +33,9 @@
namespace rib {
static inline bool
-sortFace(const FaceEntry& entry1, const FaceEntry& entry2)
+sortRoutes(const Route& lhs, const Route& rhs)
{
- return entry1.faceId < entry2.faceId;
+ return lhs.faceId < rhs.faceId;
}
static inline bool
@@ -73,29 +73,29 @@
return m_rib.find(prefix);
}
-FaceEntry*
-Rib::find(const Name& prefix, const FaceEntry& face) const
+Route*
+Rib::find(const Name& prefix, const Route& route) const
{
RibTable::const_iterator ribIt = m_rib.find(prefix);
// Name prefix exists
if (ribIt != m_rib.end())
{
- shared_ptr<RibEntry> entry(ribIt->second);
+ shared_ptr<RibEntry> entry = ribIt->second;
- RibEntry::iterator faceIt = std::find_if(entry->begin(), entry->end(),
- bind(&compareFaceIdAndOrigin, _1, face));
+ RibEntry::iterator routeIt = entry->findRoute(route);
- if (faceIt != entry->end())
+ if (routeIt != entry->end())
{
- return &((*faceIt));
+ return &((*routeIt));
}
}
- return 0;
+
+ return nullptr;
}
void
-Rib::insert(const Name& prefix, const FaceEntry& face)
+Rib::insert(const Name& prefix, const Route& route)
{
RibTable::iterator ribIt = m_rib.find(prefix);
@@ -104,49 +104,47 @@
{
shared_ptr<RibEntry> entry(ribIt->second);
- RibEntry::iterator faceIt = std::find_if(entry->getFaces().begin(),
- entry->getFaces().end(),
- bind(&compareFaceIdAndOrigin, _1, face));
+ RibEntry::iterator routeIt = entry->findRoute(route);
- if (faceIt == entry->end())
+ if (routeIt == entry->end())
{
- // Will the new face change the namespace's capture flag?
- bool captureWasTurnedOn = (entry->hasCapture() == false && isCaptureFlagSet(face.flags));
+ // Will the new route change the namespace's capture flag?
+ bool captureWasTurnedOn = (entry->hasCapture() == false && isCaptureFlagSet(route.flags));
- // New face
- entry->insertFace(face);
+ // New route
+ entry->insertRoute(route);
m_nItems++;
// Register with face lookup table
- m_faceMap[face.faceId].push_back(entry);
+ m_faceMap[route.faceId].push_back(entry);
- createFibUpdatesForNewFaceEntry(*entry, face, captureWasTurnedOn);
+ createFibUpdatesForNewRoute(*entry, route, captureWasTurnedOn);
}
- else // Entry exists, update fields
+ else // Route exists, update fields
{
// First cancel old scheduled event, if any, then set the EventId to new one
- if (static_cast<bool>(faceIt->getExpirationEvent()))
+ if (static_cast<bool>(routeIt->getExpirationEvent()))
{
NFD_LOG_TRACE("Cancelling expiration event for " << entry->getName() << " "
- << *faceIt);
- scheduler::cancel(faceIt->getExpirationEvent());
+ << *routeIt);
+ scheduler::cancel(routeIt->getExpirationEvent());
}
// No checks are required here as the iterator needs to be updated in all cases.
- faceIt->setExpirationEvent(face.getExpirationEvent());
+ routeIt->setExpirationEvent(route.getExpirationEvent());
// Save flags for update processing
- uint64_t previousFlags = faceIt->flags;
+ uint64_t previousFlags = routeIt->flags;
- // If the entry's cost didn't change and child inherit is not set,
+ // If the route's cost didn't change and child inherit is not set,
// no need to traverse subtree.
- uint64_t previousCost = faceIt->cost;
+ uint64_t previousCost = routeIt->cost;
- faceIt->flags = face.flags;
- faceIt->cost = face.cost;
- faceIt->expires = face.expires;
+ routeIt->flags = route.flags;
+ routeIt->cost = route.cost;
+ routeIt->expires = route.expires;
- createFibUpdatesForUpdatedEntry(*entry, face, previousFlags, previousCost);
+ createFibUpdatesForUpdatedRoute(*entry, route, previousFlags, previousCost);
}
}
else // New name prefix
@@ -157,7 +155,7 @@
m_nItems++;
entry->setName(prefix);
- entry->insertFace(face);
+ entry->insertRoute(route);
// Find prefix's parent
shared_ptr<RibEntry> parent = findParent(prefix);
@@ -185,9 +183,9 @@
}
// Register with face lookup table
- m_faceMap[face.faceId].push_back(entry);
+ m_faceMap[route.faceId].push_back(entry);
- createFibUpdatesForNewRibEntry(*entry, face);
+ createFibUpdatesForNewRibEntry(*entry, route);
// do something after inserting an entry
afterInsertEntry(prefix);
@@ -195,7 +193,7 @@
}
void
-Rib::erase(const Name& prefix, const FaceEntry& face)
+Rib::erase(const Name& prefix, const Route& route)
{
RibTable::iterator ribIt = m_rib.find(prefix);
@@ -206,42 +204,42 @@
const bool hadCapture = entry->hasCapture();
- // Need to copy face to do FIB updates with correct cost and flags since nfdc does not
+ // Need to copy route to do FIB updates with correct cost and flags since nfdc does not
// pass flags or cost
- RibEntry::iterator faceIt = entry->findFace(face);
+ RibEntry::iterator routeIt = entry->findRoute(route);
- if (faceIt != entry->end())
+ if (routeIt != entry->end())
{
- FaceEntry faceToErase = *faceIt;
- faceToErase.flags = faceIt->flags;
- faceToErase.cost = faceIt->cost;
+ Route routeToErase = *routeIt;
+ routeToErase.flags = routeIt->flags;
+ routeToErase.cost = routeIt->cost;
- entry->eraseFace(faceIt);
+ entry->eraseRoute(routeIt);
m_nItems--;
const bool captureWasTurnedOff = (hadCapture && !entry->hasCapture());
- createFibUpdatesForErasedFaceEntry(*entry, faceToErase, captureWasTurnedOff);
+ createFibUpdatesForErasedRoute(*entry, routeToErase, captureWasTurnedOff);
// If this RibEntry no longer has this faceId, unregister from face lookup table
- if (!entry->hasFaceId(face.faceId))
+ if (!entry->hasFaceId(route.faceId))
{
- m_faceMap[face.faceId].remove(entry);
+ m_faceMap[route.faceId].remove(entry);
}
else
{
// The RibEntry still has the face ID; need to update FIB
- // with lowest cost for the same face instead of removing the face from the FIB
- shared_ptr<FaceEntry> lowCostFace = entry->getFaceWithLowestCostByFaceId(face.faceId);
+ // with lowest cost for the same route instead of removing the route from the FIB
+ shared_ptr<Route> lowCostRoute = entry->getRouteWithLowestCostByFaceId(route.faceId);
- BOOST_ASSERT(static_cast<bool>(lowCostFace));
+ BOOST_ASSERT(static_cast<bool>(lowCostRoute));
- createFibUpdatesForNewFaceEntry(*entry, *lowCostFace, false);
+ createFibUpdatesForNewRoute(*entry, *lowCostRoute, false);
}
- // If a RibEntry's facelist is empty, remove it from the tree
- if (entry->getFaces().size() == 0)
+ // If a RibEntry's route list is empty, remove it from the tree
+ if (entry->getRoutes().size() == 0)
{
eraseEntry(ribIt);
}
@@ -263,41 +261,34 @@
RibEntryList& ribEntries = lookupIt->second;
// For each RIB entry that has faceId, remove the face from the entry
- for (RibEntryList::iterator entryIt = ribEntries.begin(); entryIt != ribEntries.end(); ++entryIt)
+ for (shared_ptr<RibEntry>& entry : ribEntries)
{
- shared_ptr<RibEntry> entry = *entryIt;
-
const bool hadCapture = entry->hasCapture();
- // Find the faces in the entry
- for (RibEntry::iterator faceIt = entry->begin(); faceIt != entry->end(); ++faceIt)
+ // Find the routes in the entry
+ for (RibEntry::iterator routeIt = entry->begin(); routeIt != entry->end(); ++routeIt)
{
- if (faceIt->faceId == faceId)
+ if (routeIt->faceId == faceId)
{
- FaceEntry copy = *faceIt;
+ Route copy = *routeIt;
- faceIt = entry->eraseFace(faceIt);
+ routeIt = entry->eraseRoute(routeIt);
m_nItems--;
const bool captureWasTurnedOff = (hadCapture && !entry->hasCapture());
- createFibUpdatesForErasedFaceEntry(*entry, copy, captureWasTurnedOff);
+ createFibUpdatesForErasedRoute(*entry, copy, captureWasTurnedOff);
}
}
- // If a RibEntry's facelist is empty, remove it from the tree
- if (entry->getFaces().size() == 0)
+ // If a RibEntry's route list is empty, remove it from the tree
+ if (entry->getRoutes().size() == 0)
{
eraseEntry(m_rib.find(entry->getName()));
}
}
// Face no longer exists, remove from face lookup table
- FaceLookupTable::iterator entryToDelete = m_faceMap.find(faceId);
-
- if (entryToDelete != m_faceMap.end())
- {
- m_faceMap.erase(entryToDelete);
- }
+ m_faceMap.erase(lookupIt);
}
shared_ptr<RibEntry>
@@ -399,8 +390,7 @@
void
Rib::insertFibUpdate(shared_ptr<FibUpdate> update)
{
- // If an update with the same name and face already exists,
- // replace it
+ // If an update with the same name and Face ID already exists, replace it
FibUpdateList::iterator it = std::find_if(m_fibUpdateList.begin(), m_fibUpdateList.end(),
bind(&compareFibUpdates, _1, update));
@@ -419,108 +409,107 @@
}
void
-Rib::createFibUpdatesForNewRibEntry(RibEntry& entry, const FaceEntry& face)
+Rib::createFibUpdatesForNewRibEntry(RibEntry& entry, const Route& route)
{
// Create FIB update for new entry
- insertFibUpdate(FibUpdate::createAddUpdate(entry.getName(), face.faceId, face.cost));
+ insertFibUpdate(FibUpdate::createAddUpdate(entry.getName(), route.faceId, route.cost));
// No flags are set
- if (!isAnyFlagSet(face.flags))
+ if (!isAnyFlagSet(route.flags))
{
- // Add ancestor faces to self
- addInheritedFacesToEntry(entry, getAncestorFaces(entry));
+ // Add ancestor routes to self
+ addInheritedRoutesToEntry(entry, getAncestorRoutes(entry));
}
- else if (areBothFlagsSet(face.flags))
+ else if (areBothFlagsSet(route.flags))
{
- // Add face to children
- FaceSet facesToAdd;
- facesToAdd.insert(face);
+ // Add route to children
+ RouteSet routesToAdd;
+ routesToAdd.insert(route);
- // Remove faces blocked by capture and add self to children
- modifyChildrensInheritedFaces(entry, facesToAdd, getAncestorFaces(entry));
+ // Remove routes blocked by capture and add self to children
+ modifyChildrensInheritedRoutes(entry, routesToAdd, getAncestorRoutes(entry));
}
- else if (isChildInheritFlagSet(face.flags))
+ else if (isChildInheritFlagSet(route.flags))
{
- FaceSet ancestorFaces = getAncestorFaces(entry);
+ RouteSet ancestorRoutes = getAncestorRoutes(entry);
- // Add ancestor faces to self
- addInheritedFacesToEntry(entry, ancestorFaces);
+ // Add ancestor routes to self
+ addInheritedRoutesToEntry(entry, ancestorRoutes);
- // If there is an ancestor face which is the same as the new face, replace it
- // with the new face
- FaceSet::iterator it = ancestorFaces.find(face);
+ // If there is an ancestor route with the same Face ID as the new route, replace it
+ // with the new route
+ RouteSet::iterator it = ancestorRoutes.find(route);
- // There is a face that needs to be overwritten, erase and then replace
- if (it != ancestorFaces.end())
+ // There is a route that needs to be overwritten, erase and then replace
+ if (it != ancestorRoutes.end())
{
- ancestorFaces.erase(it);
+ ancestorRoutes.erase(it);
}
- // Add new face to ancestor list so it can be added to children
- ancestorFaces.insert(face);
+ // Add new route to ancestor list so it can be added to children
+ ancestorRoutes.insert(route);
- // Add ancestor faces to children
- modifyChildrensInheritedFaces(entry, ancestorFaces, FaceSet());
+ // Add ancestor routes to children
+ modifyChildrensInheritedRoutes(entry, ancestorRoutes, RouteSet());
}
- else if (isCaptureFlagSet(face.flags))
+ else if (isCaptureFlagSet(route.flags))
{
- // Remove faces blocked by capture
- modifyChildrensInheritedFaces(entry, FaceSet(), getAncestorFaces(entry));
+ // Remove routes blocked by capture
+ modifyChildrensInheritedRoutes(entry, RouteSet(), getAncestorRoutes(entry));
}
}
void
-Rib::createFibUpdatesForNewFaceEntry(RibEntry& entry, const FaceEntry& face,
- bool captureWasTurnedOn)
+Rib::createFibUpdatesForNewRoute(RibEntry& entry, const Route& route, bool captureWasTurnedOn)
{
- // Only update if the new face has a lower cost than a previously installed face
- shared_ptr<FaceEntry> prevFace = entry.getFaceWithLowestCostAndChildInheritByFaceId(face.faceId);
+ // Only update if the new route has a lower cost than a previously installed route
+ shared_ptr<Route> prevRoute = entry.getRouteWithLowestCostAndChildInheritByFaceId(route.faceId);
- FaceSet facesToAdd;
- if (isChildInheritFlagSet(face.flags))
+ RouteSet routesToAdd;
+ if (isChildInheritFlagSet(route.flags))
{
- // Add to children if this new face doesn't override a previous lower cost, or
- // add to children if this new is lower cost than a previous face.
- // Less than equal, since entry may find this face
- if (!static_cast<bool>(prevFace) || face.cost <= prevFace->cost)
+ // Add to children if this new route doesn't override a previous lower cost, or
+ // add to children if this new route is lower cost than a previous route.
+ // Less than equal, since entry may find this route
+ if (prevRoute == nullptr || route.cost <= prevRoute->cost)
{
// Add self to children
- facesToAdd.insert(face);
+ routesToAdd.insert(route);
}
}
- FaceSet facesToRemove;
+ RouteSet routesToRemove;
if (captureWasTurnedOn)
{
// Capture flag on
- facesToRemove = getAncestorFaces(entry);
+ routesToRemove = getAncestorRoutes(entry);
- // Remove ancestor faces from self
- removeInheritedFacesFromEntry(entry, facesToRemove);
+ // Remove ancestor routes from self
+ removeInheritedRoutesFromEntry(entry, routesToRemove);
}
- modifyChildrensInheritedFaces(entry, facesToAdd, facesToRemove);
+ modifyChildrensInheritedRoutes(entry, routesToAdd, routesToRemove);
- // If another face with same faceId and lower cost, don't update.
+ // If another route with same faceId and lower cost, don't update.
// Must be done last so that add updates replace removal updates
// Create FIB update for new entry
- if (face.cost <= entry.getFaceWithLowestCostByFaceId(face.faceId)->cost)
+ if (route.cost <= entry.getRouteWithLowestCostByFaceId(route.faceId)->cost)
{
- insertFibUpdate(FibUpdate::createAddUpdate(entry.getName(), face.faceId, face.cost));
+ insertFibUpdate(FibUpdate::createAddUpdate(entry.getName(), route.faceId, route.cost));
}
}
void
-Rib::createFibUpdatesForUpdatedEntry(RibEntry& entry, const FaceEntry& face,
+Rib::createFibUpdatesForUpdatedRoute(RibEntry& entry, const Route& route,
const uint64_t previousFlags, const uint64_t previousCost)
{
- const bool costDidChange = (face.cost != previousCost);
+ const bool costDidChange = (route.cost != previousCost);
- // Look for an installed face with the lowest cost and child inherit set
- shared_ptr<FaceEntry> prevFace = entry.getFaceWithLowestCostAndChildInheritByFaceId(face.faceId);
+ // Look for the installed route with the lowest cost and child inherit set
+ shared_ptr<Route> prevRoute = entry.getRouteWithLowestCostAndChildInheritByFaceId(route.faceId);
// No flags changed and cost didn't change, no change in FIB
- if (face.flags == previousFlags && !costDidChange)
+ if (route.flags == previousFlags && !costDidChange)
{
return;
}
@@ -528,32 +517,32 @@
// Cost changed so create update for the entry itself
if (costDidChange)
{
- // Create update if this face's cost is lower than other faces
- if (face.cost <= entry.getFaceWithLowestCostByFaceId(face.faceId)->cost)
+ // Create update if this route's cost is lower than other routes
+ if (route.cost <= entry.getRouteWithLowestCostByFaceId(route.faceId)->cost)
{
// Create FIB update for the updated entry
- insertFibUpdate(FibUpdate::createAddUpdate(entry.getName(), face.faceId, face.cost));
+ insertFibUpdate(FibUpdate::createAddUpdate(entry.getName(), route.faceId, route.cost));
}
- else if (previousCost < entry.getFaceWithLowestCostByFaceId(face.faceId)->cost)
+ else if (previousCost < entry.getRouteWithLowestCostByFaceId(route.faceId)->cost)
{
- // Create update if this face used to be the lowest face but is no longer
- // the lowest cost face.
- insertFibUpdate(FibUpdate::createAddUpdate(entry.getName(), prevFace->faceId,
- prevFace->cost));
+ // Create update if this route used to be the lowest cost route but is no longer
+ // the lowest cost route.
+ insertFibUpdate(FibUpdate::createAddUpdate(entry.getName(), prevRoute->faceId,
+ prevRoute->cost));
}
- // If another face with same faceId and lower cost and ChildInherit exists,
+ // If another route with same faceId and lower cost and ChildInherit exists,
// don't update children.
- if (!static_cast<bool>(prevFace) || face.cost <= prevFace->cost)
+ if (prevRoute == nullptr || route.cost <= prevRoute->cost)
{
// If no flags changed but child inheritance is set, need to update children
// with new cost
- if ((face.flags == previousFlags) && isChildInheritFlagSet(face.flags))
+ if ((route.flags == previousFlags) && isChildInheritFlagSet(route.flags))
{
// Add self to children
- FaceSet facesToAdd;
- facesToAdd.insert(face);
- modifyChildrensInheritedFaces(entry, facesToAdd, FaceSet());
+ RouteSet routesToAdd;
+ routesToAdd.insert(route);
+ modifyChildrensInheritedRoutes(entry, routesToAdd, RouteSet());
return;
}
@@ -561,140 +550,140 @@
}
// Child inherit was turned on
- if (!isChildInheritFlagSet(previousFlags) && isChildInheritFlagSet(face.flags))
+ if (!isChildInheritFlagSet(previousFlags) && isChildInheritFlagSet(route.flags))
{
- // If another face with same faceId and lower cost and ChildInherit exists,
+ // If another route with same faceId and lower cost and ChildInherit exists,
// don't update children.
- if (!static_cast<bool>(prevFace) || face.cost <= prevFace->cost)
+ if (prevRoute == nullptr || route.cost <= prevRoute->cost)
{
// Add self to children
- FaceSet facesToAdd;
- facesToAdd.insert(face);
- modifyChildrensInheritedFaces(entry, facesToAdd, FaceSet());
+ RouteSet routesToAdd;
+ routesToAdd.insert(route);
+ modifyChildrensInheritedRoutes(entry, routesToAdd, RouteSet());
}
} // Child inherit was turned off
- else if (isChildInheritFlagSet(previousFlags) && !isChildInheritFlagSet(face.flags))
+ else if (isChildInheritFlagSet(previousFlags) && !isChildInheritFlagSet(route.flags))
{
// Remove self from children
- FaceSet facesToRemove;
- facesToRemove.insert(face);
+ RouteSet routesToRemove;
+ routesToRemove.insert(route);
- FaceSet facesToAdd;
- // If another face with same faceId and ChildInherit exists, update children with this face.
- if (static_cast<bool>(prevFace))
+ RouteSet routesToAdd;
+ // If another route with same faceId and ChildInherit exists, update children with this route.
+ if (prevRoute != nullptr)
{
- facesToAdd.insert(*prevFace);
+ routesToAdd.insert(*prevRoute);
}
else
{
// Look for an ancestor that was blocked previously
- const FaceSet ancestorFaces = getAncestorFaces(entry);
- FaceSet::iterator it = ancestorFaces.find(face);
+ const RouteSet ancestorRoutes = getAncestorRoutes(entry);
+ RouteSet::iterator it = ancestorRoutes.find(route);
// If an ancestor is found, add it to children
- if (it != ancestorFaces.end())
+ if (it != ancestorRoutes.end())
{
- facesToAdd.insert(*it);
+ routesToAdd.insert(*it);
}
}
- modifyChildrensInheritedFaces(entry, facesToAdd, facesToRemove);
+ modifyChildrensInheritedRoutes(entry, routesToAdd, routesToRemove);
}
// Capture was turned on
- if (!isCaptureFlagSet(previousFlags) && isCaptureFlagSet(face.flags))
+ if (!isCaptureFlagSet(previousFlags) && isCaptureFlagSet(route.flags))
{
- FaceSet ancestorFaces = getAncestorFaces(entry);
+ RouteSet ancestorRoutes = getAncestorRoutes(entry);
- // Remove ancestor faces from self
- removeInheritedFacesFromEntry(entry, ancestorFaces);
+ // Remove ancestor routes from self
+ removeInheritedRoutesFromEntry(entry, ancestorRoutes);
- // Remove ancestor faces from children
- modifyChildrensInheritedFaces(entry, FaceSet(), ancestorFaces);
+ // Remove ancestor routes from children
+ modifyChildrensInheritedRoutes(entry, RouteSet(), ancestorRoutes);
} // Capture was turned off
- else if (isCaptureFlagSet(previousFlags) && !isCaptureFlagSet(face.flags))
+ else if (isCaptureFlagSet(previousFlags) && !isCaptureFlagSet(route.flags))
{
- FaceSet ancestorFaces = getAncestorFaces(entry);
+ RouteSet ancestorRoutes = getAncestorRoutes(entry);
- // Add ancestor faces to self
- addInheritedFacesToEntry(entry, ancestorFaces);
+ // Add ancestor routes to self
+ addInheritedRoutesToEntry(entry, ancestorRoutes);
- // Add ancestor faces to children
- modifyChildrensInheritedFaces(entry, ancestorFaces, FaceSet());
+ // Add ancestor routes to children
+ modifyChildrensInheritedRoutes(entry, ancestorRoutes, RouteSet());
}
}
void
-Rib::createFibUpdatesForErasedFaceEntry(RibEntry& entry, const FaceEntry& face,
- const bool captureWasTurnedOff)
+Rib::createFibUpdatesForErasedRoute(RibEntry& entry, const Route& route,
+ const bool captureWasTurnedOff)
{
- insertFibUpdate(FibUpdate::createRemoveUpdate(entry.getName(), face.faceId));
+ insertFibUpdate(FibUpdate::createRemoveUpdate(entry.getName(), route.faceId));
- if (areBothFlagsSet(face.flags))
+ if (areBothFlagsSet(route.flags))
{
// Remove self from children
- FaceSet facesToRemove;
- facesToRemove.insert(face);
+ RouteSet routesToRemove;
+ routesToRemove.insert(route);
// If capture is turned off for the route, need to add ancestors
// to self and children
- FaceSet facesToAdd;
+ RouteSet routesToAdd;
if (captureWasTurnedOff)
{
- // Look for an ancestors that were blocked previously
- facesToAdd = getAncestorFaces(entry);
+ // Look for ancestors that were blocked previously
+ routesToAdd = getAncestorRoutes(entry);
- // Add ancestor faces to self
- addInheritedFacesToEntry(entry, facesToAdd);
+ // Add ancestor routes to self
+ addInheritedRoutesToEntry(entry, routesToAdd);
}
- modifyChildrensInheritedFaces(entry, facesToAdd, facesToRemove);
+ modifyChildrensInheritedRoutes(entry, routesToAdd, routesToRemove);
}
- else if (isChildInheritFlagSet(face.flags))
+ else if (isChildInheritFlagSet(route.flags))
{
// If not blocked by capture, add inherited routes to children
- FaceSet facesToAdd;
+ RouteSet routesToAdd;
if (!entry.hasCapture())
{
- facesToAdd = getAncestorFaces(entry);
+ routesToAdd = getAncestorRoutes(entry);
}
- FaceSet facesToRemove;
- facesToRemove.insert(face);
+ RouteSet routesToRemove;
+ routesToRemove.insert(route);
- // Add ancestor faces to children
- modifyChildrensInheritedFaces(entry, facesToAdd, facesToRemove);
+ // Add ancestor routes to children
+ modifyChildrensInheritedRoutes(entry, routesToAdd, routesToRemove);
}
- else if (isCaptureFlagSet(face.flags))
+ else if (isCaptureFlagSet(route.flags))
{
// If capture is turned off for the route, need to add ancestors
// to self and children
- FaceSet facesToAdd;
+ RouteSet routesToAdd;
if (captureWasTurnedOff)
{
// Look for an ancestors that were blocked previously
- facesToAdd = getAncestorFaces(entry);
+ routesToAdd = getAncestorRoutes(entry);
- // Add ancestor faces to self
- addInheritedFacesToEntry(entry, facesToAdd);
+ // Add ancestor routes to self
+ addInheritedRoutesToEntry(entry, routesToAdd);
}
- modifyChildrensInheritedFaces(entry, facesToAdd, FaceSet());
+ modifyChildrensInheritedRoutes(entry, routesToAdd, RouteSet());
}
- // Need to check if the removed face was blocking an inherited route
- FaceSet ancestorFaces = getAncestorFaces(entry);
+ // Need to check if the removed route was blocking an inherited route
+ RouteSet ancestorRoutes = getAncestorRoutes(entry);
if (!entry.hasCapture())
{
- // If there is an ancestor face which is the same as the erased face, add that face
+ // If there is an ancestor route with the same Face ID as the erased route, add that route
// to the current entry
- FaceSet::iterator it = ancestorFaces.find(face);
+ RouteSet::iterator it = ancestorRoutes.find(route);
- if (it != ancestorFaces.end())
+ if (it != ancestorRoutes.end())
{
- entry.addInheritedFace(*it);
+ entry.addInheritedRoute(*it);
insertFibUpdate(FibUpdate::createAddUpdate(entry.getName(), it->faceId, it->cost));
}
}
@@ -703,28 +692,28 @@
void
Rib::createFibUpdatesForErasedRibEntry(RibEntry& entry)
{
- for (RibEntry::FaceList::iterator it = entry.getInheritedFaces().begin();
- it != entry.getInheritedFaces().end(); ++it)
+ for (RibEntry::RouteList::iterator it = entry.getInheritedRoutes().begin();
+ it != entry.getInheritedRoutes().end(); ++it)
{
insertFibUpdate(FibUpdate::createRemoveUpdate(entry.getName(), it->faceId));
}
}
-Rib::FaceSet
-Rib::getAncestorFaces(const RibEntry& entry) const
+Rib::RouteSet
+Rib::getAncestorRoutes(const RibEntry& entry) const
{
- FaceSet ancestorFaces(&sortFace);
+ RouteSet ancestorRoutes(&sortRoutes);
shared_ptr<RibEntry> parent = entry.getParent();
while (static_cast<bool>(parent))
{
- for (RibEntry::iterator it = parent->getFaces().begin();
- it != parent->getFaces().end(); ++it)
+ for (RibEntry::iterator it = parent->getRoutes().begin();
+ it != parent->getRoutes().end(); ++it)
{
if (isChildInheritFlagSet(it->flags))
{
- ancestorFaces.insert(*it);
+ ancestorRoutes.insert(*it);
}
}
@@ -736,52 +725,51 @@
parent = parent->getParent();
}
- return ancestorFaces;
+ return ancestorRoutes;
}
void
-Rib::addInheritedFacesToEntry(RibEntry& entry, const Rib::FaceSet& facesToAdd)
+Rib::addInheritedRoutesToEntry(RibEntry& entry, const Rib::RouteSet& routesToAdd)
{
- for (FaceSet::const_iterator it = facesToAdd.begin(); it != facesToAdd.end(); ++it)
+ for (RouteSet::const_iterator it = routesToAdd.begin(); it != routesToAdd.end(); ++it)
{
- // Don't add an ancestor faceId if the namespace has an entry for that faceId
+ // Don't add an ancestor route if the namespace has a route with that Face ID
if (!entry.hasFaceId(it->faceId))
{
- entry.addInheritedFace(*it);
+ entry.addInheritedRoute(*it);
insertFibUpdate(FibUpdate::createAddUpdate(entry.getName(), it->faceId, it->cost));
}
}
}
void
-Rib::removeInheritedFacesFromEntry(RibEntry& entry, const Rib::FaceSet& facesToRemove)
+Rib::removeInheritedRoutesFromEntry(RibEntry& entry, const Rib::RouteSet& routesToRemove)
{
- for (FaceSet::const_iterator it = facesToRemove.begin(); it != facesToRemove.end(); ++it)
+ for (RouteSet::const_iterator it = routesToRemove.begin(); it != routesToRemove.end(); ++it)
{
- // Only remove if the face has been inherited
- if (entry.hasInheritedFace(*it))
+ // Only remove if the route has been inherited
+ if (entry.hasInheritedRoute(*it))
{
- entry.removeInheritedFace(*it);
+ entry.removeInheritedRoute(*it);
insertFibUpdate(FibUpdate::createRemoveUpdate(entry.getName(), it->faceId));
}
}
}
void
-Rib::modifyChildrensInheritedFaces(RibEntry& entry, const Rib::FaceSet& facesToAdd,
- const Rib::FaceSet& facesToRemove)
+Rib::modifyChildrensInheritedRoutes(RibEntry& entry, const Rib::RouteSet& routesToAdd,
+ const Rib::RouteSet& routesToRemove)
{
RibEntryList children = entry.getChildren();
for (RibEntryList::iterator child = children.begin(); child != children.end(); ++child)
{
- traverseSubTree(*(*child), facesToAdd, facesToRemove);
+ traverseSubTree(*(*child), routesToAdd, routesToRemove);
}
}
void
-Rib::traverseSubTree(RibEntry& entry, Rib::FaceSet facesToAdd,
- Rib::FaceSet facesToRemove)
+Rib::traverseSubTree(RibEntry& entry, Rib::RouteSet routesToAdd, Rib::RouteSet routesToRemove)
{
// If a route on the namespace has the capture flag set, ignore self and children
if (entry.hasCapture())
@@ -789,51 +777,50 @@
return;
}
- // Remove inherited faces from current namespace
- for (Rib::FaceSet::const_iterator removeIt = facesToRemove.begin();
- removeIt != facesToRemove.end(); )
+ // Remove inherited routes from current namespace
+ for (Rib::RouteSet::const_iterator removeIt = routesToRemove.begin();
+ removeIt != routesToRemove.end(); )
{
- // If a route on the namespace has the same face and child inheritance set, ignore this face
+ // If a route on the namespace has the same face and child inheritance set, ignore this route
if (entry.hasChildInheritOnFaceId(removeIt->faceId))
{
- facesToRemove.erase(removeIt++);
+ routesToRemove.erase(removeIt++);
continue;
}
- // Only remove face if it removes an existing inherited route
- if (entry.hasInheritedFace(*removeIt))
+ // Only remove route if it removes an existing inherited route
+ if (entry.hasInheritedRoute(*removeIt))
{
- entry.removeInheritedFace(*removeIt);
+ entry.removeInheritedRoute(*removeIt);
insertFibUpdate(FibUpdate::createRemoveUpdate(entry.getName(), removeIt->faceId));
}
++removeIt;
}
- // Add inherited faces to current namespace
- for (Rib::FaceSet::const_iterator addIt = facesToAdd.begin();
- addIt != facesToAdd.end(); )
+ // Add inherited routes to current namespace
+ for (Rib::RouteSet::const_iterator addIt = routesToAdd.begin(); addIt != routesToAdd.end(); )
{
- // If a route on the namespace has the same face and child inherit set, ignore this face
+ // If a route on the namespace has the same face and child inherit set, ignore this route
if (entry.hasChildInheritOnFaceId(addIt->faceId))
{
- facesToAdd.erase(addIt++);
+ routesToAdd.erase(addIt++);
continue;
}
- // Only add face if it does not override an existing route
+ // Only add route if it does not override an existing route
if (!entry.hasFaceId(addIt->faceId))
{
- RibEntry::FaceList::iterator faceIt = entry.findInheritedFace(*addIt);
+ RibEntry::RouteList::iterator routeIt = entry.findInheritedRoute(*addIt);
- // If the entry already has the inherited face, just update the face
- if (faceIt != entry.getInheritedFaces().end())
+ // If the entry already has the inherited route, just update the route
+ if (routeIt != entry.getInheritedRoutes().end())
{
- faceIt->cost = addIt->cost;
+ routeIt->cost = addIt->cost;
}
- else // Otherwise, this is a newly inherited face
+ else // Otherwise, this is a newly inherited route
{
- entry.addInheritedFace(*addIt);
+ entry.addInheritedRoute(*addIt);
}
insertFibUpdate(FibUpdate::createAddUpdate(entry.getName(), addIt->faceId, addIt->cost));
@@ -844,10 +831,10 @@
Rib::RibEntryList children = entry.getChildren();
- // Apply face operations to current namespace's children
+ // Apply route operations to current namespace's children
for (Rib::RibEntryList::iterator child = children.begin(); child != children.end(); ++child)
{
- traverseSubTree(*(*child), facesToAdd, facesToRemove);
+ traverseSubTree(*(*child), routesToAdd, routesToRemove);
}
}
diff --git a/rib/rib.hpp b/rib/rib.hpp
index 2568b1a..698ce17 100644
--- a/rib/rib.hpp
+++ b/rib/rib.hpp
@@ -40,27 +40,27 @@
class Rib : noncopyable
{
public:
- typedef std::list<shared_ptr<RibEntry> > RibEntryList;
- typedef std::map<Name, shared_ptr<RibEntry> > RibTable;
+ typedef std::list<shared_ptr<RibEntry>> RibEntryList;
+ typedef std::map<Name, shared_ptr<RibEntry>> RibTable;
typedef RibTable::const_iterator const_iterator;
- typedef std::map<uint64_t, std::list<shared_ptr<RibEntry> > > FaceLookupTable;
- typedef bool (*FaceComparePredicate)(const FaceEntry&, const FaceEntry&);
- typedef std::set<FaceEntry, FaceComparePredicate> FaceSet;
- typedef std::list<shared_ptr<const FibUpdate> > FibUpdateList;
+ typedef std::map<uint64_t, std::list<shared_ptr<RibEntry>>> FaceLookupTable;
+ typedef bool (*RouteComparePredicate)(const Route&, const Route&);
+ typedef std::set<Route, RouteComparePredicate> RouteSet;
+ typedef std::list<shared_ptr<const FibUpdate>> FibUpdateList;
Rib();
const_iterator
find(const Name& prefix) const;
- FaceEntry*
- find(const Name& prefix, const FaceEntry& face) const;
+ Route*
+ find(const Name& prefix, const Route& route) const;
void
- insert(const Name& prefix, const FaceEntry& face);
+ insert(const Name& prefix, const Route& route);
void
- erase(const Name& prefix, const FaceEntry& face);
+ erase(const Name& prefix, const Route& route);
void
erase(const uint64_t faceId);
@@ -83,10 +83,10 @@
/** \brief finds namespaces under the passed prefix
* \return{ a list of entries which are under the passed prefix }
*/
- std::list<shared_ptr<RibEntry> >
+ std::list<shared_ptr<RibEntry>>
findDescendants(const Name& prefix) const;
- const std::list<shared_ptr<const FibUpdate> >&
+ const std::list<shared_ptr<const FibUpdate>>&
getFibUpdates() const;
void
@@ -100,42 +100,42 @@
insertFibUpdate(shared_ptr<FibUpdate> update);
void
- createFibUpdatesForNewRibEntry(RibEntry& entry, const FaceEntry& face);
+ createFibUpdatesForNewRibEntry(RibEntry& entry, const Route& route);
void
- createFibUpdatesForNewFaceEntry(RibEntry& entry, const FaceEntry& face,
- const bool captureWasTurnedOn);
+ createFibUpdatesForNewRoute(RibEntry& entry, const Route& route,
+ const bool captureWasTurnedOn);
void
- createFibUpdatesForUpdatedEntry(RibEntry& entry, const FaceEntry& face,
+ createFibUpdatesForUpdatedRoute(RibEntry& entry, const Route& route,
const uint64_t previousFlags, const uint64_t previousCost);
void
- createFibUpdatesForErasedFaceEntry(RibEntry& entry, const FaceEntry& face,
- const bool captureWasTurnedOff);
+ createFibUpdatesForErasedRoute(RibEntry& entry, const Route& route,
+ const bool captureWasTurnedOff);
void
createFibUpdatesForErasedRibEntry(RibEntry& entry);
- FaceSet
- getAncestorFaces(const RibEntry& entry) const;
+ RouteSet
+ getAncestorRoutes(const RibEntry& entry) const;
void
- modifyChildrensInheritedFaces(RibEntry& entry, const Rib::FaceSet& facesToAdd,
- const Rib::FaceSet& facesToRemove);
+ modifyChildrensInheritedRoutes(RibEntry& entry, const Rib::RouteSet& routesToAdd,
+ const Rib::RouteSet& routesToRemove);
void
- traverseSubTree(RibEntry& entry, Rib::FaceSet facesToAdd,
- Rib::FaceSet facesToRemove);
+ traverseSubTree(RibEntry& entry, Rib::RouteSet routesToAdd,
+ Rib::RouteSet routesToRemove);
- /** \brief Adds passed faces to the entry's inherited faces list
+ /** \brief Adds passed routes to the entry's inherited routes list
*/
void
- addInheritedFacesToEntry(RibEntry& entry, const Rib::FaceSet& facesToAdd);
+ addInheritedRoutesToEntry(RibEntry& entry, const Rib::RouteSet& routesToAdd);
- /** \brief Removes passed faces from the entry's inherited faces list
+ /** \brief Removes passed routes from the entry's inherited routes list
*/
void
- removeInheritedFacesFromEntry(RibEntry& entry, const Rib::FaceSet& facesToRemove);
+ removeInheritedRoutesFromEntry(RibEntry& entry, const Rib::RouteSet& routesToRemove);
public:
ndn::util::signal::Signal<Rib, Name> afterInsertEntry;
diff --git a/rib/face-entry.hpp b/rib/route.hpp
similarity index 80%
rename from rib/face-entry.hpp
rename to rib/route.hpp
index a6d468d..68769ef 100644
--- a/rib/face-entry.hpp
+++ b/rib/route.hpp
@@ -23,8 +23,8 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NFD_RIB_FACE_ENTRY_HPP
-#define NFD_RIB_FACE_ENTRY_HPP
+#ifndef NFD_RIB_ROUTE_HPP
+#define NFD_RIB_ROUTE_HPP
#include "common.hpp"
#include "core/scheduler.hpp"
@@ -32,13 +32,12 @@
namespace nfd {
namespace rib {
-/** \class FaceEntry
- * \brief represents a route for a name prefix
+/** \brief represents a route for a name prefix
*/
-class FaceEntry
+class Route
{
public:
- FaceEntry()
+ Route()
: faceId(0)
, origin(0)
, flags(0)
@@ -73,22 +72,22 @@
};
inline bool
-compareFaceIdAndOrigin(const FaceEntry& entry1, const FaceEntry& entry2)
+compareFaceIdAndOrigin(const Route& lhs, const Route& rhs)
{
- return (entry1.faceId == entry2.faceId && entry1.origin == entry2.origin);
+ return (lhs.faceId == rhs.faceId && lhs.origin == rhs.origin);
}
inline bool
-compareFaceId(const FaceEntry& entry, const uint64_t faceId)
+compareFaceId(const Route& route, const uint64_t faceId)
{
- return (entry.faceId == faceId);
+ return (route.faceId == faceId);
}
// Method definition in rib-entry.cpp
std::ostream&
-operator<<(std::ostream& os, const FaceEntry& entry);
+operator<<(std::ostream& os, const Route& route);
} // namespace rib
} // namespace nfd
-#endif // NFD_RIB_RIB_ENTRY_HPP
+#endif // NFD_RIB_ROUTE_HPP
diff --git a/tests/rib/fib-updates-common.hpp b/tests/rib/fib-updates-common.hpp
index c8c0af4..f3edd8f 100644
--- a/tests/rib/fib-updates-common.hpp
+++ b/tests/rib/fib-updates-common.hpp
@@ -27,10 +27,10 @@
namespace rib {
namespace tests {
-inline FaceEntry
-createFaceEntry(uint64_t faceId, uint64_t origin, uint64_t cost, uint64_t flags)
+inline Route
+createRoute(uint64_t faceId, uint64_t origin, uint64_t cost, uint64_t flags)
{
- FaceEntry temp;
+ Route temp;
temp.faceId = faceId;
temp.origin = origin;
temp.cost = cost;
@@ -73,25 +73,25 @@
{
public:
void
- insertFaceEntry(const Name& name, uint64_t faceId, uint64_t origin, uint64_t cost, uint64_t flags)
+ insertRoute(const Name& name, uint64_t faceId, uint64_t origin, uint64_t cost, uint64_t flags)
{
- rib::FaceEntry faceEntry;
- faceEntry.faceId = faceId;
- faceEntry.origin = origin;
- faceEntry.cost = cost;
- faceEntry.flags = flags;
+ rib::Route route;
+ route.faceId = faceId;
+ route.origin = origin;
+ route.cost = cost;
+ route.flags = flags;
- rib.insert(name, faceEntry);
+ rib.insert(name, route);
}
void
- eraseFaceEntry(const Name& name, uint64_t faceId, uint64_t origin)
+ eraseRoute(const Name& name, uint64_t faceId, uint64_t origin)
{
- rib::FaceEntry faceEntry;
- faceEntry.faceId = faceId;
- faceEntry.origin = origin;
+ rib::Route route;
+ route.faceId = faceId;
+ route.origin = origin;
- rib.erase(name, faceEntry);
+ rib.erase(name, route);
}
diff --git a/tests/rib/fib-updates-erase-face.cpp b/tests/rib/fib-updates-erase-face.cpp
index e56c0d3..1a98847 100644
--- a/tests/rib/fib-updates-erase-face.cpp
+++ b/tests/rib/fib-updates-erase-face.cpp
@@ -38,15 +38,15 @@
BOOST_AUTO_TEST_CASE(WithInheritedFace_Root)
{
- insertFaceEntry("/", 1, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a/b", 2, 0, 75, 0);
+ insertRoute("/", 1, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a/b", 2, 0, 75, 0);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 1 updates: 1 to remove face 1 from /
- eraseFaceEntry("/", 1, 0);
+ eraseRoute("/", 1, 0);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 1);
@@ -59,20 +59,20 @@
BOOST_AUTO_TEST_CASE(WithInheritedFace)
{
- insertFaceEntry("/a", 5, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 5, 255, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 20, 0);
- insertFaceEntry("/a/b", 3, 0, 5, 0);
+ insertRoute("/a", 5, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 5, 255, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 20, 0);
+ insertRoute("/a/b", 3, 0, 5, 0);
// /a should have face 5 with cost 10; /a/b should have face 3 with cost 5 and
// face 5 with cost 10
- eraseFaceEntry("/a", 5, 255);
+ eraseRoute("/a", 5, 255);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
- // Should generate 2 updates: 1 to remove face 3 from /a/b and one to remove inherited face.
- eraseFaceEntry("/a/b", 3, 0);
+ // Should generate 2 updates: 1 to remove face 3 from /a/b and one to remove inherited route
+ eraseRoute("/a/b", 3, 0);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -90,14 +90,14 @@
BOOST_AUTO_TEST_CASE(MultipleFaces)
{
- insertFaceEntry("/a", 5, 0, 10, 0);
- insertFaceEntry("/a", 5, 255, 5, 0);
+ insertRoute("/a", 5, 0, 10, 0);
+ insertRoute("/a", 5, 255, 5, 0);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 1 updates: 1 to update cost to 10 for /a
- eraseFaceEntry("/a", 5, 255);
+ eraseRoute("/a", 5, 255);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 1);
@@ -111,17 +111,17 @@
BOOST_AUTO_TEST_CASE(NoFlags_NoCaptureChange_NoCaptureOnRoute)
{
- insertFaceEntry("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, 0);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 1, 0, 100, 0);
- insertFaceEntry("/a", 1, 128, 50, 0);
+ insertRoute("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, 0);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 1, 0, 100, 0);
+ insertRoute("/a", 1, 128, 50, 0);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 1 updates: 1 to update cost for /a
- eraseFaceEntry("/a", 1, 128);
+ eraseRoute("/a", 1, 128);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 1);
@@ -135,13 +135,13 @@
BOOST_AUTO_TEST_CASE(MakeRibEmpty)
{
- insertFaceEntry("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
- // Should generate 1 updates: 1 to remove face from /
- eraseFaceEntry("/", 1, 0);
+ // Should generate 1 updates: 1 to remove route from /
+ eraseRoute("/", 1, 0);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 1);
@@ -154,17 +154,17 @@
BOOST_AUTO_TEST_CASE(NoFlags_NoCaptureChange_CaptureOnRoute)
{
- insertFaceEntry("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 1, 0, 100, 0);
- insertFaceEntry("/a", 1, 128, 50, 0);
+ insertRoute("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 1, 0, 100, 0);
+ insertRoute("/a", 1, 128, 50, 0);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
- // Should generate 1 updates: 1 to remove face from /a
- eraseFaceEntry("/a", 1, 128);
+ // Should generate 1 updates: 1 to remove route from /a
+ eraseRoute("/a", 1, 128);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 1);
@@ -177,19 +177,19 @@
BOOST_AUTO_TEST_CASE(BothFlags_NoCaptureChange_CaptureOnRoute)
{
- insertFaceEntry("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 1, 0, 100, 0);
- insertFaceEntry("/a", 1, 128, 50, (ndn::nfd::ROUTE_FLAG_CHILD_INHERIT |
+ insertRoute("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 1, 0, 100, 0);
+ insertRoute("/a", 1, 128, 50, (ndn::nfd::ROUTE_FLAG_CHILD_INHERIT |
ndn::nfd::ROUTE_FLAG_CAPTURE));
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 2 updates: 1 to remove face1 from /a and
- // 1 to remove face1 to /a/b
- eraseFaceEntry("/a", 1, 128);
+ // 1 to remove face1 from /a/b
+ eraseRoute("/a", 1, 128);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -207,11 +207,11 @@
BOOST_AUTO_TEST_CASE(BothFlags_CaptureChange_NoCaptureOnRoute)
{
- insertFaceEntry("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, 0);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 1, 0, 100, 0);
- insertFaceEntry("/a", 1, 128, 50, (ndn::nfd::ROUTE_FLAG_CHILD_INHERIT |
+ insertRoute("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, 0);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 1, 0, 100, 0);
+ insertRoute("/a", 1, 128, 50, (ndn::nfd::ROUTE_FLAG_CHILD_INHERIT |
ndn::nfd::ROUTE_FLAG_CAPTURE));
// Clear updates generated from previous insertions
@@ -219,7 +219,7 @@
// Should generate 2 updates: 1 to add face1 to /a and
// 1 to add face1 to /a/b
- eraseFaceEntry("/a", 1, 128);
+ eraseRoute("/a", 1, 128);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -239,17 +239,17 @@
BOOST_AUTO_TEST_CASE(ChildInherit_NoCaptureChange_NoCaptureOnRoute)
{
- insertFaceEntry("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, 0);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 1, 0, 100, 0);
- insertFaceEntry("/a", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, 0);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 1, 0, 100, 0);
+ insertRoute("/a", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 2 updates: 2 to add face1 to /a and /a/b
- eraseFaceEntry("/a", 1, 128);
+ eraseRoute("/a", 1, 128);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -269,17 +269,17 @@
BOOST_AUTO_TEST_CASE(ChildInherit_NoCaptureChange_CaptureOnRoute)
{
- insertFaceEntry("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 1, 0, 100, 0);
- insertFaceEntry("/a", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 1, 0, 100, 0);
+ insertRoute("/a", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 2 updates: 2 to remove face 1 from /a and /a/b
- eraseFaceEntry("/a", 1, 128);
+ eraseRoute("/a", 1, 128);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -297,18 +297,18 @@
BOOST_AUTO_TEST_CASE(Capture_CaptureChange_NoCaptureOnRoute)
{
- insertFaceEntry("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, 0);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 1, 0, 100, 0);
- insertFaceEntry("/a", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, 0);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 1, 0, 100, 0);
+ insertRoute("/a", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CAPTURE);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 2 updates: 1 to update cost on /a and
// 1 to add face1 to /a/b
- eraseFaceEntry("/a", 1 ,128);
+ eraseRoute("/a", 1 ,128);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -328,17 +328,17 @@
BOOST_AUTO_TEST_CASE(Capture_NoCaptureChange_CaptureOnRoute)
{
- insertFaceEntry("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 1, 0, 100, 0);
- insertFaceEntry("/a", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 1, 0, 100, 0);
+ insertRoute("/a", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CAPTURE);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
- // Should generate 1 updates: 1 to remove face from /a
- eraseFaceEntry("/a", 1, 128);
+ // Should generate 1 updates: 1 to remove route from /a
+ eraseRoute("/a", 1, 128);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 1);
@@ -351,11 +351,11 @@
BOOST_AUTO_TEST_CASE(EraseFaceById)
{
- insertFaceEntry("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, 0);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 4, 0, 100, 0);
- insertFaceEntry("/a", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/", 1, 0, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, 0);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 4, 0, 100, 0);
+ insertRoute("/a", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
diff --git a/tests/rib/fib-updates-new-face.cpp b/tests/rib/fib-updates-new-face.cpp
index b8e7d69..4f41488 100644
--- a/tests/rib/fib-updates-new-face.cpp
+++ b/tests/rib/fib-updates-new-face.cpp
@@ -39,7 +39,7 @@
BOOST_AUTO_TEST_CASE(Basic)
{
// should generate 1 update
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
Rib::FibUpdateList updates = rib.getFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 1);
@@ -55,7 +55,7 @@
rib.clearFibUpdates();
// should generate 2 updates
- insertFaceEntry("/a", 2, 0, 50, 0);
+ insertRoute("/a", 2, 0, 50, 0);
updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -76,7 +76,7 @@
rib.clearFibUpdates();
// should generate 2 updates
- insertFaceEntry("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/b", 3, 0, 10, 0);
updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -96,27 +96,27 @@
BOOST_AUTO_TEST_CASE(UpdateOnLowerCostNoChildInherit)
{
- insertFaceEntry("/", 1, 0, 50, 0);
+ insertRoute("/", 1, 0, 50, 0);
// Clear any updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 0 updates
- insertFaceEntry("/", 1, 128, 75, 0);
+ insertRoute("/", 1, 128, 75, 0);
BOOST_CHECK_EQUAL(rib.getFibUpdates().size(), 0);
}
BOOST_AUTO_TEST_CASE(UpdateOnLowerCostOnly)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, 0);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, 0);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 2 updates: to update cost for face 1 on / and /a
- insertFaceEntry("/", 1, 0, 25, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/", 1, 0, 25, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -137,23 +137,23 @@
rib.clearFibUpdates();
// Should generate 0 updates
- insertFaceEntry("/", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
BOOST_CHECK_EQUAL(rib.getFibUpdates().size(), 0);
}
BOOST_AUTO_TEST_CASE(NoCaptureChangeWithoutChildInherit)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 4, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 4, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 1 update: 1 to add face 5 to /a
- insertFaceEntry("/a", 5, 128, 50, 0);
+ insertRoute("/a", 5, 128, 50, 0);
const Rib::FibUpdateList& updates = rib.getFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 1);
@@ -168,17 +168,17 @@
BOOST_AUTO_TEST_CASE(NoCaptureChangeWithChildInherit)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 4, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 4, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
- // Should generate 2 updates: one for the inserted face and
- // one to add face to /a/b
- insertFaceEntry("/a", 4, 128, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ // Should generate 2 updates: one for the inserted route and
+ // one to add route to /a/b
+ insertRoute("/a", 4, 128, 5, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -198,18 +198,18 @@
BOOST_AUTO_TEST_CASE(CaptureTurnedOnWithoutChildInherit)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 4, 0, 10, 0);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 4, 0, 10, 0);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 3 updates:
- // - one for the inserted face for /a and
+ // - one for the inserted route for /a and
// - two to remove face1 from /a/b and /a/c
- insertFaceEntry("/a", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/a", 1, 128, 50, ndn::nfd::ROUTE_FLAG_CAPTURE);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 3);
@@ -233,18 +233,18 @@
BOOST_AUTO_TEST_CASE(CaptureTurnedOnWithChildInherit)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 4, 0, 10, 0);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 4, 0, 10, 0);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 2 updates:
- // - one for the inserted face for /a and
+ // - one for the inserted route for /a and
// - one to update /a/b with the new cost
- insertFaceEntry("/a", 1, 128, 50, (ndn::nfd::ROUTE_FLAG_CAPTURE |
+ insertRoute("/a", 1, 128, 50, (ndn::nfd::ROUTE_FLAG_CAPTURE |
ndn::nfd::ROUTE_FLAG_CHILD_INHERIT));
Rib::FibUpdateList updates = getSortedFibUpdates();
diff --git a/tests/rib/fib-updates-new-namespace.cpp b/tests/rib/fib-updates-new-namespace.cpp
index e409c51..5339530 100644
--- a/tests/rib/fib-updates-new-namespace.cpp
+++ b/tests/rib/fib-updates-new-namespace.cpp
@@ -38,8 +38,8 @@
BOOST_AUTO_TEST_CASE(NoFlags)
{
- // No flags, empty RIB, should generate 1 update for the inserted face
- insertFaceEntry("/a/b", 1, 0, 10, 0);
+ // No flags, empty RIB, should generate 1 update for the inserted route
+ insertRoute("/a/b", 1, 0, 10, 0);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 1);
@@ -51,18 +51,18 @@
BOOST_CHECK_EQUAL((*update)->action, FibUpdate::ADD_NEXTHOP);
// Reset RIB
- eraseFaceEntry("/a/b", 1, 0);
+ eraseRoute("/a/b", 1, 0);
rib.clearFibUpdates();
// Parent with child inherit flag
- insertFaceEntry("/a", 2, 0, 70, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 3, 0, 30, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 70, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 3, 0, 30, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
- // Should generate 3 updates, 1 for the inserted face and 2 from inheritance
- insertFaceEntry("/a/b", 1, 0, 10, 0);
+ // Should generate 3 updates, 1 for the inserted route and 2 from inheritance
+ insertRoute("/a/b", 1, 0, 10, 0);
updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 3);
@@ -88,9 +88,8 @@
BOOST_AUTO_TEST_CASE(BothFlags)
{
- // Empty RIB, should generate 1 update for the inserted face
- insertFaceEntry("/a", 1, 0, 10, (ndn::nfd::ROUTE_FLAG_CHILD_INHERIT |
- ndn::nfd::ROUTE_FLAG_CAPTURE));
+ // Empty RIB, should generate 1 update for the inserted route
+ insertRoute("/a", 1, 0, 10, (ndn::nfd::ROUTE_FLAG_CHILD_INHERIT | ndn::nfd::ROUTE_FLAG_CAPTURE));
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 1);
@@ -102,19 +101,18 @@
BOOST_CHECK_EQUAL((*update)->action, FibUpdate::ADD_NEXTHOP);
// Reset RIB
- eraseFaceEntry("/a", 1, 0);
+ eraseRoute("/a", 1, 0);
rib.clearFibUpdates();
- insertFaceEntry("/", 2, 0, 70, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a/b", 3, 0, 30, 0);
+ insertRoute("/", 2, 0, 70, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a/b", 3, 0, 30, 0);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
- // Should generate 3 updates, 1 for the inserted face, 1 to add the face to the child,
- // and 1 to remove the previously inherited entry
- insertFaceEntry("/a", 1, 0, 10, (ndn::nfd::ROUTE_FLAG_CHILD_INHERIT |
- ndn::nfd::ROUTE_FLAG_CAPTURE));
+ // Should generate 3 updates, 1 for the inserted route, 1 to add the route to the child,
+ // and 1 to remove the previously inherited route
+ insertRoute("/a", 1, 0, 10, (ndn::nfd::ROUTE_FLAG_CHILD_INHERIT | ndn::nfd::ROUTE_FLAG_CAPTURE));
updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 3);
@@ -139,15 +137,15 @@
BOOST_AUTO_TEST_CASE(ChildInherit)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a/b", 2, 0, 10, 0);
- insertFaceEntry("/a/c", 3, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a/b", 2, 0, 10, 0);
+ insertRoute("/a/c", 3, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
- // Should generate 2 updates: 1 for the inserted face and 1 to add the face to "/a/b"
- insertFaceEntry("/a", 1, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ // Should generate 2 updates: 1 for the inserted route and 1 to add the route to "/a/b"
+ insertRoute("/a", 1, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -167,16 +165,16 @@
BOOST_AUTO_TEST_CASE(Capture)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a/b", 2, 0, 10, 0);
- insertFaceEntry("/a/c", 3, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a/b", 2, 0, 10, 0);
+ insertRoute("/a/c", 3, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
- // Should generate 2 updates: 1 for the inserted face and
- // 1 to remove inherited face from "/a/b"
- insertFaceEntry("/a", 1, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ // Should generate 2 updates: 1 for the inserted route and
+ // 1 to remove the inherited route from "/a/b"
+ insertRoute("/a", 1, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
diff --git a/tests/rib/fib-updates-update-face.cpp b/tests/rib/fib-updates-update-face.cpp
index 13f5e21..e3dcd45 100644
--- a/tests/rib/fib-updates-update-face.cpp
+++ b/tests/rib/fib-updates-update-face.cpp
@@ -38,16 +38,16 @@
BOOST_AUTO_TEST_CASE(TurnOffChildInheritLowerCost)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, 0);
- insertFaceEntry("/", 1, 128, 25, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, 0);
+ insertRoute("/", 1, 128, 25, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 2 updates: 1 to update the cost of / face 1 to 50 and
// 1 to update the cost of /a face 1 to 50
- insertFaceEntry("/", 1, 128, 75, 0);
+ insertRoute("/", 1, 128, 75, 0);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -67,15 +67,15 @@
BOOST_AUTO_TEST_CASE(UpdateOnLowerCostOnly)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, 0);
- insertFaceEntry("/", 1, 128, 100, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, 0);
+ insertRoute("/", 1, 128, 100, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 0 updates
- insertFaceEntry("/", 1, 128, 75, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/", 1, 128, 75, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 0);
@@ -84,7 +84,7 @@
rib.clearFibUpdates();
// Should generate 2 updates
- insertFaceEntry("/", 1, 128, 25, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/", 1, 128, 25, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -104,16 +104,16 @@
BOOST_AUTO_TEST_CASE(NoChangeInCost)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 100, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 4, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 100, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 4, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 0 updates
- insertFaceEntry("/a", 2, 0, 100, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 100, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 0);
@@ -121,17 +121,17 @@
BOOST_AUTO_TEST_CASE(ChangeCost)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 100, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 4, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 100, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 4, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Should generate 2 updates: 1 to add face2 with new cost to /a and
// 1 to add face2 with new cost to /a/b
- insertFaceEntry("/a", 2, 0, 300, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 300, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -151,17 +151,17 @@
BOOST_AUTO_TEST_CASE(TurnOnChildInherit)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, 0);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 4, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, 0);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 4, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Turn on child inherit flag for the entry in /a
// Should generate 1 updates: 1 to add face to /a/b
- insertFaceEntry("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 1);
@@ -175,17 +175,17 @@
BOOST_AUTO_TEST_CASE(TurnOffChildInherit)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 1, 0, 100, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a/b", 2, 0, 10, 0);
- insertFaceEntry("/a/c", 1, 0, 25, 0);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 1, 0, 100, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a/b", 2, 0, 10, 0);
+ insertRoute("/a/c", 1, 0, 25, 0);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
// Turn off child inherit flag for the entry in /a
// Should generate 1 update: 1 to add face1 to /a/b
- insertFaceEntry("/a", 1, 0, 100, 0);
+ insertRoute("/a", 1, 0, 100, 0);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 1);
@@ -199,10 +199,10 @@
BOOST_AUTO_TEST_CASE(TurnOnCapture)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, 0);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 1, 0, 10, 0);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, 0);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 1, 0, 10, 0);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
@@ -210,7 +210,7 @@
// Turn on capture flag for the entry in /a
// Should generate 2 updates: 1 to remove face1 from /a and
// 1 to remove face1 from /a/b
- insertFaceEntry("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
@@ -228,10 +228,10 @@
BOOST_AUTO_TEST_CASE(TurnOffCapture)
{
- insertFaceEntry("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
- insertFaceEntry("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
- insertFaceEntry("/a/b", 3, 0, 10, 0);
- insertFaceEntry("/a/c", 1, 0, 10, 0);
+ insertRoute("/", 1, 0, 50, ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
+ insertRoute("/a", 2, 0, 10, ndn::nfd::ROUTE_FLAG_CAPTURE);
+ insertRoute("/a/b", 3, 0, 10, 0);
+ insertRoute("/a/c", 1, 0, 10, 0);
// Clear updates generated from previous insertions
rib.clearFibUpdates();
@@ -239,7 +239,7 @@
// Turn off capture flag for the entry in /a
// Should generate 2 updates: 1 to add face1 to /a and
// 1 to add face1 to /a/b
- insertFaceEntry("/a", 2, 0, 10, 0);
+ insertRoute("/a", 2, 0, 10, 0);
Rib::FibUpdateList updates = getSortedFibUpdates();
BOOST_REQUIRE_EQUAL(updates.size(), 2);
diff --git a/tests/rib/remote-registrator.cpp b/tests/rib/remote-registrator.cpp
index ed3181a..8e30218 100644
--- a/tests/rib/remote-registrator.cpp
+++ b/tests/rib/remote-registrator.cpp
@@ -104,10 +104,10 @@
{
BOOST_CHECK_EQUAL(addIdentity(identity), true);
- FaceEntry faceEntry;
- faceEntry.faceId = faceId;
+ Route route;
+ route.faceId = faceId;
- rib.insert(identity.append(appName), faceEntry);
+ rib.insert(identity.append(appName), route);
advanceClocks(time::milliseconds(1));
}
@@ -117,10 +117,10 @@
name::Component appName = DEFAULT_APP_NAME,
uint64_t faceId = 0)
{
- FaceEntry faceEntry;
- faceEntry.faceId = faceId;
+ Route route;
+ route.faceId = faceId;
- rib.insert(identity.append(appName), faceEntry);
+ rib.insert(identity.append(appName), route);
advanceClocks(time::milliseconds(1));
}
@@ -132,10 +132,10 @@
{
BOOST_CHECK_EQUAL(addIdentity(identity), true);
- FaceEntry faceEntry;
- faceEntry.faceId = faceId;
+ Route route;
+ route.faceId = faceId;
- rib.erase(identity.append(appName), faceEntry);
+ rib.erase(identity.append(appName), route);
advanceClocks(time::milliseconds(1));
}
@@ -145,10 +145,10 @@
name::Component appName = DEFAULT_APP_NAME,
uint64_t faceId = 0)
{
- FaceEntry faceEntry;
- faceEntry.faceId = faceId;
+ Route route;
+ route.faceId = faceId;
- rib.erase(identity.append(appName), faceEntry);
+ rib.erase(identity.append(appName), route);
advanceClocks(time::milliseconds(1));
}
@@ -164,7 +164,7 @@
void
connectToHub()
{
- rib.insert(COMMAND_PREFIX, FaceEntry());
+ rib.insert(COMMAND_PREFIX, Route());
advanceClocks(time::milliseconds(1));
}
@@ -172,7 +172,7 @@
void
disconnectToHub()
{
- rib.erase(COMMAND_PREFIX, FaceEntry());
+ rib.erase(COMMAND_PREFIX, Route());
advanceClocks(time::milliseconds(1));
}
diff --git a/tests/rib/rib-manager.cpp b/tests/rib/rib-manager.cpp
index 39a4a5d..cca1659 100644
--- a/tests/rib/rib-manager.cpp
+++ b/tests/rib/rib-manager.cpp
@@ -234,20 +234,20 @@
BOOST_FIXTURE_TEST_CASE(RibStatusRequest, AuthorizedRibManager)
{
- FaceEntry entry;
+ Route route;
Name name("/");
- entry.faceId = 1;
- entry.origin = 128;
- entry.cost = 32;
- entry.flags = ndn::nfd::ROUTE_FLAG_CAPTURE;
+ route.faceId = 1;
+ route.origin = 128;
+ route.cost = 32;
+ route.flags = ndn::nfd::ROUTE_FLAG_CAPTURE;
ControlParameters parameters;
parameters
.setName(name)
- .setFaceId(entry.faceId)
- .setOrigin(entry.origin)
- .setCost(entry.cost)
- .setFlags(entry.flags)
+ .setFaceId(route.faceId)
+ .setOrigin(route.origin)
+ .setCost(route.cost)
+ .setFlags(route.flags)
.setExpirationPeriod(ndn::time::milliseconds::max());
Name commandName("/localhost/nfd/rib/register");
@@ -262,7 +262,7 @@
face->processEvents(time::milliseconds(1));
BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
- RibStatusPublisherFixture::decodeRibEntryBlock(face->sentDatas[0], name, entry);
+ RibStatusPublisherFixture::decodeRibEntryBlock(face->sentDatas[0], name, route);
}
BOOST_FIXTURE_TEST_CASE(CancelExpirationEvent, AuthorizedRibManager)
diff --git a/tests/rib/rib-status-publisher-common.hpp b/tests/rib/rib-status-publisher-common.hpp
index 58ccd68..a0f1f42 100644
--- a/tests/rib/rib-status-publisher-common.hpp
+++ b/tests/rib/rib-status-publisher-common.hpp
@@ -45,7 +45,7 @@
{
public:
static void
- validateRibEntry(const Block& block, const Name& referenceName, const FaceEntry& referenceFace)
+ validateRibEntry(const Block& block, const Name& referenceName, const Route& referenceRoute)
{
ndn::nfd::RibEntry entry;
BOOST_REQUIRE_NO_THROW(entry.wireDecode(block));
@@ -55,14 +55,14 @@
std::list<ndn::nfd::Route> routes = entry.getRoutes();
std::list<ndn::nfd::Route>::iterator it = routes.begin();
- BOOST_CHECK_EQUAL(it->getFaceId(), referenceFace.faceId);
- BOOST_CHECK_EQUAL(it->getOrigin(), referenceFace.origin);
- BOOST_CHECK_EQUAL(it->getCost(), referenceFace.cost);
- BOOST_CHECK_EQUAL(it->getFlags(), referenceFace.flags);
+ BOOST_CHECK_EQUAL(it->getFaceId(), referenceRoute.faceId);
+ BOOST_CHECK_EQUAL(it->getOrigin(), referenceRoute.origin);
+ BOOST_CHECK_EQUAL(it->getCost(), referenceRoute.cost);
+ BOOST_CHECK_EQUAL(it->getFlags(), referenceRoute.flags);
}
static void
- decodeRibEntryBlock(const Data& data, const Name& referenceName, const FaceEntry& referenceFace)
+ decodeRibEntryBlock(const Data& data, const Name& referenceName, const Route& referenceRoute)
{
ndn::EncodingBuffer buffer;
@@ -81,7 +81,7 @@
BOOST_FAIL("expected RibEntry, got type #" << i->type());
}
else {
- validateRibEntry(*i, referenceName, referenceFace);
+ validateRibEntry(*i, referenceName, referenceRoute);
}
}
};
diff --git a/tests/rib/rib-status-publisher.cpp b/tests/rib/rib-status-publisher.cpp
index b1414cc..1f81900 100644
--- a/tests/rib/rib-status-publisher.cpp
+++ b/tests/rib/rib-status-publisher.cpp
@@ -39,13 +39,13 @@
{
Rib rib;
- FaceEntry entry;
+ Route route;
Name name("/");
- entry.faceId = 1;
- entry.origin = 128;
- entry.cost = 32;
- entry.flags = ndn::nfd::ROUTE_FLAG_CAPTURE;
- rib.insert(name, entry);
+ route.faceId = 1;
+ route.origin = 128;
+ route.cost = 32;
+ route.flags = ndn::nfd::ROUTE_FLAG_CAPTURE;
+ rib.insert(name, route);
ndn::KeyChain keyChain;
shared_ptr<ndn::util::DummyClientFace> face = ndn::util::makeDummyClientFace();
@@ -55,7 +55,7 @@
face->processEvents(time::milliseconds(1));
BOOST_REQUIRE_EQUAL(face->sentDatas.size(), 1);
- decodeRibEntryBlock(face->sentDatas[0], name, entry);
+ decodeRibEntryBlock(face->sentDatas[0], name, route);
}
diff --git a/tests/rib/rib.cpp b/tests/rib/rib.cpp
index 3226e57..3427c95 100644
--- a/tests/rib/rib.cpp
+++ b/tests/rib/rib.cpp
@@ -37,102 +37,102 @@
{
rib::RibEntry entry;
- rib::FaceEntry face1;
- face1.faceId = 1;
- face1.origin = 0;
+ rib::Route route1;
+ route1.faceId = 1;
+ route1.origin = 0;
- entry.insertFace(face1);
- BOOST_CHECK_EQUAL(entry.getFaces().size(), 1);
+ entry.insertRoute(route1);
+ BOOST_CHECK_EQUAL(entry.getRoutes().size(), 1);
- FaceEntry face2;
- face2.faceId = 1;
- face2.origin = 128;
+ Route route2;
+ route2.faceId = 1;
+ route2.origin = 128;
- entry.insertFace(face2);
- BOOST_CHECK_EQUAL(entry.getFaces().size(), 2);
+ entry.insertRoute(route2);
+ BOOST_CHECK_EQUAL(entry.getRoutes().size(), 2);
- entry.eraseFace(face1);
- BOOST_CHECK_EQUAL(entry.getFaces().size(), 1);
+ entry.eraseRoute(route1);
+ BOOST_CHECK_EQUAL(entry.getRoutes().size(), 1);
- BOOST_CHECK(entry.findFace(face1) == entry.getFaces().end());
- BOOST_CHECK(entry.findFace(face2) != entry.getFaces().end());
+ BOOST_CHECK(entry.findRoute(route1) == entry.getRoutes().end());
+ BOOST_CHECK(entry.findRoute(route2) != entry.getRoutes().end());
- entry.insertFace(face2);
- BOOST_CHECK_EQUAL(entry.getFaces().size(), 1);
+ entry.insertRoute(route2);
+ BOOST_CHECK_EQUAL(entry.getRoutes().size(), 1);
- entry.eraseFace(face1);
- BOOST_CHECK_EQUAL(entry.getFaces().size(), 1);
- BOOST_CHECK(entry.findFace(face2) != entry.getFaces().end());
+ entry.eraseRoute(route1);
+ BOOST_CHECK_EQUAL(entry.getRoutes().size(), 1);
+ BOOST_CHECK(entry.findRoute(route2) != entry.getRoutes().end());
}
BOOST_AUTO_TEST_CASE(Parent)
{
rib::Rib rib;
- FaceEntry root;
+ Route root;
Name name1("/");
root.faceId = 1;
root.origin = 20;
rib.insert(name1, root);
- FaceEntry entry1;
+ Route route1;
Name name2("/hello");
- entry1.faceId = 2;
- entry1.origin = 20;
- rib.insert(name2, entry1);
+ route1.faceId = 2;
+ route1.origin = 20;
+ rib.insert(name2, route1);
- FaceEntry entry2;
+ Route route2;
Name name3("/hello/world");
- entry2.faceId = 3;
- entry2.origin = 20;
- rib.insert(name3, entry2);
+ route2.faceId = 3;
+ route2.origin = 20;
+ rib.insert(name3, route2);
shared_ptr<rib::RibEntry> ribEntry = rib.findParent(name3);
BOOST_REQUIRE(static_cast<bool>(ribEntry));
- BOOST_CHECK_EQUAL(ribEntry->getFaces().front().faceId, 2);
+ BOOST_CHECK_EQUAL(ribEntry->getRoutes().front().faceId, 2);
ribEntry = rib.findParent(name2);
BOOST_REQUIRE(static_cast<bool>(ribEntry));
- BOOST_CHECK_EQUAL(ribEntry->getFaces().front().faceId, 1);
+ BOOST_CHECK_EQUAL(ribEntry->getRoutes().front().faceId, 1);
- FaceEntry entry3;
+ Route route3;
Name name4("/hello/test/foo/bar");
- entry2.faceId = 3;
- entry2.origin = 20;
- rib.insert(name4, entry3);
+ route2.faceId = 3;
+ route2.origin = 20;
+ rib.insert(name4, route3);
ribEntry = rib.findParent(name4);
BOOST_CHECK(ribEntry != shared_ptr<rib::RibEntry>());
- BOOST_CHECK(ribEntry->getFaces().front().faceId == 2);
+ BOOST_CHECK(ribEntry->getRoutes().front().faceId == 2);
}
BOOST_AUTO_TEST_CASE(Children)
{
rib::Rib rib;
- FaceEntry entry1;
+ Route route1;
Name name1("/");
- entry1.faceId = 1;
- entry1.origin = 20;
- rib.insert(name1, entry1);
+ route1.faceId = 1;
+ route1.origin = 20;
+ rib.insert(name1, route1);
- FaceEntry entry2;
+ Route route2;
Name name2("/hello/world");
- entry2.faceId = 2;
- entry2.origin = 20;
- rib.insert(name2, entry2);
+ route2.faceId = 2;
+ route2.origin = 20;
+ rib.insert(name2, route2);
- FaceEntry entry3;
+ Route route3;
Name name3("/hello/test/foo/bar");
- entry3.faceId = 3;
- entry3.origin = 20;
- rib.insert(name3, entry3);
+ route3.faceId = 3;
+ route3.origin = 20;
+ rib.insert(name3, route3);
BOOST_CHECK_EQUAL((rib.find(name1)->second)->getChildren().size(), 2);
BOOST_CHECK_EQUAL((rib.find(name2)->second)->getChildren().size(), 0);
BOOST_CHECK_EQUAL((rib.find(name3)->second)->getChildren().size(), 0);
- FaceEntry entry4;
+ Route entry4;
Name name4("/hello");
entry4.faceId = 4;
entry4.origin = 20;
@@ -156,41 +156,41 @@
{
rib::Rib rib;
- FaceEntry entry1;
+ Route route1;
Name name1("/");
- entry1.faceId = 1;
- entry1.origin = 20;
- rib.insert(name1, entry1);
+ route1.faceId = 1;
+ route1.origin = 20;
+ rib.insert(name1, route1);
- FaceEntry entry2;
+ Route route2;
Name name2("/hello/world");
- entry2.faceId = 2;
- entry2.origin = 20;
- rib.insert(name2, entry2);
+ route2.faceId = 2;
+ route2.origin = 20;
+ rib.insert(name2, route2);
- FaceEntry entry3;
+ Route route3;
Name name3("/hello/world");
- entry3.faceId = 1;
- entry3.origin = 20;
- rib.insert(name3, entry3);
+ route3.faceId = 1;
+ route3.origin = 20;
+ rib.insert(name3, route3);
- FaceEntry entry4;
+ Route entry4;
Name name4("/not/inserted");
entry4.faceId = 1;
entry4.origin = 20;
rib.erase(name4, entry4);
- rib.erase(name1, entry1);
+ rib.erase(name1, route1);
BOOST_CHECK(rib.find(name1) == rib.end());
- BOOST_CHECK_EQUAL((rib.find(name2)->second)->getFaces().size(), 2);
+ BOOST_CHECK_EQUAL((rib.find(name2)->second)->getRoutes().size(), 2);
- rib.erase(name2, entry2);
+ rib.erase(name2, route2);
- BOOST_CHECK_EQUAL((rib.find(name2)->second)->getFaces().size(), 1);
- BOOST_CHECK_EQUAL((rib.find(name2)->second)->getFaces().front().faceId, 1);
+ BOOST_CHECK_EQUAL((rib.find(name2)->second)->getRoutes().size(), 1);
+ BOOST_CHECK_EQUAL((rib.find(name2)->second)->getRoutes().front().faceId, 1);
- rib.erase(name3, entry3);
+ rib.erase(name3, route3);
BOOST_CHECK(rib.find(name2) == rib.end());
@@ -201,23 +201,23 @@
{
rib::Rib rib;
- FaceEntry entry1;
+ Route route1;
Name name1("/");
- entry1.faceId = 1;
- entry1.origin = 20;
- rib.insert(name1, entry1);
+ route1.faceId = 1;
+ route1.origin = 20;
+ rib.insert(name1, route1);
- FaceEntry entry2;
+ Route route2;
Name name2("/hello");
- entry2.faceId = 2;
- entry2.origin = 20;
- rib.insert(name2, entry2);
+ route2.faceId = 2;
+ route2.origin = 20;
+ rib.insert(name2, route2);
- FaceEntry entry3;
+ Route route3;
Name name3("/hello/world");
- entry3.faceId = 1;
- entry3.origin = 20;
- rib.insert(name3, entry3);
+ route3.faceId = 1;
+ route3.origin = 20;
+ rib.insert(name3, route3);
shared_ptr<rib::RibEntry> ribEntry1 = rib.find(name1)->second;
shared_ptr<rib::RibEntry> ribEntry2 = rib.find(name2)->second;
@@ -226,7 +226,7 @@
BOOST_CHECK(ribEntry1->getChildren().front() == ribEntry2);
BOOST_CHECK(ribEntry3->getParent() == ribEntry2);
- rib.erase(name2, entry2);
+ rib.erase(name2, route2);
BOOST_CHECK(ribEntry1->getChildren().front() == ribEntry3);
BOOST_CHECK(ribEntry3->getParent() == ribEntry1);
}
@@ -235,30 +235,30 @@
{
rib::Rib rib;
- FaceEntry entry1;
+ Route route1;
Name name1("/");
- entry1.faceId = 1;
- entry1.origin = 20;
- rib.insert(name1, entry1);
+ route1.faceId = 1;
+ route1.origin = 20;
+ rib.insert(name1, route1);
- FaceEntry entry2;
+ Route route2;
Name name2("/hello/world");
- entry2.faceId = 2;
- entry2.origin = 20;
- rib.insert(name2, entry2);
+ route2.faceId = 2;
+ route2.origin = 20;
+ rib.insert(name2, route2);
- FaceEntry entry3;
+ Route route3;
Name name3("/hello/world");
- entry3.faceId = 1;
- entry3.origin = 20;
- rib.insert(name3, entry3);
+ route3.faceId = 1;
+ route3.origin = 20;
+ rib.insert(name3, route3);
rib.erase(1);
BOOST_CHECK(rib.find(name1) == rib.end());
- BOOST_CHECK_EQUAL((rib.find(name2)->second)->getFaces().size(), 1);
+ BOOST_CHECK_EQUAL((rib.find(name2)->second)->getRoutes().size(), 1);
rib.erase(3);
- BOOST_CHECK_EQUAL((rib.find(name2)->second)->getFaces().size(), 1);
+ BOOST_CHECK_EQUAL((rib.find(name2)->second)->getRoutes().size(), 1);
rib.erase(2);
BOOST_CHECK(rib.find(name2) == rib.end());
@@ -270,61 +270,61 @@
{
rib::Rib rib;
- FaceEntry entry1;
+ Route route1;
Name name1("/hello/world");
- entry1.faceId = 1;
- entry1.origin = 20;
- entry1.cost = 10;
- entry1.flags = ndn::nfd::ROUTE_FLAG_CHILD_INHERIT | ndn::nfd::ROUTE_FLAG_CAPTURE;
- entry1.expires = time::steady_clock::now() + time::milliseconds(1500);
+ route1.faceId = 1;
+ route1.origin = 20;
+ route1.cost = 10;
+ route1.flags = ndn::nfd::ROUTE_FLAG_CHILD_INHERIT | ndn::nfd::ROUTE_FLAG_CAPTURE;
+ route1.expires = time::steady_clock::now() + time::milliseconds(1500);
- rib.insert(name1, entry1);
+ rib.insert(name1, route1);
BOOST_CHECK_EQUAL(rib.size(), 1);
- rib.insert(name1, entry1);
+ rib.insert(name1, route1);
BOOST_CHECK_EQUAL(rib.size(), 1);
- FaceEntry entry2;
+ Route route2;
Name name2("/hello/world");
- entry2.faceId = 1;
- entry2.origin = 20;
- entry2.cost = 100;
- entry2.flags = ndn::nfd::ROUTE_FLAG_CHILD_INHERIT;
- entry2.expires = time::steady_clock::now() + time::seconds(0);
+ route2.faceId = 1;
+ route2.origin = 20;
+ route2.cost = 100;
+ route2.flags = ndn::nfd::ROUTE_FLAG_CHILD_INHERIT;
+ route2.expires = time::steady_clock::now() + time::seconds(0);
- rib.insert(name2, entry2);
+ rib.insert(name2, route2);
BOOST_CHECK_EQUAL(rib.size(), 1);
- entry2.faceId = 2;
- rib.insert(name2, entry2);
+ route2.faceId = 2;
+ rib.insert(name2, route2);
BOOST_CHECK_EQUAL(rib.size(), 2);
- BOOST_CHECK(rib.find(name1)->second->hasFaceId(entry1.faceId));
- BOOST_CHECK(rib.find(name1)->second->hasFaceId(entry2.faceId));
+ BOOST_CHECK(rib.find(name1)->second->hasFaceId(route1.faceId));
+ BOOST_CHECK(rib.find(name1)->second->hasFaceId(route2.faceId));
Name name3("/foo/bar");
- rib.insert(name3, entry2);
+ rib.insert(name3, route2);
BOOST_CHECK_EQUAL(rib.size(), 3);
- entry2.origin = 1;
- rib.insert(name3, entry2);
+ route2.origin = 1;
+ rib.insert(name3, route2);
BOOST_CHECK_EQUAL(rib.size(), 4);
- rib.erase(name3, entry2);
+ rib.erase(name3, route2);
BOOST_CHECK_EQUAL(rib.size(), 3);
Name name4("/hello/world");
- rib.erase(name4, entry2);
+ rib.erase(name4, route2);
BOOST_CHECK_EQUAL(rib.size(), 3);
- entry2.origin = 20;
- rib.erase(name4, entry2);
+ route2.origin = 20;
+ rib.erase(name4, route2);
BOOST_CHECK_EQUAL(rib.size(), 2);
- BOOST_CHECK_EQUAL(rib.find(name2, entry2), static_cast<FaceEntry*>(0));
- BOOST_CHECK_NE(rib.find(name1, entry1), static_cast<FaceEntry*>(0));
+ BOOST_CHECK_EQUAL(rib.find(name2, route2), static_cast<Route*>(0));
+ BOOST_CHECK_NE(rib.find(name1, route1), static_cast<Route*>(0));
- rib.erase(name1, entry1);
+ rib.erase(name1, route1);
BOOST_CHECK_EQUAL(rib.size(), 1);
}