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;
135 return m_adjacencyList;
141 return m_adjacencyList;
147 return m_namePrefixList;
153 return m_namePrefixList;
171 return m_routingTable;
177 return m_namePrefixTable;
189 return m_adjBuildCount;
201 m_adjBuildCount = abc;
207 return m_isBuildAdjLsaSheduled;
213 m_isBuildAdjLsaSheduled = iabls;
219 return m_isRoutingTableCalculating;
225 m_isRoutingTableCalculating = irtc;
231 return m_isRouteCalculationScheduled;
237 m_isRouteCalculationScheduled = ircs;
243 return m_datasetHandler;
265 const std::string& reason,
266 uint32_t nRetriesSoFar);
292 const ndn::time::milliseconds& timeout);
321 const std::string& filename)
323 m_validator.load(section, filename);
326 ndn::security::ValidatorConfig&
340 const ndn::security::v2::Certificate*
343 const ndn::security::v2::Certificate* cert =
344 m_certStore.find(certificateKeyName);
349 ndn::security::v2::KeyChain&
358 return m_defaultCertName;
361 const ndn::security::SigningInfo&
364 return m_signingInfo;
370 return m_prefixUpdateProcessor;
376 return m_nfdRibCommandProcessor;
379 ndn::mgmt::Dispatcher&
391 return m_firstHelloInterval;
411 std::function<
void(std::list<Adjacent>::iterator)> then,
412 std::function<
void(
void)>
finally);
417 return m_statsCollector;
423 getCertificateStore()
437 registerLocalhostPrefix();
442 onKeyInterest(
const ndn::Name& name,
const ndn::Interest& interest);
447 onKeyPrefixRegSuccess(
const ndn::Name& name);
452 onFaceEventNotification(
const ndn::nfd::FaceEventNotification& faceEventNotification);
455 setFirstHelloInterval(uint32_t interval)
457 m_firstHelloInterval = interval;
468 canonizeContinuation(std::list<Adjacent>::iterator iterator,
469 std::function<
void(
void)>
finally);
472 scheduleDatasetFetch();
482 enableIncomingFaceIdIndication();
485 onFaceIdIndicationSuccess(
const ndn::nfd::ControlParameters& cp);
488 onFaceIdIndicationFailure(
const ndn::nfd::ControlResponse& cr);
494 ndn::Face& m_nlsrFace;
495 ndn::Scheduler& m_scheduler;
496 ndn::security::v2::KeyChain& m_keyChain;
500 std::string m_configFileName;
502 int64_t m_adjBuildCount;
503 bool m_isBuildAdjLsaSheduled;
504 bool m_isRouteCalculationScheduled;
505 bool m_isRoutingTableCalculating;
510 ndn::mgmt::Dispatcher m_dispatcher;
517 ndn::security::ValidatorConfig m_validator;
525 ndn::nfd::Controller m_controller;
526 ndn::nfd::Controller m_faceDatasetController;
527 ndn::security::SigningInfo m_signingInfo;
528 ndn::Name m_defaultCertName;
533 ndn::nfd::FaceMonitor m_faceMonitor;
535 uint32_t m_firstHelloInterval;
542 #endif // NLSR_NLSR_HPP
const AdjacencyList & getAdjacencyList() const
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)
A class to house all the configuration parameters for NLSR.
Class to publish all dataset.
bool getIsBuildAdjLsaSheduled()
std::string getConfFileName() const
std::function< void(uint32_t, const std::string &)> FetchDatasetTimeoutCallback
Store certificates for names.
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
ConfParameter & getConfParameter()
A wrapper class to instantiate and configure an NLSR object.
DatasetInterestHandler & getDatasetHandler()
Error(const std::string &what)
NamePrefixTable & getNamePrefixTable()
update::NfdRibCommandProcessor & getNfdRibCommandProcessor()
void connectToFetcher(ndn::util::SegmentFetcher &fetcher)
std::function< void(const std::vector< ndn::nfd::FaceStatus > &)> FetchDatasetCallback
void incrementAdjBuildCount()
uint32_t getFirstHelloInterval() const
RoutingTable & getRoutingTable()
const ConfParameter & getConfParameter() const
StatsCollector & getStatsCollector()
Maps names to lists of next hops, and exports this information to NFD.
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()
const NamePrefixList & getNamePrefixList() const
void onRegistrationSuccess(const ndn::Name &name)
ndn::security::v2::KeyChain & getKeyChain()
ndn::mgmt::Dispatcher & getDispatcher()
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)
void publishCertFromCache(const ndn::Name &keyName)
Retrieves the chain of certificates from Validator's cache and store them in Nlsr's own CertificateSt...
update::PrefixUpdateProcessor & getPrefixUpdateProcessor()
void setInfoInterestFilter()
void afterFetcherSignalEmitted(const ndn::Data &lsaSegment)
Callback when SegmentFetcher retrieves a segment.
bool getIsRouteCalculationScheduled()
void loadValidator(boost::property_tree::ptree section, const std::string &filename)
void setIsBuildAdjLsaSheduled(bool iabls)
A neighbor reachable over a Face.
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
void registrationFailed(const ndn::Name &name)
Copyright (c) 2014-2018, 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.