aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bthci_evt.c
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2014-12-12 11:11:00 +0100
committerMichal Labedzki <michal.labedzki@tieto.com>2014-12-18 11:02:52 +0000
commit4a467ff609f1b5ee99cbc1aaccdc7b78d3cbecbc (patch)
tree2eba698b56f5603af2822fd287a51b903150c6ff /epan/dissectors/packet-bthci_evt.c
parentee4a7f2c5d22fa240beebe5f3cbf610cc3e28bc9 (diff)
Bluetooth: BTLE: Add src/dst addresses when they are known
Generally where it is not connection then on LinkLayer protocol level addresses for Source and Destination device are known. Change-Id: Id67703edc08df73d4c7a2f66ee8f4d6810a867c9 Reviewed-on: https://code.wireshark.org/review/5776 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'epan/dissectors/packet-bthci_evt.c')
-rw-r--r--epan/dissectors/packet-bthci_evt.c102
1 files changed, 40 insertions, 62 deletions
diff --git a/epan/dissectors/packet-bthci_evt.c b/epan/dissectors/packet-bthci_evt.c
index d587315309..2befd8317c 100644
--- a/epan/dissectors/packet-bthci_evt.c
+++ b/epan/dissectors/packet-bthci_evt.c
@@ -888,28 +888,6 @@ static const value_string evt_air_mode_vals[] = {
void proto_register_bthci_evt(void);
void proto_reg_handoff_bthci_evt(void);
-static int
-dissect_bthci_evt_bd_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
- proto_tree *tree, guint8 *bdaddr)
-{
- guint8 bd_addr[6];
-
- bd_addr[5] = tvb_get_guint8(tvb, offset);
- bd_addr[4] = tvb_get_guint8(tvb, offset + 1);
- bd_addr[3] = tvb_get_guint8(tvb, offset + 2);
- bd_addr[2] = tvb_get_guint8(tvb, offset + 3);
- bd_addr[1] = tvb_get_guint8(tvb, offset + 4);
- bd_addr[0] = tvb_get_guint8(tvb, offset + 5);
-
- if (bdaddr)
- memcpy(bdaddr, bd_addr, 6);
-
- proto_tree_add_ether(tree, hf_bthci_evt_bd_addr, tvb, offset, 6, bd_addr);
- offset += 6;
-
- return offset;
-}
-
static void bthci_evt_vendor_prompt(packet_info *pinfo _U_, gchar* result)
{
g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Vendor as");
@@ -996,7 +974,7 @@ dissect_bthci_evt_conn_complete(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
if (!pinfo->fd->flags.visited && hci_data != NULL && status == 0x00) {
wmem_tree_key_t key[5];
guint32 k_interface_id;
@@ -1048,7 +1026,7 @@ dissect_bthci_evt_conn_complete(tvbuff_t *tvb, int offset, packet_info *pinfo,
static int
dissect_bthci_evt_conn_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
call_dissector(btcommon_cod_handle, tvb_new_subset_length(tvb, offset, 3), pinfo, tree);
offset += 3;
@@ -1232,25 +1210,25 @@ dissect_bthci_evt_lmp_features(tvbuff_t *tvb, int offset, packet_info *pinfo _U_
}
static int
-dissect_bthci_evt_pin_code_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_pin_code_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
return offset;
}
static int
-dissect_bthci_evt_link_key_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_link_key_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
return offset;
}
static int
-dissect_bthci_evt_link_key_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_link_key_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_link_key, tvb, offset, 16, ENC_NA);
offset += 16;
@@ -1262,7 +1240,7 @@ dissect_bthci_evt_link_key_notification(tvbuff_t *tvb, int offset, packet_info *
}
static int
-dissect_bthci_evt_return_link_keys(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_return_link_keys(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
guint8 evt_num_keys;
@@ -1271,7 +1249,7 @@ dissect_bthci_evt_return_link_keys(tvbuff_t *tvb, int offset, packet_info *pinfo
offset += 1;
while (evt_num_keys--) {
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_link_key, tvb, offset, 16, ENC_NA);
offset += 16;
@@ -1304,7 +1282,7 @@ dissect_bthci_evt_remote_name_req_complete(tvbuff_t *tvb, int offset,
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
proto_tree_add_item(tree, hf_bthci_evt_remote_name, tvb, offset, 248, ENC_ASCII|ENC_NA);
if (!pinfo->fd->flags.visited && hci_data != NULL) {
@@ -1416,12 +1394,12 @@ dissect_bthci_evt_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
}
static int
-dissect_bthci_evt_role_change(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_role_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bthci_evt_bd_addr( tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_role, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1639,9 +1617,9 @@ dissect_bthci_evt_command_status(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
static int
-dissect_bthci_evt_page_scan_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_page_scan_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_page_scan_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1650,9 +1628,9 @@ dissect_bthci_evt_page_scan_mode_change(tvbuff_t *tvb, int offset, packet_info *
}
static int
-dissect_bthci_evt_page_scan_repetition_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_page_scan_repetition_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1671,7 +1649,7 @@ dissect_bthci_evt_inq_result_with_rssi(tvbuff_t *tvb, int offset,
offset += 1;
for (num = 0; num < evt_num_responses; num++) {
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, (num == 0) ? bd_addr : NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, (num == 0) ? bd_addr : NULL);
proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1694,17 +1672,17 @@ dissect_bthci_evt_inq_result_with_rssi(tvbuff_t *tvb, int offset,
}
static int
-dissect_bthci_evt_io_capability_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_io_capability_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
return offset;
}
static int
-dissect_bthci_evt_io_capability_response(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_io_capability_response(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_io_capability, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1719,9 +1697,9 @@ dissect_bthci_evt_io_capability_response(tvbuff_t *tvb, int offset, packet_info
}
static int
-dissect_bthci_evt_user_confirmation_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_user_confirmation_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_numeric_value, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
@@ -1730,36 +1708,36 @@ dissect_bthci_evt_user_confirmation_request(tvbuff_t *tvb, int offset, packet_in
}
static int
-dissect_bthci_evt_user_passkey_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_user_passkey_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
return offset;
}
static int
-dissect_bthci_evt_remote_oob_data_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_remote_oob_data_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
return offset;
}
static int
-dissect_bthci_evt_simple_pairing_complete(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_simple_pairing_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
return offset;
}
static int
-dissect_bthci_evt_user_passkey_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_user_passkey_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_passkey, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
@@ -1768,9 +1746,9 @@ dissect_bthci_evt_user_passkey_notification(tvbuff_t *tvb, int offset, packet_in
}
static int
-dissect_bthci_evt_keypress_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_keypress_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_notification_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1781,7 +1759,7 @@ dissect_bthci_evt_keypress_notification(tvbuff_t *tvb, int offset, packet_info *
static int
dissect_bthci_evt_remote_host_sup_feat_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
offset = dissect_bthci_evt_lmp_features(tvb, offset, pinfo, tree, 0);
return offset;
@@ -1820,7 +1798,7 @@ dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree_add_item(tree, hf_bthci_evt_le_peer_address_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bthci_evt_bd_addr( tvb, offset, pinfo, tree, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
item = proto_tree_add_item(tree, hf_bthci_evt_le_con_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset)*1.25);
@@ -1889,7 +1867,7 @@ dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo,
offset += 1;
proto_tree_add_item(tree, hf_bthci_evt_le_peer_address_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bthci_evt_bd_addr( tvb, offset, pinfo, tree, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_bthci_evt_data_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -2248,7 +2226,7 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
if (!pinfo->fd->flags.visited && hci_data != NULL && local_addr) {
wmem_tree_key_t key[4];
guint32 k_interface_id;
@@ -3217,7 +3195,7 @@ dissect_bthci_evt_sync_connection_complete(tvbuff_t *tvb, int offset,
connection_handle = tvb_get_letohs(tvb, offset) & 0x0FFF;
offset += 2;
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
proto_tree_add_item(tree, hf_bthci_evt_sync_link_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -3413,7 +3391,7 @@ dissect_bthci_evt_inq_result(tvbuff_t *tvb, int offset, packet_info *pinfo, prot
offset += 1;
for (num = 0; num < evt_num_responses; num++) {
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;