RCFProto

- Main Page
- Classes
- Files

- File List

All Classes Functions Typedefs
UnixLocalClientTransport.hpp
1
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2013, Delta V Software. All rights reserved.
6 // http://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF
12 // under GPL terms.
13 //
14 // Version: 2.0
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18
19 #ifndef INCLUDE_RCF_UNIXLOCALCLIENTTRANSPORT_HPP
20 #define INCLUDE_RCF_UNIXLOCALCLIENTTRANSPORT_HPP
21
22 #if defined(BOOST_WINDOWS)
23 #error Unix domain sockets not supported on Windows.
24 #endif
25
26 #include <RCF/BsdClientTransport.hpp>
27 #include <RCF/Export.hpp>
28 #include <RCF/IpClientTransport.hpp>
29
30 #include <sys/un.h>
31
32 namespace RCF {
33
34 using ASIO_NS::local::stream_protocol;
35 typedef stream_protocol::socket UnixLocalSocket;
36 typedef boost::shared_ptr<UnixLocalSocket> UnixLocalSocketPtr;
37
38 class RCF_EXPORT UnixLocalClientTransport :
39 public BsdClientTransport
40 {
41 public:
42 UnixLocalClientTransport(const UnixLocalClientTransport &rhs);
43 UnixLocalClientTransport(const std::string &fileName);
44 UnixLocalClientTransport(const sockaddr_un &remoteAddr);
45 UnixLocalClientTransport(UnixLocalSocketPtr socketPtr, const std::string & fileName);
46
47 ~UnixLocalClientTransport();
48
49 TransportType getTransportType();
50
51 ClientTransportAutoPtr clone() const;
52
53 void implConnect(unsigned int timeoutMs);
54
55 void implConnect(
56 ClientTransportCallback &clientStub,
57 unsigned int timeoutMs);
58
59 void implConnectAsync(
60 ClientTransportCallback &clientStub,
61 unsigned int timeoutMs);
62
63 void implClose();
64 EndpointPtr getEndpointPtr() const;
65
66 void setRemoteAddr(const sockaddr_un &remoteAddr);
67 const sockaddr_un & getRemoteAddr() const;
68
69 bool isAssociatedWithIoService();
70 void associateWithIoService(AsioIoService & ioService);
71
72 std::string getPipeName() const;
73
74 private:
75
76 void setupSocket();
77 void setupSocket(Exception & e);
78
79 sockaddr_un mRemoteAddr;
80 const std::string mFileName;
81 };
82
83 } // namespace RCF
84
85 #endif // ! INCLUDE_RCF_UNIXLOCALCLIENTTRANSPORT_HPP