32 #define strdup _strdup
33 #define stricmp _stricmp
34 #define strnicmp _strnicmp
44#if !defined(DNS__16BIT)
45# define DNS__16BIT(p) (((p)[0] << 8) | (p)[1])
46# define DNS__32BIT(p) (((p)[0] << 24) | ((p)[1] << 16) | \
47 ((p)[2] << 8) | (p)[3])
48# define DNS_HEADER_QDCOUNT(h) DNS__16BIT((h) + 4)
49# define DNS_HEADER_ANCOUNT(h) DNS__16BIT((h) + 6)
50# define DNS_HEADER_NSCOUNT(h) DNS__16BIT((h) + 8)
51# define DNS_HEADER_ARCOUNT(h) DNS__16BIT((h) + 10)
52# define DNS_RR_TYPE(r) DNS__16BIT(r)
53# define DNS_RR_LEN(r) DNS__16BIT((r) + 8)
54# define DNS_RR_TTL(r) DNS__32BIT((r) + 4)
57#if defined(__cplusplus)
63#if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_2)
69#if defined(__ANDROID__)
70#include <sys/select.h>
74#include <netinet/in.h>
83#define ARES_EFORMERR 2
84#define ARES_ESERVFAIL 3
85#define ARES_ENOTFOUND 4
87#define ARES_EREFUSED 6
90#define ARES_EBADQUERY 7
91#define ARES_EBADNAME 8
92#define ARES_EBADFAMILY 9
93#define ARES_EBADRESP 10
94#define ARES_ECONNREFUSED 11
95#define ARES_ETIMEOUT 12
99#define ARES_EDESTRUCTION 16
102#define ARES_FLAG_USEVC (1 << 0)
103#define ARES_FLAG_PRIMARY (1 << 1)
104#define ARES_FLAG_IGNTC (1 << 2)
105#define ARES_FLAG_NORECURSE (1 << 3)
106#define ARES_FLAG_STAYOPEN (1 << 4)
107#define ARES_FLAG_NOSEARCH (1 << 5)
108#define ARES_FLAG_NOALIASES (1 << 6)
109#define ARES_FLAG_NOCHECKRESP (1 << 7)
110#define ARES_FLAG_TRY_NEXT_SERVER_ON_RCODE3 (1 << 8)
113#define ARES_OPT_FLAGS (1 << 0)
114#define ARES_OPT_TIMEOUT (1 << 1)
115#define ARES_OPT_TRIES (1 << 2)
116#define ARES_OPT_NDOTS (1 << 3)
117#define ARES_OPT_UDP_PORT (1 << 4)
118#define ARES_OPT_TCP_PORT (1 << 5)
119#define ARES_OPT_SERVERS (1 << 6)
120#define ARES_OPT_DOMAINS (1 << 7)
121#define ARES_OPT_LOOKUPS (1 << 8)
125#define ARES_CAP_IPV6 (1 << 0)
138#if defined(WIN32) || defined(sun)
213extern int ares_mkquery(
const char *name,
int dnsclass,
int type,
unsigned short id,
214 int rd,
unsigned char **buf,
int *
buflen);
216 int alen,
char **
s,
long *
enclen);
227#if defined(WIN32) || defined (__CYGWIN__) || defined (__ANDROID__)
272#ifdef ARES_LEGACY_DEFINES
278#define INDIR_MASK 0xc0
293#ifndef MAXHOSTNAMELEN
294#define MAXHOSTNAMELEN 256
300#define NS_DEFAULTPORT 53
301#define NAMESERVER_PORT NS_DEFAULTPORT
315#if defined(__cplusplus)
static void callback(void *arg, int status, unsigned char *abuf, int alen)
void ares_destroy_internal(ares_channel channel, int suppressCallbacks)
void ares_gethostbyname(ares_channel channel, const char *name, int family, ares_host_callback callback, void *arg)
int ares_capabilities(int capmask)
@ ARES_POLLACTION_WRITEOFF
@ ARES_POLLACTION_WRITEON
void ares_free_string(char *str)
struct ares_channeldata * ares_channel
int ares_init(ares_channel *channelptr)
int ares_init_with_socket_function(ares_channel *channelptr, socket_function_ptr)
void() ares_poll_cb_func(void *cb_data, struct ares_channeldata *chan, int sockidx, int fd, int using_tcp, ares_poll_action_t act)
int ares_init_options_with_socket_function(ares_channel *channelptr, struct ares_options *options, int optmask, socket_function_ptr)
struct timeval * ares_timeout(ares_channel channel, struct timeval *maxtv, struct timeval *tv)
void ares_process(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
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)
const char * ares_strerror(int code)
void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen, int family, ares_host_callback callback, void *arg)
void ares_destroy(ares_channel channel)
int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id, int rd, unsigned char **buf, int *buflen)
void ares_process_poll(ares_channel channel, int server_idx, int rdFd, int wrFd, time_t now)
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, int alen, char **s, long *enclen)
int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
int hostfile_lookup(const char *name, struct hostent **host)
void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, ares_callback callback, void *arg)
void ares_free_hostent(struct hostent *host)
void(* ares_host_callback)(void *arg, int status, struct hostent *hostent)
void ares_query(ares_channel channel, const char *name, int dnsclass, int type, ares_callback callback, void *arg)
void(* ares_callback)(void *arg, int status, unsigned char *abuf, int alen)
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, int addrlen, int family, struct hostent **host)
int ares_init_options(ares_channel *channelptr, struct ares_options *options, int optmask)
enum ares_poll_action ares_poll_action_t
void ares_destroy_suppress_callbacks(ares_channel channel)
void ares_free_errmem(char *mem)
void ares_process_set_poll_cb(ares_channel channel, ares_poll_cb_func *cb_func, void *cb_data)
void(* socket_function_ptr)(Socket s, int transportType, const char *file, int line)
struct multiFamilyAddr * servers