uvco 0.1
|
AddressHandle is a light-weight wrapper around a struct sockaddr_in(6)
, and is therefore cheap to copy.
More...
#include <name_resolution.h>
Classes | |
struct | NtopHelper_ |
A helper for calling inet_ntop(3) . More... | |
Public Member Functions | |
AddressHandle ()=default | |
AddressHandle (const AddressHandle &)=default | |
AddressHandle (AddressHandle &&)=default | |
AddressHandle & | operator= (const AddressHandle &)=default |
AddressHandle & | operator= (AddressHandle &&)=default |
~AddressHandle ()=default | |
AddressHandle (std::span< const uint8_t > ipv4_or_6, uint16_t port, uint32_t v6scope=0) | |
AddressHandle (uint32_t ipv4, uint16_t port) | |
AddressHandle (std::string_view ip, uint16_t port, uint32_t v6scope=0) | |
AddressHandle (const struct addrinfo *ai) | |
AddressHandle (const struct sockaddr *sa) | |
std::string | address () const |
uint16_t | port () const |
int | family () const |
Family is either AF_INET or AF_INET6 . | |
const struct sockaddr * | sockaddr () const |
std::string | toString () const |
Static Public Attributes | |
static constexpr size_t | ipv4Length = 4 |
static constexpr size_t | ipv6Length = 16 |
Private Attributes | |
std::variant< struct sockaddr_in, struct sockaddr_in6 > | addr_ |
AddressHandle is a light-weight wrapper around a struct sockaddr_in(6)
, and is therefore cheap to copy.
It can be constructed from different forms of TCP/IP addresses, and also supports formatting an address to a string.
In order to resolve a DNS hostname, use the Resolver
class.
|
default |
|
default |
|
default |
|
default |
uvco::AddressHandle::AddressHandle | ( | std::span< const uint8_t > | ipv4_or_6, |
uint16_t | port, | ||
uint32_t | v6scope = 0 |
||
) |
uvco::AddressHandle::AddressHandle | ( | uint32_t | ipv4, |
uint16_t | port | ||
) |
uvco::AddressHandle::AddressHandle | ( | std::string_view | ip, |
uint16_t | port, | ||
uint32_t | v6scope = 0 |
||
) |
|
explicit |
|
explicit |
|
inline |
int uvco::AddressHandle::family | ( | ) | const |
|
default |
|
default |
uint16_t uvco::AddressHandle::port | ( | ) | const |
const struct sockaddr * uvco::AddressHandle::sockaddr | ( | ) | const |
The inner sockaddr struct. May refer to either a sockaddr_in
or a sockaddr_in6
, depending on family()
.
std::string uvco::AddressHandle::toString | ( | ) | const |
|
private |
|
staticconstexpr |
|
staticconstexpr |