aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-01-02 13:48:41 -0500
committerMichael Mann <mmann78@netscape.net>2017-01-11 12:55:30 +0000
commitd8be254a51f8c4bfb3a726868c1b03371526a0db (patch)
treeebde7969150ece6bb7b0e036d106b866b9575989 /epan/dissectors
parent2d6f87623b9cf2a209d4145f7c31fc13dbc24dd3 (diff)
packet-btatt.c: Use protocol information from dissector handle instead of pinfo data for attributes.
Instead of using a dissector function placed in a dissector table, just use the protocol information registered with the dissector table to create the desired dissector tree. Change-Id: Ic32b15e3c05d73df6e8f69890c47172e991bda6f Reviewed-on: https://code.wireshark.org/review/19509 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-btatt.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/epan/dissectors/packet-btatt.c b/epan/dissectors/packet-btatt.c
index 2cc77e747a..f2a84c18da 100644
--- a/epan/dissectors/packet-btatt.c
+++ b/epan/dissectors/packet-btatt.c
@@ -4036,6 +4036,9 @@ dissect_handle(proto_tree *tree, packet_info *pinfo, gint hf,
}
static gint
+btatt_dissect_attribute_handle(guint16 handle, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, btatt_data_t *att_data);
+
+static gint
dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info *pinfo, tvbuff_t *old_tvb,
gint old_offset, gint length, guint16 handle, bluetooth_uuid_t uuid, btatt_data_t *att_data)
{
@@ -4069,7 +4072,7 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info *
p_add_proto_data(pinfo->pool, pinfo, proto_btatt, PROTO_DATA_BTATT_HANDLE, value_data);
}
- if (dissector_try_uint_new(att_handle_dissector_table, handle, tvb, pinfo, tree, TRUE, att_data))
+ if (btatt_dissect_attribute_handle(handle, tvb, pinfo, tree, att_data))
return old_offset + length;
if (p_get_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID) == NULL) {
@@ -9225,6 +9228,39 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info *
return old_offset + offset;
}
+static gint
+btatt_dissect_attribute_handle(guint16 handle, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, btatt_data_t *att_data)
+{
+ proto_item *main_item;
+ proto_tree *main_tree;
+ proto_item *patron_item = NULL;
+ bluetooth_uuid_t uuid;
+ dissector_handle_t attribute_handler;
+ const char* attribute_name;
+
+ attribute_handler = dissector_get_uint_handle(att_handle_dissector_table, handle);
+ if (attribute_handler == NULL)
+ return 0;
+
+ main_item = proto_tree_add_item(tree, dissector_handle_get_protocol_index(attribute_handler), tvb, 0, tvb_captured_length(tvb), ENC_NA);
+ main_tree = proto_item_add_subtree(main_item, ett_btgatt);
+
+ attribute_name = dissector_handle_get_short_name(attribute_handler);
+ if (strlen(attribute_name) > 7) {
+ uuid.size = 2;
+ uuid.bt_uuid = (guint16) g_ascii_strtoull(attribute_name + strlen(attribute_name) - 7, NULL, 16);
+ uuid.data[1] = uuid.bt_uuid & 0xFF;
+ uuid.data[0] = (uuid.bt_uuid >> 8) & 0xFF;
+ } else {
+ uuid.size = 2;
+ uuid.bt_uuid = 0;
+ }
+
+ return dissect_attribute_value(main_tree, patron_item, pinfo, tvb,
+ 0, tvb_captured_length(tvb), 0, uuid, att_data);
+
+}
+
static int
dissect_btgatt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{