aboutsummaryrefslogtreecommitdiffstats
path: root/packet-nbns.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-01-20 22:12:39 +0000
committerGuy Harris <guy@alum.mit.edu>2002-01-20 22:12:39 +0000
commit92915713d33924bf25041255e5f2fe8b0c2cd2f6 (patch)
treeab76e260eae8b60be6c48d592bd36f74a00f3601 /packet-nbns.c
parenta0d7e9051920dea67c6558c65b9529f7d8609b85 (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-nbns.c')
-rw-r--r--packet-nbns.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/packet-nbns.c b/packet-nbns.c
index 76046a7bb8..dd9ee37aca 100644
--- a/packet-nbns.c
+++ b/packet-nbns.c
@@ -3,7 +3,7 @@
* to when it had only NBNS)
* Guy Harris <guy@alum.mit.edu>
*
- * $Id: packet-nbns.c,v 1.70 2002/01/19 23:59:03 guy Exp $
+ * $Id: packet-nbns.c,v 1.71 2002/01/20 22:12:26 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -927,7 +927,7 @@ dissect_query_records(tvbuff_t *tvb, int cur_off, int nbns_data_offset,
start_off = cur_off;
if (nbns_tree != NULL) {
- ti = proto_tree_add_text(nbns_tree, tvb, start_off, 0, "Queries");
+ ti = proto_tree_add_text(nbns_tree, tvb, start_off, -1, "Queries");
qatree = proto_item_add_subtree(ti, ett_nbns_qry);
}
while (count-- > 0) {
@@ -954,7 +954,7 @@ dissect_answer_records(tvbuff_t *tvb, int cur_off, int nbns_data_offset,
start_off = cur_off;
if (nbns_tree != NULL) {
- ti = proto_tree_add_text(nbns_tree, tvb, start_off, 0, name);
+ ti = proto_tree_add_text(nbns_tree, tvb, start_off, -1, name);
qatree = proto_item_add_subtree(ti, ett_nbns_ans);
}
while (count-- > 0) {
@@ -1005,8 +1005,8 @@ dissect_nbns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
if (tree) {
- ti = proto_tree_add_item(tree, proto_nbns, tvb, offset,
- tvb_length(tvb), FALSE);
+ ti = proto_tree_add_item(tree, proto_nbns, tvb, offset, -1,
+ FALSE);
nbns_tree = proto_item_add_subtree(ti, ett_nbns);
if (flags & F_RESPONSE) {
@@ -1203,8 +1203,8 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
if (tree) {
- ti = proto_tree_add_item(tree, proto_nbdgm, tvb, offset,
- tvb_length_remaining(tvb, offset), FALSE);
+ ti = proto_tree_add_item(tree, proto_nbdgm, tvb, offset, -1,
+ FALSE);
nbdgm_tree = proto_item_add_subtree(ti, ett_nbdgm);
proto_tree_add_uint(nbdgm_tree, hf_nbdgm_type, tvb,