#include <source/ariba/utility/transport/tcpip/protlib/address.h>
Inherits protlib::address.
Inherited by protlib::appladdress, and protlib::netaddress.
Public Member Functions | |
virtual hostaddress * | new_instance () const |
virtual hostaddress * | copy () const |
virtual bool | operator== (const address &ie) const |
hostaddress () | |
constructor | |
hostaddress (const hostaddress &h) | |
copy constructor | |
hostaddress & | operator= (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 |
This class can hold IPv4 and IPv6 Host Addresses.
Definition at line 112 of file address.h.
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] |
protlib::hostaddress::~hostaddress | ( | ) | [inline, virtual] |
size_t protlib::hostaddress::get_hash | ( | ) | const [inline, virtual] |
hash function
Reimplemented in protlib::appladdress, and protlib::netaddress.
Definition at line 1240 of file address.h.
References ipv6addr.
Referenced by protlib::netaddress::get_hash(), protlib::appladdress::get_hash(), and __gnu_cxx::hash< protlib::hostaddress >::operator()().
string protlib::hostaddress::get_host_name | ( | bool * | res = NULL |
) | const [inline] |
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] |
is it IPv4
Check if this is an IPv4 address.
Definition at line 1290 of file address.h.
References ipv4flag.
Referenced by equiv(), protlib::AddressList::get_src_addr(), protlib::RadixTrie< propmap_t >::insert(), protlib::RadixTrie< propmap_t >::lookup_node(), and protlib::AddressList::AddressList::ltna::operator()().
bool protlib::hostaddress::is_ipv6 | ( | ) | const [inline] |
bool protlib::hostaddress::is_mapped_ip | ( | ) | const [inline] |
hostaddress & protlib::hostaddress::operator= | ( | const hostaddress & | h | ) | [inline] |
assignment
Assign h to this object.
Reimplemented in protlib::netaddress.
bool protlib::hostaddress::set_ip | ( | const string & | str | ) | [inline] |
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.
Definition at line 1329 of file address.h.
References set_ipv4(), and set_ipv6().
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] |
IPv4 address.
Definition at line 187 of file address.h.
Referenced by get_host_name(), get_ip(), get_ip_str(), is_bogus_source(), is_ip_unspec(), match_against(), protlib::netaddress::operator<(), operator==(), protlib::netaddress::rdx_cmp(), and set_ip().
bool protlib::hostaddress::ipv4flag [protected] |
IPv4 flag.
Definition at line 178 of file address.h.
Referenced by protlib::appladdress::appladdress(), protlib::netaddress::convert_to_ipv6(), convert_to_ipv6(), get_host_name(), get_ip(), get_ip_str(), protlib::appladdress::get_sockaddr(), is_bogus_source(), is_ip_unspec(), is_ipv4(), is_ipv6(), is_mapped_ip(), match_against(), protlib::netaddress::netaddress(), protlib::netaddress::operator<(), operator==(), protlib::netaddress::rdx_cmp(), set_ip(), protlib::netaddress::set_pref_len(), protlib::appladdress::set_subtype(), protlib::netaddress::set_subtype(), and set_subtype().
struct in6_addr protlib::hostaddress::ipv6addr [read] |
IPv6 address.
Definition at line 189 of file address.h.
Referenced by clear_ip(), get_hash(), get_host_name(), get_ip(), get_ip_str(), protlib::appladdress::get_sockaddr(), is_bogus_source(), is_ip_unspec(), is_mapped_ip(), match_against(), protlib::netaddress::operator<(), operator==(), protlib::netaddress::rdx_cmp(), and set_ip().
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().