24#ifndef MYSQL_HARNESS_NET_TS_IMPL_RESOLVER_H_
25#define MYSQL_HARNESS_NET_TS_IMPL_RESOLVER_H_
30#include <system_error>
52 bad_hints = EAI_BADHINTS,
69 overflow = EAI_OVERFLOW,
73 bad_protocol = EAI_PROTOCOL,
77 cancelled = EAI_CANCELED,
81 not_cancelled = EAI_NOTCANCELED,
89 all_done = EAI_ALLDONE,
97 idn_encode_failed = EAI_IDN_ENCODE,
113 class category_impl :
public std::error_category {
115 const char *
name()
const noexcept override {
return "resolver"; }
116 std::string message(
int ev)
const override {
return gai_strerror(ev); }
130 static category_impl instance;
162 const auto end =
buf + buf_len;
173 const struct sockaddr *saddr, socklen_t addrlen,
char *
host,
174 socklen_t hostlen,
char *serv, socklen_t servlen,
int flags) {
175#if defined(__APPLE__)
178 if (addrlen <
sizeof(*saddr)) {
183 if ((saddr->sa_family == AF_INET && addrlen <
sizeof(sockaddr_in)) ||
184 (saddr->sa_family == AF_INET6 && addrlen <
sizeof(sockaddr_in6))) {
194 if (ret == EAI_SYSTEM) {
214 std::error_code{ret, std::system_category()});
229 const struct addrinfo *hints) {
230 struct addrinfo *ainfo{
nullptr};
236 if (ret == EAI_SYSTEM) {
256 std::error_code{ret, std::system_category()});
264 return {std::in_place, ainfo, &::freeaddrinfo};
271 if (
nullptr == ::inet_ntop(af, src, out, out_len)) {
Definition: expected.h:943
static char buf[MAX_BUF]
Definition: conf_to_src.cc:72
static int flags[50]
Definition: hp_test1.cc:39
const char * host
Definition: mysqladmin.cc:63
static bool interrupted
Definition: mysqladmin.cc:70
void * begin(THD *thd, const TABLE *table, size_t data_size, size_t memory, size_t num_threads) noexcept
Definition: bulk_data_service.cc:1533
Definition: buf0block_hint.cc:29
const byte * find(const Pages *pages, const page_id_t &page_id) noexcept
Find a doublewrite copy of a page.
Definition: buf0dblwr.cc:3578
bool in_progress()
Check if upgrade is in progress.
Definition: upgrade.cc:113
Definition: authentication.cc:35
stdx::expected< std::unique_ptr< struct addrinfo, void(*)(struct addrinfo *)>, std::error_code > getaddrinfo(const char *node, const char *service, const struct addrinfo *hints)
Definition: resolver.h:228
stdx::expected< const char *, std::error_code > inetntop(int af, const void *src, char *out, size_t out_len)
Definition: resolver.h:267
stdx::expected< void, std::error_code > gethostname(char *buf, size_t buf_len)
get hostname.
Definition: resolver.h:150
stdx::expected< void, std::error_code > getnameinfo(const struct sockaddr *saddr, socklen_t addrlen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags)
Definition: resolver.h:172
std::error_code last_error_code()
get last std::error_code for socket-errors.
Definition: socket_error.h:106
resolver_errc
Definition: resolver.h:47
@ bad_socktype
ai_socktype not supported
@ host_not_found
NAME or SERVICE is unknown.
@ bad_flags
flags parameter had an invalid value
@ service_not_found
SERVICE not supported for ai_socktype.
@ out_of_memory
memory allocation failed
@ try_again
name could not be resolved at this time
@ fail
non recoverable failed on name resolution
@ bad_family
ai_family not supported
const std::error_category & resolver_category() noexcept
Definition: resolver.h:112
std::error_code make_error_code(resolver_errc ec)
Definition: resolver.h:134
std::error_code make_error_code(net::stream_errc e) noexcept
Definition: buffer.h:102
Definition: varlen_sort.h:183
constexpr auto make_unexpected(E &&e) -> unexpected< std::decay_t< E > >
Definition: expected.h:124
std::conditional_t< !std::is_array< T >::value, std::unique_ptr< T, detail::Deleter< T > >, std::conditional_t< detail::is_unbounded_array_v< T >, std::unique_ptr< T, detail::Array_deleter< std::remove_extent_t< T > > >, void > > unique_ptr
The following is a common type that is returned by all the ut::make_unique (non-aligned) specializati...
Definition: ut0new.h:2437
struct sockaddr sockaddr
Definition: sock_probe_win32.h:62
case opt name
Definition: sslopt-case.h:32