conexus logo

Conexus::IPv4::Address Class Reference
[IPv4 Endpoints]

IPv4 network address. More...

#include <ipv4_address.h>

Inheritance diagram for Conexus::IPv4::Address:

Inheritance graph
[legend]

List of all members.

Public Types

typedef ConexusPointer< Addresspointer
 Class scope smart pointer typedef.

Public Member Functions

 Address (uint32_t host=INADDR_ANY, uint16_t port=0)
 Default constructor, or if parameters are used constructs an address from a numeric address and an optional port number.
 Address (const std::string &host, uint16_t port=0)
 Address (const struct sockaddr_in &addr)
 Constructs from an IPv4 sockaddr.
 Address (const struct sockaddr_storage &addr)
 Constructs from a generic sockaddr_storage.
 Address (const struct sockaddr &addr)
 Constructs from a generic sockaddr.
 Address (const IPv6::Address &addr)
 Constructs from an IPv6 address if the IPv6 address is IPv4 compatible.
virtual ~Address ()
 Destructor.
uint32_t host () const
 Returns the IPv4 host.
std::string host_string () const
 Returns the IPv4 host as a string.
uint32_t subnet_mask () const
 Returns the subnet mask associated with this address.
std::string subnet_mask_string () const
 Returns the netmask associated with this address as a string.
unsigned prefix_length () const
 Returns the prefix length of the subnet mask associated with this address.
std::string prefix_length_string () const
 Returns the prefix length of the subnet mask associated with this address as a string.
std::string host_subnet_mask_string () const
 Returns the IPv4 host as an host/subnetmask string.
std::string cidr_host_string () const
 Returns the IPv4 host as a CIDR host/prefixlen string.
uint32_t prefix () const
 Returns the prefix part of this address.
std::string prefix_string () const
 Returns the prefix part of this address as a string.
uint32_t broadcast_address () const
 Returns the broadcast address for this address.
std::string broadcast_address_string () const
 Returns the broadcast address for this address as a string.
uint32_t local_address () const
 Returns the local part of this address.
std::string local_address_string () const
 Returns the local part of this address as a string.
uint16_t port () const
 Returns the port number associated with this address.
std::string port_string () const
 Returns the port number associated with this address as a string.
void set_host (uint32_t host)
 Set the host to the specified value.
void set_host (const std::string &host)
 Sets the address to the specified value.
virtual void set_host (const std::string &host, uint16_t port)
 Sets the host and port to the specified value.
void set_host_subnet_mask (uint32_t host, uint32_t subnet_mask)
 Sets the host to an absolute value with a specified subnet mask.
void set_host_prefix_length (uint32_t host, unsigned prefix_length)
 Sets the host to an absolute value with a specified CIDR prefix length.
void set_subnet_mask (uint32_t subnet_mask)
 Sets the subnet mask to the specified value.
void set_subnet_mask (const std::string &subnet_mask)
 Sets the subnet mask to the specified value.
void set_prefix_length (unsigned prefix_length)
 Sets the prefix length to the specified value.
void set_prefix_length (const std::string &prefix_length)
 Sets the prefix length to the specified value.
void set_port (uint16_t port)
 Sets the port portion of this address.
void set_port (const std::string &port)
 Sets the port to the specified value.
bool is_valid_hostname (const std::string &) const
 Determine whether the provided string is a valid hostname by performing a DNS query.
std::string hostname () const
 Performs a DNS query on the currently set host and returns the hostname string.
std::string servicename () const
 Performs a service name lookup on the currently set port and returns the servicename string.
bool is_private () const
 True if this address specifies a private network.
bool is_reserved () const
 True if this address is a reserved address specified as either 0.0.0.0/16 or class E (11110).
bool is_loopback () const
 True of this address is the loopback address with prefix 127.0.0.1/24.
bool is_broadcast () const
 True if this is a valid broadcast address.
bool is_multicast () const
 True if this is a valid multicast address.
bool is_any () const
 True if this is the any address.
