All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
async-unix-transport.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
22 #ifndef NDN_ASYNC_UNIX_TRANSPORT_HPP
23 #define NDN_ASYNC_UNIX_TRANSPORT_HPP
24 
25 // Only compile if ndn-cpp-config.h defines NDN_CPP_HAVE_BOOST_ASIO.
26 #include "../ndn-cpp-config.h"
27 #ifdef NDN_CPP_HAVE_BOOST_ASIO
28 
29 #include <string>
30 #include <boost/asio.hpp>
31 #include "../common.hpp"
32 #include "transport.hpp"
33 
34 namespace ndn {
35 
36 template<class AsioProtocol> class AsyncSocketTransport;
37 
45 class AsyncUnixTransport : public Transport {
46 public:
51  class ConnectionInfo : public Transport::ConnectionInfo {
52  public:
57  ConnectionInfo(const char *filePath)
58  : filePath_(filePath)
59  {
60  }
61 
66  const std::string&
67  getFilePath() const { return filePath_; }
68 
69  virtual
70  ~ConnectionInfo();
71 
72  private:
73  std::string filePath_;
74  };
75 
82  AsyncUnixTransport(boost::asio::io_service& ioService);
83 
90  virtual bool
91  isLocal(const Transport::ConnectionInfo& connectionInfo);
92 
97  virtual bool
98  isAsync();
99 
110  virtual void
111  connect
112  (const Transport::ConnectionInfo& connectionInfo,
113  ElementListener& elementListener, const OnConnected& onConnected);
114 
122  virtual void
123  send(const uint8_t *data, size_t dataLength);
124 
128  virtual void
129  processEvents();
130 
131  virtual bool
132  getIsConnected();
133 
137  virtual void
138  close();
139 
140  virtual ~AsyncUnixTransport();
141 
142 private:
143  ptr_lib::shared_ptr<AsyncSocketTransport<boost::asio::local::stream_protocol> >
144  socketTransport_;
145 };
146 
147 }
148 
149 #endif // NDN_CPP_HAVE_BOOST_ASIO
150 
151 #endif