36dbff9ce0064d607769c498bb585ae310711b5d
[metze/wireshark/wip.git] / epan / dissectors / packet-bluetooth.c
1 /* packet-bluetooth.c
2  * Routines for the Bluetooth
3  *
4  * Copyright 2014, Michal Labedzki for Tieto Corporation
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
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 #include "config.h"
26
27 #include <string.h>
28 #include <epan/packet.h>
29 #include <epan/to_str.h>
30 #include <epan/conversation_table.h>
31 #include <epan/decode_as.h>
32 #include <wiretap/wtap.h>
33
34 #include "packet-bluetooth.h"
35
36 int proto_bluetooth = -1;
37
38 static int hf_bluetooth_src = -1;
39 static int hf_bluetooth_dst = -1;
40 static int hf_bluetooth_addr = -1;
41 static int hf_bluetooth_str_src = -1;
42 static int hf_bluetooth_str_dst = -1;
43 static int hf_bluetooth_str_addr = -1;
44
45 static gint ett_bluetooth = -1;
46
47 static dissector_handle_t btle_handle;
48 static dissector_handle_t data_handle;
49
50 static dissector_table_t bluetooth_table;
51 static dissector_table_t hci_vendor_table;
52 dissector_table_t        bluetooth_uuid_table;
53
54 static wmem_tree_t *chandle_sessions        = NULL;
55 static wmem_tree_t *chandle_to_bdaddr       = NULL;
56 static wmem_tree_t *chandle_to_mode         = NULL;
57 static wmem_tree_t *bdaddr_to_name          = NULL;
58 static wmem_tree_t *bdaddr_to_role          = NULL;
59 static wmem_tree_t *localhost_name          = NULL;
60 static wmem_tree_t *localhost_bdaddr        = NULL;
61 static wmem_tree_t *hci_vendors             = NULL;
62
63 wmem_tree_t *bluetooth_uuids = NULL;
64
65 static int bluetooth_tap = -1;
66 int bluetooth_device_tap = -1;
67 int bluetooth_hci_summary_tap = -1;
68
69 const value_string bluetooth_uuid_vals[] = {
70     /* Protocol Identifiers - https://www.bluetooth.org/en-us/specification/assigned-numbers/service-discovery */
71     { 0x0001,   "SDP" },
72     { 0x0002,   "UDP" },
73     { 0x0003,   "RFCOMM" },
74     { 0x0004,   "TCP" },
75     { 0x0005,   "TCS-BIN" },
76     { 0x0006,   "TCS-AT" },
77     { 0x0007,   "ATT" },
78     { 0x0008,   "OBEX" },
79     { 0x0009,   "IP" },
80     { 0x000A,   "FTP" },
81     { 0x000C,   "HTTP" },
82     { 0x000E,   "WSP" },
83     { 0x000F,   "BNEP" },
84     { 0x0010,   "UPNP" },
85     { 0x0011,   "HIDP" },
86     { 0x0012,   "Hardcopy Control Channel" },
87     { 0x0014,   "Hardcopy Data Channel" },
88     { 0x0016,   "Hardcopy Notification" },
89     { 0x0017,   "AVCTP" },
90     { 0x0019,   "AVDTP" },
91     { 0x001B,   "CMPT" },
92     { 0x001D,   "UDI C-Plane" }, /* unofficial */
93     { 0x001E,   "MCAP Control Channel" },
94     { 0x001F,   "MCAP Data Channel" },
95     { 0x0100,   "L2CAP" },
96     /* Traditional Services - https://www.bluetooth.org/en-us/specification/assigned-numbers/service-discovery */
97     { 0x1000,   "Service Discovery Server Service Class ID" },
98     { 0x1001,   "Browse Group Descriptor Service Class ID" },
99     { 0x1002,   "Public Browse Group" },
100     { 0x1101,   "Serial Port" },
101     { 0x1102,   "LAN Access Using PPP" },
102     { 0x1103,   "Dialup Networking" },
103     { 0x1104,   "IrMC Sync" },
104     { 0x1105,   "OBEX Object Push" },
105     { 0x1106,   "OBEX File Transfer" },
106     { 0x1107,   "IrMC Sync Command" },
107     { 0x1108,   "Headset" },
108     { 0x1109,   "Cordless Telephony" },
109     { 0x110A,   "Audio Source" },
110     { 0x110B,   "Audio Sink" },
111     { 0x110C,   "A/V Remote Control Target" },
112     { 0x110D,   "Advanced Audio Distribution" },
113     { 0x110E,   "A/V Remote Control" },
114     { 0x110F,   "A/V Remote Control Controller" },
115     { 0x1110,   "Intercom" },
116     { 0x1111,   "Fax" },
117     { 0x1112,   "Headset Audio Gateway" },
118     { 0x1113,   "WAP" },
119     { 0x1114,   "WAP Client" },
120     { 0x1115,   "PAN PANU" },
121     { 0x1116,   "PAN NAP" },
122     { 0x1117,   "PAN GN" },
123     { 0x1118,   "Direct Printing" },
124     { 0x1119,   "Reference Printing" },
125     { 0x111A,   "Imaging" },
126     { 0x111B,   "Imaging Responder" },
127     { 0x111C,   "Imaging Automatic Archive" },
128     { 0x111D,   "Imaging Referenced Objects" },
129     { 0x111E,   "Handsfree" },
130     { 0x111F,   "Handsfree Audio Gateway" },
131     { 0x1120,   "Direct Printing Reference Objects Service" },
132     { 0x1121,   "Reflected UI" },
133     { 0x1122,   "Basic Printing" },
134     { 0x1123,   "Printing Status" },
135     { 0x1124,   "Human Interface Device Service" },
136     { 0x1125,   "Hardcopy Cable Replacement" },
137     { 0x1126,   "HCR Print" },
138     { 0x1127,   "HCR Scan" },
139     { 0x1128,   "Common ISDN Access" },
140     { 0x1129,   "Video Conferencing GW" },
141     { 0x112A,   "UDI MT" },
142     { 0x112B,   "UDI TA" },
143     { 0x112C,   "Audio/Video" },
144     { 0x112D,   "SIM Access" },
145     { 0x112E,   "Phonebook Access Client" },
146     { 0x112F,   "Phonebook Access Server" },
147     { 0x1130,   "Phonebook Access Profile" },
148     { 0x1131,   "Headset HS" },
149     { 0x1132,   "Message Access Server" },
150     { 0x1133,   "Message Notification Server" },
151     { 0x1134,   "Message Access Profile" },
152     { 0x1135,   "Global Navigation Satellite System" },
153     { 0x1136,   "Global Navigation Satellite System Server" },
154     { 0x1137,   "3D Display" },
155     { 0x1138,   "3D Glasses" },
156     { 0x1139,   "3D Synchronization Profile" },
157     { 0x113A,   "Multi-Profile" },
158     { 0x113B,   "Multi-Profile SC" },
159     { 0x113C,   "Calendar, Task and Notes Access Service" },
160     { 0x113D,   "Calendar, Task and Notes Notification Service" },
161     { 0x113E,   "Calendar, Task and Notes Profile" },
162     { 0x1200,   "PnP Information" },
163     { 0x1201,   "Generic Networking" },
164     { 0x1202,   "Generic File Transfer" },
165     { 0x1203,   "Generic Audio" },
166     { 0x1204,   "Generic Telephony" },
167     { 0x1205,   "UPNP Service" },
168     { 0x1206,   "UPNP IP Service" },
169     { 0x1300,   "ESDP UPNP_IP PAN" },
170     { 0x1301,   "ESDP UPNP IP LAP" },
171     { 0x1302,   "ESDP UPNP L2CAP" },
172     { 0x1303,   "Video Source" },
173     { 0x1304,   "Video Sink" },
174     { 0x1305,   "Video Distribution" },
175     { 0x1400,   "Health Device Profile" },
176     { 0x1401,   "Health Device Source" },
177     { 0x1402,   "Health Device Sink" },
178     /* LE Services -  https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx */
179     { 0x1800,   "Generic Access Profile" },
180     { 0x1801,   "Generic Attribute Profile" },
181     { 0x1802,   "Immediate Alert" },
182     { 0x1803,   "Link Loss" },
183     { 0x1804,   "Tx Power" },
184     { 0x1805,   "Current Time Service" },
185     { 0x1806,   "Reference Time Update Service" },
186     { 0x1807,   "Next DST Change Service" },
187     { 0x1808,   "Glucose" },
188     { 0x1809,   "Health Thermometer" },
189     { 0x180A,   "Device Information" },
190     { 0x180D,   "Heart Rate" },
191     { 0x180E,   "Phone Alert Status Service" },
192     { 0x180F,   "Battery Service" },
193     { 0x1810,   "Blood Pressure" },
194     { 0x1811,   "Alert Notification Service" },
195     { 0x1812,   "Human Interface Device" },
196     { 0x1813,   "Scan Parameters" },
197     { 0x1814,   "Running Speed and Cadence" },
198     { 0x1815,   "Automation IO" }, /* Not adopted, 0.9 now (6th June 2015) */
199     { 0x1816,   "Cycling Speed and Cadence" },
200     { 0x1818,   "Cycling Power" },
201     { 0x1819,   "Location and Navigation" },
202     { 0x181A,   "Environmental Sensing" },
203     { 0x181B,   "Body Composition" },
204     { 0x181C,   "User Data" },
205     { 0x181D,   "Weight Scale" },
206     { 0x181E,   "Bond Management" },
207     { 0x181F,   "Continuous Glucose Monitoring" },
208     { 0x1820,   "Internet Protocol Support" },
209     { 0x1821,   "Indoor Positioning" },
210     { 0x1822,   "Pulse Oximeter" },
211     { 0x1823,   "HTTP Proxy" },
212     /* Units - https://developer.bluetooth.org/gatt/units/Pages/default.aspx */
213     { 0x2700,   "unitless" },
214     { 0x2701,   "length (metre)" },
215     { 0x2702,   "mass (kilogram)" },
216     { 0x2703,   "time (second)" },
217     { 0x2704,   "electric current (ampere)" },
218     { 0x2705,   "thermodynamic temperature (kelvin)" },
219     { 0x2706,   "amount of substance (mole)" },
220     { 0x2707,   "luminous intensity (candela)" },
221     { 0x2710,   "area (square metres)" },
222     { 0x2711,   "volume (cubic metres)" },
223     { 0x2712,   "velocity (metres per second)" },
224     { 0x2713,   "acceleration (metres per second squared)" },
225     { 0x2714,   "wavenumber (reciprocal metre)" },
226     { 0x2715,   "density (kilogram per cubic metre)" },
227     { 0x2716,   "surface density (kilogram per square metre)" },
228     { 0x2717,   "specific volume (cubic metre per kilogram)" },
229     { 0x2718,   "current density (ampere per square metre)" },
230     { 0x2719,   "magnetic field strength (ampere per metre)" },
231     { 0x271A,   "amount concentration (mole per cubic metre)" },
232     { 0x271B,   "mass concentration (kilogram per cubic metre)" },
233     { 0x271C,   "luminance (candela per square metre)" },
234     { 0x271D,   "refractive index" },
235     { 0x271E,   "relative permeability" },
236     { 0x2720,   "plane angle (radian)" },
237     { 0x2721,   "solid angle (steradian)" },
238     { 0x2722,   "frequency (hertz)" },
239     { 0x2723,   "force (newton)" },
240     { 0x2724,   "pressure (pascal)" },
241     { 0x2725,   "energy (joule)" },
242     { 0x2726,   "power (watt)" },
243     { 0x2727,   "electric charge (coulomb)" },
244     { 0x2728,   "electric potential difference (volt)" },
245     { 0x2729,   "capacitance (farad)" },
246     { 0x272A,   "electric resistance (ohm)" },
247     { 0x272B,   "electric conductance (siemens)" },
248     { 0x272C,   "magnetic flex (weber)" },
249     { 0x272D,   "magnetic flex density (tesla)" },
250     { 0x272E,   "inductance (henry)" },
251     { 0x272F,   "Celsius temperature (degree Celsius)" },
252     { 0x2730,   "luminous flux (lumen)" },
253     { 0x2731,   "illuminance (lux)" },
254     { 0x2732,   "activity referred to a radionuclide (becquerel)" },
255     { 0x2733,   "absorbed dose (gray)" },
256     { 0x2734,   "dose equivalent (sievert)" },
257     { 0x2735,   "catalytic activity (katal)" },
258     { 0x2740,   "dynamic viscosity (pascal second)" },
259     { 0x2741,   "moment of force (newton metre)" },
260     { 0x2742,   "surface tension (newton per metre)" },
261     { 0x2743,   "angular velocity (radian per second)" },
262     { 0x2744,   "angular acceleration (radian per second squared)" },
263     { 0x2745,   "heat flux density (watt per square metre)" },
264     { 0x2746,   "heat capacity (joule per kelvin)" },
265     { 0x2747,   "specific heat capacity (joule per kilogram kelvin)" },
266     { 0x2748,   "specific energy (joule per kilogram)" },
267     { 0x2749,   "thermal conductivity (watt per metre kelvin)" },
268     { 0x274A,   "energy density (joule per cubic metre)" },
269     { 0x274B,   "electric field strength (volt per metre)" },
270     { 0x274C,   "electric charge density (coulomb per cubic metre)" },
271     { 0x274D,   "surface charge density (coulomb per square metre)" },
272     { 0x274E,   "electric flux density (coulomb per square metre)" },
273     { 0x274F,   "permittivity (farad per metre)" },
274     { 0x2750,   "permeability (henry per metre)" },
275     { 0x2751,   "molar energy (joule per mole)" },
276     { 0x2752,   "molar entropy (joule per mole kelvin)" },
277     { 0x2753,   "exposure (coulomb per kilogram)" },
278     { 0x2754,   "absorbed dose rate (gray per second)" },
279     { 0x2755,   "radiant intensity (watt per steradian)" },
280     { 0x2756,   "radiance (watt per square metre steradian)" },
281     { 0x2757,   "catalytic activity concentration (katal per cubic metre)" },
282     { 0x2760,   "time (minute)" },
283     { 0x2761,   "time (hour)" },
284     { 0x2762,   "time (day)" },
285     { 0x2763,   "plane angle (degree)" },
286     { 0x2764,   "plane angle (minute)" },
287     { 0x2765,   "plane angle (second)" },
288     { 0x2766,   "area (hectare)" },
289     { 0x2767,   "volume (litre)" },
290     { 0x2768,   "mass (tonne)" },
291     { 0x2780,   "pressure (bar)" },
292     { 0x2781,   "pressure (millimetre of mercury)" },
293     { 0x2782,   "length (angstrom)" },
294     { 0x2783,   "length (nautical mile)" },
295     { 0x2784,   "area (barn)" },
296     { 0x2785,   "velocity (knot)" },
297     { 0x2786,   "logarithmic radio quantity (neper)" },
298     { 0x2787,   "logarithmic radio quantity (bel)" },
299     { 0x27A0,   "length (yard)" },
300     { 0x27A1,   "length (parsec)" },
301     { 0x27A2,   "length (inch)" },
302     { 0x27A3,   "length (foot)" },
303     { 0x27A4,   "length (mile)" },
304     { 0x27A5,   "pressure (pound-force per square inch)" },
305     { 0x27A6,   "velocity (kilometre per hour)" },
306     { 0x27A7,   "velocity (mile per hour)" },
307     { 0x27A8,   "angular velocity (revolution per minute)" },
308     { 0x27A9,   "energy (gram calorie)" },
309     { 0x27AA,   "energy (kilogram calorie)" },
310     { 0x27AB,   "energy (kilowatt hour)" },
311     { 0x27AC,   "thermodynamic temperature (degree Fahrenheit)" },
312     { 0x27AD,   "percentage" },
313     { 0x27AE,   "per mille" },
314     { 0x27AF,   "period (beats per minute)" },
315     { 0x27B0,   "electric charge (ampere hours)" },
316     { 0x27B1,   "mass density (milligram per decilitre)" },
317     { 0x27B2,   "mass density (millimole per litre)" },
318     { 0x27B3,   "time (year)" },
319     { 0x27B4,   "time (month)" },
320     { 0x27B5,   "concentration (count per cubic metre)" },
321     { 0x27B6,   "irradiance (watt per square metre)" },
322     { 0x27B7,   "milliliter (per kilogram per minute)" },
323     { 0x27B8,   "mass (pound)" },
324     /* Declarations - https://developer.bluetooth.org/gatt/declarations/Pages/DeclarationsHome.aspx */
325     { 0x2800,   "GATT Primary Service Declaration" },
326     { 0x2801,   "GATT Secondary Service Declaration" },
327     { 0x2802,   "GATT Include Declaration" },
328     { 0x2803,   "GATT Characteristic Declaration" },
329     /* Descriptors - https://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorsHomePage.aspx */
330     { 0x2900,   "Characteristic Extended Properties" },
331     { 0x2901,   "Characteristic User Description" },
332     { 0x2902,   "Client Characteristic Configuration" },
333     { 0x2903,   "Server Characteristic Configuration" },
334     { 0x2904,   "Characteristic Presentation Format" },
335     { 0x2905,   "Characteristic Aggregate Format" },
336     { 0x2906,   "Valid Range" },
337     { 0x2907,   "External Report Reference" },
338     { 0x2908,   "Report Reference" },
339     { 0x2909,   "Number of Digitals" }, /* Not adopted, 0.9 now (18th July 2015) */
340     { 0x290A,   "Value Trigger Setting" },
341     { 0x290B,   "Environmental Sensing Configuration" },
342     { 0x290C,   "Environmental Sensing Measurement" },
343     { 0x290D,   "Environmental Sensing Trigger Setting" },
344     { 0x290E,   "Time Trigger Setting" }, /* Not adopted, 0.9 now (18th July 2015) */
345     /* Characteristics - https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicsHome.aspx */
346     { 0x2A00,   "Device Name" },
347     { 0x2A01,   "Appearance" },
348     { 0x2A02,   "Peripheral Privacy Flag" },
349     { 0x2A03,   "Reconnection Address" },
350     { 0x2A04,   "Peripheral Preferred Connection Parameters" },
351     { 0x2A05,   "Service Changed" },
352     { 0x2A06,   "Alert Level" },
353     { 0x2A07,   "Tx Power Level" },
354     { 0x2A08,   "Date Time" },
355     { 0x2A09,   "Day of Week" },
356     { 0x2A0A,   "Day Date Time" },
357     { 0x2A0C,   "Exact Time 256" },
358     { 0x2A0D,   "DST Offset" },
359     { 0x2A0E,   "Time Zone" },
360     { 0x2A0F,   "Local Time Information" },
361     { 0x2A11,   "Time with DST" },
362     { 0x2A12,   "Time Accuracy" },
363     { 0x2A13,   "Time Source" },
364     { 0x2A14,   "Reference Time Information" },
365     { 0x2A16,   "Time Update Control Point" },
366     { 0x2A17,   "Time Update State" },
367     { 0x2A18,   "Glucose Measurement" },
368     { 0x2A19,   "Battery Level" },
369     { 0x2A1C,   "Temperature Measurement" },
370     { 0x2A1D,   "Temperature Type" },
371     { 0x2A1E,   "Intermediate Temperature" },
372     { 0x2A21,   "Measurement Interval" },
373     { 0x2A22,   "Boot Keyboard Input Report" },
374     { 0x2A23,   "System ID" },
375     { 0x2A24,   "Model Number String" },
376     { 0x2A25,   "Serial Number String" },
377     { 0x2A26,   "Firmware Revision String" },
378     { 0x2A27,   "Hardware Revision String" },
379     { 0x2A28,   "Software Revision String" },
380     { 0x2A29,   "Manufacturer Name String" },
381     { 0x2A2A,   "IEEE 11073-20601 Regulatory Certification Data List" },
382     { 0x2A2B,   "Current Time" },
383     { 0x2A2C,   "Magnetic Declination" },
384     { 0x2A31,   "Scan Refresh" },
385     { 0x2A32,   "Boot Keyboard Output Report" },
386     { 0x2A33,   "Boot Mouse Input Report" },
387     { 0x2A34,   "Glucose Measurement Context" },
388     { 0x2A35,   "Blood Pressure Measurement" },
389     { 0x2A36,   "Intermediate Cuff Pressure" },
390     { 0x2A37,   "Heart Rate Measurement" },
391     { 0x2A38,   "Body Sensor Location" },
392     { 0x2A39,   "Heart Rate Control Point" },
393     { 0x2A3F,   "Alert Status" },
394     { 0x2A40,   "Ringer Control Point" },
395     { 0x2A41,   "Ringer Setting" },
396     { 0x2A42,   "Alert Category ID Bit Mask" },
397     { 0x2A43,   "Alert Category ID" },
398     { 0x2A44,   "Alert Notification Control Point" },
399     { 0x2A45,   "Unread Alert Status" },
400     { 0x2A46,   "New Alert" },
401     { 0x2A47,   "Supported New Alert Category" },
402     { 0x2A48,   "Supported Unread Alert Category" },
403     { 0x2A49,   "Blood Pressure Feature" },
404     { 0x2A4A,   "HID Information" },
405     { 0x2A4B,   "Report Map" },
406     { 0x2A4C,   "HID Control Point" },
407     { 0x2A4D,   "Report" },
408     { 0x2A4E,   "Protocol Mode" },
409     { 0x2A4F,   "Scan Interval Window" },
410     { 0x2A50,   "PnP ID" },
411     { 0x2A51,   "Glucose Feature" },
412     { 0x2A52,   "Record Access Control Point" },
413     { 0x2A53,   "RSC Measurement" },
414     { 0x2A54,   "RSC Feature" },
415     { 0x2A55,   "SC Control Point" },
416     { 0x2A56,   "Digital" },    /* Not adopted, 0.9 now (6th June 2015) */
417     { 0x2A58,   "Analog" },     /* Not adopted, 0.9 now (6th June 2015) */
418     { 0x2A5A,   "Aggregate" },  /* Not adopted, 0.9 now (6th June 2015) */
419     { 0x2A5B,   "CSC Measurement" },
420     { 0x2A5C,   "CSC Feature" },
421     { 0x2A5D,   "Sensor Location" },
422     { 0x2A63,   "Cycling Power Measurement" },
423     { 0x2A64,   "Cycling Power Vector" },
424     { 0x2A65,   "Cycling Power Feature" },
425     { 0x2A66,   "Cycling Power Control Point" },
426     { 0x2A67,   "Location and Speed" },
427     { 0x2A68,   "Navigation" },
428     { 0x2A69,   "Position Quality" },
429     { 0x2A6A,   "LN Feature" },
430     { 0x2A6B,   "LN Control Point" },
431     { 0x2A6C,   "Elevation" },
432     { 0x2A6D,   "Pressure" },
433     { 0x2A6E,   "Temperature" },
434     { 0x2A6F,   "Humidity" },
435     { 0x2A70,   "True Wind Speed" },
436     { 0x2A71,   "True Wind Direction" },
437     { 0x2A72,   "Apparent Wind Speed" },
438     { 0x2A73,   "Apparent Wind Direction" },
439     { 0x2A74,   "Gust Factor" },
440     { 0x2A75,   "Pollen Concentration" },
441     { 0x2A76,   "UV Index" },
442     { 0x2A77,   "Irradiance" },
443     { 0x2A78,   "Rainfall" },
444     { 0x2A79,   "Wind Chill" },
445     { 0x2A7A,   "Heat Index" },
446     { 0x2A7B,   "Dew Point" },
447     { 0x2A7D,   "Descriptor Value Changed" },
448     { 0x2A7E,   "Aerobic Heart Rate Lower Limit" },
449     { 0x2A7F,   "Aerobic Threshold" },
450     { 0x2A80,   "Age" },
451     { 0x2A81,   "Anaerobic Heart Rate Lower Limit" },
452     { 0x2A82,   "Anaerobic Heart Rate Upper Limit" },
453     { 0x2A83,   "Anaerobic Threshold" },
454     { 0x2A84,   "Aerobic Heart Rate Upper Limit" },
455     { 0x2A85,   "Date of Birth" },
456     { 0x2A86,   "Date of Threshold Assessment" },
457     { 0x2A87,   "Email Address" },
458     { 0x2A88,   "Fat Burn Heart Rate Lower Limit" },
459     { 0x2A89,   "Fat Burn Heart Rate Upper Limit" },
460     { 0x2A8A,   "First Name" },
461     { 0x2A8B,   "Five Zone Heart Rate Limits" },
462     { 0x2A8C,   "Gender" },
463     { 0x2A8D,   "Heart Rate Max" },
464     { 0x2A8E,   "Height" },
465     { 0x2A8F,   "Hip Circumference" },
466     { 0x2A90,   "Last Name" },
467     { 0x2A91,   "Maximum Recommended Heart Rate" },
468     { 0x2A92,   "Resting Heart Rate" },
469     { 0x2A93,   "Sport Type for Aerobic and Anaerobic Thresholds" },
470     { 0x2A94,   "Three Zone Heart Rate Limits" },
471     { 0x2A95,   "Two Zone Heart Rate Limit" },
472     { 0x2A96,   "VO2 Max" },
473     { 0x2A97,   "Waist Circumference" },
474     { 0x2A98,   "Weight" },
475     { 0x2A99,   "Database Change Increment" },
476     { 0x2A9A,   "User Index" },
477     { 0x2A9B,   "Body Composition Feature" },
478     { 0x2A9C,   "Body Composition Measurement" },
479     { 0x2A9D,   "Weight Measurement" },
480     { 0x2A9E,   "Weight Scale Feature" },
481     { 0x2A9F,   "User Control Point" },
482     { 0x2AA0,   "Magnetic Flux Density - 2D" },
483     { 0x2AA1,   "Magnetic Flux Density - 3D" },
484     { 0x2AA2,   "Language" },
485     { 0x2AA3,   "Barometric Pressure Trend" },
486     { 0x2AA4,   "Bond Management Control Point" },
487     { 0x2AA5,   "Bond Management Feature" },
488     { 0x2AA6,   "Central Address Resolution" },
489     { 0x2AA7,   "CGM Measurement" },
490     { 0x2AA8,   "CGM Feature" },
491     { 0x2AA9,   "CGM Status" },
492     { 0x2AAA,   "CGM Session Start Time" },
493     { 0x2AAB,   "CGM Session Run Time" },
494     { 0x2AAC,   "CGM Specific Ops Control Point" },
495     { 0x2AAD,   "Indoor Positioning Configuration" },
496     { 0x2AAE,   "Latitude" },
497     { 0x2AAF,   "Longitude" },
498     { 0x2AB0,   "Local North Coordinate" },
499     { 0x2AB1,   "Local East Coordinate" },
500     { 0x2AB2,   "Floor Number" },
501     { 0x2AB3,   "Altitude" },
502     { 0x2AB4,   "Uncertainty" },
503     { 0x2AB5,   "Location Name" },
504     { 0x2AB6,   "URI" },
505     { 0x2AB7,   "HTTP Headers" },
506     { 0x2AB8,   "HTTP Status Code" },
507     { 0x2AB9,   "HTTP Entity Body" },
508     { 0x2ABA,   "HTTP Control Point" },
509     { 0x2ABB,   "HTTPS Security" },
510     /*  16-bit UUID for Members - https://www.bluetooth.org/en-us/Pages/LoginRestrictedAll/16-bit-UUIDs-member.aspx */
511     { 0xFE83,   "Blue Bite" },
512     { 0xFE84,   "RF Digital Corp" },
513     { 0xFE85,   "RF Digital Corp" },
514     { 0xFE86,   "HUAWEI Technologies Co., Ltd." },
515     { 0xFE87,   "Qingdao Yeelink Information Technology Co., Ltd." },
516     { 0xFE88,   "SALTO SYSTEMS S.L." },
517     { 0xFE89,   "B&O Play A/S" },
518     { 0xFE8A,   "Apple, Inc." },
519     { 0xFE8B,   "Apple, Inc." },
520     { 0xFE8C,   "TRON Forum" },
521     { 0xFE8D,   "Interaxon Inc." },
522     { 0xFE8E,   "ARM Ltd" },
523     { 0xFE8F,   "CSR" },
524     { 0xFE90,   "JUMA" },
525     { 0xFE91,   "Shanghai Imilab Technology Co.,Ltd" },
526     { 0xFE92,   "Jarden Safety & Security" },
527     { 0xFE93,   "OttoQ Inc." },
528     { 0xFE94,   "OttoQ Inc." },
529     { 0xFE95,   " Xiaomi Inc." },
530     { 0xFE96,   "Tesla Motor Inc." },
531     { 0xFE97,   "Tesla Motor Inc." },
532     { 0xFE98,   "Currant, Inc." },
533     { 0xFE99,   "Currant, Inc." },
534     { 0xFE9A,   " Estimote" },
535     { 0xFE9B,   "Samsara Networks, Inc" },
536     { 0xFE9C,   "GSI Laboratories, Inc." },
537     { 0xFE9D,   "Mobiquity Networks Inc" },
538     { 0xFE9E,   "Dialog Semiconductor B.V." },
539     { 0xFE9F,   "Google" },
540     { 0xFEA0,   "Google" },
541     { 0xFEA1,   "Intrepid Control Systems, Inc." },
542     { 0xFEA2,   "Intrepid Control Systems, Inc." },
543     { 0xFEA3,   "ITT Industries" },
544     { 0xFEA4,   "Paxton Access Ltd" },
545     { 0xFEA5,   "GoPro, Inc." },
546     { 0xFEA6,   "GoPro, Inc." },
547     { 0xFEA7,   "UTC Fire and Security" },
548     { 0xFEA8,   "Savant Systems LLC" },
549     { 0xFEA9,   "Savant Systems LLC" },
550     { 0xFEAA,   "Google" },
551     { 0xFEAB,   "Nokia Corporation" },
552     { 0xFEAC,   "Nokia Corporation" },
553     { 0xFEAD,   "Nokia Corporation" },
554     { 0xFEAE,   "Nokia Corporation" },
555     { 0xFEAF,   "Nest Labs Inc." },
556     { 0xFEB0,   "Nest Labs Inc." },
557     { 0xFEB1,   "Electronics Tomorrow Limited" },
558     { 0xFEB2,   "Microsoft Corporation" },
559     { 0xFEB3,   "Taobao" },
560     { 0xFEB4,   "WiSilica Inc." },
561     { 0xFEB5,   "WiSilica Inc." },
562     { 0xFEB6,   "Vencer Co, Ltd" },
563     { 0xFEB7,   "Facebook, Inc." },
564     { 0xFEB8,   "Facebook, Inc." },
565     { 0xFEB9,   "LG Electronics" },
566     { 0xFEBA,   "Tencent Holdings Limited" },
567     { 0xFEBB,   "adafruit industries" },
568     { 0xFEBC,   "Dexcom, Inc." },
569     { 0xFEBD,   "Clover Network, Inc." },
570     { 0xFEBE,   "Bose Corporation" },
571     { 0xFEBF,   "Nod, Inc." },
572     { 0xFEC0,   "KDDI Corporation" },
573     { 0xFEC1,   "KDDI Corporation" },
574     { 0xFEC2,   "Blue Spark Technologies, Inc." },
575     { 0xFEC3,   "360fly, Inc." },
576     { 0xFEC4,   "PLUS Location Systems" },
577     { 0xFEC5,   "Realtek Semiconductor Corp." },
578     { 0xFEC6,   "Kocomojo, LLC" },
579     { 0xFEC7,   "Apple, Inc." },
580     { 0xFEC8,   "Apple, Inc." },
581     { 0xFEC9,   "Apple, Inc." },
582     { 0xFECA,   "Apple, Inc." },
583     { 0xFECB,   "Apple, Inc." },
584     { 0xFECC,   "Apple, Inc." },
585     { 0xFECD,   "Apple, Inc." },
586     { 0xFECE,   "Apple, Inc." },
587     { 0xFECF,   "Apple, Inc." },
588     { 0xFED0,   "Apple, Inc." },
589     { 0xFED1,   "Apple, Inc." },
590     { 0xFED2,   "Apple, Inc." },
591     { 0xFED3,   "Apple, Inc." },
592     { 0xFED4,   "Apple, Inc." },
593     { 0xFED5,   "Plantronics Inc." },
594     { 0xFED6,   "Broadcom Corporation" },
595     { 0xFED7,   "Broadcom Corporation" },
596     { 0xFED8,   "Google" },
597     { 0xFED9,   "Pebble Technology Corporation" },
598     { 0xFEDA,   "ISSC Technologies Corporation" },
599     { 0xFEDB,   "Perka, Inc." },
600     { 0xFEDC,   "Jawbone" },
601     { 0xFEDD,   "Jawbone" },
602     { 0xFEDE,   "Coin, Inc." },
603     { 0xFEDF,   "Design SHIFT" },
604     { 0xFEE0,   "Anhui Huami Information Technology Co." },
605     { 0xFEE1,   "Anhui Huami Information Technology Co." },
606     { 0xFEE2,   "Anki, Inc." },
607     { 0xFEE3,   "Anki, Inc." },
608     { 0xFEE4,   "Nordic Semiconductor ASA" },
609     { 0xFEE5,   "Nordic Semiconductor ASA" },
610     { 0xFEE6,   "Seed Labs, Inc." },
611     { 0xFEE7,   "Tencent Holdings Limited" },
612     { 0xFEE8,   "Quintic Corp." },
613     { 0xFEE9,   "Quintic Corp." },
614     { 0xFEEA,   "Swirl Networks, Inc." },
615     { 0xFEEB,   "Swirl Networks, Inc." },
616     { 0xFEEC,   "Tile, Inc." },
617     { 0xFEED,   "Tile, Inc." },
618     { 0xFEEE,   "Polar Electro Oy" },
619     { 0xFEEF,   "Polar Electro Oy" },
620     { 0xFEF0,   "Intel" },
621     { 0xFEF1,   "CSR" },
622     { 0xFEF2,   "CSR" },
623     { 0xFEF3,   "Google" },
624     { 0xFEF4,   "Google" },
625     { 0xFEF5,   "Dialog Semiconductor GmbH" },
626     { 0xFEF6,   "Wicentric, Inc." },
627     { 0xFEF7,   "Aplix Corporation" },
628     { 0xFEF8,   "Aplix Corporation" },
629     { 0xFEF9,   "PayPal, Inc." },
630     { 0xFEFA,   "PayPal, Inc." },
631     { 0xFEFB,   "Stollmann E+V GmbH" },
632     { 0xFEFC,   "Gimbal, Inc." },
633     { 0xFEFD,   "Gimbal, Inc." },
634     { 0xFEFE,   "GN ReSound A/S" },
635     { 0xFEFF,   "GN Netcom" },
636
637     /* SDO Uuids - https://www.bluetooth.org/en-us/specification/assigned-numbers/sdo-16-bit-uuids */
638     { 0xFFFD,   "Fast IDentity Online Alliance - Universal Second Factor Authenticator Service" },
639     { 0xFFFE,   "Alliance for Wireless Power - Wireless Power Transfer Service" },
640     { 0, NULL }
641 };
642 value_string_ext bluetooth_uuid_vals_ext = VALUE_STRING_EXT_INIT(bluetooth_uuid_vals);
643
644 /* Taken from https://www.bluetooth.org/technical/assignednumbers/identifiers.htm */
645 static const value_string bluetooth_company_id_vals[] = {
646     {0x0000, "Ericsson Technology Licensing"},
647     {0x0001, "Nokia Mobile Phones"},
648     {0x0002, "Intel Corp."},
649     {0x0003, "IBM Corp."},
650     {0x0004, "Toshiba Corp."},
651     {0x0005, "3Com"},
652     {0x0006, "Microsoft"},
653     {0x0007, "Lucent"},
654     {0x0008, "Motorola"},
655     {0x0009, "Infineon Technologies AG"},
656     {0x000A, "Cambridge Silicon Radio"},
657     {0x000B, "Silicon Wave"},
658     {0x000C, "Digianswer A/S"},
659     {0x000D, "Texas Instruments Inc."},
660     {0x000E, "Ceva, Inc. (formerly Parthus Technologies, Inc.)"},
661     {0x000F, "Broadcom Corporation"},
662     {0x0010, "Mitel Semiconductor"},
663     {0x0011, "Widcomm, Inc"},
664     {0x0012, "Zeevo, Inc."},
665     {0x0013, "Atmel Corporation"},
666     {0x0014, "Mitsubishi Electric Corporation"},
667     {0x0015, "RTX Telecom A/S"},
668     {0x0016, "KC Technology Inc."},
669     {0x0017, "NewLogic"},
670     {0x0018, "Transilica, Inc."},
671     {0x0019, "Rohde & Schwarz GmbH & Co. KG"},
672     {0x001A, "TTPCom Limited"},
673     {0x001B, "Signia Technologies, Inc."},
674     {0x001C, "Conexant Systems Inc."},
675     {0x001D, "Qualcomm"},
676     {0x001E, "Inventel"},
677     {0x001F, "AVM Berlin"},
678     {0x0020, "BandSpeed, Inc."},
679     {0x0021, "Mansella Ltd"},
680     {0x0022, "NEC Corporation"},
681     {0x0023, "WavePlus Technology Co., Ltd."},
682     {0x0024, "Alcatel"},
683     {0x0025, "NXP Semiconductors (formerly Philips Semiconductors)"},
684     {0x0026, "C Technologies"},
685     {0x0027, "Open Interface"},
686     {0x0028, "R F Micro Devices"},
687     {0x0029, "Hitachi Ltd"},
688     {0x002A, "Symbol Technologies, Inc."},
689     {0x002B, "Tenovis"},
690     {0x002C, "Macronix International Co. Ltd."},
691     {0x002D, "GCT Semiconductor"},
692     {0x002E, "Norwood Systems"},
693     {0x002F, "MewTel Technology Inc."},
694     {0x0030, "ST Microelectronics"},
695     {0x0031, "Synopsis"},
696     {0x0032, "Red-M (Communications) Ltd"},
697     {0x0033, "Commil Ltd"},
698     {0x0034, "Computer Access Technology Corporation (CATC)"},
699     {0x0035, "Eclipse (HQ Espana) S.L."},
700     {0x0036, "Renesas Electronics Corporation"},
701     {0x0037, "Mobilian Corporation"},
702     {0x0038, "Terax"},
703     {0x0039, "Integrated System Solution Corp."},
704     {0x003A, "Matsushita Electric Industrial Co., Ltd."},
705     {0x003B, "Gennum Corporation"},
706     {0x003C, "BlackBerry Limited (formerly Research In Motion)"},
707     {0x003D, "IPextreme, Inc."},
708     {0x003E, "Systems and Chips, Inc."},
709     {0x003F, "Bluetooth SIG, Inc."},
710     {0x0040, "Seiko Epson Corporation"},
711     {0x0041, "Integrated Silicon Solution Taiwan, Inc."},
712     {0x0042, "CONWISE Technology Corporation Ltd"},
713     {0x0043, "PARROT SA"},
714     {0x0044, "Socket Mobile"},
715     {0x0045, "Atheros Communications, Inc."},
716     {0x0046, "MediaTek, Inc."},
717     {0x0047, "Bluegiga"},
718     {0x0048, "Marvell Technology Group Ltd."},
719     {0x0049, "3DSP Corporation"},
720     {0x004A, "Accel Semiconductor Ltd."},
721     {0x004B, "Continental Automotive Systems"},
722     {0x004C, "Apple, Inc."},
723     {0x004D, "Staccato Communications, Inc."},
724     {0x004E, "Avago Technologies"},
725     {0x004F, "APT Licensing Ltd."},
726     {0x0050, "SiRF Technology"},
727     {0x0051, "Tzero Technologies, Inc."},
728     {0x0052, "J&M Corporation"},
729     {0x0053, "Free2move AB"},
730     {0x0054, "3DiJoy Corporation"},
731     {0x0055, "Plantronics, Inc."},
732     {0x0056, "Sony Ericsson Mobile Communications"},
733     {0x0057, "Harman International Industries, Inc."},
734     {0x0058, "Vizio, Inc."},
735     {0x0059, "Nordic Semiconductor ASA"},
736     {0x005A, "EM Microelectronic-Marin SA"},
737     {0x005B, "Ralink Technology Corporation"},
738     {0x005C, "Belkin International, Inc."},
739     {0x005D, "Realtek Semiconductor Corporation"},
740     {0x005E, "Stonestreet One, LLC"},
741     {0x005F, "Wicentric, Inc."},
742     {0x0060, "RivieraWaves S.A.S"},
743     {0x0061, "RDA Microelectronics"},
744     {0x0062, "Gibson Guitars"},
745     {0x0063, "MiCommand Inc."},
746     {0x0064, "Band XI International, LLC"},
747     {0x0065, "Hewlett-Packard Company"},
748     {0x0066, "9Solutions Oy"},
749     {0x0067, "GN Netcom A/S"},
750     {0x0068, "General Motors"},
751     {0x0069, "A&D Engineering, Inc."},
752     {0x006A, "MindTree Ltd."},
753     {0x006B, "Polar Electro OY"},
754     {0x006C, "Beautiful Enterprise Co., Ltd."},
755     {0x006D, "BriarTek, Inc."},
756     {0x006E, "Summit Data Communications, Inc."},
757     {0x006F, "Sound ID"},
758     {0x0070, "Monster, LLC"},
759     {0x0071, "connectBlue AB"},
760     {0x0072, "ShangHai Super Smart Electronics Co. Ltd."},
761     {0x0073, "Group Sense Ltd."},
762     {0x0074, "Zomm, LLC"},
763     {0x0075, "Samsung Electronics Co. Ltd."},
764     {0x0076, "Creative Technology Ltd."},
765     {0x0077, "Laird Technologies"},
766     {0x0078, "Nike, Inc."},
767     {0x0079, "lesswire AG"},
768     {0x007A, "MStar Semiconductor, Inc."},
769     {0x007B, "Hanlynn Technologies"},
770     {0x007C, "A & R Cambridge"},
771     {0x007D, "Seers Technology Co. Ltd"},
772     {0x007E, "Sports Tracking Technologies Ltd."},
773     {0x007F, "Autonet Mobile"},
774     {0x0080, "DeLorme Publishing Company, Inc."},
775     {0x0081, "WuXi Vimicro"},
776     {0x0082, "Sennheiser Communications A/S"},
777     {0x0083, "TimeKeeping Systems, Inc."},
778     {0x0084, "Ludus Helsinki Ltd."},
779     {0x0085, "BlueRadios, Inc."},
780     {0x0086, "equinox AG"},
781     {0x0087, "Garmin International, Inc."},
782     {0x0088, "Ecotest"},
783     {0x0089, "GN ReSound A/S"},
784     {0x008A, "Jawbone"},
785     {0x008B, "Topcorn Positioning Systems, LLC"},
786     {0x008C, "Gimbal Inc. (formerly Qualcomm Labs, Inc. and Qualcomm Retail Solutions, Inc.)"},
787     {0x008D, "Zscan Software"},
788     {0x008E, "Quintic Corp."},
789     {0x008F, "Stollman E+V GmbH"},
790     {0x0090, "Funai Electric Co., Ltd."},
791     {0x0091, "Advanced PANMOBIL Systems GmbH & Co. KG"},
792     {0x0092, "ThinkOptics, Inc."},
793     {0x0093, "Universal Electronics, Inc."},
794     {0x0094, "Airoha Technology Corp."},
795     {0x0095, "NEC Lighting, Ltd."},
796     {0x0096, "ODM Technology, Inc."},
797     {0x0097, "ConnecteDevice Ltd."},
798     {0x0098, "zer01.tv GmbH"},
799     {0x0099, "i.Tech Dynamic Global Distribution Ltd."},
800     {0x009A, "Alpwise"},
801     {0x009B, "Jiangsu Toppower Automotive Electronics Co., Ltd."},
802     {0x009C, "Colorfy, Inc."},
803     {0x009D, "Geoforce Inc."},
804     {0x009E, "Bose Corporation"},
805     {0x009F, "Suunto Oy"},
806     {0x00A0, "Kensington Computer Products Group"},
807     {0x00A1, "SR-Medizinelektronik"},
808     {0x00A2, "Vertu Corporation Limited"},
809     {0x00A3, "Meta Watch Ltd."},
810     {0x00A4, "LINAK A/S"},
811     {0x00A5, "OTL Dynamics LLC"},
812     {0x00A6, "Panda Ocean Inc."},
813     {0x00A7, "Visteon Corporation"},
814     {0x00A8, "ARP Devices Limited"},
815     {0x00A9, "Magneti Marelli S.p.A"},
816     {0x00AA, "CAEN RFID srl"},
817     {0x00AB, "Ingenieur-Systemgruppe Zahn GmbH"},
818     {0x00AC, "Green Throttle Games"},
819     {0x00AD, "Peter Systemtechnik GmbH"},
820     {0x00AE, "Omegawave Oy"},
821     {0x00AF, "Cinetix"},
822     {0x00B0, "Passif Semiconductor Corp"},
823     {0x00B1, "Saris Cycling Group, Inc"},
824     {0x00B2, "Bekey A/S"},
825     {0x00B3, "Clarinox Technologies Pty. Ltd."},
826     {0x00B4, "BDE Technology Co., Ltd."},
827     {0x00B5, "Swirl Networks"},
828     {0x00B6, "Meso international"},
829     {0x00B7, "TreLab Ltd"},
830     {0x00B8, "Qualcomm Innovation Center, Inc. (QuIC)"},
831     {0x00B9, "Johnson Controls, Inc."},
832     {0x00BA, "Starkey Laboratories Inc."},
833     {0x00BB, "S-Power Electronics Limited"},
834     {0x00BC, "Ace Sensor Inc"},
835     {0x00BD, "Aplix Corporation"},
836     {0x00BE, "AAMP of America"},
837     {0x00BF, "Stalmart Technology Limited"},
838     {0x00C0, "AMICCOM Electronics Corporation"},
839     {0x00C1, "Shenzhen Excelsecu Data Technology Co.,Ltd"},
840     {0x00C2, "Geneq Inc."},
841     {0x00C3, "adidas AG"},
842     {0x00C4, "LG Electronics"},
843     {0x00C5, "Onset Computer Corporation"},
844     {0x00C6, "Selfly BV"},
845     {0x00C7, "Quuppa Oy."},
846     {0x00C8, "GeLo Inc"},
847     {0x00C9, "Evluma"},
848     {0x00CA, "MC10"},
849     {0x00CB, "Binauric SE"},
850     {0x00CC, "Beats Electronics"},
851     {0x00CD, "Microchip Technology Inc."},
852     {0x00CE, "Elgato Systems GmbH"},
853     {0x00CF, "ARCHOS SA"},
854     {0x00D0, "Dexcom, Inc."},
855     {0x00D1, "Polar Electro Europe B.V."},
856     {0x00D2, "Dialog Semiconductor B.V."},
857     {0x00D3, "Taixingbang Technology (HK) Co,. LTD."},
858     {0x00D4, "Kawantech"},
859     {0x00D5, "Austco Communication Systems"},
860     {0x00D6, "Timex Group USA, Inc."},
861     {0x00D7, "Qualcomm Technologies, Inc."},
862     {0x00D8, "Qualcomm Connected Experiences, Inc."},
863     {0x00D9, "Voyetra Turtle Beach"},
864     {0x00DA, "txtr GmbH"},
865     {0x00DB, "Biosentronics"},
866     {0x00DC, "Procter & Gamble"},
867     {0x00DD, "Hosiden Corporation"},
868     {0x00DE, "Muzik LLC"},
869     {0x00DF, "Misfit Wearables Corp"},
870     {0x00E0, "Google"},
871     {0x00E1, "Danlers Ltd"},
872     {0x00E2, "Semilink Inc"},
873     {0x00E3, "inMusic Brands, Inc"},
874     {0x00E4, "L.S. Research Inc."},
875     {0x00E5, "Eden Software Consultants Ltd."},
876     {0x00E6, "Freshtemp"},
877     {0x00E7, "KS Technologies"},
878     {0x00E8, "ACTS Technologies"},
879     {0x00E9, "Vtrack Systems"},
880     {0x00EA, "Nielsen-Kellerman Company"},
881     {0x00EB, "Server Technology, Inc."},
882     {0x00EC, "BioResearch Associates"},
883     {0x00ED, "Jolly Logic, LLC"},
884     {0x00EE, "Above Average Outcomes, Inc."},
885     {0x00EF, "Bitsplitters GmbH"},
886     {0x00F0, "PayPal, Inc."},
887     {0x00F1, "Witron Technology Limited"},
888     {0x00F2, "Aether Things Inc. (formerly Morse Project Inc.)"},
889     {0x00F3, "Kent Displays Inc."},
890     {0x00F4, "Nautilus Inc."},
891     {0x00F5, "Smartifier Oy"},
892     {0x00F6, "Elcometer Limited"},
893     {0x00F7, "VSN Technologies Inc."},
894     {0x00F8, "AceUni Corp., Ltd."},
895     {0x00F9, "StickNFind"},
896     {0x00FA, "Crystal Code AB"},
897     {0x00FB, "KOUKAAM a.s."},
898     {0x00FC, "Delphi Corporation"},
899     {0x00FD, "ValenceTech Limited"},
900     {0x00FE, "Reserved"},
901     {0x00FF, "Typo Products, LLC"},
902     {0x0100, "TomTom International BV"},
903     {0x0101, "Fugoo, Inc"},
904     {0x0102, "Keiser Corporation"},
905     {0x0103, "Bang & Olufsen A/S"},
906     {0x0104, "PLUS Locations Systems Pty Ltd"},
907     {0x0105, "Ubiquitous Computing Technology Corporation"},
908     {0x0106, "Innovative Yachtter Solutions"},
909     {0x0107, "William Demant Holding A/S"},
910     {0x0108, "Chicony Electronics Co., Ltd."},
911     {0x0109, "Atus BV"},
912     {0x010A, "Codegate Ltd."},
913     {0x010B, "ERi, Inc."},
914     {0x010C, "Transducers Direct, LLC"},
915     {0x010D, "Fujitsu Ten Limited"},
916     {0x010E, "Audi AG"},
917     {0x010F, "HiSilicon Technologies Co., Ltd."},
918     {0x0110, "Nippon Seiki Co., Ltd."},
919     {0x0111, "Steelseries ApS"},
920     {0x0112, "Visybl Inc."},
921     {0x0113, "Openbrain Technologies, Co., Ltd."},
922     {0x0114, "Xensr"},
923     {0x0115, "e.solutions"},
924     {0x0116, "1OAK Technologies"},
925     {0x0117, "Wimoto Technologies Inc"},
926     {0x0118, "Radius Networks, Inc."},
927     {0x0119, "Wize Technology Co., Ltd."},
928     {0x011A, "Qualcomm Labs, Inc."},
929     {0x011B, "Aruba Networks"},
930     {0x011C, "Baidu"},
931     {0x011D, "Arendi AG"},
932     {0x011E, "Skoda Auto a.s."},
933     {0x011F, "Volkswagon AG"},
934     {0x0120, "Porsche AG"},
935     {0x0121, "Sino Wealth Electronic Ltd."},
936     {0x0122, "AirTurn, Inc."},
937     {0x0123, "Kinsa, Inc."},
938     {0x0124, "HID Global"},
939     {0x0125, "SEAT es"},
940     {0x0126, "Promethean Ltd."},
941     {0x0127, "Salutica Allied Solutions"},
942     {0x0128, "GPSI Group Pty Ltd"},
943     {0x0129, "Nimble Devices Oy"},
944     {0x012A, "Changzhou Yongse Infotech Co., Ltd"},
945     {0x012B, "SportIQ"},
946     {0x012C, "TEMEC Instruments B.V."},
947     {0x012D, "Sony Corporation"},
948     {0x012E, "ASSA ABLOY"},
949     {0x012F, "Clarion Co., Ltd."},
950     {0x0130, "Warehouse Innovations"},
951     {0x0131, "Cypress Semiconductor Corporation"},
952     {0x0132, "MADS Inc"},
953     {0x0133, "Blue Maestro Limited"},
954     {0x0134, "Resolution Products, Inc."},
955     {0x0135, "Airewear LLC"},
956     {0x0136, "Seed Labs, Inc. (formerly ETC sp. z.o.o.)"},
957     {0x0137, "Prestigio Plaza Ltd."},
958     {0x0138, "NTEO Inc."},
959     {0x0139, "Focus Systems Corporation"},
960     {0x013A, "Tencent Holdings Limited"},
961     {0x013B, "Allegion"},
962     {0x013C, "Murata Manufacuring Co., Ltd."},
963     {0x013E, "Nod, Inc."},
964     {0x013F, "B&B Manufacturing Company"},
965     {0x0140, "Alpine Electronics (China) Co., Ltd"},
966     {0x0141, "FedEx Services"},
967     {0x0142, "Grape Systems Inc."},
968     {0x0143, "Bkon Connect"},
969     {0x0144, "Lintech GmbH"},
970     {0x0145, "Novatel Wireless"},
971     {0x0146, "Ciright"},
972     {0x0147, "Mighty Cast, Inc."},
973     {0x0148, "Ambimat Electronics"},
974     {0x0149, "Perytons Ltd."},
975     {0x014A, "Tivoli Audio, LLC"},
976     {0x014B, "Master Lock"},
977     {0x014C, "Mesh-Net Ltd"},
978     {0x014D, "Huizhou Desay SV Automotive CO., LTD."},
979     {0x014E, "Tangerine, Inc."},
980     {0x014F, "B&W Group Ltd."},
981     {0x0150, "Pioneer Corporation"},
982     {0x0151, "OnBeep"},
983     {0x0152, "Vernier Software & Technology"},
984     {0x0153, "ROL Ergo"},
985     {0x0154, "Pebble Technology"},
986     {0x0155, "NETATMO"},
987     {0x0156, "Accumulate AB"},
988     {0x0157, "Anhui Huami Information Technology Co., Ltd."},
989     {0x0158, "Inmite s.r.o."},
990     {0x0159, "ChefSteps, Inc."},
991     {0x015A, "micas AG"},
992     {0x015B, "Biomedical Research Ltd."},
993     {0x015C, "Pitius Tec S.L."},
994     {0x015D, "Estimote, Inc."},
995     {0x015E, "Unikey Technologies, Inc."},
996     {0x015F, "Timer Cap Co."},
997     {0x0160, "AwoX"},
998     {0x0161, "yikes"},
999     {0x0162, "MADSGlobal NZ Ltd."},
1000     {0x0163, "PCH International"},
1001     {0x0164, "Qingdao Yeelink Information Technology Co., Ltd."},
1002     {0x0165, "Milwaukee Tool (formerly Milwaukee Electric Tools)"},
1003     {0x0166, "MISHIK Pte Ltd"},
1004     {0x0167, "Bayer HealthCare"},
1005     {0x0168, "Spicebox LLC"},
1006     {0x0169, "emberlight"},
1007     {0x016A, "Cooper-Atkins Corporation"},
1008     {0x016B, "Qblinks"},
1009     {0x016C, "MYSPHERA"},
1010     {0x016D, "LifeScan Inc"},
1011     {0x016E, "Volantic AB"},
1012     {0x016F, "Podo Labs, Inc"},
1013     {0x0170, "Roche Diabetes Care AG"},
1014     {0x0171, "Amazon Fulfillment Service"},
1015     {0x0172, "Connovate Technology Private Limited"},
1016     {0x0173, "Kocomojo, LLC"},
1017     {0x0174, "Everykey LLC"},
1018     {0x0175, "Dynamic Controls"},
1019     {0x0176, "SentriLock"},
1020     {0x0177, "I-SYST inc."},
1021     {0x0178, "CASIO COMPUTER CO., LTD."},
1022     {0x0179, "LAPIS Semiconductor Co., Ltd."},
1023     {0x017A, "Telemonitor, Inc."},
1024     {0x017B, "taskit GmbH"},
1025     {0x017C, "Daimler AG"},
1026     {0x017D, "BatAndCat"},
1027     {0x017E, "BluDotz Ltd"},
1028     {0x017F, "XTel ApS"},
1029     {0x0180, "Gigaset Communications GmbH"},
1030     {0x0181, "Gecko Health Innovations, Inc."},
1031     {0x0182, "HOP Ubiquitous"},
1032     {0x0183, "To Be Assigned"},
1033     {0x0184, "Nectar"},
1034     {0x0185, "bel'apps LLC"},
1035     {0x0186, "CORE Lighting Ltd"},
1036     {0x0187, "Seraphim Sense Ltd"},
1037     {0x0188, "Unico RBC"},
1038     {0x0189, "Physical Enterprises Inc."},
1039     {0x018A, "Able Trend Technology Limited"},
1040     {0x018B, "Konica Minolta, Inc."},
1041     {0x018C, "Wilo SE"},
1042     {0x018D, "Extron Design Services"},
1043     {0x018E, "Fitbit, Inc."},
1044     {0x018F, "Fireflies Systems"},
1045     {0x0190, "Intelletto Technologies Inc."},
1046     {0x0191, "FDK CORPORATION"},
1047     {0x0192, "Cloudleaf, Inc"},
1048     {0x0193, "Maveric Automation LLC"},
1049     {0x0194, "Acoustic Stream Corporation"},
1050     {0x0195, "Zuli"},
1051     {0x0196, "Paxton Access Ltd"},
1052     {0x0197, "WiSilica Inc"},
1053     {0x0198, "Vengit Limited"},
1054     {0x0199, "SALTO SYSTEMS S.L."},
1055     {0x019A, "TRON Forum (formerly T-Engine Forum)"},
1056     {0x019B, "CUBETECH s.r.o."},
1057     {0x019C, "Cokiya Incorporated"},
1058     {0x019D, "CVS Health"},
1059     {0x019E, "Ceruus"},
1060     {0x019F, "Strainstall Ltd"},
1061     {0x01A0, "Channel Enterprises (HK) Ltd."},
1062     {0x01A1, "FIAMM"},
1063     {0x01A2, "GIGALANE.CO.,LTD"},
1064     {0x01A3, "EROAD"},
1065     {0x01A4, "Mine Safety Appliances"},
1066     {0x01A5, "Icon Health and Fitness"},
1067     {0x01A6, "Asandoo GmbH"},
1068     {0x01A7, "ENERGOUS CORPORATION"},
1069     {0x01A8, "Taobao"},
1070     {0x01A9, "Canon Inc."},
1071     {0x01AA, "Geophysical Technology Inc."},
1072     {0x01AB, "Facebook, Inc."},
1073     {0x01AC, "Nipro Diagnostics, Inc."},
1074     {0x01AD, "FlightSafety International"},
1075     {0x01AE, "Earlens Corporation"},
1076     {0x01AF, "Sunrise Micro Devices, Inc."},
1077     {0x01B0, "Star Micronics Co., Ltd."},
1078     {0x01B1, "Netizens Sp. z o.o."},
1079     {0x01B2, "Nymi Inc."},
1080     {0x01B3, "Nytec, Inc."},
1081     {0x01B4, "Trineo Sp. z o.o."},
1082     {0x01B5, "Nest Labs Inc."},
1083     {0x01B6, "LM Technologies Ltd"},
1084     {0x01B7, "General Electric Company"},
1085     {0x01B8, "iD3 S.L."},
1086     {0x01B9, "HANA Micron"},
1087     {0x01BA, "Stages Cycling LLC"},
1088     {0x01BB, "Cochlear Bone Anchored Solutions AB"},
1089     {0x01BC, "SenionLab AB"},
1090     {0x01BD, "Syszone Co., Ltd"},
1091     {0x01BE, "Pulsate Mobile Ltd."},
1092     {0x01BF, "Hong Kong HunterSun Electronic Limited"},
1093     {0x01C0, "pironex GmbH"},
1094     {0x01C1, "BRADATECH Corp."},
1095     {0x01C2, "Transenergooil AG"},
1096     {0x01C3, "Bunch"},
1097     {0x01C4, "DME Microelectronics"},
1098     {0x01C5, "Bitcraze AB"},
1099     {0x01C6, "HASWARE Inc."},
1100     {0x01C7, "Abiogenix Inc."},
1101     {0x01C8, "Poly-Control ApS"},
1102     {0x01C9, "Avi-on"},
1103     {0x01CA, "Laerdal Medical AS"},
1104     {0x01CB, "Fetch My Pet"},
1105     {0x01CC, "Sam Labs Ltd."},
1106     {0x01CD, "Chengdu Synwing Technology Ltd"},
1107     {0x01CE, "HOUWA SYSTEM DESIGN, k.k."},
1108     {0x01CF, "BSH"},
1109     {0x01D0, "Primus Inter Pares Ltd"},
1110     {0x01D1, "August"},
1111     {0x01D2, "Gill Electronics"},
1112     {0x01D3, "Sky Wave Design"},
1113     {0x01D4, "Newlab S.r.l."},
1114     {0x01D5, "ELAD srl"},
1115     {0x01D6, "G-wearables inc."},
1116     {0x01D7, "Squadrone Systems Inc."},
1117     {0x01D8, "Code Corporation"},
1118     {0x01D9, "Savant Systems LLC"},
1119     {0x01DA, "Logitech International SA"},
1120     {0x01DB, "Innblue Consulting"},
1121     {0x01DC, "iParking Ltd."},
1122     {0x01DD, "Koninklijke Philips Electronics N.V."},
1123     {0x01DE, "Minelab Electronics Pty Limited"},
1124     {0x01DF, "Bison Group Ltd."},
1125     {0x01E0, "Widex A/S"},
1126     {0x01E1, "Jolla Ltd"},
1127     {0x01E2, "Lectronix, Inc."},
1128     {0x01E3, "Caterpillar Inc"},
1129     {0x01E4, "Freedom Innovations"},
1130     {0x01E5, "Dynamic Devices Ltd"},
1131     {0x01E6, "Technology Solutions (UK) Ltd"},
1132     {0x01E7, "IPS Group Inc."},
1133     {0x01E8, "STIR"},
1134     {0x01E9, "Sano, Inc"},
1135     {0x01EA, "Advanced Application Design, Inc."},
1136     {0x01EB, "AutoMap LLC"},
1137     {0x01EC, "Spreadtrum Communications Shanghai Ltd"},
1138     {0x01ED, "CuteCircuit LTD"},
1139     {0x01EE, "Valeo Service"},
1140     {0x01EF, "Fullpower Technologies, Inc."},
1141     {0x01F0, "KloudNation"},
1142     {0x01F1, "Zebra Technologies Corporation"},
1143     {0x01F2, "Itron, Inc."},
1144     {0x01F3, "The University of Tokyo"},
1145     {0x01F4, "UTC Fire and Security"},
1146     {0x01F5, "Cool Webthings Limited"},
1147     {0x01F6, "DJO Global"},
1148     {0x01F7, "Gelliner Limited"},
1149     {0x01F8, "Anyka (Guangzhou) Microelectronics Technology Co, LTD"},
1150     {0x01F9, "Medtronic, Inc."},
1151     {0x01FA, "Gozio, Inc."},
1152     {0x01FB, "Form Lifting, LLC"},
1153     {0x01FC, "Wahoo Fitness, LLC"},
1154     {0x01FD, "Kontakt Micro-Location Sp. z o.o."},
1155     {0x01FE, "Radio System Corporation"},
1156     {0x01FF, "Freescale Semiconductor, Inc."},
1157     {0x0200, "Verifone Systems PTe Ltd. Taiwan Branch"},
1158     {0x0201, "AR Timing"},
1159     {0x0202, "Rigado LLC"},
1160     {0x0203, "Kemppi Oy"},
1161     {0x0204, "Tapcentive Inc."},
1162     {0x0205, "Smartbotics Inc."},
1163     {0x0206, "Otter Products, LLC"},
1164     {0x0207, "STEMP Inc."},
1165     {0x0208, "LumiGeek LLC"},
1166     {0x0209, "InvisionHeart Inc."},
1167     {0x020A, "Macnica Inc. "},
1168     {0x020B, "Jaguar Land Rover Limited"},
1169     {0x020C, "CoroWare Technologies, Inc"},
1170     {0x020D, "Simplo Technology Co., LTD"},
1171     {0x020E, "Omron Healthcare Co., LTD"},
1172     {0x020F, "Comodule GMBH"},
1173     {0x0210, "ikeGPS"},
1174     {0x0211, "Telink Semiconductor Co. Ltd"},
1175     {0x0212, "Interplan Co., Ltd"},
1176     {0x0213, "Wyler AG"},
1177     {0x0214, "IK Multimedia Production srl"},
1178     {0x0215, "Lukoton Experience Oy"},
1179     {0x0216, "MTI Ltd"},
1180     {0x0217, "Tech4home, Lda"},
1181     {0x0218, "Hiotech AB"},
1182     {0x0219, "DOTT Limited"},
1183     {0x021A, "Blue Speck Labs, LLC"},
1184     {0x021B, "Cisco Systems Inc"},
1185     {0x021C, "Mobicomm Inc"},
1186     {0x021D, "Edamic"},
1187     {0x021E, "Goodnet Ltd"},
1188     {0x021F, "Luster Leaf Products Inc"},
1189     {0x0220, "Manus Machina BV"},
1190     {0x0221, "Mobiquity Networks Inc"},
1191     {0x0222, "Praxis Dynamics"},
1192     {0x0223, "Philip Morris Products S.A."},
1193     {0x0224, "Comarch SA"},
1194     {0x0225, "Nestl Nespresso S.A."},
1195     {0x0226, "Merlinia A/S"},
1196     {0x0227, "LifeBEAM Technologies"},
1197     {0x0228, "Twocanoes Labs, LLC"},
1198     {0x0229, "Muoverti Limited"},
1199     {0X022A, "Stamer Musikanlagen GMBH"},
1200     {0x022B, "Tesla Motors"},
1201     {0x022C, "Pharynks Corporation"},
1202     {0x022D, "Lupine"},
1203     {0x022E, "Siemens AG"},
1204     {0x022F, "Huami (Shanghai) Culture Communication CO., LTD"},
1205     {0x0230, "Foster Electric Company, Ltd"},
1206     {0x0231, "ETA SA"},
1207     {0x0232, "x-Senso Solutions Kft"},
1208     {0x0233, "Shenzhen SuLong Communication Ltd"},
1209     {0x0234, "FengFan (BeiJing) Technology Co, Ltd"},
1210     {0x0235, "Qrio Inc"},
1211     {0x0236, "Pitpatpet Ltd"},
1212     {0x0237, "MSHeli s.r.l."},
1213     {0x0238, "Trakm8 Ltd"},
1214     {0x0239, "JIN CO, Ltd"},
1215     {0x023A, "Alatech Technology"},
1216     {0x023B, "Beijing CarePulse Electronic Technology Co, Ltd"},
1217     {0x023C, "Awarepoint"},
1218     {0x023D, "ViCentra B.V."},
1219     {0x023E, "Raven Industries"},
1220     {0x023F, "WaveWare Technologies"},
1221     {0x0240, "Argenox Technologies"},
1222     {0x0241, "Bragi GmbH"},
1223     {0x0242, "16Lab Inc"},
1224     {0x0243, "Masimo Corp"},
1225     {0x0244, "Iotera Inc."},
1226     {0x0245, "EndressHauser"},
1227     {0x0246, "ACKme Networks, Inc."},
1228     {0x0247, "FiftyThree Inc."},
1229     {0x0248, "Parker Hannifin Corp"},
1230     {0x0249, "Transcranial Ltd"},
1231     {0x024A, "Uwatec AG"},
1232     {0x024B, "Orlan LLC"},
1233     {0x024C, "Blue Clover Devices"},
1234     {0x024D, "M-Way Solutions GmbH"},
1235     {0x024E, "Microtronics Engineering GmbH"},
1236     {0x024F, "Schneider Schreibgerte GmbH"},
1237     {0x0250, "Sapphire Circuits LLC"},
1238     {0x0251, "Lumo Bodytech Inc."},
1239     {0x0252, "UKC Technosolution"},
1240     {0x0253, "Xicato Inc."},
1241     {0x0254, "Playbrush"},
1242     {0x0255, "Dai Nippon Printing Co., Ltd."},
1243     {0x0256, "G24 Power Limited"},
1244     {0x0257, "AdBabble Local Commerce Inc."},
1245     {0x0258, "Devialet SA"},
1246     {0x0259, "ALTYOR"},
1247     {0x025A, "University of Applied Sciences Valais/Haute Ecole Valaisanne"},
1248     {0x025B, "Five Interactive, LLC dba Zendo"},
1249     {0x025C, "NetEase (Hangzhou) Network co.Ltd."},
1250     {0x025D, "Lexmark International Inc."},
1251     {0x025E, "Fluke Corporation"},
1252     {0x025F, "Yardarm Technologies"},
1253     {0x0260, "SensaRx"},
1254     {0x0261, "SECVRE GmbH"},
1255     {0x0262, "Glacial Ridge Technologies"},
1256     {0x0263, "Identiv, Inc."},
1257     {0x0264, "DDS, Inc."},
1258     {0x0265, "SMK Corporation"},
1259     {0x0266, "Schawbel Technologies LLC"},
1260     {0x0267, "XMI Systems SA"},
1261     {0x0268, "Cerevo"},
1262     {0x0269, "Torrox GmbH & Co KG"},
1263     {0x026A, "Gemalto"},
1264     {0x026B, "DEKA Research & Development Corp."},
1265     {0x026C, "Domster Tadeusz Szydlowski"},
1266     {0x026D, "Technogym SPA"},
1267     {0x026E, "FLEURBAEY BVBA"},
1268     {0x026F, "Aptcode Solutions"},
1269     {0x0270, "LSI ADL Technology"},
1270     {0x0271, "Animas Corp"},
1271     {0x0272, "Alps Electric Co., Ltd."},
1272     {0x0273, "OCEASOFT"},
1273     {0x0274, "Motsai Research"},
1274     {0x0275, "Geotab"},
1275     {0x0276, "E.G.O. Elektro-Gertebau GmbH"},
1276     {0x0277, "bewhere inc"},
1277     {0x0278, "Johnson Outdoors Inc"},
1278     {0x0279, "steute Schaltgerate GmbH & Co. KG"},
1279     {0x027A, "Ekomini inc."},
1280     {0x027B, "DEFA AS"},
1281     {0x027C, "Aseptika Ltd"},
1282     {0x027D, "HUAWEI Technologies Co., Ltd."},
1283     {0x027E, "HabitAware, LLC"},
1284     {0x027F, "ruwido austria gmbh"},
1285     {0x0280, "ITEC corporation"},
1286     {0x0281, "StoneL"},
1287     {0x0282, "Sonova AG"},
1288     {0x0283, "Maven Machines, Inc."},
1289     {0x0284, "Synapse Electronics"},
1290     {0x0285, "Standard Innovation Inc."},
1291     {0x0286, "RF Code, Inc."},
1292     {0x0287, "Wally Ventures S.L."},
1293     {0x0288, "Willowbank Electronics Ltd"},
1294     {0x0289, "SK Telecom"},
1295     {0x028A, "Jetro AS"},
1296     {0x028B, "Code Gears LTD"},
1297     {0x028C, "NANOLINK APS"},
1298     {0x028D, "IF, LLC"},
1299     {0x028E, "RF Digital Corp"},
1300     {0x028F, "Church & Dwight Co., Inc"},
1301     {0x0290, "Multibit Oy"},
1302     {0x0291, "CliniCloud Inc"},
1303     {0x0292, "SwiftSensors"},
1304     {0x0293, "Blue Bite"},
1305     {0x0294, "ELIAS GmbH"},
1306     {0x0295, "Sivantos GmbH"},
1307     {0x0296, "Petzl"},
1308     {0x0297, "storm power ltd"},
1309     {0x0298, "EISST Ltd"},
1310     {0x0299, "Inexess Technology Simma KG"},
1311     {0x029A, "Currant, Inc."},
1312     {0x029B, "C2 Development, Inc."},
1313     {0x029C, "Blue Sky Scientific, LLC"},
1314     {0x029D, "ALOTTAZS LABS, LLC"},
1315     {0x029E, "Kupson spol. s r.o."},
1316     {0x029F, "Areus Engineering GmbH"},
1317     {0x02A0, "Impossible Camera GmbH"},
1318     {0x02A1, "InventureTrack Systems"},
1319     {0x02A2, "LockedUp"},
1320     {0x02A3, "Itude"},
1321     {0x02A4, "Pacific Lock Company"},
1322     {0x02A5, "Tendyron Corporation"},
1323     {0xFFFF, "For use in internal and interoperability tests."},
1324     {0, NULL }
1325 };
1326 value_string_ext bluetooth_company_id_vals_ext = VALUE_STRING_EXT_INIT(bluetooth_company_id_vals);
1327
1328 const value_string bluetooth_address_type_vals[] = {
1329     { 0x00,  "Public" },
1330     { 0x01,  "Random" },
1331     { 0, NULL }
1332 };
1333
1334 guint32 max_disconnect_in_frame = G_MAXUINT32;
1335
1336
1337 void proto_register_bluetooth(void);
1338 void proto_reg_handoff_bluetooth(void);
1339
1340 static void bluetooth_uuid_prompt(packet_info *pinfo, gchar* result)
1341 {
1342     gchar *value_data;
1343
1344     value_data = (gchar *) p_get_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID);
1345     if (value_data)
1346         g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "BT Service UUID %s as", (gchar *) value_data);
1347     else
1348         g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Unknown BT Service UUID");
1349 }
1350
1351 static gpointer bluetooth_uuid_value(packet_info *pinfo)
1352 {
1353     gchar *value_data;
1354
1355     value_data = (gchar *) p_get_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID);
1356
1357     if (value_data)
1358         return (gpointer) value_data;
1359
1360     return NULL;
1361 }
1362
1363 gint
1364 dissect_bd_addr(gint hf_bd_addr, packet_info *pinfo, proto_tree *tree,
1365         tvbuff_t *tvb, gint offset, gboolean is_local_bd_addr,
1366         guint32 interface_id, guint32 adapter_id, guint8 *bdaddr)
1367 {
1368     guint8 bd_addr[6];
1369
1370     bd_addr[5] = tvb_get_guint8(tvb, offset);
1371     bd_addr[4] = tvb_get_guint8(tvb, offset + 1);
1372     bd_addr[3] = tvb_get_guint8(tvb, offset + 2);
1373     bd_addr[2] = tvb_get_guint8(tvb, offset + 3);
1374     bd_addr[1] = tvb_get_guint8(tvb, offset + 4);
1375     bd_addr[0] = tvb_get_guint8(tvb, offset + 5);
1376
1377     proto_tree_add_ether(tree, hf_bd_addr, tvb, offset, 6, bd_addr);
1378     offset += 6;
1379
1380     if (have_tap_listener(bluetooth_device_tap)) {
1381         bluetooth_device_tap_t  *tap_device;
1382
1383         tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
1384         tap_device->interface_id = interface_id;
1385         tap_device->adapter_id   = adapter_id;
1386         memcpy(tap_device->bd_addr, bd_addr, 6);
1387         tap_device->has_bd_addr = TRUE;
1388         tap_device->is_local = is_local_bd_addr;
1389         tap_device->type = BLUETOOTH_DEVICE_BD_ADDR;
1390         tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
1391     }
1392
1393     if (bdaddr)
1394         memcpy(bdaddr, bd_addr, 6);
1395
1396     return offset;
1397 }
1398
1399
1400 void
1401 save_local_device_name_from_eir_ad(tvbuff_t *tvb, gint offset, packet_info *pinfo,
1402         guint8 size, bluetooth_data_t *bluetooth_data)
1403 {
1404     gint                    i = 0;
1405     guint8                  length;
1406     wmem_tree_key_t         key[4];
1407     guint32                 k_interface_id;
1408     guint32                 k_adapter_id;
1409     guint32                 k_frame_number;
1410     gchar                   *name;
1411     localhost_name_entry_t  *localhost_name_entry;
1412
1413     if (!(!pinfo->fd->flags.visited && bluetooth_data)) return;
1414
1415     while (i < size) {
1416         length = tvb_get_guint8(tvb, offset + i);
1417         if (length == 0) break;
1418
1419         switch(tvb_get_guint8(tvb, offset + i + 1)) {
1420         case 0x08: /* Device Name, shortened */
1421         case 0x09: /* Device Name, full */
1422             name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + i + 2, length - 1, ENC_ASCII);
1423
1424             k_interface_id = bluetooth_data->interface_id;
1425             k_adapter_id = bluetooth_data->adapter_id;
1426             k_frame_number = pinfo->fd->num;
1427
1428             key[0].length = 1;
1429             key[0].key    = &k_interface_id;
1430             key[1].length = 1;
1431             key[1].key    = &k_adapter_id;
1432             key[2].length = 1;
1433             key[2].key    = &k_frame_number;
1434             key[3].length = 0;
1435             key[3].key    = NULL;
1436
1437             localhost_name_entry = (localhost_name_entry_t *) wmem_new(wmem_file_scope(), localhost_name_entry_t);
1438             localhost_name_entry->interface_id = k_interface_id;
1439             localhost_name_entry->adapter_id = k_adapter_id;
1440             localhost_name_entry->name = wmem_strdup(wmem_file_scope(), name);
1441
1442             wmem_tree_insert32_array(bluetooth_data->localhost_name, key, localhost_name_entry);
1443
1444             break;
1445         }
1446
1447         i += length + 1;
1448     }
1449 }
1450
1451
1452 static const char* bluetooth_conv_get_filter_type(conv_item_t* conv _U_, conv_filter_type_e filter)
1453 {
1454     if (filter == CONV_FT_SRC_ADDRESS)
1455         return "bluetooth.src";
1456
1457     if (filter == CONV_FT_DST_ADDRESS)
1458         return "bluetooth.dst";
1459
1460     if (filter == CONV_FT_ANY_ADDRESS)
1461         return "bluetooth.addr";
1462
1463     return CONV_FILTER_INVALID;
1464 }
1465
1466 static ct_dissector_info_t bluetooth_ct_dissector_info = {&bluetooth_conv_get_filter_type};
1467
1468
1469 static const char* bluetooth_get_filter_type(hostlist_talker_t* host _U_, conv_filter_type_e filter)
1470 {
1471     if (filter == CONV_FT_ANY_ADDRESS)
1472         return "bluetooth.addr";
1473
1474     return CONV_FILTER_INVALID;
1475 }
1476
1477 static hostlist_dissector_info_t  bluetooth_dissector_info = {&bluetooth_get_filter_type};
1478
1479
1480 static int
1481 bluetooth_conversation_packet(void *pct, packet_info *pinfo,
1482         epan_dissect_t *edt _U_, const void *vip _U_)
1483 {
1484     conv_hash_t *hash = (conv_hash_t*) pct;
1485     add_conversation_table_data(hash, &pinfo->dl_src, &pinfo->dl_dst, 0, 0, 1,
1486             pinfo->fd->pkt_len, &pinfo->rel_ts, &pinfo->fd->abs_ts,
1487             &bluetooth_ct_dissector_info, PT_NONE);
1488
1489     return 1;
1490 }
1491
1492
1493 static int
1494 bluetooth_hostlist_packet(void *pit, packet_info *pinfo,
1495         epan_dissect_t *edt _U_, const void *vip _U_)
1496 {
1497     conv_hash_t *hash = (conv_hash_t*) pit;
1498
1499     add_hostlist_table_data(hash, &pinfo->dl_src, 0, TRUE,  1, pinfo->fd->pkt_len, &bluetooth_dissector_info, PT_NONE);
1500     add_hostlist_table_data(hash, &pinfo->dl_dst, 0, FALSE, 1, pinfo->fd->pkt_len, &bluetooth_dissector_info, PT_NONE);
1501
1502     return 1;
1503 }
1504
1505 static conversation_t *
1506 get_conversation(packet_info *pinfo,
1507                      address *src_addr, address *dst_addr,
1508                      guint32 src_endpoint, guint32 dst_endpoint)
1509 {
1510     conversation_t *conversation;
1511
1512     conversation = find_conversation(pinfo->fd->num,
1513                                src_addr, dst_addr,
1514                                pinfo->ptype,
1515                                src_endpoint, dst_endpoint, 0);
1516     if (conversation) {
1517         return conversation;
1518     }
1519
1520     conversation = conversation_new(pinfo->fd->num,
1521                            src_addr, dst_addr,
1522                            pinfo->ptype,
1523                            src_endpoint, dst_endpoint, 0);
1524     return conversation;
1525 }
1526
1527 bluetooth_uuid_t
1528 get_uuid(tvbuff_t *tvb, gint offset, gint size)
1529 {
1530     bluetooth_uuid_t  uuid;
1531
1532     memset(&uuid, 0, sizeof(uuid));
1533
1534     if (size != 2 && size != 16) {
1535         return uuid;
1536     }
1537
1538     uuid.size = size;
1539     if (size == 2) {
1540         uuid.data[0] = tvb_get_guint8(tvb, offset + 1);
1541         uuid.data[1] = tvb_get_guint8(tvb, offset);
1542     } else if (size == 16) {
1543         uuid.data[0] = tvb_get_guint8(tvb, offset + 15);
1544         uuid.data[1] = tvb_get_guint8(tvb, offset + 14);
1545         uuid.data[2] = tvb_get_guint8(tvb, offset + 13);
1546         uuid.data[3] = tvb_get_guint8(tvb, offset + 12);
1547         uuid.data[4] = tvb_get_guint8(tvb, offset + 11);
1548         uuid.data[5] = tvb_get_guint8(tvb, offset + 10);
1549         uuid.data[6] = tvb_get_guint8(tvb, offset + 9);
1550         uuid.data[7] = tvb_get_guint8(tvb, offset + 8);
1551         uuid.data[8] = tvb_get_guint8(tvb, offset + 7);
1552         uuid.data[9] = tvb_get_guint8(tvb, offset + 6);
1553         uuid.data[10] = tvb_get_guint8(tvb, offset + 5);
1554         uuid.data[11] = tvb_get_guint8(tvb, offset + 4);
1555         uuid.data[12] = tvb_get_guint8(tvb, offset + 3);
1556         uuid.data[13] = tvb_get_guint8(tvb, offset + 2);
1557         uuid.data[14] = tvb_get_guint8(tvb, offset + 1);
1558         uuid.data[15] = tvb_get_guint8(tvb, offset);
1559     }
1560
1561     if (size == 2) {
1562         uuid.bt_uuid = uuid.data[1] | uuid.data[0] << 8;
1563     } else {
1564         if (uuid.data[0] == 0x00 && uuid.data[1] == 0x00 &&
1565                 uuid.data[4]  == 0x00 && uuid.data[5]  == 0x00 && uuid.data[6]  == 0x10 &&
1566                 uuid.data[7]  == 0x00 && uuid.data[8]  == 0x80 && uuid.data[9]  == 0x00 &&
1567                 uuid.data[10] == 0x00 && uuid.data[11] == 0x80 && uuid.data[12] == 0x5F &&
1568                 uuid.data[13] == 0x9B && uuid.data[14] == 0x34 && uuid.data[15] == 0xFB)
1569         uuid.bt_uuid = uuid.data[2] | uuid.data[3] << 8;
1570     }
1571
1572     return uuid;
1573 }
1574
1575 const gchar *
1576 print_numeric_uuid(bluetooth_uuid_t *uuid)
1577 {
1578     if (!(uuid && uuid->size > 0))
1579         return NULL;
1580
1581     if (uuid->size != 16) {
1582         return bytes_to_str(wmem_packet_scope(), uuid->data, uuid->size);
1583     } else {
1584         gchar *text;
1585
1586         text = (gchar *) wmem_alloc(wmem_packet_scope(), 38);
1587         bytes_to_hexstr(&text[0], uuid->data, 4);
1588         text[8] = '-';
1589         bytes_to_hexstr(&text[9], uuid->data + 4, 2);
1590         text[13] = '-';
1591         bytes_to_hexstr(&text[14], uuid->data + 4 + 2 * 1, 2);
1592         text[18] = '-';
1593         bytes_to_hexstr(&text[19], uuid->data + 4 + 2 * 2, 2);
1594         text[23] = '-';
1595         bytes_to_hexstr(&text[24], uuid->data + 4 + 2 * 3, 6);
1596         text[36] = '\0';
1597
1598         return text;
1599     }
1600
1601     return NULL;
1602 }
1603
1604 const gchar *
1605 print_uuid(bluetooth_uuid_t *uuid)
1606 {
1607     const gchar *description;
1608
1609     if (uuid->bt_uuid) {
1610         const gchar *name;
1611
1612         /*
1613          * Known UUID?
1614          */
1615         name = try_val_to_str_ext(uuid->bt_uuid, &bluetooth_uuid_vals_ext);
1616         if (name != NULL) {
1617             /*
1618              * Yes.  This string is part of the value_string_ext table,
1619              * so we don't have to make a copy.
1620              */
1621             return name;
1622         }
1623
1624         /*
1625          * No - fall through to try looking it up.
1626          */
1627     }
1628
1629     description = print_numeric_uuid(uuid);
1630
1631     if (description) {
1632         description = (const gchar *) wmem_tree_lookup_string(bluetooth_uuids, description, 0);
1633         if (description)
1634             return description;
1635     }
1636
1637     return "Unknown";
1638 }
1639
1640 static bluetooth_data_t *
1641 dissect_bluetooth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1642 {
1643     proto_item        *main_item;
1644     proto_tree        *main_tree;
1645     proto_item        *sub_item;
1646     bluetooth_data_t  *bluetooth_data;
1647     address           *src;
1648     address           *dst;
1649
1650     col_set_str(pinfo->cinfo, COL_PROTOCOL, "Bluetooth");
1651     switch (pinfo->p2p_dir) {
1652
1653     case P2P_DIR_SENT:
1654         col_add_fstr(pinfo->cinfo, COL_INFO, "Sent ");
1655         break;
1656
1657     case P2P_DIR_RECV:
1658         col_add_fstr(pinfo->cinfo, COL_INFO, "Rcvd ");
1659         break;
1660
1661     default:
1662         col_set_str(pinfo->cinfo, COL_INFO, "UnknownDirection ");
1663         break;
1664     }
1665
1666     pinfo->ptype = PT_BLUETOOTH;
1667     get_conversation(pinfo, &pinfo->dl_src, &pinfo->dl_dst, pinfo->srcport, pinfo->destport);
1668
1669     main_item = proto_tree_add_item(tree, proto_bluetooth, tvb, 0, tvb_captured_length(tvb), ENC_NA);
1670     main_tree = proto_item_add_subtree(main_item, ett_bluetooth);
1671
1672     bluetooth_data = (bluetooth_data_t *) wmem_new(wmem_packet_scope(), bluetooth_data_t);
1673     if (pinfo->phdr->presence_flags & WTAP_HAS_INTERFACE_ID)
1674         bluetooth_data->interface_id = pinfo->phdr->interface_id;
1675     else
1676         bluetooth_data->interface_id = HCI_INTERFACE_DEFAULT;
1677     bluetooth_data->adapter_id = HCI_ADAPTER_DEFAULT;
1678     bluetooth_data->adapter_disconnect_in_frame  = &max_disconnect_in_frame;
1679     bluetooth_data->chandle_sessions             = chandle_sessions;
1680     bluetooth_data->chandle_to_bdaddr            = chandle_to_bdaddr;
1681     bluetooth_data->chandle_to_mode              = chandle_to_mode;
1682     bluetooth_data->bdaddr_to_name               = bdaddr_to_name;
1683     bluetooth_data->bdaddr_to_role               = bdaddr_to_role;
1684     bluetooth_data->localhost_bdaddr             = localhost_bdaddr;
1685     bluetooth_data->localhost_name               = localhost_name;
1686     bluetooth_data->hci_vendors                  = hci_vendors;
1687
1688     if (have_tap_listener(bluetooth_tap)) {
1689         bluetooth_tap_data_t  *bluetooth_tap_data;
1690
1691         bluetooth_tap_data                = wmem_new(wmem_packet_scope(), bluetooth_tap_data_t);
1692         bluetooth_tap_data->interface_id  = bluetooth_data->interface_id;
1693         bluetooth_tap_data->adapter_id    = bluetooth_data->adapter_id;
1694
1695         tap_queue_packet(bluetooth_tap, pinfo, bluetooth_tap_data);
1696     }
1697
1698     src = (address *) p_get_proto_data(wmem_file_scope(), pinfo, proto_bluetooth, BLUETOOTH_DATA_SRC);
1699     dst = (address *) p_get_proto_data(wmem_file_scope(), pinfo, proto_bluetooth, BLUETOOTH_DATA_DST);
1700
1701     if (src && src->type == AT_STRINGZ) {
1702         sub_item = proto_tree_add_string(main_tree, hf_bluetooth_str_addr, tvb, 0, 0, (const char *) src->data);
1703         PROTO_ITEM_SET_HIDDEN(sub_item);
1704
1705         sub_item = proto_tree_add_string(main_tree, hf_bluetooth_str_src, tvb, 0, 0, (const char *) src->data);
1706         PROTO_ITEM_SET_GENERATED(sub_item);
1707     } else if (src && src->type == AT_ETHER) {
1708         sub_item = proto_tree_add_ether(main_tree, hf_bluetooth_addr, tvb, 0, 0, (const guint8 *) src->data);
1709         PROTO_ITEM_SET_HIDDEN(sub_item);
1710
1711         sub_item = proto_tree_add_ether(main_tree, hf_bluetooth_src, tvb, 0, 0, (const guint8 *) src->data);
1712         PROTO_ITEM_SET_GENERATED(sub_item);
1713     }
1714
1715     if (dst && dst->type == AT_STRINGZ) {
1716         sub_item = proto_tree_add_string(main_tree, hf_bluetooth_str_addr, tvb, 0, 0, (const char *) dst->data);
1717         PROTO_ITEM_SET_HIDDEN(sub_item);
1718
1719         sub_item = proto_tree_add_string(main_tree, hf_bluetooth_str_dst, tvb, 0, 0, (const char *) dst->data);
1720         PROTO_ITEM_SET_GENERATED(sub_item);
1721     } else if (dst && dst->type == AT_ETHER) {
1722         sub_item = proto_tree_add_ether(main_tree, hf_bluetooth_addr, tvb, 0, 0, (const guint8 *) dst->data);
1723         PROTO_ITEM_SET_HIDDEN(sub_item);
1724
1725         sub_item = proto_tree_add_ether(main_tree, hf_bluetooth_dst, tvb, 0, 0, (const guint8 *) dst->data);
1726         PROTO_ITEM_SET_GENERATED(sub_item);
1727     }
1728
1729     return bluetooth_data;
1730 }
1731
1732 /*
1733  * Register this in the wtap_encap dissector table.
1734  */
1735 static gint
1736 dissect_bluetooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1737 {
1738     bluetooth_data_t  *bluetooth_data;
1739
1740     bluetooth_data = dissect_bluetooth_common(tvb, pinfo, tree);
1741
1742     /*
1743      * There is no pseudo-header, or there's just a p2p pseudo-header.
1744      */
1745     bluetooth_data->previous_protocol_data_type = BT_PD_NONE;
1746     bluetooth_data->previous_protocol_data.none = NULL;
1747
1748     if (!dissector_try_uint_new(bluetooth_table, pinfo->phdr->pkt_encap, tvb, pinfo, tree, TRUE, bluetooth_data)) {
1749         call_dissector(data_handle, tvb, pinfo, tree);
1750     }
1751
1752     return tvb_captured_length(tvb);
1753 }
1754
1755
1756 /*
1757  * Register this in the wtap_encap dissector table.
1758  */
1759 static gint
1760 dissect_bluetooth_bthci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1761 {
1762     bluetooth_data_t  *bluetooth_data;
1763
1764     bluetooth_data = dissect_bluetooth_common(tvb, pinfo, tree);
1765
1766     /*
1767      * data points to a struct bthci_phdr.
1768      */
1769     bluetooth_data->previous_protocol_data_type = BT_PD_BTHCI;
1770     bluetooth_data->previous_protocol_data.bthci = (struct bthci_phdr *)data;
1771
1772     if (!dissector_try_uint_new(bluetooth_table, pinfo->phdr->pkt_encap, tvb, pinfo, tree, TRUE, bluetooth_data)) {
1773         call_dissector(data_handle, tvb, pinfo, tree);
1774     }
1775
1776     return tvb_captured_length(tvb);
1777 }
1778
1779 /*
1780  * Register this in the wtap_encap dissector table.
1781  */
1782 static gint
1783 dissect_bluetooth_btmon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1784 {
1785     bluetooth_data_t  *bluetooth_data;
1786
1787     bluetooth_data = dissect_bluetooth_common(tvb, pinfo, tree);
1788
1789     /*
1790      * data points to a struct btmon_phdr.
1791      */
1792     bluetooth_data->previous_protocol_data_type = BT_PD_BTMON;
1793     bluetooth_data->previous_protocol_data.btmon = (struct btmon_phdr *)data;
1794
1795     if (!dissector_try_uint_new(bluetooth_table, pinfo->phdr->pkt_encap, tvb, pinfo, tree, TRUE, bluetooth_data)) {
1796         call_dissector(data_handle, tvb, pinfo, tree);
1797     }
1798
1799     return tvb_captured_length(tvb);
1800 }
1801
1802 /*
1803  * Register this in various USB dissector tables.
1804  */
1805 static gint
1806 dissect_bluetooth_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
1807 {
1808     bluetooth_data_t  *bluetooth_data;
1809
1810     bluetooth_data = dissect_bluetooth_common(tvb, pinfo, tree);
1811
1812     /*
1813      * data points to a usb_conv_info_t.
1814      */
1815     bluetooth_data->previous_protocol_data_type = BT_PD_USB_CONV_INFO;
1816     bluetooth_data->previous_protocol_data.usb_conv_info = (usb_conv_info_t *)data;
1817
1818     if (!dissector_try_uint_new(bluetooth_table, pinfo->phdr->pkt_encap, tvb, pinfo, tree, TRUE, bluetooth_data)) {
1819         call_dissector(data_handle, tvb, pinfo, tree);
1820     }
1821
1822     return tvb_captured_length(tvb);
1823 }
1824
1825 /*
1826  * Register this by name; it's called from the Ubertooth dissector.
1827  */
1828 static gint
1829 dissect_bluetooth_ubertooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
1830 {
1831     bluetooth_data_t  *bluetooth_data;
1832
1833     bluetooth_data = dissect_bluetooth_common(tvb, pinfo, tree);
1834
1835     /*
1836      * data points to a ubertooth_data_t.
1837      */
1838     bluetooth_data->previous_protocol_data_type = BT_PD_UBERTOOTH_DATA;
1839     bluetooth_data->previous_protocol_data.ubertooth_data = (ubertooth_data_t *)data;
1840
1841     call_dissector(btle_handle, tvb, pinfo, tree);
1842
1843     return tvb_captured_length(tvb);
1844 }
1845
1846 void
1847 proto_register_bluetooth(void)
1848 {
1849     static hf_register_info hf[] = {
1850         { &hf_bluetooth_src,
1851             { "Source",                              "bluetooth.src",
1852             FT_ETHER, BASE_NONE, NULL, 0x0,
1853             NULL, HFILL }
1854         },
1855         { &hf_bluetooth_dst,
1856             { "Destination",                         "bluetooth.dst",
1857             FT_ETHER, BASE_NONE, NULL, 0x0,
1858             NULL, HFILL }
1859         },
1860         { &hf_bluetooth_addr,
1861             { "Source or Destination",               "bluetooth.addr",
1862             FT_ETHER, BASE_NONE, NULL, 0x0,
1863             NULL, HFILL }
1864         },
1865         { &hf_bluetooth_str_src,
1866             { "Source",                              "bluetooth.src",
1867             FT_STRING, STR_ASCII, NULL, 0x0,
1868             NULL, HFILL }
1869         },
1870         { &hf_bluetooth_str_dst,
1871             { "Destination",                         "bluetooth.dst",
1872             FT_STRING, STR_ASCII, NULL, 0x0,
1873             NULL, HFILL }
1874         },
1875         { &hf_bluetooth_str_addr,
1876             { "Source or Destination",               "bluetooth.addr",
1877             FT_STRING, STR_ASCII, NULL, 0x0,
1878             NULL, HFILL }
1879         },
1880     };
1881
1882     static gint *ett[] = {
1883         &ett_bluetooth,
1884     };
1885
1886     /* Decode As handling */
1887     static build_valid_func bluetooth_uuid_da_build_value[1] = {bluetooth_uuid_value};
1888     static decode_as_value_t bluetooth_uuid_da_values = {bluetooth_uuid_prompt, 1, bluetooth_uuid_da_build_value};
1889     static decode_as_t bluetooth_uuid_da = {"bluetooth", "BT Service UUID", "bluetooth.uuid", 1, 0, &bluetooth_uuid_da_values, NULL, NULL,
1890             decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL};
1891
1892
1893     proto_bluetooth = proto_register_protocol("Bluetooth",
1894             "Bluetooth", "bluetooth");
1895
1896     register_dissector("bluetooth_ubertooth", dissect_bluetooth_ubertooth, proto_bluetooth);
1897
1898     proto_register_field_array(proto_bluetooth, hf, array_length(hf));
1899     proto_register_subtree_array(ett, array_length(ett));
1900
1901     bluetooth_table = register_dissector_table("bluetooth.encap",
1902             "Bluetooth Encapsulation", FT_UINT32, BASE_HEX, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE);
1903
1904     chandle_sessions         = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
1905     chandle_to_bdaddr        = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
1906     chandle_to_mode          = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
1907     bdaddr_to_name           = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
1908     bdaddr_to_role           = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
1909     localhost_bdaddr         = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
1910     localhost_name           = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
1911     hci_vendors              = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
1912
1913     hci_vendor_table = register_dissector_table("bluetooth.vendor", "HCI Vendor", FT_UINT16, BASE_HEX, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE);
1914     bluetooth_uuids          = wmem_tree_new(wmem_epan_scope());
1915
1916     bluetooth_tap = register_tap("bluetooth");
1917     bluetooth_device_tap = register_tap("bluetooth.device");
1918     bluetooth_hci_summary_tap = register_tap("bluetooth.hci_summary");
1919
1920     bluetooth_uuid_table = register_dissector_table("bluetooth.uuid", "BT Service UUID", FT_STRING, BASE_NONE, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE);
1921
1922     register_conversation_table(proto_bluetooth, TRUE, bluetooth_conversation_packet, bluetooth_hostlist_packet);
1923
1924     register_decode_as(&bluetooth_uuid_da);
1925 }
1926
1927 void
1928 proto_reg_handoff_bluetooth(void)
1929 {
1930     dissector_handle_t bluetooth_handle = create_dissector_handle(dissect_bluetooth, proto_bluetooth);
1931     dissector_handle_t bluetooth_bthci_handle = create_dissector_handle(dissect_bluetooth_bthci, proto_bluetooth);
1932     dissector_handle_t bluetooth_btmon_handle = create_dissector_handle(dissect_bluetooth_btmon, proto_bluetooth);
1933     dissector_handle_t bluetooth_usb_handle = create_dissector_handle(dissect_bluetooth_usb, proto_bluetooth);
1934
1935     btle_handle = find_dissector("btle");
1936     data_handle = find_dissector("data");
1937
1938     dissector_add_uint("wtap_encap", WTAP_ENCAP_BLUETOOTH_HCI,           bluetooth_bthci_handle);
1939     dissector_add_uint("wtap_encap", WTAP_ENCAP_BLUETOOTH_H4,            bluetooth_handle);
1940     dissector_add_uint("wtap_encap", WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR,  bluetooth_handle);
1941     dissector_add_uint("wtap_encap", WTAP_ENCAP_BLUETOOTH_LINUX_MONITOR, bluetooth_btmon_handle);
1942     dissector_add_uint("wtap_encap", WTAP_ENCAP_PACKETLOGGER,            bluetooth_handle);
1943
1944     dissector_add_uint("wtap_encap", WTAP_ENCAP_BLUETOOTH_LE_LL,           bluetooth_handle);
1945     dissector_add_uint("wtap_encap", WTAP_ENCAP_BLUETOOTH_LE_LL_WITH_PHDR, bluetooth_handle);
1946     dissector_add_uint("wtap_encap", WTAP_ENCAP_BLUETOOTH_BREDR_BB,        bluetooth_handle);
1947
1948     dissector_add_uint("usb.product", (0x0a5c << 16) | 0x21e8, bluetooth_usb_handle);
1949     dissector_add_uint("usb.product", (0x1131 << 16) | 0x1001, bluetooth_usb_handle);
1950     dissector_add_uint("usb.product", (0x050d << 16) | 0x0081, bluetooth_usb_handle);
1951     dissector_add_uint("usb.product", (0x0a5c << 16) | 0x2198, bluetooth_usb_handle);
1952     dissector_add_uint("usb.product", (0x0a5c << 16) | 0x21e8, bluetooth_usb_handle);
1953     dissector_add_uint("usb.product", (0x04bf << 16) | 0x0320, bluetooth_usb_handle);
1954     dissector_add_uint("usb.product", (0x13d3 << 16) | 0x3375, bluetooth_usb_handle);
1955
1956     dissector_add_uint("usb.protocol", 0xE00101, bluetooth_usb_handle);
1957     dissector_add_uint("usb.protocol", 0xE00104, bluetooth_usb_handle);
1958
1959     dissector_add_for_decode_as("usb.device", bluetooth_usb_handle);
1960
1961     wmem_tree_insert_string(bluetooth_uuids, "00000001-0000-1000-8000-0002EE000002", (gchar *) "SyncML Server", 0);
1962     wmem_tree_insert_string(bluetooth_uuids, "00000002-0000-1000-8000-0002EE000002", (gchar *) "SyncML Client", 0);
1963 /* TODO: Add UUID128 verion of UUID16; UUID32? UUID16? */
1964 }
1965
1966 /*
1967  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
1968  *
1969  * Local variables:
1970  * c-basic-offset: 4
1971  * tab-width: 8
1972  * indent-tabs-mode: nil
1973  * End:
1974  *
1975  * vi: set shiftwidth=4 tabstop=8 expandtab:
1976  * :indentSize=4:tabSize=8:noTabs=true:
1977  */