face: add EndpointId in Face and LinkService

refs: #4843

Change-Id: If1249015392ef904a56a0d0d97946e2b3024d7d4
diff --git a/daemon/fw/face-endpoint.hpp b/daemon/fw/face-endpoint.hpp
deleted file mode 100644
index acfbc2e..0000000
--- a/daemon/fw/face-endpoint.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2019,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_DAEMON_FW_FACE_ENDPOINT_HPP
-#define NFD_DAEMON_FW_FACE_ENDPOINT_HPP
-
-#include "face/face.hpp"
-
-namespace nfd {
-
-/** \brief Represents a face-endpoint pair in the forwarder
- */
-class FaceEndpoint
-{
-public:
-  FaceEndpoint(const Face& face, EndpointId endpoint)
-    : face(const_cast<Face&>(face))
-    , endpoint(endpoint)
-  {
-  }
-
-public:
-  Face& face;
-  const EndpointId endpoint;
-};
-
-inline std::ostream&
-operator<<(std::ostream& os, const FaceEndpoint& fe)
-{
-  return os << "(" << fe.face.getId() << "," << fe.endpoint << ")";
-}
-
-} // namespace nfd
-
-#endif // NFD_DAEMON_FW_FACE_ENDPOINT_HPP
\ No newline at end of file
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 17751bf..b2cb4b0 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -53,16 +53,16 @@
 {
   m_faceTable.afterAdd.connect([this] (Face& face) {
     face.afterReceiveInterest.connect(
-      [this, &face] (const Interest& interest) {
-        this->startProcessInterest(FaceEndpoint(face, 0), interest);
+      [this, &face] (const Interest& interest, const EndpointId& endpointId) {
+        this->startProcessInterest(FaceEndpoint(face, endpointId), interest);
       });
     face.afterReceiveData.connect(
-      [this, &face] (const Data& data) {
-        this->startProcessData(FaceEndpoint(face, 0), data);
+      [this, &face] (const Data& data, const EndpointId& endpointId) {
+        this->startProcessData(FaceEndpoint(face, endpointId), data);
       });
     face.afterReceiveNack.connect(
-      [this, &face] (const lp::Nack& nack) {
-        this->startProcessNack(FaceEndpoint(face, 0), nack);
+      [this, &face] (const lp::Nack& nack, const EndpointId& endpointId) {
+        this->startProcessNack(FaceEndpoint(face, endpointId), nack);
       });
     face.onDroppedInterest.connect(
       [this, &face] (const Interest& interest) {
@@ -157,7 +157,7 @@
   // note: Don't enter outgoing Nack pipeline because it needs an in-record.
   lp::Nack nack(interest);
   nack.setReason(lp::NackReason::DUPLICATE);
-  ingress.face.sendNack(nack);
+  ingress.face.sendNack(nack, ingress.endpoint);
 }
 
 void
@@ -232,7 +232,7 @@
   pitEntry->insertOrUpdateOutRecord(egress.face, egress.endpoint, interest);
 
   // send Interest
-  egress.face.sendInterest(interest);
+  egress.face.sendInterest(interest, egress.endpoint);
   ++m_counters.nOutInterests;
 }
 
@@ -371,7 +371,7 @@
 }
 
 void
-Forwarder::onOutgoingData(const Data& data, FaceEndpoint egress)
+Forwarder::onOutgoingData(const Data& data, const FaceEndpoint& egress)
 {
   if (egress.face.getId() == face::INVALID_FACEID) {
     NFD_LOG_WARN("onOutgoingData out=(invalid) data=" << data.getName());
@@ -391,7 +391,7 @@
   // TODO traffic manager
 
   // send Data
-  egress.face.sendData(data);
+  egress.face.sendData(data, egress.endpoint);
   ++m_counters.nOutData;
 }
 
@@ -493,7 +493,7 @@
   pitEntry->deleteInRecord(egress.face, egress.endpoint);
 
   // send Nack on face
-  egress.face.sendNack(nackPkt);
+  egress.face.sendNack(nackPkt, egress.endpoint);
   ++m_counters.nOutNacks;
 }
 
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index 18ca483..cc1d048 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -26,10 +26,10 @@
 #ifndef NFD_DAEMON_FW_FORWARDER_HPP
 #define NFD_DAEMON_FW_FORWARDER_HPP
 
-#include "face-endpoint.hpp"
 #include "face-table.hpp"
 #include "forwarder-counters.hpp"
 #include "unsolicited-data-policy.hpp"
+#include "face/face-endpoint.hpp"
 #include "table/fib.hpp"
 #include "table/pit.hpp"
 #include "table/cs.hpp"
@@ -228,7 +228,7 @@
   /** \brief outgoing Data pipeline
    */
   VIRTUAL_WITH_TESTS void
-  onOutgoingData(const Data& data, FaceEndpoint egress);
+  onOutgoingData(const Data& data, const FaceEndpoint& egress);
 
   /** \brief incoming Nack pipeline
    */