Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

inet_address Class Reference

Inherits address.

List of all members.


Detailed Description

An IP address and port.

Currently only IPv4 addresses are supported, but this class may encapsulate IPv6 addresses as well in the future.


Public Types

typedef unsigned int port
 The type used to represent a port.


Public Methods

 inet_address ()
 Constructs an empty address.

 inet_address (port pt)
 Constructs an address from a port (using INADDR_ANY as the host).

 inet_address (string ip, port pt=0)
 Constructs an address from a host name and port.

 inet_address (string ip, string pt)
 Constructs an address from a host name and port string.

 inet_address (const address &other)
 Coerces an address to an IP address, yielding an empty address if the address is not an IP address.

string get_host () const
 Returns the host as a dotted-quad string.

string get_hostname () const
 Returns the hostname, as obtained by gethostbyaddr.

port get_port () const
 Returns the port (or zero if none).

string as_string () const
 Returns a human-readable version of this address.

 NMSTL_SIMPLY_SERIALIZABLE (inet_address,<< addr)

Static Public Methods

string local_hostname ()

Protected Methods

const sockaddr_in * inetaddr () const


Member Typedef Documentation

typedef unsigned int inet_address::port
 

The type used to represent a port.


Constructor & Destructor Documentation

inet_address::inet_address  
 

Constructs an empty address.

inet_address::inet_address port    pt
 

Constructs an address from a port (using INADDR_ANY as the host).

inet_address::inet_address string    ip,
port    pt = 0
 

Constructs an address from a host name and port.

If the host name is not a dotted quad, this constructor will call gethostbyname to look up the address and thus may block.

inet_address::inet_address string    ip,
string    pt
 

Constructs an address from a host name and port string.

If the host name is not a dotted quad, this constructor will call gethostbyname to look up the address and thus may block.

inet_address::inet_address const address   other [explicit]
 

Coerces an address to an IP address, yielding an empty address if the address is not an IP address.


Member Function Documentation

string inet_address::as_string   const
 

Returns a human-readable version of this address.

Reimplemented from address.

string inet_address::get_host   const
 

Returns the host as a dotted-quad string.

string inet_address::get_hostname   const
 

Returns the hostname, as obtained by gethostbyaddr.

This method may block.

port inet_address::get_port   const
 

Returns the port (or zero if none).

const sockaddr_in* inet_address::inetaddr   const [protected]
 

string inet_address::local_hostname   [static]
 

inet_address::NMSTL_SIMPLY_SERIALIZABLE inet_address   ,
<<    addr
 


The documentation for this class was generated from the following file:
Generated on Fri Dec 20 13:35:10 2002 for NMSTL