1 /* packet-btbredr.c 2 * Routines for Bluetooth baseband dissection 3 * Copyright 2014, Dominic Spill <[email protected]> 4 * Copyright 2009, Michael Ossmann <[email protected]> 5 * 6 * Wireshark - Network traffic analyzer 7 * By Gerald Combs <[email protected]> 8 * Copyright 1998 Gerald Combs 9 * 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU General Public License 12 * as published by the Free Software Foundation; either version 2 13 * of the License, or (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 23 */ 24 25 #ifdef HAVE_CONFIG_H 26 #include "config.h" 27 #else 28 #include <wireshark/config.h> 29 #endif 30 31 #include <epan/packet.h> 32 #include <epan/prefs.h> 33 34 /* function prototypes */ 35 void proto_reg_handoff_btbredr(void); 36 37 /* initialize the protocol and registered fields */ 38 static int proto_btbredr = -1; 39 static int hf_btbredr_meta = -1; 40 static int hf_btbredr_channel = -1; 41 static int hf_btbredr_signal = -1; 42 static int hf_btbredr_noise = -1; 43 static int hf_btbredr_ac_offenses = -1; 44 static int hf_btbredr_mod = -1; 45 static int hf_btbredr_transport = -1; 46 static int hf_btbredr_corrected_header = -1; 47 static int hf_btbredr_corrected_payload = -1; 48 static int hf_btbredr_lap = -1; 49 static int hf_btbredr_ref_lap = -1; 50 static int hf_btbredr_ref_uap = -1; 51 static int hf_btbredr_pkthdr = -1; 52 static int hf_btbredr_ltaddr = -1; 53 static int hf_btbredr_type = -1; 54 static int hf_btbredr_flags = -1; 55 static int hf_btbredr_flow = -1; 56 static int hf_btbredr_arqn = -1; 57 static int hf_btbredr_seqn = -1; 58 static int hf_btbredr_hec = -1; 59 static int hf_btbredr_payload = -1; 60 static int hf_btbredr_pldhdr = -1; 61 static int hf_btbredr_llid = -1; 62 static int hf_btbredr_pldflow = -1; 63 static int hf_btbredr_length = -1; 64 static int hf_btbredr_pldbody = -1; 65 static int hf_btbredr_crc = -1; 66 static int hf_btbredr_fhs_parity = -1; 67 static int hf_btbredr_fhs_lap = -1; 68 static int hf_btbredr_fhs_eir = -1; 69 static int hf_btbredr_fhs_sr = -1; 70 static int hf_btbredr_fhs_uap = -1; 71 static int hf_btbredr_fhs_nap = -1; 72 static int hf_btbredr_fhs_class = -1; 73 static int hf_btbredr_fhs_ltaddr = -1; 74 static int hf_btbredr_fhs_clk = -1; 75 static int hf_btbredr_fhs_psmode = -1; 76 77 /* field values */ 78 static const true_false_string direction = { 79 "Slave to Master", 80 "Master to Slave" 81 }; 82 83 static const true_false_string clock_bits = { 84 "27", 85 "6" 86 }; 87 88 static const true_false_string valid_flags = { 89 "Invalid", 90 "Valid" 91 }; 92 93 static const value_string modulation[] = { 94 { 0x0, "Basic Rate (GFSK)" }, 95 { 0x1, "Enhanced Data Rate (PI/2-DQPSK)" }, 96 { 0x2, "Enhanced Data Rate (8DPSK)" } 97 }; 98 99 static const value_string transports[] = { 100 { 0x0, "unknown" }, 101 { 0x1, "SCO" }, 102 { 0x2, "eSCO" }, 103 { 0x3, "ACL" }, 104 { 0x4, "CSB" } 105 }; 106 107 static const value_string packet_types[] = { 108 /* generic names for unknown logical transport */ 109 { 0x0, "NULL" }, 110 { 0x1, "POLL" }, 111 { 0x2, "FHS" }, 112 { 0x3, "DM1" }, 113 { 0x4, "DH1/2-DH1" }, 114 { 0x5, "HV1" }, 115 { 0x6, "HV2/2-EV3" }, 116 { 0x7, "HV3/EV3/3-EV3" }, 117 { 0x8, "DV/3-DH1" }, 118 { 0x9, "AUX1" }, 119 { 0xa, "DM3/2-DH3" }, 120 { 0xb, "DH3/3-DH3" }, 121 { 0xc, "EV4/2-EV5" }, 122 { 0xd, "EV5/3-EV5" }, 123 { 0xe, "DM5/2-DH5" }, 124 { 0xf, "DH5/3-DH5" }, 125 { 0, NULL } 126 }; 127 128 static const value_string sr_modes[] = { 129 { 0x0, "R0" }, 130 { 0x1, "R1" }, 131 { 0x2, "R2" }, 132 { 0x3, "Reserved" }, 133 { 0, NULL } 134 }; 135 136 static const range_string ps_modes[] = { 137 { 0x0, 0x0, "Mandatory scan mode" }, 138 { 0x1, 0x7, "Reserved" }, 139 { 0, 0, NULL } 140 }; 141 142 static const value_string llid_codes[] = { 143 { 0x0, "undefined" }, 144 { 0x1, "Continuation fragment of an L2CAP message (ACL-U)" }, 145 { 0x2, "Start of an L2CAP message or no fragmentation (ACL-U)" }, 146 { 0x3, "LMP message (ACL-C)" }, 147 { 0, NULL } 148 }; 149 150 /* initialize the subtree pointers */ 151 static gint ett_btbredr = -1; 152 static gint ett_btbredr_meta = -1; 153 static gint ett_btbredr_pkthdr = -1; 154 static gint ett_btbredr_flags = -1; 155 static gint ett_btbredr_payload = -1; 156 static gint ett_btbredr_pldhdr = -1; 157 158 /* subdissectors */ 159 static dissector_handle_t btlmp_handle = NULL; 160 static dissector_handle_t btl2cap_handle = NULL; 161 162 /* packet header flags */ 163 static const int *flag_fields[] = { 164 &hf_btbredr_flow, 165 &hf_btbredr_arqn, 166 &hf_btbredr_seqn, 167 NULL 168 }; 169 170 /* one byte payload header */ 171 int 172 dissect_payload_header1(proto_tree *tree, tvbuff_t *tvb, int offset) 173 { 174 proto_item *hdr_item; 175 proto_tree *hdr_tree; 176 177 DISSECTOR_ASSERT(tvb_length_remaining(tvb, offset) >= 1); 178 179 hdr_item = proto_tree_add_item(tree, hf_btbredr_pldhdr, tvb, offset, 1, ENC_NA); 180 hdr_tree = proto_item_add_subtree(hdr_item, ett_btbredr_pldhdr); 181 182 proto_tree_add_item(hdr_tree, hf_btbredr_llid, tvb, offset, 1, ENC_NA); 183 proto_tree_add_item(hdr_tree, hf_btbredr_pldflow, tvb, offset, 1, ENC_NA); 184 proto_tree_add_item(hdr_tree, hf_btbredr_length, tvb, offset, 1, ENC_NA); 185 186 /* payload length */ 187 return tvb_get_guint8(tvb, offset) >> 3; 188 } 189 190 void 191 dissect_fhs(proto_tree *tree, tvbuff_t *tvb, int offset) 192 { 193 proto_item *fhs_item, *psmode_item; 194 proto_tree *fhs_tree; 195 const gchar *description; 196 guint8 psmode; 197 198 DISSECTOR_ASSERT(tvb_length_remaining(tvb, offset) == 20); 199 200 fhs_item = proto_tree_add_item(tree, hf_btbredr_payload, tvb, offset, -1, ENC_NA); 201 fhs_tree = proto_item_add_subtree(fhs_item, ett_btbredr_payload); 202 203 /* Use proto_tree_add_bits_item() to get around 32bit limit on bitmasks */ 204 proto_tree_add_bits_item(fhs_tree, hf_btbredr_fhs_parity, tvb, offset*8, 34, ENC_LITTLE_ENDIAN); 205 /* proto_tree_add_item(fhs_tree, hf_btbredr_fhs_parity, tvb, offset, 5, ENC_LITTLE_ENDIAN); */ 206 offset += 4; 207 208 proto_tree_add_item(fhs_tree, hf_btbredr_fhs_lap, tvb, offset, 4, ENC_LITTLE_ENDIAN); 209 offset += 3; 210 211 proto_tree_add_item(fhs_tree, hf_btbredr_fhs_eir, tvb, offset, 1, ENC_NA); 212 /* skipping 1 undefined bit */ 213 proto_tree_add_item(fhs_tree, hf_btbredr_fhs_sr, tvb, offset, 1, ENC_NA); 214 /* skipping 2 reserved bits */ 215 offset += 1; 216 217 proto_tree_add_item(fhs_tree, hf_btbredr_fhs_uap, tvb, offset, 1, ENC_NA); 218 offset += 1; 219 220 proto_tree_add_item(fhs_tree, hf_btbredr_fhs_nap, tvb, offset, 2, ENC_LITTLE_ENDIAN); 221 offset += 2; 222 223 proto_tree_add_item(fhs_tree, hf_btbredr_fhs_class, tvb, offset, 3, ENC_LITTLE_ENDIAN); 224 offset += 3; 225 226 proto_tree_add_item(fhs_tree, hf_btbredr_fhs_ltaddr, tvb, offset, 1, ENC_NA); 227 proto_tree_add_item(fhs_tree, hf_btbredr_fhs_clk, tvb, offset, 4, ENC_LITTLE_ENDIAN); 228 offset += 3; 229 230 psmode = tvb_get_guint8(tvb, offset); 231 description = try_rval_to_str(psmode, ps_modes); 232 psmode_item = proto_tree_add_item(fhs_tree, hf_btbredr_fhs_psmode, tvb, offset, 1, ENC_NA); 233 if (description) 234 proto_item_append_text(psmode_item, " (%s)", description); 235 offset += 1; 236 237 proto_tree_add_item(fhs_tree, hf_btbredr_crc, tvb, offset, 2, ENC_LITTLE_ENDIAN); 238 offset += 2; 239 } 240 241 void 242 dissect_dm1(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset) 243 { 244 int len; /* payload length indicated by payload header */ 245 int llid; /* logical link id */ 246 int l2len; /* length indicated by l2cap header */ 247 proto_item *dm1_item; 248 proto_tree *dm1_tree; 249 tvbuff_t *pld_tvb; 250 251 /* 252 * FIXME 253 * I'm probably doing a terrible, terrible thing here, but it gets my 254 * initial test cases working. 255 */ 256 guint16 fake_acl_data; 257 258 DISSECTOR_ASSERT(tvb_length_remaining(tvb, offset) >= 3); 259 260 dm1_item = proto_tree_add_item(tree, hf_btbredr_payload, tvb, offset, -1, ENC_NA); 261 dm1_tree = proto_item_add_subtree(dm1_item, ett_btbredr_payload); 262 263 len = dissect_payload_header1(dm1_tree, tvb, offset); 264 llid = tvb_get_guint8(tvb, offset) & 0x3; 265 offset += 1; 266 267 DISSECTOR_ASSERT(tvb_length_remaining(tvb, offset) == len + 2); 268 269 if (llid == 3 && btlmp_handle) { 270 /* LMP */ 271 pld_tvb = tvb_new_subset(tvb, offset, len, len); 272 call_dissector(btlmp_handle, pld_tvb, pinfo, dm1_tree); 273 } else if (llid == 2 && btl2cap_handle) { 274 /* unfragmented L2CAP or start of fragment */ 275 l2len = tvb_get_letohs(tvb, offset); 276 if (l2len + 4 == len) { 277 /* unfragmented */ 278 pinfo->private_data = &fake_acl_data; 279 pld_tvb = tvb_new_subset(tvb, offset, len, len); 280 call_dissector(btl2cap_handle, pld_tvb, pinfo, dm1_tree); 281 } else { 282 /* start of fragment */ 283 proto_tree_add_item(dm1_tree, hf_btbredr_pldbody, tvb, offset, len, ENC_NA); 284 } 285 } else { 286 proto_tree_add_item(dm1_tree, hf_btbredr_pldbody, tvb, offset, len, ENC_NA); 287 } 288 offset += len; 289 290 proto_tree_add_item(dm1_tree, hf_btbredr_crc, tvb, offset, 2, ENC_LITTLE_ENDIAN); 291 offset += 2; 292 } 293 294 /* dissect a packet */ 295 static int 296 dissect_btbredr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) 297 { 298 proto_item *btbredr_item, *meta_item, *pkthdr_item; 299 proto_tree *btbredr_tree, *meta_tree, *pkthdr_tree; 300 int offset; 301 /* Avoid error: 'type' may be used uninitialized in this function */ 302 guint8 type = 0xff; 303 const gchar *info; 304 305 /* sanity check: length */ 306 if (tvb_length(tvb) > 0 && tvb_length(tvb) < 9) 307 /* bad length: look for a different dissector */ 308 return 0; 309 310 /* maybe should verify HEC */ 311 312 /* make entries in protocol column and info column on summary display */ 313 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Bluetooth"); 314 315 if (tvb_length(tvb) == 0) { 316 info = "ID"; 317 } else { 318 type = (tvb_get_guint8(tvb, 6) >> 3) & 0x0f; 319 info = val_to_str(type, packet_types, "Unknown type: 0x%x"); 320 } 321 322 col_clear(pinfo->cinfo, COL_INFO); 323 col_add_str(pinfo->cinfo, COL_INFO, info); 324 325 /* see if we are being asked for details */ 326 if (tree) { 327 328 /* create display subtree for the protocol */ 329 offset = 0; 330 btbredr_item = proto_tree_add_item(tree, proto_btbredr, tvb, offset, -1, ENC_NA); 331 btbredr_tree = proto_item_add_subtree(btbredr_item, ett_btbredr); 332 333 /* ID packets have no header, no payload */ 334 if (tvb_length(tvb) == 0) 335 return 1; 336 337 /* meta data */ 338 meta_item = proto_tree_add_item(btbredr_tree, hf_btbredr_meta, tvb, offset, 3, ENC_NA); 339 meta_tree = proto_item_add_subtree(meta_item, ett_btbredr_meta); 340 341 proto_tree_add_item(meta_tree, hf_btbredr_channel, tvb, offset, 1, ENC_NA); 342 offset += 1; 343 proto_tree_add_item(meta_tree, hf_btbredr_signal, tvb, offset, 1, ENC_NA); 344 offset += 1; 345 proto_tree_add_item(meta_tree, hf_btbredr_noise, tvb, offset, 1, ENC_NA); 346 offset += 1; 347 proto_tree_add_item(meta_tree, hf_btbredr_ac_offenses, tvb, offset, 1, ENC_NA); 348 offset += 1; 349 350 proto_tree_add_item(meta_tree, hf_btbredr_mod, tvb, offset, 1, ENC_NA); 351 proto_tree_add_item(meta_tree, hf_btbredr_transport, tvb, offset, 1, ENC_NA); 352 offset += 1; 353 354 proto_tree_add_item(meta_tree, hf_btbredr_corrected_header, tvb, offset, 1, ENC_NA); 355 offset += 1; 356 proto_tree_add_item(meta_tree, hf_btbredr_corrected_payload, tvb, offset, 2, ENC_LITTLE_ENDIAN); 357 offset += 2; 358 359 proto_tree_add_item(meta_tree, hf_btbredr_lap, tvb, offset, 4, ENC_LITTLE_ENDIAN); 360 offset += 4; 361 proto_tree_add_item(meta_tree, hf_btbredr_ref_lap, tvb, offset, 3, ENC_LITTLE_ENDIAN); 362 offset += 3; 363 proto_tree_add_item(meta_tree, hf_btbredr_ref_uap, tvb, offset, 1, ENC_NA); 364 offset += 1; 365 366 367 /* packet header */ 368 pkthdr_item = proto_tree_add_item(btbredr_tree, hf_btbredr_pkthdr, tvb, offset, 3, ENC_NA); 369 pkthdr_tree = proto_item_add_subtree(pkthdr_item, ett_btbredr_pkthdr); 370 371 proto_tree_add_item(pkthdr_tree, hf_btbredr_ltaddr, tvb, offset, 1, ENC_NA); 372 proto_tree_add_item(pkthdr_tree, hf_btbredr_type, tvb, offset, 1, ENC_NA); 373 offset += 1; 374 proto_tree_add_bitmask(pkthdr_tree, tvb, offset, hf_btbredr_flags, 375 ett_btbredr_flags, flag_fields, ENC_NA); 376 offset += 1; 377 proto_tree_add_item(pkthdr_tree, hf_btbredr_hec, tvb, offset, 1, ENC_NA); 378 offset += 2; 379 380 /* payload */ 381 switch (type) { 382 case 0x0: /* NULL */ 383 case 0x1: /* POLL */ 384 break; 385 case 0x2: /* FHS */ 386 dissect_fhs(btbredr_tree, tvb, offset); 387 break; 388 case 0x3: /* DM1 */ 389 dissect_dm1(btbredr_tree, tvb, pinfo, offset); 390 break; 391 case 0x4: /* DH1/2-DH1 */ 392 dissect_dm1(btbredr_tree, tvb, pinfo, offset); 393 break; 394 case 0x5: /* HV1 */ 395 case 0x6: /* HV2/2-EV3 */ 396 case 0x7: /* HV3/EV3/3-EV3 */ 397 case 0x8: /* DV/3-DH1 */ 398 case 0x9: /* AUX1 */ 399 case 0xa: /* DM3/2-DH3 */ 400 case 0xb: /* DH3/3-DH3 */ 401 case 0xc: /* EV4/2-EV5 */ 402 case 0xd: /* EV5/3-EV5 */ 403 case 0xe: /* DM5/2-DH5 */ 404 case 0xf: /* DH5/3-DH5 */ 405 proto_tree_add_item(btbredr_tree, hf_btbredr_payload, tvb, offset, -1, ENC_NA); 406 break; 407 default: 408 break; 409 } 410 } 411 412 /* Return the amount of data this dissector was able to dissect */ 413 return tvb_length(tvb); 414 } 415 416 /* register the protocol with Wireshark */ 417 void 418 proto_register_btbredr(void) 419 { 420 /* list of fields */ 421 static hf_register_info hf[] = { 422 { &hf_btbredr_meta, 423 { "Meta Data", "btbredr.meta", 424 FT_NONE, BASE_NONE, NULL, 0x0, 425 "Meta Data About the Packet", HFILL } 426 }, 427 { &hf_btbredr_channel, 428 { "Channel", "btbredr.channel", 429 FT_UINT8, BASE_DEC, NULL, 0x0, 430 "Channel (0-78)", HFILL } 431 }, 432 { &hf_btbredr_signal, 433 { "Signal", "btbredr.signal", 434 FT_UINT8, BASE_DEC, NULL, 0x0, 435 "Signal Power", HFILL } 436 }, 437 { &hf_btbredr_noise, 438 { "Noise", "btbredr.noise", 439 FT_UINT8, BASE_DEC, NULL, 0x0, 440 "Noise Power", HFILL } 441 }, 442 { &hf_btbredr_ac_offenses, 443 { "AC Offenses", "btbredr.ac_offenses", 444 FT_UINT8, BASE_DEC, NULL, 0x0, 445 "Access Code Offenses", HFILL } 446 }, 447 { &hf_btbredr_mod, 448 { "Transport Rate", "btbredr.mod", 449 FT_UINT8, BASE_HEX, VALS(&modulation), 0x02, 450 "Transport Data Rate", HFILL } 451 }, 452 { &hf_btbredr_transport, 453 { "Transport", "btbredr.transport", 454 FT_UINT8, BASE_HEX, VALS(&transports), 0x70, 455 "Logical Transport", HFILL } 456 }, 457 { &hf_btbredr_corrected_header, 458 { "Corrected Header", "btbredr.corrected_header", 459 FT_UINT8, BASE_DEC, NULL, 0x0, 460 "Corrected Header Bits", HFILL } 461 }, 462 { &hf_btbredr_corrected_payload, 463 { "Corrected Payload", "btbredr.corrected_payload", 464 FT_UINT16, BASE_DEC, NULL, 0x0, 465 "Corrected Payload Bits", HFILL } 466 }, 467 { &hf_btbredr_lap, 468 { "LAP", "btbredr.lap", 469 FT_UINT32, BASE_HEX, NULL, 0x0, 470 "Lower Address Part", HFILL } 471 }, 472 { &hf_btbredr_ref_lap, 473 { "Ref. LAP", "btbredr.ref_lap", 474 FT_UINT32, BASE_HEX, NULL, 0x0, 475 "Reference LAP", HFILL } 476 }, 477 { &hf_btbredr_ref_uap, 478 { "Ref. UAP", "btbredr.ref_uap", 479 FT_UINT8, BASE_HEX, NULL, 0x0, 480 "Reference UAP", HFILL } 481 }, 482 { &hf_btbredr_pkthdr, 483 { "Packet Header", "btbredr.pkthdr", 484 FT_NONE, BASE_NONE, NULL, 0x0, 485 "Bluetooth Baseband Packet Header", HFILL } 486 }, 487 { &hf_btbredr_ltaddr, 488 { "LT_ADDR", "btbredr.lt_addr", 489 FT_UINT8, BASE_HEX, NULL, 0x07, 490 "Logical Transport Address", HFILL } 491 }, 492 { &hf_btbredr_type, 493 { "TYPE", "btbredr.type", 494 FT_UINT8, BASE_HEX, VALS(packet_types), 0x78, 495 "Packet Type", HFILL } 496 }, 497 { &hf_btbredr_flags, 498 { "Flags", "btbredr.flags", 499 FT_UINT8, BASE_HEX, NULL, 0x0, 500 "Packet Header Flags", HFILL } 501 }, 502 { &hf_btbredr_flow, 503 { "FLOW", "btbredr.flow", 504 FT_BOOLEAN, 8, NULL, 0x01, 505 "Flow control indication", HFILL } 506 }, 507 { &hf_btbredr_arqn, 508 { "ARQN", "btbredr.arqn", 509 FT_BOOLEAN, 8, NULL, 0x02, 510 "Acknowledgment indication", HFILL } 511 }, 512 { &hf_btbredr_seqn, 513 { "SEQN", "btbredr.seqn", 514 FT_BOOLEAN, 8, NULL, 0x04, 515 "Sequence number", HFILL } 516 }, 517 { &hf_btbredr_hec, 518 { "HEC", "btbredr.lt_addr", 519 FT_UINT8, BASE_HEX, NULL, 0x0, 520 "Header Error Check", HFILL } 521 }, 522 { &hf_btbredr_payload, 523 { "Payload", "btbredr.payload", 524 FT_NONE, BASE_NONE, NULL, 0x0, 525 NULL, HFILL } 526 }, 527 { &hf_btbredr_llid, 528 { "LLID", "btbredr.llid", 529 FT_UINT8, BASE_HEX, VALS(llid_codes), 0x03, 530 "Logical Link ID", HFILL } 531 }, 532 { &hf_btbredr_pldflow, 533 { "Flow", "btbredr.flow", 534 FT_BOOLEAN, 8, NULL, 0x04, 535 "Payload Flow indication", HFILL } 536 }, 537 { &hf_btbredr_length, 538 { "Length", "btbredr.length", 539 FT_UINT8, BASE_DEC, NULL, 0xf8, 540 "Payload Length", HFILL } 541 }, 542 { &hf_btbredr_pldhdr, 543 { "Payload Header", "btbredr.pldhdr", 544 FT_NONE, BASE_NONE, NULL, 0x0, 545 NULL, HFILL } 546 }, 547 { &hf_btbredr_pldbody, 548 { "Payload Body", "btbredr.pldbody", 549 FT_BYTES, BASE_NONE, NULL, 0x0, 550 NULL, HFILL } 551 }, 552 { &hf_btbredr_crc, 553 { "CRC", "btbredr.crc", 554 FT_UINT16, BASE_HEX, NULL, 0x0, 555 "Payload CRC", HFILL } 556 }, 557 { &hf_btbredr_fhs_parity, 558 { "Parity", "btbredr.parity", 559 /* FIXME this doesn't work because bitmasks can only be 32 bits */ 560 FT_UINT64, BASE_HEX, NULL, /*0x00000003ffffffffULL,*/ 0x0, 561 "LAP parity", HFILL } 562 }, 563 { &hf_btbredr_fhs_lap, 564 { "LAP", "btbredr.lap", 565 FT_UINT24, BASE_HEX, NULL, 0x03fffffc, 566 "Lower Address Part", HFILL } 567 }, 568 { &hf_btbredr_fhs_eir, 569 { "EIR", "btbredr.eir", 570 FT_BOOLEAN, 8, NULL, 0x04, 571 "Extended Inquiry Response packet may follow", HFILL } 572 }, 573 { &hf_btbredr_fhs_sr, 574 { "SR", "btbredr.sr", 575 FT_UINT8, BASE_HEX, VALS(sr_modes), 0x30, 576 "Scan Repetition", HFILL } 577 }, 578 { &hf_btbredr_fhs_uap, 579 { "UAP", "btbredr.uap", 580 FT_UINT8, BASE_HEX, NULL, 0x0, 581 "Upper Address Part", HFILL } 582 }, 583 { &hf_btbredr_fhs_nap, 584 { "NAP", "btbredr.nap", 585 FT_UINT16, BASE_HEX, NULL, 0x0, 586 "Non-Significant Address Part", HFILL } 587 }, 588 { &hf_btbredr_fhs_class, /* FIXME break out further */ 589 { "Class of Device", "btbredr.class", 590 FT_UINT24, BASE_HEX, NULL, 0x0, 591 NULL, HFILL } 592 }, 593 { &hf_btbredr_fhs_ltaddr, 594 { "LT_ADDR", "btbredr.lt_addr", 595 FT_UINT8, BASE_HEX, NULL, 0x07, 596 "Logical Transport Address", HFILL } 597 }, 598 { &hf_btbredr_fhs_clk, 599 { "CLK", "btbredr.clk", 600 FT_UINT32, BASE_HEX, NULL, 0x1ffffff8, 601 "Clock bits 2 through 27", HFILL } 602 }, 603 { &hf_btbredr_fhs_psmode, 604 { "Page Scan Mode", "btbredr.psmode", 605 FT_UINT8, BASE_HEX, NULL, 0xe0, 606 NULL, HFILL } 607 }, 608 }; 609 610 /* protocol subtree arrays */ 611 static gint *ett[] = { 612 &ett_btbredr, 613 &ett_btbredr_meta, 614 &ett_btbredr_pkthdr, 615 &ett_btbredr_flags, 616 &ett_btbredr_payload, 617 &ett_btbredr_pldhdr, 618 }; 619 620 /* register the protocol name and description */ 621 proto_btbredr = proto_register_protocol( 622 "Bluetooth Baseband", /* full name */ 623 "BT Baseband", /* short name */ 624 "btbredr" /* abbreviation (e.g. for filters) */ 625 ); 626 627 /* register the header fields and subtrees used */ 628 proto_register_field_array(proto_btbredr, hf, array_length(hf)); 629 proto_register_subtree_array(ett, array_length(ett)); 630 } 631 632 /* Remove this once recent Wireshark/TCPdump releases are more common */ 633 #ifndef WTAP_ENCAP_BLUETOOTH_BREDR_BB 634 #define WTAP_ENCAP_BLUETOOTH_BREDR_BB 161 635 #endif 636 637 void 638 proto_reg_handoff_btbredr(void) 639 { 640 dissector_handle_t btbredr_handle; 641 btbredr_handle = new_create_dissector_handle(dissect_btbredr, 642 proto_btbredr); 643 dissector_add_uint("wtap_encap", 644 WTAP_ENCAP_BLUETOOTH_BREDR_BB, 645 btbredr_handle); 646 647 btlmp_handle = find_dissector("btlmp"); 648 btl2cap_handle = find_dissector("btl2cap"); 649 } 650 651 /* 652 * Editor modelines - http://www.wireshark.org/tools/modelines.html 653 * 654 * Local variables: 655 * c-basic-offset: 4 656 * tab-width: 8 657 * indent-tabs-mode: nil 658 * End: 659 * 660 * vi: set shiftwidth=4 tabstop=8 expandtab: 661 * :indentSize=4:tabSize=8:noTabs=true: 662 */ 663