Address Objects

Collaboration diagram for Address Objects:

Namespaces

namespace  protlib

Functions

 protlib::address::address (subtype_t st)
 constructor with subtype
void protlib::address::throw_nomem_error () const
 virtual destructor
virtual hostaddress * protlib::hostaddress::new_instance () const
virtual hostaddress * protlib::hostaddress::copy () const
virtual bool protlib::hostaddress::operator== (const address &ie) const
 protlib::hostaddress::hostaddress (const char *str, bool *res=NULL)
 constructor from string
bool protlib::hostaddress::set_ipv4 (const char *str)
 set IPv4 from string
void protlib::hostaddress::set_ip (const struct in_addr &in)
 set IPv4 from in_addr
bool protlib::hostaddress::set_ipv6 (const char *str)
 set IPv6 from string
void protlib::hostaddress::set_ip (const struct in6_addr &in)
 set IPv6 from in6_addr
void protlib::hostaddress::set_ip (const hostaddress &h)
 set IP from hostaddress
bool protlib::hostaddress::is_ip_unspec () const
 is IP unspecified
const char * protlib::hostaddress::get_ip_str () const
 get ip address as string
const char * protlib::hostaddress::get_ip_str (char *str) const
 get ip address as string
bool protlib::hostaddress::get_ip (struct in_addr &in) const
 get as in_addr?
bool protlib::hostaddress::get_ip (struct in6_addr &in) const
 get as in6_addr?
bool protlib::hostaddress::is_bogus_source () const
 is bogus source (e.g. localhost, multicast)
virtual void protlib::hostaddress::convert_to_ipv6 ()
 convert to iPv6
virtual bool protlib::hostaddress::equiv (const hostaddress &h) const
 are they equivalent
virtual void protlib::hostaddress::set_subtype (bool ipv4)
 set subtype and IPv4 flag
void protlib::hostaddress::clear_ip ()
 clear IP buffer (sets IP address to undefined/any and deletes any outstring)
virtual int protlib::hostaddress::match_against (const hostaddress &ha) const
 match against IP address
virtual int protlib::hostaddress::match_against (const netaddress &na) const
 match against network prefix
virtual appladdress * protlib::appladdress::new_instance () const
virtual appladdress * protlib::appladdress::copy () const
virtual bool protlib::appladdress::operator== (const address &ie) const
virtual netaddress * protlib::netaddress::new_instance () const
virtual netaddress * protlib::netaddress::copy () const
virtual bool protlib::netaddress::operator== (const address &ie) const
virtual void protlib::netaddress::convert_to_ipv6 ()
 convert to iPv6
virtual void protlib::netaddress::set_subtype (bool ipv4)
 set subtype and IPv4 flag
 protlib::netaddress::netaddress ()
 constructor
 protlib::netaddress::netaddress (const netaddress &na)
 copy constructor
 protlib::netaddress::netaddress (const hostaddress &h, prefix_length_t len=128)
 constructor from hostaddress and prefix length
 protlib::netaddress::netaddress (const char *str, bool *res=NULL)
 constructor from string
 protlib::netaddress::netaddress (const char *str, prefix_length_t len, bool *res=NULL)
 constructor from string and prefix length
netaddress & protlib::netaddress::operator= (const netaddress &na)
 assignment
netaddress & protlib::netaddress::operator= (const hostaddress &ha)
 assignment
prefix_length_t protlib::netaddress::set_pref_len (prefix_length_t len)
bool protlib::netaddress::operator< (const netaddress &na) const
 comparison for prefixmap
int protlib::netaddress::rdx_cmp (const netaddress *na, int *pos) const
virtual udsaddress * protlib::udsaddress::new_instance () const
virtual udsaddress * protlib::udsaddress::copy () const
virtual bool protlib::udsaddress::operator== (const address &ie) const
 protlib::AddressList::AddressList ()
 protlib::AddressList::~AddressList ()
