pit: add EndpointId field in in-record and out-record

refs: #4842

Change-Id: Id4bca4ad9c2d7c8a2fd975c0b052fb9271b6e47d
diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index 13560a9..b07211b 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -176,7 +176,7 @@
     return;
   }
 
-  auto inRecord = pitEntry->getInRecord(*inFace);
+  auto inRecord = pitEntry->getInRecord(*inFace, 0);
   BOOST_ASSERT(inRecord != pitEntry->in_end());
   // in-record is erased only if Interest is satisfied, and RTO timer should have been cancelled
   // note: if this strategy is extended to send Nacks, that would also erase in-record,
@@ -225,7 +225,7 @@
     return;
   }
 
-  auto outRecord = pitEntry->getOutRecord(inFace);
+  auto outRecord = pitEntry->getOutRecord(inFace, 0);
   if (outRecord == pitEntry->out_end()) { // no out-record
     NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << inFace.getId() <<
                   " no-out-record");
diff --git a/daemon/fw/asf-measurements.cpp b/daemon/fw/asf-measurements.cpp
index 6302020..17771e0 100644
--- a/daemon/fw/asf-measurements.cpp
+++ b/daemon/fw/asf-measurements.cpp
@@ -114,7 +114,7 @@
 FaceInfo::recordRtt(const shared_ptr<pit::Entry>& pitEntry, const Face& inFace)
 {
   // Calculate RTT
-  pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(inFace);
+  pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(inFace, 0);
 
   if (outRecord == pitEntry->out_end()) { // no out-record
     NFD_LOG_TRACE(pitEntry->getInterest() << " dataFrom inFace=" << inFace.getId() << " no-out-record");
diff --git a/daemon/fw/best-route-strategy2.cpp b/daemon/fw/best-route-strategy2.cpp
index 03f27dc..7a1f063 100644
--- a/daemon/fw/best-route-strategy2.cpp
+++ b/daemon/fw/best-route-strategy2.cpp
@@ -88,7 +88,7 @@
 
   if (wantUnused) {
     // nexthop must not have unexpired out-record
-    auto outRecord = pitEntry->getOutRecord(outFace);
+    auto outRecord = pitEntry->getOutRecord(outFace, 0);
     if (outRecord != pitEntry->out_end() && outRecord->getExpiry() > now) {
       return false;
     }
@@ -112,7 +112,7 @@
     if (!isNextHopEligible(inFace, interest, *it, pitEntry))
       continue;
 
-    auto outRecord = pitEntry->getOutRecord(it->getFace());
+    auto outRecord = pitEntry->getOutRecord(it->getFace(), 0);
     BOOST_ASSERT(outRecord != pitEntry->out_end());
     if (outRecord->getLastRenewed() < earliestRenewed) {
       found = it;
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index b53b82d..f4e5ac9 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -176,7 +176,7 @@
   ++m_counters.nCsMisses;
 
   // insert in-record
-  pitEntry->insertOrUpdateInRecord(const_cast<Face&>(inFace), interest);
+  pitEntry->insertOrUpdateInRecord(const_cast<Face&>(inFace), 0, interest);
 
   // set PIT expiry timer to the time that the last PIT in-record expires
   auto lastExpiring = std::max_element(pitEntry->in_begin(), pitEntry->in_end(), &compare_InRecord_expiry);
@@ -230,7 +230,7 @@
                 " interest=" << pitEntry->getName());
 
   // insert out-record
-  pitEntry->insertOrUpdateOutRecord(outFace, interest);
+  pitEntry->insertOrUpdateOutRecord(outFace, 0, interest);
 
   // send Interest
   outFace.sendInterest(interest);
@@ -309,7 +309,7 @@
     this->insertDeadNonceList(*pitEntry, &inFace);
 
     // delete PIT entry's out-record
-    pitEntry->deleteOutRecord(inFace);
+    pitEntry->deleteOutRecord(inFace, 0);
   }
   // when more than one PIT entry is matched, trigger strategy: before satisfy Interest,
   // and send Data to all matched out faces
@@ -343,7 +343,7 @@
 
       // clear PIT entry's in and out records
       pitEntry->clearInRecords();
-      pitEntry->deleteOutRecord(inFace);
+      pitEntry->deleteOutRecord(inFace, 0);
     }
 
     // foreach pending downstream
@@ -425,7 +425,7 @@
   }
 
   // has out-record?
-  pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(inFace);
+  pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(inFace, 0);
   // if no out-record found, drop
   if (outRecord == pitEntry->out_end()) {
     NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
@@ -472,7 +472,7 @@
   }
 
   // has in-record?
