RCFProto

- Main Page
- Classes
- Files

- File List

All Classes Functions Typedefs
Win32NamedPipeClientTransport.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_WIN32NAMEDPIPECLIENTTRANSPORT_HPP
20 #define INCLUDE_RCF_WIN32NAMEDPIPECLIENTTRANSPORT_HPP
21
22 #include <RCF/ConnectionOrientedClientTransport.hpp>
23
24 #include <RCF/util/Tchar.hpp>
25
26 #include <RCF/AsioFwd.hpp>
27
28 namespace RCF {
29
30 class RCF_EXPORT Win32NamedPipeClientTransport :
31 public ConnectionOrientedClientTransport
32 {
33 public:
34
35 Win32NamedPipeClientTransport(
36 const Win32NamedPipeClientTransport & rhs);
37
38 Win32NamedPipeClientTransport(
39 const tstring & pipeName);
40
41 Win32NamedPipeClientTransport(AsioPipeHandlePtr socketPtr, const tstring & pipeName);
42
43 ~Win32NamedPipeClientTransport();
44
45 TransportType getTransportType();
46
47 ClientTransportAutoPtr clone() const;
48
49 HANDLE getNativeHandle() const;
50
51 AsioPipeHandlePtr releaseSocket();
52
53 void setDisconnectBeforeClosing(bool disconnectBeforeClosing);
54
55 tstring getPipeName() const;
56 void setPipeName(const tstring & pipeName);
57
58 void setSecurityAttributes(LPSECURITY_ATTRIBUTES pSec);
59
60 void associateWithIoService(AsioIoService & ioService);
61 bool isAssociatedWithIoService();
62
63 private:
64
65 std::size_t implRead(
66 const ByteBuffer &byteBuffer,
67 std::size_t bytesRequested);
68
69 std::size_t implReadAsync(
70 const ByteBuffer &byteBuffer,
71 std::size_t bytesRequested);
72
73 std::size_t implWrite(
74 const std::vector<ByteBuffer> &byteBuffers);
75
76 std::size_t implWriteAsync(
77 const std::vector<ByteBuffer> &byteBuffers);
78
79 void implClose();
80
81 void implConnect(
82 ClientTransportCallback &clientStub,
83 unsigned int timeoutMs);
84
85 void implConnectAsync(
86 ClientTransportCallback &clientStub,
87 unsigned int timeoutMs);
88
89 // I_ClientTransport
90 EndpointPtr getEndpointPtr() const;
91 bool isConnected();
92
93 private:
94
95 tstring mEpPipeName;
96 tstring mPipeName;
97 HANDLE mhPipe;
98 HANDLE mhEvent;
99
100 LPSECURITY_ATTRIBUTES mpSec;
101
102 bool mAsyncMode;
103
104 AsioPipeHandlePtr mSocketPtr;
105 AsioIoService * mpIoService;
106 };
107
108 } // namespace RCF
109
110 #endif // ! INCLUDE_RCF_WIN32NAMEDPIPECLIENTTRANSPORT_HPP