26 #ifndef NFD_RIB_RIB_MANAGER_HPP 27 #define NFD_RIB_RIB_MANAGER_HPP 35 #include <ndn-cxx/security/validator-config.hpp> 36 #include <ndn-cxx/mgmt/nfd/controller.hpp> 37 #include <ndn-cxx/mgmt/nfd/face-event-notification.hpp> 38 #include <ndn-cxx/mgmt/nfd/face-monitor.hpp> 39 #include <ndn-cxx/util/scheduler.hpp> 50 class Error :
public std::runtime_error
53 using std::runtime_error::runtime_error;
56 RibManager(
Rib& rib, ndn::Face& face, ndn::KeyChain& keyChain, ndn::nfd::Controller& nfdController,
57 Dispatcher& dispatcher, ndn::util::Scheduler& scheduler);
120 slAnnounce(
const ndn::PrefixAnnouncement& pa, uint64_t faceId, time::milliseconds maxLifetime,
142 slRenew(
const Name& name, uint64_t faceId, time::milliseconds maxLifetime,
160 enum class RibUpdateResult
168 getSlAnnounceResultFromRibUpdateResult(RibUpdateResult r);
177 beginAddRoute(
const Name& name,
Route route, optional<time::nanoseconds> expires,
178 const std::function<
void(RibUpdateResult)>& done);
186 beginRemoveRoute(
const Name& name,
const Route& route,
187 const std::function<
void(RibUpdateResult)>& done);
190 beginRibUpdate(
const RibUpdate& update,
const std::function<
void(RibUpdateResult)>& done);
194 registerTopPrefix(
const Name& topPrefix);
199 registerEntry(
const Name& topPrefix,
const Interest& interest,
200 ControlParameters parameters,
201 const ndn::mgmt::CommandContinuation& done);
206 unregisterEntry(
const Name& topPrefix,
const Interest& interest,
207 ControlParameters parameters,
208 const ndn::mgmt::CommandContinuation& done);
213 listEntries(
const Name& topPrefix,
const Interest& interest,
214 ndn::mgmt::StatusDatasetContext& context);
217 setFaceForSelfRegistration(
const Interest& request, ControlParameters& parameters);
219 ndn::mgmt::Authorization
220 makeAuthorization(
const std::string& verb)
override;
227 onFetchActiveFacesFailure(uint32_t code,
const std::string& reason);
230 onFaceDestroyedEvent(uint64_t faceId);
234 scheduleActiveFaceFetch(
const time::seconds& timeToWait);
237 removeInvalidFaces(
const std::vector<ndn::nfd::FaceStatus>& activeFaces);
240 onNotification(
const ndn::nfd::FaceEventNotification& notification);
247 ndn::KeyChain& m_keyChain;
248 ndn::nfd::Controller& m_nfdController;
249 Dispatcher& m_dispatcher;
250 ndn::util::Scheduler& m_scheduler;
252 ndn::nfd::FaceMonitor m_faceMonitor;
253 ndn::ValidatorConfig m_localhostValidator;
254 ndn::ValidatorConfig m_localhopValidator;
255 bool m_isLocalhopEnabled;
257 ndn::util::scheduler::ScopedEventId m_activeFaceFetchEvent;
258 using FaceIdSet = std::set<uint64_t>;
259 FaceIdSet m_registeredFaces;
268 #endif // NFD_RIB_RIB_MANAGER_HPP
Serve commands and datasets in NFD RIB management protocol.
void slFindAnn(const Name &name, const SlFindAnnCallback &cb) const
Retrieve an outgoing prefix announcement for self-learning strategy.
represents the Routing Information Base
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
static const Name LOCALHOP_TOP_PREFIX
std::function< void(SlAnnounceResult res)> SlAnnounceCallback
void enableLocalhop(const ConfigSection §ion, const std::string &filename)
Apply localhop_security configuration and allow accepting commands on /localhop/nfd/rib prefix...
void registerWithNfd()
Start accepting commands and dataset requests.
void applyLocalhostConfig(const ConfigSection §ion, const std::string &filename)
Apply localhost_security configuration.
void enableLocalFields()
Enable NDNLP IncomingFaceId field in order to support self-registration commands. ...
a collection of common functions shared by all NFD managers and RIB manager, such as communicating wi...
boost::property_tree::ptree ConfigSection
a config file section
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
void slRenew(const Name &name, uint64_t faceId, time::milliseconds maxLifetime, const SlAnnounceCallback &cb)
Renew a route created by prefix announcement from self-learning strategy.
represents a route for a name prefix
void disableLocalhop()
Disallow accepting commands on /localhop/nfd/rib prefix.
std::function< void(optional< ndn::PrefixAnnouncement >)> SlFindAnnCallback
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
void slAnnounce(const ndn::PrefixAnnouncement &pa, uint64_t faceId, time::milliseconds maxLifetime, const SlAnnounceCallback &cb)
Insert a route by prefix announcement from self-learning strategy.
RibManager(Rib &rib, ndn::Face &face, ndn::KeyChain &keyChain, ndn::nfd::Controller &nfdController, Dispatcher &dispatcher, ndn::util::Scheduler &scheduler)