RCFProto
 All Classes Functions Typedefs
MulticastClientTransport.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_MULTICASTCLIENTTRANSPORT_HPP
20 #define INCLUDE_RCF_MULTICASTCLIENTTRANSPORT_HPP
21 
22 #include <list>
23 #include <memory>
24 #include <string>
25 
26 #include <boost/shared_ptr.hpp>
27 
28 #include <RCF/ClientTransport.hpp>
29 #include <RCF/Export.hpp>
30 #include <RCF/ThreadLibrary.hpp>
31 
32 namespace RCF {
33 
34  typedef boost::shared_ptr< ClientTransportAutoPtr > ClientTransportAutoPtrPtr;
35 
36  // Special purpose client transport for sending messages in parallel on multiple sub-transports.
37  class RCF_EXPORT MulticastClientTransport : public ClientTransport
38  {
39  public:
40 
41  TransportType getTransportType();
42 
43  std::auto_ptr<ClientTransport> clone() const;
44 
45  EndpointPtr getEndpointPtr() const;
46 
47  int send(
48  ClientTransportCallback & clientStub,
49  const std::vector<ByteBuffer> & data,
50  unsigned int timeoutMs);
51 
52  int receive(
53  ClientTransportCallback & clientStub,
54  ByteBuffer & byteBuffer,
55  unsigned int timeoutMs);
56 
57  bool isConnected();
58 
59  void connect(
60  ClientTransportCallback & clientStub,
61  unsigned int timeoutMs);
62 
63  void disconnect(
64  unsigned int timeoutMs);
65 
66  void addTransport(
67  ClientTransportAutoPtr clientTransportAutoPtr);
68 
69  void setTransportFilters(
70  const std::vector<FilterPtr> & filters);
71 
72  void getTransportFilters(
73  std::vector<FilterPtr> & filters);
74 
75  void setTimer(boost::uint32_t timeoutMs, ClientTransportCallback *pClientStub);
76 
77  void dropIdleTransports();
78  void pingAllTransports();
79 
80  private:
81 
82  void bringInNewTransports();
83 
84  typedef std::list< ClientTransportAutoPtrPtr > ClientTransportList;
85 
86  Mutex mClientTransportsMutex;
87  ClientTransportList mClientTransports;
88  ClientTransportList mAddedClientTransports;
89 
90  ClientTransportAutoPtr mMulticastTemp;
91  };
92 
93 } // namespace RCF
94 
95 #endif // ! INCLUDE_RCF_MULTICASTCLIENTTRANSPORT_HPP