Public Member Functions | |
NHostAddress (void) | |
Constructs a NHostAddress object. | |
NHostAddress (const NString &addr) | |
Constructs a NHostAddress object. | |
NHostAddress (const NHostAddress &addr) | |
Constructs a NHostAddress object. | |
NHostAddress (const sockaddr *addr) | |
Constructs a NHostAddress object. | |
void | clear (void) |
Resets the host address hold by the object. | |
void | setAddress (nuint32 ip) |
Sets the host address hold by the object to a given ip address. | |
void | setAddress (const NString &addr) |
Sets the host address hold by the object to a given host address. | |
void | setAddress (const sockaddr *sock) |
Sets the host address hold by the object to a given address. | |
nuint32 | resolve (void) const |
Resolves the address of the host. | |
NString | toString (void) const |
Returns the resolved address in a NString format. | |
NString | address (void) const |
Returns the host address as originally set. | |
NList< NString > | aliases (void) |
Returns a list with all the aliases of the host. | |
NList< nuint32 > | addresses (void) |
Returns a list with all the ip addresses of the host. | |
bool | isNull (void) const |
Tests whether the host is NULL (0.0.0.0). | |
bool | isLocalhost (void) const |
Tests wheter the host is localhost (127.0.0.1). | |
NHostAddress & | operator= (const NHostAddress &rhs) |
Assigns a NHostAddress to the object. | |
NHostAddress & | operator= (const NString &rhs) |
Assigns an address to the object. | |
NHostAddress (void) | |
Constructs a NHostAddress object. | |
NHostAddress (const NString &addr) | |
Constructs a NHostAddress object. | |
NHostAddress (const NHostAddress &addr) | |
Constructs a NHostAddress object. | |
NHostAddress (const sockaddr *addr) | |
Constructs a NHostAddress object. | |
void | clear (void) |
Resets the host address hold by the object. | |
void | setAddress (nuint32 ip) |
Sets the host address hold by the object to a given ip address. | |
void | setAddress (const NString &addr) |
Sets the host address hold by the object to a given host address. | |
void | setAddress (const sockaddr *sock) |
Sets the host address hold by the object to a given address. | |
nuint32 | resolve (void) const |
Resolves the address of the host. | |
NString | toString (void) const |
Returns the resolved address in a NString format. | |
NString | address (void) const |
Returns the host address as originally set. | |
NList< NString > | aliases (void) |
Returns a list with all the aliases of the host. | |
NList< nuint32 > | addresses (void) |
Returns a list with all the ip addresses of the host. | |
bool | isNull (void) const |
Tests whether the host is NULL (0.0.0.0). | |
bool | isLocalhost (void) const |
Tests wheter the host is localhost (127.0.0.1). | |
NHostAddress & | operator= (const NHostAddress &rhs) |
Assigns a NHostAddress to the object. | |
NHostAddress & | operator= (const NString &rhs) |
Assigns an address to the object. | |
Static Public Member Functions | |
static NString | toString (nuint32 ip) |
Returns a given ip addresss in a NString format. | |
static NString | toString (nuint32 ip) |
Returns a given ip addresss in a NString format. |
Definition at line 48 of file linux/nhostaddress.h.
NHostAddress | ( | const NString & | addr | ) |
Constructs a NHostAddress object.
addr | The address (ip or hostname) |
Definition at line 34 of file linux/nhostaddress.cpp.
NHostAddress | ( | const NHostAddress & | addr | ) |
Constructs a NHostAddress object.
addr | The object to be copied |
Definition at line 43 of file linux/nhostaddress.cpp.
NHostAddress | ( | const sockaddr * | addr | ) |
Constructs a NHostAddress object.
addr | A pointer to a sockaddr structure |
Definition at line 52 of file linux/nhostaddress.cpp.
References setAddress().
NHostAddress | ( | const NString & | addr | ) |
NHostAddress | ( | const NHostAddress & | addr | ) |
NHostAddress | ( | const sockaddr * | addr | ) |
void setAddress | ( | nuint32 | ip | ) |
Sets the host address hold by the object to a given ip address.
ip | The ip address of the host in network byte order |
Definition at line 66 of file linux/nhostaddress.cpp.
References NString::number().
Referenced by NHostAddress(), and NTcpSocket::peerAddress().
void setAddress | ( | const NString & | addr | ) |
Sets the host address hold by the object to a given host address.
addr | The host address |
Definition at line 71 of file linux/nhostaddress.cpp.
void setAddress | ( | const sockaddr * | sock | ) |
Sets the host address hold by the object to a given address.
sock | A pointer to a sockaddr structure containing the host address |
Definition at line 75 of file linux/nhostaddress.cpp.
nuint32 resolve | ( | void | ) | const |
Resolves the address of the host.
NMemException | If runs out of memory | |
NResolveException | If get a low level error | |
NHostTryAgainException | If requested to try again | |
NHostNotFoundException | If the host was not found |
Definition at line 82 of file linux/nhostaddress.cpp.
References NException::NETWORK, and NString::toChar().
Referenced by NTcpSocket::connectToHost(), NMySql::connectToHost(), and toString().
NString toString | ( | void | ) | const |
Returns the resolved address in a NString format.
Definition at line 135 of file linux/nhostaddress.cpp.
References resolve().
Referenced by NTcpSocket::connectToHost(), NMySql::connectToHost(), NTcpSocket::execListen(), NMySql::getError(), NAbstractSocket::NAbstractSocket(), NTcpSocket::peerName(), NTcpSocket::read(), NTcpSocket::readLine(), and NTcpSocket::waitForConnected().
Returns a given ip addresss in a NString format.
ip | The ip address in network byte order |
Definition at line 151 of file linux/nhostaddress.cpp.
References NException::NETWORK, and NString::number().
NString address | ( | void | ) | const |
Returns the host address as originally set.
Definition at line 166 of file linux/nhostaddress.cpp.
Returns a list with all the aliases of the host.
Definition at line 171 of file linux/nhostaddress.cpp.
References NList::append().
Returns a list with all the ip addresses of the host.
Definition at line 186 of file linux/nhostaddress.cpp.
References NList::append().
bool isNull | ( | void | ) | const |
Tests whether the host is NULL (0.0.0.0).
Definition at line 207 of file linux/nhostaddress.cpp.
bool isLocalhost | ( | void | ) | const |
Tests wheter the host is localhost (127.0.0.1).
Definition at line 216 of file linux/nhostaddress.cpp.
NHostAddress & operator= | ( | const NHostAddress & | rhs | ) |
Assigns a NHostAddress to the object.
rhs | The NHostAddress being copied |
Definition at line 225 of file linux/nhostaddress.cpp.
References m_addr.
NHostAddress & operator= | ( | const NString & | rhs | ) |
Assigns an address to the object.
rhs | The address of the host |
Definition at line 232 of file linux/nhostaddress.cpp.
void setAddress | ( | nuint32 | ip | ) |
Sets the host address hold by the object to a given ip address.
ip | The ip address of the host in network byte order |
void setAddress | ( | const NString & | addr | ) |
Sets the host address hold by the object to a given host address.
addr | The host address |
void setAddress | ( | const sockaddr * | sock | ) |
Sets the host address hold by the object to a given address.
sock | A pointer to a sockaddr structure containing the host address |
nuint32 resolve | ( | void | ) | const |
Resolves the address of the host.
NMemException | If runs out of memory | |
NResolveException | If get a low level error | |
NHostTryAgainException | If requested to try again | |
NHostNotFoundException | If the host was not found |
NString toString | ( | void | ) | const |
NString address | ( | void | ) | const |
Returns the host address as originally set.
Returns a list with all the aliases of the host.
Returns a list with all the ip addresses of the host.
bool isNull | ( | void | ) | const |
Tests whether the host is NULL (0.0.0.0).
bool isLocalhost | ( | void | ) | const |
Tests wheter the host is localhost (127.0.0.1).
NHostAddress& operator= | ( | const NHostAddress & | rhs | ) |
Assigns a NHostAddress to the object.
rhs | The NHostAddress being copied |
NHostAddress& operator= | ( | const NString & | rhs | ) |
Assigns an address to the object.
rhs | The address of the host |