diff --git a/.waf-tools/compiler-features.py b/.waf-tools/compiler-features.py
index 1fd529e..8fa6aa7 100644
--- a/.waf-tools/compiler-features.py
+++ b/.waf-tools/compiler-features.py
@@ -23,5 +23,41 @@
                    define_name='HAVE_CXX_OVERRIDE',
                    features='cxx', mandatory=False)
 
+FINAL = '''
+class Base
+{
+  virtual void
+  f(int a);
+};
+
+class Derived : public Base
+{
+  virtual void
+  f(int a) final;
+};
+'''
+
+@conf
+def check_final(self):
+    self.check_cxx(msg='Checking for final specifier on method',
+                   fragment=FINAL,
+                   define_name='HAVE_CXX_FINAL',
+                   features='cxx', mandatory=False)
+
+CLASS_FINAL = '''
+class A final
+{
+};
+'''
+
+@conf
+def check_class_final(self):
+    self.check_cxx(msg='Checking for final specifier on class',
+                   fragment=CLASS_FINAL,
+                   define_name='HAVE_CXX_CLASS_FINAL',
+                   features='cxx', mandatory=False)
+
 def configure(conf):
     conf.check_override()
+    conf.check_final()
+    conf.check_class_final()
diff --git a/common.hpp b/common.hpp
index 3e4f44f..c64dd37 100644
--- a/common.hpp
+++ b/common.hpp
@@ -41,7 +41,8 @@
 #endif
 
 /** \def DECL_OVERRIDE
- *  \brief expands to 'override' if compiler supports this feature, otherwise expands to nothing
+ *  \brief expands to 'override' if compiler supports 'override' specifier,
+ *         otherwise expands to nothing
  */
 #ifdef HAVE_CXX_OVERRIDE
 #define DECL_OVERRIDE override
@@ -49,6 +50,26 @@
 #define DECL_OVERRIDE
 #endif
 
+/** \def DECL_FINAL
+ *  \brief expands to 'final' if compiler supports 'final' specifier on method,
+ *         otherwise expands to nothing
+ */
+#ifdef HAVE_CXX_FINAL
+#define DECL_FINAL final
+#else
+#define DECL_FINAL
+#endif
+
+/** \def DECL_CLASS_FINAL
+ *  \brief expands to 'final' if compiler supports 'final' specifier on class,
+ *         otherwise expands to nothing
+ */
+#ifdef HAVE_CXX_CLASS_FINAL
+#define DECL_CLASS_FINAL final
+#else
+#define DECL_CLASS_FINAL
+#endif
+
 #include <cstddef>
 #include <cstdint>
 #include <functional>
@@ -67,6 +88,7 @@
 #include <ndn-cxx/data.hpp>
 #include <ndn-cxx/name.hpp>
 #include <ndn-cxx/encoding/block.hpp>
+#include <ndn-cxx/lp/nack.hpp>
 #include <ndn-cxx/util/backports.hpp>
 #include <ndn-cxx/util/face-uri.hpp>
 #include <ndn-cxx/util/signal.hpp>
@@ -117,6 +139,7 @@
 using namespace ndn::tlv;
 } // namespace tlv
 
+namespace lp = ndn::lp;
 namespace name = ndn::name;
 namespace time = ndn::time;
 namespace signal = ndn::util::signal;
diff --git a/daemon/face/face-log.hpp b/daemon/face/face-log.hpp
new file mode 100644
index 0000000..6e0b3fd
--- /dev/null
+++ b/daemon/face/face-log.hpp
@@ -0,0 +1,93 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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_FACE_FACE_LOG_HPP
+#define NFD_DAEMON_FACE_FACE_LOG_HPP
+
+#include "core/logger.hpp"
+
+namespace nfd {
+namespace face {
+
+/** \brief for internal use by FaceLogging macros
+ *
+ *  FaceLogHelper wraps a Face, LinkService, or Transport object.
+ *
+ *  std::ostream& operator<<(std::ostream& os, const FaceLogHelper<T>& flh)
+ *  should be specialized to print "[id=888,local=scheme://local/uri,remote=scheme://remote/uri] "
+ *  which appears as part of the log message.
+ */
+template<typename T>
+class FaceLogHelper
+{
+public:
+  explicit
+  FaceLogHelper(const T& obj1)
+    : obj(obj1)
+  {
+  }
+
+public:
+  const T& obj;
+};
+
+/** \defgroup FaceLogging Face logging macros
+ *
+ * These macros augment the log message with some face-specific information,
+ * such as the face ID, that are useful to distinguish which face produced the
+ * message. It is strongly recommended to use these macros instead of the
+ * generic ones for all logging inside Face, LinkService, Transport subclasses.
+ * @{
+ */
+
+#define NFD_LOG_FACE(level, msg) NFD_LOG_##level( \
+  ::nfd::face::FaceLogHelper< \
+    typename std::remove_cv< \
+      typename std::remove_reference<decltype(*this)>::type \
+    >::type \
+  >(*this) \
+  << msg)
+
+/** \brief Log a message at TRACE level */
+#define NFD_LOG_FACE_TRACE(msg) NFD_LOG_FACE(TRACE, msg)
+
+/** \brief Log a message at DEBUG level */
+#define NFD_LOG_FACE_DEBUG(msg) NFD_LOG_FACE(DEBUG, msg)
+
+/** \brief Log a message at INFO level */
+#define NFD_LOG_FACE_INFO(msg)  NFD_LOG_FACE(INFO,  msg)
+
+/** \brief Log a message at WARN level */
+#define NFD_LOG_FACE_WARN(msg)  NFD_LOG_FACE(WARN,  msg)
+
+/** \brief Log a message at ERROR level */
+#define NFD_LOG_FACE_ERROR(msg) NFD_LOG_FACE(ERROR, msg)
+
+/** @} */
+
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_FACE_LOG_HPP
diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp
index a5923d2..9c2f2e6 100644
--- a/daemon/face/face.hpp
+++ b/daemon/face/face.hpp
@@ -29,6 +29,7 @@
 #include "common.hpp"
 #include "core/logger.hpp"
 #include "face-counters.hpp"
+#include "face-log.hpp"
 
 #include <ndn-cxx/management/nfd-face-status.hpp>
 
@@ -82,12 +83,18 @@
   /// fires when a Data is received
   signal::Signal<Face, Data> onReceiveData;
 
+  /// fires when a Nack is received
+  signal::Signal<Face, lp::Nack> onReceiveNack;
+
   /// fires when an Interest is sent out
   signal::Signal<Face, Interest> onSendInterest;
 
   /// fires when a Data is sent out
   signal::Signal<Face, Data> onSendData;
 
+  /// fires when a Nack is sent out
+  signal::Signal<Face, lp::Nack> onSendNack;
+
   /// fires when face disconnects or fails to perform properly
   signal::Signal<Face, std::string/*reason*/> onFail;
 
@@ -99,6 +106,12 @@
   virtual void
   sendData(const Data& data) = 0;
 
+  /// send a Nack
+  virtual void
+  sendNack(const ndn::lp::Nack& nack)
+  {
+  }
+
   /** \brief Close the face
    *
    *  This terminates all communication on the face and cause
@@ -133,6 +146,10 @@
   ndn::nfd::FacePersistency
   getPersistency() const;
 
+  // 'virtual' to allow override in LpFaceWrapper
+  virtual void
+  setPersistency(ndn::nfd::FacePersistency persistency);
+
   /** \brief Get whether packets sent by this face may reach multiple peers
    */
   bool
@@ -145,7 +162,8 @@
   virtual bool
   isUp() const;
 
-  const FaceCounters&
+  // 'virtual' to allow override in LpFaceWrapper
+  virtual const FaceCounters&
   getCounters() const;
 
   /** \return a FaceUri that represents the remote endpoint
@@ -169,10 +187,6 @@
   virtual ndn::nfd::FaceStatus
   getFaceStatus() const;
 
-PUBLIC_WITH_TESTS_ELSE_PROTECTED:
-  void
-  setPersistency(ndn::nfd::FacePersistency persistency);
-
 protected:
   bool
   decodeAndDispatchInput(const Block& element);
@@ -187,12 +201,14 @@
 
   DECLARE_SIGNAL_EMIT(onReceiveInterest)
   DECLARE_SIGNAL_EMIT(onReceiveData)
+  DECLARE_SIGNAL_EMIT(onReceiveNack)
   DECLARE_SIGNAL_EMIT(onSendInterest)
   DECLARE_SIGNAL_EMIT(onSendData)
+  DECLARE_SIGNAL_EMIT(onSendNack)
 
-private:
   // this method should be used only by the FaceTable
-  void
+  // 'virtual' to allow override in LpFaceWrapper
+  virtual void
   setId(FaceId faceId);
 
 private:
@@ -282,38 +298,15 @@
   return m_localUri;
 }
 
-
-/** \defgroup FaceLogging Face logging macros
- *
- * These macros augment the log message with some face-specific information,
- * such as the face ID, that are useful to distinguish which face produced the
- * message. It is strongly recommended to use these macros instead of the
- * generic ones for all logging inside Face subclasses.
- * @{
- */
-
-#define NFD_LOG_FACE(level, msg)                        \
-  NFD_LOG_##level("[id=" << this->getId() <<            \
-                  ",local=" << this->getLocalUri() <<   \
-                  ",remote=" << this->getRemoteUri() << \
-                  "] " << msg)
-
-/** \brief Log a message at TRACE level */
-#define NFD_LOG_FACE_TRACE(msg) NFD_LOG_FACE(TRACE, msg)
-
-/** \brief Log a message at DEBUG level */
-#define NFD_LOG_FACE_DEBUG(msg) NFD_LOG_FACE(DEBUG, msg)
-
-/** \brief Log a message at INFO level */
-#define NFD_LOG_FACE_INFO(msg)  NFD_LOG_FACE(INFO,  msg)
-
-/** \brief Log a message at WARN level */
-#define NFD_LOG_FACE_WARN(msg)  NFD_LOG_FACE(WARN,  msg)
-
-/** \brief Log a message at ERROR level */
-#define NFD_LOG_FACE_ERROR(msg) NFD_LOG_FACE(ERROR, msg)
-
-/** @} */
+template<typename T>
+typename std::enable_if<std::is_base_of<Face, T>::value, std::ostream&>::type
+operator<<(std::ostream& os, const face::FaceLogHelper<T>& flh)
+{
+  const Face& face = flh.obj;
+  os << "[id=" << face.getId() << ",local=" << face.getLocalUri() <<
+        ",remote=" << face.getRemoteUri() << "] ";
+  return os;
+}
 
 } // namespace nfd
 
