33 #include <ndn-cxx/security/key-chain.hpp> 34 #include <ndn-cxx/util/signal.hpp> 35 #include <ndn-cxx/util/time.hpp> 37 #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);
187 const ndn::time::seconds&
190 return m_adjLsaBuildInterval;
196 return m_sequencingManager;
216 ndn::time::steady_clock::TimePoint deadline = DEFAULT_LSA_RETRIEVAL_DEADLINE);
232 doesNameLsaExist(
const ndn::Name& key);
244 doesCoordinateLsaExist(
const ndn::Name& key);
266 doesAdjLsaExist(
const ndn::Name& key);
274 scheduleNameLsaExpiration(
const ndn::Name& key,
int seqNo,
275 const ndn::time::seconds& expTime);
282 expireOrRefreshNameLsa(
const ndn::Name& lsaKey, uint64_t seqNo);
291 scheduleAdjLsaExpiration(
const ndn::Name& key,
int seqNo,
292 const ndn::time::seconds& expTime);
297 expireOrRefreshAdjLsa(
const ndn::Name& lsaKey, uint64_t seqNo);
300 scheduleCoordinateLsaExpiration(
const ndn::Name& key,
int seqNo,
301 const ndn::time::seconds& expTime);
304 expireOrRefreshCoordinateLsa(
const ndn::Name& lsaKey,
310 putLsaData(
const ndn::Interest& interest,
const std::string& content);
313 processInterestForNameLsa(
const ndn::Interest& interest,
314 const ndn::Name& lsaKey,
318 processInterestForAdjacencyLsa(
const ndn::Interest& interest,
319 const ndn::Name& lsaKey,
323 processInterestForCoordinateLsa(
const ndn::Interest& interest,
324 const ndn::Name& lsaKey,
327 onContentValidated(
const std::shared_ptr<const ndn::Data>& data);
330 processContentNameLsa(
const ndn::Name& lsaKey,
331 uint64_t lsSeqNo, std::string& dataContent);
334 processContentAdjacencyLsa(
const ndn::Name& lsaKey,
335 uint64_t lsSeqNo, std::string& dataContent);
338 processContentCoordinateLsa(
const ndn::Name& lsaKey,
339 uint64_t lsSeqNo, std::string& dataContent);
357 onFetchLsaError(uint32_t errorCode,
358 const std::string& msg,
359 ndn::Name& interestName,
360 uint32_t retransmitNo,
361 const ndn::time::steady_clock::TimePoint& deadline,
372 afterFetchLsa(
const ndn::ConstBufferPtr& data, ndn::Name& interestName);
375 ndn::time::system_clock::TimePoint
376 getLsaExpirationTimePoint();
380 cancelScheduleLsaExpiringEvent(ndn::EventId eid);
389 ndn::Scheduler& m_scheduler;
393 std::list<NameLsa> m_nameLsdb;
394 std::list<AdjLsa> m_adjLsdb;
395 std::list<CoordinateLsa> m_corLsdb;
397 ndn::time::seconds m_lsaRefreshTime;
398 std::string m_thisRouterPrefix;
400 typedef std::map<ndn::Name, uint64_t> SequenceNumberMap;
404 SequenceNumberMap m_highestSeqNo;
406 static const ndn::time::seconds GRACE_PERIOD;
407 static const ndn::time::steady_clock::TimePoint DEFAULT_LSA_RETRIEVAL_DEADLINE;
409 ndn::time::seconds m_adjLsaBuildInterval;
413 ndn::util::signal::ScopedConnection m_onNewLsaConnection;
418 #endif // NLSR_LSDB_HPP bool installAdjLsa(AdjLsa &alsa)
Installs an adj. LSA into the LSDB.
const std::list< NameLsa > & getNameLsdb() const
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)
Lsdb(Nlsr &nlsr, ndn::Scheduler &scheduler)
bool isLsaNew(const ndn::Name &routerName, const Lsa::Type &lsaType, const uint64_t &sequenceNumber)
SyncLogicHandler & getSyncLogicHandler()
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.
void setLsaRefreshTime(const ndn::time::seconds &lsaRefreshTime)
bool isNameLsaNew(const ndn::Name &key, uint64_t seqNo)
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.
LsaSegmentStorage & getLsaStorage()
ndn::util::signal::Signal< Lsdb, Statistics::PacketType > lsaIncrementSignal
void setThisRouterPrefix(std::string trp)
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.