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) 18 #include "asio/detail/config.hpp" 20 #include "asio/detail/array.hpp" 21 #include "asio/detail/cstdint.hpp" 22 #include "asio/detail/socket_types.hpp" 23 #include "asio/detail/string_view.hpp" 24 #include "asio/detail/winsock_init.hpp" 25 #include "asio/error_code.hpp" 27 #if !defined(ASIO_NO_IOSTREAM) 29 #endif // !defined(ASIO_NO_IOSTREAM) 31 #include "asio/detail/push_options.hpp" 56 #if defined(GENERATING_DOCUMENTATION) 80 #if defined(ASIO_HAS_MOVE) 86 #endif // defined(ASIO_HAS_MOVE) 89 address_v4&
operator=(
const address_v4& other) ASIO_NOEXCEPT
95 #if defined(ASIO_HAS_MOVE) 96 address_v4&
operator=(address_v4&& other) ASIO_NOEXCEPT
102 #endif // defined(ASIO_HAS_MOVE) 105 ASIO_DECL bytes_type
to_bytes()
const ASIO_NOEXCEPT;
108 ASIO_DECL uint_type
to_uint()
const ASIO_NOEXCEPT;
110 #if !defined(ASIO_NO_DEPRECATED) 111 ASIO_DECL
unsigned long to_ulong()
const;
113 #endif // !defined(ASIO_NO_DEPRECATED) 118 #if !defined(ASIO_NO_DEPRECATED) 134 static address_v4
from_string(
const std::string& str);
140 #endif // !defined(ASIO_NO_DEPRECATED) 148 #if !defined(ASIO_NO_DEPRECATED) 160 #endif // !defined(ASIO_NO_DEPRECATED) 167 const address_v4& a2) ASIO_NOEXCEPT
169 return a1.addr_.s_addr == a2.addr_.s_addr;
174 const address_v4& a2) ASIO_NOEXCEPT
176 return a1.addr_.s_addr != a2.addr_.s_addr;
181 const address_v4& a2) ASIO_NOEXCEPT
183 return a1.to_uint() < a2.to_uint();
188 const address_v4& a2) ASIO_NOEXCEPT
190 return a1.to_uint() > a2.to_uint();
195 const address_v4& a2) ASIO_NOEXCEPT
197 return a1.to_uint() <= a2.to_uint();
202 const address_v4& a2) ASIO_NOEXCEPT
204 return a1.to_uint() >= a2.to_uint();
208 static address_v4
any() ASIO_NOEXCEPT
225 #if !defined(ASIO_NO_DEPRECATED) 230 const address_v4& addr,
const address_v4& mask);
234 ASIO_DECL
static address_v4
netmask(
const address_v4& addr);
235 #endif // !defined(ASIO_NO_DEPRECATED) 239 asio::detail::in4_addr_type addr_;
286 #if defined(ASIO_HAS_STRING_VIEW) \ 287 || defined(GENERATING_DOCUMENTATION) 302 #endif // defined(ASIO_HAS_STRING_VIEW) 305 #if !defined(ASIO_NO_IOSTREAM) 319 template <
typename Elem,
typename Traits>
321 std::basic_ostream<Elem, Traits>& os,
const address_v4& addr);
323 #endif // !defined(ASIO_NO_IOSTREAM) 328 #include "asio/detail/pop_options.hpp" 330 #include "asio/ip/impl/address_v4.hpp" 331 #if defined(ASIO_HEADER_ONLY) 332 # include "asio/ip/impl/address_v4.ipp" 333 #endif // defined(ASIO_HEADER_ONLY) 335 #endif // ASIO_IP_ADDRESS_V4_HPP friend bool operator<(const address_v4 &a1, const address_v4 &a2) ASIO_NOEXCEPT
Compare addresses for ordering.
Definition: address_v4.hpp:180
address_v4 make_address_v4(const address_v4::bytes_type &bytes)
Create an IPv4 address from raw bytes in network order.
Definition: address_v4.hpp:246
ASIO_DECL bool is_class_a() const
(Deprecated: Use network_v4 class.) Determine whether the address is a class A address.
Definition: address_v4.ipp:122
static ASIO_DECL address_v4 netmask(const address_v4 &addr)
(Deprecated: Use network_v4 class.) Obtain the netmask that corresponds to the address, based on its address class.
Definition: address_v4.ipp:149
ASIO_DECL bool is_class_b() const
(Deprecated: Use network_v4 class.) Determine whether the address is a class B address.
Definition: address_v4.ipp:127
address_v4() ASIO_NOEXCEPT
Default constructor.
Definition: address_v4.hpp:63
std::basic_ostream< Elem, Traits > & operator<<(std::basic_ostream< Elem, Traits > &os, const address_v4 &addr)
Output an address as a string.
Definition: address_v4.hpp:54
asio::detail::array< unsigned char, 4 > bytes_type
The type used to represent an address as an array of bytes.
Definition: address_v4.hpp:59
friend bool operator==(const address_v4 &a1, const address_v4 &a2) ASIO_NOEXCEPT
Compare two addresses for equality.
Definition: address_v4.hpp:166
friend bool operator!=(const address_v4 &a1, const address_v4 &a2) ASIO_NOEXCEPT
Compare two addresses for inequality.
Definition: address_v4.hpp:173
ASIO_DECL bytes_type to_bytes() const ASIO_NOEXCEPT
Get the address in bytes, in network byte order.
Definition: address_v4.ipp:60
Implements IP version 4 style addresses.
Definition: address_v4.hpp:45
uint_least32_t uint_type
The type used to represent an address as an unsigned integer.
Definition: address_v4.hpp:49
ASIO_DECL bool is_loopback() const ASIO_NOEXCEPT
Determine whether the address is a loopback address.
Definition: address_v4.ipp:111
ASIO_DECL bool is_class_c() const
(Deprecated: Use network_v4 class.) Determine whether the address is a class C address.
Definition: address_v4.ipp:132
address_v4 & operator=(const address_v4 &other) ASIO_NOEXCEPT
Assign from another address.
Definition: address_v4.hpp:89
friend bool operator>(const address_v4 &a1, const address_v4 &a2) ASIO_NOEXCEPT
Compare addresses for ordering.
Definition: address_v4.hpp:187
static address_v4 from_string(const char *str)
(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal fo...
Definition: address_v4.hpp:29
address_v4 make_address_v4(address_v4::uint_type addr)
Create an IPv4 address from an unsigned integer in host byte order.
Definition: address_v4.hpp:255
ASIO_DECL uint_type to_uint() const ASIO_NOEXCEPT
Get the address as an unsigned integer in host byte order.
Definition: address_v4.ipp:72
friend bool operator<=(const address_v4 &a1, const address_v4 &a2) ASIO_NOEXCEPT
Compare addresses for ordering.
Definition: address_v4.hpp:194
static address_v4 any() ASIO_NOEXCEPT
Obtain an address object that represents any address.
Definition: address_v4.hpp:208
ASIO_DECL std::string to_string() const
Get the address as a string in dotted decimal format.
Definition: address_v4.ipp:84
ASIO_DECL unsigned long to_ulong() const
Get the address as an unsigned long in host byte order.
Definition: address_v4.ipp:78
static address_v4 loopback() ASIO_NOEXCEPT
Obtain an address object that represents the loopback address.
Definition: address_v4.hpp:214
static address_v4 broadcast() ASIO_NOEXCEPT
Obtain an address object that represents the broadcast address.
Definition: address_v4.hpp:220
Class to represent an error code value.
Definition: error_code.hpp:80
address_v4(const address_v4 &other) ASIO_NOEXCEPT
Copy constructor.
Definition: address_v4.hpp:75
ASIO_DECL bool is_multicast() const ASIO_NOEXCEPT
Determine whether the address is a multicast address.
Definition: address_v4.ipp:138
ASIO_DECL bool is_unspecified() const ASIO_NOEXCEPT
Determine whether the address is unspecified.
Definition: address_v4.ipp:116
Definition: any_io_executor.hpp:28
Definition: format.h:3611
Definition: array_fwd.hpp:23
friend bool operator>=(const address_v4 &a1, const address_v4 &a2) ASIO_NOEXCEPT
Compare addresses for ordering.
Definition: address_v4.hpp:201