summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-loop.c
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2006-03-16 17:47:45 +0000
committerJaap Keuter <jaap.keuter@xs4all.nl>2006-03-16 17:47:45 +0000
commitc673b2f4f1c9b5ae1979ac25ce5ed7e545fc6a4c (patch)
tree30a4cd23f3fc88c5212d3db4166b89df63d5a0d6 /epan/dissectors/packet-loop.c
parentd3efbd7284848fd38529325d5665f3979a2b2e2b (diff)
downloadwireshark-c673b2f4f1c9b5ae1979ac25ce5ed7e545fc6a4c.tar.gz
Fixed skipCount decoding. Added "relevant function" tag and put relevant function into INFO column.
svn path=/trunk/; revision=17646
Diffstat (limited to 'epan/dissectors/packet-loop.c')
-rw-r--r--epan/dissectors/packet-loop.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/epan/dissectors/packet-loop.c b/epan/dissectors/packet-loop.c
index 698c63bc7b..31cd864107 100644
--- a/epan/dissectors/packet-loop.c
+++ b/epan/dissectors/packet-loop.c
@@ -60,7 +60,9 @@ dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item *ti;
guint16 function;
int offset = 0;
- gboolean set_info = FALSE;
+ int skip_offset;
+ gboolean set_info = TRUE;
+ gboolean more_function;
tvbuff_t *next_tvb;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
@@ -69,21 +71,24 @@ dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_clear(pinfo->cinfo, COL_INFO);
if (tree) {
- ti = proto_tree_add_item(tree, proto_loop, tvb, 0, -1, FALSE);
+ ti = proto_tree_add_item(tree, proto_loop, tvb, offset, -1, FALSE);
loop_tree = proto_item_add_subtree(ti, ett_loop);
+
+ proto_tree_add_item(loop_tree, hf_loop_skipcount, tvb, offset, 2, TRUE);
}
+ skip_offset = 2 + tvb_get_ntohs(tvb, offset);
+ offset += 2;
- for (;;) {
- if (tree)
- proto_tree_add_item(loop_tree, hf_loop_skipcount, tvb, offset, 2, TRUE);
- offset += 2;
+ do {
function = tvb_get_letohs(tvb, offset);
- if (!set_info) {
+ if (offset == skip_offset) {
if (check_col(pinfo->cinfo, COL_INFO)) {
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(function, function_vals, "Unknown function (%u)"));
}
- set_info = TRUE;
+ if (tree)
+ proto_tree_add_text(loop_tree, tvb, offset, 2, "Relevant function:");
+ set_info = FALSE;
}
if (tree)
proto_tree_add_uint(loop_tree, hf_loop_function, tvb, offset, 2, function);
@@ -95,22 +100,31 @@ dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(loop_tree, hf_loop_receipt_number, tvb, offset, 2,
TRUE);
offset += 2;
- next_tvb = tvb_new_subset(tvb, offset, -1, -1);
- call_dissector(data_handle, next_tvb, pinfo, tree);
- return;
+ more_function = FALSE;
+ break;
case FUNC_FORWARD_DATA:
if (tree)
proto_tree_add_item(loop_tree, hf_loop_forwarding_address, tvb, offset,
6, FALSE);
offset += 6;
+ more_function = TRUE;
break;
default:
- next_tvb = tvb_new_subset(tvb, offset, -1, -1);
- call_dissector(data_handle, next_tvb, pinfo, tree);
- return;
+ more_function = FALSE;
+ break;
}
+ } while (more_function);
+
+ if (set_info && check_col(pinfo->cinfo, COL_INFO)) {
+ col_add_str(pinfo->cinfo, COL_INFO, "No valid function found");
+ }
+
+ if (tvb_length_remaining(tvb, offset) > 0)
+ {
+ next_tvb = tvb_new_subset(tvb, offset, -1, -1);
+ call_dissector(data_handle, next_tvb, pinfo, tree);
}
}