aboutsummaryrefslogtreecommitdiff
path: root/scanner.l
diff options
context:
space:
mode:
Diffstat (limited to 'scanner.l')
-rw-r--r--scanner.l29
1 files changed, 28 insertions, 1 deletions
diff --git a/scanner.l b/scanner.l
index 74255289..2c12cac5 100644
--- a/scanner.l
+++ b/scanner.l
@@ -42,7 +42,32 @@
#include "gencode.h"
#ifdef INET6
-#ifndef _WIN32
+
+#ifdef _WIN32
+/*
+ * To quote the MSDN page for getaddrinfo() at
+ *
+ * https://msdn.microsoft.com/en-us/library/windows/desktop/ms738520(v=vs.85).aspx
+ *
+ * "Support for getaddrinfo on Windows 2000 and older versions
+ * The getaddrinfo function was added to the Ws2_32.dll on Windows XP and
+ * later. To execute an application that uses this function on earlier
+ * versions of Windows, then you need to include the Ws2tcpip.h and
+ * Wspiapi.h files. When the Wspiapi.h include file is added, the
+ * getaddrinfo function is defined to the WspiapiGetAddrInfo inline
+ * function in the Wspiapi.h file. At runtime, the WspiapiGetAddrInfo
+ * function is implemented in such a way that if the Ws2_32.dll or the
+ * Wship6.dll (the file containing getaddrinfo in the IPv6 Technology
+ * Preview for Windows 2000) does not include getaddrinfo, then a
+ * version of getaddrinfo is implemented inline based on code in the
+ * Wspiapi.h header file. This inline code will be used on older Windows
+ * platforms that do not natively support the getaddrinfo function."
+ *
+ * We use getaddrinfo(), so we include Wspiapi.h here. pcap-stdinc.h
+ * includes Ws2tcpip.h, so we don't need to include it ourselves.
+ */
+#include <Wspiapi.h>
+#else /* _WIN32 */
#include <sys/socket.h> /* for "struct sockaddr" in "struct addrinfo" */
#include <netdb.h> /* for "struct addrinfo" */
#endif /* _WIN32 */
@@ -51,7 +76,9 @@
#if !defined(AI_NUMERICHOST)
#define AI_NUMERICHOST 0x04
#endif
+
#endif /*INET6*/
+
#include <pcap/namedb.h>
#include "tokdefs.h"