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 UnixLocalNetworkSession :
public AsioNetworkSession
44 UnixLocalNetworkSession(
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);
58 bool implIsConnected();
62 void implCloseAfterWrite();
64 ClientTransportAutoPtr implCreateClientTransport();
66 void implTransferNativeFrom(ClientTransport & clientTransport);
68 int getNativeHandle();
71 UnixLocalSocketPtr mSocketPtr;
72 std::string mRemoteFileName;
73 NoRemoteAddress mRemoteAddress;
76 class RCF_EXPORT UnixLocalServerTransport :
77 public AsioServerTransport
81 UnixLocalServerTransport(
const std::string & fileName);
83 TransportType getTransportType();
85 ServerTransportPtr clone();
87 AsioNetworkSessionPtr implCreateNetworkSession();
91 ClientTransportAutoPtr implCreateClientTransport(
92 const Endpoint &endpoint);
94 std::string getPipeName()
const;
96 void onServerStart(RcfServer & server);
97 void onServerStop(RcfServer & server);
101 const std::string mFileName;
106 #endif // ! INCLUDE_RCF_UNIXLOCALSERVERTRANSPORT_HPP