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/datagram-face.hpp b/daemon/face/datagram-face.hpp
deleted file mode 100644
index a55fb8c..0000000
--- a/daemon/face/datagram-face.hpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/* -*- 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_DATAGRAM_FACE_HPP
-#define NFD_DAEMON_FACE_DATAGRAM_FACE_HPP
-
-#include "face.hpp"
-#include "core/global-io.hpp"
-
-namespace nfd {
-
-struct Unicast {};
-struct Multicast {};
-
-template<class Protocol, class Addressing = Unicast>
-class DatagramFace : public Face
-{
-public:
-  typedef Protocol protocol;
-
-  /** \brief Construct datagram face
-   *
-   * \param socket      Protocol-specific socket for the created face
-   */
-  DatagramFace(const FaceUri& remoteUri, const FaceUri& localUri,
-               typename protocol::socket socket);
-
-  // from Face
-  void
-  sendInterest(const Interest& interest) DECL_OVERRIDE;
-
-  void
-  sendData(const Data& data) DECL_OVERRIDE;
-
-  void
-  close() DECL_OVERRIDE;
-
-  void
-  receiveDatagram(const uint8_t* buffer,
-                  size_t nBytesReceived,
-                  const boost::system::error_code& error);
-
-protected:
-  void
-  processErrorCode(const boost::system::error_code& error);
-
-  void
-  handleSend(const boost::system::error_code& error,
-             size_t nBytesSent,
-             const Block& payload);
-
-  void
-  handleReceive(const boost::system::error_code& error,
-                size_t nBytesReceived);
-
-  void
-  keepFaceAliveUntilAllHandlersExecuted(const shared_ptr<Face>& face);
-
-  void
-  closeSocket();
-
-  bool
-  hasBeenUsedRecently() const;
-
-  /**
-   * \brief Set m_hasBeenUsedRecently to false
-   */
-  void
-  resetRecentUsage();
-
-protected:
-  typename protocol::socket m_socket;
-
-  NFD_LOG_INCLASS_DECLARE();
-
-private:
-  uint8_t m_inputBuffer[ndn::MAX_NDN_PACKET_SIZE];
-  bool m_hasBeenUsedRecently;
-};
-
-
-template<class T, class U>
-inline
-DatagramFace<T, U>::DatagramFace(const FaceUri& remoteUri, const FaceUri& localUri,
-                                 typename DatagramFace::protocol::socket socket)
-  : Face(remoteUri, localUri, false, std::is_same<U, Multicast>::value)
-  , m_socket(std::move(socket))
-{
-  NFD_LOG_FACE_INFO("Creating face");
-
-  m_socket.async_receive(boost::asio::buffer(m_inputBuffer, ndn::MAX_NDN_PACKET_SIZE),
-                         bind(&DatagramFace<T, U>::handleReceive, this,
-                              boost::asio::placeholders::error,
-                              boost::asio::placeholders::bytes_transferred));
-}
-
-template<class T, class U>
-inline void
-DatagramFace<T, U>::sendInterest(const Interest& interest)
-{
-  NFD_LOG_FACE_TRACE(__func__);
-
-  this->emitSignal(onSendInterest, interest);
-
-  const Block& payload = interest.wireEncode();
-  m_socket.async_send(boost::asio::buffer(payload.wire(), payload.size()),
-                      bind(&DatagramFace<T, U>::handleSend, this,
-                           boost::asio::placeholders::error,
-                           boost::asio::placeholders::bytes_transferred,
-                           payload));
-}
-
-template<class T, class U>
-inline void
-DatagramFace<T, U>::sendData(const Data& data)
-{
-  NFD_LOG_FACE_TRACE(__func__);
-
-  this->emitSignal(onSendData, data);
-
-  const Block& payload = data.wireEncode();
-  m_socket.async_send(boost::asio::buffer(payload.wire(), payload.size()),
-                      bind(&DatagramFace<T, U>::handleSend, this,
-                           boost::asio::placeholders::error,
-                           boost::asio::placeholders::bytes_transferred,
-                           payload));
-}
-
-template<class T, class U>
-inline void
-DatagramFace<T, U>::close()
-{
-  if (!m_socket.is_open())
-    return;
-
-  NFD_LOG_FACE_INFO("Closing face");
-
-  closeSocket();
-  this->fail("Face closed");
-}
-
-template<class T, class U>
-inline void
-DatagramFace<T, U>::processErrorCode(const boost::system::error_code& error)
-{
-  if (error == boost::asio::error::operation_aborted) // when cancel() is called
-    return;
-
-  if (getPersistency() == ndn::nfd::FacePersistency::FACE_PERSISTENCY_PERMANENT) {
-    NFD_LOG_FACE_DEBUG("Permanent face ignores error: " << error.message());
-    return;
-  }
-
-  if (!m_socket.is_open()) {
-    this->fail("Tunnel closed");
-    return;
-  }
-
-  if (error != boost::asio::error::eof)
-    NFD_LOG_FACE_WARN("Send or receive operation failed: " << error.message());
-
-  closeSocket();
-
-  if (error == boost::asio::error::eof)
-    this->fail("Tunnel closed");
-  else
-    this->fail(error.message());
-}
-
-template<class T, class U>
-inline void
-DatagramFace<T, U>::handleSend(const boost::system::error_code& error,
-                               size_t nBytesSent,
-                               const Block& payload)
-// 'payload' is unused; it's needed to retain the underlying Buffer
-{
-  if (error)
-    return processErrorCode(error);
-
-  NFD_LOG_FACE_TRACE("Successfully sent: " << nBytesSent << " bytes");
-  this->getMutableCounters().getNOutBytes() += nBytesSent;
-}
-
-template<class T, class U>
-inline void
-DatagramFace<T, U>::handleReceive(const boost::system::error_code& error,
-                                  size_t nBytesReceived)
-{
-  receiveDatagram(m_inputBuffer, nBytesReceived, error);
-
-  if (m_socket.is_open())
-    m_socket.async_receive(boost::asio::buffer(m_inputBuffer, ndn::MAX_NDN_PACKET_SIZE),
-                           bind(&DatagramFace<T, U>::handleReceive, this,
-                                boost::asio::placeholders::error,
-                                boost::asio::placeholders::bytes_transferred));
-}
-
-template<class T, class U>
-inline void
-DatagramFace<T, U>::receiveDatagram(const uint8_t* buffer,
-                                    size_t nBytesReceived,
-                                    const boost::system::error_code& error)
-{
-  if (error)
-    return processErrorCode(error);
-
-  NFD_LOG_FACE_TRACE("Received: " << nBytesReceived << " bytes");
-  this->getMutableCounters().getNInBytes() += nBytesReceived;
-
-  bool isOk = false;
-  Block element;
-  std::tie(isOk, element) = Block::fromBuffer(buffer, nBytesReceived);
-  if (!isOk)
-    {
-      NFD_LOG_FACE_WARN("Failed to parse incoming packet");
-      // This message won't extend the face lifetime
-      return;
-    }
-
-  if (element.size() != nBytesReceived)
-    {
-      NFD_LOG_FACE_WARN("Received datagram size and decoded element size don't match");
-      // This message won't extend the face lifetime
-      return;
-    }
-
-  if (!this->decodeAndDispatchInput(element))
-    {
-      NFD_LOG_FACE_WARN("Received unrecognized TLV block of type " << element.type());
-      // This message won't extend the face lifetime
-      return;
-    }
-
-  m_hasBeenUsedRecently = true;
-}
-
-template<class T, class U>
-inline void
-DatagramFace<T, U>::keepFaceAliveUntilAllHandlersExecuted(const shared_ptr<Face>& face)
-{
-  NFD_LOG_FACE_TRACE(__func__);
-}
-
-template<class T, class U>
-inline void
-DatagramFace<T, U>::closeSocket()
-{
-  NFD_LOG_FACE_TRACE(__func__);
-
-  // use the non-throwing variants and ignore errors, if any
-  boost::system::error_code error;
-  m_socket.shutdown(protocol::socket::shutdown_both, error);
-  m_socket.close(error);
-  // after this, handlers will be called with an error code
-
-  // ensure that the Face object is alive at least until all pending
-  // handlers are dispatched
-  getGlobalIoService().post(bind(&DatagramFace<T, U>::keepFaceAliveUntilAllHandlersExecuted,
-                                 this, this->shared_from_this()));
-}
-
-template<class T, class U>
-inline bool
-DatagramFace<T, U>::hasBeenUsedRecently() const
-{
-  return m_hasBeenUsedRecently;
-}
-
-template<class T, class U>
-inline void
-DatagramFace<T, U>::resetRecentUsage()
-{
-  m_hasBeenUsedRecently = false;
-}
-
-} // namespace nfd
-
-#endif // NFD_DAEMON_FACE_DATAGRAM_FACE_HPP
diff --git a/daemon/face/datagram-transport.hpp b/daemon/face/datagram-transport.hpp
new file mode 100644
index 0000000..f9cf2fc
--- /dev/null
+++ b/daemon/face/datagram-transport.hpp
@@ -0,0 +1,239 @@
+/* -*- 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_DATAGRAM_TRANSPORT_HPP
+#define NFD_DAEMON_FACE_DATAGRAM_TRANSPORT_HPP
+
+#include "transport.hpp"
+#include "core/global-io.hpp"
+
+#include <array>
+
+namespace nfd {
+namespace face {
+
+struct Unicast {};
+struct Multicast {};
+
+/** \brief Implements Transport for datagram-based protocols.
+ *
+ *  \tparam Protocol a datagram-based protocol in Boost.Asio
+ */
+template<class Protocol, class Addressing = Unicast>
+class DatagramTransport : public Transport
+{
+public:
+  typedef Protocol protocol;
+
+  /** \brief Construct datagram transport.
+   *
+   *  \param socket Protocol-specific socket for the created transport
+   */
+  explicit
+  DatagramTransport(typename protocol::socket&& socket);
+
+  virtual void
+  doSend(Transport::Packet&& packet) DECL_OVERRIDE;
+
+  virtual void
+  doClose() DECL_OVERRIDE;
+
+  /** \brief Receive datagram, translate buffer into packet, deliver to parent class.
+   */
+  void
+  receiveDatagram(const uint8_t* buffer, size_t nBytesReceived,
+                  const boost::system::error_code& error);
+
+protected:
+  void
+  handleReceive(const boost::system::error_code& error,
+                size_t nBytesReceived);
+
+  void
+  handleSend(const boost::system::error_code& error,
+             size_t nBytesSent, const Block& payload);
+
+  void
+  processErrorCode(const boost::system::error_code& error);
+
+  bool
+  hasBeenUsedRecently() const;
+
+  void
+  resetRecentUsage();
+
+protected:
+  typename protocol::socket m_socket;
+
+  NFD_LOG_INCLASS_DECLARE();
+
+private:
+  std::array<uint8_t, ndn::MAX_NDN_PACKET_SIZE> m_receiveBuffer;
+  bool m_hasBeenUsedRecently;
+};
+
+
+template<class T, class U>
+inline
+DatagramTransport<T, U>::DatagramTransport(typename DatagramTransport::protocol::socket&& socket)
+  : m_socket(std::move(socket))
+{
+  m_socket.async_receive(boost::asio::buffer(m_receiveBuffer),
+                         bind(&DatagramTransport<T, U>::handleReceive, this,
+                              boost::asio::placeholders::error,
+                              boost::asio::placeholders::bytes_transferred));
+}
+
+template<class T, class U>
+inline void
+DatagramTransport<T, U>::doSend(Transport::Packet&& packet)
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  m_socket.async_send(boost::asio::buffer(packet.packet),
+                      bind(&DatagramTransport<T, U>::handleSend, this,
+                           boost::asio::placeholders::error,
+                           boost::asio::placeholders::bytes_transferred,
+                           packet.packet));
+}
+
+template<class T, class U>
+inline void
+DatagramTransport<T, U>::doClose()
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  if (m_socket.is_open()) {
+    // Cancel all outstanding operations and close the socket.
+    // Use the non-throwing variants and ignore errors, if any.
+    boost::system::error_code error;
+    m_socket.cancel(error);
+    m_socket.close(error);
+  }
+
+  // Ensure that the Transport stays alive at least until
+  // all pending handlers are dispatched
+  getGlobalIoService().post([this] {
+    this->setState(TransportState::CLOSED);
+  });
+}
+
+template<class T, class U>
+inline void
+DatagramTransport<T, U>::receiveDatagram(const uint8_t* buffer, size_t nBytesReceived,
+                                         const boost::system::error_code& error)
+{
+  if (error)
+    return processErrorCode(error);
+
+  NFD_LOG_FACE_TRACE("Received: " << nBytesReceived << " bytes");
+
+  bool isOk = false;
+  Block element;
+  std::tie(isOk, element) = Block::fromBuffer(buffer, nBytesReceived);
+  if (!isOk) {
+    NFD_LOG_FACE_WARN("Failed to parse incoming packet");
+    // This packet won't extend the face lifetime
+    return;
+  }
+  if (element.size() != nBytesReceived) {
+    NFD_LOG_FACE_WARN("Received datagram size and decoded element size don't match");
+    // This packet won't extend the face lifetime
+    return;
+  }
+
+  m_hasBeenUsedRecently = true;
+  this->receive(Transport::Packet(std::move(element)));
+}
+
+template<class T, class U>
+inline void
+DatagramTransport<T, U>::handleReceive(const boost::system::error_code& error,
+                                       size_t nBytesReceived)
+{
+  receiveDatagram(m_receiveBuffer.data(), nBytesReceived, error);
+
+  if (m_socket.is_open())
+    m_socket.async_receive(boost::asio::buffer(m_receiveBuffer),
+                           bind(&DatagramTransport<T, U>::handleReceive, this,
+                                boost::asio::placeholders::error,
+                                boost::asio::placeholders::bytes_transferred));
+}
+
+template<class T, class U>
+inline void
+DatagramTransport<T, U>::handleSend(const boost::system::error_code& error,
+                                    size_t nBytesSent, const Block& payload)
+// 'payload' is unused; it's needed to retain the underlying Buffer
+{
+  if (error)
+    return processErrorCode(error);
+
+  NFD_LOG_FACE_TRACE("Successfully sent: " << nBytesSent << " bytes");
+}
+
+template<class T, class U>
+inline void
+DatagramTransport<T, U>::processErrorCode(const boost::system::error_code& error)
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  if (getState() == TransportState::CLOSING ||
+      getState() == TransportState::FAILED ||
+      getState() == TransportState::CLOSED ||
+      error == boost::asio::error::operation_aborted)
+    // transport is shutting down, ignore any errors
+    return;
+
+  if (getPersistency() == ndn::nfd::FacePersistency::FACE_PERSISTENCY_PERMANENT) {
+    NFD_LOG_FACE_DEBUG("Permanent face ignores error: " << error.message());
+    return;
+  }
+
+  if (error != boost::asio::error::eof)
+    NFD_LOG_FACE_WARN("Send or receive operation failed: " << error.message());
+
+  this->setState(TransportState::FAILED);
+  doClose();
+}
+
+template<class T, class U>
+inline bool
+DatagramTransport<T, U>::hasBeenUsedRecently() const
+{
+  return m_hasBeenUsedRecently;
+}
+
+template<class T, class U>
+inline void
+DatagramTransport<T, U>::resetRecentUsage()
+{
+  m_hasBeenUsedRecently = false;
+}
+
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_DATAGRAM_TRANSPORT_HPP
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..4fa4c1c
--- /dev/null
+++ b/daemon/face/generic-link-service.cpp
@@ -0,0 +1,257 @@
+/* -*- 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");
+
+GenericLinkService::Options::Options()
+  : allowLocalFields(false)
+{
+}
+
+GenericLinkService::GenericLinkService(const GenericLinkService::Options& options)
+  : m_options(options)
+{
+}
+
+void
+GenericLinkService::doSendInterest(const Interest& interest)
+{
+  lp::Packet lpPacket(interest.wireEncode());
+  if (m_options.allowLocalFields) {
+    encodeLocalFields(interest, lpPacket);
+  }
+  Transport::Packet packet;
+  packet.packet = lpPacket.wireEncode();
+  sendPacket(std::move(packet));
+}
+
+void
+GenericLinkService::doSendData(const Data& data)
+{
+  lp::Packet lpPacket(data.wireEncode());
+  if (m_options.allowLocalFields) {
+    encodeLocalFields(data, lpPacket);
+  }
+  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());
+  if (m_options.allowLocalFields) {
+    encodeLocalFields(nack.getInterest(), lpPacket);
+  }
+  Transport::Packet packet;
+  packet.packet = lpPacket.wireEncode();
+  sendPacket(std::move(packet));
+}
+
+bool
+GenericLinkService::encodeLocalFields(const Interest& interest, lp::Packet& lpPacket)
+{
+  if (interest.getLocalControlHeader().hasIncomingFaceId()) {
+    lpPacket.add<lp::IncomingFaceIdField>(interest.getIncomingFaceId());
+  }
+
+  if (interest.getLocalControlHeader().hasCachingPolicy()) {
+    // Packet must be dropped
+    return false;
+  }
+
+  return true;
+}
+
+bool
+GenericLinkService::encodeLocalFields(const Data& data, lp::Packet& lpPacket)
+{
+  if (data.getLocalControlHeader().hasIncomingFaceId()) {
+    lpPacket.add<lp::IncomingFaceIdField>(data.getIncomingFaceId());
+  }
+
+  if (data.getLocalControlHeader().hasCachingPolicy()) {
+    switch (data.getCachingPolicy()) {
+      case ndn::nfd::LocalControlHeader::CachingPolicy::NO_CACHE: {
+        lp::CachePolicy cachePolicy;
+        cachePolicy.setPolicy(lp::CachePolicyType::NO_CACHE);
+        lpPacket.add<lp::CachePolicyField>(cachePolicy);
+        break;
+      }
+      default: {
+        break;
+      }
+    }
+  }
+
+  return true;
+}
+
+void
+GenericLinkService::doReceivePacket(Transport::Packet&& packet)
+{
+  lp::Packet pkt(packet.packet);
+
+  if (pkt.has<lp::FragIndexField>() || pkt.has<lp::FragCountField>()) {
+    NFD_LOG_FACE_WARN("received fragment, but reassembly not implemented: DROP");
+    return;
+  }
+
+  try {
+    ndn::Buffer::const_iterator fragBegin, fragEnd;
+    std::tie(fragBegin, fragEnd) = pkt.get<lp::FragmentField>();
+    Block netPkt(&*fragBegin, std::distance(fragBegin, fragEnd));
+
+    switch (netPkt.type()) {
+      case tlv::Interest:
+        if (pkt.has<lp::NackField>()) {
+          this->decodeNack(netPkt, pkt);
+        }
+        else {
+          this->decodeInterest(netPkt, pkt);
+        }
+        break;
+      case tlv::Data:
+        this->decodeData(netPkt, pkt);
+        break;
+      default:
+        NFD_LOG_FACE_WARN("unrecognized network-layer packet TLV-TYPE " << netPkt.type() << ": DROP");
+        return;
+    }
+  }
+  catch (const tlv::Error& e) {
+    NFD_LOG_FACE_WARN("packet parse error (" << e.what() << "): DROP");
+  }
+}
+
+
+void
+GenericLinkService::decodeInterest(const Block& netPkt, const lp::Packet& firstPkt)
+{
+  BOOST_ASSERT(netPkt.type() == tlv::Interest);
+  BOOST_ASSERT(!firstPkt.has<lp::NackField>());
+
+  // forwarding expects Interest to be created with make_shared
+  auto interest = make_shared<Interest>(netPkt);
+
+  if (firstPkt.has<lp::NextHopFaceIdField>()) {
+    if (m_options.allowLocalFields) {
+      interest->setNextHopFaceId(firstPkt.get<lp::NextHopFaceIdField>());
+    }
+    else {
+      NFD_LOG_FACE_WARN("received NextHopFaceId, but local fields disabled: DROP");
+      return;
+    }
+  }
+
+  if (firstPkt.has<lp::CachePolicyField>()) {
+    NFD_LOG_FACE_WARN("received CachePolicy with Interest: DROP");
+    return;
+  }
+
+  if (firstPkt.has<lp::IncomingFaceIdField>()) {
+    NFD_LOG_FACE_WARN("received IncomingFaceId: IGNORE");
+  }
+
+  this->receiveInterest(*interest);
+}
+
+void
+GenericLinkService::decodeData(const Block& netPkt, const lp::Packet& firstPkt)
+{
+  BOOST_ASSERT(netPkt.type() == tlv::Data);
+
+  // forwarding expects Data to be created with make_shared
+  auto data = make_shared<Data>(netPkt);
+
+  if (firstPkt.has<lp::NackField>()) {
+    NFD_LOG_FACE_WARN("received Nack with Data: DROP");
+    return;
+  }
+
+  if (firstPkt.has<lp::NextHopFaceIdField>()) {
+    NFD_LOG_FACE_WARN("received NextHopFaceId with Data: DROP");
+    return;
+  }
+
+  if (firstPkt.has<lp::CachePolicyField>()) {
+    if (m_options.allowLocalFields) {
+      lp::CachePolicyType policy = firstPkt.get<lp::CachePolicyField>().getPolicy();
+      switch (policy) {
+        case lp::CachePolicyType::NO_CACHE:
+          data->setCachingPolicy(ndn::nfd::LocalControlHeader::CachingPolicy::NO_CACHE);
+          break;
+        default:
+          NFD_LOG_FACE_WARN("unrecognized CachePolicyType " << policy << ": DROP");
+          return;
+      }
+    }
+    else {
+      NFD_LOG_FACE_WARN("received CachePolicy, but local fields disabled: IGNORE");
+    }
+  }
+
+  if (firstPkt.has<lp::IncomingFaceIdField>()) {
+    NFD_LOG_FACE_WARN("received IncomingFaceId: IGNORE");
+  }
+
+  this->receiveData(*data);
+}
+
+void
+GenericLinkService::decodeNack(const Block& netPkt, const lp::Packet& firstPkt)
+{
+  BOOST_ASSERT(netPkt.type() == tlv::Interest);
+  BOOST_ASSERT(firstPkt.has<lp::NackField>());
+
+  lp::Nack nack((Interest(netPkt)));
+  nack.setHeader(firstPkt.get<lp::NackField>());
+
+  if (firstPkt.has<lp::NextHopFaceIdField>()) {
+    NFD_LOG_FACE_WARN("received NextHopFaceId with Nack: DROP");
+    return;
+  }
+
+  if (firstPkt.has<lp::CachePolicyField>()) {
+    NFD_LOG_FACE_WARN("received CachePolicy with Nack: DROP");
+    return;
+  }
+
+  if (firstPkt.has<lp::IncomingFaceIdField>()) {
+    NFD_LOG_FACE_WARN("received IncomingFaceId: IGNORE");
+  }
+
+  this->receiveNack(nack);
+}
+
+} // 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..ae3328f
--- /dev/null
+++ b/daemon/face/generic-link-service.hpp
@@ -0,0 +1,162 @@
+/* -*- 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 GenericLinkService is a LinkService that implements the NDNLPv2 protocol
+ *  \sa http://redmine.named-data.net/projects/nfd/wiki/NDNLPv2
+ */
+class GenericLinkService : public LinkService
+{
+public:
+  /** \brief Options that control the behavior of GenericLinkService
+   */
+  class Options
+  {
+  public:
+    Options();
+
+  public:
+    // TODO #3171: fragmentation and reassembly options
+
+    /** \brief enables encoding of IncomingFaceId, and decoding of NextHopFaceId and CachePolicy
+     */
+    bool allowLocalFields;
+  };
+
+  explicit
+  GenericLinkService(const Options& options = Options());
+
+  /** \brief get Options used by GenericLinkService
+   */
+  const Options&
+  getOptions() const;
+
+  /** \brief sets Options used by GenericLinkService
+   */
+  void
+  setOptions(const Options& options);
+
+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;
+
+private: // encoding and decoding
+  /** \brief encode IncomingFaceId into LpPacket and verify local fields
+   */
+  static bool
+  encodeLocalFields(const Interest& interest, lp::Packet& lpPacket);
+
+  /** \brief encode CachingPolicy and IncomingFaceId into LpPacket and verify local fields
+   */
+  static bool
+  encodeLocalFields(const Data& data, lp::Packet& lpPacket);
+
+  /** \brief decode incoming Interest
+   *  \param netPkt reassembled network-layer packet; TLV-TYPE must be Interest
+   *  \param firstPkt LpPacket of first fragment; must not have Nack field
+   *
+   *  If decoding is successful, receiveInterest signal is emitted;
+   *  otherwise, a warning is logged.
+   *
+   *  \throw tlv::Error parse error in an LpHeader field
+   */
+  void
+  decodeInterest(const Block& netPkt, const lp::Packet& firstPkt);
+
+  /** \brief decode incoming Interest
+   *  \param netPkt reassembled network-layer packet; TLV-TYPE must be Data
+   *  \param firstPkt LpPacket of first fragment
+   *
+   *  If decoding is successful, receiveData signal is emitted;
+   *  otherwise, a warning is logged.
+   *
+   *  \throw tlv::Error parse error in an LpHeader field
+   */
+  void
+  decodeData(const Block& netPkt, const lp::Packet& firstPkt);
+
+  /** \brief decode incoming Interest
+   *  \param netPkt reassembled network-layer packet; TLV-TYPE must be Interest
+   *  \param firstPkt LpPacket of first fragment; must have Nack field
+   *
+   *  If decoding is successful, receiveNack signal is emitted;
+   *  otherwise, a warning is logged.
+   *
+   *  \throw tlv::Error parse error in an LpHeader field
+   */
+  void
+  decodeNack(const Block& netPkt, const lp::Packet& firstPkt);
+
+private:
+  Options m_options;
+};
+
+inline const GenericLinkService::Options&
+GenericLinkService::getOptions() const
+{
+  return m_options;
+}
+
+inline void
+GenericLinkService::setOptions(const GenericLinkService::Options& options)
+{
+  m_options = options;
+}
+
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_GENERIC_LINK_SERVICE_HPP
diff --git a/daemon/face/internal-client-face.hpp b/daemon/face/internal-client-face.hpp
index 8eb3c46..abc375b 100644
--- a/daemon/face/internal-client-face.hpp
+++ b/daemon/face/internal-client-face.hpp
@@ -31,6 +31,7 @@
 #include <ndn-cxx/face.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
 #include <ndn-cxx/transport/transport.hpp>
+#include <ndn-cxx/lp/packet.hpp>
 
 namespace nfd {
 
@@ -95,22 +96,19 @@
 void
 InternalClientFace::receive(const Packet& packet)
 {
-  if (!packet.getLocalControlHeader().empty(ndn::nfd::LocalControlHeader::ENCODE_ALL)) {
+  lp::Packet lpPacket(packet.wireEncode());
 
-    Block header = packet.getLocalControlHeader()
-                         .wireEncode(packet, ndn::nfd::LocalControlHeader::ENCODE_ALL);
-    Block payload = packet.wireEncode();
+  ndn::nfd::LocalControlHeader localControlHeader = packet.getLocalControlHeader();
 
-    ndn::EncodingBuffer encoder(header.size() + payload.size(),
-                                header.size() + payload.size());
-    encoder.appendByteArray(header.wire(), header.size());
-    encoder.appendByteArray(payload.wire(), payload.size());
-
-    m_transport->receive(encoder.block());
+  if (localControlHeader.hasIncomingFaceId()) {
+    lpPacket.add<lp::IncomingFaceIdField>(localControlHeader.getIncomingFaceId());
   }
-  else {
-    m_transport->receive(packet.wireEncode());
+
+  if (localControlHeader.hasNextHopFaceId()) {
+    lpPacket.add<lp::NextHopFaceIdField>(localControlHeader.getNextHopFaceId());
   }
+
+  m_transport->receive(lpPacket.wireEncode());
 }
 
 } // namespace nfd
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/udp-face.hpp b/daemon/face/lp-face.cpp
similarity index 60%
copy from daemon/face/udp-face.hpp
copy to daemon/face/lp-face.cpp
index a7541a5..0b2e826 100644
--- a/daemon/face/udp-face.hpp
+++ b/daemon/face/lp-face.cpp
@@ -23,41 +23,23 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NFD_DAEMON_FACE_UDP_FACE_HPP
-#define NFD_DAEMON_FACE_UDP_FACE_HPP
-
-#include "datagram-face.hpp"
-#include "core/scheduler.hpp"
+#include "lp-face.hpp"
 
 namespace nfd {
+namespace face {
 
-/**
- * \brief Implementation of Face abstraction that uses
- *        unicast UDP as underlying transport mechanism
- */
-class UdpFace : public DatagramFace<boost::asio::ip::udp>
+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))
 {
-public:
-  UdpFace(const FaceUri& remoteUri, const FaceUri& localUri,
-          protocol::socket socket, ndn::nfd::FacePersistency persistency,
-          const time::seconds& idleTimeout);
+  m_service->setFaceAndTransport(*this, *m_transport);
+  m_transport->setFaceAndLinkService(*this, *m_service);
+}
 
-  ndn::nfd::FaceStatus
-  getFaceStatus() const DECL_OVERRIDE;
-
-private:
-  void
-  closeIfIdle();
-
-private:
-  const time::seconds m_idleTimeout;
-  time::steady_clock::TimePoint m_lastIdleCheck;
-  scheduler::ScopedEventId m_closeIfIdleEvent;
-
-  // friend because it needs to invoke protected Face::setOnDemand
-  friend class UdpChannel;
-};
-
+} // namespace face
 } // namespace nfd
