25#ifndef MYSQL_HARNESS_NET_TS_IMPL_RESOLVER_H_
26#define MYSQL_HARNESS_NET_TS_IMPL_RESOLVER_H_
31#include <system_error>
53 bad_hints = EAI_BADHINTS,
70 overflow = EAI_OVERFLOW,
74 bad_protocol = EAI_PROTOCOL,
78 cancelled = EAI_CANCELED,
82 not_cancelled = EAI_NOTCANCELED,
90 all_done = EAI_ALLDONE,
98 idn_encode_failed = EAI_IDN_ENCODE,
114 class category_impl :
public std::error_category {
116 const char *
name()
const noexcept override {
return "resolver"; }
117 std::string message(
int ev)
const override {
return gai_strerror(ev); }
131 static category_impl instance;
162 const auto begin =
buf;
163 const auto end =
buf + buf_len;
165 if (end ==
std::find(begin, end,
'\0')) {
174 const struct sockaddr *saddr, socklen_t addrlen,
char *
host,
175 socklen_t hostlen,
char *serv, socklen_t servlen,
int flags) {
176#if defined(__APPLE__)
179 if (addrlen <
sizeof(*saddr)) {
184 if ((saddr->sa_family == AF_INET && addrlen <
sizeof(sockaddr_in)) ||
185 (saddr->sa_family == AF_INET6 && addrlen <
sizeof(sockaddr_in6))) {
195 if (ret == EAI_SYSTEM) {
215 std::error_code{ret, std::system_category()});
230 const struct addrinfo *hints) {
231 struct addrinfo *ainfo{
nullptr};
237 if (ret == EAI_SYSTEM) {
257 std::error_code{ret, std::system_category()});
265 return {std::in_place, ainfo, &::freeaddrinfo};
272 if (
nullptr == ::inet_ntop(af, src, out, out_len)) {
Definition: expected.h:944
static int flags[50]
Definition: hp_test1.cc:40
const char * host
Definition: mysqladmin.cc:59
static bool interrupted
Definition: mysqladmin.cc:66
Definition: buf0block_hint.cc:30
const byte * find(const Pages *pages, const page_id_t &page_id) noexcept
Find a doublewrite copy of a page.
Definition: buf0dblwr.cc:3564
bool in_progress()
Check if upgrade is in progress.
Definition: upgrade.cc:114
Definition: authentication.cc:36
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:229
stdx::expected< const char *, std::error_code > inetntop(int af, const void *src, char *out, size_t out_len)
Definition: resolver.h:268
stdx::expected< void, std::error_code > gethostname(char *buf, size_t buf_len)
get hostname.
Definition: resolver.h:151
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:173
std::error_code last_error_code()
get last std::error_code for socket-errors.
Definition: socket_error.h:107
resolver_errc
Definition: resolver.h:48
@ 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:113
std::error_code make_error_code(resolver_errc ec)
Definition: resolver.h:135
std::error_code make_error_code(net::stream_errc e) noexcept
Definition: buffer.h:103
Definition: gcs_xcom_synode.h:64
constexpr auto make_unexpected(E &&e) -> unexpected< std::decay_t< E > >
Definition: expected.h:125
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:2438
struct sockaddr sockaddr
Definition: sock_probe_win32.h:63
case opt name
Definition: sslopt-case.h:33