Commit 14358640 authored by Yang Tse's avatar Yang Tse
Browse files

Definitions of resolver specialty compile-time defines CURLRES_* moved

from hostip.h to setup.h in order to allow proper inclusion in any file.

This represents no functional change at all in which resolver is used,
everything still works as usual, internally and externally there is no
difference in behavior.
parent 4a8a7314
Loading
Loading
Loading
Loading
+1 −26
Original line number Diff line number Diff line
@@ -37,38 +37,13 @@
#endif

/*
 * Setup comfortable CURLRES_* defines to use in the host*.c sources.
 * Comfortable CURLRES_* definitions are included from setup.h
 */

#ifdef USE_ARES
#include <ares_version.h>
#endif

#ifdef USE_ARES
#define CURLRES_ASYNCH
#define CURLRES_ARES
#endif

#ifdef USE_THREADING_GETHOSTBYNAME
#define CURLRES_ASYNCH
#define CURLRES_THREADED
#endif

#ifdef USE_THREADING_GETADDRINFO
#define CURLRES_ASYNCH
#define CURLRES_THREADED
#endif

#ifdef ENABLE_IPV6
#define CURLRES_IPV6
#else
#define CURLRES_IPV4
#endif

#ifndef CURLRES_ASYNCH
#define CURLRES_SYNCH
#endif

/* Allocate enough memory to hold the full name information structs and
 * everything. OSF1 is known to require at least 8872 bytes. The buffer
 * required for storing all possible aliases and IP numbers is according to
+48 −14
Original line number Diff line number Diff line
@@ -407,6 +407,27 @@

#endif /* WIN32 */

/*
 * msvc 6.0 requires PSDK in order to have INET6_ADDRSTRLEN
 * defined in ws2tcpip.h as well as to provide IPv6 support.
 */

#if defined(_MSC_VER) && !defined(__POCC__)
#  if !defined(HAVE_WS2TCPIP_H) || \
     ((_MSC_VER < 1300) && !defined(INET6_ADDRSTRLEN))
#    undef HAVE_GETADDRINFO_THREADSAFE
#    undef HAVE_FREEADDRINFO
#    undef HAVE_GETADDRINFO
#    undef HAVE_GETNAMEINFO
#    undef ENABLE_IPV6
#  endif
#endif

/* ---------------------------------------------------------------- */
/*             resolver specialty compile-time defines              */
/*         CURLRES_* defines to use in the host*.c sources          */
/* ---------------------------------------------------------------- */

#if defined(WIN32) && !defined(__CYGWIN__) && !defined(USE_ARES) && \
    !defined(__LCC__)  /* lcc-win32 doesn't have _beginthreadex() */
#ifdef ENABLE_IPV6
@@ -424,6 +445,33 @@
#define CURL_NO__BEGINTHREADEX
#endif

#ifdef USE_ARES
#  define CURLRES_ASYNCH
#  define CURLRES_ARES
#endif

#ifdef USE_THREADING_GETHOSTBYNAME
#  define CURLRES_ASYNCH
#  define CURLRES_THREADED
#endif

#ifdef USE_THREADING_GETADDRINFO
#  define CURLRES_ASYNCH
#  define CURLRES_THREADED
#endif

#ifdef ENABLE_IPV6
#  define CURLRES_IPV6
#else
#  define CURLRES_IPV4
#endif

#ifndef CURLRES_ASYNCH
#  define CURLRES_SYNCH
#endif

/* ---------------------------------------------------------------- */

/*
 * When using WINSOCK, TELNET protocol requires WINSOCK2 API.
 */
@@ -444,20 +492,6 @@
#  endif
#endif

/*
 * msvc 6.0 requires PSDK in order to have INET6_ADDRSTRLEN
 * defined in ws2tcpip.h as well as to provide IPv6 support.
 */

#if defined(_MSC_VER) && !defined(__POCC__)
#  if !defined(HAVE_WS2TCPIP_H) || ((_MSC_VER < 1300) && !defined(INET6_ADDRSTRLEN))
#    undef HAVE_FREEADDRINFO
#    undef HAVE_GETADDRINFO
#    undef HAVE_GETNAMEINFO
#    undef ENABLE_IPV6
#  endif
#endif

/*
 * Intentionally fail to build when using msvc 6.0 without PSDK installed.
 * The brave of heart can circumvent this, defining ALLOW_MSVC6_WITHOUT_PSDK
+1 −2
Original line number Diff line number Diff line
@@ -5044,8 +5044,7 @@ CURLcode Curl_connect(struct SessionHandle *data,
CURLcode Curl_async_resolved(struct connectdata *conn,
                             bool *protocol_done)
{
#if defined(USE_ARES) || defined(USE_THREADING_GETHOSTBYNAME) || \
    defined(USE_THREADING_GETADDRINFO)
#ifdef CURLRES_ASYNCH
  CURLcode code;

  if(conn->async.dns) {
+2 −4
Original line number Diff line number Diff line
@@ -436,8 +436,7 @@ typedef enum {
} zlibInitState;
#endif

#if defined(USE_ARES) || defined(USE_THREADING_GETHOSTBYNAME) || \
    defined(USE_THREADING_GETADDRINFO)
#ifdef CURLRES_ASYNCH
struct Curl_async {
  char *hostname;
  int port;
@@ -813,8 +812,7 @@ struct connectdata {

  char syserr_buf [256]; /* buffer for Curl_strerror() */

#if defined(USE_ARES) || defined(USE_THREADING_GETHOSTBYNAME) || \
    defined(USE_THREADING_GETADDRINFO)
#ifdef CURLRES_ASYNCH
  /* data used for the asynch name resolve callback */
  struct Curl_async async;
#endif