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