Remote Call Framework 3.4
TcpEndpoint.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2023, 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.4
14 // Contact: support <at> deltavsoft.com
15 //
16 //******************************************************************************
17 
18 #ifndef INCLUDE_RCF_TCPENDPOINT_HPP
19 #define INCLUDE_RCF_TCPENDPOINT_HPP
20 
21 #include <string>
22 #include <memory>
23 
24 #include <RCF/Endpoint.hpp>
25 #include <RCF/Export.hpp>
26 #include <RCF/IpAddress.hpp>
27 
28 namespace RCF {
29 
30  class ServerTransport;
31  class ClientTransport;
32 
34  class RCF_EXPORT TcpEndpoint : public Endpoint
35  {
36  public:
37 
38  // *** SWIG BEGIN ***
39 
41  TcpEndpoint(int port);
42 
44  TcpEndpoint(const std::string &ip, int port);
45 
47  std::string getIp() const;
48 
50  int getPort() const;
51 
53  std::string asString() const;
54 
55  // *** SWIG END ***
56 
57  TcpEndpoint();
58 
59 
60  TcpEndpoint(const IpAddress & ipAddress);
61  TcpEndpoint(const TcpEndpoint &rhs);
62 
63  std::unique_ptr<ServerTransport> createServerTransport() const;
64  std::unique_ptr<ClientTransport> createClientTransport() const;
65  EndpointPtr clone() const;
66 
67  IpAddress getIpAddress() const;
68 
69  bool operator<(const TcpEndpoint &rhs) const
70  {
71  return mIpAddress < rhs.mIpAddress;
72  }
73 
74  private:
75  IpAddress mIpAddress;
76  };
77 
78  class RCF_EXPORT TcpEndpointV4 : public TcpEndpoint
79  {
80  public:
81  TcpEndpointV4(const std::string & ip, int port);
82  };
83 
84  class RCF_EXPORT TcpEndpointV6 : public TcpEndpoint
85  {
86  public:
87  TcpEndpointV6(const std::string & ip, int port);
88  };
89 
90 } // namespace RCF
91 
92 #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:34
Base class for all network endpoint types.
Definition: Endpoint.hpp:40
Definition: AmiIoHandler.hpp:23
Represents an IP address (IPv4 or IPv6).
Definition: IpAddress.hpp:66