Remote Call Framework 3.1
BsdClientTransport.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2019, 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: 3.1
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
19 #ifndef INCLUDE_RCF_BSDCLIENTTRANSPORT_HPP
20 #define INCLUDE_RCF_BSDCLIENTTRANSPORT_HPP
21 
22 #include <RCF/Export.hpp>
23 #include <RCF/ConnectedClientTransport.hpp>
24 
25 namespace RCF {
26 
27  class RCF_EXPORT BsdClientTransport :
28  public ConnectedClientTransport
29  {
30  public:
31 
32  BsdClientTransport();
33  BsdClientTransport(const BsdClientTransport & rhs);
34  BsdClientTransport(TcpSocketPtr socketPtr);
35 
36 #ifdef RCF_HAS_LOCAL_SOCKETS
37  BsdClientTransport(UnixLocalSocketPtr socketPtr);
38 #endif
39 
40  ~BsdClientTransport();
41 
42  TcpSocketPtr releaseTcpSocket();
43  UnixLocalSocketPtr releaseLocalSocket();
44 
45  int getNativeHandle() const;
46 
47  private:
48 
49  std::size_t implRead(
50  const ByteBuffer &byteBuffer,
51  std::size_t bytesRequested);
52 
53  std::size_t implReadAsync(
54  const ByteBuffer &byteBuffer,
55  std::size_t bytesRequested);
56 
57  std::size_t implWrite(
58  const std::vector<ByteBuffer> &byteBuffers);
59 
60  std::size_t implWriteAsync(
61  const std::vector<ByteBuffer> &byteBuffers);
62 
63  bool isConnected();
64 
65  protected:
66 
67  int mFd;
68  TcpSocketPtr mTcpSocketPtr;
69  UnixLocalSocketPtr mLocalSocketPtr;
70 
71  AsioIoService * mpIoService;
72 
73  int mWriteCounter;
74  };
75 
76 } // namespace RCF
77 
78 #endif // ! INCLUDE_RCF_TCPCLIENTTRANSPORT_HPP
Definition: AmiIoHandler.hpp:24