aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-02 19:20:04 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-02 19:20:04 +0000
commita267501b82a84ab3d5b9cb7d2f06129d5ca57e42 (patch)
tree056e815b8f475e4c3b5ae57d80f89e202d47aa13
parent2c85824a469dba2edc674f29a18058bcec19139e (diff)
Bluetooth: Use dissector data instead of pinfo->private_data. Bug 7893 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7893)
From Michal Labedzki svn path=/trunk/; revision=53051
-rw-r--r--epan/conversation.h3
-rw-r--r--epan/dissectors/packet-bt3ds.c6
-rw-r--r--epan/dissectors/packet-btamp.c10
-rw-r--r--epan/dissectors/packet-btatt.c12
-rw-r--r--epan/dissectors/packet-btavctp.c26
-rw-r--r--epan/dissectors/packet-btavdtp.c16
-rw-r--r--epan/dissectors/packet-btavrcp.c21
-rw-r--r--epan/dissectors/packet-btbnep.c14
-rw-r--r--epan/dissectors/packet-bthci_acl.c37
-rw-r--r--epan/dissectors/packet-bthci_cmd.c22
-rw-r--r--epan/dissectors/packet-bthci_evt.c69
-rw-r--r--epan/dissectors/packet-bthci_sco.c17
-rw-r--r--epan/dissectors/packet-bthcrp.c15
-rw-r--r--epan/dissectors/packet-bthfp.c41
-rw-r--r--epan/dissectors/packet-bthid.c6
-rw-r--r--epan/dissectors/packet-btl2cap.c124
-rw-r--r--epan/dissectors/packet-btl2cap.h4
-rw-r--r--epan/dissectors/packet-btmcap.c15
-rw-r--r--epan/dissectors/packet-btobex.c34
-rw-r--r--epan/dissectors/packet-btrfcomm.c60
-rw-r--r--epan/dissectors/packet-btrfcomm.h4
-rw-r--r--epan/dissectors/packet-btsap.c20
-rw-r--r--epan/dissectors/packet-btsdp.c80
-rw-r--r--epan/dissectors/packet-btsmp.c6
-rw-r--r--epan/dissectors/packet-hci_h1.c15
-rw-r--r--epan/dissectors/packet-hci_h4.c13
-rw-r--r--epan/dissectors/packet-hci_usb.c22
27 files changed, 347 insertions, 365 deletions
diff --git a/epan/conversation.h b/epan/conversation.h
index 5cb8bcd7f6..df137e53d4 100644
--- a/epan/conversation.h
+++ b/epan/conversation.h
@@ -190,9 +190,6 @@ WS_DLL_PUBLIC
GHashTable *get_conversation_hashtable_no_addr2(void);
WS_DLL_PUBLIC
-GHashTable *get_conversation_hashtable_no_addr2(void);
-
-WS_DLL_PUBLIC
GHashTable * get_conversation_hashtable_no_port2(void);
WS_DLL_PUBLIC
diff --git a/epan/dissectors/packet-bt3ds.c b/epan/dissectors/packet-bt3ds.c
index cef430c482..1773dffec2 100644
--- a/epan/dissectors/packet-bt3ds.c
+++ b/epan/dissectors/packet-bt3ds.c
@@ -65,6 +65,9 @@ dissect_bt3ds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
gint offset = 0;
guint8 value;
+ main_item = proto_tree_add_item(tree, proto_bt3ds, tvb, offset, -1, ENC_NA);
+ main_tree = proto_item_add_subtree(main_item, ett_bt3ds);
+
col_set_str(pinfo->cinfo, COL_PROTOCOL, "3DS");
switch (pinfo->p2p_dir) {
@@ -80,9 +83,6 @@ dissect_bt3ds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
break;
}
- main_item = proto_tree_add_item(tree, proto_bt3ds, tvb, offset, -1, ENC_NA);
- main_tree = proto_item_add_subtree(main_item, ett_bt3ds);
-
sub_item = proto_tree_add_item(main_tree, hf_message_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
value = tvb_get_guint8(tvb, offset);
if (value > 0)
diff --git a/epan/dissectors/packet-btamp.c b/epan/dissectors/packet-btamp.c
index 6615d95c05..06582e7d82 100644
--- a/epan/dissectors/packet-btamp.c
+++ b/epan/dissectors/packet-btamp.c
@@ -381,7 +381,8 @@ static int
dissect_btamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
int offset = 0;
- proto_tree *btamp_tree = NULL;
+ proto_item *ti;
+ proto_tree *btamp_tree;
guint16 length;
proto_item *ti_command;
proto_tree *btamp_cmd_tree;
@@ -403,11 +404,8 @@ dissect_btamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
break;
}
- if (tree) {
- proto_item *ti;
- ti = proto_tree_add_item(tree, proto_btamp, tvb, offset, -1, ENC_NA);
- btamp_tree = proto_item_add_subtree(ti, ett_btamp);
- }
+ ti = proto_tree_add_item(tree, proto_btamp, tvb, offset, -1, ENC_NA);
+ btamp_tree = proto_item_add_subtree(ti, ett_btamp);
length = tvb_reported_length_remaining(tvb, offset);
ti_command = proto_tree_add_none_format(btamp_tree,
diff --git a/epan/dissectors/packet-btatt.c b/epan/dissectors/packet-btatt.c
index 4adfb52875..c12cd88c47 100644
--- a/epan/dissectors/packet-btatt.c
+++ b/epan/dissectors/packet-btatt.c
@@ -265,6 +265,12 @@ dissect_btatt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
proto_tree *st, *ltree;
guint8 opcode;
+ if (tvb_length_remaining(tvb, 0) < 1)
+ return 0;
+
+ ti = proto_tree_add_item(tree, proto_btatt, tvb, 0, -1, ENC_NA);
+ st = proto_item_add_subtree(ti, ett_btatt);
+
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATT");
switch (pinfo->p2p_dir) {
@@ -280,12 +286,6 @@ dissect_btatt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
break;
}
- if (tvb_length_remaining(tvb, 0) < 1)
- return FALSE;
-
- ti = proto_tree_add_item(tree, proto_btatt, tvb, 0, -1, ENC_NA);
- st = proto_item_add_subtree(ti, ett_btatt);
-
item = proto_tree_add_item(st, hf_btatt_opcode, tvb, 0, 1, ENC_LITTLE_ENDIAN);
opcode = tvb_get_guint8(tvb, 0);
offset++;
diff --git a/epan/dissectors/packet-btavctp.c b/epan/dissectors/packet-btavctp.c
index b93260188d..706665d660 100644
--- a/epan/dissectors/packet-btavctp.c
+++ b/epan/dissectors/packet-btavctp.c
@@ -100,8 +100,8 @@ static const value_string ipid_vals[] = {
void proto_register_btavctp(void);
void proto_reg_handoff_btavctp(void);
-static void
-dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_item *ti;
proto_tree *btavctp_tree;
@@ -117,13 +117,13 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint number_of_packets = 0;
guint length;
guint i_frame;
- void *save_private_data;
+
+ ti = proto_tree_add_item(tree, proto_btavctp, tvb, offset, -1, ENC_NA);
+ btavctp_tree = proto_item_add_subtree(ti, ett_btavctp);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AVCTP");
col_clear(pinfo->cinfo, COL_INFO);
- l2cap_data = (btl2cap_data_t *) pinfo->private_data;
-
switch (pinfo->p2p_dir) {
case P2P_DIR_SENT:
col_set_str(pinfo->cinfo, COL_INFO, "Sent ");
@@ -137,9 +137,8 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
- ti = proto_tree_add_item(tree, proto_btavctp, tvb, offset, -1, ENC_NA);
-
- btavctp_tree = proto_item_add_subtree(ti, ett_btavctp);
+ l2cap_data = (btl2cap_data_t *) data;
+ DISSECTOR_ASSERT(l2cap_data);
proto_tree_add_item(btavctp_tree, hf_btavctp_transaction, tvb, offset, 1, ENC_BIG_ENDIAN);
pitem = proto_tree_add_item(btavctp_tree, hf_btavctp_packet_type, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -173,9 +172,6 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
avctp_data->chandle = l2cap_data->chandle;
avctp_data->psm = l2cap_data->psm;
- save_private_data = pinfo->private_data;
- pinfo->private_data = avctp_data;
-
col_append_fstr(pinfo->cinfo, COL_INFO, "%s - Transaction: %u, PacketType: %s",
val_to_str_const(cr, cr_vals, "unknown CR"), transaction,
val_to_str_const(packet_type, packet_type_vals, "unknown packet type"));
@@ -185,7 +181,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* reassembling */
next_tvb = tvb_new_subset(tvb, offset, length, length);
if (packet_type == PACKET_TYPE_SINGLE) {
- if (!dissector_try_uint(avctp_service_dissector_table, pid, next_tvb, pinfo, tree)) {
+ if (!dissector_try_uint_new(avctp_service_dissector_table, pid, next_tvb, pinfo, tree, TRUE, avctp_data)) {
call_dissector(data_handle, next_tvb, pinfo, tree);
}
@@ -376,7 +372,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
next_tvb = tvb_new_child_real_data(tvb, reassembled, length, length);
add_new_data_source(pinfo, next_tvb, "Reassembled AVCTP");
- if (!dissector_try_uint(avctp_service_dissector_table, fragments->pid, next_tvb, pinfo, tree)) {
+ if (!dissector_try_uint_new(avctp_service_dissector_table, fragments->pid, next_tvb, pinfo, tree, TRUE, avctp_data)) {
call_dissector(data_handle, next_tvb, pinfo, tree);
}
}
@@ -387,7 +383,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
- pinfo->private_data = save_private_data;
+ return offset;
}
void
@@ -447,7 +443,7 @@ proto_register_btavctp(void)
avctp_service_dissector_table = register_dissector_table("btavctp.service", "BT AVCTP Service", FT_UINT16, BASE_HEX);
proto_btavctp = proto_register_protocol("Bluetooth AVCTP Protocol", "BT AVCTP", "btavctp");
- register_dissector("btavctp", dissect_btavctp, proto_btavctp);
+ new_register_dissector("btavctp", dissect_btavctp, proto_btavctp);
proto_register_field_array(proto_btavctp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-btavdtp.c b/epan/dissectors/packet-btavdtp.c
index 191b6d5324..7a61df132e 100644
--- a/epan/dissectors/packet-btavdtp.c
+++ b/epan/dissectors/packet-btavdtp.c
@@ -927,8 +927,8 @@ dissect_seid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset,
}
-static void
-dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_item *ti;
proto_tree *btavdtp_tree = NULL;
@@ -954,8 +954,6 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AVDTP");
- l2cap_data = (btl2cap_data_t *) pinfo->private_data;
-
switch (pinfo->p2p_dir) {
case P2P_DIR_SENT:
col_set_str(pinfo->cinfo, COL_INFO, "Sent ");
@@ -971,6 +969,9 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
+ l2cap_data = (btl2cap_data_t *) data;
+ DISSECTOR_ASSERT(l2cap_data);
+
if (!force_avdtp && !pinfo->fd->flags.visited && (l2cap_data->first_scid_frame == pinfo->fd->num ||
l2cap_data->first_dcid_frame == pinfo->fd->num)) {
cid_type_data = wmem_new(wmem_file_scope(), cid_type_data_t);
@@ -1060,7 +1061,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
- return;
+ return offset;
} else if (!(cid_type_data && cid_type_data->type == STREAM_TYPE_SIGNAL && cid_type_data->cid == l2cap_data->cid)) {
/* AVDTP not signaling - Unknown Media stream */
ti = proto_tree_add_item(tree, proto_btavdtp, tvb, offset, -1, ENC_NA);
@@ -1068,7 +1069,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_append_fstr(pinfo->cinfo, COL_INFO, "Unknown stream on cid=0x%04x", l2cap_data->cid);
proto_tree_add_item(btavdtp_tree, hf_btavdtp_data, tvb, offset, -1, ENC_NA);
- return;
+ return offset;
}
}
@@ -1316,6 +1317,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(btavdtp_tree, hf_btavdtp_data, tvb, offset, -1, ENC_NA);
}
+ return offset;
}
@@ -1970,7 +1972,7 @@ proto_register_btavdtp(void)
};
proto_btavdtp = proto_register_protocol("Bluetooth AVDTP Protocol", "BT AVDTP", "btavdtp");
- register_dissector("btavdtp", dissect_btavdtp, proto_btavdtp);
+ new_register_dissector("btavdtp", dissect_btavdtp, proto_btavdtp);
proto_register_field_array(proto_btavdtp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-btavrcp.c b/epan/dissectors/packet-btavrcp.c
index 640ff38818..4a3c8ffad6 100644
--- a/epan/dissectors/packet-btavrcp.c
+++ b/epan/dissectors/packet-btavrcp.c
@@ -996,7 +996,7 @@ dissect_subunit(tvbuff_t *tvb, proto_tree *tree, gint offset, gboolean is_comman
static gint
dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gint offset, guint ctype, guint32 *op, guint32 *op_arg,
- gboolean is_command)
+ gboolean is_command, btavctp_data_t *avctp_data)
{
proto_item *pitem;
guint pdu_id;
@@ -1018,12 +1018,9 @@ dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint32 psm;
guint volume;
guint volume_percent;
- btavctp_data_t *avctp_data;
fragment_t *fragment;
data_fragment_t *data_fragment;
- avctp_data = (btavctp_data_t *) pinfo->private_data;
-
*op_arg = 0;
interface_id = avctp_data->interface_id;
@@ -2068,8 +2065,8 @@ dissect_browsing(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
return offset;
}
-static void
-dissect_btavrcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btavrcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_item *ti;
proto_tree *btavrcp_tree;
@@ -2098,7 +2095,8 @@ dissect_btavrcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 psm;
btavctp_data_t *avctp_data;
- avctp_data = (btavctp_data_t *) pinfo->private_data;
+ ti = proto_tree_add_item(tree, proto_btavrcp, tvb, offset, -1, ENC_NA);
+ btavrcp_tree = proto_item_add_subtree(ti, ett_btavrcp);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AVRCP");
@@ -2115,8 +2113,8 @@ dissect_btavrcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
- ti = proto_tree_add_item(tree, proto_btavrcp, tvb, offset, -1, ENC_NA);
- btavrcp_tree = proto_item_add_subtree(ti, ett_btavrcp);
+ avctp_data = (btavctp_data_t *) data;
+ DISSECTOR_ASSERT(avctp_data);
is_command = !avctp_data->cr;
@@ -2157,7 +2155,7 @@ dissect_btavrcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case OPCODE_VENDOR_DEPENDANT:
offset = dissect_vendor_dependant(tvb, pinfo, btavrcp_tree,
- offset, ctype, &op, &op_arg, is_command);
+ offset, ctype, &op, &op_arg, is_command, avctp_data);
break;
};
@@ -2313,6 +2311,7 @@ dissect_btavrcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
expert_add_info(pinfo, pitem, &ei_btavrcp_unexpected_data);
}
+ return offset;
}
@@ -3148,7 +3147,7 @@ proto_register_btavrcp(void)
timing = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
proto_btavrcp = proto_register_protocol("Bluetooth AVRCP Profile", "BT AVRCP", "btavrcp");
- register_dissector("btavrcp", dissect_btavrcp, proto_btavrcp);
+ new_register_dissector("btavrcp", dissect_btavrcp, proto_btavrcp);
proto_register_field_array(proto_btavrcp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-btbnep.c b/epan/dissectors/packet-btbnep.c
index 3a55c3a30c..93bfa9af13 100644
--- a/epan/dissectors/packet-btbnep.c
+++ b/epan/dissectors/packet-btbnep.c
@@ -273,8 +273,8 @@ dissect_extension(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offse
return offset;
}
-static void
-dissect_btbnep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btbnep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *pi;
proto_tree *btbnep_tree;
@@ -287,6 +287,9 @@ dissect_btbnep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
const guint8 *src_addr;
const guint8 *dst_addr;
+ pi = proto_tree_add_item(tree, proto_btbnep, tvb, offset, -1, ENC_NA);
+ btbnep_tree = proto_item_add_subtree(pi, ett_btbnep);
+
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BNEP");
col_clear(pinfo->cinfo, COL_INFO);
@@ -303,9 +306,6 @@ dissect_btbnep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
- pi = proto_tree_add_item(tree, proto_btbnep, tvb, offset, -1, ENC_NA);
- btbnep_tree = proto_item_add_subtree(pi, ett_btbnep);
-
proto_tree_add_item(btbnep_tree, hf_btbnep_extension_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(btbnep_tree, hf_btbnep_bnep_type, tvb, offset, 1, ENC_BIG_ENDIAN);
bnep_type = tvb_get_guint8(tvb, offset);
@@ -375,6 +375,8 @@ dissect_btbnep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector(data_handle, next_tvb, pinfo, tree);
}
}
+
+ return offset;
}
void
@@ -512,7 +514,7 @@ proto_register_btbnep(void)
};
proto_btbnep = proto_register_protocol("Bluetooth BNEP Protocol", "BT BNEP", "btbnep");
- register_dissector("btbnep", dissect_btbnep, proto_btbnep);
+ new_register_dissector("btbnep", dissect_btbnep, proto_btbnep);
proto_register_field_array(proto_btbnep, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-bthci_acl.c b/epan/dissectors/packet-bthci_acl.c
index 1364dedc1e..c48ea26ee2 100644
--- a/epan/dissectors/packet-bthci_acl.c
+++ b/epan/dissectors/packet-bthci_acl.c
@@ -90,20 +90,19 @@ void proto_register_bthci_acl(void);
void proto_reg_handoff_bthci_acl(void);
/* Code to actually dissect the packets */
-static void
-dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- proto_item *ti = NULL;
- proto_tree *bthci_acl_tree = NULL;
+ proto_item *ti;
+ proto_tree *bthci_acl_tree;
guint16 flags;
guint16 length;
gboolean fragmented;
- int offset = 0;
+ gint offset = 0;
guint16 pb_flag, l2cap_length = 0;
tvbuff_t *next_tvb;
bthci_acl_data_t *acl_data;
chandle_data_t *chandle_data;
- void *pd_save;
hci_data_t *hci_data;
wmem_tree_key_t key[5];
guint32 k_connection_handle;
@@ -119,6 +118,9 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
localhost_bdaddr_entry_t *localhost_bdaddr_entry;
localhost_name_entry_t *localhost_name_entry;
+ ti = proto_tree_add_item(tree, proto_bthci_acl, tvb, offset, -1, ENC_NA);
+ bthci_acl_tree = proto_item_add_subtree(ti, ett_bthci_acl);
+
switch (pinfo->p2p_dir) {
case P2P_DIR_SENT:
col_set_str(pinfo->cinfo, COL_INFO, "Sent ");
@@ -134,10 +136,8 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCI_ACL");
- if (tree) {
- ti = proto_tree_add_item(tree, proto_bthci_acl, tvb, offset, -1, ENC_NA);
- bthci_acl_tree = proto_item_add_subtree(ti, ett_bthci_acl);
- }
+ hci_data = (hci_data_t *) data;
+ DISSECTOR_ASSERT(hci_data);
flags = tvb_get_letohs(tvb, offset);
pb_flag = (flags & 0x3000) >> 12;
@@ -146,7 +146,6 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(bthci_acl_tree, hf_bthci_acl_bc_flag, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- hci_data = (hci_data_t *) pinfo->private_data;
acl_data = wmem_new(wmem_packet_scope(), bthci_acl_data_t);
acl_data->interface_id = hci_data->interface_id;
@@ -155,9 +154,6 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
acl_data->remote_bd_addr_oui = 0;
acl_data->remote_bd_addr_id = 0;
- pd_save = pinfo->private_data;
- pinfo->private_data = acl_data;
-
k_interface_id = hci_data->interface_id;
k_adapter_id = hci_data->adapter_id;
k_connection_handle = flags & 0x0fff;
@@ -362,10 +358,10 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), length);
if (btl2cap_handle) {
- call_dissector(btl2cap_handle, next_tvb, pinfo, tree);
+ call_dissector_with_data(btl2cap_handle, next_tvb, pinfo, tree, acl_data);
}
- pinfo->private_data = pd_save;
- return;
+
+ return offset;
}
if (fragmented && acl_reassembly) {
@@ -421,12 +417,13 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* call L2CAP dissector */
if (btl2cap_handle) {
- call_dissector(btl2cap_handle, next_tvb, pinfo, tree);
+ call_dissector_with_data(btl2cap_handle, next_tvb, pinfo, tree, acl_data);
}
}
}
}
- pinfo->private_data = pd_save;
+
+ return offset;
}
@@ -483,7 +480,7 @@ proto_register_bthci_acl(void)
/* Register the protocol name and description */
proto_bthci_acl = proto_register_protocol("Bluetooth HCI ACL Packet", "HCI_ACL", "bthci_acl");
- register_dissector("bthci_acl", dissect_bthci_acl, proto_bthci_acl);
+ new_register_dissector("bthci_acl", dissect_bthci_acl, proto_bthci_acl);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_bthci_acl, hf, array_length(hf));
diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c
index 36dc31981d..1de3c8869e 100644
--- a/epan/dissectors/packet-bthci_cmd.c
+++ b/epan/dissectors/packet-bthci_cmd.c
@@ -3201,20 +3201,23 @@ dissect_le_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
}
/* Code to actually dissect the packets */
-static void
-dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- proto_item *ti_cmd = NULL;
- proto_tree *bthci_cmd_tree = NULL;
+ proto_item *ti_cmd;
+ proto_tree *bthci_cmd_tree;
guint16 opcode;
guint16 ocf;
guint8 param_length;
guint8 ogf;
- int offset = 0;
+ gint offset = 0;
proto_item *ti_opcode;
proto_tree *opcode_tree;
gint hfx;
+ ti_cmd = proto_tree_add_item(tree, proto_bthci_cmd, tvb, offset, -1, ENC_NA);
+ bthci_cmd_tree = proto_item_add_subtree(ti_cmd, ett_bthci_cmd);
+
switch (pinfo->p2p_dir) {
case P2P_DIR_SENT:
col_set_str(pinfo->cinfo, COL_INFO, "Sent ");
@@ -3228,11 +3231,6 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
- if (tree) {
- ti_cmd = proto_tree_add_item(tree, proto_bthci_cmd, tvb, offset, -1, ENC_NA);
- bthci_cmd_tree = proto_item_add_subtree(ti_cmd, ett_bthci_cmd);
- }
-
opcode = tvb_get_letohs(tvb, offset);
ocf = opcode & 0x03ff;
ogf = (guint8) (opcode >> 10);
@@ -3314,6 +3312,8 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_expert(bthci_cmd_tree, pinfo, &ei_command_parameter_unexpected, tvb, offset, -1);
/*offset += tvb_length_remaining(tvb, offset);*/
}
+
+ return offset;
}
@@ -5140,7 +5140,7 @@ proto_register_bthci_cmd(void)
/* Register the protocol name and description */
proto_bthci_cmd = proto_register_protocol("Bluetooth HCI Command", "HCI_CMD", "bthci_cmd");
- register_dissector("bthci_cmd", dissect_bthci_cmd, proto_bthci_cmd);
+ new_register_dissector("bthci_cmd", dissect_bthci_cmd, proto_bthci_cmd);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_bthci_cmd, hf, array_length(hf));
diff --git a/epan/dissectors/packet-bthci_evt.c b/epan/dissectors/packet-bthci_evt.c
index 3e27a2ff00..9f5dfec7b8 100644
--- a/epan/dissectors/packet-bthci_evt.c
+++ b/epan/dissectors/packet-bthci_evt.c
@@ -43,7 +43,7 @@
#include "packet-bluetooth-hci.h"
#include "packet-sdp.h"
-static dissector_handle_t bthci_com_handle;
+static dissector_handle_t bthci_cmd_handle;
/* Initialize the protocol and registered fields */
static int proto_bthci_evt = -1;
@@ -1091,12 +1091,12 @@ dissect_bthci_evt_inq_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_
}
static int
-dissect_bthci_evt_conn_complete(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_conn_complete(tvbuff_t *tvb, int offset, packet_info *pinfo,
+ proto_tree *tree, hci_data_t *hci_data)
{
guint16 connection_handle;
guint8 bd_addr[6];
guint8 status;
- hci_data_t *hci_data = (hci_data_t *) pinfo->private_data;
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
status = tvb_get_guint8(tvb, offset);
@@ -1369,10 +1369,10 @@ dissect_bthci_evt_read_remote_support_features_complete(tvbuff_t *tvb, int offse
}
static int
-dissect_bthci_evt_remote_name_req_complete(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_remote_name_req_complete(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree, hci_data_t *hci_data)
{
guint8 bd_addr[6];
- hci_data_t *hci_data = (hci_data_t *) pinfo->private_data;
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -1512,14 +1512,14 @@ dissect_bthci_evt_hardware_error(tvbuff_t *tvb, int offset, packet_info *pinfo _
}
static int
-dissect_bthci_evt_loopback_command(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_loopback_command(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree, hci_data_t *hci_data)
{
tvbuff_t *next_tvb;
next_tvb = tvb_new_subset_remaining(tvb, offset);
- if(bthci_com_handle){
- call_dissector(bthci_com_handle, next_tvb, pinfo, tree);
- }
+ call_dissector_with_data(bthci_cmd_handle, next_tvb, pinfo, tree, hci_data);
+
offset+=tvb_length_remaining(tvb, offset);
return offset;
@@ -1756,14 +1756,13 @@ dissect_bthci_evt_inq_result_with_rssi(tvbuff_t *tvb, int offset,
static int
dissect_bthci_evt_eir_ad_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
- proto_tree *tree, guint8 size, guint8 *bd_addr)
+ proto_tree *tree, guint8 size, guint8 *bd_addr, hci_data_t *hci_data)
{
guint16 i, j;
guint8 length, type;
proto_item *ti_eir = NULL;
proto_item *ti_eir_subtree = NULL;
proto_item *sub_item;
- hci_data_t *hci_data = (hci_data_t *) pinfo->private_data;
if(tree){
ti_eir = proto_tree_add_item(tree, (size == 240) ? hf_extended_inquiry_response_data : hf_advertising_data,
@@ -2108,7 +2107,8 @@ dissect_bthci_evt_remote_host_sup_feat_notification(tvbuff_t *tvb, int offset, p
}
static int
-dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo,
+ proto_tree *tree, hci_data_t *hci_data)
{
proto_item *item;
guint8 subevent_code;
@@ -2159,7 +2159,7 @@ dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_bthci_evt_data_length, tvb, offset, 1, ENC_NA);
offset++;
- offset=dissect_bthci_evt_eir_ad_data(tvb, offset, pinfo, tree, length, NULL);
+ offset=dissect_bthci_evt_eir_ad_data(tvb, offset, pinfo, tree, length, NULL, hci_data);
proto_tree_add_item(tree, hf_bthci_evt_rssi, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
}
@@ -2355,7 +2355,8 @@ dissect_bthci_evt_amp_status_change(tvbuff_t *tvb, int offset, packet_info *pinf
}
static int
-dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree, hci_data_t *hci_data)
{
proto_item *ti_opcode;
proto_tree *opcode_tree;
@@ -2369,7 +2370,6 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset, packet_info *pinfo
guint8 bd_addr[6];
gboolean local_addr = FALSE;
gint hfx;
- hci_data_t *hci_data = (hci_data_t *) pinfo->private_data;
proto_tree_add_item(tree, hf_bthci_evt_num_command_packets, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2892,7 +2892,7 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset, packet_info *pinfo
proto_tree_add_item(tree, hf_bthci_evt_fec_required, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
- offset=dissect_bthci_evt_eir_ad_data(tvb, offset, pinfo, tree, 240, NULL);
+ offset=dissect_bthci_evt_eir_ad_data(tvb, offset, pinfo, tree, 240, NULL, hci_data);
break;
case 0x0c55: /* Read Simple Pairing Mode */
@@ -3635,13 +3635,18 @@ dissect_bthci_evt_inq_result(tvbuff_t *tvb, int offset, packet_info *pinfo, prot
/* Code to actually dissect the packets */
-static int
-dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+static gint
+dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- proto_tree *bthci_evt_tree = NULL;
+ proto_item *ti;
+ proto_tree *bthci_evt_tree;
guint8 param_length, evt_code;
guint8 bd_addr[6];
- int offset = 0;
+ gint offset = 0;
+ hci_data_t *hci_data;
+
+ ti = proto_tree_add_item(tree, proto_bthci_evt, tvb, offset, -1, ENC_NA);
+ bthci_evt_tree = proto_item_add_subtree(ti, ett_bthci_evt);
switch (pinfo->p2p_dir) {
case P2P_DIR_SENT:
@@ -3656,12 +3661,8 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
}
- if (tree) {
- proto_item *ti;
-
- ti = proto_tree_add_item(tree, proto_bthci_evt, tvb, offset, -1, ENC_NA);
- bthci_evt_tree = proto_item_add_subtree(ti, ett_bthci_evt);
- }
+ hci_data = (hci_data_t *) data;
+ DISSECTOR_ASSERT(hci_data);
evt_code = tvb_get_guint8(tvb, offset);
proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_code, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -3688,7 +3689,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x03: /* Connection Complete */
- offset=dissect_bthci_evt_conn_complete(tvb, offset, pinfo, bthci_evt_tree);
+ offset=dissect_bthci_evt_conn_complete(tvb, offset, pinfo, bthci_evt_tree, hci_data);
break;
case 0x04: /* Connection Request */
@@ -3704,7 +3705,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x07: /* Remote Name Request Complete */
- offset=dissect_bthci_evt_remote_name_req_complete(tvb, offset, pinfo, bthci_evt_tree);
+ offset=dissect_bthci_evt_remote_name_req_complete(tvb, offset, pinfo, bthci_evt_tree, hci_data);
break;
case 0x08: /* Encryption Change */
@@ -3732,7 +3733,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x0e: /* Command Complete */
- offset=dissect_bthci_evt_command_complete(tvb, offset, pinfo, bthci_evt_tree);
+ offset=dissect_bthci_evt_command_complete(tvb, offset, pinfo, bthci_evt_tree, hci_data);
break;
case 0x0f: /* Command Status */
@@ -3776,7 +3777,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x19: /* Loopback Command */
- offset=dissect_bthci_evt_loopback_command(tvb, offset, pinfo, bthci_evt_tree);
+ offset=dissect_bthci_evt_loopback_command(tvb, offset, pinfo, bthci_evt_tree, hci_data);
break;
case 0x1a: /* Data Buffer Overflow */
@@ -3834,7 +3835,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
case 0x2f: /* Extended Inquiry Result */
/* TODO: Get bd_addr from first and pass to second*/
offset = dissect_bthci_evt_inq_result_with_rssi(tvb, offset, pinfo, bthci_evt_tree, bd_addr);
- offset = dissect_bthci_evt_eir_ad_data(tvb, offset, pinfo, bthci_evt_tree, 240, bd_addr);
+ offset = dissect_bthci_evt_eir_ad_data(tvb, offset, pinfo, bthci_evt_tree, 240, bd_addr, hci_data);
break;
case 0x30: /* Encryption Key Refresh Complete */
@@ -3886,7 +3887,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x3e: /* LE Meta */
- offset=dissect_bthci_evt_le_meta(tvb, offset, pinfo, bthci_evt_tree);
+ offset=dissect_bthci_evt_le_meta(tvb, offset, pinfo, bthci_evt_tree, hci_data);
break;
case 0x40: /* Physical Link Complete */
@@ -3962,6 +3963,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
}
}
+
return offset;
}
@@ -5846,7 +5848,6 @@ proto_register_bthci_evt(void)
/* Register the protocol name and description */
proto_bthci_evt = proto_register_protocol("Bluetooth HCI Event",
"HCI_EVT", "bthci_evt");
-
new_register_dissector("bthci_evt", dissect_bthci_evt, proto_bthci_evt);
/* Required function calls to register the header fields and subtrees used */
@@ -5876,7 +5877,7 @@ proto_reg_handoff_bthci_evt(void)
dissector_add_uint("hci_h4.type", HCI_H4_TYPE_EVT, bthci_evt_handle);
dissector_add_uint("hci_h1.type", BTHCI_CHANNEL_EVENT, bthci_evt_handle);
- bthci_com_handle = find_dissector("bthci_cmd");
+ bthci_cmd_handle = find_dissector("bthci_cmd");
}
/*
diff --git a/epan/dissectors/packet-bthci_sco.c b/epan/dissectors/packet-bthci_sco.c
index 906ec53ba0..b8fc4e7958 100644
--- a/epan/dissectors/packet-bthci_sco.c
+++ b/epan/dissectors/packet-bthci_sco.c
@@ -45,12 +45,15 @@ void proto_register_bthci_sco(void);
void proto_reg_handoff_bthci_sco(void);
/* Code to actually dissect the packets */
-static void
-dissect_bthci_sco(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
+static gint
+dissect_bthci_sco(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
{
proto_item *ti;
proto_tree *bthci_sco_tree;
- int offset = 0;
+ gint offset = 0;
+
+ ti = proto_tree_add_item(tree, proto_bthci_sco, tvb, offset, -1, ENC_NA);
+ bthci_sco_tree = proto_item_add_subtree(ti, ett_bthci_sco);
switch (pinfo->p2p_dir) {
case P2P_DIR_SENT:
@@ -65,10 +68,6 @@ dissect_bthci_sco(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
break;
}
- ti = proto_tree_add_item(tree, proto_bthci_sco, tvb, offset, -1, ENC_NA);
- bthci_sco_tree = proto_item_add_subtree(ti, ett_bthci_sco);
-
-
proto_tree_add_item(bthci_sco_tree, hf_bthci_sco_chandle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
@@ -76,6 +75,8 @@ dissect_bthci_sco(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
offset++;
proto_tree_add_item(bthci_sco_tree, hf_bthci_sco_data, tvb, offset, -1, ENC_NA);
+
+ return tvb_length(tvb);
}
@@ -107,7 +108,7 @@ proto_register_bthci_sco(void)
/* Register the protocol name and description */
proto_bthci_sco = proto_register_protocol("Bluetooth HCI SCO Packet", "HCI_SCO", "bthci_sco");
- register_dissector("bthci_sco", dissect_bthci_sco, proto_bthci_sco);
+ new_register_dissector("bthci_sco", dissect_bthci_sco, proto_bthci_sco);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_bthci_sco, hf, array_length(hf));
diff --git a/epan/dissectors/packet-bthcrp.c b/epan/dissectors/packet-bthcrp.c
index c73415f98d..e07bee779d 100644
--- a/epan/dissectors/packet-bthcrp.c
+++ b/epan/dissectors/packet-bthcrp.c
@@ -345,8 +345,8 @@ dissect_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
return offset;
}
-static void
-dissect_bthcrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_bthcrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_item *main_item;
proto_tree *main_tree;
@@ -354,7 +354,8 @@ dissect_bthcrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gint offset = 0;
gboolean is_client_message;
- l2cap_data = (btl2cap_data_t *) pinfo->private_data;
+ main_item = proto_tree_add_item(tree, proto_bthcrp, tvb, offset, -1, ENC_NA);
+ main_tree = proto_item_add_subtree(main_item, ett_bthcrp);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCRP");
@@ -371,8 +372,8 @@ dissect_bthcrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
- main_item = proto_tree_add_item(tree, proto_bthcrp, tvb, offset, -1, ENC_NA);
- main_tree = proto_item_add_subtree(main_item, ett_bthcrp);
+ l2cap_data = (btl2cap_data_t *) data;
+ DISSECTOR_ASSERT(l2cap_data);
/* TODO: Implement streams reconizing by SDP
* Server provide SDP record for Control and Data PSM
@@ -397,6 +398,8 @@ dissect_bthcrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
pitem = proto_tree_add_item(main_tree, hf_bthcrp_data, tvb, offset, -1, ENC_NA);
expert_add_info(pinfo, pitem, &ei_bthcrp_unexpected_data);
}
+
+ return offset;
}
@@ -539,7 +542,7 @@ proto_register_bthcrp(void)
};
proto_bthcrp = proto_register_protocol("Bluetooth HCRP Profile", "BT HCRP", "bthcrp");
- register_dissector("bthcrp", dissect_bthcrp, proto_bthcrp);
+ new_register_dissector("bthcrp", dissect_bthcrp, proto_bthcrp);
proto_register_field_array(proto_bthcrp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-bthfp.c b/epan/dissectors/packet-bthfp.c
index e73b3fe027..26b90ee028 100644
--- a/epan/dissectors/packet-bthfp.c
+++ b/epan/dissectors/packet-bthfp.c
@@ -1132,8 +1132,8 @@ dissect_at_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
return offset;
}
-static void
-dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_item *main_item;
proto_tree *main_tree;
@@ -1163,12 +1163,8 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint reassemble_start_offset = 0;
guint reassemble_end_offset = 0;
- rfcomm_data = (btrfcomm_data_t *) pinfo->private_data;
-
- interface_id = rfcomm_data->interface_id;
- adapter_id = rfcomm_data->adapter_id;
- chandle = rfcomm_data->chandle;
- dlci = rfcomm_data->dlci;
+ main_item = proto_tree_add_item(tree, proto_bthfp, tvb, 0, -1, ENC_NA);
+ main_tree = proto_item_add_subtree(main_item, ett_bthfp);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HFP");
@@ -1184,8 +1180,13 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
- main_item = proto_tree_add_item(tree, proto_bthfp, tvb, 0, -1, ENC_NA);
- main_tree = proto_item_add_subtree(main_item, ett_bthfp);
+ rfcomm_data = (btrfcomm_data_t *) data;
+ DISSECTOR_ASSERT(rfcomm_data);
+
+ interface_id = rfcomm_data->interface_id;
+ adapter_id = rfcomm_data->adapter_id;
+ chandle = rfcomm_data->chandle;
+ dlci = rfcomm_data->dlci;
if ((hfp_role == ROLE_AG && pinfo->p2p_dir == P2P_DIR_SENT) ||
(hfp_role == ROLE_HS && pinfo->p2p_dir == P2P_DIR_RECV)) {
@@ -1267,7 +1268,7 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_append_fstr(pinfo->cinfo, COL_INFO, "Data: %s",
tvb_format_text(tvb, 0, tvb_length(tvb)));
proto_tree_add_item(main_tree, hf_data, tvb, 0, -1, ENC_NA | ENC_ASCII);
- return;
+ return tvb_length(tvb);
}
/* save fragments */
@@ -1457,17 +1458,17 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
fragment->dlci == dlci &&
fragment->role == role &&
fragment->reassemble_state != REASSEMBLE_FRAGMENT) {
- guint8 *data;
+ guint8 *at_data;
guint i_data_offset;
i_data_offset = fragment->index + fragment->length;
- data = (guint8 *) wmem_alloc(pinfo->pool, fragment->index + fragment->length);
+ at_data = (guint8 *) wmem_alloc(pinfo->pool, fragment->index + fragment->length);
i_fragment = fragment;
if (i_fragment && i_fragment->reassemble_state == REASSEMBLE_PARTIALLY) {
i_data_offset -= i_fragment->reassemble_end_offset;
- memcpy(data + i_data_offset, i_fragment->data, i_fragment->reassemble_end_offset);
+ memcpy(at_data + i_data_offset, i_fragment->data, i_fragment->reassemble_end_offset);
i_fragment = i_fragment->previous_fragment;
}
@@ -1475,24 +1476,24 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (i_fragment) {
while (i_fragment && i_fragment->index > 0) {
i_data_offset -= i_fragment->length;
- memcpy(data + i_data_offset, i_fragment->data, i_fragment->length);
+ memcpy(at_data + i_data_offset, i_fragment->data, i_fragment->length);
i_fragment = i_fragment->previous_fragment;
}
if (i_fragment && i_fragment->reassemble_state == REASSEMBLE_PARTIALLY) {
i_data_offset -= (i_fragment->length - i_fragment->reassemble_start_offset);
- memcpy(data + i_data_offset, i_fragment->data + i_fragment->reassemble_start_offset,
+ memcpy(at_data + i_data_offset, i_fragment->data + i_fragment->reassemble_start_offset,
i_fragment->length - i_fragment->reassemble_start_offset);
} else if (i_fragment) {
i_data_offset -= i_fragment->length;
- memcpy(data + i_data_offset, i_fragment->data, i_fragment->length);
+ memcpy(at_data + i_data_offset, i_fragment->data, i_fragment->length);
}
}
if (fragment->index > 0 && fragment->length > 0) {
proto_tree_add_item(main_tree, hf_fragment, tvb, offset,
tvb_length_remaining(tvb, offset), ENC_ASCII | ENC_NA);
- reassembled_tvb = tvb_new_child_real_data(tvb, data,
+ reassembled_tvb = tvb_new_child_real_data(tvb, at_data,
fragment->index + fragment->length, fragment->index + fragment->length);
add_new_data_source(pinfo, reassembled_tvb, "Reassembled HFP");
}
@@ -1520,6 +1521,8 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(main_tree, hf_fragment, tvb, offset,
tvb_length_remaining(tvb, offset), ENC_ASCII | ENC_NA);
}
+
+ return offset;
}
static int
@@ -2016,7 +2019,7 @@ proto_register_bthfp(void)
fragments = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
proto_bthfp = proto_register_protocol("Bluetooth HFP Profile", "BT HFP", "bthfp");
- register_dissector("bthfp", dissect_bthfp, proto_bthfp);
+ new_register_dissector("bthfp", dissect_bthfp, proto_bthfp);
proto_register_field_array(proto_bthfp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-bthid.c b/epan/dissectors/packet-bthid.c
index f94f41df7c..7c251ead5f 100644
--- a/epan/dissectors/packet-bthid.c
+++ b/epan/dissectors/packet-bthid.c
@@ -696,6 +696,9 @@ dissect_bthid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
guint8 control_operation;
proto_item *pitem;
+ ti = proto_tree_add_item(tree, proto_bthid, tvb, offset, -1, ENC_NA);
+ bthid_tree = proto_item_add_subtree(ti, ett_bthid);
+
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HID");
col_clear(pinfo->cinfo, COL_INFO);
@@ -712,9 +715,6 @@ dissect_bthid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
break;
}
- ti = proto_tree_add_item(tree, proto_bthid, tvb, offset, -1, ENC_NA);
- bthid_tree = proto_item_add_subtree(ti, ett_bthid);
-
pitem = proto_tree_add_item(bthid_tree, hf_bthid_transaction_type, tvb, offset, 1, ENC_BIG_ENDIAN);
transaction_type = tvb_get_guint8(tvb, offset);
parameter = transaction_type & 0x0F;
diff --git a/epan/dissectors/packet-btl2cap.c b/epan/dissectors/packet-btl2cap.c
index 3037697026..1187eb521b 100644
--- a/epan/dissectors/packet-btl2cap.c
+++ b/epan/dissectors/packet-btl2cap.c
@@ -373,7 +373,7 @@ void proto_register_btl2cap(void);
void proto_reg_handoff_btl2cap(void);
static guint16
-get_service_uuid(packet_info *pinfo, guint16 psm, gboolean is_local_psm)
+get_service_uuid(packet_info *pinfo, btl2cap_data_t *l2cap_data, guint16 psm, gboolean is_local_psm)
{
wmem_tree_key_t key[10];
guint32 k_interface_id;
@@ -390,9 +390,6 @@ get_service_uuid(packet_info *pinfo, guint16 psm, gboolean is_local_psm)
guint32 remote_bd_addr_oui;
guint32 remote_bd_addr_id;
service_info_t *service_info;
- btl2cap_data_t *l2cap_data;
-
- l2cap_data = (btl2cap_data_t *) pinfo->private_data;
interface_id = l2cap_data->interface_id;
adapter_id = l2cap_data->adapter_id;
@@ -493,7 +490,9 @@ dissect_comrej(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tr
}
static int
-dissect_connrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, gboolean is_ch_request)
+dissect_connrequest(tvbuff_t *tvb, int offset, packet_info *pinfo,
+ proto_tree *tree, gboolean is_ch_request, bthci_acl_data_t *acl_data,
+ btl2cap_data_t *l2cap_data)
{
guint16 scid;
guint16 psm;
@@ -510,7 +509,7 @@ dissect_connrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
item = proto_tree_add_item(tree, hf_btl2cap_psm_dynamic, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- uuid = get_service_uuid(pinfo, psm, (pinfo->p2p_dir == P2P_DIR_RECV) ? TRUE : FALSE);
+ uuid = get_service_uuid(pinfo, l2cap_data, psm, (pinfo->p2p_dir == P2P_DIR_RECV) ? TRUE : FALSE);
if (uuid) {
psm_str = val_to_str_ext_const(uuid, &vs_service_classes_ext, "Unknown PSM");
proto_item_append_text(item, " (%s)", psm_str);
@@ -539,7 +538,6 @@ dissect_connrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
guint32 interface_id;
guint32 adapter_id;
guint32 chandle;
- bthci_acl_data_t *acl_data = (bthci_acl_data_t *) pinfo->private_data;
psm_data_t *psm_data;
interface_id = (acl_data) ? acl_data->interface_id : HCI_INTERFACE_AMP;
@@ -746,7 +744,8 @@ dissect_options(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *t
static int
-dissect_configrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint16 length)
+dissect_configrequest(tvbuff_t *tvb, int offset, packet_info *pinfo,
+ proto_tree *tree, guint16 length, bthci_acl_data_t *acl_data)
{
guint16 dcid;
@@ -773,7 +772,6 @@ dissect_configrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
guint32 adapter_id;
guint32 chandle;
guint32 cid;
- bthci_acl_data_t *acl_data = (bthci_acl_data_t *) pinfo->private_data;
interface_id = (acl_data) ? acl_data->interface_id : HCI_INTERFACE_AMP;
adapter_id = (acl_data) ? acl_data->adapter_id : HCI_ADAPTER_DEFAULT;
@@ -929,7 +927,8 @@ dissect_inforesponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
}
static int
-dissect_configresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint16 length)
+dissect_configresponse(tvbuff_t *tvb, int offset, packet_info *pinfo,
+ proto_tree *tree, guint16 length, bthci_acl_data_t *acl_data)
{
guint16 scid;
guint16 result;
@@ -963,7 +962,6 @@ dissect_configresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
guint32 adapter_id;
guint32 chandle;
guint32 cid;
- bthci_acl_data_t *acl_data = (bthci_acl_data_t *) pinfo->private_data;
interface_id = (acl_data) ? acl_data->interface_id : HCI_INTERFACE_AMP;
adapter_id = (acl_data) ? acl_data->adapter_id : HCI_ADAPTER_DEFAULT;
@@ -1009,7 +1007,8 @@ dissect_configresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
}
static int
-dissect_connresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_connresponse(tvbuff_t *tvb, int offset, packet_info *pinfo,
+ proto_tree *tree, bthci_acl_data_t *acl_data)
{
guint16 scid, dcid, result;
@@ -1048,7 +1047,6 @@ dissect_connresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
guint32 adapter_id;
guint32 chandle;
guint32 cid;
- bthci_acl_data_t *acl_data = (bthci_acl_data_t *) pinfo->private_data;
interface_id = (acl_data) ? acl_data->interface_id : HCI_INTERFACE_AMP;
adapter_id = (acl_data) ? acl_data->adapter_id : HCI_ADAPTER_DEFAULT;
@@ -1111,9 +1109,9 @@ dissect_connresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
}
static int
-dissect_chanresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_chanresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bthci_acl_data_t *acl_data)
{
- return dissect_connresponse(tvb, offset, pinfo, tree);
+ return dissect_connresponse(tvb, offset, pinfo, tree, acl_data);
}
static int
@@ -1211,7 +1209,8 @@ dissect_connparamresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t
}
static int
-dissect_disconnrequestresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_disconnrequestresponse(tvbuff_t *tvb, int offset, packet_info *pinfo,
+ proto_tree *tree, bthci_acl_data_t *acl_data)
{
guint16 scid;
guint16 dcid;
@@ -1239,7 +1238,6 @@ dissect_disconnrequestresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, pr
guint32 chandle;
guint32 key_scid;
guint32 key_dcid;
- bthci_acl_data_t *acl_data = (bthci_acl_data_t *) pinfo->private_data;
interface_id = (acl_data) ? acl_data->interface_id : HCI_INTERFACE_AMP;
adapter_id = (acl_data) ? acl_data->adapter_id : HCI_ADAPTER_DEFAULT;
@@ -1308,8 +1306,9 @@ dissect_disconnrequestresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, pr
}
static int
-dissect_b_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *btl2cap_tree,
- guint16 cid, guint16 psm, gboolean is_local_psm, guint16 length, int offset)
+dissect_b_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ proto_tree *btl2cap_tree, guint16 cid, guint16 psm,
+ gboolean is_local_psm, guint16 length, int offset, btl2cap_data_t *l2cap_data)
{
tvbuff_t *next_tvb;
@@ -1321,7 +1320,7 @@ dissect_b_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
proto_item *psm_item;
guint16 uuid;
- uuid = get_service_uuid(pinfo, psm, is_local_psm);
+ uuid = get_service_uuid(pinfo, l2cap_data, psm, is_local_psm);
if (psm < BTL2CAP_DYNAMIC_PSM_START) {
psm_item = proto_tree_add_uint(btl2cap_tree, hf_btl2cap_psm, tvb, offset, 0, psm);
@@ -1335,10 +1334,10 @@ dissect_b_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
PROTO_ITEM_SET_GENERATED(psm_item);
/* call next dissector */
- if (!dissector_try_uint(l2cap_cid_dissector_table, (guint32) cid, next_tvb, pinfo, tree)) {
- if (!dissector_try_uint(l2cap_psm_dissector_table, (guint32) psm, next_tvb, pinfo, tree)) {
+ if (!dissector_try_uint_new(l2cap_cid_dissector_table, (guint32) cid, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
+ if (!dissector_try_uint_new(l2cap_psm_dissector_table, (guint32) psm, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
/* not a known fixed PSM, try to find a registered service to a dynamic PSM */
- if (!dissector_try_uint(l2cap_service_dissector_table, uuid, next_tvb, pinfo, tree)) {
+ if (!dissector_try_uint_new(l2cap_service_dissector_table, uuid, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
/* unknown protocol. declare as data */
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, ENC_NA);
}
@@ -1346,7 +1345,7 @@ dissect_b_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
}
offset += tvb_length_remaining(tvb, offset);
} else {
- if (!dissector_try_uint(l2cap_cid_dissector_table, (guint32) cid, next_tvb, pinfo, tree)) {
+ if (!dissector_try_uint_new(l2cap_cid_dissector_table, (guint32) cid, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, ENC_NA);
offset += tvb_length_remaining(tvb, offset);
}
@@ -1355,8 +1354,9 @@ dissect_b_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
}
static int
-dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *btl2cap_tree,
- psm_data_t *psm_data, guint16 length, int offset, config_data_t *config_data)
+dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ proto_tree *btl2cap_tree, psm_data_t *psm_data, guint16 length,
+ gint offset, config_data_t *config_data, btl2cap_data_t *l2cap_data)
{
tvbuff_t *next_tvb = NULL;
guint16 control, segment;
@@ -1478,7 +1478,7 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
proto_item *psm_item;
guint16 uuid;
- uuid = get_service_uuid(pinfo, psm, psm_data->local_service);
+ uuid = get_service_uuid(pinfo, l2cap_data, psm, psm_data->local_service);
if (psm < BTL2CAP_DYNAMIC_PSM_START) {
psm_item = proto_tree_add_uint(btl2cap_tree, hf_btl2cap_psm, tvb, offset, 0, psm);
@@ -1491,9 +1491,9 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
PROTO_ITEM_SET_GENERATED(psm_item);
/* call next dissector */
- if (!dissector_try_uint(l2cap_psm_dissector_table, (guint32) psm, next_tvb, pinfo, tree)) {
+ if (!dissector_try_uint_new(l2cap_psm_dissector_table, (guint32) psm, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
/* not a known fixed PSM, try to find a registered service to a dynamic PSM */
- if (!dissector_try_uint(l2cap_service_dissector_table, uuid, next_tvb, pinfo, tree)) {
+ if (!dissector_try_uint_new(l2cap_service_dissector_table, uuid, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
/* unknown protocol. declare as data */
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, next_tvb, 0, tvb_length(next_tvb), ENC_NA);
}
@@ -1550,16 +1550,12 @@ dissect_s_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, proto_t
return offset;
}
-/* Code to actually dissect the packets
- * This dissector will only be called ontop of BTHCI ACL
- * and this dissector _REQUIRES_ that
- * pinfo->private_data points to a valid bthci_acl_data_t structure
- */
-static void
-dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- int offset = 0;
- proto_tree *btl2cap_tree = NULL;
+ gint offset = 0;
+ proto_item *ti;
+ proto_tree *btl2cap_tree;
guint16 length;
guint16 cid;
guint16 psm;
@@ -1568,7 +1564,9 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
psm_data_t *psm_data;
bthci_acl_data_t *acl_data;
btl2cap_data_t *l2cap_data;
- void *pd_save;
+
+ ti = proto_tree_add_item(tree, proto_btl2cap, tvb, offset, -1, ENC_NA);
+ btl2cap_tree = proto_item_add_subtree(ti, ett_btl2cap);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2CAP");
@@ -1585,11 +1583,8 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
- if (tree) {
- proto_item *ti;
- ti = proto_tree_add_item(tree, proto_btl2cap, tvb, offset, -1, ENC_NA);
- btl2cap_tree = proto_item_add_subtree(ti, ett_btl2cap);
- }
+ acl_data = (bthci_acl_data_t *) data;
+ DISSECTOR_ASSERT(acl_data);
length = tvb_get_letohs(tvb, offset);
proto_tree_add_item(btl2cap_tree, hf_btl2cap_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
@@ -1599,7 +1594,6 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(btl2cap_tree, hf_btl2cap_cid, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- acl_data = (bthci_acl_data_t *)pinfo->private_data;
l2cap_data = wmem_new(wmem_packet_scope(), btl2cap_data_t);
l2cap_data->interface_id = (acl_data) ? acl_data->interface_id : HCI_INTERFACE_AMP;
@@ -1611,9 +1605,6 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
l2cap_data->remote_bd_addr_oui = (acl_data) ? acl_data->remote_bd_addr_oui : 0;
l2cap_data->remote_bd_addr_id = (acl_data) ? acl_data->remote_bd_addr_id : 0;
- pd_save = pinfo->private_data;
- pinfo->private_data = l2cap_data;
-
if (cid == BTL2CAP_FIXED_CID_SIGNAL || cid == BTL2CAP_FIXED_CID_LE_SIGNAL) {
/* This is a command packet*/
while (offset < (length + 4)) {
@@ -1651,27 +1642,27 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case 0x02: /* Connection Request */
- offset = dissect_connrequest(tvb, offset, pinfo, btl2cap_cmd_tree, FALSE);
+ offset = dissect_connrequest(tvb, offset, pinfo, btl2cap_cmd_tree, FALSE, acl_data, l2cap_data);
break;
case 0x03: /* Connection Response */
- offset = dissect_connresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
+ offset = dissect_connresponse(tvb, offset, pinfo, btl2cap_cmd_tree, acl_data);
break;
case 0x04: /* Configure Request */
- offset = dissect_configrequest(tvb, offset, pinfo, btl2cap_cmd_tree, cmd_length);
+ offset = dissect_configrequest(tvb, offset, pinfo, btl2cap_cmd_tree, cmd_length, acl_data);
break;
case 0x05: /* Configure Response */
- offset = dissect_configresponse(tvb, offset, pinfo, btl2cap_cmd_tree, cmd_length);
+ offset = dissect_configresponse(tvb, offset, pinfo, btl2cap_cmd_tree, cmd_length, acl_data);
break;
case 0x06: /* Disconnect Request */
- offset = dissect_disconnrequestresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
+ offset = dissect_disconnrequestresponse(tvb, offset, pinfo, btl2cap_cmd_tree, acl_data);
break;
case 0x07: /* Disconnect Response */
- offset = dissect_disconnrequestresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
+ offset = dissect_disconnrequestresponse(tvb, offset, pinfo, btl2cap_cmd_tree, acl_data);
break;
case 0x08: /* Echo Request */
@@ -1691,11 +1682,11 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case 0x0c: /* Create Channel Request */
- offset = dissect_connrequest(tvb, offset, pinfo, btl2cap_cmd_tree, TRUE);
+ offset = dissect_connrequest(tvb, offset, pinfo, btl2cap_cmd_tree, TRUE, acl_data, l2cap_data);
break;
case 0x0d: /* Create Channel Response */
- offset = dissect_chanresponse(tvb, offset, pinfo, btl2cap_cmd_tree);
+ offset = dissect_chanresponse(tvb, offset, pinfo, btl2cap_cmd_tree, acl_data);
break;
case 0x0e: /* Move Channel Request */
@@ -1740,13 +1731,13 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), length);
/* call next dissector */
- if (!dissector_try_uint(l2cap_psm_dissector_table, (guint32) psm, next_tvb, pinfo, tree)) {
+ if (!dissector_try_uint_new(l2cap_psm_dissector_table, (guint32) psm, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
/* not a known fixed PSM, try to find a registered service to a dynamic PSM */
guint16 uuid;
- uuid = get_service_uuid(pinfo, psm, (pinfo->p2p_dir == P2P_DIR_RECV) ? TRUE : FALSE );
+ uuid = get_service_uuid(pinfo, l2cap_data, psm, (pinfo->p2p_dir == P2P_DIR_RECV) ? TRUE : FALSE );
- if (!dissector_try_uint(l2cap_service_dissector_table, uuid, next_tvb, pinfo, tree)) {
+ if (!dissector_try_uint_new(l2cap_service_dissector_table, uuid, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
/* unknown protocol. declare as data */
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, ENC_NA);
}
@@ -1783,8 +1774,8 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), length);
}
/* call next dissector */
- if (next_tvb && !dissector_try_uint(l2cap_cid_dissector_table, (guint32) cid,
- next_tvb, pinfo, tree)) {
+ if (next_tvb && !dissector_try_uint_new(l2cap_cid_dissector_table, (guint32) cid,
+ next_tvb, pinfo, tree, TRUE, l2cap_data)) {
/* unknown protocol. declare as data */
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, ENC_NA);
}
@@ -1854,21 +1845,22 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
else
config_data = &(psm_data->out);
if (config_data->mode == 0) {
- dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, cid, psm, psm_data->local_service, length, offset);
+ dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, cid, psm, psm_data->local_service, length, offset, l2cap_data);
} else {
control = tvb_get_letohs(tvb, offset);
if (control & 0x1) {
dissect_s_frame(tvb, pinfo, tree, btl2cap_tree, psm, length, offset, config_data);
} else {
- dissect_i_frame(tvb, pinfo, tree, btl2cap_tree, psm_data, length, offset, config_data);
+ dissect_i_frame(tvb, pinfo, tree, btl2cap_tree, psm_data, length, offset, config_data, l2cap_data);
}
}
} else {
psm = 0;
- dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, cid, psm, FALSE, length, offset);
+ dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, cid, psm, FALSE, length, offset, l2cap_data);
}
}
- pinfo->private_data = pd_save;
+
+ return offset;
}
@@ -2333,7 +2325,7 @@ proto_register_btl2cap(void)
/* Register the protocol name and description */
proto_btl2cap = proto_register_protocol("Bluetooth L2CAP Protocol", "BT L2CAP", "btl2cap");
- register_dissector("btl2cap", dissect_btl2cap, proto_btl2cap);
+ new_register_dissector("btl2cap", dissect_btl2cap, proto_btl2cap);
/* subdissector code */
l2cap_psm_dissector_table = register_dissector_table("btl2cap.psm", "L2CAP PSM", FT_UINT16, BASE_HEX);
diff --git a/epan/dissectors/packet-btl2cap.h b/epan/dissectors/packet-btl2cap.h
index 5837eb47d3..533902a7be 100644
--- a/epan/dissectors/packet-btl2cap.h
+++ b/epan/dissectors/packet-btl2cap.h
@@ -51,10 +51,6 @@
#define BTL2CAP_FIXED_CID_AMP_TEST 0x003F
#define BTL2CAP_FIXED_CID_MAX 0x0040
-/* This structure is passed to higher layer protocols through
- * pinfo->private_data so that they can track "conversations" based on
- * chandle, cid and direction
- */
typedef struct _btl2cap_data_t {
guint32 interface_id;
guint32 adapter_id;
diff --git a/epan/dissectors/packet-btmcap.c b/epan/dissectors/packet-btmcap.c
index 041d571bdc..14a552b90e 100644
--- a/epan/dissectors/packet-btmcap.c
+++ b/epan/dissectors/packet-btmcap.c
@@ -98,8 +98,8 @@ static const value_string response_code_vals[] = {
void proto_register_btmcap(void);
void proto_reg_handoff_btmcap(void);
-static void
-dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *main_item;
proto_tree *main_tree;
@@ -112,6 +112,9 @@ dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 bluetooth_clock_sync_time;
guint64 timestamp_sync_time;
+ main_item = proto_tree_add_item(tree, proto_btmcap, tvb, offset, -1, ENC_NA);
+ main_tree = proto_item_add_subtree(main_item, ett_btmcap);
+
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MCAP");
switch (pinfo->p2p_dir) {
@@ -127,9 +130,6 @@ dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
- main_item = proto_tree_add_item(tree, proto_btmcap, tvb, offset, -1, ENC_NA);
- main_tree = proto_item_add_subtree(main_item, ett_btmcap);
-
pitem = proto_tree_add_item(main_tree, hf_btmcap_op_code, tvb, offset, 1, ENC_BIG_ENDIAN);
op_code = tvb_get_guint8(tvb, offset);
offset += 1;
@@ -311,7 +311,10 @@ dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tvb_length_remaining(tvb, offset)) {
pitem = proto_tree_add_item(main_tree, hf_btmcap_data, tvb, offset, -1, ENC_NA);
expert_add_info(pinfo, pitem, &ei_btmcap_unexpected_data);
+ offset = tvb_length(tvb);
}
+
+ return offset;
}
@@ -417,7 +420,7 @@ proto_register_btmcap(void)
};
proto_btmcap = proto_register_protocol("Bluetooth MCAP Protocol", "BT MCAP", "btmcap");
- register_dissector("btmcap", dissect_btmcap, proto_btmcap);
+ new_register_dissector("btmcap", dissect_btmcap, proto_btmcap);
proto_register_field_array(proto_btmcap, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-btobex.c b/epan/dissectors/packet-btobex.c
index ba1c400de1..db55218199 100644
--- a/epan/dissectors/packet-btobex.c
+++ b/epan/dissectors/packet-btobex.c
@@ -1048,7 +1048,7 @@ dissect_map_application_parameters(tvbuff_t *tvb, packet_info *pinfo,
static int
dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
- gint profile, gboolean is_obex_over_l2cap)
+ gint profile, gboolean is_obex_over_l2cap, void *data)
{
proto_tree *hdrs_tree = NULL;
proto_tree *hdr_tree = NULL;
@@ -1170,7 +1170,7 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
if (is_obex_over_l2cap) {
btl2cap_data_t *l2cap_data;
- l2cap_data = (btl2cap_data_t *)pinfo->private_data;
+ l2cap_data = (btl2cap_data_t *) data;
interface_id = l2cap_data->interface_id;
adapter_id = l2cap_data->adapter_id;
chandle = l2cap_data->chandle;
@@ -1178,7 +1178,7 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
} else {
btrfcomm_data_t *rfcomm_data;
- rfcomm_data = (btrfcomm_data_t *)pinfo->private_data;
+ rfcomm_data = (btrfcomm_data_t *) data;
interface_id = rfcomm_data->interface_id;
adapter_id = rfcomm_data->adapter_id;
chandle = rfcomm_data->chandle;
@@ -1250,15 +1250,15 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
return offset;
}
-static void
-dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
fragment_head *frag_msg = NULL;
gboolean save_fragmented, complete;
tvbuff_t* new_tvb = NULL;
tvbuff_t* next_tvb = NULL;
guint32 no_of_segments = 0;
- int offset = 0;
+ gint offset = 0;
gint profile = PROFILE_UNKNOWN;
gint response_opcode = -1;
gboolean is_obex_over_l2cap = FALSE;
@@ -1287,7 +1287,9 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (is_obex_over_l2cap) {
btl2cap_data_t *l2cap_data;
- l2cap_data = (btl2cap_data_t *)pinfo->private_data;
+ l2cap_data = (btl2cap_data_t *) data;
+ DISSECTOR_ASSERT(l2cap_data);
+
interface_id = l2cap_data->interface_id;
adapter_id = l2cap_data->adapter_id;
chandle = l2cap_data->chandle;
@@ -1295,7 +1297,9 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} else {
btrfcomm_data_t *rfcomm_data;
- rfcomm_data = (btrfcomm_data_t *)pinfo->private_data;
+ rfcomm_data = (btrfcomm_data_t *) data;
+ DISSECTOR_ASSERT(rfcomm_data);
+
interface_id = rfcomm_data->interface_id;
adapter_id = rfcomm_data->adapter_id;
chandle = rfcomm_data->chandle;
@@ -1420,7 +1424,7 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (is_obex_over_l2cap) {
btl2cap_data_t *l2cap_data;
- l2cap_data = (btl2cap_data_t *)pinfo->private_data;
+ l2cap_data = (btl2cap_data_t *) data;
interface_id = l2cap_data->interface_id;
adapter_id = l2cap_data->adapter_id;
chandle = l2cap_data->chandle;
@@ -1428,7 +1432,7 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} else {
btrfcomm_data_t *rfcomm_data;
- rfcomm_data = (btrfcomm_data_t *)pinfo->private_data;
+ rfcomm_data = (btrfcomm_data_t *) data;
interface_id = rfcomm_data->interface_id;
adapter_id = rfcomm_data->adapter_id;
chandle = rfcomm_data->chandle;
@@ -1514,7 +1518,7 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (is_obex_over_l2cap) {
btl2cap_data_t *l2cap_data;
- l2cap_data = (btl2cap_data_t *)pinfo->private_data;
+ l2cap_data = (btl2cap_data_t *) data;
interface_id = l2cap_data->interface_id;
adapter_id = l2cap_data->adapter_id;
chandle = l2cap_data->chandle;
@@ -1522,7 +1526,7 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} else {
btrfcomm_data_t *rfcomm_data;
- rfcomm_data = (btrfcomm_data_t *)pinfo->private_data;
+ rfcomm_data = (btrfcomm_data_t *) data;
interface_id = rfcomm_data->interface_id;
adapter_id = rfcomm_data->adapter_id;
chandle = rfcomm_data->chandle;
@@ -1573,7 +1577,7 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
- dissect_headers(st, next_tvb, offset, pinfo, profile, is_obex_over_l2cap);
+ dissect_headers(st, next_tvb, offset, pinfo, profile, is_obex_over_l2cap, data);
} else {
/* packet fragment */
col_add_fstr(pinfo->cinfo, COL_INFO, "%s Obex fragment",
@@ -1583,6 +1587,8 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
pinfo->fragmented = save_fragmented;
+
+ return offset;
}
@@ -2318,7 +2324,7 @@ proto_register_btobex(void)
proto_btobex = proto_register_protocol("Bluetooth OBEX Protocol", "BT OBEX", "btobex");
- register_dissector("btobex", dissect_btobex, proto_btobex);
+ new_register_dissector("btobex", dissect_btobex, proto_btobex);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_btobex, hf, array_length(hf));
diff --git a/epan/dissectors/packet-btrfcomm.c b/epan/dissectors/packet-btrfcomm.c
index a32b0d0701..bdd90d5e57 100644
--- a/epan/dissectors/packet-btrfcomm.c
+++ b/epan/dissectors/packet-btrfcomm.c
@@ -540,18 +540,13 @@ dissect_btrfcomm_MccType(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 *mc
return offset;
}
-/* This dissector is only called from L2CAP.
- * This dissector REQUIRES that pinfo->private_data points to a valid structure
- * since it needs this (future) to track which flow a fragment belongs to
- * in order to do reassembly of ppp streams.
- */
-static void
-dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_item *ti;
proto_tree *rfcomm_tree;
- int offset = 0;
- int fcs_offset;
+ gint offset = 0;
+ gint fcs_offset;
guint8 dlci, cr_flag, ea_flag;
guint8 frame_type, pf_flag;
guint16 frame_len;
@@ -563,8 +558,6 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RFCOMM");
- l2cap_data = (btl2cap_data_t *) pinfo->private_data;
-
switch (pinfo->p2p_dir) {
case P2P_DIR_SENT:
col_set_str(pinfo->cinfo, COL_INFO, "Sent ");
@@ -578,6 +571,9 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
+ l2cap_data = (btl2cap_data_t *) data;
+ DISSECTOR_ASSERT(l2cap_data);
+
/* flags and dlci */
offset = dissect_btrfcomm_address(tvb, offset, rfcomm_tree, &ea_flag, &cr_flag, &dlci);
/* pf and frame type */
@@ -694,7 +690,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (length > (guint32) tvb_length_remaining(tvb, offset)) {
expert_add_info_format(pinfo, ctrl_tree, &ei_btrfcomm_mcc_length_bad, "Huge MCC length: %u", length);
- return;
+ return offset;
}
switch(mcc_type) {
@@ -756,15 +752,14 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
rfcomm_data->dlci = dlci;
rfcomm_data->remote_bd_addr_oui = l2cap_data->remote_bd_addr_oui;
rfcomm_data->remote_bd_addr_id = l2cap_data->remote_bd_addr_id;
- pinfo->private_data = rfcomm_data;
- if (!dissector_try_uint(rfcomm_channel_dissector_table, (guint32) dlci >> 1,
- next_tvb, pinfo, tree)) {
- if (!dissector_try_uint(rfcomm_service_dissector_table, service_info->uuid.bt_uuid,
- next_tvb, pinfo, tree)) {
+ if (!dissector_try_uint_new(rfcomm_channel_dissector_table, (guint32) dlci >> 1,
+ next_tvb, pinfo, tree, TRUE, rfcomm_data)) {
+ if (!dissector_try_uint_new(rfcomm_service_dissector_table, service_info->uuid.bt_uuid,
+ next_tvb, pinfo, tree, TRUE, rfcomm_data)) {
decode_by_dissector = find_proto_by_channel(dlci >> 1);
if (rfcomm_channels_enabled && decode_by_dissector) {
- call_dissector(decode_by_dissector, next_tvb, pinfo, tree);
+ call_dissector_with_data(decode_by_dissector, next_tvb, pinfo, tree, rfcomm_data);
} else {
/* unknown service, let the data dissector handle it */
call_dissector(data_handle, next_tvb, pinfo, tree);
@@ -774,6 +769,9 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
proto_tree_add_item(rfcomm_tree, hf_fcs, tvb, fcs_offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+
+ return offset;
}
void
@@ -1016,7 +1014,7 @@ proto_register_btrfcomm(void)
/* Register the protocol name and description */
proto_btrfcomm = proto_register_protocol("Bluetooth RFCOMM Protocol", "BT RFCOMM", "btrfcomm");
- register_dissector("btrfcomm", dissect_btrfcomm, proto_btrfcomm);
+ new_register_dissector("btrfcomm", dissect_btrfcomm, proto_btrfcomm);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_btrfcomm, hf, array_length(hf));
@@ -1086,8 +1084,8 @@ proto_reg_handoff_btrfcomm(void)
}
/* Bluetooth Dial-Up Networking (DUN) profile dissection */
-static void
-dissect_btdun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btdun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *ti;
proto_tree *st;
@@ -1127,6 +1125,8 @@ dissect_btdun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector(data_handle, tvb, pinfo, tree);
}
}
+
+ return length;
}
void
@@ -1146,7 +1146,7 @@ proto_register_btdun(void)
};
proto_btdun = proto_register_protocol("Bluetooth DUN Packet", "BT DUN", "btdun");
- register_dissector("btdun", dissect_btdun, proto_btdun);
+ new_register_dissector("btdun", dissect_btdun, proto_btdun);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_btdun, hf, array_length(hf));
@@ -1167,8 +1167,8 @@ proto_reg_handoff_btdun(void)
}
/* Bluetooth Serial Port profile (SPP) dissection */
-static void
-dissect_btspp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btspp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *ti;
proto_tree *st;
@@ -1194,6 +1194,8 @@ dissect_btspp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
proto_tree_add_item(st, hf_spp_data, tvb, 0, -1, ENC_NA);
+
+ return tvb_length(tvb);
}
void
@@ -1213,7 +1215,7 @@ proto_register_btspp(void)
};
proto_btspp = proto_register_protocol("Bluetooth SPP Packet", "BT SPP", "btspp");
- register_dissector("btspp", dissect_btspp, proto_btspp);
+ new_register_dissector("btspp", dissect_btspp, proto_btspp);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_btspp, hf, array_length(hf));
@@ -1233,8 +1235,8 @@ proto_reg_handoff_btspp(void)
/* Bluetooth Global Navigation Satellite System profile (GNSS) dissection */
-static void
-dissect_btgnss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btgnss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *main_item;
proto_tree *main_tree;
@@ -1250,6 +1252,8 @@ dissect_btgnss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* GNSS using NMEA-0183 protocol, but it is not available */
proto_tree_add_item(main_tree, hf_gnss_data, tvb, 0, -1, ENC_NA | ENC_ASCII);
+
+ return tvb_length(tvb);
}
void
@@ -1268,7 +1272,7 @@ proto_register_btgnss(void)
};
proto_btgnss = proto_register_protocol("Bluetooth GNSS Profile", "BT GNSS", "btgnss");
- register_dissector("btgnss", dissect_btgnss, proto_btgnss);
+ new_register_dissector("btgnss", dissect_btgnss, proto_btgnss);
proto_register_field_array(proto_btgnss, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-btrfcomm.h b/epan/dissectors/packet-btrfcomm.h
index bc113e86f4..986c0d1eb2 100644
--- a/epan/dissectors/packet-btrfcomm.h
+++ b/epan/dissectors/packet-btrfcomm.h
@@ -24,10 +24,6 @@
#ifndef __PACKET_BTRFCOMM_H__
#define __PACKET_BTRFCOMM_H__
-/* This structure is passed to higher layer protocols through
- * pinfo->private_data so that they can track "conversations" based on
- * chandle, cid, dlci and direction
- */
typedef struct _btrfcomm_data_t {
guint32 interface_id;
guint32 adapter_id;
diff --git a/epan/dissectors/packet-btsap.c b/epan/dissectors/packet-btsap.c
index 5f554427ea..f553b8b0e1 100644
--- a/epan/dissectors/packet-btsap.c
+++ b/epan/dissectors/packet-btsap.c
@@ -82,6 +82,7 @@ static gint ett_btsap = -1;
static gint ett_btsap_parameter = -1;
static expert_field ei_btsap_parameter_error = EI_INIT;
+static expert_field ei_unexpected_data = EI_INIT;
static gint top_dissect = TOP_DISSECT_INTERNAL;
@@ -382,8 +383,8 @@ dissect_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree,
return offset;
}
-static void
-dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *ti;
proto_tree *btsap_tree;
@@ -397,6 +398,8 @@ dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint i_parameter;
guint i_next_parameter;
+ ti = proto_tree_add_item(tree, proto_btsap, tvb, offset, -1, ENC_NA);
+ btsap_tree = proto_item_add_subtree(ti, ett_btsap);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SAP");
@@ -413,9 +416,6 @@ dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
- ti = proto_tree_add_item(tree, proto_btsap, tvb, offset, -1, ENC_NA);
- btsap_tree = proto_item_add_subtree(ti, ett_btsap);
-
proto_tree_add_item(btsap_tree, hf_btsap_header_msg_id, tvb, offset, 1, ENC_BIG_ENDIAN);
msg_id = tvb_get_guint8(tvb, offset);
col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(msg_id, msg_id_vals, "Unknown MsgID"));
@@ -579,9 +579,10 @@ dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb, offset, 0, "Too many parameters");
}
- if (tvb_length(tvb) > offset) {
- proto_tree_add_item(btsap_tree, hf_btsap_data, tvb, offset, -1, ENC_NA);
- }
+ if (tvb_length(tvb) > offset)
+ proto_tree_add_expert(tree, pinfo, &ei_unexpected_data, tvb, offset, -1);
+
+ return offset;
}
@@ -708,10 +709,11 @@ proto_register_btsap(void)
static ei_register_info ei[] = {
{ &ei_btsap_parameter_error, { "btsap.parameter_error", PI_PROTOCOL, PI_WARN, "Parameter error", EXPFILL }},
+ { &ei_unexpected_data, { "btsap.unexpected_data", PI_PROTOCOL, PI_WARN, "Unexpected_data", EXPFILL }},
};
proto_btsap = proto_register_protocol("Bluetooth SAP Profile", "BT SAP", "btsap");
- register_dissector("btsap", dissect_btsap, proto_btsap);
+ new_register_dissector("btsap", dissect_btsap, proto_btsap);
proto_register_field_array(proto_btsap, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-btsdp.c b/epan/dissectors/packet-btsdp.c
index cc4bd073e5..c49f6eff32 100644
--- a/epan/dissectors/packet-btsdp.c
+++ b/epan/dissectors/packet-btsdp.c
@@ -1013,9 +1013,8 @@ print_uuid(uuid_t *uuid)
static wmem_array_t *
-get_uuids(packet_info *pinfo, guint32 record_handle)
+get_uuids(packet_info *pinfo, guint32 record_handle, btl2cap_data_t *l2cap_data)
{
- btl2cap_data_t *l2cap_data;
record_handle_service_t *record_handle_service;
wmem_tree_key_t key[7];
guint32 k_interface_id;
@@ -1030,8 +1029,6 @@ get_uuids(packet_info *pinfo, guint32 record_handle)
guint32 psm;
guint32 frame_number;
- l2cap_data = (btl2cap_data_t *) pinfo->private_data;
-
interface_id = l2cap_data->interface_id;
adapter_id = l2cap_data->adapter_id;
chandle = l2cap_data->chandle;
@@ -1318,10 +1315,10 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo,
gint offset, guint tid, gboolean is_request,
gint attribute_list_byte_offset, gint attribute_list_byte_count,
guint32 pdu_type, tvbuff_t **new_tvb, gboolean *is_first,
- gboolean *is_continued, wmem_array_t **uuid_array, guint32 *record_handle)
+ gboolean *is_continued, wmem_array_t **uuid_array,
+ guint32 *record_handle, btl2cap_data_t *l2cap_data)
{
guint length;
- btl2cap_data_t *l2cap_data;
tid_request_t *tid_request;
continuation_state_data_t *continuation_state_data;
wmem_tree_key_t key[12];
@@ -1340,7 +1337,6 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo,
guint32 frame_number;
guint32 *continuation_state_array;
- l2cap_data = (btl2cap_data_t *) pinfo->private_data;
if (new_tvb) *new_tvb = NULL;
interface_id = l2cap_data->interface_id;
@@ -3653,7 +3649,7 @@ dissect_sdp_error_response(proto_tree *tree, tvbuff_t *tvb, gint offset)
static gint
dissect_sdp_service_attribute_list(proto_tree *tree, tvbuff_t *tvb, gint offset,
- packet_info *pinfo, uuid_t *service_uuid)
+ packet_info *pinfo, uuid_t *service_uuid, btl2cap_data_t *l2cap_data)
{
proto_item *list_item;
proto_tree *list_tree;
@@ -3679,13 +3675,10 @@ dissect_sdp_service_attribute_list(proto_tree *tree, tvbuff_t *tvb, gint offset,
guint32 k_service_channel;
guint32 k_frame_number;
service_info_t *service_info;
- btl2cap_data_t *l2cap_data;
wmem_array_t *uuid_array;
uuid_array = wmem_array_new(wmem_packet_scope(), sizeof(uuid_t));
- l2cap_data = (btl2cap_data_t *) pinfo->private_data;
-
offset = get_type_length(tvb, offset, &len);
memset(&uuid, 0, sizeof(uuid_t));
@@ -3804,7 +3797,7 @@ dissect_sdp_service_attribute_list(proto_tree *tree, tvbuff_t *tvb, gint offset,
static gint
dissect_sdp_service_attribute_list_array(proto_tree *tree, tvbuff_t *tvb,
gint offset, packet_info *pinfo, gint attribute_list_byte_count,
- uuid_t *service_uuid)
+ uuid_t *service_uuid, btl2cap_data_t *l2cap_data)
{
proto_item *lists_item;
proto_tree *lists_tree;
@@ -3828,7 +3821,7 @@ dissect_sdp_service_attribute_list_array(proto_tree *tree, tvbuff_t *tvb,
number_of_attributes += 1;
offset = dissect_sdp_service_attribute_list(next_tree, tvb, offset,
- pinfo, service_uuid);
+ pinfo, service_uuid, l2cap_data);
}
proto_item_append_text(lists_tree, " [count = %2u]", number_of_attributes);
@@ -3839,7 +3832,7 @@ dissect_sdp_service_attribute_list_array(proto_tree *tree, tvbuff_t *tvb,
static gint
dissect_sdp_service_search_request(proto_tree *tree, tvbuff_t *tvb, gint offset,
- packet_info *pinfo, guint16 tid)
+ packet_info *pinfo, guint16 tid, btl2cap_data_t *l2cap_data)
{
gint start_offset;
gint bytes_to_go;
@@ -3889,7 +3882,7 @@ dissect_sdp_service_search_request(proto_tree *tree, tvbuff_t *tvb, gint offset,
offset += 2;
reassemble_continuation_state(tvb, pinfo, offset, tid, TRUE,
- 0, 0, PDU_TYPE_SERVICE_SEARCH, NULL, NULL, NULL, &uuid_array, NULL);
+ 0, 0, PDU_TYPE_SERVICE_SEARCH, NULL, NULL, NULL, &uuid_array, NULL, l2cap_data);
offset = dissect_continuation_state(tvb, tree, pinfo, offset);
@@ -3899,7 +3892,7 @@ dissect_sdp_service_search_request(proto_tree *tree, tvbuff_t *tvb, gint offset,
static gint
dissect_sdp_service_search_response(proto_tree *tree, tvbuff_t *tvb,
- gint offset, packet_info *pinfo, guint16 tid)
+ gint offset, packet_info *pinfo, guint16 tid, btl2cap_data_t *l2cap_data)
{
proto_tree *st;
proto_item *ti;
@@ -3941,13 +3934,12 @@ dissect_sdp_service_search_response(proto_tree *tree, tvbuff_t *tvb,
reassemble_continuation_state(tvb, pinfo, offset, tid, FALSE,
offset - current_count * 4, current_count * 4, PDU_TYPE_SERVICE_SEARCH,
- &new_tvb, &is_first, &is_continued, &uuid_array, NULL);
+ &new_tvb, &is_first, &is_continued, &uuid_array, NULL, l2cap_data);
if (is_continued)
col_append_str(pinfo->cinfo, COL_INFO, "(fragment)");
if (!pinfo->fd->flags.visited) {
- btl2cap_data_t *l2cap_data;
record_handle_service_t *record_handle_service;
wmem_tree_key_t key[7];
guint32 k_interface_id;
@@ -3963,8 +3955,6 @@ dissect_sdp_service_search_response(proto_tree *tree, tvbuff_t *tvb,
guint32 record_handle;
guint32 frame_number;
- l2cap_data = (btl2cap_data_t *) pinfo->private_data;
-
interface_id = l2cap_data->interface_id;
adapter_id = l2cap_data->adapter_id;
chandle = l2cap_data->chandle;
@@ -4039,7 +4029,7 @@ dissect_sdp_service_search_response(proto_tree *tree, tvbuff_t *tvb,
static gint
dissect_sdp_service_attribute_request(proto_tree *tree, tvbuff_t *tvb,
- gint offset, packet_info *pinfo, guint16 tid)
+ gint offset, packet_info *pinfo, guint16 tid, btl2cap_data_t *l2cap_data)
{
guint32 record_handle;
wmem_array_t *uuid_array;
@@ -4053,13 +4043,13 @@ dissect_sdp_service_attribute_request(proto_tree *tree, tvbuff_t *tvb,
proto_tree_add_item(tree, hf_maximum_attribute_byte_count, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
- uuid_array = get_uuids(pinfo, record_handle);
+ uuid_array = get_uuids(pinfo, record_handle, l2cap_data);
uuid = get_most_specified_uuid(uuid_array);
offset += dissect_attribute_id_list(tree, tvb, offset, pinfo, &uuid);
reassemble_continuation_state(tvb, pinfo, offset, tid, TRUE,
- 0, 0, PDU_TYPE_SERVICE_ATTRIBUTE, NULL, NULL, NULL, NULL, &record_handle);
+ 0, 0, PDU_TYPE_SERVICE_ATTRIBUTE, NULL, NULL, NULL, NULL, &record_handle, l2cap_data);
offset = dissect_continuation_state(tvb, tree, pinfo, offset);
@@ -4069,7 +4059,7 @@ dissect_sdp_service_attribute_request(proto_tree *tree, tvbuff_t *tvb,
static gint
dissect_sdp_service_attribute_response(proto_tree *tree, tvbuff_t *tvb,
- gint offset, packet_info *pinfo, guint16 tid)
+ gint offset, packet_info *pinfo, guint16 tid, btl2cap_data_t *l2cap_data)
{
gint attribute_list_byte_count;
gboolean is_first;
@@ -4086,19 +4076,19 @@ dissect_sdp_service_attribute_response(proto_tree *tree, tvbuff_t *tvb,
offset + attribute_list_byte_count, tid, FALSE,
offset, attribute_list_byte_count,
PDU_TYPE_SERVICE_ATTRIBUTE, &new_tvb, &is_first,
- &is_continued, NULL, &record_handle);
+ &is_continued, NULL, &record_handle, l2cap_data);
if (!is_continued) {
wmem_array_t *uuid_array;
- uuid_array = get_uuids(pinfo, record_handle);
+ uuid_array = get_uuids(pinfo, record_handle, l2cap_data);
uuid = get_most_specified_uuid(uuid_array);
} else {
memset(&uuid, 0, sizeof(uuid_t));
}
if (is_first && !is_continued) {
- dissect_sdp_service_attribute_list(tree, tvb, offset, pinfo, &uuid);
+ dissect_sdp_service_attribute_list(tree, tvb, offset, pinfo, &uuid, l2cap_data);
} else {
proto_tree_add_item(tree, hf_fragment, tvb, offset,
attribute_list_byte_count, ENC_NA);
@@ -4123,7 +4113,7 @@ dissect_sdp_service_attribute_response(proto_tree *tree, tvbuff_t *tvb,
if (!is_continued) {
dissect_sdp_service_attribute_list(reassembled_tree, new_tvb, 0,
- pinfo, &uuid);
+ pinfo, &uuid, l2cap_data);
}
}
@@ -4133,7 +4123,7 @@ dissect_sdp_service_attribute_response(proto_tree *tree, tvbuff_t *tvb,
static gint
dissect_sdp_service_search_attribute_request(proto_tree *tree, tvbuff_t *tvb,
- gint offset, packet_info *pinfo, guint16 tid)
+ gint offset, packet_info *pinfo, guint16 tid, btl2cap_data_t *l2cap_data)
{
proto_tree *ptree;
proto_item *pitem;
@@ -4190,7 +4180,7 @@ dissect_sdp_service_search_attribute_request(proto_tree *tree, tvbuff_t *tvb,
offset += dissect_attribute_id_list(tree, tvb, offset, pinfo, &uuid);
reassemble_continuation_state(tvb, pinfo, offset, tid, TRUE,
- 0, 0, PDU_TYPE_SERVICE_SEARCH_ATTRIBUTE, NULL, NULL, NULL, &uuid_array, NULL);
+ 0, 0, PDU_TYPE_SERVICE_SEARCH_ATTRIBUTE, NULL, NULL, NULL, &uuid_array, NULL, l2cap_data);
offset = dissect_continuation_state(tvb, tree, pinfo, offset);
@@ -4200,7 +4190,7 @@ dissect_sdp_service_search_attribute_request(proto_tree *tree, tvbuff_t *tvb,
static gint
dissect_sdp_service_search_attribute_response(proto_tree *tree, tvbuff_t *tvb,
- gint offset, packet_info *pinfo, guint16 tid)
+ gint offset, packet_info *pinfo, guint16 tid, btl2cap_data_t *l2cap_data)
{
gint attribute_list_byte_count;
gboolean is_first;
@@ -4217,13 +4207,13 @@ dissect_sdp_service_search_attribute_response(proto_tree *tree, tvbuff_t *tvb,
offset + attribute_list_byte_count, tid, FALSE,
offset, attribute_list_byte_count,
PDU_TYPE_SERVICE_SEARCH_ATTRIBUTE, &new_tvb, &is_first,
- &is_continued, &uuid_array, NULL);
+ &is_continued, &uuid_array, NULL, l2cap_data);
uuid = get_most_specified_uuid(uuid_array);;
if (is_first && !is_continued) {
dissect_sdp_service_attribute_list_array(tree, tvb, offset, pinfo,
- attribute_list_byte_count, &uuid);
+ attribute_list_byte_count, &uuid, l2cap_data);
} else {
proto_tree_add_item(tree, hf_fragment, tvb, offset,
attribute_list_byte_count, ENC_NA);
@@ -4248,7 +4238,7 @@ dissect_sdp_service_search_attribute_response(proto_tree *tree, tvbuff_t *tvb,
if (!is_continued)
dissect_sdp_service_attribute_list_array(reassembled_tree, new_tvb, 0,
- pinfo, tvb_length(new_tvb), &uuid);
+ pinfo, tvb_length(new_tvb), &uuid, l2cap_data);
}
return offset;
@@ -4256,19 +4246,23 @@ dissect_sdp_service_search_attribute_response(proto_tree *tree, tvbuff_t *tvb,
static gint
-dissect_btsdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_btsdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_item *ti;
proto_tree *st;
gint offset = 0;
guint8 pdu_id;
guint16 tid;
-
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "SDP");
+ btl2cap_data_t *l2cap_data;
ti = proto_tree_add_item(tree, proto_btsdp, tvb, 0, -1, ENC_NA);
st = proto_item_add_subtree(ti, ett_btsdp);
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "SDP");
+
+ l2cap_data = (btl2cap_data_t *) data;
+ DISSECTOR_ASSERT(l2cap_data);
+
tap_queue_packet(btsdp_tap, NULL, (void *) &sdp_package);
switch (pinfo->p2p_dir) {
@@ -4303,22 +4297,22 @@ dissect_btsdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
offset = dissect_sdp_error_response(st, tvb, offset);
break;
case 0x02:
- offset = dissect_sdp_service_search_request(st, tvb, offset, pinfo, tid);
+ offset = dissect_sdp_service_search_request(st, tvb, offset, pinfo, tid, l2cap_data);
break;
case 0x03:
- offset = dissect_sdp_service_search_response(st, tvb, offset, pinfo, tid);
+ offset = dissect_sdp_service_search_response(st, tvb, offset, pinfo, tid, l2cap_data);
break;
case 0x04:
- offset = dissect_sdp_service_attribute_request(st, tvb, offset, pinfo, tid);
+ offset = dissect_sdp_service_attribute_request(st, tvb, offset, pinfo, tid, l2cap_data);
break;
case 0x05:
- offset = dissect_sdp_service_attribute_response(st, tvb, offset, pinfo, tid);
+ offset = dissect_sdp_service_attribute_response(st, tvb, offset, pinfo, tid, l2cap_data);
break;
case 0x06:
- offset = dissect_sdp_service_search_attribute_request(st, tvb, offset, pinfo, tid);
+ offset = dissect_sdp_service_search_attribute_request(st, tvb, offset, pinfo, tid, l2cap_data);
break;
case 0x07:
- offset = dissect_sdp_service_search_attribute_response(st, tvb, offset, pinfo, tid);
+ offset = dissect_sdp_service_search_attribute_response(st, tvb, offset, pinfo, tid, l2cap_data);
break;
}
diff --git a/epan/dissectors/packet-btsmp.c b/epan/dissectors/packet-btsmp.c
index 584f8d46b7..1acd6a6522 100644
--- a/epan/dissectors/packet-btsmp.c
+++ b/epan/dissectors/packet-btsmp.c
@@ -184,6 +184,9 @@ dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
proto_tree *st;
guint8 opcode;
+ ti = proto_tree_add_item(tree, proto_btsmp, tvb, 0, -1, ENC_NA);
+ st = proto_item_add_subtree(ti, ett_btsmp);
+
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMP");
switch (pinfo->p2p_dir) {
@@ -202,9 +205,6 @@ dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
if (tvb_length_remaining(tvb, 0) < 1)
return FALSE;
- ti = proto_tree_add_item(tree, proto_btsmp, tvb, 0, -1, ENC_NA);
- st = proto_item_add_subtree(ti, ett_btsmp);
-
proto_tree_add_item(st, hf_btsmp_opcode, tvb, 0, 1, ENC_LITTLE_ENDIAN);
opcode = tvb_get_guint8(tvb, 0);
offset++;
diff --git a/epan/dissectors/packet-hci_h1.c b/epan/dissectors/packet-hci_h1.c
index 49a25816ae..f0200b7261 100644
--- a/epan/dissectors/packet-hci_h1.c
+++ b/epan/dissectors/packet-hci_h1.c
@@ -60,14 +60,13 @@ static const value_string hci_h1_direction_vals[] = {
void proto_register_hci_h1(void);
void proto_reg_handoff_hci_h1(void);
-static void
-dissect_hci_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_hci_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
guint8 type;
tvbuff_t *next_tvb;
proto_item *ti = NULL;
proto_tree *hci_h1_tree = NULL;
- void *pd_save;
hci_data_t *hci_data;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCI");
@@ -107,25 +106,23 @@ dissect_hci_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
val_to_str(type, hci_h1_type_vals,
"Unknown 0x%02x"));
- pd_save = pinfo->private_data;
- hci_data = wmem_new(wmem_packet_scope(),hci_data_t);
+ hci_data = wmem_new(wmem_packet_scope(), hci_data_t);
hci_data->interface_id = HCI_INTERFACE_H4;
hci_data->adapter_id = HCI_ADAPTER_DEFAULT;
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->private_data = hci_data;
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(hci_h1_table, type, next_tvb, pinfo, tree)) {
+ if (!dissector_try_uint_new(hci_h1_table, type, next_tvb, pinfo, tree, TRUE, hci_data)) {
call_dissector(data_handle, next_tvb, pinfo, tree);
}
- pinfo->private_data = pd_save;
+ return tvb_length(tvb);
}
@@ -147,7 +144,7 @@ proto_register_hci_h1(void)
proto_hci_h1 = proto_register_protocol("Bluetooth HCI H1",
"HCI_H1", "hci_h1");
- register_dissector("hci_h1", dissect_hci_h1, proto_hci_h1);
+ new_register_dissector("hci_h1", dissect_hci_h1, proto_hci_h1);
proto_register_field_array(proto_hci_h1, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-hci_h4.c b/epan/dissectors/packet-hci_h4.c
index 125174f4cb..655a8f9ecb 100644
--- a/epan/dissectors/packet-hci_h4.c
+++ b/epan/dissectors/packet-hci_h4.c
@@ -66,14 +66,13 @@ static const value_string hci_h4_direction_vals[] = {
void proto_register_hci_h4(void);
void proto_reg_handoff_hci_h4(void);
-static void
-dissect_hci_h4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint
+dissect_hci_h4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
guint8 type;
tvbuff_t *next_tvb;
proto_item *ti = NULL;
proto_tree *hci_h4_tree = NULL;
- void *pd_save;
hci_data_t *hci_data;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCI H4");
@@ -103,7 +102,6 @@ dissect_hci_h4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
hci_h4_tree = proto_item_add_subtree(ti, ett_hci_h4);
}
- pd_save = pinfo->private_data;
hci_data = (hci_data_t *) wmem_new(wmem_packet_scope(), hci_data_t);
hci_data->interface_id = HCI_INTERFACE_H4;
hci_data->adapter_id = HCI_ADAPTER_DEFAULT;
@@ -111,7 +109,6 @@ dissect_hci_h4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
hci_data->bdaddr_to_name_table = bdaddr_to_name_table;
hci_data->localhost_bdaddr = localhost_bdaddr;
hci_data->localhost_name = localhost_name;
- pinfo->private_data = hci_data;
ti = proto_tree_add_uint(hci_h4_tree, hf_hci_h4_direction, tvb, 0, 0, pinfo->p2p_dir);
PROTO_ITEM_SET_GENERATED(ti);
@@ -122,11 +119,11 @@ dissect_hci_h4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
val_to_str(type, hci_h4_type_vals, "Unknown HCI packet type 0x%02x"));
next_tvb = tvb_new_subset_remaining(tvb, 1);
- if (!dissector_try_uint(hci_h4_table, type, next_tvb, pinfo, tree)) {
+ if (!dissector_try_uint_new(hci_h4_table, type, next_tvb, pinfo, tree, TRUE, hci_data)) {
call_dissector(data_handle, next_tvb, pinfo, tree);
}
- pinfo->private_data = pd_save;
+ return tvb_length(tvb);
}
@@ -153,7 +150,7 @@ proto_register_hci_h4(void)
proto_hci_h4 = proto_register_protocol("Bluetooth HCI H4",
"HCI_H4", "hci_h4");
- register_dissector("hci_h4", dissect_hci_h4, proto_hci_h4);
+ new_register_dissector("hci_h4", dissect_hci_h4, proto_hci_h4);
proto_register_field_array(proto_hci_h4, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-hci_usb.c b/epan/dissectors/packet-hci_usb.c
index 86aef138c5..175c259df9 100644
--- a/epan/dissectors/packet-hci_usb.c
+++ b/epan/dissectors/packet-hci_usb.c
@@ -94,7 +94,7 @@ static const fragment_items hci_usb_msg_frag_items = {
void proto_register_hci_usb(void);
void proto_reg_handoff_hci_usb(void);
-static int
+static gint
dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_item *ttree = NULL;
@@ -103,7 +103,6 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
gint offset = 0;
usb_data_t *usb_data;
tvbuff_t *next_tvb = NULL;
- void *pd_save;
hci_data_t *hci_data;
gint p2p_dir_save;
guint32 session_id;
@@ -112,6 +111,9 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
if (tvb_length_remaining(tvb, offset) <= 0)
return 0;
+ titem = proto_tree_add_item(tree, proto_hci_usb, tvb, offset, -1, ENC_NA);
+ ttree = proto_item_add_subtree(titem, ett_hci_usb);
+
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCI_USB");
@@ -136,11 +138,6 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
break;
}
- titem = proto_tree_add_item(tree, proto_hci_usb, tvb, offset, -1, ENC_NA);
- ttree = proto_item_add_subtree(titem, ett_hci_usb);
-
- pd_save = pinfo->private_data;
-
session_id = usb_data->bus_id << 16 | usb_data->device_address << 8 | ((pinfo->p2p_dir == P2P_DIR_RECV) ? 1 : 0 ) << 7 | usb_data->endpoint;
hci_data = (hci_data_t *) wmem_new(wmem_packet_scope(), hci_data_t);
@@ -150,7 +147,7 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
hci_data->bdaddr_to_name_table = bdaddr_to_name_table;
hci_data->localhost_bdaddr = localhost_bdaddr;
hci_data->localhost_name = localhost_name;
- pinfo->private_data = hci_data;
+
pinfo->ptype = PT_BLUETOOTH;
next_tvb = tvb_new_subset_remaining(tvb, offset);
@@ -205,11 +202,11 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
}
if (usb_data->endpoint == 0x00) {
- call_dissector(find_dissector("bthci_cmd"), next_tvb, pinfo, tree);
+ call_dissector_with_data(find_dissector("bthci_cmd"), next_tvb, pinfo, tree, hci_data);
} else if (usb_data->endpoint == 0x01) {
- call_dissector(find_dissector("bthci_evt"), next_tvb, pinfo, tree);
+ call_dissector_with_data(find_dissector("bthci_evt"), next_tvb, pinfo, tree, hci_data);
} else if (usb_data->endpoint == 0x02) {
- call_dissector(find_dissector("bthci_acl"), next_tvb, pinfo, tree);
+ call_dissector_with_data(find_dissector("bthci_acl"), next_tvb, pinfo, tree, hci_data);
}
} else {
pitem = proto_tree_add_item(ttree, hf_bthci_usb_packet_unknown_fragment, tvb, offset, -1, ENC_NA);
@@ -217,7 +214,7 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
}
if (usb_data->endpoint == 0x03) {
- call_dissector(find_dissector("bthci_sco"), next_tvb, pinfo, tree);
+ call_dissector_with_data(find_dissector("bthci_sco"), next_tvb, pinfo, tree, hci_data);
} else if (usb_data->endpoint > 0x03) {
proto_tree_add_item(ttree, hf_bthci_usb_data, tvb, offset, -1, ENC_NA);
}
@@ -225,7 +222,6 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
offset += tvb_length_remaining(tvb, offset);
pinfo->p2p_dir = p2p_dir_save;
- pinfo->private_data = pd_save;
return offset;
}