face: Rename all ChannelFactories to protocol Factories

Base class is ProtocolFactory and implementations are TcpFactory,
UnixStreamFactory, EthernetFactory.

Since Factories are doing more than just creating channels (some can
create faces directly), more general name is more appropriate.

Change-Id: I3d6c2460a1b29e244f8462453720f4e7785893ca
diff --git a/daemon/face/unix-stream-factory.hpp b/daemon/face/unix-stream-factory.hpp
new file mode 100644
index 0000000..4b26a3f
--- /dev/null
+++ b/daemon/face/unix-stream-factory.hpp
@@ -0,0 +1,60 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NFD_FACE_UNIX_STREAM_FACTORY_HPP
+#define NFD_FACE_UNIX_STREAM_FACTORY_HPP
+
+#include "protocol-factory.hpp"
+#include "unix-stream-channel.hpp"
+
+namespace nfd {
+
+class UnixStreamFactory : public ProtocolFactory
+{
+public:
+  /**
+   * \brief Exception of UnixStreamFactory
+   */
+  struct Error : public ProtocolFactory::Error
+  {
+    Error(const std::string& what) : ProtocolFactory::Error(what) {}
+  };
+
+  /**
+   * \brief Create stream-oriented Unix channel using specified socket path
+   *
+   * If this method is called twice with the same path, only one channel
+   * will be created.  The second call will just retrieve the existing
+   * channel.
+   *
+   * \returns always a valid pointer to a UnixStreamChannel object,
+   *          an exception will be thrown if the channel cannot be created.
+   *
+   * \throws UnixStreamFactory::Error
+   */
+  shared_ptr<UnixStreamChannel>
+  create(const std::string& unixSocketPath);
+
+private:
+  /**
+   * \brief Look up UnixStreamChannel using specified endpoint
+   *
+   * \returns shared pointer to the existing UnixStreamChannel object
+   *          or empty shared pointer when such channel does not exist
+   *
+   * \throws never
+   */
+  shared_ptr<UnixStreamChannel>
+  find(const unix_stream::Endpoint& endpoint);
+
+private:
+  typedef std::map< unix_stream::Endpoint, shared_ptr<UnixStreamChannel> > ChannelMap;
+  ChannelMap m_channels;
+};
+
+} // namespace nfd
+
+#endif // NFD_FACE_UNIX_STREAM_FACTORY_HPP