35 : onNewLsa(std::make_unique<
OnNewLsa>())
37 , m_isLsaNew(isLsaNew)
39 , m_nameLsaUserPrefix(
ndn::Name(m_confParam.getSyncUserPrefix()).append(boost::lexical_cast<std::string>(
Lsa::Type::NAME)))
40 , m_syncLogic(m_syncFace, m_confParam.getSyncProtocol(), m_confParam.getSyncPrefix(),
41 m_nameLsaUserPrefix, m_confParam.getSyncInterestLifetime(),
59 SyncLogicHandler::processUpdate(
const ndn::Name& updateName, uint64_t highSeq)
61 NLSR_LOG_DEBUG(
"Update Name: " << updateName <<
" Seq no: " << highSeq);
66 if (nlsrPosition < 0 || lsaPosition < 0) {
71 ndn::Name networkName = updateName.getSubName(1, nlsrPosition-1);
72 ndn::Name routerName = updateName.getSubName(lsaPosition + 1).getPrefix(-1);
74 ndn::Name originRouter = networkName;
75 originRouter.append(routerName);
77 processUpdateFromSync(originRouter, updateName, highSeq);
81 SyncLogicHandler::processUpdateFromSync(
const ndn::Name& originRouter,
82 const ndn::Name& updateName, uint64_t seqNo)
90 std::istringstream(updateName.get(updateName.size()-1).toUri()) >> lsaType;
93 " sequence number than entry in LSDB");
95 if (m_isLsaNew(originRouter, lsaType, seqNo)) {
98 NLSR_LOG_ERROR(
"Got an update for adjacency LSA when hyperbolic routing " <<
99 "is enabled. Not going to fetch.");
105 NLSR_LOG_ERROR(
"Got an update for coordinate LSA when link-state " <<
106 "is enabled. Not going to fetch.");
109 (*onNewLsa)(updateName, seqNo, originRouter);
A class to house all the configuration parameters for NLSR.
int32_t getHyperbolicState() const
const ndn::Name & getSyncUserPrefix() const
const ndn::Name & getRouterPrefix() const
Data abstraction for Lsa Lsa := LSA-TYPE TLV-LENGTH Name SequenceNumber ExpirationTimePoint.
NLSR-to-ChronoSync interaction point.
void publishRoutingUpdate(const Lsa::Type &type, const uint64_t &seqNo)
Instruct ChronoSync to publish an update.
SyncLogicHandler(ndn::Face &face, const IsLsaNew &isLsaNew, const ConfParameter &conf)
std::function< bool(const ndn::Name &, const Lsa::Type &lsaType, const uint64_t &)> IsLsaNew
void publishUpdate(const ndn::Name &userPrefix, uint64_t seq)
Publish update to ChronoSync or PSync.
void addUserNode(const ndn::Name &userPrefix)
Add user node to ChronoSync or PSync.
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California.
#define NLSR_LOG_DEBUG(x)
#define INIT_LOGGER(name)
#define NLSR_LOG_ERROR(x)
int32_t getNameComponentPosition(const ndn::Name &name, const std::string &searchString)
search a name component in ndn::Name and return the position of the component
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California,...
ndn::util::Signal< SyncLogicHandler, const ndn::Name &, const uint64_t &, const ndn::Name & > OnNewLsa