RCFProto

- Main Page
- Classes
- Files

- File List

All Classes Functions Typedefs
UdpClientTransport.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_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 boost::shared_ptr<UdpClientTransport> UdpClientTransportPtr;
32
33 class RCF_EXPORT UdpClientTransport :
34 public ClientTransport,
35 public IpClientTransport
36 {
37 private:
38 IpAddress mSrcIp;
39 IpAddress mDestIp;
40 IpAddress mFromIp;
41 ReallocBufferPtr mReadVecPtr;
42 ReallocBufferPtr mWriteVecPtr;
43 bool mAsync;
44 int mSock;
45
46 public:
47 UdpClientTransport(const IpAddress & ipAddress);
48 UdpClientTransport(const UdpClientTransport &rhs);
49 ~UdpClientTransport();
50
51 TransportType getTransportType();
52
53 ClientTransportAutoPtr
54 clone() const;
55
56 EndpointPtr getEndpointPtr() const;
57
58 void connect(
59 ClientTransportCallback &clientStub,
60 unsigned int timeoutMs);
61
62 void disconnect(unsigned int timeoutMs);
63
64 int send(
65 ClientTransportCallback &clientStub,
66 const std::vector<ByteBuffer> &data,
67 unsigned int timeoutMs);
68
69 int receive(
70 ClientTransportCallback &clientStub,
71 ByteBuffer &byteBuffer,
72 unsigned int timeoutMs);
73
74 void close();
75 bool isConnected();
76
77 void setTransportFilters(
78 const std::vector<FilterPtr> &filters);
79
80 void getTransportFilters(
81 std::vector<FilterPtr> &filters);
82
83 int getNativeHandle() const;
84
85 void setTimer(boost::uint32_t timeoutMs, ClientTransportCallback *pClientStub);
86
87 bool supportsTransportFilters()
88 {
89 return false;
90 }
91 };
92
93 } // namespace RCF
94
95 #endif // ! INCLUDE_RCF_UDPCLIENTTRANSPORT_HPP