Get rid of the "len" and "captured_len" members of the "packet_info"

structure; they're no longer used.

svn path=/trunk/; revision=4236
This commit is contained in:
Guy Harris 2001-11-20 22:29:07 +00:00
parent e8d4f4f0ac
commit 2f10c7f630
11 changed files with 34 additions and 119 deletions

View File

@ -1,7 +1,7 @@
/* capture.c
* Routines for packet capture windows
*
* $Id: capture.c,v 1.158 2001/11/20 21:59:12 guy Exp $
* $Id: capture.c,v 1.159 2001/11/20 22:29:04 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1148,12 +1148,6 @@ pipe_dispatch(int fd, loop_data *ld, struct pcap_hdr *hdr)
whdr.pkt_encap = ld->linktype;
wtap_dump(ld->pdh, &whdr, NULL, 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 = whdr.len;
pi.captured_len = whdr.caplen;
/* update capture statistics */
switch (ld->linktype) {
case WTAP_ENCAP_ETHERNET:
@ -1873,12 +1867,6 @@ capture_pcap_cb(u_char *user, const struct pcap_pkthdr *phdr,
}
}
/* 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, 0, phdr->len, &ld->counts);

View File

@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
* $Id: packet.c,v 1.38 2001/11/15 10:58:50 guy Exp $
* $Id: packet.c,v 1.39 2001/11/20 22:29:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -98,9 +98,7 @@ packet_cleanup(void)
/*
* Given a tvbuff, a packet_info *, and a length from a packet header,
* adjust the length of the tvbuff, and the "len" and "captured_len"
* members of the "packet_info" structure, to reflect the specified
* length.
* adjust the length of the tvbuff to reflect the specified length.
*/
void
set_actual_length(tvbuff_t *tvb, packet_info *pinfo, guint specified_len)
@ -120,23 +118,6 @@ set_actual_length(tvbuff_t *tvb, packet_info *pinfo, guint specified_len)
probably us) may use that to determine how much of its packet
was padding. */
tvb_set_reported_length(tvb, specified_len);
/* XXX - can we get rid of "pinfo->len" and "pinfo->captured_len"
when the last dissector is tvbuffified? */
/* Shrink the total payload by the amount of padding. */
padding = reported_payload_len - specified_len;
if (pinfo->len >= padding)
pinfo->len -= padding;
/* Shrink the captured payload by the amount of padding in the
captured payload (which may be less than the amount of padding,
as the padding may not have been captured). */
if (specified_len < payload_len) {
padding = payload_len - specified_len;
if (pinfo->captured_len >= padding)
pinfo->captured_len -= padding;
}
}
}
@ -174,12 +155,6 @@ dissect_packet(tvbuff_t **p_tvb, union wtap_pseudo_header *pseudo_header,
{
blank_packetinfo();
/* 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 = fd->pkt_len;
pi.captured_len = fd->cap_len;
pi.fd = fd;
pi.pseudo_header = pseudo_header;

View File

@ -1,7 +1,7 @@
/* packet_info.h
* Definitions for packet info structures and routines
*
* $Id: packet_info.h,v 1.9 2001/11/15 10:58:51 guy Exp $
* $Id: packet_info.h,v 1.10 2001/11/20 22:29:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -91,8 +91,6 @@ typedef struct _packet_info {
const char *current_proto; /* name of protocol currently being dissected */
frame_data *fd;
union wtap_pseudo_header *pseudo_header;
int len;
int captured_len;
address dl_src; /* link-layer source address */
address dl_dst; /* link-layer destination address */
address net_src; /* network-layer source address */

View File

@ -1,7 +1,7 @@
/* packet-clnp.c
* Routines for ISO/OSI network and transport protocol packet disassembly
*
* $Id: packet-clnp.c,v 1.37 2001/11/15 10:58:48 guy Exp $
* $Id: packet-clnp.c,v 1.38 2001/11/20 22:29:04 guy Exp $
* Laurent Deniel <deniel@worldnet.fr>
* Ralf Schneider <Ralf.Schneider@t-online.de>
*
@ -1812,14 +1812,6 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Length of CLNP datagram plus headers above it. */
len = segment_length;
/* Set the payload and captured-payload lengths to the minima of (the
datagram length plus the length of the headers above it) and the
frame lengths. */
if (pinfo->len > len)
pinfo->len = len;
if (pinfo->captured_len > len)
pinfo->captured_len = len;
offset = cnf_hdr_len;
/* For now, dissect the payload of segments other than the initial
@ -1933,11 +1925,10 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* It's not fragmented. */
pinfo->fragmented = FALSE;
/* Save the current value of "pi", and adjust certain fields to
reflect the new tvbuff. */
/* XXX - is this still necessary? Do we have to worry about
subdissectors changing "pi", or, given that we're no longer
doing so, is that no longer an issue? */
save_pi = pi;
pi.len = tvb_reported_length(next_tvb);
pi.captured_len = tvb_length(next_tvb);
must_restore_pi = TRUE;
} else {
/* We don't have the complete reassembled payload. */

View File

@ -1,7 +1,7 @@
/* packet-eth.c
* Routines for ethernet packet disassembly
*
* $Id: packet-eth.c,v 1.67 2001/11/20 21:59:12 guy Exp $
* $Id: packet-eth.c,v 1.68 2001/11/20 22:29:04 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -116,10 +116,8 @@ capture_eth(const u_char *pd, int offset, int len, packet_counts *ld)
and set the payload and captured-payload lengths to the minima
of the total length and the frame lengths. */
length += offset + ETH_HEADER_SIZE;
if (pi.len > length)
pi.len = length;
if (pi.captured_len > length)
pi.captured_len = length;
if (len > length)
len = length;
} else {
ethhdr_type = ETHERNET_II;
}
@ -141,7 +139,6 @@ capture_eth(const u_char *pd, int offset, int len, packet_counts *ld)
static void
dissect_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
int orig_captured_len;
proto_item *ti;
const guint8 *dst, *src;
const guint8 *pd;
@ -149,13 +146,10 @@ dissect_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint16 etype;
volatile gboolean is_802_2;
int eth_offset;
volatile guint16 length;
proto_tree *volatile fh_tree = NULL;
tvb_compat(tvb, &pd, (int*)&eth_offset);
orig_captured_len = pinfo->captured_len;
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "Ethernet");
@ -170,8 +164,6 @@ dissect_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* either ethernet802.3 or ethernet802.2 */
if (etype <= IEEE_802_3_MAX_LEN) {
length = etype;
/* Oh, yuck. Cisco ISL frames require special interpretation of the
destination address field; fortunately, they can be recognized by
checking the first 5 octets of the destination address, which are
@ -221,20 +213,6 @@ dissect_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_ether_hidden(fh_tree, hf_eth_addr, tvb, 6, 6, src);
}
/* Convert the LLC length from the 802.3 header to a total
frame length, by adding in the size of any data that preceded
the Ethernet header, and adding in the Ethernet header size,
and set the payload and captured-payload lengths to the minima
of the total length and the frame lengths.
XXX - when all dissectors are tvbuffified we shouldn't have to
do this any more. */
length += eth_offset + ETH_HEADER_SIZE;
if (pinfo->len > length)
pinfo->len = length;
if (pinfo->captured_len > length)
pinfo->captured_len = length;
dissect_802_3(etype, is_802_2, tvb, ETH_HEADER_SIZE, pinfo, tree, fh_tree,
hf_eth_len, hf_eth_trailer);
} else {

View File

@ -4,7 +4,7 @@
* Copyright 2001, Michal Melerowicz <michal.melerowicz@nokia.com>
* Nicolas Balkota <balkota@mac.com>
*
* $Id: packet-gtp.c,v 1.14 2001/11/15 10:58:48 guy Exp $
* $Id: packet-gtp.c,v 1.15 2001/11/20 22:29:04 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -3684,12 +3684,11 @@ decode_gtp_proto_conf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
next_tvb = tvb_new_subset(tvb, offset + 5, proto_len + 2, proto_len + 2);
/* Save the current value of "pi", and adjust
certain fields to reflect the new top-level
tvbuff. */
/* XXX - is this still necessary? Do we have to
worry about subdissectors changing "pi", or,
given that we're no longer doing so, is that
no longer an issue? */
save_pi = pi;
pi.len = tvb_reported_length(next_tvb);
pi.captured_len = tvb_length(next_tvb);
call_dissector(ppp_handle, next_tvb, pinfo, ext_tree_proto);

View File

@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
* $Id: packet-ip.c,v 1.145 2001/11/20 21:59:12 guy Exp $
* $Id: packet-ip.c,v 1.146 2001/11/20 22:29:04 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1071,11 +1071,10 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* It's not fragmented. */
pinfo->fragmented = FALSE;
/* Save the current value of "pi", and adjust certain fields to
reflect the new tvbuff. */
/* XXX - is this still necessary? Do we have to worry about
subdissectors changing "pi", or, given that we're no longer
doing so, is that no longer an issue? */
save_pi = pi;
pi.len = tvb_reported_length(next_tvb);
pi.captured_len = tvb_length(next_tvb);
must_restore_pi = TRUE;
} else {
/* We don't have the complete reassembled payload. */

View File

@ -1,7 +1,7 @@
/* packet-ipv6.c
* Routines for IPv6 packet disassembly
*
* $Id: packet-ipv6.c,v 1.65 2001/11/15 10:58:48 guy Exp $
* $Id: packet-ipv6.c,v 1.66 2001/11/20 22:29:04 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -909,11 +909,10 @@ again:
/* It's not fragmented. */
pinfo->fragmented = FALSE;
/* Save the current value of "pi", and adjust certain fields to
reflect the new tvbuff. */
/* XXX - is this still necessary? Do we have to worry about
subdissectors changing "pi", or, given that we're no longer
doing so, is that no longer an issue? */
save_pi = pi;
pi.len = tvb_reported_length(next_tvb);
pi.captured_len = tvb_length(next_tvb);
must_restore_pi = TRUE;
} else {
/* We don't have the complete reassembled payload. */

View File

@ -1,7 +1,7 @@
/* packet-isl.c
* Routines for Cisco ISL Ethernet header disassembly
*
* $Id: packet-isl.c,v 1.26 2001/11/20 21:59:13 guy Exp $
* $Id: packet-isl.c,v 1.27 2001/11/20 22:29:04 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -150,8 +150,6 @@ dissect_isl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gint crc_offset;
gint captured_length;
tvbuff_t *next_tvb;
const guint8 *compat_pd;
int compat_offset;
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "ISL");
@ -241,15 +239,6 @@ dissect_isl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
next_tvb = tvb_new_subset(tvb, ISL_HEADER_SIZE, captured_length, length);
/* Set "pinfo"'s payload and captured-payload lengths to the values
we calculated.
XXX - when all dissectors are tvbuffified we shouldn't have to
do this any more. */
tvb_compat(next_tvb, &compat_pd, &compat_offset);
pinfo->len = compat_offset + length;
pinfo->captured_len = compat_offset + captured_length;
call_dissector(eth_handle, next_tvb, pinfo, tree);
}
}

