24#include <sys/socket.h>
25#include <netinet/in.h>
48static void host_callback(
void *arg,
int status,
unsigned char *abuf,
114 for (p =
hquery->remaining_lookups; *p; p++)
120 hquery->remaining_lookups = p + 1;
139static void host_callback(
void* arg,
int status,
unsigned char* abuf,
int alen)
148 if (host && channel->
nsort)
181 for (p = name; *p; p++)
183 if (!
isdigit((
unsigned char)*p) && *p !=
'.')
190 if (p == name || *(p - 1) ==
'.')
194#if defined(_MSC_VER) && _MSC_VER >= 1800
195 inet_pton(
AF_INET, name, &addr.s_addr);
215 addrs[0] = (
char*)&addr;
278 for (
i1 = 0; host->h_addr_list[
i1];
i1++)
302 for (
i = 0;
i < nsort;
i++)
304 if ((addr->s_addr & sortlist[
i].
mask.s_addr) == sortlist[
i].
addr.s_addr)
static void callback(void *arg, int status, unsigned char *abuf, int alen)
void ares_search(ares_channel channel, const char *name, int dnsclass, int type, ares_callback callback, void *arg)
int ares_parse_a_reply(const unsigned char *abuf, int alen, struct hostent **host)
#define ARES_EDESTRUCTION
void ares_free_hostent(struct hostent *host)
void(* ares_host_callback)(void *arg, int status, struct hostent *hostent)
int ares__get_hostent(FILE *fp, struct hostent **host)
static void end_hquery(struct host_query *hquery, int status, struct hostent *host)
void ares_gethostbyname(ares_channel channel, const char *name, int family, ares_host_callback callback, void *arg)
static void next_lookup(struct host_query *hquery)
static int get_address_index(struct in_addr *addr, struct apattern *sortlist, int nsort)
static void host_callback(void *arg, int status, unsigned char *abuf, int alen)
static void sort_addresses(struct hostent *host, struct apattern *sortlist, int nsort)
static int fake_hostent(const char *name, ares_host_callback callback, void *arg)
int hostfile_lookup(const char *name, struct hostent **host)
static int file_lookup(const char *name, struct hostent **host)
int ares_local_gethostbyname(ares_channel channel, const char *name, int family, ares_host_callback callback, void *arg)
struct apattern * sortlist
const char * remaining_lookups
ares_host_callback callback