Remote Call Framework 3.1
ProxyEndpointTransport.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_PROXYENDPOINTTRANSPORT_HPP
20 #define INCLUDE_RCF_PROXYENDPOINTTRANSPORT_HPP
21 
22 #include <RCF/Export.hpp>
23 #include <RCF/Idl.hpp>
24 #include <RCF/ServerTransport.hpp>
25 
26 #include <string.h>
27 #include <vector>
28 
29 namespace RCF
30 {
31 
32  RCF_BEGIN(I_ProxyEp, "I_ProxyEp")
33 
34  RCF_METHOD_V2(
35  void,
36  SetupProxyEndpoint,
37  const std::string&, // Proxy endpoint name
38  const std::string&) // Proxy endpoint password
39 
40  RCF_METHOD_V1(
41  void,
42  GetConnectionRequests,
43  std::vector<std::string>&) // Connection requests
44 
45  RCF_METHOD_V2(
46  void,
47  MakeConnectionAvailable,
48  const std::string&, // Proxy endpoint name
49  const std::string&) // Request ID
50 
51  RCF_END(I_ProxyEp)
52 
53 
54  class ProxyEndpointTransport;
55  class TcpServerTransport;
56 
57  typedef std::shared_ptr<ProxyEndpointTransport> ProxyEndpointTransportPtr;
58 
59  class RCF_EXPORT ProxyEndpointTransport : public ServerTransport, public I_Service
60  {
61  public:
62 
63  ProxyEndpointTransport(const Endpoint& ep, const std::string& proxyEndpointName);
64  ~ProxyEndpointTransport();
65 
66  virtual ServerTransportPtr clone();
67 
68  virtual TransportType getTransportType();
69  virtual void onServiceAdded(RcfServer &server);
70  virtual void onServiceRemoved(RcfServer &server);
71  virtual void onServerStart(RcfServer &server);
72  virtual void onServerStop(RcfServer &server);
73 
74 
75  private:
76 
77  void runTransport();
78 
79  EndpointPtr mEndpointPtr;
80  std::string mEndpointName;
81 
82  RcfServer * mpServer = NULL;
83  TcpServerTransport * mpTcpTransport = NULL;
84 
85  bool mStopFlag = false;
86  ThreadPtr mThreadPtr;
87  RcfClient<I_ProxyEp> mConn;
88  };
89 
90 }
91 
92 #endif // ! INCLUDE_RCF_PROXYENDPOINTTRANSPORT_HPP
std::shared_ptr< Endpoint > EndpointPtr
Reference counted wrapper for RCF::Endpoint.
Definition: RcfFwd.hpp:117
Definition: AmiIoHandler.hpp:24
TransportType
Describes the transport types used by a RCF connection.
Definition: Enums.hpp:34
std::shared_ptr< ServerTransport > ServerTransportPtr
Unique pointer wrapper for RCF::ServerTransport.
Definition: RcfFwd.hpp:46