Remote Call Framework 3.1
TcpEndpoint.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_TCPENDPOINT_HPP
20 #define INCLUDE_RCF_TCPENDPOINT_HPP
21 
22 #include <string>
23 #include <memory>
24 
25 #include <RCF/Endpoint.hpp>
26 #include <RCF/Export.hpp>
27 #include <RCF/IpAddress.hpp>
28 
29 namespace RCF {
30 
31  class ServerTransport;
32  class ClientTransport;
33 
35  class RCF_EXPORT TcpEndpoint : public Endpoint
36  {
37  public:
38 
39  // *** SWIG BEGIN ***
40 
42  TcpEndpoint(int port);
43 
45  TcpEndpoint(const std::string &ip, int port);
46 
48  std::string getIp() const;
49 
51  int getPort() const;
52 
54  std::string asString() const;
55 
56  // *** SWIG END ***
57 
58  TcpEndpoint();
59 
60 
61  TcpEndpoint(const IpAddress & ipAddress);
62  TcpEndpoint(const TcpEndpoint &rhs);
63 
64  std::unique_ptr<ServerTransport> createServerTransport() const;
65  std::unique_ptr<ClientTransport> createClientTransport() const;
66  EndpointPtr clone() const;
67 
68  IpAddress getIpAddress() const;
69 
70  bool operator<(const TcpEndpoint &rhs) const
71  {
72  return mIpAddress < rhs.mIpAddress;
73  }
74 
75  private:
76  IpAddress mIpAddress;
77  };
78 
79  class RCF_EXPORT TcpEndpointV4 : public TcpEndpoint
80  {
81  public:
82  TcpEndpointV4(const std::string & ip, int port);
83  };
84 
85  class RCF_EXPORT TcpEndpointV6 : public TcpEndpoint
86  {
87  public:
88  TcpEndpointV6(const std::string & ip, int port);
89  };
90 
91 } // namespace RCF
92 
93 #endif // ! INCLUDE_RCF_TCPENDPOINT_HPP
std::shared_ptr< Endpoint > EndpointPtr
Reference counted wrapper for RCF::Endpoint.
Definition: RcfFwd.hpp:117
Represents a TCP endpoint.
Definition: TcpEndpoint.hpp:35
Base class for all network endpoint types.
Definition: Endpoint.hpp:41
Definition: AmiIoHandler.hpp:24
Represents an IP address (IPv4 or IPv6).
Definition: IpAddress.hpp:67