RTP Trace System
1.0
|
#include <internetaddress.h>
Public Types | |
enum | PrintFormat { PF_Address = (1 << 0), PF_Hostname = (1 << 1), PF_Full = PF_Address | PF_Hostname } |
Public Member Functions | |
InternetAddress () | |
InternetAddress (const InternetAddress &address) | |
InternetAddress (const String &address) | |
InternetAddress (const String &hostName, const card16 port) | |
InternetAddress (const card16 port) | |
InternetAddress (sockaddr *address, socklen_t length) | |
~InternetAddress () | |
void | reset () |
void | init (const InternetAddress &address) |
void | init (const card16 port) |
void | init (const String &hostName, const card16 port) |
InternetAddress & | operator= (const InternetAddress &source) |
card16 | getPort () const |
void | setPort (const card16 port) |
PrintFormat | getPrintFormat () const |
void | setPrintFormat (const PrintFormat format) |
bool | isValid () const |
bool | isNull () const |
String | getAddressString () const |
bool | isIPv4 () const |
bool | isIPv6 () const |
cardinal | getSystemAddress (sockaddr *buffer, const socklen_t length, const cardinal type) const |
bool | setSystemAddress (sockaddr *address, const socklen_t length) |
int | operator== (const InternetAddress &address) const |
int | operator!= (const InternetAddress &address) const |
int | operator< (const InternetAddress &address) const |
int | operator<= (const InternetAddress &address) const |
int | operator> (const InternetAddress &address) const |
int | operator>= (const InternetAddress &address) const |
PortableAddress | getPortableAddress () const |
InternetAddress (const PortableAddress &address) | |
void | init (const PortableAddress &address) |
Static Public Member Functions | |
static InternetAddress | getLocalAddress (const InternetAddress &peer) |
static cardinal | getHostByName (const String &name, card16 *myadr) |
static bool | hasIPv6 () |
Static Public Attributes | |
static bool | UseIPv6 = checkIPv6() |
Static Private Member Functions | |
static bool | checkIPv6 () |
Private Attributes | |
card16 | Host [8] |
card16 | Port |
PrintFormat | Format |
bool | Valid |
setPrintFormat() printing formats.
Constructor for an empty internet address.
Coral::InternetAddress::InternetAddress | ( | const InternetAddress & | address | ) |
Constructor for an internet address from an internet address.
address | Internet address. |
Coral::InternetAddress::InternetAddress | ( | const String & | address | ) |
Constructor for a internet address given by a string. Examples: "gaffel:7500", "12.34.56.78:7500", "3ffe:4711::0!7500", "odin:7500", "ipv6-odin:7500".
address | Address string. |
Coral::InternetAddress::InternetAddress | ( | const String & | hostName, |
const card16 | port | ||
) |
Constructor for a internet address given by host name and port.
hostName | Host name. |
port | Port number. |
Coral::InternetAddress::InternetAddress | ( | const card16 | port | ) |
Constructor for INADDR_ANY address with given port.
port | Port number. |
Coral::InternetAddress::InternetAddress | ( | sockaddr * | address, |
socklen_t | length | ||
) |
Constructor for a internet address from the system's sockaddr structure. The sockaddr structure may be sockaddr_in (IPv4) or sockaddr_in6 (IPv6).
address | sockaddr. |
length | Length of sockaddr (sizeof(sockaddr_in) or sizeof(sockaddr_in6)). |
Destructor.
Coral::InternetAddress::InternetAddress | ( | const PortableAddress & | address | ) |
Constructor for InternetAddress from PortableAddress.
address | PortableAddress. |
bool Coral::InternetAddress::checkIPv6 | ( | ) | [static, private] |
String Coral::InternetAddress::getAddressString | ( | ) | const [virtual] |
Get address string.
Implements Coral::SocketAddress.
Reimplemented in Coral::InternetFlow.
cardinal Coral::InternetAddress::getHostByName | ( | const String & | name, |
card16 * | myadr | ||
) | [static] |
Wrapper for system's gethostbyname() function. This version does support IPv6 addresses even if the system itself does not support IPv6. IPv6 addresses are then converted to IPv4 if possible (IPv4-mapped IPv6).
name | Host name. |
myadr | Storage space to save a IPv6 address (16 bytes). |
length | Length of the address saved in myaddr or 0 in case of failure. |
InternetAddress Coral::InternetAddress::getLocalAddress | ( | const InternetAddress & | peer | ) | [static] |
Get the local host address. The parameter peer gives the address of the other host.
address | Reference to SocketAddress to write address to. |
peer | Address of peer. |
Examples: localhost => localhost address (127.0.0.1 or ::1). ethernet-host => ethernet interface address. internet-address => dynamic-ip address set by pppd.
card16 Coral::InternetAddress::getPort | ( | ) | const [inline] |
Get port of address.
PortableAddress Coral::InternetAddress::getPortableAddress | ( | ) | const [inline] |
Get PortableAddress from InternetAddress.
PrintFormat Coral::InternetAddress::getPrintFormat | ( | ) | const [inline] |
Get printing format.
cardinal Coral::InternetAddress::getSystemAddress | ( | sockaddr * | buffer, |
const socklen_t | length, | ||
const cardinal | type | ||
) | const [virtual] |
getSystemAddress() implementation of SocketAddress
Implements Coral::SocketAddress.
Reimplemented in Coral::InternetFlow.
static bool Coral::InternetAddress::hasIPv6 | ( | ) | [inline, static] |
Check, if IPv6 support is available.
void Coral::InternetAddress::init | ( | const InternetAddress & | address | ) |
Initialize internet address from internet address.
void Coral::InternetAddress::init | ( | const card16 | port | ) |
Initialize internet address with INADDR_ANY and given port.
port | Port number. |
void Coral::InternetAddress::init | ( | const String & | hostName, |
const card16 | port | ||
) |
Initialize internet address with given host name and port.
hostName | Host name. |
port | Port number. |
void Coral::InternetAddress::init | ( | const PortableAddress & | address | ) |
Initialize InternetAddress from PortableAddress.
address | PortableAddress. |
bool Coral::InternetAddress::isIPv4 | ( | ) | const [inline] |
Check, if internet address is an IPv4 or IPv4-mapped address.
bool Coral::InternetAddress::isIPv6 | ( | ) | const [inline] |
Check, if internet address is a real (not IPv4-mapped) IPv6 address. Addresses which return true here can be used with labeled flows by class Socket.
bool Coral::InternetAddress::isNull | ( | ) | const [inline] |
Check, if the address is null.
bool Coral::InternetAddress::isValid | ( | ) | const [virtual] |
isValid() implementation of SocketAddress.
Implements Coral::SocketAddress.
int Coral::InternetAddress::operator!= | ( | const InternetAddress & | address | ) | const [inline] |
Implementation of != operator.
int Coral::InternetAddress::operator< | ( | const InternetAddress & | address | ) | const |
Implementation of < operator.
int Coral::InternetAddress::operator<= | ( | const InternetAddress & | address | ) | const [inline] |
Implementation of <= operator.
InternetAddress& Coral::InternetAddress::operator= | ( | const InternetAddress & | source | ) | [inline] |
Implementation of = operator.
int Coral::InternetAddress::operator== | ( | const InternetAddress & | address | ) | const |
Implementation of == operator.
int Coral::InternetAddress::operator> | ( | const InternetAddress & | address | ) | const |
Implementation of > operator.
int Coral::InternetAddress::operator>= | ( | const InternetAddress & | address | ) | const [inline] |
Implementation of >= operator.
void Coral::InternetAddress::reset | ( | ) | [virtual] |
void Coral::InternetAddress::setPort | ( | const card16 | port | ) | [inline] |
Set port of address.
void Coral::InternetAddress::setPrintFormat | ( | const PrintFormat | format | ) | [inline] |
Set printing format.
format | Print format. |
bool Coral::InternetAddress::setSystemAddress | ( | sockaddr * | address, |
const socklen_t | length | ||
) | [virtual] |
setSystemAddress() implementation of SocketAddress.
Implements Coral::SocketAddress.
Reimplemented in Coral::InternetFlow.
PrintFormat Coral::InternetAddress::Format [private] |
Print format.
card16 Coral::InternetAddress::Host[8] [private] |
Host address in network byte order. IPv4 addresses are converted to IPv4-mapped IPv6 addresses.
card16 Coral::InternetAddress::Port [private] |
Port number.
bool Coral::InternetAddress::UseIPv6 = checkIPv6() [static] |
Static variable which shows the availability of IPv6. Setting this variable to false on an IPv6 system simulates an IPv4-only system.
Do *not* change this variable if Socket or InternetAddress objects are already in use!!!
bool Coral::InternetAddress::Valid [private] |
Is address valid?