aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bthci_cmd.c
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2015-10-18 15:06:30 +0200
committerMichal Labedzki <michal.labedzki@tieto.com>2015-11-20 16:00:15 +0000
commita90100631e1c3134313299f78760d7b1a91bc757 (patch)
treef1556dab1d60b176169b817ee164bfe0ce1549ab /epan/dissectors/packet-bthci_cmd.c
parentc44246448aea18de39dea15ad6ece062a43f348d (diff)
Bluetooth: Add ability to add custom UUID description
Some vendors use UUID128 as own services/attributes. Sometimes they use UUID16 for it too. Support both cases. Change-Id: I001692b94fcc2f86eafa81012790e9134b0f2a36 Reviewed-on: https://code.wireshark.org/review/11976 Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'epan/dissectors/packet-bthci_cmd.c')
-rw-r--r--epan/dissectors/packet-bthci_cmd.c73
1 files changed, 16 insertions, 57 deletions
diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c
index 8f009f481a..0126064dae 100644
--- a/epan/dissectors/packet-bthci_cmd.c
+++ b/epan/dissectors/packet-bthci_cmd.c
@@ -4889,7 +4889,6 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
guint8 type;
guint8 data_size;
gint64 end_offset;
- guint i_uuid;
gboolean has_bd_addr = FALSE;
guint8 bd_addr[6];
guint8 *name = NULL;
@@ -4945,22 +4944,12 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_uuid_32, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_item_append_text(sub_item, " (%s)", val_to_str_ext_const(tvb_get_ntohs(tvb, offset + 2), &bluetooth_uuid_vals_ext, "Unknown"));
} else {
- sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_custom_uuid, tvb, offset, 4, ENC_NA);
-
- i_uuid = 0;
- while (bluetooth_uuid_custom[i_uuid].name) {
- if (bluetooth_uuid_custom[i_uuid].size != 4) {
- i_uuid += 1;
- continue;
- }
+ bluetooth_uuid_t uuid;
- if (tvb_memeql(tvb, offset, bluetooth_uuid_custom[i_uuid].uuid, 4) == 0) {
- proto_item_append_text(sub_item, " (%s)", bluetooth_uuid_custom[i_uuid].name);
- break;
- }
+ sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_custom_uuid, tvb, offset, 4, ENC_NA);
+ uuid = get_uuid(tvb, offset, 4);
- i_uuid += 1;
- }
+ proto_item_append_text(sub_item, " (%s)", print_uuid(&uuid));
}
offset += 4;
@@ -4978,22 +4967,12 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_uuid_128, tvb, offset, 16, ENC_NA);
proto_item_append_text(sub_item, " (%s)", val_to_str_ext_const(tvb_get_ntohs(tvb, offset + 2), &bluetooth_uuid_vals_ext, "Unknown"));
} else {
- sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_custom_uuid, tvb, offset, 16, ENC_NA);
+ bluetooth_uuid_t uuid;
- i_uuid = 0;
- while (bluetooth_uuid_custom[i_uuid].name) {
- if (bluetooth_uuid_custom[i_uuid].size != 16) {
- i_uuid += 1;
- continue;
- }
-
- if (tvb_memeql(tvb, offset, bluetooth_uuid_custom[i_uuid].uuid, 16) == 0) {
- proto_item_append_text(sub_item, " (%s)", bluetooth_uuid_custom[i_uuid].name);
- break;
- }
+ sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_custom_uuid, tvb, offset, 16, ENC_NA);
+ uuid = get_uuid(tvb, offset, 16);
- i_uuid += 1;
- }
+ proto_item_append_text(sub_item, " (%s)", print_uuid(&uuid));
}
offset += 16;
@@ -5120,22 +5099,12 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_uuid_32, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_item_append_text(sub_item, " (%s)", val_to_str_ext_const(tvb_get_ntohs(tvb, offset + 2), &bluetooth_uuid_vals_ext, "Unknown"));
} else {
- sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_custom_uuid, tvb, offset, 4, ENC_NA);
+ bluetooth_uuid_t uuid;
- i_uuid = 0;
- while (bluetooth_uuid_custom[i_uuid].name) {
- if (bluetooth_uuid_custom[i_uuid].size != 4) {
- i_uuid += 1;
- continue;
- }
-
- if (tvb_memeql(tvb, offset, bluetooth_uuid_custom[i_uuid].uuid, 4) == 0) {
- proto_item_append_text(sub_item, " (%s)", bluetooth_uuid_custom[i_uuid].name);
- break;
- }
+ sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_custom_uuid, tvb, offset, 4, ENC_NA);
+ uuid = get_uuid(tvb, offset, 4);
- i_uuid += 1;
- }
+ proto_item_append_text(sub_item, " (%s)", print_uuid(&uuid));
}
offset += 4;
@@ -5151,22 +5120,12 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_uuid_128, tvb, offset, 16, ENC_NA);
proto_item_append_text(sub_item, " (%s)", val_to_str_ext_const(tvb_get_ntohs(tvb, offset + 2), &bluetooth_uuid_vals_ext, "Unknown"));
} else {
- sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_custom_uuid, tvb, offset, 16, ENC_NA);
+ bluetooth_uuid_t uuid;
- i_uuid = 0;
- while (bluetooth_uuid_custom[i_uuid].name) {
- if (bluetooth_uuid_custom[i_uuid].size != 16) {
- i_uuid += 1;
- continue;
- }
-
- if (tvb_memeql(tvb, offset, bluetooth_uuid_custom[i_uuid].uuid, 16) == 0) {
- proto_item_append_text(sub_item, " (%s)", bluetooth_uuid_custom[i_uuid].name);
- break;
- }
+ sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_custom_uuid, tvb, offset, 16, ENC_NA);
+ uuid = get_uuid(tvb, offset, 16);
- i_uuid += 1;
- }
+ proto_item_append_text(sub_item, " (%s)", print_uuid(&uuid));
}
offset += 16;