From 3faec795e9c5b5f153f66960c11673c2f53e4243 Mon Sep 17 00:00:00 2001 From: Michal Labedzki Date: Mon, 8 Jun 2015 19:38:48 +0200 Subject: Qt/Bluetooth: Add HCI Summary dialogue HCI Summary dialogue collect HCI Opcodes, HCI Events, Hardware Errors, Statuses and Reasons. Also show occurrence of them. The top level item is group of items (by OGF or types), the second level item is in real command, event, hardware error, status or reason. The third level items are direct link to packet that contains second level item type. Change-Id: I6b6bd02533c4605a2dd2c1f5dfee46f72a0f3fdc Reviewed-on: https://code.wireshark.org/review/9676 Reviewed-by: Alexis La Goutte Tested-by: Alexis La Goutte Petri-Dish: Michal Labedzki Tested-by: Petri Dish Buildbot Reviewed-by: Michal Labedzki --- epan/dissectors/packet-bthci_vendor.c | 69 ++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) (limited to 'epan/dissectors/packet-bthci_vendor.c') diff --git a/epan/dissectors/packet-bthci_vendor.c b/epan/dissectors/packet-bthci_vendor.c index 62872ac275..813ee013ab 100644 --- a/epan/dissectors/packet-bthci_vendor.c +++ b/epan/dissectors/packet-bthci_vendor.c @@ -26,6 +26,7 @@ #include #include +#include #include "packet-bluetooth.h" #include "packet-bthci_cmd.h" @@ -404,6 +405,28 @@ dissect_bthci_vendor_broadcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre else col_append_fstr(pinfo->cinfo, COL_INFO, "Unknown Command 0x%04X (opcode 0x%04X)", ocf, opcode); + if (have_tap_listener(bluetooth_hci_summary_tap)) { + bluetooth_hci_summary_tap_t *tap_hci_summary; + + tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t); + if (bluetooth_data) { + tap_hci_summary->interface_id = bluetooth_data->interface_id; + tap_hci_summary->adapter_id = bluetooth_data->adapter_id; + } else { + tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT; + tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT; + } + + tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_VENDOR_OPCODE; + tap_hci_summary->ogf = opcode >> 10; + tap_hci_summary->ocf = ocf; + if (try_val_to_str(ocf, opcode_ocf_vals)) + tap_hci_summary->name = description; + else + tap_hci_summary->name = NULL; + tap_queue_packet(bluetooth_hci_summary_tap, pinfo, tap_hci_summary); + } + proto_tree_add_item(main_tree, hf_parameter_length, tvb, offset, 1, ENC_NA); length = tvb_get_guint8(tvb, offset); offset += 1; @@ -757,10 +780,32 @@ dissect_bthci_vendor_broadcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre col_add_fstr(pinfo->cinfo, COL_INFO, "Rcvd Broadcom "); event_code = tvb_get_guint8(tvb, offset); - col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(event_code, &bthci_evt_evt_code_vals_ext, "Unknown 0x%08x")); + description = val_to_str_ext_const(event_code, &bthci_evt_evt_code_vals_ext, "Unknown 0x%08x"); + col_append_str(pinfo->cinfo, COL_INFO, description); proto_tree_add_item(main_tree, hf_event_code, tvb, offset, 1, ENC_NA); offset += 1; + if (have_tap_listener(bluetooth_hci_summary_tap)) { + bluetooth_hci_summary_tap_t *tap_hci_summary; + + tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t); + if (bluetooth_data) { + tap_hci_summary->interface_id = bluetooth_data->interface_id; + tap_hci_summary->adapter_id = bluetooth_data->adapter_id; + } else { + tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT; + tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT; + } + + tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_VENDOR_EVENT; + tap_hci_summary->event = event_code; + if (try_val_to_str_ext(event_code, &bthci_evt_evt_code_vals_ext)) + tap_hci_summary->name = description; + else + tap_hci_summary->name = NULL; + tap_queue_packet(bluetooth_hci_summary_tap, pinfo, tap_hci_summary); + } + proto_tree_add_item(main_tree, hf_parameter_length, tvb, offset, 1, ENC_NA); length = tvb_get_guint8(tvb, offset); offset += 1; @@ -785,6 +830,28 @@ dissect_bthci_vendor_broadcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre else col_append_fstr(pinfo->cinfo, COL_INFO, " (Unknown Command 0x%04X [opcode 0x%04X])", ocf, opcode); + if (have_tap_listener(bluetooth_hci_summary_tap)) { + bluetooth_hci_summary_tap_t *tap_hci_summary; + + tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t); + if (bluetooth_data) { + tap_hci_summary->interface_id = bluetooth_data->interface_id; + tap_hci_summary->adapter_id = bluetooth_data->adapter_id; + } else { + tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT; + tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT; + } + + tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_VENDOR_EVENT_OPCODE; + tap_hci_summary->ogf = opcode >> 10; + tap_hci_summary->ocf = ocf; + if (try_val_to_str(ocf, opcode_ocf_vals)) + tap_hci_summary->name = description; + else + tap_hci_summary->name = NULL; + tap_queue_packet(bluetooth_hci_summary_tap, pinfo, tap_hci_summary); + } + proto_tree_add_item(main_tree, hf_status, tvb, offset, 1, ENC_NA); status = tvb_get_guint8(tvb, offset); offset += 1; -- cgit v1.2.3