26 #ifndef NFD_RIB_RIB_HPP
27 #define NFD_RIB_RIB_HPP
32 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
37 using ndn::nfd::ControlParameters;
43 class Rib : noncopyable
47 typedef std::map<Name, shared_ptr<RibEntry>>
RibTable;
51 typedef std::set<Route, RouteComparePredicate>
RouteSet;
61 find(
const Name& prefix)
const;
64 find(
const Name& prefix,
const Route& route)
const;
84 std::list<shared_ptr<RibEntry>>
95 std::list<shared_ptr<RibEntry>>
112 const UpdateSuccessCallback& onSuccess,
113 const UpdateFailureCallback& onFailure);
127 uint32_t code,
const std::string& error);
133 insert(
const Name& prefix,
const Route& route);
147 addUpdateToQueue(
const RibUpdate& update,
159 sendBatchFromQueue();
163 function<void(RibUpdateBatch)> m_onSendBatchFromQueue;
166 erase(
const Name& prefix,
const Route& route);
180 getAncestorRoutes(
const RibEntry& entry)
const;
189 getAncestorRoutes(
const Name& name)
const;
198 typedef std::pair<const Name&,const Route&> NameAndRoute;
200 std::list<NameAndRoute>
201 findRoutesWithFaceId(uint64_t faceId);
209 FaceLookupTable m_faceMap;
217 struct UpdateQueueItem
225 typedef std::list<UpdateQueueItem> UpdateQueue;
226 UpdateQueue m_updateBatches;
229 bool m_isUpdateInProgress;
235 return m_rib.begin();
253 return m_rib.empty();
262 #endif // NFD_RIB_RIB_HPP
bool(* RouteComparePredicate)(const Route &, const Route &)
std::set< Route, RouteComparePredicate > RouteSet
void onFibUpdateFailure(const Rib::UpdateFailureCallback &onFailure, uint32_t code, const std::string &error)
computes FibUpdates based on updates to the RIB and sends them to NFD
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
const_iterator find(const Name &prefix) const
std::list< shared_ptr< RibEntry > > findDescendantsForNonInsertedName(const Name &prefix) const
finds namespaces under the passed prefix
represents a collection of RibUpdates to be applied to a single FaceId
void setFibUpdater(FibUpdater *updater)
ndn::util::signal::Signal< Rib, Name > afterEraseEntry
const_iterator end() const
Table::const_iterator iterator
std::list< RibUpdate > RibUpdateList
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
std::list< shared_ptr< RibEntry > > RibEntryList
function< void(uint32_t code, const std::string &error)> UpdateFailureCallback
void insert(const Name &prefix, const Route &route)
std::list< shared_ptr< RibEntry > > findDescendants(const Name &prefix) const
finds namespaces under the passed prefix
represents a route for a name prefix
std::map< Name, shared_ptr< RibEntry > > RibTable
const_iterator begin() const
function< void()> UpdateSuccessCallback
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
void onFibUpdateSuccess(const RibUpdateBatch &batch, const RibUpdateList &inheritedRoutes, const Rib::UpdateSuccessCallback &onSuccess)
RibTable::const_iterator const_iterator
represents a RIB entry, which contains one or more Routes with the same prefix
void beginRemoveFace(uint64_t faceId)
starts the FIB update process when a face has been destroyed
std::map< uint64_t, std::list< shared_ptr< RibEntry > > > FaceLookupTable
void onRouteExpiration(const Name &prefix, const Route &route)
void beginApplyUpdate(const RibUpdate &update, const UpdateSuccessCallback &onSuccess, const UpdateFailureCallback &onFailure)
passes the provided RibUpdateBatch to FibUpdater to calculate and send FibUpdates.
ndn::util::signal::Signal< Rib, Name > afterInsertEntry
shared_ptr< RibEntry > findParent(const Name &prefix) const