32 #include <ndn-cxx/security/key-chain.hpp> 33 #include <ndn-cxx/util/signal.hpp> 34 #include <ndn-cxx/util/time.hpp> 36 #include <boost/cstdint.hpp> 54 isLsaNew(
const ndn::Name& routerName,
const Lsa::Type& lsaType,
const uint64_t& sequenceNumber);
97 const std::list<NameLsa>&
136 const std::list<CoordinateLsa>&
177 const std::list<AdjLsa>&
183 m_adjLsaBuildInterval = ndn::time::seconds(interval);
186 const ndn::time::seconds&
189 return m_adjLsaBuildInterval;
195 return m_sequencingManager;
209 ndn::time::steady_clock::TimePoint deadline = DEFAULT_LSA_RETRIEVAL_DEADLINE);
225 doesNameLsaExist(
const ndn::Name& key);
237 doesCoordinateLsaExist(
const ndn::Name& key);
259 doesAdjLsaExist(
const ndn::Name& key);
267 scheduleNameLsaExpiration(
const ndn::Name& key,
int seqNo,
268 const ndn::time::seconds& expTime);
275 expireOrRefreshNameLsa(
const ndn::Name& lsaKey, uint64_t seqNo);
284 scheduleAdjLsaExpiration(
const ndn::Name& key,
int seqNo,
285 const ndn::time::seconds& expTime);
290 expireOrRefreshAdjLsa(
const ndn::Name& lsaKey, uint64_t seqNo);
293 scheduleCoordinateLsaExpiration(
const ndn::Name& key,
int seqNo,
294 const ndn::time::seconds& expTime);
297 expireOrRefreshCoordinateLsa(
const ndn::Name& lsaKey,
303 putLsaData(
const ndn::Interest& interest,
const std::string& content);
306 processInterestForNameLsa(
const ndn::Interest& interest,
307 const ndn::Name& lsaKey,
311 processInterestForAdjacencyLsa(
const ndn::Interest& interest,
312 const ndn::Name& lsaKey,
316 processInterestForCoordinateLsa(
const ndn::Interest& interest,
317 const ndn::Name& lsaKey,
320 onContentValidated(
const std::shared_ptr<const ndn::Data>& data);
323 processContentNameLsa(
const ndn::Name& lsaKey,
324 uint64_t lsSeqNo, std::string& dataContent);
327 processContentAdjacencyLsa(
const ndn::Name& lsaKey,
328 uint64_t lsSeqNo, std::string& dataContent);
331 processContentCoordinateLsa(
const ndn::Name& lsaKey,
332 uint64_t lsSeqNo, std::string& dataContent);
350 onFetchLsaError(uint32_t errorCode,
351 const std::string& msg,
352 ndn::Name& interestName,
353 uint32_t retransmitNo,
354 const ndn::time::steady_clock::TimePoint& deadline,
365 afterFetchLsa(
const ndn::ConstBufferPtr& data, ndn::Name& interestName);
368 ndn::time::system_clock::TimePoint
369 getLsaExpirationTimePoint();
373 cancelScheduleLsaExpiringEvent(ndn::EventId eid);
382 ndn::Scheduler& m_scheduler;
385 std::list<NameLsa> m_nameLsdb;
386 std::list<AdjLsa> m_adjLsdb;
387 std::list<CoordinateLsa> m_corLsdb;
389 ndn::time::seconds m_lsaRefreshTime;
390 std::string m_thisRouterPrefix;
392 typedef std::map<ndn::Name, uint64_t> SequenceNumberMap;
396 SequenceNumberMap m_highestSeqNo;
398 static const ndn::time::seconds GRACE_PERIOD;
399 static const ndn::time::steady_clock::TimePoint DEFAULT_LSA_RETRIEVAL_DEADLINE;
401 ndn::time::seconds m_adjLsaBuildInterval;
405 ndn::util::signal::ScopedConnection m_onNewLsaConnection;
411 #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-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
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.