socklen_t sockaddr_size () const
 Overrides the virtual parent method and provides the size in bytes of the underlying sockaddr_in structure.
struct sockaddr_in & sockaddr_in ()
 Provides a non-constant reference to the underlying sockaddr_in structure.
struct sockaddr_in * sockaddr_in_ptr ()
 Provides a non-constant pointer to the underlying sockaddr_in structure.
 operator struct sockaddr_in * ()
Addressoperator= (const Address &other)
Addressoperator= (const Conexus::Address &other)
bool operator== (const Address &other) const
 True if the port and host are the same.
virtual sigc::signal< void > & signal_changed ()
virtual sigc::signal< void > & signal_host_changed ()
virtual sigc::signal< void > & signal_port_changed ()
virtual sigc::signal< void > & signal_prefix_changed ()
virtual bool is_ipv4 ()
 Always true for IPv4::Address.
virtual bool is_ipv6 ()
 Never true.

Static Public Member Functions

static pointer create (uint32_t host=INADDR_ANY, uint16_t port=0)
 Creates a smart pointer from an host and port number.
static pointer create (const std::string &host, uint16_t port)
static pointer create (const struct sockaddr_in &addr)
 Creates a smart pointer from an IPv4 sockaddr_in.
static pointer create (const struct sockaddr_storage &addr)
 Creates a smart pointer from a generic sockaddr_storage.
static pointer create (const struct sockaddr &addr)
 Creates a smart pointer from a generic sockaddr.
static pointer create (const IPv6::Address &ipv6addr)
 Creates a smart pointer from an IPv6 address if the IPv6 address is IPv4 compatible.

Protected Attributes

uint32_t m_host
uint16_t m_port
unsigned m_prefix_length
 Netmask prefix length.
sigc::signal< void > m_signal_host_changed
sigc::signal< void > m_signal_port_changed
sigc::signal< void > m_signal_prefix_changed
sigc::signal< void > m_signal_changed

Related Functions

(Note that these are not member functions.)

enum  IPV4_EMBEDDED_TYPE { IPV4_COMPATIBLE, IPV4_MAPPED }
std::string host_to_string (uint32_t)
 Convert a host byte order 32-bit host to a string.
uint32_t string_to_host (const std::string &)
 Convert a string to a host byte order 32-bit host.
void string_to_host_prefix (const std::string &, uint32_t &host, int &prefix)
 Convert a string to an host and a prefix length.
bool is_valid_hostname (const std::string &)
 Determine whether the provided string is a valid hostname by performing a DNS query.
std::string host_to_hostname (uint32_t host) throw(address_exception)
 Convert a host byte order 32-bit host to a hostname string.
std::string service_to_servicename (uint16_t service) throw(address_exception)
 Convert a host byte order 16-bit port number to a service name string.
uint32_t hostname_to_host (const std::string &hostname) throw(address_exception)
 Convert a hostname string to a 32-bit host byte order host.
uint16_t servicename_to_service (const std::string &servicename) throw(address_exception)
 Convert a service name string to a 16-bit host byte order port number.
bool validate_subnet_mask (uint32_t subnet_mask) throw()
 Checks to make sure this is a valid subnet mask; i.e.
uint32_t create_subnet_mask (unsigned prefix_length)
 Given a prefix length, return a subnet mask.
unsigned subnet_mask_length (uint32_t subnet_mask) throw()
 Given a CIDR subnet mask, return the number of prefix bits.
