|
|
This class manages an internet address.
InternetAddress () |
Constructor for an empty internet address.
InternetAddress (const InternetAddress& address) |
Constructor for an internet address from an internet address.
Parameters:
address | Internet address. |
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".
Parameters:
address | Address string. |
InternetAddress (const String& hostName, const card16 port) |
Constructor for a internet address given by host name and port.
Parameters:
hostName | Host name. |
port | Port number. |
InternetAddress (const card16 port) |
Constructor for INADDR_ANY address with given port.
Parameters:
port | Port number. |
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).
Parameters:
address | sockaddr. |
length | Length of sockaddr (sizeof(sockaddr_in) or sizeof(sockaddr_in6)). |
~InternetAddress () |
Destructor.
void reset () |
Reset internet address.
Reimplemented from SocketAddress
void init (const InternetAddress& address) |
Initialize internet address from internet address.
void init (const card16 port) |
Initialize internet address with INADDR_ANY and given port.
Parameters:
port | Port number. |
void init (const String& hostName, const card16 port) |
Initialize internet address with given host name and port.
Parameters:
hostName | Host name. |
port | Port number. |
inline InternetAddress& operator= (const InternetAddress& source) |
Implementation of = operator.
inline card16 getPort () |
Get port of address.
inline void setPort (const card16 port) |
Set port of address.
enum PrintFormat {PF_Address = (1 << 0), PF_Hostname = (1 << 1), PF_Full = PF_Address | PF_Hostname } |
setPrintFormat() printing formats.
inline PrintFormat getPrintFormat () |
Get printing format.
Returns: Print format.
inline void setPrintFormat (const PrintFormat format) |
Set printing format.
Parameters:
format | Print format. |
bool isValid () |
isValid() implementation of SocketAddress.
See also: SocketAddress#isValid
Reimplemented from SocketAddress
inline bool isNull () |
Check, if the address is null.
Returns: true, if the address is not null; false otherwise.
String getAddressString () |
Get address string.
Returns: Address string.
Reimplemented from SocketAddress
inline bool isIPv4 () |
Check, if internet address is an IPv4 or IPv4-mapped address.
Returns: true, if address is an IPv4 or IPv4-mapped address; false otherwise.
inline bool isIPv6 () |
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.
Returns: true, if address is real IPv6; false otherwise.
InternetAddress getLocalAddress (const InternetAddress& peer) |
Get the local host address. The parameter peer gives the address of the other host.
Examples: localhost => localhost address (127.0.0.1 or ::1). ethernet-host => ethernet interface address. internet-address => dynamic-ip address set by pppd.
Parameters:
address | Reference to SocketAddress to write address to. |
peer | Address of peer. |
Returns: true, if call was successful; false otherwise.
cardinal getSystemAddress (sockaddr* buffer, const socklen_t length, const cardinal type) |
getSystemAddress() implementation of SocketAddress
See also: SocketAddress#getSystemAddress
Reimplemented from SocketAddress
bool setSystemAddress (sockaddr* address, const socklen_t length) |
setSystemAddress() implementation of SocketAddress.
See also: SocketAddress#setSystemAddress
Reimplemented from SocketAddress
cardinal getHostByName (const String& name, card16* myadr) |
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).
Parameters:
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. |
inline bool hasIPv6 () |
Check, if IPv6 support is available.
Returns: true, if IPv6 support is available; false otherwise.
static bool UseIPv6 |
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!!!
int operator== (const InternetAddress& address) |
Implementation of == operator.
inline int operator!= (const InternetAddress& address) |
Implementation of != operator.
int operator< (const InternetAddress& address) |
Implementation of < operator.
inline int operator<= (const InternetAddress& address) |
Implementation of <= operator.
int operator> (const InternetAddress& address) |
Implementation of > operator.
inline int operator>= (const InternetAddress& address) |
Implementation of >= operator.
inline PortableAddress getPortableAddress () |
Get PortableAddress from InternetAddress.
Returns: PortableAddress.
InternetAddress (const PortableAddress& address) |
Constructor for InternetAddress from PortableAddress.
Parameters:
address | PortableAddress. |
void init (const PortableAddress& address) |
Initialize InternetAddress from PortableAddress.
Parameters:
address | PortableAddress. |