-  pit::InRecordCollection::iterator inRecord = pitEntry->getInRecord(outFace);
+  pit::InRecordCollection::iterator inRecord = pitEntry->getInRecord(outFace, 0);
 
   // if no in-record found, drop
   if (inRecord == pitEntry->in_end()) {
@@ -499,7 +499,7 @@
   nackPkt.setHeader(nack);
 
   // erase in-record
-  pitEntry->deleteInRecord(outFace);
+  pitEntry->deleteInRecord(outFace, 0);
 
   // send Nack on face
   const_cast<Face&>(outFace).sendNack(nackPkt);
@@ -548,7 +548,7 @@
   }
   else {
     // insert outgoing Nonce of a specific face
-    auto outRecord = pitEntry.getOutRecord(*upstream);
+    auto outRecord = pitEntry.getOutRecord(*upstream, 0);
     if (outRecord != pitEntry.getOutRecords().end()) {
       m_deadNonceList.add(pitEntry.getName(), outRecord->getLastNonce());
     }
diff --git a/daemon/fw/multicast-strategy.cpp b/daemon/fw/multicast-strategy.cpp
index 71fa7c1..7732e09 100644
--- a/daemon/fw/multicast-strategy.cpp
+++ b/daemon/fw/multicast-strategy.cpp
@@ -95,7 +95,7 @@
                            << " pitEntry-to=" << outFace.getId());
 
     if (suppressResult == RetxSuppressionResult::FORWARD) {
-      m_retxSuppression.incrementIntervalForOutRecord(*pitEntry->getOutRecord(outFace));
+      m_retxSuppression.incrementIntervalForOutRecord(*pitEntry->getOutRecord(outFace, 0));
     }
     ++nEligibleNextHops;
   }
diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index 9a16897..778ed2b 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -143,7 +143,7 @@
   if (pitEntry == nullptr) {
     return;
   }
-  auto inRecord = pitEntry->getInRecord(*inFace);
+  auto inRecord = pitEntry->getInRecord(*inFace, 0);
   if (inRecord == pitEntry->in_end()) {
     return;
   }
diff --git a/daemon/fw/process-nack-traits.cpp b/daemon/fw/process-nack-traits.cpp
index 584bf70..4b2d091 100644
--- a/daemon/fw/process-nack-traits.cpp
+++ b/daemon/fw/process-nack-traits.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -56,7 +56,7 @@
 
   if (nOutRecordsNotNacked == 1) {
     BOOST_ASSERT(lastFaceNotNacked != nullptr);
-    pit::InRecordCollection::iterator inR = pitEntry->getInRecord(*lastFaceNotNacked);
+    pit::InRecordCollection::iterator inR = pitEntry->getInRecord(*lastFaceNotNacked, 0);
     if (inR != pitEntry->in_end()) {
       // one out-record not Nacked, which is also a downstream
       NFD_LOG_DEBUG(nack.getInterest() << " nack-from=" << inFace.getId() <<
diff --git a/daemon/fw/retx-suppression-exponential.cpp b/daemon/fw/retx-suppression-exponential.cpp
index b110588..1275dd9 100644
--- a/daemon/fw/retx-suppression-exponential.cpp
+++ b/daemon/fw/retx-suppression-exponential.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -95,7 +95,7 @@
 RetxSuppressionExponential::decidePerUpstream(pit::Entry& pitEntry, Face& outFace)
 {
   // NEW if outRecord for the face does not exist
-  auto outRecord = pitEntry.getOutRecord(outFace);
+  auto outRecord = pitEntry.getOutRecord(outFace, 0);
   if (outRecord == pitEntry.out_end()) {
     return RetxSuppressionResult::NEW;
   }
diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp
index 174dca4..42f0f22 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.cpp
@@ -73,7 +73,7 @@
   const fib::NextHopList& nexthops = fibEntry.getNextHops();
 
   bool isNonDiscovery = interest.getTag<lp::NonDiscoveryTag>() != nullptr;
-  auto inRecordInfo = pitEntry->getInRecord(inFace)->insertStrategyInfo<InRecordInfo>().first;
+  auto inRecordInfo = pitEntry->getInRecord(inFace, 0)->insertStrategyInfo<InRecordInfo>().first;
   if (isNonDiscovery) { // "non-discovery" Interest
     inRecordInfo->isNonDiscoveryInterest = true;
     if (nexthops.empty()) { // return NACK if no matching FIB entry exists
@@ -103,7 +103,7 @@
 SelfLearningStrategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
                                        const Face& inFace, const Data& data)
 {
-  OutRecordInfo* outRecordInfo = pitEntry->getOutRecord(inFace)->getStrategyInfo<OutRecordInfo>();
+  OutRecordInfo* outRecordInfo = pitEntry->getOutRecord(inFace, 0)->getStrategyInfo<OutRecordInfo>();
   if (outRecordInfo && outRecordInfo->isNonDiscoveryInterest) { // outgoing Interest was non-discovery
     if (!needPrefixAnn(pitEntry)) { // no need to attach a PA (common cases)
       sendDataToAll(pitEntry, inFace, data);
@@ -146,7 +146,7 @@
       continue;
     }
     this->sendInterest(pitEntry, outFace, interest);
-    pitEntry->getOutRecord(outFace)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = false;
+    pitEntry->getOutRecord(outFace, 0)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = false;
     NFD_LOG_DEBUG("send discovery Interest=" << interest << " from="
                   << inFace.getId() << " to=" << outFace.getId());
   }
@@ -164,7 +164,7 @@
       continue;
     }
     this->sendInterest(pitEntry, outFace, interest);
-    pitEntry->getOutRecord(outFace)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = true;
+    pitEntry->getOutRecord(outFace, 0)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = true;
     NFD_LOG_DEBUG("send non-discovery Interest=" << interest << " from="
                   << inFace.getId() << " to=" << outFace.getId());
   }
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 3f364ea..378e554 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -199,7 +199,7 @@
 
   // delete the PIT entry's in-record based on outFace,
   // since Data is sent to outFace from which the Interest was received
-  pitEntry->deleteInRecord(outFace);
+  pitEntry->deleteInRecord(outFace, 0);
 
   m_forwarder.onOutgoingData(data, *const_pointer_cast<Face>(outFace.shared_from_this()));
 }