diff options
author | Anders Broman <anders.broman@ericsson.com> | 2013-07-23 04:09:50 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2013-07-23 04:09:50 +0000 |
commit | 46eabdf34d1666d7c674b05590ecfce6ecf995aa (patch) | |
tree | 4a64816dd11106f7cb72c0b425e18eec933a8e5b | |
parent | 24a60b1d6c8d3252e28ab7e57685885d7f030c13 (diff) |
From Michal Labedzki:
Add initial support for 3DS Profile.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8948
svn path=/trunk/; revision=50812
-rw-r--r-- | epan/CMakeLists.txt | 1 | ||||
-rw-r--r-- | epan/dissectors/Makefile.common | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-bt3ds.c | 208 | ||||
-rw-r--r-- | epan/dissectors/packet-btl2cap.h | 23 | ||||
-rw-r--r-- | epan/dissectors/packet-btsdp.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-btsdp.h | 6 |
6 files changed, 232 insertions, 10 deletions
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt index e7c72bcbde..81f1e39abc 100644 --- a/epan/CMakeLists.txt +++ b/epan/CMakeLists.txt @@ -396,6 +396,7 @@ set(DISSECTOR_SRC dissectors/packet-bssgp.c dissectors/packet-bt-dht.c dissectors/packet-bt-utp.c + dissectors/packet-bt3ds.c dissectors/packet-btamp.c dissectors/packet-btatt.c dissectors/packet-btbnep.c diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index 74f82869c3..3355520e71 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -322,6 +322,7 @@ DISSECTOR_SRC = \ packet-bssgp.c \ packet-bt-dht.c \ packet-bt-utp.c \ + packet-bt3ds.c \ packet-btamp.c \ packet-btatt.c \ packet-btbnep.c \ diff --git a/epan/dissectors/packet-bt3ds.c b/epan/dissectors/packet-bt3ds.c new file mode 100644 index 0000000000..38662bf2bb --- /dev/null +++ b/epan/dissectors/packet-bt3ds.c @@ -0,0 +1,208 @@ +/* packet-bt3ds.c + * Routines for Bluetooth 3DS dissection + * + * Copyright 2013, Michal Labedzki for Tieto Corporation + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include <epan/packet.h> +#include <epan/prefs.h> +#include <epan/expert.h> + +#include "packet-btl2cap.h" +#include "packet-btsdp.h" + +static int proto_bt3ds = -1; + +static int hf_message_opcode = -1; +static int hf_association_notification = -1; +static int hf_user_request_for_battery_level_display = -1; +static int hf_reserved = -1; +static int hf_battery_level = -1; + +static expert_field ei_message_opcode_reserved = EI_INIT; +static expert_field ei_reserved = EI_INIT; +static expert_field ei_battery_level_reserved = EI_INIT; +static expert_field ei_unexpected_data = EI_INIT; + +static gint ett_bt3ds = -1; + +static const value_string message_opcode_vals[] = { + { 0x00, "3DG Connection Announcement" }, + { 0, NULL } +}; + +void proto_register_bt3ds(void); +void proto_reg_handoff_bt3ds(void); + +static gint +dissect_bt3ds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +{ + proto_item *main_item; + proto_tree *main_tree; + proto_item *sub_item; + gint offset = 0; + guint8 value; + + col_set_str(pinfo->cinfo, COL_PROTOCOL, "3DS"); + col_clear(pinfo->cinfo, COL_INFO); + + switch (pinfo->p2p_dir) { + case P2P_DIR_SENT: + col_add_str(pinfo->cinfo, COL_INFO, "Sent "); + break; + case P2P_DIR_RECV: + col_add_str(pinfo->cinfo, COL_INFO, "Rcvd "); + break; + default: + col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ", + pinfo->p2p_dir); + break; + } + + main_item = proto_tree_add_item(tree, proto_bt3ds, tvb, offset, -1, ENC_NA); + main_tree = proto_item_add_subtree(main_item, ett_bt3ds); + + sub_item = proto_tree_add_item(main_tree, hf_message_opcode, tvb, offset, 1, ENC_BIG_ENDIAN); + value = tvb_get_guint8(tvb, offset); + if (value > 0) + expert_add_info(pinfo, sub_item, &ei_message_opcode_reserved); + offset += 1; + + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_const(value, message_opcode_vals, "Unknown")); + + sub_item = proto_tree_add_item(main_tree, hf_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(main_tree, hf_user_request_for_battery_level_display, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(main_tree, hf_association_notification, tvb, offset, 1, ENC_BIG_ENDIAN); + value = tvb_get_guint8(tvb, offset) >> 2; + if (value != 0) + expert_add_info(pinfo, sub_item, &ei_reserved); + offset += 1; + + sub_item = proto_tree_add_item(main_tree, hf_battery_level, tvb, offset, 1, ENC_BIG_ENDIAN); + value = tvb_get_guint8(tvb, offset); + if (value >= 101 && value <= 254) + expert_add_info(pinfo, sub_item, &ei_battery_level_reserved); + else if (value == 255) + proto_item_append_text(sub_item, "Battery Level Reporting Not Supported"); + + offset += 1; + + if (tvb_length_remaining(tvb, offset) > 0) { + proto_tree_add_expert(main_tree, pinfo, &ei_unexpected_data, tvb, offset, -1); + offset += tvb_length_remaining(tvb, offset); + } + + return offset; +} + + +void +proto_register_bt3ds(void) +{ + module_t *module; + expert_module_t *expert_bt3ds; + + static ei_register_info ei[] = { + { &ei_message_opcode_reserved, { "bt3ds.expert.message_opcode.reserved", PI_PROTOCOL, PI_NOTE, "Value is reserved", EXPFILL }}, + { &ei_reserved, { "bt3ds.expert.reserved", PI_PROTOCOL, PI_NOTE, "Value is reserved", EXPFILL }}, + { &ei_battery_level_reserved, { "bt3ds.expert.battery_level.reserved", PI_PROTOCOL, PI_NOTE, "Value is reserved", EXPFILL }}, + { &ei_unexpected_data, { "bt3ds.expert.unexpected_data", PI_PROTOCOL, PI_WARN, "Unexpected data", EXPFILL }} + }; + + static hf_register_info hf[] = { + { &hf_message_opcode, + { "Message Opcode", "bt3ds.message_opcode", + FT_UINT8, BASE_HEX, VALS(message_opcode_vals), 0x00, + NULL, HFILL } + }, + { &hf_association_notification, + { "Association Notification", "bt3ds.association_notification", + FT_BOOLEAN, 8, NULL, 0x01, + NULL, HFILL } + }, + { &hf_user_request_for_battery_level_display, + { "User Request for Battery Level Display", "bt3ds.user_request_for_battery_level_display", + FT_BOOLEAN, 8, NULL, 0x02, + NULL, HFILL } + }, + { &hf_reserved, + { "Reserved", "bt3ds.reserved", + FT_UINT8, BASE_HEX, NULL, 0xFC, + NULL, HFILL } + }, + { &hf_battery_level, + { "Battery Level", "bt3ds.battery_level", + FT_UINT8, BASE_DEC, NULL, 0x00, + "0-100% of current charge level of battery", HFILL } + } + }; + + static gint *ett[] = { + &ett_bt3ds + }; + + proto_bt3ds = proto_register_protocol("Bluetooth 3DS Profile", "BT 3DS", "bt3ds"); + new_register_dissector("bt3ds", dissect_bt3ds, proto_bt3ds); + + proto_register_field_array(proto_bt3ds, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + expert_bt3ds = expert_register_protocol(proto_bt3ds); + expert_register_field_array(expert_bt3ds, ei, array_length(ei)); + + module = prefs_register_protocol(proto_bt3ds, NULL); + prefs_register_static_text_preference(module, "3ds.version", + "Bluetooth Profile 3DS version: 1.0", + "Version of profile supported by this dissector."); + +} + +void +proto_reg_handoff_bt3ds(void) +{ + dissector_handle_t b3ds_handle; + + b3ds_handle = find_dissector("bt3ds"); + + dissector_add_uint("btl2cap.service", BTSDP_3D_SYNCHRONIZATION_UUID, b3ds_handle); + dissector_add_uint("btl2cap.service", BTSDP_3D_DISPLAY_UUID, b3ds_handle); + dissector_add_uint("btl2cap.service", BTSDP_3D_GLASSES_UUID, b3ds_handle); + + dissector_add_uint("btl2cap.psm", BTL2CAP_PSM_3DS, b3ds_handle); + dissector_add_handle("btl2cap.cid", b3ds_handle); +} + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/dissectors/packet-btl2cap.h b/epan/dissectors/packet-btl2cap.h index 9ed1da3ec1..5837eb47d3 100644 --- a/epan/dissectors/packet-btl2cap.h +++ b/epan/dissectors/packet-btl2cap.h @@ -24,15 +24,20 @@ #ifndef __PACKET_BTL2CAP_H__ #define __PACKET_BTL2CAP_H__ -#define BTL2CAP_PSM_SDP 0x0001 -#define BTL2CAP_PSM_RFCOMM 0x0003 -#define BTL2CAP_PSM_BNEP 0x000f -#define BTL2CAP_PSM_HID_CTRL 0x0011 -#define BTL2CAP_PSM_HID_INTR 0x0013 -#define BTL2CAP_PSM_AVCTP_CTRL 0x0017 -#define BTL2CAP_PSM_AVDTP 0x0019 -#define BTL2CAP_PSM_AVCTP_BRWS 0x001b -#define BTL2CAP_PSM_ATT 0x001f +#define BTL2CAP_PSM_SDP 0x0001 +#define BTL2CAP_PSM_RFCOMM 0x0003 +#define BTL2CAP_PSM_TCS_BIN 0x0005 +#define BTL2CAP_PSM_TCS_BIN_CORDLESS 0x0007 +#define BTL2CAP_PSM_BNEP 0x000f +#define BTL2CAP_PSM_HID_CTRL 0x0011 +#define BTL2CAP_PSM_HID_INTR 0x0013 +#define BTL2CAP_PSM_UPNP 0x0015 +#define BTL2CAP_PSM_AVCTP_CTRL 0x0017 +#define BTL2CAP_PSM_AVDTP 0x0019 +#define BTL2CAP_PSM_AVCTP_BRWS 0x001b +#define BTL2CAP_PSM_UDI_C_PLANE 0x001d +#define BTL2CAP_PSM_ATT 0x001f +#define BTL2CAP_PSM_3DS 0x0021 #define BTL2CAP_DYNAMIC_PSM_START 0x1000 diff --git a/epan/dissectors/packet-btsdp.c b/epan/dissectors/packet-btsdp.c index 7d4bd47f5d..e40efb44c9 100644 --- a/epan/dissectors/packet-btsdp.c +++ b/epan/dissectors/packet-btsdp.c @@ -840,6 +840,9 @@ static const value_string vs_service_classes[] = { { 0x1134, "Message Access Profile" }, { 0x1135, "Global Navigation Satellite System" }, { 0x1136, "Global Navigation Satellite System Server" }, + { 0x1137, "3D Display" }, + { 0x1138, "3D Glasses" }, + { 0x1139, "3D Synchronization Profile" }, { 0x1200, "PnP Information" }, { 0x1201, "Generic Networking" }, { 0x1202, "Generic File Transfer" }, diff --git a/epan/dissectors/packet-btsdp.h b/epan/dissectors/packet-btsdp.h index d9d7780ad4..e1d91a9ccd 100644 --- a/epan/dissectors/packet-btsdp.h +++ b/epan/dissectors/packet-btsdp.h @@ -130,11 +130,15 @@ #define BTSDP_GNSS_UUID 0x1135 #define BTSDP_GNSS_SERVER_UUID 0x1136 +#define BTSDP_3D_DISPLAY_UUID 0x1137 +#define BTSDP_3D_GLASSES_UUID 0x1138 +#define BTSDP_3D_SYNCHRONIZATION_UUID 0x1139 + #define BTSDP_DID_SERVICE_UUID 0x1200 #define BTSDP_GENERIC_NETWORKING_SERVICE_UUID 0x1201 #define BTSDP_GENERIC_FILE_TRANSFER_SERVICE_UUID 0x1202 -#define BTSDP_GENERIC_AUDIO_SERVICE_UUID e 0x1203 +#define BTSDP_GENERIC_AUDIO_SERVICE_UUID 0x1203 #define BTSDP_GENERIC_TELEPHONY_SERVICE_UUID 0x1204 #define BTSDP_ESDP_UPNP_SERVICE_SERVICE_UUID 0x1205 |