#include <Address.h>
Public Member Functions | |
Address () | |
Constructs an invalid address. | |
Address (std::string address) | |
Creates a new Address, resolving the name in address if necessary. | |
Address (const char *address) | |
Alternate version for better implicit conversion. | |
Address (NLaddress address) | |
Creates a new Address with the HawkNL NLaddress. | |
void | setAddressByName (const std::string &address) |
Does the same work as the constructor. | |
std::string | getNameByAddress () const |
Returns the reverse DNS lookup based on this address. | |
NLaddress | getAddress () const |
Returns a copy of the actual HawkNL address struct. | |
void | setAddress (NLaddress address) |
Sets the address based on the given HawkNL address. | |
std::string | toString () const |
Returns a string representation of this address in the format xxx.xxx.xxx.xxx:ppppp, but if the port is 0, the colon and port number are empty. | |
int | getPort () const |
Returns the port for this address. | |
void | setPort (int port) |
Sets the port for this address. | |
bool | isValid () const |
Returns if this address is in a valid state. | |
operator bool () const | |
Another method for testing isValid(). | |
bool | operator== (const Address &rhs) const |
Tests if two addresses are equal based on the HawkNL function nlCompareAddr. |
|
Creates a new Address, resolving the name in address if necessary.
The format is the same as HawkNL's nlGetAddrFromName, for IP this format is xxx.xxx.xxx.xxx:ppppp where ppppp is the optional port and xxx.xxx.xxx.xxx can be a hostname, i.e.: If no string is supplied, the default is 0.0.0.0:0. Note that the name resolution may take some time and this constructor will block. If the resolution failed, then the Address is not valid (!isValid()).
|
|
Returns the reverse DNS lookup based on this address. This method will block. If the name doesn't exist, the IP address will be returned. The port from this address will not be part of the name in either case. |
|
Returns if this address is in a valid state. And address will become invalid if a name could not be resolved, or a port sent was out of range. |
|
Another method for testing isValid().
|
|
Tests if two addresses are equal based on the HawkNL function nlCompareAddr. This does not take validity into consideration. |
|
Sets the port for this address. This is a number 0..65535. |