27 #include <boost/lexical_cast.hpp>
37 : m_isLsaNew(std::move(isLsaNew))
39 , m_nameLsaUserPrefix(ndn::Name(m_confParam.getSyncUserPrefix()).append(boost::lexical_cast<std::string>(
Lsa::Type::NAME)))
40 , m_syncLogic(face, keyChain, m_confParam.getSyncProtocol(), m_confParam.getSyncPrefix(),
41 m_nameLsaUserPrefix, m_confParam.getSyncInterestLifetime(),
59 SyncLogicHandler::processUpdate(
const ndn::Name& updateName, uint64_t highSeq, uint64_t incomingFaceId)
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);
73 ndn::Name originRouter = networkName;
74 originRouter.append(routerName);
76 processUpdateFromSync(originRouter, updateName, highSeq, incomingFaceId);
80 SyncLogicHandler::processUpdateFromSync(
const ndn::Name& originRouter,
81 const ndn::Name& updateName, uint64_t seqNo,
82 uint64_t incomingFaceId)
90 std::istringstream(updateName.get(updateName.size()-1).toUri()) >> lsaType;
93 " sequence number than entry in LSDB");
95 if (m_isLsaNew(originRouter, lsaType, seqNo, incomingFaceId)) {
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.");
110 onNewLsa(updateName, seqNo, originRouter, incomingFaceId);
A class to house all the configuration parameters for NLSR.
int32_t getHyperbolicState() const
const ndn::Name & getSyncUserPrefix() const
const ndn::Name & getRouterPrefix() const
static const std::string NLSR_COMPONENT
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, ndn::KeyChain &keyChain, IsLsaNew isLsaNew, const ConfParameter &conf)
std::function< bool(const ndn::Name &, const Lsa::Type &lsaType, const uint64_t &, uint64_t)> IsLsaNew
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