2012-09-10 12:12:05 +00:00
|
|
|
/* packet-bthci_acl.c
|
2006-05-14 10:18:29 +00:00
|
|
|
* Routines for the Bluetooth ACL dissection
|
|
|
|
* Copyright 2002, Christoph Scholz <scholz@cs.uni-bonn.de>
|
2014-03-03 07:50:53 +00:00
|
|
|
* - from: http://affix.sourceforge.net/archive/ethereal_affix-3.patch
|
|
|
|
* Copyright 2006, Ronnie Sahlberg
|
|
|
|
* - refactored for Wireshark checkin
|
|
|
|
* Copyright 2014, Michal Labedzki for Tieto Corporation
|
2006-05-14 10:18:29 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2006-05-14 10:18:29 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2008-04-29 15:20:19 +00:00
|
|
|
*
|
2006-05-14 10:18:29 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2008-04-29 15:20:19 +00:00
|
|
|
*
|
2006-05-14 10:18:29 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 23:18:38 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2006-05-14 10:18:29 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2006-05-14 10:18:29 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2006-05-27 06:10:52 +00:00
|
|
|
#include <epan/prefs.h>
|
2013-12-21 17:23:17 +00:00
|
|
|
#include <epan/addr_resolv.h>
|
2014-08-26 13:37:00 +00:00
|
|
|
#include <epan/expert.h>
|
2016-01-25 01:10:20 +00:00
|
|
|
#include <epan/proto_data.h>
|
2012-09-21 10:49:44 +00:00
|
|
|
|
2014-12-12 10:24:44 +00:00
|
|
|
#include "packet-bluetooth.h"
|
2012-09-21 10:49:44 +00:00
|
|
|
#include "packet-bthci_acl.h"
|
2006-05-14 10:18:29 +00:00
|
|
|
|
|
|
|
/* Initialize the protocol and registered fields */
|
2012-09-10 12:12:05 +00:00
|
|
|
static int proto_bthci_acl = -1;
|
|
|
|
static int hf_bthci_acl_chandle = -1;
|
|
|
|
static int hf_bthci_acl_pb_flag = -1;
|
|
|
|
static int hf_bthci_acl_bc_flag = -1;
|
|
|
|
static int hf_bthci_acl_length = -1;
|
2014-03-03 07:50:53 +00:00
|
|
|
static int hf_bthci_acl_data = -1;
|
2012-09-10 12:12:05 +00:00
|
|
|
static int hf_bthci_acl_continuation_to = -1;
|
|
|
|
static int hf_bthci_acl_reassembled_in = -1;
|
2014-06-02 15:05:31 +00:00
|
|
|
static int hf_bthci_acl_connect_in = -1;
|
|
|
|
static int hf_bthci_acl_disconnect_in = -1;
|
2014-03-03 07:50:53 +00:00
|
|
|
static int hf_bthci_acl_src_bd_addr = -1;
|
|
|
|
static int hf_bthci_acl_src_name = -1;
|
2014-12-12 10:24:44 +00:00
|
|
|
static int hf_bthci_acl_src_role = -1;
|
2014-03-03 07:50:53 +00:00
|
|
|
static int hf_bthci_acl_dst_bd_addr = -1;
|
|
|
|
static int hf_bthci_acl_dst_name = -1;
|
2014-12-12 10:24:44 +00:00
|
|
|
static int hf_bthci_acl_dst_role = -1;
|
|
|
|
static int hf_bthci_acl_role_last_change_in_frame = -1;
|
|
|
|
static int hf_bthci_acl_mode = -1;
|
|
|
|
static int hf_bthci_acl_mode_last_change_in_frame = -1;
|
2006-05-14 10:18:29 +00:00
|
|
|
|
|
|
|
/* Initialize the subtree pointers */
|
2012-09-10 12:12:05 +00:00
|
|
|
static gint ett_bthci_acl = -1;
|
2006-05-14 10:18:29 +00:00
|
|
|
|
2014-08-26 13:37:00 +00:00
|
|
|
static expert_field ei_invalid_session = EI_INIT;
|
2015-11-08 16:35:24 +00:00
|
|
|
static expert_field ei_length_bad = EI_INIT;
|
2014-08-26 13:37:00 +00:00
|
|
|
|
2014-03-03 11:12:03 +00:00
|
|
|
static dissector_handle_t bthci_acl_handle;
|
2012-03-12 14:40:09 +00:00
|
|
|
static dissector_handle_t btl2cap_handle = NULL;
|
2006-05-14 10:18:29 +00:00
|
|
|
|
2006-05-27 06:10:52 +00:00
|
|
|
static gboolean acl_reassembly = TRUE;
|
|
|
|
|
|
|
|
typedef struct _multi_fragment_pdu_t {
|
2012-03-12 14:40:09 +00:00
|
|
|
guint32 first_frame;
|
|
|
|
guint32 last_frame;
|
|
|
|
guint16 tot_len;
|
|
|
|
char *reassembled;
|
|
|
|
int cur_off; /* counter used by reassembly */
|
2006-05-27 06:10:52 +00:00
|
|
|
} multi_fragment_pdu_t;
|
|
|
|
|
|
|
|
typedef struct _chandle_data_t {
|
2016-01-24 03:40:51 +00:00
|
|
|
wmem_tree_t *start_fragments; /* indexed by pinfo->num */
|
2006-05-27 06:10:52 +00:00
|
|
|
} chandle_data_t;
|
|
|
|
|
2013-06-20 16:31:53 +00:00
|
|
|
static wmem_tree_t *chandle_tree = NULL;
|
2006-05-27 06:10:52 +00:00
|
|
|
|
2014-12-12 10:24:44 +00:00
|
|
|
static const value_string role_vals[] = {
|
|
|
|
{ 0, "Unknown" },
|
|
|
|
{ 1, "Master" },
|
|
|
|
{ 2, "Slave" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string mode_vals[] = {
|
|
|
|
{ 0, "Active Mode" },
|
|
|
|
{ 1, "Hold Mode" },
|
|
|
|
{ 2, "Sniff Mode" },
|
|
|
|
{ 3, "Park Mode" },
|
|
|
|
{-1, "Unknown" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2006-05-14 10:18:29 +00:00
|
|
|
static const value_string pb_flag_vals[] = {
|
2012-11-30 11:31:28 +00:00
|
|
|
{ 0, "First Non-automatically Flushable Packet" },
|
|
|
|
{ 1, "Continuing Fragment" },
|
|
|
|
{ 2, "First Automatically Flushable Packet" },
|
|
|
|
{ 0, NULL }
|
2006-05-14 10:18:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string bc_flag_vals[] = {
|
2012-11-30 11:31:28 +00:00
|
|
|
{ 0, "Point-To-Point" },
|
|
|
|
{ 1, "Active Broadcast" },
|
|
|
|
{ 2, "Piconet Broadcast" },
|
|
|
|
{ 0, NULL }
|
2006-05-14 10:18:29 +00:00
|
|
|
};
|
|
|
|
|
2014-08-26 13:37:00 +00:00
|
|
|
static guint32 invalid_session = 0;
|
2014-06-02 15:05:31 +00:00
|
|
|
|
|
|
|
|
2013-03-19 13:51:52 +00:00
|
|
|
void proto_register_bthci_acl(void);
|
|
|
|
void proto_reg_handoff_bthci_acl(void);
|
2006-05-14 10:18:29 +00:00
|
|
|
|
|
|
|
/* Code to actually dissect the packets */
|
2013-11-02 19:20:04 +00:00
|
|
|
static gint
|
|
|
|
dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
2006-05-14 10:18:29 +00:00
|
|
|
{
|
2014-08-26 13:37:00 +00:00
|
|
|
proto_item *bthci_acl_itam;
|
2013-11-02 19:20:04 +00:00
|
|
|
proto_tree *bthci_acl_tree;
|
2014-03-03 07:50:53 +00:00
|
|
|
proto_item *sub_item;
|
2015-11-08 16:35:24 +00:00
|
|
|
proto_item *length_item;
|
2012-11-29 13:21:10 +00:00
|
|
|
guint16 flags;
|
|
|
|
guint16 length;
|
|
|
|
gboolean fragmented;
|
2013-11-02 19:20:04 +00:00
|
|
|
gint offset = 0;
|
2012-11-29 13:21:10 +00:00
|
|
|
guint16 pb_flag, l2cap_length = 0;
|
|
|
|
tvbuff_t *next_tvb;
|
|
|
|
bthci_acl_data_t *acl_data;
|
|
|
|
chandle_data_t *chandle_data;
|
2014-12-12 10:24:44 +00:00
|
|
|
bluetooth_data_t *bluetooth_data;
|
2014-03-03 07:50:53 +00:00
|
|
|
wmem_tree_t *subtree;
|
|
|
|
wmem_tree_key_t key[6];
|
|
|
|
guint32 interface_id;
|
|
|
|
guint32 adapter_id;
|
|
|
|
guint32 connection_handle;
|
|
|
|
guint32 direction;
|
|
|
|
guint32 frame_number;
|
2012-11-29 13:21:10 +00:00
|
|
|
remote_bdaddr_t *remote_bdaddr;
|
2012-11-30 11:31:28 +00:00
|
|
|
const gchar *localhost_name;
|
2012-11-29 13:21:10 +00:00
|
|
|
guint8 localhost_bdaddr[6];
|
2012-11-30 11:31:28 +00:00
|
|
|
const gchar *localhost_ether_addr;
|
2012-11-29 13:21:10 +00:00
|
|
|
gchar *localhost_addr_name;
|
2012-11-30 11:31:28 +00:00
|
|
|
gint localhost_length;
|
2012-11-29 13:21:10 +00:00
|
|
|
localhost_bdaddr_entry_t *localhost_bdaddr_entry;
|
|
|
|
localhost_name_entry_t *localhost_name_entry;
|
2014-03-03 07:50:53 +00:00
|
|
|
const guint8 unknown_bd_addr[6] = {0, 0, 0, 0, 0, 0};
|
|
|
|
const guint8 *src_bd_addr = &unknown_bd_addr[0];
|
|
|
|
const gchar *src_name = "";
|
|
|
|
const gchar *src_addr_name = "";
|
|
|
|
const guint8 *dst_bd_addr = &unknown_bd_addr[0];
|
|
|
|
const gchar *dst_name = "";
|
|
|
|
const gchar *dst_addr_name = "";
|
2014-06-02 15:05:31 +00:00
|
|
|
chandle_session_t *chandle_session;
|
2014-12-12 10:24:44 +00:00
|
|
|
guint32 src_role = ROLE_UNKNOWN;
|
|
|
|
guint32 dst_role = ROLE_UNKNOWN;
|
|
|
|
guint32 role_last_change_in_frame = 0;
|
|
|
|
connection_mode_t *connection_mode;
|
|
|
|
gint32 mode = -1;
|
|
|
|
guint32 mode_last_change_in_frame = 0;
|
2012-03-12 14:40:09 +00:00
|
|
|
|
2013-12-02 21:13:29 +00:00
|
|
|
/* Reject the packet if data is NULL */
|
|
|
|
if (data == NULL)
|
|
|
|
return 0;
|
2014-12-12 10:24:44 +00:00
|
|
|
bluetooth_data = (bluetooth_data_t *) data;
|
2013-12-02 21:13:29 +00:00
|
|
|
|
2014-08-26 13:37:00 +00:00
|
|
|
bthci_acl_itam = proto_tree_add_item(tree, proto_bthci_acl, tvb, offset, -1, ENC_NA);
|
|
|
|
bthci_acl_tree = proto_item_add_subtree(bthci_acl_itam, ett_bthci_acl);
|
2013-11-02 19:20:04 +00:00
|
|
|
|
2013-03-30 21:47:27 +00:00
|
|
|
switch (pinfo->p2p_dir) {
|
|
|
|
case P2P_DIR_SENT:
|
2013-10-29 14:09:20 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Sent ");
|
2013-03-30 21:47:27 +00:00
|
|
|
break;
|
|
|
|
case P2P_DIR_RECV:
|
2013-10-29 14:09:20 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Rcvd ");
|
2013-03-30 21:47:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
2015-01-18 09:44:04 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "UnknownDirection ");
|
2013-03-30 21:47:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-03-12 14:40:09 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCI_ACL");
|
|
|
|
|
|
|
|
flags = tvb_get_letohs(tvb, offset);
|
|
|
|
pb_flag = (flags & 0x3000) >> 12;
|
2012-09-10 12:12:05 +00:00
|
|
|
proto_tree_add_item(bthci_acl_tree, hf_bthci_acl_chandle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
proto_tree_add_item(bthci_acl_tree, hf_bthci_acl_pb_flag, tvb, offset, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
proto_tree_add_item(bthci_acl_tree, hf_bthci_acl_bc_flag, tvb, offset, 2, ENC_LITTLE_ENDIAN);
|
2012-03-12 14:40:09 +00:00
|
|
|
offset += 2;
|
|
|
|
|
2014-12-12 10:24:44 +00:00
|
|
|
interface_id = bluetooth_data->interface_id;
|
|
|
|
adapter_id = bluetooth_data->adapter_id;
|
2014-03-03 07:50:53 +00:00
|
|
|
connection_handle = flags & 0x0fff;
|
|
|
|
direction = pinfo->p2p_dir;
|
2016-01-24 03:40:51 +00:00
|
|
|
frame_number = pinfo->num;
|
2012-11-29 13:21:10 +00:00
|
|
|
|
2014-03-03 07:50:53 +00:00
|
|
|
acl_data = wmem_new(wmem_packet_scope(), bthci_acl_data_t);
|
2014-06-02 15:05:31 +00:00
|
|
|
acl_data->interface_id = interface_id;
|
|
|
|
acl_data->adapter_id = adapter_id;
|
2014-12-12 10:24:44 +00:00
|
|
|
acl_data->adapter_disconnect_in_frame = bluetooth_data->adapter_disconnect_in_frame;
|
2014-06-02 15:05:31 +00:00
|
|
|
acl_data->chandle = connection_handle;
|
2013-02-11 15:04:53 +00:00
|
|
|
|
2012-11-29 13:21:10 +00:00
|
|
|
key[0].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[0].key = &interface_id;
|
2012-11-29 13:21:10 +00:00
|
|
|
key[1].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[1].key = &adapter_id;
|
2012-11-29 13:21:10 +00:00
|
|
|
key[2].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[2].key = &connection_handle;
|
|
|
|
key[3].length = 0;
|
|
|
|
key[3].key = NULL;
|
2012-11-29 13:21:10 +00:00
|
|
|
|
2014-12-12 10:24:44 +00:00
|
|
|
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bluetooth_data->chandle_sessions, key);
|
2016-01-24 03:40:51 +00:00
|
|
|
chandle_session = (subtree) ? (chandle_session_t *) wmem_tree_lookup32_le(subtree, pinfo->num) : NULL;
|
2014-06-02 15:05:31 +00:00
|
|
|
if (chandle_session &&
|
2016-01-24 03:40:51 +00:00
|
|
|
chandle_session->connect_in_frame < pinfo->num &&
|
|
|
|
chandle_session->disconnect_in_frame > pinfo->num) {
|
2014-06-02 15:05:31 +00:00
|
|
|
acl_data->disconnect_in_frame = &chandle_session->disconnect_in_frame;
|
|
|
|
} else {
|
2014-08-26 13:37:00 +00:00
|
|
|
acl_data->disconnect_in_frame = &invalid_session;
|
|
|
|
chandle_session = NULL;
|
2014-06-02 15:05:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
acl_data->remote_bd_addr_oui = 0;
|
|
|
|
acl_data->remote_bd_addr_id = 0;
|
|
|
|
|
2014-12-12 10:24:44 +00:00
|
|
|
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bluetooth_data->chandle_to_mode, key);
|
2016-01-24 03:40:51 +00:00
|
|
|
connection_mode = (subtree) ? (connection_mode_t *) wmem_tree_lookup32_le(subtree, pinfo->num) : NULL;
|
2014-12-12 10:24:44 +00:00
|
|
|
if (connection_mode) {
|
|
|
|
mode = connection_mode->mode;
|
|
|
|
mode_last_change_in_frame = connection_mode->change_in_frame;
|
|
|
|
}
|
|
|
|
|
2012-11-29 13:21:10 +00:00
|
|
|
/* remote bdaddr and name */
|
2014-12-12 10:24:44 +00:00
|
|
|
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bluetooth_data->chandle_to_bdaddr, key);
|
2016-01-24 03:40:51 +00:00
|
|
|
remote_bdaddr = (subtree) ? (remote_bdaddr_t *) wmem_tree_lookup32_le(subtree, pinfo->num) : NULL;
|
2014-03-03 07:50:53 +00:00
|
|
|
if (remote_bdaddr) {
|
2012-11-29 13:21:10 +00:00
|
|
|
guint32 k_bd_addr_oui;
|
|
|
|
guint32 k_bd_addr_id;
|
|
|
|
guint32 bd_addr_oui;
|
|
|
|
guint32 bd_addr_id;
|
2012-11-30 11:31:28 +00:00
|
|
|
device_name_t *device_name;
|
2014-12-12 10:24:44 +00:00
|
|
|
device_role_t *device_role;
|
2012-11-30 11:31:28 +00:00
|
|
|
const gchar *remote_name;
|
|
|
|
const gchar *remote_ether_addr;
|
|
|
|
gchar *remote_addr_name;
|
2012-11-29 16:26:12 +00:00
|
|
|
gint remote_length;
|
2012-11-29 13:21:10 +00:00
|
|
|
|
|
|
|
bd_addr_oui = remote_bdaddr->bd_addr[0] << 16 | remote_bdaddr->bd_addr[1] << 8 | remote_bdaddr->bd_addr[2];
|
2012-11-30 11:31:28 +00:00
|
|
|
bd_addr_id = remote_bdaddr->bd_addr[3] << 16 | remote_bdaddr->bd_addr[4] << 8 | remote_bdaddr->bd_addr[5];
|
2013-02-21 21:35:19 +00:00
|
|
|
|
2013-03-30 21:43:18 +00:00
|
|
|
acl_data->remote_bd_addr_oui = bd_addr_oui;
|
|
|
|
acl_data->remote_bd_addr_id = bd_addr_id;
|
|
|
|
|
2013-02-21 21:35:19 +00:00
|
|
|
k_bd_addr_oui = bd_addr_oui;
|
|
|
|
k_bd_addr_id = bd_addr_id;
|
2012-11-29 13:21:10 +00:00
|
|
|
|
|
|
|
key[0].length = 1;
|
2014-12-12 10:24:44 +00:00
|
|
|
key[0].key = &interface_id;
|
2012-11-29 13:21:10 +00:00
|
|
|
key[1].length = 1;
|
2014-12-12 10:24:44 +00:00
|
|
|
key[1].key = &adapter_id;
|
|
|
|
key[2].length = 1;
|
|
|
|
key[2].key = &k_bd_addr_id;
|
|
|
|
key[3].length = 1;
|
|
|
|
key[3].key = &k_bd_addr_oui;
|
|
|
|
key[4].length = 0;
|
|
|
|
key[4].key = NULL;
|
|
|
|
|
|
|
|
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bluetooth_data->bdaddr_to_role, key);
|
2016-01-24 03:40:51 +00:00
|
|
|
device_role = (subtree) ? (device_role_t *) wmem_tree_lookup32_le(subtree, pinfo->num) : NULL;
|
2014-12-12 10:24:44 +00:00
|
|
|
if (device_role) {
|
|
|
|
if ((pinfo->p2p_dir == P2P_DIR_SENT && device_role->role == ROLE_MASTER) ||
|
|
|
|
(pinfo->p2p_dir == P2P_DIR_RECV && device_role->role == ROLE_SLAVE)) {
|
|
|
|
src_role = ROLE_SLAVE;
|
|
|
|
dst_role = ROLE_MASTER;
|
|
|
|
} else if ((pinfo->p2p_dir == P2P_DIR_SENT && device_role->role == ROLE_SLAVE) ||
|
|
|
|
(pinfo->p2p_dir == P2P_DIR_RECV && device_role->role == ROLE_MASTER)) {
|
|
|
|
src_role = ROLE_MASTER;
|
|
|
|
dst_role = ROLE_SLAVE;
|
|
|
|
}
|
|
|
|
role_last_change_in_frame = device_role->change_in_frame;
|
|
|
|
}
|
2012-11-29 13:21:10 +00:00
|
|
|
|
2014-12-12 10:24:44 +00:00
|
|
|
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bluetooth_data->bdaddr_to_name, key);
|
2016-01-24 03:40:51 +00:00
|
|
|
device_name = (subtree) ? (device_name_t *) wmem_tree_lookup32_le(subtree, pinfo->num) : NULL;
|
2014-03-03 07:50:53 +00:00
|
|
|
if (device_name)
|
2012-11-29 13:21:10 +00:00
|
|
|
remote_name = device_name->name;
|
|
|
|
else
|
|
|
|
remote_name = "";
|
|
|
|
|
|
|
|
remote_ether_addr = get_ether_name(remote_bdaddr->bd_addr);
|
2012-11-29 16:26:12 +00:00
|
|
|
remote_length = (gint)(strlen(remote_ether_addr) + 3 + strlen(remote_name) + 1);
|
2013-03-18 19:47:33 +00:00
|
|
|
remote_addr_name = (gchar *)wmem_alloc(pinfo->pool, remote_length);
|
2012-11-29 13:21:10 +00:00
|
|
|
|
|
|
|
g_snprintf(remote_addr_name, remote_length, "%s (%s)", remote_ether_addr, remote_name);
|
|
|
|
|
|
|
|
if (pinfo->p2p_dir == P2P_DIR_RECV) {
|
2014-03-03 07:50:53 +00:00
|
|
|
src_bd_addr = remote_bdaddr->bd_addr;
|
|
|
|
src_name = remote_name;
|
|
|
|
src_addr_name = remote_addr_name;
|
2012-11-29 13:21:10 +00:00
|
|
|
} else if (pinfo->p2p_dir == P2P_DIR_SENT) {
|
2014-03-03 07:50:53 +00:00
|
|
|
dst_bd_addr = remote_bdaddr->bd_addr;
|
|
|
|
dst_name = remote_name;
|
|
|
|
dst_addr_name = remote_addr_name;
|
2012-11-29 13:21:10 +00:00
|
|
|
}
|
|
|
|
} else {
|
2014-03-03 07:50:53 +00:00
|
|
|
if (pinfo->p2p_dir == P2P_DIR_RECV)
|
|
|
|
src_addr_name = "remote ()";
|
|
|
|
else if (pinfo->p2p_dir == P2P_DIR_SENT)
|
|
|
|
dst_addr_name = "remote ()";
|
2012-11-29 13:21:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* localhost bdaddr and name */
|
|
|
|
key[0].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[0].key = &interface_id;
|
2012-11-29 13:21:10 +00:00
|
|
|
key[1].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[1].key = &adapter_id;
|
|
|
|
key[2].length = 0;
|
|
|
|
key[2].key = NULL;
|
2012-11-29 13:21:10 +00:00
|
|
|
|
2013-06-30 21:34:40 +00:00
|
|
|
|
2014-12-12 10:24:44 +00:00
|
|
|
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bluetooth_data->localhost_bdaddr, key);
|
2016-01-24 03:40:51 +00:00
|
|
|
localhost_bdaddr_entry = (subtree) ? (localhost_bdaddr_entry_t *) wmem_tree_lookup32_le(subtree, pinfo->num) : NULL;
|
2014-03-03 07:50:53 +00:00
|
|
|
if (localhost_bdaddr_entry) {
|
2012-11-29 13:21:10 +00:00
|
|
|
localhost_ether_addr = get_ether_name(localhost_bdaddr_entry->bd_addr);
|
2013-06-30 21:34:40 +00:00
|
|
|
memcpy(localhost_bdaddr, localhost_bdaddr_entry->bd_addr, 6);
|
2013-10-13 19:56:52 +00:00
|
|
|
} else {
|
2012-11-29 13:21:10 +00:00
|
|
|
localhost_ether_addr = "localhost";
|
2014-03-03 07:50:53 +00:00
|
|
|
memcpy(localhost_bdaddr, unknown_bd_addr, 6);
|
2013-06-30 21:34:40 +00:00
|
|
|
}
|
2012-11-29 13:21:10 +00:00
|
|
|
|
2014-12-12 10:24:44 +00:00
|
|
|
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bluetooth_data->localhost_name, key);
|
2016-01-24 03:40:51 +00:00
|
|
|
localhost_name_entry = (subtree) ? (localhost_name_entry_t *) wmem_tree_lookup32_le(subtree, pinfo->num) : NULL;
|
2014-03-03 07:50:53 +00:00
|
|
|
if (localhost_name_entry)
|
2012-11-29 13:21:10 +00:00
|
|
|
localhost_name = localhost_name_entry->name;
|
|
|
|
else
|
2012-11-30 11:31:28 +00:00
|
|
|
localhost_name = "";
|
2012-11-29 13:21:10 +00:00
|
|
|
|
2012-11-29 16:26:12 +00:00
|
|
|
localhost_length = (gint)(strlen(localhost_ether_addr) + 3 + strlen(localhost_name) + 1);
|
2013-03-18 19:47:33 +00:00
|
|
|
localhost_addr_name = (gchar *)wmem_alloc(pinfo->pool, localhost_length);
|
2012-11-29 13:21:10 +00:00
|
|
|
|
|
|
|
g_snprintf(localhost_addr_name, localhost_length, "%s (%s)", localhost_ether_addr, localhost_name);
|
|
|
|
|
|
|
|
if (pinfo->p2p_dir == P2P_DIR_RECV) {
|
2014-03-03 07:50:53 +00:00
|
|
|
dst_bd_addr = localhost_bdaddr;
|
|
|
|
dst_name = localhost_name;
|
|
|
|
dst_addr_name = localhost_addr_name;
|
2012-11-29 13:21:10 +00:00
|
|
|
} else if (pinfo->p2p_dir == P2P_DIR_SENT) {
|
2014-03-03 07:50:53 +00:00
|
|
|
src_bd_addr = localhost_bdaddr;
|
|
|
|
src_name = localhost_name;
|
|
|
|
src_addr_name = localhost_addr_name;
|
2012-11-29 13:21:10 +00:00
|
|
|
}
|
|
|
|
|
2012-03-12 14:40:09 +00:00
|
|
|
/* find the chandle_data structure associated with this chandle */
|
2013-02-21 21:35:19 +00:00
|
|
|
key[0].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[0].key = &interface_id;
|
2013-02-21 21:35:19 +00:00
|
|
|
key[1].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[1].key = &adapter_id;
|
2013-02-21 21:35:19 +00:00
|
|
|
key[2].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[2].key = &connection_handle;
|
2013-02-21 21:35:19 +00:00
|
|
|
key[3].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[3].key = &direction;
|
2013-02-21 21:35:19 +00:00
|
|
|
key[4].length = 0;
|
|
|
|
key[4].key = NULL;
|
|
|
|
|
2014-03-03 07:50:53 +00:00
|
|
|
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(chandle_tree, key);
|
2016-01-24 03:40:51 +00:00
|
|
|
chandle_data = (subtree) ? (chandle_data_t *) wmem_tree_lookup32_le(subtree, pinfo->num) : NULL;
|
2014-03-03 07:50:53 +00:00
|
|
|
if (!pinfo->fd->flags.visited && !chandle_data) {
|
2013-02-21 21:35:19 +00:00
|
|
|
key[0].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[0].key = &interface_id;
|
2013-02-21 21:35:19 +00:00
|
|
|
key[1].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[1].key = &adapter_id;
|
2013-02-21 21:35:19 +00:00
|
|
|
key[2].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[2].key = &connection_handle;
|
2013-02-21 21:35:19 +00:00
|
|
|
key[3].length = 1;
|
2014-03-03 07:50:53 +00:00
|
|
|
key[3].key = &direction;
|
|
|
|
key[4].length = 1;
|
|
|
|
key[4].key = &frame_number;
|
|
|
|
key[5].length = 0;
|
|
|
|
key[5].key = NULL;
|
2013-02-21 21:35:19 +00:00
|
|
|
|
2013-09-12 22:03:31 +00:00
|
|
|
chandle_data = (chandle_data_t *)wmem_alloc(wmem_file_scope(), sizeof(chandle_data_t));
|
2013-06-20 16:31:53 +00:00
|
|
|
chandle_data->start_fragments = wmem_tree_new(wmem_file_scope());
|
2013-02-21 21:35:19 +00:00
|
|
|
|
2013-06-20 16:31:53 +00:00
|
|
|
wmem_tree_insert32_array(chandle_tree, key, chandle_data);
|
2014-08-28 06:23:27 +00:00
|
|
|
} else if (pinfo->fd->flags.visited && !chandle_data) {
|
|
|
|
DISSECTOR_ASSERT_HINT(0, "Impossible: no previously session saved");
|
2012-03-12 14:40:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
length = tvb_get_letohs(tvb, offset);
|
2015-11-08 16:35:24 +00:00
|
|
|
length_item = proto_tree_add_item(bthci_acl_tree, hf_bthci_acl_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
|
2012-11-30 11:31:28 +00:00
|
|
|
offset += 2;
|
2012-03-12 14:40:09 +00:00
|
|
|
|
|
|
|
/* determine if packet is fragmented */
|
|
|
|
switch(pb_flag) {
|
|
|
|
case 0x01: /* Continuation fragment */
|
|
|
|
fragmented = TRUE;
|
|
|
|
break;
|
|
|
|
case 0x00: /* First fragment/packet, non-auto flushable */
|
|
|
|
case 0x02: /* First fragment/packet, auto flushable */
|
|
|
|
l2cap_length = tvb_get_letohs(tvb, offset);
|
2012-11-30 11:31:28 +00:00
|
|
|
fragmented = (l2cap_length + 4 != length);
|
2012-03-12 14:40:09 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* unknown pb_flag */
|
|
|
|
fragmented = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-11-30 11:31:28 +00:00
|
|
|
if (!fragmented || (!acl_reassembly && !(pb_flag & 0x01))) {
|
2012-03-12 14:40:09 +00:00
|
|
|
/* call L2CAP dissector for PDUs that are not fragmented
|
|
|
|
* also for the first fragment if reassembly is disabled
|
|
|
|
*/
|
2015-11-08 16:35:24 +00:00
|
|
|
if (length < tvb_captured_length_remaining(tvb, offset)) {
|
|
|
|
expert_add_info(pinfo, length_item, &ei_length_bad);
|
|
|
|
/* Try to dissect as more as possible */
|
|
|
|
length = tvb_captured_length_remaining(tvb, offset);
|
|
|
|
}
|
|
|
|
|
2014-03-03 07:50:53 +00:00
|
|
|
next_tvb = tvb_new_subset(tvb, offset, tvb_captured_length_remaining(tvb, offset), length);
|
|
|
|
offset += call_dissector_with_data(btl2cap_handle, next_tvb, pinfo, tree, acl_data);
|
|
|
|
} else if (fragmented && acl_reassembly) {
|
2012-03-12 14:40:09 +00:00
|
|
|
multi_fragment_pdu_t *mfp = NULL;
|
|
|
|
gint len;
|
|
|
|
|
2012-11-30 11:31:28 +00:00
|
|
|
if (!(pb_flag & 0x01)) { /* first fragment */
|
2012-03-12 14:40:09 +00:00
|
|
|
if (!pinfo->fd->flags.visited) {
|
2013-03-19 13:51:52 +00:00
|
|
|
mfp = (multi_fragment_pdu_t *) wmem_new(wmem_file_scope(), multi_fragment_pdu_t);
|
2016-01-24 03:40:51 +00:00
|
|
|
mfp->first_frame = pinfo->num;
|
2012-03-12 14:40:09 +00:00
|
|
|
mfp->last_frame = 0;
|
2012-11-30 11:31:28 +00:00
|
|
|
mfp->tot_len = l2cap_length + 4;
|
2013-03-19 13:51:52 +00:00
|
|
|
mfp->reassembled = (char *) wmem_alloc(wmem_file_scope(), mfp->tot_len);
|
2014-03-03 07:50:53 +00:00
|
|
|
len = tvb_captured_length_remaining(tvb, offset);
|
2012-03-12 14:40:09 +00:00
|
|
|
if (len <= mfp->tot_len) {
|
2012-11-30 11:31:28 +00:00
|
|
|
tvb_memcpy(tvb, (guint8 *) mfp->reassembled, offset, len);
|
2012-03-12 14:40:09 +00:00
|
|
|
mfp->cur_off = len;
|
2016-01-24 03:40:51 +00:00
|
|
|
wmem_tree_insert32(chandle_data->start_fragments, pinfo->num, mfp);
|
2012-03-12 14:40:09 +00:00
|
|
|
}
|
|
|
|
} else {
|
2016-01-24 03:40:51 +00:00
|
|
|
mfp = (multi_fragment_pdu_t *)wmem_tree_lookup32(chandle_data->start_fragments, pinfo->num);
|
2012-03-12 14:40:09 +00:00
|
|
|
}
|
|
|
|
if (mfp != NULL && mfp->last_frame) {
|
|
|
|
proto_item *item;
|
2012-11-30 11:31:28 +00:00
|
|
|
|
2012-09-10 12:12:05 +00:00
|
|
|
item = proto_tree_add_uint(bthci_acl_tree, hf_bthci_acl_reassembled_in, tvb, 0, 0, mfp->last_frame);
|
2012-03-12 14:40:09 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " [Reassembled in #%u]", mfp->last_frame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pb_flag == 0x01) { /* continuation fragment */
|
2016-01-24 03:40:51 +00:00
|
|
|
mfp = (multi_fragment_pdu_t *)wmem_tree_lookup32_le(chandle_data->start_fragments, pinfo->num);
|
2012-03-12 14:40:09 +00:00
|
|
|
if (!pinfo->fd->flags.visited) {
|
2014-03-03 07:50:53 +00:00
|
|
|
len = tvb_captured_length_remaining(tvb, offset);
|
2012-11-30 11:31:28 +00:00
|
|
|
if (mfp != NULL && !mfp->last_frame && (mfp->tot_len >= mfp->cur_off + len)) {
|
|
|
|
tvb_memcpy(tvb, (guint8 *) mfp->reassembled + mfp->cur_off, offset, len);
|
|
|
|
mfp->cur_off += len;
|
2012-03-12 14:40:09 +00:00
|
|
|
if (mfp->cur_off == mfp->tot_len) {
|
2016-01-24 03:40:51 +00:00
|
|
|
mfp->last_frame = pinfo->num;
|
2012-03-12 14:40:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (mfp) {
|
|
|
|
proto_item *item;
|
2012-11-30 11:31:28 +00:00
|
|
|
|
2012-09-10 12:12:05 +00:00
|
|
|
item = proto_tree_add_uint(bthci_acl_tree, hf_bthci_acl_continuation_to, tvb, 0, 0, mfp->first_frame);
|
2012-03-12 14:40:09 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " [Continuation to #%u]", mfp->first_frame);
|
|
|
|
}
|
2016-01-24 03:40:51 +00:00
|
|
|
if (mfp != NULL && mfp->last_frame == pinfo->num) {
|
2012-11-30 11:31:28 +00:00
|
|
|
next_tvb = tvb_new_child_real_data(tvb, (guint8 *) mfp->reassembled, mfp->tot_len, mfp->tot_len);
|
2012-03-12 14:40:09 +00:00
|
|
|
add_new_data_source(pinfo, next_tvb, "Reassembled BTHCI ACL");
|
|
|
|
|
2014-03-03 07:50:53 +00:00
|
|
|
offset += call_dissector_with_data(btl2cap_handle, next_tvb, pinfo, tree, acl_data);
|
2012-03-12 14:40:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-11-02 19:20:04 +00:00
|
|
|
|
2014-03-03 07:50:53 +00:00
|
|
|
if (tvb_captured_length_remaining(tvb, offset) > 0)
|
|
|
|
proto_tree_add_item(bthci_acl_tree, hf_bthci_acl_data, tvb, offset, -1, ENC_NA);
|
|
|
|
|
2014-06-02 15:05:31 +00:00
|
|
|
if (chandle_session) {
|
|
|
|
sub_item = proto_tree_add_uint(bthci_acl_tree, hf_bthci_acl_connect_in, tvb, 0, 0, chandle_session->connect_in_frame);
|
|
|
|
PROTO_ITEM_SET_GENERATED(sub_item);
|
|
|
|
|
|
|
|
if (chandle_session->disconnect_in_frame < G_MAXUINT32) {
|
|
|
|
sub_item = proto_tree_add_uint(bthci_acl_tree, hf_bthci_acl_disconnect_in, tvb, 0, 0, chandle_session->disconnect_in_frame);
|
|
|
|
PROTO_ITEM_SET_GENERATED(sub_item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-26 13:37:00 +00:00
|
|
|
if (acl_data->disconnect_in_frame == &invalid_session) {
|
|
|
|
expert_add_info(pinfo, bthci_acl_itam, &ei_invalid_session);
|
|
|
|
}
|
|
|
|
|
2015-10-21 19:04:16 +00:00
|
|
|
set_address(&pinfo->net_src, AT_STRINGZ, (int)strlen(src_name) + 1, src_name);
|
|
|
|
set_address(&pinfo->dl_src, AT_ETHER, 6, src_bd_addr);
|
|
|
|
set_address(&pinfo->src, AT_STRINGZ, (int)strlen(src_addr_name) + 1, src_addr_name);
|
2014-03-03 07:50:53 +00:00
|
|
|
|
2015-10-21 19:04:16 +00:00
|
|
|
set_address(&pinfo->net_dst, AT_STRINGZ, (int)strlen(dst_name) + 1, dst_name);
|
|
|
|
set_address(&pinfo->dl_dst, AT_ETHER, 6, dst_bd_addr);
|
|
|
|
set_address(&pinfo->dst, AT_STRINGZ, (int)strlen(dst_addr_name) + 1, dst_addr_name);
|
2014-03-03 07:50:53 +00:00
|
|
|
|
2014-12-12 10:24:44 +00:00
|
|
|
if (!pinfo->fd->flags.visited) {
|
|
|
|
address *addr;
|
|
|
|
|
|
|
|
addr = (address *) wmem_memdup(wmem_file_scope(), &pinfo->dl_src, sizeof(address));
|
|
|
|
addr->data = wmem_memdup(wmem_file_scope(), pinfo->dl_src.data, pinfo->dl_src.len);
|
|
|
|
p_add_proto_data(wmem_file_scope(), pinfo, proto_bluetooth, BLUETOOTH_DATA_SRC, addr);
|
|
|
|
|
|
|
|
addr = (address *) wmem_memdup(wmem_file_scope(), &pinfo->dl_dst, sizeof(address));
|
|
|
|
addr->data = wmem_memdup(wmem_file_scope(), pinfo->dl_dst.data, pinfo->dl_dst.len);
|
|
|
|
p_add_proto_data(wmem_file_scope(), pinfo, proto_bluetooth, BLUETOOTH_DATA_DST, addr);
|
|
|
|
}
|
|
|
|
|
2014-03-03 07:50:53 +00:00
|
|
|
sub_item = proto_tree_add_ether(bthci_acl_tree, hf_bthci_acl_src_bd_addr, tvb, 0, 0, src_bd_addr);
|
|
|
|
PROTO_ITEM_SET_GENERATED(sub_item);
|
|
|
|
|
|
|
|
sub_item = proto_tree_add_string(bthci_acl_tree, hf_bthci_acl_src_name, tvb, 0, 0, src_name);
|
|
|
|
PROTO_ITEM_SET_GENERATED(sub_item);
|
|
|
|
|
2014-12-12 10:24:44 +00:00
|
|
|
sub_item = proto_tree_add_uint(bthci_acl_tree, hf_bthci_acl_src_role, tvb, 0, 0, src_role);
|
|
|
|
PROTO_ITEM_SET_GENERATED(sub_item);
|
|
|
|
|
2014-03-03 07:50:53 +00:00
|
|
|
sub_item = proto_tree_add_ether(bthci_acl_tree, hf_bthci_acl_dst_bd_addr, tvb, 0, 0, dst_bd_addr);
|
|
|
|
PROTO_ITEM_SET_GENERATED(sub_item);
|
|
|
|
|
|
|
|
sub_item = proto_tree_add_string(bthci_acl_tree, hf_bthci_acl_dst_name, tvb, 0, 0, dst_name);
|
|
|
|
PROTO_ITEM_SET_GENERATED(sub_item);
|
|
|
|
|
2014-12-12 10:24:44 +00:00
|
|
|
sub_item = proto_tree_add_uint(bthci_acl_tree, hf_bthci_acl_dst_role, tvb, 0, 0, dst_role);
|
|
|
|
PROTO_ITEM_SET_GENERATED(sub_item);
|
|
|
|
|
|
|
|
if (role_last_change_in_frame > 0) {
|
|
|
|
sub_item = proto_tree_add_uint(bthci_acl_tree, hf_bthci_acl_role_last_change_in_frame, tvb, 0, 0, role_last_change_in_frame);
|
|
|
|
PROTO_ITEM_SET_GENERATED(sub_item);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub_item = proto_tree_add_int(bthci_acl_tree, hf_bthci_acl_mode, tvb, 0, 0, mode);
|
|
|
|
PROTO_ITEM_SET_GENERATED(sub_item);
|
|
|
|
|
|
|
|
if (mode_last_change_in_frame > 0) {
|
|
|
|
sub_item = proto_tree_add_uint(bthci_acl_tree, hf_bthci_acl_mode_last_change_in_frame, tvb, 0, 0, mode_last_change_in_frame);
|
|
|
|
PROTO_ITEM_SET_GENERATED(sub_item);
|
|
|
|
}
|
|
|
|
|
2014-03-03 07:50:53 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2006-05-14 10:18:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2012-09-10 12:12:05 +00:00
|
|
|
proto_register_bthci_acl(void)
|
2008-04-29 15:20:19 +00:00
|
|
|
{
|
2014-08-26 13:37:00 +00:00
|
|
|
module_t *bthci_acl_module;
|
|
|
|
expert_module_t *bthci_acl_expert_module;
|
2012-03-12 14:40:09 +00:00
|
|
|
/* Setup list of header fields See Section 1.6.1 for details*/
|
|
|
|
static hf_register_info hf[] = {
|
2012-09-10 12:12:05 +00:00
|
|
|
{ &hf_bthci_acl_chandle,
|
|
|
|
{ "Connection Handle", "bthci_acl.chandle",
|
2012-03-12 14:40:09 +00:00
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0FFF,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2012-09-10 12:12:05 +00:00
|
|
|
{ &hf_bthci_acl_pb_flag,
|
|
|
|
{ "PB Flag", "bthci_acl.pb_flag",
|
2012-03-12 14:40:09 +00:00
|
|
|
FT_UINT16, BASE_DEC, VALS(pb_flag_vals), 0x3000,
|
|
|
|
"Packet Boundary Flag", HFILL }
|
|
|
|
},
|
2012-09-10 12:12:05 +00:00
|
|
|
{ &hf_bthci_acl_bc_flag,
|
|
|
|
{ "BC Flag", "bthci_acl.bc_flag",
|
2012-03-12 14:40:09 +00:00
|
|
|
FT_UINT16, BASE_DEC, VALS(bc_flag_vals), 0xC000,
|
|
|
|
"Broadcast Flag", HFILL }
|
|
|
|
},
|
2012-09-10 12:12:05 +00:00
|
|
|
{ &hf_bthci_acl_length,
|
|
|
|
{ "Data Total Length", "bthci_acl.length",
|
2012-03-12 14:40:09 +00:00
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2012-09-10 12:12:05 +00:00
|
|
|
{ &hf_bthci_acl_data,
|
|
|
|
{ "Data", "bthci_acl.data",
|
2012-03-12 14:40:09 +00:00
|
|
|
FT_NONE, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2012-09-10 12:12:05 +00:00
|
|
|
{ &hf_bthci_acl_continuation_to,
|
|
|
|
{ "This is a continuation to the PDU in frame", "bthci_acl.continuation_to",
|
2012-03-12 14:40:09 +00:00
|
|
|
FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
|
|
|
"This is a continuation to the PDU in frame #", HFILL }
|
|
|
|
},
|
2012-09-10 12:12:05 +00:00
|
|
|
{ &hf_bthci_acl_reassembled_in,
|
|
|
|
{ "This PDU is reassembled in frame", "bthci_acl.reassembled_in",
|
2012-03-12 14:40:09 +00:00
|
|
|
FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
|
|
|
"This PDU is reassembled in frame #", HFILL }
|
|
|
|
},
|
2014-06-02 15:05:31 +00:00
|
|
|
{ &hf_bthci_acl_connect_in,
|
|
|
|
{ "Connect in frame", "bthci_acl.connect_in",
|
|
|
|
FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_bthci_acl_disconnect_in,
|
|
|
|
{ "Disconnect in frame", "bthci_acl.disconnect_in",
|
|
|
|
FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2014-03-03 07:50:53 +00:00
|
|
|
{ &hf_bthci_acl_src_bd_addr,
|
|
|
|
{ "Source BD_ADDR", "bthci_acl.src.bd_addr",
|
|
|
|
FT_ETHER, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_bthci_acl_src_name,
|
|
|
|
{ "Source Device Name", "bthci_acl.src.name",
|
|
|
|
FT_STRINGZ, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2014-12-12 10:24:44 +00:00
|
|
|
{ &hf_bthci_acl_src_role,
|
|
|
|
{ "Source Role", "bthci_acl.src.role",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(role_vals), 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2014-03-03 07:50:53 +00:00
|
|
|
{ &hf_bthci_acl_dst_bd_addr,
|
|
|
|
{ "Destination BD_ADDR", "bthci_acl.dst.bd_addr",
|
|
|
|
FT_ETHER, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_bthci_acl_dst_name,
|
|
|
|
{ "Destination Device Name", "bthci_acl.dst.name",
|
|
|
|
FT_STRINGZ, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2014-12-12 10:24:44 +00:00
|
|
|
{ &hf_bthci_acl_dst_role,
|
|
|
|
{ "Destination Role", "bthci_acl.dst.role",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(role_vals), 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_bthci_acl_role_last_change_in_frame,
|
|
|
|
{ "Last Role Change in Frame", "bthci_acl.last_change_in_frame.role",
|
|
|
|
FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_bthci_acl_mode,
|
|
|
|
{ "Current Mode", "bthci_acl.mode",
|
|
|
|
FT_INT32, BASE_DEC, VALS(mode_vals), 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_bthci_acl_mode_last_change_in_frame,
|
|
|
|
{ "Last Mode Change in Frame", "bthci_acl.last_change_in_frame.mode",
|
|
|
|
FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2012-03-12 14:40:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
2012-09-10 12:12:05 +00:00
|
|
|
&ett_bthci_acl,
|
2012-03-12 14:40:09 +00:00
|
|
|
};
|
2014-08-26 13:37:00 +00:00
|
|
|
|
|
|
|
static ei_register_info ei[] = {
|
2015-11-08 16:35:24 +00:00
|
|
|
{ &ei_invalid_session, { "bthci_acl.invalid_session", PI_PROTOCOL, PI_ERROR, "Frame is out of any \"connection handle\" session", EXPFILL }},
|
|
|
|
{ &ei_length_bad, { "bthci_acl.length.bad", PI_MALFORMED, PI_WARN, "Length too short", EXPFILL }},
|
2014-08-26 13:37:00 +00:00
|
|
|
};
|
2012-03-12 14:40:09 +00:00
|
|
|
|
|
|
|
/* Register the protocol name and description */
|
2012-09-10 12:12:05 +00:00
|
|
|
proto_bthci_acl = proto_register_protocol("Bluetooth HCI ACL Packet", "HCI_ACL", "bthci_acl");
|
2015-12-09 04:04:01 +00:00
|
|
|
bthci_acl_handle = register_dissector("bthci_acl", dissect_bthci_acl, proto_bthci_acl);
|
2012-03-12 14:40:09 +00:00
|
|
|
|
|
|
|
/* Required function calls to register the header fields and subtrees used */
|
2012-09-10 12:12:05 +00:00
|
|
|
proto_register_field_array(proto_bthci_acl, hf, array_length(hf));
|
2012-03-12 14:40:09 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
2014-08-26 13:37:00 +00:00
|
|
|
bthci_acl_expert_module = expert_register_protocol(proto_bthci_acl);
|
|
|
|
expert_register_field_array(bthci_acl_expert_module, ei, array_length(ei));
|
|
|
|
|
2012-03-12 14:40:09 +00:00
|
|
|
/* Register configuration preferences */
|
2012-09-10 12:12:05 +00:00
|
|
|
bthci_acl_module = prefs_register_protocol(proto_bthci_acl, NULL);
|
|
|
|
prefs_register_bool_preference(bthci_acl_module, "hci_acl_reassembly",
|
2012-03-12 14:40:09 +00:00
|
|
|
"Reassemble ACL Fragments",
|
|
|
|
"Whether the ACL dissector should reassemble fragmented PDUs",
|
|
|
|
&acl_reassembly);
|
|
|
|
|
2013-06-20 16:31:53 +00:00
|
|
|
chandle_tree = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
|
2006-05-14 10:18:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2012-09-10 12:12:05 +00:00
|
|
|
proto_reg_handoff_bthci_acl(void)
|
2006-05-14 10:18:29 +00:00
|
|
|
{
|
2012-03-12 14:40:09 +00:00
|
|
|
dissector_add_uint("hci_h4.type", HCI_H4_TYPE_ACL, bthci_acl_handle);
|
|
|
|
dissector_add_uint("hci_h1.type", BTHCI_CHANNEL_ACL, bthci_acl_handle);
|
2006-05-14 10:18:29 +00:00
|
|
|
|
2016-03-16 13:02:52 +00:00
|
|
|
btl2cap_handle = find_dissector_add_dependency("btl2cap", proto_bthci_acl);
|
2006-05-14 10:18:29 +00:00
|
|
|
}
|
|
|
|
|
2012-10-09 10:36:04 +00:00
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|