42 #include <boost/cstdint.hpp> 44 #include <boost/throw_exception.hpp> 46 #include <ndn-cxx/face.hpp> 47 #include <ndn-cxx/security/key-chain.hpp> 48 #include <ndn-cxx/security/validator-config.hpp> 49 #include <ndn-cxx/security/v2/certificate-fetcher-direct-fetch.hpp> 50 #include <ndn-cxx/security/signing-helpers.hpp> 51 #include <ndn-cxx/security/signing-info.hpp> 52 #include <ndn-cxx/util/scheduler.hpp> 53 #include <ndn-cxx/mgmt/nfd/face-event-notification.hpp> 54 #include <ndn-cxx/mgmt/nfd/face-monitor.hpp> 55 #include <ndn-cxx/mgmt/dispatcher.hpp> 56 #include <ndn-cxx/mgmt/nfd/face-status.hpp> 57 #include <ndn-cxx/data.hpp> 58 #include <ndn-cxx/encoding/block.hpp> 59 #include <ndn-cxx/encoding/nfd-constants.hpp> 60 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp> 61 #include <ndn-cxx/mgmt/nfd/control-response.hpp> 73 class Error :
public std::runtime_error
78 :
std::runtime_error(what)
83 Nlsr(boost::asio::io_service& ioService, ndn::Scheduler& scheduler, ndn::Face& face, ndn::KeyChain& keyChain);
111 return m_configFileName;
117 m_configFileName = fileName;
123 return m_isDaemonProcess;
129 m_isDaemonProcess = value;
141 return m_adjacencyList;
147 return m_namePrefixList;
165 return m_routingTable;
171 return m_namePrefixTable;
183 return m_adjBuildCount;
195 m_adjBuildCount = abc;
201 return m_isBuildAdjLsaSheduled;
207 m_isBuildAdjLsaSheduled = iabls;
213 return m_isRoutingTableCalculating;
219 m_isRoutingTableCalculating = irtc;
225 return m_isRouteCalculationScheduled;
231 m_isRouteCalculationScheduled = ircs;
237 return m_lsdbDatasetHandler;
259 const std::string& reason,
260 uint32_t nRetriesSoFar);
286 const ndn::time::milliseconds& timeout);
300 const std::string& filename)
302 m_validator.load(section, filename);
305 ndn::security::ValidatorConfig&
319 const ndn::security::v2::Certificate*
322 const ndn::security::v2::Certificate* cert =
323 m_certStore.find(certificateKeyName);
328 ndn::security::v2::KeyChain&
337 return m_defaultCertName;
340 const ndn::security::SigningInfo&
343 return m_signingInfo;
349 return m_prefixUpdateProcessor;
355 return m_nfdRibCommandProcessor;
358 ndn::mgmt::Dispatcher&
361 return m_localhostDispatcher;
364 ndn::mgmt::Dispatcher&
367 return m_routerNameDispatcher;
379 return m_firstHelloInterval;
399 std::function<
void(std::list<Adjacent>::iterator)> then,
400 std::function<
void(
void)>
finally);
405 return m_statsCollector;
411 getCertificateStore()
425 registerLocalhostPrefix();
430 onKeyInterest(
const ndn::Name& name,
const ndn::Interest& interest);
435 onKeyPrefixRegSuccess(
const ndn::Name& name);
440 onFaceEventNotification(
const ndn::nfd::FaceEventNotification& faceEventNotification);
443 setFirstHelloInterval(uint32_t interval)
445 m_firstHelloInterval = interval;
456 canonizeContinuation(std::list<Adjacent>::iterator iterator,
457 std::function<
void(
void)>
finally);
460 scheduleDatasetFetch();
470 enableIncomingFaceIdIndication();
473 onFaceIdIndicationSuccess(
const ndn::nfd::ControlParameters& cp);
476 onFaceIdIndicationFailure(
const ndn::nfd::ControlResponse& cr);
482 ndn::Face& m_nlsrFace;
483 ndn::Scheduler& m_scheduler;
484 ndn::security::v2::KeyChain& m_keyChain;
488 bool m_isDaemonProcess;
489 std::string m_configFileName;
491 int64_t m_adjBuildCount;
492 bool m_isBuildAdjLsaSheduled;
493 bool m_isRouteCalculationScheduled;
494 bool m_isRoutingTableCalculating;
499 ndn::mgmt::Dispatcher m_localhostDispatcher;
500 ndn::mgmt::Dispatcher m_routerNameDispatcher;
507 ndn::security::ValidatorConfig m_validator;
515 ndn::nfd::Controller m_controller;
516 ndn::nfd::Controller m_faceDatasetController;
517 ndn::security::SigningInfo m_signingInfo;
518 ndn::Name m_defaultCertName;
523 ndn::nfd::FaceMonitor m_faceMonitor;
525 uint32_t m_firstHelloInterval;
532 #endif // NLSR_NLSR_HPP
void initializeFaces(const FetchDatasetCallback &onFetchSuccess, const FetchDatasetTimeoutCallback &onFetchFailure)
Initializes neighbors' Faces using information from NFD.
void onFaceDatasetFetchTimeout(uint32_t code, const std::string &reason, uint32_t nRetriesSoFar)
ndn::mgmt::Dispatcher & getLocalhostDispatcher()
A class to house all the configuration parameters for NLSR.
bool getIsBuildAdjLsaSheduled()
std::string getConfFileName() const
std::function< void(uint32_t, const std::string &)> FetchDatasetTimeoutCallback
Class to publish all lsa dataset.
Store certificates for names.
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
ConfParameter & getConfParameter()
void setIsDaemonProcess(bool value)
A wrapper class to instantiate and configure an NLSR object.
Error(const std::string &what)
NamePrefixTable & getNamePrefixTable()
update::NfdRibCommandProcessor & getNfdRibCommandProcessor()
ndn::mgmt::Dispatcher & getRouterNameDispatcher()
std::function< void(const std::vector< ndn::nfd::FaceStatus > &)> FetchDatasetCallback
void incrementAdjBuildCount()
uint32_t getFirstHelloInterval() const
RoutingTable & getRoutingTable()
StatsCollector & getStatsCollector()
LsdbDatasetInterestHandler & getLsdbDatasetHandler()
Maps names to lists of next hops, and exports this information to NFD.
bool getIsSetDaemonProcess()
void setLsaInterestFilter()
void addDispatcherTopPrefix(const ndn::Name &topPrefix)
Add top level prefixes for Dispatcher.
static const ndn::Name LOCALHOST_PREFIX
void registerAdjacencyPrefixes(const Adjacent &adj, const ndn::time::milliseconds &timeout)
Registers NLSR-specific prefixes for a neighbor (Adjacent)
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California.
void canonizeNeighborUris(std::list< Adjacent >::iterator currentNeighbor, std::function< void(std::list< Adjacent >::iterator)> then, std::function< void(void)> finally)
Canonize the URI for this and all proceeding neighbors in a list.
AdjacencyList & getAdjacencyList()
const ndn::Name & getDefaultCertName()
void setIsRouteCalculationScheduled(bool ircs)
void setAdjBuildCount(int64_t abc)
bool getIsRoutingTableCalculating()
void onRegistrationSuccess(const ndn::Name &name)
ndn::security::v2::KeyChain & getKeyChain()
void loadCertToPublish(const ndn::security::v2::Certificate &certificate)
Add a certificate NLSR claims to be authoritative for to the certificate store.
void setConfFileName(const std::string &fileName)
update::PrefixUpdateProcessor & getPrefixUpdateProcessor()
void setInfoInterestFilter()
bool getIsRouteCalculationScheduled()
void loadValidator(boost::property_tree::ptree section, const std::string &filename)
void setIsBuildAdjLsaSheduled(bool iabls)
A neighbor reachable over a Face.
void registrationFailed(const ndn::Name &name)
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
NamePrefixList & getNamePrefixList()
void setIsRoutingTableCalculating(bool irtc)
long int getAdjBuildCount()
const ndn::security::v2::Certificate * getCertificate(const ndn::Name &certificateKeyName)
Find a certificate.
ndn::Face & getNlsrFace()
Nlsr(boost::asio::io_service &ioService, ndn::Scheduler &scheduler, ndn::Face &face, ndn::KeyChain &keyChain)
static ndn::Name DEFAULT_BROADCAST_PREFIX("/ndn/broadcast")
const ndn::security::SigningInfo & getSigningInfo()
ndn::security::ValidatorConfig & getValidator()
void processFaceDataset(const std::vector< ndn::nfd::FaceStatus > &faces)
Consumes a Face StatusDataset to configure NLSR neighbors.