-
-#endif // NFD_DAEMON_FACE_UDP_FACE_HPP
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/multicast-udp-face.cpp b/daemon/face/multicast-udp-face.cpp
deleted file mode 100644
index 8ac07af..0000000
--- a/daemon/face/multicast-udp-face.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- 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 "multicast-udp-face.hpp"
-
-namespace nfd {
-
-NFD_LOG_INCLASS_2TEMPLATE_SPECIALIZATION_DEFINE(DatagramFace,
-                                                MulticastUdpFace::protocol, Multicast,
-                                                "MulticastUdpFace");
-
-MulticastUdpFace::MulticastUdpFace(const protocol::endpoint& multicastGroup,
-                                   const FaceUri& localUri,
-                                   protocol::socket recvSocket, protocol::socket sendSocket)
-  : DatagramFace(FaceUri(multicastGroup), localUri, std::move(recvSocket))
-  , m_multicastGroup(multicastGroup)
-  , m_sendSocket(std::move(sendSocket))
-{
-}
-
-const MulticastUdpFace::protocol::endpoint&
-MulticastUdpFace::getMulticastGroup() const
-{
-  return m_multicastGroup;
-}
-
-void
-MulticastUdpFace::sendInterest(const Interest& interest)
-{
-  NFD_LOG_FACE_TRACE(__func__);
-  this->emitSignal(onSendInterest, interest);
-  sendBlock(interest.wireEncode());
-}
-
-void
-MulticastUdpFace::sendData(const Data& data)
-{
-  NFD_LOG_FACE_TRACE(__func__);
-  /// \todo After this face implements duplicate suppression, onSendData should
-  ///       be emitted only when data is actually sent out. See also #2555
-  this->emitSignal(onSendData, data);
-  sendBlock(data.wireEncode());
-}
-
-void
-MulticastUdpFace::sendBlock(const Block& block)
-{
-  m_sendSocket.async_send_to(boost::asio::buffer(block.wire(), block.size()), m_multicastGroup,
-                             bind(&MulticastUdpFace::handleSend, this,
-                                  boost::asio::placeholders::error,
-                                  boost::asio::placeholders::bytes_transferred,
-                                  block));
-}
-
-} // namespace nfd
diff --git a/daemon/face/multicast-udp-face.hpp b/daemon/face/multicast-udp-face.hpp
deleted file mode 100644
index 7aab4a7..0000000
--- a/daemon/face/multicast-udp-face.hpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014,  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_MULTICAST_UDP_FACE_HPP
-#define NFD_DAEMON_FACE_MULTICAST_UDP_FACE_HPP
-
-#include "datagram-face.hpp"
-
-namespace nfd {
-
-/**
- * \brief Implementation of Face abstraction that uses
- *        multicast UDP as underlying transport mechanism
- */
-class MulticastUdpFace : public DatagramFace<boost::asio::ip::udp, Multicast>
-{
-public:
-  /**
-   * \brief Creates a UDP-based face for multicast communication
-   */
-  MulticastUdpFace(const protocol::endpoint& multicastGroup, const FaceUri& localUri,
-                   protocol::socket recvSocket, protocol::socket sendSocket);
-
-  const protocol::endpoint&
-  getMulticastGroup() const;
-
-  // from Face
-  void
-  sendInterest(const Interest& interest) DECL_OVERRIDE;
-
-  void
-  sendData(const Data& data) DECL_OVERRIDE;
-
-private:
-  void
-  sendBlock(const Block& block);
-
-private:
-  protocol::endpoint m_multicastGroup;
-  protocol::socket m_sendSocket;
-};
-
-} // namespace nfd
-
-#endif // NFD_DAEMON_FACE_MULTICAST_UDP_FACE_HPP
diff --git a/daemon/face/multicast-udp-transport.cpp b/daemon/face/multicast-udp-transport.cpp
new file mode 100644
index 0000000..7befa78
--- /dev/null
+++ b/daemon/face/multicast-udp-transport.cpp
@@ -0,0 +1,79 @@
+/* -*- 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 "multicast-udp-transport.hpp"
+
+namespace nfd {
+namespace face {
+
+NFD_LOG_INCLASS_2TEMPLATE_SPECIALIZATION_DEFINE(DatagramTransport, MulticastUdpTransport::protocol,
+                                                Multicast, "MulticastUdpTransport");
+
+MulticastUdpTransport::MulticastUdpTransport(const protocol::endpoint& localEndpoint,
+                                             const protocol::endpoint& multicastGroup,
+                                             protocol::socket&& recvSocket,
+                                             protocol::socket&& sendSocket)
+  : DatagramTransport(std::move(recvSocket))
+  , m_multicastGroup(multicastGroup)
+  , m_sendSocket(std::move(sendSocket))
+{
+  this->setLocalUri(FaceUri(localEndpoint));
+  this->setRemoteUri(FaceUri(multicastGroup));
+  this->setPersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
+  this->setLinkType(ndn::nfd::LINK_TYPE_MULTI_ACCESS);
+
+  NFD_LOG_FACE_INFO("Creating transport");
+}
+
+void
+MulticastUdpTransport::doSend(Transport::Packet&& packet)
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  m_sendSocket.async_send_to(boost::asio::buffer(packet.packet), m_multicastGroup,
+                             bind(&MulticastUdpTransport::handleSend, this,
+                                  boost::asio::placeholders::error,
+                                  boost::asio::placeholders::bytes_transferred,
+                                  packet.packet));
+}
+
+void
+MulticastUdpTransport::doClose()
+{
+  if (m_sendSocket.is_open()) {
+    NFD_LOG_FACE_TRACE("Closing sending socket");
+
+    // Cancel all outstanding operations and close the socket.
+    // Use the non-throwing variants and ignore errors, if any.
+    boost::system::error_code error;
+    m_sendSocket.cancel(error);
+    m_sendSocket.close(error);
+  }
+
+  DatagramTransport::doClose();
+}
+
+} // namespace face
+} // namespace nfd
diff --git a/daemon/face/multicast-udp-transport.hpp b/daemon/face/multicast-udp-transport.hpp
new file mode 100644
index 0000000..7966b5b
--- /dev/null
+++ b/daemon/face/multicast-udp-transport.hpp
@@ -0,0 +1,64 @@
+/* -*- 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_MULTICAST_UDP_TRANSPORT_HPP
+#define NFD_DAEMON_FACE_MULTICAST_UDP_TRANSPORT_HPP
+
+#include "datagram-transport.hpp"
+
+namespace nfd {
+namespace face {
+
+/**
+ * \brief A Transport that communicates on a UDP multicast group
+ */
+class MulticastUdpTransport : public DatagramTransport<boost::asio::ip::udp, Multicast>
+{
+public:
+  /**
+   * \brief Creates a UDP-based transport for multicast communication
+   * \param recvSocket socket used to receive packets
+   * \param sendSocket socket used to send to the multicast address
+   */
+  MulticastUdpTransport(const protocol::endpoint& localEndpoint,
+                        const protocol::endpoint& multicastGroup,
+                        protocol::socket&& recvSocket, protocol::socket&& sendSocket);
+
+private:
+  virtual void
+  doSend(Transport::Packet&& packet) DECL_OVERRIDE;
+
+  virtual void
+  doClose() DECL_OVERRIDE;
+
+private:
+  protocol::endpoint m_multicastGroup;
+  protocol::socket m_sendSocket;
+};
+
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_MULTICAST_UDP_TRANSPORT_HPP
diff --git a/daemon/face/stream-transport.hpp b/daemon/face/stream-transport.hpp
new file mode 100644
index 0000000..e9ec78d
--- /dev/null
+++ b/daemon/face/stream-transport.hpp
@@ -0,0 +1,271 @@
+/* -*- 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_STREAM_TRANSPORT_HPP
+#define NFD_DAEMON_FACE_STREAM_TRANSPORT_HPP
+
+#include "transport.hpp"
+#include "core/global-io.hpp"
+
+#include <queue>
+
+namespace nfd {
+namespace face {
+
+/** \brief Implements Transport for stream-based protocols.
+ *
+ *  \tparam Protocol a stream-based protocol in Boost.Asio
+ */
+template<class Protocol>
+class StreamTransport : public Transport
+{
+public:
+  typedef Protocol protocol;
+
+  /** \brief Construct stream transport.
+   *
+   *  \param socket Protocol-specific socket for the created transport
+   */
+  explicit
+  StreamTransport(typename protocol::socket&& socket);
+
+  virtual void
+  doSend(Transport::Packet&& packet) DECL_OVERRIDE;
+
+  virtual void
+  doClose() DECL_OVERRIDE;
+
+protected:
+  void
+  deferredClose();
+
+  void
+  sendFromQueue();
+
+  void
+  handleSend(const boost::system::error_code& error,
+             size_t nBytesSent);
+
+  void
+  handleReceive(const boost::system::error_code& error,
+                size_t nBytesReceived);
+
+  void
+  processErrorCode(const boost::system::error_code& error);
+
+protected:
+  typename protocol::socket m_socket;
+
+  NFD_LOG_INCLASS_DECLARE();
+
+private:
+  uint8_t m_inputBuffer[ndn::MAX_NDN_PACKET_SIZE];
+  size_t m_inputBufferSize;
+  std::queue<Block> m_sendQueue;
+};
+
+// All derived classes must use
+// NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(StreamTransport, <specialization-parameter>, "Name");
+
+
+template<class T>
+inline
+StreamTransport<T>::StreamTransport(typename StreamTransport::protocol::socket&& socket)
+  : m_socket(std::move(socket))
+  , m_inputBufferSize(0)
+{
+  m_socket.async_receive(boost::asio::buffer(m_inputBuffer, ndn::MAX_NDN_PACKET_SIZE),
+                         bind(&StreamTransport<T>::handleReceive, this,
+                              boost::asio::placeholders::error,
+                              boost::asio::placeholders::bytes_transferred));
+}
+
+template<class T>
+inline void
+StreamTransport<T>::doSend(Transport::Packet&& packet)
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  bool wasQueueEmpty = m_sendQueue.empty();
+  m_sendQueue.push(packet.packet);
+
+  if (wasQueueEmpty)
+    sendFromQueue();
+}
+
+template<class T>
+inline void
+StreamTransport<T>::doClose()
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  if (m_socket.is_open()) {
+    // Cancel all outstanding operations and shutdown the socket
+    // so that no further sends or receives are possible.
+    // Use the non-throwing variants and ignore errors, if any.
+    boost::system::error_code error;
+    m_socket.cancel(error);
+    m_socket.shutdown(protocol::socket::shutdown_both, error);
+  }
+
+  // Ensure that the Transport stays alive at least until
+  // all pending handlers are dispatched
+  getGlobalIoService().post(bind(&StreamTransport<T>::deferredClose, this));
+
+  // Some bug or feature of Boost.Asio (see http://redmine.named-data.net/issues/1856):
+  //
+  // When doClose is called from a socket event handler (e.g., from handleReceive),
+  // m_socket.shutdown() does not trigger the cancellation of the handleSend callback.
+  // Instead, handleSend is invoked as nothing bad happened.
+  //
+  // In order to prevent the assertion in handleSend from failing, we clear the queue
+  // and close the socket in deferredClose, i.e., after all callbacks scheduled up to
+  // this point have been executed.  If more send operations are scheduled after this
+  // point, they will fail because the socket has been shutdown, and their callbacks
+  // will be invoked with error code == asio::error::shut_down.
+}
+
+template<class T>
+inline void
+StreamTransport<T>::deferredClose()
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  // clear send queue
+  std::queue<Block> emptyQueue;
+  std::swap(emptyQueue, m_sendQueue);
+
+  // use the non-throwing variant and ignore errors, if any
+  boost::system::error_code error;
+  m_socket.close(error);
+
+  this->setState(TransportState::CLOSED);
+}
+
+template<class T>
+inline void
+StreamTransport<T>::sendFromQueue()
+{
+  boost::asio::async_write(m_socket, boost::asio::buffer(m_sendQueue.front()),
+                           bind(&StreamTransport<T>::handleSend, this,
+                                boost::asio::placeholders::error,
+                                boost::asio::placeholders::bytes_transferred));
+}
+
+template<class T>
+inline void
+StreamTransport<T>::handleSend(const boost::system::error_code& error,
+                               size_t nBytesSent)
+{
+  if (error)
+    return processErrorCode(error);
+
+  NFD_LOG_FACE_TRACE("Successfully sent: " << nBytesSent << " bytes");
+
+  BOOST_ASSERT(!m_sendQueue.empty());
+  m_sendQueue.pop();
+
+  if (!m_sendQueue.empty())
+    sendFromQueue();
+}
+
+template<class T>
+inline void
+StreamTransport<T>::handleReceive(const boost::system::error_code& error,
+                                  size_t nBytesReceived)
+{
+  if (error)
+    return processErrorCode(error);
+
+  NFD_LOG_FACE_TRACE("Received: " << nBytesReceived << " bytes");
+
+  m_inputBufferSize += nBytesReceived;
+
+  size_t offset = 0;
+
+  bool isOk = true;
+  Block element;
+  while (m_inputBufferSize - offset > 0) {
+    std::tie(isOk, element) = Block::fromBuffer(m_inputBuffer + offset, m_inputBufferSize - offset);
+    if (!isOk)
+      break;
+
+    offset += element.size();
+
+    BOOST_ASSERT(offset <= m_inputBufferSize);
+
+    Transport::Packet packet(std::move(element));
+    this->receive(std::move(packet));
+  }
+
+  if (!isOk && m_inputBufferSize == ndn::MAX_NDN_PACKET_SIZE && offset == 0) {
+    NFD_LOG_FACE_WARN("Failed to parse incoming packet or packet too large to process");
+    this->setState(TransportState::FAILED);
+    doClose();
+    return;
+  }
+
+  if (offset > 0) {
+    if (offset != m_inputBufferSize) {
+      std::copy(m_inputBuffer + offset, m_inputBuffer + m_inputBufferSize, m_inputBuffer);
+      m_inputBufferSize -= offset;
+    }
+    else {
+      m_inputBufferSize = 0;
+    }
+  }
+
+  m_socket.async_receive(boost::asio::buffer(m_inputBuffer + m_inputBufferSize,
+                                             ndn::MAX_NDN_PACKET_SIZE - m_inputBufferSize),
+                         bind(&StreamTransport<T>::handleReceive, this,
+                              boost::asio::placeholders::error,
+                              boost::asio::placeholders::bytes_transferred));
+}
+
+template<class T>
+inline void
+StreamTransport<T>::processErrorCode(const boost::system::error_code& error)
+{
+  NFD_LOG_FACE_TRACE(__func__);
+
+  if (getState() == TransportState::CLOSING ||
+      getState() == TransportState::FAILED ||
+      getState() == TransportState::CLOSED ||
+      error == boost::asio::error::operation_aborted || // when cancel() is called
+      error == boost::asio::error::shut_down)           // after shutdown() is called
+    // transport is shutting down, ignore any errors
+    return;
+
+  if (error != boost::asio::error::eof)
+    NFD_LOG_FACE_WARN("Send or receive operation failed: " << error.message());
+
+  this->setState(TransportState::FAILED);
+  doClose();
+}
+
+} // namespace face
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_STREAM_TRANSPORT_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/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index c9920c4..a1ff92c 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -24,7 +24,8 @@
  */
 
 #include "udp-channel.hpp"
-#include "udp-face.hpp"
+#include "generic-link-service.hpp"
+#include "unicast-udp-transport.hpp"
 #include "core/global-io.hpp"
 
 namespace nfd {
@@ -71,7 +72,7 @@
                     const FaceCreatedCallback& onFaceCreated,
                     const ConnectFailedCallback& onConnectFailed)
 {
-  shared_ptr<UdpFace> face;
+  shared_ptr<face::LpFaceWrapper> face;
   try {
     face = createFace(remoteEndpoint, persistency).second;
   }
@@ -93,7 +94,7 @@
   return m_channelFaces.size();
 }
 
-std::pair<bool, shared_ptr<UdpFace>>
+std::pair<bool, shared_ptr<face::LpFaceWrapper>>
 UdpChannel::createFace(const udp::Endpoint& remoteEndpoint, ndn::nfd::FacePersistency persistency)
 {
   auto it = m_channelFaces.find(remoteEndpoint);
@@ -116,15 +117,18 @@
   socket.bind(m_localEndpoint);
   socket.connect(remoteEndpoint);
 
-  auto face = make_shared<UdpFace>(FaceUri(remoteEndpoint), FaceUri(m_localEndpoint),
-                                   std::move(socket), persistency, m_idleFaceTimeout);
+  auto linkService = make_unique<face::GenericLinkService>();
+  auto transport = make_unique<face::UnicastUdpTransport>(std::move(socket), persistency, m_idleFaceTimeout);
+  auto lpFace = make_unique<face::LpFace>(std::move(linkService), std::move(transport));
+  auto face = make_shared<face::LpFaceWrapper>(std::move(lpFace));
 
+  face->setPersistency(persistency);
   face->onFail.connectSingleShot([this, remoteEndpoint] (const std::string&) {
     NFD_LOG_TRACE("Erasing " << remoteEndpoint << " from channel face map");
     m_channelFaces.erase(remoteEndpoint);
   });
-  m_channelFaces[remoteEndpoint] = face;
 
+  m_channelFaces[remoteEndpoint] = face;
   return {true, face};
 }
 
@@ -147,7 +151,7 @@
   NFD_LOG_DEBUG("[" << m_localEndpoint << "] New peer " << m_remoteEndpoint);
 
   bool created;
