SF 3538780 SocketAddress needs operator < function

This commit is contained in:
Aleksandar Fabijanic
2012-07-11 02:55:27 +00:00
parent bf4f148782
commit 1bd21292e7
4 changed files with 80 additions and 55 deletions

View File

@@ -18,14 +18,14 @@
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
@@ -62,10 +62,10 @@ class Net_API SocketAddress
public:
SocketAddress();
/// Creates a wildcard (all zero) IPv4 SocketAddress.
SocketAddress(const IPAddress& host, Poco::UInt16 port);
/// Creates a SocketAddress from an IP address and a port number.
SocketAddress(const std::string& host, Poco::UInt16 port);
/// Creates a SocketAddress from an IP address and a port number.
///
@@ -73,15 +73,15 @@ public:
/// be in dotted decimal (IPv4) or hex string (IPv6) format.
SocketAddress(const std::string& host, const std::string& port);
/// Creates a SocketAddress from an IP address and a
/// Creates a SocketAddress from an IP address and a
/// service name or port number.
///
/// The IP address must either be a domain name, or it must
/// be in dotted decimal (IPv4) or hex string (IPv6) format.
///
/// The given port must either be a decimal port number, or
/// The given port must either be a decimal port number, or
/// a service name.
explicit SocketAddress(const std::string& hostAndPort);
/// Creates a SocketAddress from an IP address or host name and a
/// port number/service name. Host name/address and port number must
@@ -89,49 +89,50 @@ public:
/// the address part must be enclosed in brackets.
///
/// Examples:
/// 192.168.1.10:80
/// [::FFFF:192.168.1.120]:2040
/// 192.168.1.10:80
/// [::ffff:192.168.1.120]:2040
/// www.appinf.com:8080
SocketAddress(const SocketAddress& addr);
/// Creates a SocketAddress by copying another one.
SocketAddress(const struct sockaddr* addr, poco_socklen_t length);
/// Creates a SocketAddress from a native socket address.
~SocketAddress();
/// Destroys the SocketAddress.
SocketAddress& operator = (const SocketAddress& addr);
/// Assigns another SocketAddress.
void swap(SocketAddress& addr);
/// Swaps the SocketAddress with another one.
/// Swaps the SocketAddress with another one.
IPAddress host() const;
/// Returns the host IP address.
Poco::UInt16 port() const;
/// Returns the port number.
poco_socklen_t length() const;
/// Returns the length of the internal native socket address.
/// Returns the length of the internal native socket address.
const struct sockaddr* addr() const;
/// Returns a pointer to the internal native socket address.
int af() const;
/// Returns the address family (AF_INET or AF_INET6) of the address.
std::string toString() const;
/// Returns a string representation of the address.
IPAddress::Family family() const;
/// Returns the address family of the host's address.
bool operator < (const SocketAddress& addr) const;
bool operator == (const SocketAddress& addr) const;
bool operator != (const SocketAddress& addr) const;
enum
{
MAX_ADDRESS_LENGTH =