Boost C++ Libraries Home Libraries People FAQ More

Home | Reference | Tutorial | Examples | Design
Reference Index | Class Hierarchy | Class Index | Member Index

boost::asio::ip::address_v4 Class Reference

List of all members.

Detailed Description

Implements IP version 4 style addresses.

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

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


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_v4operator= (const address_v4 &other)
 Assign from another address.
address_v4operator= (unsigned long addr)
 Assign from an unsigned long.
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.
template<typename Error_Handler>
std::string to_string (Error_Handler error_handler) 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_class_D () const
 Determine whether the address is a class D 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.
template<typename Error_Handler>
static address_v4 from_string (const char *str, Error_Handler error_handler)
 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.
template<typename Error_Handler>
static address_v4 from_string (const std::string &str, Error_Handler error_handler)
 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.

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.

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.


Member Typedef Documentation

typedef boost::array<unsigned char, 4> boost::asio::ip::address_v4::bytes_type

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


Constructor & Destructor Documentation

boost::asio::ip::address_v4::address_v4 (  ) 

Default constructor.

boost::asio::ip::address_v4::address_v4 ( const bytes_type bytes  )  [explicit]

Construct an address from raw bytes.

boost::asio::ip::address_v4::address_v4 ( unsigned long  addr  )  [explicit]

Construct an address from a unsigned long in host byte order.

boost::asio::ip::address_v4::address_v4 ( const address_v4 other  ) 

Copy constructor.


Member Function Documentation

address_v4& boost::asio::ip::address_v4::operator= ( const address_v4 other  ) 

Assign from another address.

address_v4& boost::asio::ip::address_v4::operator= ( unsigned long  addr  ) 

Assign from an unsigned long.

bytes_type boost::asio::ip::address_v4::to_bytes (  )  const

Get the address in bytes.

unsigned long boost::asio::ip::address_v4::to_ulong (  )  const

Get the address as an unsigned long in host byte order.

std::string boost::asio::ip::address_v4::to_string (  )  const

Get the address as a string in dotted decimal format.

template<typename Error_Handler>
std::string boost::asio::ip::address_v4::to_string ( Error_Handler  error_handler  )  const

Get the address as a string in dotted decimal format.

static address_v4 boost::asio::ip::address_v4::from_string ( const char *  str  )  [static]

Create an address from an IP address string in dotted decimal form.

template<typename Error_Handler>
static address_v4 boost::asio::ip::address_v4::from_string ( const char *  str,
Error_Handler  error_handler 
) [static]

Create an address from an IP address string in dotted decimal form.

static address_v4 boost::asio::ip::address_v4::from_string ( const std::string &  str  )  [static]

Create an address from an IP address string in dotted decimal form.

template<typename Error_Handler>
static address_v4 boost::asio::ip::address_v4::from_string ( const std::string &  str,
Error_Handler  error_handler 
) [static]

Create an address from an IP address string in dotted decimal form.

bool boost::asio::ip::address_v4::is_class_A (  )  const

Determine whether the address is a class A address.

bool boost::asio::ip::address_v4::is_class_B (  )  const

Determine whether the address is a class B address.

bool boost::asio::ip::address_v4::is_class_C (  )  const

Determine whether the address is a class C address.

bool boost::asio::ip::address_v4::is_class_D (  )  const

Determine whether the address is a class D address.

bool boost::asio::ip::address_v4::is_multicast (  )  const

Determine whether the address is a multicast address.

static address_v4 boost::asio::ip::address_v4::any (  )  [static]

Obtain an address object that represents any address.

static address_v4 boost::asio::ip::address_v4::loopback (  )  [static]

Obtain an address object that represents the loopback address.

static address_v4 boost::asio::ip::address_v4::broadcast (  )  [static]

Obtain an address object that represents the broadcast address.


Friends And Related Function Documentation

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.

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:
os The output stream to which the string will be written.
addr The address to be written.
Returns:
The output stream.

Copyright © 2003 - 2006 Christopher M. Kohlhoff


Home | Reference | Tutorial | Examples | Design