SourcePro® API Reference Guide

 
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Related Functions
RWInet6Host Class Reference

Encapsulates an Internet host IPv6 address and its names. More...

#include <rw/network/RWInet6Host.h>

Public Types

enum  NameLookup { numeric }
 

Public Member Functions

 RWInet6Host (void)
 
 RWInet6Host (struct in6_addr IPAddress)
 
 RWInet6Host (const RWCString &hostname)
 
 RWInet6Host (const char *)
 
struct in6_addr getAddress () const
 
RWTValVector< struct in6_addr > getAddresses () const
 
RWTValVector< RWCStringgetAliases () const
 
RWCString getName () const
 
RWCString id (unsigned level=0) const
 
bool operator!= (const RWInet6Host &rhs) const
 
bool operator== (const RWInet6Host &rhs) const
 
void prepare () const
 
void prepare (NameLookup lookup) const
 

Static Public Member Functions

static RWCString addressAsString (struct in6_addr IPAddress)
 
static RWInet6Host me ()
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &strm, const RWInet6Host &host)
 

Detailed Description

Encapsulates an Internet host IPv6 address and its names. You can construct an RWInet6Host from either an IPv6 address or a symbolic name.

Member Enumeration Documentation

Attributes to change name lookup behavior.

Enumerator
numeric 

If the host address is already known, a lookup will not be used to discover the host name. The colon-hexadecimal form of the host address will be used as the host name.

Constructor & Destructor Documentation

RWInet6Host::RWInet6Host ( void  )

An Internet host can be specified as an actual address or through a string. The string can be either the symbolic name of the host or an IPv6 hex address. The default constructor creates a special host that represents an unspecified IPv6 address on the current machine. This is useful when constructing servers.

RWInet6Host::RWInet6Host ( struct in6_addr  IPAddress)

An Internet host can be specified as an actual address or through a string. The string can be either the symbolic name of the host or an IPv6 hex address. The default constructor creates a special host that represents an unspecified IPv6 address on the current machine. This is useful when constructing servers.

RWInet6Host::RWInet6Host ( const RWCString hostname)

An Internet host can be specified as an actual address or through a string. The string can be either the symbolic name of the host or an IPv6 hex address. The default constructor creates a special host that represents an unspecified IPv6 address on the current machine. This is useful when constructing servers.

RWInet6Host::RWInet6Host ( const char *  )

An Internet host can be specified as an actual address or through a string. The string can be either the symbolic name of the host or an IPv6 hex address. The default constructor creates a special host that represents an unspecified IPv6 address on the current machine. This is useful when constructing servers.

Member Function Documentation

static RWCString RWInet6Host::addressAsString ( struct in6_addr  IPAddress)
static

Takes an address as an in6_addr and returns the IPv6 hex address string representation of the address. To go from an IPv6 hex address string to an address, build an RWInet6Host object from the IPv6 hex address string.

struct in6_addr RWInet6Host::getAddress ( ) const

Returns the primary IPv6 address for this host entry as an in6_addr. If you want to print out an IPv6 address, use the addressAsString() static member function.

RWTValVector<struct in6_addr> RWInet6Host::getAddresses ( ) const

Returns a list of addresses for this host entry as in6_addr structs. If you want to print out an IPv6 address, use the addressAsString() static member function. The primary address is the first entry in the getAddresses() array. This call may block if prepare() has not been called.

RWTValVector<RWCString> RWInet6Host::getAliases ( ) const

Returns the list of aliases for this host entry. The official name is not included in the list of aliases. This call may block if prepare() has not been called.

Note
This method is provided only for compatibility with RWInetHost, and will return an empty collection.
RWCString RWInet6Host::getName ( ) const

Returns the official name for this host entry. This call may block if prepare() has not been called.

RWCString RWInet6Host::id ( unsigned  level = 0) const

Returns a string describing self. The verbosity of the output is controlled by level, where level=0 is the most basic output, and level=9 is the most verbose.

Depending on the level and input provided, the output may contain the host name or IP address, and known aliases for that name and aliased IP addresses.

Grammar Definitions

ip-address ::= <ip address in colon hexadecimal notation>
ip-address-list ::= ip-address ("," ip-address)*
hostname ::= <domain name>
host ::= hostname | ip-address
alias-list ::= "(" hostname ("," hostname)* ")"
level Calls prepare() Output Grammar Sample Output for id(level) given RWInet6Host("localhost")
0 host localhost
1 host localhost
2 host localhost
3 X host localhost
4 X host "(" ip-address ")" localhost(::1)
5 X host "(" ip-address ")" localhost(::1)
6 X host localhost
7 X host "(" ip-address ")" localhost(::1)
8 X host "(" ip-address ")" localhost(::1)
9 X host (alias-list)? "(" ip-address-list ")" localhost(::1)
static RWInet6Host RWInet6Host::me ( )
static

Returns the host object for the host on which this program is currently running.

bool RWInet6Host::operator!= ( const RWInet6Host rhs) const

Return true or false to indicate whether two hosts objects are equal or not.

bool RWInet6Host::operator== ( const RWInet6Host rhs) const

Return true or false to indicate whether two hosts objects are equal or not.

void RWInet6Host::prepare ( ) const

Ensures that no future operations block. The prepare() function calls the host database routines to gather information about this host. It is not necessary to explicitly call prepare() because it is called by other member functions if needed. No exceptions are thrown by prepare().

void RWInet6Host::prepare ( NameLookup  lookup) const

Ensures that no future operations block. The prepare() function calls the host database routines to gather information about this host. It is not necessary to explicitly call prepare() because it is called by other member functions if needed. No exceptions are thrown by prepare().

Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  strm,
const RWInet6Host host 
)
related

Outputs a representation of host on strm. The representation is generated using the member function host.id() with level=0.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.