aboutsummaryrefslogtreecommitdiffstats
path: root/packet-smb-pipe.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-smb-pipe.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-smb-pipe.c')
-rw-r--r--packet-smb-pipe.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/packet-smb-pipe.c b/packet-smb-pipe.c
index 450d464542..c1c4403cf0 100644
--- a/packet-smb-pipe.c
+++ b/packet-smb-pipe.c
@@ -8,7 +8,7 @@ XXX Fixme : shouldnt show [malformed frame] for long packets
* significant rewrite to tvbuffify the dissector, Ronnie Sahlberg and
* Guy Harris 2001
*
- * $Id: packet-smb-pipe.c,v 1.64 2002/01/17 06:29:16 guy Exp $
+ * $Id: packet-smb-pipe.c,v 1.65 2002/01/20 22:12:28 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -715,8 +715,7 @@ netshareenum_shares_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int offset)
{
if (tree) {
- return proto_tree_add_text(tree, tvb, offset,
- tvb_length_remaining(tvb, offset),
+ return proto_tree_add_text(tree, tvb, offset, -1,
"Available Shares");
} else
return NULL;
@@ -730,8 +729,7 @@ netshareenum_share_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int offset)
{
if (tree) {
- return proto_tree_add_text(tree, tvb, offset,
- tvb_length_remaining(tvb, offset),
+ return proto_tree_add_text(tree, tvb, offset, -1,
"Share %.13s", tvb_get_ptr(tvb, offset, 13));
} else
return NULL;
@@ -908,8 +906,8 @@ netserverenum2_servers_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int offset)
{
if (tree) {
- return proto_tree_add_text(tree, tvb, offset,
- tvb_length_remaining(tvb, offset), "Servers");
+ return proto_tree_add_text(tree, tvb, offset, -1,
+ "Servers");
} else
return NULL;
}
@@ -922,8 +920,7 @@ netserverenum2_server_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int offset)
{
if (tree) {
- return proto_tree_add_text(tree, tvb, offset,
- tvb_length_remaining(tvb, offset),
+ return proto_tree_add_text(tree, tvb, offset, -1,
"Server %.16s", tvb_get_ptr(tvb, offset, 16));
} else
return NULL;
@@ -1893,8 +1890,7 @@ dissect_response_data(tvbuff_t *tvb, packet_info *pinfo, int convert,
* We can't dissect the data; just show it
* as raw data.
*/
- proto_tree_add_text(tree, tvb, offset,
- tvb_length_remaining(tvb, offset),
+ proto_tree_add_text(tree, tvb, offset, -1,
"Data (no descriptor available)");
offset += tvb_length_remaining(tvb, offset);
} else {
@@ -2002,7 +1998,7 @@ dissect_pipe_lanman(tvbuff_t *pd_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb,
if (parent_tree) {
item = proto_tree_add_item(parent_tree, proto_smb_lanman,
- pd_tvb, 0, tvb_length(pd_tvb), FALSE);
+ pd_tvb, 0, -1, FALSE);
tree = proto_item_add_subtree(item, ett_lanman);
}