2 * Routines for Bluetooth BNEP dissection
4 * Copyright 2012, Michal Labedzki for Tieto Corporation
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include <epan/packet.h>
16 #include <epan/prefs.h>
17 #include <epan/etypes.h>
18 #include <epan/expert.h>
20 #include "packet-bluetooth.h"
21 #include "packet-btl2cap.h"
22 #include "packet-btsdp.h"
24 #define BNEP_TYPE_GENERAL_ETHERNET 0x00
25 #define BNEP_TYPE_CONTROL 0x01
26 #define BNEP_TYPE_COMPRESSED_ETHERNET 0x02
27 #define BNEP_TYPE_COMPRESSED_ETHERNET_SOURCE_ONLY 0x03
28 #define BNEP_TYPE_COMPRESSED_ETHERNET_DESTINATION_ONLY 0x04
29 #define RESERVED_802 0x7F
31 static int proto_btbnep
;
32 static int hf_btbnep_bnep_type
;
33 static int hf_btbnep_extension_flag
;
34 static int hf_btbnep_extension_type
;
35 static int hf_btbnep_extension_length
;
36 static int hf_btbnep_dst
;
37 static int hf_btbnep_src
;
38 static int hf_btbnep_len
;
39 static int hf_btbnep_invalid_lentype
;
40 static int hf_btbnep_type
;
41 static int hf_btbnep_addr
;
42 static int hf_btbnep_lg
;
43 static int hf_btbnep_ig
;
44 static int hf_btbnep_control_type
;
45 static int hf_btbnep_unknown_control_type
;
46 static int hf_btbnep_uuid_size
;
47 static int hf_btbnep_destination_service_uuid
;
48 static int hf_btbnep_source_service_uuid
;
49 static int hf_btbnep_setup_connection_response_message
;
50 static int hf_btbnep_filter_net_type_response_message
;
51 static int hf_btbnep_filter_multi_addr_response_message
;
52 static int hf_btbnep_list_length
;
53 static int hf_btbnep_network_type_start
;
54 static int hf_btbnep_network_type_end
;
55 static int hf_btbnep_multicast_address_start
;
56 static int hf_btbnep_multicast_address_end
;
58 static int ett_btbnep
;
61 static expert_field ei_btbnep_src_not_group_address
;
62 static expert_field ei_btbnep_invalid_lentype
;
63 static expert_field ei_btbnep_len_past_end
;
65 static dissector_handle_t btbnep_handle
;
67 static bool top_dissect
= true;
69 static dissector_handle_t llc_handle
;
70 static dissector_handle_t ipx_handle
;
71 static dissector_handle_t ethertype_handle
;
73 static const true_false_string ig_tfs
= {
74 "Group address (multicast/broadcast)",
75 "Individual address (unicast)"
78 static const true_false_string lg_tfs
= {
79 "Locally administered address (this is NOT the factory default)",
80 "Globally unique address (factory default)"
83 static const value_string bnep_type_vals
[] = {
84 { 0x00, "General Ethernet" },
86 { 0x02, "Compressed Ethernet" },
87 { 0x03, "Compressed Ethernet Source Only" },
88 { 0x04, "Compressed Ethernet Destination Only" },
89 { 0x7F, "Reserved for 802.2 LLC Packets for IEEE 802.15.1 WG" },
93 static const value_string control_type_vals
[] = {
94 { 0x00, "Command Not Understood" },
95 { 0x01, "Setup Connection Request" },
96 { 0x02, "Setup Connection Response" },
97 { 0x03, "Filter Net Type Set" },
98 { 0x04, "Filter Net Type Response" },
99 { 0x05, "Filter Multi Addr Set" },
100 { 0x06, "Filter Multi Addr Response" },
104 static const value_string extension_type_vals
[] = {
105 { 0x00, "Extension Control" },
109 static const value_string setup_connection_response_message_vals
[] = {
110 { 0x0000, "Operation Successful" },
111 { 0x0001, "Operation FAIL: Invalid Destination Service UUID" },
112 { 0x0002, "Operation FAIL: Invalid Source Service UUID" },
113 { 0x0003, "Operation FAIL: Invalid Service UUID Size" },
114 { 0x0004, "Operation FAIL: Connection Not Allowed" },
118 static const value_string filter_net_type_response_message_vals
[] = {
119 { 0x0000, "Operation Successful" },
120 { 0x0001, "Unsupported Request" },
121 { 0x0002, "Operation FAIL: Invalid Networking Protocol Type Range" },
122 { 0x0003, "Operation FAIL: Too many filters" },
123 { 0x0004, "Operation FAIL: Unable to fulfill request due to security reasons" },
127 static const value_string filter_multi_addr_response_message_vals
[] = {
128 { 0x0000, "Operation Successful" },
129 { 0x0001, "Unsupported Request" },
130 { 0x0002, "Operation FAIL: Invalid Multicast Address" },
131 { 0x0003, "Operation FAIL: Too many filters" },
132 { 0x0004, "Operation FAIL: Unable to fulfill request due to security reasons" },
136 void proto_register_btbnep(void);
137 void proto_reg_handoff_btbnep(void);
140 dissect_control(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
)
142 proto_item
*pitem
= NULL
;
143 unsigned control_type
;
144 uint8_t unknown_control_type
;
148 uint16_t response_message
;
149 uint16_t list_length
;
152 proto_tree_add_item(tree
, hf_btbnep_control_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
153 control_type
= tvb_get_uint8(tvb
, offset
);
156 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " - %s", val_to_str_const(control_type
, control_type_vals
, "Unknown type"));
158 switch(control_type
) {
159 case 0x00: /* Command Not Understood */
160 proto_tree_add_item(tree
, hf_btbnep_unknown_control_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
161 unknown_control_type
= tvb_get_uint8(tvb
, offset
);
164 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " - Unknown(%s)", val_to_str_const(unknown_control_type
, control_type_vals
, "Unknown type"));
167 case 0x01: /* Setup Connection Request */
168 proto_tree_add_item(tree
, hf_btbnep_uuid_size
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
169 uuid_size
= tvb_get_uint8(tvb
, offset
);
172 pitem
= proto_tree_add_item(tree
, hf_btbnep_destination_service_uuid
, tvb
, offset
, uuid_size
, ENC_NA
);
173 uuid_dst
= tvb_get_ntohs(tvb
, offset
);
174 proto_item_append_text(pitem
, " (%s)", val_to_str_ext_const(uuid_dst
, &bluetooth_uuid_vals_ext
, "Unknown uuid"));
177 pitem
= proto_tree_add_item(tree
, hf_btbnep_source_service_uuid
, tvb
, offset
, uuid_size
, ENC_NA
);
178 uuid_src
= tvb_get_ntohs(tvb
, offset
);
179 proto_item_append_text(pitem
, " (%s)", val_to_str_ext_const(uuid_src
, &bluetooth_uuid_vals_ext
, "Unknown uuid"));
182 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " - dst: <%s>, src: <%s>",
183 val_to_str_ext_const(uuid_dst
, &bluetooth_uuid_vals_ext
, "Unknown uuid"),
184 val_to_str_ext_const(uuid_src
, &bluetooth_uuid_vals_ext
, "Unknown uuid"));
186 case 0x02: /* Setup Connection Response */
187 proto_tree_add_item(tree
, hf_btbnep_setup_connection_response_message
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
188 response_message
= tvb_get_ntohs(tvb
, offset
);
190 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " - %s",
191 val_to_str_const(response_message
, setup_connection_response_message_vals
, "Unknown response message"));
193 case 0x03: /* Filter Net Type Set */
194 proto_tree_add_item(tree
, hf_btbnep_list_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
195 list_length
= tvb_get_ntohs(tvb
, offset
);
198 for (i_item
= 0; i_item
+ 4 > i_item
&& i_item
< list_length
; i_item
+= 4) {
199 proto_tree_add_item(tree
, hf_btbnep_network_type_start
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
202 proto_tree_add_item(tree
, hf_btbnep_network_type_end
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
206 case 0x04: /* Filter Net Type Response */
207 proto_tree_add_item(tree
, hf_btbnep_filter_net_type_response_message
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
208 response_message
= tvb_get_ntohs(tvb
, offset
);
210 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " - %s",
211 val_to_str_const(response_message
, filter_net_type_response_message_vals
, "Unknown response message"));
213 case 0x05: /*Filter Multi Addr Set*/
214 proto_tree_add_item(tree
, hf_btbnep_list_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
215 list_length
= tvb_get_ntohs(tvb
, offset
);
218 for (i_item
= 0; i_item
+ 12 > i_item
&& i_item
< list_length
; i_item
+= 12) {
219 proto_tree_add_item(tree
, hf_btbnep_multicast_address_start
, tvb
, offset
, FT_ETHER_LEN
, ENC_NA
);
220 offset
+= FT_ETHER_LEN
;
222 proto_tree_add_item(tree
, hf_btbnep_multicast_address_end
, tvb
, offset
, FT_ETHER_LEN
, ENC_NA
);
223 offset
+= FT_ETHER_LEN
;
226 case 0x06: /* Filter Multi Addr Response */
227 proto_tree_add_item(tree
, hf_btbnep_filter_multi_addr_response_message
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
228 response_message
= tvb_get_ntohs(tvb
, offset
);
230 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " - %s",
231 val_to_str_const(response_message
, filter_multi_addr_response_message_vals
, "Unknown response message"));
240 // NOLINTNEXTLINE(misc-no-recursion)
241 dissect_extension(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
)
243 uint8_t extension_flag
;
244 uint8_t extension_type
;
245 uint16_t extension_length
;
248 proto_tree_add_item(tree
, hf_btbnep_extension_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
249 proto_tree_add_item(tree
, hf_btbnep_extension_flag
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
250 type
= tvb_get_uint8(tvb
, offset
);
251 extension_flag
= type
& 0x01;
252 extension_type
= type
>> 1;
255 proto_tree_add_item(tree
, hf_btbnep_extension_length
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
256 extension_length
= tvb_get_ntohs(tvb
, offset
);
259 if (extension_type
== 0x00) {
260 /* Extension Control */
261 offset
= dissect_control(tvb
, pinfo
, tree
, offset
);
263 offset
+= extension_length
;
266 increment_dissection_depth(pinfo
);
267 if (extension_flag
) offset
= dissect_extension(tvb
, pinfo
, tree
, offset
);
268 decrement_dissection_depth(pinfo
);
274 dissect_btbnep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
277 proto_tree
*btbnep_tree
;
280 unsigned extension_flag
;
281 unsigned len_type
= 0;
282 proto_item
*addr_item
;
283 proto_tree
*addr_tree
= NULL
;
284 proto_item
*length_ti
= NULL
;
286 pi
= proto_tree_add_item(tree
, proto_btbnep
, tvb
, offset
, -1, ENC_NA
);
287 btbnep_tree
= proto_item_add_subtree(pi
, ett_btbnep
);
289 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "BNEP");
290 col_clear(pinfo
->cinfo
, COL_INFO
);
292 switch (pinfo
->p2p_dir
) {
294 col_set_str(pinfo
->cinfo
, COL_INFO
, "Sent ");
297 col_set_str(pinfo
->cinfo
, COL_INFO
, "Rcvd ");
300 col_set_str(pinfo
->cinfo
, COL_INFO
, "UnknownDirection ");
304 proto_tree_add_item(btbnep_tree
, hf_btbnep_extension_flag
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
305 proto_tree_add_item(btbnep_tree
, hf_btbnep_bnep_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
306 bnep_type
= tvb_get_uint8(tvb
, offset
);
307 extension_flag
= bnep_type
& 0x80;
308 bnep_type
= bnep_type
& 0x7F;
311 col_append_str(pinfo
->cinfo
, COL_INFO
, val_to_str_const(bnep_type
, bnep_type_vals
, "Unknown type"));
312 if (extension_flag
) col_append_str(pinfo
->cinfo
, COL_INFO
, "+E");
314 if (bnep_type
== BNEP_TYPE_GENERAL_ETHERNET
|| bnep_type
== BNEP_TYPE_COMPRESSED_ETHERNET_DESTINATION_ONLY
) {
315 set_address_tvb(&pinfo
->dl_dst
, AT_ETHER
, 6, tvb
, offset
);
316 copy_address_shallow(&pinfo
->dst
, &pinfo
->dl_dst
);
318 addr_item
= proto_tree_add_item(btbnep_tree
, hf_btbnep_dst
, tvb
, offset
, FT_ETHER_LEN
, ENC_NA
);
319 addr_tree
= proto_item_add_subtree(addr_item
, ett_addr
);
320 proto_tree_add_item(addr_tree
, hf_btbnep_addr
, tvb
, offset
, FT_ETHER_LEN
, ENC_NA
);
321 proto_tree_add_item(addr_tree
, hf_btbnep_lg
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
322 proto_tree_add_item(addr_tree
, hf_btbnep_ig
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
323 offset
+= FT_ETHER_LEN
;
326 if (bnep_type
== BNEP_TYPE_GENERAL_ETHERNET
|| bnep_type
== BNEP_TYPE_COMPRESSED_ETHERNET_SOURCE_ONLY
) {
327 set_address_tvb(&pinfo
->dl_src
, AT_ETHER
, 6, tvb
, offset
);
328 copy_address_shallow(&pinfo
->src
, &pinfo
->dl_src
);
330 addr_item
= proto_tree_add_item(btbnep_tree
, hf_btbnep_src
, tvb
, offset
, FT_ETHER_LEN
, ENC_NA
);
331 addr_tree
= proto_item_add_subtree(addr_item
, ett_addr
);
332 if (tvb_get_uint8(tvb
, offset
) & 0x01) {
333 expert_add_info(pinfo
, addr_item
, &ei_btbnep_src_not_group_address
);
336 proto_tree_add_item(addr_tree
, hf_btbnep_addr
, tvb
, offset
, FT_ETHER_LEN
, ENC_NA
);
337 proto_tree_add_item(addr_tree
, hf_btbnep_lg
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
338 proto_tree_add_item(addr_tree
, hf_btbnep_ig
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
339 offset
+= FT_ETHER_LEN
;
342 if (bnep_type
!= BNEP_TYPE_CONTROL
) {
343 len_type
= tvb_get_ntohs(tvb
, offset
);
344 if (len_type
<= IEEE_802_3_MAX_LEN
) {
346 * The BNEP Version 1.0 spec says, for BNEP_GENERAL_ETHERNET
347 * packets, "Note: Networking Protocol Types as used in this
348 * specification SHALL be taken to include values in the range
349 * 0x0000-0x05dc, used to represent the IEEE802.3 length
350 * interpretation of the IEEE802.3 length/type field.",
351 * although it says that it's not mandatory to process
354 length_ti
= proto_tree_add_item(btbnep_tree
, hf_btbnep_len
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
355 } else if (len_type
< ETHERNET_II_MIN_LEN
) {
357 * Not a valid Ethernet length, not a valid Ethernet type.
361 ti
= proto_tree_add_item(btbnep_tree
, hf_btbnep_invalid_lentype
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
362 expert_add_info_format(pinfo
, ti
, &ei_btbnep_invalid_lentype
,
363 "Invalid length/type: 0x%04x (%u)",
370 proto_tree_add_item(btbnep_tree
, hf_btbnep_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
371 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " - Type: %s", val_to_str_const(len_type
, etype_vals
, "unknown"));
375 offset
= dissect_control(tvb
, pinfo
, btbnep_tree
, offset
);
378 if (extension_flag
) {
379 offset
= dissect_extension(tvb
, pinfo
, btbnep_tree
, offset
);
382 if (bnep_type
!= BNEP_TYPE_CONTROL
) {
383 /* dissect normal network */
385 if (len_type
<= IEEE_802_3_MAX_LEN
) {
391 * The BNEP Version 1.0 spec says, for BNEP_GENERAL_ETHERNET
392 * packets, "Note: Networking Protocol Types as used in this
393 * specification SHALL be taken to include values in the range
394 * 0x0000-0x05dc, used to represent the IEEE802.3 length
395 * interpretation of the IEEE802.3 length/type field.",
396 * although it says that it's not mandatory to process
401 * Is there an 802.2 layer? I can tell by looking at the
402 * first 2 bytes of the payload. If they are 0xffff, then
403 * the payload is IPX.
405 * (Probably won't happen, but we might as well do this
410 /* Don't throw an exception for this check (even a BoundsError) */
411 if (tvb_bytes_exist(tvb
, offset
, 2)) {
412 if (tvb_get_ntohs(tvb
, offset
) == 0xffff) {
417 reported_length
= tvb_reported_length_remaining(tvb
, offset
);
420 * Make sure the length doesn't go past the end of the
423 if (reported_length
>= 0 && len_type
> (unsigned)reported_length
) {
424 len_type
= reported_length
;
425 expert_add_info(pinfo
, length_ti
, &ei_btbnep_len_past_end
);
428 /* Give the next dissector only 'len_type' number of bytes. */
429 next_tvb
= tvb_new_subset_length(tvb
, offset
, len_type
);
431 call_dissector(llc_handle
, next_tvb
, pinfo
, tree
);
433 call_dissector(ipx_handle
, next_tvb
, pinfo
, tree
);
435 } else if (len_type
< ETHERNET_II_MIN_LEN
) {
437 * Not a valid packet.
441 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
442 call_data_dissector(next_tvb
, pinfo
, tree
);
447 ethertype_data_t ethertype_data
;
449 proto_tree_add_uint(btbnep_tree
, hf_btbnep_type
, tvb
,
450 offset
- 2, 2, len_type
);
452 ethertype_data
.etype
= len_type
;
453 ethertype_data
.payload_offset
= offset
;
454 ethertype_data
.fh_tree
= btbnep_tree
;
455 ethertype_data
.trailer_id
= 0;
456 ethertype_data
.fcs_len
= 0;
458 call_dissector_with_data(ethertype_handle
, tvb
, pinfo
, tree
, ðertype_data
);
463 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
464 call_data_dissector(next_tvb
, pinfo
, tree
);
472 proto_register_btbnep(void)
475 expert_module_t
* expert_btbnep
;
477 static hf_register_info hf
[] = {
478 { &hf_btbnep_bnep_type
,
479 { "BNEP Type", "btbnep.bnep_type",
480 FT_UINT8
, BASE_HEX
, VALS(bnep_type_vals
), 0x7F,
483 { &hf_btbnep_extension_flag
,
484 { "Extension Flag", "btbnep.extension_flag",
485 FT_BOOLEAN
, 8, NULL
, 0x80,
488 { &hf_btbnep_control_type
,
489 { "Control Type", "btbnep.control_type",
490 FT_UINT8
, BASE_HEX
, VALS(control_type_vals
), 0x00,
493 { &hf_btbnep_extension_type
,
494 { "Extension Type", "btbnep.extension_type",
495 FT_UINT8
, BASE_HEX
, VALS(extension_type_vals
), 0x00,
498 { &hf_btbnep_extension_length
,
499 { "Extension Length", "btbnep.extension_length",
500 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
503 { &hf_btbnep_unknown_control_type
,
504 { "Unknown Control Type", "btbnep.unknown_control_type",
505 FT_UINT8
, BASE_HEX
, VALS(control_type_vals
), 0x00,
508 { &hf_btbnep_uuid_size
,
509 { "UIDD Size", "btbnep.uuid_size",
510 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
513 { &hf_btbnep_destination_service_uuid
,
514 { "Destination Service UUID", "btbnep.destination_service_uuid",
515 FT_NONE
, BASE_NONE
, NULL
, 0x00,
518 { &hf_btbnep_source_service_uuid
,
519 { "Source Service UUID", "btbnep.source_service_uuid",
520 FT_NONE
, BASE_NONE
, NULL
, 0x00,
523 { &hf_btbnep_setup_connection_response_message
,
524 { "Response Message", "btbnep.setup_connection_response_message",
525 FT_UINT16
, BASE_HEX
, VALS(setup_connection_response_message_vals
), 0x00,
528 { &hf_btbnep_filter_net_type_response_message
,
529 { "Response Message", "btbnep.filter_net_type_response_message",
530 FT_UINT16
, BASE_HEX
, VALS(filter_net_type_response_message_vals
), 0x00,
533 { &hf_btbnep_filter_multi_addr_response_message
,
534 { "Response Message", "btbnep.filter_multi_addr_response_message",
535 FT_UINT16
, BASE_HEX
, VALS(filter_multi_addr_response_message_vals
), 0x00,
538 { &hf_btbnep_list_length
,
539 { "List Length", "btbnep.list_length",
540 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
543 /* http://www.iana.org/assignments/ethernet-numbers */
544 { &hf_btbnep_network_type_start
,
545 { "Network Protocol Type Range Start", "btbnep.network_type_start",
546 FT_UINT16
, BASE_HEX
, VALS(etype_vals
), 0x00,
549 { &hf_btbnep_network_type_end
,
550 { "Network Protocol Type Range End", "btbnep.network_type_end",
551 FT_UINT16
, BASE_HEX
, VALS(etype_vals
), 0x00,
554 { &hf_btbnep_multicast_address_start
,
555 { "Multicast Address Start", "btbnep.multicast_address_start",
556 FT_ETHER
, BASE_NONE
, NULL
, 0x00,
559 { &hf_btbnep_multicast_address_end
,
560 { "Multicast Address End", "btbnep.multicast_address_end",
561 FT_ETHER
, BASE_NONE
, NULL
, 0x00,
565 { "Destination", "btbnep.dst",
566 FT_ETHER
, BASE_NONE
, NULL
, 0x0,
567 "Destination Hardware Address", HFILL
}
570 { "Source", "btbnep.src",
571 FT_ETHER
, BASE_NONE
, NULL
, 0x0,
572 "Source Hardware Address", HFILL
}
575 { "Length", "btbnep.len",
576 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
579 { &hf_btbnep_invalid_lentype
,
580 { "Invalid length/type", "btbnep.invalid_lentype",
581 FT_UINT16
, BASE_HEX_DEC
, NULL
, 0x0,
585 { "Type", "btbnep.type",
586 FT_UINT16
, BASE_HEX
, VALS(etype_vals
), 0x0,
590 { "Address", "btbnep.addr",
591 FT_ETHER
, BASE_NONE
, NULL
, 0x0,
592 "Source or Destination Hardware Address", HFILL
}
595 { "LG bit", "btbnep.lg",
596 FT_BOOLEAN
, 24, TFS(&lg_tfs
), 0x020000,
597 "Specifies if this is a locally administered or globally unique (IEEE assigned) address", HFILL
}
600 { "IG bit", "btbnep.ig",
601 FT_BOOLEAN
, 24, TFS(&ig_tfs
), 0x010000,
602 "Specifies if this is an individual (unicast) or group (broadcast/multicast) address", HFILL
}
606 static int *ett
[] = {
611 static ei_register_info ei
[] = {
612 { &ei_btbnep_src_not_group_address
, { "btbnep.src.not_group_address", PI_PROTOCOL
, PI_WARN
, "Source MAC must not be a group address: IEEE 802.3-2002, Section 3.2.3(b)", EXPFILL
}},
613 { &ei_btbnep_invalid_lentype
, { "btbnep.invalid_lentype.expert", PI_PROTOCOL
, PI_WARN
, "Invalid length/type", EXPFILL
}},
614 { &ei_btbnep_len_past_end
, { "btbnep.len.past_end", PI_MALFORMED
, PI_ERROR
, "Length field value goes past the end of the payload", EXPFILL
}},
617 proto_btbnep
= proto_register_protocol("Bluetooth BNEP Protocol", "BT BNEP", "btbnep");
618 btbnep_handle
= register_dissector("btbnep", dissect_btbnep
, proto_btbnep
);
620 proto_register_field_array(proto_btbnep
, hf
, array_length(hf
));
621 proto_register_subtree_array(ett
, array_length(ett
));
622 expert_btbnep
= expert_register_protocol(proto_btbnep
);
623 expert_register_field_array(expert_btbnep
, ei
, array_length(ei
));
625 module
= prefs_register_protocol_subtree("Bluetooth", proto_btbnep
, NULL
);
626 prefs_register_static_text_preference(module
, "bnep.version",
627 "Bluetooth Protocol BNEP version: 1.0",
628 "Version of protocol supported by this dissector.");
630 prefs_register_bool_preference(module
, "bnep.top_dissect",
631 "Dissecting the top protocols", "Dissecting the top protocols",
636 proto_reg_handoff_btbnep(void)
638 ipx_handle
= find_dissector_add_dependency("ipx", proto_btbnep
);
639 llc_handle
= find_dissector_add_dependency("llc", proto_btbnep
);
640 ethertype_handle
= find_dissector_add_dependency("ethertype", proto_btbnep
);
642 dissector_add_string("bluetooth.uuid", "1115", btbnep_handle
);
643 dissector_add_string("bluetooth.uuid", "1116", btbnep_handle
);
644 dissector_add_string("bluetooth.uuid", "1117", btbnep_handle
);
646 dissector_add_uint("btl2cap.psm", BTL2CAP_PSM_BNEP
, btbnep_handle
);
647 dissector_add_for_decode_as("btl2cap.cid", btbnep_handle
);
651 * Editor modelines - https://www.wireshark.org/tools/modelines.html
656 * indent-tabs-mode: nil
659 * vi: set shiftwidth=4 tabstop=8 expandtab:
660 * :indentSize=4:tabSize=8:noTabs=true: