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