diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 1999-08-18 00:57:54 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 1999-08-18 00:57:54 +0000 |
commit | 973eb23d6688f6f75caa89958d847c5e9bd0beea (patch) | |
tree | e9e831bb1b3b77de445b70cbeb126f919f01bce2 /packet-nntp.c | |
parent | 3104122f7df1c1e0814136c22de0f0487d01968f (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".)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@506 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-nntp.c')
-rw-r--r-- | packet-nntp.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/packet-nntp.c b/packet-nntp.c index 01dd9da4d5..06af7db8d1 100644 --- a/packet-nntp.c +++ b/packet-nntp.c @@ -2,7 +2,7 @@ * Routines for nntp packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-nntp.c,v 1.3 1999/07/29 05:47:00 gram Exp $ + * $Id: packet-nntp.c,v 1.4 1999/08/18 00:57:52 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -41,18 +41,17 @@ #include <glib.h> #include "packet.h" -extern packet_info pi; - static int proto_nntp = -1; void -dissect_nntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int max_data) +dissect_nntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { gchar *type; proto_tree *nntp_tree, *ti; const u_char *data, *dataend; const u_char *lineend, *eol; int linelen; + int max_data = pi.captured_len - offset; data = &pd[offset]; dataend = data + END_OF_FRAME; |