iflist_t * protlib::AddressList::get_interfaces ()
bool protlib::AddressList::by_interface (bool start_empty=true)
bool protlib::AddressList::add_interface (char *name)
bool protlib::AddressList::del_interface (char *name)
bool protlib::AddressList::add_property (netaddress &na, AddrProperty *p=ConfiguredAddr_P, bool propagate=true)
bool protlib::AddressList::del_property (netaddress &na, AddrProperty *p=ConfiguredAddr_P, bool propagate=true)
bool protlib::AddressList::add_host_prop (const char *name, AddrProperty *p=ConfiguredAddr_P)
bool protlib::AddressList::del_host_prop (const char *name, AddrProperty *p=ConfiguredAddr_P)
bool protlib::AddressList::ignore (netaddress &na, bool propagate=true)
bool protlib::AddressList::unignore (netaddress &na, bool propagate=true)
bool protlib::AddressList::ignore_bogons (void)
bool protlib::AddressList::ignore_locals (void)
bool protlib::AddressList::ignore_loopback (void)
bool protlib::AddressList::addr_is (netaddress &na, AddrProperty *prop)
bool protlib::AddressList::addr_is_in (netaddress &na, AddrProperty *prop)
addrlist_t * protlib::AddressList::get_addrs (AddrProperty *prop=LocalAddr_P)
netaddress * protlib::AddressList::get_first (AddrProperty *p=LocalAddr_P, bool IPv4=true)
netaddress * protlib::AddressList::get_src_addr (const netaddress &dest, uint32_t *prefs)
void protlib::AddressList::getifaddrs_iflist (iflist_t &list)
bool protlib::AddressList::getifaddrs_is_local (netaddress &na)
void protlib::AddressList::getifaddrs_get_addrs (addrlist_t &list)
void protlib::AddressList::bequeath (addr2prop_t::node *head, AddrProperty *p, bool add=true)
void protlib::AddressList::collect (addr2prop_t::node *head, AddrProperty *p, addrlist_t &list)
addr2prop_t::node * protlib::AddressList::collect_first (addr2prop_t::node *head, AddrProperty *p)

Variables

static AddrProperty * protlib::AddressList::LocalAddr_P
static AddrProperty * protlib::AddressList::ConfiguredAddr_P
static AddrProperty * protlib::AddressList::IgnoreAddr_P
static AddrProperty * protlib::AddressList::AnyAddr_P

Function Documentation

bool protlib::AddressList::add_host_prop ( const char *  name,
AddrProperty p = ConfiguredAddr_P 
) [inherited]

bool protlib::AddressList::add_interface ( char *  name  )  [inherited]

Definition at line 846 of file address.cpp.

References protlib::AddressList::interfaces.

bool protlib::AddressList::add_property ( netaddress na,
AddrProperty p = ConfiguredAddr_P,
bool  propagate = true 
) [inherited]

bool protlib::AddressList::addr_is ( netaddress na,
AddrProperty prop 
) [inherited]

bool protlib::AddressList::addr_is_in ( netaddress na,
AddrProperty prop 
) [inherited]

protlib::address::address ( subtype_t  st  )  [protected, inherited]

constructor with subtype

Set subtype.

Definition at line 56 of file address.cpp.

protlib::AddressList::AddressList (  )  [inherited]

void protlib::AddressList::bequeath ( addr2prop_t::node *  head,
AddrProperty p,
bool  add = true 
) [private, inherited]

bool protlib::AddressList::by_interface ( bool  start_empty = true  )  [inherited]

void protlib::hostaddress::clear_ip (  )  [inherited]

clear IP buffer (sets IP address to undefined/any and deletes any outstring)

Clear the IP address buffer and the outstring if it exists.

Definition at line 333 of file address.cpp.

References protlib::hostaddress::ipv6addr, and protlib::hostaddress::outstring.

Referenced by protlib::hostaddress::convert_to_ipv6(), protlib::hostaddress::hostaddress(), and protlib::hostaddress::set_ip().

void protlib::AddressList::collect ( addr2prop_t::node *  head,
AddrProperty p,
addrlist_t list 
) [private, inherited]

Definition at line 1505 of file address.cpp.

References protlib::AddressList::AnyAddr_P.

Referenced by protlib::AddressList::get_addrs().