struct in6_addr operator& (const struct in6_addr &first, const struct in6_addr &second)
struct in6_addr operator| (const struct in6_addr &first, const struct in6_addr &second)
struct in6_addr operator^ (const struct in6_addr &first, const struct in6_addr &second)
struct in6_addr operator~ (const struct in6_addr &addr)
struct in6_addr & operator&= (struct in6_addr &first, const struct in6_addr &second)
struct in6_addr & operator|= (struct in6_addr &first, const struct in6_addr &second)
struct in6_addr & operator^= (struct in6_addr &first, const struct in6_addr &second)
bool operator== (const struct in6_addr &, const struct in6_addr &)
bool operator< (const struct in6_addr &, const struct in6_addr &)
bool operator!= (const struct in6_addr &, const struct in6_addr &)
std::string host_to_string (const struct in6_addr &)
void string_to_host_prefix (const std::string &, struct in6_addr &host, int &prefix)
std::string host_to_hostname (const struct in6_addr &host) throw(address_exception)
bool validate_subnet_mask (const struct in6_addr &subnet_mask) throw()


Detailed Description

IPv4 network address.

This class represents an IPv4 address and includes support for accessing the address as a traditional sockaddr_in (a BSD socket API IPv4 network address C structure).

Host byte order and network byte order: all methods expect parameters and return values in host byte order with the following exception; if you request a sockaddr_in representation of this address, the sockaddr_in C structure will be filled with values that are already in network byte order and ready for use with raw BSD API socket calls.

Author:
Rick L Vinyard Jr <rvinyard@cs.nmsu.edu>
Examples:

factory_client.cpp, file_client.cpp, ipv4_multicast_client.cpp, ipv4_udp_client.cpp, ll_client.cpp, ll_server.cpp, and registry_client.cpp.


Member Typedef Documentation

typedef ConexusPointer<Address> Conexus::IPv4::Address::pointer

Class scope smart pointer typedef.

Reimplemented from Conexus::Address.


Constructor & Destructor Documentation

Conexus::IPv4::Address::Address ( uint32_t  host = INADDR_ANY,
uint16_t  port = 0 
)

Default constructor, or if parameters are used constructs an address from a numeric address and an optional port number.

Sets default family to AF_INET.

Parameters:
address Numeric address in local host byte order.
port Port number in local host byte order.

References Conexus::Address::m_sockaddr.

Conexus::IPv4::Address::Address ( const std::string &  host,
uint16_t  port = 0 
)

Conexus::IPv4::Address::Address ( const struct sockaddr_in &  addr  ) 

Constructs from an IPv4 sockaddr.

References m_host, m_port, and Conexus::Address::m_sockaddr.

Conexus::IPv4::Address::Address ( const struct sockaddr_storage &  addr  ) 

Constructs from a generic sockaddr_storage.

Reimplemented from Conexus::Address.

References m_host, m_port, and Conexus::Address::m_sockaddr.

Conexus::IPv4::Address::Address ( const struct sockaddr addr  ) 

Constructs from a generic sockaddr.

References m_host, m_port, and Conexus::Address::m_sockaddr.

Conexus::IPv4::Address::Address ( const IPv6::Address &  addr  ) 

Constructs from an IPv6 address if the IPv6 address is IPv4 compatible.

References Conexus::Address::m_sockaddr, and set_host().

Conexus::IPv4::Address::~Address (  )  [virtual]

Destructor.

Reimplemented from Conexus::Address.


Member Function Documentation

uint32_t Conexus::IPv4::Address::broadcast_address (  )  const

Returns the broadcast address for this address.

References host(), and subnet_mask().

Referenced by broadcast_address_string().

std::string Conexus::IPv4::Address::broadcast_address_string (  )  const

Returns the broadcast address for this address as a string.

References broadcast_address(), and host_to_string().

std::string Conexus::IPv4::Address::cidr_host_string (  )  const [virtual]

Returns the IPv4 host as a CIDR host/prefixlen string.

Implements Conexus::IPAddressInterface.

References host_string(), and prefix_length_string().

Address::pointer Conexus::IPv4::Address::create ( const IPv6::Address &  ipv6addr  )  [static]

Creates a smart pointer from an IPv6 address if the IPv6 address is IPv4 compatible.

References Conexus::Address::Address().

Address::pointer Conexus::IPv4::Address::create ( const struct sockaddr addr  )  [static]

Creates a smart pointer from a generic sockaddr.

References Conexus::Address::Address().

