face: group parameters to createFace and connect into a common structure

Change-Id: Icb6857602ed7e897be6c5334b05be23793d133bb
diff --git a/daemon/face/channel.hpp b/daemon/face/channel.hpp
index a999b72..1a5ed90 100644
--- a/daemon/face/channel.hpp
+++ b/daemon/face/channel.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -32,16 +32,14 @@
 namespace nfd {
 namespace face {
 
-class Face;
-
 /** \brief Prototype for the callback that is invoked when a face is created
  *         (in response to an incoming connection or after a connection is established)
  */
-typedef function<void(const shared_ptr<Face>& newFace)> FaceCreatedCallback;
+using FaceCreatedCallback = function<void(const shared_ptr<Face>& face)>;
 
 /** \brief Prototype for the callback that is invoked when a face fails to be created
  */
-typedef function<void(uint32_t status, const std::string& reason)> FaceCreationFailedCallback;
+using FaceCreationFailedCallback = function<void(uint32_t status, const std::string& reason)>;
 
 /** \brief represent a channel that communicates on a local endpoint
  *  \sa FaceSystem
@@ -79,6 +77,28 @@
   FaceUri m_uri;
 };
 
+/** \brief Parameters used to set Transport properties or LinkService options on a newly created face
+ *
+ *  Parameters are passed as a struct rather than individually, so that a future change in the list
+ *  of parameters does not require an update to the method signature in all subclasses.
+ */
+class FaceParams
+{
+public:
+  // get rid of this constructor and use aggregate init + NSDMIs when we switch to C++14
+  FaceParams() noexcept
+    : persistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
+    , wantLocalFields(false)
+    , wantLpReliability(false)
+  {
+  }
+
+public:
+  ndn::nfd::FacePersistency persistency;
+  bool wantLocalFields;
+  bool wantLpReliability;
+};
+
 /** \brief invokes a callback when the face is closed
  *  \param face the face
  *  \param f the callback to be invoked when the face enters CLOSED state
diff --git a/daemon/face/ethernet-channel.cpp b/daemon/face/ethernet-channel.cpp
index a4d1907..cf60527 100644
--- a/daemon/face/ethernet-channel.cpp
+++ b/daemon/face/ethernet-channel.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017,  Regents of the University of California,
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -54,14 +54,13 @@
 
 void
 EthernetChannel::connect(const ethernet::Address& remoteEndpoint,
-                         ndn::nfd::FacePersistency persistency,
-                         bool wantLpReliability,
+                         const FaceParams& params,
                          const FaceCreatedCallback& onFaceCreated,
                          const FaceCreationFailedCallback& onConnectFailed)
 {
   shared_ptr<Face> face;
   try {
-    face = createFace(remoteEndpoint, persistency, wantLpReliability).second;
+    face = createFace(remoteEndpoint, params).second;
   }
   catch (const boost::system::system_error& e) {
     NFD_LOG_CHAN_DEBUG("Face creation for " << remoteEndpoint << " failed: " << e.what());
@@ -166,7 +165,9 @@
   bool isCreated = false;
   shared_ptr<Face> face;
   try {
-    std::tie(isCreated, face) = createFace(sender, ndn::nfd::FACE_PERSISTENCY_ON_DEMAND, false);
+    FaceParams params;
+    params.persistency = ndn::nfd::FACE_PERSISTENCY_ON_DEMAND;
+    std::tie(isCreated, face) = createFace(sender, params);
   }
   catch (const EthernetTransport::Error& e) {
     NFD_LOG_CHAN_DEBUG("Face creation for " << sender << " failed: " << e.what());
@@ -187,8 +188,7 @@
 
 std::pair<bool, shared_ptr<Face>>
 EthernetChannel::createFace(const ethernet::Address& remoteEndpoint,
-                            ndn::nfd::FacePersistency persistency,
-                            bool wantLpReliability)
+                            const FaceParams& params)
 {
   auto it = m_channelFaces.find(remoteEndpoint);
   if (it != m_channelFaces.end()) {
@@ -201,11 +201,11 @@
   GenericLinkService::Options options;
   options.allowFragmentation = true;
   options.allowReassembly = true;
-  options.reliabilityOptions.isEnabled = wantLpReliability;
+  options.reliabilityOptions.isEnabled = params.wantLpReliability;
 
   auto linkService = make_unique<GenericLinkService>(options);
   auto transport = make_unique<UnicastEthernetTransport>(*m_localEndpoint, remoteEndpoint,
-                                                         persistency, m_idleFaceTimeout);
+                                                         params.persistency, m_idleFaceTimeout);
   auto face = make_shared<Face>(std::move(linkService), std::move(transport));
 
   m_channelFaces[remoteEndpoint] = face;
diff --git a/daemon/face/ethernet-channel.hpp b/daemon/face/ethernet-channel.hpp
index 5847af5..36d32be 100644
--- a/daemon/face/ethernet-channel.hpp
+++ b/daemon/face/ethernet-channel.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017,  Regents of the University of California,
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -76,17 +76,10 @@
 
   /**
    * \brief Create a unicast Ethernet face toward \p remoteEndpoint
-   *
-   * \param remoteEndpoint The remote Ethernet endpoint
-   * \param persistency Persistency of the newly created face
-   * \param wantLpReliability whether LpReliability should be enabled
-   * \param onFaceCreated Callback to notify successful creation of the face
-   * \param onConnectFailed Callback to notify errors
    */
   void
   connect(const ethernet::Address& remoteEndpoint,
-          ndn::nfd::FacePersistency persistency,
-          bool wantLpReliability,
+          const FaceParams& params,
           const FaceCreatedCallback& onFaceCreated,
           const FaceCreationFailedCallback& onConnectFailed);
 
@@ -124,8 +117,7 @@
 
   std::pair<bool, shared_ptr<Face>>
   createFace(const ethernet::Address& remoteEndpoint,
-             ndn::nfd::FacePersistency persistency,
-             bool wantLpReliability);
+             const FaceParams& params);
 
   void
   updateFilter();
diff --git a/daemon/face/ethernet-factory.cpp b/daemon/face/ethernet-factory.cpp
index 36f7c45..2c6c39c 100644
--- a/daemon/face/ethernet-factory.cpp
+++ b/daemon/face/ethernet-factory.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017,  Regents of the University of California,
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,6 +26,7 @@
 #include "ethernet-factory.hpp"
 #include "generic-link-service.hpp"
 #include "multicast-ethernet-transport.hpp"
+
 #include <boost/range/adaptors.hpp>
 #include <boost/range/algorithm/copy.hpp>
 
@@ -165,27 +166,27 @@
 }
 
 void
