#include <netAddress.h>
Public Member Functions | |
NetAddress () | |
Constructs an unspecified address. | |
NetAddress (const PRNetAddr &addr) | |
Constructs an address from a given PRNetAddr. | |
bool | set_any (int port) |
Sets the address up to refer to a particular port, but not to any particular IP. | |
bool | set_localhost (int port) |
Sets the address up to refer to a particular port, on this host. | |
bool | set_host (const string &hostname, int port) |
Sets the address up to refer to a particular port on a particular host. | |
void | clear () |
Resets the NetAddress to its initial state. | |
int | get_port () const |
Returns the port number to which this address refers. | |
void | set_port (int port) |
Resets the port number without otherwise changing the address. | |
string | get_ip_string () const |
Returns the IP address to which this address refers, formatted as a string. | |
PN_uint32 | get_ip () const |
Returns the IP address to which this address refers, as a 32-bit integer, in host byte order. | |
PN_uint8 | get_ip_component (int n) const |
Returns the nth 8-bit component of the IP address. | |
PRNetAddr * | get_addr () const |
Returns the PRNetAddr for this address. | |
void | output (ostream &out) const |
Private Attributes | |
PRNetAddr | _addr |
Definition at line 39 of file netAddress.h.
|
Constructs an unspecified address.
Definition at line 39 of file netAddress.cxx. |
|
Constructs an address from a given PRNetAddr. Normally, this constructor should not be used by user code; instead, create a default NetAddress and use one of the set_*() functions to set up an address. Definition at line 58 of file netAddress.cxx. References _addr. |
|
Resets the NetAddress to its initial state.
Definition at line 209 of file netAddress.cxx. References _addr, and pprerror(). Referenced by NetDatagram::NetDatagram(). |
|
Returns the PRNetAddr for this address.
Definition at line 312 of file netAddress.cxx. |
|
Returns the IP address to which this address refers, as a 32-bit integer, in host byte order.
Definition at line 277 of file netAddress.cxx. |
|
Returns the nth 8-bit component of the IP address. An IP address has four components; component 0 is the first (leftmost), and component 3 is the last (rightmost) in the dotted number convention. Definition at line 296 of file netAddress.cxx. |
|
Returns the IP address to which this address refers, formatted as a string.
Definition at line 252 of file netAddress.cxx. References _addr. Referenced by ConnectionListener::receive_datagram(). |
|
Returns the port number to which this address refers.
Definition at line 222 of file netAddress.cxx. |
|
Definition at line 324 of file netAddress.cxx. |
|
Sets the address up to refer to a particular port, but not to any particular IP. Returns true if successful, false otherwise (currently, this only returns true). Definition at line 77 of file netAddress.cxx. |
|
Sets the address up to refer to a particular port on a particular host. Returns true if the hostname is known, false otherwise. Definition at line 113 of file netAddress.cxx. Referenced by ConnectionManager::open_TCP_client_connection(). |
|
Sets the address up to refer to a particular port, on this host.
Definition at line 94 of file netAddress.cxx. References size_t. |
|
Resets the port number without otherwise changing the address.
Definition at line 237 of file netAddress.cxx. |
|
Definition at line 61 of file netAddress.h. Referenced by clear(), get_ip_string(), NetAddress(), and set_port(). |