Clementine
Public Types | Public Member Functions | Static Public Member Functions | Friends | Related Functions | List of all members
asio::ip::address_v4 Class Reference

Implements IP version 4 style addresses. More...

#include <address_v4.hpp>

Public Types

typedef uint_least32_t uint_type
 The type used to represent an address as an unsigned integer.
 
typedef asio::detail::array< unsigned char, 4 > bytes_type
 The type used to represent an address as an array of bytes. More...
 

Public Member Functions

 address_v4 () ASIO_NOEXCEPT
 Default constructor.
 
ASIO_DECL address_v4 (const bytes_type &bytes)
 Construct an address from raw bytes.
 
ASIO_DECL address_v4 (uint_type addr)
 Construct an address from an unsigned integer in host byte order.
 
 address_v4 (const address_v4 &other) ASIO_NOEXCEPT
 Copy constructor.
 
address_v4operator= (const address_v4 &other) ASIO_NOEXCEPT
 Assign from another address.
 
ASIO_DECL bytes_type to_bytes () const ASIO_NOEXCEPT
 Get the address in bytes, in network byte order.
 
ASIO_DECL uint_type to_uint () const ASIO_NOEXCEPT
 Get the address as an unsigned integer in host byte order.
 
ASIO_DECL unsigned long to_ulong () const
 Get the address as an unsigned long in host byte order.
 
ASIO_DECL std::string to_string () const
 Get the address as a string in dotted decimal format.
 
ASIO_DECL std::string to_string (asio::error_code &ec) const
 (Deprecated: Use other overload.) Get the address as a string in dotted decimal format. More...
 
ASIO_DECL bool is_loopback () const ASIO_NOEXCEPT
 Determine whether the address is a loopback address.
 
ASIO_DECL bool is_unspecified () const ASIO_NOEXCEPT
 Determine whether the address is unspecified.
 
ASIO_DECL bool is_class_a () const
 (Deprecated: Use network_v4 class.) Determine whether the address is a class A address. More...
 
ASIO_DECL bool is_class_b () const
 (Deprecated: Use network_v4 class.) Determine whether the address is a class B address. More...
 
ASIO_DECL bool is_class_c () const
 (Deprecated: Use network_v4 class.) Determine whether the address is a class C address. More...
 
ASIO_DECL bool is_multicast () const ASIO_NOEXCEPT
 Determine whether the address is a multicast address.
 

Static Public Member Functions