-  shared_ptr<UdpFace> face;
+  shared_ptr<face::LpFaceWrapper> face;
   try {
     std::tie(created, face) = createFace(m_remoteEndpoint, ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
   }
@@ -163,7 +167,7 @@
     onFaceCreated(face);
 
   // dispatch the datagram to the face for processing
-  face->receiveDatagram(m_inputBuffer, nBytesReceived, error);
+  static_cast<face::UnicastUdpTransport*>(face->getLpFace()->getTransport())->receiveDatagram(m_inputBuffer, nBytesReceived, error);
 
   m_socket.async_receive_from(boost::asio::buffer(m_inputBuffer, ndn::MAX_NDN_PACKET_SIZE),
                               m_remoteEndpoint,
diff --git a/daemon/face/udp-channel.hpp b/daemon/face/udp-channel.hpp
index 3f92ada..0825ad4 100644
--- a/daemon/face/udp-channel.hpp
+++ b/daemon/face/udp-channel.hpp
@@ -1,12 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014,  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
+ * 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.
@@ -27,6 +27,7 @@
 #define NFD_DAEMON_FACE_UDP_CHANNEL_HPP
 
 #include "channel.hpp"
+#include "lp-face-wrapper.hpp"
 
 namespace nfd {
 
@@ -34,8 +35,6 @@
 typedef boost::asio::ip::udp::endpoint Endpoint;
 } // namespace udp
 
-class UdpFace;
-
 /**
  * \brief Class implementing UDP-based channel to create faces
  */
@@ -92,7 +91,7 @@
   isListening() const;
 
 private:
-  std::pair<bool, shared_ptr<UdpFace>>
+  std::pair<bool, shared_ptr<face::LpFaceWrapper>>
   createFace(const udp::Endpoint& remoteEndpoint, ndn::nfd::FacePersistency persistency);
 
   /**
@@ -106,7 +105,7 @@
                 const ConnectFailedCallback& onReceiveFailed);
 
 private:
-  std::map<udp::Endpoint, shared_ptr<UdpFace>> m_channelFaces;
+  std::map<udp::Endpoint, shared_ptr<face::LpFaceWrapper>> m_channelFaces;
 
   udp::Endpoint m_localEndpoint;
 
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index 8d24bbe..74636d8 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.cpp
@@ -24,6 +24,9 @@
  */
 
 #include "udp-factory.hpp"
+#include "generic-link-service.hpp"
+#include "lp-face-wrapper.hpp"
+#include "multicast-udp-transport.hpp"
 #include "core/global-io.hpp"
 #include "core/network-interface.hpp"
 
@@ -117,11 +120,12 @@
   if (static_cast<bool>(channel))
     return channel;
 
-  //checking if the endpoint is already in use for multicast face
-  shared_ptr<MulticastUdpFace> multicast = findMulticastFace(endpoint);
-  if (static_cast<bool>(multicast))
+  // check if the endpoint is already used by a multicast face
+  auto face = findMulticastFace(endpoint);
+  if (face) {
     BOOST_THROW_EXCEPTION(Error("Cannot create the requested UDP unicast channel, local "
                                 "endpoint is already allocated for a UDP multicast face"));
+  }
 
   if (endpoint.address().is_multicast()) {
     BOOST_THROW_EXCEPTION(Error("This method is only for unicast channel. The provided "
@@ -146,15 +150,15 @@
   return createChannel(endpoint, timeout);
 }
 
-shared_ptr<MulticastUdpFace>
+shared_ptr<face::LpFaceWrapper>
 UdpFactory::createMulticastFace(const udp::Endpoint& localEndpoint,
                                 const udp::Endpoint& multicastEndpoint,
                                 const std::string& networkInterfaceName/* = ""*/)
 {
   // checking if the local and multicast endpoints are already in use for a multicast face
-  shared_ptr<MulticastUdpFace> face = findMulticastFace(localEndpoint);
-  if (static_cast<bool>(face)) {
-    if (face->getMulticastGroup() == multicastEndpoint)
+  auto face = findMulticastFace(localEndpoint);
+  if (face) {
+    if (face->getRemoteUri() == FaceUri(multicastEndpoint))
       return face;
     else
       BOOST_THROW_EXCEPTION(Error("Cannot create the requested UDP multicast face, local "
@@ -225,8 +229,12 @@
   }
 #endif
 
-  face = make_shared<MulticastUdpFace>(multicastEndpoint, FaceUri(localEndpoint),
-                                       std::move(receiveSocket), std::move(sendSocket));
+  auto linkService = make_unique<face::GenericLinkService>();
+  auto transport = make_unique<face::MulticastUdpTransport>(localEndpoint, multicastEndpoint,
+                                                            std::move(receiveSocket),
+                                                            std::move(sendSocket));
+  auto lpFace = make_unique<face::LpFace>(std::move(linkService), std::move(transport));
+  face = make_shared<face::LpFaceWrapper>(std::move(lpFace));
 
   face->onFail.connectSingleShot([this, localEndpoint] (const std::string& reason) {
     m_multicastFaces.erase(localEndpoint);
@@ -236,7 +244,7 @@
   return face;
 }
 
-shared_ptr<MulticastUdpFace>
+shared_ptr<face::LpFaceWrapper>
 UdpFactory::createMulticastFace(const std::string& localIp,
                                 const std::string& multicastIp,
                                 const std::string& multicastPort,
@@ -302,14 +310,14 @@
     return shared_ptr<UdpChannel>();
 }
 
-shared_ptr<MulticastUdpFace>
+shared_ptr<face::LpFaceWrapper>
 UdpFactory::findMulticastFace(const udp::Endpoint& localEndpoint)
 {
   MulticastFaceMap::iterator i = m_multicastFaces.find(localEndpoint);
   if (i != m_multicastFaces.end())
     return i->second;
   else
-    return shared_ptr<MulticastUdpFace>();
+    return nullptr;
 }
 
 std::list<shared_ptr<const Channel>>
diff --git a/daemon/face/udp-factory.hpp b/daemon/face/udp-factory.hpp
index 1a3714c..0465ca5 100644
--- a/daemon/face/udp-factory.hpp
+++ b/daemon/face/udp-factory.hpp
@@ -28,7 +28,6 @@
 
 #include "protocol-factory.hpp"
 #include "udp-channel.hpp"
-#include "multicast-udp-face.hpp"
 
 namespace nfd {
 
@@ -50,7 +49,7 @@
     }
   };
 
-  typedef std::map<udp::Endpoint, shared_ptr<MulticastUdpFace>> MulticastFaceMap;
+  typedef std::map<udp::Endpoint, shared_ptr<face::LpFaceWrapper>> MulticastFaceMap;
 
   explicit
   UdpFactory(const std::string& defaultPort = "6363");
@@ -131,12 +130,12 @@
    * \see http://www.boost.org/doc/libs/1_42_0/doc/html/boost_asio/reference/ip__udp/endpoint.html
    *      for details on ways to create udp::Endpoint
    */
-  shared_ptr<MulticastUdpFace>
+  shared_ptr<face::LpFaceWrapper>
   createMulticastFace(const udp::Endpoint& localEndpoint,
                       const udp::Endpoint& multicastEndpoint,
                       const std::string& networkInterfaceName = "");
 
-  shared_ptr<MulticastUdpFace>
+  shared_ptr<face::LpFaceWrapper>
   createMulticastFace(const std::string& localIp,
                       const std::string& multicastIp,
                       const std::string& multicastPort,
@@ -186,11 +185,9 @@
    * \brief Look up multicast UdpFace using specified local endpoint
    *
    * \returns shared pointer to the existing multicast MulticastUdpFace object
-   *          or empty shared pointer when such face does not exist
-   *
-   * \throws never
+   *          or nullptr when such face does not exist
    */
-  shared_ptr<MulticastUdpFace>
+  shared_ptr<face::LpFaceWrapper>
   findMulticastFace(const udp::Endpoint& localEndpoint);
 
 PUBLIC_WITH_TESTS_ELSE_PRIVATE:
diff --git a/daemon/face/udp-face.cpp b/daemon/face/unicast-udp-transport.cpp
similarity index 63%
rename from daemon/face/udp-face.cpp
rename to daemon/face/unicast-udp-transport.cpp
index 6985784..eb8ab66 100644
--- a/daemon/face/udp-face.cpp
+++ b/daemon/face/unicast-udp-transport.cpp
@@ -23,8 +23,7 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "udp-face.hpp"
-// #include "core/global-io.hpp" // for #1718 manual test below
+#include "unicast-udp-transport.hpp"
 
 #ifdef __linux__
 #include <cerrno>       // for errno
@@ -34,17 +33,24 @@
 #endif
 
 namespace nfd {
+namespace face {
 
-NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(DatagramFace, UdpFace::protocol, "UdpFace");
+NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(DatagramTransport, UnicastUdpTransport::protocol,
+                                               "UnicastUdpTransport");
 
-UdpFace::UdpFace(const FaceUri& remoteUri, const FaceUri& localUri,
-                 protocol::socket socket, ndn::nfd::FacePersistency persistency,
-                 const time::seconds& idleTimeout)
-  : DatagramFace(remoteUri, localUri, std::move(socket))
+UnicastUdpTransport::UnicastUdpTransport(protocol::socket&& socket,
+                                         ndn::nfd::FacePersistency persistency,
+                                         const time::seconds& idleTimeout)
+  : DatagramTransport(std::move(socket))
   , m_idleTimeout(idleTimeout)
   , m_lastIdleCheck(time::steady_clock::now())
 {
+  this->setLocalUri(FaceUri(m_socket.local_endpoint()));
+  this->setRemoteUri(FaceUri(m_socket.remote_endpoint()));
   this->setPersistency(persistency);
+  this->setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT);
+
+  NFD_LOG_FACE_INFO("Creating transport");
 
 #ifdef __linux__
   //
@@ -66,56 +72,31 @@
   }
 #endif
 
-  if (this->getPersistency() == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND && m_idleTimeout > time::seconds::zero()) {
-    m_closeIfIdleEvent = scheduler::schedule(m_idleTimeout, bind(&UdpFace::closeIfIdle, this));
+  if (getPersistency() == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND &&
+      m_idleTimeout > time::seconds::zero()) {
+    m_closeIfIdleEvent = scheduler::schedule(m_idleTimeout, bind(&UnicastUdpTransport::closeIfIdle, this));
   }
 }
 
-ndn::nfd::FaceStatus
-UdpFace::getFaceStatus() const
-{
-  auto status = DatagramFace::getFaceStatus();
-
-  if (this->getPersistency() == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) {
-    time::milliseconds left = m_idleTimeout;
-    left -= time::duration_cast<time::milliseconds>(time::steady_clock::now() - m_lastIdleCheck);
-
-    if (left < time::milliseconds::zero())
-      left = time::milliseconds::zero();
-
-    if (hasBeenUsedRecently())
-      left += m_idleTimeout;
-
-    status.setExpirationPeriod(left);
-  }
-
-  return status;
-}
-
 void
-UdpFace::closeIfIdle()
+UnicastUdpTransport::closeIfIdle()
 {
-  // Face can be switched from on-demand to non-on-demand mode
+  // transport can be switched from on-demand to non-on-demand mode
   // (non-on-demand -> on-demand transition is not allowed)
-  if (this->getPersistency() == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) {
+  if (getPersistency() == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) {
     if (!hasBeenUsedRecently()) {
-      NFD_LOG_FACE_INFO("Closing for inactivity");
-      close();
-
-      // #1718 manual test: uncomment, run NFD in valgrind, send in a UDP packet
-      //                    expect read-after-free error and crash
-      // getGlobalIoService().post([this] {
-      //   NFD_LOG_FACE_ERROR("Remaining references: " << this->shared_from_this().use_count());
-      // });
+      NFD_LOG_FACE_INFO("Closing due to inactivity");
+      this->close();
     }
     else {
       resetRecentUsage();
 
       m_lastIdleCheck = time::steady_clock::now();
-      m_closeIfIdleEvent = scheduler::schedule(m_idleTimeout, bind(&UdpFace::closeIfIdle, this));
+      m_closeIfIdleEvent = scheduler::schedule(m_idleTimeout, bind(&UnicastUdpTransport::closeIfIdle, this));
     }
   }
   // else do nothing and do not reschedule the event
 }
 
+} // namespace face
 } // namespace nfd
diff --git a/daemon/face/udp-face.hpp b/daemon/face/unicast-udp-transport.hpp
similarity index 70%
rename from daemon/face/udp-face.hpp
rename to daemon/face/unicast-udp-transport.hpp
index a7541a5..2622e4b 100644
--- a/daemon/face/udp-face.hpp
+++ b/daemon/face/unicast-udp-transport.hpp
@@ -23,27 +23,24 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NFD_DAEMON_FACE_UDP_FACE_HPP
-#define NFD_DAEMON_FACE_UDP_FACE_HPP
+#ifndef NFD_DAEMON_FACE_UDP_TRANSPORT_HPP
+#define NFD_DAEMON_FACE_UDP_TRANSPORT_HPP
 
-#include "datagram-face.hpp"
+#include "datagram-transport.hpp"
 #include "core/scheduler.hpp"
 
 namespace nfd {
+namespace face {
 
 /**
- * \brief Implementation of Face abstraction that uses
- *        unicast UDP as underlying transport mechanism
+ * \brief A Transport that communicates on a unicast UDP socket
  */
-class UdpFace : public DatagramFace<boost::asio::ip::udp>
+class UnicastUdpTransport : public DatagramTransport<boost::asio::ip::udp>
 {
 public:
-  UdpFace(const FaceUri& remoteUri, const FaceUri& localUri,
-          protocol::socket socket, ndn::nfd::FacePersistency persistency,
-          const time::seconds& idleTimeout);
-
-  ndn::nfd::FaceStatus
-  getFaceStatus() const DECL_OVERRIDE;
+  UnicastUdpTransport(protocol::socket&& socket,
+                      ndn::nfd::FacePersistency persistency,
+                      const time::seconds& idleTimeout);
 
 private:
   void
@@ -53,11 +50,9 @@
   const time::seconds m_idleTimeout;
   time::steady_clock::TimePoint m_lastIdleCheck;
   scheduler::ScopedEventId m_closeIfIdleEvent;
-
-  // friend because it needs to invoke protected Face::setOnDemand
-  friend class UdpChannel;
 };
 
+} // namespace face
 } // namespace nfd
 
-#endif // NFD_DAEMON_FACE_UDP_FACE_HPP
+#endif // NFD_DAEMON_FACE_UDP_TRANSPORT_HPP
diff --git a/daemon/face/unix-stream-channel.cpp b/daemon/face/unix-stream-channel.cpp
index c883163..3de9850 100644
--- a/daemon/face/unix-stream-channel.cpp
+++ b/daemon/face/unix-stream-channel.cpp
@@ -24,7 +24,9 @@
  */
 
 #include "unix-stream-channel.hpp"
-#include "unix-stream-face.hpp"
+#include "generic-link-service.hpp"
+#include "lp-face-wrapper.hpp"
+#include "unix-stream-transport.hpp"
 #include "core/global-io.hpp"
 
 #include <boost/filesystem.hpp>
@@ -131,9 +133,10 @@
 
   NFD_LOG_DEBUG("[" << m_endpoint << "] Incoming connection");
 
-  auto remoteUri = FaceUri::fromFd(m_socket.native_handle());
-  auto localUri = FaceUri(m_socket.local_endpoint());
-  auto face = make_shared<UnixStreamFace>(remoteUri, localUri, std::move(m_socket));
+  auto linkService = make_unique<face::GenericLinkService>();
+  auto transport = make_unique<face::UnixStreamTransport>(std::move(m_socket));
+  auto lpFace = make_unique<face::LpFace>(std::move(linkService), std::move(transport));
+  auto face = make_shared<face::LpFaceWrapper>(std::move(lpFace));
   onFaceCreated(face);
 
   // prepare accepting the next connection
diff --git a/daemon/face/unix-stream-face.cpp b/daemon/face/unix-stream-face.cpp
deleted file mode 100644
index 41ef68b..0000000
--- a/daemon/face/unix-stream-face.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014  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
- *
- * 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 "unix-stream-face.hpp"
-
-namespace nfd {
-
-// The whole purpose of this file is to specialize the logger,
-// otherwise, everything could be put into the header file.
-
-NFD_LOG_INCLASS_2TEMPLATE_SPECIALIZATION_DEFINE(StreamFace,
-                                                UnixStreamFace::protocol, LocalFace,
-                                                "UnixStreamFace");
-
-UnixStreamFace::UnixStreamFace(const FaceUri& remoteUri, const FaceUri& localUri,
-                               protocol::socket socket)
-  : StreamFace<protocol, LocalFace>(remoteUri, localUri, std::move(socket), true)
-{
-  static_assert(
-    std::is_same<std::remove_cv<protocol::socket::native_handle_type>::type, int>::value,
-    "The native handle type for UnixStreamFace sockets must be 'int'"
-  );
-}
-
-} // namespace nfd
diff --git a/daemon/face/unix-stream-face.hpp b/daemon/face/unix-stream-face.hpp
deleted file mode 100644
index c377819..0000000
--- a/daemon/face/unix-stream-face.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014  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
- *
- * 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_UNIX_STREAM_FACE_HPP
-#define NFD_DAEMON_FACE_UNIX_STREAM_FACE_HPP
-
-#include "stream-face.hpp"
-
-#ifndef HAVE_UNIX_SOCKETS
-#error "Cannot include this file when UNIX sockets are not available"
-#endif
-
-namespace nfd {
-
-/**
- * \brief Implementation of Face abstraction that uses stream-oriented
- *        Unix domain sockets as underlying transport mechanism
- */
-class UnixStreamFace : public StreamFace<boost::asio::local::stream_protocol, LocalFace>
-{
-public:
-  UnixStreamFace(const FaceUri& remoteUri, const FaceUri& localUri,
-                 protocol::socket socket);
-};
-
-} // namespace nfd
-
-#endif // NFD_DAEMON_FACE_UNIX_STREAM_FACE_HPP
diff --git a/daemon/face/udp-face.hpp b/daemon/face/unix-stream-transport.cpp
similarity index 60%
copy from daemon/face/udp-face.hpp
copy to daemon/face/unix-stream-transport.cpp
index a7541a5..17351f0 100644
--- a/daemon/face/udp-face.hpp
+++ b/daemon/face/unix-stream-transport.cpp
@@ -23,41 +23,29 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NFD_DAEMON_FACE_UDP_FACE_HPP
-#define NFD_DAEMON_FACE_UDP_FACE_HPP
-
-#include "datagram-face.hpp"
-#include "core/scheduler.hpp"
+#include "unix-stream-transport.hpp"
 
 namespace nfd {
+namespace face {
 
-/**
- * \brief Implementation of Face abstraction that uses
- *        unicast UDP as underlying transport mechanism
- */
-class UdpFace : public DatagramFace<boost::asio::ip::udp>
+NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(StreamTransport, UnixStreamTransport::protocol,
+                                               "UnixStreamTransport");
+
+UnixStreamTransport::UnixStreamTransport(protocol::socket&& socket)
+  : StreamTransport(std::move(socket))
 {
-public:
-  UdpFace(const FaceUri& remoteUri, const FaceUri& localUri,
-          protocol::socket socket, ndn::nfd::FacePersistency persistency,
-          const time::seconds& idleTimeout);
+  static_assert(
+    std::is_same<std::remove_cv<protocol::socket::native_handle_type>::type, int>::value,
+    "The native handle type for UnixStreamFace sockets must be 'int'"
+  );
 
-  ndn::nfd::FaceStatus
-  getFaceStatus() const DECL_OVERRIDE;
+  this->setLocalUri(FaceUri(m_socket.local_endpoint()));
+  this->setRemoteUri(FaceUri::fromFd(m_socket.native_handle()));
+  this->setScope(ndn::nfd::FACE_SCOPE_LOCAL);
+  this->setPersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
 
-private:
-  void
-  closeIfIdle();
+  NFD_LOG_FACE_INFO("Creating Transport");
+}
 
-private:
-  const time::seconds m_idleTimeout;
-  time::steady_clock::TimePoint m_lastIdleCheck;
-  scheduler::ScopedEventId m_closeIfIdleEvent;
-
-  // friend because it needs to invoke protected Face::setOnDemand
-  friend class UdpChannel;
-};
-
+} // namespace face
 } // namespace nfd
-
-#endif // NFD_DAEMON_FACE_UDP_FACE_HPP
diff --git a/daemon/face/udp-face.hpp b/daemon/face/unix-stream-transport.hpp
similarity index 61%
copy from daemon/face/udp-face.hpp
copy to daemon/face/unix-stream-transport.hpp
index a7541a5..27f4eaa 100644
--- a/daemon/face/udp-face.hpp
+++ b/daemon/face/unix-stream-transport.hpp
@@ -23,41 +23,29 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NFD_DAEMON_FACE_UDP_FACE_HPP
-#define NFD_DAEMON_FACE_UDP_FACE_HPP
+#ifndef NFD_DAEMON_FACE_UNIX_STREAM_TRANSPORT_HPP
+#define NFD_DAEMON_FACE_UNIX_STREAM_TRANSPORT_HPP
 
-#include "datagram-face.hpp"
-#include "core/scheduler.hpp"
+#include "stream-transport.hpp"
+
+#ifndef HAVE_UNIX_SOCKETS
+#error "Cannot include this file when UNIX sockets are not available"
+#endif
 
 namespace nfd {
+namespace face {
 
 /**
- * \brief Implementation of Face abstraction that uses
- *        unicast UDP as underlying transport mechanism
+ * \brief A Transport that communicates on a stream-oriented Unix domain socket
  */
-class UdpFace : public DatagramFace<boost::asio::ip::udp>
+class UnixStreamTransport : public StreamTransport<boost::asio::local::stream_protocol>
 {
 public:
-  UdpFace(const FaceUri& remoteUri, const FaceUri& localUri,
-          protocol::socket socket, ndn::nfd::FacePersistency persistency,
-          const time::seconds& idleTimeout);
-
-  ndn::nfd::FaceStatus
-  getFaceStatus() const DECL_OVERRIDE;
-
-private:
-  void
-  closeIfIdle();
-
-private:
-  const time::seconds m_idleTimeout;
-  time::steady_clock::TimePoint m_lastIdleCheck;
-  scheduler::ScopedEventId m_closeIfIdleEvent;
-
-  // friend because it needs to invoke protected Face::setOnDemand
-  friend class UdpChannel;
+  explicit
+  UnixStreamTransport(protocol::socket&& socket);
 };
 
+} // namespace face
 } // namespace nfd
 
-#endif // NFD_DAEMON_FACE_UDP_FACE_HPP
+#endif // NFD_DAEMON_FACE_UNIX_STREAM_TRANSPORT_HPP
diff --git a/daemon/fw/best-route-strategy2.cpp b/daemon/fw/best-route-strategy2.cpp
index 2ec786c..e0e31dc 100644
--- a/daemon/fw/best-route-strategy2.cpp
+++ b/daemon/fw/best-route-strategy2.cpp
@@ -31,7 +31,7 @@
 
 NFD_LOG_INIT("BestRouteStrategy2");
 
-const Name BestRouteStrategy2::STRATEGY_NAME("ndn:/localhost/nfd/strategy/best-route/%FD%03");
+const Name BestRouteStrategy2::STRATEGY_NAME("ndn:/localhost/nfd/strategy/best-route/%FD%04");
 NFD_REGISTER_STRATEGY(BestRouteStrategy2);
 
 BestRouteStrategy2::BestRouteStrategy2(Forwarder& forwarder, const Name& name)
@@ -104,8 +104,7 @@
   const fib::NextHopList& nexthops = fibEntry->getNextHops();
   fib::NextHopList::const_iterator it = nexthops.end();
 
-  RetxSuppression::Result suppression =
-      m_retxSuppression.decide(inFace, interest, *pitEntry);
+  RetxSuppression::Result suppression = m_retxSuppression.decide(inFace, interest, *pitEntry);
   if (suppression == RetxSuppression::NEW) {
     // forward to nexthop with lowest cost except downstream
     it = std::find_if(nexthops.begin(), nexthops.end(),
@@ -114,6 +113,11 @@
 
     if (it == nexthops.end()) {
       NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " noNextHop");
+
+      lp::NackHeader nackHeader;
+      nackHeader.setReason(lp::NackReason::NO_ROUTE);
+      this->sendNack(pitEntry, inFace, nackHeader);
+
       this->rejectPendingInterest(pitEntry);
       return;
     }
@@ -156,5 +160,72 @@
   }
 }
 
+/** \return less severe NackReason between x and y
+ *
+ *  lp::NackReason::NONE is treated as most severe
+ */
+inline lp::NackReason
+compareLessSevere(lp::NackReason x, lp::NackReason y)
+{
+  if (x == lp::NackReason::NONE) {
+    return y;
+  }
+  if (y == lp::NackReason::NONE) {
+    return x;
+  }
+  return static_cast<lp::NackReason>(std::min(static_cast<int>(x), static_cast<int>(y)));
+}
+
+void
+BestRouteStrategy2::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+                                     shared_ptr<fib::Entry> fibEntry,
+                                     shared_ptr<pit::Entry> pitEntry)
+{
+  int nOutRecordsNotNacked = 0;
+  Face* lastFaceNotNacked = nullptr;
+  lp::NackReason leastSevereReason = lp::NackReason::NONE;
+  for (const pit::OutRecord& outR : pitEntry->getOutRecords()) {
+    const lp::NackHeader* inNack = outR.getIncomingNack();
+    if (inNack == nullptr) {
+      ++nOutRecordsNotNacked;
+      lastFaceNotNacked = outR.getFace().get();
+      continue;
+    }
+
+    leastSevereReason = compareLessSevere(leastSevereReason, inNack->getReason());
+  }
+
+  lp::NackHeader outNack;
+  outNack.setReason(leastSevereReason);
+
+  if (nOutRecordsNotNacked == 1) {
+    BOOST_ASSERT(lastFaceNotNacked != nullptr);
+    pit::InRecordCollection::const_iterator inR = pitEntry->getInRecord(*lastFaceNotNacked);
+    if (inR != pitEntry->getInRecords().end()) {
+      // one out-record not Nacked, which is also a downstream
+      NFD_LOG_DEBUG(nack.getInterest() << " nack-from=" << inFace.getId() <<
+                    " nack=" << nack.getReason() <<
+                    " nack-to(bidirectional)=" << lastFaceNotNacked->getId() <<
+                    " out-nack=" << outNack.getReason());
+      this->sendNack(pitEntry, *lastFaceNotNacked, outNack);
+      return;
+    }
+  }
+
+  if (nOutRecordsNotNacked > 0) {
+    NFD_LOG_DEBUG(nack.getInterest() << " nack-from=" << inFace.getId() <<
+                  " nack=" << nack.getReason() <<
+                  " waiting=" << nOutRecordsNotNacked);
+    // continue waiting
+    return;
+  }
+
+
+  NFD_LOG_DEBUG(nack.getInterest() << " nack-from=" << inFace.getId() <<
+                " nack=" << nack.getReason() <<
+                " nack-to=all out-nack=" << outNack.getReason());
+  this->sendNacks(pitEntry, outNack);
+}
+
 } // namespace fw
 } // namespace nfd
diff --git a/daemon/fw/best-route-strategy2.hpp b/daemon/fw/best-route-strategy2.hpp
index bf3eba2..8c19dc0 100644
--- a/daemon/fw/best-route-strategy2.hpp
+++ b/daemon/fw/best-route-strategy2.hpp
@@ -32,13 +32,22 @@
 namespace nfd {
 namespace fw {
 
-/** \brief Best Route strategy version 3
+/** \brief Best Route strategy version 4
  *
  *  This strategy forwards a new Interest to the lowest-cost nexthop (except downstream).
  *  After that, if consumer retransmits the Interest (and is not suppressed according to
  *  exponential backoff algorithm), the strategy forwards the Interest again to
  *  the lowest-cost nexthop (except downstream) that is not previously used.
- *  If all nexthops have been used, the strategy starts over.
+ *  If all nexthops have been used, the strategy starts over with the first nexthop.
+ *
+ *  This strategy returns Nack to all downstreams with reason NoRoute
+ *  if there is no usable nexthop, which may be caused by:
+ *  (a) the FIB entry contains no nexthop;
+ *  (b) the FIB nexthop happens to be the sole downstream;
+ *  (c) the FIB nexthops violate scope.
+ *
+ *  This strategy returns Nack to all downstreams if all upstreams have returned Nacks.
+ *  The reason of the sent Nack equals the least severe reason among received Nacks.
  */
 class BestRouteStrategy2 : public Strategy
 {
@@ -46,11 +55,15 @@
   BestRouteStrategy2(Forwarder& forwarder, const Name& name = STRATEGY_NAME);
 
   virtual void
-  afterReceiveInterest(const Face& inFace,
-                       const Interest& interest,
+  afterReceiveInterest(const Face& inFace, const Interest& interest,
                        shared_ptr<fib::Entry> fibEntry,
                        shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE;
 
+  virtual void
+  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+                   shared_ptr<fib::Entry> fibEntry,
+                   shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE;
+
 public:
   static const Name STRATEGY_NAME;
 
diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp
index f256d20..a8a8053 100644
--- a/daemon/fw/face-table.cpp
+++ b/daemon/fw/face-table.cpp
@@ -25,6 +25,7 @@
 
 #include "face-table.hpp"
 #include "forwarder.hpp"
+#include "core/global-io.hpp"
 #include "core/logger.hpp"
 
 namespace nfd {
@@ -89,6 +90,8 @@
                                        &m_forwarder, ref(*face), _1));
   face->onReceiveData.connect(bind(&Forwarder::startProcessData,
                                    &m_forwarder, ref(*face), _1));
+  face->onReceiveNack.connect(bind(&Forwarder::startProcessNack,
+                                   &m_forwarder, ref(*face), _1));
   face->onFail.connectSingleShot(bind(&FaceTable::remove, this, face, _1));
 
   this->onAdd(face);
@@ -109,6 +112,9 @@
                " (" << reason << ")");
 
   m_forwarder.getFib().removeNextHopFromAllEntries(face);
+
+  // defer Face deallocation, so that Transport isn't deallocated during afterStateChange signal
+  getGlobalIoService().post([face] {});
 }
 
 FaceTable::ForwardRange
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 27bfa38..20428c5 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -60,7 +60,7 @@
       interest.getLink();
     }
   }
-  catch (tlv::Error&) {
+  catch (const tlv::Error&) {
     NFD_LOG_DEBUG("startProcessInterest face=" << face.getId() <<
                   " interest=" << interest.getName() << " malformed");
     // It's safe to call interest.getName() because Name has been fully parsed
@@ -80,6 +80,25 @@
 }
 
 void
+Forwarder::startProcessNack(Face& face, const lp::Nack& nack)
+{
+  // check fields used by forwarding are well-formed
+  try {
+    if (nack.getInterest().hasLink()) {
+      nack.getInterest().getLink();
+    }
+  }
+  catch (const tlv::Error&) {
+    NFD_LOG_DEBUG("startProcessNack face=" << face.getId() <<
+                  " nack=" << nack.getInterest().getName() <<
+                  "~" << nack.getReason() << " malformed");
+    return;
+  }
+
+  this->onIncomingNack(face, nack);
+}
+
+void
 Forwarder::onIncomingInterest(Face& inFace, const Interest& interest)
 {
   // receive Interest
@@ -131,10 +150,23 @@
 Forwarder::onInterestLoop(Face& inFace, const Interest& interest,
                           shared_ptr<pit::Entry> pitEntry)
 {
-  NFD_LOG_DEBUG("onInterestLoop face=" << inFace.getId() <<
-                " interest=" << interest.getName());
+  // if multi-access face, drop
+  if (inFace.isMultiAccess()) {
+    NFD_LOG_DEBUG("onInterestLoop face=" << inFace.getId() <<
+                  " interest=" << interest.getName() <<
+                  " drop");
+    return;
+  }
 
-  // (drop)
+  NFD_LOG_DEBUG("onInterestLoop face=" << inFace.getId() <<
+                " interest=" << interest.getName() <<
+                " send-Nack-duplicate");
+
+  // send Nack with reason=DUPLICATE
+  // note: Don't enter outgoing Nack pipeline because it needs an in-record.
+  lp::Nack nack(interest);
+  nack.setReason(lp::NackReason::DUPLICATE);
+  inFace.sendNack(nack);
 }
 
 void
@@ -362,7 +394,7 @@
   // CS insert
   m_cs.insert(data);
 
-  std::set<shared_ptr<Face> > pendingDownstreams;
+  std::set<Face*> pendingDownstreams;
   // foreach PitEntry
   for (const shared_ptr<pit::Entry>& pitEntry : pitMatches) {
     NFD_LOG_DEBUG("onIncomingData matching=" << pitEntry->getName());
@@ -372,10 +404,9 @@
 
     // remember pending downstreams
     const pit::InRecordCollection& inRecords = pitEntry->getInRecords();
-    for (pit::InRecordCollection::const_iterator it = inRecords.begin();
-                                                 it != inRecords.end(); ++it) {
-      if (it->getExpiry() > time::steady_clock::now()) {
-        pendingDownstreams.insert(it->getFace());
+    for (const pit::InRecord& inRecord : inRecords) {
+      if (inRecord.getExpiry() > time::steady_clock::now()) {
+        pendingDownstreams.insert(inRecord.getFace().get());
       }
     }
 
@@ -395,10 +426,8 @@
   }
 
   // foreach pending downstream
-  for (std::set<shared_ptr<Face> >::iterator it = pendingDownstreams.begin();
-      it != pendingDownstreams.end(); ++it) {
-    shared_ptr<Face> pendingDownstream = *it;
-    if (pendingDownstream.get() == &inFace) {
+  for (Face* pendingDownstream : pendingDownstreams) {
+    if (pendingDownstream == &inFace) {
       continue;
     }
     // goto outgoing Data pipeline
@@ -447,6 +476,104 @@
   ++m_counters.getNOutDatas();
 }
 
+void
+Forwarder::onIncomingNack(Face& inFace, const lp::Nack& nack)
+{
+  // if multi-access face, drop
+  if (inFace.isMultiAccess()) {
+    NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
+                  " nack=" << nack.getInterest().getName() <<
+                  "~" << nack.getReason() << " face-is-multi-access");
+    return;
+  }
+
+  // PIT match
+  shared_ptr<pit::Entry> pitEntry = m_pit.find(nack.getInterest());
+  // if no PIT entry found, drop
+  if (pitEntry == nullptr) {
+    NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
+                  " nack=" << nack.getInterest().getName() <<
+                  "~" << nack.getReason() << " no-PIT-entry");
+    return;
+  }
+
+  // has out-record?
+  pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(inFace);
+  // if no out-record found, drop
+  if (outRecord == pitEntry->getOutRecords().end()) {
+    NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
+                  " nack=" << nack.getInterest().getName() <<
+                  "~" << nack.getReason() << " no-out-record");
+    return;
+  }
+
+  // if out-record has different Nonce, drop
+  if (nack.getInterest().getNonce() != outRecord->getLastNonce()) {
+    NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
+                  " nack=" << nack.getInterest().getName() <<
+                  "~" << nack.getReason() << " wrong-Nonce " <<
+                  nack.getInterest().getNonce() << "!=" << outRecord->getLastNonce());
+    return;
+  }
+
+  NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() <<
+                " nack=" << nack.getInterest().getName() <<
+                "~" << nack.getReason() << " OK");
+
+  // record Nack on out-record
+  outRecord->setIncomingNack(nack);
+
+  // trigger strategy: after receive NACK
+  shared_ptr<fib::Entry> fibEntry = m_fib.findLongestPrefixMatch(*pitEntry);
+  this->dispatchToStrategy(pitEntry, bind(&Strategy::afterReceiveNack, _1,
+                                          cref(inFace), cref(nack), fibEntry, pitEntry));
+}
+
+void
+Forwarder::onOutgoingNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace,
+                          const lp::NackHeader& nack)
+{
+  if (outFace.getId() == INVALID_FACEID) {
+    NFD_LOG_WARN("onOutgoingNack face=invalid" <<
+                  " nack=" << pitEntry->getInterest().getName() <<
+                  "~" << nack.getReason() << " no-in-record");
+    return;
+  }
+
+  // has in-record?
+  pit::InRecordCollection::const_iterator inRecord = pitEntry->getInRecord(outFace);
+
+  // if no in-record found, drop
+  if (inRecord == pitEntry->getInRecords().end()) {
+    NFD_LOG_DEBUG("onOutgoingNack face=" << outFace.getId() <<
+                  " nack=" << pitEntry->getInterest().getName() <<
+                  "~" << nack.getReason() << " no-in-record");
+    return;
+  }
+
+  // if multi-access face, drop
+  if (outFace.isMultiAccess()) {
+    NFD_LOG_DEBUG("onOutgoingNack face=" << outFace.getId() <<
+                  " nack=" << pitEntry->getInterest().getName() <<
+                  "~" << nack.getReason() << " face-is-multi-access");
+    return;
+  }
+
+  NFD_LOG_DEBUG("onOutgoingNack face=" << outFace.getId() <<
+                " nack=" << pitEntry->getInterest().getName() <<
+                "~" << nack.getReason() << " OK");
+
+  // create Nack packet with the Interest from in-record
+  lp::Nack nackPkt(inRecord->getInterest());
+  nackPkt.setHeader(nack);
+
+  // erase in-record
+  pitEntry->deleteInRecord(outFace);
+
+  // send Nack on face
+  const_cast<Face&>(outFace).sendNack(nackPkt);
+}
+
 static inline bool
 compare_InRecord_expiry(const pit::InRecord& a, const pit::InRecord& b)
 {
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index 155ec4a..ebfaa05 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -90,6 +90,12 @@
   void
   startProcessData(Face& face, const Data& data);
 
+  /** \brief start incoming Nack processing
+   *  \param nack the incoming Nack, must be created with make_shared
+   */
+  void
+  startProcessNack(Face& face, const lp::Nack& nack);
+
   NameTree&
   getNameTree();
 
@@ -128,12 +134,12 @@
 
   /** \brief Content Store miss pipeline
   */
-  void
+  VIRTUAL_WITH_TESTS void
   onContentStoreMiss(const Face& inFace, shared_ptr<pit::Entry> pitEntry, const Interest& interest);
 
   /** \brief Content Store hit pipeline
   */
-  void
+  VIRTUAL_WITH_TESTS void
   onContentStoreHit(const Face& inFace, shared_ptr<pit::Entry> pitEntry,
                     const Interest& interest, const Data& data);
 
@@ -176,6 +182,16 @@
   VIRTUAL_WITH_TESTS void
   onOutgoingData(const Data& data, Face& outFace);
 
+  /** \brief incoming Nack pipeline
+   */
+  VIRTUAL_WITH_TESTS void
+  onIncomingNack(Face& inFace, const lp::Nack& nack);
+
+  /** \brief outgoing Nack pipeline
+   */
+  VIRTUAL_WITH_TESTS void
+  onOutgoingNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace, const lp::NackHeader& nack);
+
 PROTECTED_WITH_TESTS_ELSE_PRIVATE:
   VIRTUAL_WITH_TESTS void
   setUnsatisfyTimer(shared_ptr<pit::Entry> pitEntry);
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 4f439db..7b0504e 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -60,23 +60,36 @@
   NFD_LOG_DEBUG("beforeExpirePendingInterest pitEntry=" << pitEntry->getName());
 }
 
-//void
-//Strategy::afterAddFibEntry(shared_ptr<fib::Entry> fibEntry)
-//{
-//  NFD_LOG_DEBUG("afterAddFibEntry fibEntry=" << fibEntry->getPrefix());
-//}
-//
-//void
-//Strategy::afterUpdateFibEntry(shared_ptr<fib::Entry> fibEntry)
-//{
-//  NFD_LOG_DEBUG("afterUpdateFibEntry fibEntry=" << fibEntry->getPrefix());
-//}
-//
-//void
-//Strategy::beforeRemoveFibEntry(shared_ptr<fib::Entry> fibEntry)
-//{
-//  NFD_LOG_DEBUG("beforeRemoveFibEntry fibEntry=" << fibEntry->getPrefix());
-//}
+void
+Strategy::afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+                           shared_ptr<fib::Entry> fibEntry, shared_ptr<pit::Entry> pitEntry)
+{
+  NFD_LOG_DEBUG("afterReceiveNack inFace=" << inFace.getId() <<
+                " pitEntry=" << pitEntry->getName());
+}
+
+void
+Strategy::sendNacks(shared_ptr<pit::Entry> pitEntry, const lp::NackHeader& header,
+                    std::initializer_list<const Face*> exceptFaces)
+{
+  // populate downstreams with all downstreams faces
+  std::unordered_set<const Face*> downstreams;
+  const pit::InRecordCollection& inRecords = pitEntry->getInRecords();
+  std::transform(inRecords.begin(), inRecords.end(), std::inserter(downstreams, downstreams.end()),
+                 [] (const pit::InRecord& inR) { return inR.getFace().get(); });
+
+  // delete excluded faces
+  // .erase in a loop is more efficient than std::set_difference between that requires sorted range
+  for (const Face* exceptFace : exceptFaces) {
+    downstreams.erase(exceptFace);
+  }
+
+  // send Nacks
+  for (const Face* downstream : downstreams) {
+    this->sendNack(pitEntry, *downstream, header);
+  }
+  // warning: don't loop on pitEntry->getInRecords(), because InRecord is erased when sending Nack
+}
 
 } // namespace fw
 } // namespace nfd
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index 8eca1db..ebbb361 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -70,7 +70,7 @@
    *    invoke this->rejectPendingInterest so that PIT entry will be deleted shortly
    *
    *  \note The strategy is permitted to store a weak reference to fibEntry.
