src: decouple classes from Nlsr object
refs: #1952, #2803, #3960, #4288
Change-Id: Ibe3ac3820f11e8107ee4b13e510d53c27467a6cb
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 13f2e8e..78547e2 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-2018, The University of Memphis,
+ * Copyright (c) 2014-2019, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -50,6 +50,7 @@
, m_isLsaNew(isLsaNew)
, m_confParam(conf)
{
+ createSyncLogic(conf.getSyncPrefix());
}
void
@@ -122,21 +123,21 @@
Lsa::Type lsaType;
std::istringstream(updateName.get(updateName.size()-1).toUri()) >> lsaType;
- NLSR_LOG_DEBUG("Received sync update with higher " << lsaType
- << " sequence number than entry in LSDB");
+ NLSR_LOG_DEBUG("Received sync update with higher " << lsaType <<
+ " sequence number than entry in LSDB");
if (m_isLsaNew(originRouter, lsaType, seqNo)) {
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"
- << " is enabled. Not going to fetch.");
+ NLSR_LOG_ERROR("Got an update for adjacency LSA when hyperbolic routing " <<
+ "is enabled. Not going to fetch.");
return;
}
if (lsaType == Lsa::Type::COORDINATE && seqNo != 0 &&
m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_OFF) {
- NLSR_LOG_ERROR("Got an update for coordinate LSA when link-state"
- << " is enabled. Not going to fetch.");
+ NLSR_LOG_ERROR("Got an update for coordinate LSA when link-state " <<
+ "is enabled. Not going to fetch.");
return;
}
(*onNewLsa)(updateName, seqNo);
diff --git a/src/communication/sync-logic-handler.hpp b/src/communication/sync-logic-handler.hpp
index ae72fb8..b9461c2 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-2018, The University of Memphis,
+ * Copyright (c) 2014-2019, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -76,11 +76,13 @@
void
publishRoutingUpdate(const Lsa::Type& type, const uint64_t& seqNo);
- /*! \brief Create and configure a Logic object to enable ChronoSync for this NLSR.
+PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+ /*! \brief Create and configure a Logic object to enable Sync for this NLSR.
*
* In a typical situation this only needs to be called once, when NLSR starts.
- * \param syncPrefix The sync prefix you want this ChronoSync to use
- * \param syncInterestLifetime ChronoSync sends a periodic sync interest every \p syncInterestLifetime / 2 ms
+ * \param syncPrefix The sync prefix you want this Sync to use
+ * \param syncInterestLifetime ChronoSync/PSync sends a periodic sync interest every
+ * \p syncInterestLifetime / 2 ms
* \sa Nlsr::initialize
*/
void
@@ -88,10 +90,15 @@
const ndn::time::milliseconds& syncInterestLifetime =
ndn::time::milliseconds(SYNC_INTEREST_LIFETIME_DEFAULT));
+ /*! \brief Callback from Sync protocol
+ *
+ * In a typical situation this only needs to be called once, when NLSR starts.
+ * \param updateName The prefix for which sync reports an update
+ * \param highSeq The latest sequence number of the update
+ */
void
processUpdate(const ndn::Name& updateName, uint64_t highSeq);
-PUBLIC_WITH_TESTS_ELSE_PRIVATE:
/*! \brief Simple function to glue Name components together
*/
void