Implements IP version 4 style addresses. More...
#include <address_v4.hpp>
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. | |
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. | |
address_v4 & | operator= (const address_v4 &other) |
Assign from another address. | |
bytes_type | to_bytes () const |
Get the address in bytes. | |
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. | |
unsigned long | to_ulong () const |
Get the address as an unsigned long in host byte order. | |
Static Public Member Functions | |
static address_v4 | any () |
Obtain an address object that represents any 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) |
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 | loopback () |
Obtain an address object that represents the loopback address. | |
static address_v4 | netmask (const address_v4 &addr) |
Private Attributes | |
asio::detail::in4_addr_type | addr_ |
Friends | |
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 two addresses for equality. | |
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. |
Implements IP version 4 style addresses.
The asio::ip::address_v4 class provides the ability to use and manipulate IP version 4 addresses.
Definition at line 43 of file address_v4.hpp.
typedef boost::array<unsigned char, 4> asio::ip::address_v4::bytes_type |
The type used to represent an address as an array of bytes.
Definition at line 47 of file address_v4.hpp.
asio::ip::address_v4::address_v4 | ( | ) | [inline] |
Default constructor.
Definition at line 50 of file address_v4.hpp.
asio::ip::address_v4::address_v4 | ( | const bytes_type & | bytes | ) | [inline, explicit] |
Construct an address from raw bytes.
Definition at line 56 of file address_v4.hpp.
asio::ip::address_v4::address_v4 | ( | unsigned long | addr | ) | [inline, explicit] |
Construct an address from a unsigned long in host byte order.
Definition at line 63 of file address_v4.hpp.
asio::ip::address_v4::address_v4 | ( | const address_v4 & | other | ) | [inline] |
Copy constructor.
Definition at line 69 of file address_v4.hpp.
static address_v4 asio::ip::address_v4::any | ( | ) | [inline, static] |
Obtain an address object that represents any address.
Definition at line 210 of file address_v4.hpp.
static address_v4 asio::ip::address_v4::broadcast | ( | ) | [inline, static] |
Obtain an address object that represents the broadcast address.
Definition at line 222 of file address_v4.hpp.
static address_v4 asio::ip::address_v4::broadcast | ( | const address_v4 & | addr, |
const address_v4 & | mask | ||
) | [inline, static] |
Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask.
Definition at line 229 of file address_v4.hpp.
static address_v4 asio::ip::address_v4::from_string | ( | const char * | str | ) | [inline, static] |
Create an address from an IP address string in dotted decimal form.
Definition at line 118 of file address_v4.hpp.
static address_v4 asio::ip::address_v4::from_string | ( | const char * | str, |
asio::error_code & | ec | ||
) | [inline, static] |
Create an address from an IP address string in dotted decimal form.
Definition at line 127 of file address_v4.hpp.
static address_v4 asio::ip::address_v4::from_string | ( | const std::string & | str | ) | [inline, static] |
Create an address from an IP address string in dotted decimal form.
Definition at line 137 of file address_v4.hpp.
static address_v4 asio::ip::address_v4::from_string | ( | const std::string & | str, |
asio::error_code & | ec | ||
) | [inline, static] |
Create an address from an IP address string in dotted decimal form.
Definition at line 143 of file address_v4.hpp.
bool asio::ip::address_v4::is_class_a | ( | ) | const [inline] |
Determine whether the address is a class A address.
Definition at line 150 of file address_v4.hpp.
bool asio::ip::address_v4::is_class_b | ( | ) | const [inline] |
Determine whether the address is a class B address.
Definition at line 156 of file address_v4.hpp.
bool asio::ip::address_v4::is_class_c | ( | ) | const [inline] |
Determine whether the address is a class C address.
Definition at line 162 of file address_v4.hpp.
bool asio::ip::address_v4::is_multicast | ( | ) | const [inline] |
Determine whether the address is a multicast address.
Definition at line 168 of file address_v4.hpp.
static address_v4 asio::ip::address_v4::loopback | ( | ) | [inline, static] |
Obtain an address object that represents the loopback address.
Definition at line 216 of file address_v4.hpp.
static address_v4 asio::ip::address_v4::netmask | ( | const address_v4 & | addr | ) | [inline, static] |
Obtain the netmask that corresponds to the address, based on its address class.
Definition at line 236 of file address_v4.hpp.
address_v4& asio::ip::address_v4::operator= | ( | const address_v4 & | other | ) | [inline] |
Assign from another address.
Definition at line 75 of file address_v4.hpp.
bytes_type asio::ip::address_v4::to_bytes | ( | ) | const [inline] |
Get the address in bytes.
Definition at line 82 of file address_v4.hpp.
std::string asio::ip::address_v4::to_string | ( | ) | const [inline] |
Get the address as a string in dotted decimal format.
Definition at line 97 of file address_v4.hpp.
std::string asio::ip::address_v4::to_string | ( | asio::error_code & | ec | ) | const [inline] |
Get the address as a string in dotted decimal format.
Definition at line 106 of file address_v4.hpp.
unsigned long asio::ip::address_v4::to_ulong | ( | ) | const [inline] |
Get the address as an unsigned long in host byte order.
Definition at line 91 of file address_v4.hpp.
bool operator!= | ( | const address_v4 & | a1, |
const address_v4 & | a2 | ||
) | [friend] |
Compare two addresses for inequality.
Definition at line 180 of file address_v4.hpp.
bool operator< | ( | const address_v4 & | a1, |
const address_v4 & | a2 | ||
) | [friend] |
Compare addresses for ordering.
Definition at line 186 of file address_v4.hpp.
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. |
Definition at line 265 of file address_v4.hpp.
bool operator<= | ( | const address_v4 & | a1, |
const address_v4 & | a2 | ||
) | [friend] |
Compare addresses for ordering.
Definition at line 198 of file address_v4.hpp.
bool operator== | ( | const address_v4 & | a1, |
const address_v4 & | a2 | ||
) | [friend] |
Compare two addresses for equality.
Definition at line 174 of file address_v4.hpp.
bool operator> | ( | const address_v4 & | a1, |
const address_v4 & | a2 | ||
) | [friend] |
Compare addresses for ordering.
Definition at line 192 of file address_v4.hpp.
bool operator>= | ( | const address_v4 & | a1, |
const address_v4 & | a2 | ||
) | [friend] |
Compare addresses for ordering.
Definition at line 204 of file address_v4.hpp.
Definition at line 249 of file address_v4.hpp.