#ifndef DNS_LOOKUP_H
#define DNS_LOOKUP_H
struct dns_lookup;
struct dns_lookup_settings {
const char *dns_client_socket_path;
unsigned int timeout_msecs;
/* the idle_timeout_msecs works only with the dns_client_* API.
0 = disconnect immediately */
unsigned int idle_timeout_msecs;
/* ioloop to run the lookup on (defaults to current_ioloop) */
};
struct dns_lookup_result {
/* all is ok if ret=0, otherwise it contains net_gethosterror()
compatible error code. error string is always set if ret != 0. */
int ret;
const char *error;
/* how many milliseconds the lookup took. */
unsigned int msecs;
/* for IP lookup: */
unsigned int ips_count;
/* for PTR lookup: */
const char *name;
};
void *context);
/* Do asynchronous DNS lookup via dns-client UNIX socket. Returns 0 if lookup
started, -1 if there was an error communicating with the UNIX socket.
When failing with -1, the callback is called before returning from the
function. */
dns_lookup(host + \
CALLBACK_TYPECHECK(callback, void (*)( \
const struct dns_lookup_settings *set,
dns_lookup_ptr(host + \
CALLBACK_TYPECHECK(callback, void (*)( \
/* Abort the DNS lookup without calling the callback. */
/* Alternative API for clients that need to do multiple DNS lookups. */
/* Connect immediately to the dns-lookup socket. */
CALLBACK_TYPECHECK(callback, void (*)( \
CALLBACK_TYPECHECK(callback, void (*)( \
#endif