Remote Call Framework 3.3
Win32NamedPipeClientTransport.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2022, Delta V Software. All rights reserved.
6 // https://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 under GPL terms.
12 //
13 // Version: 3.3
14 // Contact: support <at> deltavsoft.com
15 //
16 //******************************************************************************
17 
18 #ifndef INCLUDE_RCF_WIN32NAMEDPIPECLIENTTRANSPORT_HPP
19 #define INCLUDE_RCF_WIN32NAMEDPIPECLIENTTRANSPORT_HPP
20 
21 #include <RCF/ConnectedClientTransport.hpp>
22 
23 #include <RCF/Tchar.hpp>
24 
25 #include <RCF/AsioFwd.hpp>
26 
27 namespace RCF {
28 
29  class RCF_EXPORT Win32NamedPipeClientTransport :
30  public ConnectedClientTransport
31  {
32  public:
33 
34  Win32NamedPipeClientTransport(
35  const Win32NamedPipeClientTransport & rhs);
36 
37  Win32NamedPipeClientTransport(
38  const tstring & pipeName);
39 
40  Win32NamedPipeClientTransport(AsioPipeHandlePtr socketPtr, const tstring & pipeName);
41 
42  ~Win32NamedPipeClientTransport();
43 
44  TransportType getTransportType();
45 
46  ClientTransportUniquePtr clone() const;
47 
48  HANDLE getNativeHandle() const;
49 
50  AsioPipeHandlePtr releaseSocket();
51 
52  void setDisconnectBeforeClosing(bool disconnectBeforeClosing);
53 
54  tstring getPipeName() const;
55  void setPipeName(const tstring & pipeName);
56 
57  void setSecurityAttributes(LPSECURITY_ATTRIBUTES pSec);
58 
59  void associateWithIoService(AsioIoService & ioService);
60  bool isAssociatedWithIoService();
61 
62  private:
63 
64  std::size_t implRead(
65  const ByteBuffer &byteBuffer,
66  std::size_t bytesRequested);
67 
68  std::size_t implReadAsync(
69  const ByteBuffer &byteBuffer,
70  std::size_t bytesRequested);
71 
72  std::size_t implWrite(
73  const std::vector<ByteBuffer> &byteBuffers);
74 
75  std::size_t implWriteAsync(
76  const std::vector<ByteBuffer> &byteBuffers);
77 
78  void implClose();
79 
80  void implConnect(
81  ClientTransportCallback &clientStub,
82  unsigned int timeoutMs);
83 
84  void implConnectAsync(
85  ClientTransportCallback &clientStub,
86  unsigned int timeoutMs);
87 
88  // I_ClientTransport
89  EndpointPtr getEndpointPtr() const;
90  bool isConnected();
91 
92  private:
93 
94  tstring mEpPipeName;
95  tstring mPipeName;
96  HANDLE mhPipe;
97  HANDLE mhEvent;
98 
99  LPSECURITY_ATTRIBUTES mpSec;
100 
101  bool mAsyncMode;
102 
103  AsioPipeHandlePtr mSocketPtr;
104  AsioIoService * mpIoService;
105  };
106 
107 } // namespace RCF
108 
109 #endif // ! INCLUDE_RCF_WIN32NAMEDPIPECLIENTTRANSPORT_HPP
std::shared_ptr< Endpoint > EndpointPtr
Reference counted wrapper for RCF::Endpoint.
Definition: RcfFwd.hpp:117
std::unique_ptr< ClientTransport > ClientTransportUniquePtr
Unique pointer wrapper for RCF::ClientTransport.
Definition: RcfFwd.hpp:43
Definition: AmiIoHandler.hpp:23
TransportType
Describes the transport types used by a RCF connection.
Definition: Enums.hpp:33