summaryrefslogtreecommitdiff
path: root/tethereal.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-05-31 09:53:21 +0000
committerGuy Harris <guy@alum.mit.edu>2004-05-31 09:53:21 +0000
commitc8c2bab1b98f9d05cab6bef8d4d193572af652e2 (patch)
tree7187d5a919b5f168a36241fde5ee75d0fb7d2829 /tethereal.c
parent3804c8ae9a783e3e69a5b81cbe1fe1fab4867520 (diff)
downloadwireshark-c8c2bab1b98f9d05cab6bef8d4d193572af652e2.tar.gz
Add a routine that indicates where there are any tap listeners
registered (not whether there are any tap *filters* registered). Do dissection in Tethereal iff: we're printing information about each packet; we're using a read filter on the packets; there are any tap listeners registered (even if there are no tap filters registered - not all taps use filters). svn path=/trunk/; revision=11040
Diffstat (limited to 'tethereal.c')
-rw-r--r--tethereal.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/tethereal.c b/tethereal.c
index c672e981a0..cc06419a8f 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -1,6 +1,6 @@
/* tethereal.c
*
- * $Id: tethereal.c,v 1.241 2004/05/31 08:41:32 guy Exp $
+ * $Id: tethereal.c,v 1.242 2004/05/31 09:53:21 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -121,6 +121,7 @@ static guint32 prevsec, prevusec;
static GString *comp_info_str, *runtime_info_str;
static gboolean quiet;
static gboolean print_packet_info; /* TRUE if we're to print packet information */
+static gboolean do_dissection; /* TRUE if we have to dissect each packet */
static gboolean verbose;
static gboolean print_hex;
static gboolean line_buffered;
@@ -1502,6 +1503,16 @@ main(int argc, char *argv[])
}
}
cfile.rfcode = rfcode;
+
+ /* We have to dissect each packet if:
+
+ we're printing information about each packet;
+
+ we're using a read filter on the packets;
+
+ we're using any taps. */
+ do_dissection = print_packet_info || rfcode || have_tap_listeners();
+
if (cf_name) {
/*
* We're reading a capture file.
@@ -2432,8 +2443,9 @@ process_packet(capture_file *cf, wtap_dumper *pdh, long offset,
cf->count++;
/* If we're going to print packet information, or we're going to
- run a read filter, set up to do a dissection and do so. */
- if (print_packet_info || cf->rfcode) {
+ run a read filter, or we're going to process taps, set up to
+ do a dissection and do so. */
+ if (do_dissection) {
fill_in_fdata(&fdata, cf, whdr, offset);
if (print_packet_info) {
@@ -2511,11 +2523,10 @@ process_packet(capture_file *cf, wtap_dumper *pdh, long offset,
}
}
- if (edt != NULL)
+ if (do_dissection) {
epan_dissect_free(edt);
-
- if (print_packet_info || cf->rfcode)
clear_fdata(&fdata);
+ }
}
static void