-   *        Do not store a shared reference, because PIT entry may be deleted at any moment.
+   *        Do not store a shared reference, because FIB entry may be deleted at any moment.
    *        fibEntry is passed by value to allow obtaining a weak reference from it.
    *  \note The strategy is permitted to store a shared reference to pitEntry.
    *        pitEntry is passed by value to reflect this fact.
@@ -110,11 +110,33 @@
   virtual void
   beforeExpirePendingInterest(shared_ptr<pit::Entry> pitEntry);
 
+  /** \brief trigger after Nack is received
+   *
+   *  This trigger is invoked when an incoming Nack is received in response to
+   *  an forwarded Interest.
+   *  The Nack has been confirmed to be a response to the last Interest forwarded
+   *  to that upstream, i.e. the PIT out-record exists and has a matching Nonce.
+   *  The NackHeader has been recorded in the PIT out-record.
+   *
+   *  In this base class this method does nothing.
+   *
+   *  \note The strategy is permitted to store a weak reference to fibEntry.
+   *        Do not store a shared reference, because PIT entry may be deleted at any moment.
+   *        fibEntry is passed by value to allow obtaining a weak reference from it.
+   *  \note The strategy is permitted to store a shared reference to pitEntry.
+   *        pitEntry is passed by value to reflect this fact.
+   */
+  virtual void
+  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+                   shared_ptr<fib::Entry> fibEntry, shared_ptr<pit::Entry> pitEntry);
+
 protected: // actions
-  /// send Interest to outFace
+  /** \brief send Interest to outFace
+   *  \param wantNewNonce if true, a new Nonce will be generated,
+   *                      rather than reusing a Nonce from one of the PIT in-records
+   */
   VIRTUAL_WITH_TESTS void
-  sendInterest(shared_ptr<pit::Entry> pitEntry,
-               shared_ptr<Face> outFace,
+  sendInterest(shared_ptr<pit::Entry> pitEntry, shared_ptr<Face> outFace,
                bool wantNewNonce = false);
 
   /** \brief decide that a pending Interest cannot be forwarded
@@ -125,6 +147,22 @@
   VIRTUAL_WITH_TESTS void
   rejectPendingInterest(shared_ptr<pit::Entry> pitEntry);
 
+  /** \brief send Nack to outFace
+   *
+   *  The outFace must have a PIT in-record, otherwise this method has no effect.
+   */
+  VIRTUAL_WITH_TESTS void
+  sendNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace,
+           const lp::NackHeader& header);
+
+  /** \brief send Nack to every face that has an in-record,
+   *         except those in \p exceptFaces
+   *  \note This is not an action, but a helper that invokes the sendNack action.
+   */
+  void
+  sendNacks(shared_ptr<pit::Entry> pitEntry, const lp::NackHeader& header,
+            std::initializer_list<const Face*> exceptFaces = std::initializer_list<const Face*>());
+
 protected: // accessors
   MeasurementsAccessor&
   getMeasurements();
@@ -171,6 +209,13 @@
   m_forwarder.onInterestReject(pitEntry);
 }
 
+inline void
+Strategy::sendNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace,
+                   const lp::NackHeader& header)
+{
+  m_forwarder.onOutgoingNack(pitEntry, outFace, header);
+}
+
 inline MeasurementsAccessor&
 Strategy::getMeasurements()
 {
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index 2991ee6..29cac39 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -26,9 +26,11 @@
 #include "face-manager.hpp"
 
 #include "core/network-interface.hpp"
-#include "fw/face-table.hpp"
+#include "face/generic-link-service.hpp"
+#include "face/lp-face-wrapper.hpp"
 #include "face/tcp-factory.hpp"
 #include "face/udp-factory.hpp"
+#include "fw/face-table.hpp"
 
 #include <ndn-cxx/management/nfd-face-status.hpp>
 #include <ndn-cxx/management/nfd-channel-status.hpp>
@@ -132,43 +134,6 @@
 }
 
 void
-FaceManager::destroyFace(const Name& topPrefix, const Interest& interest,
-                         const ControlParameters& parameters,
-                         const ndn::mgmt::CommandContinuation& done)
-{
-  shared_ptr<Face> target = m_faceTable.get(parameters.getFaceId());
-  if (target) {
-    target->close();
-  }
-
-  done(ControlResponse(200, "OK").setBody(parameters.wireEncode()));
-}
-
-void
-FaceManager::enableLocalControl(const Name& topPrefix, const Interest& interest,
-                                const ControlParameters& parameters,
-                                const ndn::mgmt::CommandContinuation& done)
-{
-  auto result = extractLocalControlParameters(interest, parameters, done);
-  if (result.isValid) {
-    result.face->setLocalControlHeaderFeature(result.feature, true);
-    return done(ControlResponse(200, "OK").setBody(parameters.wireEncode()));
-  }
-}
-
-void
-FaceManager::disableLocalControl(const Name& topPrefix, const Interest& interest,
-                                 const ControlParameters& parameters,
-                                 const ndn::mgmt::CommandContinuation& done)
-{
-  auto result = extractLocalControlParameters(interest, parameters, done);
-  if (result.isValid) {
-    result.face->setLocalControlHeaderFeature(result.feature, false);
-    return done(ControlResponse(200, "OK").setBody(parameters.wireEncode()));
-  }
-}
-
-void
 FaceManager::afterCreateFaceSuccess(ControlParameters& parameters,
                                     const shared_ptr<Face>& newFace,
                                     const ndn::mgmt::CommandContinuation& done)
@@ -182,6 +147,19 @@
 }
 
 void
+FaceManager::destroyFace(const Name& topPrefix, const Interest& interest,
+                         const ControlParameters& parameters,
+                         const ndn::mgmt::CommandContinuation& done)
+{
+  shared_ptr<Face> target = m_faceTable.get(parameters.getFaceId());
+  if (target) {
+    target->close();
+  }
+
+  done(ControlResponse(200, "OK").setBody(parameters.wireEncode()));
+}
+
+void
 FaceManager::afterCreateFaceFailure(const std::string& reason,
                                     const ndn::mgmt::CommandContinuation& done)
 {
@@ -190,6 +168,68 @@
   done(ControlResponse(408, "Failed to create face: " + reason));
 }
 
+void
+FaceManager::enableLocalControl(const Name& topPrefix, const Interest& interest,
+                                const ControlParameters& parameters,
+                                const ndn::mgmt::CommandContinuation& done)
+{
+  auto result = extractLocalControlParameters(interest, parameters, done);
+  if (!result.isValid) {
+    return;
+  }
+
+  if (result.face) {
+    result.face->setLocalControlHeaderFeature(result.feature, true);
+    return done(ControlResponse(200, "OK").setBody(parameters.wireEncode()));
+  }
+
+  // TODO#3226 redesign enable-local-control
+  // For now, enable-local-control will enable all local fields in GenericLinkService.
+  BOOST_ASSERT(result.lpFace != nullptr);
+  auto service = dynamic_cast<face::GenericLinkService*>(result.lpFace->getLinkService());
+  if (service == nullptr) {
+    return done(ControlResponse(503, "LinkService type not supported"));
+  }
+
+  face::GenericLinkService::Options options = service->getOptions();
+  options.allowLocalFields = true;
+  service->setOptions(options);
+
+  return done(ControlResponse(200, "OK: enable all local fields on GenericLinkService")
+              .setBody(parameters.wireEncode()));
+}
+
+void
+FaceManager::disableLocalControl(const Name& topPrefix, const Interest& interest,
+                                 const ControlParameters& parameters,
+                                 const ndn::mgmt::CommandContinuation& done)
+{
+  auto result = extractLocalControlParameters(interest, parameters, done);
+  if (!result.isValid) {
+    return;
+  }
+
+  if (result.face) {
+    result.face->setLocalControlHeaderFeature(result.feature, false);
+    return done(ControlResponse(200, "OK").setBody(parameters.wireEncode()));
+  }
+
+  // TODO#3226 redesign disable-local-control
+  // For now, disable-local-control will disable all local fields in GenericLinkService.
+  BOOST_ASSERT(result.lpFace != nullptr);
+  auto service = dynamic_cast<face::GenericLinkService*>(result.lpFace->getLinkService());
+  if (service == nullptr) {
+    return done(ControlResponse(503, "LinkService type not supported"));
+  }
+
+  face::GenericLinkService::Options options = service->getOptions();
+  options.allowLocalFields = false;
+  service->setOptions(options);
+
+  return done(ControlResponse(200, "OK: disable all local fields on GenericLinkService")
+              .setBody(parameters.wireEncode()));
+}
+
 FaceManager::ExtractLocalControlParametersResult
 FaceManager::extractLocalControlParameters(const Interest& request,
                                            const ControlParameters& parameters,
@@ -197,6 +237,7 @@
 {
   ExtractLocalControlParametersResult result;
   result.isValid = false;
+  result.lpFace = nullptr;
 
   auto face = m_faceTable.get(request.getIncomingFaceId());
   if (!static_cast<bool>(face)) {
@@ -214,6 +255,11 @@
 
   result.isValid = true;
   result.face = dynamic_pointer_cast<LocalFace>(face);
+  if (result.face == nullptr) {
+    auto lpFaceW = dynamic_pointer_cast<face::LpFaceWrapper>(face);
+    BOOST_ASSERT(lpFaceW != nullptr);
+    result.lpFace = lpFaceW->getLpFace();
+  }
   result.feature = static_cast<LocalControlFeature>(parameters.getLocalControlFeature());
 
   return result;
@@ -685,7 +731,7 @@
       }
 #endif
 
-      std::list<shared_ptr<MulticastUdpFace> > multicastFacesToRemove;
+      std::list<shared_ptr<face::LpFaceWrapper>> multicastFacesToRemove;
       for (auto i = factory->getMulticastFaces().begin();
            i != factory->getMulticastFaces().end();
            ++i) {
@@ -693,33 +739,27 @@
       }
 
       for (const auto& nic : ipv4MulticastInterfaces) {
-        shared_ptr<MulticastUdpFace> newFace;
-        newFace = factory->createMulticastFace(nic.ipv4Addresses[0].to_string(),
-                                               mcastGroup,
-                                               mcastPort,
-                                               isNicNameNecessary ? nic.name : "");
+        auto newFace = factory->createMulticastFace(nic.ipv4Addresses[0].to_string(),
+                                                    mcastGroup, mcastPort,
+                                                    isNicNameNecessary ? nic.name : "");
         addCreatedFaceToForwarder(newFace);
         multicastFacesToRemove.remove(newFace);
       }
 
-      for (auto i = multicastFacesToRemove.begin();
-           i != multicastFacesToRemove.end();
-           ++i) {
-        (*i)->close();
+      for (const auto& face : multicastFacesToRemove) {
+        face->close();
       }
     }
     else {
-      std::list<shared_ptr<MulticastUdpFace>> multicastFacesToRemove;
+      std::list<shared_ptr<face::LpFaceWrapper>> multicastFacesToRemove;
       for (auto i = factory->getMulticastFaces().begin();
            i != factory->getMulticastFaces().end();
            ++i) {
         multicastFacesToRemove.push_back(i->second);
       }
 
-      for (auto i = multicastFacesToRemove.begin();
-           i != multicastFacesToRemove.end();
-           ++i) {
-        (*i)->close();
+      for (const auto& face : multicastFacesToRemove) {
+        face->close();
       }
     }
   }
diff --git a/daemon/mgmt/face-manager.hpp b/daemon/mgmt/face-manager.hpp
index f5283d6..e3c955f 100644
--- a/daemon/mgmt/face-manager.hpp
+++ b/daemon/mgmt/face-manager.hpp
@@ -36,6 +36,10 @@
 class NetworkInterfaceInfo;
 class ProtocolFactory;
 
+namespace face {
+class LpFace;
+} // namespace face
+
 /**
  * @brief implement the Face Management of NFD Management Protocol.
  * @sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt
@@ -88,6 +92,7 @@
   {
     bool isValid;
     shared_ptr<LocalFace> face;
+    face::LpFace* lpFace;
     LocalControlFeature feature;
   };
 
diff --git a/daemon/table/pit-entry.cpp b/daemon/table/pit-entry.cpp
index da7c6ed..85ea19c 100644
--- a/daemon/table/pit-entry.cpp
+++ b/daemon/table/pit-entry.cpp
@@ -149,6 +149,16 @@
 }
 
 void
+Entry::deleteInRecord(const Face& face)
+{
+  auto it = std::find_if(m_inRecords.begin(), m_inRecords.end(),
+    [&face] (const InRecord& inRecord) { return inRecord.getFace().get() == &face; });
+  if (it != m_inRecords.end()) {
+    m_inRecords.erase(it);
+  }
+}
+
+void
 Entry::deleteInRecords()
 {
   m_inRecords.clear();
@@ -168,8 +178,8 @@
   return it;
 }
 
-OutRecordCollection::const_iterator
-Entry::getOutRecord(const Face& face) const
+OutRecordCollection::iterator
+Entry::getOutRecord(const Face& face)
 {
   return std::find_if(m_outRecords.begin(), m_outRecords.end(),
     [&face] (const OutRecord& outRecord) { return outRecord.getFace().get() == &face; });
diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp
index 6d59ce8..3f15598 100644
--- a/daemon/table/pit-entry.hpp
+++ b/daemon/table/pit-entry.hpp
@@ -132,6 +132,10 @@
   InRecordCollection::const_iterator
   getInRecord(const Face& face) const;
 
+  /// deletes one InRecord for face if exists
+  void
+  deleteInRecord(const Face& face);
+
   /// deletes all InRecords
   void
   deleteInRecords();
@@ -151,8 +155,8 @@
   /** \brief get the OutRecord for face
    *  \return an iterator to the OutRecord, or .end if it does not exist
    */
-  OutRecordCollection::const_iterator
-  getOutRecord(const Face& face) const;
+  OutRecordCollection::iterator
+  getOutRecord(const Face& face);
 
   /// deletes one OutRecord for face if exists
   void
diff --git a/daemon/table/pit-out-record.cpp b/daemon/table/pit-out-record.cpp
index 268b67b..1cf303d 100644
--- a/daemon/table/pit-out-record.cpp
+++ b/daemon/table/pit-out-record.cpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  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
+ * 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.
@@ -20,7 +21,7 @@
  *
  * 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 "pit-out-record.hpp"
 
@@ -32,5 +33,16 @@
 {
 }
 
+bool
+OutRecord::setIncomingNack(const lp::Nack& nack)
+{
+  if (nack.getInterest().getNonce() != this->getLastNonce()) {
+    return false;
+  }
+
+  m_incomingNack.reset(new lp::NackHeader(nack.getHeader()));
+  return true;
+}
+
 } // namespace pit
 } // namespace nfd
diff --git a/daemon/table/pit-out-record.hpp b/daemon/table/pit-out-record.hpp
index c75e005..4717779 100644
--- a/daemon/table/pit-out-record.hpp
+++ b/daemon/table/pit-out-record.hpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  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
+ * 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.
@@ -20,7 +21,7 @@
  *
  * 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_TABLE_PIT_OUT_RECORD_HPP
 #define NFD_DAEMON_TABLE_PIT_OUT_RECORD_HPP
@@ -30,14 +31,49 @@
 namespace nfd {
 namespace pit {
 
-/** \class OutRecord
- *  \brief contains information about an Interest toward an outgoing face
+/** \brief contains information about an Interest toward an outgoing face
  */
 class OutRecord : public FaceRecord
 {
 public:
   explicit
   OutRecord(shared_ptr<Face> face);
+
+  /** \return last NACK returned by \p getFace()
+   *
+   *  A nullptr return value means the Interest is still pending or has timed out.
+   *  A non-null return value means the last outgoing Interest has been NACKed.
+   */
+  const lp::NackHeader*
+  getIncomingNack() const
+  {
+    return m_incomingNack.get();
+  }
+
+  /** \brief sets a NACK received from \p getFace()
+   *  \return whether incoming NACK is accepted
+   *
+   *  This is invoked in incoming NACK pipeline.
+   *  An incoming NACK is accepted if its Nonce matches \p getLastNonce().
+   *  If accepted, \p nack.getHeader() will be copied,
+   *  and any pointer previously returned by \p .getIncomingNack() .
+   */
+  bool
+  setIncomingNack(const lp::Nack& nack);
+
+  /** \brief clears last NACK
+   *
+   *  This is invoked in outgoing Interest pipeline.
+   *  This invalidates any pointer previously returned by \p .getIncomingNack() .
+   */
+  void
+  clearIncomingNack()
+  {
+    m_incomingNack.reset();
+  }
+
+private:
+  unique_ptr<lp::NackHeader> m_incomingNack;
 };
 
 } // namespace pit
diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp
index c21ccdf..959593f 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.cpp
@@ -62,7 +62,7 @@
 }
 
 std::pair<shared_ptr<pit::Entry>, bool>
-Pit::insert(const Interest& interest)
+Pit::findOrInsert(const Interest& interest, bool allowInsert)
 {
   // first lookup() the Interest Name in the NameTree, which will creates all
   // the intermedia nodes, starting from the shortest prefix.
@@ -78,13 +78,17 @@
                                   entry->getInterest().getSelectors() == interest.getSelectors();
                          });
   if (it != pitEntries.end()) {
-    return { *it, false };
+    return {*it, false};
+  }
+
+  if (!allowInsert) {
+    return {nullptr, true};
   }
 
   shared_ptr<pit::Entry> entry = make_shared<pit::Entry>(interest);
   nameTreeEntry->insertPitEntry(entry);
   m_nItems++;
-  return { entry, true };
+  return {entry, true};
 }
 
 pit::DataMatchResult
diff --git a/daemon/table/pit.hpp b/daemon/table/pit.hpp
index e9616d5..adab085 100644
--- a/daemon/table/pit.hpp
+++ b/daemon/table/pit.hpp
@@ -58,10 +58,17 @@
   size_t
   size() const;
 
+  /** \brief finds a PIT entry for Interest
+   *  \param interest the Interest
+   *  \return an existing entry with same Name and Selectors; otherwise nullptr
+   */
+  shared_ptr<pit::Entry>
+  find(const Interest& interest) const;
+
   /** \brief inserts a PIT entry for Interest
-   *
-   *  If an entry for exact same name and selectors exists, that entry is returned.
-   *  \return the entry, and true for new entry, false for existing entry
+   *  \param interest the Interest; must be created with make_shared
+   *  \return a new or existing entry with same Name and Selectors,
+   *          and true for new entry, false for existing entry
    */
   std::pair<shared_ptr<pit::Entry>, bool>
   insert(const Interest& interest);
@@ -135,6 +142,18 @@
   };
 
 private:
+  /** \brief finds or inserts a PIT entry for Interest
+   *  \param interest the Interest; must be created with make_shared if allowInsert
+   *  \param allowInsert whether inserting new entry is allowed.
+   *  \return if allowInsert, a new or existing entry with same Name+Selectors,
+   *          and true for new entry, false for existing entry;
+   *          if not allowInsert, an existing entry with same Name+Selectors and false,
+   *          or {nullptr, true} if there's no existing entry
+   */
+  std::pair<shared_ptr<pit::Entry>, bool>
+  findOrInsert(const Interest& interest, bool allowInsert);
+
+private:
   NameTree& m_nameTree;
   size_t m_nItems;
 };
@@ -145,6 +164,18 @@
   return m_nItems;
 }
 
+inline shared_ptr<pit::Entry>
+Pit::find(const Interest& interest) const
+{
+  return const_cast<Pit*>(this)->findOrInsert(interest, false).first;
+}
+
+inline std::pair<shared_ptr<pit::Entry>, bool>
+Pit::insert(const Interest& interest)
+{
+  return this->findOrInsert(interest, true);
+}
+
 inline Pit::const_iterator
 Pit::end() const
 {
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..aa2c7a7
--- /dev/null
+++ b/tests/daemon/face/generic-link-service.t.cpp
@@ -0,0 +1,493 @@
+/* -*- 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(GenericLinkService::Options());
+    // By default, GenericLinkService is created with default options.
+    // Test cases may invoke .initialize with alternate options.
+  }
+
+  void
+  initialize(const GenericLinkService::Options& options)
+  {
+    face.reset(new LpFace(make_unique<GenericLinkService>(options),
+                          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)
+{
+  // Initialize with Options that disables all services
+  GenericLinkService::Options options;
+  options.allowLocalFields = false;
+  initialize(options);
+
+  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)
+{
+  // Initialize with Options that disables all services
+  GenericLinkService::Options options;
+  options.allowLocalFields = false;
+  initialize(options);
+
+  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)
+{
+  // Initialize with Options that disables all services
+  GenericLinkService::Options options;
+  options.allowLocalFields = false;
+  initialize(options);
+
+  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)
+{
+  // Initialize with Options that disables all services
+  GenericLinkService::Options options;
+  options.allowLocalFields = false;
+  initialize(options);
+
+  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)
+{
+  // Initialize with Options that disables all services
+  GenericLinkService::Options options;
+  options.allowLocalFields = false;
+  initialize(options);
+
+  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)
+{
+  // Initialize with Options that disables all services
+  GenericLinkService::Options options;
+  options.allowLocalFields = false;
+  initialize(options);
+
+  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)
+{
+  // Initialize with Options that disables all services
+  GenericLinkService::Options options;
+  options.allowLocalFields = false;
+  initialize(options);
+
+  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)
+{
+  // Initialize with Options that disables all services
+  GenericLinkService::Options options;
+  options.allowLocalFields = false;
+  initialize(options);
+
+  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(Fragmentation)
+
+BOOST_AUTO_TEST_CASE(ReassemblyDisabledDropFragIndex)
+{
+  // TODO#3171 Initialize with Options that disables reassembly
+
+  shared_ptr<Interest> interest = makeInterest("/IgFe6NvH");
+  lp::Packet packet(interest->wireEncode());
+  packet.set<lp::FragIndexField>(140);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_CHECK(receivedInterests.empty());
+}
+
+BOOST_AUTO_TEST_CASE(ReassemblyDisabledDropFragCount)
+{
+  // TODO#3171 Initialize with Options that disables reassembly
+
+  shared_ptr<Interest> interest = makeInterest("/SeGmEjvIVX");
+  lp::Packet packet(interest->wireEncode());
+  packet.set<lp::FragCountField>(276);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_CHECK(receivedInterests.empty());
+}
+
+BOOST_AUTO_TEST_SUITE_END() // Fragmentation
+
+
+BOOST_AUTO_TEST_SUITE(LocalFields)
+
+BOOST_AUTO_TEST_CASE(ReceiveNextHopFaceId)
+{
+  // Initialize with Options that enables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = true;
+  initialize(options);
+
+  shared_ptr<Interest> interest = makeInterest("/12345678");
+  lp::Packet packet(interest->wireEncode());
+  packet.set<lp::NextHopFaceIdField>(1000);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
+  BOOST_REQUIRE(receivedInterests.back().getLocalControlHeader().hasNextHopFaceId());
+  BOOST_CHECK_EQUAL(receivedInterests.back().getNextHopFaceId(), 1000);
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNextHopFaceIdDisabled)
+{
+  // Initialize with Options that disables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = false;
+  initialize(options);
+
+  shared_ptr<Interest> interest = makeInterest("/12345678");
+  lp::Packet packet(interest->wireEncode());
+  packet.set<lp::NextHopFaceIdField>(1000);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_CHECK(receivedInterests.empty());
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNextHopFaceIdDropData)
+{
+  // Initialize with Options that enables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = true;
+  initialize(options);
+
+  shared_ptr<Data> data = makeData("/12345678");
+  lp::Packet packet(data->wireEncode());
+  packet.set<lp::NextHopFaceIdField>(1000);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_CHECK(receivedData.empty());
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveNextHopFaceIdDropNack)
+{
+  // Initialize with Options that enables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = true;
+  initialize(options);
+
+  lp::Nack nack = makeNack("/localhost/test", 123, lp::NackReason::NO_ROUTE);
+  lp::Packet packet;
+  packet.set<lp::FragmentField>(std::make_pair(
+    nack.getInterest().wireEncode().begin(), nack.getInterest().wireEncode().end()));
+  packet.set<lp::NackField>(nack.getHeader());
+  packet.set<lp::NextHopFaceIdField>(1000);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_CHECK(receivedNacks.empty());
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveCacheControl)
+{
+  // Initialize with Options that enables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = true;
+  initialize(options);
+
+  shared_ptr<Data> data = makeData("/12345678");
+  lp::Packet packet(data->wireEncode());
+  lp::CachePolicy policy;
+  policy.setPolicy(lp::CachePolicyType::NO_CACHE);
+  packet.set<lp::CachePolicyField>(policy);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
+  BOOST_REQUIRE(receivedData.back().getLocalControlHeader().hasCachingPolicy());
+  BOOST_CHECK_EQUAL(receivedData.back().getCachingPolicy(),
+                    ndn::nfd::LocalControlHeader::CachingPolicy::NO_CACHE);
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveCacheControlDisabled)
+{
+  // Initialize with Options that disables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = false;
+  initialize(options);
+
+  shared_ptr<Data> data = makeData("/12345678");
+  lp::Packet packet(data->wireEncode());
+  lp::CachePolicy policy;
+  policy.setPolicy(lp::CachePolicyType::NO_CACHE);
+  packet.set<lp::CachePolicyField>(policy);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
+  BOOST_CHECK(!receivedData.back().getLocalControlHeader().hasCachingPolicy());
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveCacheControlDropInterest)
+{
+  // Initialize with Options that enables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = true;
+  initialize(options);
+
+  shared_ptr<Interest> interest = makeInterest("/12345678");
+  lp::Packet packet(interest->wireEncode());
+  lp::CachePolicy policy;
+  policy.setPolicy(lp::CachePolicyType::NO_CACHE);
+  packet.set<lp::CachePolicyField>(policy);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_CHECK(receivedInterests.empty());
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveCacheControlDropNack)
+{
+  // Initialize with Options that enables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = true;
+  initialize(options);
+
+  lp::Nack nack = makeNack("/localhost/test", 123, lp::NackReason::NO_ROUTE);
+  lp::Packet packet(nack.getInterest().wireEncode());
+  packet.set<lp::NackField>(nack.getHeader());
+  lp::CachePolicy policy;
+  policy.setPolicy(lp::CachePolicyType::NO_CACHE);
+  packet.set<lp::CachePolicyField>(policy);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_CHECK(receivedNacks.empty());
+}
+
+BOOST_AUTO_TEST_CASE(SendIncomingFaceId)
+{
+  // Initialize with Options that enables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = true;
+  initialize(options);
+
+  shared_ptr<Interest> interest = makeInterest("/12345678");
+  interest->setIncomingFaceId(1000);
+
+  face->sendInterest(*interest);
+
+  BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1);
+  lp::Packet sent(transport->sentPackets.back().packet);
+  BOOST_REQUIRE(sent.has<lp::IncomingFaceIdField>());
+  BOOST_CHECK_EQUAL(sent.get<lp::IncomingFaceIdField>(), 1000);
+}
+
+BOOST_AUTO_TEST_CASE(SendIncomingFaceIdDisabled)
+{
+  // Initialize with Options that disables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = false;
+  initialize(options);
+
+  shared_ptr<Interest> interest = makeInterest("/12345678");
+  interest->setIncomingFaceId(1000);
+
+  face->sendInterest(*interest);
+
+  BOOST_REQUIRE_EQUAL(transport->sentPackets.size(), 1);
+  lp::Packet sent(transport->sentPackets.back().packet);
+  BOOST_CHECK(!sent.has<lp::IncomingFaceIdField>());
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveIncomingFaceIdIgnoreInterest)
+{
+  // Initialize with Options that enables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = true;
+  initialize(options);
+
+  shared_ptr<Interest> interest = makeInterest("/12345678");
+  lp::Packet packet(interest->wireEncode());
+  packet.set<lp::IncomingFaceIdField>(1000);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
+  BOOST_CHECK(!receivedInterests.back().getLocalControlHeader().hasIncomingFaceId());
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveIncomingFaceIdIgnoreData)
+{
+  // Initialize with Options that enables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = true;
+  initialize(options);
+
+  shared_ptr<Data> data = makeData("/z1megUh9Bj");
+  lp::Packet packet(data->wireEncode());
+  packet.set<lp::IncomingFaceIdField>(1000);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
+  BOOST_CHECK(!receivedData.back().getLocalControlHeader().hasIncomingFaceId());
+}
+
+BOOST_AUTO_TEST_CASE(ReceiveIncomingFaceIdIgnoreNack)
+{
+  // Initialize with Options that enables local fields
+  GenericLinkService::Options options;
+  options.allowLocalFields = true;
+  initialize(options);
+
+  lp::Nack nack = makeNack("/TPAhdiHz", 278, lp::NackReason::CONGESTION);
+  lp::Packet packet(nack.getInterest().wireEncode());
+  packet.set<lp::NackField>(nack.getHeader());
+  packet.set<lp::IncomingFaceIdField>(1000);
+
+  transport->receivePacket(packet.wireEncode());
+
+  BOOST_REQUIRE_EQUAL(receivedNacks.size(), 1);
+  BOOST_CHECK(!receivedNacks.back().getLocalControlHeader().hasIncomingFaceId());
+}
+
+BOOST_AUTO_TEST_SUITE_END() // LocalFields
+
+
+BOOST_AUTO_TEST_SUITE_END() // TestGenericLinkService
+BOOST_AUTO_TEST_SUITE_END() // Face
+
+} // 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/daemon/face/udp.t.cpp b/tests/daemon/face/udp.t.cpp
index c00f54f..6869176 100644
--- a/tests/daemon/face/udp.t.cpp
+++ b/tests/daemon/face/udp.t.cpp
@@ -24,7 +24,6 @@
  */
 
 #include "face/udp-channel.hpp"
-#include "face/udp-face.hpp"
 #include "face/udp-factory.hpp"
 
 #include "core/network-interface.hpp"
@@ -35,7 +34,10 @@
 namespace nfd {
 namespace tests {
 
-BOOST_FIXTURE_TEST_SUITE(FaceUdp, BaseFixture)
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestUdp, BaseFixture)
+
+using nfd::Face;
 
 BOOST_AUTO_TEST_CASE(GetChannels)
 {
@@ -126,7 +128,7 @@
   auto multicastFace1a = factory.createMulticastFace(interfaceIp, "224.0.0.1", "20072");
   BOOST_CHECK_EQUAL(multicastFace1, multicastFace1a);
   BOOST_CHECK_EQUAL(multicastFace1->isLocal(), false);
-  BOOST_CHECK_EQUAL(multicastFace1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
+  BOOST_CHECK_EQUAL(multicastFace1->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERMANENT);
   BOOST_CHECK_EQUAL(multicastFace1->isMultiAccess(), true);
 
   //same endpoint of a multicast face
@@ -701,7 +703,8 @@
                }));
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestUdp
+BOOST_AUTO_TEST_SUITE_END() // Face
 
 } // namespace tests
 } // namespace nfd