View File

@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
* $Id: packet-tcp.c,v 1.114 2001/11/15 10:58:48 guy Exp $
* $Id: packet-tcp.c,v 1.115 2001/11/20 22:29:04 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -392,11 +392,11 @@ desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset,
/* indicate that this is reassembled data */
tcpinfo->is_reassembled = TRUE;
/* save current value of *pinfo across call to
dissector */
/* XXX - is this still necessary? Do we have to
worry about subdissectors changing "*pinfo", or,
given that we're no longer doing so, is that no
longer an issue? */
save_pi = *pinfo;
pinfo->len = tvb_reported_length(next_tvb);
pinfo->captured_len = tvb_length(next_tvb);
/* call subdissector */
decode_tcp_ports(next_tvb, 0, pinfo, tree,

View File

@ -2,7 +2,7 @@
* Routines for Wellfleet Compression frame disassembly
* Copyright 2001, Jeffrey C. Foster <jfoste@woodward.com>
*
* $Id: packet-wcp.c,v 1.12 2001/11/15 10:58:49 guy Exp $
* $Id: packet-wcp.c,v 1.13 2001/11/20 22:29:04 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -396,11 +396,10 @@ void dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
return;
}
/* Save the current value of "pi", and adjust certain fields to
reflect the new tvbuff. */
/* XXX - is this still necessary? Do we have to worry
about subdissectors changing "pi", or, given that
we're no longer doing so, is that no longer an issue? */
save_pi = pi;
pi.len = tvb_reported_length(next_tvb);
pi.captured_len = tvb_length(next_tvb);
must_restore_pi = TRUE;
}