aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/erf.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-10-01 07:11:49 +0000
committerGuy Harris <guy@alum.mit.edu>2003-10-01 07:11:49 +0000
commitbe2736adcf8ac583c2d56e37db9ef01f391913f9 (patch)
treedefd8c4db6a77dd4d288de2b0b10f39d6c701b73 /wiretap/erf.c
parent44bb98184df93ebb56b5dce5dbd1deb6f37d716a (diff)
Have a pseudo-header for Ethernet packets, giving the size of the FCS -
0 means "there is no FCS in the packet data", 4 means "there is an FCS in the packet data", -1 means "I don't know whether there's an FCS in the packet data, guess based on the packet size". Assume that Ethernet encapsulated inside other protocols has no FCS, by having the "eth" dissector assume that (and not check for an Ethernet pseudo-header). Have "ethertype()" take an argument giving the FCS size; pass 0 when appropriate. Fix up Wiretap routines to set the pseudo-header. This means we no longer use the "generic" seek-and-read routine, so get rid of it. svn path=/trunk/; revision=8574
Diffstat (limited to 'wiretap/erf.c')
-rw-r--r--wiretap/erf.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/wiretap/erf.c b/wiretap/erf.c
index ac1cd7eff3..6c650b9b16 100644
--- a/wiretap/erf.c
+++ b/wiretap/erf.c
@@ -32,7 +32,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
-* $Id: erf.c,v 1.3 2003/09/19 04:08:11 guy Exp $
+* $Id: erf.c,v 1.4 2003/10/01 07:11:46 guy Exp $
*/
/*
@@ -69,7 +69,7 @@ static gboolean erf_seek_read(wtap *wth, long seek_off,
int length, int *err);
static void erf_close(wtap *wth);
static int erf_encap_to_wtap_encap(erf_t *erf, guint8 erf_encap);
-static void erf_guess_atm_traffic_type(
+static void erf_set_pseudo_header(
guint8 type,
erf_t *erf,
guchar *pd,
@@ -245,7 +245,7 @@ static gboolean erf_read(wtap *wth, int *err, long *data_offset)
);
wth->data_offset += packet_size;
- erf_guess_atm_traffic_type(
+ erf_set_pseudo_header(
erf_header.type, wth->capture.erf,
buffer_start_ptr(wth->frame_buffer), packet_size, &wth->pseudo_header
);
@@ -274,7 +274,7 @@ static gboolean erf_seek_read(wtap *wth, long seek_off,
wtap_file_read_expected_bytes(pd+offset, (int)packet_size, wth->random_fh, err);
- erf_guess_atm_traffic_type(erf_header.type, wth->capture.erf, pd, length, pseudo_header);
+ erf_set_pseudo_header(erf_header.type, wth->capture.erf, pd, length, pseudo_header);
return TRUE;
}
@@ -435,9 +435,15 @@ static int erf_encap_to_wtap_encap(erf_t *erf, guint8 erf_encap)
return wtap_encap;
}
-static void erf_guess_atm_traffic_type(
+static void erf_set_pseudo_header(
guint8 type, erf_t *erf, guchar *pd, int length, union wtap_pseudo_header *pseudo_header)
{
+ if (type == TYPE_ETH) {
+ /*
+ * We don't know whether there's an FCS in this frame or not.
+ */
+ pseudo_header->eth.fcs_len = -1;
+ } else
if (!erf->is_rawatm &&
(type == TYPE_ATM || type == TYPE_AAL5) &&
(erf->atm_encap == WTAP_ENCAP_ATM_PDUS ||
@@ -450,5 +456,3 @@ static void erf_guess_atm_traffic_type(
pseudo_header->atm.subtype = TRAF_ST_UNKNOWN;
}
}
-
-