34 #include <ndn-cxx/security/key-chain.hpp> 35 #include <ndn-cxx/util/signal.hpp> 36 #include <ndn-cxx/util/time.hpp> 37 #include <ndn-cxx/util/segment-fetcher.hpp> 39 #include <PSync/segment-publisher.hpp> 42 #include <boost/cstdint.hpp> 49 Lsdb(ndn::Face& face, ndn::KeyChain& keyChain,
50 ndn::security::SigningInfo& signingInfo,
ConfParameter& confParam,
62 isLsaNew(
const ndn::Name& routerName,
const Lsa::Type& lsaType,
const uint64_t& sequenceNumber);
105 const std::list<NameLsa>&
144 const std::list<CoordinateLsa>&
185 const std::list<AdjLsa>&
191 m_adjLsaBuildInterval = ndn::time::seconds(interval);
194 const ndn::time::seconds&
197 return m_adjLsaBuildInterval;
203 return m_sequencingManager;
211 ndn::time::steady_clock::TimePoint deadline = DEFAULT_LSA_RETRIEVAL_DEADLINE);
225 return m_isBuildAdjLsaSheduled;
239 doesNameLsaExist(
const ndn::Name& key);
251 doesCoordinateLsaExist(
const ndn::Name& key);
273 doesAdjLsaExist(
const ndn::Name& key);
281 scheduleNameLsaExpiration(
const ndn::Name& key,
int seqNo,
282 const ndn::time::seconds& expTime);
289 expireOrRefreshNameLsa(
const ndn::Name& lsaKey, uint64_t seqNo);
298 scheduleAdjLsaExpiration(
const ndn::Name& key,
int seqNo,
299 const ndn::time::seconds& expTime);
304 expireOrRefreshAdjLsa(
const ndn::Name& lsaKey, uint64_t seqNo);
307 scheduleCoordinateLsaExpiration(
const ndn::Name& key,
int seqNo,
308 const ndn::time::seconds& expTime);
311 expireOrRefreshCoordinateLsa(
const ndn::Name& lsaKey,
317 processInterestForNameLsa(
const ndn::Interest& interest,
318 const ndn::Name& lsaKey,
322 processInterestForAdjacencyLsa(
const ndn::Interest& interest,
323 const ndn::Name& lsaKey,
327 processInterestForCoordinateLsa(
const ndn::Interest& interest,
328 const ndn::Name& lsaKey,
331 onContentValidated(
const std::shared_ptr<const ndn::Data>& data);
334 processContentNameLsa(
const ndn::Name& lsaKey,
335 uint64_t lsSeqNo, std::string& dataContent);
338 processContentAdjacencyLsa(
const ndn::Name& lsaKey,
339 uint64_t lsSeqNo, std::string& dataContent);
342 processContentCoordinateLsa(
const ndn::Name& lsaKey,
343 uint64_t lsSeqNo, std::string& dataContent);
361 onFetchLsaError(uint32_t errorCode,
362 const std::string& msg,
363 const ndn::Name& interestName,
364 uint32_t retransmitNo,
365 const ndn::time::steady_clock::TimePoint& deadline,
376 afterFetchLsa(
const ndn::ConstBufferPtr& data,
const ndn::Name& interestName);
379 ndn::time::system_clock::TimePoint
380 getLsaExpirationTimePoint();
384 cancelScheduleLsaExpiringEvent(ndn::EventId eid);
394 ndn::Scheduler m_scheduler;
395 ndn::security::SigningInfo& m_signingInfo;
406 std::list<NameLsa> m_nameLsdb;
407 std::list<AdjLsa> m_adjLsdb;
408 std::list<CoordinateLsa> m_corLsdb;
410 ndn::time::seconds m_lsaRefreshTime;
411 std::string m_thisRouterPrefix;
413 typedef std::map<ndn::Name, uint64_t> SequenceNumberMap;
417 SequenceNumberMap m_highestSeqNo;
419 static const ndn::time::seconds GRACE_PERIOD;
420 static const ndn::time::steady_clock::TimePoint DEFAULT_LSA_RETRIEVAL_DEADLINE;
422 ndn::time::seconds m_adjLsaBuildInterval;
426 ndn::util::signal::ScopedConnection m_onNewLsaConnection;
428 std::set<std::shared_ptr<ndn::util::SegmentFetcher>> m_fetchers;
429 psync::SegmentPublisher m_segmentPublisher;
431 bool m_isBuildAdjLsaSheduled;
432 int64_t m_adjBuildCount;
437 #endif // NLSR_LSDB_HPP bool installAdjLsa(AdjLsa &alsa)
Installs an adj. LSA into the LSDB.
const std::list< NameLsa > & getNameLsdb() const
A class to house all the configuration parameters for NLSR.
void scheduleAdjLsaBuild()
Schedules a build of this router's LSA.
bool removeNameLsa(const ndn::Name &key)
Remove a name LSA from the LSDB.
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
void setAdjLsaBuildInterval(uint32_t interval)
bool isLsaNew(const ndn::Name &routerName, const Lsa::Type &lsaType, const uint64_t &sequenceNumber)
SyncLogicHandler & getSyncLogicHandler()
bool getIsBuildAdjLsaSheduled()
const std::list< CoordinateLsa > & getCoordinateLsdb() const
bool isCoordinateLsaNew(const ndn::Name &key, uint64_t seqNo)
Returns whether a cor. LSA from a router is new or not.
CoordinateLsa * findCoordinateLsa(const ndn::Name &key)
Finds a cor. LSA in the LSDB.
ndn::util::signal::Signal< Lsdb, const ndn::Data & > afterSegmentValidatedSignal
bool isNameLsaNew(const ndn::Name &key, uint64_t seqNo)
Lsdb(ndn::Face &face, ndn::KeyChain &keyChain, ndn::security::SigningInfo &signingInfo, ConfParameter &confParam, NamePrefixTable &namePrefixTable, RoutingTable &routingTable)
bool installCoordinateLsa(CoordinateLsa &clsa)
Installs a cor. LSA into the LSDB.
SequencingManager & getSequencingManager()
NLSR-to-ChronoSync interaction point.
NameLsa * findNameLsa(const ndn::Name &key)
Returns the name LSA with the given key.
void processInterest(const ndn::Name &name, const ndn::Interest &interest)
void expressInterest(const ndn::Name &interestName, uint32_t timeoutCount, ndn::time::steady_clock::TimePoint deadline=DEFAULT_LSA_RETRIEVAL_DEADLINE)
bool doesLsaExist(const ndn::Name &key, const Lsa::Type &lsType)
const ndn::time::seconds & getAdjLsaBuildInterval() const
bool isAdjLsaNew(const ndn::Name &key, uint64_t seqNo)
Returns whether an LSA is new.
bool removeAdjLsa(const ndn::Name &key)
Removes an adj. LSA from the LSDB.
static const ndn::Name::Component NAME_COMPONENT
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
ndn::util::signal::Signal< Lsdb, Statistics::PacketType > lsaIncrementSignal
bool installNameLsa(NameLsa &nlsa)
Installs a name LSA into the LSDB.
bool buildAndInstallOwnNameLsa()
Builds a name LSA for this router and then installs it into the LSDB.
bool buildAndInstallOwnCoordinateLsa()
Builds a cor. LSA for this router and installs it into the LSDB.
const std::list< AdjLsa > & getAdjLsdb() const
AdjLsa * findAdjLsa(const ndn::Name &key)
Finds an adj. LSA in the LSDB.
bool buildAndInstallOwnAdjLsa()
Wrapper event to build and install an adj. LSA for this router.
bool removeCoordinateLsa(const ndn::Name &key)
Removes a cor. LSA from the LSDB.