diff --git a/tests/daemon/face/unix-stream.t.cpp b/tests/daemon/face/unix-stream.t.cpp
index c5f5221..0af9db2 100644
--- a/tests/daemon/face/unix-stream.t.cpp
+++ b/tests/daemon/face/unix-stream.t.cpp
@@ -24,8 +24,11 @@
  */
 
 #include "face/unix-stream-channel.hpp"
-#include "face/unix-stream-face.hpp"
 #include "face/unix-stream-factory.hpp"
+#include "face/unix-stream-transport.hpp"
+
+#include "face/generic-link-service.hpp"
+#include "face/lp-face-wrapper.hpp"
 
 #include "tests/test-common.hpp"
 #include "tests/limited-io.hpp"
@@ -38,7 +41,12 @@
 #define CHANNEL_PATH1 "unix-stream-test.1.sock"
 #define CHANNEL_PATH2 "unix-stream-test.2.sock"
 
-BOOST_FIXTURE_TEST_SUITE(FaceUnixStream, BaseFixture)
+BOOST_AUTO_TEST_SUITE(Face)
+BOOST_FIXTURE_TEST_SUITE(TestUnixStream, BaseFixture)
+
+using nfd::Face;
+using face::LpFaceWrapper;
+using face::UnixStreamTransport;
 
 BOOST_AUTO_TEST_CASE(ChannelMap)
 {
@@ -112,7 +120,7 @@
   channel1_onFaceCreated(const shared_ptr<Face>& newFace)
   {
     BOOST_CHECK(!static_cast<bool>(face1));
-    face1 = static_pointer_cast<UnixStreamFace>(newFace);
+    face1 = static_pointer_cast<LpFaceWrapper>(newFace);
     face1->onReceiveInterest.connect(bind(&EndToEndFixture::face1_onReceiveInterest, this, _1));
     face1->onReceiveData.connect(bind(&EndToEndFixture::face1_onReceiveData, this, _1));
 
@@ -162,7 +170,7 @@
   void
   channel_onFaceCreated(const shared_ptr<Face>& newFace)
   {
-    faces.push_back(static_pointer_cast<UnixStreamFace>(newFace));
+    faces.push_back(static_pointer_cast<LpFaceWrapper>(newFace));
 
     limitedIo.afterOp();
   }
@@ -175,25 +183,26 @@
     limitedIo.afterOp();
   }
 
-  shared_ptr<UnixStreamFace>
-  makeFace(UnixStreamFace::protocol::socket socket)
+  shared_ptr<LpFaceWrapper>
+  makeFace(UnixStreamTransport::protocol::socket&& socket)
   {
-    auto remoteUri = FaceUri::fromFd(socket.native_handle());
-    auto localUri = FaceUri(socket.local_endpoint());
-    return make_shared<UnixStreamFace>(remoteUri, localUri, std::move(socket));
+    auto linkService = make_unique<face::GenericLinkService>();
+    auto transport = make_unique<UnixStreamTransport>(std::move(socket));
+    auto lpFace = make_unique<LpFace>(std::move(linkService), std::move(transport));
+    return make_shared<LpFaceWrapper>(std::move(lpFace));
   }
 
 protected:
   LimitedIo limitedIo;
 
-  shared_ptr<UnixStreamFace> face1;
+  shared_ptr<LpFaceWrapper> face1;
   std::vector<Interest> face1_receivedInterests;
   std::vector<Data> face1_receivedDatas;
-  shared_ptr<UnixStreamFace> face2;
+  shared_ptr<LpFaceWrapper> face2;
   std::vector<Interest> face2_receivedInterests;
   std::vector<Data> face2_receivedDatas;
 
-  std::list<shared_ptr<UnixStreamFace>> faces;
+  std::list<shared_ptr<LpFaceWrapper>> faces;
 };
 
 
@@ -205,8 +214,8 @@
   channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
                    bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
 
-  UnixStreamFace::protocol::socket client(g_io);
-  client.async_connect(UnixStreamFace::protocol::endpoint(CHANNEL_PATH1),
+  UnixStreamTransport::protocol::socket client(g_io);
+  client.async_connect(UnixStreamTransport::protocol::endpoint(CHANNEL_PATH1),
                        bind(&EndToEndFixture::client_onConnect, this, _1));
 
   BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS, "Connect");
@@ -280,16 +289,16 @@
   channel->listen(bind(&EndToEndFixture::channel_onFaceCreated,   this, _1),
                   bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
 
-  UnixStreamFace::protocol::socket client1(g_io);
-  client1.async_connect(UnixStreamFace::protocol::endpoint(CHANNEL_PATH1),
+  UnixStreamTransport::protocol::socket client1(g_io);
+  client1.async_connect(UnixStreamTransport::protocol::endpoint(CHANNEL_PATH1),
                         bind(&EndToEndFixture::client_onConnect, this, _1));
 
   BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS, "First connect");
 
   BOOST_CHECK_EQUAL(faces.size(), 1);
 
-  UnixStreamFace::protocol::socket client2(g_io);
-  client2.async_connect(UnixStreamFace::protocol::endpoint(CHANNEL_PATH1),
+  UnixStreamTransport::protocol::socket client2(g_io);
+  client2.async_connect(UnixStreamTransport::protocol::endpoint(CHANNEL_PATH1),
                         bind(&EndToEndFixture::client_onConnect, this, _1));
 
   BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS, "Second connect");
@@ -331,188 +340,189 @@
   BOOST_CHECK_EQUAL(face2_receivedDatas    [0].getName(), data1->getName());
 }
 
-BOOST_FIXTURE_TEST_CASE(UnixStreamFaceLocalControlHeader, EndToEndFixture)
-{
-  UnixStreamFactory factory;
+//BOOST_FIXTURE_TEST_CASE(UnixStreamTransportLocalControlHeader, EndToEndFixture)
+//{
+//  UnixStreamFactory factory;
+//
+//  shared_ptr<UnixStreamChannel> channel1 = factory.createChannel(CHANNEL_PATH1);
+//  channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
+//                   bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
+//
+//  UnixStreamTransport::protocol::socket client(g_io);
+//  client.async_connect(UnixStreamTransport::protocol::endpoint(CHANNEL_PATH1),
+//                       bind(&EndToEndFixture::client_onConnect, this, _1));
+//
+//  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS, "Connect");
+//
+//  BOOST_REQUIRE(static_cast<bool>(face1));
+//
+//  face2 = makeFace(std::move(client));
+//  face2->onReceiveInterest.connect(bind(&EndToEndFixture::face2_onReceiveInterest, this, _1));
+//  face2->onReceiveData.connect(bind(&EndToEndFixture::face2_onReceiveData, this, _1));
+//
+//  shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
+//  shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
 
-  shared_ptr<UnixStreamChannel> channel1 = factory.createChannel(CHANNEL_PATH1);
-  channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated,   this, _1),
-                   bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
+//  face1->setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID);
+//  face1->setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID);
+//
+//  BOOST_CHECK(face1->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
+//  BOOST_CHECK(face1->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
 
-  UnixStreamFace::protocol::socket client(g_io);
-  client.async_connect(UnixStreamFace::protocol::endpoint(CHANNEL_PATH1),
-                       bind(&EndToEndFixture::client_onConnect, this, _1));
+//  face2->setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID);
+//  face2->setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID);
 
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS, "Connect");
-
-  BOOST_REQUIRE(static_cast<bool>(face1));
-
-  face2 = makeFace(std::move(client));
-  face2->onReceiveInterest.connect(bind(&EndToEndFixture::face2_onReceiveInterest, this, _1));
-  face2->onReceiveData.connect(bind(&EndToEndFixture::face2_onReceiveData, this, _1));
-
-  shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R");
-  shared_ptr<Data>     data1     = makeData("ndn:/KfczhUqVix");
-
-  face1->setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID);
-  face1->setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID);
-
-  BOOST_CHECK(face1->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
-  BOOST_CHECK(face1->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
-
-  face2->setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID);
-  face2->setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID);
-
-  BOOST_CHECK(face2->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
-  BOOST_CHECK(face2->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
+//  BOOST_CHECK(face2->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
+//  BOOST_CHECK(face2->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
 
   ////////////////////////////////////////////////////////
 
-  interest1->setIncomingFaceId(11);
-  interest1->setNextHopFaceId(111);
-  face1->sendInterest(*interest1);
+//  interest1->setIncomingFaceId(11);
+//  interest1->setNextHopFaceId(111);
+//  face1->sendInterest(*interest1);
 
-  data1->setIncomingFaceId(22);
-  data1->getLocalControlHeader().setNextHopFaceId(222);
-  face1->sendData(*data1);
+//  data1->setIncomingFaceId(22);
+//  data1->getLocalControlHeader().setNextHopFaceId(222);
+//  face1->sendData(*data1);
 
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
-                      "Regular send/receive");
+//  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+//                      "Regular send/receive");
 
-  BOOST_REQUIRE_EQUAL(face2_receivedInterests.size(), 1);
-  BOOST_REQUIRE_EQUAL(face2_receivedDatas    .size(), 1);
+//  BOOST_REQUIRE_EQUAL(face2_receivedInterests.size(), 1);
+//  BOOST_REQUIRE_EQUAL(face2_receivedDatas    .size(), 1);
 
-  // sending allows only IncomingFaceId, receiving allows only NextHopFaceId
-  BOOST_CHECK_EQUAL(face2_receivedInterests[0].getLocalControlHeader().hasIncomingFaceId(), false);
-  BOOST_CHECK_EQUAL(face2_receivedInterests[0].getLocalControlHeader().hasNextHopFaceId(), false);
+//  sending allows only IncomingFaceId, receiving allows only NextHopFaceId
+//  BOOST_CHECK_EQUAL(face2_receivedInterests[0].getLocalControlHeader().hasIncomingFaceId(), false);
+//  BOOST_CHECK_EQUAL(face2_receivedInterests[0].getLocalControlHeader().hasNextHopFaceId(), false);
 
-  BOOST_CHECK_EQUAL(face2_receivedDatas[0].getLocalControlHeader().hasIncomingFaceId(), false);
-  BOOST_CHECK_EQUAL(face2_receivedDatas[0].getLocalControlHeader().hasNextHopFaceId(), false);
+//  BOOST_CHECK_EQUAL(face2_receivedDatas[0].getLocalControlHeader().hasIncomingFaceId(), false);
+//  BOOST_CHECK_EQUAL(face2_receivedDatas[0].getLocalControlHeader().hasNextHopFaceId(), false);
 
-  face1->close();
-  face1.reset();
+//  face1->close();
+//  face1.reset();
 
   ////////////////////////////////////////////////////////
 
-  client.async_connect(UnixStreamFace::protocol::endpoint(CHANNEL_PATH1),
-                       bind(&EndToEndFixture::client_onConnect, this, _1));
+//  client.async_connect(UnixStreamTransport::protocol::endpoint(CHANNEL_PATH1),
+//                       bind(&EndToEndFixture::client_onConnect, this, _1));
 
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS, "Connect");
+//  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS, "Connect");
 
-  BOOST_REQUIRE(static_cast<bool>(face1));
-  face1->setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID);
-  face1->setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID);
+//  BOOST_REQUIRE(static_cast<bool>(face1));
+//  face1->setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID);
+//  face1->setLocalControlHeaderFeature(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID);
 
-  Block iHeader = interest1->getLocalControlHeader()
-                  .wireEncode(*interest1, ndn::nfd::LocalControlHeader::ENCODE_INCOMING_FACE_ID |
-                                          ndn::nfd::LocalControlHeader::ENCODE_NEXT_HOP);
-  Block iPayload = interest1->wireEncode();
+//  Block iHeader = interest1->getLocalControlHeader()
+//                  .wireEncode(*interest1, ndn::nfd::LocalControlHeader::ENCODE_INCOMING_FACE_ID |
+//                                          ndn::nfd::LocalControlHeader::ENCODE_NEXT_HOP);
+//  Block iPayload = interest1->wireEncode();
 
-  Block dHeader = data1->getLocalControlHeader()
-                  .wireEncode(*data1, ndn::nfd::LocalControlHeader::ENCODE_INCOMING_FACE_ID |
-                                      ndn::nfd::LocalControlHeader::ENCODE_NEXT_HOP);
-  Block dPayload = data1->wireEncode();
+//  Block dHeader = data1->getLocalControlHeader()
+//                  .wireEncode(*data1, ndn::nfd::LocalControlHeader::ENCODE_INCOMING_FACE_ID |
+//                                      ndn::nfd::LocalControlHeader::ENCODE_NEXT_HOP);
+//  Block dPayload = data1->wireEncode();
 
-  client.async_send(std::vector<boost::asio::const_buffer>{iHeader, iPayload},
-                    [] (const boost::system::error_code& error, size_t nBytesSent) {
-                      BOOST_CHECK_MESSAGE(!error, error.message());
-                    });
-  client.async_send(std::vector<boost::asio::const_buffer>{dHeader, dPayload},
-                    [] (const boost::system::error_code& error, size_t nBytesSent) {
-                      BOOST_CHECK_MESSAGE(!error, error.message());
-                    });
+//  client.async_send(std::vector<boost::asio::const_buffer>{iHeader, iPayload},
+//                    [] (const boost::system::error_code& error, size_t nBytesSent) {
+//                      BOOST_CHECK_MESSAGE(!error, error.message());
+//                    });
+//  client.async_send(std::vector<boost::asio::const_buffer>{dHeader, dPayload},
+//                    [] (const boost::system::error_code& error, size_t nBytesSent) {
+//                      BOOST_CHECK_MESSAGE(!error, error.message());
+//                    });
 
-  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
-                      "Send/receive with LocalControlHeader");
+//  BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
+//                      "Send/receive with LocalControlHeader");
 
-  BOOST_REQUIRE_EQUAL(face1_receivedInterests.size(), 1);
-  BOOST_REQUIRE_EQUAL(face1_receivedDatas    .size(), 1);
+//  BOOST_REQUIRE_EQUAL(face1_receivedInterests.size(), 1);
+//  BOOST_REQUIRE_EQUAL(face1_receivedDatas    .size(), 1);
 
-  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getLocalControlHeader().hasIncomingFaceId(), false);
-  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getLocalControlHeader().hasNextHopFaceId(), true);
-  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getNextHopFaceId(), 111);
+//  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getLocalControlHeader().hasIncomingFaceId(), false);
+//  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getLocalControlHeader().hasNextHopFaceId(), true);
+//  BOOST_CHECK_EQUAL(face1_receivedInterests[0].getNextHopFaceId(), 111);
 
-  BOOST_CHECK_EQUAL(face1_receivedDatas[0].getLocalControlHeader().hasIncomingFaceId(), false);
-  BOOST_CHECK_EQUAL(face1_receivedDatas[0].getLocalControlHeader().hasNextHopFaceId(), false);
-}
+//  BOOST_CHECK_EQUAL(face1_receivedDatas[0].getLocalControlHeader().hasIncomingFaceId(), false);
+//  BOOST_CHECK_EQUAL(face1_receivedDatas[0].getLocalControlHeader().hasNextHopFaceId(), false);
+//}
 
 
-class SimpleEndToEndFixture : protected BaseFixture
-{
-public:
-  void
-  onFaceCreated(const shared_ptr<Face>& face)
-  {
-    face->onReceiveInterest.connect(bind(&SimpleEndToEndFixture::onReceiveInterest, this, _1));
-    face->onReceiveData.connect(bind(&SimpleEndToEndFixture::onReceiveData, this, _1));
-    face->onFail.connect(bind(&SimpleEndToEndFixture::onFail, this, face));
+//class SimpleEndToEndFixture : protected BaseFixture
+//{
+//public:
+//  void
+//  onFaceCreated(const shared_ptr<Face>& face)
+//  {
+//    face->onReceiveInterest.connect(bind(&SimpleEndToEndFixture::onReceiveInterest, this, _1));
+//    face->onReceiveData.connect(bind(&SimpleEndToEndFixture::onReceiveData, this, _1));
+//    face->onFail.connect(bind(&SimpleEndToEndFixture::onFail, this, face));
 
-    if (static_cast<bool>(dynamic_pointer_cast<LocalFace>(face))) {
-      static_pointer_cast<LocalFace>(face)->setLocalControlHeaderFeature(
-        LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID);
+//    if (static_cast<bool>(dynamic_pointer_cast<LocalFace>(face))) {
+//    static_pointer_cast<LocalFace>(face)->setLocalControlHeaderFeature(
+//     LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID);
 
-      static_pointer_cast<LocalFace>(face)->setLocalControlHeaderFeature(
-        LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID);
-    }
+//    static_pointer_cast<LocalFace>(face)->setLocalControlHeaderFeature(
+//      LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID);
+//  }
 
-    limitedIo.afterOp();
-  }
+//    limitedIo.afterOp();
+//  }
 
-  void
-  onConnectFailed(const std::string& reason)
-  {
-    BOOST_CHECK_MESSAGE(false, reason);
+//  void
+//  onConnectFailed(const std::string& reason)
+//  {
+//    BOOST_CHECK_MESSAGE(false, reason);
 
-    limitedIo.afterOp();
-  }
+//    limitedIo.afterOp();
+//  }
 
-  void
-  onReceiveInterest(const Interest& interest)
-  {
-    receivedInterests.push_back(interest);
+//  void
+//  onReceiveInterest(const Interest& interest)
+//  {
+//    receivedInterests.push_back(interest);
 
-    limitedIo.afterOp();
-  }
+//    limitedIo.afterOp();
+//  }
 
-  void
-  onReceiveData(const Data& data)
-  {
-    receivedDatas.push_back(data);
+//  void
+//  onReceiveData(const Data& data)
+//  {
+//    receivedDatas.push_back(data);
 
-    limitedIo.afterOp();
-  }
+//    limitedIo.afterOp();
+//  }
 
-  void
-  onFail(const shared_ptr<Face>& face)
-  {
-    limitedIo.afterOp();
-  }
+//  void
+//  onFail(const shared_ptr<Face>& face)
+//  {
+//    limitedIo.afterOp();
+//  }
 
-public:
-  LimitedIo limitedIo;
+//public:
+//  LimitedIo limitedIo;
 
-  std::vector<Interest> receivedInterests;
-  std::vector<Data> receivedDatas;
-};
+//  std::vector<Interest> receivedInterests;
+//  std::vector<Data> receivedDatas;
+//};
 
 
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(CorruptedInput, Dataset,
-                                 CorruptedPackets, SimpleEndToEndFixture)
-{
-  UnixStreamFactory factory;
+//BOOST_FIXTURE_TEST_CASE_TEMPLATE(CorruptedInput, Dataset,
+//                                 CorruptedPackets, SimpleEndToEndFixture)
+//{
+//  UnixStreamFactory factory;
 
-  shared_ptr<UnixStreamChannel> channel = factory.createChannel(CHANNEL_PATH1);
-  channel->listen(bind(&SimpleEndToEndFixture::onFaceCreated,   this, _1),
-                  bind(&SimpleEndToEndFixture::onConnectFailed, this, _1));
+//  shared_ptr<UnixStreamChannel> channel = factory.createChannel(CHANNEL_PATH1);
+//  channel->listen(bind(&SimpleEndToEndFixture::onFaceCreated,   this, _1),
+//                  bind(&SimpleEndToEndFixture::onConnectFailed, this, _1));
 
-  DummyStreamSender<UnixStreamFace::protocol, Dataset> sender;
-  sender.start(UnixStreamFace::protocol::endpoint(CHANNEL_PATH1));
+//  DummyStreamSender<UnixStreamTransport::protocol, Dataset> sender;
+//  sender.start(UnixStreamTransport::protocol::endpoint(CHANNEL_PATH1));
 
-  BOOST_CHECK_MESSAGE(limitedIo.run(LimitedIo::UNLIMITED_OPS, time::seconds(1)) == LimitedIo::EXCEED_TIME,
-                      "Exception thrown for " + Dataset::getName());
-}
+//  BOOST_CHECK_MESSAGE(limitedIo.run(LimitedIo::UNLIMITED_OPS, time::seconds(1)) == LimitedIo::EXCEED_TIME,
+//                      "Exception thrown for " + Dataset::getName());
+//}
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestUnixStream
+BOOST_AUTO_TEST_SUITE_END() // Face
 
 } // namespace tests
 } // namespace nfd
diff --git a/tests/daemon/fw/access-strategy.t.cpp b/tests/daemon/fw/access-strategy.t.cpp
index ddc0092..fa211a6 100644
--- a/tests/daemon/fw/access-strategy.t.cpp
+++ b/tests/daemon/fw/access-strategy.t.cpp
@@ -47,7 +47,8 @@
 // code style rule 3.25. This is necessary because some lines ends with '\' which
 // would cause "multi-line comment" compiler warning if '//' comments are used.
 
