Implements version-independent IP addresses. More...
#include <address.hpp>
Public Member Functions | |
BOOST_ASIO_DECL | address () |
Default constructor. More... | |
BOOST_ASIO_DECL | address (const boost::asio::ip::address_v4 &ipv4_address) |
Construct an address from an IPv4 address. More... | |
BOOST_ASIO_DECL | address (const boost::asio::ip::address_v6 &ipv6_address) |
Construct an address from an IPv6 address. More... | |
BOOST_ASIO_DECL | address (const address &other) |
Copy constructor. More... | |
BOOST_ASIO_DECL address & | operator= (const address &other) |
Assign from another address. More... | |
BOOST_ASIO_DECL address & | operator= (const boost::asio::ip::address_v4 &ipv4_address) |
Assign from an IPv4 address. More... | |
BOOST_ASIO_DECL address & | operator= (const boost::asio::ip::address_v6 &ipv6_address) |
Assign from an IPv6 address. More... | |
bool | is_v4 () const |
Get whether the address is an IP version 4 address. More... | |
bool | is_v6 () const |
Get whether the address is an IP version 6 address. More... | |
BOOST_ASIO_DECL boost::asio::ip::address_v4 | to_v4 () const |
Get the address as an IP version 4 address. More... | |
BOOST_ASIO_DECL boost::asio::ip::address_v6 | to_v6 () const |
Get the address as an IP version 6 address. More... | |
BOOST_ASIO_DECL std::string | to_string () const |
Get the address as a string in dotted decimal format. More... | |
BOOST_ASIO_DECL std::string | to_string (boost::system::error_code &ec) const |
Get the address as a string in dotted decimal format. More... | |
BOOST_ASIO_DECL bool | is_loopback () const |
Determine whether the address is a loopback address. More... | |
BOOST_ASIO_DECL bool | is_unspecified () const |
Determine whether the address is unspecified. More... | |
BOOST_ASIO_DECL bool | is_multicast () const |
Determine whether the address is a multicast address. More... | |
Static Public Member Functions | |
static BOOST_ASIO_DECL address | from_string (const char *str) |
Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. More... | |
static BOOST_ASIO_DECL address | from_string (const char *str, boost::system::error_code &ec) |
Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. More... | |
static BOOST_ASIO_DECL address | from_string (const std::string &str) |
Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. More... | |
static BOOST_ASIO_DECL address | from_string (const std::string &str, boost::system::error_code &ec) |
Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. More... | |
Friends | |
BOOST_ASIO_DECL friend bool | operator== (const address &a1, const address &a2) |
Compare two addresses for equality. More... | |
bool | operator!= (const address &a1, const address &a2) |
Compare two addresses for inequality. More... | |
BOOST_ASIO_DECL friend bool | operator< (const address &a1, const address &a2) |
Compare addresses for ordering. More... | |
bool | operator> (const address &a1, const address &a2) |
Compare addresses for ordering. More... | |
bool | operator<= (const address &a1, const address &a2) |
Compare addresses for ordering. More... | |
bool | operator>= (const address &a1, const address &a2) |
Compare addresses for ordering. More... | |
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. More... | |
Implements version-independent IP addresses.
The boost::asio::ip::address class provides the ability to use either IP version 4 or version 6 addresses.
BOOST_ASIO_DECL boost::asio::ip::address::address | ( | ) |
Default constructor.
BOOST_ASIO_DECL boost::asio::ip::address::address | ( | const boost::asio::ip::address_v4 & | ipv4_address | ) |
Construct an address from an IPv4 address.
BOOST_ASIO_DECL boost::asio::ip::address::address | ( | const boost::asio::ip::address_v6 & | ipv6_address | ) |
Construct an address from an IPv6 address.
BOOST_ASIO_DECL boost::asio::ip::address::address | ( | const address & | other | ) |
Copy constructor.
|
static |
Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
|
static |
Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
|
static |
Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
|
static |
Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
BOOST_ASIO_DECL bool boost::asio::ip::address::is_loopback | ( | ) | const |
Determine whether the address is a loopback address.
BOOST_ASIO_DECL bool boost::asio::ip::address::is_multicast | ( | ) | const |
Determine whether the address is a multicast address.
BOOST_ASIO_DECL bool boost::asio::ip::address::is_unspecified | ( | ) | const |
Determine whether the address is unspecified.
|
inline |
Get whether the address is an IP version 4 address.
|
inline |
Get whether the address is an IP version 6 address.
Assign from another address.
BOOST_ASIO_DECL address& boost::asio::ip::address::operator= | ( | const boost::asio::ip::address_v4 & | ipv4_address | ) |
Assign from an IPv4 address.
BOOST_ASIO_DECL address& boost::asio::ip::address::operator= | ( | const boost::asio::ip::address_v6 & | ipv6_address | ) |
Assign from an IPv6 address.
BOOST_ASIO_DECL std::string boost::asio::ip::address::to_string | ( | ) | const |
Get the address as a string in dotted decimal format.
BOOST_ASIO_DECL std::string boost::asio::ip::address::to_string | ( | boost::system::error_code & | ec | ) | const |
Get the address as a string in dotted decimal format.
BOOST_ASIO_DECL boost::asio::ip::address_v4 boost::asio::ip::address::to_v4 | ( | ) | const |
Get the address as an IP version 4 address.
BOOST_ASIO_DECL boost::asio::ip::address_v6 boost::asio::ip::address::to_v6 | ( | ) | const |
Get the address as an IP version 6 address.
Compare two addresses for inequality.
Compare addresses for ordering.
|
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. |
Compare two addresses for equality.