communication: adapt to API changes in PSync

Pass the KeyChain instance to psync::FullProducer

Change-Id: Ia97356dc364c7bdaf6dc80ad57fa351eeabe997d
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 3e29067..cd9e17a 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.cpp
@@ -20,9 +20,7 @@
  */
 
 #include "sync-logic-handler.hpp"
-#include "common.hpp"
-#include "conf-parameter.hpp"
-#include "lsa/lsa.hpp"
+#include "hello-protocol.hpp"
 #include "logger.hpp"
 #include "utility/name-helper.hpp"
 
@@ -32,14 +30,14 @@
 
 INIT_LOGGER(SyncLogicHandler);
 
-SyncLogicHandler::SyncLogicHandler(ndn::Face& face, const IsLsaNew& isLsaNew,
-                                   const ConfParameter& conf)
-  : onNewLsa(std::make_unique<OnNewLsa>())
-  , m_syncFace(face)
-  , m_isLsaNew(isLsaNew)
+const std::string LSA_COMPONENT{"LSA"};
+
+SyncLogicHandler::SyncLogicHandler(ndn::Face& face, ndn::KeyChain& keyChain,
+                                   IsLsaNew isLsaNew, const ConfParameter& conf)
+  : m_isLsaNew(std::move(isLsaNew))
   , m_confParam(conf)
   , 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_syncLogic(face, keyChain, m_confParam.getSyncProtocol(), m_confParam.getSyncPrefix(),
                 m_nameLsaUserPrefix, m_confParam.getSyncInterestLifetime(),
                 std::bind(&SyncLogicHandler::processUpdate, this, _1, _2, _3))
 {
@@ -62,7 +60,7 @@
 {
   NLSR_LOG_DEBUG("Update Name: " << updateName << " Seq no: " << highSeq);
 
-  int32_t nlsrPosition = util::getNameComponentPosition(updateName, NLSR_COMPONENT);
+  int32_t nlsrPosition = util::getNameComponentPosition(updateName, HelloProtocol::NLSR_COMPONENT);
   int32_t lsaPosition = util::getNameComponentPosition(updateName, LSA_COMPONENT);
 
   if (nlsrPosition < 0 || lsaPosition < 0) {
@@ -70,9 +68,8 @@
     return;
   }
 
-  ndn::Name networkName = updateName.getSubName(1, nlsrPosition-1);
+  ndn::Name networkName = updateName.getSubName(1, nlsrPosition - 1);
   ndn::Name routerName = updateName.getSubName(lsaPosition + 1).getPrefix(-1);
-
   ndn::Name originRouter = networkName;
   originRouter.append(routerName);
 
@@ -109,7 +106,8 @@
                        "is enabled. Not going to fetch.");
         return;
       }
-      (*onNewLsa)(updateName, seqNo, originRouter, incomingFaceId);
+
+      onNewLsa(updateName, seqNo, originRouter, incomingFaceId);
     }
   }
 }