Bluetooth: AVDTP: First step to fully support AVDTP session

Session should be finished too on HCI Disconnect and Adapter disappear.

Change-Id: I0823872e60ec932fc0831975e54dc33d49fb5dbc
Reviewed-on: https://code.wireshark.org/review/1882
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
This commit is contained in:
Michal Labedzki 2014-04-14 18:59:07 +02:00
parent 49cc95784b
commit 1258ce7bce
3 changed files with 18 additions and 5 deletions

View File

@ -541,6 +541,8 @@ typedef struct _channels_info_t {
wmem_tree_t *stream_numbers;
guint32 disconnect_in_frame;
guint32 *l2cap_disconnect_in_frame;
guint32 *hci_disconnect_in_frame;
guint32 *adapter_disconnect_in_frame;
sep_entry_t *sep;
} channels_info_t;
@ -1300,7 +1302,11 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(channels, key);
channels_info = (subtree) ? (channels_info_t *) wmem_tree_lookup32_le(subtree, frame_number) : NULL;
if (!(channels_info && *channels_info->l2cap_disconnect_in_frame >= pinfo->fd->num && channels_info->disconnect_in_frame >= pinfo->fd->num)) {
if (!(channels_info &&
*channels_info->adapter_disconnect_in_frame >= pinfo->fd->num &&
*channels_info->hci_disconnect_in_frame >= pinfo->fd->num &&
*channels_info->l2cap_disconnect_in_frame >= pinfo->fd->num &&
channels_info->disconnect_in_frame >= pinfo->fd->num)) {
channels_info = (channels_info_t *) wmem_new (wmem_file_scope(), channels_info_t);
channels_info->control_local_cid = l2cap_data->local_cid;
@ -1308,7 +1314,9 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
channels_info->media_local_cid = BTL2CAP_UNKNOWN_CID;
channels_info->media_remote_cid = BTL2CAP_UNKNOWN_CID;
channels_info->disconnect_in_frame = G_MAXUINT32;
channels_info->l2cap_disconnect_in_frame = l2cap_data->disconnect_in_frame;
channels_info->l2cap_disconnect_in_frame = l2cap_data->disconnect_in_frame;
channels_info->hci_disconnect_in_frame = l2cap_data->hci_disconnect_in_frame;
channels_info->adapter_disconnect_in_frame = l2cap_data->adapter_disconnect_in_frame;
channels_info->sep = NULL;
if (!pinfo->fd->flags.visited) {

View File

@ -1790,7 +1790,9 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
l2cap_data->remote_cid = BTL2CAP_UNKNOWN_CID;
l2cap_data->is_local_psm = FALSE;
l2cap_data->psm = 0;
l2cap_data->disconnect_in_frame = &max_disconnect_in_frame;
l2cap_data->disconnect_in_frame = &max_disconnect_in_frame;
l2cap_data->hci_disconnect_in_frame = &max_disconnect_in_frame;
l2cap_data->adapter_disconnect_in_frame = &max_disconnect_in_frame;
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;

View File

@ -54,13 +54,16 @@
typedef struct _btl2cap_data_t {
guint32 interface_id;
guint32 adapter_id;
guint32 *adapter_disconnect_in_frame;
guint16 chandle; /* only low 12 bits used */
guint32 *hci_disconnect_in_frame;
guint16 psm;
guint32 *disconnect_in_frame;
guint16 cid;
guint32 local_cid;
guint32 remote_cid;
guint32 *disconnect_in_frame;
gboolean is_local_psm; /* otherwise it is PSM in remote device */
guint16 psm;
guint32 remote_bd_addr_oui;
guint32 remote_bd_addr_id;
} btl2cap_data_t;