#include <userver/engine/io/sockaddr.hpp>
Native socket address wrapper.
Definition at line 40 of file sockaddr.hpp.
Public Member Functions | |
Sockaddr () noexcept | |
Constructs an unspecified native socket address. | |
Sockaddr (const void *data) | |
Wraps a native socket address structure. | |
template<typename T > | |
T * | As () |
Domain-specific native socket address structure pointer. | |
template<typename T > | |
const T * | As () const |
Domain-specific native socket address structure pointer. | |
struct sockaddr * | Data () |
Native socket address structure pointer. | |
const struct sockaddr * | Data () const |
Native socket address structure pointer. | |
socklen_t | Size () const |
Maximum supported native socket address structure size. | |
socklen_t | Capacity () const |
Maximum supported native socket address structure size. | |
sa_family_t | Family () const |
Protocol family. | |
AddrDomain | Domain () const |
Communication domain. | |
bool | HasPort () const |
Whether the stored socket address family expects a port. | |
std::uint16_t | Port () const |
Returns the stored port number if available, otherwise throws. | |
void | SetPort (std::uint16_t port) |
Sets a port for address families that allow for one, otherwise throws. | |
std::string | PrimaryAddressString () const |
Human-readable address representation. | |
Static Public Member Functions | |
static Sockaddr | MakeUnixSocketAddress (std::string_view path) |
Creates address of a Unix socket located at the specified path. | |
static Sockaddr | MakeLoopbackAddress () noexcept |
Creates the IPv6 loopback address [::1]:0 that also handles IPv4 connections. | |
static Sockaddr | MakeIPv4LoopbackAddress () noexcept |
Creates the IPv4 only loopback address 127.0.0.1:0 . | |
static constexpr socklen_t | Addrlen (AddrDomain domain) |
Domain-specific native socket address structure size. | |
|
inlinenoexcept |
Constructs an unspecified native socket address.
Definition at line 44 of file sockaddr.hpp.
|
inlineexplicit |
Wraps a native socket address structure.
Definition at line 49 of file sockaddr.hpp.
|
inlinestaticconstexpr |
Domain-specific native socket address structure size.
Definition at line 119 of file sockaddr.hpp.
|
inline |
Domain-specific native socket address structure pointer.
Definition at line 73 of file sockaddr.hpp.
|
inline |
Domain-specific native socket address structure pointer.
Definition at line 82 of file sockaddr.hpp.
|
inline |
Maximum supported native socket address structure size.
Definition at line 97 of file sockaddr.hpp.
|
inline |
Native socket address structure pointer.
Definition at line 88 of file sockaddr.hpp.
|
inline |
Native socket address structure pointer.
Definition at line 91 of file sockaddr.hpp.
|
inline |
Communication domain.
Definition at line 103 of file sockaddr.hpp.
|
inline |
Protocol family.
Definition at line 100 of file sockaddr.hpp.
|
staticnoexcept |
Creates the IPv4 only loopback address 127.0.0.1:0
.
Prefer a more generic MakeLoopbackAddress() function if not sure.
|
staticnoexcept |
Creates the IPv6 loopback address [::1]:0
that also handles IPv4 connections.
A program needs to support only this API type to support IPv4 and IPv6.
std::string engine::io::Sockaddr::PrimaryAddressString | ( | ) | const |
Human-readable address representation.
|
inline |
Maximum supported native socket address structure size.
Definition at line 94 of file sockaddr.hpp.