face: Adding new 'createFace' method in all Factories

This method accepts parsed URI object and attempts to create Face on the
right channel (e.g., if hostname in URI resolved to IPv6, IPv6 TCP channel
will be used).

Factories that do not support 'createFace' operation will throw an exception.

As of this commit, *Factory::create methods are renamed to more explicit
*Factory::createChannel, and *Factory::connect to *Factory::createFace.
All other Factory-specific methods should denote what exactly is
created: channel, face, or multicast face.

Change-Id: I6396dc84c4cd8bbcdde9f55cfac90635d99e93e9
Refs: #1195
diff --git a/daemon/face/tcp-factory.hpp b/daemon/face/tcp-factory.hpp
index fbda795..1886f24 100644
--- a/daemon/face/tcp-factory.hpp
+++ b/daemon/face/tcp-factory.hpp
@@ -23,6 +23,9 @@
     Error(const std::string& what) : ProtocolFactory::Error(what) {}
   };
 
+  explicit
+  TcpFactory(const std::string& defaultPort = "6363");
+
   /**
    * \brief Create TCP-based channel using tcp::Endpoint
    *
@@ -41,7 +44,7 @@
    *      for details on ways to create tcp::Endpoint
    */
   shared_ptr<TcpChannel>
-  create(const tcp::Endpoint& localEndpoint);
+  createChannel(const tcp::Endpoint& localEndpoint);
 
   /**
    * \brief Create TCP-based channel using specified host and port number
@@ -54,7 +57,14 @@
    * \throws TcpFactory::Error
    */
   shared_ptr<TcpChannel>
-  create(const std::string& localHost, const std::string& localPort);
+  createChannel(const std::string& localHost, const std::string& localPort);
+
+  // from Factory
+
+  virtual void
+  createFace(const FaceUri& uri,
+             const FaceCreatedCallback& onCreated,
+             const FaceConnectFailedCallback& onConnectFailed);
 
 private:
   /**
@@ -66,11 +76,18 @@
    * \throws never
    */
   shared_ptr<TcpChannel>
-  find(const tcp::Endpoint& localEndpoint);
+  findChannel(const tcp::Endpoint& localEndpoint);
+
+  void
+  continueCreateFaceAfterResolve(const tcp::Endpoint& endpoint,
+                                 const FaceCreatedCallback& onCreated,
+                                 const FaceConnectFailedCallback& onConnectFailed);
 
 private:
   typedef std::map< tcp::Endpoint, shared_ptr<TcpChannel> > ChannelMap;
   ChannelMap m_channels;
+
+  std::string m_defaultPort;
 };
 
 } // namespace nfd