Remote Call Framework 3.0
UdpClientTransport.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2018, 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.0
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
19 #ifndef INCLUDE_RCF_UDPCLIENTTRANSPORT_HPP
20 #define INCLUDE_RCF_UDPCLIENTTRANSPORT_HPP
21 
22 #include <RCF/ClientTransport.hpp>
23 #include <RCF/Export.hpp>
24 #include <RCF/IpAddress.hpp>
25 #include <RCF/IpClientTransport.hpp>
26 
27 namespace RCF {
28 
29  class UdpClientTransport;
30 
31  typedef std::shared_ptr<UdpClientTransport> UdpClientTransportPtr;
32 
33  class ReallocBuffer;
34  typedef std::shared_ptr<ReallocBuffer> ReallocBufferPtr;
35 
36  class RCF_EXPORT UdpClientTransport :
37  public ClientTransport,
38  public IpClientTransport
39  {
40  private:
41  IpAddress mSrcIp;
42  IpAddress mDestIp;
43  IpAddress mFromIp;
44  ReallocBufferPtr mReadVecPtr;
45  ReallocBufferPtr mWriteVecPtr;
46  bool mAsync;
47  int mSock;
48 
49  public:
50  UdpClientTransport(const IpAddress & ipAddress);
51  UdpClientTransport(const UdpClientTransport &rhs);
52  ~UdpClientTransport();
53 
54  TransportType getTransportType();
55 
57  clone() const;
58 
59  EndpointPtr getEndpointPtr() const;
60 
61  void connect(
62  ClientTransportCallback &clientStub,
63  unsigned int timeoutMs);
64 
65  void disconnect(unsigned int timeoutMs);
66 
67  int send(
68  ClientTransportCallback &clientStub,
69  const std::vector<ByteBuffer> &data,
70  unsigned int timeoutMs);
71 
72  int receive(
73  ClientTransportCallback &clientStub,
74  ByteBuffer &byteBuffer,
75  unsigned int timeoutMs);
76 
77  void close();
78  bool isConnected();
79 
80  void setTransportFilters(
81  const std::vector<FilterPtr> &filters);
82 
83  void getTransportFilters(
84  std::vector<FilterPtr> &filters);
85 
86  int getNativeHandle() const;
87 
88  void setTimer(std::uint32_t timeoutMs, ClientTransportCallback *pClientStub);
89 
90  bool supportsTransportFilters()
91  {
92  return false;
93  }
94  };
95 
96 } // namespace RCF
97 
98 #endif // ! INCLUDE_RCF_UDPCLIENTTRANSPORT_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:24
TransportType
Describes the transport types used by a RCF connection.
Definition: Enums.hpp:34