40 , m_isLsaNew(isLsaNew)
42 , m_nameLsaUserPrefix(
ndn::Name(m_confParam.getSyncUserPrefix()).append(
std::to_string(
Lsa::Type::NAME)))
43 , m_syncLogic(m_syncFace, m_confParam.getSyncProtocol(), m_confParam.getSyncPrefix(),
44 m_nameLsaUserPrefix, m_confParam.getSyncInterestLifetime(),
63 SyncLogicHandler::processUpdate(
const ndn::Name& updateName, uint64_t highSeq)
65 NLSR_LOG_DEBUG(
"Update Name: " << updateName <<
" Seq no: " << highSeq);
70 if (nlsrPosition < 0 || lsaPosition < 0) {
75 ndn::Name networkName = updateName.getSubName(1, nlsrPosition-1);
76 ndn::Name routerName = updateName.getSubName(lsaPosition + 1).getPrefix(-1);
78 ndn::Name originRouter = networkName;
79 originRouter.append(routerName);
81 processUpdateFromSync(originRouter, updateName, highSeq);
85 SyncLogicHandler::processUpdateFromSync(
const ndn::Name& originRouter,
86 const ndn::Name& updateName, uint64_t seqNo)
94 std::istringstream(updateName.get(updateName.size()-1).toUri()) >> lsaType;
97 " sequence number than entry in LSDB");
99 if (m_isLsaNew(originRouter, lsaType, seqNo)) {
102 NLSR_LOG_ERROR(
"Got an update for adjacency LSA when hyperbolic routing " <<
103 "is enabled. Not going to fetch.");
109 NLSR_LOG_ERROR(
"Got an update for coordinate LSA when link-state " <<
110 "is enabled. Not going to fetch.");
113 (*onNewLsa)(updateName, seqNo, originRouter);
const std::string NLSR_COMPONENT
A class to house all the configuration parameters for NLSR.
ndn::util::Signal< SyncLogicHandler, const ndn::Name &, const uint64_t &, const ndn::Name & > OnNewLsa
#define NLSR_LOG_DEBUG(x)
const ndn::Name & getRouterPrefix() const
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California.
#define INIT_LOGGER(name)
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California.
std::function< bool(const ndn::Name &, const Lsa::Type &lsaType, const uint64_t &)> IsLsaNew
NLSR-to-ChronoSync interaction point.
static 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
#define NLSR_LOG_ERROR(x)
Copyright (c) 2014-2019, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
void addUserNode(const ndn::Name &userPrefix)
Add user node to ChronoSync or PSync.
const ndn::Name & getSyncUserPrefix() const
int32_t getHyperbolicState() const
const std::string LSA_COMPONENT
SyncLogicHandler(ndn::Face &face, const IsLsaNew &isLsaNew, const ConfParameter &conf)
void publishUpdate(const ndn::Name &userPrefix, uint64_t seq)
Publish update to ChronoSync or PSync.
void publishRoutingUpdate(const Lsa::Type &type, const uint64_t &seqNo)
Instruct ChronoSync to publish an update.