diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-03-03 22:24:53 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-03-03 22:24:53 +0000 |
commit | ba72e955dc1b42da73e3a25eecd4bd336ffbf1b7 (patch) | |
tree | efb280a0c42fb616c066a4c6fd5a220bce732508 | |
parent | 76ff7e4a66cc2e45a25a3ac815e5520195ea3ae4 (diff) |
Have "wtap_read()" set "wth->phdr.pkt_encap" to "wth->file_encap",
rather than requiring individual capture file type handlers to do it
(unless they're doing per-packet encapsulation, in which case we check
to make sure they didn't *leave* it as WTAP_ENCAP_PER_PACKET).
svn path=/trunk/; revision=10290
-rw-r--r-- | wiretap/5views.c | 3 | ||||
-rw-r--r-- | wiretap/airopeek9.c | 3 | ||||
-rw-r--r-- | wiretap/ascend.c | 3 | ||||
-rw-r--r-- | wiretap/cosine.c | 3 | ||||
-rw-r--r-- | wiretap/csids.c | 3 | ||||
-rw-r--r-- | wiretap/dbs-etherwatch.c | 3 | ||||
-rw-r--r-- | wiretap/etherpeek.c | 3 | ||||
-rw-r--r-- | wiretap/eyesdn.c | 3 | ||||
-rw-r--r-- | wiretap/hcidump.c | 3 | ||||
-rw-r--r-- | wiretap/lanalyzer.c | 3 | ||||
-rw-r--r-- | wiretap/libpcap.c | 3 | ||||
-rw-r--r-- | wiretap/netmon.c | 3 | ||||
-rw-r--r-- | wiretap/netxray.c | 3 | ||||
-rw-r--r-- | wiretap/radcom.c | 4 | ||||
-rw-r--r-- | wiretap/snoop.c | 3 | ||||
-rw-r--r-- | wiretap/visual.c | 4 | ||||
-rw-r--r-- | wiretap/vms.c | 3 | ||||
-rw-r--r-- | wiretap/wtap.c | 21 |
18 files changed, 37 insertions, 37 deletions
diff --git a/wiretap/5views.c b/wiretap/5views.c index 23f63445f5..43b533c7e6 100644 --- a/wiretap/5views.c +++ b/wiretap/5views.c @@ -1,6 +1,6 @@ /* 5views.c * - * $Id: 5views.c,v 1.4 2004/01/25 21:55:11 guy Exp $ + * $Id: 5views.c,v 1.5 2004/03/03 22:24:50 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -254,7 +254,6 @@ _5views_read(wtap *wth, int *err, gchar **err_info _U_, long *data_offset) wth->phdr.ts.tv_usec = TimeStamped_Header.NanoSecondes/1000; wth->phdr.caplen = packet_size; wth->phdr.len = orig_size; - wth->phdr.pkt_encap = wth->file_encap; switch (wth->file_encap) { diff --git a/wiretap/airopeek9.c b/wiretap/airopeek9.c index 68d5368d21..7d8be7563d 100644 --- a/wiretap/airopeek9.c +++ b/wiretap/airopeek9.c @@ -1,7 +1,7 @@ /* airopeek9.c * Routines for opening EtherPeek and AiroPeek V9 files * - * $Id: airopeek9.c,v 1.11 2004/02/06 20:50:44 guy Exp $ + * $Id: airopeek9.c,v 1.12 2004/03/03 22:24:50 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -545,7 +545,6 @@ static gboolean airopeekv9_read(wtap *wth, int *err, gchar **err_info, break; } - wth->phdr.pkt_encap = wth->file_encap; return TRUE; } diff --git a/wiretap/ascend.c b/wiretap/ascend.c index 31f76eecb7..0fb002c00d 100644 --- a/wiretap/ascend.c +++ b/wiretap/ascend.c @@ -1,6 +1,6 @@ /* ascend.c * - * $Id: ascend.c,v 1.32 2004/01/25 21:55:12 guy Exp $ + * $Id: ascend.c,v 1.33 2004/03/03 22:24:51 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -333,7 +333,6 @@ static gboolean ascend_read(wtap *wth, int *err, gchar **err_info, wth->phdr.ts.tv_usec = header.usecs; wth->phdr.caplen = header.caplen; wth->phdr.len = header.len; - wth->phdr.pkt_encap = wth->file_encap; wth->data_offset = offset; *data_offset = offset; diff --git a/wiretap/cosine.c b/wiretap/cosine.c index d121e2bd4c..eb3bbb70cb 100644 --- a/wiretap/cosine.c +++ b/wiretap/cosine.c @@ -1,6 +1,6 @@ /* cosine.c * - * $Id: cosine.c,v 1.9 2004/02/09 00:06:30 guy Exp $ + * $Id: cosine.c,v 1.10 2004/03/03 22:24:51 guy Exp $ * * CoSine IPNOS L2 debug output parsing * Copyright (c) 2002 by Motonori Shindo <mshindo@mshindo.net> @@ -421,7 +421,6 @@ parse_cosine_rec_hdr(wtap *wth, const char *line, wth->phdr.ts.tv_sec = mktime(&tm); wth->phdr.ts.tv_usec = csec * 10000; wth->phdr.len = pkt_len; - wth->phdr.pkt_encap = WTAP_ENCAP_COSINE; } /* XXX need to handle other encapsulations like Cisco HDLC, Frame Relay and ATM */ diff --git a/wiretap/csids.c b/wiretap/csids.c index 5b19959627..be747386dc 100644 --- a/wiretap/csids.c +++ b/wiretap/csids.c @@ -1,6 +1,6 @@ /* csids.c * - * $Id: csids.c,v 1.16 2004/01/25 21:55:12 guy Exp $ + * $Id: csids.c,v 1.17 2004/03/03 22:24:51 guy Exp $ * * Copyright (c) 2000 by Mike Hall <mlh@io.com> * Copyright (c) 2000 by Cisco Systems @@ -182,7 +182,6 @@ static gboolean csids_read(wtap *wth, int *err, gchar **err_info _U_, wth->phdr.caplen = hdr.caplen; wth->phdr.ts.tv_sec = hdr.seconds; wth->phdr.ts.tv_usec = 0; - wth->phdr.pkt_encap = WTAP_ENCAP_RAW_IP; if( wth->capture.csids->byteswapped == TRUE ) { guint16* swap = (guint16*)buf; diff --git a/wiretap/dbs-etherwatch.c b/wiretap/dbs-etherwatch.c index e59e1e7bd6..d247112b5e 100644 --- a/wiretap/dbs-etherwatch.c +++ b/wiretap/dbs-etherwatch.c @@ -1,6 +1,6 @@ /* dbs-etherwatch.c * - * $Id: dbs-etherwatch.c,v 1.16 2004/02/09 00:06:30 guy Exp $ + * $Id: dbs-etherwatch.c,v 1.17 2004/03/03 22:24:51 guy Exp $ * * Wiretap Library * Copyright (c) 2001 by Marc Milgram <ethereal@mmilgram.NOSPAMmail.net> @@ -479,7 +479,6 @@ parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err, wth->phdr.ts.tv_usec = csec * 10000; wth->phdr.caplen = eth_hdr_len + pkt_len; wth->phdr.len = eth_hdr_len + pkt_len; - wth->phdr.pkt_encap = wth->file_encap; } /* Parse the hex dump */ diff --git a/wiretap/etherpeek.c b/wiretap/etherpeek.c index 3096cf3786..18decfa48a 100644 --- a/wiretap/etherpeek.c +++ b/wiretap/etherpeek.c @@ -3,7 +3,7 @@ * and V7 files * Copyright (c) 2001, Daniel Thompson <d.thompson@gmx.net> * - * $Id: etherpeek.c,v 1.28 2004/02/06 02:09:11 guy Exp $ + * $Id: etherpeek.c,v 1.29 2004/03/03 22:24:51 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -466,7 +466,6 @@ static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info, wth->phdr.caplen -= 4; } - wth->phdr.pkt_encap = wth->file_encap; return TRUE; } diff --git a/wiretap/eyesdn.c b/wiretap/eyesdn.c index 662d2a769c..9c0b5e36eb 100644 --- a/wiretap/eyesdn.c +++ b/wiretap/eyesdn.c @@ -1,6 +1,6 @@ /* eyesdn.c * - * $Id: eyesdn.c,v 1.4 2004/03/03 01:49:16 guy Exp $ + * $Id: eyesdn.c,v 1.5 2004/03/03 22:24:51 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -220,7 +220,6 @@ static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info, wth->data_offset = offset; *data_offset = offset; - wth->phdr.pkt_encap = wth->file_encap; return TRUE; } diff --git a/wiretap/hcidump.c b/wiretap/hcidump.c index 6de99d1291..f1d59d2774 100644 --- a/wiretap/hcidump.c +++ b/wiretap/hcidump.c @@ -1,6 +1,6 @@ /* hcidump.c * - * $Id: hcidump.c,v 1.3 2004/01/25 21:55:13 guy Exp $ + * $Id: hcidump.c,v 1.4 2004/03/03 22:24:51 guy Exp $ * * Copyright (c) 2003 by Marcel Holtmann <marcel@holtmann.org> * @@ -84,7 +84,6 @@ static gboolean hcidump_read(wtap *wth, int *err, gchar **err_info, wth->phdr.ts.tv_usec = GUINT32_FROM_LE(dh.ts_usec); wth->phdr.caplen = packet_size; wth->phdr.len = packet_size; - wth->phdr.pkt_encap = WTAP_ENCAP_BLUETOOTH_H4; wth->pseudo_header.p2p.sent = (dh.in ? FALSE : TRUE); diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c index 51bec6af0b..1755ae4ec9 100644 --- a/wiretap/lanalyzer.c +++ b/wiretap/lanalyzer.c @@ -1,6 +1,6 @@ /* lanalyzer.c * - * $Id: lanalyzer.c,v 1.46 2004/01/25 21:55:15 guy Exp $ + * $Id: lanalyzer.c,v 1.47 2004/03/03 22:24:51 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -385,7 +385,6 @@ static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info, } wth->phdr.len = true_size; wth->phdr.caplen = packet_size; - wth->phdr.pkt_encap = wth->file_encap; switch (wth->file_encap) { diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index 88a9170f67..76a7ad99ec 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -1,6 +1,6 @@ /* libpcap.c * - * $Id: libpcap.c,v 1.115 2004/02/19 08:02:06 guy Exp $ + * $Id: libpcap.c,v 1.116 2004/03/03 22:24:51 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -1180,7 +1180,6 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info, wth->phdr.ts.tv_usec = hdr.hdr.ts_usec; wth->phdr.caplen = packet_size; wth->phdr.len = orig_size; - wth->phdr.pkt_encap = wth->file_encap; if (wth->file_encap == WTAP_ENCAP_ATM_PDUS) { if (wth->file_type == WTAP_FILE_PCAP_NOKIA) { diff --git a/wiretap/netmon.c b/wiretap/netmon.c index c5c48411e9..b6be16ce5b 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -1,6 +1,6 @@ /* netmon.c * - * $Id: netmon.c,v 1.68 2004/01/25 21:55:15 guy Exp $ + * $Id: netmon.c,v 1.69 2004/03/03 22:24:51 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -452,7 +452,6 @@ static gboolean netmon_read(wtap *wth, int *err, gchar **err_info, wth->phdr.ts.tv_usec = usecs; wth->phdr.caplen = packet_size; wth->phdr.len = orig_size; - wth->phdr.pkt_encap = wth->file_encap; /* * Attempt to guess from the packet data, the VPI, and the VCI diff --git a/wiretap/netxray.c b/wiretap/netxray.c index fe8068aa9e..2f88a4845e 100644 --- a/wiretap/netxray.c +++ b/wiretap/netxray.c @@ -1,6 +1,6 @@ /* netxray.c * - * $Id: netxray.c,v 1.89 2004/01/27 08:06:12 guy Exp $ + * $Id: netxray.c,v 1.90 2004/03/03 22:24:51 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -646,7 +646,6 @@ reread: wth->phdr.caplen = packet_size - padding; wth->phdr.len = pletohs(&hdr.hdr_1_x.orig_len) - padding; } - wth->phdr.pkt_encap = wth->file_encap; return TRUE; } diff --git a/wiretap/radcom.c b/wiretap/radcom.c index 0c93110908..2f25173c71 100644 --- a/wiretap/radcom.c +++ b/wiretap/radcom.c @@ -1,6 +1,6 @@ /* radcom.c * - * $Id: radcom.c,v 1.44 2004/01/25 21:55:17 guy Exp $ + * $Id: radcom.c,v 1.45 2004/03/03 22:24:52 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -351,8 +351,6 @@ static gboolean radcom_read(wtap *wth, int *err, gchar **err_info _U_, return FALSE; /* Read error */ wth->data_offset += length; - wth->phdr.pkt_encap = wth->file_encap; - if (wth->file_encap == WTAP_ENCAP_LAPB) { /* Read the FCS. XXX - should we have some way of indicating the diff --git a/wiretap/snoop.c b/wiretap/snoop.c index bc3a8811c4..676f4f9d85 100644 --- a/wiretap/snoop.c +++ b/wiretap/snoop.c @@ -1,6 +1,6 @@ /* snoop.c * - * $Id: snoop.c,v 1.68 2004/01/25 21:55:17 guy Exp $ + * $Id: snoop.c,v 1.69 2004/03/03 22:24:52 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -505,7 +505,6 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info, wth->phdr.ts.tv_usec = g_ntohl(hdr.ts_usec); wth->phdr.caplen = packet_size; wth->phdr.len = orig_size; - wth->phdr.pkt_encap = wth->file_encap; /* * If this is ATM LANE traffic, try to guess what type of LANE diff --git a/wiretap/visual.c b/wiretap/visual.c index 0447b4b7e7..96a13be830 100644 --- a/wiretap/visual.c +++ b/wiretap/visual.c @@ -2,7 +2,7 @@ * File read and write routines for Visual Networks cap files. * Copyright (c) 2001, Tom Nisbet tnisbet@visualnetworks.com * - * $Id: visual.c,v 1.15 2004/01/25 21:55:17 guy Exp $ + * $Id: visual.c,v 1.16 2004/03/03 22:24:52 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -311,8 +311,6 @@ static gboolean visual_read(wtap *wth, int *err, gchar **err_info, with a media type of HDLC can be either Cisco EtherType or PPP. */ if ((wth->file_encap == WTAP_ENCAP_CHDLC_WITH_PHDR) && (vpkt_hdr.encap_hint == 14)) wth->phdr.pkt_encap = WTAP_ENCAP_PPP_WITH_PHDR; - else - wth->phdr.pkt_encap = wth->file_encap; return TRUE; } diff --git a/wiretap/vms.c b/wiretap/vms.c index 8ccb086ee3..27b88d33ad 100644 --- a/wiretap/vms.c +++ b/wiretap/vms.c @@ -1,6 +1,6 @@ /* vms.c * - * $Id: vms.c,v 1.22 2004/02/09 00:06:30 guy Exp $ + * $Id: vms.c,v 1.23 2004/03/03 22:24:53 guy Exp $ * * Wiretap Library * Copyright (c) 2001 by Marc Milgram <ethereal@mmilgram.NOSPAMmail.net> @@ -444,7 +444,6 @@ parse_vms_rec_hdr(wtap *wth, FILE_T fh, int *err, gchar **err_info) wth->phdr.ts.tv_usec = csec * 10000; wth->phdr.caplen = pkt_len; wth->phdr.len = pkt_len; - wth->phdr.pkt_encap = WTAP_ENCAP_RAW_IP; } return pkt_len; diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 900e92b24c..bfd1718846 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -1,6 +1,6 @@ /* wtap.c * - * $Id: wtap.c,v 1.89 2004/01/29 10:58:28 guy Exp $ + * $Id: wtap.c,v 1.90 2004/03/03 22:24:53 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -368,6 +368,16 @@ wtap_close(wtap *wth) gboolean wtap_read(wtap *wth, int *err, gchar **err_info, long *data_offset) { + /* + * Set the packet encapsulation to the file's encapsulation + * value; if that's not WTAP_ENCAP_PER_PACKET, it's the + * right answer (and means that the read routine for this + * capture file type doesn't have to set it), and if it + * *is* WTAP_ENCAP_PER_PACKET, the caller needs to set it + * anyway. + */ + wth->phdr.pkt_encap = wth->file_encap; + if (!wth->subtype_read(wth, err, err_info, data_offset)) return FALSE; /* failure */ @@ -377,6 +387,15 @@ wtap_read(wtap *wth, int *err, gchar **err_info, long *data_offset) */ if (wth->phdr.caplen > wth->phdr.len) wth->phdr.caplen = wth->phdr.len; + + /* + * Make sure that it's not WTAP_ENCAP_PER_PACKET, as that + * probably means the file has that encapsulation type + * but the read routine didn't set this packet's + * encapsulation type. + */ + g_assert(wth->phdr.pkt_encap != WTAP_ENCAP_PER_PACKET); + return TRUE; /* success */ } |