aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bluetooth.c
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2015-07-13 19:01:48 +0200
committerMichal Labedzki <michal.labedzki@tieto.com>2015-07-17 08:06:40 +0000
commitdac7cf9f8c5bf5ce0d0abe10c5a04950716d02bc (patch)
tree2ccb6f3bdf57aade00f14917986b505419d0cff2 /epan/dissectors/packet-bluetooth.c
parent5491fea2017f8c1ad92476f25bee7219e3c68155 (diff)
Bluetooth: Add generic UUID table for DecodeBy
Replace L2CAP Service, RFCOMM Service and AVCTP PID dissector table by shared Bluetooth Service UUID table. It also supports UUID16, UUID32 and UUID128 by hex-string, like for AVRCP: "110e". Change-Id: I473bc73d10939e8ed6dd55a6a92387c7a1ec125a Reviewed-on: https://code.wireshark.org/review/9678 Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'epan/dissectors/packet-bluetooth.c')
-rw-r--r--epan/dissectors/packet-bluetooth.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/epan/dissectors/packet-bluetooth.c b/epan/dissectors/packet-bluetooth.c
index f994576722..12bfec2008 100644
--- a/epan/dissectors/packet-bluetooth.c
+++ b/epan/dissectors/packet-bluetooth.c
@@ -27,6 +27,7 @@
#include <epan/packet.h>
#include <epan/to_str.h>
#include <epan/conversation_table.h>
+#include <epan/decode_as.h>
#include <wiretap/wtap.h>
#include "packet-bluetooth.h"
@@ -47,6 +48,7 @@ static dissector_handle_t data_handle;
static dissector_table_t bluetooth_table;
static dissector_table_t hci_vendor_table;
+dissector_table_t bluetooth_uuid_table;
static wmem_tree_t *chandle_sessions = NULL;
static wmem_tree_t *chandle_to_bdaddr = NULL;
@@ -1022,6 +1024,28 @@ guint32 max_disconnect_in_frame = G_MAXUINT32;
void proto_register_bluetooth(void);
void proto_reg_handoff_bluetooth(void);
+static void bluetooth_uuid_prompt(packet_info *pinfo, gchar* result)
+{
+ gchar *value_data;
+
+ value_data = (gchar *) p_get_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID);
+ if (value_data)
+ g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "BT Service UUID %s as", (gchar *) value_data);
+ else
+ g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Unknown BT Service UUID");
+}
+
+static gpointer bluetooth_uuid_value(packet_info *pinfo)
+{
+ gchar *value_data;
+
+ value_data = (gchar *) p_get_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID);
+
+ if (value_data)
+ return (gpointer) value_data;
+
+ return NULL;
+}
gint
dissect_bd_addr(gint hf_bd_addr, packet_info *pinfo, proto_tree *tree,
@@ -1499,6 +1523,13 @@ proto_register_bluetooth(void)
&ett_bluetooth,
};
+ /* Decode As handling */
+ static build_valid_func bluetooth_uuid_da_build_value[1] = {bluetooth_uuid_value};
+ static decode_as_value_t bluetooth_uuid_da_values = {bluetooth_uuid_prompt, 1, bluetooth_uuid_da_build_value};
+ static decode_as_t bluetooth_uuid_da = {"bluetooth", "BT Service UUID", "bluetooth.uuid", 1, 0, &bluetooth_uuid_da_values, NULL, NULL,
+ decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL};
+
+
proto_bluetooth = proto_register_protocol("Bluetooth",
"Bluetooth", "bluetooth");
@@ -1524,7 +1555,11 @@ proto_register_bluetooth(void)
bluetooth_tap = register_tap("bluetooth");
bluetooth_device_tap = register_tap("bluetooth.device");
+ bluetooth_uuid_table = register_dissector_table("bluetooth.uuid", "BT Service UUID", FT_STRING, BASE_NONE);
+
register_conversation_table(proto_bluetooth, TRUE, bluetooth_conversation_packet, bluetooth_hostlist_packet);
+
+ register_decode_as(&bluetooth_uuid_da);
}
void