aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-btsap.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-02 19:20:04 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-02 19:20:04 +0000
commita267501b82a84ab3d5b9cb7d2f06129d5ca57e42 (patch)
tree056e815b8f475e4c3b5ae57d80f89e202d47aa13 /epan/dissectors/packet-btsap.c
parent2c85824a469dba2edc674f29a18058bcec19139e (diff)
Bluetooth: Use dissector data instead of pinfo->private_data. Bug 7893 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7893)
From Michal Labedzki svn path=/trunk/; revision=53051
Diffstat (limited to 'epan/dissectors/packet-btsap.c')
-rw-r--r--epan/dissectors/packet-btsap.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/epan/dissectors/packet-btsap.c b/epan/dissectors/packet-btsap.c
index 5f554427ea..f553b8b0e1 100644
--- a/epan/dissectors/packet-btsap.c
+++ b/epan/dissectors/packet-btsap.c
@@ -82,6 +82,7 @@ static gint ett_btsap = -1;
static gint ett_btsap_parameter = -1;
static expert_field ei_btsap_parameter_error = EI_INIT;
+static expert_field ei_unexpected_data = EI_INIT;
static gint top_dissect = TOP_DISSECT_INTERNAL;
@@ -382,8 +383,8 @@ dissect_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree,
return offset;
}
-static void
-dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *ti;
proto_tree *btsap_tree;
@@ -397,6 +398,8 @@ dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint i_parameter;
guint i_next_parameter;
+ ti = proto_tree_add_item(tree, proto_btsap, tvb, offset, -1, ENC_NA);
+ btsap_tree = proto_item_add_subtree(ti, ett_btsap);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SAP");
@@ -413,9 +416,6 @@ dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
- ti = proto_tree_add_item(tree, proto_btsap, tvb, offset, -1, ENC_NA);
- btsap_tree = proto_item_add_subtree(ti, ett_btsap);
-
proto_tree_add_item(btsap_tree, hf_btsap_header_msg_id, tvb, offset, 1, ENC_BIG_ENDIAN);
msg_id = tvb_get_guint8(tvb, offset);
col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(msg_id, msg_id_vals, "Unknown MsgID"));
@@ -579,9 +579,10 @@ dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb, offset, 0, "Too many parameters");
}
- if (tvb_length(tvb) > offset) {
- proto_tree_add_item(btsap_tree, hf_btsap_data, tvb, offset, -1, ENC_NA);
- }
+ if (tvb_length(tvb) > offset)
+ proto_tree_add_expert(tree, pinfo, &ei_unexpected_data, tvb, offset, -1);
+
+ return offset;
}
@@ -708,10 +709,11 @@ proto_register_btsap(void)
static ei_register_info ei[] = {
{ &ei_btsap_parameter_error, { "btsap.parameter_error", PI_PROTOCOL, PI_WARN, "Parameter error", EXPFILL }},
+ { &ei_unexpected_data, { "btsap.unexpected_data", PI_PROTOCOL, PI_WARN, "Unexpected_data", EXPFILL }},
};
proto_btsap = proto_register_protocol("Bluetooth SAP Profile", "BT SAP", "btsap");
- register_dissector("btsap", dissect_btsap, proto_btsap);
+ new_register_dissector("btsap", dissect_btsap, proto_btsap);
proto_register_field_array(proto_btsap, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));