diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-09-05 12:56:02 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-09-05 12:56:02 -0700 |
commit | d7c711dec95c78d6b638f54e3761bba095042992 (patch) | |
tree | f0d2e5332a398557c5c04fbd4e53f64b78483166 | |
parent | 3f508412a0919ce11723b44a87dc37876f7b7ca7 (diff) |
On Windows, include winsock2.h in pcap-types.h.
pcap-types.h is supposed to arrange that u_int be defined; on Windows,
you have to include winsock2.h for that, just as, on UN*X, you generally
have to include sys/types.h for that (and we do include it).
-rw-r--r-- | pcap-stdinc.h | 12 | ||||
-rw-r--r-- | pcap-types.h | 19 |
2 files changed, 20 insertions, 11 deletions
diff --git a/pcap-stdinc.h b/pcap-stdinc.h index 9ea1f681..28edd5d3 100644 --- a/pcap-stdinc.h +++ b/pcap-stdinc.h @@ -60,22 +60,12 @@ #ifndef pcap_stdinc_h #define pcap_stdinc_h -/* - * Avoids a compiler warning in case this was already defined - * (someone defined _WINSOCKAPI_ when including 'windows.h', in order - * to prevent it from including 'winsock.h') - */ -#ifdef _WINSOCKAPI_ -#undef _WINSOCKAPI_ -#endif +#include <pcap-types.h> -#include <winsock2.h> #include <fcntl.h> #include <time.h> #include <io.h> #include <ws2tcpip.h> -#include <pcap-types.h> - #endif /* pcap_stdinc_h */ diff --git a/pcap-types.h b/pcap-types.h index 7c318d09..bb264c3e 100644 --- a/pcap-types.h +++ b/pcap-types.h @@ -34,6 +34,22 @@ /* * Get the integer types we use defined, by hook or by crook. */ +#ifdef _WIN32 +/* + * Avoids a compiler warning in case this was already defined + * (someone defined _WINSOCKAPI_ when including 'windows.h', in order + * to prevent it from including 'winsock.h') + */ +#ifdef _WINSOCKAPI_ +#undef _WINSOCKAPI_ +#endif + +/* + * This defines u_int. + */ +#include <winsock2.h> +#endif + #if defined(_MSC_VER) /* * Target is Windows, compiler is MSVC. @@ -94,6 +110,9 @@ #ifdef HAVE_SYS_BITYPES_H #include <sys/bitypes.h> #endif + /* + * This defines u_int, among other types. + */ #include <sys/types.h> #endif |