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
 {