protlib::hostaddress Class Reference

IP Host Address. More...

#include <source/ariba/utility/transport/tcpip/protlib/address.h>

Inherits protlib::address.

Inherited by protlib::appladdress, and protlib::netaddress.

Collaboration diagram for protlib::hostaddress:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual hostaddressnew_instance () const
virtual hostaddresscopy () const
virtual bool operator== (const address &ie) const
 hostaddress ()
 constructor
 hostaddress (const hostaddress &h)
 copy constructor
hostaddressoperator= (const hostaddress &h)
 assignment
 hostaddress (const char *str, bool *res=NULL)
 constructor from string
 hostaddress (const struct in6_addr &ipv6addr)
 constructor from in6_addr
virtual ~hostaddress ()
 destructor
bool set_ipv4 (const char *str)
 set IPv4 from string
void set_ip (const struct in_addr &in)
 set IPv4 from in_addr
bool set_ipv6 (const char *str)
 set IPv6 from string
void set_ip (const struct in6_addr &in)
 set IPv6 from in6_addr
bool set_ip (const char *str)
 set IPv4 or IPv6 from string
bool set_ip (const string &str)
void set_ip (const hostaddress &h)
 set IP from hostaddress
bool is_ip_unspec () const
 is IP unspecified
const char * get_ip_str () const
 get ip address as string
const char * get_ip_str (char *str) const
 get ip address as string
bool is_ipv4 () const
 is it IPv4
bool is_ipv6 () const
 is it IPv6
bool is_bogus_source () const
 is bogus source (e.g. localhost, multicast)
bool is_mapped_ip () const
 is it a 4to6-mapped address?
bool get_ip (struct in_addr &in) const
 get as in_addr?
bool get_ip (struct in6_addr &in) const
 get as in6_addr?
struct in6_addr * get_ip () const
 get as in6_addr?
virtual void convert_to_ipv6 ()
 convert to iPv6
virtual bool equiv (const hostaddress &h) const
 are they equivalent
string get_host_name (bool *res=NULL) const
 lookup host name
virtual size_t get_hash () const
 hash function
virtual int match_against (const hostaddress &ha) const
 match against IP address
virtual int match_against (const netaddress &na) const
 match against network prefix
void clear_ip ()
 clear IP buffer (sets IP address to undefined/any and deletes any outstring)

Protected Member Functions

virtual void set_subtype (bool ipv4)
 set subtype and IPv4 flag

Protected Attributes

bool ipv4flag
 IPv4 flag.
union {
   struct in_addr   ipv4addr
 IPv4 address.
   struct in6_addr   ipv6addr
 IPv6 address.
}; 
 IP buffer.

Private Attributes

char * outstring
 pointer to IP string representation


Detailed Description

IP Host Address.

This class can hold IPv4 and IPv6 Host Addresses.

Definition at line 112 of file address.h.


Constructor & Destructor Documentation

protlib::hostaddress::hostaddress (  )  [inline]

constructor

Initialize a hostaddress object. This calls virtual member set_subtype and therefore sets subtype in all derived class which overwrite this member function correctly.

Definition at line 1253 of file address.h.

References clear_ip(), and set_subtype().

Referenced by copy(), and new_instance().

protlib::hostaddress::hostaddress ( const hostaddress h  )  [inline]

copy constructor

Copy constructor for hostaddress objects

Definition at line 1277 of file address.h.

References set_ip().

protlib::hostaddress::hostaddress ( const struct in6_addr &  ipv6addr  )  [inline]

constructor from in6_addr

Definition at line 204 of file address.h.

References set_subtype().

protlib::hostaddress::~hostaddress (  )  [inline, virtual]

destructor

Delete outstring if it exists.

Definition at line 1315 of file address.h.

References outstring.


Member Function Documentation

size_t protlib::hostaddress::get_hash (  )  const [inline, virtual]

string protlib::hostaddress::get_host_name ( bool *  res = NULL  )  const [inline]

lookup host name

Lookup the host name associated with the current IP address.

Definition at line 1339 of file address.h.

References protlib::tsdb::get_hostname(), ipv4addr, ipv4flag, and ipv6addr.

struct in6_addr* protlib::hostaddress::get_ip (  )  const [inline, read]

get as in6_addr?

Definition at line 163 of file address.h.

References ipv4flag.

Referenced by convert_to_ipv6().

bool protlib::hostaddress::is_ipv4 (  )  const [inline]

bool protlib::hostaddress::is_ipv6 (  )  const [inline]

is it IPv6

Check if this is an IPv6 address.

Definition at line 1297 of file address.h.

References ipv4flag.

bool protlib::hostaddress::is_mapped_ip (  )  const [inline]

is it a 4to6-mapped address?

Check if this is a 6to4 mapped address.

Definition at line 1304 of file address.h.

References ipv4flag, and ipv6addr.

Referenced by equiv(), and protlib::operator<<().

hostaddress & protlib::hostaddress::operator= ( const hostaddress h  )  [inline]

assignment

Assign h to this object.

Reimplemented in protlib::netaddress.

Definition at line 1266 of file address.h.

References outstring, and set_ip().

bool protlib::hostaddress::set_ip ( const string &  str  )  [inline]

Definition at line 1311 of file address.h.

References set_ip().

bool protlib::hostaddress::set_ip ( const char *  str  )  [inline]

set IPv4 or IPv6 from string

Set IPv4 or IPv6 from string or leave object unchanged. This changes object type.

Returns:
true on success.

Definition at line 1329 of file address.h.

References set_ipv4(), and set_ipv6().


Member Data Documentation

union { ... } [protected]

IP buffer.

I in protected and NOT private scope because subclasses have to (de)serialize it.

struct in_addr protlib::hostaddress::ipv4addr [read]

struct in6_addr protlib::hostaddress::ipv6addr [read]

char* protlib::hostaddress::outstring [mutable, private]

pointer to IP string representation

Definition at line 196 of file address.h.

Referenced by clear_ip(), get_ip_str(), operator=(), and ~hostaddress().


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

Generated on Fri Aug 14 23:39:46 2009 for Ariba by  doxygen 1.5.8