RCFProto

- Main Page
- Classes
- Files

- File List

All Classes Functions Typedefs
TcpEndpoint.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_TCPENDPOINT_HPP
20 #define INCLUDE_RCF_TCPENDPOINT_HPP
21
22 #include <string>
23 #include <memory>
24
25 #include <boost/shared_ptr.hpp>
26
27 #include <RCF/Endpoint.hpp>
28 #include <RCF/Enums.hpp>
29 #include <RCF/Export.hpp>
30 #include <RCF/IpAddress.hpp>
31 #include <RCF/SerializationProtocol.hpp>
32 #include <RCF/TypeTraits.hpp>
33
34 namespace RCF {
35
36 class ServerTransport;
37 class ClientTransport;
38
40 class RCF_EXPORT TcpEndpoint : public Endpoint
41 {
42 public:
43
44 // *** SWIG BEGIN ***
45
47 TcpEndpoint(int port);
48
50 TcpEndpoint(const std::string &ip, int port);
51
53 std::string getIp() const;
54
56 int getPort() const;
57
59 std::string asString() const;
60
61 // *** SWIG END ***
62
63 TcpEndpoint();
64
65
66 TcpEndpoint(const IpAddress & ipAddress);
67 TcpEndpoint(const TcpEndpoint &rhs);
68
69 std::auto_ptr<ServerTransport> createServerTransport() const;
70 std::auto_ptr<ClientTransport> createClientTransport() const;
71 EndpointPtr clone() const;
72
73 IpAddress getIpAddress() const;
74
75 bool operator<(const TcpEndpoint &rhs) const
76 {
77 return mIpAddress < rhs.mIpAddress;
78 }
79
80 private:
81 IpAddress mIpAddress;
82 };
83
84 class TcpEndpointV4 : public TcpEndpoint
85 {
86 public:
87 TcpEndpointV4(const std::string & ip, int port) :
88 TcpEndpoint( IpAddressV4(ip, port) )
89 {
90 }
91 };
92
93 class TcpEndpointV6 : public TcpEndpoint
94 {
95 public:
96 TcpEndpointV6(const std::string & ip, int port) :
97 TcpEndpoint( IpAddressV6(ip, port) )
98 {
99 }
100 };
101
102 } // namespace RCF
103
104 #endif // ! INCLUDE_RCF_TCPENDPOINT_HPP