aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2001-01-28 23:56:29 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2001-01-28 23:56:29 +0000
commitc5732e87749fbb6a2cb2f29f09fe2c1281fe8153 (patch)
treecb909e1bd0ac75967663e61754eac3a7181148b5
parent1745222c7a427772c09a4a477ff5af00762ebcc8 (diff)
There's no need for a member of a "capture_file" structure holding a
compiled capture filter program, so remove it, and remove the include of <pcap.h> from "file.h"; instead, have local "struct bpf_program" structures where needed, and have those files that need stuff from <pcap.h> include it. This cleans stuff up a bit, and should eliminate a pile of compile warnings with Visual C++ due to <pcap.h> and some GTK+/GLib header file (or files they include) both defining "inline". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2954 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--capture.c13
-rw-r--r--file.h9
-rw-r--r--gtk/capture_dlg.c4
-rw-r--r--gtk/main.c6
-rw-r--r--tethereal.c9
-rw-r--r--util.c4
6 files changed, 24 insertions, 21 deletions
diff --git a/capture.c b/capture.c
index dfbd87dc71..fef514a113 100644
--- a/capture.c
+++ b/capture.c
@@ -1,7 +1,7 @@
/* capture.c
* Routines for packet capture windows
*
- * $Id: capture.c,v 1.136 2001/01/13 03:17:15 gram Exp $
+ * $Id: capture.c,v 1.137 2001/01/28 23:56:27 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -100,14 +100,12 @@
#include <signal.h>
#include <errno.h>
+#include <pcap.h>
+
#ifdef NEED_SNPRINTF_H
# include "snprintf.h"
#endif
-#ifndef lib_pcap_h
-#include <pcap.h>
-#endif
-
#ifdef _WIN32
#include <process.h> /* For spawning child process */
#endif
@@ -1119,6 +1117,7 @@ capture(void)
int snaplen;
gchar err_str[PCAP_ERRBUF_SIZE], label_str[64];
bpf_u_int32 netnum, netmask;
+ struct bpf_program fcode;
time_t upd_time, cur_time;
int err, inpkts, i;
char errmsg[4096+1];
@@ -1279,12 +1278,12 @@ capture(void)
*/
netmask = 0;
}
- if (pcap_compile(pch, &cfile.fcode, cfile.cfilter, 1, netmask) < 0) {
+ if (pcap_compile(pch, &fcode, cfile.cfilter, 1, netmask) < 0) {
snprintf(errmsg, sizeof errmsg, "Unable to parse filter string (%s).",
pcap_geterr(pch));
goto error;
}
- if (pcap_setfilter(pch, &cfile.fcode) < 0) {
+ if (pcap_setfilter(pch, &fcode) < 0) {
snprintf(errmsg, sizeof errmsg, "Can't install filter (%s).",
pcap_geterr(pch));
goto error;
diff --git a/file.h b/file.h
index 21e6af2689..196a18debb 100644
--- a/file.h
+++ b/file.h
@@ -1,7 +1,7 @@
/* file.h
* Definitions for file structures and routines
*
- * $Id: file.h,v 1.78 2000/10/20 04:26:38 gram Exp $
+ * $Id: file.h,v 1.79 2001/01/28 23:56:27 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -32,10 +32,6 @@
#include "wiretap/wtap.h"
-#ifdef HAVE_LIBPCAP
-#include <pcap.h>
-#endif
-
#include "dfilter.h"
#include "print.h"
@@ -56,8 +52,6 @@
#define file_close fclose
#endif /* HAVE_LIBZ */
-typedef struct bpf_program bpf_prog;
-
/* Current state of file. */
typedef enum {
FILE_CLOSED, /* No file open */
@@ -93,7 +87,6 @@ typedef struct _capture_file {
dfilter *dfcode; /* Compiled display filter program */
#ifdef HAVE_LIBPCAP
gchar *cfilter; /* Capture filter string */
- bpf_prog fcode; /* Compiled capture filter program */
#endif
gchar *sfilter; /* Search filter string */
gboolean sbackward; /* TRUE if search is backward, FALSE if forward */
diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c
index 8ed93d9077..1ae2796beb 100644
--- a/gtk/capture_dlg.c
+++ b/gtk/capture_dlg.c
@@ -1,7 +1,7 @@
/* capture_dlg.c
* Routines for packet capture windows
*
- * $Id: capture_dlg.c,v 1.36 2001/01/02 01:32:21 guy Exp $
+ * $Id: capture_dlg.c,v 1.37 2001/01/28 23:56:29 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -41,6 +41,8 @@
#include <time.h>
+#include <pcap.h>
+
#ifdef NEED_SNPRINTF_H
# include "snprintf.h"
#endif
diff --git a/gtk/main.c b/gtk/main.c
index 37abbe8293..649a6dfcf6 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.175 2001/01/28 09:13:10 guy Exp $
+ * $Id: main.c,v 1.176 2001/01/28 23:56:29 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -73,6 +73,10 @@
#include <signal.h>
+#ifdef HAVE_LIBPCAP
+#include <pcap.h>
+#endif
+
#ifdef NEED_SNPRINTF_H
# include "snprintf.h"
#endif
diff --git a/tethereal.c b/tethereal.c
index 11b1a9d469..7eb3a2d6a4 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -1,6 +1,6 @@
/* tethereal.c
*
- * $Id: tethereal.c,v 1.61 2001/01/04 00:16:43 guy Exp $
+ * $Id: tethereal.c,v 1.62 2001/01/28 23:56:27 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -53,6 +53,8 @@
#include <signal.h>
+#include <pcap.h>
+
#ifdef NEED_SNPRINTF_H
# include "snprintf.h"
#endif
@@ -531,6 +533,7 @@ capture(int packet_count, int out_file_type)
{
gchar err_str[PCAP_ERRBUF_SIZE];
bpf_u_int32 netnum, netmask;
+ struct bpf_program fcode;
void (*oldhandler)(int);
int err, inpkts;
char errmsg[1024+1];
@@ -609,12 +612,12 @@ capture(int packet_count, int out_file_type)
"Warning: Couldn't obtain netmask info (%s)\n.", err_str);
netmask = 0;
}
- if (pcap_compile(ld.pch, &cfile.fcode, cfile.cfilter, 1, netmask) < 0) {
+ if (pcap_compile(ld.pch, &fcode, cfile.cfilter, 1, netmask) < 0) {
snprintf(errmsg, sizeof errmsg, "Unable to parse filter string (%s).",
pcap_geterr(ld.pch));
goto error;
}
- if (pcap_setfilter(ld.pch, &cfile.fcode) < 0) {
+ if (pcap_setfilter(ld.pch, &fcode) < 0) {
snprintf(errmsg, sizeof errmsg, "Can't install filter (%s).",
pcap_geterr(ld.pch));
goto error;
diff --git a/util.c b/util.c
index 0bd6787d19..1ff362902c 100644
--- a/util.c
+++ b/util.c
@@ -1,7 +1,7 @@
/* util.c
* Utility routines
*
- * $Id: util.c,v 1.48 2000/12/23 19:50:36 guy Exp $
+ * $Id: util.c,v 1.49 2001/01/28 23:56:27 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -75,6 +75,8 @@ typedef int mode_t; /* for win32 */
#include <sys/ioctl.h>
#endif
+#include <pcap.h>
+
#ifndef WIN32
#include <net/if.h>
#endif