AddressList::addr2prop_t::node * protlib::AddressList::collect_first ( addr2prop_t::node *  head,
AddrProperty p 
) [private, inherited]

Definition at line 1531 of file address.cpp.

References protlib::AddressList::AnyAddr_P.

Referenced by protlib::AddressList::get_first().

void protlib::netaddress::convert_to_ipv6 (  )  [virtual, inherited]

convert to iPv6

Convert the IP address to IPv6 by mapping it from IPv4 to IPv6 if necessary. The prefix length is converted, too.

Reimplemented from protlib::hostaddress.

Definition at line 477 of file address.cpp.

References protlib::hostaddress::ipv4flag, protlib::netaddress::prefix_length, and protlib::netaddress::set_pref_len().

void protlib::hostaddress::convert_to_ipv6 (  )  [virtual, inherited]

udsaddress * protlib::udsaddress::copy (  )  const [virtual, inherited]

Implements protlib::address.

Definition at line 783 of file address.cpp.

References catch_bad_alloc, and protlib::udsaddress::udsaddress().

netaddress * protlib::netaddress::copy (  )  const [virtual, inherited]

Reimplemented from protlib::hostaddress.

Definition at line 452 of file address.cpp.

References catch_bad_alloc, and protlib::netaddress::netaddress().

appladdress * protlib::appladdress::copy (  )  const [virtual, inherited]

Reimplemented from protlib::hostaddress.

Definition at line 420 of file address.cpp.

References protlib::appladdress::appladdress(), and catch_bad_alloc.

Referenced by protlib::TPoverTCP::receiver_thread().

hostaddress * protlib::hostaddress::copy (  )  const [virtual, inherited]

Implements protlib::address.

Reimplemented in protlib::appladdress, and protlib::netaddress.

Definition at line 81 of file address.cpp.

References catch_bad_alloc, and protlib::hostaddress::hostaddress().

Referenced by protlib::hostaddress::equiv().

bool protlib::AddressList::del_host_prop ( const char *  name,
AddrProperty p = ConfiguredAddr_P 
) [inherited]

bool protlib::AddressList::del_interface ( char *  name  )  [inherited]

Definition at line 855 of file address.cpp.

References protlib::AddressList::interfaces.

bool protlib::AddressList::del_property ( netaddress na,
AddrProperty p = ConfiguredAddr_P,
bool  propagate = true 
) [inherited]

bool protlib::hostaddress::equiv ( const hostaddress h  )  const [virtual, inherited]

AddressList::addrlist_t * protlib::AddressList::get_addrs ( AddrProperty prop = LocalAddr_P  )  [inherited]

netaddress * protlib::AddressList::get_first ( AddrProperty p = LocalAddr_P,
bool  IPv4 = true 
) [inherited]

AddressList::iflist_t * protlib::AddressList::get_interfaces (  )  [inherited]

bool protlib::hostaddress::get_ip ( struct in6_addr &  in  )  const [inherited]

get as in6_addr?

Get IP address as an in6_addr. If this is an IPv4 address, it is mapped to IPv6.

Returns:
true since this is always possible.

Definition at line 237 of file address.cpp.

References protlib::hostaddress::ipv4addr, protlib::hostaddress::ipv4flag, and protlib::hostaddress::ipv6addr.

bool protlib::hostaddress::get_ip ( struct in_addr &  in  )  const [inherited]

get as in_addr?

Get IP address as an in_addr if possible.

Returns:
true on success.

Definition at line 223 of file address.cpp.

References protlib::hostaddress::ipv4addr, protlib::hostaddress::ipv4flag, and protlib::hostaddress::ipv6addr.

Referenced by protlib::AddressList::get_src_addr(), and protlib::TPoverUDP::udpsend().

const char * protlib::hostaddress::get_ip_str ( char *  str  )  const [inherited]

get ip address as string

Get IP address as a string.

Parameters:
str string buffer

Definition at line 211 of file address.cpp.

References protlib::hostaddress::ipv4addr, protlib::hostaddress::ipv4flag, and protlib::hostaddress::ipv6addr.

