deps: sync with upstream bagder/c-ares@bba4dc5
Fixes: https://github.com/iojs/io.js/issues/1676 PR-URL: https://github.com/iojs/io.js/pull/1678 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
Родитель
36cdc7c8ac
Коммит
7e1c0e75ed
|
@ -26,7 +26,6 @@
|
|||
'direct_dependent_settings': {
|
||||
'include_dirs': [ 'include' ]
|
||||
},
|
||||
'defines': [ 'HAVE_CONFIG_H' ],
|
||||
'sources': [
|
||||
'common.gypi',
|
||||
'include/ares.h',
|
||||
|
@ -96,7 +95,6 @@
|
|||
'src/inet_ntop.c',
|
||||
'src/ares_inet_net_pton.h',
|
||||
'src/setup_once.h',
|
||||
'src/windows_port.c'
|
||||
],
|
||||
'conditions': [
|
||||
[ 'library=="static_library"', {
|
||||
|
@ -107,7 +105,7 @@
|
|||
[ 'OS=="win"', {
|
||||
'include_dirs': [ 'config/win32' ],
|
||||
'sources': [
|
||||
'config/win32/ares_config.h',
|
||||
'src/config-win32.h',
|
||||
'src/windows_port.c',
|
||||
'src/ares_getenv.c',
|
||||
'src/ares_iphlpapi.h',
|
||||
|
@ -126,6 +124,7 @@
|
|||
'-Wextra',
|
||||
'-Wno-unused-parameter'
|
||||
],
|
||||
'defines': [ 'HAVE_CONFIG_H' ],
|
||||
}],
|
||||
[ 'OS not in "win android"', {
|
||||
'cflags': [
|
||||
|
|
|
@ -29,55 +29,8 @@
|
|||
# define WIN32
|
||||
#endif
|
||||
|
||||
/*************************** libuv patch ***************/
|
||||
|
||||
/*
|
||||
* We want to avoid autoconf altogether since there are a finite number of
|
||||
* operating systems and simply build c-ares. Therefore we do not want the
|
||||
* configurations provided by ares_build.h since we are always statically
|
||||
* linking c-ares into libuv. Having a system dependent ares_build.h forces
|
||||
* all users of ares.h to include the correct ares_build.h. We do not care
|
||||
* about the linking checks provided by ares_rules.h. This would complicate
|
||||
* the libuv build process.
|
||||
*/
|
||||
|
||||
|
||||
#if defined(WIN32)
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file ws2tcpip.h must be included by the external interface. */
|
||||
/* #undef CARES_PULL_WS2TCPIP_H */
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
# include <windows.h>
|
||||
|
||||
#else /* Not Windows */
|
||||
|
||||
# include <sys/time.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#define CARES_SIZEOF_LONG 4
|
||||
#endif
|
||||
|
||||
/* Integral data type used for ares_socklen_t. */
|
||||
#define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
|
||||
|
||||
#if 0
|
||||
/* The size of `ares_socklen_t', as computed by sizeof. */
|
||||
#define CARES_SIZEOF_ARES_SOCKLEN_T 4
|
||||
#endif
|
||||
|
||||
/* Data type definition of ares_socklen_t. */
|
||||
typedef int ares_socklen_t;
|
||||
|
||||
#if 0 /* libuv disabled */
|
||||
#include "ares_rules.h" /* c-ares rules enforcement */
|
||||
#endif
|
||||
|
||||
/*********************** end libuv patch ***************/
|
||||
typedef unsigned ares_socklen_t;
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
@ -520,8 +473,6 @@ struct ares_txt_reply {
|
|||
struct ares_txt_reply *next;
|
||||
unsigned char *txt;
|
||||
size_t length; /* length excludes null termination */
|
||||
unsigned char record_start; /* 1 - if start of new record
|
||||
* 0 - if a chunk in the same record */
|
||||
};
|
||||
|
||||
struct ares_naptr_reply {
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
#define ARES_VERSION_MAJOR 1
|
||||
#define ARES_VERSION_MINOR 10
|
||||
#define ARES_VERSION_PATCH 0
|
||||
#define ARES_VERSION_PATCH 1
|
||||
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
|
||||
(ARES_VERSION_MINOR<<8)|\
|
||||
(ARES_VERSION_PATCH))
|
||||
#define ARES_VERSION_STR "1.10.0-DEV"
|
||||
#define ARES_VERSION_STR "1.10.1-DEV"
|
||||
|
||||
#if (ARES_VERSION >= 0x010700)
|
||||
# define CARES_HAVE_ARES_LIBRARY_INIT 1
|
||||
|
|
|
@ -61,7 +61,10 @@ int ares__read_line(FILE *fp, char **buf, size_t *bufsize)
|
|||
/* Allocate more space. */
|
||||
newbuf = realloc(*buf, *bufsize * 2);
|
||||
if (!newbuf)
|
||||
return ARES_ENOMEM;
|
||||
{
|
||||
free(*buf);
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
*buf = newbuf;
|
||||
*bufsize *= 2;
|
||||
}
|
||||
|
|
|
@ -188,8 +188,9 @@ static void host_callback(void *arg, int status, int timeouts,
|
|||
else if (hquery->sent_family == AF_INET6)
|
||||
{
|
||||
status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL);
|
||||
if ((status == ARES_ENODATA || status == ARES_EBADRESP) &&
|
||||
hquery->want_family == AF_UNSPEC) {
|
||||
if ((status == ARES_ENODATA || status == ARES_EBADRESP ||
|
||||
(status == ARES_SUCCESS && host && host->h_addr_list[0] == NULL)) &&
|
||||
hquery->want_family == AF_UNSPEC) {
|
||||
/* The query returned something but either there were no AAAA
|
||||
records (e.g. just CNAME) or the response was malformed. Try
|
||||
looking up A instead. */
|
||||
|
|
|
@ -281,6 +281,8 @@ static char *lookup_service(unsigned short port, int flags,
|
|||
struct servent se;
|
||||
#endif
|
||||
char tmpbuf[4096];
|
||||
char *name;
|
||||
size_t name_len;
|
||||
|
||||
if (port)
|
||||
{
|
||||
|
@ -323,14 +325,20 @@ static char *lookup_service(unsigned short port, int flags,
|
|||
#endif
|
||||
}
|
||||
if (sep && sep->s_name)
|
||||
/* get service name */
|
||||
strcpy(tmpbuf, sep->s_name);
|
||||
{
|
||||
/* get service name */
|
||||
name = sep->s_name;
|
||||
}
|
||||
else
|
||||
/* get port as a string */
|
||||
sprintf(tmpbuf, "%u", (unsigned int)ntohs(port));
|
||||
if (strlen(tmpbuf) < buflen)
|
||||
{
|
||||
/* get port as a string */
|
||||
sprintf(tmpbuf, "%u", (unsigned int)ntohs(port));
|
||||
name = tmpbuf;
|
||||
}
|
||||
name_len = strlen(name);
|
||||
if (name_len < buflen)
|
||||
/* return it if buffer big enough */
|
||||
strcpy(buf, tmpbuf);
|
||||
memcpy(buf, name, name_len + 1);
|
||||
else
|
||||
/* avoid reusing previous one */
|
||||
buf[0] = '\0';
|
||||
|
|
|
@ -30,9 +30,7 @@ int ares_getsock(ares_channel channel,
|
|||
/* Are there any active queries? */
|
||||
int active_queries = !ares__is_list_empty(&(channel->all_queries));
|
||||
|
||||
for (i = 0;
|
||||
(i < channel->nservers) && (sockindex < ARES_GETSOCK_MAXNUM);
|
||||
i++)
|
||||
for (i = 0; i < channel->nservers; i++)
|
||||
{
|
||||
server = &channel->servers[i];
|
||||
/* We only need to register interest in UDP sockets if we have
|
||||
|
@ -40,7 +38,7 @@ int ares_getsock(ares_channel channel,
|
|||
*/
|
||||
if (active_queries && server->udp_socket != ARES_SOCKET_BAD)
|
||||
{
|
||||
if(sockindex >= numsocks)
|
||||
if(sockindex >= numsocks || sockindex >= ARES_GETSOCK_MAXNUM)
|
||||
break;
|
||||
socks[sockindex] = server->udp_socket;
|
||||
bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex);
|
||||
|
@ -52,7 +50,7 @@ int ares_getsock(ares_channel channel,
|
|||
*/
|
||||
if (server->tcp_socket != ARES_SOCKET_BAD)
|
||||
{
|
||||
if(sockindex >= numsocks)
|
||||
if(sockindex >= numsocks || sockindex >= ARES_GETSOCK_MAXNUM)
|
||||
break;
|
||||
socks[sockindex] = server->tcp_socket;
|
||||
bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex);
|
||||
|
|
|
@ -266,7 +266,10 @@ int ares_dup(ares_channel *dest, ares_channel src)
|
|||
which is most of them */
|
||||
rc = ares_save_options(src, &opts, &optmask);
|
||||
if(rc)
|
||||
{
|
||||
ares_destroy_options(&opts);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Then create the new channel with those options */
|
||||
rc = ares_init_options(dest, &opts, optmask);
|
||||
|
@ -1158,20 +1161,24 @@ static int init_by_resolv_conf(ares_channel channel)
|
|||
FILE *fp;
|
||||
size_t linesize;
|
||||
int error;
|
||||
int update_domains;
|
||||
|
||||
/* Don't read resolv.conf and friends if we don't have to */
|
||||
if (ARES_CONFIG_CHECK(channel))
|
||||
return ARES_SUCCESS;
|
||||
|
||||
/* Only update search domains if they're not already specified */
|
||||
update_domains = (channel->ndomains == -1);
|
||||
|
||||
fp = fopen(PATH_RESOLV_CONF, "r");
|
||||
if (fp) {
|
||||
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
|
||||
{
|
||||
if ((p = try_config(line, "domain", ';')))
|
||||
if ((p = try_config(line, "domain", ';')) && update_domains)
|
||||
status = config_domain(channel, p);
|
||||
else if ((p = try_config(line, "lookup", ';')) && !channel->lookups)
|
||||
status = config_lookup(channel, p, "bind", "file");
|
||||
else if ((p = try_config(line, "search", ';')))
|
||||
else if ((p = try_config(line, "search", ';')) && update_domains)
|
||||
status = set_search(channel, p);
|
||||
else if ((p = try_config(line, "nameserver", ';')) &&
|
||||
channel->nservers == -1)
|
||||
|
@ -1410,7 +1417,7 @@ static int init_by_defaults(ares_channel channel)
|
|||
goto error;
|
||||
}
|
||||
|
||||
} WHILE_FALSE;
|
||||
} while (res != 0);
|
||||
|
||||
dot = strchr(hostname, '.');
|
||||
if (dot) {
|
||||
|
|
|
@ -71,7 +71,7 @@ struct addrinfo
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/* Defined in ares_net_pton.c for no particular reason. */
|
||||
/* Defined in inet_net_pton.c for no particular reason. */
|
||||
extern const struct ares_in6_addr ares_in6addr_any; /* :: */
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ static int ares_win32_init(void)
|
|||
#ifdef USE_WINSOCK
|
||||
|
||||
hnd_iphlpapi = 0;
|
||||
hnd_iphlpapi = LoadLibraryW(L"iphlpapi.dll");
|
||||
hnd_iphlpapi = LoadLibrary("iphlpapi.dll");
|
||||
if (!hnd_iphlpapi)
|
||||
return ARES_ELOADIPHLPAPI;
|
||||
|
||||
|
@ -73,7 +73,7 @@ static int ares_win32_init(void)
|
|||
*/
|
||||
|
||||
hnd_advapi32 = 0;
|
||||
hnd_advapi32 = LoadLibraryW(L"advapi32.dll");
|
||||
hnd_advapi32 = LoadLibrary("advapi32.dll");
|
||||
if (hnd_advapi32)
|
||||
{
|
||||
ares_fpSystemFunction036 = (fpSystemFunction036_t)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
/* Copyright (C) 2010-2012 by Daniel Stenberg
|
||||
/* Copyright (C) 2010-2013 by Daniel Stenberg
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
|
@ -21,6 +21,10 @@
|
|||
# include <assert.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#if defined(__INTEL_COMPILER) && defined(__unix__)
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
|
@ -36,13 +40,43 @@
|
|||
|
||||
#include "ares_nowarn.h"
|
||||
|
||||
#define CARES_MASK_USHORT (~(unsigned short) 0)
|
||||
#define CARES_MASK_UINT (~(unsigned int) 0)
|
||||
#define CARES_MASK_ULONG (~(unsigned long) 0)
|
||||
#if (SIZEOF_SHORT == 2)
|
||||
# define CARES_MASK_SSHORT 0x7FFF
|
||||
# define CARES_MASK_USHORT 0xFFFF
|
||||
#elif (SIZEOF_SHORT == 4)
|
||||
# define CARES_MASK_SSHORT 0x7FFFFFFF
|
||||
# define CARES_MASK_USHORT 0xFFFFFFFF
|
||||
#elif (SIZEOF_SHORT == 8)
|
||||
# define CARES_MASK_SSHORT 0x7FFFFFFFFFFFFFFF
|
||||
# define CARES_MASK_USHORT 0xFFFFFFFFFFFFFFFF
|
||||
#else
|
||||
# error "SIZEOF_SHORT not defined"
|
||||
#endif
|
||||
|
||||
#define CARES_MASK_SSHORT (CARES_MASK_USHORT >> 1)
|
||||
#define CARES_MASK_SINT (CARES_MASK_UINT >> 1)
|
||||
#define CARES_MASK_SLONG (CARES_MASK_ULONG >> 1)
|
||||
#if (SIZEOF_INT == 2)
|
||||
# define CARES_MASK_SINT 0x7FFF
|
||||
# define CARES_MASK_UINT 0xFFFF
|
||||
#elif (SIZEOF_INT == 4)
|
||||
# define CARES_MASK_SINT 0x7FFFFFFF
|
||||
# define CARES_MASK_UINT 0xFFFFFFFF
|
||||
#elif (SIZEOF_INT == 8)
|
||||
# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFF
|
||||
# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFF
|
||||
#elif (SIZEOF_INT == 16)
|
||||
# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
#else
|
||||
# error "SIZEOF_INT not defined"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LIMITS_H
|
||||
/* systems without <limits.h> we guess have 32 bit longs */
|
||||
#define CARES_MASK_SLONG 0x7FFFFFFFL
|
||||
#define CARES_MASK_ULONG 0xFFFFFFFFUL
|
||||
#else
|
||||
#define CARES_MASK_ULONG ULONG_MAX
|
||||
#define CARES_MASK_SLONG LONG_MAX
|
||||
#endif
|
||||
|
||||
/*
|
||||
** unsigned size_t to signed long
|
||||
|
|
|
@ -158,6 +158,9 @@ int ares_set_servers_csv(ares_channel channel,
|
|||
return ARES_SUCCESS; /* blank all servers */
|
||||
|
||||
csv = malloc(i + 2);
|
||||
if (!csv)
|
||||
return ARES_ENOMEM;
|
||||
|
||||
strcpy(csv, _csv);
|
||||
if (csv[i-1] != ',') { /* make parsing easier by ensuring ending ',' */
|
||||
csv[i] = ',';
|
||||
|
|
|
@ -86,7 +86,10 @@ ares_parse_soa_reply(const unsigned char *abuf, int alen,
|
|||
/* allocate result struct */
|
||||
soa = ares_malloc_data(ARES_DATATYPE_SOA_REPLY);
|
||||
if (!soa)
|
||||
return ARES_ENOMEM;
|
||||
{
|
||||
status = ARES_ENOMEM;
|
||||
goto failed_stat;
|
||||
}
|
||||
|
||||
/* nsname */
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &soa->nsname, &len);
|
||||
|
|
|
@ -133,6 +133,8 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
|
|||
break;
|
||||
}
|
||||
|
||||
++strptr;
|
||||
|
||||
/* Allocate storage for this TXT answer appending it to the list */
|
||||
txt_curr = ares_malloc_data(ARES_DATATYPE_TXT_REPLY);
|
||||
if (!txt_curr)
|
||||
|
@ -150,7 +152,6 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
|
|||
}
|
||||
txt_last = txt_curr;
|
||||
|
||||
txt_curr->record_start = strptr == aptr;
|
||||
txt_curr->length = substr_len;
|
||||
txt_curr->txt = malloc (substr_len + 1/* Including null byte */);
|
||||
if (txt_curr->txt == NULL)
|
||||
|
@ -158,8 +159,6 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
|
|||
status = ARES_ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
||||
++strptr;
|
||||
memcpy ((char *) txt_curr->txt, strptr, substr_len);
|
||||
|
||||
/* Make sure we NULL-terminate */
|
||||
|
|
|
@ -310,12 +310,7 @@ struct ares_channeldata {
|
|||
/* return true if now is exactly check time or later */
|
||||
int ares__timedout(struct timeval *now,
|
||||
struct timeval *check);
|
||||
/* add the specific number of milliseconds to the time in the first argument */
|
||||
int ares__timeadd(struct timeval *now,
|
||||
int millisecs);
|
||||
/* return time offset between now and (future) check, in milliseconds */
|
||||
long ares__timeoffset(struct timeval *now,
|
||||
struct timeval *check);
|
||||
|
||||
/* returns ARES_SUCCESS if library has been initialized */
|
||||
int ares_library_initialized(void);
|
||||
void ares__send_query(ares_channel channel, struct query *query,
|
||||
|
|
|
@ -102,8 +102,7 @@ int ares__timedout(struct timeval *now,
|
|||
}
|
||||
|
||||
/* add the specific number of milliseconds to the time in the first argument */
|
||||
int ares__timeadd(struct timeval *now,
|
||||
int millisecs)
|
||||
static void timeadd(struct timeval *now, int millisecs)
|
||||
{
|
||||
now->tv_sec += millisecs/1000;
|
||||
now->tv_usec += (millisecs%1000)*1000;
|
||||
|
@ -112,19 +111,8 @@ int ares__timeadd(struct timeval *now,
|
|||
++(now->tv_sec);
|
||||
now->tv_usec -= 1000000;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* return time offset between now and (future) check, in milliseconds */
|
||||
long ares__timeoffset(struct timeval *now,
|
||||
struct timeval *check)
|
||||
{
|
||||
return (check->tv_sec - now->tv_sec)*1000 +
|
||||
(check->tv_usec - now->tv_usec)/1000;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* generic process function
|
||||
*/
|
||||
|
@ -831,8 +819,7 @@ void ares__send_query(ares_channel channel, struct query *query,
|
|||
timeplus = channel->timeout << (query->try_count / channel->nservers);
|
||||
timeplus = (timeplus * (9 + (rand () & 7))) / 16;
|
||||
query->timeout = *now;
|
||||
ares__timeadd(&query->timeout,
|
||||
timeplus);
|
||||
timeadd(&query->timeout, timeplus);
|
||||
/* Keep track of queries bucketed by timeout, so we can process
|
||||
* timeout events quickly.
|
||||
*/
|
||||
|
|
|
@ -68,11 +68,6 @@
|
|||
* Verify that some macros are actually defined.
|
||||
*/
|
||||
|
||||
#ifndef CARES_SIZEOF_LONG
|
||||
# error "CARES_SIZEOF_LONG definition is missing!"
|
||||
Error Compilation_aborted_CARES_SIZEOF_LONG_is_missing
|
||||
#endif
|
||||
|
||||
#ifndef CARES_TYPEOF_ARES_SOCKLEN_T
|
||||
# error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!"
|
||||
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing
|
||||
|
@ -91,15 +86,6 @@
|
|||
|
||||
#define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
|
||||
|
||||
/*
|
||||
* Verify that the size previously defined and expected for long
|
||||
* is the same as the one reported by sizeof() at compile time.
|
||||
*/
|
||||
|
||||
typedef char
|
||||
__cares_rule_01__
|
||||
[CareschkszEQ(long, CARES_SIZEOF_LONG)];
|
||||
|
||||
/*
|
||||
* Verify that the size previously defined and expected for
|
||||
* ares_socklen_t is actually the the same as the one reported
|
||||
|
|
|
@ -239,7 +239,7 @@ static int single_domain(ares_channel channel, const char *name, char **s)
|
|||
/* If the name contains a trailing dot, then the single query is the name
|
||||
* sans the trailing dot.
|
||||
*/
|
||||
if (name[len - 1] == '.')
|
||||
if ((len > 0) && (name[len - 1] == '.'))
|
||||
{
|
||||
*s = strdup(name);
|
||||
return (*s) ? ARES_SUCCESS : ARES_ENOMEM;
|
||||
|
|
|
@ -75,9 +75,9 @@
|
|||
/* please, do it beyond the point further indicated in this file. */
|
||||
/* ================================================================ */
|
||||
|
||||
#if 1 /* libuv hack */
|
||||
#include <errno.h> /* needed on windows */
|
||||
#else
|
||||
#if 1
|
||||
# define SIZEOF_SHORT 2
|
||||
#else /* Disabled for the gyp-ified build. */
|
||||
/*
|
||||
* c-ares external interface definitions are also used internally,
|
||||
* and might also include required system header files to define them.
|
||||
|
@ -90,7 +90,7 @@
|
|||
*/
|
||||
|
||||
#include <ares_rules.h>
|
||||
#endif /* libuv hack */
|
||||
#endif
|
||||
|
||||
/* ================================================================= */
|
||||
/* No system header file shall be included in this file before this */
|
||||
|
|
|
@ -23,6 +23,13 @@
|
|||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
/* return time offset between now and (future) check, in milliseconds */
|
||||
static long timeoffset(struct timeval *now, struct timeval *check)
|
||||
{
|
||||
return (check->tv_sec - now->tv_sec)*1000 +
|
||||
(check->tv_usec - now->tv_usec)/1000;
|
||||
}
|
||||
|
||||
/* WARNING: Beware that this is linear in the number of outstanding
|
||||
* requests! You are probably far better off just calling ares_process()
|
||||
* once per second, rather than calling ares_timeout() to figure out
|
||||
|
@ -53,7 +60,7 @@ struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
|
|||
query = list_node->data;
|
||||
if (query->timeout.tv_sec == 0)
|
||||
continue;
|
||||
offset = ares__timeoffset(&now, &query->timeout);
|
||||
offset = timeoffset(&now, &query->timeout);
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
if (min_offset == -1 || offset < min_offset)
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
#ifndef __ARES_CONFIG_WIN32_H
|
||||
#define __ARES_CONFIG_WIN32_H
|
||||
#ifndef HEADER_CARES_CONFIG_WIN32_H
|
||||
#define HEADER_CARES_CONFIG_WIN32_H
|
||||
|
||||
/* when building c-ares library */
|
||||
#define CARES_BUILDING_LIBRARY 1
|
||||
|
||||
/* Copyright (C) 2004 - 2008 by Daniel Stenberg et al
|
||||
/* Copyright (C) 2004 - 2011 by Daniel Stenberg et al
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
|
@ -17,25 +14,29 @@
|
|||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#define ARES_
|
||||
|
||||
/* ================================================================ */
|
||||
/* ares/config-win32.h - Hand crafted config file for Windows */
|
||||
/* c-ares/config-win32.h - Hand crafted config file for Windows */
|
||||
/* ================================================================ */
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* HEADER FILES */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Define if you have the <getopt.h> header file. */
|
||||
/* Define if you have the <assert.h> header file. */
|
||||
#define HAVE_ASSERT_H 1
|
||||
|
||||
/* Define if you have the <errno.h> header file. */
|
||||
#define HAVE_ERRNO_H 1
|
||||
|
||||
/* Define if you have the <getopt.h> header file. */
|
||||
#if defined(__MINGW32__) || defined(__POCC__)
|
||||
#define HAVE_GETOPT_H 1
|
||||
#endif
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define if you have the <process.h> header file. */
|
||||
/* Define if you have the <process.h> header file. */
|
||||
#ifndef __SALFORDC__
|
||||
#define HAVE_PROCESS_H 1
|
||||
#endif
|
||||
|
@ -44,31 +45,29 @@
|
|||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* Define if you have the <sys/time.h> header file */
|
||||
#if defined(__MINGW32__)
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
#endif
|
||||
/* #define HAVE_SYS_TIME_H 1 */
|
||||
|
||||
/* Define if you have the <time.h> header file. */
|
||||
/* Define if you have the <time.h> header file. */
|
||||
#define HAVE_TIME_H 1
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \
|
||||
defined(__POCC__)
|
||||
#define HAVE_UNISTD_H 1
|
||||
#endif
|
||||
|
||||
/* Define if you have the windows.h header file. */
|
||||
/* Define if you have the <windows.h> header file. */
|
||||
#define HAVE_WINDOWS_H 1
|
||||
|
||||
/* Define if you have the <winsock.h> header file. */
|
||||
/* Define if you have the <winsock.h> header file. */
|
||||
#define HAVE_WINSOCK_H 1
|
||||
|
||||
/* Define if you have the <winsock2.h> header file. */
|
||||
/* Define if you have the <winsock2.h> header file. */
|
||||
#ifndef __SALFORDC__
|
||||
#define HAVE_WINSOCK2_H 1
|
||||
#endif
|
||||
|
||||
/* Define if you have the <ws2tcpip.h> header file. */
|
||||
/* Define if you have the <ws2tcpip.h> header file. */
|
||||
#ifndef __SALFORDC__
|
||||
#define HAVE_WS2TCPIP_H 1
|
||||
#endif
|
||||
|
@ -80,20 +79,23 @@
|
|||
/* Define if sig_atomic_t is an available typedef. */
|
||||
#define HAVE_SIG_ATOMIC_T 1
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
/* #define TIME_WITH_SYS_TIME 1 */
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* FUNCTIONS */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Define if you have the closesocket function. */
|
||||
/* Define if you have the closesocket function. */
|
||||
#define HAVE_CLOSESOCKET 1
|
||||
|
||||
/* Define if you have the gethostname function. */
|
||||
/* Define if you have the getenv function. */
|
||||
#define HAVE_GETENV 1
|
||||
|
||||
/* Define if you have the gethostname function. */
|
||||
#define HAVE_GETHOSTNAME 1
|
||||
|
||||
/* Define if you have the ioctlsocket function. */
|
||||
|
@ -105,9 +107,6 @@
|
|||
/* Define if you have the strcasecmp function. */
|
||||
/* #define HAVE_STRCASECMP 1 */
|
||||
|
||||
/* Define if you have the getenv function. */
|
||||
#define HAVE_GETENV 1
|
||||
|
||||
/* Define if you have the strdup function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
|
@ -183,7 +182,7 @@
|
|||
/* Define to the function return type for send. */
|
||||
#define SEND_TYPE_RETV int
|
||||
|
||||
/* Specifics for the Watt-32 tcp/ip stack */
|
||||
/* Specifics for the Watt-32 tcp/ip stack. */
|
||||
#ifdef WATT32
|
||||
#define SOCKET int
|
||||
#define NS_INADDRSZ 4
|
||||
|
@ -206,13 +205,13 @@
|
|||
/* TYPEDEF REPLACEMENTS */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Define this if in_addr_t is not an available 'typedefed' type */
|
||||
/* Define if in_addr_t is not an available 'typedefed' type. */
|
||||
#define in_addr_t unsigned long
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
/* Define to the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define ssize_t if it is not an available 'typedefed' type */
|
||||
/* Define if ssize_t is not an available 'typedefed' type. */
|
||||
#ifndef _SSIZE_T_DEFINED
|
||||
# if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \
|
||||
defined(__POCC__) || \
|
||||
|
@ -230,13 +229,13 @@
|
|||
/* TYPE SIZES */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* The size of `int', as computed by sizeof. */
|
||||
/* Define to the size of `int', as computed by sizeof. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The size of `short', as computed by sizeof. */
|
||||
/* Define to the size of `short', as computed by sizeof. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
/* Define to the size of `size_t', as computed by sizeof. */
|
||||
#if defined(_WIN64)
|
||||
# define SIZEOF_SIZE_T 8
|
||||
#else
|
||||
|
@ -247,34 +246,35 @@
|
|||
/* STRUCT RELATED */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Define this if you have struct addrinfo */
|
||||
/* Define if you have struct addrinfo. */
|
||||
#define HAVE_STRUCT_ADDRINFO 1
|
||||
|
||||
/* Define this if you have struct sockaddr_storage */
|
||||
#ifndef __SALFORDC__
|
||||
/* Define if you have struct sockaddr_storage. */
|
||||
#if !defined(__SALFORDC__) && !defined(__BORLANDC__)
|
||||
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
|
||||
#endif
|
||||
|
||||
/* Define this if you have struct timeval */
|
||||
/* Define if you have struct timeval. */
|
||||
#define HAVE_STRUCT_TIMEVAL 1
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* COMPILER SPECIFIC */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Define to avoid VS2005 complaining about portable C functions */
|
||||
/* Define to avoid VS2005 complaining about portable C functions. */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
# define _CRT_SECURE_NO_DEPRECATE 1
|
||||
# define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#endif
|
||||
|
||||
/* Officially, Microsoft's Windows SDK versions 6.X do not support Windows
|
||||
2000 as a supported build target. VS2008 default installations provide an
|
||||
embedded Windows SDK v6.0A along with the claim that Windows 2000 is a
|
||||
valid build target for VS2008. Popular belief is that binaries built using
|
||||
Windows SDK versions 6.X and Windows 2000 as a build target are functional */
|
||||
2000 as a supported build target. VS2008 default installations provide
|
||||
an embedded Windows SDK v6.0A along with the claim that Windows 2000 is
|
||||
a valid build target for VS2008. Popular belief is that binaries built
|
||||
with VS2008 using Windows SDK versions 6.X and Windows 2000 as a build
|
||||
target are functional. */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
|
||||
# define VS2008_MINIMUM_TARGET 0x0500
|
||||
# define VS2008_MIN_TARGET 0x0500
|
||||
#endif
|
||||
|
||||
/* When no build target is specified VS2008 default build target is Windows
|
||||
|
@ -282,18 +282,18 @@
|
|||
for VS2008 we will target the minimum Officially supported build target,
|
||||
which happens to be Windows XP. */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
|
||||
# define VS2008_DEFAULT_TARGET 0x0501
|
||||
# define VS2008_DEF_TARGET 0x0501
|
||||
#endif
|
||||
|
||||
/* VS2008 default target settings and minimum build target check */
|
||||
/* VS2008 default target settings and minimum build target check. */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
|
||||
# ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT VS2008_DEFAULT_TARGET
|
||||
# define _WIN32_WINNT VS2008_DEF_TARGET
|
||||
# endif
|
||||
# ifndef WINVER
|
||||
# define WINVER VS2008_DEFAULT_TARGET
|
||||
# define WINVER VS2008_DEF_TARGET
|
||||
# endif
|
||||
# if (_WIN32_WINNT < VS2008_MINIMUM_TARGET) || (WINVER < VS2008_MINIMUM_TARGET)
|
||||
# if (_WIN32_WINNT < VS2008_MIN_TARGET) || (WINVER < VS2008_MIN_TARGET)
|
||||
# error VS2008 does not support Windows build targets prior to Windows 2000
|
||||
# endif
|
||||
#endif
|
||||
|
@ -340,30 +340,46 @@
|
|||
/* IPV6 COMPATIBILITY */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Define this if you have address family AF_INET6 */
|
||||
/* Define if you have address family AF_INET6. */
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#define HAVE_AF_INET6 1
|
||||
#endif
|
||||
|
||||
/* Define this if you have protocol family PF_INET6 */
|
||||
/* Define if you have protocol family PF_INET6. */
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#define HAVE_PF_INET6 1
|
||||
#endif
|
||||
|
||||
/* Define this if you have struct in6_addr */
|
||||
/* Define if you have struct in6_addr. */
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#define HAVE_STRUCT_IN6_ADDR 1
|
||||
#endif
|
||||
|
||||
/* Define this if you have struct sockaddr_in6 */
|
||||
/* Define if you have struct sockaddr_in6. */
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1
|
||||
#endif
|
||||
|
||||
/* Define this if you have sockaddr_in6 with scopeid */
|
||||
/* Define if you have sockaddr_in6 with scopeid. */
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Win CE */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#endif /* __ARES_CONFIG_WIN32_H */
|
||||
/* FIXME: A proper config-win32ce.h should be created to hold these */
|
||||
|
||||
/*
|
||||
* System error codes for Windows CE
|
||||
*/
|
||||
|
||||
#if defined(_WIN32_WCE) && !defined(HAVE_ERRNO_H)
|
||||
# define ENOENT ERROR_FILE_NOT_FOUND
|
||||
# define ESRCH ERROR_PATH_NOT_FOUND
|
||||
# define ENOMEM ERROR_NOT_ENOUGH_MEMORY
|
||||
# define ENOSPC ERROR_INVALID_PARAMETER
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CARES_CONFIG_WIN32_H */
|
Загрузка…
Ссылка в новой задаче