11 #ifndef ASIO_IP_ADDRESS_V4_HPP 12 #define ASIO_IP_ADDRESS_V4_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 25 #if !defined(ASIO_NO_IOSTREAM) 27 #endif // !defined(ASIO_NO_IOSTREAM) 51 #if defined(GENERATING_DOCUMENTATION) 75 #if defined(ASIO_HAS_MOVE) 81 #endif // defined(ASIO_HAS_MOVE) 90 #if defined(ASIO_HAS_MOVE) 97 #endif // defined(ASIO_HAS_MOVE) 144 friend bool operator==(
const address_v4& a1,
const address_v4& a2)
146 return a1.addr_.s_addr == a2.addr_.s_addr;
150 friend bool operator!=(
const address_v4& a1,
const address_v4& a2)
152 return a1.addr_.s_addr != a2.addr_.s_addr;
156 friend bool operator<(
const address_v4& a1,
const address_v4& a2)
162 friend bool operator>(
const address_v4& a1,
const address_v4& a2)
168 friend bool operator<=(
const address_v4& a1,
const address_v4& a2)
174 friend bool operator>=(
const address_v4& a1,
const address_v4& a2)
200 const address_v4& addr,
const address_v4& mask);
211 #if !defined(ASIO_NO_IOSTREAM) 225 template <
typename Elem,
typename Traits>
227 std::basic_ostream<Elem, Traits>& os,
const address_v4& addr);
229 #endif // !defined(ASIO_NO_IOSTREAM) 237 #if defined(ASIO_HEADER_ONLY) 239 #endif // defined(ASIO_HEADER_ONLY) 241 #endif // ASIO_IP_ADDRESS_V4_HPP
friend bool operator>(const address_v4 &a1, const address_v4 &a2)
Compare addresses for ordering.
static ASIO_DECL address_v4 netmask(const address_v4 &addr)
friend bool operator==(const address_v4 &a1, const address_v4 &a2)
Compare two addresses for equality.
std::basic_ostream< Elem, Traits > & operator<<(std::basic_ostream< Elem, Traits > &os, const address_v4 &addr)
Output an address as a string.
asio::detail::array< unsigned char, 4 > bytes_type
The type used to represent an address as an array of bytes.
ASIO_DECL bool is_multicast() const
Determine whether the address is a multicast address.
ASIO_DECL unsigned long to_ulong() const
Get the address as an unsigned long in host byte order.
static address_v4 broadcast()
Obtain an address object that represents the broadcast address.
Implements IP version 4 style addresses.
address_v4()
Default constructor.
ASIO_DECL bool is_class_b() const
Determine whether the address is a class B address.
friend bool operator!=(const address_v4 &a1, const address_v4 &a2)
Compare two addresses for inequality.
friend bool operator<(const address_v4 &a1, const address_v4 &a2)
Compare addresses for ordering.
ASIO_DECL bool is_unspecified() const
Determine whether the address is unspecified.
friend bool operator<=(const address_v4 &a1, const address_v4 &a2)
Compare addresses for ordering.
static ASIO_DECL address_v4 from_string(const char *str)
Create an address from an IP address string in dotted decimal form.
ASIO_DECL std::string to_string() const
Get the address as a string in dotted decimal format.
static address_v4 loopback()
Obtain an address object that represents the loopback address.
ASIO_DECL bytes_type to_bytes() const
Get the address in bytes, in network byte order.
address_v4(const address_v4 &other)
Copy constructor.
ASIO_DECL bool is_class_c() const
Determine whether the address is a class C address.
ASIO_DECL bool is_class_a() const
Determine whether the address is a class A address.
Class to represent an error code value.
friend bool operator>=(const address_v4 &a1, const address_v4 &a2)
Compare addresses for ordering.
ASIO_DECL bool is_loopback() const
Determine whether the address is a loopback address.
static address_v4 any()
Obtain an address object that represents any address.
address_v4 & operator=(const address_v4 &other)
Assign from another address.