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-telnet.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-telnet.c')
-rw-r--r-- | packet-telnet.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/packet-telnet.c b/packet-telnet.c index b1bbbdf10f..0654fdf5bd 100644 --- a/packet-telnet.c +++ b/packet-telnet.c @@ -1,8 +1,8 @@ -/* packet-pop.c +/* packet-telnet.c * Routines for telnet packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-telnet.c,v 1.4 1999/07/29 05:47:05 gram Exp $ + * $Id: packet-telnet.c,v 1.5 1999/08/18 00:57:53 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -113,8 +113,6 @@ char *options[] = { "TN3270E" }; -extern packet_info pi; - void telnet_sub_option(proto_tree *telnet_tree, char *rr, int *i, int offset, int max_data) { proto_tree *ti, *option_tree; @@ -306,12 +304,13 @@ void telnet_command(proto_tree *telnet_tree, char *rr, int *i, int offset, int m } void -dissect_telnet(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int max_data) +dissect_telnet(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree *telnet_tree, *ti; gchar rr[1500]; int i1; int i2; + int max_data = pi.captured_len - offset; memset(rr, '\0', sizeof(rr)); |