const char * protlib::hostaddress::get_ip_str (  )  const [inherited]

get ip address as string

Get IP address as a string. The output string is kept inside the hostaddress object and should be copied if used for a longer time.

Definition at line 187 of file address.cpp.

References protlib::hostaddress::ipv4flag, and protlib::hostaddress::outstring.

Referenced by ariba::transport::convert(), protlib::TPoverTCP::get_connection_to(), protlib::TPoverTCP::master_listener_thread(), protlib::operator<<(), protlib::hostaddress::operator==(), and protlib::TPoverTCP::tcpsend().

netaddress * protlib::AddressList::get_src_addr ( const netaddress dest,
uint32_t *  prefs 
) [inherited]

void protlib::AddressList::getifaddrs_get_addrs ( addrlist_t list  )  [private, inherited]

void protlib::AddressList::getifaddrs_iflist ( iflist_t list  )  [private, inherited]

bool protlib::AddressList::getifaddrs_is_local ( netaddress na  )  [private, inherited]

protlib::hostaddress::hostaddress ( const char *  str,
bool *  res = NULL 
) [inherited]

constructor from string

Initialize hostaddress from string if possible.

Definition at line 104 of file address.cpp.

References protlib::hostaddress::clear_ip(), and protlib::hostaddress::set_ip().

bool protlib::AddressList::ignore ( netaddress na,
bool  propagate = true 
) [inherited]

bool protlib::AddressList::ignore_bogons ( void   )  [inherited]

bool protlib::AddressList::ignore_locals ( void   )  [inherited]

bool protlib::AddressList::ignore_loopback ( void   )  [inherited]

bool protlib::hostaddress::is_bogus_source (  )  const [inherited]

is bogus source (e.g. localhost, multicast)

returns false if address is not allowed to be used as source address: loopback, multicast, broadcast, unspecified

Definition at line 250 of file address.cpp.

References protlib::hostaddress::ipv4addr, protlib::hostaddress::ipv4flag, and protlib::hostaddress::ipv6addr.

bool protlib::hostaddress::is_ip_unspec (  )  const [inherited]

is IP unspecified

Check if IP address is unspecified (set to 0).

Definition at line 177 of file address.cpp.

References protlib::hostaddress::ipv4addr, protlib::hostaddress::ipv4flag, and protlib::hostaddress::ipv6addr.

Referenced by protlib::hostaddress::convert_to_ipv6().

int protlib::hostaddress::match_against ( const netaddress na  )  const [virtual, inherited]

match against network prefix

Match this IP address against the given network prefix.

Returns:
-1 on no match or error, e.g. when IPv4 and IPv6 are matched

the length of the matched prefix.

Reimplemented in protlib::netaddress.

Definition at line 361 of file address.cpp.

References protlib::netaddress::get_pref_len(), protlib::hostaddress::ipv4addr, protlib::hostaddress::ipv4flag, and protlib::hostaddress::ipv6addr.

int protlib::hostaddress::match_against ( const hostaddress ha  )  const [virtual, inherited]

match against IP address

Match this IP address against another IP address. Two IP addresses match if they are equal.

Returns:
-1 on no match or error, e.g. when IPv4 and IPv6 are matched

the length of the matched prefix.

Definition at line 348 of file address.cpp.

References protlib::hostaddress::ipv4flag.

Referenced by protlib::AddressList::getifaddrs_is_local().

protlib::netaddress::netaddress ( const char *  str,
prefix_length_t  len,
bool *  res = NULL 
) [inherited]

constructor from string and prefix length

Initialize from string and prefix length. If the string does not contain a valid IP address, it is set to all 0 by the hostaddress constructor.

Definition at line 570 of file address.cpp.

References protlib::hostaddress::ipv4flag, protlib::netaddress::set_pref_len(), and protlib::netaddress::set_subtype().

protlib::netaddress::netaddress ( const char *  str,
bool *  res = NULL 
) [inherited]

constructor from string

Initialize from string which contains IP and prefix length separated by '/'.

Definition at line 527 of file address.cpp.

