#include winsock2.h pulls in about 90 distinct .h files
and about 140 total .h files.
Currently winsock2.h is (mostly unnecessarily) included
for each dissector via packet.h/wtap.h.
This patch removes #include winsock2.h from wtap.h and
then includes winsock2.h (or windows.h) in the
few specific places required.
With this patch, my Windows Wireshark build takes
about 30% less time.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@26535
f5534014-38df-0310-8fa8-
9805f1628bb7
#pragma warning( disable : 4996)
#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
#include <glib.h>
#include <gmodule.h>
-#include <wtap.h>
#include <pcap.h>
/* XXX - yes, I know, I should move cppmagic.h to a generic location. */
#include <epan/value_string.h>
+#include <Packet32.h>
+#include <windows.h>
+#include <windowsx.h>
+#include <Ntddndis.h>
+#include "capture_wpcap_packet.h"
/* packet32.h requires sockaddr_storage
- * wether sockaddr_storage is defined or not depends on the Platform SDK
+ * whether sockaddr_storage is defined or not depends on the Platform SDK
* version installed. The only one not defining it is the SDK that comes
* with MSVC 6.0 (WINVER 0x0400).
*
* copied from RFC2553 (and slightly modified because of datatypes) ...
* XXX - defined more than once, move this to a header file */
+#ifndef WINVER
+#error WINVER not defined ....
+#endif
#if (WINVER <= 0x0400) && defined(_MSC_VER)
typedef unsigned short eth_sa_family_t;
#endif /* WINVER */
-#include <Packet32.h>
-#include <windows.h>
-#include <windowsx.h>
-#include <Ntddndis.h>
-
-#include "capture_wpcap_packet.h"
-
gboolean has_wpacket = FALSE;
#ifdef _WIN32
#include <process.h> /* getpid */
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
#endif
#ifdef NEED_STRPTIME_H
#include <netinet/in.h>
#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
#include <string.h>
#include <glib.h>
#include <sys/socket.h>
#endif
+#if HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
#include <glib.h>
#include <epan/conversation.h>
# include "config.h"
#endif
+#ifdef _MSC_VER
+#include <windows.h>
+#endif
+
+
#include <glib.h>
#include <epan/packet.h>
#include <epan/timestamp.h>
#include "packet-wps.h"
-#ifdef HAVE_AIRPCAP
-#include <airpcap.h>
-#include <airpcap_loader.h>
-#else
-/* XXX - This is probably a bit much */
-#define MAX_ENCRYPTION_KEYS 64
-#endif
-
#ifndef roundup2
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
#include <glib.h>
#include "../globals.h"
#include "../file.h"
#include "../capture.h"
-#include "../capture_wpcap_packet.h"
#include "../simple_dialog.h"
-#include <wiretap/wtap.h>
#include "gtk/main.h"
#include "gtk/dlg_utils.h"
#include "gtk/gtkvumeter.h"
#include "gtk/capture_if_details_dlg_win32.h"
+#include <Packet32.h>
+#include <windows.h>
+#include <windowsx.h>
+#include <Ntddndis.h>
+#include "../capture_wpcap_packet.h"
/* packet32.h requires sockaddr_storage
- * wether sockaddr_storage is defined or not depends on the Platform SDK
+ * whether sockaddr_storage is defined or not depends on the Platform SDK
* version installed. The only one not defining it is the SDK that comes
* with MSVC 6.0 (WINVER 0x0400).
*
* copied from RFC2553 (and slightly modified because of datatypes) ...
* XXX - defined more than once, move this to a header file */
+#ifndef WINVER
+#error WINVER not defined ...
+#endif
#if (WINVER <= 0x0400) && defined(_MSC_VER)
typedef unsigned short eth_sa_family_t;
/* ... copied from RFC2553 */
#endif /* WINVER */
-#include <Packet32.h>
-#include <windows.h>
-#include <windowsx.h>
-#include <Ntddndis.h>
-
#define DETAILS_STR_MAX 1024
#include <io.h>
#include <fcntl.h>
+#include <windows.h>
+#include <windowsx.h>
+#include <commdlg.h>
+#include <richedit.h>
+
+
#include <gtk/gtk.h>
#include "epan/filesystem.h"
#include "gtk/file_dlg_win32.h"
#include "gtk/help_dlg.h"
-#include <windows.h>
-#include <windowsx.h>
-#include <commdlg.h>
-#include <richedit.h>
-
typedef enum {
merge_append,
merge_chrono,
#include "image/wsicon16.xpm"
+#ifdef _WIN32
+#include <windows.h>
+#endif
#define WINDOW_GEOM_KEY "window_geom"
#include "gtk/mcast_stream_dlg.h"
#include "gtk/main.h"
-
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
gint32 trigger=50; /* limit for triggering the burst alarm (in packets per second) */
gint32 bufferalarm = 10000; /* limit for triggernig the buffer alarm (in bytes) */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#else
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
#endif
#define SCTP_DATA_CHUNK_ID 0
#include <stdio.h>
#include <time.h>
-#ifdef HAVE_LIBZ
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
+
+#ifdef HAVE_LIBZ
#include <zlib.h>
#define FILE_T gzFile
#else /* No zLib */
#include <sys/time.h>
#endif
-#ifdef HAVE_WINSOCK2_H
-# include <winsock2.h>
-#endif
-
#include <glib.h>
#include <stdio.h>
#include <time.h>