26 #ifndef NFD_DAEMON_RIB_RIB_HPP
27 #define NFD_DAEMON_RIB_RIB_HPP
32 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
39 using ndn::nfd::ControlParameters;
54 return std::tie(lhs.entry->getName(), lhs.route->faceId, lhs.route->origin) <
55 std::tie(rhs.entry->getName(), rhs.route->faceId, rhs.route->origin);
69 class Rib : noncopyable
73 using RibTable = std::map<Name, shared_ptr<RibEntry>>;
80 find(
const Name& prefix)
const;
83 find(
const Name& prefix,
const Route& route)
const;
109 return m_rib.empty();
148 enqueueRemoveFace(
const RibEntry& entry, uint64_t faceId);
155 addUpdateToQueue(
const RibUpdate& update,
162 sendBatchFromQueue();
171 uint32_t code,
const std::string& error);
175 erase(
const Name& prefix,
const Route& route);
178 using RouteComparePredicate = bool (*)(
const Route&,
const Route&);
179 using RouteSet = std::set<Route, RouteComparePredicate>;
184 std::list<shared_ptr<RibEntry>>
185 findDescendants(
const Name& prefix)
const;
190 std::list<shared_ptr<RibEntry>>
191 findDescendantsForNonInsertedName(
const Name& prefix)
const;
194 eraseEntry(RibTable::iterator it);
203 getAncestorRoutes(
const RibEntry& entry)
const;
210 getAncestorRoutes(
const Name& name)
const;
244 std::multimap<uint64_t, shared_ptr<RibEntry>> m_faceEntries;
248 struct UpdateQueueItem
255 using UpdateQueue = std::list<UpdateQueueItem>;
256 UpdateQueue m_updateBatches;
257 bool m_isUpdateInProgress =
false;
Computes FibUpdates based on updates to the RIB and sends them to NFD.
Represents a RIB entry, which contains one or more Routes with the same prefix.
RouteList::const_iterator const_iterator
Represents the Routing Information Base.
signal::Signal< Rib, Name > afterInsertEntry
Signals after a RIB entry is inserted.
size_t size() const noexcept
signal::Signal< Rib, RibRouteRef > afterAddRoute
Signals after a Route is added.
void beginRemoveFailedFaces(const std::set< uint64_t > &activeFaceIds)
const_iterator begin() const
signal::Signal< Rib, RibRouteRef > beforeRemoveRoute
Signals before a route is removed.
std::function< void()> UpdateSuccessCallback
void setFibUpdater(FibUpdater *updater)
void beginRemoveFace(uint64_t faceId)
Starts the FIB update process when a face has been destroyed.
RibTable::const_iterator const_iterator
Route * findLongestPrefix(const Name &prefix, const Route &route) const
void insert(const Name &prefix, const Route &route)
const_iterator end() const
signal::Signal< Rib, Name > afterEraseEntry
Signals after a RIB entry is erased.
std::list< shared_ptr< RibEntry > > RibEntryList
void onRouteExpiration(const Name &prefix, const Route &route)
bool empty() const noexcept
std::map< Name, shared_ptr< RibEntry > > RibTable
const_iterator find(const Name &prefix) const
void beginApplyUpdate(const RibUpdate &update, const UpdateSuccessCallback &onSuccess, const UpdateFailureCallback &onFailure)
Passes the provided RibUpdateBatch to FibUpdater to calculate and send FibUpdates.
std::function< void(uint32_t code, const std::string &error)> UpdateFailureCallback
shared_ptr< RibEntry > findParent(const Name &prefix) const
Represents a collection of RibUpdates to be applied to a single FaceId.
Represents a route that will be added to or removed from a namespace.
Represents a route for a name prefix.
#define NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
std::list< RibUpdate > RibUpdateList
friend bool operator<(const RibRouteRef &lhs, const RibRouteRef &rhs) noexcept
shared_ptr< RibEntry > entry
RibEntry::const_iterator route