-EthernetFactory::createFace(const CreateFaceParams& params,
+EthernetFactory::createFace(const CreateFaceRequest& req,
                             const FaceCreatedCallback& onCreated,
                             const FaceCreationFailedCallback& onFailure)
 {
-  BOOST_ASSERT(params.remoteUri.isCanonical());
+  BOOST_ASSERT(req.remoteUri.isCanonical());
 
-  if (!params.localUri || params.localUri->getScheme() != "dev") {
+  if (!req.localUri || req.localUri->getScheme() != "dev") {
     NFD_LOG_TRACE("Cannot create unicast Ethernet face without dev:// LocalUri");
     onFailure(406, "Creation of unicast Ethernet faces requires a LocalUri with dev:// scheme");
     return;
   }
-  BOOST_ASSERT(params.localUri->isCanonical());
+  BOOST_ASSERT(req.localUri->isCanonical());
 
-  if (params.persistency == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) {
+  if (req.params.persistency == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) {
     NFD_LOG_TRACE("createFace does not support FACE_PERSISTENCY_ON_DEMAND");
     onFailure(406, "Outgoing Ethernet faces do not support on-demand persistency");
     return;
   }
 
-  ethernet::Address remoteEndpoint(ethernet::Address::fromString(params.remoteUri.getHost()));
-  std::string localEndpoint(params.localUri->getHost());
+  ethernet::Address remoteEndpoint(ethernet::Address::fromString(req.remoteUri.getHost()));
+  std::string localEndpoint(req.localUri->getHost());
 
   if (remoteEndpoint.isMulticast()) {
     NFD_LOG_TRACE("createFace does not support multicast faces");
@@ -193,7 +194,7 @@
     return;
   }
 
-  if (params.wantLocalFields) {
+  if (req.params.wantLocalFields) {
     // Ethernet faces are never local
     NFD_LOG_TRACE("createFace cannot create non-local face with local fields enabled");
     onFailure(406, "Local fields can only be enabled on faces with local scope");
@@ -202,8 +203,7 @@
 
   for (const auto& i : m_channels) {
     if (i.first == localEndpoint) {
-      i.second->connect(remoteEndpoint, params.persistency, params.wantLpReliability,
-                        onCreated, onFailure);
+      i.second->connect(remoteEndpoint, req.params, onCreated, onFailure);
       return;
     }
   }
diff --git a/daemon/face/ethernet-factory.hpp b/daemon/face/ethernet-factory.hpp
index 7f53cff..11dac9c 100644
--- a/daemon/face/ethernet-factory.hpp
+++ b/daemon/face/ethernet-factory.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017,  Regents of the University of California,
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -50,7 +50,7 @@
                 FaceSystem::ConfigContext& context) override;
 
   void
-  createFace(const CreateFaceParams& params,
+  createFace(const CreateFaceRequest& req,
              const FaceCreatedCallback& onCreated,
              const FaceCreationFailedCallback& onFailure) override;
 
@@ -109,7 +109,7 @@
   {
     bool isEnabled = false;
     bool wantListen = false;
-    time::nanoseconds idleTimeout = time::seconds(600);
+    time::nanoseconds idleTimeout = 10_min;
   };
   UnicastConfig m_unicastConfig;
 
diff --git a/daemon/face/protocol-factory.hpp b/daemon/face/protocol-factory.hpp
index e0c62a1..fe3f1f8 100644
--- a/daemon/face/protocol-factory.hpp
+++ b/daemon/face/protocol-factory.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017,  Regents of the University of California,
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -129,29 +129,27 @@
     return providedSchemes;
   }
 
-  /** \brief Parameters to ProtocolFactory::createFace
+  /** \brief Encapsulates a face creation request and all its parameters
    *
    *  Parameters are passed as a struct rather than individually, so that a future change in the list
    *  of parameters does not require an update to the method signature in all subclasses.
    */
-  struct CreateFaceParams
+  struct CreateFaceRequest
   {
     FaceUri remoteUri;
     ndn::optional<FaceUri> localUri;
-    ndn::nfd::FacePersistency persistency;
-    bool wantLocalFields;
-    bool wantLpReliability;
+    FaceParams params;
   };
 
-  /** \brief Try to create face using the supplied parameters
+  /** \brief Try to create a unicast face using the supplied parameters
    *
-   * \param params parameters to create face with
-   * \param onCreated callback if face creation succeeds or face already exists;
-   *                  persistency and local fields settings are not updated on an existing face
+   * \param req request object containing the face creation parameters
+   * \param onCreated callback if face creation succeeds or face already exists; the settings
+   *                  of an existing face are not updated if they differ from the request
    * \param onFailure callback if face creation fails
    */
   virtual void
-  createFace(const CreateFaceParams& params,
+  createFace(const CreateFaceRequest& req,
              const FaceCreatedCallback& onCreated,
              const FaceCreationFailedCallback& onFailure) = 0;
 
@@ -180,7 +178,6 @@
 
 protected:
   std::set<std::string> providedSchemes; ///< FaceUri schemes provided by this ProtocolFactory
-
   FaceCreatedCallback addFace; ///< callback when a new face is created
 
   /** \brief NetworkMonitor for listing available network interfaces and monitoring their changes
diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp
index 1dee521..b6f434d 100644
--- a/daemon/face/tcp-channel.cpp
+++ b/daemon/face/tcp-channel.cpp
@@ -69,9 +69,7 @@
 
 void
 TcpChannel::connect(const tcp::Endpoint& remoteEndpoint,
-                    ndn::nfd::FacePersistency persistency,
-                    bool wantLocalFields,
-                    bool wantLpReliability,
+                    const FaceParams& params,
                     const FaceCreatedCallback& onFaceCreated,
                     const FaceCreationFailedCallback& onConnectFailed,
                     time::nanoseconds timeout)
@@ -91,17 +89,12 @@
   clientSocket->async_connect(remoteEndpoint,
                               bind(&TcpChannel::handleConnect, this,
                                    boost::asio::placeholders::error, remoteEndpoint, clientSocket,
-                                   // Creating a parameters struct works around limit on number of
-                                   // parameters to bind
-                                   ConnectParams{persistency, wantLocalFields, wantLpReliability},
-                                   timeoutEvent, onFaceCreated, onConnectFailed));
+                                   params, timeoutEvent, onFaceCreated, onConnectFailed));
 }
 
 void
 TcpChannel::createFace(ip::tcp::socket&& socket,
-                       ndn::nfd::FacePersistency persistency,
-                       bool wantLocalFields,
-                       bool wantLpReliability,
+                       const FaceParams& params,
                        const FaceCreatedCallback& onFaceCreated)
 {
   shared_ptr<Face> face;
@@ -110,12 +103,12 @@
   auto it = m_channelFaces.find(remoteEndpoint);
   if (it == m_channelFaces.end()) {
     GenericLinkService::Options options;
-    options.allowLocalFields = wantLocalFields;
-    options.reliabilityOptions.isEnabled = wantLpReliability;
+    options.allowLocalFields = params.wantLocalFields;
+    options.reliabilityOptions.isEnabled = params.wantLpReliability;
     options.allowCongestionMarking = m_wantCongestionMarking;
     auto linkService = make_unique<GenericLinkService>(options);
 
-    auto transport = make_unique<TcpTransport>(std::move(socket), persistency);
+    auto transport = make_unique<TcpTransport>(std::move(socket), params.persistency);
     face = make_shared<Face>(std::move(linkService), std::move(transport));
 
     m_channelFaces[remoteEndpoint] = face;
@@ -160,7 +153,10 @@
   }
 
   NFD_LOG_CHAN_TRACE("Incoming connection from " << m_socket.remote_endpoint());
-  createFace(std::move(m_socket), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND, false, false, onFaceCreated);
+
+  FaceParams params;
+  params.persistency = ndn::nfd::FACE_PERSISTENCY_ON_DEMAND;
+  createFace(std::move(m_socket), params, onFaceCreated);
 
   // prepare accepting the next connection
   accept(onFaceCreated, onAcceptFailed);
@@ -170,7 +166,7 @@
 TcpChannel::handleConnect(const boost::system::error_code& error,
                           const tcp::Endpoint& remoteEndpoint,
                           const shared_ptr<ip::tcp::socket>& socket,
-                          TcpChannel::ConnectParams params,
+                          const FaceParams& params,
                           const scheduler::EventId& connectTimeoutEvent,
                           const FaceCreatedCallback& onFaceCreated,
                           const FaceCreationFailedCallback& onConnectFailed)
@@ -195,8 +191,7 @@
   }
 
   NFD_LOG_CHAN_TRACE("Connected to " << socket->remote_endpoint());
-  createFace(std::move(*socket), params.persistency, params.wantLocalFields,
-             params.wantLpReliability, onFaceCreated);
+  createFace(std::move(*socket), params, onFaceCreated);
 }
 
 void
diff --git a/daemon/face/tcp-channel.hpp b/daemon/face/tcp-channel.hpp
index 1587b99..0f4c79a 100644
--- a/daemon/face/tcp-channel.hpp
+++ b/daemon/face/tcp-channel.hpp
@@ -86,27 +86,15 @@
    */
   void
   connect(const tcp::Endpoint& remoteEndpoint,
-          ndn::nfd::FacePersistency persistency,
-          bool wantLocalFields,
-          bool wantLpReliability,
+          const FaceParams& params,
           const FaceCreatedCallback& onFaceCreated,
           const FaceCreationFailedCallback& onConnectFailed,
-          time::nanoseconds timeout = time::seconds(4));
-
-private:
-  struct ConnectParams
-  {
-    ndn::nfd::FacePersistency persistency;
-    bool wantLocalFields;
-    bool wantLpReliability;
-  };
+          time::nanoseconds timeout = 8_s);
 
 private:
   void
   createFace(boost::asio::ip::tcp::socket&& socket,
-             ndn::nfd::FacePersistency persistency,
-             bool wantLocalFields,
-             bool wantLpReliability,
+             const FaceParams& params,
              const FaceCreatedCallback& onFaceCreated);
 
   void
@@ -122,7 +110,7 @@
   handleConnect(const boost::system::error_code& error,
                 const tcp::Endpoint& remoteEndpoint,
                 const shared_ptr<boost::asio::ip::tcp::socket>& socket,
-                ConnectParams params,
+                const FaceParams& params,
                 const scheduler::EventId& connectTimeoutEvent,
                 const FaceCreatedCallback& onFaceCreated,
                 const FaceCreationFailedCallback& onConnectFailed);
diff --git a/daemon/face/tcp-factory.cpp b/daemon/face/tcp-factory.cpp
index fae3c54..1477e09 100644
--- a/daemon/face/tcp-factory.cpp
+++ b/daemon/face/tcp-factory.cpp
@@ -129,31 +129,31 @@
 }
 
 void
-TcpFactory::createFace(const CreateFaceParams& params,
+TcpFactory::createFace(const CreateFaceRequest& req,
                        const FaceCreatedCallback& onCreated,
                        const FaceCreationFailedCallback& onFailure)
 {
-  BOOST_ASSERT(params.remoteUri.isCanonical());
+  BOOST_ASSERT(req.remoteUri.isCanonical());
 
-  if (params.localUri) {
+  if (req.localUri) {
     NFD_LOG_TRACE("Cannot create unicast TCP face with LocalUri");
     onFailure(406, "Unicast TCP faces cannot be created with a LocalUri");
     return;
   }
 
-  if (params.persistency == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) {
+  if (req.params.persistency == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) {
     NFD_LOG_TRACE("createFace does not support FACE_PERSISTENCY_ON_DEMAND");
     onFailure(406, "Outgoing TCP faces do not support on-demand persistency");
     return;
   }
 
-  tcp::Endpoint endpoint(ndn::ip::addressFromString(params.remoteUri.getHost()),
-                         boost::lexical_cast<uint16_t>(params.remoteUri.getPort()));
+  tcp::Endpoint endpoint(ndn::ip::addressFromString(req.remoteUri.getHost()),
+                         boost::lexical_cast<uint16_t>(req.remoteUri.getPort()));
 
   // a canonical tcp4/tcp6 FaceUri cannot have a multicast address
   BOOST_ASSERT(!endpoint.address().is_multicast());
 
-  if (params.wantLocalFields && !endpoint.address().is_loopback()) {
+  if (req.params.wantLocalFields && !endpoint.address().is_loopback()) {
     NFD_LOG_TRACE("createFace cannot create non-local face with local fields enabled");
     onFailure(406, "Local fields can only be enabled on faces with local scope");
     return;
@@ -163,8 +163,7 @@
   for (const auto& i : m_channels) {
     if ((i.first.address().is_v4() && endpoint.address().is_v4()) ||
         (i.first.address().is_v6() && endpoint.address().is_v6())) {
-      i.second->connect(endpoint, params.persistency, params.wantLocalFields,
-                        params.wantLpReliability, onCreated, onFailure);
+      i.second->connect(endpoint, req.params, onCreated, onFailure);
       return;
     }
   }
diff --git a/daemon/face/tcp-factory.hpp b/daemon/face/tcp-factory.hpp
index 7fbac39..874dd8c 100644
--- a/daemon/face/tcp-factory.hpp
+++ b/daemon/face/tcp-factory.hpp
@@ -50,7 +50,7 @@
                 FaceSystem::ConfigContext& context) override;
 
   void
-  createFace(const CreateFaceParams& params,
+  createFace(const CreateFaceRequest& req,
              const FaceCreatedCallback& onCreated,
              const FaceCreationFailedCallback& onFailure) override;
 
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index 3f3271e..624b9cd 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -49,14 +49,13 @@
 
 void
 UdpChannel::connect(const udp::Endpoint& remoteEndpoint,
-                    ndn::nfd::FacePersistency persistency,
-                    bool wantLpReliability,
+                    const FaceParams& params,
                     const FaceCreatedCallback& onFaceCreated,
                     const FaceCreationFailedCallback& onConnectFailed)
 {
   shared_ptr<Face> face;
   try {
-    face = createFace(remoteEndpoint, persistency, wantLpReliability).second;
+    face = createFace(remoteEndpoint, params).second;
   }
   catch (const boost::system::system_error& e) {
     NFD_LOG_CHAN_DEBUG("Face creation for " << remoteEndpoint << " failed: " << e.what());
@@ -121,8 +120,9 @@
   bool isCreated = false;
   shared_ptr<Face> face;
   try {
-    std::tie(isCreated, face) = createFace(m_remoteEndpoint, ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
-                                           false);
+    FaceParams params;
+    params.persistency = ndn::nfd::FACE_PERSISTENCY_ON_DEMAND;
+    std::tie(isCreated, face) = createFace(m_remoteEndpoint, params);
   }
   catch (const boost::system::system_error& e) {
     NFD_LOG_CHAN_DEBUG("Face creation for " << m_remoteEndpoint << " failed: " << e.what());
@@ -145,8 +145,7 @@
 
 std::pair<bool, shared_ptr<Face>>
 UdpChannel::createFace(const udp::Endpoint& remoteEndpoint,
-                       ndn::nfd::FacePersistency persistency,
-                       bool wantLpReliability)
+                       const FaceParams& params)
 {
   auto it = m_channelFaces.find(remoteEndpoint);
   if (it != m_channelFaces.end()) {
@@ -162,10 +161,10 @@
   socket.connect(remoteEndpoint);
 
   GenericLinkService::Options options;
-  options.reliabilityOptions.isEnabled = wantLpReliability;
+  options.reliabilityOptions.isEnabled = params.wantLpReliability;
   options.allowCongestionMarking = m_wantCongestionMarking;
   auto linkService = make_unique<GenericLinkService>(options);
-  auto transport = make_unique<UnicastUdpTransport>(std::move(socket), persistency, m_idleFaceTimeout);
+  auto transport = make_unique<UnicastUdpTransport>(std::move(socket), params.persistency, m_idleFaceTimeout);
   auto face = make_shared<Face>(std::move(linkService), std::move(transport));
 
   m_channelFaces[remoteEndpoint] = face;
diff --git a/daemon/face/udp-channel.hpp b/daemon/face/udp-channel.hpp
index 4441370..89540de 100644
--- a/daemon/face/udp-channel.hpp
+++ b/daemon/face/udp-channel.hpp
@@ -65,17 +65,10 @@
 
   /**
    * \brief Create a unicast UDP face toward \p remoteEndpoint
-   *
-   * \param remoteEndpoint The remote UDP endpoint
-   * \param persistency Persistency of the newly created face
-   * \param wantLpReliability whether LpReliability should be enabled
-   * \param onFaceCreated Callback to notify successful creation of the face
-   * \param onConnectFailed Callback to notify errors
    */
   void
   connect(const udp::Endpoint& remoteEndpoint,
-          ndn::nfd::FacePersistency persistency,
-          bool wantLpReliability,
+          const FaceParams& params,
           const FaceCreatedCallback& onFaceCreated,
           const FaceCreationFailedCallback& onConnectFailed);
 
@@ -111,8 +104,7 @@
 
   std::pair<bool, shared_ptr<Face>>
   createFace(const udp::Endpoint& remoteEndpoint,
-             ndn::nfd::FacePersistency persistency,
-             bool wantLpReliability);
+             const FaceParams& params);
 
 private:
   const udp::Endpoint m_localEndpoint;
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index 0a377ab..74b6974 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.cpp
@@ -231,26 +231,26 @@
 }
 
 void
-UdpFactory::createFace(const CreateFaceParams& params,
+UdpFactory::createFace(const CreateFaceRequest& req,
                        const FaceCreatedCallback& onCreated,
                        const FaceCreationFailedCallback& onFailure)
 {
-  BOOST_ASSERT(params.remoteUri.isCanonical());
+  BOOST_ASSERT(req.remoteUri.isCanonical());
 
-  if (params.localUri) {
+  if (req.localUri) {
     NFD_LOG_TRACE("Cannot create unicast UDP face with LocalUri");
     onFailure(406, "Unicast UDP faces cannot be created with a LocalUri");
     return;
   }
 
-  if (params.persistency == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) {
+  if (req.params.persistency == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) {
     NFD_LOG_TRACE("createFace does not support FACE_PERSISTENCY_ON_DEMAND");
     onFailure(406, "Outgoing UDP faces do not support on-demand persistency");
     return;
   }
 
-  udp::Endpoint endpoint(ndn::ip::addressFromString(params.remoteUri.getHost()),
-                         boost::lexical_cast<uint16_t>(params.remoteUri.getPort()));
+  udp::Endpoint endpoint(ndn::ip::addressFromString(req.remoteUri.getHost()),
+                         boost::lexical_cast<uint16_t>(req.remoteUri.getPort()));
 
   if (endpoint.address().is_multicast()) {
     NFD_LOG_TRACE("createFace does not support multicast faces");
@@ -258,7 +258,7 @@
     return;
   }
 
-  if (params.wantLocalFields) {
+  if (req.params.wantLocalFields) {
     // UDP faces are never local
     NFD_LOG_TRACE("createFace cannot create non-local face with local fields enabled");
     onFailure(406, "Local fields can only be enabled on faces with local scope");
@@ -269,8 +269,7 @@
   for (const auto& i : m_channels) {
     if ((i.first.address().is_v4() && endpoint.address().is_v4()) ||
         (i.first.address().is_v6() && endpoint.address().is_v6())) {
-      i.second->connect(endpoint, params.persistency, params.wantLpReliability,
-                        onCreated, onFailure);
+      i.second->connect(endpoint, req.params, onCreated, onFailure);
       return;
     }
   }
diff --git a/daemon/face/udp-factory.hpp b/daemon/face/udp-factory.hpp
index 62f59ee..9fccdbb 100644
--- a/daemon/face/udp-factory.hpp
+++ b/daemon/face/udp-factory.hpp
@@ -66,7 +66,7 @@
                 FaceSystem::ConfigContext& context) override;
 
   void
-  createFace(const CreateFaceParams& params,
+  createFace(const CreateFaceRequest& req,
              const FaceCreatedCallback& onCreated,
              const FaceCreationFailedCallback& onFailure) override;
 
diff --git a/daemon/face/unix-stream-factory.cpp b/daemon/face/unix-stream-factory.cpp
index acbd543..439eff4 100644
--- a/daemon/face/unix-stream-factory.cpp
+++ b/daemon/face/unix-stream-factory.cpp
@@ -86,7 +86,7 @@
 }
 
 void
-UnixStreamFactory::createFace(const CreateFaceParams& params,
+UnixStreamFactory::createFace(const CreateFaceRequest& req,
                               const FaceCreatedCallback& onCreated,
                               const FaceCreationFailedCallback& onFailure)
 {
diff --git a/daemon/face/unix-stream-factory.hpp b/daemon/face/unix-stream-factory.hpp
index d87ffd1..de2391f 100644
--- a/daemon/face/unix-stream-factory.hpp
+++ b/daemon/face/unix-stream-factory.hpp
@@ -50,7 +50,7 @@
                 FaceSystem::ConfigContext& context) override;
 
   void
-  createFace(const CreateFaceParams& params,
+  createFace(const CreateFaceRequest& req,
              const FaceCreatedCallback& onCreated,
              const FaceCreationFailedCallback& onFailure) override;
 
diff --git a/daemon/face/websocket-channel.cpp b/daemon/face/websocket-channel.cpp
index 02ae079..d26a0b5 100644
--- a/daemon/face/websocket-channel.cpp
+++ b/daemon/face/websocket-channel.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -35,7 +35,7 @@
 
 WebSocketChannel::WebSocketChannel(const websocket::Endpoint& localEndpoint)
   : m_localEndpoint(localEndpoint)
-  , m_pingInterval(time::seconds(10))
+  , m_pingInterval(10_s)
 {
   setUri(FaceUri(m_localEndpoint, "ws"));
   NFD_LOG_CHAN_INFO("Creating channel");
diff --git a/daemon/face/websocket-factory.cpp b/daemon/face/websocket-factory.cpp
index e5317a5..c61d900 100644
--- a/daemon/face/websocket-factory.cpp
+++ b/daemon/face/websocket-factory.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017,  Regents of the University of California,
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -118,7 +118,7 @@
 }
 
 void
-WebSocketFactory::createFace(const CreateFaceParams& params,
+WebSocketFactory::createFace(const CreateFaceRequest& req,
                              const FaceCreatedCallback& onCreated,
                              const FaceCreationFailedCallback& onFailure)
 {
diff --git a/daemon/face/websocket-factory.hpp b/daemon/face/websocket-factory.hpp
index 21eb6fc..9c8639e 100644
--- a/daemon/face/websocket-factory.hpp
+++ b/daemon/face/websocket-factory.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017,  Regents of the University of California,
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -52,7 +52,7 @@
   /** \brief unicast face creation is not supported and will always fail
    */
   void
-  createFace(const CreateFaceParams& params,
+  createFace(const CreateFaceRequest& req,
              const FaceCreatedCallback& onCreated,
              const FaceCreationFailedCallback& onFailure) override;
 
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index 936b71e..7ddf6ea 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017,  Regents of the University of California,
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -115,14 +115,16 @@
     return;
   }
 
+  face::FaceParams faceParams;
+  faceParams.persistency = parameters.getFacePersistency();
+  faceParams.wantLocalFields = parameters.hasFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) &&
+                               parameters.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED);
+  faceParams.wantLpReliability = parameters.hasFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED) &&
+                                 parameters.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED);
   try {
-    factory->createFace({remoteUri, localUri, parameters.getFacePersistency(),
-        parameters.hasFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) &&
-        parameters.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED),
-        parameters.hasFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED) &&
-        parameters.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)},
-      bind(&FaceManager::afterCreateFaceSuccess, this, parameters, _1, done),
-      bind(&FaceManager::afterCreateFaceFailure, this, _1, _2, done));
+    factory->createFace({remoteUri, localUri, faceParams},
+                        bind(&FaceManager::afterCreateFaceSuccess, this, parameters, _1, done),
+                        bind(&FaceManager::afterCreateFaceFailure, this, _1, _2, done));
   }
   catch (const std::runtime_error& error) {
     NFD_LOG_ERROR("Face creation failed: " << error.what());