diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-01-23 08:55:37 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-01-23 08:55:37 +0000 |
commit | 2461d79698e685644e2f07ee46381a092348461c (patch) | |
tree | 8647292ca380ae9108970a167959b9df1c931ec9 /capture.c | |
parent | 42d68156a9599948fb0c5c633efc9d61548d5a5b (diff) | |
download | wireshark-2461d79698e685644e2f07ee46381a092348461c.tar.gz wireshark-2461d79698e685644e2f07ee46381a092348461c.tar.bz2 wireshark-2461d79698e685644e2f07ee46381a092348461c.zip |
In "dissect_eth()", update "pi.len" and "pi.captured_len" regardless of
whether we're building a protocol tree or not.
Make "dissect_eth()" use "BYTES_ARE_IN_FRAME()" to see if we have a full
Ethernet header - it can be called with a non-zero offset, if Ethernet
frames are encapsulated inside other frames (e.g., ATM LANE).
Make capture routines take an "offset" argument if the corresponding
dissect routine takes one (for symmetry, and for Cisco ISL or any other
protocol that encapsulates Ethernet or Token-Ring frames inside other
frames).
Pass the frame lengths to capture routines via the "pi" structure,
rather than as an in-line argument, so that they can macros such as
"BYTES_ARE_IN_FRAME()" the way the corresponding dissect routines do.
Make capture routines update "pi.len" and "pi.captured_len" the same way
the corresponding diseect routines do, if the capture routines then call
other capture routines.
Make "capture_vlan()" count as "other" frames that are too short, the
way other capture routines do.
svn path=/trunk/; revision=1525
Diffstat (limited to 'capture.c')
-rw-r--r-- | capture.c | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -1,7 +1,7 @@ /* capture.c * Routines for packet capture windows * - * $Id: capture.c,v 1.90 2000/01/20 21:34:12 guy Exp $ + * $Id: capture.c,v 1.91 2000/01/23 08:55:30 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -861,26 +861,32 @@ capture_pcap_cb(u_char *user, const struct pcap_pkthdr *phdr, /* XXX - do something if this fails */ wtap_dump(ld->pdh, &whdr, pd, &err); } + + /* Set the initial payload to the packet length, and the initial + captured payload to the capture length (other protocols may + reduce them if their headers say they're less). */ + pi.len = phdr->len; + pi.captured_len = phdr->caplen; switch (ld->linktype) { case WTAP_ENCAP_ETHERNET: - capture_eth(pd, phdr->caplen, &ld->counts); + capture_eth(pd, 0, &ld->counts); break; case WTAP_ENCAP_FDDI: case WTAP_ENCAP_FDDI_BITSWAPPED: - capture_fddi(pd, phdr->caplen, &ld->counts); + capture_fddi(pd, &ld->counts); break; case WTAP_ENCAP_TR: - capture_tr(pd, phdr->caplen, &ld->counts); + capture_tr(pd, 0, &ld->counts); break; case WTAP_ENCAP_NULL: - capture_null(pd, phdr->caplen, &ld->counts); + capture_null(pd, &ld->counts); break; case WTAP_ENCAP_PPP: - capture_ppp(pd, phdr->caplen, &ld->counts); + capture_ppp(pd, &ld->counts); break; case WTAP_ENCAP_RAW_IP: - capture_raw(pd, phdr->caplen, &ld->counts); + capture_raw(pd, &ld->counts); break; /* XXX - FreeBSD may append 4-byte ATM pseudo-header to DLT_ATM_RFC1483, with LLC header following; we should implement it at some |