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> 49 Lsdb(ndn::Face& face, ndn::KeyChain& keyChain,
50 ndn::security::SigningInfo& signingInfo,
ConfParameter& confParam,
56 isLsaNew(
const ndn::Name& routerName,
const Lsa::Type& lsaType,
const uint64_t& sequenceNumber);
99 const std::list<NameLsa>&
138 const std::list<CoordinateLsa>&
179 const std::list<AdjLsa>&
185 m_adjLsaBuildInterval = ndn::time::seconds(interval);
193 ndn::time::steady_clock::TimePoint deadline = DEFAULT_LSA_RETRIEVAL_DEADLINE);
207 return m_isBuildAdjLsaSheduled;
226 doesNameLsaExist(
const ndn::Name& key);
238 doesCoordinateLsaExist(
const ndn::Name& key);
260 doesAdjLsaExist(
const ndn::Name& key);
267 ndn::scheduler::EventId
268 scheduleNameLsaExpiration(
const ndn::Name& key,
int seqNo,
269 const ndn::time::seconds& expTime);
276 expireOrRefreshNameLsa(
const ndn::Name& lsaKey, uint64_t seqNo);
284 ndn::scheduler::EventId
285 scheduleAdjLsaExpiration(
const ndn::Name& key,
int seqNo,
286 const ndn::time::seconds& expTime);
290 expireOrRefreshAdjLsa(
const ndn::Name& lsaKey, uint64_t seqNo);
292 ndn::scheduler::EventId
293 scheduleCoordinateLsaExpiration(
const ndn::Name& key,
int seqNo,
294 const ndn::time::seconds& expTime);
297 expireOrRefreshCoordinateLsa(
const ndn::Name& lsaKey,
301 processInterestForNameLsa(
const ndn::Interest& interest,
302 const ndn::Name& lsaKey,
306 processInterestForAdjacencyLsa(
const ndn::Interest& interest,
307 const ndn::Name& lsaKey,
311 processInterestForCoordinateLsa(
const ndn::Interest& interest,
312 const ndn::Name& lsaKey,
316 onContentValidated(
const std::shared_ptr<const ndn::Data>& data);
319 processContentNameLsa(
const ndn::Name& lsaKey,
320 uint64_t lsSeqNo, std::string& dataContent);
323 processContentAdjacencyLsa(
const ndn::Name& lsaKey,
324 uint64_t lsSeqNo, std::string& dataContent);
327 processContentCoordinateLsa(
const ndn::Name& lsaKey,
328 uint64_t lsSeqNo, std::string& dataContent);
346 onFetchLsaError(uint32_t errorCode,
347 const std::string& msg,
348 const ndn::Name& interestName,
349 uint32_t retransmitNo,
350 const ndn::time::steady_clock::TimePoint& deadline,
361 afterFetchLsa(
const ndn::ConstBufferPtr& data,
const ndn::Name& interestName);
364 ndn::time::system_clock::TimePoint
365 getLsaExpirationTimePoint();
375 ndn::Scheduler m_scheduler;
376 ndn::security::SigningInfo& m_signingInfo;
386 std::list<NameLsa> m_nameLsdb;
387 std::list<AdjLsa> m_adjLsdb;
388 std::list<CoordinateLsa> m_corLsdb;
390 ndn::time::seconds m_lsaRefreshTime;
391 std::string m_thisRouterPrefix;
393 typedef std::map<ndn::Name, uint64_t> SequenceNumberMap;
397 SequenceNumberMap m_highestSeqNo;
399 static const ndn::time::seconds GRACE_PERIOD;
400 static const ndn::time::steady_clock::TimePoint DEFAULT_LSA_RETRIEVAL_DEADLINE;
403 ndn::time::seconds m_adjLsaBuildInterval;
408 ndn::util::signal::ScopedConnection m_onNewLsaConnection;
410 std::set<std::shared_ptr<ndn::util::SegmentFetcher>> m_fetchers;
411 psync::SegmentPublisher m_segmentPublisher;
413 bool m_isBuildAdjLsaSheduled;
414 int64_t m_adjBuildCount;
417 ndn::InMemoryStoragePersistent m_lsaStorage;
422 #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)
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.
const SyncLogicHandler & getSync()
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-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.