21 #ifndef XAPIAN_INCLUDED_RESOLVER_H
22 #define XAPIAN_INCLUDED_RESOLVER_H
26 #include <string_view>
43 #define C(X) ((X) < 0 ? 2 : 1)
100 struct addrinfo* old_p =
p;
110 return !(*
this == o);
114 Resolver(std::string_view host,
int port,
int flags = 0) {
115 using namespace std::string_literals;
147 if (host !=
"::1" && host !=
"127.0.0.1" && host !=
"localhost") {
148 flags |= AI_ADDRCONFIG;
152 #ifdef AI_NUMERICSERV
153 flags |= AI_NUMERICSERV;
156 struct addrinfo hints;
157 std::memset(&hints, 0,
sizeof(
struct addrinfo));
158 hints.ai_family = AF_UNSPEC;
159 hints.ai_socktype = SOCK_STREAM;
160 hints.ai_flags = flags;
161 hints.ai_protocol = 0;
163 int r = getaddrinfo(host.empty() ?
nullptr :
str(host).c_str(),
bool operator!=(const const_iterator &o) const
bool operator==(const const_iterator &o) const
const_iterator operator++(int)
const_iterator(struct addrinfo *p_)
struct addrinfo & operator*() const
const_iterator end() const
Resolver(std::string_view host, int port, int flags=0)
const_iterator begin() const
Indicates a problem communicating with a remote database.
Hierarchy of classes which Xapian can throw as exceptions.
string str(int value)
Convert int to std::string.
include <netdb.h>, with portability workarounds.
include <sys/socket.h> with portability workarounds.
Convert types to std::string.