]> granicus.if.org Git - curl/commitdiff
config-win32: add support for if_nametoindex and getsockname
authorZenju <zenju@gmx.de>
Wed, 22 May 2019 09:11:36 +0000 (11:11 +0200)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Thu, 23 May 2019 09:10:28 +0000 (11:10 +0200)
Closes https://github.com/curl/curl/pull/3923

lib/config-win32.h
lib/url.c

index 24c35d339bab29111c3a79f9898a931f6595304d..08cfd0d4cb9d9571134acdab3b4b015a324d7a05 100644 (file)
 #define HAVE_WS2TCPIP_H 1
 #endif
 
+/* Define if you have the <Iphlpapi.h> header file. */
+#ifndef __SALFORDC__
+#define HAVE_IPHLPAPI_H 1
+#endif
+
 /* ---------------------------------------------------------------- */
 /*                        OTHER HEADER INFO                         */
 /* ---------------------------------------------------------------- */
 /* Define to 1 if you have the `getpeername' function. */
 #define HAVE_GETPEERNAME 1
 
+/* Define to 1 if you have the getsockname function. */
+#define HAVE_GETSOCKNAME 1
+
 /* Define if you have the gethostbyaddr function. */
 #define HAVE_GETHOSTBYADDR 1
 
@@ -582,8 +590,9 @@ Vista
 #  endif
 #endif
 
-/* Availability of freeaddrinfo, getaddrinfo and getnameinfo functions is
-   quite convoluted, compiler dependent and even build target dependent. */
+/* Availability of freeaddrinfo, getaddrinfo, getnameinfo and if_nametoindex
+   functions is quite convoluted, compiler dependent and even build target
+   dependent. */
 #if defined(HAVE_WS2TCPIP_H)
 #  if defined(__POCC__)
 #    define HAVE_FREEADDRINFO           1
@@ -602,6 +611,11 @@ Vista
 #    define HAVE_GETNAMEINFO            1
 #  endif
 #endif
+#if defined(HAVE_IPHLPAPI_H)
+  #if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
+    #define HAVE_IF_NAMETOINDEX 1
+  #endif
+#endif
 
 #if defined(__POCC__)
 #  ifndef _MSC_VER
index db76fa65662fca4d19d7d28c50c9a5e5b2f0b3ac..b5169485f9ad307ba4956c52ac14601905ccba43 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
 #ifdef HAVE_NET_IF_H
 #include <net/if.h>
 #endif
+#ifdef HAVE_IPHLPAPI_H
+#include <Iphlpapi.h>
+#endif
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
-
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #endif