face: face refactoring completion

* delete old Face
* rename LpFace as Face
* eliminate LpFaceWrapper and use new Face

refs #3172

Change-Id: I08c3a5dfb4cc1b9834b30cccd9ab634535d0608c
diff --git a/daemon/face/face.cpp b/daemon/face/face.cpp
index 5367d39..69d32c1 100644
--- a/daemon/face/face.cpp
+++ b/daemon/face/face.cpp
@@ -25,73 +25,31 @@
 
 #include "face.hpp"
 
-#include <ndn-cxx/management/nfd-face-event-notification.hpp>
-
 namespace nfd {
+namespace face {
 
-Face::Face(const FaceUri& remoteUri, const FaceUri& localUri, bool isLocal, bool isMultiAccess)
-  : m_id(INVALID_FACEID)
-  , m_countersWrapper(m_counters)
-  , m_remoteUri(remoteUri)
-  , m_localUri(localUri)
-  , m_isLocal(isLocal)
-  , m_persistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
-  , m_isMultiAccess(isMultiAccess)
-  , m_isFailed(false)
+Face::Face(unique_ptr<LinkService> service, unique_ptr<Transport> transport)
+  : afterReceiveInterest(service->afterReceiveInterest)
+  , afterReceiveData(service->afterReceiveData)
+  , afterReceiveNack(service->afterReceiveNack)
+  , afterStateChange(transport->afterStateChange)
+  , m_id(INVALID_FACEID)
+  , m_service(std::move(service))
+  , m_transport(std::move(transport))
+  , m_counters(m_service->getCounters(), m_transport->getCounters())
 {
-  onReceiveInterest.connect([this] (const ndn::Interest&) { ++m_counters.getNInInterests(); });
-  onReceiveData    .connect([this] (const ndn::Data&)     { ++m_counters.getNInDatas(); });
-  onSendInterest   .connect([this] (const ndn::Interest&) { ++m_counters.getNOutInterests(); });
-  onSendData       .connect([this] (const ndn::Data&)     { ++m_counters.getNOutDatas(); });
+  m_service->setFaceAndTransport(*this, *m_transport);
+  m_transport->setFaceAndLinkService(*this, *m_service);
 }
 
-Face::~Face()
+std::ostream&
+operator<<(std::ostream& os, const FaceLogHelper<Face>& flh)
 {
+  const Face& face = flh.obj;
+  os << "[id=" << face.getId() << ",local=" << face.getLocalUri() <<
+        ",remote=" << face.getRemoteUri() << "] ";
+  return os;
 }
 
-bool
-Face::isUp() const
-{
-  return true;
-}
-
-bool
-Face::decodeAndDispatchInput(const Block& element)
-{
-  try {
-    /// \todo Ensure lazy field decoding process
-
-    if (element.type() == tlv::Interest)
-      {
-        shared_ptr<Interest> i = make_shared<Interest>();
-        i->wireDecode(element);
-        this->onReceiveInterest(*i);
-      }
-    else if (element.type() == tlv::Data)
-      {
-        shared_ptr<Data> d = make_shared<Data>();
-        d->wireDecode(element);
-        this->onReceiveData(*d);
-      }
-    else
-      return false;
-
-    return true;
-  }
-  catch (const tlv::Error&) {
-    return false;
-  }
-}
-
-void
-Face::fail(const std::string& reason)
-{
-  if (m_isFailed) {
-    return;
-  }
-
-  m_isFailed = true;
-  this->onFail(reason);
-}
-
+} // namespace face
 } // namespace nfd