2 * Routines for Bluetooth Pseudoheader for BR/EDR Baseband
4 * Copyright 2020, Thomas Sailer <t.sailer@alumni.ethz.ch>
5 * Copyright 2014, Michal Labedzki for Tieto Corporation
6 * Copyright 2014, Dominic Spill <dominicgs@gmail.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include <epan/packet.h>
18 #include <epan/expert.h>
19 #include <epan/proto_data.h>
20 #include <epan/reassemble.h>
22 #include <wiretap/wtap.h>
24 #include "packet-bluetooth.h"
25 #include "packet-btbredr_rf.h"
26 #include "packet-bthci_acl.h"
29 * Future Improvements:
30 * - De-Whiten if the capture hardware did not already do it and we have the UAP
33 static int proto_btbredr_rf
;
34 static int proto_btbredr_fhs
;
36 static int hf_rf_channel
;
37 static int hf_uncertain_rf_channel
;
38 static int hf_signal_power
;
39 static int hf_invalid_signal_power
;
40 static int hf_noise_power
;
41 static int hf_invalid_noise_power
;
42 static int hf_access_address_offenses
;
43 static int hf_payload_transport_rate
;
44 static int hf_payload_transport_rate_payload
;
45 static int hf_payload_transport_rate_transport
;
46 static int hf_payload_transport_rate_ignored
;
47 static int hf_corrected_header_bits
;
48 static int hf_corrected_payload_bits
;
49 static int hf_lower_address_part
;
50 static int hf_reference_lower_address_part
;
51 static int hf_invalid_reference_lower_address_part
;
52 static int hf_reference_upper_addres_part
;
53 static int hf_invalid_reference_upper_addres_part
;
54 static int hf_whitened_packet_header
;
55 static int hf_invalid_packet_header
;
56 static int hf_packet_header
;
57 static int hf_packet_header_reserved
;
58 static int hf_packet_header_lt_addr
;
59 static int hf_packet_header_type
;
60 static int hf_packet_header_type_any
;
61 static int hf_packet_header_type_sco_br
;
62 static int hf_packet_header_type_esco_br
;
63 static int hf_packet_header_type_esco_edr
;
64 static int hf_packet_header_type_acl_br
;
65 static int hf_packet_header_type_acl_edr
;
66 static int hf_packet_header_type_cpb_br
;
67 static int hf_packet_header_type_cpb_edr
;
68 static int hf_packet_header_flow_control
;
69 static int hf_packet_header_acknowledge_indication
;
70 static int hf_packet_header_sequence_number
;
71 static int hf_packet_header_header_error_check
;
72 static int hf_packet_header_broken_lt_addr
;
73 static int hf_packet_header_broken_type
;
74 static int hf_packet_header_broken_type_any
;
75 static int hf_packet_header_broken_type_sco_br
;
76 static int hf_packet_header_broken_type_esco_br
;
77 static int hf_packet_header_broken_type_esco_edr
;
78 static int hf_packet_header_broken_type_acl_br
;
79 static int hf_packet_header_broken_type_acl_edr
;
80 static int hf_packet_header_broken_type_cpb_br
;
81 static int hf_packet_header_broken_type_cpb_edr
;
82 static int hf_packet_header_broken_flow_control
;
83 static int hf_packet_header_broken_acknowledge_indication
;
84 static int hf_packet_header_broken_sequence_number
;
85 static int hf_packet_header_broken_header_error_check
;
87 static int hf_flags_reserved_15_14
;
88 static int hf_flags_mic_pass
;
89 static int hf_flags_mic_checked
;
90 static int hf_flags_crc_pass
;
91 static int hf_flags_crc_checked
;
92 static int hf_flags_hec_pass
;
93 static int hf_flags_hec_checked
;
94 static int hf_flags_reference_upper_addres_part_valid
;
95 static int hf_flags_rf_channel_aliasing
;
96 static int hf_flags_br_edr_data_present
;
97 static int hf_flags_reference_lower_address_part_valid
;
98 static int hf_flags_bredr_payload_decrypted
;
99 static int hf_flags_noise_power_valid
;
100 static int hf_flags_signal_power_valid
;
101 static int hf_flags_packet_header_and_br_edr_payload_dewhitened
;
102 static int hf_whitened_data
;
103 static int hf_encrypted_data
;
105 static int hf_isochronous_data
;
106 static int hf_asynchronous_data
;
107 static int hf_l2cap_fragment
;
109 static int hf_payload_header2
;
110 static int hf_payload_header2_llid
;
111 static int hf_payload_header2_flow
;
112 static int hf_payload_header2_length
;
113 static int hf_payload_header2_rfu
;
114 static int hf_payload_header1
;
115 static int hf_payload_header1_llid
;
116 static int hf_payload_header1_flow
;
117 static int hf_payload_header1_length
;
118 static int hf_l2cap_msg_fragments
;
119 static int hf_l2cap_msg_fragment
;
120 static int hf_l2cap_msg_fragment_overlap
;
121 static int hf_l2cap_msg_fragment_overlap_conflicts
;
122 static int hf_l2cap_msg_fragment_multiple_tails
;
123 static int hf_l2cap_msg_fragment_too_long_fragment
;
124 static int hf_l2cap_msg_fragment_error
;
125 static int hf_l2cap_msg_fragment_count
;
126 static int hf_l2cap_msg_reassembled_in
;
127 static int hf_l2cap_msg_reassembled_length
;
128 static int hf_fhs_parity
;
129 static int hf_fhs_lap
;
130 static int hf_fhs_eir
;
131 static int hf_fhs_reserved
;
132 static int hf_fhs_sr
;
133 static int hf_fhs_sp
;
134 static int hf_fhs_uap
;
135 static int hf_fhs_nap
;
136 static int hf_fhs_class
;
137 static int hf_fhs_ltaddr
;
138 static int hf_fhs_clk
;
139 static int hf_fhs_pagescanmode
;
141 #define FLAGS_MIC_PASS 0x2000
142 #define FLAGS_MIC_CHECKED 0x1000
143 #define FLAGS_CRC_PASS 0x0800
144 #define FLAGS_CRC_CHECKED 0x0400
145 #define FLAGS_HEC_PASS 0x0200
146 #define FLAGS_HEC_CHECKED 0x0100
147 #define FLAGS_REFERENCE_UPPER_ADDRES_PART_VALID 0x0080
148 #define FLAGS_RF_CHANNEL_ALIASING 0x0040
149 #define FLAGS_BR_EDR_DATA_PRESENT 0x0020
150 #define FLAGS_REFERENCE_LOWER_ADDRESS_PART_VALID 0x0010
151 #define FLAGS_BREDR_PAYLOAD_DECRYPTED 0x0008
152 #define FLAGS_NOISE_POWER_VALID 0x0004
153 #define FLAGS_SIGNAL_POWER_VALID 0x0002
154 #define FLAGS_PACKET_HEADER_AND_BR_EDR_PAYLOAD_DEWHITENED 0x0001
156 static int * const hfx_payload_transport_rate
[] = {
157 &hf_payload_transport_rate_payload
,
158 &hf_payload_transport_rate_transport
,
162 static expert_field ei_unexpected_data
;
163 static expert_field ei_reserved_not_zero
;
164 static expert_field ei_incorrect_packet_header_or_hec
;
165 static expert_field ei_packet_header_with_hec_not_checked
;
166 static expert_field ei_broken_packet_header_format
;
167 static expert_field ei_incorrect_crc
;
168 static expert_field ei_missing_fragment_start
;
169 static expert_field ei_esco_incorrect_ltaddr
;
170 static expert_field ei_esco_incorrect_length
;
172 static int ett_btbredr_rf
;
173 static int ett_flags
;
174 static int ett_payload_transport_rate
;
175 static int ett_packet_header
;
176 static int ett_bluetooth_header
;
177 static int ett_payload_header
;
178 static int ett_l2cap_msg_fragment
;
179 static int ett_l2cap_msg_fragments
;
180 static int ett_btbredr_fhs
;
182 static dissector_table_t packet_type_sco_br_table
;
183 static dissector_table_t packet_type_esco_br_table
;
184 static dissector_table_t packet_type_esco_edr_table
;
185 static dissector_table_t packet_type_acl_br_table
;
186 static dissector_table_t packet_type_acl_edr_table
;
187 static dissector_table_t packet_type_cpb_br_table
;
188 static dissector_table_t packet_type_cpb_edr_table
;
190 static dissector_handle_t btlmp_handle
;
191 static dissector_handle_t btl2cap_handle
;
193 static dissector_handle_t btbredr_rf_handle
;
194 static dissector_handle_t btbredr_fhs_handle
;
196 static wmem_tree_t
*connection_info_tree
;
197 static wmem_tree_t
*device_info_tree
;
199 typedef struct _device_info_t
{
200 uint32_t interface_id
;
206 #define BDADDR_CENTRAL 0
207 #define BDADDR_PERIPHERAL 1
209 typedef struct _btbredr_frame_info_t
{
210 unsigned retransmit
: 1; /* 0 = No, 1 = Retransmitted frame */
211 unsigned ack
: 1; /* 0 = Nack, 1 = Ack */
212 unsigned more_fragments
: 1; /* 0 = Last fragment, 1 = More fragments */
213 unsigned missing_start
: 1; /* 0 = No, 1 = Missing fragment start */
214 uint32_t l2cap_index
; /* Unique identifier for each L2CAP message */
215 } btbredr_frame_info_t
;
218 bluetooth_data_t
*bluetooth_data
;
219 connection_info_t
*connection_info
;
220 device_info_t
*device_info
;
221 } btbredr_fhs_data_t
;
223 static const uint8_t null_bd_addr
[6] = { 0, 0, 0, 0, 0, 0 };
226 static reassembly_table l2cap_msg_reassembly_table
;
228 static const fragment_items l2cap_msg_frag_items
= {
229 /* Fragment subtrees */
230 &ett_l2cap_msg_fragment
,
231 &ett_l2cap_msg_fragments
,
232 /* Fragment fields */
233 &hf_l2cap_msg_fragments
,
234 &hf_l2cap_msg_fragment
,
235 &hf_l2cap_msg_fragment_overlap
,
236 &hf_l2cap_msg_fragment_overlap_conflicts
,
237 &hf_l2cap_msg_fragment_multiple_tails
,
238 &hf_l2cap_msg_fragment_too_long_fragment
,
239 &hf_l2cap_msg_fragment_error
,
240 &hf_l2cap_msg_fragment_count
,
241 /* Reassembled in field */
242 &hf_l2cap_msg_reassembled_in
,
243 /* Reassembled length field */
244 &hf_l2cap_msg_reassembled_length
,
245 /* Reassembled data field */
248 "BT BR/EDR L2CAP fragments"
251 static const value_string payload_transport_rate_transport_vals
[] = {
260 #define TRANSPORT_ANY 0x00
261 #define TRANSPORT_SCO 0x10
262 #define TRANSPORT_eSCO 0x20
263 #define TRANSPORT_ACL 0x30
264 #define TRANSPORT_CPB 0x40
267 static const value_string payload_transport_rate_payload_vals
[] = {
268 { 0x00, "Basic Rate with GFSK demodulation" },
269 { 0x01, "Enhanced Data Rate with PI/2-DQPSK demodulation" },
270 { 0x02, "Enhanced Data Rate with 8DPSK demodulation" },
274 static const value_string payload_transport_rate_payload_abbrev_vals
[] = {
275 { 0x00, "BR 1Mbps" },
276 { 0x01, "EDR 2Mbps" },
277 { 0x02, "EDR 3Mbps" },
281 #define PAYLOAD_BR 0x00
282 #define PAYLOAD_EDR_2 0x01
283 #define PAYLOAD_EDR_3 0x02
285 #define PACKET_TYPE_UNKNOWN -1
287 static const value_string packet_type_any_vals
[] = {
292 { 0x04, "DH1/2-DH1" },
294 { 0x06, "HV2/2-EV3" },
295 { 0x07, "HV3/EV3/3-EV3" },
296 { 0x08, "DV/3-DH1" },
298 { 0x0A, "DM3/2-DH3" },
299 { 0x0B, "DH3/3-DH3" },
300 { 0x0C, "EV4/2-EV5" },
301 { 0x0D, "EV5/3-EV5" },
302 { 0x0E, "DM5/2-DH5" },
303 { 0x0F, "DH5/3-DH5" },
307 static const value_string packet_type_sco_br_vals
[] = {
312 { 0x04, "undefined" },
317 { 0x09, "undefined" },
318 { 0x0A, "undefined" },
319 { 0x0B, "undefined" },
320 { 0x0C, "undefined" },
321 { 0x0D, "undefined" },
322 { 0x0E, "undefined" },
323 { 0x0F, "undefined" },
327 static const value_string packet_type_esco_br_vals
[] = {
330 { 0x02, "reserved" },
331 { 0x03, "reserved" },
332 { 0x04, "undefined" },
333 { 0x05, "undefined" },
334 { 0x06, "undefined" },
336 { 0x08, "undefined" },
337 { 0x09, "undefined" },
338 { 0x0A, "undefined" },
339 { 0x0B, "undefined" },
342 { 0x0E, "undefined" },
343 { 0x0F, "undefined" },
347 static const value_string packet_type_esco_edr_vals
[] = {
350 { 0x02, "reserved" },
351 { 0x03, "reserved" },
352 { 0x04, "undefined" },
353 { 0x05, "undefined" },
356 { 0x08, "undefined" },
357 { 0x09, "undefined" },
358 { 0x0A, "undefined" },
359 { 0x0B, "undefined" },
362 { 0x0E, "undefined" },
363 { 0x0F, "undefined" },
367 static const value_string packet_type_acl_br_vals
[] = {
373 { 0x05, "undefined" },
374 { 0x06, "undefined" },
375 { 0x07, "undefined" },
376 { 0x08, "undefined" },
380 { 0x0C, "undefined" },
381 { 0x0D, "undefined" },
387 static const value_string packet_type_acl_edr_vals
[] = {
393 { 0x05, "undefined" },
394 { 0x06, "undefined" },
395 { 0x07, "undefined" },
400 { 0x0C, "undefined" },
401 { 0x0D, "undefined" },
407 static const value_string packet_type_cpb_br_vals
[] = {
409 { 0x01, "reserved" },
410 { 0x02, "reserved" },
413 { 0x05, "undefined" },
414 { 0x06, "undefined" },
415 { 0x07, "undefined" },
416 { 0x08, "undefined" },
417 { 0x09, "undefined" },
420 { 0x0C, "undefined" },
421 { 0x0D, "undefined" },
427 static const value_string packet_type_cpb_edr_vals
[] = {
429 { 0x01, "reserved" },
430 { 0x02, "reserved" },
433 { 0x05, "undefined" },
434 { 0x06, "undefined" },
435 { 0x07, "undefined" },
437 { 0x09, "undefined" },
440 { 0x0C, "undefined" },
441 { 0x0D, "undefined" },
447 static const val64_string fhs_scan_repetition_vals
[] = {
454 static const value_string fhs_page_scan_mode_vals
[] = {
455 { 0x00, "Mandatory Scan Mode" },
459 void proto_register_btbredr_rf(void);
460 void proto_reg_handoff_btbredr_rf(void);
463 reverse_bits(uint8_t value
)
465 value
= ((value
>> 1) & 0x55) | ((value
<< 1) & 0xaa);
466 value
= ((value
>> 2) & 0x33) | ((value
<< 2) & 0xcc);
467 value
= ((value
>> 4) & 0x0f) | ((value
<< 4) & 0xf0);
472 broken_check_hec(uint8_t uap
, uint32_t header
)
475 uint16_t header_data
;
480 header_data
= (header
>> 8) & 0x3F;
484 for (i
= 9; i
>= 0; i
-= 1) {
488 lfsr
= (lfsr
<< 1) | (((lfsr
>> 7) ^ (header_data
>> i
)) & 0x01);
491 lfsr
= reverse_bits(lfsr
);
497 check_hec(uint8_t uap
, uint32_t header
)
499 static const uint32_t crc_poly_rev_bt_hec
= 0xe5;
501 header
^= reverse_bits(uap
) & 0xff;
502 for (unsigned i
= 0; i
< 10; ++i
, header
>>= 1)
504 header
^= (crc_poly_rev_bt_hec
<< 1);
509 check_crc(uint8_t uap
, tvbuff_t
*tvb
, int offset
, int len
)
511 static const uint16_t crc_poly_rev_bt_pdu
= 0x8408;
512 uint16_t crc
= reverse_bits(uap
);
514 for (; len
> 0; --len
, ++offset
) {
515 crc
^= tvb_get_uint8(tvb
, offset
) & 0xff;
516 for (unsigned i
= 0; i
< 8; ++i
) {
517 uint16_t x
= crc
& 1;
519 crc
^= crc_poly_rev_bt_pdu
& -x
;
526 extract_lap(const uint8_t bd_addr
[6])
528 uint32_t lap
= bd_addr
[3];
537 is_reserved_lap(uint32_t lap
)
539 return (lap
>= 0x9e8b00) && (lap
<= 0x9e8b3f);
542 static connection_info_t
*
543 lookup_connection_info(uint32_t interface_id
, uint32_t adapter_id
, uint32_t lap
, uint32_t ltaddr
, uint32_t pktnum
)
545 connection_info_t
*cinfo
;
546 wmem_tree_key_t key
[6];
548 key
[0].key
= &interface_id
;
550 key
[1].key
= &adapter_id
;
554 key
[3].key
= <addr
;
556 key
[4].key
= &pktnum
;
559 cinfo
= (connection_info_t
*) wmem_tree_lookup32_array_le(connection_info_tree
, key
);
562 if (cinfo
->interface_id
!= interface_id
|| cinfo
->adapter_id
!= adapter_id
||
563 extract_lap(cinfo
->bd_addr
[BDADDR_CENTRAL
]) != lap
|| cinfo
->lt_addr
!= ltaddr
)
569 btbredr_rf_add_esco_link(connection_info_t
*cinfo
, packet_info
*pinfo
, uint8_t handle
, uint32_t ltaddr
, uint16_t pktszms
, uint16_t pktszsm
)
571 connection_info_t
*ecinfo
;
573 wmem_tree_key_t key
[6];
574 if (!cinfo
|| !pinfo
|| ltaddr
>= 8 || !ltaddr
)
576 lap
= extract_lap(cinfo
->bd_addr
[BDADDR_CENTRAL
]);
577 ecinfo
= lookup_connection_info(cinfo
->interface_id
, cinfo
->adapter_id
, lap
, ltaddr
, pinfo
->num
);
578 if (ecinfo
&& (memcmp(cinfo
->bd_addr
[BDADDR_CENTRAL
], ecinfo
->bd_addr
[BDADDR_CENTRAL
], 6) ||
579 memcmp(cinfo
->bd_addr
[BDADDR_PERIPHERAL
], ecinfo
->bd_addr
[BDADDR_PERIPHERAL
], 6) ||
580 !ecinfo
->esco
|| ecinfo
->escohandle
!= handle
|| ecinfo
->escosize
[0] != pktszms
||
581 ecinfo
->escosize
[1] != pktszsm
))
585 ecinfo
= wmem_new0(wmem_file_scope(), connection_info_t
);
586 ecinfo
->interface_id
= cinfo
->interface_id
;
587 ecinfo
->adapter_id
= cinfo
->adapter_id
;
588 ecinfo
->lt_addr
= ltaddr
;
589 ecinfo
->timestamp
= cinfo
->timestamp
;
590 ecinfo
->btclock
= cinfo
->btclock
;
591 memcpy(ecinfo
->bd_addr
[BDADDR_CENTRAL
], cinfo
->bd_addr
[BDADDR_CENTRAL
], 6);
592 memcpy(ecinfo
->bd_addr
[BDADDR_PERIPHERAL
], cinfo
->bd_addr
[BDADDR_PERIPHERAL
], 6);
593 ecinfo
->escosize
[0] = pktszms
;
594 ecinfo
->escosize
[1] = pktszsm
;
595 ecinfo
->escohandle
= handle
;
598 key
[0].key
= &cinfo
->interface_id
;
600 key
[1].key
= &cinfo
->adapter_id
;
604 key
[3].key
= <addr
;
606 key
[4].key
= &pinfo
->num
;
609 wmem_tree_insert32_array(connection_info_tree
, key
, ecinfo
);
614 btbredr_rf_remove_esco_link(connection_info_t
*cinfo
, packet_info
*pinfo
, uint8_t handle
)
616 connection_info_t
*ecinfo
;
618 wmem_tree_key_t key
[6];
619 if (!cinfo
|| !pinfo
)
621 lap
= extract_lap(cinfo
->bd_addr
[BDADDR_CENTRAL
]);
622 for (uint32_t ltaddr
= 1; ltaddr
< 8; ++ltaddr
) {
623 ecinfo
= lookup_connection_info(cinfo
->interface_id
, cinfo
->adapter_id
, lap
, ltaddr
, pinfo
->num
);
626 if (memcmp(cinfo
->bd_addr
[BDADDR_CENTRAL
], ecinfo
->bd_addr
[BDADDR_CENTRAL
], 6) ||
627 memcmp(cinfo
->bd_addr
[BDADDR_PERIPHERAL
], ecinfo
->bd_addr
[BDADDR_PERIPHERAL
], 6) ||
628 !ecinfo
->esco
|| ecinfo
->escohandle
!= handle
)
631 key
[0].key
= &cinfo
->interface_id
;
633 key
[1].key
= &cinfo
->adapter_id
;
637 key
[3].key
= <addr
;
639 key
[4].key
= &pinfo
->num
;
642 wmem_tree_insert32_array(connection_info_tree
, key
, ecinfo
);
647 dissect_btbredr_rf(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
649 proto_item
*btbredr_rf_item
;
650 proto_tree
*btbredr_rf_tree
;
651 proto_item
*flags_item
;
652 proto_tree
*flags_tree
;
653 proto_item
*header_item
= NULL
;
654 proto_tree
*header_tree
;
655 proto_item
*reserved_item
;
656 proto_item
*hec_item
= NULL
;
660 uint32_t interface_id
;
666 uint8_t payload_and_transport
;
667 int16_t packet_type
= PACKET_TYPE_UNKNOWN
;
668 const char *packet_type_str
= "Unknown";
669 dissector_table_t packet_type_table
= NULL
;
671 int isochronous_length
= 0;
672 bool isochronous_crc
= false;
673 bool isochronous_esco
= false;
676 bool data_crc
= false;
680 btbredr_frame_info_t
*frame_info
= NULL
;
681 connection_info_t
*connection_info
= NULL
;
682 device_info_t
*device_info
= NULL
;
683 bluetooth_data_t
*bluetooth_data
= (bluetooth_data_t
*) data
;
686 interface_id
= bluetooth_data
->interface_id
;
687 else if (pinfo
->rec
->presence_flags
& WTAP_HAS_INTERFACE_ID
)
688 interface_id
= pinfo
->rec
->rec_header
.packet_header
.interface_id
;
690 interface_id
= HCI_INTERFACE_DEFAULT
;
693 adapter_id
= bluetooth_data
->adapter_id
;
695 adapter_id
= HCI_ADAPTER_DEFAULT
;
697 btbredr_rf_item
= proto_tree_add_item(tree
, proto_btbredr_rf
, tvb
, offset
, -1, ENC_NA
);
698 btbredr_rf_tree
= proto_item_add_subtree(btbredr_rf_item
, ett_btbredr_rf
);
700 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "BT BR/EDR RF");
702 if (tvb_captured_length(tvb
) >= 21) {
703 flags
= tvb_get_uint16(tvb
, 20, ENC_LITTLE_ENDIAN
);
708 if (flags
& FLAGS_RF_CHANNEL_ALIASING
)
709 hf_x
= hf_uncertain_rf_channel
;
711 hf_x
= hf_rf_channel
;
712 proto_tree_add_item(btbredr_rf_tree
, hf_x
, tvb
, offset
, 1, ENC_NA
);
715 if (flags
& FLAGS_SIGNAL_POWER_VALID
)
716 hf_x
= hf_signal_power
;
718 hf_x
= hf_invalid_signal_power
;
719 proto_tree_add_item(btbredr_rf_tree
, hf_x
, tvb
, offset
, 1, ENC_NA
);
722 if (flags
& FLAGS_NOISE_POWER_VALID
)
723 hf_x
= hf_noise_power
;
725 hf_x
= hf_invalid_noise_power
;
726 proto_tree_add_item(btbredr_rf_tree
, hf_x
, tvb
, offset
, 1, ENC_NA
);
729 proto_tree_add_item(btbredr_rf_tree
, hf_access_address_offenses
, tvb
, offset
, 1, ENC_NA
);
732 payload_and_transport
= tvb_get_uint8(tvb
, offset
);
734 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "Transport: %s (%s), RF Channel: %s%2u",
735 val_to_str_const(payload_and_transport
>> 4, payload_transport_rate_transport_vals
, "Unknown"),
736 val_to_str_const(payload_and_transport
& 0xF, payload_transport_rate_payload_abbrev_vals
, "Unknown"),
737 (flags
& FLAGS_RF_CHANNEL_ALIASING
) ? "~" : "",
738 tvb_get_uint8(tvb
, 0));
740 if (payload_and_transport
== 0xFF)
741 proto_tree_add_item(btbredr_rf_tree
, hf_payload_transport_rate_ignored
, tvb
, offset
, 1, ENC_NA
);
743 proto_tree_add_bitmask(btbredr_rf_tree
, tvb
, offset
, hf_payload_transport_rate
, ett_payload_transport_rate
, hfx_payload_transport_rate
, ENC_LITTLE_ENDIAN
);
746 proto_tree_add_item(btbredr_rf_tree
, hf_corrected_header_bits
, tvb
, offset
, 1, ENC_NA
);
749 proto_tree_add_item(btbredr_rf_tree
, hf_corrected_payload_bits
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
752 proto_tree_add_item(btbredr_rf_tree
, hf_lower_address_part
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
753 lap
= tvb_get_uint32(tvb
, offset
, ENC_LITTLE_ENDIAN
) & 0xffffff;
756 if (!is_reserved_lap(lap
)) {
757 wmem_tree_key_t key
[4];
759 key
[0].key
= &interface_id
;
761 key
[1].key
= &adapter_id
;
767 device_info
= (device_info_t
*) wmem_tree_lookup32_array(device_info_tree
, key
);
771 direction
= (device_info
->dir
== pinfo
->p2p_dir
) ? BDADDR_CENTRAL
: BDADDR_PERIPHERAL
;
772 uap
= device_info
->bd_addr
[2];
775 if (flags
& FLAGS_REFERENCE_LOWER_ADDRESS_PART_VALID
)
776 hf_x
= hf_reference_lower_address_part
;
778 hf_x
= hf_invalid_reference_lower_address_part
;
779 proto_tree_add_item(btbredr_rf_tree
, hf_x
, tvb
, offset
, 3, ENC_LITTLE_ENDIAN
);
782 if (flags
& FLAGS_REFERENCE_UPPER_ADDRES_PART_VALID
) {
783 hf_x
= hf_reference_upper_addres_part
;
784 uap
= tvb_get_uint8(tvb
, offset
);
786 hf_x
= hf_invalid_reference_upper_addres_part
;
788 proto_tree_add_item(btbredr_rf_tree
, hf_x
, tvb
, offset
, 1, ENC_NA
);
792 uint32_t hdr
= tvb_get_uint32(tvb
, offset
, ENC_LITTLE_ENDIAN
);
793 bool have_uap
= device_info
|| !!(flags
& FLAGS_REFERENCE_UPPER_ADDRES_PART_VALID
);
794 bool is_inquiry
= is_reserved_lap(lap
);
795 bool is_inquiry_fhs
= is_inquiry
&& (((hdr
>> 3) & 0x0f) == 2);
796 bool is_inquiry_broken_fhs
= is_inquiry
&& (((hdr
>> 11) & 0x0f) == 2);
797 if (is_inquiry
&& !(is_inquiry_fhs
|| is_inquiry_broken_fhs
))
799 else if (!(flags
& FLAGS_PACKET_HEADER_AND_BR_EDR_PAYLOAD_DEWHITENED
))
801 else if ((have_uap
|| is_inquiry_fhs
) && check_hec(is_inquiry_fhs
? 0 : uap
, hdr
))
803 else if ((have_uap
|| is_inquiry_broken_fhs
) && broken_check_hec(is_inquiry_broken_fhs
? 0 : uap
, hdr
))
811 decrypted
= !!(flags
& FLAGS_BREDR_PAYLOAD_DECRYPTED
);
813 if (header_mode
== -1) {
814 proto_tree_add_item(btbredr_rf_tree
, hf_whitened_packet_header
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
815 } else if (header_mode
== -2) {
816 proto_tree_add_item(btbredr_rf_tree
, hf_invalid_packet_header
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
817 } else if (header_mode
== 2) {
818 // broken header format
819 header_item
= proto_tree_add_item(btbredr_rf_tree
, hf_packet_header
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
820 header_tree
= proto_item_add_subtree(header_item
, ett_bluetooth_header
);
822 proto_tree_add_item(header_tree
, hf_packet_header_reserved
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
823 proto_tree_add_item(header_tree
, hf_packet_header_broken_lt_addr
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
824 ltaddr
= (tvb_get_uint32(tvb
, offset
, ENC_LITTLE_ENDIAN
) >> 15) & 7;
825 arqn
= (tvb_get_uint32(tvb
, offset
, ENC_LITTLE_ENDIAN
) >> 9) & 1;
826 seqn
= (tvb_get_uint32(tvb
, offset
, ENC_LITTLE_ENDIAN
) >> 8) & 1;
828 if (payload_and_transport
== (TRANSPORT_SCO
| PAYLOAD_BR
)) {
829 proto_tree_add_item(header_tree
, hf_packet_header_broken_type_sco_br
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
831 packet_type
= (tvb_get_uint8(tvb
, offset
+ 1) >> 3) & 0xF;
832 packet_type_str
= val_to_str_const(packet_type
, packet_type_sco_br_vals
, "Unknown");
833 packet_type_table
= packet_type_sco_br_table
;
834 } else if (payload_and_transport
== (TRANSPORT_eSCO
| PAYLOAD_BR
)) {
835 proto_tree_add_item(header_tree
, hf_packet_header_broken_type_esco_br
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
837 packet_type
= (tvb_get_uint8(tvb
, offset
+ 1) >> 3) & 0xF;
838 packet_type_str
= val_to_str_const(packet_type
, packet_type_esco_br_vals
, "Unknown");
839 packet_type_table
= packet_type_esco_br_table
;
840 } else if (payload_and_transport
== (TRANSPORT_eSCO
| PAYLOAD_EDR_2
) || payload_and_transport
== (TRANSPORT_eSCO
| PAYLOAD_EDR_3
)) {
841 proto_tree_add_item(header_tree
, hf_packet_header_broken_type_esco_edr
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
843 packet_type
= (tvb_get_uint8(tvb
, offset
+ 1) >> 3) & 0xF;
844 packet_type_str
= val_to_str_const(packet_type
, packet_type_esco_edr_vals
, "Unknown");
845 packet_type_table
= packet_type_esco_edr_table
;
846 } else if (payload_and_transport
== (TRANSPORT_ACL
| PAYLOAD_BR
)) {
847 proto_tree_add_item(header_tree
, hf_packet_header_broken_type_acl_br
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
849 packet_type
= (tvb_get_uint8(tvb
, offset
+ 1) >> 3) & 0xF;
850 packet_type_str
= val_to_str_const(packet_type
, packet_type_acl_br_vals
, "Unknown");
851 packet_type_table
= packet_type_acl_br_table
;
852 } else if (payload_and_transport
== (TRANSPORT_ACL
| PAYLOAD_EDR_2
) || payload_and_transport
== (TRANSPORT_ACL
| PAYLOAD_EDR_3
)) {
853 proto_tree_add_item(header_tree
, hf_packet_header_broken_type_acl_edr
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
855 packet_type
= (tvb_get_uint8(tvb
, offset
+ 1) >> 3) & 0xF;
856 packet_type_str
= val_to_str_const(packet_type
, packet_type_acl_edr_vals
, "Unknown");
857 packet_type_table
= packet_type_acl_edr_table
;
858 } else if (payload_and_transport
== (TRANSPORT_CPB
| PAYLOAD_BR
)) {
859 proto_tree_add_item(header_tree
, hf_packet_header_broken_type_cpb_br
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
861 packet_type
= (tvb_get_uint8(tvb
, offset
+ 1) >> 3) & 0xF;
862 packet_type_str
= val_to_str_const(packet_type
, packet_type_cpb_br_vals
, "Unknown");
863 packet_type_table
= packet_type_cpb_br_table
;
864 } else if (payload_and_transport
== (TRANSPORT_CPB
| PAYLOAD_EDR_2
) || payload_and_transport
== (TRANSPORT_ACL
| PAYLOAD_EDR_3
)) {
865 proto_tree_add_item(header_tree
, hf_packet_header_broken_type_cpb_edr
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
867 packet_type
= (tvb_get_uint8(tvb
, offset
+ 1) >> 3) & 0xF;
868 packet_type_str
= val_to_str_const(packet_type
, packet_type_cpb_edr_vals
, "Unknown");
869 packet_type_table
= packet_type_cpb_edr_table
;
870 } else if ((payload_and_transport
>> 4) == TRANSPORT_ANY
) {
871 proto_tree_add_item(header_tree
, hf_packet_header_broken_type_any
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
873 packet_type
= (tvb_get_uint8(tvb
, offset
+ 1) >> 3) & 0xF;
874 packet_type_str
= val_to_str_const(packet_type
, packet_type_any_vals
, "Unknown");
876 proto_tree_add_item(header_tree
, hf_packet_header_broken_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
879 proto_tree_add_item(header_tree
, hf_packet_header_broken_flow_control
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
880 proto_tree_add_item(header_tree
, hf_packet_header_broken_acknowledge_indication
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
881 proto_tree_add_item(header_tree
, hf_packet_header_broken_sequence_number
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
882 hec_item
= proto_tree_add_item(header_tree
, hf_packet_header_broken_header_error_check
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
883 } else if (header_mode
>= 0) {
884 // header format according to Core_v5.2.pdf Vol 2 Part B Chapter 6.4
885 header_item
= proto_tree_add_item(btbredr_rf_tree
, hf_packet_header
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
886 header_tree
= proto_item_add_subtree(header_item
, ett_bluetooth_header
);
888 proto_tree_add_item(header_tree
, hf_packet_header_lt_addr
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
889 ltaddr
= tvb_get_uint32(tvb
, offset
, ENC_LITTLE_ENDIAN
) & 7;
890 arqn
= (tvb_get_uint32(tvb
, offset
, ENC_LITTLE_ENDIAN
) >> 8) & 1;
891 seqn
= (tvb_get_uint32(tvb
, offset
, ENC_LITTLE_ENDIAN
) >> 9) & 1;
893 if (payload_and_transport
== (TRANSPORT_SCO
| PAYLOAD_BR
)) {
894 proto_tree_add_item(header_tree
, hf_packet_header_type_sco_br
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
896 packet_type
= (tvb_get_uint8(tvb
, offset
) >> 3) & 0xF;
897 packet_type_str
= val_to_str_const(packet_type
, packet_type_sco_br_vals
, "Unknown");
898 packet_type_table
= packet_type_sco_br_table
;
899 } else if (payload_and_transport
== (TRANSPORT_eSCO
| PAYLOAD_BR
)) {
900 proto_tree_add_item(header_tree
, hf_packet_header_type_esco_br
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
902 packet_type
= (tvb_get_uint8(tvb
, offset
) >> 3) & 0xF;
903 packet_type_str
= val_to_str_const(packet_type
, packet_type_esco_br_vals
, "Unknown");
904 packet_type_table
= packet_type_esco_br_table
;
905 } else if (payload_and_transport
== (TRANSPORT_eSCO
| PAYLOAD_EDR_2
) || payload_and_transport
== (TRANSPORT_eSCO
| PAYLOAD_EDR_3
)) {
906 proto_tree_add_item(header_tree
, hf_packet_header_type_esco_edr
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
908 packet_type
= (tvb_get_uint8(tvb
, offset
) >> 3) & 0xF;
909 packet_type_str
= val_to_str_const(packet_type
, packet_type_esco_edr_vals
, "Unknown");
910 packet_type_table
= packet_type_esco_edr_table
;
911 } else if (payload_and_transport
== (TRANSPORT_ACL
| PAYLOAD_BR
)) {
912 proto_tree_add_item(header_tree
, hf_packet_header_type_acl_br
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
914 packet_type
= (tvb_get_uint8(tvb
, offset
) >> 3) & 0xF;
915 packet_type_str
= val_to_str_const(packet_type
, packet_type_acl_br_vals
, "Unknown");
916 packet_type_table
= packet_type_acl_br_table
;
917 } else if (payload_and_transport
== (TRANSPORT_ACL
| PAYLOAD_EDR_2
) || payload_and_transport
== (TRANSPORT_ACL
| PAYLOAD_EDR_3
)) {
918 proto_tree_add_item(header_tree
, hf_packet_header_type_acl_edr
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
920 packet_type
= (tvb_get_uint8(tvb
, offset
) >> 3) & 0xF;
921 packet_type_str
= val_to_str_const(packet_type
, packet_type_acl_edr_vals
, "Unknown");
922 packet_type_table
= packet_type_acl_edr_table
;
923 } else if (payload_and_transport
== (TRANSPORT_CPB
| PAYLOAD_BR
)) {
924 proto_tree_add_item(header_tree
, hf_packet_header_type_cpb_br
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
926 packet_type
= (tvb_get_uint8(tvb
, offset
) >> 3) & 0xF;
927 packet_type_str
= val_to_str_const(packet_type
, packet_type_cpb_br_vals
, "Unknown");
928 packet_type_table
= packet_type_cpb_br_table
;
929 } else if (payload_and_transport
== (TRANSPORT_CPB
| PAYLOAD_EDR_2
) || payload_and_transport
== (TRANSPORT_ACL
| PAYLOAD_EDR_3
)) {
930 proto_tree_add_item(header_tree
, hf_packet_header_type_cpb_edr
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
932 packet_type
= (tvb_get_uint8(tvb
, offset
) >> 3) & 0xF;
933 packet_type_str
= val_to_str_const(packet_type
, packet_type_cpb_edr_vals
, "Unknown");
934 packet_type_table
= packet_type_cpb_edr_table
;
935 } else if ((payload_and_transport
>> 4) == TRANSPORT_ANY
) {
936 proto_tree_add_item(header_tree
, hf_packet_header_type_any
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
938 packet_type
= (tvb_get_uint8(tvb
, offset
) >> 3) & 0xF;
939 packet_type_str
= val_to_str_const(packet_type
, packet_type_any_vals
, "Unknown");
941 proto_tree_add_item(header_tree
, hf_packet_header_type
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
944 proto_tree_add_item(header_tree
, hf_packet_header_flow_control
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
945 proto_tree_add_item(header_tree
, hf_packet_header_acknowledge_indication
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
946 proto_tree_add_item(header_tree
, hf_packet_header_sequence_number
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
947 hec_item
= proto_tree_add_item(header_tree
, hf_packet_header_header_error_check
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
948 proto_tree_add_item(header_tree
, hf_packet_header_reserved
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
951 switch (header_mode
) {
953 col_set_str(pinfo
->cinfo
, COL_INFO
, (lap
== 0x9e8b33) ? "GIAC" : "DIAC");
957 expert_add_info(pinfo
, hec_item
, &ei_packet_header_with_hec_not_checked
);
961 expert_add_info(pinfo
, hec_item
, &ei_incorrect_packet_header_or_hec
);
965 expert_add_info(pinfo
, header_item
, &ei_broken_packet_header_format
);
972 if (header_mode
> 0 && ltaddr
)
973 connection_info
= lookup_connection_info(interface_id
, adapter_id
, lap
, ltaddr
, pinfo
->num
);
975 if (connection_info
&& direction
>= 0) {
976 set_address(&pinfo
->dl_src
, AT_ETHER
, sizeof(connection_info
->bd_addr
[0]), connection_info
->bd_addr
[direction
]);
977 set_address(&pinfo
->dl_dst
, AT_ETHER
, sizeof(connection_info
->bd_addr
[0]), connection_info
->bd_addr
[1 - direction
]);
978 set_address(&pinfo
->net_src
, AT_ETHER
, sizeof(connection_info
->bd_addr
[0]), connection_info
->bd_addr
[direction
]);
979 set_address(&pinfo
->net_dst
, AT_ETHER
, sizeof(connection_info
->bd_addr
[0]), connection_info
->bd_addr
[1 - direction
]);
981 clear_address(&pinfo
->dl_dst
);
982 clear_address(&pinfo
->net_dst
);
983 if (header_mode
> 0 && !ltaddr
&& device_info
) {
984 set_address(&pinfo
->dl_src
, AT_ETHER
, sizeof(device_info
->bd_addr
), device_info
->bd_addr
);
985 set_address(&pinfo
->net_src
, AT_ETHER
, sizeof(device_info
->bd_addr
), device_info
->bd_addr
);
987 clear_address(&pinfo
->dl_src
);
988 clear_address(&pinfo
->net_src
);
991 copy_address_shallow(&pinfo
->src
, &pinfo
->net_src
);
992 copy_address_shallow(&pinfo
->dst
, &pinfo
->net_dst
);
996 flags_item
= proto_tree_add_item(btbredr_rf_tree
, hf_flags
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
997 flags_tree
= proto_item_add_subtree(flags_item
, ett_flags
);
999 flags
= tvb_get_uint16(tvb
, offset
, ENC_LITTLE_ENDIAN
);
1001 reserved_item
= proto_tree_add_item(flags_tree
, hf_flags_reserved_15_14
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1002 if (flags
& 0xC000) {
1003 expert_add_info(pinfo
, reserved_item
, &ei_reserved_not_zero
);
1006 proto_tree_add_item(flags_tree
, hf_flags_mic_pass
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1007 proto_tree_add_item(flags_tree
, hf_flags_mic_checked
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1008 proto_tree_add_item(flags_tree
, hf_flags_crc_pass
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1009 proto_tree_add_item(flags_tree
, hf_flags_crc_checked
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1010 proto_tree_add_item(flags_tree
, hf_flags_hec_pass
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1011 proto_tree_add_item(flags_tree
, hf_flags_hec_checked
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1012 proto_tree_add_item(flags_tree
, hf_flags_reference_upper_addres_part_valid
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1013 proto_tree_add_item(flags_tree
, hf_flags_rf_channel_aliasing
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1014 proto_tree_add_item(flags_tree
, hf_flags_br_edr_data_present
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1015 proto_tree_add_item(flags_tree
, hf_flags_reference_lower_address_part_valid
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1016 proto_tree_add_item(flags_tree
, hf_flags_bredr_payload_decrypted
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1017 proto_tree_add_item(flags_tree
, hf_flags_noise_power_valid
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1018 proto_tree_add_item(flags_tree
, hf_flags_signal_power_valid
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1019 proto_tree_add_item(flags_tree
, hf_flags_packet_header_and_br_edr_payload_dewhitened
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1023 if ((flags
& (FLAGS_SIGNAL_POWER_VALID
| FLAGS_NOISE_POWER_VALID
)) == (FLAGS_SIGNAL_POWER_VALID
| FLAGS_NOISE_POWER_VALID
)) {
1024 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " (SP: %4i, NP: %4i)",
1025 (int)tvb_get_int8(tvb
, 1), (int)tvb_get_int8(tvb
, 2));
1026 } else if (flags
& FLAGS_SIGNAL_POWER_VALID
) {
1027 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " (SP: %4i)",
1028 (int)tvb_get_int8(tvb
, 1));
1029 } else if (flags
& FLAGS_NOISE_POWER_VALID
) {
1030 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " (NP: %4i)",
1031 (int)tvb_get_int8(tvb
, 2));
1034 if (flags
& FLAGS_PACKET_HEADER_AND_BR_EDR_PAYLOAD_DEWHITENED
)
1035 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", Packet Type: %s", packet_type_str
);
1037 // Packet Type Table
1038 if (payload_and_transport
== (TRANSPORT_SCO
| PAYLOAD_BR
)) {
1039 switch (packet_type
) {
1042 isochronous_length
= 0;
1043 isochronous_crc
= false;
1050 isochronous_length
= 0;
1051 isochronous_crc
= false;
1059 isochronous_length
= 0;
1060 isochronous_crc
= false;
1067 isochronous_length
= 10;
1068 isochronous_crc
= false;
1075 isochronous_length
= 20;
1076 isochronous_crc
= false;
1083 isochronous_length
= 30;
1084 isochronous_crc
= false;
1091 isochronous_length
= 10;
1092 isochronous_crc
= false;
1101 } else if (payload_and_transport
== (TRANSPORT_eSCO
| PAYLOAD_BR
)) {
1102 switch (packet_type
) {
1105 isochronous_length
= 0;
1106 isochronous_crc
= false;
1113 isochronous_length
= 30;
1114 isochronous_crc
= true;
1115 isochronous_esco
= true;
1122 isochronous_length
= 120;
1123 isochronous_crc
= true;
1124 isochronous_esco
= true;
1131 isochronous_length
= 180;
1132 isochronous_crc
= true;
1133 isochronous_esco
= true;
1142 } else if (payload_and_transport
== (TRANSPORT_eSCO
| PAYLOAD_EDR_2
) || payload_and_transport
== (TRANSPORT_eSCO
| PAYLOAD_EDR_3
)) {
1143 switch (packet_type
) {
1146 isochronous_length
= 0;
1147 isochronous_crc
= false;
1154 isochronous_length
= 60;
1155 isochronous_crc
= true;
1156 isochronous_esco
= true;
1163 isochronous_length
= 90;
1164 isochronous_crc
= true;
1165 isochronous_esco
= true;
1172 isochronous_length
= 360;
1173 isochronous_crc
= true;
1174 isochronous_esco
= true;
1181 isochronous_length
= 540;
1182 isochronous_crc
= true;
1183 isochronous_esco
= true;
1192 } else if (payload_and_transport
== (TRANSPORT_ACL
| PAYLOAD_BR
)) {
1193 switch (packet_type
) {
1196 isochronous_length
= 0;
1197 isochronous_crc
= false;
1204 isochronous_length
= 0;
1205 isochronous_crc
= false;
1213 isochronous_length
= 0;
1214 isochronous_crc
= false;
1221 isochronous_length
= 0;
1222 isochronous_crc
= false;
1229 isochronous_length
= 0;
1230 isochronous_crc
= false;
1237 isochronous_length
= 0;
1238 isochronous_crc
= false;
1245 isochronous_length
= 0;
1246 isochronous_crc
= false;
1253 isochronous_length
= 0;
1254 isochronous_crc
= false;
1261 isochronous_length
= 0;
1262 isochronous_crc
= false;
1271 } else if (payload_and_transport
== (TRANSPORT_ACL
| PAYLOAD_EDR_2
) || payload_and_transport
== (TRANSPORT_ACL
| PAYLOAD_EDR_3
)) {
1272 switch (packet_type
) {
1275 isochronous_length
= 0;
1276 isochronous_crc
= false;
1283 isochronous_length
= 0;
1284 isochronous_crc
= false;
1292 isochronous_length
= 0;
1293 isochronous_crc
= false;
1300 isochronous_length
= 0;
1301 isochronous_crc
= false;
1308 isochronous_length
= 0;
1309 isochronous_crc
= false;
1316 isochronous_length
= 0;
1317 isochronous_crc
= false;
1324 isochronous_length
= 0;
1325 isochronous_crc
= false;
1332 isochronous_length
= 0;
1333 isochronous_crc
= false;
1340 isochronous_length
= 0;
1341 isochronous_crc
= false;
1348 isochronous_length
= 0;
1349 isochronous_crc
= false;
1358 } else if (payload_and_transport
== (TRANSPORT_CPB
| PAYLOAD_BR
)) {
1359 switch (packet_type
) {
1361 isochronous_length
= 0;
1362 isochronous_crc
= false;
1369 isochronous_length
= 0;
1370 isochronous_crc
= false;
1377 isochronous_length
= 0;
1378 isochronous_crc
= false;
1385 isochronous_length
= 0;
1386 isochronous_crc
= false;
1393 isochronous_length
= 0;
1394 isochronous_crc
= false;
1401 isochronous_length
= 0;
1402 isochronous_crc
= false;
1409 isochronous_length
= 0;
1410 isochronous_crc
= false;
1419 } else if (payload_and_transport
== (TRANSPORT_CPB
| PAYLOAD_EDR_2
) || payload_and_transport
== (TRANSPORT_ACL
| PAYLOAD_EDR_3
)) {
1420 switch (packet_type
) {
1422 isochronous_length
= 0;
1423 isochronous_crc
= false;
1430 isochronous_length
= 0;
1431 isochronous_crc
= false;
1438 isochronous_length
= 0;
1439 isochronous_crc
= false;
1446 isochronous_length
= 0;
1447 isochronous_crc
= false;
1454 isochronous_length
= 0;
1455 isochronous_crc
= false;
1462 isochronous_length
= 0;
1463 isochronous_crc
= false;
1470 isochronous_length
= 0;
1471 isochronous_crc
= false;
1478 isochronous_length
= 0;
1479 isochronous_crc
= false;
1488 } else if ((payload_and_transport
>> 4) == TRANSPORT_ANY
) {
1489 switch (packet_type
) {
1492 isochronous_length
= 0;
1493 isochronous_crc
= false;
1500 isochronous_length
= 0;
1501 isochronous_crc
= false;
1509 isochronous_length
= 0;
1510 isochronous_crc
= false;
1521 if (flags
& FLAGS_BR_EDR_DATA_PRESENT
) {
1522 if (flags
& FLAGS_PACKET_HEADER_AND_BR_EDR_PAYLOAD_DEWHITENED
) {
1526 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
1527 if (packet_type_table
&& packet_type
> PACKET_TYPE_UNKNOWN
&&
1528 dissector_try_uint_with_data(packet_type_table
, packet_type
, next_tvb
, pinfo
, tree
, true, bluetooth_data
)) {
1529 offset
= tvb_reported_length(tvb
);
1531 if (isochronous_length
> 0 &&
1532 (!isochronous_crc
|| (flags
& (FLAGS_CRC_PASS
| FLAGS_CRC_CHECKED
)) == (FLAGS_CRC_PASS
| FLAGS_CRC_CHECKED
))) {
1533 int len
= tvb_captured_length_remaining(tvb
, offset
);
1534 if (isochronous_crc
)
1536 if (isochronous_length
> len
)
1537 isochronous_length
= len
;
1538 if (isochronous_length
> 0) {
1539 //next_tvb = tvb_new_subset_length(tvb, offset, isochronous_length);
1540 proto_item
*iso_item
= proto_tree_add_item(btbredr_rf_tree
, hf_isochronous_data
, tvb
, offset
, isochronous_length
, ENC_NA
);
1541 if (isochronous_crc
) {
1542 proto_item
*crc_item
= NULL
;
1543 crc_item
= proto_tree_add_item(btbredr_rf_tree
, hf_crc
, tvb
, offset
+ isochronous_length
, 2, ENC_LITTLE_ENDIAN
);
1544 if ((flags
& FLAGS_REFERENCE_UPPER_ADDRES_PART_VALID
) && !check_crc(uap
, tvb
, offset
, isochronous_length
+ 2))
1545 expert_add_info(pinfo
, crc_item
, &ei_incorrect_crc
);
1548 offset
+= isochronous_length
;
1549 if (connection_info
) {
1550 if (connection_info
->esco
!= isochronous_esco
)
1551 expert_add_info(pinfo
, iso_item
, &ei_esco_incorrect_ltaddr
);
1552 if (direction
>= 0 && connection_info
->esco
&&
1553 connection_info
->escosize
[direction
] != isochronous_length
)
1554 expert_add_info(pinfo
, iso_item
, &ei_esco_incorrect_length
);
1558 if (data_length
> 0 &&
1559 (!data_crc
|| (flags
& (FLAGS_CRC_PASS
| FLAGS_CRC_CHECKED
)) == (FLAGS_CRC_PASS
| FLAGS_CRC_CHECKED
))) {
1560 int len
= tvb_captured_length_remaining(tvb
, offset
);
1565 if (data_length
> len
)
1567 if (data_header
> 0) {
1568 if (len
< data_header
) {
1570 } else if (data_header
== 1) {
1571 uint8_t hdr
= tvb_get_uint8(tvb
, offset
);
1580 } else if (data_header
== 2) {
1581 uint16_t hdr
= tvb_get_uint16(tvb
, offset
, ENC_LITTLE_ENDIAN
);
1594 if (data_length
> 0 && !error
) {
1595 bool handled
= false;
1596 fragment_head
*frag_l2cap_msg
= NULL
;
1597 if (data_header
== 1) {
1598 proto_item
*pheader_item
= proto_tree_add_item(btbredr_rf_tree
, hf_payload_header1
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
1599 proto_tree
*pheader_tree
= proto_item_add_subtree(pheader_item
, ett_payload_header
);
1600 proto_tree_add_item(pheader_tree
, hf_payload_header1_llid
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
1601 proto_tree_add_item(pheader_tree
, hf_payload_header1_flow
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
1602 proto_tree_add_item(pheader_tree
, hf_payload_header1_length
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
1603 } else if (data_header
== 2) {
1604 proto_item
*pheader_item
= proto_tree_add_item(btbredr_rf_tree
, hf_payload_header2
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1605 proto_tree
*pheader_tree
= proto_item_add_subtree(pheader_item
, ett_payload_header
);
1606 proto_tree_add_item(pheader_tree
, hf_payload_header2_llid
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1607 proto_tree_add_item(pheader_tree
, hf_payload_header2_flow
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1608 proto_tree_add_item(pheader_tree
, hf_payload_header2_length
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1609 proto_tree_add_item(pheader_tree
, hf_payload_header2_rfu
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1611 if (!pinfo
->fd
->visited
) {
1612 frame_info
= wmem_new0(wmem_file_scope(), btbredr_frame_info_t
);
1613 p_add_proto_data(wmem_file_scope(), pinfo
, proto_btbredr_rf
, pinfo
->curr_layer_num
, frame_info
);
1614 if (connection_info
&& direction
>= 0) {
1615 frame_info
->retransmit
= (seqn
== connection_info
->reassembly
[direction
].seqn
);
1616 frame_info
->ack
= arqn
;
1617 frame_info
->l2cap_index
= pinfo
->num
;
1618 connection_info
->reassembly
[direction
].seqn
= seqn
;
1621 frame_info
= (btbredr_frame_info_t
*)p_get_proto_data(wmem_file_scope(), pinfo
, proto_btbredr_rf
, pinfo
->curr_layer_num
);
1623 if (packet_type
== 2) {
1625 next_tvb
= tvb_new_subset_length(tvb
, offset
+ data_header
, data_length
- data_header
);
1627 btbredr_fhs_data_t
*fhs_data
= wmem_new0(pinfo
->pool
, btbredr_fhs_data_t
);
1628 fhs_data
->bluetooth_data
= bluetooth_data
;
1629 fhs_data
->device_info
= device_info
;
1630 fhs_data
->connection_info
= connection_info
;
1631 call_dissector_with_data(btbredr_fhs_handle
, next_tvb
, pinfo
, tree
, fhs_data
);
1639 next_tvb
= tvb_new_subset_length(tvb
, offset
+ data_header
, data_length
- data_header
);
1642 call_dissector_with_data(btlmp_handle
, next_tvb
, pinfo
, tree
, connection_info
);
1646 case 0x02: // Start of or complete L2CAP message
1647 if (!btl2cap_handle
)
1649 if (frame_info
&& data_length
> data_header
) {
1650 unsigned pdu_len
= data_length
- data_header
;
1651 unsigned l2cap_len
= tvb_get_letohs(tvb
, offset
+ data_header
);
1652 if (l2cap_len
+ 4 <= pdu_len
) {
1653 bthci_acl_data_t
*acl_data
= wmem_new(pinfo
->pool
, bthci_acl_data_t
);
1654 acl_data
->interface_id
= interface_id
;
1655 acl_data
->adapter_id
= adapter_id
;
1656 acl_data
->chandle
= 0; /* No connection handle at this layer */
1657 acl_data
->remote_bd_addr_oui
= 0;
1658 acl_data
->remote_bd_addr_id
= 0;
1659 acl_data
->is_btle
= true;
1660 acl_data
->is_btle_retransmit
= false;
1661 acl_data
->adapter_disconnect_in_frame
= &bluetooth_max_disconnect_in_frame
;
1662 acl_data
->disconnect_in_frame
= &bluetooth_max_disconnect_in_frame
;
1663 next_tvb
= tvb_new_subset_length(tvb
, offset
+ data_header
, pdu_len
);
1664 call_dissector_with_data(btl2cap_handle
, next_tvb
, pinfo
, tree
, acl_data
);
1666 col_set_str(pinfo
->cinfo
, COL_INFO
, "L2CAP Data");
1667 if (!pinfo
->fd
->visited
&& connection_info
&& direction
>= 0) {
1668 connection_info
->reassembly
[direction
].l2cap_index
= pinfo
->num
;
1669 connection_info
->reassembly
[direction
].segment_len_rem
= 0;
1673 pinfo
->fragmented
= true;
1674 if (!frame_info
->retransmit
&& connection_info
&& direction
>= 0) {
1675 if (!pinfo
->fd
->visited
) {
1676 connection_info
->reassembly
[direction
].l2cap_index
= pinfo
->num
;
1677 connection_info
->reassembly
[direction
].segment_len_rem
= l2cap_len
+ 4 - pdu_len
;
1678 frame_info
->more_fragments
= 1;
1680 frag_l2cap_msg
= fragment_add_seq_next(&l2cap_msg_reassembly_table
,
1681 tvb
, offset
+ data_header
,
1683 frame_info
->l2cap_index
, /* uint32_t ID for fragments belonging together */
1685 pdu_len
, /* Fragment length */
1686 frame_info
->more_fragments
); /* More fragments */
1687 process_reassembled_data(tvb
, offset
+ data_header
, pinfo
,
1688 "Reassembled L2CAP",
1690 &l2cap_msg_frag_items
,
1694 proto_tree_add_item(btbredr_rf_tree
, hf_l2cap_fragment
, tvb
, offset
+ data_header
, pdu_len
, ENC_NA
);
1696 col_set_str(pinfo
->cinfo
, COL_INFO
, "L2CAP Fragment Start");
1700 case 0x01: /* Continuation fragment of an L2CAP message, or an Empty PDU */
1701 if (!btl2cap_handle
)
1703 if (!frame_info
|| data_length
<= data_header
) {
1704 col_set_str(pinfo
->cinfo
, COL_INFO
, "Empty PDU");
1707 pinfo
->fragmented
= true;
1708 if (!frame_info
->retransmit
&& connection_info
&& direction
>= 0) {
1709 unsigned pdu_len
= data_length
- data_header
;
1710 if (!pinfo
->fd
->visited
) {
1711 if (connection_info
->reassembly
[direction
].segment_len_rem
> 0) {
1712 if (connection_info
->reassembly
[direction
].segment_len_rem
>= pdu_len
) {
1713 connection_info
->reassembly
[direction
].segment_len_rem
-= pdu_len
;
1714 frame_info
->l2cap_index
= connection_info
->reassembly
[direction
].l2cap_index
;
1717 * Missing fragment for previous L2CAP and fragment start for this.
1718 * Set more_fragments and increase l2cap_index to avoid reassembly.
1720 frame_info
->more_fragments
= 1;
1721 frame_info
->missing_start
= 1;
1722 connection_info
->reassembly
[direction
].l2cap_index
= pinfo
->num
;
1723 connection_info
->reassembly
[direction
].segment_len_rem
= 0;
1725 frame_info
->more_fragments
= (connection_info
->reassembly
[direction
].segment_len_rem
> 0);
1728 * Missing fragment start.
1729 * Set more_fragments and increase l2cap_index to avoid reassembly.
1731 frame_info
->more_fragments
= 1;
1732 frame_info
->missing_start
= 1;
1733 connection_info
->reassembly
[direction
].l2cap_index
= pinfo
->num
;
1734 connection_info
->reassembly
[direction
].segment_len_rem
= 0;
1737 frag_l2cap_msg
= fragment_add_seq_next(&l2cap_msg_reassembly_table
,
1738 tvb
, offset
+ data_header
,
1740 frame_info
->l2cap_index
, /* uint32_t ID for fragments belonging together */
1742 pdu_len
, /* Fragment length */
1743 frame_info
->more_fragments
); /* More fragments */
1744 next_tvb
= process_reassembled_data(tvb
, offset
, pinfo
,
1745 "Reassembled L2CAP",
1747 &l2cap_msg_frag_items
,
1752 bthci_acl_data_t
*acl_data
= wmem_new(pinfo
->pool
, bthci_acl_data_t
);
1753 acl_data
->interface_id
= interface_id
;
1754 acl_data
->adapter_id
= adapter_id
;
1755 acl_data
->chandle
= 0; /* No connection handle at this layer */
1756 acl_data
->remote_bd_addr_oui
= 0;
1757 acl_data
->remote_bd_addr_id
= 0;
1758 acl_data
->is_btle
= true;
1759 acl_data
->is_btle_retransmit
= false;
1760 acl_data
->adapter_disconnect_in_frame
= &bluetooth_max_disconnect_in_frame
;
1761 acl_data
->disconnect_in_frame
= &bluetooth_max_disconnect_in_frame
;
1762 call_dissector_with_data(btl2cap_handle
, next_tvb
, pinfo
, tree
, acl_data
);
1764 col_set_str(pinfo
->cinfo
, COL_INFO
, "L2CAP Data");
1766 proto_item
*item
= proto_tree_add_item(btbredr_rf_tree
, hf_l2cap_fragment
, tvb
, offset
+ data_header
, data_length
- data_header
, ENC_NA
);
1767 if (frame_info
->missing_start
)
1768 expert_add_info(pinfo
, item
, &ei_missing_fragment_start
);
1770 col_set_str(pinfo
->cinfo
, COL_INFO
, "L2CAP Fragment");
1778 proto_tree_add_item(btbredr_rf_tree
, hf_asynchronous_data
, tvb
, offset
+ data_header
, data_length
- data_header
, ENC_NA
);
1780 proto_item
*crc_item
= NULL
;
1781 crc_item
= proto_tree_add_item(btbredr_rf_tree
, hf_crc
, tvb
, offset
+ data_length
, 2, ENC_LITTLE_ENDIAN
);
1782 if ((flags
& FLAGS_REFERENCE_UPPER_ADDRES_PART_VALID
) && !check_crc(uap
, tvb
, offset
, data_length
+ 2))
1783 expert_add_info(pinfo
, crc_item
, &ei_incorrect_crc
);
1786 offset
+= data_length
;
1789 if (tvb_captured_length_remaining(tvb
, offset
) > 0)
1790 proto_tree_add_item(btbredr_rf_tree
, hf_data
, tvb
, offset
, tvb_captured_length_remaining(tvb
, offset
), ENC_NA
);
1793 proto_tree_add_item(btbredr_rf_tree
, hf_encrypted_data
, tvb
, offset
, tvb_captured_length_remaining(tvb
, offset
), ENC_NA
);
1794 offset
= tvb_reported_length(tvb
);
1797 proto_tree_add_item(btbredr_rf_tree
, hf_whitened_data
, tvb
, offset
, tvb_captured_length_remaining(tvb
, offset
), ENC_NA
);
1798 offset
= tvb_reported_length(tvb
);
1801 if (tvb_captured_length_remaining(tvb
, offset
) > 0)
1802 proto_tree_add_expert(btbredr_rf_tree
, pinfo
, &ei_unexpected_data
, tvb
, offset
, tvb_captured_length_remaining(tvb
, offset
));
1803 offset
= tvb_reported_length(tvb
);
1806 if (!pinfo
->fd
->visited
) {
1809 addr
= (address
*) wmem_memdup(wmem_file_scope(), &pinfo
->dl_src
, sizeof(address
));
1810 addr
->data
= wmem_memdup(wmem_file_scope(), pinfo
->dl_src
.data
, pinfo
->dl_src
.len
);
1811 p_add_proto_data(wmem_file_scope(), pinfo
, proto_bluetooth
, BLUETOOTH_DATA_SRC
, addr
);
1813 addr
= (address
*) wmem_memdup(wmem_file_scope(), &pinfo
->dl_dst
, sizeof(address
));
1814 addr
->data
= wmem_memdup(wmem_file_scope(), pinfo
->dl_dst
.data
, pinfo
->dl_dst
.len
);
1815 p_add_proto_data(wmem_file_scope(), pinfo
, proto_bluetooth
, BLUETOOTH_DATA_DST
, addr
);
1822 dissect_btbredr_fhs(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
1824 proto_item
*btbredr_fhs_item
;
1825 proto_tree
*btbredr_fhs_tree
;
1827 uint32_t interface_id
;
1828 uint32_t adapter_id
;
1829 uint64_t parity_lap_eir_sp_sr
;
1833 uint32_t ltaddr_clk_pgscan
;
1835 device_info_t
*device_info
= NULL
;
1836 connection_info_t
*connection_info
= NULL
;
1837 btbredr_fhs_data_t
*fhs_data
= (btbredr_fhs_data_t
*) data
;
1839 btbredr_fhs_item
= proto_tree_add_item(tree
, proto_btbredr_fhs
, tvb
, offset
, -1, ENC_NA
);
1840 btbredr_fhs_tree
= proto_item_add_subtree(btbredr_fhs_item
, ett_btbredr_fhs
);
1842 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "BT BR/EDR FHS");
1844 if (fhs_data
->bluetooth_data
)
1845 interface_id
= fhs_data
->bluetooth_data
->interface_id
;
1846 else if (pinfo
->rec
->presence_flags
& WTAP_HAS_INTERFACE_ID
)
1847 interface_id
= pinfo
->rec
->rec_header
.packet_header
.interface_id
;
1849 interface_id
= HCI_INTERFACE_DEFAULT
;
1851 if (fhs_data
->bluetooth_data
)
1852 adapter_id
= fhs_data
->bluetooth_data
->adapter_id
;
1854 adapter_id
= HCI_ADAPTER_DEFAULT
;
1856 proto_tree_add_item(btbredr_fhs_tree
, hf_fhs_parity
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
1857 proto_tree_add_item(btbredr_fhs_tree
, hf_fhs_lap
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
1858 proto_tree_add_item(btbredr_fhs_tree
, hf_fhs_eir
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
1859 proto_tree_add_item(btbredr_fhs_tree
, hf_fhs_reserved
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
1860 proto_tree_add_item(btbredr_fhs_tree
, hf_fhs_sr
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
1861 proto_tree_add_item(btbredr_fhs_tree
, hf_fhs_sp
, tvb
, offset
, 8, ENC_LITTLE_ENDIAN
);
1862 parity_lap_eir_sp_sr
= tvb_get_uint64(tvb
, offset
, ENC_LITTLE_ENDIAN
);
1863 lap
= (parity_lap_eir_sp_sr
>> 34) & 0xffffff;
1865 proto_tree_add_item(btbredr_fhs_tree
, hf_fhs_uap
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
1866 uap
= tvb_get_uint8(tvb
, offset
);
1868 proto_tree_add_item(btbredr_fhs_tree
, hf_fhs_nap
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
1869 nap
= tvb_get_uint16(tvb
, offset
, ENC_LITTLE_ENDIAN
);
1871 proto_tree_add_item(btbredr_fhs_tree
, hf_fhs_class
, tvb
, offset
, 3, ENC_LITTLE_ENDIAN
);
1873 proto_tree_add_item(btbredr_fhs_tree
, hf_fhs_ltaddr
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
1874 proto_tree_add_item(btbredr_fhs_tree
, hf_fhs_clk
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
1875 proto_tree_add_item(btbredr_fhs_tree
, hf_fhs_pagescanmode
, tvb
, offset
, 4, ENC_LITTLE_ENDIAN
);
1876 ltaddr_clk_pgscan
= tvb_get_uint32(tvb
, offset
, ENC_LITTLE_ENDIAN
);
1878 ltaddr
= ltaddr_clk_pgscan
& 0x00000007;
1881 wmem_tree_key_t key
[4];
1883 key
[0].key
= &interface_id
;
1885 key
[1].key
= &adapter_id
;
1891 device_info
= (device_info_t
*) wmem_tree_lookup32_array(device_info_tree
, key
);
1892 if (!device_info
&& !pinfo
->fd
->visited
) {
1893 device_info
= wmem_new0(wmem_file_scope(), device_info_t
);
1894 device_info
->interface_id
= interface_id
;
1895 device_info
->adapter_id
= adapter_id
;
1896 device_info
->bd_addr
[0] = nap
>> 8;
1897 device_info
->bd_addr
[1] = nap
>> 0;
1898 device_info
->bd_addr
[2] = uap
;
1899 device_info
->bd_addr
[3] = lap
>> 16;
1900 device_info
->bd_addr
[4] = lap
>> 8;
1901 device_info
->bd_addr
[5] = lap
;
1902 device_info
->dir
= pinfo
->p2p_dir
;
1903 wmem_tree_insert32_array(device_info_tree
, key
, device_info
);
1907 connection_info
= lookup_connection_info(interface_id
, adapter_id
, lap
, ltaddr
, pinfo
->num
);
1908 if (!pinfo
->fd
->visited
) {
1909 if (connection_info
&& fhs_data
->device_info
&&
1910 !memcmp(connection_info
->bd_addr
[BDADDR_PERIPHERAL
], null_bd_addr
, 6))
1911 memcpy(connection_info
->bd_addr
[BDADDR_PERIPHERAL
], fhs_data
->device_info
->bd_addr
, 6);
1912 if (!connection_info
&& device_info
) {
1913 wmem_tree_key_t key
[6];
1915 key
[0].key
= &interface_id
;
1917 key
[1].key
= &adapter_id
;
1921 key
[3].key
= <addr
;
1923 key
[4].key
= &pinfo
->num
;
1926 connection_info
= wmem_new0(wmem_file_scope(), connection_info_t
);
1927 connection_info
->interface_id
= interface_id
;
1928 connection_info
->adapter_id
= adapter_id
;
1929 connection_info
->lt_addr
= ltaddr
;
1930 connection_info
->timestamp
= pinfo
->abs_ts
;
1931 connection_info
->btclock
= (ltaddr_clk_pgscan
>> 3) & 0x3ffffff;
1932 memcpy(connection_info
->bd_addr
[BDADDR_CENTRAL
], device_info
->bd_addr
, 6);
1933 if (fhs_data
->device_info
)
1934 memcpy(connection_info
->bd_addr
[BDADDR_PERIPHERAL
], fhs_data
->device_info
->bd_addr
, 6);
1935 wmem_tree_insert32_array(connection_info_tree
, key
, connection_info
);
1940 set_address(&pinfo
->dl_src
, AT_ETHER
, sizeof(device_info
->bd_addr
), device_info
->bd_addr
);
1941 set_address(&pinfo
->net_src
, AT_ETHER
, sizeof(device_info
->bd_addr
), device_info
->bd_addr
);
1942 copy_address_shallow(&pinfo
->src
, &pinfo
->net_src
);
1944 if (fhs_data
->device_info
) {
1945 set_address(&pinfo
->dl_dst
, AT_ETHER
, sizeof(fhs_data
->device_info
->bd_addr
), fhs_data
->device_info
->bd_addr
);
1946 set_address(&pinfo
->net_dst
, AT_ETHER
, sizeof(fhs_data
->device_info
->bd_addr
), fhs_data
->device_info
->bd_addr
);
1947 copy_address_shallow(&pinfo
->dst
, &pinfo
->net_dst
);
1953 proto_register_btbredr_rf(void)
1955 expert_module_t
*expert_module
;
1957 static hf_register_info hf
[] = {
1959 { "RF Channel", "btbredr_rf.rf_channel",
1960 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1963 { &hf_uncertain_rf_channel
,
1964 { "Uncertain RF Channel", "btbredr_rf.uncertain_rf_channel",
1965 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1969 { "Signal Power", "btbredr_rf.signal_power",
1970 FT_INT8
, BASE_DEC
, NULL
, 0x00,
1971 "Signal Power in dBm", HFILL
}
1973 { &hf_invalid_signal_power
,
1974 { "Invalid Signal Power", "btbredr_rf.invalid.signal_power",
1975 FT_INT8
, BASE_DEC
, NULL
, 0x00,
1979 { "Noise Power", "btbredr_rf.noise_power",
1980 FT_INT8
, BASE_DEC
, NULL
, 0x00,
1981 "Noise Power in dBm", HFILL
}
1983 { &hf_invalid_noise_power
,
1984 { "Invalid Noise Power", "btbredr_rf.invalid.noise_power",
1985 FT_INT8
, BASE_DEC
, NULL
, 0x00,
1988 { &hf_access_address_offenses
,
1989 { "Access Address Offenses", "btbredr_rf.access_address_offenses",
1990 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1993 { &hf_payload_transport_rate
,
1994 { "Payload Transport Rate", "btbredr_rf.payload_transport_rate",
1995 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
1998 { &hf_payload_transport_rate_ignored
,
1999 { "Payload Transport Rate: Ignored", "btbredr_rf.payload_transport_rate.ignored",
2000 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
2001 "BT Packet Header is ignored and there is no payload", HFILL
}
2003 { &hf_payload_transport_rate_transport
,
2004 { "Transport", "btbredr_rf.payload_transport_rate.transport",
2005 FT_UINT8
, BASE_HEX
, VALS(payload_transport_rate_transport_vals
), 0xF0,
2008 { &hf_payload_transport_rate_payload
,
2009 { "Payload", "btbredr_rf.payload_transport_rate.payload",
2010 FT_UINT8
, BASE_HEX
, VALS(payload_transport_rate_payload_vals
), 0x0F,
2013 { &hf_corrected_header_bits
,
2014 { "Corrected Header Bits", "btbredr_rf.corrected_header_bits",
2015 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
2018 { &hf_corrected_payload_bits
,
2019 { "Corrected Payload Bits", "btbredr_rf.corrected_payload_bits",
2020 FT_INT16
, BASE_DEC
, NULL
, 0x00,
2023 { &hf_lower_address_part
,
2024 { "Lower Address Part", "btbredr_rf.lower_address_part",
2025 FT_UINT32
, BASE_HEX
, NULL
, 0x00,
2028 { &hf_reference_lower_address_part
,
2029 { "Reference Lower Address Part", "btbredr_rf.reference_lower_address_part",
2030 FT_UINT24
, BASE_HEX
, NULL
, 0x00,
2033 { &hf_invalid_reference_lower_address_part
,
2034 { "Invalid Reference Lower Address Part", "btbredr_rf.invalid.reference_lower_address_part",
2035 FT_UINT24
, BASE_HEX
, NULL
, 0x00,
2038 { &hf_reference_upper_addres_part
,
2039 { "Reference Upper Address Part", "btbredr_rf.reference_upper_address_part",
2040 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
2043 { &hf_invalid_reference_upper_addres_part
,
2044 { "Invalid Reference Upper Address Part", "btbredr_rf.invalid.reference_upper_address_part",
2045 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
2048 { &hf_whitened_packet_header
,
2049 { "Whitened Packet Header", "btbredr_rf.whitened.packet_header",
2050 FT_UINT32
, BASE_HEX
, NULL
, 0x00,
2053 { &hf_invalid_packet_header
,
2054 { "Invalid Packet Header", "btbredr_rf.invalid.packet_header",
2055 FT_UINT32
, BASE_HEX
, NULL
, 0x00,
2058 { &hf_packet_header
,
2059 { "Packet Header", "btbredr_rf.packet_header",
2060 FT_UINT32
, BASE_HEX
, NULL
, 0x00,
2063 { &hf_packet_header_lt_addr
,
2064 { "LT_ADDR", "btbredr_rf.packet_header.lt_addr",
2065 FT_UINT32
, BASE_HEX
, NULL
, 0x00000007,
2068 { &hf_packet_header_type
,
2069 { "Type", "btbredr_rf.packet_header.type",
2070 FT_UINT32
, BASE_HEX
, NULL
, 0x00000078,
2073 { &hf_packet_header_type_any
,
2074 { "Type", "btbredr_rf.packet_header.type",
2075 FT_UINT32
, BASE_HEX
, VALS(packet_type_any_vals
), 0x00000078,
2078 { &hf_packet_header_type_sco_br
,
2079 { "Type", "btbredr_rf.packet_header.type",
2080 FT_UINT32
, BASE_HEX
, VALS(packet_type_sco_br_vals
), 0x00000078,
2083 { &hf_packet_header_type_esco_br
,
2084 { "Type", "btbredr_rf.packet_header.type",
2085 FT_UINT32
, BASE_HEX
, VALS(packet_type_esco_br_vals
), 0x00000078,
2088 { &hf_packet_header_type_esco_edr
,
2089 { "Type", "btbredr_rf.packet_header.type",
2090 FT_UINT32
, BASE_HEX
, VALS(packet_type_esco_edr_vals
), 0x00000078,
2093 { &hf_packet_header_type_acl_br
,
2094 { "Type", "btbredr_rf.packet_header.type",
2095 FT_UINT32
, BASE_HEX
, VALS(packet_type_acl_br_vals
), 0x00000078,
2098 { &hf_packet_header_type_acl_edr
,
2099 { "Type", "btbredr_rf.packet_header.type",
2100 FT_UINT32
, BASE_HEX
, VALS(packet_type_acl_edr_vals
), 0x00000078,
2103 { &hf_packet_header_type_cpb_br
,
2104 { "Type", "btbredr_rf.packet_header.type",
2105 FT_UINT32
, BASE_HEX
, VALS(packet_type_cpb_br_vals
), 0x00000078,
2108 { &hf_packet_header_type_cpb_edr
,
2109 { "Type", "btbredr_rf.packet_header.type",
2110 FT_UINT32
, BASE_HEX
, VALS(packet_type_cpb_edr_vals
), 0x00000078,
2113 { &hf_packet_header_flow_control
,
2114 { "Flow Control", "btbredr_rf.packet_header.flow_control",
2115 FT_BOOLEAN
, 32, NULL
, 0x00000080,
2118 { &hf_packet_header_acknowledge_indication
,
2119 { "ARQN", "btbredr_rf.packet_header.arqn",
2120 FT_BOOLEAN
, 32, NULL
, 0x00000100,
2121 "Acknowledge Indication", HFILL
}
2123 { &hf_packet_header_sequence_number
,
2124 { "SEQN", "btbredr_rf.packet_header.seqn",
2125 FT_BOOLEAN
, 32, NULL
, 0x00000200,
2126 "Sequence Number", HFILL
}
2128 { &hf_packet_header_header_error_check
,
2129 { "HEC", "btbredr_rf.packet_header.hec",
2130 FT_UINT32
, BASE_HEX
, NULL
, 0x0003FC00,
2131 "Header Error Check", HFILL
}
2133 { &hf_packet_header_reserved
,
2134 { "Reserved", "btbredr_rf.packet_header.reserved",
2135 FT_UINT32
, BASE_HEX
, NULL
, 0xFFFC0000,
2138 { &hf_packet_header_broken_lt_addr
,
2139 { "LT_ADDR", "btbredr_rf.packet_header.lt_addr",
2140 FT_UINT32
, BASE_HEX
, NULL
, 0x00038000,
2143 { &hf_packet_header_broken_type
,
2144 { "Type", "btbredr_rf.packet_header.type",
2145 FT_UINT32
, BASE_HEX
, NULL
, 0x00007800,
2148 { &hf_packet_header_broken_type_any
,
2149 { "Type", "btbredr_rf.packet_header.type",
2150 FT_UINT32
, BASE_HEX
, VALS(packet_type_any_vals
), 0x00007800,
2153 { &hf_packet_header_broken_type_sco_br
,
2154 { "Type", "btbredr_rf.packet_header.type",
2155 FT_UINT32
, BASE_HEX
, VALS(packet_type_sco_br_vals
), 0x00007800,
2158 { &hf_packet_header_broken_type_esco_br
,
2159 { "Type", "btbredr_rf.packet_header.type",
2160 FT_UINT32
, BASE_HEX
, VALS(packet_type_esco_br_vals
), 0x00007800,
2163 { &hf_packet_header_broken_type_esco_edr
,
2164 { "Type", "btbredr_rf.packet_header.type",
2165 FT_UINT32
, BASE_HEX
, VALS(packet_type_esco_edr_vals
), 0x00007800,
2168 { &hf_packet_header_broken_type_acl_br
,
2169 { "Type", "btbredr_rf.packet_header.type",
2170 FT_UINT32
, BASE_HEX
, VALS(packet_type_acl_br_vals
), 0x00007800,
2173 { &hf_packet_header_broken_type_acl_edr
,
2174 { "Type", "btbredr_rf.packet_header.type",
2175 FT_UINT32
, BASE_HEX
, VALS(packet_type_acl_edr_vals
), 0x00007800,
2178 { &hf_packet_header_broken_type_cpb_br
,
2179 { "Type", "btbredr_rf.packet_header.type",
2180 FT_UINT32
, BASE_HEX
, VALS(packet_type_cpb_br_vals
), 0x00007800,
2183 { &hf_packet_header_broken_type_cpb_edr
,
2184 { "Type", "btbredr_rf.packet_header.type",
2185 FT_UINT32
, BASE_HEX
, VALS(packet_type_cpb_edr_vals
), 0x00007800,
2188 { &hf_packet_header_broken_flow_control
,
2189 { "Flow Control", "btbredr_rf.packet_header.flow_control",
2190 FT_BOOLEAN
, 32, NULL
, 0x00000400,
2193 { &hf_packet_header_broken_acknowledge_indication
,
2194 { "ARQN", "btbredr_rf.packet_header.arqn",
2195 FT_BOOLEAN
, 32, NULL
, 0x00000200,
2196 "Acknowledge Indication", HFILL
}
2198 { &hf_packet_header_broken_sequence_number
,
2199 { "SEQN", "btbredr_rf.packet_header.seqn",
2200 FT_BOOLEAN
, 32, NULL
, 0x00000100,
2201 "Sequence Number", HFILL
}
2203 { &hf_packet_header_broken_header_error_check
,
2204 { "HEC", "btbredr_rf.packet_header.hec",
2205 FT_UINT32
, BASE_HEX
, NULL
, 0x000000FF,
2206 "Header Error Check", HFILL
}
2208 { &hf_whitened_data
,
2209 { "Whitened Data", "btbredr_rf.whitened.data",
2210 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2213 { &hf_encrypted_data
,
2214 { "Encrypted Data", "btbredr_rf.encrypted.data",
2215 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2219 { "Data", "btbredr_rf.data",
2220 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2223 { &hf_isochronous_data
,
2224 { "Isochronous Data", "btbredr_rf.isochronous_data",
2225 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2228 { &hf_asynchronous_data
,
2229 { "Asynchronous Data", "btbredr_rf.asynchronous_data",
2230 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2233 { &hf_l2cap_fragment
,
2234 { "L2CAP Fragment", "btbredr_rf.l2cap_data",
2235 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2239 { "CRC", "btbredr_rf.crc",
2240 FT_UINT16
, BASE_HEX
, NULL
, 0x00,
2244 { "Flags", "btbredr_rf.flags",
2245 FT_UINT16
, BASE_HEX
, NULL
, 0x00,
2248 { &hf_flags_reserved_15_14
,
2249 { "Reserved", "btbredr_rf.flags.reserved.15_14",
2250 FT_UINT16
, BASE_HEX
, NULL
, 0xC000,
2253 { &hf_flags_mic_pass
,
2254 { "MIC Pass", "btbredr_rf.flags.mic_pass",
2255 FT_BOOLEAN
, 16, NULL
, 0x2000,
2258 { &hf_flags_mic_checked
,
2259 { "MIC Checked", "btbredr_rf.flags.mic_check",
2260 FT_BOOLEAN
, 16, NULL
, 0x1000,
2263 { &hf_flags_crc_pass
,
2264 { "CRC Pass", "btbredr_rf.flags.crc_pass",
2265 FT_BOOLEAN
, 16, NULL
, 0x0800,
2268 { &hf_flags_crc_checked
,
2269 { "CRC Checked", "btbredr_rf.flags.crc_check",
2270 FT_BOOLEAN
, 16, NULL
, 0x0400,
2273 { &hf_flags_hec_pass
,
2274 { "HEC Pass", "btbredr_rf.flags.hec_pass",
2275 FT_BOOLEAN
, 16, NULL
, 0x0200,
2278 { &hf_flags_hec_checked
,
2279 { "HEC Checked", "btbredr_rf.flags.hec_check",
2280 FT_BOOLEAN
, 16, NULL
, 0x0100,
2283 { &hf_flags_reference_upper_addres_part_valid
,
2284 { "Reference Upper Address Part Valid", "btbredr_rf.flags.reference_upper_address_part_valid",
2285 FT_BOOLEAN
, 16, NULL
, 0x0080,
2288 { &hf_flags_rf_channel_aliasing
,
2289 { "RF Channel Aliasing", "btbredr_rf.flags.rf_channel_aliasing",
2290 FT_BOOLEAN
, 16, NULL
, 0x0040,
2293 { &hf_flags_br_edr_data_present
,
2294 { "BR or EDR Data Present", "btbredr_rf.flags.bredr_data_present",
2295 FT_BOOLEAN
, 16, NULL
, 0x0020,
2298 { &hf_flags_reference_lower_address_part_valid
,
2299 { "Reference Lower Address Part Valid", "btbredr_rf.flags.reference_lower_address_part_valid",
2300 FT_BOOLEAN
, 16, NULL
, 0x0010,
2303 { &hf_flags_bredr_payload_decrypted
,
2304 { "BR or EDR Payload Decrypted", "btbredr_rf.flags.bredr_payload_decrypted",
2305 FT_BOOLEAN
, 16, NULL
, 0x0008,
2308 { &hf_flags_noise_power_valid
,
2309 { "Noise Power Valid", "btbredr_rf.flags.noise_power_valid",
2310 FT_BOOLEAN
, 16, NULL
, 0x0004,
2313 { &hf_flags_signal_power_valid
,
2314 { "Signal Power Valid", "btbredr_rf.flags.signal_power_valid",
2315 FT_BOOLEAN
, 16, NULL
, 0x0002,
2318 { &hf_flags_packet_header_and_br_edr_payload_dewhitened
,
2319 { "Packet Header and BR/EDR Payload Dewhitened", "btbredr_rf.flags.pkt_hdr_and_br_edr_payload_dewhitened",
2320 FT_BOOLEAN
, 16, NULL
, 0x0001,
2323 { &hf_payload_header2
,
2324 { "Payload Header", "btbredr_rf.payload_header",
2325 FT_UINT16
, BASE_HEX
, NULL
, 0x00,
2328 { &hf_payload_header2_llid
,
2329 { "LLID", "btbredr_rf.payload_header.llid",
2330 FT_UINT16
, BASE_HEX
, NULL
, 0x0003,
2333 { &hf_payload_header2_flow
,
2334 { "Flow", "btbredr_rf.payload_header.flow",
2335 FT_UINT16
, BASE_HEX
, NULL
, 0x0004,
2338 { &hf_payload_header2_length
,
2339 { "Length", "btbredr_rf.payload_header.length",
2340 FT_UINT16
, BASE_HEX
, NULL
, 0x1ff8,
2343 { &hf_payload_header2_rfu
,
2344 { "RFU", "btbredr_rf.payload_header.rfu",
2345 FT_UINT16
, BASE_HEX
, NULL
, 0xe000,
2348 { &hf_payload_header1
,
2349 { "Payload Header", "btbredr_rf.payload_header",
2350 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
2353 { &hf_payload_header1_llid
,
2354 { "LLID", "btbredr_rf.payload_header.llid",
2355 FT_UINT8
, BASE_HEX
, NULL
, 0x03,
2358 { &hf_payload_header1_flow
,
2359 { "Flow", "btbredr_rf.payload_header.flow",
2360 FT_UINT8
, BASE_HEX
, NULL
, 0x04,
2363 { &hf_payload_header1_length
,
2364 { "Length", "btbredr_rf.payload_header.length",
2365 FT_UINT8
, BASE_HEX
, NULL
, 0xf8,
2368 { &hf_l2cap_msg_fragments
,
2369 { "L2CAP fragments", "btbredr_rf.l2cap.fragments",
2370 FT_NONE
, BASE_NONE
, NULL
, 0x00,
2373 { &hf_l2cap_msg_fragment
,
2374 { "L2CAP fragment", "btbredr_rf.l2cap.fragment",
2375 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x00,
2378 { &hf_l2cap_msg_fragment_overlap
,
2379 { "L2CAP fragment overlap", "btbredr_rf.l2cap.fragment.overlap",
2380 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
2383 { &hf_l2cap_msg_fragment_overlap_conflicts
,
2384 { "L2CAP fragment overlapping with conflicting data", "btbredr_rf.l2cap.fragment.overlap.conflicts",
2385 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
2388 { &hf_l2cap_msg_fragment_multiple_tails
,
2389 { "L2CAP has multiple tail fragments", "btbredr_rf.l2cap.fragment.multiple_tails",
2390 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
2393 { &hf_l2cap_msg_fragment_too_long_fragment
,
2394 { "L2CAP fragment too long", "btbredr_rf.l2cap.fragment.too_long_fragment",
2395 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
2398 { &hf_l2cap_msg_fragment_error
,
2399 { "L2CAP defragmentation error", "btbredr_rf.l2cap.fragment.error",
2400 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x00,
2403 { &hf_l2cap_msg_fragment_count
,
2404 { "L2CAP fragment count", "btbredr_rf.l2cap.fragment.count",
2405 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
2408 { &hf_l2cap_msg_reassembled_in
,
2409 { "Reassembled in", "btbredr_rf.l2cap.reassembled.in",
2410 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x00,
2413 { &hf_l2cap_msg_reassembled_length
,
2414 { "Reassembled L2CAP length", "btbredr_rf.l2cap.reassembled.length",
2415 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
2420 static hf_register_info hf_fhs
[] = {
2422 { "Parity Bits", "btbredr_fhs.parity",
2423 FT_UINT64
, BASE_HEX
, NULL
, 0x00000003ffffffff,
2427 { "Lower Address Part", "btbredr_fhs.lap",
2428 FT_UINT64
, BASE_HEX
, NULL
, 0x03fffffc00000000,
2432 { "Extended Inquiry Response", "btbredr_fhs.eir",
2433 FT_UINT64
, BASE_DEC
, NULL
, 0x0400000000000000,
2437 { "Reserved", "btbredr_fhs.reserved",
2438 FT_UINT64
, BASE_DEC
, NULL
, 0x0800000000000000,
2442 { "Scan Repetition", "btbredr_fhs.sr",
2443 FT_UINT64
, BASE_DEC
|BASE_VAL64_STRING
, VALS64(fhs_scan_repetition_vals
), 0x3000000000000000,
2447 { "SP", "btbredr_fhs.sp",
2448 FT_UINT64
, BASE_DEC
, NULL
, 0xc000000000000000,
2449 "shall be set to 10", HFILL
}
2452 { "Upper Address Part", "btbredr_fhs.uap",
2453 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
2457 { "Non-Significant Address Part", "btbredr_fhs.nap",
2458 FT_UINT16
, BASE_HEX
, NULL
, 0x00,
2462 { "Class of Device", "btbredr_fhs.class",
2463 FT_UINT24
, BASE_HEX
, NULL
, 0x00,
2467 { "LT_ADDR", "btbredr_fhs.ltaddr",
2468 FT_UINT32
, BASE_DEC
, NULL
, 0x00000007,
2472 { "CLK", "btbredr_fhs.clk",
2473 FT_UINT32
, BASE_HEX
, NULL
, 0x1ffffff8,
2476 { &hf_fhs_pagescanmode
,
2477 { "Page Scan Mode", "btbredr_fhs.pagescanmode",
2478 FT_UINT32
, BASE_DEC
, VALS(fhs_page_scan_mode_vals
), 0xe0000000,
2483 static int *ett
[] = {
2486 &ett_payload_transport_rate
,
2488 &ett_bluetooth_header
,
2489 &ett_payload_header
,
2490 &ett_l2cap_msg_fragment
,
2491 &ett_l2cap_msg_fragments
,
2495 static ei_register_info ei
[] = {
2496 { &ei_unexpected_data
, { "btbredr_rf.unexpected_data", PI_PROTOCOL
, PI_WARN
, "Unexpected data, BR or EDR Data Present flag is set to False", EXPFILL
}},
2497 { &ei_reserved_not_zero
, { "btbredr_rf.reserved_not_zero", PI_PROTOCOL
, PI_WARN
, "Reserved values are not zeros", EXPFILL
}},
2498 { &ei_incorrect_packet_header_or_hec
, { "btbredr_rf.incorrect_packet_header_or_hec", PI_PROTOCOL
, PI_WARN
, "Incorrect Packet Header or HEC", EXPFILL
}},
2499 { &ei_packet_header_with_hec_not_checked
, { "btbredr_rf.packet_header_with_hec_not_checked", PI_PROTOCOL
, PI_NOTE
, "Packet Header with HEC is not checked", EXPFILL
}},
2500 { &ei_broken_packet_header_format
, { "btbredr_rf.broken_packet_header_format", PI_PROTOCOL
, PI_WARN
, "Broken Packet Header Format", EXPFILL
}},
2501 { &ei_incorrect_crc
, { "btbredr_rf.incorrect_crc", PI_PROTOCOL
, PI_WARN
, "Incorrect CRC", EXPFILL
}},
2502 { &ei_missing_fragment_start
, { "btbredr_rf.missing_fragment_start", PI_SEQUENCE
, PI_WARN
, "Missing Fragment Start", EXPFILL
}},
2503 { &ei_esco_incorrect_ltaddr
, { "btbredr_rf.esco_incorrect_ltaddr", PI_PROTOCOL
, PI_WARN
, "Incorrect (e)SCO LT_ADDR", EXPFILL
}},
2504 { &ei_esco_incorrect_length
, { "btbredr_rf.esco_incorrect_length", PI_PROTOCOL
, PI_WARN
, "Incorrect eSCO Packet Length", EXPFILL
}}
2507 connection_info_tree
= wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
2508 device_info_tree
= wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
2510 proto_btbredr_rf
= proto_register_protocol("Bluetooth Pseudoheader for BR/EDR", "BT BR/EDR RF", "btbredr_rf");
2511 proto_register_field_array(proto_btbredr_rf
, hf
, array_length(hf
));
2512 proto_register_subtree_array(ett
, array_length(ett
));
2513 btbredr_rf_handle
= register_dissector("btbredr_rf", dissect_btbredr_rf
, proto_btbredr_rf
);
2515 proto_btbredr_fhs
= proto_register_protocol("Bluetooth BR/EDR FHS", "BT BR/EDR FHS", "btbredr_fhs");
2516 proto_register_field_array(proto_btbredr_fhs
, hf_fhs
, array_length(hf_fhs
));
2517 btbredr_fhs_handle
= register_dissector("btbredr_fhs", dissect_btbredr_fhs
, proto_btbredr_fhs
);
2519 packet_type_sco_br_table
= register_dissector_table("btbredr_rf.packet_type.sco.br", "BT Packet Type for SCO BR", proto_btbredr_rf
, FT_UINT8
, BASE_HEX
);
2520 packet_type_esco_br_table
= register_dissector_table("btbredr_rf.packet_type.esco.br", "BT Packet Type for eSCO BR", proto_btbredr_rf
, FT_UINT8
, BASE_HEX
);
2521 packet_type_esco_edr_table
= register_dissector_table("btbredr_rf.packet_type.esco.edr", "BT Packet Type for eSCO EDR", proto_btbredr_rf
, FT_UINT8
, BASE_HEX
);
2522 packet_type_acl_br_table
= register_dissector_table("btbredr_rf.packet_type.acl.br", "BT Packet Type for ACL BR", proto_btbredr_rf
, FT_UINT8
, BASE_HEX
);
2523 packet_type_acl_edr_table
= register_dissector_table("btbredr_rf.packet_type.acl.edr", "BT Packet Type for ACL EDR", proto_btbredr_rf
, FT_UINT8
, BASE_HEX
);
2524 packet_type_cpb_br_table
= register_dissector_table("btbredr_rf.packet_type.cpb.br", "BT Packet Type for CPB BR", proto_btbredr_rf
, FT_UINT8
, BASE_HEX
);
2525 packet_type_cpb_edr_table
= register_dissector_table("btbredr_rf.packet_type.cpb.edr", "BT Packet Type for CPB EDR", proto_btbredr_rf
, FT_UINT8
, BASE_HEX
);
2527 expert_module
= expert_register_protocol(proto_btbredr_rf
);
2528 expert_register_field_array(expert_module
, ei
, array_length(ei
));
2532 proto_reg_handoff_btbredr_rf(void)
2534 btlmp_handle
= find_dissector_add_dependency("btlmp", proto_btbredr_rf
);
2535 btl2cap_handle
= find_dissector_add_dependency("btl2cap", proto_btbredr_rf
);
2536 dissector_add_uint("bluetooth.encap", WTAP_ENCAP_BLUETOOTH_BREDR_BB
, btbredr_rf_handle
);
2540 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2545 * indent-tabs-mode: nil
2548 * vi: set shiftwidth=4 tabstop=8 expandtab:
2549 * :indentSize=4:tabSize=8:noTabs=true: