@ -119,6 +119,37 @@ extern "C" {
# 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 ,
@ -418,7 +449,8 @@ CARES_EXTERN void ares_library_cleanup(void);
CARES_EXTERN const char * ares_version ( int * version ) ;
CARES_EXTERN int ares_init ( ares_channel_t * * channelptr ) ;
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 ,
@ -494,8 +526,9 @@ CARES_EXTERN void
const struct ares_socket_functions * funcs ,
void * user_data ) ;
CARES_EXTERN void ares_send ( ares_channel_t * channel , const unsigned char * qbuf ,
int qlen , ares_callback callback , void * arg ) ;
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 ) ;
/*! Send a DNS query as an ares_dns_record_t with a callback containing the
* parsed DNS record .
@ -513,9 +546,10 @@ CARES_EXTERN ares_status_t ares_send_dnsrec(ares_channel_t *channel,
ares_callback_dnsrec callback ,
void * arg , unsigned short * qid ) ;
CARES_EXTERN void ares_query ( ares_channel_t * channel , const char * name ,
int dnsclass , int type , ares_callback callback ,
void * arg ) ;
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 ) ;
/*! Perform a DNS query with a callback containing the parsed DNS record.
*
@ -537,9 +571,10 @@ CARES_EXTERN ares_status_t ares_query_dnsrec(ares_channel_t *channel,
void * arg ,
unsigned short * qid ) ;
CARES_EXTERN void ares_search ( ares_channel_t * channel , const char * name ,
int dnsclass , int type , ares_callback callback ,
void * arg ) ;
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 ) ;
/*! Search for a complete DNS message.
*
@ -557,9 +592,10 @@ CARES_EXTERN ares_status_t ares_search_dnsrec(ares_channel_t *channel,
ares_callback_dnsrec callback ,
void * arg ) ;
CARES_EXTERN void ares_gethostbyname ( ares_channel_t * channel , const char * name ,
int family , ares_host_callback 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 ,
@ -574,31 +610,34 @@ CARES_EXTERN void ares_getnameinfo(ares_channel_t *channel,
ares_socklen_t salen , int flags ,
ares_nameinfo_callback callback , void * arg ) ;
CARES_EXTERN int ares_fds ( 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_fds ( ares_channel_t * channel , fd_set * read_fds , fd_set * write_fds ) ;
CARES_EXTERN int ares_getsock ( ares_channel_t * channel , ares_socket_t * socks ,
int numsocks ) ;
CARES_EXTERN CARES_DEPRECATED_FOR ( ARES_OPT_EVENT_THREAD or ARES_OPT_SOCK_STATE_CB )
int ares_getsock ( ares_channel_t * channel , ares_socket_t * socks , int numsocks ) ;
CARES_EXTERN struct timeval * ares_timeout ( ares_channel_t * channel ,
struct timeval * maxtv ,
struct timeval * tv ) ;
CARES_EXTERN void ares_process ( ares_channel_t * channel , fd_set * read_fds ,
fd_set * write_fds ) ;
CARES_EXTERN CARES_DEPRECATED_FOR ( ares_process_fd )
void ares_process ( ares_channel_t * channel , fd_set * read_fds ,
fd_set * write_fds ) ;
CARES_EXTERN void ares_process_fd ( ares_channel_t * channel ,
ares_socket_t read_fd ,
ares_socket_t write_fd ) ;
CARES_EXTERN 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_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 int ares_mkquery ( const char * name , int dnsclass , int type ,
unsigned short id , int rd , unsigned char * * buf ,
int * buflen ) ;
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 ,
@ -733,46 +772,58 @@ struct ares_addrinfo_hints {
* * so written .
*/
CARES_EXTERN 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_a_reply ( const unsigned char * abuf , int alen ,
struct hostent * * host ,
struct ares_addrttl * addrttls ,
int * naddrttls ) ;
CARES_EXTERN 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_aaaa_reply ( const unsigned char * abuf , int alen ,
struct hostent * * host ,
struct ares_addr6ttl * addrttls ,
int * naddrttls ) ;
CARES_EXTERN 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_caa_reply ( const unsigned char * abuf , int alen ,
struct ares_caa_reply * * caa_out ) ;
CARES_EXTERN 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_ptr_reply ( const unsigned char * abuf , int alen ,
const void * addr , int addrlen , int family ,
struct hostent * * host ) ;
CARES_EXTERN 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_ns_reply ( const unsigned char * abuf , int alen ,
struct hostent * * host ) ;
CARES_EXTERN 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_srv_reply ( const unsigned char * abuf , int alen ,
struct ares_srv_reply * * srv_out ) ;
CARES_EXTERN 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_mx_reply ( const unsigned char * abuf , int alen ,
struct ares_mx_reply * * mx_out ) ;
CARES_EXTERN 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 ( const unsigned char * abuf , int alen ,
struct ares_txt_reply * * txt_out ) ;
CARES_EXTERN 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_txt_reply_ext ( const unsigned char * abuf , int alen ,
struct ares_txt_ext * * txt_out ) ;
CARES_EXTERN 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_naptr_reply ( const unsigned char * abuf , int alen ,
struct ares_naptr_reply * * naptr_out ) ;
CARES_EXTERN 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_soa_reply ( const unsigned char * abuf , int alen ,
struct ares_soa_reply * * soa_out ) ;
CARES_EXTERN int ares_parse_uri_reply ( const unsigned char * abuf , int alen ,
struct ares_uri_reply * * uri_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 ) ;
@ -805,11 +856,13 @@ struct ares_addr_port_node {
int tcp_port ;
} ;
CARES_EXTERN int ares_set_servers ( ares_channel_t * channel ,
const struct ares_addr_node * servers ) ;
CARES_EXTERN int
ares_set_servers_ports ( ares_channel_t * channel ,
const struct ares_addr_port_node * servers ) ;
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 ) ;
/* Incoming string format: host[:port][,host[:port]]... */
CARES_EXTERN int ares_set_servers_csv ( ares_channel_t * channel ,
@ -818,10 +871,13 @@ CARES_EXTERN int ares_set_servers_ports_csv(ares_channel_t *channel,
const char * servers ) ;
CARES_EXTERN char * ares_get_servers_csv ( ares_channel_t * channel ) ;
CARES_EXTERN int ares_get_servers ( ares_channel_t * channel ,
struct ares_addr_node * * servers ) ;
CARES_EXTERN int ares_get_servers_ports ( ares_channel_t * channel ,
struct ares_addr_port_node * * servers ) ;
CARES_EXTERN CARES_DEPRECATED_FOR ( ares_get_servers_csv )
int ares_get_servers ( ares_channel_t * channel ,
struct ares_addr_node * * servers ) ;
CARES_EXTERN CARES_DEPRECATED_FOR ( ares_get_servers_ports_csv )
int ares_get_servers_ports ( 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 ) ;