diff options
author | Michal Labedzki <michal.labedzki@tieto.com> | 2014-12-12 11:24:44 +0100 |
---|---|---|
committer | Michal Labedzki <michal.labedzki@tieto.com> | 2014-12-18 11:03:05 +0000 |
commit | f5cd21543d332f6c14da88ebd50730750f791dd4 (patch) | |
tree | b10694bfabdbdb3d20bb0c011fe9c489676d59e6 /epan/dissectors/packet-hci_h1.c | |
parent | 4a467ff609f1b5ee99cbc1aaccdc7b78d3cbecbc (diff) |
Bluetooth: Add generic Bluetooth dissector
Bluetooth dissector is used to add ability to filter all bluetooth
payload from capture files (there are many transport like:
hci_h4, hci_h1, hci_usb, hci_mon, btle). Also it is used to placeholder for
all data tree used to store additional informations like bd_addrs, names, etc.
Finally it is used to be one point for Bluetooth
Endpoints/Conversation filtering what is enabled now.
Also add Master/Slave Role and Connection Mode tracking.
Change-Id: I67048080fb8ee16fa0f4ec429c1257de81ddd737
Reviewed-on: https://code.wireshark.org/review/5771
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'epan/dissectors/packet-hci_h1.c')
-rw-r--r-- | epan/dissectors/packet-hci_h1.c | 50 |
1 files changed, 11 insertions, 39 deletions
diff --git a/epan/dissectors/packet-hci_h1.c b/epan/dissectors/packet-hci_h1.c index 1e2ce5b6dd..bdea12dac4 100644 --- a/epan/dissectors/packet-hci_h1.c +++ b/epan/dissectors/packet-hci_h1.c @@ -27,7 +27,7 @@ #include <epan/wmem/wmem.h> #include <wiretap/wtap.h> -#include "packet-bluetooth-hci.h" +#include "packet-bluetooth.h" static int proto_hci_h1 = -1; @@ -40,12 +40,6 @@ static dissector_table_t hci_h1_table; static dissector_handle_t hci_h1_handle; static dissector_handle_t data_handle; -static wmem_tree_t *chandle_sessions = NULL; -static wmem_tree_t *chandle_to_bdaddr_table = NULL; -static wmem_tree_t *bdaddr_to_name_table = NULL; -static wmem_tree_t *localhost_name = NULL; -static wmem_tree_t *localhost_bdaddr = NULL; - static const value_string hci_h1_type_vals[] = { {BTHCI_CHANNEL_COMMAND, "HCI Command"}, {BTHCI_CHANNEL_ACL, "ACL Data"}, @@ -60,20 +54,19 @@ static const value_string hci_h1_direction_vals[] = { {0, NULL} }; -static guint32 max_disconnect_in_frame = G_MAXUINT32; - - void proto_register_hci_h1(void); void proto_reg_handoff_hci_h1(void); static gint -dissect_hci_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +dissect_hci_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - guint8 type; - tvbuff_t *next_tvb; - proto_item *ti = NULL; - proto_tree *hci_h1_tree = NULL; - hci_data_t *hci_data; + guint8 type; + tvbuff_t *next_tvb; + proto_item *ti = NULL; + proto_tree *hci_h1_tree = NULL; + bluetooth_data_t *bluetooth_data; + + bluetooth_data = (bluetooth_data_t *) data; col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCI"); @@ -112,26 +105,11 @@ dissect_hci_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ val_to_str(type, hci_h1_type_vals, "Unknown 0x%02x")); - hci_data = wmem_new(wmem_packet_scope(), hci_data_t); - if (pinfo->phdr->presence_flags & WTAP_HAS_INTERFACE_ID) - hci_data->interface_id = pinfo->phdr->interface_id; - else - hci_data->interface_id = HCI_INTERFACE_DEFAULT; - hci_data->adapter_id = HCI_ADAPTER_DEFAULT; - hci_data->adapter_disconnect_in_frame = &max_disconnect_in_frame; - hci_data->chandle_sessions = chandle_sessions; - hci_data->chandle_to_bdaddr_table = chandle_to_bdaddr_table; - hci_data->bdaddr_to_name_table = bdaddr_to_name_table; - hci_data->localhost_bdaddr = localhost_bdaddr; - hci_data->localhost_name = localhost_name; - - pinfo->ptype = PT_BLUETOOTH; - ti = proto_tree_add_int(hci_h1_tree, hf_hci_h1_direction, tvb, 0, 0, pinfo->p2p_dir); PROTO_ITEM_SET_GENERATED(ti); next_tvb = tvb_new_subset_remaining(tvb, 0); - if (!dissector_try_uint_new(hci_h1_table, type, next_tvb, pinfo, tree, TRUE, hci_data)) { + if (!dissector_try_uint_new(hci_h1_table, type, next_tvb, pinfo, tree, TRUE, bluetooth_data)) { call_dissector(data_handle, next_tvb, pinfo, tree); } @@ -164,12 +142,6 @@ proto_register_hci_h1(void) hci_h1_table = register_dissector_table("hci_h1.type", "HCI h1 pdu type", FT_UINT8, BASE_HEX); - - chandle_sessions = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); - chandle_to_bdaddr_table = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); /* adapter, chandle: bdaddr */ - bdaddr_to_name_table = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); /* bdaddr: name */ - localhost_bdaddr = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); /* adapter, frame: bdaddr */ - localhost_name = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); /* adapter, frame: name */ } void @@ -177,7 +149,7 @@ proto_reg_handoff_hci_h1(void) { data_handle = find_dissector("data"); - dissector_add_uint("wtap_encap", WTAP_ENCAP_BLUETOOTH_HCI, hci_h1_handle); + dissector_add_uint("bluetooth.encap", WTAP_ENCAP_BLUETOOTH_HCI, hci_h1_handle); } /* |