diff --git a/daemon/face/generic-link-service.cpp b/daemon/face/generic-link-service.cpp
new file mode 100644
index 0000000..79010e6
--- /dev/null
+++ b/daemon/face/generic-link-service.cpp
@@ -0,0 +1,93 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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/>.
+ */
+
+#include "generic-link-service.hpp"
+
+namespace nfd {
+namespace face {
+
+NFD_LOG_INIT("GenericLinkService");
+
+void
+GenericLinkService::doSendInterest(const Interest& interest)
+{
+  lp::Packet lpPacket(interest.wireEncode());
+  Transport::Packet packet;
+  packet.packet = lpPacket.wireEncode();
+  sendPacket(std::move(packet));
+}
+
+void
+GenericLinkService::doSendData(const Data& data)
+{
+  lp::Packet lpPacket(data.wireEncode());
+  Transport::Packet packet;
+  packet.packet = lpPacket.wireEncode();
+  sendPacket(std::move(packet));
+}
+
+void
+GenericLinkService::doSendNack(const lp::Nack& nack)
+{
+  lp::Packet lpPacket(nack.getInterest().wireEncode());
+  lpPacket.add<lp::NackField>(nack.getHeader());
+  Transport::Packet packet;
+  packet.packet = lpPacket.wireEncode();
+  sendPacket(std::move(packet));
+}
+
+void
+GenericLinkService::doReceivePacket(Transport::Packet&& packet)
+{
+  lp::Packet lpPacket(packet.packet);
+  ndn::Buffer::const_iterator fragBegin, fragEnd;
+  std::tie(fragBegin, fragEnd) = lpPacket.get<lp::FragmentField>();
+  Block netPacket(&*fragBegin, std::distance(fragBegin, fragEnd));
+
+  // Forwarding expects Interest and Data to be created with make_shared,
+  // but has no such requirement on Nack.
+  switch (netPacket.type()) {
+    case tlv::Interest: {
+      auto interest = make_shared<Interest>(netPacket);
+      if (lpPacket.has<lp::NackField>()) {
+        lp::Nack nack(std::move(*interest));
+        nack.setHeader(lpPacket.get<lp::NackField>());
+        receiveNack(nack);
+      }
+      else {
+        receiveInterest(*interest);
+      }
+      break;
+    }
+    case tlv::Data: {
+      auto data = make_shared<Data>(netPacket);
+      receiveData(*data);
+      break;
+    }
+  }
+}
+
+} // namespace face
+} // namespace nfd
diff --git a/daemon/face/generic-link-service.hpp b/daemon/face/generic-link-service.hpp
new file mode 100644
index 0000000..8d91f88
--- /dev/null
+++ b/daemon/face/generic-link-service.hpp
@@ -0,0 +1,70 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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_FACE_GENERIC_LINK_SERVICE_HPP
+#define NFD_DAEMON_FACE_GENERIC_LINK_SERVICE_HPP
+
+#include "common.hpp"
+#include "core/logger.hpp"
+
+#include "link-service.hpp"
+
+#include <ndn-cxx/lp/packet.hpp>
+
+namespace nfd {
+namespace face {
+
+/** \brief generic LinkService
+ */
+class GenericLinkService : public LinkService
+{
+private: // send path entrypoint
+  /** \brief sends Interest
+   */
+  void
+  doSendInterest(const Interest& interest) DECL_OVERRIDE;
+
+  /** \brief sends Data
+   */
+  void
+  doSendData(const Data& data) DECL_OVERRIDE;
+
+  /** \brief sends Nack
+   *  This class does not send out a Nack.
+   */
+  void
+  doSendNack(const ndn::lp::Nack& nack) DECL_OVERRIDE;
+
+private: // receive path entrypoint
+  /** \brief receives Packet
+   */
+  void
+  doReceivePacket(Transport::Packet&& packet) DECL_OVERRIDE;
+};
+
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_GENERIC_LINK_SERVICE_HPP
\ No newline at end of file
diff --git a/daemon/face/link-service.cpp b/daemon/face/link-service.cpp
new file mode 100644
index 0000000..3f19388
--- /dev/null
+++ b/daemon/face/link-service.cpp
@@ -0,0 +1,135 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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/>.
+ */
+
+#include "link-service.hpp"
+#include "lp-face.hpp"
+#include "transport.hpp"
+
+namespace nfd {
+namespace face {
+
+NFD_LOG_INIT("LinkService");
+
+LinkService::LinkService()
+  : m_face(nullptr)
+  , m_transport(nullptr)
+  , m_counters(nullptr)
+{
+}
+
+LinkService::~LinkService()
+{
+}
+
+void
+LinkService::setFaceAndTransport(LpFace& face, Transport& transport)
+{
+  BOOST_ASSERT(m_face == nullptr);
+  BOOST_ASSERT(m_transport == nullptr);
+
+  m_face = &face;
+  m_transport = &transport;
+  m_counters = &m_face->getMutableCounters();
+}
+
+void
+LinkService::sendInterest(const Interest& interest)
+{
+  BOOST_ASSERT(m_transport != nullptr);
+  NFD_LOG_FACE_TRACE(__func__);
+
+  ++m_counters->getNOutInterests();
+
+  doSendInterest(interest);
+}
+
+void
+LinkService::sendData(const Data& data)
+{
+  BOOST_ASSERT(m_transport != nullptr);
+  NFD_LOG_FACE_TRACE(__func__);
+
+  ++m_counters->getNOutDatas();
+
+  doSendData(data);
+}
+
+void
+LinkService::sendNack(const ndn::lp::Nack& nack)
+{
+  BOOST_ASSERT(m_transport != nullptr);
+  NFD_LOG_FACE_TRACE(__func__);
+
+  // TODO#3177 increment counter
+
+  doSendNack(nack);
+}
+
+void
+LinkService::receiveInterest(const Interest& interest)
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  ++m_counters->getNInInterests();
+
+  afterReceiveInterest(interest);
+}
+
+void
+LinkService::receiveData(const Data& data)
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  ++m_counters->getNInDatas();
+
+  afterReceiveData(data);
+}
+
+void
+LinkService::receiveNack(const ndn::lp::Nack& nack)
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  // TODO#3177 increment counter
+
+  afterReceiveNack(nack);
+}
+
+std::ostream&
+operator<<(std::ostream& os, const FaceLogHelper<LinkService>& flh)
+{
+  const LpFace* face = flh.obj.getFace();
+  if (face == nullptr) {
+    os << "[id=0,local=unknown,remote=unknown] ";
+  }
+  else {
+    os << "[id=" << face->getId() << ",local=" << face->getLocalUri()
+       << ",remote=" << face->getRemoteUri() << "] ";
+  }
+  return os;
+}
+
+} // namespace face
+} // namespace nfd
diff --git a/daemon/face/link-service.hpp b/daemon/face/link-service.hpp
new file mode 100644
index 0000000..1b7bda8
--- /dev/null
+++ b/daemon/face/link-service.hpp
@@ -0,0 +1,198 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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_FACE_LINK_SERVICE_HPP
+#define NFD_DAEMON_FACE_LINK_SERVICE_HPP
+
+#include "transport.hpp"
+#include "face-log.hpp"
+
+namespace nfd {
+namespace face {
+
+class LpFace;
+
+/** \brief the upper part of an LpFace
+ *  \sa LpFace
+ */
+class LinkService : noncopyable
+{
+public:
+  LinkService();
+
+  virtual
+  ~LinkService();
+
+  /** \brief set Face and Transport for LinkService
+   *  \pre setFaceAndTransport has not been called
+   */
+  void
+  setFaceAndTransport(LpFace& face, Transport& transport);
+
+  /** \return Face to which this LinkService is attached
+   */
+  const LpFace*
+  getFace() const;
+
+  /** \return Transport to which this LinkService is attached
+   */
+  const Transport*
+  getTransport() const;
+
+  /** \return Transport to which this LinkService is attached
+   */
+  Transport*
+  getTransport();
+
+public: // upper interface to be used by forwarding
+  /** \brief send Interest
+   *  \pre setTransport has been called
+   */
+  void
+  sendInterest(const Interest& interest);
+
+  /** \brief send Data
+   *  \pre setTransport has been called
+   */
+  void
+  sendData(const Data& data);
+
+  /** \brief send Nack
+   *  \pre setTransport has been called
+   */
+  void
+  sendNack(const ndn::lp::Nack& nack);
+
+  /** \brief signals on Interest received
+   */
+  signal::Signal<LinkService, Interest> afterReceiveInterest;
+
+  /** \brief signals on Data received
+   */
+  signal::Signal<LinkService, Data> afterReceiveData;
+
+  /** \brief signals on Nack received
+   */
+  signal::Signal<LinkService, lp::Nack> afterReceiveNack;
+
+private: // upper interface to be overridden in subclass (send path entrypoint)
+  /** \brief performs LinkService specific operations to send an Interest
+   */
+  virtual void
+  doSendInterest(const Interest& interest) = 0;
+
+  /** \brief performs LinkService specific operations to send a Data
+   */
+  virtual void
+  doSendData(const Data& data) = 0;
+
+  /** \brief performs LinkService specific operations to send a Nack
+   */
+  virtual void
+  doSendNack(const lp::Nack& nack) = 0;
+
+protected: // upper interface to be invoked in subclass (receive path termination)
+  /** \brief delivers received Interest to forwarding
+   */
+  void
+  receiveInterest(const Interest& interest);
+
+  /** \brief delivers received Data to forwarding
+   */
+  void
+  receiveData(const Data& data);
+
+  /** \brief delivers received Nack to forwarding
+   */
+  void
+  receiveNack(const lp::Nack& nack);
+
+public: // lower interface to be invoked by Transport
+  /** \brief performs LinkService specific operations to receive a lower-layer packet
+   */
+  void
+  receivePacket(Transport::Packet&& packet);
+
+protected: // lower interface to be invoked in subclass (send path termination)
+  /** \brief sends a lower-layer packet via Transport
+   */
+  void
+  sendPacket(Transport::Packet&& packet);
+
+private: // lower interface to be overridden in subclass
+  virtual void
+  doReceivePacket(Transport::Packet&& packet) = 0;
+
+private:
+  LpFace* m_face;
+  Transport* m_transport;
+  NetworkLayerCounters* m_counters; // TODO#3177 change into NetCounters
+};
+
+inline const LpFace*
+LinkService::getFace() const
+{
+  return m_face;
+}
+
+inline const Transport*
+LinkService::getTransport() const
+{
+  return m_transport;
+}
+
+inline Transport*
+LinkService::getTransport()
+{
+  return m_transport;
+}
+
+inline void
+LinkService::receivePacket(Transport::Packet&& packet)
+{
+  doReceivePacket(std::move(packet));
+}
+
+inline void
+LinkService::sendPacket(Transport::Packet&& packet)
+{
+  m_transport->send(std::move(packet));
+}
+
+std::ostream&
+operator<<(std::ostream& os, const FaceLogHelper<LinkService>& flh);
+
+template<typename T>
+typename std::enable_if<std::is_base_of<LinkService, T>::value &&
+                        !std::is_same<LinkService, T>::value, std::ostream&>::type
+operator<<(std::ostream& os, const FaceLogHelper<T>& flh)
+{
+  return os << FaceLogHelper<LinkService>(flh.obj);
+}
+
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_LINK_SERVICE_HPP
diff --git a/daemon/face/lp-face-wrapper.cpp b/daemon/face/lp-face-wrapper.cpp
new file mode 100644
index 0000000..920997a
--- /dev/null
+++ b/daemon/face/lp-face-wrapper.cpp
@@ -0,0 +1,102 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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/>.
+ */
+
+#include "lp-face-wrapper.hpp"
+
+namespace nfd {
+namespace face {
+
+LpFaceWrapper::LpFaceWrapper(unique_ptr<LpFace> face)
+  : Face(face->getRemoteUri(), face->getLocalUri(),
+         face->getScope() == ndn::nfd::FACE_SCOPE_LOCAL,
+         face->getLinkType() == ndn::nfd::LINK_TYPE_MULTI_ACCESS)
+  , m_face(std::move(face))
+{
+  this->Face::setPersistency(m_face->getPersistency());
+  m_face->afterReceiveInterest.connect(bind(&LpFaceWrapper::dispatchInterest, this, _1));
+  m_face->afterReceiveData.connect(bind(&LpFaceWrapper::dispatchData, this, _1));
+  m_face->afterReceiveNack.connect(bind(&LpFaceWrapper::dispatchNack, this, _1));
+  m_face->afterStateChange.connect(bind(&LpFaceWrapper::handleStateChange, this, _1, _2));
+}
+
+void
+LpFaceWrapper::setPersistency(ndn::nfd::FacePersistency persistency)
+{
+  this->Face::setPersistency(persistency);
+  m_face->setPersistency(persistency);
+}
+
+void
+LpFaceWrapper::setId(nfd::FaceId faceId)
+{
+  this->Face::setId(faceId);
+
+  FaceId lpId = static_cast<FaceId>(faceId);
+  if (faceId == nfd::INVALID_FACEID) {
+    lpId = INVALID_FACEID;
+  }
+  m_face->setId(lpId);
+}
+
+void
+LpFaceWrapper::dispatchInterest(const Interest& interest)
+{
+  this->emitSignal(onReceiveInterest, interest);
+}
+
+void
+LpFaceWrapper::dispatchData(const Data& data)
+{
+  this->emitSignal(onReceiveData, data);
+}
+
+void
+LpFaceWrapper::dispatchNack(const ndn::lp::Nack& nack)
+{
+  this->emitSignal(onReceiveNack, nack);
+}
+
+void
+LpFaceWrapper::handleStateChange(FaceState oldState, FaceState newState)
+{
+  if (newState != FaceState::CLOSED) {
+    return;
+  }
+
+  switch (oldState) {
+  case FaceState::CLOSING:
+    this->fail("LpFace closed");
+    break;
+  case FaceState::FAILED:
+    this->fail("LpFace failed");
+    break;
+  default:
+    BOOST_ASSERT(false);
+    break;
+  }
+}
+
+} // namespace face
+} // namespace nfd
diff --git a/daemon/face/lp-face-wrapper.hpp b/daemon/face/lp-face-wrapper.hpp
new file mode 100644
index 0000000..084094f
--- /dev/null
+++ b/daemon/face/lp-face-wrapper.hpp
@@ -0,0 +1,140 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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_FACE_LP_FACE_WRAPPER_HPP
+#define NFD_DAEMON_FACE_LP_FACE_WRAPPER_HPP
+
+#include "common.hpp"
+#include "face.hpp"
+#include "lp-face.hpp"
+
+namespace nfd {
+namespace face {
+
+/** \brief an adaptor to provide old Face APIs from an LpFace
+ *  \sa LpFace
+ *  \note When LpFace is adapted by LpFaceWrapper,
+ *        FaceId and counters will come from old Face rather than LpFace.
+ */
+class LpFaceWrapper : public Face
+{
+public:
+  explicit
+  LpFaceWrapper(unique_ptr<LpFace> face);
+
+  LpFace*
+  getLpFace();
+
+  virtual void
+  sendInterest(const Interest& interest) DECL_OVERRIDE;
+
+  virtual void
+  sendData(const Data& data) DECL_OVERRIDE;
+
+  virtual void
+  sendNack(const lp::Nack& nack) DECL_OVERRIDE;
+
+  virtual void
+  close() DECL_OVERRIDE;
+
+  virtual bool
+  isUp() const DECL_OVERRIDE;
+
+  virtual void
+  setPersistency(ndn::nfd::FacePersistency persistency) DECL_OVERRIDE;
+
+  virtual const FaceCounters&
+  getCounters() const DECL_OVERRIDE;
+
+protected:
+  virtual void
+  setId(nfd::FaceId faceId) DECL_OVERRIDE;
+
+private:
+  void
+  dispatchInterest(const Interest& interest);
+
+  void
+  dispatchData(const Data& data);
+
+  void
+  dispatchNack(const lp::Nack& nack);
+
+  void
+  handleStateChange(FaceState oldState, FaceState newState);
+
+private:
+  unique_ptr<LpFace> m_face;
+};
+
+inline LpFace*
+LpFaceWrapper::getLpFace()
+{
+  return m_face.get();
+}
+
+inline void
+LpFaceWrapper::sendInterest(const Interest& interest)
+{
+  this->emitSignal(onSendInterest, interest);
+  m_face->sendInterest(interest);
+}
+
+inline void
+LpFaceWrapper::sendData(const Data& data)
+{
+  this->emitSignal(onSendData, data);
+  m_face->sendData(data);
+}
+
+inline void
+LpFaceWrapper::sendNack(const lp::Nack& nack)
+{
+  this->emitSignal(onSendNack, nack);
+  m_face->sendNack(nack);
+}
+
+inline void
+LpFaceWrapper::close()
+{
+  m_face->close();
+}
+
+inline bool
+LpFaceWrapper::isUp() const
+{
+  return m_face->getState() == FaceState::UP;
+}
+
+inline const FaceCounters&
+LpFaceWrapper::getCounters() const
+{
+  return m_face->getCounters();
+}
+
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_LP_FACE_WRAPPER_HPP
diff --git a/daemon/face/lp-face.cpp b/daemon/face/lp-face.cpp
new file mode 100644
index 0000000..0b2e826
--- /dev/null
+++ b/daemon/face/lp-face.cpp
@@ -0,0 +1,45 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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/>.
+ */
+
+#include "lp-face.hpp"
+
+namespace nfd {
+namespace face {
+
+LpFace::LpFace(unique_ptr<LinkService> service, unique_ptr<Transport> transport)
+  : afterReceiveInterest(service->afterReceiveInterest)
+  , afterReceiveData(service->afterReceiveData)
+  , afterReceiveNack(service->afterReceiveNack)
+  , afterStateChange(transport->afterStateChange)
+  , m_id(INVALID_FACEID)
+  , m_service(std::move(service))
+  , m_transport(std::move(transport))
+{
+  m_service->setFaceAndTransport(*this, *m_transport);
+  m_transport->setFaceAndLinkService(*this, *m_service);
+}
+
+} // namespace face
+} // namespace nfd
diff --git a/daemon/face/lp-face.hpp b/daemon/face/lp-face.hpp
new file mode 100644
index 0000000..d825928
--- /dev/null
+++ b/daemon/face/lp-face.hpp
@@ -0,0 +1,311 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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_LP_FACE_HPP
+#define NFD_DAEMON_LP_FACE_HPP
+
+#include "transport.hpp"
+#include "link-service.hpp"
+#include "face-log.hpp"
+
+namespace nfd {
+namespace face {
+
+/** \brief identifies a face
+ */
+typedef uint64_t FaceId;
+
+/// indicates an invalid FaceId
+const FaceId INVALID_FACEID = 0;
+/// identifies the InternalFace used in management
+const FaceId FACEID_INTERNAL_FACE = 1;
+/// identifies a packet comes from the ContentStore, in LocalControlHeader incomingFaceId
+const FaceId FACEID_CONTENT_STORE = 254;
+/// identifies the NullFace that drops every packet
+const FaceId FACEID_NULL = 255;
+/// upper bound of reserved FaceIds
+const FaceId FACEID_RESERVED_MAX = 255;
+
+/** \brief indicates the state of a face
+ */
+typedef TransportState FaceState;
+
+/** \brief generalization of a network interface
+ *
+ *  A face generalizes a network interface.
+ *  It provides network-layer packet delivery services on a physical interface,
+ *  an overlay tunnel, or a link to a local application, with best-effort.
+ *
+ *  A face combines two parts: LinkService and Transport.
+ *  Transport is the lower part, which provides TLV block delivery services with best-effort.
+ *  LinkService is the upper part, which translates between network-layer packets
+ *  and TLV blocks, and may provide additional services such as fragmentation and reassembly.
+ *
+ *  We are in the process of refactoring face system to use this LinkService+Transport
+ *  architecture. During this process, the "face" is named LpFace, and we implement a
+ *  LpFaceWrapper class as an adaptor to the old Face APIs. After the completion of refactoring,
+ *  LpFace will be renamed to Face.
+ */
+class LpFace
+#ifndef WITH_TESTS
+DECL_CLASS_FINAL
+#endif
+  : noncopyable
+{
+public:
+  LpFace(unique_ptr<LinkService> service, unique_ptr<Transport> transport);
+
+  LinkService*
+  getLinkService();
+
+  Transport*
+  getTransport();
+
+public: // upper interface connected to forwarding
+  /** \brief sends Interest on Face
+   */
+  void
+  sendInterest(const Interest& interest);
+
+  /** \brief sends Data on Face
+   */
+  void
+  sendData(const Data& data);
+
+  /** \brief sends Nack on Face
+   */
+  void
+  sendNack(const lp::Nack& nack);
+
+  /** \brief signals on Interest received
+   */
+  signal::Signal<LinkService, Interest>& afterReceiveInterest;
+
+  /** \brief signals on Data received
+   */
+  signal::Signal<LinkService, Data>& afterReceiveData;
+
+  /** \brief signals on Nack received
+   */
+  signal::Signal<LinkService, lp::Nack>& afterReceiveNack;
+
+public: // static properties
+  /** \return face ID
+   */
+  FaceId
+  getId() const;
+
+  /** \brief sets face ID
+   *  \note Normally, this should only be invoked by FaceTable.
+   */
+  void
+  setId(FaceId id);
+
+  /** \return a FaceUri representing local endpoint
+   */
+  FaceUri
+  getLocalUri() const;
+
+  /** \return a FaceUri representing remote endpoint
+   */
+  FaceUri
+  getRemoteUri() const;
+
+  /** \return whether face is local or non-local for scope control purpose
+   */
+  ndn::nfd::FaceScope
+  getScope() const;
+
+  /** \return face persistency setting
+   */
+  ndn::nfd::FacePersistency
+  getPersistency() const;
+
+  /** \brief changes face persistency setting
+   */
+  void
+  setPersistency(ndn::nfd::FacePersistency persistency);
+
+  /** \return whether face is point-to-point or multi-access
+   */
+  ndn::nfd::LinkType
+  getLinkType() const;
+
+public: // dynamic properties
+  /** \return face state
+   */
+  FaceState
+  getState() const;
+
+  /** \brief signals after face state changed
+   */
+  signal::Signal<Transport, FaceState/*old*/, FaceState/*new*/>& afterStateChange;
+
+  /** \brief request the face to be closed
+   *
+   *  This operation is effective only if face is in UP or DOWN state,
+   *  otherwise it has no effect.
+   *  The face changes state to CLOSING, and performs cleanup procedure.
+   *  The state will be changed to CLOSED when cleanup is complete, which may
+   *  happen synchronously or asynchronously.
+   *
+   *  \warning the face must not be deallocated until its state changes to CLOSED
+   */
+  void
+  close();
+
+  const FaceCounters&
+  getCounters() const;
+
+  FaceCounters&
+  getMutableCounters();
+
+private:
+  FaceId m_id;
+  unique_ptr<LinkService> m_service;
+  unique_ptr<Transport> m_transport;
+  FaceCounters m_counters;
+};
+
+inline LinkService*
+LpFace::getLinkService()
+{
+  return m_service.get();
+}
+
+inline Transport*
+LpFace::getTransport()
+{
+  return m_transport.get();
+}
+
+inline void
+LpFace::sendInterest(const Interest& interest)
+{
+  m_service->sendInterest(interest);
+}
+
+inline void
+LpFace::sendData(const Data& data)
+{
+  m_service->sendData(data);
+}
+
+inline void
+LpFace::sendNack(const lp::Nack& nack)
+{
+  m_service->sendNack(nack);
+}
+
+inline FaceId
+LpFace::getId() const
+{
+  return m_id;
+}
+
+inline void
+LpFace::setId(FaceId id)
+{
+  m_id = id;
+}
+
+inline FaceUri
+LpFace::getLocalUri() const
+{
+  return m_transport->getLocalUri();
+}
+
+inline FaceUri
+LpFace::getRemoteUri() const
+{
+  return m_transport->getRemoteUri();
+}
+
+inline ndn::nfd::FaceScope
+LpFace::getScope() const
+{
+  return m_transport->getScope();
+}
+
+inline ndn::nfd::FacePersistency
+LpFace::getPersistency() const
+{
+  return m_transport->getPersistency();
+}
+
+inline void
+LpFace::setPersistency(ndn::nfd::FacePersistency persistency)
+{
+  return m_transport->setPersistency(persistency);
+}
+
+inline ndn::nfd::LinkType
+LpFace::getLinkType() const
+{
+  return m_transport->getLinkType();
+}
+
+inline FaceState
+LpFace::getState() const
+{
+  return m_transport->getState();
+}
+
+inline void
+LpFace::close()
+{
+  m_transport->close();
+}
+
+inline const FaceCounters&
+LpFace::getCounters() const
+{
+  return m_counters;
+}
+
+inline FaceCounters&
+LpFace::getMutableCounters()
+{
+  return m_counters;
+}
+
+template<typename T>
+typename std::enable_if<std::is_base_of<LpFace, T>::value, std::ostream&>::type
+operator<<(std::ostream& os, const FaceLogHelper<T>& flh)
+{
+  const LpFace& face = flh.obj;
+  os << "[id=" << face.getId() << ",local=" << face.getLocalUri() <<
+        ",remote=" << face.getRemoteUri() << "] ";
+  return os;
+}
+
+} // namespace face
+
+// using face::FaceId; // TODO uncomment in #3172
+using face::LpFace;
+
+} // namespace nfd
+
+#endif // NFD_DAEMON_LP_FACE_HPP
diff --git a/daemon/face/transport.cpp b/daemon/face/transport.cpp
new file mode 100644
index 0000000..fa1159d
--- /dev/null
+++ b/daemon/face/transport.cpp
@@ -0,0 +1,169 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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/>.
+ */
+
+#include "transport.hpp"
+#include "lp-face.hpp"
+#include "link-service.hpp"
+
+namespace nfd {
+namespace face {
+
+NFD_LOG_INIT("Transport");
+
+std::ostream&
+operator<<(std::ostream& os, TransportState state)
+{
+  switch (state) {
+  case TransportState::UP:
+    return os << "UP";
+  case TransportState::DOWN:
+    return os << "DOWN";
+  case TransportState::CLOSING:
+    return os << "CLOSING";
+  case TransportState::FAILED:
+    return os << "FAILED";
+  case TransportState::CLOSED:
+    return os << "CLOSED";
+  default:
+    return os << "NONE";
+  }
+}
+
+Transport::Packet::Packet(Block&& packet1)
+  : packet(std::move(packet1))
+{
+}
+
+Transport::Transport()
+  : m_face(nullptr)
+  , m_service(nullptr)
+  , m_scope(ndn::nfd::FACE_SCOPE_NON_LOCAL)
+  , m_persistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
+  , m_linkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT)
+  , m_state(TransportState::UP)
+  , m_counters(nullptr)
+{
+}
+
+Transport::~Transport()
+{
+}
+
+void
+Transport::setFaceAndLinkService(LpFace& face, LinkService& service)
+{
+  BOOST_ASSERT(m_face == nullptr);
+  BOOST_ASSERT(m_service == nullptr);
+
+  m_face = &face;
+  m_service = &service;
+  m_counters = &m_face->getMutableCounters();
+}
+
+void
+Transport::close()
+{
+  if (m_state != TransportState::UP && m_state != TransportState::DOWN) {
+    return;
+  }
+
+  this->setState(TransportState::CLOSING);
+  this->doClose();
+  // warning: don't access any fields after this:
+  // the Transport may be deallocated if doClose changes state to CLOSED
+}
+
+void
+Transport::send(Transport::Packet&& packet)
+{
+  // TODO#3177 increment LpPacket counter
+  m_counters->getNOutBytes() += packet.packet.size();
+
+  this->doSend(std::move(packet));
+}
+
+void
+Transport::receive(Transport::Packet&& packet)
+{
+  // TODO#3177 increment LpPacket counter
+  m_counters->getNInBytes() += packet.packet.size();
+
+  m_service->receivePacket(std::move(packet));
+}
+
+void
+Transport::setState(TransportState newState)
+{
+  if (m_state == newState) {
+    return;
+  }
+
+  bool isValid = false;
+  switch (m_state) {
+    case TransportState::UP:
+      isValid = newState == TransportState::DOWN ||
+                newState == TransportState::CLOSING ||
+                newState == TransportState::FAILED;
+      break;
+    case TransportState::DOWN:
+      isValid = newState == TransportState::UP ||
+                newState == TransportState::CLOSING ||
+                newState == TransportState::FAILED;
+      break;
+    case TransportState::CLOSING:
+    case TransportState::FAILED:
+      isValid = newState == TransportState::CLOSED;
+      break;
+    default:
+      break;
+  }
+
+  if (!isValid) {
+    throw std::runtime_error("invalid state transition");
+  }
+
+  NFD_LOG_FACE_INFO("setState " << m_state << " -> " << newState);
+
+  TransportState oldState = m_state;
+  m_state = newState;
+  afterStateChange(oldState, newState);
+  // warning: don't access any fields after this:
+  // the Transport may be deallocated in the signal handler if newState is CLOSED
+}
+
+std::ostream&
+operator<<(std::ostream& os, const FaceLogHelper<Transport>& flh)
+{
+  const Transport& transport = flh.obj;
+  const LpFace* face = transport.getFace();
+  FaceId faceId = face == nullptr ? INVALID_FACEID : face->getId();
+
+  os << "[id=" << faceId << ",local=" << transport.getLocalUri()
+     << ",remote=" << transport.getRemoteUri() << "] ";
+  return os;
+}
+
+} // namespace face
+} // namespace nfd
diff --git a/daemon/face/transport.hpp b/daemon/face/transport.hpp
new file mode 100644
index 0000000..144e0dc
--- /dev/null
+++ b/daemon/face/transport.hpp
@@ -0,0 +1,340 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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_FACE_TRANSPORT_HPP
+#define NFD_DAEMON_FACE_TRANSPORT_HPP
+
+#include "common.hpp"
+
+#include "face-counters.hpp"
+#include "face-log.hpp"
+
+namespace nfd {
+namespace face {
+
+class LpFace;
+class LinkService;
+
+/** \brief indicates the state of a transport
+ */
+enum class TransportState {
+  NONE,
+  UP, ///< the transport is up
+  DOWN, ///< the transport is down temporarily, and is being recovered
+  CLOSING, ///< the transport is requested to be closed
+  FAILED, ///< the transport is being closed due to a failure
+  CLOSED ///< the transport is closed, and can be safely deallocated
+};
+
+std::ostream&
+operator<<(std::ostream& os, TransportState state);
+
+/** \brief the lower part of an LpFace
+ *  \sa LpFace
+ */
+class Transport : noncopyable
+{
+public:
+  /** \brief identifies an endpoint on the link
+   */
+  typedef uint64_t EndpointId;
+
+  /** \brief stores a packet along with the remote endpoint
+   */
+  class Packet
+  {
+  public:
+    Packet() = default;
+
+    explicit
+    Packet(Block&& packet);
+
+  public:
+    /** \brief the packet as a TLV block
+     */
+    Block packet;
+
+    /** \brief identifies the remote endpoint
+     *
+     *  This ID is only meaningful in the context of the same Transport.
+     *  Incoming packets from the same remote endpoint have the same EndpointId,
+     *  and incoming packets from different remote endpoints have different EndpointIds.
+     */
+    EndpointId remoteEndpoint;
+  };
+
+  Transport();
+
+  virtual
+  ~Transport();
+
+public:
+  /** \brief set Face and LinkService for Transport
+   *  \pre setFaceAndLinkService has not been called
+   */
+  void
+  setFaceAndLinkService(LpFace& face, LinkService& service);
+
+  /** \return Face to which this Transport is attached
+   */
+  const LpFace*
+  getFace() const;
+
+  /** \return LinkService to which this Transport is attached
+   */
+  const LinkService*
+  getLinkService() const;
+
+  /** \return LinkService to which this Transport is attached
+   */
+  LinkService*
+  getLinkService();
+
+public: // upper interface
+  /** \brief request the transport to be closed
+   *
+   *  This operation is effective only if transport is in UP or DOWN state,
+   *  otherwise it has no effect.
+   *  The transport changes state to CLOSING, and performs cleanup procedure.
+   *  The state will be changed to CLOSED when cleanup is complete, which may
+   *  happen synchronously or asynchronously.
+   */
+  void
+  close();
+
+  /** \brief send a link-layer packet
+   */
+  void
+  send(Packet&& packet);
+
+protected: // upper interface to be invoked by subclass
+  /** \brief receive a link-layer packet
+   */
+  void
+  receive(Packet&& packet);
+
+public: // static properties
+  /** \return a FaceUri representing local endpoint
+   */
+  FaceUri
+  getLocalUri() const;
+
+  /** \return a FaceUri representing remote endpoint
+   */
+  FaceUri
+  getRemoteUri() const;
+
+  /** \return whether face is local or non-local for scope control purpose
+   */
+  ndn::nfd::FaceScope
+  getScope() const;
+
+  /** \return face persistency setting
+   */
+  ndn::nfd::FacePersistency
+  getPersistency() const;
+
+  /** \brief changes face persistency setting
+   */
+  void
+  setPersistency(ndn::nfd::FacePersistency persistency);
+
+  /** \return whether face is point-to-point or multi-access
+   */
+  ndn::nfd::LinkType
+  getLinkType() const;
+
+public: // dynamic properties
+  /** \return transport state
+   */
+  TransportState
+  getState() const;
+
+  /** \brief signals when transport state changes
+   */
+  signal::Signal<Transport, TransportState/*old*/, TransportState/*new*/> afterStateChange;
+
+protected: // properties to be set by subclass
+  void
+  setLocalUri(const FaceUri& uri);
+
+  void
+  setRemoteUri(const FaceUri& uri);
+
+  void
+  setScope(ndn::nfd::FaceScope scope);
+
+  void
+  setLinkType(ndn::nfd::LinkType linkType);
+
+  /** \brief set transport state
+   *
+   *  Only the following transitions are valid:
+   *  UP->DOWN, DOWN->UP, UP/DOWN->CLOSING/FAILED, CLOSING/FAILED->CLOSED
+   *
+   *  \throw std::runtime_error transition is invalid.
+   */
+  void
+  setState(TransportState newState);
+
+protected: // to be overridden by subclass
+  /** \brief invoked before persistency is changed
+   *  \throw std::invalid_argument new persistency is not supported
+   *  \throw std::runtime_error transition is disallowed
+   *
+   *  Base class implementation does nothing.
+   */
+  virtual void
+  beforeChangePersistency(ndn::nfd::FacePersistency newPersistency)
+  {
+  }
+
+  /** \brief performs Transport specific operations to close the transport
+   *
+   *  When the cleanup procedure is complete, this method should change state to CLOSED.
+   *  This can happen synchronously or asynchronously.
+   */
+  virtual void
+  doClose() = 0;
+
+private: // to be overridden by subclass
+  /** \brief performs Transport specific operations to send a packet
+   *  \param packet the packet, which must be a well-formed TLV block
+   */
+  virtual void
+  doSend(Packet&& packet) = 0;
+
+private:
+  LpFace* m_face;
+  LinkService* m_service;
+  FaceUri m_localUri;
+  FaceUri m_remoteUri;
+  ndn::nfd::FaceScope m_scope;
+  ndn::nfd::FacePersistency m_persistency;
+  ndn::nfd::LinkType m_linkType;
+  TransportState m_state;
+  LinkLayerCounters* m_counters; // TODO#3177 change into LinkCounters
+};
+
+inline const LpFace*
+Transport::getFace() const
+{
+  return m_face;
+}
+
+inline const LinkService*
+Transport::getLinkService() const
+{
+  return m_service;
+}
+
+inline LinkService*
+Transport::getLinkService()
+{
+  return m_service;
+}
+
+inline FaceUri
+Transport::getLocalUri() const
+{
+  return m_localUri;
+}
+
+inline FaceUri
+Transport::getRemoteUri() const
+{
+  return m_remoteUri;
+}
+
+inline ndn::nfd::FaceScope
+Transport::getScope() const
+{
+  return m_scope;
+}
+
+inline ndn::nfd::FacePersistency
+Transport::getPersistency() const
+{
+  return m_persistency;
+}
+
+inline void
+Transport::setPersistency(ndn::nfd::FacePersistency persistency)
+{
+  this->beforeChangePersistency(persistency);
+  m_persistency = persistency;
+}
+
+inline ndn::nfd::LinkType
+Transport::getLinkType() const
+{
+  return m_linkType;
+}
+
+inline TransportState
+Transport::getState() const
+{
+  return m_state;
+}
+
+inline void
+Transport::setLocalUri(const FaceUri& uri)
+{
+  m_localUri = uri;
+}
+
+inline void
+Transport::setRemoteUri(const FaceUri& uri)
+{
+  m_remoteUri = uri;
+}
+
+inline void
+Transport::setScope(ndn::nfd::FaceScope scope)
+{
+  m_scope = scope;
+}
+
+inline void
+Transport::setLinkType(ndn::nfd::LinkType linkType)
+{
+  m_linkType = linkType;
+}
+
+std::ostream&
+operator<<(std::ostream& os, const FaceLogHelper<Transport>& flh);
+
+template<typename T>
+typename std::enable_if<std::is_base_of<Transport, T>::value &&
+                        !std::is_same<Transport, T>::value, std::ostream&>::type
+operator<<(std::ostream& os, const FaceLogHelper<T>& flh)
+{
+  return os << FaceLogHelper<Transport>(flh.obj);
+}
+
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_TRANSPORT_HPP
diff --git a/tests/daemon/face/dummy-lp-face.cpp b/tests/daemon/face/dummy-lp-face.cpp
new file mode 100644
index 0000000..20fb20d
--- /dev/null
+++ b/tests/daemon/face/dummy-lp-face.cpp
@@ -0,0 +1,140 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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/>.
+ */
+
+#include "dummy-lp-face.hpp"
+#include "dummy-transport.hpp"
+
+namespace nfd {
+namespace face {
+namespace tests {
+
+class DummyLpFace::LinkService : public face::LinkService
+{
+public:
+  void
+  receiveInterest(const Interest& interest)
+  {
+    this->face::LinkService::receiveInterest(interest);
+  }
+
+  void
+  receiveData(const Data& data)
+  {
+    this->face::LinkService::receiveData(data);
+  }
+
+  void
+  receiveNack(const lp::Nack& nack)
+  {
+    this->face::LinkService::receiveNack(nack);
+  }
+
+  signal::Signal<LinkService> afterSend;
+
+private:
+  virtual void
+  doSendInterest(const Interest& interest) DECL_OVERRIDE
+  {
+    this->sentInterests.push_back(interest);
+    this->afterSend();
+  }
+
+  virtual void
+  doSendData(const Data& data) DECL_OVERRIDE
+  {
+    this->sentData.push_back(data);
+    this->afterSend();
+  }
+
+  virtual void
+  doSendNack(const lp::Nack& nack) DECL_OVERRIDE
+  {
+    this->sentNacks.push_back(nack);
+    this->afterSend();
+  }
+
+  virtual void
+  doReceivePacket(Transport::Packet&& packet) DECL_OVERRIDE
+  {
+    BOOST_ASSERT(false);
+  }
+
+public:
+  std::vector<Interest> sentInterests;
+  std::vector<Data> sentData;
+  std::vector<lp::Nack> sentNacks;
+};
+
+DummyLpFace::DummyLpFace(const std::string& localUri, const std::string& remoteUri,
+                         ndn::nfd::FaceScope scope, ndn::nfd::FacePersistency persistency,
+                         ndn::nfd::LinkType linkType)
+  : LpFace(make_unique<LinkService>(),
+           make_unique<DummyTransport>(localUri, remoteUri, scope, persistency, linkType))
+  , afterSend(this->getLinkServiceInternal()->afterSend)
+  , sentInterests(this->getLinkServiceInternal()->sentInterests)
+  , sentData(this->getLinkServiceInternal()->sentData)
+  , sentNacks(this->getLinkServiceInternal()->sentNacks)
+{
+}
+
+void
+DummyLpFace::setState(FaceState state)
+{
+  this->getTransportInternal()->setState(state);
+}
+
+void
+DummyLpFace::receiveInterest(const Interest& interest)
+{
+  this->getLinkServiceInternal()->receiveInterest(interest);
+}
+
+void
+DummyLpFace::receiveData(const Data& data)
+{
+  this->getLinkServiceInternal()->receiveData(data);
+}
+
+void
+DummyLpFace::receiveNack(const lp::Nack& nack)
+{
+  this->getLinkServiceInternal()->receiveNack(nack);
+}
+
+DummyLpFace::LinkService*
+DummyLpFace::getLinkServiceInternal()
+{
+  return static_cast<LinkService*>(this->getLinkService());
+}
+
+DummyTransport*
+DummyLpFace::getTransportInternal()
+{
+  return static_cast<DummyTransport*>(this->getTransport());
+}
+
+} // namespace tests
+} // namespace face
+} // namespace nfd
diff --git a/tests/daemon/face/dummy-lp-face.hpp b/tests/daemon/face/dummy-lp-face.hpp
new file mode 100644
index 0000000..588cb59
--- /dev/null
+++ b/tests/daemon/face/dummy-lp-face.hpp
@@ -0,0 +1,99 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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_TESTS_DAEMON_FACE_DUMMY_LP_FACE_HPP
+#define NFD_TESTS_DAEMON_FACE_DUMMY_LP_FACE_HPP
+
+#include "face/lp-face.hpp"
+
+namespace nfd {
+namespace face {
+namespace tests {
+
+class DummyTransport;
+
+/** \brief a LpFace for unit testing
+ *
+ *  The DummyLpFace allows observing outgoing network-layer packets,
+ *  and allows incoming network-layer packets to be injected from a test suite.
+ *  It's primarily used for forwarding test suites, but can be used in other tests as well.
+ */
+class DummyLpFace : public LpFace
+{
+public:
+  class LinkService;
+
+  DummyLpFace(const std::string& localUri = "dummy://", const std::string& remoteUri = "dummy://",
+              ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_NON_LOCAL,
+              ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+              ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_POINT_TO_POINT);
+
+  /** \brief changes face state
+   *  \pre current state is not CLOSED or FAILED
+   */
+  void
+  setState(FaceState state);
+
+  /** \brief causes the face to receive an Interest
+   */
+  void
+  receiveInterest(const Interest& interest);
+
+  /** \brief causes the face to receive a Data
+   */
+  void
+  receiveData(const Data& data);
+
+  /** \brief causes the face to receive a Nack
+   */
+  void
+  receiveNack(const lp::Nack& nack);
+
+  /** \brief signals after any network-layer packet is sent
+   */
+  signal::Signal<LinkService>& afterSend;
+
+private:
+  LinkService*
+  getLinkServiceInternal();
+
+  DummyTransport*
+  getTransportInternal();
+
+public:
+  std::vector<Interest>& sentInterests;
+  std::vector<Data>& sentData;
+  std::vector<lp::Nack>& sentNacks;
+};
+
+} // namespace tests
+} // namespace face
+
+namespace tests {
+using nfd::face::tests::DummyLpFace;
+} // namespace tests
+} // namespace nfd
+
+#endif // NFD_TESTS_DAEMON_FACE_DUMMY_LP_FACE_HPP
diff --git a/tests/daemon/face/dummy-transport.hpp b/tests/daemon/face/dummy-transport.hpp
new file mode 100644
index 0000000..df8fa54
--- /dev/null
+++ b/tests/daemon/face/dummy-transport.hpp
@@ -0,0 +1,96 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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_TESTS_DAEMON_FACE_DUMMY_TRANSPORT_HPP
+#define NFD_TESTS_DAEMON_FACE_DUMMY_TRANSPORT_HPP
+
+#include "common.hpp"
+
+#include "face/transport.hpp"
+
+namespace nfd {
+namespace face {
+namespace tests {
+
+/** \brief dummy Transport used in unit tests
+ */
+class DummyTransport : public Transport
+{
+public:
+  DummyTransport(const std::string& localUri = "dummy://",
+                 const std::string& remoteUri = "dummy://",
+                 ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_NON_LOCAL,
+                 ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                 ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_POINT_TO_POINT)
+    : isClosed(false)
+  {
+    this->setLocalUri(FaceUri(localUri));
+    this->setRemoteUri(FaceUri(remoteUri));
+    this->setScope(scope);
+    this->setPersistency(persistency);
+    this->setLinkType(linkType);
+  }
+
+  void
+  setState(FaceState state)
+  {
+    this->Transport::setState(state);
+  }
+
+  void
+  receivePacket(Packet&& packet)
+  {
+    this->receive(std::move(packet));
+  }
+
+  void
+  receivePacket(Block block)
+  {
+    this->receive(Packet(std::move(block)));
+  }
+
+private:
+  virtual void
+  doClose() DECL_OVERRIDE
+  {
+    isClosed = true;
+  }
+
+  virtual void
+  doSend(Packet&& packet) DECL_OVERRIDE
+  {
+    sentPackets.push_back(std::move(packet));
+  }
+
+public:
+  bool isClosed;
+  std::vector<Packet> sentPackets;
+};
+
+} // namespace tests
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_TESTS_DAEMON_FACE_DUMMY_TRANSPORT_HPP
diff --git a/tests/daemon/face/generic-link-service.t.cpp b/tests/daemon/face/generic-link-service.t.cpp
new file mode 100644
index 0000000..a918b26
--- /dev/null
+++ b/tests/daemon/face/generic-link-service.t.cpp
@@ -0,0 +1,285 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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/>.
+ */
+
+#include "face/generic-link-service.hpp"
+#include "face/lp-face.hpp"
+#include "dummy-transport.hpp"
+
+#include "tests/test-common.hpp"
+
+namespace nfd {
+namespace face {
+namespace tests {
+
+using namespace nfd::tests;
+
+BOOST_AUTO_TEST_SUITE(Face)
+
+class GenericLinkServiceFixture : public BaseFixture
+{
+protected:
+  GenericLinkServiceFixture()
+    : service(nullptr)
+    , transport(nullptr)
+  {
+    this->initialize();
+    // By default, GenericLinkService is created with default options.
+    // Test cases may invoke .initialize with alternate options.
+  }
+
+  void
+  initialize()
+  {
+    // TODO#3104 add GenericLinkService::Options parameter,
+    //           and create GenericLinkService with options
+    face.reset(new LpFace(make_unique<GenericLinkService>(),
+                          make_unique<DummyTransport>()));
+    service = static_cast<GenericLinkService*>(face->getLinkService());
+    transport = static_cast<DummyTransport*>(face->getTransport());
+
+    face->afterReceiveInterest.connect(
+      [this] (const Interest& interest) { receivedInterests.push_back(interest); });
+    face->afterReceiveData.connect(
+      [this] (const Data& data) { receivedData.push_back(data); });
+    face->afterReceiveNack.connect(
+      [this] (const lp::Nack& nack) { receivedNacks.push_back(nack); });
+  }
+
+protected:
+  unique_ptr<LpFace> face;
+  GenericLinkService* service;
+  DummyTransport* transport;
+  std::vector<Interest> receivedInterests;
+  std::vector<Data> receivedData;
+  std::vector<lp::Nack> receivedNacks;
+};
+
+BOOST_FIXTURE_TEST_SUITE(TestGenericLinkService, GenericLinkServiceFixture)
+
+
+BOOST_AUTO_TEST_SUITE(SimpleSendReceive) // send and receive without other fields
+
+BOOST_AUTO_TEST_CASE(SendInterest)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  shared_ptr<Interest> interest1 = makeInterest("/localhost/test");
+
+  face->sendInterest(*interest1);
+
+  BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1);
+  BOOST_CHECK(transport->sentPackets.back().packet == interest1->wireEncode());
+}
+
+BOOST_AUTO_TEST_CASE(SendData)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  shared_ptr<Data> data1 = makeData("/localhost/test");
+
+  face->sendData(*data1);
+
+  BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1);
+  BOOST_CHECK(transport->sentPackets.back().packet == data1->wireEncode());
+}
+
+BOOST_AUTO_TEST_CASE(SendNack)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  lp::Nack nack1 = makeNack("/localhost/test", 323, lp::NackReason::NO_ROUTE);
+
+  face->sendNack(nack1);
+
+  BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1);
+  lp::Packet nack1pkt;
+  BOOST_REQUIRE_NO_THROW(nack1pkt.wireDecode(transport->sentPackets.back().packet));
+  BOOST_CHECK_EQUAL(nack1pkt.has<lp::NackField>(), true);
+  BOOST_CHECK_EQUAL(nack1pkt.has<lp::FragmentField>(), true);
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveBareInterest)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  shared_ptr<Interest> interest1 = makeInterest("/23Rd9hEiR");
+
+  transport->receivePacket(interest1->wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
+  BOOST_CHECK_EQUAL(receivedInterests.back(), *interest1);
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveInterest)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  shared_ptr<Interest> interest1 = makeInterest("/23Rd9hEiR");
+  lp::Packet lpPacket;
+  lpPacket.set<lp::FragmentField>(std::make_pair(
+    interest1->wireEncode().begin(), interest1->wireEncode().end()));
+  lpPacket.set<lp::SequenceField>(0); // force LpPacket encoding
+
+  transport->receivePacket(lpPacket.wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
+  BOOST_CHECK_EQUAL(receivedInterests.back(), *interest1);
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveBareData)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  shared_ptr<Data> data1 = makeData("/12345678");
+
+  transport->receivePacket(data1->wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
+  BOOST_CHECK_EQUAL(receivedData.back(), *data1);
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveData)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  shared_ptr<Data> data1 = makeData("/12345689");
+  lp::Packet lpPacket;
+  lpPacket.set<lp::FragmentField>(std::make_pair(
+    data1->wireEncode().begin(), data1->wireEncode().end()));
+  lpPacket.set<lp::SequenceField>(0); // force LpPacket encoding
+
+  transport->receivePacket(lpPacket.wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
+  BOOST_CHECK_EQUAL(receivedData.back(), *data1);
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNack)
+{
+  // TODO#3104 initialize with Options that disables all services
+
+  lp::Nack nack1 = makeNack("/localhost/test", 323, lp::NackReason::NO_ROUTE);
+  lp::Packet lpPacket;
+  lpPacket.set<lp::FragmentField>(std::make_pair(
+    nack1.getInterest().wireEncode().begin(), nack1.getInterest().wireEncode().end()));
+  lpPacket.set<lp::NackField>(nack1.getHeader());
+
+  transport->receivePacket(lpPacket.wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedNacks.size(), 1);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // SimpleSendReceive
+
+
+BOOST_AUTO_TEST_SUITE(LocalFields)
+
+BOOST_AUTO_TEST_CASE(SendIncomingFaceId)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 send Interest with IncomingFaceId
+  //           expect transport->sentPackets.back() has IncomingFaceId field
+}
+
+BOOST_AUTO_TEST_CASE(SendIncomingFaceIdDisabled)
+{
+  // TODO#3104 initialize with Options that disables local fields
+  // TODO#3104 send Interest with IncomingFaceId
+  //           expect transport->sentPackets.back() has no IncomingFaceId field
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveIncomingFaceIdIgnore)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Interest with IncomingFaceId
+  //           expect receivedInterests.back() has no IncomingFaceId tag
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNextHopFaceId)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Interest with NextHopFaceId
+  //           expect receivedInterests.back() has NextHopFaceId tag
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNextHopFaceIdDisabled)
+{
+  // TODO#3104 initialize with Options that disables local fields
+  // TODO#3104 receive Interest with NextHopFaceId
+  //           expect receivedInterests.empty()
+  //       or, expect receivedInterests.back() has no NextHopFaceId tag
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNextHopFaceIdDropData)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Data with NextHopFaceId
+  //           expect receivedData.empty()
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNextHopFaceIdDropNack)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Nack with NextHopFaceId
+  //           expect receivedNacks.empty()
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveCacheControl)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Data with CacheControl
+  //           expect receivedData.back() has CacheControl tag
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveCacheControlDisabled)
+{
+  // TODO#3104 initialize with Options that disables local fields
+  // TODO#3104 receive Data with CacheControl
+  //           expect receivedData.back() has no CacheControl tag
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveCacheControlDropInterest)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Interest with CacheControl
+  //           expect receivedInterests.empty()
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveCacheControlDropNack)
+{
+  // TODO#3104 initialize with Options that enables local fields
+  // TODO#3104 receive Nack with CacheControl
+  //           expect receivedNacks.empty()
+}
+
+BOOST_AUTO_TEST_SUITE_END() // LocalFields
+
+
+BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace face
+} // namespace nfd
diff --git a/tests/daemon/face/lp-face-wrapper.t.cpp b/tests/daemon/face/lp-face-wrapper.t.cpp
new file mode 100644
index 0000000..182d2fc
--- /dev/null
+++ b/tests/daemon/face/lp-face-wrapper.t.cpp
@@ -0,0 +1,173 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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/>.
+ */
+
+#include "face/lp-face-wrapper.hpp"
+#include "fw/forwarder.hpp"
+
+#include "tests/test-common.hpp"
+#include "dummy-lp-face.hpp"
+
+namespace nfd {
+namespace face {
+namespace tests {
+
+using namespace nfd::tests;
+
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestLpFaceWrapper, BaseFixture)
+
+BOOST_AUTO_TEST_CASE(SetId)
+{
+  Forwarder forwarder;
+  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
+  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
+
+  BOOST_CHECK_EQUAL(face1->getId(), nfd::face::INVALID_FACEID);
+  BOOST_CHECK_EQUAL(face1w->getId(), nfd::INVALID_FACEID);
+
+  forwarder.addFace(face1w);
+
+  BOOST_CHECK_NE(face1->getId(), nfd::face::INVALID_FACEID);
+  BOOST_CHECK_NE(face1w->getId(), nfd::INVALID_FACEID);
+  BOOST_CHECK_EQUAL(face1->getId(), static_cast<face::FaceId>(face1w->getId()));
+}
+
+BOOST_AUTO_TEST_CASE(SetPersistency)
+{
+  unique_ptr<LpFace> face1u = make_unique<DummyLpFace>();
+  face1u->setPersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
+
+  auto face1w = make_shared<face::LpFaceWrapper>(std::move(face1u));
+  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
+
+  BOOST_CHECK_EQUAL(face1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
+  BOOST_CHECK_EQUAL(face1w->getPersistency(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
+
+  face1w->setPersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
+
+  BOOST_CHECK_EQUAL(face1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
+  BOOST_CHECK_EQUAL(face1w->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
+}
+
+BOOST_AUTO_TEST_CASE(FailSignal)
+{
+  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
+  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
+
+  bool isFailed = false;
+  face1w->onFail.connect(bind([&isFailed] { isFailed = true; }));
+
+  face1->setState(FaceState::DOWN);
+  BOOST_CHECK(!isFailed);
+
+  face1->setState(FaceState::FAILED);
+  BOOST_CHECK(!isFailed);
+
+  face1->setState(FaceState::CLOSED);
+  BOOST_CHECK(isFailed);
+}
+
+BOOST_AUTO_TEST_CASE(SendReceive)
+{
+  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
+  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
+
+  const size_t nInInterests = 192;
+  const size_t nInData = 91;
+  const size_t nInNacks = 29;
+  const size_t nOutInterests = 202;
+  const size_t nOutData = 128;
+  const size_t nOutNacks = 84;
+
+  size_t nReceivedInterests = 0;
+  size_t nReceivedData = 0;
+  size_t nReceivedNacks = 0;
+  face1w->onReceiveInterest.connect(bind([&nReceivedInterests] { ++nReceivedInterests; }));
+  face1w->onReceiveData.connect(bind([&nReceivedData] { ++nReceivedData; }));
+  face1w->onReceiveNack.connect(bind([&nReceivedNacks] { ++nReceivedNacks; }));
+
+  BOOST_CHECK_EQUAL(face1->getCounters().getNInInterests(), 0);
+  BOOST_CHECK_EQUAL(face1->getCounters().getNInDatas(), 0);
+  BOOST_CHECK_EQUAL(face1->getCounters().getNOutInterests(), 0);
+  BOOST_CHECK_EQUAL(face1->getCounters().getNOutDatas(), 0);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNInInterests(), 0);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNInDatas(), 0);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNOutInterests(), 0);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNOutDatas(), 0);
+  // There's no counters for NACK for now.
+
+  for (size_t i = 0; i < nInInterests; ++i) {
+    shared_ptr<Interest> interest = makeInterest("/JSQdqward4");
+    face1->receiveInterest(*interest);
+  }
+
+  for (size_t i = 0; i < nInData; ++i) {
+    shared_ptr<Data> data = makeData("/hT8FDigWn1");
+    face1->receiveData(*data);
+  }
+
+  for (size_t i = 0; i < nInNacks; ++i) {
+    lp::Nack nack = makeNack("/StnEVTj4Ex", 561, lp::NackReason::CONGESTION);
+    face1->receiveNack(nack);
+  }
+
+  for (size_t i = 0; i < nOutInterests; ++i) {
+    shared_ptr<Interest> interest = makeInterest("/XyUAFYQDmd");
+    face1w->sendInterest(*interest);
+  }
+
+  for (size_t i = 0; i < nOutData; ++i) {
+    shared_ptr<Data> data = makeData("/GigPEtPH6");
+    face1w->sendData(*data);
+  }
+
+  for (size_t i = 0; i < nOutNacks; ++i) {
+    lp::Nack nack = makeNack("/9xK6FbwIBM", 365, lp::NackReason::CONGESTION);
+    face1w->sendNack(nack);
+  }
+
+  BOOST_CHECK_EQUAL(face1->getCounters().getNInInterests(), nInInterests);
+  BOOST_CHECK_EQUAL(face1->getCounters().getNInDatas(), nInData);
+  BOOST_CHECK_EQUAL(face1->getCounters().getNOutInterests(), nOutInterests);
+  BOOST_CHECK_EQUAL(face1->getCounters().getNOutDatas(), nOutData);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNInInterests(), nInInterests);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNInDatas(), nInData);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNOutInterests(), nOutInterests);
+  BOOST_CHECK_EQUAL(face1w->getCounters().getNOutDatas(), nOutData);
+
+  BOOST_CHECK_EQUAL(nReceivedInterests, nInInterests);
+  BOOST_CHECK_EQUAL(nReceivedData, nInData);
+  BOOST_CHECK_EQUAL(nReceivedNacks, nInNacks);
+  BOOST_CHECK_EQUAL(face1->sentInterests.size(), nOutInterests);
+  BOOST_CHECK_EQUAL(face1->sentData.size(), nOutData);
+  BOOST_CHECK_EQUAL(face1->sentNacks.size(), nOutNacks);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace face
+} // namespace nfd
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 784ee2d..c7b7c36 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -135,9 +135,13 @@
 };
 
 inline shared_ptr<Interest>
-makeInterest(const Name& name)
+makeInterest(const Name& name, uint32_t nonce = 0)
 {
-  return make_shared<Interest>(name);
+  auto interest = make_shared<Interest>(name);
+  if (nonce != 0) {
+    interest->setNonce(nonce);
+  }
+  return interest;
 }
 
 inline shared_ptr<Data>
@@ -166,6 +170,16 @@
   return link;
 }
 
+inline lp::Nack
+makeNack(const Name& name, uint32_t nonce, lp::NackReason reason)
+{
+  Interest interest(name);
+  interest.setNonce(nonce);
+  lp::Nack nack(std::move(interest));
+  nack.setReason(reason);
+  return nack;
+}
+
 } // namespace tests
 } // namespace nfd
 