-BOOST_FIXTURE_TEST_SUITE(FwAccessStrategy, UnitTestTimeFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_FIXTURE_TEST_SUITE(TestAccessStrategy, UnitTestTimeFixture)
 
 class TwoLaptopsFixture : public UnitTestTimeFixture
 {
@@ -65,14 +66,14 @@
      *      +---------+             +---------+
      */
 
-    router = topo.addForwarder();
-    laptopA = topo.addForwarder();
-    laptopB = topo.addForwarder();
+    router = topo.addForwarder("R");
+    laptopA = topo.addForwarder("A");
+    laptopB = topo.addForwarder("B");
 
     topo.setStrategy<fw::AccessStrategy>(router);
 
-    linkA = topo.addLink(time::milliseconds(10), {router, laptopA});
-    linkB = topo.addLink(time::milliseconds(20), {router, laptopB});
+    linkA = topo.addLink("RA", time::milliseconds(10), {router, laptopA});
+    linkB = topo.addLink("RB", time::milliseconds(20), {router, laptopB});
   }
 
 protected:
@@ -115,19 +116,19 @@
   topo.registerPrefix(router, linkA->getFace(router), "ndn:/laptops");
   topo.registerPrefix(router, linkB->getFace(router), "ndn:/laptops");
 
-  shared_ptr<TopologyAppLink> producer = topo.addAppFace(laptopA, "ndn:/laptops/A");
-  topo.addEchoProducer(*producer->getClientFace());
+  shared_ptr<TopologyAppLink> producer = topo.addAppFace("p", laptopA, "ndn:/laptops/A");
+  topo.addEchoProducer(producer->getClientFace());
 
-  shared_ptr<TopologyAppLink> consumer = topo.addAppFace(router);
-  topo.addIntervalConsumer(*consumer->getClientFace(), "ndn:/laptops/A",
+  shared_ptr<TopologyAppLink> consumer = topo.addAppFace("c", router);
+  topo.addIntervalConsumer(consumer->getClientFace(), "ndn:/laptops/A",
                            time::milliseconds(100), 100);
 
   this->advanceClocks(time::milliseconds(5), time::seconds(12));
 
   // most Interests should be satisfied, and few Interests can go to wrong laptop
-  BOOST_CHECK_GE(consumer->getForwarderFace()->m_sentDatas.size(), 97);
-  BOOST_CHECK_GE(linkA->getFace(router)->m_sentInterests.size(), 97);
-  BOOST_CHECK_LE(linkB->getFace(router)->m_sentInterests.size(), 5);
+  BOOST_CHECK_GE(consumer->getForwarderFace().getCounters().getNOutDatas(), 97);
+  BOOST_CHECK_GE(linkA->getFace(router).getCounters().getNOutInterests(), 97);
+  BOOST_CHECK_LE(linkB->getFace(router).getCounters().getNOutInterests(), 5);
 }
 
 BOOST_FIXTURE_TEST_CASE(FastSlowProducer, TwoLaptopsFixture)
@@ -160,21 +161,21 @@
   topo.registerPrefix(router, linkA->getFace(router), "ndn:/laptops");
   topo.registerPrefix(router, linkB->getFace(router), "ndn:/laptops");
 
-  shared_ptr<TopologyAppLink> producerA = topo.addAppFace(laptopA, "ndn:/laptops/BOTH");
-  topo.addEchoProducer(*producerA->getClientFace());
-  shared_ptr<TopologyAppLink> producerB = topo.addAppFace(laptopB, "ndn:/laptops/BOTH");
-  topo.addEchoProducer(*producerB->getClientFace());
+  shared_ptr<TopologyAppLink> producerA = topo.addAppFace("pA", laptopA, "ndn:/laptops/BOTH");
+  topo.addEchoProducer(producerA->getClientFace());
+  shared_ptr<TopologyAppLink> producerB = topo.addAppFace("pB", laptopB, "ndn:/laptops/BOTH");
+  topo.addEchoProducer(producerB->getClientFace());
 
-  shared_ptr<TopologyAppLink> consumer = topo.addAppFace(router);
-  topo.addIntervalConsumer(*consumer->getClientFace(), "ndn:/laptops/BOTH",
+  shared_ptr<TopologyAppLink> consumer = topo.addAppFace("c", router);
+  topo.addIntervalConsumer(consumer->getClientFace(), "ndn:/laptops/BOTH",
                            time::milliseconds(100), 100);
 
   this->advanceClocks(time::milliseconds(5), time::seconds(12));
 
   // most Interests should be satisfied, and few Interests can go to slower laptopB
-  BOOST_CHECK_GE(consumer->getForwarderFace()->m_sentDatas.size(), 97);
-  BOOST_CHECK_GE(linkA->getFace(router)->m_sentInterests.size(), 90);
-  BOOST_CHECK_LE(linkB->getFace(router)->m_sentInterests.size(), 15);
+  BOOST_CHECK_GE(consumer->getForwarderFace().getCounters().getNOutDatas(), 97);
+  BOOST_CHECK_GE(linkA->getFace(router).getCounters().getNOutInterests(), 90);
+  BOOST_CHECK_LE(linkB->getFace(router).getCounters().getNOutInterests(), 15);
 }
 
 BOOST_FIXTURE_TEST_CASE(ProducerMobility, TwoLaptopsFixture)
@@ -207,13 +208,13 @@
   topo.registerPrefix(router, linkA->getFace(router), "ndn:/laptops");
   topo.registerPrefix(router, linkB->getFace(router), "ndn:/laptops");
 
-  shared_ptr<TopologyAppLink> producerA = topo.addAppFace(laptopA, "ndn:/laptops/M");
-  topo.addEchoProducer(*producerA->getClientFace());
-  shared_ptr<TopologyAppLink> producerB = topo.addAppFace(laptopB, "ndn:/laptops/M");
-  topo.addEchoProducer(*producerB->getClientFace());
+  shared_ptr<TopologyAppLink> producerA = topo.addAppFace("pA", laptopA, "ndn:/laptops/M");
+  topo.addEchoProducer(producerA->getClientFace());
+  shared_ptr<TopologyAppLink> producerB = topo.addAppFace("pB", laptopB, "ndn:/laptops/M");
+  topo.addEchoProducer(producerB->getClientFace());
 
-  shared_ptr<TopologyAppLink> consumer = topo.addAppFace(router);
-  topo.addIntervalConsumer(*consumer->getClientFace(), "ndn:/laptops/M",
+  shared_ptr<TopologyAppLink> consumer = topo.addAppFace("c", router);
+  topo.addIntervalConsumer(consumer->getClientFace(), "ndn:/laptops/M",
                            time::milliseconds(100), 100);
 
   // producer is initially on laptopA
@@ -221,19 +222,19 @@
   this->advanceClocks(time::milliseconds(5), time::seconds(6));
 
   // few Interests can go to laptopB
-  BOOST_CHECK_LE(linkB->getFace(router)->m_sentInterests.size(), 5);
+  BOOST_CHECK_LE(linkB->getFace(router).getCounters().getNOutInterests(), 5);
 
   // producer moves to laptopB
   producerA->fail();
   producerB->recover();
-  linkA->getFace(router)->m_sentInterests.clear();
+  const_cast<FaceCounters&>(linkA->getFace(router).getCounters()).getNOutInterests().set(0);
   this->advanceClocks(time::milliseconds(5), time::seconds(6));
 
   // few additional Interests can go to laptopA
-  BOOST_CHECK_LE(linkA->getFace(router)->m_sentInterests.size(), 5);
+  BOOST_CHECK_LE(linkA->getFace(router).getCounters().getNOutInterests(), 5);
 
   // most Interests should be satisfied
-  BOOST_CHECK_GE(consumer->getForwarderFace()->m_sentDatas.size(), 97);
+  BOOST_CHECK_GE(consumer->getForwarderFace().getCounters().getNOutDatas(), 97);
 }
 
 BOOST_FIXTURE_TEST_CASE(Bidirectional, TwoLaptopsFixture)
@@ -263,23 +264,23 @@
   topo.registerPrefix(router, linkA->getFace(router), "ndn:/laptops");
   topo.registerPrefix(router, linkB->getFace(router), "ndn:/laptops");
 
-  shared_ptr<TopologyAppLink> producerA = topo.addAppFace(laptopA, "ndn:/laptops/A");
-  topo.addEchoProducer(*producerA->getClientFace());
-  shared_ptr<TopologyAppLink> producerB = topo.addAppFace(laptopB, "ndn:/laptops/B");
-  topo.addEchoProducer(*producerB->getClientFace());
+  shared_ptr<TopologyAppLink> producerA = topo.addAppFace("pA", laptopA, "ndn:/laptops/A");
+  topo.addEchoProducer(producerA->getClientFace());
+  shared_ptr<TopologyAppLink> producerB = topo.addAppFace("pB", laptopB, "ndn:/laptops/B");
+  topo.addEchoProducer(producerB->getClientFace());
 
-  shared_ptr<TopologyAppLink> consumerAB = topo.addAppFace(laptopA);
-  topo.addIntervalConsumer(*consumerAB->getClientFace(), "ndn:/laptops/B",
+  shared_ptr<TopologyAppLink> consumerAB = topo.addAppFace("cAB", laptopA);
+  topo.addIntervalConsumer(consumerAB->getClientFace(), "ndn:/laptops/B",
                            time::milliseconds(100), 100);
-  shared_ptr<TopologyAppLink> consumerBA = topo.addAppFace(laptopB);
-  topo.addIntervalConsumer(*consumerBA->getClientFace(), "ndn:/laptops/A",
+  shared_ptr<TopologyAppLink> consumerBA = topo.addAppFace("cBA", laptopB);
+  topo.addIntervalConsumer(consumerBA->getClientFace(), "ndn:/laptops/A",
                            time::milliseconds(100), 100);
 
   this->advanceClocks(time::milliseconds(5), time::seconds(12));
 
   // most Interests should be satisfied
-  BOOST_CHECK_GE(consumerAB->getForwarderFace()->m_sentDatas.size(), 97);
-  BOOST_CHECK_GE(consumerBA->getForwarderFace()->m_sentDatas.size(), 97);
+  BOOST_CHECK_GE(consumerAB->getForwarderFace().getCounters().getNOutDatas(), 97);
+  BOOST_CHECK_GE(consumerBA->getForwarderFace().getCounters().getNOutDatas(), 97);
 }
 
 BOOST_FIXTURE_TEST_CASE(PacketLoss, TwoLaptopsFixture)
@@ -308,25 +309,25 @@
   // laptopA has prefix in router FIB; laptopB is unused in this test case
   topo.registerPrefix(router, linkA->getFace(router), "ndn:/laptops");
 
-  shared_ptr<TopologyAppLink> producerA = topo.addAppFace(laptopA, "ndn:/laptops/A");
-  topo.addEchoProducer(*producerA->getClientFace());
+  shared_ptr<TopologyAppLink> producerA = topo.addAppFace("pA", laptopA, "ndn:/laptops/A");
+  topo.addEchoProducer(producerA->getClientFace());
 
-  shared_ptr<TopologyAppLink> consumer = topo.addAppFace(router);
+  shared_ptr<TopologyAppLink> consumer = topo.addAppFace("c", router);
 
   // Interest 1 completes normally
   shared_ptr<Interest> interest1 = makeInterest("ndn:/laptops/A/1");
   bool hasData1 = false;
-  consumer->getClientFace()->expressInterest(*interest1,
-                                             bind([&hasData1] { hasData1 = true; }));
+  consumer->getClientFace().expressInterest(*interest1,
+                                            bind([&hasData1] { hasData1 = true; }));
   this->advanceClocks(time::milliseconds(5), time::seconds(1));
   BOOST_CHECK_EQUAL(hasData1, true);
 
   // Interest 2 experiences a packet loss on initial transmission
   shared_ptr<Interest> interest2a = makeInterest("ndn:/laptops/A/2");
   bool hasData2a = false, hasTimeout2a = false;
-  consumer->getClientFace()->expressInterest(*interest2a,
-                                             bind([&hasData2a] { hasData2a = true; }),
-                                             bind([&hasTimeout2a] { hasTimeout2a = true; }));
+  consumer->getClientFace().expressInterest(*interest2a,
+                                            bind([&hasData2a] { hasData2a = true; }),
+                                            bind([&hasTimeout2a] { hasTimeout2a = true; }));
   producerA->fail();
   this->advanceClocks(time::milliseconds(5), time::milliseconds(60));
   BOOST_CHECK_EQUAL(hasData2a, false);
@@ -335,8 +336,8 @@
   // Interest 2 retransmission is suppressed
   shared_ptr<Interest> interest2b = makeInterest("ndn:/laptops/A/2");
   bool hasData2b = false;
-  consumer->getClientFace()->expressInterest(*interest2b,
-                                             bind([&hasData2b] { hasData2b = true; }));
+  consumer->getClientFace().expressInterest(*interest2b,
+                                            bind([&hasData2b] { hasData2b = true; }));
   producerA->recover();
   this->advanceClocks(time::milliseconds(5), time::seconds(1));
   BOOST_CHECK_EQUAL(hasData2b, false);
@@ -344,8 +345,8 @@
   // Interest 2 retransmission gets through, and is answered
   shared_ptr<Interest> interest2c = makeInterest("ndn:/laptops/A/2");
   bool hasData2c = false;
-  consumer->getClientFace()->expressInterest(*interest2c,
-                                             bind([&hasData2c] { hasData2c = true; }));
+  consumer->getClientFace().expressInterest(*interest2c,
+                                            bind([&hasData2c] { hasData2c = true; }));
   this->advanceClocks(time::milliseconds(5), time::seconds(1));
   BOOST_CHECK_EQUAL(hasData2c, true);
 }
@@ -357,17 +358,18 @@
   topo.registerPrefix(router, linkA->getFace(router), "ndn:/net");
 
   // send Interests from laptopA to router
-  shared_ptr<TopologyAppLink> consumer = topo.addAppFace(laptopA);
-  topo.addIntervalConsumer(*consumer->getClientFace(), "ndn:/net",
+  shared_ptr<TopologyAppLink> consumer = topo.addAppFace("c", laptopA);
+  topo.addIntervalConsumer(consumer->getClientFace(), "ndn:/net",
                            time::milliseconds(100), 10);
 
   this->advanceClocks(time::milliseconds(5), time::seconds(2));
 
   // Interest shouldn't loop back from router
-  BOOST_CHECK_EQUAL(linkA->getFace(router)->m_sentInterests.size(), 0);
+  BOOST_CHECK_EQUAL(linkA->getFace(router).getCounters().getNOutInterests(), 0);
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestAccessStrategy
+BOOST_AUTO_TEST_SUITE_END() // Fw
 
 } // namespace tests
 } // namespace fw
diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp
index 8a2c3db..4ee43e9 100644
--- a/tests/daemon/fw/best-route-strategy2.t.cpp
+++ b/tests/daemon/fw/best-route-strategy2.t.cpp
@@ -24,10 +24,11 @@
  */
 
 #include "fw/best-route-strategy2.hpp"
-#include "strategy-tester.hpp"
 
 #include "tests/test-common.hpp"
 #include "tests/daemon/face/dummy-face.hpp"
+#include "strategy-tester.hpp"
+#include "topology-tester.hpp"
 
 namespace nfd {
 namespace fw {
@@ -35,33 +36,51 @@
 
 using namespace nfd::tests;
 
-BOOST_FIXTURE_TEST_SUITE(FwBestRouteStrategy2, UnitTestTimeFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+
+class BestRouteStrategy2Fixture : public UnitTestTimeFixture
+{
+protected:
+  BestRouteStrategy2Fixture()
+    : strategy(forwarder)
+    , fib(forwarder.getFib())
+    , pit(forwarder.getPit())
+    , face1(make_shared<DummyFace>())
+    , face2(make_shared<DummyFace>())
+    , face3(make_shared<DummyFace>())
+    , face4(make_shared<DummyFace>())
+    , face5(make_shared<DummyFace>())
+  {
+    forwarder.addFace(face1);
+    forwarder.addFace(face2);
+    forwarder.addFace(face3);
+    forwarder.addFace(face4);
+    forwarder.addFace(face5);
+  }
+
+public:
+  Forwarder forwarder;
+  StrategyTester<fw::BestRouteStrategy2> strategy;
+  Fib& fib;
+  Pit& pit;
+
+  shared_ptr<DummyFace> face1;
+  shared_ptr<DummyFace> face2;
+  shared_ptr<DummyFace> face3;
+  shared_ptr<DummyFace> face4;
+  shared_ptr<DummyFace> face5;
+};
+
+BOOST_FIXTURE_TEST_SUITE(TestBestRouteStrategy2, BestRouteStrategy2Fixture)
 
 BOOST_AUTO_TEST_CASE(Forward)
 {
-  Forwarder forwarder;
-  typedef StrategyTester<fw::BestRouteStrategy2> BestRouteStrategy2Tester;
-  BestRouteStrategy2Tester strategy(forwarder);
-
-  shared_ptr<DummyFace> face1 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face2 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face3 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face4 = make_shared<DummyFace>();
-  shared_ptr<DummyFace> face5 = make_shared<DummyFace>();
-  forwarder.addFace(face1);
-  forwarder.addFace(face2);
-  forwarder.addFace(face3);
-  forwarder.addFace(face4);
-  forwarder.addFace(face5);
-
-  Fib& fib = forwarder.getFib();
   shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
   fibEntry->addNextHop(face1, 10);
   fibEntry->addNextHop(face2, 20);
   fibEntry->addNextHop(face3, 30);
 
   shared_ptr<Interest> interest = makeInterest("ndn:/BzgFBchqA");
-  Pit& pit = forwarder.getPit();
   shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
 
   const time::nanoseconds TICK = time::duration_cast<time::nanoseconds>(
@@ -71,20 +90,20 @@
   // however face1 is downstream so it cannot be used
   pitEntry->insertOrUpdateInRecord(face1, *interest);
   strategy.afterReceiveInterest(*face1, *interest, fibEntry, pitEntry);
-  BOOST_REQUIRE_EQUAL(strategy.m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory.back().get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory.back().outFaceId, face2->getId());
 
   // downstream retransmits frequently, but the strategy should not send Interests
   // more often than DEFAULT_MIN_RETX_INTERVAL
   scheduler::EventId retxFrom4Evt;
-  size_t nSentLast = strategy.m_sendInterestHistory.size();
+  size_t nSentLast = strategy.sendInterestHistory.size();
   time::steady_clock::TimePoint timeSentLast = time::steady_clock::now();
   function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
   periodicalRetxFrom4 = [&] {
     pitEntry->insertOrUpdateInRecord(face4, *interest);
     strategy.afterReceiveInterest(*face4, *interest, fibEntry, pitEntry);
 
-    size_t nSent = strategy.m_sendInterestHistory.size();
+    size_t nSent = strategy.sendInterestHistory.size();
     if (nSent > nSentLast) {
       BOOST_CHECK_EQUAL(nSent - nSentLast, 1);
       time::steady_clock::TimePoint timeSent = time::steady_clock::now();
@@ -101,29 +120,346 @@
 
   // nexthops for accepted retransmissions: follow FIB cost,
   // later forward to an eligible upstream with earliest OutRecord
-  BOOST_REQUIRE_GE(strategy.m_sendInterestHistory.size(), 6);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[1].get<1>(), face1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[2].get<1>(), face3);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[3].get<1>(), face2);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[4].get<1>(), face1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[5].get<1>(), face3);
+  BOOST_REQUIRE_GE(strategy.sendInterestHistory.size(), 6);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[1].outFaceId, face1->getId());
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[2].outFaceId, face3->getId());
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[3].outFaceId, face2->getId());
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[4].outFaceId, face1->getId());
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[5].outFaceId, face3->getId());
 
   fibEntry->removeNextHop(face1);
 
-  strategy.m_sendInterestHistory.clear();
+  strategy.sendInterestHistory.clear();
   for (int i = 0; i < 3; ++i) {
     this->advanceClocks(TICK, fw::RetxSuppressionExponential::DEFAULT_MAX_INTERVAL * 2);
     pitEntry->insertOrUpdateInRecord(face5, *interest);
     strategy.afterReceiveInterest(*face5, *interest, fibEntry, pitEntry);
   }
-  BOOST_REQUIRE_EQUAL(strategy.m_sendInterestHistory.size(), 3);
-  BOOST_CHECK_NE(strategy.m_sendInterestHistory[0].get<1>(), face1);
-  BOOST_CHECK_NE(strategy.m_sendInterestHistory[1].get<1>(), face1);
-  BOOST_CHECK_NE(strategy.m_sendInterestHistory[2].get<1>(), face1);
+  BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 3);
+  BOOST_CHECK_NE(strategy.sendInterestHistory[0].outFaceId, face1->getId());
+  BOOST_CHECK_NE(strategy.sendInterestHistory[1].outFaceId, face1->getId());
+  BOOST_CHECK_NE(strategy.sendInterestHistory[2].outFaceId, face1->getId());
   // face1 cannot be used because it's gone from FIB entry
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE(NoRouteNack) // send Nack-NoRoute if there's no usable FIB nexthop
+
+class EmptyNextHopList
+{
+public:
+  Name
+  getInterestName()
+  {
+    return "/P";
+  }
+
+  shared_ptr<fib::Entry>
+  makeFibEntry(BestRouteStrategy2Fixture* fixture)
+  {
+    return fixture->fib.insert(Name()).first;
+  }
+};
+
+class NextHopIsDownstream
+{
+public:
+  Name
+  getInterestName()
+  {
+    return "/P";
+  }
+
+  shared_ptr<fib::Entry>
+  makeFibEntry(BestRouteStrategy2Fixture* fixture)
+  {
+    shared_ptr<fib::Entry> fibEntry = fixture->fib.insert(Name()).first;
+    fibEntry->addNextHop(fixture->face1, 10);
+    return fibEntry;
+  }
+};
+
+class NextHopViolatesScope
+{
+public:
+  Name
+  getInterestName()
+  {
+    return "/localhop/P";
+  }
+
+  shared_ptr<fib::Entry>
+  makeFibEntry(BestRouteStrategy2Fixture* fixture)
+  {
+    shared_ptr<fib::Entry> fibEntry = fixture->fib.insert("/localhop").first;
+    fibEntry->addNextHop(fixture->face2, 10);
+    // face1 and face2 are both non-local; Interest from face1 cannot be forwarded to face2
+    return fibEntry;
+  }
+};
+
+typedef boost::mpl::vector<EmptyNextHopList, NextHopIsDownstream, NextHopViolatesScope> NoRouteScenarios;
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(IncomingInterest, Scenario, NoRouteScenarios)
+{
+  Scenario scenario;
+
+  shared_ptr<Interest> interest = makeInterest(scenario.getInterestName());
+  shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
+  pitEntry->insertOrUpdateInRecord(face1, *interest);
+
+  shared_ptr<fib::Entry> fibEntry = scenario.makeFibEntry(this);
+
+  strategy.afterReceiveInterest(*face1, *interest, fibEntry, pitEntry);
+
+  BOOST_REQUIRE_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory[0].pitEntry, pitEntry);
+
+  BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), lp::NackReason::NO_ROUTE);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // NoRouteNack
+
+BOOST_AUTO_TEST_SUITE(IncomingNack)
+
+BOOST_AUTO_TEST_CASE(OneUpstream) // one upstream, send Nack when Nack arrives
+{
+  shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
+  fibEntry->addNextHop(face3, 10);
+  fibEntry->addNextHop(face4, 20);
+  fibEntry->addNextHop(face5, 30);
+
+  shared_ptr<Interest> interest1 = makeInterest("/McQYjMbm", 992);
+  shared_ptr<Interest> interest2 = makeInterest("/McQYjMbm", 114);
+  shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
+  pitEntry->insertOrUpdateInRecord(face1, *interest1);
+  pitEntry->insertOrUpdateInRecord(face2, *interest2);
+  pitEntry->insertOrUpdateOutRecord(face3, *interest1);
+
+  lp::Nack nack3 = makeNack("/McQYjMbm", 992, lp::NackReason::CONGESTION);
+  pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
+  strategy.afterReceiveNack(*face3, nack3, fibEntry, pitEntry);
+
+  BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 2);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), lp::NackReason::CONGESTION);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[1].pitEntry, pitEntry);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[1].header.getReason(), lp::NackReason::CONGESTION);
+  std::unordered_set<FaceId> nackFaceIds{strategy.sendNackHistory[0].outFaceId,
+                                         strategy.sendNackHistory[1].outFaceId};
+  std::unordered_set<FaceId> expectedNackFaceIds{face1->getId(), face2->getId()};
+  BOOST_CHECK_EQUAL_COLLECTIONS(nackFaceIds.begin(), nackFaceIds.end(),
+                                expectedNackFaceIds.begin(), expectedNackFaceIds.end());
+}
+
+BOOST_AUTO_TEST_CASE(TwoUpstreams) // two upstreams, send Nack when both Nacks arrive
+{
+  shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
+  fibEntry->addNextHop(face3, 10);
+  fibEntry->addNextHop(face4, 20);
+  fibEntry->addNextHop(face5, 30);
+
+  shared_ptr<Interest> interest1 = makeInterest("/aS9FAyUV19", 286);
+  shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
+  pitEntry->insertOrUpdateInRecord(face1, *interest1);
+  pitEntry->insertOrUpdateOutRecord(face3, *interest1);
+  pitEntry->insertOrUpdateOutRecord(face4, *interest1);
+
+  lp::Nack nack3 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
+  pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
+  strategy.afterReceiveNack(*face3, nack3, fibEntry, pitEntry);
+
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0); // don't send Nack until all upstreams have Nacked
+
+  lp::Nack nack4 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
+  pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
+  strategy.afterReceiveNack(*face4, nack4, fibEntry, pitEntry);
+
+  BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), lp::NackReason::CONGESTION);
+}
+
+BOOST_AUTO_TEST_CASE(Timeout) // two upstreams, one times out, don't send Nack
+{
+  shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
+  fibEntry->addNextHop(face3, 10);
+  fibEntry->addNextHop(face4, 20);
+  fibEntry->addNextHop(face5, 30);
+
+  shared_ptr<Interest> interest1 = makeInterest("/sIYw0TXWDj", 115);
+  interest1->setInterestLifetime(time::milliseconds(400));
+  shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
+  pitEntry->insertOrUpdateInRecord(face1, *interest1);
+  pitEntry->insertOrUpdateOutRecord(face3, *interest1);
+
+  this->advanceClocks(time::milliseconds(300));
+  shared_ptr<Interest> interest2 = makeInterest("/sIYw0TXWDj", 223);
+  pitEntry->insertOrUpdateInRecord(face1, *interest2);
+  pitEntry->insertOrUpdateOutRecord(face4, *interest2);
+
+  this->advanceClocks(time::milliseconds(200)); // face3 has timed out
+
+  lp::Nack nack4 = makeNack("/sIYw0TXWDj", 223, lp::NackReason::CONGESTION);
+  pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
+  strategy.afterReceiveNack(*face4, nack4, fibEntry, pitEntry);
+
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
+}
+
+BOOST_FIXTURE_TEST_CASE(LiveDeadlock, UnitTestTimeFixture) // #3033 note-7
+{
+  /*
+   *           /----------\
+   *           | producer |
+   *           \----------/
+   *                |
+   *              +---+
+   *              | P |
+   *              +---+
+   *                |
+   *           failed link
+   *                |
+   *              +---+
+   *              | R |
+   *              +---+
+   *             ^     ^
+   *            /       \
+   *           /         \
+   *        +---+       +---+
+   *        | B | <---> | C |
+   *        +---+       +---+
+   *          ^           ^
+   *          |           |
+   *          |           |
+   *        +---+       +---+
+   *        | A |       | D |
+   *        +---+       +---+
+   *          ^           ^
+   *          |           |
+   *  /----------\     /----------\
+   *  | consumer |     | consumer |
+   *  \----------/     \----------/
+   */
+
+  TopologyTester topo;
+  TopologyNode nodeP = topo.addForwarder("P"),
+               nodeR = topo.addForwarder("R"),
+               nodeA = topo.addForwarder("A"),
+               nodeB = topo.addForwarder("B"),
+               nodeC = topo.addForwarder("C"),
+               nodeD = topo.addForwarder("D");
+
+  for (TopologyNode node : {nodeP, nodeR, nodeA, nodeB, nodeC, nodeD}) {
+    topo.setStrategy<BestRouteStrategy2>(node);
+  }
+
+  const time::milliseconds LINK_DELAY(10);
+  shared_ptr<TopologyLink> linkPR = topo.addLink("PR", LINK_DELAY, {nodeP, nodeR}),
+                           linkRB = topo.addLink("RB", LINK_DELAY, {nodeR, nodeB}),
+                           linkRC = topo.addLink("RC", LINK_DELAY, {nodeR, nodeC}),
+                           linkBC = topo.addLink("BC", LINK_DELAY, {nodeB, nodeC}),
+                           linkBA = topo.addLink("BA", LINK_DELAY, {nodeB, nodeA}),
+                           linkCD = topo.addLink("CD", LINK_DELAY, {nodeC, nodeD});
+
+  // TODO register the prefix on R->P but then set the face DOWN
+  // topo.registerPrefix(nodeR, linkPR->getFace(nodeR), "ndn:/P", 10);
+  topo.registerPrefix(nodeB, linkRB->getFace(nodeB), "ndn:/P", 20);
+  topo.registerPrefix(nodeB, linkBC->getFace(nodeB), "ndn:/P", 30);
+  topo.registerPrefix(nodeC, linkRC->getFace(nodeC), "ndn:/P", 20);
+  topo.registerPrefix(nodeC, linkBC->getFace(nodeC), "ndn:/P", 30);
+  topo.registerPrefix(nodeA, linkBA->getFace(nodeA), "ndn:/P", 30);
+  topo.registerPrefix(nodeD, linkCD->getFace(nodeD), "ndn:/P", 30);
+
+  ndn::Face& appA = topo.addAppFace("A", nodeA)->getClientFace();
+  ndn::Face& appD = topo.addAppFace("D", nodeD)->getClientFace();
+
+  int nNacksA = 0, nNacksD = 0;
+  appA.expressInterest(Interest("/P/1"), bind([]{}), bind([&nNacksA]{ ++nNacksA; }), bind([]{}));
+  appD.expressInterest(Interest("/P/1"), bind([]{}), bind([&nNacksD]{ ++nNacksD; }), bind([]{}));
+  this->advanceClocks(time::milliseconds(1), time::milliseconds(5));
+  appA.expressInterest(Interest("/P/1"), bind([]{}), bind([&nNacksA]{ ++nNacksA; }), bind([]{}));
+  appD.expressInterest(Interest("/P/1"), bind([]{}), bind([&nNacksD]{ ++nNacksD; }), bind([]{}));
+  this->advanceClocks(time::milliseconds(1), time::milliseconds(100));
+
+  // As long as at least one Nack arrives at each client, strategy behavior is correct.
+  // Whether both Interests are Nacked is a client face behavior, not strategy behavior.
+  BOOST_CHECK_GT(nNacksA, 0);
+  BOOST_CHECK_GT(nNacksD, 0);
+}
+
+template<lp::NackReason X, lp::NackReason Y, lp::NackReason R>
+struct NackReasonCombination
+{
+  lp::NackReason
+  getX() const
+  {
+    return X;
+  }
+
+  lp::NackReason
+  getY() const
+  {
+    return Y;
+  }
+
+  lp::NackReason
+  getExpectedResult() const
+  {
+    return R;
+  }
+};
+
+typedef boost::mpl::vector<
+    NackReasonCombination<lp::NackReason::CONGESTION, lp::NackReason::CONGESTION, lp::NackReason::CONGESTION>,
+    NackReasonCombination<lp::NackReason::CONGESTION, lp::NackReason::DUPLICATE, lp::NackReason::CONGESTION>,
+    NackReasonCombination<lp::NackReason::CONGESTION, lp::NackReason::NO_ROUTE, lp::NackReason::CONGESTION>,
+    NackReasonCombination<lp::NackReason::DUPLICATE, lp::NackReason::CONGESTION, lp::NackReason::CONGESTION>,
+    NackReasonCombination<lp::NackReason::DUPLICATE, lp::NackReason::DUPLICATE, lp::NackReason::DUPLICATE>,
+    NackReasonCombination<lp::NackReason::DUPLICATE, lp::NackReason::NO_ROUTE, lp::NackReason::DUPLICATE>,
+    NackReasonCombination<lp::NackReason::NO_ROUTE, lp::NackReason::CONGESTION, lp::NackReason::CONGESTION>,
+    NackReasonCombination<lp::NackReason::NO_ROUTE, lp::NackReason::DUPLICATE, lp::NackReason::DUPLICATE>,
+    NackReasonCombination<lp::NackReason::NO_ROUTE, lp::NackReason::NO_ROUTE, lp::NackReason::NO_ROUTE>
+  > NackReasonCombinations;
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(CombineReasons, Combination, NackReasonCombinations)
+{
+  Combination combination;
+
+  shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
+  fibEntry->addNextHop(face3, 10);
+  fibEntry->addNextHop(face4, 20);
+  fibEntry->addNextHop(face5, 30);
+
+  shared_ptr<Interest> interest1 = makeInterest("/F6sEwB24I", 282);
+  shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
+  pitEntry->insertOrUpdateInRecord(face1, *interest1);
+  pitEntry->insertOrUpdateOutRecord(face3, *interest1);
+  pitEntry->insertOrUpdateOutRecord(face4, *interest1);
+
+  lp::Nack nack3 = makeNack("/F6sEwB24I", 282, combination.getX());
+  pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
+  strategy.afterReceiveNack(*face3, nack3, fibEntry, pitEntry);
+
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
+
+  lp::Nack nack4 = makeNack("/F6sEwB24I", 282, combination.getY());
+  pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
+  strategy.afterReceiveNack(*face4, nack4, fibEntry, pitEntry);
+
+  BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), combination.getExpectedResult());
+}
+
+BOOST_AUTO_TEST_SUITE_END() // IncomingNack
+
+BOOST_AUTO_TEST_SUITE_END() // TestBestRouteStrategy2
+BOOST_AUTO_TEST_SUITE_END() // Fw
 
 } // namespace tests
 } // namespace fw
diff --git a/tests/daemon/fw/client-control-strategy.t.cpp b/tests/daemon/fw/client-control-strategy.t.cpp
index ee3a362..189d42f 100644
--- a/tests/daemon/fw/client-control-strategy.t.cpp
+++ b/tests/daemon/fw/client-control-strategy.t.cpp
@@ -35,7 +35,8 @@
 
 using namespace nfd::tests;
 
