19 #ifndef INCLUDE_RCF_UNIXLOCALSERVERTRANSPORT_HPP
20 #define INCLUDE_RCF_UNIXLOCALSERVERTRANSPORT_HPP
22 #if defined(BOOST_WINDOWS)
23 #error Unix domain sockets not supported on Windows.
26 #ifndef RCF_HAS_LOCAL_SOCKETS
27 #error Unix domain sockets not supported by this version of Boost.Asio.
30 #include <RCF/AsioServerTransport.hpp>
31 #include <RCF/Export.hpp>
35 using ASIO_NS::local::stream_protocol;
36 typedef stream_protocol::socket UnixLocalSocket;
37 typedef boost::shared_ptr<UnixLocalSocket> UnixLocalSocketPtr;
39 class UnixLocalServerTransport;
41 class RCF_EXPORT UnixLocalSessionState :
public AsioSessionState
44 UnixLocalSessionState(
45 UnixLocalServerTransport & transport,
46 AsioIoService & ioService);
48 const RemoteAddress & implGetRemoteAddress();
50 void implRead(
char * buffer, std::size_t bufferLen);
52 void implWrite(
const std::vector<ByteBuffer> & buffers);
55 AsioSessionState &toBeNotified,
57 std::size_t bufferLen);
63 bool implIsConnected();
67 void implCloseAfterWrite();
69 ClientTransportAutoPtr implCreateClientTransport();
71 void implTransferNativeFrom(ClientTransport & clientTransport);
73 int getNativeHandle();
76 UnixLocalSocketPtr mSocketPtr;
77 std::string mRemoteFileName;
78 NoRemoteAddress mRemoteAddress;
81 class RCF_EXPORT UnixLocalServerTransport :
82 public AsioServerTransport
86 UnixLocalServerTransport(
const std::string & fileName);
88 TransportType getTransportType();
90 ServerTransportPtr clone();
92 AsioSessionStatePtr implCreateSessionState();
96 ClientTransportAutoPtr implCreateClientTransport(
97 const Endpoint &endpoint);
99 std::string getPipeName()
const;
101 void onServerStart(RcfServer & server);
102 void onServerStop(RcfServer & server);
106 const std::string mFileName;
111 #endif // ! INCLUDE_RCF_UNIXLOCALSERVERTRANSPORT_HPP