2012-11-05 11:42:10 +00:00
/* packet-btavdtp.c
* Routines for Bluetooth AVDTP dissection
*
* Copyright 2012 , Michal Labedzki for Tieto Corporation
*
* Wireshark - Network traffic analyzer
* By Gerald Combs < gerald @ wireshark . org >
* Copyright 1998 Gerald Combs
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA .
*/
# include "config.h"
# include <epan/packet.h>
# include <epan/expert.h>
# include <epan/prefs.h>
2013-03-19 13:51:52 +00:00
# include <epan/wmem/wmem.h>
2014-02-24 10:50:37 +00:00
# include <wiretap/wtap.h>
2012-11-05 11:42:10 +00:00
# include "packet-btl2cap.h"
# include "packet-btsdp.h"
# include "packet-btavdtp.h"
2013-11-03 15:25:52 +00:00
# include "packet-rtp.h"
2012-11-05 11:42:10 +00:00
# define AVDTP_MESSAGE_TYPE_MASK 0x03
# define AVDTP_PACKET_TYPE_MASK 0x0C
# define AVDTP_TRANSACTION_MASK 0xF0
# define AVDTP_SIGNAL_ID_MASK 0x3F
# define AVDTP_RFA0_MASK 0xC0
# define MESSAGE_TYPE_COMMAND 0x00
# define MESSAGE_TYPE_GENERAL_REJECT 0x01
# define MESSAGE_TYPE_ACCEPT 0x02
# define MESSAGE_TYPE_REJECT 0x03
# define PACKET_TYPE_SINGLE 0x00
# define PACKET_TYPE_START 0x01
# define PACKET_TYPE_CONTINUE 0x02
# define PACKET_TYPE_END 0x03
# define SIGNAL_ID_DISCOVER 0x01
# define SIGNAL_ID_GET_CAPABILITIES 0x02
# define SIGNAL_ID_SET_CONFIGURATION 0x03
# define SIGNAL_ID_GET_CONFIGURATION 0x04
# define SIGNAL_ID_RECONFIGURE 0x05
# define SIGNAL_ID_OPEN 0x06
# define SIGNAL_ID_START 0x07
# define SIGNAL_ID_CLOSE 0x08
# define SIGNAL_ID_SUSPEND 0x09
# define SIGNAL_ID_ABORT 0x0A
# define SIGNAL_ID_SECURITY_CONTROL 0x0B
# define SIGNAL_ID_GET_ALL_CAPABILITIES 0x0C
# define SIGNAL_ID_DELAY_REPORT 0x0D
# define SERVICE_CATEGORY_MEDIA_TRANSPORT 0x01
# define SERVICE_CATEGORY_REPORTING 0x02
# define SERVICE_CATEGORY_RECOVERY 0x03
# define SERVICE_CATEGORY_CONTENT_PROTECTION 0x04
# define SERVICE_CATEGORY_HEADER_COMPRESSION 0x05
# define SERVICE_CATEGORY_MULTIPLEXING 0x06
# define SERVICE_CATEGORY_MEDIA_CODEC 0x07
# define SERVICE_CATEGORY_DELAY_REPORTING 0x08
# define MEDIA_TYPE_AUDIO 0x00
# define MEDIA_TYPE_VIDEO 0x01
# define SEID_ACP 0x00
# define SEID_INT 0x01
# define STREAM_TYPE_MEDIA 0x00
# define STREAM_TYPE_SIGNAL 0x01
2014-03-25 07:59:28 +00:00
# define CODEC_DEFAULT 0xFFFF
2012-11-05 11:42:10 +00:00
# define CODEC_SBC 0x00
# define CODEC_MPEG12_AUDIO 0x01
# define CODEC_MPEG24_AAC 0x02
# define CODEC_ATRAC 0x04
# define CODEC_H263_BASELINE 0x01
# define CODEC_MPEG4_VSP 0x02
# define CODEC_H263_PROFILE_3 0x03
# define CODEC_H263_PROFILE_8 0x04
# define CODEC_VENDOR 0xFF
# define HEADER_SIZE 2
# define SEP_MAX 64
# define SEP_SIZE 2
static int proto_btavdtp = - 1 ;
static int hf_btavdtp_data = - 1 ;
static int hf_btavdtp_message_type = - 1 ;
static int hf_btavdtp_packet_type = - 1 ;
static int hf_btavdtp_transaction = - 1 ;
2013-10-26 02:24:04 +00:00
static int hf_btavdtp_signal = - 1 ;
2012-11-05 11:42:10 +00:00
static int hf_btavdtp_signal_id = - 1 ;
static int hf_btavdtp_rfa0 = - 1 ;
static int hf_btavdtp_number_of_signal_packets = - 1 ;
static int hf_btavdtp_sep_seid = - 1 ;
static int hf_btavdtp_sep_inuse = - 1 ;
static int hf_btavdtp_sep_rfa0 = - 1 ;
static int hf_btavdtp_sep_media_type = - 1 ;
static int hf_btavdtp_sep_type = - 1 ;
static int hf_btavdtp_sep_rfa1 = - 1 ;
static int hf_btavdtp_error_code = - 1 ;
2013-10-26 02:24:04 +00:00
static int hf_btavdtp_acp_sep = - 1 ;
static int hf_btavdtp_acp_seid_item = - 1 ;
static int hf_btavdtp_int_seid_item = - 1 ;
2012-11-05 11:42:10 +00:00
static int hf_btavdtp_acp_seid = - 1 ;
static int hf_btavdtp_int_seid = - 1 ;
static int hf_btavdtp_service_category = - 1 ;
static int hf_btavdtp_rfa_seid = - 1 ;
static int hf_btavdtp_delay = - 1 ;
static int hf_btavdtp_length_of_service_category = - 1 ;
static int hf_btavdtp_recovery_type = - 1 ;
static int hf_btavdtp_maximum_recovery_window_size = - 1 ;
static int hf_btavdtp_maximum_number_of_media_packet_in_parity_code = - 1 ;
static int hf_btavdtp_multiplexing_fragmentation = - 1 ;
static int hf_btavdtp_multiplexing_rfa = - 1 ;
static int hf_btavdtp_multiplexing_tsid = - 1 ;
static int hf_btavdtp_multiplexing_tcid = - 1 ;
static int hf_btavdtp_multiplexing_entry_rfa = - 1 ;
static int hf_btavdtp_header_compression_backch = - 1 ;
static int hf_btavdtp_header_compression_media = - 1 ;
static int hf_btavdtp_header_compression_recovery = - 1 ;
2012-12-03 11:39:22 +00:00
static int hf_btavdtp_header_compression_rfa = - 1 ;
2012-11-05 11:42:10 +00:00
static int hf_btavdtp_content_protection_type = - 1 ;
static int hf_btavdtp_media_codec_media_type = - 1 ;
static int hf_btavdtp_media_codec_rfa = - 1 ;
static int hf_btavdtp_media_codec_unknown_type = - 1 ;
static int hf_btavdtp_media_codec_audio_type = - 1 ;
static int hf_btavdtp_media_codec_video_type = - 1 ;
static int hf_btavdtp_sbc_sampling_frequency_16000 = - 1 ;
static int hf_btavdtp_sbc_sampling_frequency_32000 = - 1 ;
static int hf_btavdtp_sbc_sampling_frequency_44100 = - 1 ;
static int hf_btavdtp_sbc_sampling_frequency_48000 = - 1 ;
static int hf_btavdtp_sbc_channel_mode_mono = - 1 ;
static int hf_btavdtp_sbc_channel_mode_dual_channel = - 1 ;
static int hf_btavdtp_sbc_channel_mode_stereo = - 1 ;
static int hf_btavdtp_sbc_channel_mode_joint_stereo = - 1 ;
static int hf_btavdtp_sbc_block_4 = - 1 ;
static int hf_btavdtp_sbc_block_8 = - 1 ;
static int hf_btavdtp_sbc_block_12 = - 1 ;
static int hf_btavdtp_sbc_block_16 = - 1 ;
static int hf_btavdtp_sbc_subbands_4 = - 1 ;
static int hf_btavdtp_sbc_subbands_8 = - 1 ;
static int hf_btavdtp_sbc_allocation_method_snr = - 1 ;
static int hf_btavdtp_sbc_allocation_method_loudness = - 1 ;
static int hf_btavdtp_sbc_min_bitpool = - 1 ;
static int hf_btavdtp_sbc_max_bitpool = - 1 ;
static int hf_btavdtp_mpeg12_layer_1 = - 1 ;
static int hf_btavdtp_mpeg12_layer_2 = - 1 ;
static int hf_btavdtp_mpeg12_layer_3 = - 1 ;
static int hf_btavdtp_mpeg12_crc_protection = - 1 ;
static int hf_btavdtp_mpeg12_channel_mode_mono = - 1 ;
static int hf_btavdtp_mpeg12_channel_mode_dual_channel = - 1 ;
static int hf_btavdtp_mpeg12_channel_mode_stereo = - 1 ;
static int hf_btavdtp_mpeg12_channel_mode_joint_stereo = - 1 ;
static int hf_btavdtp_mpeg12_rfa = - 1 ;
static int hf_btavdtp_mpeg12_mpf_2 = - 1 ;
static int hf_btavdtp_mpeg12_sampling_frequency_16000 = - 1 ;
static int hf_btavdtp_mpeg12_sampling_frequency_22050 = - 1 ;
static int hf_btavdtp_mpeg12_sampling_frequency_24000 = - 1 ;
static int hf_btavdtp_mpeg12_sampling_frequency_32000 = - 1 ;
static int hf_btavdtp_mpeg12_sampling_frequency_44100 = - 1 ;
static int hf_btavdtp_mpeg12_sampling_frequency_48000 = - 1 ;
static int hf_btavdtp_mpeg12_vbr_supported = - 1 ;
static int hf_btavdtp_mpeg12_bit_rate = - 1 ;
static int hf_btavdtp_mpeg24_object_type_mpeg2_aac_lc = - 1 ;
static int hf_btavdtp_mpeg24_object_type_mpeg4_aac_lc = - 1 ;
static int hf_btavdtp_mpeg24_object_type_mpeg4_aac_ltp = - 1 ;
static int hf_btavdtp_mpeg24_object_type_mpeg4_aac_scalable = - 1 ;
static int hf_btavdtp_mpeg24_object_type_rfa = - 1 ;
static int hf_btavdtp_mpeg24_sampling_frequency_8000 = - 1 ;
static int hf_btavdtp_mpeg24_sampling_frequency_11025 = - 1 ;
static int hf_btavdtp_mpeg24_sampling_frequency_12000 = - 1 ;
static int hf_btavdtp_mpeg24_sampling_frequency_16000 = - 1 ;
static int hf_btavdtp_mpeg24_sampling_frequency_22050 = - 1 ;
static int hf_btavdtp_mpeg24_sampling_frequency_24000 = - 1 ;
static int hf_btavdtp_mpeg24_sampling_frequency_32000 = - 1 ;
static int hf_btavdtp_mpeg24_sampling_frequency_44100 = - 1 ;
static int hf_btavdtp_mpeg24_sampling_frequency_48000 = - 1 ;
static int hf_btavdtp_mpeg24_sampling_frequency_64000 = - 1 ;
static int hf_btavdtp_mpeg24_sampling_frequency_88200 = - 1 ;
static int hf_btavdtp_mpeg24_sampling_frequency_96000 = - 1 ;
static int hf_btavdtp_mpeg24_channels_1 = - 1 ;
static int hf_btavdtp_mpeg24_channels_2 = - 1 ;
static int hf_btavdtp_mpeg24_rfa = - 1 ;
static int hf_btavdtp_mpeg24_vbr_supported = - 1 ;
static int hf_btavdtp_mpeg24_bit_rate = - 1 ;
static int hf_btavdtp_atrac_version = - 1 ;
static int hf_btavdtp_atrac_channel_mode_single_channel = - 1 ;
static int hf_btavdtp_atrac_channel_mode_dual_channel = - 1 ;
static int hf_btavdtp_atrac_channel_mode_joint_stereo = - 1 ;
static int hf_btavdtp_atrac_rfa1 = - 1 ;
static int hf_btavdtp_atrac_rfa2 = - 1 ;
static int hf_btavdtp_atrac_sampling_frequency_44100 = - 1 ;
static int hf_btavdtp_atrac_sampling_frequency_48000 = - 1 ;
static int hf_btavdtp_atrac_vbr_supported = - 1 ;
static int hf_btavdtp_atrac_bit_rate = - 1 ;
static int hf_btavdtp_atrac_maximum_sul = - 1 ;
static int hf_btavdtp_atrac_rfa3 = - 1 ;
static int hf_btavdtp_h263_level_10 = - 1 ;
static int hf_btavdtp_h263_level_20 = - 1 ;
static int hf_btavdtp_h263_level_30 = - 1 ;
static int hf_btavdtp_h263_level_rfa = - 1 ;
static int hf_btavdtp_mpeg4_level_0 = - 1 ;
static int hf_btavdtp_mpeg4_level_1 = - 1 ;
static int hf_btavdtp_mpeg4_level_2 = - 1 ;
static int hf_btavdtp_mpeg4_level_3 = - 1 ;
static int hf_btavdtp_mpeg4_level_rfa = - 1 ;
static int hf_btavdtp_vendor_id = - 1 ;
static int hf_btavdtp_vendor_specific_codec_id = - 1 ;
static int hf_btavdtp_vendor_specific_value = - 1 ;
2013-10-26 02:24:04 +00:00
static int hf_btavdtp_capabilities = - 1 ;
static int hf_btavdtp_service = - 1 ;
static int hf_btavdtp_service_multiplexing_entry = - 1 ;
2012-11-05 11:42:10 +00:00
static gint ett_btavdtp = - 1 ;
static gint ett_btavdtp_sep = - 1 ;
static gint ett_btavdtp_capabilities = - 1 ;
static gint ett_btavdtp_service = - 1 ;
2013-07-09 01:18:52 +00:00
static expert_field ei_btavdtp_sbc_min_bitpool_out_of_range = EI_INIT ;
static expert_field ei_btavdtp_sbc_max_bitpool_out_of_range = EI_INIT ;
static expert_field ei_btavdtp_unexpected_losc_data = EI_INIT ;
2012-11-05 11:42:10 +00:00
static gboolean force_avdtp = FALSE ;
static dissector_handle_t btavdtp_handle ;
static dissector_handle_t bta2dp_handle ;
static dissector_handle_t btvdp_handle ;
2012-12-03 11:36:06 +00:00
static dissector_handle_t rtp_handle ;
2012-11-05 11:42:10 +00:00
2013-06-20 16:31:53 +00:00
static wmem_tree_t * sep_list = NULL ;
static wmem_tree_t * sep_open = NULL ;
static wmem_tree_t * cid_to_type_table = NULL ;
2012-11-05 11:42:10 +00:00
/* A2DP declarations */
2013-11-03 15:25:52 +00:00
static gint proto_bta2dp = - 1 ;
static gint ett_bta2dp = - 1 ;
static gint proto_bta2dp_cph_scms_t = - 1 ;
static gint ett_bta2dp_cph_scms_t = - 1 ;
2014-03-03 07:51:46 +00:00
static int hf_bta2dp_acp_seid = - 1 ;
static int hf_bta2dp_int_seid = - 1 ;
2013-11-03 15:25:52 +00:00
static int hf_bta2dp_codec = - 1 ;
static int hf_bta2dp_content_protection = - 1 ;
static int hf_bta2dp_l_bit = - 1 ;
static int hf_bta2dp_cp_bit = - 1 ;
static int hf_bta2dp_reserved = - 1 ;
2012-11-05 11:42:10 +00:00
static dissector_handle_t sbc_handle ;
static dissector_handle_t mp2t_handle ;
static dissector_handle_t mpeg_audio_handle ;
static dissector_handle_t atrac_handle ;
2013-11-03 15:25:52 +00:00
static gboolean force_a2dp_scms_t = FALSE ;
2014-03-25 07:59:28 +00:00
static gint force_a2dp_codec = CODEC_DEFAULT ;
2013-11-03 15:25:52 +00:00
static const enum_val_t pref_a2dp_codec [ ] = {
2014-03-25 07:59:28 +00:00
{ " default " , " Default " , CODEC_DEFAULT } ,
2013-11-03 15:25:52 +00:00
{ " sbc " , " SBC " , CODEC_SBC } ,
{ " mp2t " , " MPEG12 AUDIO " , CODEC_MPEG12_AUDIO } ,
{ " mpeg-audio " , " MPEG24 AAC " , CODEC_MPEG24_AAC } ,
/* XXX: Not supported in Wireshark yet { "atrac", "ATRAC", CODEC_ATRAC },*/
{ NULL , NULL , 0 }
} ;
2012-11-05 11:42:10 +00:00
/* VDP declarations */
2013-11-03 15:25:52 +00:00
static gint proto_btvdp = - 1 ;
static gint ett_btvdp = - 1 ;
static gint proto_btvdp_cph_scms_t = - 1 ;
static gint ett_btvdp_cph_scms_t = - 1 ;
2014-03-03 07:51:46 +00:00
static int hf_btvdp_acp_seid = - 1 ;
static int hf_btvdp_int_seid = - 1 ;
2013-11-03 15:25:52 +00:00
static int hf_btvdp_codec = - 1 ;
static int hf_btvdp_content_protection = - 1 ;
static int hf_btvdp_l_bit = - 1 ;
static int hf_btvdp_cp_bit = - 1 ;
static int hf_btvdp_reserved = - 1 ;
2012-11-05 11:42:10 +00:00
static dissector_handle_t h263_handle ;
static dissector_handle_t mp4v_es_handle ;
2013-11-03 15:25:52 +00:00
static gboolean force_vdp_scms_t = FALSE ;
static gint force_vdp_codec = CODEC_H263_BASELINE ;
static const enum_val_t pref_vdp_codec [ ] = {
{ " h263 " , " H263 " , CODEC_H263_BASELINE } ,
{ " mp4v-es " , " MPEG4 VSP " , CODEC_MPEG4_VSP } ,
{ NULL , NULL , 0 }
} ;
2012-11-05 11:42:10 +00:00
static const value_string message_type_vals [ ] = {
{ 0x00 , " Command " } ,
{ 0x01 , " GeneralReject " } ,
{ 0x02 , " ResponseAccept " } ,
{ 0x03 , " ResponseReject " } ,
{ 0 , NULL }
} ;
static const value_string packet_type_vals [ ] = {
{ 0x00 , " Single " } ,
{ 0x01 , " Start " } ,
{ 0x02 , " Continue " } ,
{ 0x03 , " End " } ,
{ 0 , NULL }
} ;
static const value_string signal_id_vals [ ] = {
{ 0x00 , " Reserved " } ,
{ 0x01 , " Discover " } ,
{ 0x02 , " GetCapabilities " } ,
{ 0x03 , " SetConfiguration " } ,
{ 0x04 , " GetConfiguration " } ,
{ 0x05 , " Reconfigure " } ,
{ 0x06 , " Open " } ,
{ 0x07 , " Start " } ,
{ 0x08 , " Close " } ,
{ 0x09 , " Suspend " } ,
{ 0x0A , " Abort " } ,
{ 0x0B , " SecurityControl " } ,
{ 0x0C , " GetAllCapabilities " } ,
{ 0x0D , " DelayReport " } ,
{ 0 , NULL }
} ;
static const value_string media_type_vals [ ] = {
{ 0x00 , " Audio " } ,
{ 0x01 , " Video " } ,
{ 0x02 , " Multimedia " } ,
{ 0 , NULL }
} ;
static const value_string sep_type_vals [ ] = {
{ 0x00 , " Source " } ,
{ 0x01 , " Sink " } ,
{ 0 , NULL }
} ;
static const value_string true_false [ ] = {
{ 0x00 , " False " } ,
{ 0x01 , " True " } ,
{ 0 , NULL }
} ;
static const value_string error_code_vals [ ] = {
/* ACP to INT, Signal Response Header Error Codes */
{ 0x01 , " Bad Header Format " } ,
/* ACP to INT, Signal Response Payload Format Error Codes */
{ 0x11 , " Bad Length " } ,
{ 0x12 , " Bad ACP SEID " } ,
{ 0x13 , " SEP In Use " } ,
{ 0x14 , " SEP Not In Use " } ,
{ 0x17 , " Bad Service Category " } ,
{ 0x18 , " Bad Payload Format " } ,
{ 0x19 , " Not Supported Command " } ,
{ 0x1A , " Invalid Capabilities " } ,
/* ACP to INT, Signal Response Transport Service Capabilities Error Codes */
{ 0x22 , " Bad Recovery Type " } ,
{ 0x23 , " Bad Media Transport Format " } ,
{ 0x25 , " Bad Recovery Format " } ,
{ 0x26 , " Bad Header Compression Format " } ,
{ 0x27 , " Bad Content Protection Format " } ,
{ 0x28 , " Bad Multiplexing Format " } ,
{ 0x29 , " Unsupported Configuration " } ,
/* ACP to INT, Procedure Error Codes */
{ 0x31 , " Bad State " } ,
{ 0 , NULL }
} ;
static const value_string service_category_vals [ ] = {
{ 0x01 , " Media Transport " } ,
{ 0x02 , " Reporting " } ,
{ 0x03 , " Recovery " } ,
{ 0x04 , " Content Protection " } ,
{ 0x05 , " Header Compression " } ,
{ 0x06 , " Multiplexing " } ,
{ 0x07 , " Media Codec " } ,
{ 0x08 , " Delay Reporting " } ,
{ 0 , NULL }
} ;
static const value_string recovery_type_vals [ ] = {
{ 0x00 , " Forbidden " } ,
{ 0x01 , " RFC2733 " } ,
{ 0 , NULL }
} ;
static const value_string multiplexing_tsid_vals [ ] = {
{ 0x00 , " Used for TSID query " } ,
{ 0x1F , " RFD " } ,
{ 0 , NULL }
} ;
static const value_string multiplexing_tcid_vals [ ] = {
{ 0x00 , " Used for TCID query " } ,
{ 0x1F , " RFD " } ,
{ 0 , NULL }
} ;
static const value_string media_codec_audio_type_vals [ ] = {
{ 0x00 , " SBC " } ,
{ 0x01 , " MPEG-1,2 Audio " } ,
{ 0x02 , " MPEG-2,4 AAC " } ,
{ 0x04 , " ATRAC family " } ,
{ 0xFF , " non-A2DP " } ,
{ 0 , NULL }
} ;
static const value_string media_codec_video_type_vals [ ] = {
{ 0x01 , " H.263 baseline " } ,
{ 0x02 , " MPEG-4 Visual Simple Profile " } ,
{ 0x03 , " H.263 profile 3 " } ,
{ 0x04 , " H.263 profile 8 " } ,
{ 0xFF , " non-VDP " } ,
{ 0 , NULL }
} ;
2013-11-03 15:25:52 +00:00
static const value_string content_protection_type_vals [ ] = {
{ 0x01 , " DTCP " } ,
{ 0x02 , " SCMS-T " } ,
{ 0 , NULL }
} ;
2012-11-05 11:42:10 +00:00
extern value_string_ext bthci_evt_comp_id_ext ;
enum sep_state {
SEP_STATE_FREE ,
SEP_STATE_OPEN ,
SEP_STATE_IN_USE
} ;
typedef struct _sep_entry_t {
guint8 seid ;
guint8 type ;
guint8 media_type ;
gint codec ;
2013-11-03 15:25:52 +00:00
gint content_protection_type ;
2014-03-03 07:51:46 +00:00
guint8 int_seid ;
2012-11-05 11:42:10 +00:00
enum sep_state state ;
} sep_entry_t ;
typedef struct _cid_type_data_t {
2014-02-24 10:50:37 +00:00
guint32 interface_id ;
guint32 adapter_id ;
guint32 chandle ;
2012-11-05 11:42:10 +00:00
guint32 type ;
guint16 cid ;
sep_entry_t * sep ;
} cid_type_data_t ;
2013-11-03 15:25:52 +00:00
typedef struct _sep_data_t {
gint codec ;
2014-03-03 07:51:46 +00:00
guint8 acp_seid ;
guint8 int_seid ;
2013-11-03 15:25:52 +00:00
gint content_protection_type ;
} sep_data_t ;
2013-11-04 10:07:33 +00:00
void proto_register_btavdtp ( void ) ;
void proto_reg_handoff_btavdtp ( void ) ;
void proto_register_bta2dp ( void ) ;
void proto_reg_handoff_bta2dp ( void ) ;
void proto_register_bta2dp_content_protection_header_scms_t ( void ) ;
void proto_register_btvdp ( void ) ;
void proto_reg_handoff_btvdp ( void ) ;
void proto_register_btvdp_content_protection_header_scms_t ( void ) ;
2012-12-03 11:36:06 +00:00
static const char *
2014-02-24 10:50:37 +00:00
get_sep_type ( guint32 interface_id ,
guint32 adapter_id , guint32 chandle , guint32 direction , guint32 seid , guint32 frame_number )
2012-11-05 11:42:10 +00:00
{
2014-02-24 10:50:37 +00:00
wmem_tree_key_t key [ 6 ] ;
wmem_tree_t * subtree ;
2012-11-05 11:42:10 +00:00
sep_entry_t * sep ;
key [ 0 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 0 ] . key = & interface_id ;
2012-11-05 11:42:10 +00:00
key [ 1 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 1 ] . key = & adapter_id ;
key [ 2 ] . length = 1 ;
key [ 2 ] . key = & chandle ;
key [ 3 ] . length = 1 ;
key [ 3 ] . key = & direction ;
key [ 4 ] . length = 1 ;
key [ 4 ] . key = & seid ;
key [ 5 ] . length = 0 ;
key [ 5 ] . key = NULL ;
subtree = ( wmem_tree_t * ) wmem_tree_lookup32_array ( sep_list , key ) ;
sep = ( subtree ) ? ( sep_entry_t * ) wmem_tree_lookup32_le ( subtree , frame_number ) : NULL ;
if ( sep ) {
2012-11-05 11:42:10 +00:00
return val_to_str_const ( sep - > type , sep_type_vals , " unknown " ) ;
}
return " unknown " ;
}
2012-12-03 11:36:06 +00:00
static const char *
2014-02-24 10:50:37 +00:00
get_sep_media_type ( guint32 interface_id ,
guint32 adapter_id , guint32 chandle , guint32 direction , guint32 seid , guint32 frame_number )
2012-11-05 11:42:10 +00:00
{
2014-02-24 10:50:37 +00:00
wmem_tree_key_t key [ 6 ] ;
wmem_tree_t * subtree ;
2012-11-05 11:42:10 +00:00
sep_entry_t * sep ;
key [ 0 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 0 ] . key = & interface_id ;
2012-11-05 11:42:10 +00:00
key [ 1 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 1 ] . key = & adapter_id ;
key [ 2 ] . length = 1 ;
key [ 2 ] . key = & chandle ;
key [ 3 ] . length = 1 ;
key [ 3 ] . key = & direction ;
key [ 4 ] . length = 1 ;
key [ 4 ] . key = & seid ;
key [ 5 ] . length = 0 ;
key [ 5 ] . key = NULL ;
subtree = ( wmem_tree_t * ) wmem_tree_lookup32_array ( sep_list , key ) ;
sep = ( subtree ) ? ( sep_entry_t * ) wmem_tree_lookup32_le ( subtree , frame_number ) : NULL ;
if ( sep ) {
2012-11-05 11:42:10 +00:00
return val_to_str_const ( sep - > media_type , media_type_vals , " unknown " ) ;
}
return " unknown " ;
}
static gint
2014-02-24 10:50:37 +00:00
dissect_sep ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , gint offset ,
guint32 interface_id , guint32 adapter_id , guint32 chandle )
2012-11-05 11:42:10 +00:00
{
proto_tree * sep_tree ;
proto_item * sep_item ;
guint i_sep = 1 ;
guint media_type ;
guint type ;
guint seid ;
guint in_use ;
guint items ;
2014-02-24 10:50:37 +00:00
guint32 direction ;
2012-11-05 11:42:10 +00:00
2014-02-24 10:50:37 +00:00
/* Reverse direction to avoid mass reversing it, because this is only case
when SEP is provided in ACP role , otherwise INT frequently asking for it
*/
direction = ( pinfo - > p2p_dir = = P2P_DIR_SENT ) ? P2P_DIR_RECV : P2P_DIR_SENT ;
2012-11-05 11:42:10 +00:00
items = tvb_length_remaining ( tvb , offset ) / 2 ;
2013-04-02 21:13:02 +00:00
while ( tvb_length_remaining ( tvb , offset ) > 0 ) {
2012-11-05 11:42:10 +00:00
seid = tvb_get_guint8 ( tvb , offset ) ;
in_use = seid & 0x02 ;
seid = seid > > 2 ;
media_type = tvb_get_guint8 ( tvb , offset + 1 ) > > 4 ;
type = ( tvb_get_guint8 ( tvb , offset + 1 ) & 0x08 ) > > 3 ;
2013-10-26 02:24:04 +00:00
sep_item = proto_tree_add_none_format ( tree , hf_btavdtp_acp_sep , tvb , offset , 2 , " ACP SEP [%u - %s %s] item %u/%u " ,
2013-02-21 21:04:59 +00:00
seid , val_to_str_const ( media_type , media_type_vals , " unknown " ) ,
val_to_str_const ( type , sep_type_vals , " unknown " ) , i_sep , items ) ;
2012-11-05 11:42:10 +00:00
sep_tree = proto_item_add_subtree ( sep_item , ett_btavdtp_sep ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( sep_tree , hf_btavdtp_sep_seid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( sep_tree , hf_btavdtp_sep_inuse , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( sep_tree , hf_btavdtp_sep_rfa0 , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( sep_tree , hf_btavdtp_sep_media_type , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( sep_tree , hf_btavdtp_sep_type , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( sep_tree , hf_btavdtp_sep_rfa1 , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
if ( ! pinfo - > fd - > flags . visited ) {
2014-02-24 10:50:37 +00:00
sep_entry_t * sep_data ;
wmem_tree_key_t key [ 7 ] ;
guint32 frame_number = pinfo - > fd - > num ;
key [ 0 ] . length = 1 ;
key [ 0 ] . key = & interface_id ;
key [ 1 ] . length = 1 ;
key [ 1 ] . key = & adapter_id ;
key [ 2 ] . length = 1 ;
key [ 2 ] . key = & chandle ;
key [ 3 ] . length = 1 ;
key [ 3 ] . key = & direction ;
key [ 4 ] . length = 1 ;
key [ 4 ] . key = & seid ;
key [ 5 ] . length = 1 ;
key [ 5 ] . key = & frame_number ;
key [ 6 ] . length = 0 ;
key [ 6 ] . key = NULL ;
2013-03-19 13:51:52 +00:00
sep_data = wmem_new ( wmem_file_scope ( ) , sep_entry_t ) ;
2012-11-05 11:42:10 +00:00
sep_data - > seid = seid ;
sep_data - > type = type ;
2012-12-03 11:36:06 +00:00
sep_data - > codec = - 1 ;
2013-11-03 15:25:52 +00:00
sep_data - > content_protection_type = 0 ;
2012-11-05 11:42:10 +00:00
sep_data - > media_type = media_type ;
if ( in_use ) {
sep_data - > state = SEP_STATE_IN_USE ;
} else {
sep_data - > state = SEP_STATE_FREE ;
}
2013-06-20 16:31:53 +00:00
wmem_tree_insert32_array ( sep_list , key , sep_data ) ;
2012-11-05 11:42:10 +00:00
}
offset + = 1 ;
i_sep + = 1 ;
}
col_append_fstr ( pinfo - > cinfo , COL_INFO , " - items: %u " , items ) ;
return offset ;
}
static gint
dissect_codec ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , gint offset ,
guint losc , gint media_type , gint media_codec_type )
{
proto_item * pitem ;
guint bitpool ;
switch ( media_type ) {
case MEDIA_TYPE_AUDIO :
switch ( media_codec_type ) {
case CODEC_SBC :
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( tree , hf_btavdtp_sbc_sampling_frequency_16000 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_sampling_frequency_32000 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_sampling_frequency_44100 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_sampling_frequency_48000 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_channel_mode_mono , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_channel_mode_dual_channel , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_channel_mode_stereo , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_channel_mode_joint_stereo , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_block_4 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_block_8 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_block_12 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_block_16 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_subbands_4 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_subbands_8 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_allocation_method_snr , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_sbc_allocation_method_loudness , tvb , offset + 1 , 1 , ENC_NA ) ;
pitem = proto_tree_add_item ( tree , hf_btavdtp_sbc_min_bitpool , tvb , offset + 2 , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
bitpool = tvb_get_guint8 ( tvb , offset + 2 ) ;
if ( bitpool < 2 | | bitpool > 250 ) {
2013-07-09 01:18:52 +00:00
expert_add_info ( pinfo , pitem , & ei_btavdtp_sbc_min_bitpool_out_of_range ) ;
2012-11-05 11:42:10 +00:00
}
2014-02-16 11:14:40 +00:00
pitem = proto_tree_add_item ( tree , hf_btavdtp_sbc_max_bitpool , tvb , offset + 3 , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
bitpool = tvb_get_guint8 ( tvb , offset + 3 ) ;
if ( bitpool < 2 | | bitpool > 250 ) {
2013-07-09 01:18:52 +00:00
expert_add_info ( pinfo , pitem , & ei_btavdtp_sbc_max_bitpool_out_of_range ) ;
2012-11-05 11:42:10 +00:00
}
break ;
case CODEC_MPEG12_AUDIO :
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_layer_1 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_layer_2 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_layer_3 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_crc_protection , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_channel_mode_mono , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_channel_mode_dual_channel , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_channel_mode_stereo , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_channel_mode_joint_stereo , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_rfa , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_mpf_2 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_sampling_frequency_16000 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_sampling_frequency_22050 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_sampling_frequency_24000 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_sampling_frequency_32000 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_sampling_frequency_44100 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_sampling_frequency_48000 , tvb , offset + 1 , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_vbr_supported , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg12_bit_rate , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
break ;
case CODEC_MPEG24_AAC :
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_object_type_mpeg2_aac_lc , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_object_type_mpeg4_aac_lc , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_object_type_mpeg4_aac_ltp , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_object_type_mpeg4_aac_scalable , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_object_type_rfa , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_8000 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_11025 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_12000 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_16000 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_22050 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_24000 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_32000 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_44100 , tvb , offset + 1 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_48000 , tvb , offset + 2 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_64000 , tvb , offset + 2 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_88200 , tvb , offset + 2 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_96000 , tvb , offset + 2 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_channels_1 , tvb , offset + 2 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_channels_2 , tvb , offset + 2 , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_rfa , tvb , offset + 2 , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_vbr_supported , tvb , offset + 3 , 3 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg24_bit_rate , tvb , offset + 3 , 3 , ENC_BIG_ENDIAN ) ;
break ;
case CODEC_ATRAC :
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( tree , hf_btavdtp_atrac_version , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_atrac_channel_mode_single_channel , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_atrac_channel_mode_dual_channel , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_atrac_channel_mode_joint_stereo , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_atrac_rfa1 , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
proto_tree_add_item ( tree , hf_btavdtp_atrac_rfa2 , tvb , offset + 1 , 3 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tree , hf_btavdtp_atrac_sampling_frequency_44100 , tvb , offset + 1 , 3 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tree , hf_btavdtp_atrac_sampling_frequency_48000 , tvb , offset + 1 , 3 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tree , hf_btavdtp_atrac_vbr_supported , tvb , offset + 3 , 3 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tree , hf_btavdtp_atrac_bit_rate , tvb , offset + 3 , 3 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tree , hf_btavdtp_atrac_maximum_sul , tvb , offset + 4 , 2 , ENC_BIG_ENDIAN ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( tree , hf_btavdtp_atrac_rfa3 , tvb , offset + 6 , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
break ;
case CODEC_VENDOR : /* non-A2DP */
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( tree , hf_btavdtp_vendor_id , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_codec_id , tvb , offset + 4 , 2 , ENC_LITTLE_ENDIAN ) ;
2012-11-12 14:53:46 +00:00
proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_value , tvb , offset + 6 , losc - 6 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
break ;
default :
2012-11-12 14:53:46 +00:00
proto_tree_add_item ( tree , hf_btavdtp_data , tvb , offset , losc , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
}
break ;
case MEDIA_TYPE_VIDEO :
switch ( media_codec_type ) {
case CODEC_H263_BASELINE :
case CODEC_H263_PROFILE_3 :
case CODEC_H263_PROFILE_8 :
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( tree , hf_btavdtp_h263_level_10 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_h263_level_20 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_h263_level_30 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_h263_level_rfa , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
break ;
case CODEC_MPEG4_VSP :
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( tree , hf_btavdtp_mpeg4_level_0 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg4_level_1 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg4_level_2 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg4_level_3 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_btavdtp_mpeg4_level_rfa , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
break ;
case CODEC_VENDOR : /* non-VDP */
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( tree , hf_btavdtp_vendor_id , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_codec_id , tvb , offset + 4 , 2 , ENC_LITTLE_ENDIAN ) ;
2012-11-12 14:53:46 +00:00
proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_value , tvb , offset + 6 , losc - 6 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
break ;
default :
2012-11-12 14:53:46 +00:00
proto_tree_add_item ( tree , hf_btavdtp_data , tvb , offset , losc , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
}
break ;
default :
2012-11-12 14:53:46 +00:00
proto_tree_add_item ( tree , hf_btavdtp_data , tvb , offset , losc , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
}
offset + = losc ;
return offset ;
}
static gint
dissect_capabilities ( tvbuff_t * tvb , packet_info * pinfo ,
2013-11-03 15:25:52 +00:00
proto_tree * tree , gint offset , gint * codec ,
gint * content_protection_type )
2012-11-05 11:42:10 +00:00
{
proto_item * pitem = NULL ;
proto_item * ptree = NULL ;
2012-12-02 15:21:53 +00:00
proto_tree * capabilities_tree ;
proto_item * capabilities_item ;
2012-11-05 11:42:10 +00:00
proto_tree * service_tree = NULL ;
proto_item * service_item = NULL ;
gint service_category = 0 ;
gint losc = 0 ;
gint recovery_type = 0 ;
gint maximum_recovery_window_size = 0 ;
gint maximum_number_of_media_packet_in_parity_code = 0 ;
gint media_type = 0 ;
gint media_codec_type = 0 ;
2013-10-26 02:24:04 +00:00
capabilities_item = proto_tree_add_item ( tree , hf_btavdtp_capabilities , tvb , offset , tvb_length ( tvb ) - offset , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
capabilities_tree = proto_item_add_subtree ( capabilities_item , ett_btavdtp_capabilities ) ;
if ( codec ) {
* codec = - 1 ;
}
2013-04-02 21:13:02 +00:00
while ( tvb_length_remaining ( tvb , offset ) > 0 ) {
2012-11-05 11:42:10 +00:00
service_category = tvb_get_guint8 ( tvb , offset ) ;
losc = tvb_get_guint8 ( tvb , offset + 1 ) ;
2013-10-26 02:24:04 +00:00
service_item = proto_tree_add_none_format ( capabilities_tree , hf_btavdtp_service , tvb , offset , 2 + losc , " Service: %s " , val_to_str_const ( service_category , service_category_vals , " RFD " ) ) ;
2012-11-05 11:42:10 +00:00
service_tree = proto_item_add_subtree ( service_item , ett_btavdtp_service ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( service_tree , hf_btavdtp_service_category , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( service_tree , hf_btavdtp_length_of_service_category , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
switch ( service_category ) {
case SERVICE_CATEGORY_MEDIA_TRANSPORT :
case SERVICE_CATEGORY_REPORTING :
case SERVICE_CATEGORY_DELAY_REPORTING :
/* losc should be 0*/
break ;
case SERVICE_CATEGORY_RECOVERY :
recovery_type = tvb_get_guint8 ( tvb , offset ) ;
2014-02-16 11:14:40 +00:00
pitem = proto_tree_add_item ( service_tree , hf_btavdtp_recovery_type , tvb , offset , 1 , ENC_NA ) ;
2013-02-21 21:04:59 +00:00
proto_item_append_text ( pitem , " (%s) " , val_to_str_const ( recovery_type , recovery_type_vals , " RFD " ) ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
losc - = 1 ;
maximum_recovery_window_size = tvb_get_guint8 ( tvb , offset ) ;
2014-02-16 11:14:40 +00:00
pitem = proto_tree_add_item ( service_tree , hf_btavdtp_maximum_recovery_window_size , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
if ( maximum_recovery_window_size = = 0x00 ) {
proto_item_append_text ( pitem , " (Forbidden) " ) ;
} else if ( maximum_recovery_window_size > = 0x18 ) {
proto_item_append_text ( pitem , " (Undocumented) " ) ;
}
offset + = 1 ;
losc - = 1 ;
maximum_number_of_media_packet_in_parity_code = tvb_get_guint8 ( tvb , offset ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( service_tree , hf_btavdtp_maximum_number_of_media_packet_in_parity_code , tvb , offset , 1 , ENC_NA ) ;
pitem = proto_tree_add_item ( service_tree , hf_btavdtp_maximum_recovery_window_size , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
if ( maximum_number_of_media_packet_in_parity_code = = 0x00 ) {
proto_item_append_text ( pitem , " (Forbidden) " ) ;
} else if ( maximum_number_of_media_packet_in_parity_code > = 0x18 ) {
proto_item_append_text ( pitem , " (Undocumented) " ) ;
}
offset + = 1 ;
losc - = 1 ;
break ;
case SERVICE_CATEGORY_MEDIA_CODEC :
media_type = tvb_get_guint8 ( tvb , offset ) > > 4 ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( service_tree , hf_btavdtp_media_codec_media_type , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( service_tree , hf_btavdtp_media_codec_rfa , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
losc - = 1 ;
media_codec_type = tvb_get_guint8 ( tvb , offset ) ;
if ( codec ) {
* codec = media_codec_type ;
}
if ( media_type = = MEDIA_TYPE_AUDIO ) {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( service_tree , hf_btavdtp_media_codec_audio_type , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
proto_item_append_text ( service_item , " - Audio %s " ,
val_to_str_const ( media_codec_type , media_codec_audio_type_vals , " unknown codec " ) ) ;
col_append_fstr ( pinfo - > cinfo , COL_INFO , " - Audio %s " ,
val_to_str_const ( media_codec_type , media_codec_audio_type_vals , " unknown codec " ) ) ;
} else if ( media_type = = MEDIA_TYPE_VIDEO ) {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( service_tree , hf_btavdtp_media_codec_video_type , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
proto_item_append_text ( service_item , " - Video %s " ,
val_to_str_const ( media_codec_type , media_codec_video_type_vals , " unknown codec " ) ) ;
col_append_fstr ( pinfo - > cinfo , COL_INFO , " - Video %s " ,
val_to_str_const ( media_codec_type , media_codec_video_type_vals , " unknown codec " ) ) ;
} else {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( service_tree , hf_btavdtp_media_codec_unknown_type , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
proto_item_append_text ( service_item , " - Unknown 0x%02x " , media_codec_type ) ;
col_append_fstr ( pinfo - > cinfo , COL_INFO , " - Unknown 0x%02x " , media_codec_type ) ;
}
offset + = 1 ;
losc - = 1 ;
offset = dissect_codec ( tvb , pinfo , service_tree , offset , losc , media_type , media_codec_type ) ;
losc = 0 ;
break ;
case SERVICE_CATEGORY_CONTENT_PROTECTION :
2013-03-28 15:41:25 +00:00
proto_tree_add_item ( service_tree , hf_btavdtp_content_protection_type , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
2013-11-03 15:25:52 +00:00
if ( content_protection_type ) {
* content_protection_type = tvb_get_letohs ( tvb , offset ) ;
}
2012-11-05 11:42:10 +00:00
offset + = 2 ;
losc - = 2 ;
2013-11-03 15:25:52 +00:00
if ( losc > 0 ) {
proto_tree_add_item ( service_tree , hf_btavdtp_data , tvb , offset , losc , ENC_NA ) ;
offset + = losc ;
losc = 0 ;
}
2012-11-05 11:42:10 +00:00
break ;
case SERVICE_CATEGORY_HEADER_COMPRESSION :
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( service_tree , hf_btavdtp_header_compression_backch , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( service_tree , hf_btavdtp_header_compression_media , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( service_tree , hf_btavdtp_header_compression_recovery , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( service_tree , hf_btavdtp_header_compression_rfa , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
losc - = 1 ;
break ;
case SERVICE_CATEGORY_MULTIPLEXING :
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( service_tree , hf_btavdtp_multiplexing_fragmentation , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( service_tree , hf_btavdtp_multiplexing_rfa , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
losc - = 1 ;
if ( losc > = 2 ) {
2013-10-26 02:24:04 +00:00
pitem = proto_tree_add_none_format ( service_tree , hf_btavdtp_service_multiplexing_entry , tvb , offset , 1 + losc , " Entry: Media Transport Session " ) ;
2012-11-05 11:42:10 +00:00
ptree = proto_item_add_subtree ( pitem , ett_btavdtp_service ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_tsid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_entry_rfa , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
losc - = 1 ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_tcid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_entry_rfa , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
losc - = 1 ;
}
if ( losc > = 2 ) {
2013-10-26 02:24:04 +00:00
pitem = proto_tree_add_none_format ( service_tree , hf_btavdtp_service_multiplexing_entry , tvb , offset , 1 + losc , " Entry: Reporting Transport Session " ) ;
2012-11-05 11:42:10 +00:00
ptree = proto_item_add_subtree ( pitem , ett_btavdtp_service ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_tsid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_entry_rfa , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
losc - = 1 ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_tcid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_entry_rfa , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
losc - = 1 ;
}
if ( losc > = 2 ) {
2013-10-26 02:24:04 +00:00
pitem = proto_tree_add_none_format ( service_tree , hf_btavdtp_service_multiplexing_entry , tvb , offset , 1 + losc , " Entry: Recovery Transport Session " ) ;
2012-11-05 11:42:10 +00:00
ptree = proto_item_add_subtree ( pitem , ett_btavdtp_service ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_tsid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_entry_rfa , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
losc - = 1 ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_tcid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_entry_rfa , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
losc - = 1 ;
}
break ;
default :
2013-01-14 18:31:04 +00:00
proto_tree_add_item ( service_tree , hf_btavdtp_data , tvb , offset , losc , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = losc ;
losc = 0 ;
}
if ( losc > 0 ) {
2012-11-12 14:53:46 +00:00
pitem = proto_tree_add_item ( service_tree , hf_btavdtp_data , tvb , offset , losc , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = losc ;
2013-07-09 01:18:52 +00:00
expert_add_info ( pinfo , pitem , & ei_btavdtp_unexpected_losc_data ) ;
2012-11-05 11:42:10 +00:00
}
}
return offset ;
}
static gint
dissect_seid ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , gint offset ,
2014-02-24 10:50:37 +00:00
gint seid_side , gint i_item , guint32 * sep_seid ,
guint32 interface_id , guint32 adapter_id , guint32 chandle ,
guint32 frame_number )
2012-11-05 11:42:10 +00:00
{
2014-02-24 10:50:37 +00:00
guint32 seid ;
2012-11-05 11:42:10 +00:00
proto_tree * seid_tree = NULL ;
proto_item * seid_item = NULL ;
2014-02-24 10:50:37 +00:00
guint32 direction ;
2012-11-05 11:42:10 +00:00
seid = tvb_get_guint8 ( tvb , offset ) > > 2 ;
if ( sep_seid ) {
* sep_seid = seid ;
}
if ( seid_side = = SEID_ACP ) {
2014-02-24 10:50:37 +00:00
direction = pinfo - > p2p_dir ;
2013-10-26 02:24:04 +00:00
seid_item = proto_tree_add_none_format ( tree , hf_btavdtp_acp_seid_item , tvb , offset , 1 ,
2014-02-24 10:50:37 +00:00
" ACP SEID [%u - %s %s] " , seid ,
get_sep_media_type ( interface_id , adapter_id , chandle , direction , seid , frame_number ) ,
get_sep_type ( interface_id , adapter_id , chandle , direction , seid , frame_number ) ) ;
2012-11-05 11:42:10 +00:00
seid_tree = proto_item_add_subtree ( seid_item , ett_btavdtp_sep ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( seid_tree , hf_btavdtp_acp_seid , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
if ( i_item > 0 ) proto_item_append_text ( seid_item , " item %u " , i_item ) ;
col_append_fstr ( pinfo - > cinfo , COL_INFO , " - ACP SEID [%u - %s %s] " ,
2014-02-24 10:50:37 +00:00
seid , get_sep_media_type ( interface_id , adapter_id , chandle , direction , seid , frame_number ) ,
get_sep_type ( interface_id , adapter_id , chandle , direction , seid , frame_number ) ) ;
2012-11-05 11:42:10 +00:00
} else {
2014-02-24 10:50:37 +00:00
direction = ( pinfo - > p2p_dir = = P2P_DIR_SENT ) ? P2P_DIR_RECV : P2P_DIR_SENT ;
2013-10-26 02:24:04 +00:00
seid_item = proto_tree_add_none_format ( tree , hf_btavdtp_int_seid_item , tvb , offset , 1 ,
2014-02-24 10:50:37 +00:00
" INT SEID [%u - %s %s] " , seid ,
get_sep_media_type ( interface_id , adapter_id , chandle , direction , seid , frame_number ) ,
get_sep_type ( interface_id , adapter_id , chandle , direction , seid , frame_number ) ) ;
2012-11-05 11:42:10 +00:00
seid_tree = proto_item_add_subtree ( seid_item , ett_btavdtp_sep ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( seid_tree , hf_btavdtp_int_seid , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
if ( i_item > 0 ) proto_item_append_text ( seid_item , " item %u " , i_item ) ;
col_append_fstr ( pinfo - > cinfo , COL_INFO , " - INT SEID [%u - %s %s] " ,
2014-02-24 10:50:37 +00:00
seid , get_sep_media_type ( interface_id , adapter_id , chandle , direction , seid , frame_number ) ,
get_sep_type ( interface_id , adapter_id , chandle , direction , seid , frame_number ) ) ;
2012-11-05 11:42:10 +00:00
}
2013-10-26 02:24:04 +00:00
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( seid_tree , hf_btavdtp_rfa_seid , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
return offset ;
}
2013-11-02 19:20:04 +00:00
static gint
dissect_btavdtp ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data )
2012-11-05 11:42:10 +00:00
{
proto_item * ti ;
proto_tree * btavdtp_tree = NULL ;
proto_tree * signal_tree = NULL ;
proto_item * signal_item = NULL ;
btl2cap_data_t * l2cap_data ;
gint offset = 0 ;
gint i_sep = 1 ;
gint packet_type = 0 ;
gint message_type = 0 ;
gint signal_id = 0 ;
guint delay ;
2014-02-24 10:50:37 +00:00
wmem_tree_t * subtree ;
wmem_tree_key_t key [ 8 ] ;
guint32 interface_id ;
guint32 adapter_id ;
guint32 chandle ;
guint32 direction ;
guint32 type ;
guint32 cid ;
guint32 frame_number ;
2012-11-05 11:42:10 +00:00
cid_type_data_t * cid_type_data ;
sep_entry_t * sep ;
tvbuff_t * next_tvb ;
guint32 seid ;
2013-11-03 15:25:52 +00:00
gint codec = - 1 ;
gint content_protection_type = 0 ;
2012-11-05 11:42:10 +00:00
col_set_str ( pinfo - > cinfo , COL_PROTOCOL , " AVDTP " ) ;
2014-02-24 10:50:37 +00:00
direction = pinfo - > p2p_dir ;
switch ( direction ) {
2013-03-30 21:47:27 +00:00
case P2P_DIR_SENT :
2013-10-29 14:09:20 +00:00
col_set_str ( pinfo - > cinfo , COL_INFO , " Sent " ) ;
2013-03-30 21:47:27 +00:00
break ;
2012-11-05 11:42:10 +00:00
2013-03-30 21:47:27 +00:00
case P2P_DIR_RECV :
2013-10-29 14:09:20 +00:00
col_set_str ( pinfo - > cinfo , COL_INFO , " Rcvd " ) ;
2013-03-30 21:47:27 +00:00
break ;
default :
col_add_fstr ( pinfo - > cinfo , COL_INFO , " Unknown direction %d " ,
2014-02-24 10:50:37 +00:00
direction ) ;
2013-03-30 21:47:27 +00:00
goto LABEL_data ;
break ;
2012-11-05 11:42:10 +00:00
}
2013-11-02 19:20:04 +00:00
l2cap_data = ( btl2cap_data_t * ) data ;
DISSECTOR_ASSERT ( l2cap_data ) ;
2012-11-05 11:42:10 +00:00
if ( ! force_avdtp & & ! pinfo - > fd - > flags . visited & & ( l2cap_data - > first_scid_frame = = pinfo - > fd - > num | |
l2cap_data - > first_dcid_frame = = pinfo - > fd - > num ) ) {
2013-03-19 13:51:52 +00:00
cid_type_data = wmem_new ( wmem_file_scope ( ) , cid_type_data_t ) ;
2014-02-24 10:50:37 +00:00
cid_type_data - > interface_id = l2cap_data - > interface_id ;
cid_type_data - > adapter_id = l2cap_data - > adapter_id ;
cid_type_data - > chandle = l2cap_data - > chandle ;
2012-11-05 11:42:10 +00:00
cid_type_data - > type = STREAM_TYPE_MEDIA ;
cid_type_data - > cid = l2cap_data - > cid ;
cid_type_data - > sep = NULL ;
/* heuristics for recognize signal AVDTP: first packet must be Discover Command */
if ( ( tvb_get_guint8 ( tvb , offset ) & 0x0F ) = = 0x00 & &
tvb_get_guint8 ( tvb , offset + 1 ) = = 0x01 & &
tvb_length_remaining ( tvb , offset ) = = HEADER_SIZE ) {
/* It is AVDTP Signaling cmd side */
cid_type_data - > type = STREAM_TYPE_SIGNAL ;
} else if ( ( tvb_get_guint8 ( tvb , offset ) & 0x0F ) = = 0x02 & &
tvb_get_guint8 ( tvb , offset + 1 ) = = 0x01 & &
tvb_length_remaining ( tvb , offset ) < = SEP_MAX * SEP_SIZE + HEADER_SIZE & &
! ( tvb_length_remaining ( tvb , offset ) % SEP_SIZE ) ) {
/* It is AVDTP Signaling rsp side */
cid_type_data - > type = STREAM_TYPE_SIGNAL ;
} else {
2014-02-24 10:50:37 +00:00
interface_id = cid_type_data - > interface_id ;
adapter_id = cid_type_data - > adapter_id ;
chandle = cid_type_data - > chandle ;
frame_number = pinfo - > fd - > num ;
key [ 0 ] . length = 1 ;
key [ 0 ] . key = & interface_id ;
key [ 1 ] . length = 1 ;
key [ 1 ] . key = & adapter_id ;
key [ 2 ] . length = 1 ;
key [ 2 ] . key = & chandle ;
key [ 3 ] . length = 0 ;
key [ 3 ] . key = NULL ;
subtree = ( wmem_tree_t * ) wmem_tree_lookup32_array ( sep_open , key ) ;
sep = ( subtree ) ? ( sep_entry_t * ) wmem_tree_lookup32_le ( subtree , frame_number ) : NULL ;
2012-11-05 11:42:10 +00:00
if ( sep & & sep - > state = = SEP_STATE_OPEN ) {
sep - > state = SEP_STATE_IN_USE ;
cid_type_data - > sep = sep ;
}
}
2014-02-24 10:50:37 +00:00
interface_id = cid_type_data - > interface_id ;
adapter_id = cid_type_data - > adapter_id ;
chandle = cid_type_data - > chandle ;
type = cid_type_data - > type ;
cid = cid_type_data - > cid ;
frame_number = pinfo - > fd - > num ;
2012-11-05 11:42:10 +00:00
key [ 0 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 0 ] . key = & interface_id ;
2012-11-05 11:42:10 +00:00
key [ 1 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 1 ] . key = & adapter_id ;
2012-11-05 11:42:10 +00:00
key [ 2 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 2 ] . key = & chandle ;
key [ 3 ] . length = 1 ;
key [ 3 ] . key = & cid ;
key [ 4 ] . length = 1 ;
key [ 4 ] . key = & type ;
key [ 5 ] . length = 1 ;
key [ 5 ] . key = & frame_number ;
key [ 6 ] . length = 0 ;
key [ 6 ] . key = NULL ;
2012-11-05 11:42:10 +00:00
2013-06-20 16:31:53 +00:00
wmem_tree_insert32_array ( cid_to_type_table , key , cid_type_data ) ;
2012-11-05 11:42:10 +00:00
}
2014-02-24 10:50:37 +00:00
interface_id = l2cap_data - > interface_id ;
adapter_id = l2cap_data - > adapter_id ;
chandle = l2cap_data - > chandle ;
cid = l2cap_data - > cid ;
frame_number = pinfo - > fd - > num ;
2012-11-05 11:42:10 +00:00
if ( ! force_avdtp ) {
key [ 0 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 0 ] . key = & interface_id ;
2012-11-05 11:42:10 +00:00
key [ 1 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 1 ] . key = & adapter_id ;
2012-11-05 11:42:10 +00:00
key [ 2 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 2 ] . key = & chandle ;
key [ 3 ] . length = 1 ;
key [ 3 ] . key = & cid ;
key [ 4 ] . length = 0 ;
key [ 4 ] . key = NULL ;
subtree = ( wmem_tree_t * ) wmem_tree_lookup32_array ( cid_to_type_table , key ) ;
if ( subtree ) {
wmem_tree_t * type_tree ;
type_tree = ( wmem_tree_t * ) wmem_tree_lookup32 ( subtree , STREAM_TYPE_MEDIA ) ;
if ( ! type_tree )
type_tree = ( wmem_tree_t * ) wmem_tree_lookup32 ( subtree , STREAM_TYPE_SIGNAL ) ;
subtree = type_tree ;
}
cid_type_data = ( subtree ) ? ( cid_type_data_t * ) wmem_tree_lookup32_le ( subtree , frame_number ) : NULL ;
if ( cid_type_data & & cid_type_data - > type = = STREAM_TYPE_MEDIA ) {
2012-11-05 11:42:10 +00:00
/* AVDTP Media */
if ( ! cid_type_data - > sep ) {
ti = proto_tree_add_item ( tree , proto_btavdtp , tvb , offset , - 1 , ENC_NA ) ;
btavdtp_tree = proto_item_add_subtree ( ti , ett_btavdtp ) ;
col_append_fstr ( pinfo - > cinfo , COL_INFO , " Media stream on cid=0x%04x " , l2cap_data - > cid ) ;
2012-11-12 14:53:46 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_data , tvb , offset , - 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
} else {
col_append_fstr ( pinfo - > cinfo , COL_INFO , " Media stream ACP SEID [%u - %s %s] " ,
2014-02-24 10:50:37 +00:00
cid_type_data - > sep - > seid , get_sep_media_type (
cid_type_data - > interface_id ,
cid_type_data - > adapter_id ,
cid_type_data - > chandle ,
direction ,
cid_type_data - > sep - > seid ,
pinfo - > fd - > num ) ,
get_sep_type ( cid_type_data - > interface_id ,
cid_type_data - > adapter_id ,
cid_type_data - > chandle ,
direction ,
cid_type_data - > sep - > seid ,
pinfo - > fd - > num ) ) ;
2012-11-05 11:42:10 +00:00
if ( cid_type_data - > sep - > media_type = = MEDIA_TYPE_AUDIO ) {
2013-11-03 15:25:52 +00:00
sep_data_t sep_data ;
2014-03-03 07:51:46 +00:00
sep_data . codec = cid_type_data - > sep - > codec ;
sep_data . acp_seid = cid_type_data - > sep - > seid ;
sep_data . int_seid = cid_type_data - > sep - > int_seid ;
2013-11-03 15:25:52 +00:00
sep_data . content_protection_type = cid_type_data - > sep - > content_protection_type ;
2013-02-19 23:17:07 +00:00
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
2013-11-03 15:25:52 +00:00
call_dissector_with_data ( bta2dp_handle , next_tvb , pinfo , tree , & sep_data ) ;
2012-11-05 11:42:10 +00:00
} else if ( cid_type_data - > sep - > media_type = = MEDIA_TYPE_VIDEO ) {
2013-11-03 15:25:52 +00:00
sep_data_t sep_data ;
2014-03-03 07:51:46 +00:00
sep_data . codec = cid_type_data - > sep - > codec ;
sep_data . acp_seid = cid_type_data - > sep - > seid ;
sep_data . int_seid = cid_type_data - > sep - > int_seid ;
2013-11-03 15:25:52 +00:00
sep_data . content_protection_type = cid_type_data - > sep - > content_protection_type ;
2013-02-19 23:17:07 +00:00
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
2013-11-03 15:25:52 +00:00
call_dissector_with_data ( btvdp_handle , next_tvb , pinfo , tree , & sep_data ) ;
2012-11-05 11:42:10 +00:00
} else {
ti = proto_tree_add_item ( tree , proto_btavdtp , tvb , offset , - 1 , ENC_NA ) ;
btavdtp_tree = proto_item_add_subtree ( ti , ett_btavdtp ) ;
col_append_fstr ( pinfo - > cinfo , COL_INFO , " Media stream on cid=0x%04x " , l2cap_data - > cid ) ;
2012-11-12 14:53:46 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_data , tvb , offset , - 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
}
}
2013-11-02 20:10:51 +00:00
return tvb_length ( tvb ) ;
2014-02-24 10:50:37 +00:00
} else if ( ! ( cid_type_data & & cid_type_data - > type = = STREAM_TYPE_SIGNAL ) ) {
2012-11-05 11:42:10 +00:00
/* AVDTP not signaling - Unknown Media stream */
ti = proto_tree_add_item ( tree , proto_btavdtp , tvb , offset , - 1 , ENC_NA ) ;
btavdtp_tree = proto_item_add_subtree ( ti , ett_btavdtp ) ;
col_append_fstr ( pinfo - > cinfo , COL_INFO , " Unknown stream on cid=0x%04x " , l2cap_data - > cid ) ;
2012-11-12 14:53:46 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_data , tvb , offset , - 1 , ENC_NA ) ;
2013-11-02 20:10:51 +00:00
return tvb_length ( tvb ) ;
2012-11-05 11:42:10 +00:00
}
}
ti = proto_tree_add_item ( tree , proto_btavdtp , tvb , offset , - 1 , ENC_NA ) ;
btavdtp_tree = proto_item_add_subtree ( ti , ett_btavdtp ) ;
/* AVDTP signaling*/
message_type = ( tvb_get_guint8 ( tvb , offset ) & AVDTP_MESSAGE_TYPE_MASK ) ;
packet_type = ( tvb_get_guint8 ( tvb , offset ) & AVDTP_PACKET_TYPE_MASK ) > > 2 ;
2013-10-26 02:24:04 +00:00
signal_item = proto_tree_add_item ( btavdtp_tree , hf_btavdtp_signal , tvb , offset ,
( packet_type = = PACKET_TYPE_START ) ? 3 : 2 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
signal_tree = proto_item_add_subtree ( signal_item , ett_btavdtp_sep ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( signal_tree , hf_btavdtp_transaction , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( signal_tree , hf_btavdtp_packet_type , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( signal_tree , hf_btavdtp_message_type , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
if ( packet_type = = PACKET_TYPE_START ) {
offset + = 1 ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( signal_tree , hf_btavdtp_number_of_signal_packets , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
}
if ( packet_type = = PACKET_TYPE_CONTINUE | | packet_type = = PACKET_TYPE_END ) goto LABEL_data ;
offset + = 1 ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( signal_tree , hf_btavdtp_rfa0 , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( signal_tree , hf_btavdtp_signal_id , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
signal_id = tvb_get_guint8 ( tvb , offset ) & AVDTP_SIGNAL_ID_MASK ;
2013-10-26 02:24:04 +00:00
proto_item_append_text ( signal_item , " : %s (%s) " ,
2013-02-21 21:04:59 +00:00
val_to_str_const ( signal_id , signal_id_vals , " Unknown signal " ) ,
val_to_str_const ( message_type , message_type_vals , " Unknown message type " ) ) ;
2012-11-05 11:42:10 +00:00
col_append_fstr ( pinfo - > cinfo , COL_INFO , " %s - %s " ,
2013-02-21 21:04:59 +00:00
val_to_str_const ( message_type , message_type_vals , " Unknown message type " ) ,
val_to_str_const ( signal_id , signal_id_vals , " Unknown signal " ) ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
if ( message_type ! = MESSAGE_TYPE_GENERAL_REJECT ) switch ( signal_id ) {
case SIGNAL_ID_DISCOVER :
if ( message_type = = MESSAGE_TYPE_COMMAND ) break ;
if ( message_type = = MESSAGE_TYPE_REJECT ) {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_error_code , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
break ;
}
2014-02-24 10:50:37 +00:00
offset = dissect_sep ( tvb , pinfo , btavdtp_tree , offset ,
interface_id , adapter_id , chandle ) ;
2012-11-05 11:42:10 +00:00
break ;
case SIGNAL_ID_GET_CAPABILITIES :
case SIGNAL_ID_GET_ALL_CAPABILITIES :
if ( message_type = = MESSAGE_TYPE_COMMAND ) {
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , 0 , NULL , interface_id ,
adapter_id , chandle , frame_number ) ;
2012-11-05 11:42:10 +00:00
break ;
}
if ( message_type = = MESSAGE_TYPE_REJECT ) {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_error_code , tvb , offset , 1 , ENC_NA ) ;
2014-02-04 10:15:46 +00:00
offset + = 1 ;
2012-11-05 11:42:10 +00:00
break ;
}
2013-11-03 15:25:52 +00:00
offset = dissect_capabilities ( tvb , pinfo , btavdtp_tree , offset , NULL , NULL ) ;
2012-11-05 11:42:10 +00:00
break ;
case SIGNAL_ID_SET_CONFIGURATION :
if ( message_type = = MESSAGE_TYPE_COMMAND ) {
2014-03-03 07:51:46 +00:00
guint32 int_seid ;
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , 0 , & seid , interface_id ,
adapter_id , chandle , frame_number ) ;
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
2014-03-03 07:51:46 +00:00
SEID_INT , 0 , & int_seid , interface_id ,
2014-02-24 10:50:37 +00:00
adapter_id , chandle , frame_number ) ;
2013-11-03 15:25:52 +00:00
offset = dissect_capabilities ( tvb , pinfo , btavdtp_tree , offset , & codec , & content_protection_type ) ;
2012-11-05 11:42:10 +00:00
key [ 0 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 0 ] . key = & interface_id ;
2012-11-05 11:42:10 +00:00
key [ 1 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 1 ] . key = & adapter_id ;
key [ 2 ] . length = 1 ;
key [ 2 ] . key = & chandle ;
key [ 3 ] . length = 1 ;
key [ 3 ] . key = & direction ;
key [ 4 ] . length = 1 ;
key [ 4 ] . key = & seid ;
key [ 5 ] . length = 0 ;
key [ 5 ] . key = NULL ;
subtree = ( wmem_tree_t * ) wmem_tree_lookup32_array ( sep_list , key ) ;
sep = ( subtree ) ? ( sep_entry_t * ) wmem_tree_lookup32_le ( subtree , frame_number ) : NULL ;
if ( sep ) {
2012-11-05 11:42:10 +00:00
sep - > codec = codec ;
2013-11-03 15:25:52 +00:00
sep - > content_protection_type = content_protection_type ;
2014-03-03 07:51:46 +00:00
sep - > int_seid = int_seid ;
2012-11-05 11:42:10 +00:00
}
break ;
}
if ( message_type = = MESSAGE_TYPE_REJECT ) {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_service_category , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
2014-02-04 10:15:46 +00:00
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_error_code , tvb , offset , 1 , ENC_NA ) ;
2014-02-04 10:15:46 +00:00
offset + = 1 ;
2012-11-05 11:42:10 +00:00
break ;
}
break ;
case SIGNAL_ID_GET_CONFIGURATION :
if ( message_type = = MESSAGE_TYPE_COMMAND ) {
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , 0 , NULL , interface_id ,
adapter_id , chandle , frame_number ) ;
2012-11-05 11:42:10 +00:00
break ;
}
if ( message_type = = MESSAGE_TYPE_REJECT ) {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_error_code , tvb , offset , 1 , ENC_NA ) ;
2014-02-04 10:15:46 +00:00
offset + = 1 ;
2012-11-05 11:42:10 +00:00
break ;
}
2013-11-03 15:25:52 +00:00
offset = dissect_capabilities ( tvb , pinfo , btavdtp_tree , offset , NULL , NULL ) ;
2012-11-05 11:42:10 +00:00
break ;
case SIGNAL_ID_RECONFIGURE :
if ( message_type = = MESSAGE_TYPE_COMMAND ) {
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , 0 , & seid , interface_id ,
adapter_id , chandle , frame_number ) ;
2013-11-03 15:25:52 +00:00
offset = dissect_capabilities ( tvb , pinfo , btavdtp_tree , offset , & codec , & content_protection_type ) ;
2012-11-05 11:42:10 +00:00
key [ 0 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 0 ] . key = & interface_id ;
2012-11-05 11:42:10 +00:00
key [ 1 ] . length = 1 ;
2014-02-24 10:50:37 +00:00
key [ 1 ] . key = & adapter_id ;
key [ 2 ] . length = 1 ;
key [ 2 ] . key = & chandle ;
key [ 3 ] . length = 1 ;
key [ 3 ] . key = & direction ;
key [ 4 ] . length = 1 ;
key [ 4 ] . key = & seid ;
key [ 5 ] . length = 0 ;
key [ 5 ] . key = NULL ;
subtree = ( wmem_tree_t * ) wmem_tree_lookup32_array ( sep_list , key ) ;
sep = ( subtree ) ? ( sep_entry_t * ) wmem_tree_lookup32_le ( subtree , frame_number ) : NULL ;
if ( sep ) {
2012-11-05 11:42:10 +00:00
sep - > codec = codec ;
2013-11-03 15:25:52 +00:00
sep - > content_protection_type = content_protection_type ;
2012-11-05 11:42:10 +00:00
}
break ;
}
if ( message_type = = MESSAGE_TYPE_REJECT ) {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_service_category , tvb , offset , 1 , ENC_NA ) ;
2012-11-05 11:42:10 +00:00
offset + = 1 ;
2014-02-04 10:15:46 +00:00
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_error_code , tvb , offset , 1 , ENC_NA ) ;
2014-02-04 10:15:46 +00:00
offset + = 1 ;
2012-11-05 11:42:10 +00:00
break ;
}
break ;
case SIGNAL_ID_OPEN :
if ( message_type = = MESSAGE_TYPE_COMMAND ) {
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , 0 , & seid , interface_id ,
adapter_id , chandle , frame_number ) ;
if ( ! pinfo - > fd - > flags . visited ) {
key [ 0 ] . length = 1 ;
key [ 0 ] . key = & interface_id ;
key [ 1 ] . length = 1 ;
key [ 1 ] . key = & adapter_id ;
key [ 2 ] . length = 1 ;
key [ 2 ] . key = & chandle ;
key [ 3 ] . length = 1 ;
key [ 3 ] . key = & direction ;
key [ 4 ] . length = 1 ;
key [ 4 ] . key = & seid ;
key [ 5 ] . length = 0 ;
key [ 5 ] . key = NULL ;
subtree = ( wmem_tree_t * ) wmem_tree_lookup32_array ( sep_list , key ) ;
sep = ( subtree ) ? ( sep_entry_t * ) wmem_tree_lookup32_le ( subtree , frame_number ) : NULL ;
if ( sep ) {
sep - > state = SEP_STATE_OPEN ;
key [ 3 ] . length = 1 ;
key [ 3 ] . key = & frame_number ;
key [ 4 ] . length = 0 ;
key [ 4 ] . key = NULL ;
wmem_tree_insert32_array ( sep_open , key , sep ) ;
}
2012-11-05 11:42:10 +00:00
}
break ;
}
if ( message_type = = MESSAGE_TYPE_REJECT ) {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_error_code , tvb , offset , 1 , ENC_NA ) ;
2014-02-04 10:15:46 +00:00
offset + = 1 ;
2012-11-05 11:42:10 +00:00
break ;
}
break ;
case SIGNAL_ID_START :
if ( message_type = = MESSAGE_TYPE_COMMAND ) {
i_sep = 1 ;
2013-04-02 21:13:02 +00:00
while ( tvb_length_remaining ( tvb , offset ) > 0 ) {
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , i_sep , NULL ,
interface_id , adapter_id , chandle , frame_number ) ;
2012-11-05 11:42:10 +00:00
i_sep + = 1 ;
}
break ;
}
if ( message_type = = MESSAGE_TYPE_REJECT ) {
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , 0 , NULL ,
interface_id , adapter_id , chandle , frame_number ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_error_code , tvb , offset , 1 , ENC_NA ) ;
2014-02-04 10:15:46 +00:00
offset + = 1 ;
2012-11-05 11:42:10 +00:00
break ;
}
break ;
case SIGNAL_ID_CLOSE :
if ( message_type = = MESSAGE_TYPE_COMMAND ) {
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , 0 , NULL , interface_id ,
adapter_id , chandle , frame_number ) ;
2012-11-05 11:42:10 +00:00
break ;
}
if ( message_type = = MESSAGE_TYPE_REJECT ) {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_error_code , tvb , offset , 1 , ENC_NA ) ;
2014-02-04 10:15:46 +00:00
offset + = 1 ;
2012-11-05 11:42:10 +00:00
break ;
}
break ;
case SIGNAL_ID_SUSPEND :
if ( message_type = = MESSAGE_TYPE_COMMAND ) {
i_sep = 1 ;
2013-04-02 21:13:02 +00:00
while ( tvb_length_remaining ( tvb , offset ) > 0 ) {
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , i_sep , NULL ,
interface_id , adapter_id , chandle , frame_number ) ;
2012-11-05 11:42:10 +00:00
i_sep + = 1 ;
}
break ;
}
if ( message_type = = MESSAGE_TYPE_REJECT ) {
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , 0 , NULL , interface_id ,
adapter_id , chandle , frame_number ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_error_code , tvb , offset , 1 , ENC_NA ) ;
2014-02-04 10:15:46 +00:00
offset + = 1 ;
2012-11-05 11:42:10 +00:00
break ;
}
break ;
case SIGNAL_ID_ABORT :
if ( message_type = = MESSAGE_TYPE_COMMAND ) {
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , 0 , NULL , interface_id ,
adapter_id , chandle , frame_number ) ;
2012-11-05 11:42:10 +00:00
break ;
}
if ( message_type = = MESSAGE_TYPE_REJECT ) {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_error_code , tvb , offset , 1 , ENC_NA ) ;
2014-02-04 10:15:46 +00:00
offset + = 1 ;
2012-11-05 11:42:10 +00:00
break ;
}
break ;
case SIGNAL_ID_SECURITY_CONTROL :
if ( message_type = = MESSAGE_TYPE_COMMAND ) {
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , 0 , NULL , interface_id ,
adapter_id , chandle , frame_number ) ;
2012-11-05 11:42:10 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_data , tvb , offset , - 1 , ENC_NA ) ;
offset + = tvb_length_remaining ( tvb , offset ) ;
break ;
}
if ( message_type = = MESSAGE_TYPE_REJECT ) {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_error_code , tvb , offset , 1 , ENC_NA ) ;
2014-02-04 10:15:46 +00:00
offset + = 1 ;
2012-11-05 11:42:10 +00:00
break ;
}
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_data , tvb , offset , - 1 , ENC_NA ) ;
offset + = tvb_length_remaining ( tvb , offset ) ;
break ;
case SIGNAL_ID_DELAY_REPORT :
if ( message_type = = MESSAGE_TYPE_COMMAND ) {
2013-03-18 06:04:09 +00:00
proto_item * pitem ;
2012-11-05 11:42:10 +00:00
delay = tvb_get_ntohs ( tvb , offset + 1 ) ;
col_append_fstr ( pinfo - > cinfo , COL_INFO , " (%u.%u ms) " , delay / 10 , delay % 10 ) ;
2014-02-24 10:50:37 +00:00
offset = dissect_seid ( tvb , pinfo , btavdtp_tree , offset ,
SEID_ACP , 0 , NULL ,
interface_id , adapter_id , chandle , frame_number ) ;
2012-11-05 11:42:10 +00:00
pitem = proto_tree_add_item ( btavdtp_tree , hf_btavdtp_delay , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
proto_item_append_text ( pitem , " (1/10 ms) " ) ;
offset + = 2 ;
break ;
}
if ( message_type = = MESSAGE_TYPE_REJECT ) {
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_error_code , tvb , offset , 1 , ENC_NA ) ;
2014-02-04 10:15:46 +00:00
offset + = 1 ;
2012-11-05 11:42:10 +00:00
break ;
}
break ;
}
LABEL_data :
if ( tvb_length_remaining ( tvb , offset ) > 0 ) {
proto_tree_add_item ( btavdtp_tree , hf_btavdtp_data , tvb , offset , - 1 , ENC_NA ) ;
}
2013-11-02 19:20:04 +00:00
return offset ;
2012-11-05 11:42:10 +00:00
}
void
proto_register_btavdtp ( void )
{
module_t * module ;
static hf_register_info hf [ ] = {
2013-10-26 02:24:04 +00:00
{ & hf_btavdtp_signal ,
{ " Signal " , " btavdtp.signal " ,
FT_NONE , BASE_NONE , NULL , 0x00 ,
NULL , HFILL }
} ,
2012-11-05 11:42:10 +00:00
{ & hf_btavdtp_message_type ,
{ " Message Type " , " btavdtp.message_type " ,
FT_UINT8 , BASE_HEX , VALS ( message_type_vals ) , AVDTP_MESSAGE_TYPE_MASK ,
NULL , HFILL }
} ,
{ & hf_btavdtp_packet_type ,
{ " Packet Type " , " btavdtp.packet_type " ,
FT_UINT8 , BASE_HEX , VALS ( packet_type_vals ) , AVDTP_PACKET_TYPE_MASK ,
NULL , HFILL }
} ,
{ & hf_btavdtp_transaction ,
{ " Transaction " , " btavdtp.transaction " ,
FT_UINT8 , BASE_HEX , NULL , AVDTP_TRANSACTION_MASK ,
NULL , HFILL }
} ,
{ & hf_btavdtp_signal_id ,
2013-10-26 02:24:04 +00:00
{ " Signal " , " btavdtp.signal_id " ,
2012-11-05 11:42:10 +00:00
FT_UINT8 , BASE_HEX , VALS ( signal_id_vals ) , AVDTP_SIGNAL_ID_MASK ,
NULL , HFILL }
} ,
{ & hf_btavdtp_rfa0 ,
{ " RFA " , " btavdtp.rfa0 " ,
FT_UINT8 , BASE_HEX , NULL , AVDTP_RFA0_MASK ,
NULL , HFILL }
} ,
2012-12-02 03:25:38 +00:00
{ & hf_btavdtp_number_of_signal_packets ,
{ " Number of signal packets " , " btavdtp.num_signal_packets " ,
FT_UINT8 , BASE_DEC , NULL , 0 ,
NULL , HFILL }
} ,
2012-11-05 11:42:10 +00:00
{ & hf_btavdtp_error_code ,
{ " Error Code " , " btavdtp.error_code " ,
FT_UINT8 , BASE_HEX , VALS ( error_code_vals ) , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sep_seid ,
{ " SEID " , " btavdtp.sep_seid " ,
FT_UINT8 , BASE_DEC , NULL , 0xFC ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sep_inuse ,
{ " In Use " , " btavdtp.sep_inuse " ,
FT_UINT8 , BASE_HEX , VALS ( true_false ) , 0x02 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sep_rfa0 ,
{ " RFA0 " , " btavdtp.sep_rfa0 " ,
FT_UINT8 , BASE_HEX , NULL , 0x01 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sep_media_type ,
{ " Media Type " , " btavdtp.sep_media_type " ,
FT_UINT8 , BASE_HEX , VALS ( media_type_vals ) , 0xF0 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sep_type ,
{ " Type " , " btavdtp.sep_type " ,
FT_UINT8 , BASE_HEX , VALS ( sep_type_vals ) , 0x08 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sep_rfa1 ,
{ " RFA1 " , " btavdtp.sep_rfa1 " ,
FT_UINT8 , BASE_HEX , NULL , 0x07 ,
NULL , HFILL }
} ,
2013-10-26 02:24:04 +00:00
{ & hf_btavdtp_acp_sep ,
{ " ACP SEP " , " btavdtp.acp_sep " ,
FT_NONE , BASE_NONE , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_acp_seid_item ,
{ " ACP SEID " , " btavdtp.acp_seid_item " ,
FT_NONE , BASE_NONE , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_int_seid_item ,
{ " INT SEID " , " btavdtp.int_seid_item " ,
FT_NONE , BASE_NONE , NULL , 0x00 ,
NULL , HFILL }
} ,
2012-11-05 11:42:10 +00:00
{ & hf_btavdtp_acp_seid ,
{ " ACP SEID " , " btavdtp.acp_seid " ,
FT_UINT8 , BASE_DEC , NULL , 0xFC ,
NULL , HFILL }
} ,
{ & hf_btavdtp_int_seid ,
{ " INT SEID " , " btavdtp.int_seid " ,
FT_UINT8 , BASE_DEC , NULL , 0xFC ,
NULL , HFILL }
} ,
{ & hf_btavdtp_rfa_seid ,
{ " RFA " , " btavdtp.rfa_seid " ,
FT_UINT8 , BASE_HEX , NULL , 0x03 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_service_category ,
{ " Service Category " , " btavdtp.service_category " ,
FT_UINT8 , BASE_HEX , VALS ( service_category_vals ) , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_length_of_service_category ,
{ " Length of Service Category " , " btavdtp.length_of_service_category " ,
FT_UINT8 , BASE_HEX , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_delay ,
{ " Delay " , " btavdtp.delay " ,
FT_UINT16 , BASE_DEC , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_recovery_type ,
{ " Service Category " , " btavdtp.recovery_type " ,
FT_UINT8 , BASE_HEX , VALS ( recovery_type_vals ) , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_maximum_recovery_window_size ,
{ " Service Category " , " btavdtp.maximum_recovery_window_size " ,
FT_UINT8 , BASE_HEX , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_maximum_number_of_media_packet_in_parity_code ,
{ " Service Category " , " btavdtp.maximum_number_of_media_packet_in_parity_code " ,
FT_UINT8 , BASE_HEX , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_multiplexing_fragmentation ,
{ " Fragmentation " , " btavdtp.multiplexing_fragmentation " ,
FT_UINT8 , BASE_HEX , VALS ( true_false ) , 0x80 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_multiplexing_rfa ,
{ " RFA " , " btavdtp.multiplexing_rfa " ,
FT_UINT8 , BASE_HEX , NULL , 0x7F ,
NULL , HFILL }
} ,
{ & hf_btavdtp_multiplexing_tsid ,
{ " TSID " , " btavdtp.multiplexing_tsid " ,
FT_UINT8 , BASE_HEX , VALS ( multiplexing_tsid_vals ) , 0xF8 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_multiplexing_tcid ,
{ " TCID " , " btavdtp.multiplexing_tcid " ,
FT_UINT8 , BASE_HEX , VALS ( multiplexing_tcid_vals ) , 0xF8 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_multiplexing_entry_rfa ,
{ " RFA " , " btavdtp.multiplexing_entry_rfa " ,
FT_UINT8 , BASE_HEX , NULL , 0x07 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_header_compression_backch ,
{ " BackCh " , " btavdtp.header_compression_backch " ,
FT_UINT8 , BASE_HEX , VALS ( true_false ) , 0x80 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_header_compression_media ,
{ " Media " , " btavdtp.header_compression_media " ,
FT_UINT8 , BASE_HEX , VALS ( true_false ) , 0x40 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_header_compression_recovery ,
{ " Recovery " , " btavdtp.header_compression_recovery " ,
FT_UINT8 , BASE_HEX , VALS ( true_false ) , 0x20 ,
NULL , HFILL }
} ,
2012-12-03 11:39:22 +00:00
{ & hf_btavdtp_header_compression_rfa ,
{ " RFA " , " btavdtp.header_compression_rfa " ,
FT_UINT8 , BASE_HEX , NULL , 0x1f ,
NULL , HFILL }
} ,
2012-11-05 11:42:10 +00:00
{ & hf_btavdtp_content_protection_type ,
{ " Type " , " btavdtp.content_protection_type " ,
2013-11-03 15:25:52 +00:00
FT_UINT16 , BASE_HEX , VALS ( content_protection_type_vals ) , 0x0000 ,
2012-11-05 11:42:10 +00:00
NULL , HFILL }
} ,
{ & hf_btavdtp_media_codec_media_type ,
{ " Media Type " , " btavdtp.media_codec_media_type " ,
FT_UINT8 , BASE_HEX , VALS ( media_type_vals ) , 0xF0 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_media_codec_rfa ,
{ " RFA " , " btavdtp.media_codec_rfa " ,
FT_UINT8 , BASE_HEX , NULL , 0x0F ,
NULL , HFILL }
} ,
{ & hf_btavdtp_media_codec_audio_type ,
{ " Media Codec Audio Type " , " btavdtp.media_codec_audio_type " ,
FT_UINT8 , BASE_HEX , VALS ( media_codec_audio_type_vals ) , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_media_codec_video_type ,
{ " Media Codec Video Type " , " btavdtp.media_codec_video_type " ,
FT_UINT8 , BASE_HEX , VALS ( media_codec_video_type_vals ) , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_media_codec_unknown_type ,
{ " Media Codec Unknown Type " , " btavdtp.media_codec_unknown_type " ,
FT_UINT8 , BASE_HEX , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_sampling_frequency_16000 ,
{ " Sampling Frequency 16000 Hz " , " btavdtp.codec.sbc.sampling_frequency.16000 " ,
FT_BOOLEAN , 8 , NULL , 0x80 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_sampling_frequency_32000 ,
{ " Sampling Frequency 32000 Hz " , " btavdtp.codec.sbc.sampling_frequency.32000 " ,
FT_BOOLEAN , 8 , NULL , 0x40 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_sampling_frequency_44100 ,
{ " Sampling Frequency 44100 Hz " , " btavdtp.codec.sbc.sampling_frequency.44100 " ,
FT_BOOLEAN , 8 , NULL , 0x20 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_sampling_frequency_48000 ,
{ " Sampling Frequency 48000 Hz " , " btavdtp.codec.sbc.sampling_frequency.48000 " ,
FT_BOOLEAN , 8 , NULL , 0x10 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_channel_mode_mono ,
{ " Channel Mode Mono " , " btavdtp.codec.sbc.channel_mode.mono " ,
FT_BOOLEAN , 8 , NULL , 0x08 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_channel_mode_dual_channel ,
{ " Channel Mode Dual Channel " , " btavdtp.codec.sbc.channel_mode.dual_channel " ,
FT_BOOLEAN , 8 , NULL , 0x04 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_channel_mode_stereo ,
{ " Channel Mode Stereo " , " btavdtp.codec.sbc.channel_mode.stereo " ,
FT_BOOLEAN , 8 , NULL , 0x02 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_channel_mode_joint_stereo ,
{ " Channel Mode Joint Stereo " , " btavdtp.codec.sbc.channel_mode.joint_stereo " ,
FT_BOOLEAN , 8 , NULL , 0x01 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_block_4 ,
2014-03-16 12:07:36 +00:00
{ " Block Length 4 " , " btavdtp.codec.sbc.block.4 " ,
2012-11-05 11:42:10 +00:00
FT_BOOLEAN , 8 , NULL , 0x80 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_block_8 ,
2014-03-16 12:07:36 +00:00
{ " Block Length 8 " , " btavdtp.codec.sbc.block.8 " ,
2012-11-05 11:42:10 +00:00
FT_BOOLEAN , 8 , NULL , 0x40 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_block_12 ,
2014-03-16 12:07:36 +00:00
{ " Block Length 12 " , " btavdtp.codec.sbc.block.12 " ,
2012-11-05 11:42:10 +00:00
FT_BOOLEAN , 8 , NULL , 0x20 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_block_16 ,
2014-03-16 12:07:36 +00:00
{ " Block Length 16 " , " btavdtp.codec.sbc.block.16 " ,
2012-11-05 11:42:10 +00:00
FT_BOOLEAN , 8 , NULL , 0x10 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_subbands_4 ,
2014-03-16 12:07:36 +00:00
{ " Subbands 4 " , " btavdtp.codec.sbc.subbands.4 " ,
2012-11-05 11:42:10 +00:00
FT_BOOLEAN , 8 , NULL , 0x08 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_subbands_8 ,
2014-03-16 12:07:36 +00:00
{ " Subbands 8 " , " btavdtp.codec.sbc.subbands.8 " ,
2012-11-05 11:42:10 +00:00
FT_BOOLEAN , 8 , NULL , 0x04 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_allocation_method_snr ,
2014-03-16 12:07:36 +00:00
{ " Allocation Method SNR " , " btavdtp.codec.sbc.allocation_method.snr " ,
2012-11-05 11:42:10 +00:00
FT_BOOLEAN , 8 , NULL , 0x02 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_allocation_method_loudness ,
2014-03-16 12:07:36 +00:00
{ " Allocation Method Loudness " , " btavdtp.codec.sbc.allocation_method.loudness " ,
2012-11-05 11:42:10 +00:00
FT_BOOLEAN , 8 , NULL , 0x01 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_min_bitpool ,
{ " Minumum Bitpool " , " btavdtp.codec.sbc.minimum_bitpool " ,
FT_UINT8 , BASE_DEC , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_sbc_max_bitpool ,
{ " Maximum Bitpool " , " btavdtp.codec.sbc.maximum_bitpool " ,
FT_UINT8 , BASE_DEC , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_layer_1 ,
{ " MP1 " , " btavdtp.codec.mpeg12.layer_1 " ,
FT_BOOLEAN , 8 , NULL , 0x80 ,
" MPEG Layer 1 " , HFILL }
} ,
{ & hf_btavdtp_mpeg12_layer_2 ,
{ " MP2 " , " btavdtp.codec.mpeg12.layer_2 " ,
FT_BOOLEAN , 8 , NULL , 0x40 ,
" MPEG Layer 2 " , HFILL }
} ,
{ & hf_btavdtp_mpeg12_layer_3 ,
{ " MP3 " , " btavdtp.codec.mpeg12.layer_3 " ,
FT_BOOLEAN , 8 , NULL , 0x20 ,
" MPEG Layer 3 " , HFILL }
} ,
{ & hf_btavdtp_mpeg12_crc_protection ,
{ " CRC Protection " , " btavdtp.codec.mpeg12.crc_protection " ,
FT_BOOLEAN , 8 , NULL , 0x10 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_channel_mode_mono ,
{ " Channel Mode Mono " , " btavdtp.codec.mpeg12.channel_mode.mono " ,
FT_BOOLEAN , 8 , NULL , 0x08 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_channel_mode_dual_channel ,
{ " Channel Mode Dual Channel " , " btavdtp.codec.mpeg12.channel_mode.dual_channel " ,
FT_BOOLEAN , 8 , NULL , 0x04 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_channel_mode_stereo ,
{ " Channel Mode Stereo " , " btavdtp.codec.mpeg12.channel_mode.stereo " ,
FT_BOOLEAN , 8 , NULL , 0x02 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_channel_mode_joint_stereo ,
{ " Channel Mode Joint Stereo " , " btavdtp.codec.mpeg12.channel_mode.joint_stereo " ,
FT_BOOLEAN , 8 , NULL , 0x01 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_rfa ,
{ " RFA " , " btavdtp.codec.mpeg12.rfa " ,
FT_BOOLEAN , 8 , NULL , 0x80 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_mpf_2 ,
2014-03-21 11:36:28 +00:00
{ " Media Payload Format 2 " , " btavdtp.codec.mpeg12.mpf_2 " ,
2012-11-05 11:42:10 +00:00
FT_BOOLEAN , 8 , NULL , 0x40 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_sampling_frequency_16000 ,
{ " Sampling Frequency 16000 Hz " , " btavdtp.codec.sbc.sampling_frequency.16000 " ,
FT_BOOLEAN , 8 , NULL , 0x20 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_sampling_frequency_22050 ,
{ " Sampling Frequency 22050 Hz " , " btavdtp.codec.sbc.sampling_frequency.22050 " ,
FT_BOOLEAN , 8 , NULL , 0x10 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_sampling_frequency_24000 ,
{ " Sampling Frequency 24000 Hz " , " btavdtp.codec.sbc.sampling_frequency.24000 " ,
FT_BOOLEAN , 8 , NULL , 0x08 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_sampling_frequency_32000 ,
{ " Sampling Frequency 32000 Hz " , " btavdtp.codec.sbc.sampling_frequency.32000 " ,
FT_BOOLEAN , 8 , NULL , 0x04 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_sampling_frequency_44100 ,
{ " Sampling Frequency 44100 Hz " , " btavdtp.codec.sbc.sampling_frequency.44100 " ,
FT_BOOLEAN , 8 , NULL , 0x02 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_sampling_frequency_48000 ,
{ " Sampling Frequency 48000 Hz " , " btavdtp.codec.sbc.sampling_frequency.48000 " ,
FT_BOOLEAN , 8 , NULL , 0x01 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_vbr_supported ,
{ " VBR Supported " , " btavdtp.codec.mpeg12.vbr " ,
FT_BOOLEAN , 16 , NULL , 0x8000 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg12_bit_rate ,
{ " Bit Rate " , " btavdtp.codec.mpeg12.bit_rate " ,
FT_UINT16 , BASE_HEX , NULL , 0x7FFF ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_object_type_mpeg2_aac_lc ,
{ " MPEG2 ACC LC " , " btavdtp.codec.mpeg24.object_type.mpeg2_aac_lc " ,
FT_UINT8 , BASE_HEX , NULL , 0x80 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_object_type_mpeg4_aac_lc ,
{ " MPEG4 ACC LC " , " btavdtp.codec.mpeg24.object_type.mpeg4_aac_lc " ,
FT_UINT8 , BASE_HEX , NULL , 0x40 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_object_type_mpeg4_aac_ltp ,
{ " MPEG4 ACC LTP " , " btavdtp.codec.mpeg24.object_type.mpeg4_aac_ltp " ,
FT_UINT8 , BASE_HEX , NULL , 0x20 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_object_type_mpeg4_aac_scalable ,
{ " MPEG4 ACC Scalable " , " btavdtp.codec.mpeg24.object_type.mpeg4_aac_scalable " ,
FT_UINT8 , BASE_HEX , NULL , 0x10 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_object_type_rfa ,
{ " RFA " , " btavdtp.codec.mpeg24.object_type.rfa " ,
FT_UINT8 , BASE_HEX , NULL , 0x0F ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_sampling_frequency_8000 ,
{ " Sampling Frequency 8000 Hz " , " btavdtp.codec.mpeg24.sampling_frequency.8000 " ,
FT_BOOLEAN , 8 , NULL , 0x80 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_sampling_frequency_11025 ,
{ " Sampling Frequency 11025 Hz " , " btavdtp.codec.mpeg24.sampling_frequency.11025 " ,
FT_BOOLEAN , 8 , NULL , 0x40 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_sampling_frequency_12000 ,
{ " Sampling Frequency 12000 Hz " , " btavdtp.codec.mpeg24.sampling_frequency.12000 " ,
FT_BOOLEAN , 8 , NULL , 0x20 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_sampling_frequency_16000 ,
{ " Sampling Frequency 16000 Hz " , " btavdtp.codec.mpeg24.sampling_frequency.16000 " ,
FT_BOOLEAN , 8 , NULL , 0x10 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_sampling_frequency_22050 ,
{ " Sampling Frequency 22050 Hz " , " btavdtp.codec.mpeg24.sampling_frequency.22050 " ,
FT_BOOLEAN , 8 , NULL , 0x08 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_sampling_frequency_24000 ,
{ " Sampling Frequency 24000 Hz " , " btavdtp.codec.mpeg24.sampling_frequency.24000 " ,
FT_BOOLEAN , 8 , NULL , 0x04 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_sampling_frequency_32000 ,
{ " Sampling Frequency 32000 Hz " , " btavdtp.codec.mpeg24.sampling_frequency.32000 " ,
FT_BOOLEAN , 8 , NULL , 0x02 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_sampling_frequency_44100 ,
{ " Sampling Frequency 44100 Hz " , " btavdtp.codec.mpeg24.sampling_frequency.44100 " ,
FT_BOOLEAN , 8 , NULL , 0x01 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_sampling_frequency_48000 ,
{ " Sampling Frequency 48000 Hz " , " btavdtp.codec.mpeg24.sampling_frequency.48000 " ,
FT_BOOLEAN , 8 , NULL , 0x80 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_sampling_frequency_64000 ,
{ " Sampling Frequency 64000 Hz " , " btavdtp.codec.mpeg24.sampling_frequency.64000 " ,
FT_BOOLEAN , 8 , NULL , 0x40 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_sampling_frequency_88200 ,
{ " Sampling Frequency 88200 Hz " , " btavdtp.codec.mpeg24.sampling_frequency.88200 " ,
FT_BOOLEAN , 8 , NULL , 0x20 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_sampling_frequency_96000 ,
{ " Sampling Frequency 96000 Hz " , " btavdtp.codec.mpeg24.sampling_frequency.96000 " ,
FT_BOOLEAN , 8 , NULL , 0x10 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_channels_1 ,
{ " Channels 1 " , " btavdtp.codec.mpeg24.channels.1 " ,
FT_BOOLEAN , 8 , NULL , 0x08 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_channels_2 ,
{ " Channels 2 " , " btavdtp.codec.mpeg24.channels.2 " ,
FT_BOOLEAN , 8 , NULL , 0x04 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_rfa ,
{ " RFA " , " btavdtp.codec.mpeg24.rfa " ,
FT_UINT8 , BASE_HEX , NULL , 0x03 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_vbr_supported ,
{ " VBR Supported " , " btavdtp.codec.mpeg24.vbr " ,
FT_BOOLEAN , 24 , NULL , 0x800000 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg24_bit_rate ,
{ " Bit Rate " , " btavdtp.codec.mpeg24.bit_rate " ,
FT_UINT24 , BASE_HEX , NULL , 0x7FFFFF ,
NULL , HFILL }
} ,
{ & hf_btavdtp_atrac_version ,
{ " Version " , " btavdtp.codec.atrac.version " ,
FT_UINT8 , BASE_DEC , NULL , 0xE0 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_atrac_channel_mode_single_channel ,
{ " Channel Mode Single Channel " , " btavdtp.codec.atrac.channel_mode.single_channel " ,
FT_BOOLEAN , 8 , NULL , 0x10 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_atrac_channel_mode_dual_channel ,
{ " Channel Mode Dual Channel " , " btavdtp.codec.atrac.channel_mode.dual_channel " ,
FT_BOOLEAN , 8 , NULL , 0x08 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_atrac_channel_mode_joint_stereo ,
{ " Channel Mode Joint Stereo " , " btavdtp.codec.atrac.channel_mode.joint_stereo " ,
FT_BOOLEAN , 8 , NULL , 0x04 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_atrac_rfa1 ,
{ " RFA " , " btavdtp.codec.atrac.rfa1 " ,
FT_UINT8 , BASE_HEX , NULL , 0x03 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_atrac_rfa2 ,
{ " RFA " , " btavdtp.codec.atrac.rfa2 " ,
FT_UINT24 , BASE_HEX , NULL , 0xC00000 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_atrac_sampling_frequency_44100 ,
{ " Sampling Frequency 44100 Hz " , " btavdtp.codec.sbc.sampling_frequency.44100 " ,
FT_BOOLEAN , 24 , NULL , 0x200000 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_atrac_sampling_frequency_48000 ,
{ " Sampling Frequency 48000 Hz " , " btavdtp.codec.sbc.sampling_frequency.48000 " ,
FT_BOOLEAN , 24 , NULL , 0x100000 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_atrac_vbr_supported ,
{ " VBR Supported " , " btavdtp.codec.atrac.vbr " ,
FT_BOOLEAN , 24 , NULL , 0x080000 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_atrac_bit_rate ,
{ " Bit Rate " , " btavdtp.codec.atrac.bit_rate " ,
FT_UINT24 , BASE_HEX , NULL , 0x07FFFF ,
NULL , HFILL }
} ,
{ & hf_btavdtp_atrac_maximum_sul ,
{ " Maximum SUL " , " btavdtp.codec.atrac.maximum_sul " ,
FT_UINT8 , BASE_DEC , NULL , 0x00 ,
" Sound Unit Length (SUL) is one of the parameters that determine bit rate of the audio stream. " , HFILL }
} ,
{ & hf_btavdtp_atrac_rfa3 ,
{ " RFA " , " btavdtp.codec.atrac.rfa3 " ,
FT_UINT8 , BASE_HEX , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_h263_level_10 ,
{ " H264 Level 10 " , " btavdtp.codec.h264.level.10 " ,
FT_BOOLEAN , 8 , NULL , 0x80 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_h263_level_20 ,
{ " H264 Level 20 " , " btavdtp.codec.h264.level.20 " ,
FT_BOOLEAN , 8 , NULL , 0x40 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_h263_level_30 ,
{ " H264 Level 30 " , " btavdtp.codec.h264.level.30 " ,
FT_BOOLEAN , 8 , NULL , 0x20 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_h263_level_rfa ,
{ " H264 Level RFA " , " btavdtp.codec.h264.level.rfa " ,
FT_UINT8 , BASE_HEX , NULL , 0x1F ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg4_level_0 ,
{ " MPEG Level 0 " , " btavdtp.codec.mpeg4.level.0 " ,
FT_BOOLEAN , 8 , NULL , 0x80 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg4_level_1 ,
{ " MPEG Level 1 " , " btavdtp.codec.mpeg4.level.1 " ,
FT_BOOLEAN , 8 , NULL , 0x40 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg4_level_2 ,
{ " MPEG Level 2 " , " btavdtp.codec.mpeg4.level.2 " ,
FT_BOOLEAN , 8 , NULL , 0x20 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg4_level_3 ,
{ " MPEG4 Level 3 " , " btavdtp.codec.mpeg4.level.3 " ,
FT_BOOLEAN , 8 , NULL , 0x10 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_mpeg4_level_rfa ,
{ " MPEG4 Level RFA " , " btavdtp.codec.mpeg4.level.rfa " ,
FT_UINT8 , BASE_HEX , NULL , 0x0F ,
NULL , HFILL }
} ,
{ & hf_btavdtp_vendor_id ,
{ " Vendor ID " , " btavdtp.codec.vendor.vendor_id " ,
2012-11-12 14:53:46 +00:00
FT_UINT32 , BASE_HEX | BASE_EXT_STRING , & bthci_evt_comp_id_ext , 0x00 ,
2012-11-05 11:42:10 +00:00
NULL , HFILL }
} ,
{ & hf_btavdtp_vendor_specific_codec_id ,
{ " Codec " , " btavdtp.codec.vendor.codec_id " ,
FT_UINT16 , BASE_HEX , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_vendor_specific_value ,
{ " Value " , " btavdtp.codec.vendor.value " ,
FT_NONE , BASE_NONE , NULL , 0x00 ,
NULL , HFILL }
} ,
2013-10-26 02:24:04 +00:00
{ & hf_btavdtp_capabilities ,
{ " Capabilities " , " btavdtp.capabilities " ,
FT_NONE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_service ,
{ " Service " , " btavdtp.service " ,
FT_NONE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
{ & hf_btavdtp_service_multiplexing_entry ,
{ " Entry " , " btavdtp.service_multiplexing_entry " ,
FT_NONE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
} ,
2012-11-05 11:42:10 +00:00
{ & hf_btavdtp_data ,
{ " Data " , " btavdtp.data " ,
FT_NONE , BASE_NONE , NULL , 0x0 ,
NULL , HFILL }
2013-10-26 02:24:04 +00:00
}
2012-11-05 11:42:10 +00:00
} ;
static gint * ett [ ] = {
& ett_btavdtp ,
& ett_btavdtp_sep ,
& ett_btavdtp_capabilities ,
& ett_btavdtp_service ,
} ;
2013-03-18 06:23:22 +00:00
proto_btavdtp = proto_register_protocol ( " Bluetooth AVDTP Protocol " , " BT AVDTP " , " btavdtp " ) ;
2014-03-03 11:12:03 +00:00
btavdtp_handle = new_register_dissector ( " btavdtp " , dissect_btavdtp , proto_btavdtp ) ;
2012-11-05 11:42:10 +00:00
proto_register_field_array ( proto_btavdtp , hf , array_length ( hf ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
module = prefs_register_protocol ( proto_btavdtp , NULL ) ;
prefs_register_static_text_preference ( module , " avdtp.version " ,
" Bluetooth Protocol AVDTP version: 1.3 " ,
" Version of protocol supported by this dissector. " ) ;
prefs_register_bool_preference ( module , " avdtp.force " ,
" Force decoding as AVDTP Signaling " ,
" Force decoding as AVDTP Signaling " ,
& force_avdtp ) ;
2013-06-20 16:31:53 +00:00
sep_list = wmem_tree_new_autoreset ( wmem_epan_scope ( ) , wmem_file_scope ( ) ) ;
sep_open = wmem_tree_new_autoreset ( wmem_epan_scope ( ) , wmem_file_scope ( ) ) ;
cid_to_type_table = wmem_tree_new_autoreset ( wmem_epan_scope ( ) , wmem_file_scope ( ) ) ; /* cid: type */
2012-11-05 11:42:10 +00:00
}
void
proto_reg_handoff_btavdtp ( void )
{
dissector_add_uint ( " btl2cap.service " , BTSDP_AVDTP_PROTOCOL_UUID , btavdtp_handle ) ;
dissector_add_uint ( " btl2cap.psm " , BTL2CAP_PSM_AVDTP , btavdtp_handle ) ;
dissector_add_handle ( " btl2cap.cid " , btavdtp_handle ) ;
}
static gint
2012-11-30 20:25:21 +00:00
dissect_bta2dp ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data )
2012-11-05 11:42:10 +00:00
{
proto_item * ti ;
proto_tree * bta2dp_tree ;
proto_item * pitem ;
2013-11-03 15:25:52 +00:00
gint offset = 0 ;
dissector_handle_t codec_dissector = NULL ;
bta2dp_codec_info_t bta2dp_codec_info ;
sep_data_t sep_data ;
sep_data . codec = CODEC_SBC ;
sep_data . content_protection_type = 0 ;
2014-03-03 07:51:46 +00:00
sep_data . acp_seid = 0 ;
sep_data . int_seid = 0 ;
2013-11-03 15:25:52 +00:00
2014-03-25 07:59:28 +00:00
if ( force_a2dp_scms_t | | force_a2dp_codec ! = CODEC_DEFAULT ) {
2013-11-03 15:25:52 +00:00
if ( force_a2dp_scms_t )
sep_data . content_protection_type = 2 ;
else if ( data )
sep_data . content_protection_type = ( ( sep_data_t * ) data ) - > content_protection_type ;
2014-03-25 07:59:28 +00:00
if ( force_a2dp_codec ! = CODEC_DEFAULT )
2013-11-03 15:25:52 +00:00
sep_data . codec = force_a2dp_codec ;
else if ( data )
sep_data . codec = ( ( sep_data_t * ) data ) - > codec ;
} else {
if ( data )
sep_data = * ( ( sep_data_t * ) data ) ;
}
2012-11-05 11:42:10 +00:00
col_set_str ( pinfo - > cinfo , COL_PROTOCOL , " A2DP " ) ;
switch ( pinfo - > p2p_dir ) {
case P2P_DIR_SENT :
2013-10-29 14:09:20 +00:00
col_set_str ( pinfo - > cinfo , COL_INFO , " Sent " ) ;
2012-11-05 11:42:10 +00:00
break ;
case P2P_DIR_RECV :
2013-10-29 14:09:20 +00:00
col_set_str ( pinfo - > cinfo , COL_INFO , " Rcvd " ) ;
2012-11-05 11:42:10 +00:00
break ;
case P2P_DIR_UNKNOWN :
col_clear ( pinfo - > cinfo , COL_INFO ) ;
break ;
default :
col_add_fstr ( pinfo - > cinfo , COL_INFO , " Unknown direction %d " ,
pinfo - > p2p_dir ) ;
break ;
}
ti = proto_tree_add_item ( tree , proto_bta2dp , tvb , offset , - 1 , ENC_NA ) ;
col_append_fstr ( pinfo - > cinfo , COL_INFO , " Audio stream - %s " ,
2013-11-03 15:25:52 +00:00
val_to_str_const ( sep_data . codec , media_codec_audio_type_vals , " unknown codec " ) ) ;
2012-11-05 11:42:10 +00:00
bta2dp_tree = proto_item_add_subtree ( ti , ett_bta2dp ) ;
2014-03-03 07:51:46 +00:00
pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_acp_seid , tvb , 0 , 0 , sep_data . acp_seid ) ;
PROTO_ITEM_SET_GENERATED ( pitem ) ;
pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_int_seid , tvb , 0 , 0 , sep_data . int_seid ) ;
PROTO_ITEM_SET_GENERATED ( pitem ) ;
pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_codec , tvb , 0 , 0 , sep_data . codec ) ;
2012-11-05 11:42:10 +00:00
PROTO_ITEM_SET_GENERATED ( pitem ) ;
2013-11-03 15:25:52 +00:00
if ( sep_data . content_protection_type > 0 ) {
2014-03-03 07:51:46 +00:00
pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_content_protection , tvb , 0 , 0 , sep_data . content_protection_type ) ;
2013-11-03 15:25:52 +00:00
PROTO_ITEM_SET_GENERATED ( pitem ) ;
}
switch ( sep_data . codec ) {
2012-11-05 11:42:10 +00:00
case CODEC_SBC :
codec_dissector = sbc_handle ;
break ;
case CODEC_MPEG12_AUDIO :
codec_dissector = mp2t_handle ;
break ;
case CODEC_MPEG24_AAC :
codec_dissector = mpeg_audio_handle ;
break ;
case CODEC_ATRAC :
codec_dissector = atrac_handle ;
break ;
}
2013-11-03 15:25:52 +00:00
bta2dp_codec_info . codec_dissector = codec_dissector ;
bta2dp_codec_info . content_protection_type = sep_data . content_protection_type ;
2012-11-05 11:42:10 +00:00
2013-11-03 15:25:52 +00:00
bluetooth_add_address ( pinfo , & pinfo - > net_dst , " BT A2DP " , pinfo - > fd - > num , FALSE , & bta2dp_codec_info ) ;
2012-11-05 11:42:10 +00:00
call_dissector ( rtp_handle , tvb , pinfo , tree ) ;
offset + = tvb_length_remaining ( tvb , offset ) ;
return offset ;
}
void
proto_register_bta2dp ( void )
{
module_t * module ;
2013-11-03 15:25:52 +00:00
2013-11-02 20:10:51 +00:00
static hf_register_info hf [ ] = {
2014-03-03 07:51:46 +00:00
{ & hf_bta2dp_acp_seid ,
{ " ACP SEID " , " bta2dp.acp_seid " ,
FT_UINT8 , BASE_DEC , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_bta2dp_int_seid ,
{ " INT SEID " , " bta2dp.int_seid " ,
FT_UINT8 , BASE_DEC , NULL , 0x00 ,
NULL , HFILL }
} ,
2013-11-02 20:10:51 +00:00
{ & hf_bta2dp_codec ,
{ " Codec " , " bta2dp.codec " ,
FT_UINT8 , BASE_HEX , VALS ( media_codec_audio_type_vals ) , 0x00 ,
NULL , HFILL }
} ,
{ & hf_bta2dp_content_protection ,
{ " Content Protection " , " bta2dp.content_protection " ,
FT_UINT16 , BASE_HEX , VALS ( content_protection_type_vals ) , 0x0000 ,
NULL , HFILL }
2014-03-03 07:51:46 +00:00
} ,
2013-11-02 20:10:51 +00:00
} ;
2012-11-05 11:42:10 +00:00
static gint * ett [ ] = {
& ett_bta2dp
} ;
2013-03-18 06:23:22 +00:00
proto_bta2dp = proto_register_protocol ( " Bluetooth A2DP Profile " , " BT A2DP " , " bta2dp " ) ;
2013-11-02 20:10:51 +00:00
proto_register_field_array ( proto_bta2dp , hf , array_length ( hf ) ) ;
2012-11-05 11:42:10 +00:00
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
2014-03-03 11:12:03 +00:00
bta2dp_handle = new_register_dissector ( " bta2dp " , dissect_bta2dp , proto_bta2dp ) ;
2012-11-05 11:42:10 +00:00
module = prefs_register_protocol ( proto_bta2dp , NULL ) ;
prefs_register_static_text_preference ( module , " a2dp.version " ,
" Bluetooth Profile A2DP version: 1.3 " ,
" Version of profile supported by this dissector. " ) ;
2013-11-03 15:25:52 +00:00
prefs_register_bool_preference ( module , " a2dp.content_protection.scms_t " ,
" Force SCMS-T decoding " ,
" Force decoding stream as A2DP with Content Protection SCMS-T " ,
& force_a2dp_scms_t ) ;
prefs_register_enum_preference ( module , " a2dp.codec " ,
" Force codec " ,
" Force decoding stream as A2DP with specified codec " ,
& force_a2dp_codec , pref_a2dp_codec , FALSE ) ;
2012-11-05 11:42:10 +00:00
}
void
proto_reg_handoff_bta2dp ( void )
{
sbc_handle = find_dissector ( " sbc " ) ;
mp2t_handle = find_dissector ( " mp2t " ) ;
mpeg_audio_handle = find_dissector ( " mpeg-audio " ) ;
/* TODO: ATRAC dissector does not exist yet */
atrac_handle = find_dissector ( " atrac " ) ;
rtp_handle = find_dissector ( " rtp " ) ;
dissector_add_uint ( " btl2cap.service " , BTSDP_A2DP_SOURCE_SERVICE_UUID , bta2dp_handle ) ;
dissector_add_uint ( " btl2cap.service " , BTSDP_A2DP_SINK_SERVICE_UUID , bta2dp_handle ) ;
dissector_add_uint ( " btl2cap.service " , BTSDP_A2DP_DISTRIBUTION_SERVICE_UUID , bta2dp_handle ) ;
dissector_add_handle ( " btl2cap.cid " , bta2dp_handle ) ;
}
static gint
2012-12-03 11:36:06 +00:00
dissect_btvdp ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data )
2012-11-05 11:42:10 +00:00
{
proto_item * ti ;
proto_tree * btvdp_tree ;
proto_item * pitem ;
2013-11-03 15:25:52 +00:00
gint offset = 0 ;
dissector_handle_t codec_dissector = NULL ;
btvdp_codec_info_t btvdp_codec_info ;
sep_data_t sep_data ;
sep_data . codec = CODEC_H263_BASELINE ;
sep_data . content_protection_type = 0 ;
2014-03-03 07:51:46 +00:00
sep_data . acp_seid = 0 ;
sep_data . int_seid = 0 ;
2013-11-03 15:25:52 +00:00
if ( force_vdp_scms_t | | force_vdp_codec ) {
if ( force_vdp_scms_t )
sep_data . content_protection_type = 2 ;
else if ( data )
sep_data . content_protection_type = ( ( sep_data_t * ) data ) - > content_protection_type ;
if ( force_vdp_codec )
sep_data . codec = force_vdp_codec ;
else if ( data )
sep_data . codec = ( ( sep_data_t * ) data ) - > codec ;
} else {
if ( data )
sep_data = * ( ( sep_data_t * ) data ) ;
}
2012-11-05 11:42:10 +00:00
col_set_str ( pinfo - > cinfo , COL_PROTOCOL , " VDP " ) ;
switch ( pinfo - > p2p_dir ) {
case P2P_DIR_SENT :
2013-10-29 14:09:20 +00:00
col_set_str ( pinfo - > cinfo , COL_INFO , " Sent " ) ;
2012-11-05 11:42:10 +00:00
break ;
case P2P_DIR_RECV :
2013-10-29 14:09:20 +00:00
col_set_str ( pinfo - > cinfo , COL_INFO , " Rcvd " ) ;
2012-11-05 11:42:10 +00:00
break ;
case P2P_DIR_UNKNOWN :
col_clear ( pinfo - > cinfo , COL_INFO ) ;
break ;
default :
col_add_fstr ( pinfo - > cinfo , COL_INFO , " Unknown direction %d " ,
pinfo - > p2p_dir ) ;
break ;
}
ti = proto_tree_add_item ( tree , proto_btvdp , tvb , offset , - 1 , ENC_NA ) ;
col_append_fstr ( pinfo - > cinfo , COL_INFO , " Video stream - %s " ,
2013-11-03 15:25:52 +00:00
val_to_str_const ( sep_data . codec , media_codec_video_type_vals , " unknown codec " ) ) ;
2012-11-05 11:42:10 +00:00
btvdp_tree = proto_item_add_subtree ( ti , ett_btvdp ) ;
2014-03-03 07:51:46 +00:00
pitem = proto_tree_add_uint ( btvdp_tree , hf_btvdp_acp_seid , tvb , 0 , 0 , sep_data . acp_seid ) ;
PROTO_ITEM_SET_GENERATED ( pitem ) ;
pitem = proto_tree_add_uint ( btvdp_tree , hf_btvdp_int_seid , tvb , 0 , 0 , sep_data . int_seid ) ;
PROTO_ITEM_SET_GENERATED ( pitem ) ;
pitem = proto_tree_add_uint ( btvdp_tree , hf_btvdp_codec , tvb , 0 , 0 , sep_data . codec ) ;
2012-11-05 11:42:10 +00:00
PROTO_ITEM_SET_GENERATED ( pitem ) ;
2013-11-03 15:25:52 +00:00
if ( sep_data . content_protection_type > 0 ) {
2014-03-03 07:51:46 +00:00
pitem = proto_tree_add_uint ( btvdp_tree , hf_btvdp_content_protection , tvb , 0 , 0 , sep_data . content_protection_type ) ;
2013-11-03 15:25:52 +00:00
PROTO_ITEM_SET_GENERATED ( pitem ) ;
}
switch ( sep_data . codec ) {
2012-11-05 11:42:10 +00:00
case CODEC_H263_BASELINE :
case CODEC_H263_PROFILE_3 :
case CODEC_H263_PROFILE_8 :
codec_dissector = h263_handle ;
break ;
case CODEC_MPEG4_VSP :
codec_dissector = mp4v_es_handle ;
break ;
}
2013-11-03 15:25:52 +00:00
btvdp_codec_info . codec_dissector = codec_dissector ;
btvdp_codec_info . content_protection_type = sep_data . content_protection_type ;
2012-11-05 11:42:10 +00:00
2013-11-03 15:25:52 +00:00
bluetooth_add_address ( pinfo , & pinfo - > net_dst , " BT VDP " , pinfo - > fd - > num , TRUE , & btvdp_codec_info ) ;
2012-11-05 11:42:10 +00:00
call_dissector ( rtp_handle , tvb , pinfo , tree ) ;
offset + = tvb_length_remaining ( tvb , offset ) ;
return offset ;
}
void
proto_register_btvdp ( void )
{
module_t * module ;
2013-07-09 01:18:52 +00:00
expert_module_t * expert_btavdtp ;
2012-11-05 11:42:10 +00:00
2013-11-02 20:10:51 +00:00
static hf_register_info hf [ ] = {
2014-03-03 07:51:46 +00:00
{ & hf_btvdp_acp_seid ,
{ " ACP SEID " , " btvdp.acp_seid " ,
FT_UINT8 , BASE_DEC , NULL , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btvdp_int_seid ,
{ " INT SEID " , " btvdp.int_seid " ,
FT_UINT8 , BASE_DEC , NULL , 0x00 ,
NULL , HFILL }
} ,
2013-11-02 20:10:51 +00:00
{ & hf_btvdp_codec ,
{ " Codec " , " btvdp.codec " ,
FT_UINT8 , BASE_HEX , VALS ( media_codec_video_type_vals ) , 0x00 ,
NULL , HFILL }
} ,
{ & hf_btvdp_content_protection ,
{ " Content Protection " , " btvdp.content_protection " ,
FT_UINT16 , BASE_HEX , VALS ( content_protection_type_vals ) , 0x0000 ,
NULL , HFILL }
}
} ;
2012-11-05 11:42:10 +00:00
static gint * ett [ ] = {
& ett_btvdp
} ;
2013-07-09 01:18:52 +00:00
static ei_register_info ei [ ] = {
{ & ei_btavdtp_sbc_min_bitpool_out_of_range , { " btavdtp.codec.sbc.minimum_bitpool.out_of_range " , PI_PROTOCOL , PI_WARN , " Bitpool is out of range. Should be 2..250. " , EXPFILL } } ,
{ & ei_btavdtp_sbc_max_bitpool_out_of_range , { " btavdtp.codec.sbc.maximum_bitpool.out_of_range " , PI_PROTOCOL , PI_WARN , " Bitpool is out of range. Should be 2..250. " , EXPFILL } } ,
{ & ei_btavdtp_unexpected_losc_data , { " btavdtp.unexpected_losc_data " , PI_PROTOCOL , PI_WARN , " Unexpected losc data " , EXPFILL } } ,
} ;
2013-03-18 06:23:22 +00:00
proto_btvdp = proto_register_protocol ( " Bluetooth VDP Profile " , " BT VDP " , " btvdp " ) ;
2014-03-03 11:12:03 +00:00
btvdp_handle = new_register_dissector ( " btvdp " , dissect_btvdp , proto_btvdp ) ;
2013-11-02 20:10:51 +00:00
proto_register_field_array ( proto_bta2dp , hf , array_length ( hf ) ) ;
2012-11-05 11:42:10 +00:00
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
2013-07-09 01:18:52 +00:00
expert_btavdtp = expert_register_protocol ( proto_btvdp ) ;
expert_register_field_array ( expert_btavdtp , ei , array_length ( ei ) ) ;
2012-11-05 11:42:10 +00:00
module = prefs_register_protocol ( proto_btvdp , NULL ) ;
prefs_register_static_text_preference ( module , " vdp.version " ,
" Bluetooth Profile VDP version: 1.1 " ,
" Version of profile supported by this dissector. " ) ;
2013-11-03 15:25:52 +00:00
prefs_register_bool_preference ( module , " vdp.content_protection.scms_t " ,
" Force SCMS-T decoding " ,
" Force decoding stream as VDP with Content Protection SCMS-T " ,
& force_vdp_scms_t ) ;
prefs_register_enum_preference ( module , " vdp.codec " ,
" Force codec " ,
" Force decoding stream as VDP with specified codec " ,
& force_vdp_codec , pref_vdp_codec , FALSE ) ;
2012-11-05 11:42:10 +00:00
}
void
proto_reg_handoff_btvdp ( void )
{
2013-07-01 11:55:48 +00:00
h263_handle = find_dissector ( " h263 " ) ;
2012-11-05 11:42:10 +00:00
mp4v_es_handle = find_dissector ( " mp4v-es " ) ;
rtp_handle = find_dissector ( " rtp " ) ;
dissector_add_uint ( " btl2cap.service " , BTSDP_VDP_SOURCE_SERVICE_UUID , btvdp_handle ) ;
dissector_add_uint ( " btl2cap.service " , BTSDP_VDP_SINK_SERVICE_UUID , btvdp_handle ) ;
dissector_add_uint ( " btl2cap.service " , BTSDP_VDP_DISTRIBUTION_SERVICE_UUID , btvdp_handle ) ;
dissector_add_handle ( " btl2cap.cid " , btvdp_handle ) ;
}
2013-11-03 15:25:52 +00:00
static gint
dissect_a2dp_cp_scms_t ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data _U_ )
{
proto_item * main_item ;
proto_tree * main_tree ;
gint offset = 0 ;
main_item = proto_tree_add_item ( tree , proto_bta2dp_cph_scms_t , tvb , offset , 1 , ENC_NA ) ;
main_tree = proto_item_add_subtree ( main_item , ett_bta2dp_cph_scms_t ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( main_tree , hf_bta2dp_reserved , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( main_tree , hf_bta2dp_cp_bit , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( main_tree , hf_bta2dp_l_bit , tvb , offset , 1 , ENC_NA ) ;
2013-11-03 15:25:52 +00:00
offset + = 1 ;
return offset ;
}
void
proto_register_bta2dp_content_protection_header_scms_t ( void )
{
static hf_register_info hf [ ] = {
{ & hf_bta2dp_l_bit ,
{ " L-bit " , " bta2dp.content_protection_header.scms_t.l_bit " ,
FT_BOOLEAN , 8 , NULL , 0x01 ,
NULL , HFILL }
} ,
{ & hf_bta2dp_cp_bit ,
{ " Cp-bit " , " bta2dp.content_protection_header.scms_t.cp_bit " ,
FT_BOOLEAN , 8 , NULL , 0x02 ,
NULL , HFILL }
} ,
{ & hf_bta2dp_reserved ,
{ " Reserved " , " bta2dp.content_protection_header.scms_t.reserved " ,
FT_BOOLEAN , 8 , NULL , 0xFC ,
NULL , HFILL }
}
} ;
static gint * ett [ ] = {
& ett_bta2dp_cph_scms_t
} ;
proto_bta2dp_cph_scms_t = proto_register_protocol ( " Bluetooth A2DP Content Protection Header SCMS-T " , " BT A2DP Content Protection Header SCMS-T " , " bta2dp_content_protection_header_scms_t " ) ;
proto_register_field_array ( proto_bta2dp_cph_scms_t , hf , array_length ( hf ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
new_register_dissector ( " bta2dp_content_protection_header_scms_t " , dissect_a2dp_cp_scms_t , proto_bta2dp_cph_scms_t ) ;
}
static gint
dissect_vdp_cp_scms_t ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data _U_ )
{
proto_item * main_item ;
proto_tree * main_tree ;
gint offset = 0 ;
main_item = proto_tree_add_item ( tree , proto_btvdp_cph_scms_t , tvb , offset , 1 , ENC_NA ) ;
main_tree = proto_item_add_subtree ( main_item , ett_btvdp_cph_scms_t ) ;
2014-02-16 11:14:40 +00:00
proto_tree_add_item ( main_tree , hf_btvdp_reserved , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( main_tree , hf_btvdp_cp_bit , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( main_tree , hf_btvdp_l_bit , tvb , offset , 1 , ENC_NA ) ;
2013-11-03 15:25:52 +00:00
offset + = 1 ;
return offset ;
}
void
proto_register_btvdp_content_protection_header_scms_t ( void )
{
static hf_register_info hf [ ] = {
{ & hf_btvdp_l_bit ,
{ " L-bit " , " btvdp.content_protection_header.scms_t.l_bit " ,
FT_BOOLEAN , 8 , NULL , 0x01 ,
NULL , HFILL }
} ,
{ & hf_btvdp_cp_bit ,
{ " Cp-bit " , " btvdp.content_protection_header.scms_t.cp_bit " ,
FT_BOOLEAN , 8 , NULL , 0x02 ,
NULL , HFILL }
} ,
{ & hf_btvdp_reserved ,
{ " Reserved " , " btvdp.content_protection_header.scms_t.reserved " ,
FT_BOOLEAN , 8 , NULL , 0xFC ,
NULL , HFILL }
}
} ;
static gint * ett [ ] = {
& ett_btvdp_cph_scms_t
} ;
proto_btvdp_cph_scms_t = proto_register_protocol ( " Bluetooth VDP Content Protection Header SCMS-T " , " BT VDP Content Protection Header SCMS-T " , " btvdp_content_protection_header_scms_t " ) ;
proto_register_field_array ( proto_btvdp_cph_scms_t , hf , array_length ( hf ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
new_register_dissector ( " btvdp_content_protection_header_scms_t " , dissect_vdp_cp_scms_t , proto_btvdp_cph_scms_t ) ;
}
2012-11-05 11:42:10 +00:00
/*
* Editor modelines - http : //www.wireshark.org/tools/modelines.html
*
* Local variables :
* c - basic - offset : 4
* tab - width : 8
* indent - tabs - mode : nil
* End :
*
* vi : set shiftwidth = 4 tabstop = 8 expandtab :
* : indentSize = 4 : tabSize = 8 : noTabs = true :
*/