-BOOST_FIXTURE_TEST_SUITE(FwClientControlStrategy, BaseFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_FIXTURE_TEST_SUITE(TestClientControlStrategy, BaseFixture)
 
 BOOST_AUTO_TEST_CASE(Forward3)
 {
@@ -65,20 +66,20 @@
   shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
   pitEntry1->insertOrUpdateInRecord(face4, *interest1);
 
-  strategy.m_sendInterestHistory.clear();
+  strategy.sendInterestHistory.clear();
   strategy.afterReceiveInterest(*face4, *interest1, fibEntry, pitEntry1);
-  BOOST_REQUIRE_EQUAL(strategy.m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[0].get<1>(), face1);
+  BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[0].outFaceId, face1->getId());
 
   // Interest without NextHopFaceId
   shared_ptr<Interest> interest2 = makeInterest("ndn:/y6JQADGVz");
   shared_ptr<pit::Entry> pitEntry2 = pit.insert(*interest2).first;
   pitEntry2->insertOrUpdateInRecord(face4, *interest2);
 
-  strategy.m_sendInterestHistory.clear();
+  strategy.sendInterestHistory.clear();
   strategy.afterReceiveInterest(*face4, *interest2, fibEntry, pitEntry2);
-  BOOST_REQUIRE_EQUAL(strategy.m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory[0].get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory[0].outFaceId, face2->getId());
 
   // Interest with invalid NextHopFaceId
   shared_ptr<Interest> interest3 = makeInterest("ndn:/0z8r6yDDe");
@@ -87,14 +88,15 @@
   pitEntry3->insertOrUpdateInRecord(face4, *interest3);
 
   face3->close(); // face3 is closed and its FaceId becomes invalid
-  strategy.m_sendInterestHistory.clear();
-  strategy.m_rejectPendingInterestHistory.clear();
+  strategy.sendInterestHistory.clear();
+  strategy.rejectPendingInterestHistory.clear();
   strategy.afterReceiveInterest(*face4, *interest3, fibEntry, pitEntry3);
-  BOOST_REQUIRE_EQUAL(strategy.m_sendInterestHistory.size(), 0);
-  BOOST_REQUIRE_EQUAL(strategy.m_rejectPendingInterestHistory.size(), 1);
+  BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 0);
+  BOOST_REQUIRE_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestClientControlStrategy
+BOOST_AUTO_TEST_SUITE_END() // Fw
 
 } // namespace tests
 } // namespace fw
diff --git a/tests/daemon/fw/dummy-strategy.hpp b/tests/daemon/fw/dummy-strategy.hpp
index d078051..33d2656 100644
--- a/tests/daemon/fw/dummy-strategy.hpp
+++ b/tests/daemon/fw/dummy-strategy.hpp
@@ -33,7 +33,7 @@
 
 /** \brief strategy for unit testing
  *
- *  Triggers on DummyStrategy are recorded but does nothing
+ *  Unless otherwise indicated, triggers are recorded but does nothing.
  */
 class DummyStrategy : public fw::Strategy
 {
@@ -47,9 +47,13 @@
   {
   }
 
+  /** \brief after receive Interest trigger
+   *
+   *  If \p interestOutFace is not null, send Interest action is invoked with that face;
+   *  otherwise, reject pending Interest action is invoked.
+   */
   virtual void
-  afterReceiveInterest(const Face& inFace,
-                       const Interest& interest,
+  afterReceiveInterest(const Face& inFace, const Interest& interest,
                        shared_ptr<fib::Entry> fibEntry,
                        shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE
   {
@@ -59,7 +63,7 @@
         interest, fibEntry, pitEntry));
     }
 
-    if (static_cast<bool>(interestOutFace)) {
+    if (interestOutFace) {
       this->sendInterest(pitEntry, interestOutFace);
     }
     else {
@@ -80,16 +84,25 @@
     ++beforeExpirePendingInterest_count;
   }
 
+  virtual void
+  afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+                   shared_ptr<fib::Entry> fibEntry,
+                   shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE
+  {
+    ++afterReceiveNack_count;
+  }
+
 public:
   int afterReceiveInterest_count;
   bool wantAfterReceiveInterestCalls;
   std::vector<std::tuple<FaceId, Interest, shared_ptr<fib::Entry>,
               shared_ptr<pit::Entry>>> afterReceiveInterestCalls;
+  shared_ptr<Face> interestOutFace;
+
   int beforeSatisfyInterest_count;
   int beforeExpirePendingInterest_count;
+  int afterReceiveNack_count;
 
-  /// outFace to use in afterReceiveInterest, nullptr to reject
-  shared_ptr<Face> interestOutFace;
 };
 
 } // namespace tests
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index d9d50d6..6a3509f 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -25,6 +25,8 @@
 
 #include "fw/forwarder.hpp"
 #include "tests/daemon/face/dummy-face.hpp"
+#include "tests/daemon/face/dummy-lp-face.hpp"
+#include "face/lp-face-wrapper.hpp"
 #include "dummy-strategy.hpp"
 
 #include "tests/test-common.hpp"
@@ -425,6 +427,225 @@
   BOOST_CHECK_EQUAL(face4->m_sentDatas.size(), 1);
 }
 
+BOOST_AUTO_TEST_CASE(IncomingNack)
+{
+  Forwarder forwarder;
+  auto face1 = make_shared<DummyFace>();
+  auto face2 = make_shared<DummyFace>();
+  auto face3 = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>(
+               "dummy://", "dummy://",
+               ndn::nfd::FACE_SCOPE_NON_LOCAL,
+               ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+               ndn::nfd::LINK_TYPE_MULTI_ACCESS));
+  forwarder.addFace(face1);
+  forwarder.addFace(face2);
+  forwarder.addFace(face3);
+
+  StrategyChoice& strategyChoice = forwarder.getStrategyChoice();
+  shared_ptr<DummyStrategy> strategyP = make_shared<DummyStrategy>(
+                                        ref(forwarder), "ndn:/strategyP");
+  shared_ptr<DummyStrategy> strategyQ = make_shared<DummyStrategy>(
+                                        ref(forwarder), "ndn:/strategyQ");
+  strategyChoice.install(strategyP);
+  strategyChoice.install(strategyQ);
+  strategyChoice.insert("ndn:/" , strategyP->getName());
+  strategyChoice.insert("ndn:/B", strategyQ->getName());
+
+  Pit& pit = forwarder.getPit();
+
+  // dispatch to the correct strategy
+  shared_ptr<Interest> interest1 = makeInterest("/A/AYJqayrzF", 562);
+  shared_ptr<pit::Entry> pit1 = pit.insert(*interest1).first;
+  pit1->insertOrUpdateOutRecord(face1, *interest1);
+  shared_ptr<Interest> interest2 = makeInterest("/B/EVyP73ru", 221);
+  shared_ptr<pit::Entry> pit2 = pit.insert(*interest2).first;
+  pit2->insertOrUpdateOutRecord(face1, *interest2);
+
+  lp::Nack nack1 = makeNack("/A/AYJqayrzF", 562, lp::NackReason::CONGESTION);
+  strategyP->afterReceiveNack_count = 0;
+  strategyQ->afterReceiveNack_count = 0;
+  forwarder.onIncomingNack(*face1, nack1);
+  BOOST_CHECK_EQUAL(strategyP->afterReceiveNack_count, 1);
+  BOOST_CHECK_EQUAL(strategyQ->afterReceiveNack_count, 0);
+
+  lp::Nack nack2 = makeNack("/B/EVyP73ru", 221, lp::NackReason::CONGESTION);
+  strategyP->afterReceiveNack_count = 0;
+  strategyQ->afterReceiveNack_count = 0;
+  forwarder.onIncomingNack(*face1, nack2);
+  BOOST_CHECK_EQUAL(strategyP->afterReceiveNack_count, 0);
+  BOOST_CHECK_EQUAL(strategyQ->afterReceiveNack_count, 1);
+
+  // record Nack on PIT out-record
+  pit::OutRecordCollection::const_iterator outRecord1 = pit1->getOutRecord(*face1);
+  BOOST_REQUIRE(outRecord1 != pit1->getOutRecords().end());
+  BOOST_REQUIRE(outRecord1->getIncomingNack() != nullptr);
+  BOOST_CHECK_EQUAL(outRecord1->getIncomingNack()->getReason(), lp::NackReason::CONGESTION);
+
+  // drop if no PIT entry
+  lp::Nack nack3 = makeNack("/yEcw5HhdM", 243, lp::NackReason::CONGESTION);
+  strategyP->afterReceiveNack_count = 0;
+  strategyQ->afterReceiveNack_count = 0;
+  forwarder.onIncomingNack(*face1, nack3);
+  BOOST_CHECK_EQUAL(strategyP->afterReceiveNack_count, 0);
+  BOOST_CHECK_EQUAL(strategyQ->afterReceiveNack_count, 0);
+
+  // drop if no out-record
+  shared_ptr<Interest> interest4 = makeInterest("/Etab4KpY", 157);
+  shared_ptr<pit::Entry> pit4 = pit.insert(*interest4).first;
+  pit4->insertOrUpdateOutRecord(face1, *interest4);
+
+  lp::Nack nack4a = makeNack("/Etab4KpY", 157, lp::NackReason::CONGESTION);
+  strategyP->afterReceiveNack_count = 0;
+  strategyQ->afterReceiveNack_count = 0;
+  forwarder.onIncomingNack(*face2, nack4a);
+  BOOST_CHECK_EQUAL(strategyP->afterReceiveNack_count, 0);
+  BOOST_CHECK_EQUAL(strategyQ->afterReceiveNack_count, 0);
+
+  // drop if Nonce does not match out-record
+  lp::Nack nack4b = makeNack("/Etab4KpY", 294, lp::NackReason::CONGESTION);
+  strategyP->afterReceiveNack_count = 0;
+  strategyQ->afterReceiveNack_count = 0;
+  forwarder.onIncomingNack(*face1, nack4b);
+  BOOST_CHECK_EQUAL(strategyP->afterReceiveNack_count, 0);
+  BOOST_CHECK_EQUAL(strategyQ->afterReceiveNack_count, 0);
+
+  // drop if inFace is multi-access
+  pit4->insertOrUpdateOutRecord(face3, *interest4);
+  strategyP->afterReceiveNack_count = 0;
+  strategyQ->afterReceiveNack_count = 0;
+  forwarder.onIncomingNack(*face3, nack4a);
+  BOOST_CHECK_EQUAL(strategyP->afterReceiveNack_count, 0);
+  BOOST_CHECK_EQUAL(strategyQ->afterReceiveNack_count, 0);
+}
+
+BOOST_AUTO_TEST_CASE(OutgoingNack)
+{
+  Forwarder forwarder;
+  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
+  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
+  auto face2w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
+  auto face2 = static_cast<DummyLpFace*>(face2w->getLpFace());
+  auto face3w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>(
+                "dummy://", "dummy://",
+                ndn::nfd::FACE_SCOPE_NON_LOCAL,
+                ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                ndn::nfd::LINK_TYPE_MULTI_ACCESS));
+  auto face3 = static_cast<DummyLpFace*>(face3w->getLpFace());
+  forwarder.addFace(face1w);
+  forwarder.addFace(face2w);
+  forwarder.addFace(face3w);
+  // TODO#3172 eliminate wrapper
+
+  Pit& pit = forwarder.getPit();
+
+  lp::NackHeader nackHeader;
+  nackHeader.setReason(lp::NackReason::CONGESTION);
+
+  // don't send Nack if there's no in-record
+  shared_ptr<Interest> interest1 = makeInterest("/fM5IVEtC", 719);
+  shared_ptr<pit::Entry> pit1 = pit.insert(*interest1).first;
+  pit1->insertOrUpdateInRecord(face1w, *interest1);
+
+  face2->sentNacks.clear();
+  forwarder.onOutgoingNack(pit1, *face2w, nackHeader);
+  BOOST_CHECK_EQUAL(face2->sentNacks.size(), 0);
+
+  // send Nack with correct Nonce
+  shared_ptr<Interest> interest2a = makeInterest("/Vi8tRm9MG3", 152);
+  shared_ptr<pit::Entry> pit2 = pit.insert(*interest2a).first;
+  pit2->insertOrUpdateInRecord(face1w, *interest2a);
+  shared_ptr<Interest> interest2b = makeInterest("/Vi8tRm9MG3", 808);
+  pit2->insertOrUpdateInRecord(face2w, *interest2b);
+
+  face1->sentNacks.clear();
+  forwarder.onOutgoingNack(pit2, *face1w, nackHeader);
+  BOOST_REQUIRE_EQUAL(face1->sentNacks.size(), 1);
+  BOOST_CHECK_EQUAL(face1->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
+  BOOST_CHECK_EQUAL(face1->sentNacks.back().getInterest().getNonce(), 152);
+
+  // erase in-record
+  pit::InRecordCollection::const_iterator inRecord2a = pit2->getInRecord(*face1w);
+  BOOST_CHECK(inRecord2a == pit2->getInRecords().end());
+
+  // send Nack with correct Nonce
+  face2->sentNacks.clear();
+  forwarder.onOutgoingNack(pit2, *face2w, nackHeader);
+  BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
+  BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
+  BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest().getNonce(), 808);
+
+  // erase in-record
+  pit::InRecordCollection::const_iterator inRecord2b = pit2->getInRecord(*face1w);
+  BOOST_CHECK(inRecord2b == pit2->getInRecords().end());
+
+  // don't send Nack to multi-access face
+  shared_ptr<Interest> interest2c = makeInterest("/Vi8tRm9MG3", 228);
+  pit2->insertOrUpdateInRecord(face3w, *interest2c);
+
+  face3->sentNacks.clear();
+  forwarder.onOutgoingNack(pit1, *face3w, nackHeader);
+  BOOST_CHECK_EQUAL(face3->sentNacks.size(), 0);
+}
+
+BOOST_AUTO_TEST_CASE(InterestLoopNack)
+{
+  Forwarder forwarder;
+  auto face1w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
+  auto face1 = static_cast<DummyLpFace*>(face1w->getLpFace());
+  auto face2w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>());
+  auto face2 = static_cast<DummyLpFace*>(face2w->getLpFace());
+  auto face3w = make_shared<face::LpFaceWrapper>(make_unique<DummyLpFace>(
+                "dummy://", "dummy://",
+                ndn::nfd::FACE_SCOPE_NON_LOCAL,
+                ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                ndn::nfd::LINK_TYPE_MULTI_ACCESS));
+  auto face3 = static_cast<DummyLpFace*>(face3w->getLpFace());
+  auto face4 = make_shared<DummyFace>();
+  forwarder.addFace(face1w);
+  forwarder.addFace(face2w);
+  forwarder.addFace(face3w);
+  forwarder.addFace(face4);
+  // TODO#3172 eliminate wrapper
+
+  Fib& fib = forwarder.getFib();
+  shared_ptr<fib::Entry> fibEntry = fib.insert(Name("/zT4XwK0Hnx")).first;
+  fibEntry->addNextHop(face4, 0);
+
+  // receive Interest on face1
+  face1->sentNacks.clear();
+  shared_ptr<Interest> interest1a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732);
+  face1->receiveInterest(*interest1a);
+  BOOST_CHECK(face1->sentNacks.empty());
+
+  // receive Interest with duplicate Nonce on face1
+  face1->sentNacks.clear();
+  shared_ptr<Interest> interest1b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732);
+  face1->receiveInterest(*interest1b);
+  BOOST_REQUIRE_EQUAL(face1->sentNacks.size(), 1);
+  BOOST_CHECK_EQUAL(face1->sentNacks.back().getInterest(), *interest1b);
+  BOOST_CHECK_EQUAL(face1->sentNacks.back().getReason(), lp::NackReason::DUPLICATE);
+
+  // receive Interest with duplicate Nonce on face2
+  face2->sentNacks.clear();
+  shared_ptr<Interest> interest2a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732);
+  face2->receiveInterest(*interest2a);
+  BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
+  BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest(), *interest2a);
+  BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::DUPLICATE);
+
+  // receive Interest with new Nonce on face2
+  face2->sentNacks.clear();
+  shared_ptr<Interest> interest2b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 944);
+  face2->receiveInterest(*interest2b);
+  BOOST_CHECK(face2->sentNacks.empty());
+
+  // receive Interest with duplicate Nonce on face3, don't send Nack to multi-access face
+  face3->sentNacks.clear();
+  shared_ptr<Interest> interest3a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732);
+  face3->receiveInterest(*interest3a);
+  BOOST_CHECK(face3->sentNacks.empty());
+}
+
 BOOST_FIXTURE_TEST_CASE(InterestLoopWithShortLifetime, UnitTestTimeFixture) // Bug 1953
 {
   Forwarder forwarder;
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index c67c408..3476cd3 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -35,7 +35,8 @@
 
 using namespace nfd::tests;
 
-BOOST_FIXTURE_TEST_SUITE(FwMulticastStrategy, BaseFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_FIXTURE_TEST_SUITE(TestMulticastStrategy, BaseFixture)
 
 BOOST_AUTO_TEST_CASE(Forward2)
 {
@@ -62,21 +63,17 @@
   pitEntry->insertOrUpdateInRecord(face3, *interest);
 
   strategy.afterReceiveInterest(*face3, *interest, fibEntry, pitEntry);
-  BOOST_CHECK_EQUAL(strategy.m_rejectPendingInterestHistory.size(), 0);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory.size(), 2);
-  bool hasFace1 = false;
-  bool hasFace2 = false;
-  for (std::vector<MulticastStrategyTester::SendInterestArgs>::iterator it =
-       strategy.m_sendInterestHistory.begin();
-       it != strategy.m_sendInterestHistory.end(); ++it) {
-    if (it->get<1>() == face1) {
-      hasFace1 = true;
-    }
-    if (it->get<1>() == face2) {
-      hasFace2 = true;
-    }
-  }
-  BOOST_CHECK(hasFace1 && hasFace2);
+  BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 2);
+  std::set<FaceId> sentInterestFaceIds;
+  std::transform(strategy.sendInterestHistory.begin(), strategy.sendInterestHistory.end(),
+                 std::inserter(sentInterestFaceIds, sentInterestFaceIds.end()),
+                 [] (const MulticastStrategyTester::SendInterestArgs& args) {
+                   return args.outFaceId;
+                 });
+  std::set<FaceId> expectedInterestFaceIds{face1->getId(), face2->getId()};
+  BOOST_CHECK_EQUAL_COLLECTIONS(sentInterestFaceIds.begin(), sentInterestFaceIds.end(),
+                                expectedInterestFaceIds.begin(), expectedInterestFaceIds.end());
 }
 
 BOOST_AUTO_TEST_CASE(RejectScope)
@@ -100,8 +97,8 @@
   pitEntry->insertOrUpdateInRecord(face1, *interest);
 
   strategy.afterReceiveInterest(*face1, *interest, fibEntry, pitEntry);
-  BOOST_CHECK_EQUAL(strategy.m_rejectPendingInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory.size(), 0);
+  BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 0);
 }
 
 BOOST_AUTO_TEST_CASE(RejectLoopback)
@@ -123,11 +120,12 @@
   pitEntry->insertOrUpdateInRecord(face1, *interest);
 
   strategy.afterReceiveInterest(*face1, *interest, fibEntry, pitEntry);
-  BOOST_CHECK_EQUAL(strategy.m_rejectPendingInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy.m_sendInterestHistory.size(), 0);
+  BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 0);
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestMulticastStrategy
+BOOST_AUTO_TEST_SUITE_END() // Fw
 
 } // namespace tests
 } // namespace fw
diff --git a/tests/daemon/fw/ncc-strategy.t.cpp b/tests/daemon/fw/ncc-strategy.t.cpp
index a10fc47..889b2e2 100644
--- a/tests/daemon/fw/ncc-strategy.t.cpp
+++ b/tests/daemon/fw/ncc-strategy.t.cpp
@@ -36,7 +36,8 @@
 
 using namespace nfd::tests;
 
-BOOST_FIXTURE_TEST_SUITE(FwNccStrategy, UnitTestTimeFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_FIXTURE_TEST_SUITE(TestNccStrategy, UnitTestTimeFixture)
 
 // NccStrategy is fairly complex.
 // The most important property is:
@@ -48,7 +49,7 @@
   Forwarder forwarder;
   typedef StrategyTester<fw::NccStrategy> NccStrategyTester;
   shared_ptr<NccStrategyTester> strategy = make_shared<NccStrategyTester>(ref(forwarder));
-  strategy->onAction.connect(bind(&LimitedIo::afterOp, &limitedIo));
+  strategy->afterAction.connect(bind(&LimitedIo::afterOp, &limitedIo));
 
   shared_ptr<DummyFace> face1 = make_shared<DummyFace>();
   shared_ptr<DummyFace> face2 = make_shared<DummyFace>();
@@ -79,13 +80,13 @@
 
   // forwards to face1 because routing says it's best
   // (no io run here: afterReceiveInterest has already sent the Interest)
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[0].get<1>(), face1);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[0].outFaceId, face1->getId());
 
   // forwards to face2 because face1 doesn't respond
   limitedIo.run(1, time::milliseconds(500), time::milliseconds(10));
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 2);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[1].get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 2);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[1].outFaceId, face2->getId());
 
   // face2 responds
   shared_ptr<Data> data1p = makeData("ndn:/0Jm1ajrW/%00");
@@ -104,8 +105,8 @@
 
   // forwards to face2 because it responds previously
   this->advanceClocks(time::milliseconds(1));
-  BOOST_REQUIRE_GE(strategy->m_sendInterestHistory.size(), 3);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[2].get<1>(), face2);
+  BOOST_REQUIRE_GE(strategy->sendInterestHistory.size(), 3);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[2].outFaceId, face2->getId());
 }
 
 BOOST_AUTO_TEST_CASE(Bug1853)
@@ -140,8 +141,8 @@
   strategy->afterReceiveInterest(*face3, *interest1, fibEntry, pitEntry1);
 
   this->advanceClocks(time::milliseconds(1));
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[0].get<1>(), face1);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[0].outFaceId, face1->getId());
 
   // face1 responds
   shared_ptr<Data> data1 = makeData("ndn:/nztwIvHX/%00");
@@ -168,7 +169,7 @@
   Forwarder forwarder;
   typedef StrategyTester<fw::NccStrategy> NccStrategyTester;
   shared_ptr<NccStrategyTester> strategy = make_shared<NccStrategyTester>(ref(forwarder));
-  strategy->onAction.connect(bind(&LimitedIo::afterOp, &limitedIo));
+  strategy->afterAction.connect(bind(&LimitedIo::afterOp, &limitedIo));
 
   shared_ptr<DummyFace> face1 = make_shared<DummyFace>();
   shared_ptr<DummyFace> face2 = make_shared<DummyFace>();
@@ -195,11 +196,11 @@
 
   pitEntry1->insertOrUpdateInRecord(face3, *interest1);
   strategy->afterReceiveInterest(*face3, *interest1, fibEntry, pitEntry1);
-  limitedIo.run(2 - strategy->m_sendInterestHistory.size(),
+  limitedIo.run(2 - strategy->sendInterestHistory.size(),
                 time::milliseconds(2000), time::milliseconds(10));
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 2);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[0].get<1>(), face1);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[1].get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 2);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[0].outFaceId, face1->getId());
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[1].outFaceId, face2->getId());
 
   // face1 responds
   shared_ptr<Data> data1 = makeData("ndn:/seRMz5a6/%00");
@@ -217,11 +218,11 @@
 
   pitEntry2->insertOrUpdateInRecord(face3, *interest2);
   strategy->afterReceiveInterest(*face3, *interest2, fibEntry, pitEntry2);
-  limitedIo.run(3 - strategy->m_sendInterestHistory.size(),
+  limitedIo.run(3 - strategy->sendInterestHistory.size(),
                 time::milliseconds(2000), time::milliseconds(10));
 
-  BOOST_REQUIRE_GE(strategy->m_sendInterestHistory.size(), 3);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[2].get<1>(), face1);
+  BOOST_REQUIRE_GE(strategy->sendInterestHistory.size(), 3);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[2].outFaceId, face1->getId());
 }
 
 BOOST_AUTO_TEST_CASE(Bug1971)
@@ -230,7 +231,7 @@
   Forwarder forwarder;
   typedef StrategyTester<fw::NccStrategy> NccStrategyTester;
   shared_ptr<NccStrategyTester> strategy = make_shared<NccStrategyTester>(ref(forwarder));
-  strategy->onAction.connect(bind(&LimitedIo::afterOp, &limitedIo));
+  strategy->afterAction.connect(bind(&LimitedIo::afterOp, &limitedIo));
 
   shared_ptr<DummyFace> face1 = make_shared<DummyFace>();
   shared_ptr<DummyFace> face2 = make_shared<DummyFace>();
@@ -254,10 +255,10 @@
 
   pitEntry1->insertOrUpdateInRecord(face1, *interest1);
   strategy->afterReceiveInterest(*face1, *interest1, fibEntry, pitEntry1);
-  limitedIo.run(1 - strategy->m_sendInterestHistory.size(),
+  limitedIo.run(1 - strategy->sendInterestHistory.size(),
                 time::milliseconds(2000), time::milliseconds(10));
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[0].get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[0].outFaceId, face2->getId());
 
   // face2 responds
   shared_ptr<Data> data1 = makeData("ndn:/M4mBXCsd");
@@ -270,10 +271,10 @@
   // similar Interest: strategy should still forward it
   pitEntry1->insertOrUpdateInRecord(face1, *interest1);
   strategy->afterReceiveInterest(*face1, *interest1, fibEntry, pitEntry1);
-  limitedIo.run(2 - strategy->m_sendInterestHistory.size(),
+  limitedIo.run(2 - strategy->sendInterestHistory.size(),
                 time::milliseconds(2000), time::milliseconds(10));
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 2);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[1].get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 2);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[1].outFaceId, face2->getId());
 }
 
 BOOST_AUTO_TEST_CASE(Bug1998)
@@ -306,11 +307,12 @@
   strategy->afterReceiveInterest(*face1, *interest1, fibEntry, pitEntry1);
 
   // Interest shall go to face2, not loop back to face1
-  BOOST_REQUIRE_EQUAL(strategy->m_sendInterestHistory.size(), 1);
-  BOOST_CHECK_EQUAL(strategy->m_sendInterestHistory[0].get<1>(), face2);
+  BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 1);
+  BOOST_CHECK_EQUAL(strategy->sendInterestHistory[0].outFaceId, face2->getId());
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestNccStrategy
+BOOST_AUTO_TEST_SUITE_END() // Fw
 
 } // namespace tests
 } // namespace fw
diff --git a/tests/daemon/fw/retx-suppression.t.cpp b/tests/daemon/fw/retx-suppression.t.cpp
index 2d1b146..266f168 100644
--- a/tests/daemon/fw/retx-suppression.t.cpp
+++ b/tests/daemon/fw/retx-suppression.t.cpp
@@ -26,7 +26,6 @@
 #include "fw/retx-suppression.hpp"
 #include "fw/retx-suppression-fixed.hpp"
 #include "fw/retx-suppression-exponential.hpp"
-#include "strategy-tester.hpp"
 
 #include "tests/test-common.hpp"
 #include "tests/daemon/face/dummy-face.hpp"
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index 9cf4855..26c29c1 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -33,8 +33,7 @@
 namespace fw {
 namespace tests {
 
-/** \class StrategyTester
- *  \brief extends strategy S for unit testing
+/** \brief extends strategy S for unit testing
  *
  *  Actions invoked by S are recorded but not passed to forwarder
  */
@@ -49,7 +48,7 @@
   }
 
   /// fires after each Action
-  signal::Signal<StrategyTester<S>> onAction;
+  signal::Signal<StrategyTester<S>> afterAction;
 
 protected:
   virtual void
@@ -60,12 +59,32 @@
   virtual void
   rejectPendingInterest(shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE;
 
-public:
-  typedef boost::tuple<shared_ptr<pit::Entry>, shared_ptr<Face>> SendInterestArgs;
-  std::vector<SendInterestArgs> m_sendInterestHistory;
+  virtual void
+  sendNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace,
+           const lp::NackHeader& header) DECL_OVERRIDE;
 
-  typedef boost::tuple<shared_ptr<pit::Entry>> RejectPendingInterestArgs;
-  std::vector<RejectPendingInterestArgs> m_rejectPendingInterestHistory;
+public:
+  struct SendInterestArgs
+  {
+    shared_ptr<pit::Entry> pitEntry;
+    FaceId outFaceId;
+    bool wantNewNonce;
+  };
+  std::vector<SendInterestArgs> sendInterestHistory;
+
+  struct RejectPendingInterestArgs
+  {
+    shared_ptr<pit::Entry> pitEntry;
+  };
+  std::vector<RejectPendingInterestArgs> rejectPendingInterestHistory;
+
+  struct SendNackArgs
+  {
+    shared_ptr<pit::Entry> pitEntry;
+    FaceId outFaceId;
+    lp::NackHeader header;
+  };
+  std::vector<SendNackArgs> sendNackHistory;
 };
 
 
