clang-format

pull/733/head
Brad House 11 months ago
parent b2139f6c79
commit 9f4c474a7c
  1. 170
      include/ares.h
  2. 17
      include/ares_dns_record.h
  3. 1
      src/lib/ares__hosts_file.c
  4. 8
      src/lib/ares_create_query.c
  5. 10
      src/lib/ares_dns_private.h
  6. 16
      src/lib/ares_dns_record.c
  7. 4
      src/lib/ares_dns_write.c
  8. 20
      src/lib/ares_getaddrinfo.c
  9. 3
      src/lib/ares_gethostbyaddr.c
  10. 4
      src/lib/ares_parse_ptr_reply.c
  11. 7
      src/lib/ares_private.h
  12. 3
      src/lib/ares_process.c
  13. 1
      src/lib/ares_qcache.c
  14. 17
      src/lib/ares_query.c
  15. 32
      src/lib/ares_search.c
  16. 9
      src/lib/ares_send.c
  17. 8
      src/lib/ares_update_servers.c

@ -120,9 +120,8 @@ extern "C" {
#endif
#ifdef __GNUC__
#define CARES_GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
# define CARES_GCC_VERSION \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#else
# define CARES_GCC_VERSION 0
#endif
@ -142,7 +141,8 @@ extern "C" {
# endif
# if CARES_GCC_VERSION >= 40500 || defined(__clang__)
#define CARES_DEPRECATED_FOR(f) __attribute__((deprecated("Use " #f " instead")))
# 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
@ -449,8 +449,8 @@ 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 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,
@ -526,9 +526,9 @@ CARES_EXTERN void
const struct ares_socket_functions *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 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.
@ -546,10 +546,9 @@ CARES_EXTERN ares_status_t ares_send_dnsrec(ares_channel_t *channel,
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 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.
*
@ -568,13 +567,11 @@ CARES_EXTERN ares_status_t ares_query_dnsrec(ares_channel_t *channel,
ares_dns_class_t dnsclass,
ares_dns_rec_type_t type,
ares_callback_dnsrec callback,
void *arg,
unsigned short *qid);
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 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.
*
@ -592,10 +589,9 @@ CARES_EXTERN ares_status_t ares_search_dnsrec(ares_channel_t *channel,
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 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,
@ -610,34 +606,34 @@ CARES_EXTERN void ares_getnameinfo(ares_channel_t *channel,
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(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 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 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 CARES_DEPRECATED_FOR(ares_process_fd)
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 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_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 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,
@ -772,58 +768,44 @@ struct ares_addrinfo_hints {
** so written.
*/
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_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_ns_reply(const unsigned char *abuf, int alen,
struct hostent **host);
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_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_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(
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_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_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_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 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);
@ -856,13 +838,12 @@ struct ares_addr_port_node {
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_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
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,
@ -871,13 +852,12 @@ 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 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_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
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);

@ -630,10 +630,8 @@ CARES_EXTERN ares_status_t ares_dns_record_query_add(ares_dns_record_t *dnsrec,
* \param[in] name Name to use as replacement.
* \return ARES_SUCCESS on success
*/
CARES_EXTERN ares_status_t
ares_dns_record_query_set_name(ares_dns_record_t *dnsrec,
size_t idx,
const char *name);
CARES_EXTERN ares_status_t ares_dns_record_query_set_name(
ares_dns_record_t *dnsrec, size_t idx, const char *name);
/*! Replace the question type with a different type. This may be used when
@ -644,10 +642,8 @@ CARES_EXTERN ares_status_t
* \param[in] qtype Record Type to use as replacement.
* \return ARES_SUCCESS on success
*/
CARES_EXTERN ares_status_t
ares_dns_record_query_set_type(ares_dns_record_t *dnsrec,
size_t idx,
ares_dns_rec_type_t qtype);
CARES_EXTERN ares_status_t ares_dns_record_query_set_type(
ares_dns_record_t *dnsrec, size_t idx, ares_dns_rec_type_t qtype);
/*! Get the count of queries in the DNS Record
*
@ -717,8 +713,9 @@ CARES_EXTERN ares_dns_rr_t *ares_dns_record_rr_get(ares_dns_record_t *dnsrec,
* \param[in] idx Index of resource record in section
* \return NULL on misuse, otherwise a const pointer to the resource record
*/
CARES_EXTERN const ares_dns_rr_t *ares_dns_record_rr_get_const(
const ares_dns_record_t *dnsrec, ares_dns_section_t sect, size_t idx);
CARES_EXTERN const ares_dns_rr_t *
ares_dns_record_rr_get_const(const ares_dns_record_t *dnsrec,
ares_dns_section_t sect, size_t idx);
/*! Remove the resource record based on the section and index

@ -98,7 +98,6 @@ struct ares_hosts_entry {
ares__llist_t *hosts;
};
const void *ares_dns_pton(const char *ipaddr, struct ares_addr *addr,
size_t *out_len)
{

@ -46,10 +46,9 @@ static int ares_create_query_int(const char *name, int dnsclass, int type,
*bufp = NULL;
*buflenp = 0;
status = ares_dns_record_create_query(&dnsrec, name,
(ares_dns_class_t)dnsclass,
(ares_dns_rec_type_t)type,
id, rd_flag, (size_t)max_udp_size);
status = ares_dns_record_create_query(
&dnsrec, name, (ares_dns_class_t)dnsclass, (ares_dns_rec_type_t)type, id,
rd_flag, (size_t)max_udp_size);
if (status != ARES_SUCCESS) {
goto done;
}
@ -79,4 +78,3 @@ int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
{
return ares_create_query_int(name, dnsclass, type, id, rd, buf, buflen, 0);
}

@ -61,13 +61,11 @@ void ares_dns_record_write_ttl_decrement(ares_dns_record_t *dnsrec,
* \param[in] max_udp_size Maximum size of a UDP packet for EDNS.
* \return ARES_SUCCESS on success, otherwise an error code.
*/
ares_status_t ares_dns_record_create_query(ares_dns_record_t **dnsrec,
const char *name,
ares_status_t
ares_dns_record_create_query(ares_dns_record_t **dnsrec, const char *name,
ares_dns_class_t dnsclass,
ares_dns_rec_type_t type,
unsigned short id,
ares_dns_flags_t flags,
size_t max_udp_size);
ares_dns_rec_type_t type, unsigned short id,
ares_dns_flags_t flags, size_t max_udp_size);
/*! Convert the RCODE and ANCOUNT from a DNS query reply into a status code.
*

@ -277,8 +277,7 @@ ares_status_t ares_dns_record_query_add(ares_dns_record_t *dnsrec,
}
ares_status_t ares_dns_record_query_set_name(ares_dns_record_t *dnsrec,
size_t idx,
const char *name)
size_t idx, const char *name)
{
char *orig_name = NULL;
@ -1352,13 +1351,11 @@ ares_bool_t ares_dns_has_opt_rr(const ares_dns_record_t *rec)
/* Construct a DNS record for a name with given class and type. Used internally
* by ares_search() and ares_create_query().
*/
ares_status_t ares_dns_record_create_query(ares_dns_record_t **dnsrec,
const char *name,
ares_status_t
ares_dns_record_create_query(ares_dns_record_t **dnsrec, const char *name,
ares_dns_class_t dnsclass,
ares_dns_rec_type_t type,
unsigned short id,
ares_dns_flags_t flags,
size_t max_udp_size)
ares_dns_rec_type_t type, unsigned short id,
ares_dns_flags_t flags, size_t max_udp_size)
{
ares_status_t status;
ares_dns_rr_t *rr = NULL;
@ -1434,8 +1431,9 @@ ares_dns_record_t *ares_dns_record_duplicate(const ares_dns_record_t *dnsrec)
ares_dns_record_t *out = NULL;
ares_status_t status;
if (dnsrec == NULL)
if (dnsrec == NULL) {
return NULL;
}
status = ares_dns_write(dnsrec, &data, &data_len);
if (status != ARES_SUCCESS) {

@ -989,8 +989,7 @@ static ares_status_t ares_dns_write_rr(const ares_dns_record_t *dnsrec,
}
ares_status_t ares_dns_write(const ares_dns_record_t *dnsrec,
unsigned char **buf,
size_t *buf_len)
unsigned char **buf, size_t *buf_len)
{
ares__buf_t *b = NULL;
ares_status_t status;
@ -1053,4 +1052,3 @@ void ares_dns_record_write_ttl_decrement(ares_dns_record_t *dnsrec,
}
dnsrec->ttl_decrement = ttl_decrement;
}

@ -499,8 +499,8 @@ static void host_callback(void *arg, ares_status_t status, size_t timeouts,
if (dnsrec == NULL) {
addinfostatus = ARES_EBADRESP;
} else {
addinfostatus = ares__parse_into_addrinfo(dnsrec, ARES_TRUE,
hquery->port, hquery->ai);
addinfostatus =
ares__parse_into_addrinfo(dnsrec, ARES_TRUE, hquery->port, hquery->ai);
}
if (addinfostatus == ARES_SUCCESS) {
terminate_retries(hquery, ares_dns_record_get_id(dnsrec));
@ -530,8 +530,7 @@ static void host_callback(void *arg, ares_status_t status, size_t timeouts,
if (status == ARES_ENODATA || addinfostatus == ARES_ENODATA) {
hquery->nodata_cnt++;
}
next_lookup(hquery,
hquery->nodata_cnt ? ARES_ENODATA : status);
next_lookup(hquery, hquery->nodata_cnt ? ARES_ENODATA : status);
} else {
end_hquery(hquery, status);
}
@ -626,7 +625,8 @@ static void ares_getaddrinfo_int(ares_channel_t *channel, const char *name,
return;
}
status = ares__search_name_list(channel, name, &hquery->names, &hquery->names_cnt);
status =
ares__search_name_list(channel, name, &hquery->names, &hquery->names_cnt);
if (status != ARES_SUCCESS) {
hquery_free(hquery, ARES_TRUE);
callback(arg, (int)status, 0, NULL);
@ -675,9 +675,8 @@ static ares_bool_t next_dns_lookup(struct host_query *hquery)
switch (hquery->hints.ai_family) {
case AF_INET:
hquery->remaining += 1;
ares_query_dnsrec(hquery->channel, name, ARES_CLASS_IN,
ARES_REC_TYPE_A, host_callback, hquery,
&hquery->qid_a);
ares_query_dnsrec(hquery->channel, name, ARES_CLASS_IN, ARES_REC_TYPE_A,
host_callback, hquery, &hquery->qid_a);
break;
case AF_INET6:
hquery->remaining += 1;
@ -687,9 +686,8 @@ static ares_bool_t next_dns_lookup(struct host_query *hquery)
break;
case AF_UNSPEC:
hquery->remaining += 2;
ares_query_dnsrec(hquery->channel, name, ARES_CLASS_IN,
ARES_REC_TYPE_A, host_callback, hquery,
&hquery->qid_a);
ares_query_dnsrec(hquery->channel, name, ARES_CLASS_IN, ARES_REC_TYPE_A,
host_callback, hquery, &hquery->qid_a);
ares_query_dnsrec(hquery->channel, name, ARES_CLASS_IN,
ARES_REC_TYPE_AAAA, host_callback, hquery,
&hquery->qid_aaaa);

@ -60,8 +60,7 @@ struct addr_query {
};
static void next_lookup(struct addr_query *aquery);
static void addr_callback(void *arg, ares_status_t status,
size_t timeouts,
static void addr_callback(void *arg, ares_status_t status, size_t timeouts,
const ares_dns_record_t *dnsrec);
static void end_aquery(struct addr_query *aquery, ares_status_t status,
struct hostent *host);

@ -38,8 +38,7 @@
ares_status_t ares_parse_ptr_reply_dnsrec(const ares_dns_record_t *dnsrec,
const void *addr, int addrlen,
int family,
struct hostent **host)
int family, struct hostent **host)
{
ares_status_t status;
size_t ptrcount = 0;
@ -186,7 +185,6 @@ done:
return status;
}
int ares_parse_ptr_reply(const unsigned char *abuf, int alen_int,
const void *addr, int addrlen, int family,
struct hostent **host)

@ -347,8 +347,8 @@ ares_status_t ares__requeue_query(struct query *query, struct timeval *now);
* \return ARES_SUCCESS on success, otherwise one of the other error codes.
*/
ares_status_t ares__search_name_list(const ares_channel_t *channel,
const char *name,
char ***names, size_t *names_len);
const char *name, char ***names,
size_t *names_len);
/*! Function to create callback arg for converting from ares_callback_dnsrec
* to ares_calback */
@ -453,8 +453,7 @@ ares_status_t ares__parse_into_addrinfo(const ares_dns_record_t *dnsrec,
struct ares_addrinfo *ai);
ares_status_t ares_parse_ptr_reply_dnsrec(const ares_dns_record_t *dnsrec,
const void *addr, int addrlen,
int family,
struct hostent **host);
int family, struct hostent **host);
ares_status_t ares__addrinfo2hostent(const struct ares_addrinfo *ai, int family,
struct hostent **host);

@ -68,8 +68,7 @@ static ares_bool_t same_questions(const ares_dns_record_t *qrec,
static ares_bool_t same_address(const struct sockaddr *sa,
const struct ares_addr *aa);
static void end_query(ares_channel_t *channel, struct query *query,
ares_status_t status,
const ares_dns_record_t *dnsrec);
ares_status_t status, const ares_dns_record_t *dnsrec);
static void server_increment_failures(struct server_state *server)
{

@ -442,4 +442,3 @@ ares_status_t ares_qcache_insert(ares_channel_t *channel,
return ares__qcache_insert(channel->qcache, dnsrec, query->qbuf, query->qlen,
now);
}

@ -67,8 +67,8 @@ static void ares_query_dnsrec_cb(void *arg, ares_status_t status,
static ares_status_t ares_query_int(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)
ares_callback_dnsrec callback, void *arg,
unsigned short *qid)
{
ares_status_t status;
ares_dns_record_t *dnsrec = NULL;
@ -87,10 +87,8 @@ static ares_status_t ares_query_int(ares_channel_t *channel, const char *name,
flags |= ARES_FLAG_RD;
}
status = ares_dns_record_create_query(&dnsrec, name,
dnsclass,
type,
0, flags,
status = ares_dns_record_create_query(
&dnsrec, name, dnsclass, type, 0, flags,
(size_t)(channel->flags & ARES_FLAG_EDNS) ? channel->ednspsz : 0);
if (status != ARES_SUCCESS) {
callback(arg, status, 0, NULL);
@ -118,8 +116,8 @@ static ares_status_t ares_query_int(ares_channel_t *channel, const char *name,
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)
ares_callback_dnsrec callback, void *arg,
unsigned short *qid)
{
ares_status_t status;
@ -133,7 +131,6 @@ ares_status_t ares_query_dnsrec(ares_channel_t *channel, const char *name,
return status;
}
void ares_query(ares_channel_t *channel, const char *name, int dnsclass,
int type, ares_callback callback, void *arg)
{
@ -153,5 +150,3 @@ void ares_query(ares_channel_t *channel, const char *name, int dnsclass,
(ares_dns_rec_type_t)type, ares__dnsrec_convert_cb, carg,
NULL);
}

@ -56,8 +56,9 @@ struct search_query {
static void squery_free(struct search_query *squery)
{
if (squery == NULL)
if (squery == NULL) {
return;
}
ares__strsplit_free(squery->names, squery->names_cnt);
ares_dns_record_destroy(squery->dnsrec);
ares_free(squery);
@ -89,15 +90,14 @@ static ares_status_t ares_search_next(ares_channel_t *channel,
return ARES_EFORMERR;
}
status =
ares_dns_record_query_set_name(squery->dnsrec, 0,
squery->names[squery->next_name_idx++]);
status = ares_dns_record_query_set_name(
squery->dnsrec, 0, squery->names[squery->next_name_idx++]);
if (status != ARES_SUCCESS) {
return status;
}
status = ares_send_dnsrec(channel, squery->dnsrec, search_callback, squery,
NULL);
status =
ares_send_dnsrec(channel, squery->dnsrec, search_callback, squery, NULL);
if (status != ARES_EFORMERR) {
*skip_cleanup = ARES_TRUE;
@ -180,10 +180,9 @@ static ares_bool_t ares__search_eligible(const ares_channel_t *channel,
return ARES_TRUE;
}
ares_status_t ares__search_name_list(const ares_channel_t *channel,
const char *name,
char ***names, size_t *names_len)
const char *name, char ***names,
size_t *names_len)
{
ares_status_t status;
char **list = NULL;
@ -337,8 +336,8 @@ static ares_status_t ares_search_int(ares_channel_t *channel,
squery->timeouts = 0;
squery->ever_got_nodata = ARES_FALSE;
status = ares__search_name_list(channel, name, &squery->names,
&squery->names_cnt);
status =
ares__search_name_list(channel, name, &squery->names, &squery->names_cnt);
if (status != ARES_SUCCESS) {
goto fail;
}
@ -369,8 +368,9 @@ typedef struct {
void *ares__dnsrec_convert_arg(ares_callback callback, void *arg)
{
dnsrec_convert_arg_t *carg = ares_malloc_zero(sizeof(*carg));
if (carg == NULL)
if (carg == NULL) {
return NULL;
}
carg->callback = callback;
carg->arg = arg;
return carg;
@ -428,10 +428,9 @@ void ares_search(ares_channel_t *channel, const char *name, int dnsclass,
rd_flag = !(channel->flags & ARES_FLAG_NORECURSE) ? ARES_FLAG_RD : 0;
max_udp_size = (channel->flags & ARES_FLAG_EDNS) ? channel->ednspsz : 0;
status = ares_dns_record_create_query(&dnsrec, name,
(ares_dns_class_t)dnsclass,
(ares_dns_rec_type_t)type,
0, rd_flag, max_udp_size);
status = ares_dns_record_create_query(
&dnsrec, name, (ares_dns_class_t)dnsclass, (ares_dns_rec_type_t)type, 0,
rd_flag, max_udp_size);
if (status != ARES_SUCCESS) {
callback(arg, (int)status, 0, NULL, 0);
ares_free(carg);
@ -463,7 +462,6 @@ ares_status_t ares_search_dnsrec(ares_channel_t *channel,
return status;
}
/* Concatenate two domains. */
ares_status_t ares__cat_domain(const char *name, const char *domain, char **s)
{

@ -107,7 +107,8 @@ static ares_status_t ares_send_dnsrec_int(ares_channel_t *channel,
query->try_count = 0;
packetsz = (channel->flags & ARES_FLAG_EDNS) ? channel->ednspsz : PACKETSZ;
query->using_tcp = (channel->flags & ARES_FLAG_USEVC) || query->qlen > packetsz;
query->using_tcp =
(channel->flags & ARES_FLAG_USEVC) || query->qlen > packetsz;
query->error_status = ARES_SUCCESS;
query->timeouts = 0;
@ -143,11 +144,10 @@ static ares_status_t ares_send_dnsrec_int(ares_channel_t *channel,
return status;
}
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)
ares_callback_dnsrec callback, void *arg,
unsigned short *qid)
{
ares_status_t status;
@ -164,7 +164,6 @@ ares_status_t ares_send_dnsrec(ares_channel_t *channel,
return status;
}
void ares_send(ares_channel_t *channel, const unsigned char *qbuf, int qlen,
ares_callback callback, void *arg)
{

@ -266,8 +266,8 @@ static ares_status_t parse_nameserver(ares__buf_t *buf, ares_sconfig_t *sconfig)
} else {
/* IPv6 */
const unsigned char ipv6_charset[] = "ABCDEFabcdef0123456789.:";
if (ares__buf_consume_charset(buf, ipv6_charset, sizeof(ipv6_charset)-1)
== 0) {
if (ares__buf_consume_charset(buf, ipv6_charset,
sizeof(ipv6_charset) - 1) == 0) {
return ARES_EBADSTR;
}
}
@ -318,8 +318,8 @@ static ares_status_t parse_nameserver(ares__buf_t *buf, ares_sconfig_t *sconfig)
ares__buf_tag(buf);
if (ares__buf_consume_charset(buf, iface_charset, sizeof(iface_charset)-1)
== 0) {
if (ares__buf_consume_charset(buf, iface_charset,
sizeof(iface_charset) - 1) == 0) {
return ARES_EBADSTR;
}

Loading…
Cancel
Save