#include <address.hpp>
Public Types | |
typedef address_router< V4 > | v4 |
typedef address_router< V6 > | v6 |
Public Member Functions | |
address ()=default | |
address (const sockaddr_in &addr) | |
address (const sockaddr_in6 &addr) | |
address (const address &x)=default | |
address & | operator= (const address &x) |
address (address &&x) noexcept | |
address & | operator= (address &&x) noexcept |
~address () | |
unsigned int | to_ulong () const |
std::string | to_string () const |
void | port (unsigned short pn) |
unsigned short | port () const |
bool | is_v4 () const |
bool | is_v6 () const |
sockaddr * | addr () |
const sockaddr * | addr () const |
sockaddr_in * | addr_v4 () |
const sockaddr_in * | addr_v4 () const |
sockaddr_in6 * | addr_v6 () |
const sockaddr_in6 * | addr_v6 () const |
socklen_t | size () const |
Friends | |
template<protocol_family PF> | |
class | address_router |
The address class represents a IPv4 or IPv6 address.
typedef address_router<V4> matador::address::v4 |
Shortcut to the internal IPv4 address router
typedef address_router<V6> matador::address::v6 |
Shortcut to the internal IPv6 address router
|
default |
Default constructor
|
explicit |
Constructs an address from the given addr representing a IPv4 socket address structure
addr | Initial IPv4 Socket address |
|
explicit |
Constructs an address from the given addr representing a IPv6 socket address structure
addr | Initial IPv6 Socket address |
|
default |
Copy constructs an address from the given address x
x | Address to copy from |
|
noexcept |
Move copy constructs an address from the given address x
x | Address to move copy from |
matador::address::~address | ( | ) |
Destructs the address
sockaddr * matador::address::addr | ( | ) |
Returns the raw sockaddr structure
const sockaddr * matador::address::addr | ( | ) | const |
Returns the raw sockaddr structure
sockaddr_in * matador::address::addr_v4 | ( | ) |
Returns the IPv4 sockaddr_in structure
const sockaddr_in * matador::address::addr_v4 | ( | ) | const |
Returns the IPv4 sockaddr_in structure
sockaddr_in6 * matador::address::addr_v6 | ( | ) |
Returns the IPv6 sockaddr_in6 structure
const sockaddr_in6 * matador::address::addr_v6 | ( | ) | const |
Returns the IPv6 sockaddr_in6 structure
bool matador::address::is_v4 | ( | ) | const |
Returns true if address is IPv4
bool matador::address::is_v6 | ( | ) | const |
Returns true if address is IPv4
Move assign an address from the given address x
x | Address to move assign from |
Copy assign an address from the given address x
x | Address to assign from |
unsigned short matador::address::port | ( | ) | const |
Returns the current port number of the address.
void matador::address::port | ( | unsigned short | pn | ) |
Sets the port number
pn | Port number to set |
socklen_t matador::address::size | ( | ) | const |
Returns the size of the underlying address structure.
std::string matador::address::to_string | ( | ) | const |
Return the address in string format either in IPv4 dotted format or in IPv6 colon based format
unsigned int matador::address::to_ulong | ( | ) | const |
Returns the address as unsigned long value