@@ -75,17 +94,30 @@
                                 shared_ptr<Face> outFace,
                                 bool wantNewNonce)
 {
-  m_sendInterestHistory.push_back(SendInterestArgs(pitEntry, outFace));
+  SendInterestArgs args{pitEntry, outFace->getId()};
+  sendInterestHistory.push_back(args);
   pitEntry->insertOrUpdateOutRecord(outFace, pitEntry->getInterest());
-  onAction();
+  afterAction();
 }
 
 template<typename S>
 inline void
 StrategyTester<S>::rejectPendingInterest(shared_ptr<pit::Entry> pitEntry)
 {
-  m_rejectPendingInterestHistory.push_back(RejectPendingInterestArgs(pitEntry));
-  onAction();
+  RejectPendingInterestArgs args{pitEntry};
+  rejectPendingInterestHistory.push_back(args);
+  afterAction();
+}
+
+template<typename S>
+inline void
+StrategyTester<S>::sendNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace,
+                            const lp::NackHeader& header)
+{
+  SendNackArgs args{pitEntry, outFace.getId(), header};
+  sendNackHistory.push_back(args);
+  pitEntry->deleteInRecord(outFace);
+  afterAction();
 }
 
 } // namespace tests
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
new file mode 100644
index 0000000..10a0b31
--- /dev/null
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -0,0 +1,260 @@
+/* -*- 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 "topology-tester.hpp"
+#include <ndn-cxx/encoding/encoding-buffer-fwd.hpp>
+#include "face/generic-link-service.hpp"
+
+namespace nfd {
+namespace fw {
+namespace tests {
+
+using face::LpFaceWrapper;
+
+TopologyForwarderTransport::TopologyForwarderTransport(
+    const FaceUri& localUri, const FaceUri& remoteUri,
+    ndn::nfd::FaceScope scope, ndn::nfd::LinkType linkType)
+{
+  this->setLocalUri(localUri);
+  this->setRemoteUri(remoteUri);
+  this->setScope(scope);
+  this->setPersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT);
+  this->setLinkType(linkType);
+}
+
+void
+TopologyForwarderTransport::receiveFromTopology(const Block& packet)
+{
+  Packet p;
+  p.packet = packet;
+  this->receive(std::move(p));
+}
+
+void
+TopologyForwarderTransport::doSend(Packet&& packet)
+{
+  this->emitSignal(afterSend, packet.packet);
+}
+
+void
+TopologyClientTransport::receiveFromTopology(const Block& packet)
+{
+  if (m_receiveCallback) {
+    m_receiveCallback(packet);
+  }
+}
+
+void
+TopologyClientTransport::send(const Block& wire)
+{
+  this->emitSignal(afterSend, wire);
+}
+
+void
+TopologyClientTransport::send(const Block& header, const Block& payload)
+{
+  ndn::EncodingBuffer encoder(header.size() + payload.size(), header.size() + payload.size());
+  encoder.appendByteArray(header.wire(), header.size());
+  encoder.appendByteArray(payload.wire(), payload.size());
+
+  this->send(encoder.block());
+}
+
+TopologyLinkBase::TopologyLinkBase()
+  : m_isUp(true)
+{
+}
+
+void
+TopologyLinkBase::attachTransport(TopologyNode i, TopologyTransportBase* transport)
+{
+  BOOST_ASSERT(transport != nullptr);
+  BOOST_ASSERT(m_transports.count(i) == 0);
+
+  m_transports[i] = transport;
+  transport->afterSend.connect([this, i] (const Block& packet) { this->transmit(i, packet); });
+}
+
+void
+TopologyLinkBase::transmit(TopologyNode i, const Block& packet)
+{
+  if (!m_isUp) {
+    return;
+  }
+
+  for (auto&& p : m_transports) {
+    if (p.first == i) {
+      continue;
+    }
+
+    TopologyTransportBase* recipient = p.second;
+    this->scheduleReceive(recipient, packet);
+  }
+}
+
+TopologyLink::TopologyLink(const time::nanoseconds& delay)
+  : m_delay(delay)
+{
+  BOOST_ASSERT(delay > time::nanoseconds::zero());
+  // zero delay does not work on OSX
+}
+
+void
+TopologyLink::addFace(TopologyNode i, shared_ptr<LpFaceWrapper> face)
+{
+  this->attachTransport(i, dynamic_cast<TopologyTransportBase*>(face->getLpFace()->getTransport()));
+  m_faces[i] = face;
+}
+
+void
+TopologyLink::scheduleReceive(TopologyTransportBase* recipient, const Block& packet)
+{
+  scheduler::schedule(m_delay, [packet, recipient] {
+    recipient->receiveFromTopology(packet);
+  });
+}
+
+TopologyAppLink::TopologyAppLink(shared_ptr<LpFaceWrapper> face)
+  : m_face(face)
+{
+  this->attachTransport(0, dynamic_cast<TopologyTransportBase*>(face->getLpFace()->getTransport()));
+
+  auto clientTransport = make_shared<TopologyClientTransport>();
+  m_client = make_shared<ndn::Face>(clientTransport, getGlobalIoService());
+  this->attachTransport(1, clientTransport.get());
+}
+
+void
+TopologyAppLink::scheduleReceive(TopologyTransportBase* recipient, const Block& packet)
+{
+  getGlobalIoService().post([packet, recipient] {
+    recipient->receiveFromTopology(packet);
+  });
+}
+
+TopologyNode
+TopologyTester::addForwarder(const std::string& label)
+{
+  size_t i = m_forwarders.size();
+  m_forwarders.push_back(std::move(make_unique<Forwarder>()));
+  m_forwarderLabels.push_back(label);
+  BOOST_ASSERT(m_forwarders.size() == m_forwarderLabels.size());
+  return i;
+}
+
+shared_ptr<TopologyLink>
+TopologyTester::addLink(const std::string& label, const time::nanoseconds& delay,
+                        std::initializer_list<TopologyNode> forwarders,
+                        bool forceMultiAccessFace)
+{
+  auto link = make_shared<TopologyLink>(delay);
+  FaceUri remoteUri("topology://link/" + label);
+  ndn::nfd::LinkType linkType = (forceMultiAccessFace || forwarders.size() > 2) ?
+                                ndn::nfd::LINK_TYPE_MULTI_ACCESS :
+                                ndn::nfd::LINK_TYPE_POINT_TO_POINT;
+
+  for (TopologyNode i : forwarders) {
+    Forwarder& forwarder = this->getForwarder(i);
+    FaceUri localUri("topology://" + m_forwarderLabels.at(i) + "/" + label);
+
+    auto service = make_unique<face::GenericLinkService>();
+    auto transport = make_unique<TopologyForwarderTransport>(localUri, remoteUri,
+                     ndn::nfd::FACE_SCOPE_NON_LOCAL, linkType);
+    auto face = make_unique<LpFace>(std::move(service), std::move(transport));
+    auto faceW = make_shared<LpFaceWrapper>(std::move(face));
+
+    forwarder.addFace(faceW);
+    link->addFace(i, faceW);
+  }
+
+  m_links.push_back(link); // keep a shared_ptr so callers don't have to
+  return link;
+}
+
+shared_ptr<TopologyAppLink>
+TopologyTester::addAppFace(const std::string& label, TopologyNode i)
+{
+  Forwarder& forwarder = this->getForwarder(i);
+  FaceUri localUri("topology://" + m_forwarderLabels.at(i) + "/local/" + label);
+  FaceUri remoteUri("topology://" + m_forwarderLabels.at(i) + "/app/" + label);
+
+  auto service = make_unique<face::GenericLinkService>();
+  auto transport = make_unique<TopologyForwarderTransport>(localUri, remoteUri,
+                   ndn::nfd::FACE_SCOPE_LOCAL, ndn::nfd::LINK_TYPE_POINT_TO_POINT);
+  auto face = make_unique<LpFace>(std::move(service), std::move(transport));
+  auto faceW = make_shared<LpFaceWrapper>(std::move(face));
+
+  forwarder.addFace(faceW);
+
+  auto al = make_shared<TopologyAppLink>(faceW);
+  m_appLinks.push_back(al); // keep a shared_ptr so callers don't have to
+  return al;
+}
+
+shared_ptr<TopologyAppLink>
+TopologyTester::addAppFace(const std::string& label, TopologyNode i, const Name& prefix, uint64_t cost)
+{
+  shared_ptr<TopologyAppLink> al = this->addAppFace(label, i);
+  this->registerPrefix(i, al->getForwarderFace(), prefix, cost);
+  return al;
+}
+
+void
+TopologyTester::registerPrefix(TopologyNode i, const Face& face, const Name& prefix, uint64_t cost)
+{
+  Forwarder& forwarder = this->getForwarder(i);
+  Fib& fib = forwarder.getFib();
+  shared_ptr<fib::Entry> fibEntry = fib.insert(prefix).first;
+  fibEntry->addNextHop(const_cast<Face&>(face).shared_from_this(), cost);
+}
+
+void
+TopologyTester::addEchoProducer(ndn::Face& face, const Name& prefix)
+{
+  face.setInterestFilter(prefix,
+      [&face] (const ndn::InterestFilter&, const Interest& interest) {
+        shared_ptr<Data> data = makeData(interest.getName());
+        face.put(*data);
+      });
+}
+
+void
+TopologyTester::addIntervalConsumer(ndn::Face& face, const Name& prefix,
+                                    const time::nanoseconds& interval, size_t n)
+{
+  Name name(prefix);
+  name.appendTimestamp();
+  shared_ptr<Interest> interest = makeInterest(name);
+  face.expressInterest(*interest, bind([]{}));
+
+  if (n > 1) {
+    scheduler::schedule(interval, bind(&TopologyTester::addIntervalConsumer, this,
+                                       ref(face), prefix, interval, n - 1));
+  }
+}
+
+} // namespace tests
+} // namespace fw
+} // namespace nfd
diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp
index 406c6b1..dd6d77d 100644
--- a/tests/daemon/fw/topology-tester.hpp
+++ b/tests/daemon/fw/topology-tester.hpp
@@ -30,19 +30,86 @@
 #ifndef NFD_TESTS_NFD_FW_TOPOLOGY_TESTER_HPP
 #define NFD_TESTS_NFD_FW_TOPOLOGY_TESTER_HPP
 
-#include <unordered_map>
-#include <ndn-cxx/util/dummy-client-face.hpp>
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/transport/transport.hpp>
+#include "face/lp-face-wrapper.hpp"
 #include "fw/strategy.hpp"
 #include "tests/test-common.hpp"
-#include "../face/dummy-face.hpp"
 
 namespace nfd {
 namespace fw {
 namespace tests {
 
-using ndn::util::DummyClientFace;
 using namespace nfd::tests;
 
+/** \brief abstracts a Transport used in TopologyTester
+ */
+class TopologyTransportBase
+{
+public:
+  /** \brief causes the transport to receive a link-layer packet
+   */
+  virtual void
+  receiveFromTopology(const Block& packet) = 0;
+
+  signal::Signal<TopologyTransportBase, Block> afterSend;
+
+protected:
+  DECLARE_SIGNAL_EMIT(afterSend)
+};
+
+/** \brief implements a forwarder-side Transport used in TopologyTester
+ */
+class TopologyForwarderTransport : public face::Transport, public TopologyTransportBase
+{
+public:
+  TopologyForwarderTransport(const FaceUri& localUri, const FaceUri& remoteUri,
+                             ndn::nfd::FaceScope scope, ndn::nfd::LinkType linkType);
+
+  virtual void
+  receiveFromTopology(const Block& packet) DECL_OVERRIDE;
+
+protected:
+  virtual void
+  doClose() DECL_OVERRIDE
+  {
+  }
+
+private:
+  virtual void
+  doSend(Packet&& packet) DECL_OVERRIDE;
+};
+
+/** \brief implements a client-side Transport used in TopologyTester
+ */
+class TopologyClientTransport : public ndn::Transport, public TopologyTransportBase
+{
+public:
+  virtual void
+  receiveFromTopology(const Block& packet) DECL_OVERRIDE;
+
+  virtual void
+  close() DECL_OVERRIDE
+  {
+  }
+
+  virtual void
+  pause() DECL_OVERRIDE
+  {
+  }
+
+  virtual void
+  resume() DECL_OVERRIDE
+  {
+  }
+
+  virtual void
+  send(const Block& wire) DECL_OVERRIDE;
+
+  virtual void
+  send(const Block& header, const Block& payload) DECL_OVERRIDE;
+};
+
 /** \brief identifies a node (forwarder) in the topology
  */
 typedef size_t TopologyNode;
@@ -52,10 +119,7 @@
 class TopologyLinkBase : noncopyable
 {
 public:
-  TopologyLinkBase()
-    : m_isUp(true)
-  {
-  }
+  TopologyLinkBase();
 
   /** \brief fail the link, cause packets to be dropped silently
    */
@@ -74,7 +138,21 @@
   }
 
 protected:
+  /** \brief attach a Transport onto this link
+   */
+  void
+  attachTransport(TopologyNode i, TopologyTransportBase* transport);
+
+private:
+  void
+  transmit(TopologyNode i, const Block& packet);
+
+  virtual void
+  scheduleReceive(TopologyTransportBase* recipient, const Block& packet) = 0;
+
+protected:
   bool m_isUp;
+  std::unordered_map<TopologyNode, TopologyTransportBase*> m_transports;
 };
 
 /** \brief represents a network link in the topology which connects two or more nodes
@@ -82,90 +160,27 @@
 class TopologyLink : public TopologyLinkBase
 {
 public:
+  explicit
+  TopologyLink(const time::nanoseconds& delay);
+
+  void
+  addFace(TopologyNode i, shared_ptr<face::LpFaceWrapper> face);
+
   /** \return a face of forwarder \p i which is attached to this link
    */
-  shared_ptr<DummyFace>
+  Face&
   getFace(TopologyNode i)
   {
-    return m_faces.at(i)->face;
+    return *m_faces.at(i);
   }
 
 private:
-  explicit
-  TopologyLink(const time::nanoseconds& delay)
-    : m_delay(delay)
-  {
-    BOOST_ASSERT(delay >= time::nanoseconds::zero());
-  }
-
-  struct LinkFace
-  {
-    shared_ptr<DummyFace> face;
-  };
-
-  void
-  addFace(TopologyNode i, shared_ptr<DummyFace> face)
-  {
-    BOOST_ASSERT(m_faces.count(i) == 0);
-
-    LinkFace* lf = new LinkFace();
-    lf->face = face;
-    face->onSendInterest.connect(bind(&TopologyLink::transmitInterest, this, i, _1));
-    face->onSendData.connect(bind(&TopologyLink::transmitData, this, i, _1));
-
-    m_faces[i].reset(lf);
-  }
-
-  friend class TopologyTester;
-
-private:
-  void
-  transmitInterest(TopologyNode i, const Interest& interest)
-  {
-    if (!m_isUp) {
-      return;
-    }
-
-    // Interest object cannot be shared between faces because
-    // Forwarder can set different IncomingFaceId.
-    Block wire = interest.wireEncode();
-    for (auto&& p : m_faces) {
-      if (p.first == i) {
-        continue;
-      }
-      shared_ptr<DummyFace> face = p.second->face;
-      scheduler::schedule(m_delay, [wire, face] {
-        auto interest = make_shared<Interest>(wire);
-        face->receiveInterest(*interest);
-      });
-    }
-  }
-
-  void
-  transmitData(TopologyNode i, const Data& data)
-  {
-    if (!m_isUp) {
-      return;
-    }
-
-    // Data object cannot be shared between faces because
-    // Forwarder can set different IncomingFaceId.
-    Block wire = data.wireEncode();
-    for (auto&& p : m_faces) {
-      if (p.first == i) {
-        continue;
-      }
-      shared_ptr<DummyFace> face = p.second->face;
-      scheduler::schedule(m_delay, [wire, face] {
-        auto data = make_shared<Data>(wire);
-        face->receiveData(*data);
-      });
-    }
-  }
+  virtual void
+  scheduleReceive(TopologyTransportBase* recipient, const Block& packet) DECL_OVERRIDE;
 
 private:
   time::nanoseconds m_delay;
-  std::unordered_map<TopologyNode, unique_ptr<LinkFace>> m_faces;
+  std::unordered_map<TopologyNode, shared_ptr<face::LpFaceWrapper>> m_faces;
 };
 
 /** \brief represents a link to a local application
@@ -173,66 +188,32 @@
 class TopologyAppLink : public TopologyLinkBase
 {
 public:
+  explicit
+  TopologyAppLink(shared_ptr<face::LpFaceWrapper> face);
+
   /** \return face on forwarder side
    */
-  shared_ptr<DummyLocalFace>
+  Face&
   getForwarderFace()
   {
-    return m_face;
+    return *m_face;
   }
 
   /** \return face on application side
    */
-  shared_ptr<DummyClientFace>
+  ndn::Face&
   getClientFace()
   {
-    return m_client;
+    return *m_client;
   }
 
 private:
-  explicit
-  TopologyAppLink(shared_ptr<DummyLocalFace> face)
-    : m_face(face)
-    , m_client(ndn::util::makeDummyClientFace(getGlobalIoService(), {false, false}))
-  {
-    m_client->onSendInterest.connect([this] (const Interest& interest) {
-      if (!m_isUp) {
-        return;
-      }
-      auto interest2 = interest.shared_from_this();
-      getGlobalIoService().post([=] { m_face->receiveInterest(*interest2); });
-    });
-
-    m_client->onSendData.connect([this] (const Data& data) {
-      if (!m_isUp) {
-        return;
-      }
-      auto data2 = data.shared_from_this();
-      getGlobalIoService().post([=] { m_face->receiveData(*data2); });
-    });
-
-    m_face->onSendInterest.connect([this] (const Interest& interest) {
-      if (!m_isUp) {
-        return;
-      }
-      auto interest2 = interest.shared_from_this();
-      getGlobalIoService().post([=] { m_client->receive(*interest2); });
-    });
-
-    m_face->onSendData.connect([this] (const Data& data) {
-      if (!m_isUp) {
-        return;
-      }
-      auto data2 = data.shared_from_this();
-      getGlobalIoService().post([=] { m_client->receive(*data2); });
-    });
-  }
-
-  friend class TopologyTester;
+  virtual void
+  scheduleReceive(TopologyTransportBase* recipient, const Block& packet) DECL_OVERRIDE;
 
 private:
-  shared_ptr<DummyLocalFace> m_face;
-  shared_ptr<DummyClientFace> m_client;
+  shared_ptr<face::LpFaceWrapper> m_face;
+  shared_ptr<ndn::Face> m_client;
 };
 
 /** \brief builds a topology for forwarding tests
@@ -244,12 +225,7 @@
    *  \return index of new forwarder
    */
   TopologyNode
-  addForwarder()
-  {
-    size_t i = m_forwarders.size();
-    m_forwarders.push_back(make_unique<Forwarder>());
-    return i;
-  }
+  addForwarder(const std::string& label);
 
   /** \return forwarder instance \p i
    */
@@ -281,85 +257,42 @@
    *  this packet will be received by all other faces on this link after \p delay .
    */
   shared_ptr<TopologyLink>
-  addLink(const time::nanoseconds& delay, std::initializer_list<TopologyNode> forwarders)
-  {
-    auto link = shared_ptr<TopologyLink>(new TopologyLink(delay));
-    for (TopologyNode i : forwarders) {
-      Forwarder& forwarder = this->getForwarder(i);
-      shared_ptr<DummyFace> face = make_shared<DummyFace>();
-      forwarder.addFace(face);
-      link->addFace(i, face);
-    }
-    return link;
-  }
+  addLink(const std::string& label, const time::nanoseconds& delay,
+          std::initializer_list<TopologyNode> forwarders,
+          bool forceMultiAccessFace = false);
 
   /** \brief makes a link to local application
    */
   shared_ptr<TopologyAppLink>
-  addAppFace(TopologyNode i)
-  {
-    Forwarder& forwarder = this->getForwarder(i);
-    auto face = make_shared<DummyLocalFace>();
-    forwarder.addFace(face);
-
-    return shared_ptr<TopologyAppLink>(new TopologyAppLink(face));
-  }
+  addAppFace(const std::string& label, TopologyNode i);
 
   /** \brief makes a link to local application, and register a prefix
    */
   shared_ptr<TopologyAppLink>
-  addAppFace(TopologyNode i, const Name& prefix, uint64_t cost = 0)
-  {
-    shared_ptr<TopologyAppLink> al = this->addAppFace(i);
-    this->registerPrefix(i, al->getForwarderFace(), prefix, cost);
-    return al;
-  }
+  addAppFace(const std::string& label, TopologyNode i, const Name& prefix, uint64_t cost = 0);
 
-  /** \brief registers a prefix on a face
-   *  \tparam F either DummyFace or DummyLocalFace
+  /** \brief registers a prefix on a forwarder face
    */
-  template<typename F>
   void
-  registerPrefix(TopologyNode i, shared_ptr<F> face, const Name& prefix, uint64_t cost = 0)
-  {
-    Forwarder& forwarder = this->getForwarder(i);
-    Fib& fib = forwarder.getFib();
-    shared_ptr<fib::Entry> fibEntry = fib.insert(prefix).first;
-    fibEntry->addNextHop(face, cost);
-  }
+  registerPrefix(TopologyNode i, const Face& face, const Name& prefix, uint64_t cost = 0);
 
   /** \brief creates a producer application that answers every Interest with Data of same Name
    */
   void
-  addEchoProducer(DummyClientFace& face, const Name& prefix = "/")
-  {
-    face.setInterestFilter(prefix,
-        [&face] (const ndn::InterestFilter&, const Interest& interest) {
-          shared_ptr<Data> data = makeData(interest.getName());
-          face.put(*data);
-        });
-  }
+  addEchoProducer(ndn::Face& face, const Name& prefix = "/");
 
   /** \brief creates a consumer application that sends \p n Interests under \p prefix
    *         at \p interval fixed rate.
    */
   void
-  addIntervalConsumer(DummyClientFace& face, const Name& prefix,
-                      const time::nanoseconds& interval, size_t n)
-  {
-    Name name(prefix);
-    name.appendTimestamp();
-    shared_ptr<Interest> interest = makeInterest(name);
-    face.expressInterest(*interest, bind([]{}));
-
-    if (n > 1) {
-      scheduler::schedule(interval, bind(&TopologyTester::addIntervalConsumer, this,
-                                         ref(face), prefix, interval, n - 1));
-    }
-  }
+  addIntervalConsumer(ndn::Face& face, const Name& prefix,
+                      const time::nanoseconds& interval, size_t n);
 
 private:
   std::vector<unique_ptr<Forwarder>> m_forwarders;
+  std::vector<std::string> m_forwarderLabels;
+  std::vector<shared_ptr<TopologyLink>> m_links;
+  std::vector<shared_ptr<TopologyAppLink>> m_appLinks;
 };
 
 } // namespace tests
diff --git a/tests/daemon/mgmt/face-manager-process-config.t.cpp b/tests/daemon/mgmt/face-manager-process-config.t.cpp
index 9463ac4..5dedb91 100644
--- a/tests/daemon/mgmt/face-manager-process-config.t.cpp
+++ b/tests/daemon/mgmt/face-manager-process-config.t.cpp
@@ -279,8 +279,6 @@
   BOOST_CHECK_THROW(parseConfig(CONFIG, false), ConfigFile::Error);
 }
 
-
-
 BOOST_AUTO_TEST_CASE(ProcessSectionUdpUnknownOption)
 {
   const std::string CONFIG =
@@ -295,7 +293,6 @@
   BOOST_CHECK_THROW(parseConfig(CONFIG, false), ConfigFile::Error);
 }
 
-
 BOOST_AUTO_TEST_CASE(ProcessSectionUdpMulticastReinit)
 {
   const std::string CONFIG_WITH_MCAST =
@@ -317,7 +314,6 @@
                        "no UDP multicast faces are available");
     return;
   }
-  BOOST_CHECK_GT(factory->getMulticastFaces().size(), 0);
 
   const std::string CONFIG_WITHOUT_MCAST =
     "face_system\n"
@@ -328,6 +324,7 @@
     "  }\n"
     "}\n";
   BOOST_CHECK_NO_THROW(parseConfig(CONFIG_WITHOUT_MCAST, false));
+  BOOST_REQUIRE_NO_THROW(g_io.poll());
   BOOST_CHECK_EQUAL(factory->getMulticastFaces().size(), 0);
 }
 
diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp
index 7bd89fc..dd02bec 100644
--- a/tests/daemon/table/pit.t.cpp
+++ b/tests/daemon/table/pit.t.cpp
@@ -34,9 +34,12 @@
 
 using namespace nfd::tests;
 
-BOOST_FIXTURE_TEST_SUITE(TablePit, BaseFixture)
+BOOST_AUTO_TEST_SUITE(Table)
+BOOST_FIXTURE_TEST_SUITE(TestPit, BaseFixture)
 
-BOOST_AUTO_TEST_CASE(EntryInOutRecords)
+BOOST_AUTO_TEST_SUITE(PitEntry)
+
+BOOST_AUTO_TEST_CASE(InOutRecords)
 {
   shared_ptr<Face> face1 = make_shared<DummyFace>();
   shared_ptr<Face> face2 = make_shared<DummyFace>();
@@ -151,7 +154,7 @@
   BOOST_CHECK(entry.getOutRecord(*face2) == entry.getOutRecords().end());
 }
 
-BOOST_AUTO_TEST_CASE(EntryNonce)
+BOOST_AUTO_TEST_CASE(Nonce)
 {
   shared_ptr<Face> face1 = make_shared<DummyFace>();
   shared_ptr<Face> face2 = make_shared<DummyFace>();
@@ -210,7 +213,7 @@
   BOOST_CHECK_EQUAL(entry5.findNonce(19004, *face2), pit::DUPLICATE_NONCE_NONE);
 }
 
-BOOST_AUTO_TEST_CASE(EntryLifetime)
+BOOST_AUTO_TEST_CASE(Lifetime)
 {
   shared_ptr<Interest> interest = makeInterest("ndn:/7oIEurbgy6");
   // library uses -1 to indicate unset lifetime
@@ -226,7 +229,7 @@
   BOOST_CHECK_GT(outIt->getExpiry(), time::steady_clock::now());
 }
 
-BOOST_AUTO_TEST_CASE(EntryCanForwardTo)
+BOOST_AUTO_TEST_CASE(CanForwardTo)
 {
   shared_ptr<Interest> interest = makeInterest("ndn:/WDsuBLIMG");
   pit::Entry entry(*interest);
@@ -247,6 +250,37 @@
   BOOST_CHECK_EQUAL(entry.canForwardTo(*face2), true);
 }
 
+BOOST_AUTO_TEST_CASE(OutRecordNack)
+{
+  shared_ptr<Face> face1 = make_shared<DummyFace>();
+  pit::OutRecord outR(face1);
+  BOOST_CHECK(outR.getIncomingNack() == nullptr);
+
+  shared_ptr<Interest> interest1 = makeInterest("ndn:/uWiapGjYL");
+  interest1->setNonce(165);
+  outR.update(*interest1);
+  BOOST_CHECK(outR.getIncomingNack() == nullptr);
+
+  shared_ptr<Interest> interest2 = makeInterest("ndn:/uWiapGjYL");
+  interest2->setNonce(996);
+  lp::Nack nack2(*interest2);
+  nack2.setReason(lp::NackReason::CONGESTION);
+  BOOST_CHECK_EQUAL(outR.setIncomingNack(nack2), false);
+  BOOST_CHECK(outR.getIncomingNack() == nullptr);
+
+  lp::Nack nack1(*interest1);
+  nack1.setReason(lp::NackReason::DUPLICATE);
+  BOOST_CHECK_EQUAL(outR.setIncomingNack(nack1), true);
+  BOOST_REQUIRE(outR.getIncomingNack() != nullptr);
+  BOOST_CHECK_EQUAL(outR.getIncomingNack()->getReason(), lp::NackReason::DUPLICATE);
+
+  outR.clearIncomingNack();
+  BOOST_CHECK(outR.getIncomingNack() == nullptr);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // PitEntry
+
+
 BOOST_AUTO_TEST_CASE(Insert)
 {
   Name name1("ndn:/5vzBNnMst");
@@ -368,18 +402,21 @@
   insertResult = pit.insert(*interest);
   BOOST_CHECK_EQUAL(insertResult.second, true);
   BOOST_CHECK_EQUAL(pit.size(), 1);
+  BOOST_CHECK(pit.find(*interest) != nullptr);
 
   insertResult = pit.insert(*interest);
   BOOST_CHECK_EQUAL(insertResult.second, false);
   BOOST_CHECK_EQUAL(pit.size(), 1);
+  BOOST_CHECK(pit.find(*interest) != nullptr);
 
   pit.erase(insertResult.first);
   BOOST_CHECK_EQUAL(pit.size(), 0);
+  BOOST_CHECK(pit.find(*interest) == nullptr);
 
   insertResult = pit.insert(*interest);
   BOOST_CHECK_EQUAL(insertResult.second, true);
   BOOST_CHECK_EQUAL(pit.size(), 1);
-
+  BOOST_CHECK(pit.find(*interest) != nullptr);
 }
 
 BOOST_AUTO_TEST_CASE(EraseNameTreeEntry)
@@ -496,6 +533,7 @@
 }
 
 BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace tests
 } // namespace pit
diff --git a/tests/identity-management-fixture.hpp b/tests/identity-management-fixture.hpp
index 265c3bc..9774363 100644
--- a/tests/identity-management-fixture.hpp
+++ b/tests/identity-management-fixture.hpp
@@ -19,6 +19,9 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
+#ifndef NFD_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
+#define NFD_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
+
 #include "tests/test-common.hpp"
 #include <ndn-cxx/security/key-chain.hpp>
 #include <vector>
@@ -35,7 +38,7 @@
  * Identities added via addIdentity method are automatically deleted
  * during test teardown.
  */
-class IdentityManagementFixture : public nfd::tests::BaseFixture
+class IdentityManagementFixture : public virtual BaseFixture
 {
 public:
   IdentityManagementFixture();
@@ -54,3 +57,5 @@
 
 } // namespace tests
 } // namespace nfd
+
+#endif // NFD_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 784ee2d..f5a309a 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -1,12 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014,  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
+ * 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.
@@ -62,7 +62,7 @@
 
 /** \brief a base test fixture that overrides steady clock and system clock
  */
-class UnitTestTimeFixture : public BaseFixture
+class UnitTestTimeFixture : public virtual BaseFixture
 {
 protected:
   UnitTestTimeFixture()
@@ -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
 