References protlib::hostaddress::ipv4flag, protlib::netaddress::prefix_length, protlib::hostaddress::set_ip(), and protlib::netaddress::set_subtype().

protlib::netaddress::netaddress ( const hostaddress h,
prefix_length_t  len = 128 
) [inherited]

constructor from hostaddress and prefix length

Initialize with the given host address and prefix length. Prefix length is optional and set to 0 if missing.

Definition at line 519 of file address.cpp.

References protlib::hostaddress::ipv4flag, protlib::netaddress::set_pref_len(), and protlib::netaddress::set_subtype().

protlib::netaddress::netaddress ( const netaddress na  )  [inherited]

protlib::netaddress::netaddress (  )  [inherited]

constructor

Constructor sets address type and clears prefix length.

Definition at line 504 of file address.cpp.

References protlib::hostaddress::ipv4flag, and protlib::netaddress::set_subtype().

Referenced by protlib::netaddress::copy(), and protlib::netaddress::new_instance().

udsaddress * protlib::udsaddress::new_instance (  )  const [virtual, inherited]

Implements protlib::address.

Definition at line 777 of file address.cpp.

References catch_bad_alloc, and protlib::udsaddress::udsaddress().

netaddress * protlib::netaddress::new_instance (  )  const [virtual, inherited]

Reimplemented from protlib::hostaddress.

Definition at line 446 of file address.cpp.

References catch_bad_alloc, and protlib::netaddress::netaddress().

appladdress * protlib::appladdress::new_instance (  )  const [virtual, inherited]

Reimplemented from protlib::hostaddress.

Definition at line 414 of file address.cpp.

References protlib::appladdress::appladdress(), and catch_bad_alloc.

hostaddress * protlib::hostaddress::new_instance (  )  const [virtual, inherited]

Implements protlib::address.

Reimplemented in protlib::appladdress, and protlib::netaddress.

Definition at line 75 of file address.cpp.

References catch_bad_alloc, and protlib::hostaddress::hostaddress().

bool protlib::netaddress::operator< ( const netaddress na  )  const [inherited]

comparison for prefixmap

Compare two netaddress objects. If neither a<b and b<a then a and b are considered equal.

Definition at line 606 of file address.cpp.

References protlib::hostaddress::ipv4addr, protlib::hostaddress::ipv4flag, protlib::hostaddress::ipv6addr, and protlib::netaddress::prefix_length.

netaddress & protlib::netaddress::operator= ( const hostaddress na  )  [inherited]

assignment

Assigns the given netaddress address by using hostaddress::operator=().

Reimplemented from protlib::hostaddress.

Definition at line 584 of file address.cpp.

References protlib::netaddress::operator=(), and protlib::netaddress::set_pref_len().

netaddress & protlib::netaddress::operator= ( const netaddress na  )  [inherited]

assignment

Assigns the given netaddress address by using hostaddress::operator=().

Definition at line 576 of file address.cpp.

References protlib::netaddress::prefix_length.

Referenced by protlib::netaddress::operator=().

bool protlib::udsaddress::operator== ( const address ie  )  const [virtual, inherited]

Implements protlib::address.

Definition at line 789 of file address.cpp.

References protlib::udsaddress::socknum, and protlib::udsaddress::uds_socket.

bool protlib::netaddress::operator== ( const address ie  )  const [virtual, inherited]

Reimplemented from protlib::hostaddress.

Definition at line 458 of file address.cpp.

References protlib::netaddress::prefix_length.

bool protlib::appladdress::operator== ( const address ie  )  const [virtual, inherited]

Reimplemented from protlib::hostaddress.

Definition at line 426 of file address.cpp.

References protlib::appladdress::port, and protlib::appladdress::proto.

bool protlib::hostaddress::operator== ( const address ie  )  const [virtual, inherited]

int protlib::netaddress::rdx_cmp ( const netaddress na,
int *  pos 
) const [inherited]

Compare function for the radix trie:

Compare this and na from *pos up to max(this->prefix, na->prefix)

In pos return the position where the compare ended.

