aboutsummaryrefslogtreecommitdiffstats
path: root/packet-dvmrp.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2002-01-20 22:12:39 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2002-01-20 22:12:39 +0000
commitaa3eb1c5e4884aaad42f635092d22484120ce279 (patch)
treeab76e260eae8b60be6c48d592bd36f74a00f3601 /packet-dvmrp.c
parentb041d69838e023a82b0673b2b95c1fc92e647b52 (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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4578 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-dvmrp.c')
-rw-r--r--packet-dvmrp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/packet-dvmrp.c b/packet-dvmrp.c
index 79e03f4e0c..094291da36 100644
--- a/packet-dvmrp.c
+++ b/packet-dvmrp.c
@@ -1,7 +1,7 @@
/* packet-dvmrp.c 2001 Ronnie Sahlberg <See AUTHORS for email>
* Routines for IGMP/DVMRP packet disassembly
*
- * $Id: packet-dvmrp.c,v 1.5 2001/12/23 21:36:57 guy Exp $
+ * $Id: packet-dvmrp.c,v 1.6 2002/01/20 22:12:25 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -251,7 +251,7 @@ dissect_v3_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, in
int old_offset = offset;
item = proto_tree_add_item(parent_tree, hf_route,
- tvb, offset, 0, FALSE);
+ tvb, offset, -1, FALSE);
tree = proto_item_add_subtree(item, ett_route);
m0 = 0xff;
@@ -479,14 +479,14 @@ dissect_dvmrp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int
offset += 2;
/* decode all the v1 commands */
- while (tvb_length_remaining(tvb, offset)) {
+ while (tvb_reported_length_remaining(tvb, offset)) {
proto_tree *tree;
proto_item *item;
guint8 cmd,count;
int old_offset = offset;
item = proto_tree_add_item(parent_tree, hf_commands,
- tvb, offset, 0, FALSE);
+ tvb, offset, -1, FALSE);
tree = proto_item_add_subtree(item, ett_commands);
cmd = tvb_get_guint8(tvb, offset);
@@ -637,7 +637,7 @@ dissect_dvmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int of
return offset+tvb_length_remaining(tvb, offset);
}
- item = proto_tree_add_item(parent_tree, proto_dvmrp, tvb, offset, 0, FALSE);
+ item = proto_tree_add_item(parent_tree, proto_dvmrp, tvb, offset, -1, FALSE);
tree = proto_item_add_subtree(item, ett_dvmrp);