Address::pointer Conexus::IPv4::Address::create ( const struct sockaddr_storage &  addr  )  [static]

Creates a smart pointer from a generic sockaddr_storage.

References Conexus::Address::Address().

Address::pointer Conexus::IPv4::Address::create ( const struct sockaddr_in &  addr  )  [static]

Creates a smart pointer from an IPv4 sockaddr_in.

References Conexus::Address::Address().

Address::pointer Conexus::IPv4::Address::create ( const std::string &  host,
uint16_t  port 
) [static]

Address::pointer Conexus::IPv4::Address::create ( uint32_t  host = INADDR_ANY,
uint16_t  port = 0 
) [static]

Creates a smart pointer from an host and port number.

References Conexus::Address::Address().

uint32_t Conexus::IPv4::Address::host (  )  const

Returns the IPv4 host.

Examples:
ll_client.cpp.

References m_host.

Referenced by broadcast_address(), local_address(), and prefix().

std::string Conexus::IPv4::Address::host_string (  )  const [virtual]

Returns the IPv4 host as a string.

Implements Conexus::IPAddressInterface.

Examples:
ll_server.cpp.

References host_to_string(), and m_host.

Referenced by cidr_host_string(), and host_subnet_mask_string().

std::string Conexus::IPv4::Address::host_subnet_mask_string (  )  const [virtual]

Returns the IPv4 host as an host/subnetmask string.

Implements Conexus::IPAddressInterface.

References host_string(), and subnet_mask_string().

std::string Conexus::IPv4::Address::hostname (  )  const [virtual]

Performs a DNS query on the currently set host and returns the hostname string.

Implements Conexus::IPAddressInterface.

References host_to_hostname(), and m_host.

bool Conexus::IPv4::Address::is_any (  )  const [virtual]

True if this is the any address.

Implements Conexus::IPAddressInterface.

References m_host.

bool Conexus::IPv4::Address::is_broadcast (  )  const [virtual]

True if this is a valid broadcast address.

Reimplemented from Conexus::Address.

References m_host, and subnet_mask().

Referenced by Conexus::IPv4::UDPPoset::add_destination(), and Conexus::IPv4::UDP::bind().

bool Conexus::IPv4::Address::is_ipv4 (  )  [virtual]

Always true for IPv4::Address.

Implements Conexus::IPAddressInterface.

bool Conexus::IPv4::Address::is_ipv6 (  )  [virtual]

Never true.

Implements Conexus::IPAddressInterface.

bool Conexus::IPv4::Address::is_loopback (  )  const [virtual]

True of this address is the loopback address with prefix 127.0.0.1/24.

Implements Conexus::IPAddressInterface.

References m_host.

bool Conexus::IPv4::Address::is_multicast (  )  const [virtual]

bool Conexus::IPv4::Address::is_private (  )  const

True if this address specifies a private network.

For reference, private networks are defined as:

  • 10.0.0.0 to 10.255.255.255 (10/8 prefix)
  • 172.16.0.0 to 172.31.255.255 (172.16/12 prefix)
  • 192.168.0.0 to 192.168.255.255 (192.168/16 prefix)

References m_host.

bool Conexus::IPv4::Address::is_reserved (  )  const

True if this address is a reserved address specified as either 0.0.0.0/16 or class E (11110).

References m_host.

bool Conexus::IPv4::Address::is_valid_hostname ( const std::string &  name  )  const

Determine whether the provided string is a valid hostname by performing a DNS query.

References hostname_to_host().

uint32_t Conexus::IPv4::Address::local_address (  )  const

Returns the local part of this address.

References host(), and subnet_mask().

Referenced by local_address_string().

std::string Conexus::IPv4::Address::local_address_string (  )  const [virtual]

Returns the local part of this address as a string.

Implements Conexus::IPAddressInterface.

References host_to_string(), and local_address().

Conexus::IPv4::Address::operator struct sockaddr_in * (  ) 

