diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-01-20 22:12:39 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-01-20 22:12:39 +0000 |
commit | 92915713d33924bf25041255e5f2fe8b0c2cd2f6 (patch) | |
tree | ab76e260eae8b60be6c48d592bd36f74a00f3601 /packet-pcnfsd.c | |
parent | a0d7e9051920dea67c6558c65b9529f7d8609b85 (diff) |
Allow a length of -1 to be specified when adding FT_NONE and FT_PROTOCOL
items to the protocol tree; it's interpreted as "the rest of the data in
the tvbuff". This can be used if
1) the item covers the entire packet or the remaining payload in
the packet
or
2) the item's length won't be known until it's dissected, and
will be then set with "proto_item_set_len()" - if an
exception is thrown in the dissection, it means the item ran
*past* the end of the tvbuff, so saying it runs to the end of
the tvbuff is reasonable.
Convert a number of "proto_tree_add_XXX()" calls using
"tvb_length_remaining()", values derived from the result of
"tvb_length()", or 0 (in the case of items whose length is unknown) to
use -1 instead (using 0 means that if an exception is thrown, selecting
the item highlights nothing; using -1 means it highlights all the data
for that item that's available).
In some places where "tvb_length()" or "tvb_length_remaining()" was used
to determine how large a packet is, use "tvb_reported_length()" or
"tvb_reported_length_remaining()", instead - the first two calls
indicate how much captured data was in the packet, the latter two calls
indicate how large the packet actually was (and the fact that using the
latter could cause BoundsError exceptions to be thrown is a feature - if
such an exception is thrown, the frame really *was* short, and it should
be tagged as such).
Replace some "proto_tree_add_XXX()" calls with equivalent
"proto_tree_add_item()" calls.
Fix some indentation.
svn path=/trunk/; revision=4578
Diffstat (limited to 'packet-pcnfsd.c')
-rw-r--r-- | packet-pcnfsd.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/packet-pcnfsd.c b/packet-pcnfsd.c index 819b8ec87a..99e5e25f31 100644 --- a/packet-pcnfsd.c +++ b/packet-pcnfsd.c @@ -1,10 +1,10 @@ /* packet-pcnfsd.c * Routines for PCNFSD dissection * - * $Id: packet-pcnfsd.c,v 1.3 2001/11/07 07:05:58 girlich Exp $ + * $Id: packet-pcnfsd.c,v 1.4 2002/01/20 22:12:27 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs * * Copied from packet-ypbind.c @@ -93,8 +93,7 @@ dissect_pcnfsd2_auth_call(tvbuff_t *tvb, int offset, packet_info *pinfo, if (tree) { ident_item = proto_tree_add_text(tree, tvb, - offset, tvb_length_remaining(tvb, offset), - "Authentication Ident"); + offset, -1, "Authentication Ident"); if (ident_item) ident_tree = proto_item_add_subtree( ident_item, ett_pcnfsd_auth_ident); @@ -125,8 +124,7 @@ dissect_pcnfsd2_auth_call(tvbuff_t *tvb, int offset, packet_info *pinfo, if (tree) { password_item = proto_tree_add_text(tree, tvb, - offset, tvb_length_remaining(tvb, offset), - "Authentication Password"); + offset, -1, "Authentication Password"); if (password_item) password_tree = proto_item_add_subtree( password_item, ett_pcnfsd_auth_password); |