aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>2008-10-24 00:42:09 +0000
committerwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>2008-10-24 00:42:09 +0000
commitd7d039675e3ae6a2550499fe38f7df29c4c91b67 (patch)
tree9dba16a45db59ebe1b10965d38f3844a27cc911f
parentdc41ee4f7781c1bdd95eb94b410f0896e57fdeb7 (diff)
Windows build: #include winsock2.h only when needed.
#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
-rw-r--r--airpcap.h4
-rw-r--r--capture_wpcap_packet.c18
-rw-r--r--editcap.c3
-rw-r--r--epan/dissectors/packet-dcom.c4
-rw-r--r--epan/dissectors/packet-dtls.c4
-rw-r--r--epan/dissectors/packet-frame.c5
-rw-r--r--epan/dissectors/packet-ieee80211.c8
-rw-r--r--epan/dissectors/packet-ssl.c3
-rw-r--r--gtk/capture_if_details_dlg_win32.c17
-rw-r--r--gtk/file_dlg_win32.c11
-rw-r--r--gtk/gui_utils.c3
-rw-r--r--gtk/mcast_stream.c4
-rw-r--r--gtk/sctp_stat.h4
-rw-r--r--wiretap/wtap-int.h3
-rw-r--r--wiretap/wtap.h4
15 files changed, 59 insertions, 36 deletions
diff --git a/airpcap.h b/airpcap.h
index 639a930a70..7bc4a88209 100644
--- a/airpcap.h
+++ b/airpcap.h
@@ -29,6 +29,10 @@
#pragma warning( disable : 4996)
#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/capture_wpcap_packet.c b/capture_wpcap_packet.c
index d26da5f8f4..6729e0c838 100644
--- a/capture_wpcap_packet.c
+++ b/capture_wpcap_packet.c
@@ -34,7 +34,6 @@
#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. */
@@ -42,15 +41,23 @@
#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;
@@ -85,13 +92,6 @@ struct sockaddr_storage {
#endif /* WINVER */
-#include <Packet32.h>
-#include <windows.h>
-#include <windowsx.h>
-#include <Ntddndis.h>
-
-#include "capture_wpcap_packet.h"
-
gboolean has_wpacket = FALSE;
diff --git a/editcap.c b/editcap.c
index 84ecd0a727..88a5e16ed3 100644
--- a/editcap.c
+++ b/editcap.c
@@ -48,6 +48,9 @@
#ifdef _WIN32
#include <process.h> /* getpid */
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
#endif
#ifdef NEED_STRPTIME_H
diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c
index fe7597ea0c..fa70e9443d 100644
--- a/epan/dissectors/packet-dcom.c
+++ b/epan/dissectors/packet-dcom.c
@@ -80,6 +80,10 @@
#include <netinet/in.h>
#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
#include <string.h>
#include <glib.h>
diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c
index 8fc671227c..0bae8971cc 100644
--- a/epan/dissectors/packet-dtls.c
+++ b/epan/dissectors/packet-dtls.c
@@ -58,6 +58,10 @@
#include <sys/socket.h>
#endif
+#if HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
#include <glib.h>
#include <epan/conversation.h>
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index d37d073d62..1077373482 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -27,6 +27,11 @@
# include "config.h"
#endif
+#ifdef _MSC_VER
+#include <windows.h>
+#endif
+
+
#include <glib.h>
#include <epan/packet.h>
#include <epan/timestamp.h>
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index bf08c4b229..d20d65fe01 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -84,14 +84,6 @@
#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
diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c
index 8e025cba5a..5e86372a02 100644
--- a/epan/dissectors/packet-ssl.c
+++ b/epan/dissectors/packet-ssl.c
@@ -102,6 +102,9 @@
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
#include <glib.h>
diff --git a/gtk/capture_if_details_dlg_win32.c b/gtk/capture_if_details_dlg_win32.c
index 8577a01767..d6c3f2318a 100644
--- a/gtk/capture_if_details_dlg_win32.c
+++ b/gtk/capture_if_details_dlg_win32.c
@@ -40,9 +40,7 @@
#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"
@@ -51,15 +49,23 @@
#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;
@@ -93,11 +99,6 @@ struct sockaddr_storage {
/* ... copied from RFC2553 */
#endif /* WINVER */
-#include <Packet32.h>
-#include <windows.h>
-#include <windowsx.h>
-#include <Ntddndis.h>
-
#define DETAILS_STR_MAX 1024
diff --git a/gtk/file_dlg_win32.c b/gtk/file_dlg_win32.c
index 5afcafd92f..2dc1eced57 100644
--- a/gtk/file_dlg_win32.c
+++ b/gtk/file_dlg_win32.c
@@ -34,6 +34,12 @@
#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"
@@ -59,11 +65,6 @@
#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,
diff --git a/gtk/gui_utils.c b/gtk/gui_utils.c
index 0a9415649c..6ecea32a45 100644
--- a/gtk/gui_utils.c
+++ b/gtk/gui_utils.c
@@ -45,6 +45,9 @@
#include "image/wsicon16.xpm"
+#ifdef _WIN32
+#include <windows.h>
+#endif
#define WINDOW_GEOM_KEY "window_geom"
diff --git a/gtk/mcast_stream.c b/gtk/mcast_stream.c
index c4ab045644..e6d07b3f2f 100644
--- a/gtk/mcast_stream.c
+++ b/gtk/mcast_stream.c
@@ -59,7 +59,9 @@
#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) */
diff --git a/gtk/sctp_stat.h b/gtk/sctp_stat.h
index 60694e852c..02aa0f92c5 100644
--- a/gtk/sctp_stat.h
+++ b/gtk/sctp_stat.h
@@ -28,6 +28,10 @@
#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
diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h
index cd63fd937a..757703c298 100644
--- a/wiretap/wtap-int.h
+++ b/wiretap/wtap-int.h
@@ -31,10 +31,11 @@
#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 */
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 5f9678959a..9968a7bdc3 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -27,10 +27,6 @@
#include <sys/time.h>
#endif
-#ifdef HAVE_WINSOCK2_H
-# include <winsock2.h>
-#endif
-
#include <glib.h>
#include <stdio.h>
#include <time.h>