Address & Conexus::IPv4::Address::operator= ( const Conexus::Address other  ) 

Address & Conexus::IPv4::Address::operator= ( const Address other  ) 

bool Conexus::IPv4::Address::operator== ( const Address other  )  const

True if the port and host are the same.

References m_host, and m_port.

uint16_t Conexus::IPv4::Address::port (  )  const [virtual]

Returns the port number associated with this address.

Implements Conexus::IPAddressInterface.

References m_port.

Referenced by Conexus::NSPR::UDP::bind().

std::string Conexus::IPv4::Address::port_string (  )  const [virtual]

Returns the port number associated with this address as a string.

Implements Conexus::IPAddressInterface.

References m_port.

uint32_t Conexus::IPv4::Address::prefix (  )  const

Returns the prefix part of this address.

References host(), and subnet_mask().

Referenced by prefix_string(), and set_host().

unsigned Conexus::IPv4::Address::prefix_length (  )  const [virtual]

Returns the prefix length of the subnet mask associated with this address.

Implements Conexus::IPAddressInterface.

References m_prefix_length.

Referenced by prefix_length_string().

std::string Conexus::IPv4::Address::prefix_length_string (  )  const [virtual]

Returns the prefix length of the subnet mask associated with this address as a string.

Implements Conexus::IPAddressInterface.

References prefix_length().

Referenced by cidr_host_string().

std::string Conexus::IPv4::Address::prefix_string (  )  const [virtual]

Returns the prefix part of this address as a string.

Implements Conexus::IPAddressInterface.

References host_to_string(), and prefix().

std::string Conexus::IPv4::Address::servicename (  )  const [virtual]

Performs a service name lookup on the currently set port and returns the servicename string.

Implements Conexus::IPAddressInterface.

References m_port, and service_to_servicename().

void Conexus::IPv4::Address::set_host ( const std::string &  host,
uint16_t  port 
) [virtual]

void Conexus::IPv4::Address::set_host ( const std::string &  host  )  [virtual]

Sets the address to the specified value.

If this is not a numeric specification, a DNS query will be performed. Accepts addresses of the following forms: # aaa.aaa.aaa.aaa[/nnn.nnn.nnn.nnn | /bb][:ppppp | :servicename] # hostname[/nnn.nnn.nnn.nnn | /bb][:ppppp | :servicename] Where:

  • aaa.aaa.aaa.aaa is an address in dotted decimal form
  • hostname is a host name
  • nnn.nnn.nnn.nnn is an optional subnet mask in dotted decimal form
  • bb is an optional prefix length
  • ppppp is an optional port specification
  • servicename is an optional service name specification

Implements Conexus::IPAddressInterface.

References m_host, m_prefix_length, m_signal_changed, m_signal_host_changed, m_signal_prefix_changed, Conexus::Address::m_sockaddr, prefix(), and string_to_host_prefix().

void Conexus::IPv4::Address::set_host ( uint32_t  host  ) 

void Conexus::IPv4::Address::set_host_prefix_length ( uint32_t  host,
unsigned  prefix_length 
)

Sets the host to an absolute value with a specified CIDR prefix length.

References m_host, m_prefix_length, m_signal_changed, m_signal_host_changed, m_signal_prefix_changed, and Conexus::Address::m_sockaddr.

void Conexus::IPv4::Address::set_host_subnet_mask ( uint32_t  host,
uint32_t  subnet_mask 
)

Sets the host to an absolute value with a specified subnet mask.

References m_host, m_prefix_length, m_signal_changed, m_signal_host_changed, m_signal_prefix_changed, Conexus::Address::m_sockaddr, and subnet_mask_length().

void Conexus::IPv4::Address::set_port ( const std::string &  port  )  [virtual]

void Conexus::IPv4::Address::set_port ( uint16_t  port  )  [virtual]

void Conexus::IPv4::Address::set_prefix_length ( const std::string &  prefix_length  )  [virtual]

Sets the prefix length to the specified value.

Implements Conexus::IPAddressInterface.

