All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
unix-transport.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
7 #ifndef NDN_UDPTRANSPORT_HPP
8 #define NDN_UDPTRANSPORT_HPP
9 
10 #include "../common.hpp"
11 #include "transport.hpp"
12 #include "../util/config-file.hpp"
13 
14 // forward declaration
15 namespace boost { namespace asio { namespace local { class stream_protocol; } } }
16 
17 namespace ndn {
18 
19 // forward declaration
20 template<class T, class U>
21 class StreamTransportImpl;
22 
23 class UnixTransport : public Transport
24 {
25 public:
26 
33  UnixTransport(const std::string& unixSocket);
34 
36 
37  // from Transport
38  virtual void
39  connect(boost::asio::io_service& ioService,
40  const ReceiveCallback& receiveCallback);
41 
42  virtual void
43  close();
44 
45  virtual void
46  pause();
47 
48  virtual void
49  resume();
50 
51  virtual void
52  send(const Block& wire);
53 
54  virtual void
55  send(const Block& header, const Block& payload);
56 
63  static std::string
64  getDefaultSocketName(const ConfigFile& config);
65 
66 private:
67  std::string m_unixSocket;
68 
70  friend class StreamTransportImpl<UnixTransport, boost::asio::local::stream_protocol>;
71  ptr_lib::shared_ptr< Impl > m_impl;
72 };
73 
74 }
75 
76 #endif
ptr_lib::function< void(const Block &wire)> ReceiveCallback
Definition: transport.hpp:25
virtual void resume()
static std::string getDefaultSocketName(const ConfigFile &config)
Determine the default NFD unix socket.
virtual void close()
Close the connection.
virtual void pause()
Class representing wire element of the NDN packet.
Definition: block.hpp:26
virtual void send(const Block &wire)
Set data to the host.
UnixTransport(const std::string &unixSocket)
Create Unix transport based on the socket specified in a well-known configuration file or fallback to...
virtual void connect(boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback)
Connect transport.