* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef __PACKET_BLUETOOTH_H__
#define __PACKET_BLUETOOTH_H__
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
#include <epan/wmem/wmem.h>
#include "packet-usb.h"
#include "packet-ubertooth.h"
+#define PROTO_DATA_BLUETOOTH_SERVICE_UUID 0
+
#define BLUETOOTH_DATA_SRC 0
#define BLUETOOTH_DATA_DST 1
extern int proto_bluetooth;
-extern value_string_ext bthci_cmd_opcode_vals_ext;
-extern value_string_ext bthci_ogf_vals_ext;
-extern value_string_ext bthci_cmd_ocf_link_control_vals_ext;
-extern value_string_ext bthci_cmd_ocf_link_policy_vals_ext;
-extern value_string_ext bthci_cmd_ocf_host_controller_and_baseband_vals_ext;
-extern value_string_ext bthci_cmd_ocf_informational_vals_ext;
-extern value_string_ext bthci_cmd_ocf_status_vals_ext;
-extern value_string_ext bthci_cmd_ocf_testing_vals_ext;
-extern value_string_ext bthci_cmd_ocf_low_energy_vals_ext;
-
-extern value_string_ext bthci_cmd_input_coding_vals_ext;
-extern value_string_ext bthci_cmd_input_data_format_vals_ext;
-extern value_string_ext bthci_cmd_input_sample_size_vals_ext;
-extern value_string_ext bthci_cmd_air_coding_format_vals_ext;
-extern value_string_ext bthci_cmd_status_vals_ext;
-extern value_string_ext bthci_cmd_eir_data_type_vals_ext;
-extern value_string_ext bthci_cmd_auth_req_vals_ext;
-extern value_string_ext bthci_cmd_appearance_vals_ext;
-
-extern const value_string bthci_cmd_io_capability_vals[];
-extern const value_string bthci_cmd_oob_data_present_vals[];
-extern const value_string bthci_cmd_address_types_vals[];
-extern const value_string bthci_cmd_scan_enable_values[];
-extern const value_string bthci_cmd_page_scan_modes[];
-extern const value_string bthci_cmd_page_scan_repetition_modes[];
-extern const value_string bthci_cmd_page_scan_period_modes[];
-extern const value_string bthci_cmd_notification_types[];
-
-extern value_string_ext bthci_evt_evt_code_vals_ext;
-
extern const value_string bluetooth_address_type_vals[];
#define STATUS_SUCCESS 0x00
#define HCI_INTERFACE_DEFAULT 0
#define HCI_ADAPTER_DEFAULT 0
+typedef enum {
+ BT_PD_NONE, /* no protocol data */
+ BT_PD_BTHCI, /* struct bthci_phdr * */
+ BT_PD_BTMON, /* struct btmon_phdr * */
+ BT_PD_USB_CONV_INFO, /* usb_conv_info_t * */
+ BT_PD_UBERTOOTH_DATA /* ubertooth_data_t * */
+} bt_protocol_data_type;
+
/* chandle_sessions: interface_id + adapter_id + connection_handle + frame_number -> connect_in_frame, disconnect_in_frame */
/* chandle_to_bdaddr: interface_id + adapter_id + connection_handle + frame_number -> bd_addr[6] */
/* chandle_to_mode: interface_id + adapter_id + connection_handle + frame_number -> mode */
wmem_tree_t *localhost_name;
wmem_tree_t *hci_vendors;
+ bt_protocol_data_type previous_protocol_data_type;
union {
- void *data;
+ void *none;
+ struct bthci_phdr *bthci;
+ struct btmon_phdr *btmon;
usb_conv_info_t *usb_conv_info;
ubertooth_data_t *ubertooth_data;
} previous_protocol_data;
} bluetooth_data_t;
+#define BT_LINK_TYPE_UNKNOWN 0
+#define BT_LINK_TYPE_ACL 1
+#define BT_LINK_TYPE_SCO 2
+#define BT_LINK_TYPE_LL 3
+
typedef struct _chandle_session_t {
guint32 connect_in_frame;
guint32 disconnect_in_frame;
+ guint32 link_type;
} chandle_session_t;
typedef struct _remote_bdaddr_t {
guint16 bt_uuid;
guint8 size;
guint8 data[16];
-} uuid_t;
-
-typedef struct _custom_uuid_t {
- const guint8 uuid[16];
- const guint8 size;
- const gchar *name;
-} custom_uuid_t;
-
-extern const value_string bluetooth_uuid_vals[];
-extern const custom_uuid_t custom_uuid[];
-
-extern value_string_ext bluetooth_uuid_vals_ext;
-extern value_string_ext bluetooth_company_id_vals_ext;
+} bluetooth_uuid_t;
+
+enum bluetooth_device_type {
+ BLUETOOTH_DEVICE_BD_ADDR,
+ BLUETOOTH_DEVICE_NAME,
+ BLUETOOTH_DEVICE_LOCAL_ADAPTER,
+ BLUETOOTH_DEVICE_LOCAL_VERSION,
+ BLUETOOTH_DEVICE_REMOTE_VERSION,
+ BLUETOOTH_DEVICE_RESET,
+ BLUETOOTH_DEVICE_SCAN,
+ BLUETOOTH_DEVICE_VOICE_SETTING,
+ BLUETOOTH_DEVICE_AUTHENTICATION,
+ BLUETOOTH_DEVICE_ENCRYPTION,
+ BLUETOOTH_DEVICE_CLASS_OF_DEVICE,
+ BLUETOOTH_DEVICE_SIMPLE_PAIRING_MODE,
+ BLUETOOTH_DEVICE_PAGE_TIMEOUT,
+ BLUETOOTH_DEVICE_INQUIRY_MODE,
+ BLUETOOTH_DEVICE_MTUS,
+ BLUETOOTH_DEVICE_LE_MTU
+};
+
+typedef struct _bluetooth_device_tap_t {
+ guint32 interface_id;
+ guint32 adapter_id;
+
+ gboolean is_local;
+ gboolean has_bd_addr;
+ guint8 bd_addr[6];
+ enum bluetooth_device_type type;
+ union {
+ char *name;
+ struct {
+ guint8 hci_version;
+ guint16 hci_revision;
+ guint8 lmp_version;
+ guint16 lmp_subversion;
+ guint16 manufacturer;
+ } local_version;
+ struct {
+ guint8 lmp_version;
+ guint16 lmp_subversion;
+ guint16 manufacturer;
+ } remote_version;
+ guint8 scan;
+ guint16 page_timeout;
+ guint8 authentication;
+ guint8 encryption;
+ guint32 class_of_device;
+ guint16 voice_setting;
+ guint8 simple_pairing_mode;
+ guint8 inquiry_mode;
+ struct {
+ guint16 acl_mtu;
+ guint8 sco_mtu;
+ guint16 acl_packets;
+ guint16 sco_packets;
+ } mtus;
+ struct {
+ guint16 acl_mtu;
+ guint16 acl_packets;
+ } le_mtus;
+ } data;
+} bluetooth_device_tap_t;
+
+enum bluetooth_hci_summary_type {
+ BLUETOOTH_HCI_SUMMARY_OPCODE,
+ BLUETOOTH_HCI_SUMMARY_EVENT_OPCODE,
+ BLUETOOTH_HCI_SUMMARY_EVENT,
+ BLUETOOTH_HCI_SUMMARY_SUBEVENT,
+ BLUETOOTH_HCI_SUMMARY_VENDOR_OPCODE,
+ BLUETOOTH_HCI_SUMMARY_VENDOR_EVENT_OPCODE,
+ BLUETOOTH_HCI_SUMMARY_VENDOR_EVENT,
+ BLUETOOTH_HCI_SUMMARY_STATUS,
+ BLUETOOTH_HCI_SUMMARY_STATUS_PENDING,
+ BLUETOOTH_HCI_SUMMARY_REASON,
+ BLUETOOTH_HCI_SUMMARY_HARDWARE_ERROR
+};
+
+typedef struct _bluetooth_hci_summary_tap_t {
+ guint32 interface_id;
+ guint32 adapter_id;
+
+ guint16 ocf;
+ guint8 ogf;
+ guint8 event;
+ guint8 subevent;
+ guint8 status;
+ guint8 reason;
+ guint8 hardware_error;
+
+ const gchar *name;
+ enum bluetooth_hci_summary_type type;
+} bluetooth_hci_summary_tap_t;
+
+typedef struct _bluetooth_eir_ad_data_t {
+ guint32 interface_id;
+ guint32 adapter_id;
+
+ guint8 *bd_addr;
+} bluetooth_eir_ad_data_t;
+
+
+extern int bluetooth_device_tap;
+extern int bluetooth_hci_summary_tap;
+
+WS_DLL_PUBLIC const value_string bluetooth_uuid_vals[];
+
+extern dissector_table_t bluetooth_uuid_table;
+
+WS_DLL_PUBLIC wmem_tree_t *bluetooth_uuids;
+
+WS_DLL_PUBLIC value_string_ext bluetooth_uuid_vals_ext;
+WS_DLL_PUBLIC value_string_ext bluetooth_company_id_vals_ext;
extern guint32 max_disconnect_in_frame;
-extern gint dissect_bd_addr(gint hf_bd_addr, proto_tree *tree, tvbuff_t *tvb,
- gint offset, guint8 *bdaddr);
+extern gint dissect_bd_addr(gint hf_bd_addr, packet_info *pinfo, proto_tree *tree,
+ tvbuff_t *tvb, gint offset, gboolean is_local_bd_addr,
+ guint32 interface_id, guint32 adapter_id, guint8 *bdaddr);
-extern uuid_t get_uuid(tvbuff_t *tvb, gint offset, gint size);
-extern gchar *print_uuid(uuid_t *uuid);
-extern gchar *print_numeric_uuid(uuid_t *uuid);
+extern bluetooth_uuid_t get_uuid(tvbuff_t *tvb, gint offset, gint size);
+WS_DLL_PUBLIC const gchar *print_uuid(bluetooth_uuid_t *uuid);
+WS_DLL_PUBLIC const gchar *print_numeric_uuid(bluetooth_uuid_t *uuid);
extern void save_local_device_name_from_eir_ad(tvbuff_t *tvb, gint offset,
packet_info *pinfo, guint8 size, bluetooth_data_t *bluetooth_data);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
#endif
/*