References m_prefix_length, m_signal_changed, and m_signal_prefix_changed.

void Conexus::IPv4::Address::set_prefix_length ( unsigned  prefix_length  )  [virtual]

Sets the prefix length to the specified value.

Implements Conexus::IPAddressInterface.

References m_prefix_length, m_signal_changed, and m_signal_prefix_changed.

Referenced by set_subnet_mask().

void Conexus::IPv4::Address::set_subnet_mask ( const std::string &  subnet_mask  ) 

Sets the subnet mask to the specified value.

References set_prefix_length(), string_to_host(), and subnet_mask_length().

void Conexus::IPv4::Address::set_subnet_mask ( uint32_t  subnet_mask  ) 

Sets the subnet mask to the specified value.

References set_prefix_length(), and subnet_mask_length().

sigc::signal< void > & Conexus::IPv4::Address::signal_changed (  )  [virtual]

sigc::signal< void > & Conexus::IPv4::Address::signal_host_changed (  )  [virtual]

sigc::signal< void > & Conexus::IPv4::Address::signal_port_changed (  )  [virtual]

sigc::signal< void > & Conexus::IPv4::Address::signal_prefix_changed (  )  [virtual]

struct sockaddr_in & Conexus::IPv4::Address::sockaddr_in (  )  [read]

Provides a non-constant reference to the underlying sockaddr_in structure.

References Conexus::Address::m_sockaddr.

Referenced by Conexus::IPv4::UDP::join(), Conexus::IPv4::UDP::leave(), operator=(), and sockaddr_size().

struct sockaddr_in * Conexus::IPv4::Address::sockaddr_in_ptr (  )  [read]

Provides a non-constant pointer to the underlying sockaddr_in structure.

References Conexus::Address::m_sockaddr.

socklen_t Conexus::IPv4::Address::sockaddr_size (  )  const [virtual]

Overrides the virtual parent method and provides the size in bytes of the underlying sockaddr_in structure.

Reimplemented from Conexus::Address.

References sockaddr_in().

uint32_t Conexus::IPv4::Address::subnet_mask (  )  const

Returns the subnet mask associated with this address.

References create_subnet_mask(), and m_prefix_length.

Referenced by broadcast_address(), is_broadcast(), local_address(), prefix(), and subnet_mask_string().

std::string Conexus::IPv4::Address::subnet_mask_string (  )  const [virtual]

Returns the netmask associated with this address as a string.

Implements Conexus::IPAddressInterface.

References host_to_string(), and subnet_mask().

Referenced by host_subnet_mask_string().


Friends And Related Function Documentation

struct in6_addr create_subnet_mask ( unsigned  prefix_length  )  [related]

Given a prefix length, return a subnet mask.

Given a prefix length, return a subnet mask.

Referenced by subnet_mask().

std::string host_to_hostname ( const struct in6_addr &  host  )  throw(address_exception) [related]

Given an host, look up the hostname. Unlike the other functions in this section, this is not quite a thin wrapper around getnameinfo(). This function will try to first look for the name in the IPv6 domain. However, getnameinfo() returns a success on an IPv4 mapped host, but returns the host string rather than the hostname. Therefore, this function checks to see if any ':' characters are present in the returned name and tries an IPv4 lookup to get the IPv4 hostname.

std::string host_to_hostname ( uint32_t  host  )  throw(address_exception) [related]

Convert a host byte order 32-bit host to a hostname string.

Referenced by hostname().

std::string host_to_string ( const struct in6_addr &   )  [related]

Given an IPv6 host, returns a string representation. This is just a very thin convenience wrapper around inet_ntop() for IPv6 addresses.

std::string host_to_string ( uint32_t   )  [related]

Convert a host byte order 32-bit host to a string.

Referenced by broadcast_address_string(), host_string(), local_address_string(), prefix_string(), and subnet_mask_string().

struct in6_addr hostname_to_host ( const std::string &  hostname  )  throw(address_exception) [related]

