lsdb: Fetch LSA from the face the notification about LSAs came from
Change-Id: Iadb7a22bcc8b2d7801787e5d88b37eec4eafc974
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 4f8eba2..3e29067 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -41,7 +41,7 @@
, m_nameLsaUserPrefix(ndn::Name(m_confParam.getSyncUserPrefix()).append(boost::lexical_cast<std::string>(Lsa::Type::NAME)))
, m_syncLogic(m_syncFace, m_confParam.getSyncProtocol(), m_confParam.getSyncPrefix(),
m_nameLsaUserPrefix, m_confParam.getSyncInterestLifetime(),
- std::bind(&SyncLogicHandler::processUpdate, this, _1, _2))
+ std::bind(&SyncLogicHandler::processUpdate, this, _1, _2, _3))
{
m_adjLsaUserPrefix = ndn::Name(m_confParam.getSyncUserPrefix())
.append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY));
@@ -58,7 +58,7 @@
}
void
-SyncLogicHandler::processUpdate(const ndn::Name& updateName, uint64_t highSeq)
+SyncLogicHandler::processUpdate(const ndn::Name& updateName, uint64_t highSeq, uint64_t incomingFaceId)
{
NLSR_LOG_DEBUG("Update Name: " << updateName << " Seq no: " << highSeq);
@@ -76,12 +76,13 @@
ndn::Name originRouter = networkName;
originRouter.append(routerName);
- processUpdateFromSync(originRouter, updateName, highSeq);
+ processUpdateFromSync(originRouter, updateName, highSeq, incomingFaceId);
}
void
SyncLogicHandler::processUpdateFromSync(const ndn::Name& originRouter,
- const ndn::Name& updateName, uint64_t seqNo)
+ const ndn::Name& updateName, uint64_t seqNo,
+ uint64_t incomingFaceId)
{
NLSR_LOG_DEBUG("Origin Router of update: " << originRouter);
@@ -94,7 +95,7 @@
NLSR_LOG_DEBUG("Received sync update with higher " << lsaType <<
" sequence number than entry in LSDB");
- if (m_isLsaNew(originRouter, lsaType, seqNo)) {
+ if (m_isLsaNew(originRouter, lsaType, seqNo, incomingFaceId)) {
if (lsaType == Lsa::Type::ADJACENCY && seqNo != 0 &&
m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_ON) {
NLSR_LOG_ERROR("Got an update for adjacency LSA when hyperbolic routing " <<
@@ -108,7 +109,7 @@
"is enabled. Not going to fetch.");
return;
}
- (*onNewLsa)(updateName, seqNo, originRouter);
+ (*onNewLsa)(updateName, seqNo, originRouter, incomingFaceId);
}
}
}
diff --git a/src/communication/sync-logic-handler.hpp b/src/communication/sync-logic-handler.hpp
index fa3545f..9f3e5de 100644
--- a/src/communication/sync-logic-handler.hpp
+++ b/src/communication/sync-logic-handler.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -53,7 +53,7 @@
};
using IsLsaNew =
- std::function<bool(const ndn::Name&, const Lsa::Type& lsaType, const uint64_t&)>;
+ std::function<bool(const ndn::Name&, const Lsa::Type& lsaType, const uint64_t&, uint64_t/*inFace*/)>;
SyncLogicHandler(ndn::Face& face, const IsLsaNew& isLsaNew, const ConfParameter& conf);
@@ -77,7 +77,7 @@
* \param highSeq The latest sequence number of the update
*/
void
- processUpdate(const ndn::Name& updateName, uint64_t highSeq);
+ processUpdate(const ndn::Name& updateName, uint64_t highSeq, uint64_t incomingFaceId);
/*! \brief Determine which kind of LSA was updated and fetch it.
*
@@ -89,7 +89,7 @@
*/
void
processUpdateFromSync(const ndn::Name& originRouter,
- const ndn::Name& updateName, uint64_t seqNo);
+ const ndn::Name& updateName, uint64_t seqNo, uint64_t incomingFaceId);
public:
std::unique_ptr<OnNewLsa> onNewLsa;
diff --git a/src/communication/sync-protocol-adapter.cpp b/src/communication/sync-protocol-adapter.cpp
index ae08e3a..81ec6f3 100644
--- a/src/communication/sync-protocol-adapter.cpp
+++ b/src/communication/sync-protocol-adapter.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -101,7 +101,7 @@
for (const auto& update : updates) {
// Remove FIXED_SESSION
- m_syncUpdateCallback(update.session.getPrefix(-1), update.high);
+ m_syncUpdateCallback(update.session.getPrefix(-1), update.high, 0);
}
}
#endif
@@ -112,8 +112,8 @@
NLSR_LOG_TRACE("Received PSync update event");
for (const auto& update : updates) {
- m_syncUpdateCallback(update.prefix, update.highSeq);
+ m_syncUpdateCallback(update.prefix, update.highSeq, update.incomingFace);
}
}
-} // namespace nlsr
\ No newline at end of file
+} // namespace nlsr
diff --git a/src/communication/sync-protocol-adapter.hpp b/src/communication/sync-protocol-adapter.hpp
index 1d56b25..db67fb1 100644
--- a/src/communication/sync-protocol-adapter.hpp
+++ b/src/communication/sync-protocol-adapter.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -33,7 +33,7 @@
namespace nlsr {
typedef std::function<void(const ndn::Name& updateName,
- uint64_t seqNo)> SyncUpdateCallback;
+ uint64_t seqNo, uint64_t incomingFaceId)> SyncUpdateCallback;
class SyncProtocolAdapter
{
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index 5e416b3..6fd4266 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -25,6 +25,8 @@
#include "nlsr.hpp"
#include "utility/name-helper.hpp"
+#include <ndn-cxx/lp/tags.hpp>
+
namespace nlsr {
INIT_LOGGER(Lsdb);
@@ -38,7 +40,7 @@
, m_confParam(confParam)
, m_sync(m_face,
[this] (const ndn::Name& routerName, const Lsa::Type& lsaType,
- const uint64_t& sequenceNumber) {
+ const uint64_t& sequenceNumber, uint64_t incomingFaceId) {
return isLsaNew(routerName, lsaType, sequenceNumber);
}, m_confParam)
, m_lsaRefreshTime(ndn::time::seconds(m_confParam.getLsaRefreshTime()))
@@ -47,10 +49,10 @@
, m_sequencingManager(m_confParam.getStateFileDir(), m_confParam.getHyperbolicState())
, m_onNewLsaConnection(m_sync.onNewLsa->connect(
[this] (const ndn::Name& updateName, uint64_t sequenceNumber,
- const ndn::Name& originRouter) {
+ const ndn::Name& originRouter, uint64_t incomingFaceId) {
ndn::Name lsaInterest{updateName};
lsaInterest.appendNumber(sequenceNumber);
- expressInterest(lsaInterest, 0);
+ expressInterest(lsaInterest, 0, incomingFaceId);
}))
, m_segmentPublisher(m_face, keyChain)
, m_isBuildAdjLsaScheduled(false)
@@ -385,7 +387,7 @@
}
void
-Lsdb::expressInterest(const ndn::Name& interestName, uint32_t timeoutCount,
+Lsdb::expressInterest(const ndn::Name& interestName, uint32_t timeoutCount, uint64_t incomingFaceId,
ndn::time::steady_clock::TimePoint deadline)
{
// increment SENT_LSA_INTEREST
@@ -413,6 +415,9 @@
}
ndn::Interest interest(interestName);
+ if (incomingFaceId != 0) {
+ interest.setTag(std::make_shared<ndn::lp::NextHopFaceIdTag>(incomingFaceId));
+ }
ndn::util::SegmentFetcher::Options options;
options.interestLifetime = m_confParam.getLsaInterestLifetime();
@@ -472,7 +477,7 @@
delay = ndn::time::seconds(0);
}
m_scheduler.schedule(delay, std::bind(&Lsdb::expressInterest, this,
- interestName, retransmitNo + 1, deadline));
+ interestName, /*??*/0, retransmitNo + 1, deadline));
}
}
}
diff --git a/src/lsdb.hpp b/src/lsdb.hpp
index 7d77cd3..5242c94 100644
--- a/src/lsdb.hpp
+++ b/src/lsdb.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -278,7 +278,7 @@
Lsa::Type lsaType, uint64_t seqNo);
void
- expressInterest(const ndn::Name& interestName, uint32_t timeoutCount,
+ expressInterest(const ndn::Name& interestName, uint32_t timeoutCount, uint64_t incomingFaceId,
ndn::time::steady_clock::TimePoint deadline = DEFAULT_LSA_RETRIEVAL_DEADLINE);
/*!
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index abf5c5f..176795f 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, The University of Memphis,
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -49,7 +49,7 @@
, m_helloProtocol(m_face, keyChain, confParam, m_routingTable, m_lsdb)
, m_onNewLsaConnection(m_lsdb.getSync().onNewLsa->connect(
[this] (const ndn::Name& updateName, uint64_t sequenceNumber,
- const ndn::Name& originRouter) {
+ const ndn::Name& originRouter, uint64_t incomingFaceId) {
registerStrategyForCerts(originRouter);
}))
, m_onPrefixRegistrationSuccess(m_fib.onPrefixRegistrationSuccess.connect(
diff --git a/src/signals.hpp b/src/signals.hpp
index 6001ead..b7b2b33 100644
--- a/src/signals.hpp
+++ b/src/signals.hpp
@@ -1,7 +1,8 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2020, The University of Memphis,
- * Regents of the University of California
+/*
+ * Copyright (c) 2014-2022, The University of Memphis,
+ * Regents of the University of California,
+ * Arizona Board of Regents.
*
* This file is part of NLSR (Named-data Link State Routing).
* See AUTHORS.md for complete list of NLSR authors and contributors.
@@ -16,8 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- *
- **/
+ */
#ifndef NLSR_SIGNALS_HPP
#define NLSR_SIGNALS_HPP
@@ -32,8 +32,8 @@
class RoutingTableEntry;
class SyncLogicHandler;
-using AfterRoutingChange = ndn::util::Signal<RoutingTable, const std::list<RoutingTableEntry>&>;
-using OnNewLsa = ndn::util::Signal<SyncLogicHandler, const ndn::Name&, const uint64_t&, const ndn::Name&>;
+using AfterRoutingChange = ndn::util::Signal<RoutingTable, std::list<RoutingTableEntry>>;
+using OnNewLsa = ndn::util::Signal<SyncLogicHandler, ndn::Name, uint64_t, ndn::Name, uint64_t>;
} // namespace nlsr