33 #include <ndn-cxx/security/key-chain.hpp> 34 #include <ndn-cxx/util/signal.hpp> 35 #include <ndn-cxx/util/time.hpp> 36 #include <ndn-cxx/util/segment-fetcher.hpp> 37 #include <ndn-cxx/ims/in-memory-storage-persistent.hpp> 39 #include <PSync/segment-publisher.hpp> 42 #include <boost/cstdint.hpp> 55 isLsaNew(
const ndn::Name& routerName,
const Lsa::Type& lsaType,
const uint64_t& sequenceNumber);
98 const std::list<NameLsa>&
137 const std::list<CoordinateLsa>&
178 const std::list<AdjLsa>&
184 m_adjLsaBuildInterval = ndn::time::seconds(interval);
192 ndn::time::steady_clock::TimePoint deadline = DEFAULT_LSA_RETRIEVAL_DEADLINE);
206 return m_isBuildAdjLsaSheduled;
225 doesNameLsaExist(
const ndn::Name& key);
237 doesCoordinateLsaExist(
const ndn::Name& key);
259 doesAdjLsaExist(
const ndn::Name& key);
266 ndn::scheduler::EventId
267 scheduleNameLsaExpiration(
const ndn::Name& key,
int seqNo,
268 const ndn::time::seconds& expTime);
275 expireOrRefreshNameLsa(
const ndn::Name& lsaKey, uint64_t seqNo);
283 ndn::scheduler::EventId
284 scheduleAdjLsaExpiration(
const ndn::Name& key,
int seqNo,
285 const ndn::time::seconds& expTime);
289 expireOrRefreshAdjLsa(
const ndn::Name& lsaKey, uint64_t seqNo);
291 ndn::scheduler::EventId
292 scheduleCoordinateLsaExpiration(
const ndn::Name& key,
int seqNo,
293 const ndn::time::seconds& expTime);
296 expireOrRefreshCoordinateLsa(
const ndn::Name& lsaKey,
300 processInterestForNameLsa(
const ndn::Interest& interest,
301 const ndn::Name& lsaKey,
305 processInterestForAdjacencyLsa(
const ndn::Interest& interest,
306 const ndn::Name& lsaKey,
310 processInterestForCoordinateLsa(
const ndn::Interest& interest,
311 const ndn::Name& lsaKey,
315 onContentValidated(
const std::shared_ptr<const ndn::Data>& data);
318 processContentNameLsa(
const ndn::Name& lsaKey,
319 uint64_t lsSeqNo, std::string& dataContent);
322 processContentAdjacencyLsa(
const ndn::Name& lsaKey,
323 uint64_t lsSeqNo, std::string& dataContent);
326 processContentCoordinateLsa(
const ndn::Name& lsaKey,
327 uint64_t lsSeqNo, std::string& dataContent);
345 onFetchLsaError(uint32_t errorCode,
346 const std::string& msg,
347 const ndn::Name& interestName,
348 uint32_t retransmitNo,
349 const ndn::time::steady_clock::TimePoint& deadline,
360 afterFetchLsa(
const ndn::ConstBufferPtr& data,
const ndn::Name& interestName);
363 emitSegmentValidatedSignal(
const ndn::Data& data)
369 ndn::time::system_clock::TimePoint
370 getLsaExpirationTimePoint();
380 ndn::Scheduler m_scheduler;
390 std::list<NameLsa> m_nameLsdb;
391 std::list<AdjLsa> m_adjLsdb;
392 std::list<CoordinateLsa> m_corLsdb;
394 ndn::time::seconds m_lsaRefreshTime;
395 std::string m_thisRouterPrefix;
397 typedef std::map<ndn::Name, uint64_t> SequenceNumberMap;
401 SequenceNumberMap m_highestSeqNo;
403 static const ndn::time::seconds GRACE_PERIOD;
404 static const ndn::time::steady_clock::TimePoint DEFAULT_LSA_RETRIEVAL_DEADLINE;
407 ndn::time::seconds m_adjLsaBuildInterval;
412 ndn::util::signal::ScopedConnection m_onNewLsaConnection;
414 std::set<std::shared_ptr<ndn::util::SegmentFetcher>> m_fetchers;
415 psync::SegmentPublisher m_segmentPublisher;
417 bool m_isBuildAdjLsaSheduled;
418 int64_t m_adjBuildCount;
419 ndn::scheduler::ScopedEventId m_scheduledAdjLsaBuild;
422 ndn::InMemoryStoragePersistent m_lsaStorage;
427 #endif // NLSR_LSDB_HPP bool installAdjLsa(AdjLsa &alsa)
Installs an adj. LSA into the LSDB.
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)
const std::list< NameLsa > & getNameLsdb() const
bool isLsaNew(const ndn::Name &routerName, const Lsa::Type &lsaType, const uint64_t &sequenceNumber)
const std::list< CoordinateLsa > & getCoordinateLsdb() const
Lsdb(ndn::Face &face, ndn::KeyChain &keyChain, ConfParameter &confParam, NamePrefixTable &namePrefixTable, RoutingTable &routingTable)
bool getIsBuildAdjLsaSheduled()
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)
bool installCoordinateLsa(CoordinateLsa &clsa)
Installs a cor. LSA into the LSDB.
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)
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-2019, 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.
const std::list< AdjLsa > & getAdjLsdb() const
SyncLogicHandler & getSync()
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.
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.