diff options
author | Guy Harris <guy@alum.mit.edu> | 1999-08-18 00:57:54 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 1999-08-18 00:57:54 +0000 |
commit | ac4f87218d7bf56558225bc0f78a5a0af25687e6 (patch) | |
tree | e9e831bb1b3b77de445b70cbeb126f919f01bce2 /packet-udp.c | |
parent | d4331d432915144e57271b70a9bf6b867087c0a0 (diff) |
Declare the "packet_info" structure "pi" in "packet.h", rather than in a
bunch of source files.
Replace the "payload" field of a "packet_info" structure with "len" and
"captured_len" fields, which contain the total packet length and total
captured packet length (including all headers) at the current protocol
layer (i.e., if a given layer has a length field, and that length field
says its shorter than the length we got from the capture, reduce the
"pi.len" and "pi.captured_len" values appropriately). Those fields can
be used in the future if we add checks to make sure a field we're
extracting from a packet doesn't go past the end of the packet, or past
the captured part of the packet.
Get rid of the additional payload argument to some dissection functions;
use "pi.captured_len - offset" instead.
Have the END_OF_FRAME macro use "pi.captured_len" rather than
"fd->cap_len", so that "dissect the rest of the frame" becomes "dissect
the rest of the packet", and doesn't dissect end-of-frame padding such
as padding added to make an Ethernet frame 60 or more octets long. (We
might want to rename it END_OF_PACKET; if we ever want to label the
end-of-frame padding for the benefit of people curious what that extra
gunk is, we could have a separate END_OF_FRAME macro that uses
"fd->cap_len".)
svn path=/trunk/; revision=506
Diffstat (limited to 'packet-udp.c')
-rw-r--r-- | packet-udp.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/packet-udp.c b/packet-udp.c index 9ab7ebf959..46b5da9fe6 100644 --- a/packet-udp.c +++ b/packet-udp.c @@ -1,7 +1,7 @@ /* packet-udp.c * Routines for UDP packet disassembly * - * $Id: packet-udp.c,v 1.22 1999/08/05 00:05:00 guy Exp $ + * $Id: packet-udp.c,v 1.23 1999/08/18 00:57:54 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -44,8 +44,6 @@ #include "packet.h" #include "resolv.h" -extern packet_info pi; - int proto_udp = -1; int hf_udp_srcport = -1; int hf_udp_dstport = -1; @@ -175,7 +173,6 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { struct hash_struct *dissect_routine = NULL; proto_tree *udp_tree; proto_item *ti; - guint payload; /* To do: Check for {cap len,pkt len} < struct len */ /* Avoids alignment problems on many architectures. */ @@ -185,8 +182,6 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { uh_ulen = ntohs(uh.uh_ulen); uh_sum = ntohs(uh.uh_sum); - payload = pi.payload - sizeof(e_udphdr); - if (check_col(fd, COL_PROTOCOL)) col_add_str(fd, COL_PROTOCOL, "UDP"); if (check_col(fd, COL_INFO)) @@ -235,7 +230,7 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { } else if (PORT_IS(UDP_PORT_NBNS)) dissect_nbns(pd, offset, fd, tree); else if (PORT_IS(UDP_PORT_NBDGM)) - dissect_nbdgm(pd, offset, fd, tree, payload); + dissect_nbdgm(pd, offset, fd, tree); else if (PORT_IS(UDP_PORT_IPX)) /* RFC 1234 */ dissect_ipx(pd, offset, fd, tree); #if defined(HAVE_UCD_SNMP_SNMP_H) || defined(HAVE_SNMP_SNMP_H) |