35 : m_isLsaNew(std::move(isLsaNew))
36 , m_routerPrefix(opts.routerPrefix)
37 , m_hyperbolicState(opts.hyperbolicState)
41 , m_syncLogic(face, keyChain, opts.syncProtocol, opts.syncPrefix,
42 m_nameLsaUserPrefix, opts.syncInterestLifetime,
55 SyncLogicHandler::processUpdate(
const ndn::Name& updateName, uint64_t highSeq, uint64_t incomingFaceId)
57 NLSR_LOG_DEBUG(
"Update Name: " << updateName <<
" Seq no: " << highSeq);
62 if (nlsrPosition < 0 || lsaPosition < 0) {
67 ndn::Name networkName = updateName.getSubName(1, nlsrPosition - 1);
68 ndn::Name routerName = updateName.getSubName(lsaPosition + 1).getPrefix(-1);
69 ndn::Name originRouter = networkName;
70 originRouter.append(routerName);
72 processUpdateFromSync(originRouter, updateName, highSeq, incomingFaceId);
76 SyncLogicHandler::processUpdateFromSync(
const ndn::Name& originRouter,
77 const ndn::Name& updateName, uint64_t seqNo,
78 uint64_t incomingFaceId)
82 if (originRouter == m_routerPrefix) {
87 auto lsaType = boost::lexical_cast<Lsa::Type>(updateName.get(-1).toUri());
89 " sequence number than entry in LSDB");
91 if (m_isLsaNew(originRouter, lsaType, seqNo, incomingFaceId)) {
94 NLSR_LOG_ERROR(
"Got an update for adjacency LSA when hyperbolic routing "
95 "is enabled. Not going to fetch.");
101 NLSR_LOG_ERROR(
"Got an update for coordinate LSA when link-state "
102 "is enabled. Not going to fetch.");
106 onNewLsa(updateName, seqNo, originRouter, incomingFaceId);
static const std::string NLSR_COMPONENT
Represents a Link State Announcement (LSA).
NLSR-to-sync interaction point.
void publishRoutingUpdate(Lsa::Type type, uint64_t seqNo)
Instruct ChronoSync to publish an update.
std::function< bool(const ndn::Name &routerName, Lsa::Type lsaType, uint64_t seqNo, uint64_t inFace) > IsLsaNew
SyncLogicHandler(ndn::Face &face, ndn::KeyChain &keyChain, IsLsaNew isLsaNew, const SyncLogicOptions &opts)
void publishUpdate(const ndn::Name &userPrefix, uint64_t seq)
Publish update to Sync.
void addUserNode(const ndn::Name &userPrefix)
Add user node to Sync.
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.
const std::string LSA_COMPONENT
ndn::Name makeLsaUserPrefix(const ndn::Name &userPrefix, Lsa::Type lsaType)