Reference | Class Hierarchy | Class Index | Member Index |
The asio::ip::address_v4 class provides the ability to use and manipulate IP version 4 addresses.
Public Types | |
typedef boost::array< unsigned char, 4 > | bytes_type |
The type used to represent an address as an array of bytes. | |
Public Member Functions | |
address_v4 () | |
Default constructor. | |
address_v4 (const bytes_type &bytes) | |
Construct an address from raw bytes. | |
address_v4 (unsigned long addr) | |
Construct an address from a unsigned long in host byte order. | |
address_v4 (const address_v4 &other) | |
Copy constructor. | |
address_v4 & | operator= (const address_v4 &other) |
Assign from another address. | |
bytes_type | to_bytes () const |
Get the address in bytes. | |
unsigned long | to_ulong () const |
Get the address as an unsigned long in host byte order. | |
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. | |
bool | is_class_a () const |
Determine whether the address is a class A address. | |
bool | is_class_b () const |
Determine whether the address is a class B address. | |
bool | is_class_c () const |
Determine whether the address is a class C address. | |
bool | is_multicast () const |
Determine whether the address is a multicast address. | |
Static Public Member Functions | |
static address_v4 | from_string (const char *str) |
Create an address from an IP address string in dotted decimal form. | |
static address_v4 | from_string (const char *str, asio::error_code &ec) |
Create an address from an IP address string in dotted decimal form. | |
static address_v4 | from_string (const std::string &str) |
Create an address from an IP address string in dotted decimal form. | |
static address_v4 | from_string (const std::string &str, asio::error_code &ec) |
Create an address from an IP address string in dotted decimal form. | |
static address_v4 | any () |
Obtain an address object that represents any address. | |
static address_v4 | loopback () |
Obtain an address object that represents the loopback address. | |
static address_v4 | broadcast () |
Obtain an address object that represents the broadcast address. | |
static address_v4 | broadcast (const address_v4 &addr, const address_v4 &mask) |
Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. | |
static address_v4 | netmask (const address_v4 &addr) |
Obtain the netmask that corresponds to the address, based on its address class. | |
Friends | |
bool | operator== (const address_v4 &a1, const address_v4 &a2) |
Compare two addresses for equality. | |
bool | operator!= (const address_v4 &a1, const address_v4 &a2) |
Compare two addresses for inequality. | |
bool | operator< (const address_v4 &a1, const address_v4 &a2) |
Compare addresses for ordering. | |
bool | operator> (const address_v4 &a1, const address_v4 &a2) |
Compare addresses for ordering. | |
bool | operator<= (const address_v4 &a1, const address_v4 &a2) |
Compare addresses for ordering. | |
bool | operator>= (const address_v4 &a1, const address_v4 &a2) |
Compare addresses for ordering. | |
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_v4 &addr) |
Output an address as a string. |
typedef boost::array<unsigned char, 4> asio::ip::address_v4::bytes_type |
The type used to represent an address as an array of bytes.
asio::ip::address_v4::address_v4 | ( | ) |
Default constructor.
asio::ip::address_v4::address_v4 | ( | const bytes_type & | bytes | ) | [explicit] |
Construct an address from raw bytes.
asio::ip::address_v4::address_v4 | ( | unsigned long | addr | ) | [explicit] |
Construct an address from a unsigned long in host byte order.
asio::ip::address_v4::address_v4 | ( | const address_v4 & | other | ) |
Copy constructor.
address_v4& asio::ip::address_v4::operator= | ( | const address_v4 & | other | ) |
Assign from another address.
bytes_type asio::ip::address_v4::to_bytes | ( | ) | const |
Get the address in bytes.
unsigned long asio::ip::address_v4::to_ulong | ( | ) | const |
Get the address as an unsigned long in host byte order.
std::string asio::ip::address_v4::to_string | ( | ) | const |
Get the address as a string in dotted decimal format.
std::string asio::ip::address_v4::to_string | ( | asio::error_code & | ec | ) | const |
Get the address as a string in dotted decimal format.
static address_v4 asio::ip::address_v4::from_string | ( | const char * | str | ) | [static] |
Create an address from an IP address string in dotted decimal form.
static address_v4 asio::ip::address_v4::from_string | ( | const char * | str, | |
asio::error_code & | ec | |||
) | [static] |
Create an address from an IP address string in dotted decimal form.
static address_v4 asio::ip::address_v4::from_string | ( | const std::string & | str | ) | [static] |
Create an address from an IP address string in dotted decimal form.
static address_v4 asio::ip::address_v4::from_string | ( | const std::string & | str, | |
asio::error_code & | ec | |||
) | [static] |
Create an address from an IP address string in dotted decimal form.
bool asio::ip::address_v4::is_class_a | ( | ) | const |
Determine whether the address is a class A address.
bool asio::ip::address_v4::is_class_b | ( | ) | const |
Determine whether the address is a class B address.
bool asio::ip::address_v4::is_class_c | ( | ) | const |
Determine whether the address is a class C address.
bool asio::ip::address_v4::is_multicast | ( | ) | const |
Determine whether the address is a multicast address.
static address_v4 asio::ip::address_v4::any | ( | ) | [static] |
Obtain an address object that represents any address.
static address_v4 asio::ip::address_v4::loopback | ( | ) | [static] |
Obtain an address object that represents the loopback address.
static address_v4 asio::ip::address_v4::broadcast | ( | ) | [static] |
Obtain an address object that represents the broadcast address.
static address_v4 asio::ip::address_v4::broadcast | ( | const address_v4 & | addr, | |
const address_v4 & | mask | |||
) | [static] |
Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask.
static address_v4 asio::ip::address_v4::netmask | ( | const address_v4 & | addr | ) | [static] |
Obtain the netmask that corresponds to the address, based on its address class.
bool operator== | ( | const address_v4 & | a1, | |
const address_v4 & | a2 | |||
) | [friend] |
Compare two addresses for equality.
bool operator!= | ( | const address_v4 & | a1, | |
const address_v4 & | a2 | |||
) | [friend] |
Compare two addresses for inequality.
bool operator< | ( | const address_v4 & | a1, | |
const address_v4 & | a2 | |||
) | [friend] |
Compare addresses for ordering.
bool operator> | ( | const address_v4 & | a1, | |
const address_v4 & | a2 | |||
) | [friend] |
Compare addresses for ordering.
bool operator<= | ( | const address_v4 & | a1, | |
const address_v4 & | a2 | |||
) | [friend] |
Compare addresses for ordering.
bool operator>= | ( | const address_v4 & | a1, | |
const address_v4 & | a2 | |||
) | [friend] |
Compare addresses for ordering.
std::basic_ostream< Elem, Traits > & operator<< | ( | std::basic_ostream< Elem, Traits > & | os, | |
const address_v4 & | 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. |