face: parse face_system.netdev_bound config section

refs #3521

Change-Id: I803a1651d5b44e021ec7bedb8001e216c849b9ab
diff --git a/daemon/face/protocol-factory.hpp b/daemon/face/protocol-factory.hpp
index 74dbde7..f3d7807 100644
--- a/daemon/face/protocol-factory.hpp
+++ b/daemon/face/protocol-factory.hpp
@@ -156,6 +156,18 @@
   virtual std::vector<shared_ptr<const Channel>>
   getChannels() const = 0;
 
+  /** \brief Create a netdev-bound face
+   *  \param remote remote FaceUri, must be canonical
+   *  \param netdev local network interface
+   *  \return new face
+   *  \throw Error cannot create a face using specified arguments
+   *  \note The caller must ensure there is no existing netdev-bound face with same remote FaceUri
+   *        on the same local network interface.
+   */
+  shared_ptr<Face>
+  createNetdevBoundFace(const FaceUri& remote,
+                        const shared_ptr<const ndn::net::NetworkInterface>& netdev);
+
 protected:
   explicit
   ProtocolFactory(const CtorParams& params);
@@ -169,6 +181,26 @@
     return channels;
   }
 
+private:
+  /** \brief Create a netdev-bound face
+   *  \sa createNetdevBoundFace
+   *
+   *  The base class implementation always throws Error indicating netdev-bound faces are not
+   *  supported.
+   *
+   *  A subclass that offers netdev-bound faces should override this method, and also expose
+   *  "scheme+dev" in providedSchemes. For example, UdpFactory should provide "udp4+dev" scheme,
+   *  in addition to "udp4" scheme.
+   *
+   *  The face should be constructed immediately. Face persistency shall be reported as PERMANENT.
+   *  Face state shall remain DOWN until underlying transport is connected. The face shall remain
+   *  open until after .close() is invoked, and survive all socket errors; in case the network
+   *  interface disappears, the face shall remain DOWN until .close() is invoked.
+   */
+  virtual shared_ptr<Face>
+  doCreateNetdevBoundFace(const FaceUri& remote,
+                          const shared_ptr<const ndn::net::NetworkInterface>& netif);
+
 private: // registry
   using CreateFunc = std::function<unique_ptr<ProtocolFactory>(const CtorParams&)>;
   using Registry = std::map<std::string, CreateFunc>; // indexed by factory id