Wizard
Software Engineering Project - Wizard
|
#include <inet_address.h>
Public Member Functions | |
inet_address () | |
inet_address (in_port_t port) | |
inet_address (uint32_t addr, in_port_t port) | |
inet_address (const std::string &saddr, in_port_t port) | |
inet_address (const sockaddr &addr) | |
inet_address (const sock_address &addr) | |
inet_address (const sockaddr_in &addr) | |
inet_address (const inet_address &addr) | |
bool | is_set () const |
void | create (in_addr_t addr, in_port_t port) |
void | create (const std::string &saddr, in_port_t port) |
in_addr_t | address () const |
uint8_t | operator[] (int i) const |
in_port_t | port () const |
socklen_t | size () const override |
const sockaddr * | sockaddr_ptr () const override |
sockaddr * | sockaddr_ptr () override |
const sockaddr_in * | sockaddr_in_ptr () const |
sockaddr_in * | sockaddr_in_ptr () |
std::string | to_string () const |
![]() | |
virtual | ~sock_address () |
virtual sa_family_t | family () const |
Static Public Member Functions | |
static in_addr_t | resolve_name (const std::string &saddr) |
Static Public Attributes | |
static constexpr sa_family_t | ADDRESS_FAMILY = AF_INET |
Class that represents an internet (IPv4) address. This inherits from the IP-specific form of a socket address, sockaddr_in.
|
inline |
Constructs an empty address. The address is initialized to all zeroes.
|
inlineexplicit |
Constructs an address for any iface using the specified port. This is a convenient way for a server to specify an address that will bind to all interfaces.
port | The port number in native/host byte order. |
|
inline |
Constructs an address for the specified host using the specified port.
addr | The 32-bit host address in native/host byte order. |
port | The port number in native/host byte order. |
|
inline |
Constructs an address using the name of the host and the specified port. This attempts to resolve the host name to an address.
saddr | The name of the host. |
port | The port number in native/host byte order. |
|
inline |
Constructs the address by copying the specified structure.
addr | The other address |
|
inline |
Constructs the address by copying the specified structure.
addr | The other address |
|
inline |
Constructs the address by copying the specified structure.
addr | The other address |
|
inline |
Constructs the address by copying the specified address.
addr | The other address |
|
inline |
Gets the 32-bit internet address.
void sockpp::inet_address::create | ( | const std::string & | saddr, |
in_port_t | port ) |
Creates the socket address using the specified host name and port number.
saddr | The string host name. |
port | The port number in native/host byte order. |
sys_error,getaddrinfo_error |
void sockpp::inet_address::create | ( | in_addr_t | addr, |
in_port_t | port ) |
Creates the socket address using the specified host address and port number.
addr | The host address. |
port | The host port number. |
bool sockpp::inet_address::is_set | ( | ) | const |
Checks if the address is set to some value. This doesn't attempt to determine if the address is valid, simply that it's not all zero.
|
inline |
Gets a byte of the 32-bit Internet Address
i | The byte to read (0-3) |
|
inline |
Gets the port number.
|
static |
Attempts to resolve the host name into a 32-bit internet address.
saddr | The string host name. |
sys_error,getaddrinfo_error |
|
inlineoverridevirtual |
Gets the size of this structure. This is equivalent to sizeof(this) but more convenient in some places.
Implements sockpp::sock_address.
|
inline |
Gets a pointer to this object cast to a sockaddr_in.
|
inline |
Gets a const pointer to this object cast to a sockaddr_in.
|
inlineoverridevirtual |
Gets a pointer to this object cast to a sockaddr.
Implements sockpp::sock_address.
|
inlineoverridevirtual |
Gets a pointer to this object cast to a sockaddr.
Implements sockpp::sock_address.
string sockpp::inet_address::to_string | ( | ) | const |
Gets a printable string for the address. This gets the simple dot notation of the address as returned from inet_ntop(). It does not attempt a host lookup.
|
staticconstexpr |
The address family for this type of address