Implements version-independent IP addresses. More...
#include <address.hpp>
Public Member Functions | |
address () | |
Default constructor. | |
address (const asio::ip::address_v4 &ipv4_address) | |
Construct an address from an IPv4 address. | |
address (const asio::ip::address_v6 &ipv6_address) | |
Construct an address from an IPv6 address. | |
address (const address &other) | |
Copy constructor. | |
bool | is_v4 () const |
Get whether the address is an IP version 4 address. | |
bool | is_v6 () const |
Get whether the address is an IP version 6 address. | |
address & | operator= (const address &other) |
Assign from another address. | |
address & | operator= (const asio::ip::address_v4 &ipv4_address) |
Assign from an IPv4 address. | |
address & | operator= (const asio::ip::address_v6 &ipv6_address) |
Assign from an IPv6 address. | |
std::string | to_string () const |
Get the address as a string in dotted decimal format. | |
std::string | to_string (asio::error_code &ec) const |
Get the address as a string in dotted decimal format. | |
asio::ip::address_v4 | to_v4 () const |
Get the address as an IP version 4 address. | |
asio::ip::address_v6 | to_v6 () const |
Get the address as an IP version 6 address. | |
Static Public Member Functions | |
static address | from_string (const char *str) |
static address | from_string (const char *str, asio::error_code &ec) |
static address | from_string (const std::string &str) |
static address | from_string (const std::string &str, asio::error_code &ec) |
Private Types | |
enum | { ipv4, ipv6 } |
Private Attributes | |
asio::ip::address_v4 | ipv4_address_ |
asio::ip::address_v6 | ipv6_address_ |
enum asio::ip::address:: { ... } | type_ |
Friends | |
bool | operator!= (const address &a1, const address &a2) |
Compare two addresses for inequality. | |
bool | operator< (const address &a1, const address &a2) |
Compare addresses for ordering. | |
bool | operator== (const address &a1, const address &a2) |
Compare two addresses for equality. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename Elem , typename Traits > | |
std::basic_ostream< Elem, Traits > & | operator<< (std::basic_ostream< Elem, Traits > &os, const address &addr) |
Output an address as a string. |
Implements version-independent IP addresses.
The asio::ip::address class provides the ability to use either IP version 4 or version 6 addresses.
Definition at line 43 of file address.hpp.
anonymous enum [private] |
Definition at line 243 of file address.hpp.
asio::ip::address::address | ( | ) | [inline] |
Default constructor.
Definition at line 47 of file address.hpp.
asio::ip::address::address | ( | const asio::ip::address_v4 & | ipv4_address | ) | [inline] |
Construct an address from an IPv4 address.
Definition at line 55 of file address.hpp.
asio::ip::address::address | ( | const asio::ip::address_v6 & | ipv6_address | ) | [inline] |
Construct an address from an IPv6 address.
Definition at line 63 of file address.hpp.
asio::ip::address::address | ( | const address & | other | ) | [inline] |
Copy constructor.
Definition at line 71 of file address.hpp.
static address asio::ip::address::from_string | ( | const char * | str | ) | [inline, static] |
Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
Definition at line 159 of file address.hpp.
static address asio::ip::address::from_string | ( | const char * | str, |
asio::error_code & | ec | ||
) | [inline, static] |
Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
Definition at line 169 of file address.hpp.
static address asio::ip::address::from_string | ( | const std::string & | str | ) | [inline, static] |
Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
Definition at line 196 of file address.hpp.
static address asio::ip::address::from_string | ( | const std::string & | str, |
asio::error_code & | ec | ||
) | [inline, static] |
Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
Definition at line 203 of file address.hpp.
bool asio::ip::address::is_v4 | ( | ) | const [inline] |
Get whether the address is an IP version 4 address.
Definition at line 106 of file address.hpp.
bool asio::ip::address::is_v6 | ( | ) | const [inline] |
Get whether the address is an IP version 6 address.
Definition at line 112 of file address.hpp.
Assign from another address.
Definition at line 79 of file address.hpp.
address& asio::ip::address::operator= | ( | const asio::ip::address_v4 & | ipv4_address | ) | [inline] |
Assign from an IPv4 address.
Definition at line 88 of file address.hpp.
address& asio::ip::address::operator= | ( | const asio::ip::address_v6 & | ipv6_address | ) | [inline] |
Assign from an IPv6 address.
Definition at line 97 of file address.hpp.
std::string asio::ip::address::to_string | ( | ) | const [inline] |
Get the address as a string in dotted decimal format.
Definition at line 142 of file address.hpp.
std::string asio::ip::address::to_string | ( | asio::error_code & | ec | ) | const [inline] |
Get the address as a string in dotted decimal format.
Definition at line 150 of file address.hpp.
asio::ip::address_v4 asio::ip::address::to_v4 | ( | ) | const [inline] |
Get the address as an IP version 4 address.
Definition at line 118 of file address.hpp.
asio::ip::address_v6 asio::ip::address::to_v6 | ( | ) | const [inline] |
Get the address as an IP version 6 address.
Definition at line 130 of file address.hpp.
Compare two addresses for inequality.
Definition at line 220 of file address.hpp.
Compare addresses for ordering.
Definition at line 230 of file address.hpp.
std::basic_ostream< Elem, Traits > & operator<< | ( | std::basic_ostream< Elem, Traits > & | os, |
const address & | addr | ||
) | [related] |
Output an address as a string.
Used to output a human-readable string for a specified address.
os | The output stream to which the string will be written. |
addr | The address to be written. |
Definition at line 265 of file address.hpp.
Compare two addresses for equality.
Definition at line 210 of file address.hpp.
Definition at line 246 of file address.hpp.
Definition at line 249 of file address.hpp.
enum { ... } asio::ip::address::type_ [private] |