The return value is 0 if the strings are equal and all of this' string was consumed, otherwise the sign will indicate the bit in this' string at pos (i.e. if the search should continue left or right of na).

pos < 0 indicates error

Definition at line 669 of file address.cpp.

References protlib::hostaddress::ipv4addr, protlib::hostaddress::ipv4flag, protlib::hostaddress::ipv6addr, and protlib::netaddress::prefix_length.

Referenced by protlib::RadixTrie< propmap_t >::insert(), protlib::RadixTrie< propmap_t >::lookup_node(), and protlib::AddressList::AddressList::ltna::operator()().

void protlib::hostaddress::set_ip ( const hostaddress h  )  [inherited]

void protlib::hostaddress::set_ip ( const struct in6_addr &  in  )  [inherited]

set IPv6 from in6_addr

Set IPv6 address from struct in6_addr. This changes object type to IPv6.

Definition at line 156 of file address.cpp.

References protlib::hostaddress::clear_ip(), protlib::hostaddress::ipv6addr, and protlib::hostaddress::set_subtype().

void protlib::hostaddress::set_ip ( const struct in_addr &  in  )  [inherited]

bool protlib::hostaddress::set_ipv4 ( const char *  str  )  [inherited]

set IPv4 from string

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

Returns:
true on success.

Definition at line 121 of file address.cpp.

References protlib::hostaddress::set_ip().

Referenced by protlib::hostaddress::set_ip().

bool protlib::hostaddress::set_ipv6 ( const char *  str  )  [inherited]

set IPv6 from string

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

Returns:
true on success.

Definition at line 144 of file address.cpp.

References protlib::hostaddress::set_ip().

Referenced by protlib::hostaddress::set_ip().

prefix_length_t protlib::netaddress::set_pref_len ( prefix_length_t  len  )  [inherited]

void protlib::netaddress::set_subtype ( bool  ipv4  )  [protected, virtual, inherited]

set subtype and IPv4 flag

Set subtype and IPv4 flag. This does NOT clear the outstring buffer. Use clear_ip(). In addition the prefix length is checked and set to reasonable values.

Reimplemented from protlib::hostaddress.

Definition at line 490 of file address.cpp.

References protlib::hostaddress::ipv4flag, protlib::address::IPv4NetAddress, protlib::address::IPv6NetAddress, protlib::netaddress::prefix_length, and protlib::address::subtype.

Referenced by protlib::netaddress::netaddress().

void protlib::hostaddress::set_subtype ( bool  ipv4  )  [protected, virtual, inherited]

set subtype and IPv4 flag

Set subtype and IPv4 flag. This does NOT clear the outstring buffer. Use clear_ip().

Reimplemented in protlib::appladdress, and protlib::netaddress.

Definition at line 327 of file address.cpp.

References protlib::hostaddress::ipv4flag, protlib::address::IPv4HostAddress, protlib::address::IPv6HostAddress, and protlib::address::subtype.

Referenced by protlib::hostaddress::convert_to_ipv6(), protlib::hostaddress::hostaddress(), and protlib::hostaddress::set_ip().

void protlib::address::throw_nomem_error (  )  const [protected, inherited]

virtual destructor

Log and throw a nomem_error

Definition at line 63 of file address.cpp.

References ERRCLog, and protlib::IEError::ERROR_NO_MEM.

bool protlib::AddressList::unignore ( netaddress na,
bool  propagate = true 
) [inherited]

protlib::AddressList::~AddressList (  )  [inherited]

Definition at line 812 of file address.cpp.


Variable Documentation

AddressList::AddrProperty * protlib::AddressList::AnyAddr_P [static, private, inherited]

AddressList::AddrProperty * protlib::AddressList::ConfiguredAddr_P [static, inherited]

Definition at line 1131 of file address.h.

Referenced by protlib::AddressList::AddressList().

AddressList::AddrProperty * protlib::AddressList::IgnoreAddr_P [static, private, inherited]

AddressList::AddrProperty * protlib::AddressList::LocalAddr_P [static, inherited]


Generated on Fri Aug 14 23:38:34 2009 for Ariba by  doxygen 1.5.8