libcommonc++
0.7
|
An IPv4 Internet address. More...
#include <InetAddress.h++>
Public Member Functions | |
InetAddress () | |
Construct a new, wildcard InetAddress. More... | |
InetAddress (const String &host) | |
Construct a new InetAddress for the given host name. More... | |
InetAddress (uint32_t addr) | |
Construct a new, InetAddress for the given IP address. More... | |
InetAddress (byte_t addr[4]) | |
Construct a new, InetAddress for the given IP address. More... | |
~InetAddress () | |
Destructor. More... | |
void | setHost (const String &host) |
Set the hostname for this address. More... | |
void | setAddress (uint32_t addr) |
Set the host IP address for this address. More... | |
uint32_t | getAddress () const |
Get the host IP address for this address. More... | |
char | getNetworkClass () const |
Get the network class for the IP address. More... | |
bool | isMulticast () const |
Test if the IP address is a multicast address (range 224.0.0.0 through 239.255.255.255, also known as class "D"). More... | |
bool | isNonroutable () const |
Test if the IP address is non-routable (one of 10.x.x.x, 192.168.x.x, or 172.16.x.x - 172.31.x.x). More... | |
bool | isLinkLocal () const |
Test if the IP address is a link-local address (169.254.x.x). More... | |
String | getHost () const |
Get the host name for this address. More... | |
void | resolve () |
If the InetAddress was constructed with a host (DNS) name, attempt to resolve the name to an IP address. More... | |
bool | isResolved () const |
Test if this InetAddress has been successfully resolved. More... | |
String | toString () const |
Get aString representation for this address. More... | |
String | toIPString () const |
Get a String representation for this address in dot-separated form. More... | |
bool | operator== (const InetAddress &other) const |
Equality operator. More... | |
bool | operator!= (const InetAddress &other) const |
Inequality operator. More... | |
InetAddress & | operator|= (const InetAddress &other) |
Bitwise-OR another address with this address. More... | |
InetAddress & | operator &= (const InetAddress &other) |
Bitwise-AND another address with this address. More... | |
Static Public Attributes | |
static const InetAddress | ANY |
A value representing the wildcard address, 0.0.0.0. More... | |
An IPv4 Internet address.
InetAddress | ( | ) |
Construct a new, wildcard InetAddress.
|
explicit |
Construct a new InetAddress for the given host name.
The address will not be valid until the hostname is resolved via a call to resolve().
host | The host name; either a DNS name or a dot-separated IP address. |
|
explicit |
Construct a new, InetAddress for the given IP address.
addr | The IP address, represented as a 32-bit integer in host byte order. |
|
explicit |
Construct a new, InetAddress for the given IP address.
addr | The IP address, represented as a 4-byte tuple. |
~InetAddress | ( | ) |
Destructor.
|
inline |
Get the host IP address for this address.
String getHost | ( | ) | const |
Get the host name for this address.
If necessary, a reverse DNS lookup is done. If that fails, the host is returned in dot-separated form.
HostNotFoundException | If the hostname could not be resolved. |
char getNetworkClass | ( | ) | const |
Get the network class for the IP address.
bool isLinkLocal | ( | ) | const |
Test if the IP address is a link-local address (169.254.x.x).
bool isMulticast | ( | ) | const |
Test if the IP address is a multicast address (range 224.0.0.0 through 239.255.255.255, also known as class "D").
bool isNonroutable | ( | ) | const |
Test if the IP address is non-routable (one of 10.x.x.x, 192.168.x.x, or 172.16.x.x - 172.31.x.x).
|
inline |
Test if this InetAddress has been successfully resolved.
InetAddress& operator&= | ( | const InetAddress & | other | ) |
Bitwise-AND another address with this address.
|
inline |
Inequality operator.
bool operator== | ( | const InetAddress & | other | ) | const |
Equality operator.
InetAddress & operator|= | ( | const InetAddress & | other | ) |
Bitwise-OR another address with this address.
void resolve | ( | ) |
If the InetAddress was constructed with a host (DNS) name, attempt to resolve the name to an IP address.
HostNotFoundException | If the host name could not be resolved. |
void setAddress | ( | uint32_t | addr | ) |
Set the host IP address for this address.
addr | The IP address, packed in a 32-bit integer. |
void setHost | ( | const String & | host | ) |
Set the hostname for this address.
host | The host, as a dot-separated IP address or DNS name. |
HostNotFoundException | If the hostname cannot be resolved. |
String toString | ( | ) | const |
Get aString representation for this address.
|
static |
A value representing the wildcard address, 0.0.0.0.