static address_v4 from_string (const char *str)
 (Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. More...
 
static address_v4 from_string (const char *str, asio::error_code &ec)
 (Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. More...
 
static address_v4 from_string (const std::string &str)
 (Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. More...
 
static address_v4 from_string (const std::string &str, asio::error_code &ec)
 (Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form. More...
 
static address_v4 any () ASIO_NOEXCEPT
 Obtain an address object that represents any address.
 
static address_v4 loopback () ASIO_NOEXCEPT
 Obtain an address object that represents the loopback address.
 
static address_v4 broadcast () ASIO_NOEXCEPT
 Obtain an address object that represents the broadcast address.
 
static ASIO_DECL address_v4 broadcast (const address_v4 &addr, const address_v4 &mask)
 (Deprecated: Use network_v4 class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. More...
 
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. More...
 

Friends

bool operator== (const address_v4 &a1, const address_v4 &a2) ASIO_NOEXCEPT
 Compare two addresses for equality.
 
bool operator!= (const address_v4 &a1, const address_v4 &a2) ASIO_NOEXCEPT
 Compare two addresses for inequality.
 
bool operator< (const address_v4 &a1, const address_v4 &a2) ASIO_NOEXCEPT
 Compare addresses for ordering.
 
bool operator> (const address_v4 &a1, const address_v4 &a2) ASIO_NOEXCEPT
 Compare addresses for ordering.
 
bool operator<= (const address_v4 &a1, const address_v4 &a2) ASIO_NOEXCEPT
 Compare addresses for ordering.
 
bool operator>= (const address_v4 &a1, const address_v4 &a2) ASIO_NOEXCEPT
 Compare addresses for ordering.
 

Related Functions

(Note that these are not member functions.)

address_v4 make_address_v4 (const address_v4::bytes_type &bytes)
 Create an IPv4 address from raw bytes in network order.
 
address_v4 make_address_v4 (address_v4::uint_type addr)
 Create an IPv4 address from an unsigned integer in host byte order.
 
ASIO_DECL address_v4 make_address_v4 (const char *str)
 Create an IPv4 address from an IP address string in dotted decimal form.
 
ASIO_DECL address_v4 make_address_v4 (const char *str, asio::error_code &ec) ASIO_NOEXCEPT
 Create an IPv4 address from an IP address string in dotted decimal form.
 
ASIO_DECL address_v4 make_address_v4 (const std::string &str)
 Create an IPv4 address from an IP address string in dotted decimal form.
 
ASIO_DECL address_v4 make_address_v4 (const std::string &str, asio::error_code &ec) ASIO_NOEXCEPT
 Create an IPv4 address from an IP address string in dotted decimal form.
 
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. More...
 
ASIO_DECL address_v4 make_address_v4 (v4_mapped_t, const address_v6 &v6_addr)
 Create an IPv4 address from a IPv4-mapped IPv6 address.
 
network_v4 make_network_v4 (const address_v4 &addr, unsigned short prefix_len)
 Create an IPv4 network from an address and prefix length.
 
network_v4 make_network_v4 (const address_v4 &addr, const address_v4 &mask)
 Create an IPv4 network from an address and netmask.
 
template<typename Elem , typename Traits >
std::basic_ostream< Elem, Traits > & operator<< (std::basic_ostream< Elem, Traits > &os, const network_v4 &net)
 Output a network as a string. More...
 

Detailed Description

Implements IP version 4 style addresses.

The asio::ip::address_v4 class provides the ability to use and manipulate IP version 4 addresses.

Thread Safety
Distinct objects: Safe.
Shared objects: Unsafe.

Member Typedef Documentation

◆ bytes_type

The type used to represent an address as an array of bytes.

Note
This type is defined in terms of the C++0x template std::array when it is available. Otherwise, it uses boost:array.

Member Function Documentation

◆ broadcast()

address_v4 asio::ip::address_v4::broadcast ( const address_v4 addr,
const address_v4 mask 
)
static

(Deprecated: Use network_v4 class.) Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask.

◆ from_string() [1/4]

address_v4 asio::ip::address_v4::from_string ( const char *  str)
inlinestatic

(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form.

◆ from_string() [2/4]

address_v4 asio::ip::address_v4::from_string ( const char *  str,
asio::error_code ec 
)
inlinestatic

(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form.

◆ from_string() [3/4]

address_v4 asio::ip::address_v4::from_string ( const std::string &  str)
inlinestatic

(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form.

◆ from_string() [4/4]

address_v4 asio::ip::address_v4::from_string ( const std::string &  str,
asio::error_code ec 
)
inlinestatic

(Deprecated: Use make_address_v4().) Create an address from an IP address string in dotted decimal form.

◆ is_class_a()

bool asio::ip::address_v4::is_class_a ( ) const

(Deprecated: Use network_v4 class.) Determine whether the address is a class A address.

◆ is_class_b()

bool asio::ip::address_v4::is_class_b ( ) const

(Deprecated: Use network_v4 class.) Determine whether the address is a class B address.

◆ is_class_c()

bool asio::ip::address_v4::is_class_c ( ) const

(Deprecated: Use network_v4 class.) Determine whether the address is a class C address.

◆ netmask()

address_v4 asio::ip::address_v4::netmask ( const address_v4 addr)
static

(Deprecated: Use network_v4 class.) Obtain the netmask that corresponds to the address, based on its address class.

◆ to_string()

std::string asio::ip::address_v4::to_string ( asio::error_code ec) const

(Deprecated: Use other overload.) Get the address as a string in dotted decimal format.

Friends And Related Function Documentation

◆ operator<<() [1/2]

template<typename Elem , typename Traits >
std::basic_ostream< Elem, Traits > & operator<< ( std::basic_ostream< Elem, Traits > &  os,
const network_v4 net 
)
related

Output a network as a string.

Used to output a human-readable string for a specified network.

Parameters
osThe output stream to which the string will be written.
netThe network to be written.
Returns
The output stream.

◆ operator<<() [2/2]

template<typename Elem , typename Traits >
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.

Parameters
osThe output stream to which the string will be written.
addrThe address to be written.
Returns
The output stream.

The documentation for this class was generated from the following files: