Permalink
Browse files

Upgrade libuv to fe18438

  • Loading branch information...
1 parent 4980686 commit d1e6a1317958ac3bcc252609d799aee11c50ca85 @ry ry committed Sep 30, 2011
Showing with 12,528 additions and 736 deletions.
  1. +1 −0 deps/uv/.mailmap
  2. +3 −0 deps/uv/AUTHORS
  3. +2 −2 deps/uv/README.md
  4. +1 −0 deps/uv/config-mingw.mk
  5. +11 −2 deps/uv/include/ares.h
  6. +2 −2 deps/uv/include/ares_version.h
  7. +6 −3 deps/uv/include/uv-private/uv-unix.h
  8. +2 −4 deps/uv/include/uv-private/uv-win.h
  9. +6 −0 deps/uv/include/uv.h
  10. +20 −0 deps/uv/src/ares/CHANGES
  11. +24 −0 deps/uv/src/ares/README.msvc
  12. +18 −17 deps/uv/src/ares/RELEASE-NOTES
  13. +8 −1 deps/uv/src/ares/ares_expand_name.c
  14. +1 −0 deps/uv/src/ares/ares_fds.c
  15. +3 −0 deps/uv/src/ares/ares_free_hostent.c
  16. +30 −0 deps/uv/src/ares/ares_getenv.c
  17. +26 −0 deps/uv/src/ares/ares_getenv.h
  18. +11 −2 deps/uv/src/ares/ares_gethostbyaddr.c
  19. +17 −9 deps/uv/src/ares/ares_gethostbyname.c
  20. +3 −2 deps/uv/src/ares/ares_getnameinfo.c
  21. +235 −94 deps/uv/src/ares/ares_init.c
  22. +221 −0 deps/uv/src/ares/ares_iphlpapi.h
  23. +10 −0 deps/uv/src/ares/ares_library_init.c
  24. +4 −1 deps/uv/src/ares/ares_library_init.h
  25. +126 −4 deps/uv/src/ares/ares_nowarn.c
  26. +32 −1 deps/uv/src/ares/ares_nowarn.h
  27. +4 −9 deps/uv/src/ares/ares_options.c
  28. +3 −0 deps/uv/src/ares/ares_parse_a_reply.c
  29. +3 −0 deps/uv/src/ares/ares_parse_aaaa_reply.c
  30. +2 −2 deps/uv/src/ares/ares_parse_mx_reply.c
  31. +2 −2 deps/uv/src/ares/ares_parse_ns_reply.c
  32. +12 −3 deps/uv/src/ares/ares_parse_ptr_reply.c
  33. +3 −3 deps/uv/src/ares/ares_parse_srv_reply.c
  34. +11,035 −0 deps/uv/src/ares/ares_platform.c
  35. +43 −0 deps/uv/src/ares/ares_platform.h
  36. +6 −2 deps/uv/src/ares/ares_private.h
  37. +24 −25 deps/uv/src/ares/ares_process.c
  38. +1 −2 deps/uv/src/ares/ares_search.c
  39. +1 −1 deps/uv/src/ares/ares_send.c
  40. +12 −4 deps/uv/src/ares/ares_setup.h
  41. +2 −0 deps/uv/src/ares/config_cygwin/ares_config.h
  42. +2 −0 deps/uv/src/ares/config_darwin/ares_config.h
  43. +2 −0 deps/uv/src/ares/config_freebsd/ares_config.h
  44. +2 −0 deps/uv/src/ares/config_linux/ares_config.h
  45. +2 −0 deps/uv/src/ares/config_netbsd/ares_config.h
  46. +2 −0 deps/uv/src/ares/config_openbsd/ares_config.h
  47. +2 −0 deps/uv/src/ares/config_sunos/ares_config.h
  48. +3 −0 deps/uv/src/ares/config_win32/ares_config.h
  49. +21 −20 deps/uv/src/ares/inet_net_pton.c
  50. +6 −6 deps/uv/src/ares/inet_net_pton.h
  51. +79 −103 deps/uv/src/ares/inet_ntop.c
  52. +0 −1 deps/uv/src/ares/inet_ntop.h
  53. +10 −0 deps/uv/src/ares/nameser.h
  54. +18 −2 deps/uv/src/ares/setup_once.h
  55. +1 −1 deps/uv/src/unix/cares.c
  56. +4 −4 deps/uv/src/unix/core.c
  57. +1 −1 deps/uv/src/unix/cygwin.c
  58. +1 −1 deps/uv/src/unix/darwin.c
  59. +0 −23 deps/uv/src/unix/error.c
  60. +1 −1 deps/uv/src/unix/freebsd.c
  61. +21 −21 deps/uv/src/unix/fs.c
  62. +0 −2 deps/uv/src/unix/internal.h
  63. +2 −2 deps/uv/src/unix/linux.c
  64. +1 −1 deps/uv/src/unix/netbsd.c
  65. +9 −9 deps/uv/src/unix/pipe.c
  66. +2 −2 deps/uv/src/unix/process.c
  67. +19 −19 deps/uv/src/unix/stream.c
  68. +1 −1 deps/uv/src/unix/sunos.c
  69. +23 −33 deps/uv/src/unix/tcp.c
  70. +55 −25 deps/uv/src/unix/tty.c
  71. +26 −16 deps/uv/src/unix/udp.c
  72. +23 −0 deps/uv/src/uv-common.c
  73. +4 −0 deps/uv/src/uv-common.h
  74. +1 −1 deps/uv/src/win/core.c
  75. +0 −24 deps/uv/src/win/error.c
  76. +3 −3 deps/uv/src/win/fs-event.c
  77. +16 −10 deps/uv/src/win/fs.c
  78. +7 −7 deps/uv/src/win/getaddrinfo.c
  79. +0 −9 deps/uv/src/win/internal.h
  80. +28 −28 deps/uv/src/win/pipe.c
  81. +9 −9 deps/uv/src/win/process.c
  82. +1 −1 deps/uv/src/win/stdio.c
  83. +4 −4 deps/uv/src/win/stream.c
  84. +51 −53 deps/uv/src/win/tcp.c
  85. +1 −1 deps/uv/src/win/threadpool.c
  86. +3 −3 deps/uv/src/win/timer.c
  87. +21 −15 deps/uv/src/win/tty.c
  88. +21 −69 deps/uv/src/win/udp.c
  89. +2 −2 deps/uv/src/win/util.c
  90. +1 −0 deps/uv/test/benchmark-sizes.c
  91. +17 −1 deps/uv/test/test-fs.c
  92. +2 −0 deps/uv/test/test-list.h
  93. +10 −0 deps/uv/test/test-tty.c
  94. +11 −5 deps/uv/uv.gyp
View
1 deps/uv/.mailmap
@@ -6,3 +6,4 @@
<alan@prettyrobots.com> <alan@blogometer.com>
San-Tai Hsu <vanilla@fatpipi.com>
Isaac Z. Schlueter <i@izs.me>
+Saúl Ibarra Corretgé <saghul@gmail.com>
View
3 deps/uv/AUTHORS
@@ -24,3 +24,6 @@ Matthew Sporleder <msporleder@gmail.com>
Erick Tryzelaar <erick.tryzelaar@gmail.com>
Isaac Z. Schlueter <i@izs.me>
Pieter Noordhuis <pcnoordhuis@gmail.com>
+Marek Jelen <marek@jelen.biz>
+Fedor Indutny <fedor.indutny@gmail.com>
+Saúl Ibarra Corretgé <saghul@gmail.com>
View
4 deps/uv/README.md
@@ -30,14 +30,14 @@ Implemented:
* Thread pool scheduling `uv_queue_work`
+ * ANSI escape code controlled TTY `uv_tty_t`
+
In-progress:
* File system events (Currently supports inotify, `ReadDirectoryChangesW`
and will support kqueue and event ports in the near future.)
`uv_fs_event_t`
- * VT100 TTY `uv_tty_t`
-
* Socket sharing between processes `uv_ipc_t`
View
1 deps/uv/config-mingw.mk
@@ -28,6 +28,7 @@ CFLAGS=$(CPPFLAGS) -g --std=gnu89 -D_WIN32_WINNT=0x0501 -Isrc/ares/config_win32
LINKFLAGS=-lm
CARES_OBJS += src/ares/windows_port.o
+CARES_OBJS += src/ares/ares_platform.o
WIN_SRCS=$(wildcard src/win/*.c)
WIN_OBJS=$(WIN_SRCS:.c=.o)
View
13 deps/uv/include/ares.h
@@ -1,6 +1,6 @@
/* Copyright 1998, 2009 by the Massachusetts Institute of Technology.
- * Copyright (C) 2007-2010 by Daniel Stenberg
+ * Copyright (C) 2007-2011 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -96,10 +96,19 @@ typedef int ares_socklen_t;
# include <netinet/in.h>
# include <sys/socket.h>
# include <tcp.h>
+#elif defined(_WIN32_WCE)
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h>
+# include <winsock.h>
#elif defined(WIN32)
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h>
# include <winsock2.h>
# include <ws2tcpip.h>
-# include <windows.h>
#else
# include <sys/socket.h>
# include <netinet/in.h>
View
4 deps/uv/include/ares_version.h
@@ -7,11 +7,11 @@
#define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 7
-#define ARES_VERSION_PATCH 4
+#define ARES_VERSION_PATCH 5
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH))
-#define ARES_VERSION_STR "1.7.4"
+#define ARES_VERSION_STR "1.7.5-DEV"
#if (ARES_VERSION >= 0x010700)
# define CARES_HAVE_ARES_LIBRARY_INIT 1
View
9 deps/uv/include/uv-private/uv-unix.h
@@ -33,10 +33,11 @@
#include <sys/types.h>
#include <sys/socket.h>
-#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
-
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <termios.h>
/* Note: May be cast to struct iovec. See writev(2). */
typedef struct {
@@ -183,6 +184,8 @@ typedef int uv_file;
#define UV_WORK_PRIVATE_FIELDS \
eio_req* eio;
-#define UV_TTY_PRIVATE_FIELDS /* empty */
+#define UV_TTY_PRIVATE_FIELDS \
+ struct termios orig_termios; \
+ int mode;
#endif /* UV_UNIX_H */
View
6 deps/uv/include/uv-private/uv-win.h
@@ -75,9 +75,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
uv_idle_t* next_idle_handle; \
ares_channel ares_chan; \
int ares_active_sockets; \
- uv_timer_t ares_polling_timer; \
- /* Last error code */ \
- uv_err_t last_error;
+ uv_timer_t ares_polling_timer;
#define UV_REQ_TYPE_PRIVATE \
/* TODO: remove the req suffix */ \
@@ -151,7 +149,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
#define UV_TCP_PRIVATE_FIELDS \
SOCKET socket; \
- uv_err_t bind_error; \
+ int bind_error; \
union { \
struct { uv_tcp_server_fields }; \
struct { uv_tcp_connection_fields }; \
View
6 deps/uv/include/uv.h
@@ -620,6 +620,12 @@ int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd);
int uv_tty_set_mode(uv_tty_t*, int mode);
/*
+ * To be called when the program exits. Resets TTY settings to default
+ * values for the next process to take over.
+ */
+void uv_tty_reset_mode();
+
+/*
* Gets the current Window size. On success zero is returned.
*/
int uv_tty_get_winsize(uv_tty_t*, int* width, int* height);
View
20 deps/uv/src/ares/CHANGES
@@ -1,5 +1,25 @@
Changelog for the c-ares project
+Version 1.7.5 (August 16, 2011)
+
+Fixed:
+
+ o detection of semicolon comments in resolv.conf
+ o avoid using system's inet_net_pton affected by the WLB-2008080064 advisory
+ o replacement ares_inet_net_pton affected by the WLB-2008080064 advisory
+ o replacement ares_inet_ntop affected by potential out of bounds write
+ o added install target to Makefile.msvc
+ o only fall back to AF_INET searches when looking for AF_UNSPEC addresses
+ o fixed ares_parse_*_reply memory leaks
+ o Use correct sizeof in ares_getnameinfo()
+ o IPv6-on-windows: find DNS servers correctly
+ o man pages: docs for the c-ares utility programs
+ o getservbyport replacement for Win CE
+ o config_sortlist: (win32) missing else
+ o advance_tcp_send_queue: avoid NULL ptr dereference
+ o configure: fix a bashism
+ o ares_expand_name: Fix encoded length for indirect root
+
Version 1.7.4 (December 9, 2010)
Changed:
View
24 deps/uv/src/ares/README.msvc
@@ -40,6 +40,30 @@
library version it is using.
+ How to install using MSVC from the command line
+ -----------------------------------------------
+
+ In order to allow easy usage of c-ares libraries it may be convenient to
+ install c-ares libraries and header files to a common subdirectory tree.
+
+ Once that c-ares libraries have been built using procedure described above,
+ use same command prompt window to define environment variable INSTALL_DIR
+ to designate the top subdirectory where installation of c-ares libraries and
+ header files will be done.
+
+ > set INSTALL_DIR=c:\c-ares
+
+ Afterwards, run following command to actually perform the installation:
+
+ > nmake -f Makefile.msvc install
+
+ Installation procedure will copy c-ares libraries to subdirectory 'lib' and
+ c-ares header files to subdirectory 'include' below the INSTALL_DIR subdir.
+
+ When environment variable INSTALL_DIR is not defined, installation is done
+ to c-ares source folder where Makefile.msvc file is located.
+
+
How to build using Visual Studio 6 IDE
--------------------------------------
View
35 deps/uv/src/ares/RELEASE-NOTES
@@ -1,25 +1,26 @@
-c-ares version 1.7.4
-
-Changed:
-
- o local-bind: Support binding to local interface/IPs, see
- ares_set_local_ip4, ares_set_local_ip6, ares_set_local_dev
+c-ares version 1.7.5
Fixed:
- o memory leak in ares_getnameinfo
- o add missing break that caused get_ares_servers to fail
- o ares_parse_a_reply: fix CNAME response parsing
- o init_by_options: don't copy an empty sortlist
- o Replaced uint32_t with unsigned int to fix broken builds
- on a couple of platforms
- o Fix lookup with HOSTALIASES set
- o adig: fix NAPTR parsing
- o compiler warning cleanups
+ o detection of semicolon comments in resolv.conf
+ o avoid using system's inet_net_pton affected by the WLB-2008080064 advisory
+ o replacement ares_inet_net_pton affected by the WLB-2008080064 advisory
+ o replacement ares_inet_ntop affected by potential out of bounds write
+ o added install target to Makefile.msvc
+ o only fall back to AF_INET searches when looking for AF_UNSPEC addresses
+ o fixed ares_parse_*_reply memory leaks
+ o Use correct sizeof in ares_getnameinfo()
+ o IPv6-on-windows: find DNS servers correctly
+ o man pages: docs for the c-ares utility programs
+ o getservbyport replacement for Win CE
+ o config_sortlist: (win32) missing else
+ o advance_tcp_send_queue: avoid NULL ptr dereference
+ o configure: fix a bashism
+ o ares_expand_name: Fix encoded length for indirect root
Thanks go to these friendly people for their efforts and contributions:
- Andrew C. Morrow, Ben Greear, Ben Noordhuis, Daniel Stenberg,
- Guenter Knauf, Mike Crowe, Patrik Thunstrom, Yang Tse
+ Yang Tse, Jakub Hrozek, Gisle Vanem, Tom Hughes, David Stuart, Dima Tisnek,
+ Peter Pentchev, Stefan Buhler
Have fun!
View
9 deps/uv/src/ares/ares_expand_name.c
@@ -87,7 +87,14 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
* Since this function strips trailing dots though, it becomes ""
*/
q[0] = '\0';
- *enclen = 1; /* the caller should move one byte to get past this */
+
+ /* indirect root label (like 0xc0 0x0c) is 2 bytes long (stupid, but
+ valid) */
+ if ((*encoded & INDIR_MASK) == INDIR_MASK)
+ *enclen = 2;
+ else
+ *enclen = 1; /* the caller should move one byte to get past this */
+
return ARES_SUCCESS;
}
View
1 deps/uv/src/ares/ares_fds.c
@@ -21,6 +21,7 @@
#endif
#include "ares.h"
+#include "ares_nowarn.h"
#include "ares_private.h"
int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
View
3 deps/uv/src/ares/ares_free_hostent.c
@@ -28,6 +28,9 @@ void ares_free_hostent(struct hostent *host)
{
char **p;
+ if (!host)
+ return;
+
free((char *)(host->h_name));
for (p = host->h_aliases; *p; p++)
free(*p);
View
30 deps/uv/src/ares/ares_getenv.c
@@ -0,0 +1,30 @@
+
+
+/* Copyright 1998 by the Massachusetts Institute of Technology.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ */
+
+#include "ares_setup.h"
+#include "ares_getenv.h"
+
+#ifndef HAVE_GETENV
+
+char *ares_getenv(const char *name)
+{
+#ifdef _WIN32_WCE
+ return NULL;
+#endif
+}
+
+#endif
View
26 deps/uv/src/ares/ares_getenv.h
@@ -0,0 +1,26 @@
+#ifndef HEADER_CARES_GETENV_H
+#define HEADER_CARES_GETENV_H
+
+
+/* Copyright 1998 by the Massachusetts Institute of Technology.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ */
+
+#include "ares_setup.h"
+
+#ifndef HAVE_GETENV
+extern char *ares_getenv(const char *name);
+#endif
+
+#endif /* HEADER_CARES_GETENV_H */
View
13 deps/uv/src/ares/ares_gethostbyaddr.c
@@ -42,6 +42,7 @@
#include "ares.h"
#include "inet_net_pton.h"
+#include "ares_platform.h"
#include "ares_private.h"
#ifdef WATT32
@@ -186,7 +187,13 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host)
#ifdef WIN32
char PATH_HOSTS[MAX_PATH];
- if (IS_NT()) {
+ win_platform platform;
+
+ PATH_HOSTS[0] = '\0';
+
+ platform = ares__getplatform();
+
+ if (platform == WIN_NT) {
char tmp[MAX_PATH];
HKEY hkeyHosts;
@@ -200,8 +207,10 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host)
RegCloseKey(hkeyHosts);
}
}
- else
+ else if (platform == WIN_9X)
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
+ else
+ return ARES_ENOTFOUND;
strcat(PATH_HOSTS, WIN_PATH_HOSTS);
View
26 deps/uv/src/ares/ares_gethostbyname.c
@@ -48,6 +48,7 @@
#include "ares.h"
#include "inet_net_pton.h"
#include "bitncmp.h"
+#include "ares_platform.h"
#include "ares_private.h"
#ifdef WATT32
@@ -193,11 +194,11 @@ 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) {
+ if ((status == ARES_ENODATA || status == ARES_EBADRESP) &&
+ 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. We should possibly limit this
- attempt-next logic to AF_UNSPEC lookups only. */
+ looking up A instead. */
hquery->sent_family = AF_INET;
ares_search(hquery->channel, hquery->name, C_IN, T_A,
host_callback, hquery);
@@ -209,11 +210,10 @@ static void host_callback(void *arg, int status, int timeouts,
end_hquery(hquery, status, host);
}
else if ((status == ARES_ENODATA || status == ARES_EBADRESP ||
- status == ARES_ETIMEOUT) && hquery->sent_family == AF_INET6)
+ status == ARES_ETIMEOUT) && (hquery->sent_family == AF_INET6 &&
+ hquery->want_family == AF_UNSPEC))
{
- /* The AAAA query yielded no useful result. Now look up an A instead.
- We should possibly limit this attempt-next logic to AF_UNSPEC lookups
- only. */
+ /* The AAAA query yielded no useful result. Now look up an A instead. */
hquery->sent_family = AF_INET;
ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback,
hquery);
@@ -344,7 +344,13 @@ static int file_lookup(const char *name, int family, struct hostent **host)
#ifdef WIN32
char PATH_HOSTS[MAX_PATH];
- if (IS_NT()) {
+ win_platform platform;
+
+ PATH_HOSTS[0] = '\0';
+
+ platform = ares__getplatform();
+
+ if (platform == WIN_NT) {
char tmp[MAX_PATH];
HKEY hkeyHosts;
@@ -358,8 +364,10 @@ static int file_lookup(const char *name, int family, struct hostent **host)
RegCloseKey(hkeyHosts);
}
}
- else
+ else if (platform == WIN_9X)
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
+ else
+ return ARES_ENOTFOUND;
strcat(PATH_HOSTS, WIN_PATH_HOSTS);
View
5 deps/uv/src/ares/ares_getnameinfo.c
@@ -58,6 +58,7 @@
#include "ares.h"
#include "ares_ipv6.h"
#include "inet_ntop.h"
+#include "ares_nowarn.h"
#include "ares_private.h"
struct nameinfo_query {
@@ -187,15 +188,15 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
if (sa->sa_family == AF_INET)
{
niquery->family = AF_INET;
- memcpy(&niquery->addr.addr4, addr, sizeof(addr));
+ memcpy(&niquery->addr.addr4, addr, sizeof(struct in_addr));
ares_gethostbyaddr(channel, &addr->sin_addr,
sizeof(struct in_addr), AF_INET,
nameinfo_callback, niquery);
}
else
{
niquery->family = AF_INET6;
- memcpy(&niquery->addr.addr6, addr6, sizeof(addr6));
+ memcpy(&niquery->addr.addr6, addr6, sizeof(struct ares_in6_addr));
ares_gethostbyaddr(channel, &addr6->sin6_addr,
sizeof(struct ares_in6_addr), AF_INET6,
nameinfo_callback, niquery);
View
329 deps/uv/src/ares/ares_init.c
@@ -1,6 +1,6 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
- * Copyright (C) 2007-2010 by Daniel Stenberg
+ * Copyright (C) 2007-2011 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -17,10 +17,6 @@
#include "ares_setup.h"
-#ifdef USE_WINSOCK
-#include <iphlpapi.h>
-#endif
-
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
@@ -63,17 +59,19 @@
#include <string.h>
#include <ctype.h>
#include <time.h>
-#include <errno.h>
+
+#ifdef ANDROID
+#include <sys/system_properties.h>
+#endif
+
#include "ares.h"
#include "inet_net_pton.h"
#include "ares_library_init.h"
#include "ares_nowarn.h"
+#include "ares_platform.h"
+#include "inet_ntop.h"
#include "ares_private.h"
-#ifdef ANDROID
-#include <sys/system_properties.h>
-#endif
-
#ifdef WATT32
#undef WIN32 /* Redefined in MingW/MSVC headers */
#endif
@@ -102,7 +100,7 @@ static int config_lookup(ares_channel channel, const char *str,
const char *bindch, const char *filech);
static int config_sortlist(struct apattern **sortlist, int *nsort,
const char *str);
-static char *try_config(char *s, const char *opt);
+static char *try_config(char *s, const char *opt, char scc);
#endif
#define ARES_CONFIG_CHECK(x) (x->lookups && x->nsort > -1 && \
@@ -363,7 +361,7 @@ int ares_save_options(ares_channel channel, struct ares_options *options,
ipv4_nservers++;
}
if (ipv4_nservers) {
- options->servers = malloc(ipv4_nservers * sizeof(struct server_state));
+ options->servers = malloc(ipv4_nservers * sizeof(struct in_addr));
if (!options->servers)
return ARES_ENOMEM;
for (i = j = 0; i < channel->nservers; i++)
@@ -595,73 +593,195 @@ static int get_res_interfaces_nt(HKEY hKey, const char *subkey, char **obuf)
return 0;
}
+/**
+ * The desired output for this method is that we set "ret_buf" to
+ * something like:
+ *
+ * 192.168.0.1,dns01.my.domain,fe80::200:f8ff:fe21:67cf
+ *
+ * The only ordering requirement is that primary servers are listed
+ * before secondary. There is no requirement that IPv4 addresses should
+ * necessarily be before IPv6.
+ *
+ * Note that ret_size should ideally be big enough to hold around
+ * 2-3 IPv4 and 2-3 IPv6 addresses.
+ *
+ * Finally, we need to return the total number of DNS servers located.
+ */
static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size)
{
- FIXED_INFO *fi, *newfi;
- DWORD size = sizeof (*fi);
- IP_ADDR_STRING *ipAddr;
- int i, count = 0;
- int debug = 0;
- size_t ip_size = sizeof("255.255.255.255,")-1;
- size_t left = ret_size;
- char *ret = ret_buf;
- HRESULT res;
-
- fi = malloc(size);
- if (!fi)
- return 0;
-
- res = (*ares_fpGetNetworkParams) (fi, &size);
- if ((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS))
- goto quit;
-
- newfi = realloc(fi, size);
- if (!newfi)
- goto quit;
-
- fi = newfi;
- res = (*ares_fpGetNetworkParams) (fi, &size);
- if (res != ERROR_SUCCESS)
- goto quit;
-
- if (debug)
+ const size_t ipv4_size = INET_ADDRSTRLEN + 1; /* +1 for ',' at end */
+ const size_t ipv6_size = INET6_ADDRSTRLEN + 12; /* +12 for "%0123456789," at end */
+ size_t left = ret_size;
+ char *ret = ret_buf;
+ int count = 0;
+
+ /* Use the GetAdaptersAddresses method if it's available, otherwise
+ fall back to GetNetworkParams. */
+ if (ares_fpGetAdaptersAddresses != ZERO_NULL)
{
- printf ("Host Name: %s\n", fi->HostName);
- printf ("Domain Name: %s\n", fi->DomainName);
- printf ("DNS Servers:\n"
- " %s (primary)\n", fi->DnsServerList.IpAddress.String);
+ const ULONG working_buf_size = 15000;
+ IP_ADAPTER_ADDRESSES *pFirstEntry = NULL;
+ IP_ADAPTER_ADDRESSES *pEntry = NULL;
+ ULONG bufSize = 0;
+ ULONG result = 0;
+
+ /* According to MSDN, the recommended way to do this is to use a temporary
+ buffer of 15K, to "dramatically reduce the chance that the GetAdaptersAddresses
+ method returns ERROR_BUFFER_OVERFLOW" */
+ pFirstEntry = ( IP_ADAPTER_ADDRESSES * ) malloc( working_buf_size );
+ bufSize = working_buf_size;
+ if( !pFirstEntry )
+ return 0;
+
+ /* Call the method one time */
+ result = ( *ares_fpGetAdaptersAddresses )( AF_UNSPEC, 0, 0, pFirstEntry, &bufSize );
+ if( result == ERROR_BUFFER_OVERFLOW )
+ {
+ /* Reallocate, bufSize should now be set to the required size */
+ pFirstEntry = ( IP_ADAPTER_ADDRESSES * ) realloc( pFirstEntry, bufSize );
+ if( !pFirstEntry )
+ return 0;
+
+ /* Call the method a second time */
+ result = ( *ares_fpGetAdaptersAddresses )( AF_UNSPEC, 0, 0, pFirstEntry, &bufSize );
+ if( result == ERROR_BUFFER_OVERFLOW )
+ {
+ /* Reallocate, bufSize should now be set to the required size */
+ pFirstEntry = ( IP_ADAPTER_ADDRESSES * ) realloc( pFirstEntry, bufSize );
+ if( !pFirstEntry )
+ return 0;
+
+ /* Call the method a third time. The maximum number of times we're going to do
+ this is 3. Three shall be the number thou shalt count, and the number of the
+ counting shall be three. Five is right out. */
+ result = ( *ares_fpGetAdaptersAddresses )( AF_UNSPEC, 0, 0, pFirstEntry, &bufSize );
+ }
+ }
+
+ /* Check the current result for failure */
+ if( result != ERROR_SUCCESS )
+ {
+ free( pFirstEntry );
+ return 0;
+ }
+
+ /* process the results */
+ for( pEntry = pFirstEntry ; pEntry != NULL ; pEntry = pEntry->Next )
+ {
+ IP_ADAPTER_DNS_SERVER_ADDRESS* pDNSAddr = pEntry->FirstDnsServerAddress;
+ for( ; pDNSAddr != NULL ; pDNSAddr = pDNSAddr->Next )
+ {
+ struct sockaddr *pGenericAddr = pDNSAddr->Address.lpSockaddr;
+ size_t stringlen = 0;
+
+ if( pGenericAddr->sa_family == AF_INET && left > ipv4_size )
+ {
+ /* Handle the v4 case */
+ struct sockaddr_in *pIPv4Addr = ( struct sockaddr_in * ) pGenericAddr;
+ ares_inet_ntop( AF_INET, &pIPv4Addr->sin_addr, ret, ipv4_size - 1 ); /* -1 for comma */
+
+ /* Append a comma to the end, THEN NULL. Should be OK because we
+ already tested the size at the top of the if statement. */
+ stringlen = strlen( ret );
+ ret[ stringlen ] = ',';
+ ret[ stringlen + 1 ] = '\0';
+ ret += stringlen + 1;
+ left -= ret - ret_buf;
+ ++count;
+ }
+ else if( pGenericAddr->sa_family == AF_INET6 && left > ipv6_size )
+ {
+ /* Handle the v6 case */
+ struct sockaddr_in6 *pIPv6Addr = ( struct sockaddr_in6 * ) pGenericAddr;
+ ares_inet_ntop( AF_INET6, &pIPv6Addr->sin6_addr, ret, ipv6_size - 1 ); /* -1 for comma */
+
+ /* Append a comma to the end, THEN NULL. Should be OK because we
+ already tested the size at the top of the if statement. */
+ stringlen = strlen( ret );
+ ret[ stringlen ] = ',';
+ ret[ stringlen + 1 ] = '\0';
+ ret += stringlen + 1;
+ left -= ret - ret_buf;
+ ++count;
+
+ /* NB on Windows this also returns stuff in the fec0::/10 range,
+ seems to be hard-coded somehow. Do we need to ignore them? */
+ }
+ }
+ }
+
+ if( pFirstEntry )
+ free( pFirstEntry );
+ if (ret > ret_buf)
+ ret[-1] = '\0';
+ return count;
}
- if (strlen(fi->DnsServerList.IpAddress.String) > 0 &&
- inet_addr(fi->DnsServerList.IpAddress.String) != INADDR_NONE &&
- left > ip_size)
+ else
{
- ret += sprintf (ret, "%s,", fi->DnsServerList.IpAddress.String);
- left -= ret - ret_buf;
- count++;
- }
+ FIXED_INFO *fi, *newfi;
+ DWORD size = sizeof (*fi);
+ IP_ADDR_STRING *ipAddr;
+ int i;
+ int debug = 0;
+ HRESULT res;
+
+ fi = malloc(size);
+ if (!fi)
+ return 0;
+
+ res = (*ares_fpGetNetworkParams) (fi, &size);
+ if ((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS))
+ goto quit;
+
+ newfi = realloc(fi, size);
+ if (!newfi)
+ goto quit;
+
+ fi = newfi;
+ res = (*ares_fpGetNetworkParams) (fi, &size);
+ if (res != ERROR_SUCCESS)
+ goto quit;
- for (i = 0, ipAddr = fi->DnsServerList.Next; ipAddr && left > ip_size;
- ipAddr = ipAddr->Next, i++)
- {
- if (inet_addr(ipAddr->IpAddress.String) != INADDR_NONE)
+ if (debug)
{
- ret += sprintf (ret, "%s,", ipAddr->IpAddress.String);
- left -= ret - ret_buf;
- count++;
+ printf ("Host Name: %s\n", fi->HostName);
+ printf ("Domain Name: %s\n", fi->DomainName);
+ printf ("DNS Servers:\n"
+ " %s (primary)\n", fi->DnsServerList.IpAddress.String);
+ }
+ if (strlen(fi->DnsServerList.IpAddress.String) > 0 &&
+ inet_addr(fi->DnsServerList.IpAddress.String) != INADDR_NONE &&
+ left > ipv4_size)
+ {
+ ret += sprintf (ret, "%s,", fi->DnsServerList.IpAddress.String);
+ left -= ret - ret_buf;
+ ++count;
+ }
+
+ for (i = 0, ipAddr = fi->DnsServerList.Next; ipAddr && left > ipv4_size;
+ ipAddr = ipAddr->Next, i++)
+ {
+ if (inet_addr(ipAddr->IpAddress.String) != INADDR_NONE)
+ {
+ ret += sprintf (ret, "%s,", ipAddr->IpAddress.String);
+ left -= ret - ret_buf;
+ ++count;
+ }
+ if (debug)
+ printf (" %s (secondary %d)\n", ipAddr->IpAddress.String, i+1);
}
- if (debug)
- printf (" %s (secondary %d)\n", ipAddr->IpAddress.String, i+1);
- }
quit:
- if (fi)
- free(fi);
-
- if (debug && left <= ip_size)
- printf ("Too many nameservers. Truncating to %d addressess", count);
- if (ret > ret_buf)
- ret[-1] = '\0';
- return count;
+ if (fi)
+ free(fi);
+
+ if (debug && left <= ipv4_size)
+ printf ("Too many nameservers. Truncating to %d addressess", count);
+ if (ret > ret_buf)
+ ret[-1] = '\0';
+ return count;
+ }
}
#endif
@@ -704,7 +824,8 @@ DhcpNameServer
DWORD data_type;
DWORD bytes;
DWORD result;
- char buf[256];
+ char buf[512];
+ win_platform platform;
if (channel->nservers > -1) /* don't override ARES_OPT_SERVER */
return ARES_SUCCESS;
@@ -716,7 +837,9 @@ DhcpNameServer
goto okay;
}
- if (IS_NT())
+ platform = ares__getplatform();
+
+ if (platform == WIN_NT)
{
if (RegOpenKeyEx(
HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0,
@@ -750,7 +873,7 @@ DhcpNameServer
RegCloseKey(mykey);
}
}
- else
+ else if (platform == WIN_9X)
{
if (RegOpenKeyEx(
HKEY_LOCAL_MACHINE, WIN_NS_9X, 0,
@@ -832,7 +955,10 @@ DhcpNameServer
return ARES_ENOMEM;
for (i = 0; def_nameservers[i]; i++)
- servers[i].addr.addrV4.s_addr = htonl(def_nameservers[i]);
+ {
+ servers[i].addr.addrV4.s_addr = htonl(def_nameservers[i]);
+ servers[i].addr.family = AF_INET;
+ }
status = ARES_EOF;
#elif defined(ANDROID)
@@ -856,17 +982,19 @@ DhcpNameServer
if (fp) {
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{
- if ((p = try_config(line, "domain")))
+ if ((p = try_config(line, "domain", ';')))
status = config_domain(channel, p);
- else if ((p = try_config(line, "lookup")) && !channel->lookups)
+ 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", ';')))
status = set_search(channel, p);
- else if ((p = try_config(line, "nameserver")) && channel->nservers == -1)
+ else if ((p = try_config(line, "nameserver", ';')) &&
+ channel->nservers == -1)
status = config_nameserver(&servers, &nservers, p);
- else if ((p = try_config(line, "sortlist")) && channel->nsort == -1)
+ else if ((p = try_config(line, "sortlist", ';')) &&
+ channel->nsort == -1)
status = config_sortlist(&sortlist, &nsort, p);
- else if ((p = try_config(line, "options")))
+ else if ((p = try_config(line, "options", ';')))
status = set_options(channel, p);
else
status = ARES_SUCCESS;
@@ -896,8 +1024,9 @@ DhcpNameServer
if (fp) {
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{
- if ((p = try_config(line, "hosts:")) && !channel->lookups)
- status = config_lookup(channel, p, "dns", "files");
+ if ((p = try_config(line, "hosts:", '\0')) && !channel->lookups)
+ /* ignore errors */
+ (void)config_lookup(channel, p, "dns", "files");
}
fclose(fp);
}
@@ -923,8 +1052,9 @@ DhcpNameServer
if (fp) {
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{
- if ((p = try_config(line, "order")) && !channel->lookups)
- status = config_lookup(channel, p, "bind", "hosts");
+ if ((p = try_config(line, "order", '\0')) && !channel->lookups)
+ /* ignore errors */
+ (void)config_lookup(channel, p, "bind", "hosts");
}
fclose(fp);
}
@@ -950,8 +1080,9 @@ DhcpNameServer
if (fp) {
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{
- if ((p = try_config(line, "hosts=")) && !channel->lookups)
- status = config_lookup(channel, p, "bind", "local");
+ if ((p = try_config(line, "hosts=", '\0')) && !channel->lookups)
+ /* ignore errors */
+ (void)config_lookup(channel, p, "bind", "local");
}
fclose(fp);
}
@@ -1042,10 +1173,13 @@ static int init_by_defaults(ares_channel channel)
channel->nservers = 1;
}
-#ifdef ENAMETOOLONG
-#define toolong(x) (x == -1) && ((ENAMETOOLONG == errno) || (EINVAL == errno))
+#if defined(USE_WINSOCK)
+#define toolong(x) (x == -1) && (SOCKERRNO == WSAEFAULT)
+#elif defined(ENAMETOOLONG)
+#define toolong(x) (x == -1) && ((SOCKERRNO == ENAMETOOLONG) || \
+ (SOCKERRNO == EINVAL))
#else
-#define toolong(x) (x == -1) && (EINVAL == errno)
+#define toolong(x) (x == -1) && (SOCKERRNO == EINVAL)
#endif
if (channel->ndomains == -1) {
@@ -1287,9 +1421,9 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
if (!sortlist_alloc(sortlist, nsort, &pat))
return ARES_ENOMEM;
}
- if (ipbufpfx[0] &&
- (bits = ares_inet_net_pton(AF_INET, ipbufpfx, &pat.addrV4,
- sizeof(pat.addrV4))) > 0)
+ else if (ipbufpfx[0] &&
+ (bits = ares_inet_net_pton(AF_INET, ipbufpfx, &pat.addrV4,
+ sizeof(pat.addrV4))) > 0)
{
pat.type = PATTERN_CIDR;
pat.mask.bits = (unsigned short)bits;
@@ -1426,7 +1560,7 @@ static const char *try_option(const char *p, const char *q, const char *opt)
}
#if !defined(WIN32) && !defined(WATT32)
-static char *try_config(char *s, const char *opt)
+static char *try_config(char *s, const char *opt, char scc)
{
size_t len;
char *p;
@@ -1436,10 +1570,17 @@ static char *try_config(char *s, const char *opt)
/* no line or no option */
return NULL;
+ /* Hash '#' character is always used as primary comment char, additionally
+ a not-NUL secondary comment char will be considered when specified. */
+
/* trim line comment */
p = s;
- while (*p && (*p != '#'))
- p++;
+ if(scc)
+ while (*p && (*p != '#') && (*p != scc))
+ p++;
+ else
+ while (*p && (*p != '#'))
+ p++;
*p = '\0';
/* trim trailing whitespace */
View
221 deps/uv/src/ares/ares_iphlpapi.h
@@ -0,0 +1,221 @@
+#ifndef HEADER_CARES_IPHLPAPI_H
+#define HEADER_CARES_IPHLPAPI_H
+
+/* Copyright 1998 by the Massachusetts Institute of Technology.
+ * 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 that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ */
+
+#if defined(USE_WINSOCK)
+
+#ifndef INET_ADDRSTRLEN
+#define INET_ADDRSTRLEN 22
+#endif
+
+#ifndef INET6_ADDRSTRLEN
+#define INET6_ADDRSTRLEN 65
+#endif
+
+/* ---------------------------------- */
+#if !defined(_WS2DEF_) && \
+ !defined(__CSADDR_DEFINED__) && \
+ !defined(__CSADDR_T_DEFINED)
+/* ---------------------------------- */
+
+typedef struct _SOCKET_ADDRESS {
+ LPSOCKADDR lpSockaddr;
+ INT iSockaddrLength;
+} SOCKET_ADDRESS, *PSOCKET_ADDRESS;
+
+typedef struct _CSADDR_INFO {
+ SOCKET_ADDRESS LocalAddr;
+ SOCKET_ADDRESS RemoteAddr;
+ INT iSocketType;
+ INT iProtocol;
+} CSADDR_INFO, *PCSADDR_INFO;
+
+/* --------------------------------- */
+#endif /* ! _WS2DEF_ && \ */
+/* ! __CSADDR_DEFINED__ && \ */
+/* ! __CSADDR_T_DEFINED */
+/* --------------------------------- */
+
+/* ------------------------------- */
+#if !defined(IP_ADAPTER_DDNS_ENABLED)
+/* ------------------------------- */
+
+#define IP_ADAPTER_ADDRESS_DNS_ELIGIBLE 0x0001
+#define IP_ADAPTER_ADDRESS_TRANSIENT 0x0002
+
+#define IP_ADAPTER_DDNS_ENABLED 0x0001
+#define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX 0x0002
+#define IP_ADAPTER_DHCP_ENABLED 0x0004
+#define IP_ADAPTER_RECEIVE_ONLY 0x0008
+#define IP_ADAPTER_NO_MULTICAST 0x0010
+#define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x0020
+
+#define GAA_FLAG_SKIP_UNICAST 0x0001
+#define GAA_FLAG_SKIP_ANYCAST 0x0002
+#define GAA_FLAG_SKIP_MULTICAST 0x0004
+#define GAA_FLAG_SKIP_DNS_SERVER 0x0008
+#define GAA_FLAG_INCLUDE_PREFIX 0x0010
+#define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020
+
+typedef enum {
+ IpPrefixOriginOther = 0,
+ IpPrefixOriginManual,
+ IpPrefixOriginWellKnown,
+ IpPrefixOriginDhcp,
+ IpPrefixOriginRouterAdvertisement
+} IP_PREFIX_ORIGIN;
+
+typedef enum {
+ IpSuffixOriginOther = 0,
+ IpSuffixOriginManual,
+ IpSuffixOriginWellKnown,
+ IpSuffixOriginDhcp,
+ IpSuffixOriginLinkLayerAddress,
+ IpSuffixOriginRandom
+} IP_SUFFIX_ORIGIN;
+
+typedef enum {
+ IpDadStateInvalid = 0,
+ IpDadStateTentative,
+ IpDadStateDuplicate,
+ IpDadStateDeprecated,
+ IpDadStatePreferred
+} IP_DAD_STATE;
+
+typedef enum {
+ IfOperStatusUp = 1,
+ IfOperStatusDown,
+ IfOperStatusTesting,
+ IfOperStatusUnknown,
+ IfOperStatusDormant,
+ IfOperStatusNotPresent,
+ IfOperStatusLowerLayerDown
+} IF_OPER_STATUS;
+
+typedef enum {
+ ScopeLevelInterface = 0x0001,
+ ScopeLevelLink = 0x0002,
+ ScopeLevelSubnet = 0x0003,
+ ScopeLevelAdmin = 0x0004,
+ ScopeLevelSite = 0x0005,
+ ScopeLevelOrganization = 0x0008,
+ ScopeLevelGlobal = 0x000E
+} SCOPE_LEVEL;
+
+typedef struct _IP_ADAPTER_UNICAST_ADDRESS {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Flags;
+ } s;
+ } u;
+ struct _IP_ADAPTER_UNICAST_ADDRESS *Next;
+ SOCKET_ADDRESS Address;
+ IP_PREFIX_ORIGIN PrefixOrigin;
+ IP_SUFFIX_ORIGIN SuffixOrigin;
+ IP_DAD_STATE DadState;
+ ULONG ValidLifetime;
+ ULONG PreferredLifetime;
+ ULONG LeaseLifetime;
+} IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS;
+
+typedef struct _IP_ADAPTER_ANYCAST_ADDRESS {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Flags;
+ } s;
+ } u;
+ struct _IP_ADAPTER_ANYCAST_ADDRESS *Next;
+ SOCKET_ADDRESS Address;
+} IP_ADAPTER_ANYCAST_ADDRESS, *PIP_ADAPTER_ANYCAST_ADDRESS;
+
+typedef struct _IP_ADAPTER_MULTICAST_ADDRESS {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Flags;
+ } s;
+ } u;
+ struct _IP_ADAPTER_MULTICAST_ADDRESS *Next;
+ SOCKET_ADDRESS Address;
+} IP_ADAPTER_MULTICAST_ADDRESS, *PIP_ADAPTER_MULTICAST_ADDRESS;
+
+typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Reserved;
+ } s;
+ } u;
+ struct _IP_ADAPTER_DNS_SERVER_ADDRESS *Next;
+ SOCKET_ADDRESS Address;
+} IP_ADAPTER_DNS_SERVER_ADDRESS, *PIP_ADAPTER_DNS_SERVER_ADDRESS;
+
+typedef struct _IP_ADAPTER_PREFIX {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD Flags;
+ } s;
+ } u;
+ struct _IP_ADAPTER_PREFIX *Next;
+ SOCKET_ADDRESS Address;
+ ULONG PrefixLength;
+} IP_ADAPTER_PREFIX, *PIP_ADAPTER_PREFIX;
+
+typedef struct _IP_ADAPTER_ADDRESSES {
+ union {
+ ULONGLONG Alignment;
+ struct {
+ ULONG Length;
+ DWORD IfIndex;
+ } s;
+ } u;
+ struct _IP_ADAPTER_ADDRESSES *Next;
+ PCHAR AdapterName;
+ PIP_ADAPTER_UNICAST_ADDRESS FirstUnicastAddress;
+ PIP_ADAPTER_ANYCAST_ADDRESS FirstAnycastAddress;
+ PIP_ADAPTER_MULTICAST_ADDRESS FirstMulticastAddress;
+ PIP_ADAPTER_DNS_SERVER_ADDRESS FirstDnsServerAddress;
+ PWCHAR DnsSuffix;
+ PWCHAR Description;
+ PWCHAR FriendlyName;
+ BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
+ DWORD PhysicalAddressLength;
+ DWORD Flags;
+ DWORD Mtu;
+ DWORD IfType;
+ IF_OPER_STATUS OperStatus;
+ DWORD Ipv6IfIndex;
+ DWORD ZoneIndices[16];
+ PIP_ADAPTER_PREFIX FirstPrefix;
+} IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES;
+
+/* -------------------------------- */
+#endif /* ! IP_ADAPTER_DDNS_ENABLED */
+/* -------------------------------- */
+
+#endif /* USE_WINSOCK */
+
+#endif /* HEADER_CARES_IPHLPAPI_H */
View
10 deps/uv/src/ares/ares_library_init.c
@@ -26,6 +26,7 @@
#ifdef USE_WINSOCK
fpGetNetworkParams_t ares_fpGetNetworkParams = ZERO_NULL;
fpSystemFunction036_t ares_fpSystemFunction036 = ZERO_NULL;
+fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses = ZERO_NULL;
#endif
/* library-private global vars with source visibility restricted to this file */
@@ -56,6 +57,15 @@ static int ares_win32_init(void)
return ARES_EADDRGETNETWORKPARAMS;
}
+ ares_fpGetAdaptersAddresses = (fpGetAdaptersAddresses_t)
+ GetProcAddress(hnd_iphlpapi, "GetAdaptersAddresses");
+ if (!ares_fpGetAdaptersAddresses)
+ {
+ /* This can happen on clients before WinXP, I don't
+ think it should be an error, unless we don't want to
+ support Windows 2000 anymore */
+ }
+
/*
* When advapi32.dll is unavailable or advapi32.dll has no SystemFunction036,
* also known as RtlGenRandom, which is the case for Windows versions prior
View
5 deps/uv/src/ares/ares_library_init.h
@@ -3,7 +3,7 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
- * Copyright (C) 2004-2009 by Daniel Stenberg
+ * Copyright (C) 2004-2011 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -23,15 +23,18 @@
#ifdef USE_WINSOCK
#include <iphlpapi.h>
+#include "ares_iphlpapi.h"
typedef DWORD (WINAPI *fpGetNetworkParams_t) (FIXED_INFO*, DWORD*);
typedef BOOLEAN (APIENTRY *fpSystemFunction036_t) (void*, ULONG);
+typedef ULONG (WINAPI *fpGetAdaptersAddresses_t) ( ULONG, ULONG, void*, IP_ADAPTER_ADDRESSES*, ULONG* );
/* Forward-declaration of variables defined in ares_library_init.c */
/* that are global and unique instances for whole c-ares library. */
extern fpGetNetworkParams_t ares_fpGetNetworkParams;
extern fpSystemFunction036_t ares_fpSystemFunction036;
+extern fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses;
#endif /* USE_WINSOCK */
View
130 deps/uv/src/ares/ares_nowarn.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 2010 by Daniel Stenberg
+/* Copyright (C) 2010-2011 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -17,13 +17,44 @@
#include "ares_setup.h"
+#ifdef HAVE_ASSERT_H
+# include <assert.h>
+#endif
+
+#if defined(__INTEL_COMPILER) && defined(__unix__)
+
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
+
+#endif /* __INTEL_COMPILER && __unix__ */
+
+#define BUILDING_ARES_NOWARN_C 1
+
#include "ares_nowarn.h"
-#define CARES_MASK_UINT (~(unsigned int) 0)
-#define CARES_MASK_SINT (CARES_MASK_UINT >> 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
+#endif
/*
-** size_t to signed int
+** unsigned size_t to signed int
*/
int aresx_uztosi(size_t uznum)
@@ -51,9 +82,100 @@ int aresx_sltosi(long slnum)
# pragma warning(disable:810) /* conversion may lose significant bits */
#endif
+ DEBUGASSERT(slnum >= 0);
return (int)(slnum & (long) CARES_MASK_SINT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#endif
}
+
+/*
+** signed ssize_t to signed int
+*/
+
+int aresx_sztosi(ssize_t sznum)
+{
+#ifdef __INTEL_COMPILER
+# pragma warning(push)
+# pragma warning(disable:810) /* conversion may lose significant bits */
+#endif
+
+ DEBUGASSERT(sznum >= 0);
+ return (int)(sznum & (ssize_t) CARES_MASK_SINT);
+
+#ifdef __INTEL_COMPILER
+# pragma warning(pop)
+#endif
+}
+
+/*
+** signed ssize_t to unsigned int
+*/
+
+unsigned int aresx_sztoui(ssize_t sznum)
+{
+#ifdef __INTEL_COMPILER
+# pragma warning(push)
+# pragma warning(disable:810) /* conversion may lose significant bits */
+#endif
+
+ DEBUGASSERT(sznum >= 0);
+ return (unsigned int)(sznum & (ssize_t) CARES_MASK_UINT);
+
+#ifdef __INTEL_COMPILER
+# pragma warning(pop)
+#endif
+}
+
+#if defined(__INTEL_COMPILER) && defined(__unix__)
+
+int aresx_FD_ISSET(int fd, fd_set *fdset)
+{
+ #pragma warning(push)
+ #pragma warning(disable:1469) /* clobber ignored */
+ return FD_ISSET(fd, fdset);
+ #pragma warning(pop)
+}
+
+void aresx_FD_SET(int fd, fd_set *fdset)
+{
+ #pragma warning(push)
+ #pragma warning(disable:1469) /* clobber ignored */
+ FD_SET(fd, fdset);
+ #pragma warning(pop)
+}
+
+void aresx_FD_ZERO(fd_set *fdset)
+{
+ #pragma warning(push)
+ #pragma warning(disable:593) /* variable was set but never used */
+ FD_ZERO(fdset);
+ #pragma warning(pop)
+}
+
+unsigned short aresx_htons(unsigned short usnum)
+{
+#if (__INTEL_COMPILER == 910) && defined(__i386__)
+ return (unsigned short)(((usnum << 8) & 0xFF00) | ((usnum >> 8) & 0x00FF));
+#else
+ #pragma warning(push)
+ #pragma warning(disable:810) /* conversion may lose significant bits */
+ return htons(usnum);
+ #pragma warning(pop)
+#endif
+}
+
+unsigned short aresx_ntohs(unsigned short usnum)
+{
+#if (__INTEL_COMPILER == 910) && defined(__i386__)
+ return (unsigned short)(((usnum << 8) & 0xFF00) | ((usnum >> 8) & 0x00FF));
+#else
+ #pragma warning(push)
+ #pragma warning(disable:810) /* conversion may lose significant bits */
+ return ntohs(usnum);
+ #pragma warning(pop)
+#endif
+}
+
+#endif /* __INTEL_COMPILER && __unix__ */
View
33 deps/uv/src/ares/ares_nowarn.h
@@ -2,7 +2,7 @@
#define HEADER_CARES_NOWARN_H
-/* Copyright (C) 2010 by Daniel Stenberg
+/* Copyright (C) 2010-2011 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -21,4 +21,35 @@ int aresx_uztosi(size_t uznum);
int aresx_sltosi(long slnum);
+int aresx_sztosi(ssize_t sznum);
+
+unsigned int aresx_sztoui(ssize_t sznum);
+
+#if defined(__INTEL_COMPILER) && defined(__unix__)
+
+int aresx_FD_ISSET(int fd, fd_set *fdset);
+
+void aresx_FD_SET(int fd, fd_set *fdset);
+
+void aresx_FD_ZERO(fd_set *fdset);
+
+unsigned short aresx_htons(unsigned short usnum);
+
+unsigned short aresx_ntohs(unsigned short usnum);
+
+#ifndef BUILDING_ARES_NOWARN_C
+# undef FD_ISSET
+# define FD_ISSET(a,b) aresx_FD_ISSET((a),(b))
+# undef FD_SET
+# define FD_SET(a,b) aresx_FD_SET((a),(b))
+# undef FD_ZERO
+# define FD_ZERO(a) aresx_FD_ZERO((a))
+# undef htons
+# define htons(a) aresx_htons((a))
+# undef ntohs
+# define ntohs(a) aresx_ntohs((a))
+#endif
+
+#endif /* __INTEL_COMPILER && __unix__ */
+
#endif /* HEADER_CARES_NOWARN_H */
View
13 deps/uv/src/ares/ares_options.c
@@ -1,6 +1,6 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
- * Copyright (C) 2008-2010 by Daniel Stenberg
+ * Copyright (C) 2008-2011 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -135,12 +135,10 @@ int ares_set_servers(ares_channel channel,
int ares_set_servers_csv(ares_channel channel,
const char* _csv)
{
- int i;
+ size_t i;
char* csv = NULL;
char* ptr;
char* start_host;
- long port;
- bool found_port;
int rv = ARES_SUCCESS;
struct ares_addr_node *servers = NULL;
struct ares_addr_node *last = NULL;
@@ -165,7 +163,6 @@ int ares_set_servers_csv(ares_channel channel,
}
start_host = csv;
- found_port = false;
for (ptr = csv; *ptr; ptr++) {
if (*ptr == ',') {
char* pp = ptr - 1;
@@ -186,9 +183,8 @@ int ares_set_servers_csv(ares_channel channel,
pp--;
}
if ((pp != start_host) && ((pp + 1) < ptr)) {
- /* Found it. */
- found_port = true;
- port = strtol(pp + 1, NULL, 10);
+ /* Found it. Parse over the port number */
+ (void)strtol(pp + 1, NULL, 10);
*pp = 0; /* null terminate host */
}
/* resolve host, try ipv4 first, rslt is in network byte order */
@@ -233,7 +229,6 @@ int ares_set_servers_csv(ares_channel channel,
}
/* Set up for next one */
- found_port = false;
start_host = ptr + 1;
}
}
View
3 deps/uv/src/ares/ares_parse_a_reply.c
@@ -132,6 +132,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
{
+ free(rr_name);
status = ARES_EBADRESP;
break;
}
@@ -149,6 +150,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
{
if (aptr + sizeof(struct in_addr) > abuf + alen)
{
+ free(rr_name);
status = ARES_EBADRESP;
break;
}
@@ -159,6 +161,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
struct ares_addrttl * const at = &addrttls[naddrs];
if (aptr + sizeof(struct in_addr) > abuf + alen)
{
+ free(rr_name);
status = ARES_EBADRESP;
break;
}
View
3 deps/uv/src/ares/ares_parse_aaaa_reply.c
@@ -132,6 +132,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
{
+ free(rr_name);
status = ARES_EBADRESP;
break;
}
@@ -149,6 +150,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
{
if (aptr + sizeof(struct ares_in6_addr) > abuf + alen)
{
+ free(rr_name);
status = ARES_EBADRESP;
break;
}
@@ -159,6 +161,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
struct ares_addr6ttl * const at = &addrttls[naddrs];
if (aptr + sizeof(struct ares_in6_addr) > abuf + alen)
{
+ free(rr_name);
status = ARES_EBADRESP;
break;
}
View
4 deps/uv/src/ares/ares_parse_mx_reply.c
@@ -47,7 +47,7 @@
int
ares_parse_mx_reply (const unsigned char *abuf, int alen,
- struct ares_mx_reply **mx_out)
+ struct ares_mx_reply **mx_out)
{
unsigned int qdcount, ancount, i;
const unsigned char *aptr, *vptr;
@@ -134,7 +134,7 @@ ares_parse_mx_reply (const unsigned char *abuf, int alen,
mx_last = mx_curr;
vptr = aptr;
- mx_curr->priority = ntohs (*((unsigned short *)vptr));
+ mx_curr->priority = DNS__16BIT(vptr);
vptr += sizeof(unsigned short);
status = ares_expand_name (vptr, abuf, alen, &mx_curr->host, &len);
View
4 deps/uv/src/ares/ares_parse_ns_reply.c
@@ -1,5 +1,3 @@
-/* $Id */
-
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
@@ -105,6 +103,7 @@ int ares_parse_ns_reply( const unsigned char* abuf, int alen,
if ( aptr + RRFIXEDSZ > abuf + alen )
{
status = ARES_EBADRESP;
+ free(rr_name);
break;
}
rr_type = DNS_RR_TYPE( aptr );
@@ -119,6 +118,7 @@ int ares_parse_ns_reply( const unsigned char* abuf, int alen,
&len);
if ( status != ARES_SUCCESS )
{
+ free(rr_name);
break;
}
View
15 deps/uv/src/ares/ares_parse_ptr_reply.c
@@ -99,6 +99,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
{
+ free(rr_name);
status = ARES_EBADRESP;
break;
}
@@ -114,13 +115,17 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
&len);
if (status != ARES_SUCCESS)
- break;
+ {
+ free(rr_name);
+ break;
+ }
if (hostname)
free(hostname);
hostname = rr_data;
- aliases[aliascnt] = malloc((strlen(rr_data)+1) * sizeof(char *));
+ aliases[aliascnt] = malloc((strlen(rr_data)+1) * sizeof(char));
if (!aliases[aliascnt])
{
+ free(rr_name);
status = ARES_ENOMEM;
break;
}
@@ -131,6 +136,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
alias_alloc *= 2;
ptr = realloc(aliases, alias_alloc * sizeof(char *));
if(!ptr) {
+ free(rr_name);
status = ARES_ENOMEM;
break;
}
@@ -144,7 +150,10 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
&len);
if (status != ARES_SUCCESS)
- break;
+ {
+ free(rr_name);
+ break;
+ }
free(ptrname);
ptrname = rr_data;
}
View
6 deps/uv/src/ares/ares_parse_srv_reply.c
@@ -139,11 +139,11 @@ ares_parse_srv_reply (const unsigned char *abuf, int alen,
srv_last = srv_curr;
vptr = aptr;
- srv_curr->priority = ntohs (*((unsigned short *)vptr));
+ srv_curr->priority = DNS__16BIT(vptr);
vptr += sizeof(unsigned short);
- srv_curr->weight = ntohs (*((unsigned short *)vptr));
+ srv_curr->weight = DNS__16BIT(vptr);
vptr += sizeof(unsigned short);
- srv_curr->port = ntohs (*((unsigned short *)vptr));
+ srv_curr->port = DNS__16BIT(vptr);
vptr += sizeof(unsigned short);
status = ares_expand_name (vptr, abuf, alen, &srv_curr->host, &len);
View
11,035 deps/uv/src/ares/ares_platform.c
11,035 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
43 deps/uv/src/ares/ares_platform.h
@@ -0,0 +1,43 @@
+#ifndef HEADER_CARES_PLATFORM_H
+#define HEADER_CARES_PLATFORM_H
+
+
+/* Copyright 1998 by the Massachusetts Institute of Technology.
+ * 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 that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ */
+
+#include "ares_setup.h"
+
+#if defined(WIN32) && !defined(MSDOS)
+
+typedef enum {
+ WIN_UNKNOWN,
+ WIN_3X,
+ WIN_9X,
+ WIN_NT,
+ WIN_CE
+} win_platform;
+
+win_platform ares__getplatform(void);
+
+#endif
+
+#if defined(_WIN32_WCE)
+
+struct servent *getservbyport(int port, const char *proto);
+
+#endif
+
+#endif /* HEADER_CARES_PLATFORM_H */
View
8 deps/uv/src/ares/ares_private.h
@@ -52,7 +52,6 @@
#if defined(WIN32) && !defined(WATT32)
-#define IS_NT() ((int)GetVersion() > 0)
#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP"
#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
#define NAMESERVER "NameServer"
@@ -89,6 +88,11 @@
#include "ares_ipv6.h"
#include "ares_llist.h"
+#ifndef HAVE_GETENV
+# include "ares_getenv.h"
+# define getenv(ptr) ares_getenv(ptr)
+#endif
+
#ifndef HAVE_STRDUP
# include "ares_strdup.h"
# define strdup(ptr) ares_strdup(ptr)
@@ -199,7 +203,7 @@ struct query {
void *arg;
/* Query status */
- int try; /* Number of times we tried this query already. */
+ int try_count; /* Number of times we tried this query already. */
int server; /* Server this query has last been sent to. */
struct query_server_info *server_info; /* per-server state */
int using_tcp;
View
49 deps/uv/src/ares/ares_process.c
@@ -63,10 +63,10 @@
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
-#include <errno.h>
#include "ares.h"
#include "ares_dns.h"
+#include "ares_nowarn.h"
#include "ares_private.h"
@@ -300,29 +300,28 @@ static void advance_tcp_send_queue(ares_channel channel, int whichserver,
{
struct send_request *sendreq;
struct server_state *server = &channel->servers[whichserver];
- while (num_bytes > 0)
- {
- sendreq = server->qhead;
- if ((size_t)num_bytes >= sendreq->len)
- {
- num_bytes -= sendreq->len;
- server->qhead = sendreq->next;
- if (server->qhead == NULL)
- {
- SOCK_STATE_CALLBACK(channel, server->tcp_socket, 1, 0);
- server->qtail = NULL;
- }
- if (sendreq->data_storage != NULL)
- free(sendreq->data_storage);
- free(sendreq);
- }
- else
- {
- sendreq->data += num_bytes;
- sendreq->len -= num_bytes;
- num_bytes = 0;
- }
+ while (num_bytes > 0) {
+ sendreq = server->qhead;
+ if ((size_t)num_bytes >= sendreq->len) {
+ num_bytes -= sendreq->len;
+ server->qhead = sendreq->next;
+ if (sendreq->data_storage)
+ free(sendreq->data_storage);
+ free(sendreq);
+ if (server->qhead == NULL) {
+ SOCK_STATE_CALLBACK(channel, server->tcp_socket, 1, 0);
+ server->qtail = NULL;
+
+ /* qhead is NULL so we cannot continue this loop */
+ break;
+ }
+ }
+ else {
+ sendreq->data += num_bytes;
+ sendreq->len -= num_bytes;
+ num_bytes = 0;
}
+ }
}
/* If any TCP socket selects true for reading, read some data,
@@ -686,7 +685,7 @@ static void next_server(ares_channel channel, struct query *query,
* servers to try. In total, we need to do channel->nservers * channel->tries
* attempts. Use query->try to remember how many times we already attempted
* this query. Use modular arithmetic to find the next server to try. */
- while (++(query->try) < (channel->nservers * channel->tries))
+ while (++(query->try_count) < (channel->nservers * channel->tries))
{
struct server_state *server;
@@ -791,7 +790,7 @@ void ares__send_query(ares_channel channel, struct query *query,
return;
}
}
- timeplus = channel->timeout << (query->try / channel->nservers);
+ timeplus = channel->timeout << (query->try_count / channel->nservers);
timeplus = (timeplus * (9 + (rand () & 7))) / 16;
query->timeout = *now;
ares__timeadd(&query->timeout,
View
3 deps/uv/src/ares/ares_search.c
@@ -20,7 +20,6 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include <errno.h>
#ifdef HAVE_STRINGS_H
# include <strings.h>
@@ -292,7 +291,7 @@ static int single_domain(ares_channel channel, const char *name, char **s)
}
else
{
- error = errno;
+ error = ERRNO;
switch(error)
{
case ENOENT:
View
2 deps/uv/src/ares/ares_send.c
@@ -96,7 +96,7 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen,
query->arg = arg;
/* Initialize query status. */
- query->try = 0;
+ query->try_count = 0;
/* Choose the server to send the query to. If rotation is enabled, keep track
* of the next server we want to use. */
View
16 deps/uv/src/ares/ares_setup.h
@@ -1,7 +1,6 @@
#ifndef HEADER_CARES_SETUP_H
#define HEADER_CARES_SETUP_H
-/* $Id$ */
/* Copyright (C) 2004 - 2009 by Daniel Stenberg et al
*
@@ -31,6 +30,12 @@
#ifdef HAVE_CONFIG_H
#include "ares_config.h"
+#else
+
+#ifdef WIN32
+#include "config-win32.h"
+#endif
+
#endif /* HAVE_CONFIG_H */
/* ================================================================ */
@@ -70,7 +75,7 @@
/* please, do it beyond the point further indicated in this file. */
/* ================================================================ */
-#if 0 /* libuv disabled */
+#if 0 /* libuv hack */
/*
* c-ares external interface definitions are also used internally,
* and might also include required system header files to define them.
@@ -83,7 +88,7 @@
*/
#include <ares_rules.h>
-#endif
+#endif /* libuv hack */
/* ================================================================= */
/* No system header file shall be included in this file before this */
@@ -102,6 +107,10 @@
*/
#ifdef HAVE_WINDOWS_H
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h>
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
# ifdef HAVE_WS2TCPIP_H
@@ -112,7 +121,6 @@
# include <winsock.h>
# endif
# endif
-# include <windows.h>
#endif
/*
View
2 deps/uv/src/ares/config_cygwin/ares_config.h
@@ -508,3 +508,5 @@
/* the signed version of size_t */
/* #undef ssize_t */
+
+#define HAVE_GETENV 1
View
2 deps/uv/src/ares/config_darwin/ares_config.h
@@ -508,3 +508,5 @@
/* the signed version of size_t */
/* #undef ssize_t */