RTP Audio System
2.0.0
|
#include <internetaddress.h>
Public Member Functions | |
InternetAddress () | |
InternetAddress (const InternetAddress &address) | |
InternetAddress (const String &address) | |
InternetAddress (const String &hostName, const card16 port) | |
InternetAddress (const card16 port) | |
InternetAddress (const sockaddr *address, const socklen_t length) | |
~InternetAddress () | |
void | reset () |
SocketAddress * | duplicate () const |
void | init (const InternetAddress &address) |
void | init (const String &hostName, const card16 port) |
void | init (const card16 port) |
void | init (const sockaddr *address, const socklen_t length) |
InternetAddress & | operator= (const InternetAddress &source) |
card16 | getPort () const |
void | setPort (const card16 port) |
bool | isValid () const |
integer | getFamily () const |
String | getAddressString (const cardinal format=PF_Default) const |
bool | isIPv4 () const |
bool | isIPv4compatible () const |
bool | isIPv6 () const |
bool | isNull () const |
bool | isUnspecified () const |
bool | isLoopback () const |
bool | isLinkLocal () const |
bool | isSiteLocal () const |
bool | isGlobal () const |
bool | isMulticast () const |
bool | isBroadcast () const |
bool | isUnicast () const |
bool | isReserved () const |
bool | isNodeLocalMulticast () const |
bool | isLinkLocalMulticast () const |
bool | isSiteLocalMulticast () const |
bool | isOrgLocalMulticast () const |
bool | isGlobalMulticast () const |
cardinal | getSystemAddress (sockaddr *buffer, const socklen_t length, const cardinal type) const |
bool | setSystemAddress (const 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 cardinal | getHostByName (const String &name, card16 *myadr, card16 *myscope=NULL) |
static card16 | getServiceByName (const char *name) |
static bool | getFullHostName (char *str, const size_t size) |
static bool | hasIPv6 () |
static InternetAddress | getLocalAddress (const InternetAddress &peer) |
static bool | setIPv4Address (const InternetAddress &address, in_addr *ipv4Address) |
static InternetAddress | getIPv4Address (const in_addr &ipv4Address) |
static card32 | calculateChecksum (card8 *buffer, const cardinal bytes, card32 sum) |
static card32 | wrapChecksum (card32 sum) |
Static Public Attributes | |
static bool | UseIPv6 = checkIPv6() |
Static Private Member Functions | |
static bool | checkIPv6 () |
Private Attributes | |
union { | |
card16 Host16 [8] | |
card32 Host32 [4] | |
in6_addr Address | |
} | AddrSpec |
card16 | Port |
card16 | ScopeID |
bool | Valid |
Constructor for an empty internet address.
InternetAddress::InternetAddress | ( | const InternetAddress & | address | ) |
Constructor for an internet address from an internet address.
address | Internet address. |
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. |
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. |
InternetAddress::InternetAddress | ( | const card16 | port | ) |
Constructor for INADDR_ANY address with given port.
port | Port number. |
InternetAddress::InternetAddress | ( | const sockaddr * | address, |
const 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.
InternetAddress::InternetAddress | ( | const PortableAddress & | address | ) |
Constructor for InternetAddress from PortableAddress.
address | PortableAddress. |
card32 InternetAddress::calculateChecksum | ( | card8 * | buffer, |
const cardinal | bytes, | ||
card32 | sum | ||
) | [static] |
Calculate internet checksum.
buffer | Buffer to calculate checksum from. |
bytes | Number of bytes. |
sum | Checksum value to add. |
bool InternetAddress::checkIPv6 | ( | ) | [static, private] |
SocketAddress * InternetAddress::duplicate | ( | ) | const [virtual] |
duplicate() implementation of SocketAddress.
Implements SocketAddress.
Reimplemented in InternetFlow.
String InternetAddress::getAddressString | ( | const cardinal | format = PF_Default | ) | const [virtual] |
getAddressString() implementation of SocketAddress.
Implements SocketAddress.
Reimplemented in InternetFlow.
integer InternetAddress::getFamily | ( | ) | const [virtual] |
getFamily() implementation of SocketAddress.
Implements SocketAddress.
bool InternetAddress::getFullHostName | ( | char * | str, |
const size_t | size | ||
) | [static] |
Get the computer's full locat name (format: name.domain).
str | Buffer to store name to. |
size | Size of buffer. |
cardinal InternetAddress::getHostByName | ( | const String & | name, |
card16 * | myadr, | ||
card16 * | myscope = NULL |
||
) | [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). |
myscope | Storage space to save IPv6 link local scope ID to (or NULL). |
length | Length of the address saved in myaddr or 0 in case of failure. |
InternetAddress InternetAddress::getIPv4Address | ( | const in_addr & | ipv4Address | ) | [static] |
Get IPv4 InternetAddress from in_addr structure.
ipv4Address | in_addr to get address from. |
InternetAddress InternetAddress::getLocalAddress | ( | const InternetAddress & | peer | ) | [static] |
Get the local host address. The parameter peer gives the address of the other host.
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 InternetAddress::getPort | ( | ) | const [virtual] |
getPort() implementation of SocketAddress.
Implements SocketAddress.
PortableAddress InternetAddress::getPortableAddress | ( | ) | const [inline] |
Get PortableAddress from InternetAddress.
card16 InternetAddress::getServiceByName | ( | const char * | name | ) | [static] |
Get port number for given service (e.g. http).
name | Service name (e.g. "http" or "telnet"). |
cardinal InternetAddress::getSystemAddress | ( | sockaddr * | buffer, |
const socklen_t | length, | ||
const cardinal | type | ||
) | const [virtual] |
getSystemAddress() implementation of SocketAddress
Implements SocketAddress.
Reimplemented in InternetFlow.
static bool InternetAddress::hasIPv6 | ( | ) | [inline, static] |
Check, if IPv6 support is available.
void InternetAddress::init | ( | const InternetAddress & | address | ) |
Initialize internet address from internet address.
void InternetAddress::init | ( | const String & | hostName, |
const card16 | port | ||
) |
Initialize internet address with given host name and port.
hostName | Host name. |
port | Port number. |
void InternetAddress::init | ( | const card16 | port | ) |
Initialize internet address with INADDR_ANY and given port.
port | Port number. |
void InternetAddress::init | ( | const sockaddr * | address, |
const socklen_t | length | ||
) |
Initialize 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)). |
void InternetAddress::init | ( | const PortableAddress & | address | ) |
Initialize InternetAddress from PortableAddress.
address | PortableAddress. |
bool InternetAddress::isBroadcast | ( | ) | const [inline] |
Check, if internet address broadcast address.
bool InternetAddress::isGlobal | ( | ) | const [inline] |
Check, if internet address is global, that is !(isLinkLocal() || isSiteLocal()).
bool InternetAddress::isGlobalMulticast | ( | ) | const [inline] |
Check, if internet address is a global IPv6 multicast address.
bool InternetAddress::isIPv4 | ( | ) | const [inline] |
Check, if internet address is an IPv4 or IPv4-mapped address (a.b.c.d or ::ffff:a.b.c.d).
bool InternetAddress::isIPv4compatible | ( | ) | const [inline] |
Check, if internet address is an IPv4-compatible IPv6 address (::a.b.c.d and NOT ::ffff:a.b.c.d).
bool 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 InternetAddress::isLinkLocal | ( | ) | const [inline] |
Check, if internet address is link local (IPv6) or 127.x.y.z (IPv4).
bool InternetAddress::isLinkLocalMulticast | ( | ) | const [inline] |
Check, if internet address is a link local IPv6 multicast address.
bool InternetAddress::isLoopback | ( | ) | const [inline] |
Check, if the address is loopback address (127.x.y.z for IPv4 or ::1 for IPv6).
bool InternetAddress::isMulticast | ( | ) | const [inline] |
Check, if internet address is a multicast address.
bool InternetAddress::isNodeLocalMulticast | ( | ) | const [inline] |
Check, if internet address is a node local IPv6 multicast address.
bool InternetAddress::isNull | ( | ) | const [inline] |
Check, if the address is null address (0.0.0.0 for IPv4 or :: for IPv6) and port number 0. To skip port number check, use isUnspecified().
bool InternetAddress::isOrgLocalMulticast | ( | ) | const [inline] |
Check, if internet address is a organization local IPv6 multicast address.
bool InternetAddress::isReserved | ( | ) | const [inline] |
Check, if internet address is an reserved address.
bool InternetAddress::isSiteLocal | ( | ) | const [inline] |
Check, if internet address is site local (IPv6) or 127.x.y.z, 192.168.x.y or 10.x.y.z or within {172.16.0.0 to 127.31.255.255} (IPv4).
bool InternetAddress::isSiteLocalMulticast | ( | ) | const [inline] |
Check, if internet address is a site local IPv6 multicast address.
bool InternetAddress::isUnicast | ( | ) | const [inline] |
Check, if internet address is an unicast address (not broadcast or multicast).
bool InternetAddress::isUnspecified | ( | ) | const [inline] |
bool InternetAddress::isValid | ( | ) | const [virtual] |
isValid() implementation of SocketAddress.
Implements SocketAddress.
int InternetAddress::operator!= | ( | const InternetAddress & | address | ) | const [inline] |
Implementation of != operator.
int InternetAddress::operator< | ( | const InternetAddress & | address | ) | const |
Implementation of < operator.
int InternetAddress::operator<= | ( | const InternetAddress & | address | ) | const [inline] |
Implementation of <= operator.
InternetAddress& InternetAddress::operator= | ( | const InternetAddress & | source | ) | [inline] |
Implementation of = operator.
int InternetAddress::operator== | ( | const InternetAddress & | address | ) | const |
Implementation of == operator.
int InternetAddress::operator> | ( | const InternetAddress & | address | ) | const |
Implementation of > operator.
int InternetAddress::operator>= | ( | const InternetAddress & | address | ) | const [inline] |
Implementation of >= operator.
void InternetAddress::reset | ( | ) | [virtual] |
bool InternetAddress::setIPv4Address | ( | const InternetAddress & | address, |
in_addr * | ipv4Address | ||
) | [static] |
Set in_addr structure from InternetAddress (IPv4 only!).
address | InternetAddress. |
ipv4Address | Pointer to in_addr to write address to. |
void InternetAddress::setPort | ( | const card16 | port | ) | [virtual] |
setPort() implementation of SocketAddress.
Implements SocketAddress.
bool InternetAddress::setSystemAddress | ( | const sockaddr * | address, |
const socklen_t | length | ||
) | [virtual] |
setSystemAddress() implementation of SocketAddress.
Implements SocketAddress.
card32 InternetAddress::wrapChecksum | ( | card32 | sum | ) | [static] |
Prepare checksum for writing into header: Wrap sum and convert byte order.
sum | Checksum. |
in6_addr InternetAddress::Address |
union { ... } InternetAddress::AddrSpec [private] |
Host address in network byte order. IPv4 addresses are converted to IPv4-mapped IPv6 addresses.
card16 InternetAddress::Port [private] |
Port number.
card16 InternetAddress::ScopeID [private] |
Scope ID.
bool 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 InternetAddress::Valid [private] |
Is address valid?