Convert a hostname string to a 32-bit host byte order host.

Given a hostname, get the IPv6 host. This function will performa a hostname lookup and return either the IPv6 host of the host, or an IPv4 mapped host if an IPv6 host is not available.

Referenced by is_valid_hostname().

enum IPV4_EMBEDDED_TYPE [related]

Enumerator:
IPV4_COMPATIBLE 
IPV4_MAPPED 

bool is_valid_hostname ( const std::string &   )  [related]

Determine whether the provided string is a valid hostname by performing a DNS query.

Determine whether the provided string is a valid hostname by performing a DNS query.

bool operator!= ( const struct in6_addr &  ,
const struct in6_addr &   
) [related]

struct in6_addr operator& ( const struct in6_addr &  first,
const struct in6_addr &  second 
) [related]

struct in6_addr & operator&= ( struct in6_addr &  first,
const struct in6_addr &  second 
) [related]

bool operator< ( const struct in6_addr &  ,
const struct in6_addr &   
) [related]

bool operator== ( const struct in6_addr &  ,
const struct in6_addr &   
) [related]

struct in6_addr operator^ ( const struct in6_addr &  first,
const struct in6_addr &  second 
) [related]

struct in6_addr & operator^= ( struct in6_addr &  first,
const struct in6_addr &  second 
) [related]

struct in6_addr operator| ( const struct in6_addr &  first,
const struct in6_addr &  second 
) [related]

struct in6_addr & operator|= ( struct in6_addr &  first,
const struct in6_addr &  second 
) [related]

struct in6_addr operator~ ( const struct in6_addr &  addr  )  [related]

std::string service_to_servicename ( uint16_t  service  )  throw(address_exception) [related]

Convert a host byte order 16-bit port number to a service name string.

Given a service port number, returns a string name of the service. This is just a very thin convenience wrapper around getnameinfo().

Referenced by servicename().

uint16_t servicename_to_service ( const std::string &  servicename  )  throw(address_exception) [related]

Convert a service name string to a 16-bit host byte order port number.

Given a service name, returns the port number of the service. This is just a very thin convenience wrapper around getaddrinfo().

Referenced by set_port().

struct in6_addr string_to_host ( const std::string &   )  [related]

Convert a string to a host byte order 32-bit host.

Given a string, converts to an IPv6 host. This is just a very thin convenience wrapper around inet_pton() for IPv6 addresses.

Referenced by set_subnet_mask().

void string_to_host_prefix ( const std::string &  ,
struct in6_addr &  host,
int &  prefix 
) [related]

Convert a string to an host and a prefix length

void string_to_host_prefix ( const std::string &  ,
uint32_t &  host,
int &  prefix 
) [related]

Convert a string to an host and a prefix length.

Referenced by set_host().

unsigned subnet_mask_length ( uint32_t  subnet_mask  )  throw() [related]

Given a CIDR subnet mask, return the number of prefix bits.

Referenced by set_host_subnet_mask(), and set_subnet_mask().

bool validate_subnet_mask ( const struct in6_addr &  subnet_mask  )  throw() [related]

Checks to make sure this is a valid subnet mask; i.e. all 1's followed by all 0's

bool validate_subnet_mask ( uint32_t  subnet_mask  )  throw() [related]

Checks to make sure this is a valid subnet mask; i.e.

all 1's followed by all 0's


Member Data Documentation

uint32_t Conexus::IPv4::Address::m_host [protected]

uint16_t Conexus::IPv4::Address::m_port [protected]

sigc::signal<void> Conexus::IPv4::Address::m_signal_changed [protected]

sigc::signal<void> Conexus::IPv4::Address::m_signal_host_changed [protected]

sigc::signal<void> Conexus::IPv4::Address::m_signal_port_changed [protected]

sigc::signal<void> Conexus::IPv4::Address::m_signal_prefix_changed [protected]


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

Generated on Wed Jul 8 15:51:27 2009 for conexus by doxygen 1.5.8