| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #ifndef ARES__H |
| #define ARES__H |
|
|
| #include "ares_version.h" |
| #include "ares_build.h" |
|
|
| #if defined(_WIN32) |
| # ifndef WIN32_LEAN_AND_MEAN |
| # define WIN32_LEAN_AND_MEAN |
| # endif |
| #endif |
|
|
| #ifdef CARES_HAVE_SYS_TYPES_H |
| # include <sys/types.h> |
| #endif |
|
|
| #ifdef CARES_HAVE_SYS_SOCKET_H |
| # include <sys/socket.h> |
| #endif |
|
|
| #ifdef CARES_HAVE_SYS_SELECT_H |
| # include <sys/select.h> |
| #endif |
|
|
| #ifdef CARES_HAVE_WINSOCK2_H |
| # include <winsock2.h> |
| |
| |
| # ifdef _MSC_VER |
| # pragma comment(lib, "ws2_32") |
| # pragma comment(lib, "advapi32") |
| # pragma comment(lib, "iphlpapi") |
| # endif |
| #endif |
|
|
| #ifdef CARES_HAVE_WS2TCPIP_H |
| # include <ws2tcpip.h> |
| #endif |
|
|
| #ifdef CARES_HAVE_WINDOWS_H |
| # include <windows.h> |
| #endif |
|
|
| |
| |
| |
| #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ |
| defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ |
| defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \ |
| defined(__QNX__) || defined(__MVS__) || defined(__HAIKU__) |
| # include <sys/select.h> |
| #endif |
|
|
| #if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) |
| # include <sys/bsdskt.h> |
| #endif |
|
|
| #if !defined(_WIN32) |
| # include <netinet/in.h> |
| #endif |
|
|
| #ifdef WATT32 |
| # include <tcp.h> |
| #endif |
|
|
| #if defined(ANDROID) || defined(__ANDROID__) |
| # include <jni.h> |
| #endif |
|
|
| typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; |
| typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t; |
|
|
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
|
|
| |
| |
| |
|
|
| #if defined(_WIN32) || defined(__CYGWIN__) || defined(__SYMBIAN32__) |
| # ifdef CARES_STATICLIB |
| # define CARES_EXTERN |
| # else |
| # ifdef CARES_BUILDING_LIBRARY |
| # define CARES_EXTERN __declspec(dllexport) |
| # else |
| # define CARES_EXTERN __declspec(dllimport) |
| # endif |
| # endif |
| #else |
| # if defined(__GNUC__) && __GNUC__ >= 4 |
| # define CARES_EXTERN __attribute__((visibility("default"))) |
| # elif defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 900 |
| # define CARES_EXTERN __attribute__((visibility("default"))) |
| # elif defined(__SUNPRO_C) |
| # define CARES_EXTERN _global |
| # else |
| # define CARES_EXTERN |
| # endif |
| #endif |
|
|
| #ifdef __GNUC__ |
| # define CARES_GCC_VERSION \ |
| (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) |
| #else |
| # define CARES_GCC_VERSION 0 |
| #endif |
|
|
| #ifndef __has_attribute |
| # define __has_attribute(x) 0 |
| #endif |
|
|
| #ifdef CARES_NO_DEPRECATED |
| # define CARES_DEPRECATED |
| # define CARES_DEPRECATED_FOR(f) |
| #else |
| # if CARES_GCC_VERSION >= 30200 || __has_attribute(__deprecated__) |
| # define CARES_DEPRECATED __attribute__((__deprecated__)) |
| # else |
| # define CARES_DEPRECATED |
| # endif |
|
|
| # if CARES_GCC_VERSION >= 40500 || defined(__clang__) |
| # define CARES_DEPRECATED_FOR(f) \ |
| __attribute__((deprecated("Use " #f " instead"))) |
| # elif defined(_MSC_VER) |
| # define CARES_DEPRECATED_FOR(f) __declspec(deprecated("Use " #f " instead")) |
| # else |
| # define CARES_DEPRECATED_FOR(f) CARES_DEPRECATED |
| # endif |
| #endif |
|
|
| typedef enum { |
| ARES_SUCCESS = 0, |
|
|
| |
| ARES_ENODATA = 1, |
| ARES_EFORMERR = 2, |
| ARES_ESERVFAIL = 3, |
| ARES_ENOTFOUND = 4, |
| ARES_ENOTIMP = 5, |
| ARES_EREFUSED = 6, |
|
|
| |
| ARES_EBADQUERY = 7, |
| ARES_EBADNAME = 8, |
| ARES_EBADFAMILY = 9, |
| ARES_EBADRESP = 10, |
| ARES_ECONNREFUSED = 11, |
| ARES_ETIMEOUT = 12, |
| ARES_EOF = 13, |
| ARES_EFILE = 14, |
| ARES_ENOMEM = 15, |
| ARES_EDESTRUCTION = 16, |
| ARES_EBADSTR = 17, |
|
|
| |
| ARES_EBADFLAGS = 18, |
|
|
| |
| ARES_ENONAME = 19, |
| ARES_EBADHINTS = 20, |
|
|
| |
| ARES_ENOTINITIALIZED = 21, |
|
|
| |
| ARES_ELOADIPHLPAPI = 22, |
| ARES_EADDRGETNETWORKPARAMS = 23, |
|
|
| |
| ARES_ECANCELLED = 24, |
|
|
| |
| ARES_ESERVICE = 25, |
| |
|
|
| ARES_ENOSERVER = 26 |
| } ares_status_t; |
|
|
| typedef enum { |
| ARES_FALSE = 0, |
| ARES_TRUE = 1 |
| } ares_bool_t; |
|
|
| |
| typedef enum { |
| |
| ARES_EVSYS_DEFAULT = 0, |
| |
| ARES_EVSYS_WIN32 = 1, |
| |
| ARES_EVSYS_EPOLL = 2, |
| |
| ARES_EVSYS_KQUEUE = 3, |
| |
| ARES_EVSYS_POLL = 4, |
| |
| ARES_EVSYS_SELECT = 5 |
| } ares_evsys_t; |
|
|
| |
| #define ARES_FLAG_USEVC (1 << 0) |
| #define ARES_FLAG_PRIMARY (1 << 1) |
| #define ARES_FLAG_IGNTC (1 << 2) |
| #define ARES_FLAG_NORECURSE (1 << 3) |
| #define ARES_FLAG_STAYOPEN (1 << 4) |
| #define ARES_FLAG_NOSEARCH (1 << 5) |
| #define ARES_FLAG_NOALIASES (1 << 6) |
| #define ARES_FLAG_NOCHECKRESP (1 << 7) |
| #define ARES_FLAG_EDNS (1 << 8) |
| #define ARES_FLAG_NO_DFLT_SVR (1 << 9) |
| #define ARES_FLAG_DNS0x20 (1 << 10) |
|
|
| |
| #define ARES_OPT_FLAGS (1 << 0) |
| #define ARES_OPT_TIMEOUT (1 << 1) |
| #define ARES_OPT_TRIES (1 << 2) |
| #define ARES_OPT_NDOTS (1 << 3) |
| #define ARES_OPT_UDP_PORT (1 << 4) |
| #define ARES_OPT_TCP_PORT (1 << 5) |
| #define ARES_OPT_SERVERS (1 << 6) |
| #define ARES_OPT_DOMAINS (1 << 7) |
| #define ARES_OPT_LOOKUPS (1 << 8) |
| #define ARES_OPT_SOCK_STATE_CB (1 << 9) |
| #define ARES_OPT_SORTLIST (1 << 10) |
| #define ARES_OPT_SOCK_SNDBUF (1 << 11) |
| #define ARES_OPT_SOCK_RCVBUF (1 << 12) |
| #define ARES_OPT_TIMEOUTMS (1 << 13) |
| #define ARES_OPT_ROTATE (1 << 14) |
| #define ARES_OPT_EDNSPSZ (1 << 15) |
| #define ARES_OPT_NOROTATE (1 << 16) |
| #define ARES_OPT_RESOLVCONF (1 << 17) |
| #define ARES_OPT_HOSTS_FILE (1 << 18) |
| #define ARES_OPT_UDP_MAX_QUERIES (1 << 19) |
| #define ARES_OPT_MAXTIMEOUTMS (1 << 20) |
| #define ARES_OPT_QUERY_CACHE (1 << 21) |
| #define ARES_OPT_EVENT_THREAD (1 << 22) |
| #define ARES_OPT_SERVER_FAILOVER (1 << 23) |
|
|
| |
| #define ARES_NI_NOFQDN (1 << 0) |
| #define ARES_NI_NUMERICHOST (1 << 1) |
| #define ARES_NI_NAMEREQD (1 << 2) |
| #define ARES_NI_NUMERICSERV (1 << 3) |
| #define ARES_NI_DGRAM (1 << 4) |
| #define ARES_NI_TCP 0 |
| #define ARES_NI_UDP ARES_NI_DGRAM |
| #define ARES_NI_SCTP (1 << 5) |
| #define ARES_NI_DCCP (1 << 6) |
| #define ARES_NI_NUMERICSCOPE (1 << 7) |
| #define ARES_NI_LOOKUPHOST (1 << 8) |
| #define ARES_NI_LOOKUPSERVICE (1 << 9) |
| |
| #define ARES_NI_IDN (1 << 10) |
| #define ARES_NI_IDN_ALLOW_UNASSIGNED (1 << 11) |
| #define ARES_NI_IDN_USE_STD3_ASCII_RULES (1 << 12) |
|
|
| |
| #define ARES_AI_CANONNAME (1 << 0) |
| #define ARES_AI_NUMERICHOST (1 << 1) |
| #define ARES_AI_PASSIVE (1 << 2) |
| #define ARES_AI_NUMERICSERV (1 << 3) |
| #define ARES_AI_V4MAPPED (1 << 4) |
| #define ARES_AI_ALL (1 << 5) |
| #define ARES_AI_ADDRCONFIG (1 << 6) |
| #define ARES_AI_NOSORT (1 << 7) |
| #define ARES_AI_ENVHOSTS (1 << 8) |
| |
| #define ARES_AI_IDN (1 << 10) |
| #define ARES_AI_IDN_ALLOW_UNASSIGNED (1 << 11) |
| #define ARES_AI_IDN_USE_STD3_ASCII_RULES (1 << 12) |
| #define ARES_AI_CANONIDN (1 << 13) |
|
|
| #define ARES_AI_MASK \ |
| (ARES_AI_CANONNAME | ARES_AI_NUMERICHOST | ARES_AI_PASSIVE | \ |
| ARES_AI_NUMERICSERV | ARES_AI_V4MAPPED | ARES_AI_ALL | ARES_AI_ADDRCONFIG) |
| #define ARES_GETSOCK_MAXNUM \ |
| 16 |
| |
| #define ARES_GETSOCK_READABLE(bits, num) (bits & (1 << (num))) |
| #define ARES_GETSOCK_WRITABLE(bits, num) \ |
| (bits & (1 << ((num) + ARES_GETSOCK_MAXNUM))) |
|
|
| |
| #define ARES_LIB_INIT_NONE (0) |
| #define ARES_LIB_INIT_WIN32 (1 << 0) |
| #define ARES_LIB_INIT_ALL (ARES_LIB_INIT_WIN32) |
|
|
| |
| #define ARES_SERV_STATE_UDP (1 << 0) |
| #define ARES_SERV_STATE_TCP (1 << 1) |
|
|
| |
| |
| |
|
|
| #ifndef ares_socket_typedef |
| # if defined(_WIN32) && !defined(WATT32) |
| typedef SOCKET ares_socket_t; |
| # define ARES_SOCKET_BAD INVALID_SOCKET |
| # else |
| typedef int ares_socket_t; |
| # define ARES_SOCKET_BAD -1 |
| # endif |
| # define ares_socket_typedef |
| #endif |
|
|
| typedef void (*ares_sock_state_cb)(void *data, ares_socket_t socket_fd, |
| int readable, int writable); |
|
|
| struct apattern; |
|
|
| |
| |
| |
| |
| |
| |
| |
| struct ares_server_failover_options { |
| unsigned short retry_chance; |
| size_t retry_delay; |
| }; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| struct ares_options { |
| int flags; |
| int timeout; |
| int tries; |
| int ndots; |
| unsigned short udp_port; |
| unsigned short tcp_port; |
| int socket_send_buffer_size; |
| int socket_receive_buffer_size; |
| struct in_addr *servers; |
| int nservers; |
| char **domains; |
| int ndomains; |
| char *lookups; |
| ares_sock_state_cb sock_state_cb; |
| void *sock_state_cb_data; |
| struct apattern *sortlist; |
| int nsort; |
| int ednspsz; |
| char *resolvconf_path; |
| char *hosts_path; |
| int udp_max_queries; |
| int maxtimeout; |
| unsigned int qcache_max_ttl; |
| ares_evsys_t evsys; |
| struct ares_server_failover_options server_failover_opts; |
| }; |
|
|
| struct hostent; |
| struct timeval; |
| struct sockaddr; |
| struct ares_channeldata; |
| struct ares_addrinfo; |
| struct ares_addrinfo_hints; |
|
|
| |
| typedef struct ares_channeldata *ares_channel; |
|
|
| |
| typedef struct ares_channeldata ares_channel_t; |
|
|
| |
| |
| |
| |
| |
| |
| |
| struct ares_in6_addr { |
| union { |
| unsigned char _S6_u8[16]; |
| } _S6_un; |
| }; |
|
|
| struct ares_addr { |
| int family; |
|
|
| union { |
| struct in_addr addr4; |
| struct ares_in6_addr addr6; |
| } addr; |
| }; |
|
|
| |
| #include "ares_dns_record.h" |
|
|
| typedef void (*ares_callback)(void *arg, int status, int timeouts, |
| unsigned char *abuf, int alen); |
|
|
| typedef void (*ares_callback_dnsrec)(void *arg, ares_status_t status, |
| size_t timeouts, |
| const ares_dns_record_t *dnsrec); |
|
|
| typedef void (*ares_host_callback)(void *arg, int status, int timeouts, |
| struct hostent *hostent); |
|
|
| typedef void (*ares_nameinfo_callback)(void *arg, int status, int timeouts, |
| char *node, char *service); |
|
|
| typedef int (*ares_sock_create_callback)(ares_socket_t socket_fd, int type, |
| void *data); |
|
|
| typedef int (*ares_sock_config_callback)(ares_socket_t socket_fd, int type, |
| void *data); |
|
|
| typedef void (*ares_addrinfo_callback)(void *arg, int status, int timeouts, |
| struct ares_addrinfo *res); |
|
|
| typedef void (*ares_server_state_callback)(const char *server_string, |
| ares_bool_t success, int flags, |
| void *data); |
|
|
| typedef void (*ares_pending_write_cb)(void *data); |
|
|
| CARES_EXTERN int ares_library_init(int flags); |
|
|
| CARES_EXTERN int ares_library_init_mem(int flags, void *(*amalloc)(size_t size), |
| void (*afree)(void *ptr), |
| void *(*arealloc)(void *ptr, |
| size_t size)); |
|
|
| #if defined(ANDROID) || defined(__ANDROID__) |
| CARES_EXTERN void ares_library_init_jvm(JavaVM *jvm); |
| CARES_EXTERN int ares_library_init_android(jobject connectivity_manager); |
| CARES_EXTERN int ares_library_android_initialized(void); |
| #endif |
|
|
| #define CARES_HAVE_ARES_LIBRARY_INIT 1 |
| #define CARES_HAVE_ARES_LIBRARY_CLEANUP 1 |
|
|
| CARES_EXTERN int ares_library_initialized(void); |
|
|
| CARES_EXTERN void ares_library_cleanup(void); |
|
|
| CARES_EXTERN const char *ares_version(int *version); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_init_options) int ares_init( |
| ares_channel_t **channelptr); |
|
|
| CARES_EXTERN int ares_init_options(ares_channel_t **channelptr, |
| const struct ares_options *options, |
| int optmask); |
|
|
| CARES_EXTERN int ares_save_options(const ares_channel_t *channel, |
| struct ares_options *options, int *optmask); |
|
|
| CARES_EXTERN void ares_destroy_options(struct ares_options *options); |
|
|
| CARES_EXTERN int ares_dup(ares_channel_t **dest, const ares_channel_t *src); |
|
|
| CARES_EXTERN ares_status_t ares_reinit(ares_channel_t *channel); |
|
|
| CARES_EXTERN void ares_destroy(ares_channel_t *channel); |
|
|
| CARES_EXTERN void ares_cancel(ares_channel_t *channel); |
|
|
| |
| |
| |
| |
| CARES_EXTERN void ares_set_local_ip4(ares_channel_t *channel, |
| unsigned int local_ip); |
|
|
| |
| CARES_EXTERN void ares_set_local_ip6(ares_channel_t *channel, |
| const unsigned char *local_ip6); |
|
|
| |
| CARES_EXTERN void ares_set_local_dev(ares_channel_t *channel, |
| const char *local_dev_name); |
|
|
| CARES_EXTERN void ares_set_socket_callback(ares_channel_t *channel, |
| ares_sock_create_callback callback, |
| void *user_data); |
|
|
| CARES_EXTERN void ares_set_socket_configure_callback( |
| ares_channel_t *channel, ares_sock_config_callback callback, void *user_data); |
|
|
| CARES_EXTERN void |
| ares_set_server_state_callback(ares_channel_t *channel, |
| ares_server_state_callback callback, |
| void *user_data); |
|
|
| CARES_EXTERN void ares_set_pending_write_cb(ares_channel_t *channel, |
| ares_pending_write_cb callback, |
| void *user_data); |
|
|
| CARES_EXTERN void ares_process_pending_write(ares_channel_t *channel); |
|
|
| CARES_EXTERN int ares_set_sortlist(ares_channel_t *channel, |
| const char *sortstr); |
|
|
| CARES_EXTERN void ares_getaddrinfo(ares_channel_t *channel, const char *node, |
| const char *service, |
| const struct ares_addrinfo_hints *hints, |
| ares_addrinfo_callback callback, void *arg); |
|
|
| CARES_EXTERN void ares_freeaddrinfo(struct ares_addrinfo *ai); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| struct iovec; |
|
|
| struct ares_socket_functions { |
| ares_socket_t (*asocket)(int, int, int, void *); |
| int (*aclose)(ares_socket_t, void *); |
| int (*aconnect)(ares_socket_t, const struct sockaddr *, ares_socklen_t, |
| void *); |
| ares_ssize_t (*arecvfrom)(ares_socket_t, void *, size_t, int, |
| struct sockaddr *, ares_socklen_t *, void *); |
| ares_ssize_t (*asendv)(ares_socket_t, const struct iovec *, int, void *); |
| }; |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR( |
| ares_set_socket_functions_ex) void ares_set_socket_functions(ares_channel_t |
| *channel, |
| const struct |
| ares_socket_functions |
| *funcs, |
| void *user_data); |
|
|
| |
| typedef enum { |
| |
| |
| ARES_SOCKFUNC_FLAG_NONBLOCKING = 1 << 0 |
| } ares_sockfunc_flags_t; |
|
|
| |
| |
| typedef enum { |
| |
| ARES_SOCKET_OPT_SENDBUF_SIZE, |
| |
| ARES_SOCKET_OPT_RECVBUF_SIZE, |
| |
| |
| ARES_SOCKET_OPT_BIND_DEVICE, |
| |
| |
| |
| |
| |
| |
| ARES_SOCKET_OPT_TCP_FASTOPEN |
| } ares_socket_opt_t; |
|
|
| |
| typedef enum { |
| |
| ARES_SOCKET_CONN_TCP_FASTOPEN = 1 << 0 |
| } ares_socket_connect_flags_t; |
|
|
| |
| typedef enum { |
| |
| ARES_SOCKET_BIND_TCP = 1 << 0, |
| |
| ARES_SOCKET_BIND_CLIENT = 1 << 1 |
| } ares_socket_bind_flags_t; |
|
|
| |
| struct ares_socket_functions_ex { |
| |
| unsigned int version; |
|
|
| |
| |
| unsigned int flags; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| ares_socket_t (*asocket)(int domain, int type, int protocol, void *user_data); |
|
|
| |
| |
| |
| |
| |
| int (*aclose)(ares_socket_t sock, void *user_data); |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| int (*asetsockopt)(ares_socket_t sock, ares_socket_opt_t opt, const void *val, |
| ares_socklen_t val_size, void *user_data); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| int (*aconnect)(ares_socket_t sock, const struct sockaddr *address, |
| ares_socklen_t address_len, unsigned int flags, |
| void *user_data); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| ares_ssize_t (*arecvfrom)(ares_socket_t sock, void *buffer, size_t length, |
| int flags, struct sockaddr *address, |
| ares_socklen_t *address_len, void *user_data); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| ares_ssize_t (*asendto)(ares_socket_t sock, const void *buffer, size_t length, |
| int flags, const struct sockaddr *address, |
| ares_socklen_t address_len, void *user_data); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| int (*agetsockname)(ares_socket_t sock, struct sockaddr *address, |
| ares_socklen_t *address_len, void *user_data); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| int (*abind)(ares_socket_t sock, unsigned int flags, |
| const struct sockaddr *address, socklen_t address_len, |
| void *user_data); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| unsigned int (*aif_nametoindex)(const char *ifname, void *user_data); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| const char *(*aif_indextoname)(unsigned int ifindex, char *ifname_buf, |
| size_t ifname_buf_len, void *user_data); |
| }; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| CARES_EXTERN ares_status_t ares_set_socket_functions_ex( |
| ares_channel_t *channel, const struct ares_socket_functions_ex *funcs, |
| void *user_data); |
|
|
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_send_dnsrec) void ares_send( |
| ares_channel_t *channel, const unsigned char *qbuf, int qlen, |
| ares_callback callback, void *arg); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| CARES_EXTERN ares_status_t ares_send_dnsrec(ares_channel_t *channel, |
| const ares_dns_record_t *dnsrec, |
| ares_callback_dnsrec callback, |
| void *arg, unsigned short *qid); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_query_dnsrec) void ares_query( |
| ares_channel_t *channel, const char *name, int dnsclass, int type, |
| ares_callback callback, void *arg); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| CARES_EXTERN ares_status_t ares_query_dnsrec(ares_channel_t *channel, |
| const char *name, |
| ares_dns_class_t dnsclass, |
| ares_dns_rec_type_t type, |
| ares_callback_dnsrec callback, |
| void *arg, unsigned short *qid); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_search_dnsrec) void ares_search( |
| ares_channel_t *channel, const char *name, int dnsclass, int type, |
| ares_callback callback, void *arg); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| CARES_EXTERN ares_status_t ares_search_dnsrec(ares_channel_t *channel, |
| const ares_dns_record_t *dnsrec, |
| ares_callback_dnsrec callback, |
| void *arg); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_getaddrinfo) void ares_gethostbyname( |
| ares_channel_t *channel, const char *name, int family, |
| ares_host_callback callback, void *arg); |
|
|
| CARES_EXTERN int ares_gethostbyname_file(ares_channel_t *channel, |
| const char *name, int family, |
| struct hostent **host); |
|
|
| CARES_EXTERN void ares_gethostbyaddr(ares_channel_t *channel, const void *addr, |
| int addrlen, int family, |
| ares_host_callback callback, void *arg); |
|
|
| CARES_EXTERN void ares_getnameinfo(ares_channel_t *channel, |
| const struct sockaddr *sa, |
| ares_socklen_t salen, int flags, |
| ares_nameinfo_callback callback, void *arg); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR( |
| ARES_OPT_EVENT_THREAD or |
| ARES_OPT_SOCK_STATE_CB) int ares_fds(const ares_channel_t *channel, |
| fd_set *read_fds, fd_set *write_fds); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR( |
| ARES_OPT_EVENT_THREAD or |
| ARES_OPT_SOCK_STATE_CB) int ares_getsock(const ares_channel_t *channel, |
| ares_socket_t *socks, int numsocks); |
|
|
| CARES_EXTERN struct timeval *ares_timeout(const ares_channel_t *channel, |
| struct timeval *maxtv, |
| struct timeval *tv); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_process_fds) void ares_process( |
| ares_channel_t *channel, fd_set *read_fds, fd_set *write_fds); |
|
|
| |
| typedef enum { |
| ARES_FD_EVENT_NONE = 0, |
| ARES_FD_EVENT_READ = 1 << 0, |
| ARES_FD_EVENT_WRITE = 1 << 1 |
| } ares_fd_eventflag_t; |
|
|
| |
| |
| typedef struct { |
| ares_socket_t fd; |
| unsigned int events; |
| } ares_fd_events_t; |
|
|
| |
| typedef enum { |
| ARES_PROCESS_FLAG_NONE = 0, |
| ARES_PROCESS_FLAG_SKIP_NON_FD = 1 << 0 |
| |
| |
| } ares_process_flag_t; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| CARES_EXTERN ares_status_t ares_process_fds(ares_channel_t *channel, |
| const ares_fd_events_t *events, |
| size_t nevents, unsigned int flags); |
|
|
| CARES_EXTERN void ares_process_fd(ares_channel_t *channel, |
| ares_socket_t read_fd, |
| ares_socket_t write_fd); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_record_create) int ares_create_query( |
| const char *name, int dnsclass, int type, unsigned short id, int rd, |
| unsigned char **buf, int *buflen, int max_udp_size); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_record_create) int ares_mkquery( |
| const char *name, int dnsclass, int type, unsigned short id, int rd, |
| unsigned char **buf, int *buflen); |
|
|
| CARES_EXTERN int ares_expand_name(const unsigned char *encoded, |
| const unsigned char *abuf, int alen, char **s, |
| long *enclen); |
|
|
| CARES_EXTERN int ares_expand_string(const unsigned char *encoded, |
| const unsigned char *abuf, int alen, |
| unsigned char **s, long *enclen); |
|
|
| struct ares_addrttl { |
| struct in_addr ipaddr; |
| int ttl; |
| }; |
|
|
| struct ares_addr6ttl { |
| struct ares_in6_addr ip6addr; |
| int ttl; |
| }; |
|
|
| struct ares_caa_reply { |
| struct ares_caa_reply *next; |
| int critical; |
| unsigned char *property; |
| size_t plength; |
| unsigned char *value; |
| size_t length; |
| }; |
|
|
| struct ares_srv_reply { |
| struct ares_srv_reply *next; |
| char *host; |
| unsigned short priority; |
| unsigned short weight; |
| unsigned short port; |
| }; |
|
|
| struct ares_mx_reply { |
| struct ares_mx_reply *next; |
| char *host; |
| unsigned short priority; |
| }; |
|
|
| struct ares_txt_reply { |
| struct ares_txt_reply *next; |
| unsigned char *txt; |
| size_t length; |
| }; |
|
|
| |
| |
| struct ares_txt_ext { |
| struct ares_txt_ext *next; |
| unsigned char *txt; |
| size_t length; |
| |
| |
| unsigned char record_start; |
| }; |
|
|
| struct ares_naptr_reply { |
| struct ares_naptr_reply *next; |
| unsigned char *flags; |
| unsigned char *service; |
| unsigned char *regexp; |
| char *replacement; |
| unsigned short order; |
| unsigned short preference; |
| }; |
|
|
| struct ares_soa_reply { |
| char *nsname; |
| char *hostmaster; |
| unsigned int serial; |
| unsigned int refresh; |
| unsigned int retry; |
| unsigned int expire; |
| unsigned int minttl; |
| }; |
|
|
| struct ares_uri_reply { |
| struct ares_uri_reply *next; |
| unsigned short priority; |
| unsigned short weight; |
| char *uri; |
| int ttl; |
| }; |
|
|
| |
| |
| |
| struct ares_addrinfo_node { |
| int ai_ttl; |
| int ai_flags; |
| int ai_family; |
| int ai_socktype; |
| int ai_protocol; |
| ares_socklen_t ai_addrlen; |
| struct sockaddr *ai_addr; |
| struct ares_addrinfo_node *ai_next; |
| }; |
|
|
| |
| |
| |
| |
| |
| struct ares_addrinfo_cname { |
| int ttl; |
| char *alias; |
| char *name; |
| struct ares_addrinfo_cname *next; |
| }; |
|
|
| struct ares_addrinfo { |
| struct ares_addrinfo_cname *cnames; |
| struct ares_addrinfo_node *nodes; |
| char *name; |
| }; |
|
|
| struct ares_addrinfo_hints { |
| int ai_flags; |
| int ai_family; |
| int ai_socktype; |
| int ai_protocol; |
| }; |
|
|
| |
| |
| |
| |
| |
| |
| |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_a_reply( |
| const unsigned char *abuf, int alen, struct hostent **host, |
| struct ares_addrttl *addrttls, int *naddrttls); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_aaaa_reply( |
| const unsigned char *abuf, int alen, struct hostent **host, |
| struct ares_addr6ttl *addrttls, int *naddrttls); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_caa_reply( |
| const unsigned char *abuf, int alen, struct ares_caa_reply **caa_out); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_ptr_reply( |
| const unsigned char *abuf, int alen, const void *addr, int addrlen, |
| int family, struct hostent **host); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_ns_reply( |
| const unsigned char *abuf, int alen, struct hostent **host); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_srv_reply( |
| const unsigned char *abuf, int alen, struct ares_srv_reply **srv_out); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_mx_reply( |
| const unsigned char *abuf, int alen, struct ares_mx_reply **mx_out); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_txt_reply( |
| const unsigned char *abuf, int alen, struct ares_txt_reply **txt_out); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_txt_reply_ext( |
| const unsigned char *abuf, int alen, struct ares_txt_ext **txt_out); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_naptr_reply( |
| const unsigned char *abuf, int alen, struct ares_naptr_reply **naptr_out); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_soa_reply( |
| const unsigned char *abuf, int alen, struct ares_soa_reply **soa_out); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_uri_reply( |
| const unsigned char *abuf, int alen, struct ares_uri_reply **uri_out); |
|
|
| CARES_EXTERN void ares_free_string(void *str); |
|
|
| CARES_EXTERN void ares_free_hostent(struct hostent *host); |
|
|
| CARES_EXTERN void ares_free_data(void *dataptr); |
|
|
| CARES_EXTERN const char *ares_strerror(int code); |
|
|
| struct ares_addr_node { |
| struct ares_addr_node *next; |
| int family; |
|
|
| union { |
| struct in_addr addr4; |
| struct ares_in6_addr addr6; |
| } addr; |
| }; |
|
|
| struct ares_addr_port_node { |
| struct ares_addr_port_node *next; |
| int family; |
|
|
| union { |
| struct in_addr addr4; |
| struct ares_in6_addr addr6; |
| } addr; |
|
|
| int udp_port; |
| int tcp_port; |
| }; |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_set_servers_csv) int ares_set_servers( |
| ares_channel_t *channel, const struct ares_addr_node *servers); |
|
|
| CARES_EXTERN |
| CARES_DEPRECATED_FOR(ares_set_servers_ports_csv) |
| int ares_set_servers_ports(ares_channel_t *channel, |
| const struct ares_addr_port_node *servers); |
|
|
| |
| CARES_EXTERN int ares_set_servers_csv(ares_channel_t *channel, |
| const char *servers); |
| CARES_EXTERN int ares_set_servers_ports_csv(ares_channel_t *channel, |
| const char *servers); |
| CARES_EXTERN char *ares_get_servers_csv(const ares_channel_t *channel); |
|
|
| CARES_EXTERN CARES_DEPRECATED_FOR(ares_get_servers_csv) int ares_get_servers( |
| const ares_channel_t *channel, struct ares_addr_node **servers); |
|
|
| CARES_EXTERN |
| CARES_DEPRECATED_FOR(ares_get_servers_csv) |
| int ares_get_servers_ports(const ares_channel_t *channel, |
| struct ares_addr_port_node **servers); |
|
|
| CARES_EXTERN const char *ares_inet_ntop(int af, const void *src, char *dst, |
| ares_socklen_t size); |
|
|
| CARES_EXTERN int ares_inet_pton(int af, const char *src, void *dst); |
|
|
| |
| |
| |
| |
| CARES_EXTERN ares_bool_t ares_threadsafety(void); |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| CARES_EXTERN ares_status_t ares_queue_wait_empty(ares_channel_t *channel, |
| int timeout_ms); |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| CARES_EXTERN size_t ares_queue_active_queries(const ares_channel_t *channel); |
|
|
| #ifdef __cplusplus |
| } |
| #endif |
|
|
| #endif |
|
|