aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Pawlowski <jpawlowski@google.com>2016-12-13 17:03:55 -0800
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2016-12-18 18:33:52 +0000
commit4b613a174e42e78031276a1e230497e993b1d534 (patch)
treeebf233eb12ce2691068af12ee13fb5d414d54d43
parent527eefa5132b47c431255b0681559a9496d45eb4 (diff)
Bluetooth: BTLE: Add new commands parsing
Add "LE Set Extended Advertising Data", "LE Set Extended Scan Response Data", and "LE Set Extended Advertising Enable" command parser. Change-Id: I3027dc9c213c15f503fa5495829726db3a207300 Reviewed-on: https://code.wireshark.org/review/19251 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
-rw-r--r--epan/dissectors/packet-bthci_cmd.c89
1 files changed, 89 insertions, 0 deletions
diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c
index d3dc8aa797..ad61d54d92 100644
--- a/epan/dissectors/packet-bthci_cmd.c
+++ b/epan/dissectors/packet-bthci_cmd.c
@@ -358,6 +358,11 @@ static int hf_bthci_cmd_sec_adv_max_skip = -1;
static int hf_bthci_cmd_secondary_advertising_phy = -1;
static int hf_bthci_cmd_advertising_sid = -1;
static int hf_bthci_cmd_scan_req_notif_en = -1;
+static int hf_bthci_cmd_le_adv_data_operation = -1;
+static int hf_bthci_cmd_le_adv_data_frag_pref = -1;
+static int hf_bthci_cmd_le_adv_en_sets = -1;
+static int hf_bthci_cmd_le_adv_duration = -1;
+static int hf_bthci_cmd_le_adv_max_extended_events = -1;
static const int *hfx_bthci_cmd_le_event_mask[] = {
@@ -1689,6 +1694,20 @@ static const value_string cmd_le_secondary_advertising_phy[] = {
{ 0, NULL }
};
+static const value_string cmd_le_adv_data_operation[] = {
+ { 0x00, "Intermediate fragment of fragmented data" },
+ { 0x01, "First fragment of fragmented data" },
+ { 0x02, "Last fragment of fragmented data" },
+ { 0x03, "Complete scan response data" },
+ { 0, NULL }
+};
+
+static const value_string cmd_le_adv_data_frag_pref[] = {
+ { 0x00, "The Controller may fragment all Host data" },
+ { 0x01, "The Controller should not fragment or should minimize fragmentation of Host data" },
+ { 0, NULL }
+};
+
void proto_register_bthci_cmd(void);
void proto_reg_handoff_bthci_cmd(void);
void proto_register_btcommon(void);
@@ -3452,6 +3471,51 @@ dissect_le_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
offset++;
break;
+ case 0x037: /* LE Set Extended Advertising Data */
+ case 0x038: /* LE Set Extended Scan Response Data */
+ {
+ proto_tree_add_item(tree, hf_bthci_cmd_advertising_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset+=1;
+ proto_tree_add_item(tree, hf_bthci_cmd_le_adv_data_operation, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset+=1;
+ proto_tree_add_item(tree, hf_bthci_cmd_le_adv_data_frag_pref, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset+=1;
+
+ bluetooth_eir_ad_data_t *ad_data;
+ ad_data = wmem_new0(wmem_packet_scope(), bluetooth_eir_ad_data_t);
+ ad_data->interface_id = bluetooth_data->interface_id;
+ ad_data->adapter_id = bluetooth_data->adapter_id;
+ ad_data->bd_addr = NULL;
+
+ guint8 data_length = tvb_get_guint8(tvb, offset);
+ proto_tree_add_item(tree, hf_bthci_cmd_le_data_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset++;
+ call_dissector_with_data(btcommon_ad_handle, tvb_new_subset_length(tvb, offset, data_length), pinfo, tree, ad_data);
+ save_local_device_name_from_eir_ad(tvb, offset, pinfo, data_length, bluetooth_data);
+ offset += data_length;
+ }
+ break;
+
+ case 0x039: /* LE Set Extended Advertising Enable */
+ {
+ proto_tree_add_item(tree, hf_bthci_cmd_le_advts_enable, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset++;
+
+ guint8 number_of_sets = tvb_get_guint8(tvb, offset);
+ proto_tree_add_item(tree, hf_bthci_cmd_le_adv_en_sets, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset++;
+
+ for (int i = 0; i< number_of_sets; i++) {
+ proto_tree_add_item(tree, hf_bthci_cmd_advertising_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset+=1;
+ proto_tree_add_item(tree, hf_bthci_cmd_le_adv_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset+=2;
+ proto_tree_add_item(tree, hf_bthci_cmd_le_adv_max_extended_events, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset+=1;
+ }
+ }
+ break;
+
case 0x002: /* LE Read Buffer Size */
case 0x003: /* LE Read Local Supported Features */
case 0x007: /* LE Read Advertising Channel Tx Power */
@@ -5304,6 +5368,31 @@ proto_register_bthci_cmd(void)
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
+ { &hf_bthci_cmd_le_adv_data_operation,
+ { "Data Operation", "bthci_cmd.adv_data_operation",
+ FT_UINT8, BASE_HEX, VALS(cmd_le_adv_data_operation), 0x0,
+ NULL, HFILL }
+ },
+ { &hf_bthci_cmd_le_adv_data_frag_pref,
+ { "Fragment Preference", "bthci_cmd.adv_fragment_preference",
+ FT_UINT8, BASE_HEX, VALS(cmd_le_adv_data_frag_pref), 0x0,
+ NULL, HFILL }
+ },
+ { &hf_bthci_cmd_le_adv_en_sets,
+ { "Number of Sets", "bthci_cmd.adv_num_sets",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_bthci_cmd_le_adv_duration,
+ { "Duration", "bthci_cmd.adv_duration",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_bthci_cmd_le_adv_max_extended_events,
+ { "Max Extended Events", "bthci_cmd.max_extended_advertising_events",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
};
static ei_register_info ei[] = {