Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-rtls.c
blobcde60399cb42151d82eb2034fef5d9eccc28107b
1 /* packet-rtls.c
2 * Routines for Real Time Location System dissection
3 * Copyright 2016, Alexis La Goutte (See Authors)
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
13 * http://community.arubanetworks.com/aruba/attachments/aruba/unified-wired-wireless-access/23715/1/RTLS_integrationv6.docx
16 #include <config.h>
18 #include <epan/packet.h>
19 #include <epan/expert.h>
21 void proto_reg_handoff_rtls(void);
22 void proto_register_rtls(void);
24 static dissector_handle_t rtls_handle;
26 static int proto_rtls;
27 static int hf_rtls_message_type;
28 static int hf_rtls_message_id;
29 static int hf_rtls_version_major;
30 static int hf_rtls_version_minor;
31 static int hf_rtls_data_length;
32 static int hf_rtls_ap_mac;
33 static int hf_rtls_padding;
34 static int hf_rtls_reserved;
35 static int hf_rtls_signature;
37 static int hf_rtls_as_tag_addr;
38 static int hf_rtls_sr_mac_address;
39 static int hf_rtls_nack_flags;
40 static int hf_rtls_nack_flags_internal_error;
41 static int hf_rtls_nack_flags_station_not_found;
42 static int hf_rtls_nack_flags_reserved;
43 static int hf_rtls_tr_bssid;
44 static int hf_rtls_tr_rssi;
45 static int hf_rtls_tr_rssi_calculated;
46 static int hf_rtls_tr_noise_floor;
47 static int hf_rtls_tr_timestamp;
48 static int hf_rtls_tr_tag_mac;
49 static int hf_rtls_tr_frame_control;
50 static int hf_rtls_tr_sequence;
51 static int hf_rtls_tr_data_rate;
52 static int hf_rtls_tr_tx_power;
53 static int hf_rtls_tr_channel;
54 static int hf_rtls_tr_battery;
55 static int hf_rtls_sr_mac;
56 static int hf_rtls_sr_noise_floor;
57 static int hf_rtls_sr_data_rate;
58 static int hf_rtls_sr_channel;
59 static int hf_rtls_sr_rssi;
60 static int hf_rtls_sr_rssi_calculated;
61 static int hf_rtls_sr_type;
62 static int hf_rtls_sr_associated;
63 static int hf_rtls_sr_radio_bssid;
64 static int hf_rtls_sr_mon_bssid;
65 static int hf_rtls_sr_age;
66 static int hf_rtls_ser_mac;
67 static int hf_rtls_ser_bssid;
68 static int hf_rtls_ser_essid;
69 static int hf_rtls_ser_channel;
70 static int hf_rtls_ser_phy_type;
71 static int hf_rtls_ser_rssi;
72 static int hf_rtls_ser_rssi_calculated;
73 static int hf_rtls_ser_duration;
74 static int hf_rtls_ser_num_packets;
75 static int hf_rtls_ser_noise_floor;
76 static int hf_rtls_ser_classification;
77 static int hf_rtls_aer_bssid;
78 static int hf_rtls_aer_essid;
79 static int hf_rtls_aer_channel;
80 static int hf_rtls_aer_phy_type;
81 static int hf_rtls_aer_rssi;
82 static int hf_rtls_aer_rssi_calculated;
83 static int hf_rtls_aer_duration;
84 static int hf_rtls_aer_num_packets;
85 static int hf_rtls_aer_noise_floor;
86 static int hf_rtls_aer_classification;
87 static int hf_rtls_aer_match_type;
88 static int hf_rtls_aer_match_method;
89 static int hf_rtls_cmr_messages;
91 static int * const rtls_nack_flags[] = {
92 &hf_rtls_nack_flags_internal_error,
93 &hf_rtls_nack_flags_station_not_found,
94 &hf_rtls_nack_flags_reserved,
95 NULL
98 static expert_field ei_rtls_undecoded;
99 static int ett_rtls;
100 static int ett_rtls_message;
101 static int ett_rtls_nack_flags;
103 #define RTLS_HDR_LENGTH 16
104 #define RTLS_SIGN_LENGTH 20
106 #define AR_AS_CONFIG_SET 0x0000
107 #define AR_STATION_REQUEST 0x0001
108 #define AR_ACK 0x0010
109 #define AR_NACK 0x0011
110 #define AR_TAG_REPORT 0x0012
111 #define AR_STATION_REPORT 0x0013
112 #define AR_COMPOUND_MESSAGE_REPORT 0x0014
113 #define AR_AP_NOTIFICATION 0x0015
114 #define AR_MMS_CONFIG_SET 0x0016
115 #define AR_STATION_EX_REPORT 0x0017
116 #define AR_AP_EX_REPORT 0x0018
118 static const value_string rtls_message_type_vals[] = {
119 { AR_AS_CONFIG_SET, "AR_AS_CONFIG_SET" },
120 { AR_STATION_REQUEST, "AR_STATION_REQUEST" },
121 { AR_ACK, "AR_ACK"},
122 { AR_NACK, "AR_NACK"},
123 { AR_TAG_REPORT, "AR_TAG_REPORT"},
124 { AR_STATION_REPORT, "AR_STATION_REPORT"},
125 { AR_COMPOUND_MESSAGE_REPORT, "AR_COMPOUND_MESSAGE_REPORT"},
126 { AR_AP_NOTIFICATION, "AR_AP_NOTIFICATION"},
127 { AR_MMS_CONFIG_SET, "AR_MMS_CONFIG_SET"},
128 { AR_STATION_EX_REPORT, "AR_STATION_EX_REPORT"},
129 { AR_AP_EX_REPORT, "AR_AP_EX_REPORT"},
130 { 0, NULL }
133 static const value_string rtls_sr_type_vals[] = {
134 { 1, "AR_WLAN_CLIENT" },
135 { 2, "AR_WLAN_AP" },
136 {0, NULL}
139 static const value_string rtls_sr_associated_vals[] = {
140 { 1, "AR_WLAN_ASSOCIATED (All APs and Associated Stations)" },
141 { 2, "AR_WLAN_UNASSOCIATED (Unassociated Stations)" },
142 {0, NULL}
145 static const value_string rtls_data_rate_vals[] = {
146 { 0x00, "1 Mbits" },
147 { 0x01, "2 Mbits" },
148 { 0x02, "5.5 Mbits" },
149 { 0x03, "6 Mbits" },
150 { 0x04, "9 Mbits" },
151 { 0x05, "11 Mbits" },
152 { 0x06, "12 Mbits" },
153 { 0x07, "18 Mbits" },
154 { 0x08, "24 Mbits" },
155 { 0x09, "36 Mbits" },
156 { 0x0A, "48 Mbits" },
157 { 0x0B, "54 Mbits" },
158 {0, NULL}
161 static const value_string rtls_ex_phy_type_vals[] = {
162 { 1, "802.11b" },
163 { 2, "802.11a" },
164 { 3, "802.11g" },
165 { 4, "802.11ag" },
166 {0, NULL}
169 static const value_string rtls_ex_classification_vals[] = {
170 { 1, "Valid" },
171 { 2, "interfering" },
172 { 3, "DOS'ed" },
173 {0, NULL}
176 static void
177 rssi_base_custom(char *result, uint32_t rssi)
179 /* Convert Hex to decimal and subtract 256 to get the signal value */
180 snprintf(result, ITEM_LABEL_LENGTH, "%d", rssi - 256);
184 static int
185 dissect_rtls_header(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *rtls_tree, unsigned offset, unsigned *data_length)
188 proto_tree_add_item(rtls_tree, hf_rtls_message_type, tvb, offset, 2, ENC_BIG_ENDIAN);
189 offset += 2;
191 proto_tree_add_item(rtls_tree, hf_rtls_message_id, tvb, offset, 2, ENC_BIG_ENDIAN);
192 offset += 2;
194 proto_tree_add_item(rtls_tree, hf_rtls_version_major, tvb, offset, 1, ENC_BIG_ENDIAN);
195 offset += 1;
197 proto_tree_add_item(rtls_tree, hf_rtls_version_minor, tvb, offset, 1, ENC_BIG_ENDIAN);
198 offset += 1;
200 proto_tree_add_item(rtls_tree, hf_rtls_data_length, tvb, offset, 2, ENC_BIG_ENDIAN);
201 if(data_length){
202 *data_length = tvb_get_ntohs(tvb, offset);
204 offset += 2;
206 proto_tree_add_item(rtls_tree, hf_rtls_ap_mac, tvb, offset, 6, ENC_NA);
207 offset += 6;
209 proto_tree_add_item(rtls_tree, hf_rtls_padding, tvb, offset, 2, ENC_NA);
210 offset += 2;
212 return offset;
215 static int
216 // NOLINTNEXTLINE(misc-no-recursion)
217 dissect_rtls_message_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *rtls_tree, unsigned offset, unsigned type)
219 proto_item *ti_rssi;
221 switch(type){
222 case AR_AS_CONFIG_SET:
223 proto_tree_add_item(rtls_tree, hf_rtls_as_tag_addr, tvb, offset, 6, ENC_NA);
224 offset += 6;
225 proto_tree_add_item(rtls_tree, hf_rtls_reserved, tvb, offset, 2, ENC_NA);
226 offset += 2;
227 break;
228 case AR_STATION_REQUEST:
229 proto_tree_add_item(rtls_tree, hf_rtls_sr_mac_address, tvb, offset, 6, ENC_NA);
230 offset += 6;
231 proto_tree_add_item(rtls_tree, hf_rtls_reserved, tvb, offset, 2, ENC_NA);
232 offset += 2;
233 break;
234 case AR_ACK:
235 case AR_AP_NOTIFICATION:
236 /* No Payload */
237 break;
238 case AR_NACK:
239 proto_tree_add_bitmask_with_flags(rtls_tree, tvb, offset,
240 hf_rtls_nack_flags, ett_rtls_nack_flags, rtls_nack_flags, ENC_BIG_ENDIAN, BMT_NO_APPEND);
241 offset += 2;
242 proto_tree_add_item(rtls_tree, hf_rtls_reserved, tvb, offset, 2, ENC_NA);
243 offset += 2;
244 break;
245 case AR_TAG_REPORT:
246 proto_tree_add_item(rtls_tree, hf_rtls_tr_bssid, tvb, offset, 6, ENC_NA);
247 offset += 6;
248 proto_tree_add_item(rtls_tree, hf_rtls_tr_rssi, tvb, offset, 1, ENC_BIG_ENDIAN);
249 ti_rssi = proto_tree_add_item(rtls_tree, hf_rtls_tr_rssi_calculated, tvb, offset, 1, ENC_BIG_ENDIAN);
250 proto_item_set_generated(ti_rssi);
251 offset += 1;
252 proto_tree_add_item(rtls_tree, hf_rtls_tr_noise_floor, tvb, offset, 1, ENC_BIG_ENDIAN);
253 offset += 1;
254 proto_tree_add_item(rtls_tree, hf_rtls_tr_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
255 offset += 4;
256 proto_tree_add_item(rtls_tree, hf_rtls_tr_tag_mac, tvb, offset, 6, ENC_NA);
257 offset += 6;
258 proto_tree_add_item(rtls_tree, hf_rtls_tr_frame_control, tvb, offset, 2, ENC_BIG_ENDIAN);
259 offset += 2;
260 proto_tree_add_item(rtls_tree, hf_rtls_tr_sequence, tvb, offset, 2, ENC_BIG_ENDIAN);
261 offset += 2;
262 proto_tree_add_item(rtls_tree, hf_rtls_tr_data_rate, tvb, offset, 1, ENC_BIG_ENDIAN);
263 offset += 1;
264 proto_tree_add_item(rtls_tree, hf_rtls_tr_tx_power, tvb, offset, 1, ENC_BIG_ENDIAN);
265 offset += 1;
266 proto_tree_add_item(rtls_tree, hf_rtls_tr_channel, tvb, offset, 1, ENC_BIG_ENDIAN);
267 offset += 1;
268 proto_tree_add_item(rtls_tree, hf_rtls_tr_battery, tvb, offset, 1, ENC_BIG_ENDIAN);
269 offset += 1;
270 proto_tree_add_item(rtls_tree, hf_rtls_reserved, tvb, offset, 2, ENC_NA);
271 offset += 2;
272 break;
273 case AR_STATION_REPORT:
274 proto_tree_add_item(rtls_tree, hf_rtls_sr_mac, tvb, offset, 6, ENC_NA);
275 offset += 6;
276 proto_tree_add_item(rtls_tree, hf_rtls_sr_noise_floor, tvb, offset, 1, ENC_BIG_ENDIAN);
277 offset += 1;
278 proto_tree_add_item(rtls_tree, hf_rtls_sr_data_rate, tvb, offset, 1, ENC_BIG_ENDIAN);
279 offset += 1;
280 proto_tree_add_item(rtls_tree, hf_rtls_sr_channel, tvb, offset, 1, ENC_BIG_ENDIAN);
281 offset += 1;
282 proto_tree_add_item(rtls_tree, hf_rtls_sr_rssi, tvb, offset, 1, ENC_BIG_ENDIAN);
283 ti_rssi = proto_tree_add_item(rtls_tree, hf_rtls_sr_rssi_calculated, tvb, offset, 1, ENC_BIG_ENDIAN);
284 proto_item_set_generated(ti_rssi);
285 offset += 1;
286 proto_tree_add_item(rtls_tree, hf_rtls_sr_type, tvb, offset, 1, ENC_BIG_ENDIAN);
287 offset += 1;
288 proto_tree_add_item(rtls_tree, hf_rtls_sr_associated, tvb, offset, 1, ENC_BIG_ENDIAN);
289 offset += 1;
290 proto_tree_add_item(rtls_tree, hf_rtls_sr_radio_bssid, tvb, offset, 6, ENC_NA);
291 offset += 6;
292 proto_tree_add_item(rtls_tree, hf_rtls_sr_mon_bssid, tvb, offset, 6, ENC_NA);
293 offset += 6;
294 proto_tree_add_item(rtls_tree, hf_rtls_sr_age, tvb, offset, 4, ENC_BIG_ENDIAN);
295 offset += 4;
296 break;
297 case AR_STATION_EX_REPORT:
298 proto_tree_add_item(rtls_tree, hf_rtls_ser_mac, tvb, offset, 6, ENC_NA);
299 offset += 6;
300 proto_tree_add_item(rtls_tree, hf_rtls_ser_bssid, tvb, offset, 6, ENC_NA);
301 offset += 6;
302 proto_tree_add_item(rtls_tree, hf_rtls_ser_essid, tvb, offset, 33, ENC_ASCII);
303 offset += 33;
304 proto_tree_add_item(rtls_tree, hf_rtls_ser_channel, tvb, offset, 1, ENC_BIG_ENDIAN);
305 offset += 1;
306 proto_tree_add_item(rtls_tree, hf_rtls_ser_phy_type, tvb, offset, 1, ENC_BIG_ENDIAN);
307 offset += 1;
308 proto_tree_add_item(rtls_tree, hf_rtls_ser_rssi, tvb, offset, 1, ENC_BIG_ENDIAN);
309 ti_rssi = proto_tree_add_item(rtls_tree, hf_rtls_ser_rssi_calculated, tvb, offset, 1, ENC_BIG_ENDIAN);
310 proto_item_set_generated(ti_rssi);
311 offset += 1;
312 proto_tree_add_item(rtls_tree, hf_rtls_ser_duration, tvb, offset, 2, ENC_BIG_ENDIAN);
313 offset += 2;
314 proto_tree_add_item(rtls_tree, hf_rtls_ser_num_packets, tvb, offset, 2, ENC_BIG_ENDIAN);
315 offset += 2;
316 proto_tree_add_item(rtls_tree, hf_rtls_ser_noise_floor, tvb, offset, 1, ENC_BIG_ENDIAN);
317 offset += 1;
318 proto_tree_add_item(rtls_tree, hf_rtls_ser_classification, tvb, offset, 1, ENC_BIG_ENDIAN);
319 offset += 1;
320 proto_tree_add_item(rtls_tree, hf_rtls_reserved, tvb, offset, 2, ENC_NA);
321 offset += 2;
322 break;
323 case AR_AP_EX_REPORT:
324 proto_tree_add_item(rtls_tree, hf_rtls_aer_bssid, tvb, offset, 6, ENC_NA );
325 offset += 6;
326 proto_tree_add_item(rtls_tree, hf_rtls_aer_essid, tvb, offset, 33, ENC_ASCII);
327 offset += 33;
328 proto_tree_add_item(rtls_tree, hf_rtls_aer_channel, tvb, offset, 1, ENC_BIG_ENDIAN);
329 offset += 1;
330 proto_tree_add_item(rtls_tree, hf_rtls_aer_phy_type, tvb, offset, 1, ENC_BIG_ENDIAN);
331 offset += 1;
332 proto_tree_add_item(rtls_tree, hf_rtls_aer_rssi, tvb, offset, 1, ENC_BIG_ENDIAN);
333 ti_rssi = proto_tree_add_item(rtls_tree, hf_rtls_aer_rssi_calculated, tvb, offset, 1, ENC_BIG_ENDIAN);
334 proto_item_set_generated(ti_rssi);
335 offset += 1;
336 proto_tree_add_item(rtls_tree, hf_rtls_aer_duration, tvb, offset, 2, ENC_BIG_ENDIAN);
337 offset += 2;
338 proto_tree_add_item(rtls_tree, hf_rtls_aer_num_packets, tvb, offset, 2, ENC_BIG_ENDIAN);
339 offset += 2;
340 proto_tree_add_item(rtls_tree, hf_rtls_aer_noise_floor, tvb, offset, 1, ENC_BIG_ENDIAN);
341 offset += 1;
342 proto_tree_add_item(rtls_tree, hf_rtls_aer_classification, tvb, offset, 1, ENC_BIG_ENDIAN);
343 offset += 1;
344 proto_tree_add_item(rtls_tree, hf_rtls_aer_match_type, tvb, offset, 1, ENC_BIG_ENDIAN);
345 offset += 1;
346 proto_tree_add_item(rtls_tree, hf_rtls_aer_match_method, tvb, offset, 1, ENC_BIG_ENDIAN);
347 offset += 1;
348 proto_tree_add_item(rtls_tree, hf_rtls_reserved, tvb, offset, 2, ENC_NA);
349 offset += 2;
350 break;
351 case AR_COMPOUND_MESSAGE_REPORT:{
352 uint32_t cmr_messages;
353 proto_tree *sub_tree;
355 proto_tree_add_item_ret_uint(rtls_tree, hf_rtls_cmr_messages, tvb, offset, 2, ENC_BIG_ENDIAN, &cmr_messages);
356 offset += 2;
357 proto_tree_add_item(rtls_tree, hf_rtls_reserved, tvb, offset, 2, ENC_NA);
358 offset += 2;
359 while(cmr_messages){
360 uint32_t data_length;
361 type = tvb_get_ntohs(tvb, offset);
362 sub_tree = proto_tree_add_subtree_format(rtls_tree, tvb, offset, -1, ett_rtls_message, NULL, "%s", val_to_str(type, rtls_message_type_vals, "(unknown %d)"));
364 offset = dissect_rtls_header(tvb, pinfo, sub_tree, offset, &data_length);
366 // We recurse here, but we'll run out of packet before we run out of stack.
367 offset = dissect_rtls_message_type(tvb, pinfo, sub_tree, offset, type);
369 proto_item_set_len(sub_tree, data_length + RTLS_HDR_LENGTH);
370 cmr_messages--;
373 break;
374 default:{
375 uint32_t remaining = tvb_reported_length_remaining(tvb, offset);
376 if(remaining > RTLS_SIGN_LENGTH){
377 proto_tree_add_expert(rtls_tree, pinfo, &ei_rtls_undecoded, tvb, offset, remaining - RTLS_SIGN_LENGTH);
378 offset += remaining - RTLS_SIGN_LENGTH;
381 break;
384 return offset;
387 static int
388 dissect_rtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
390 proto_item *ti;
391 proto_tree *rtls_tree;
392 unsigned offset = 0;
393 uint32_t type;
395 if (tvb_reported_length(tvb) < RTLS_HDR_LENGTH + RTLS_SIGN_LENGTH)
396 return 0;
398 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTLS");
401 ti = proto_tree_add_item(tree, proto_rtls, tvb, 0, -1, ENC_NA);
403 rtls_tree = proto_item_add_subtree(ti, ett_rtls);
405 /* RTLS Header */
406 type = tvb_get_ntohs(tvb, offset);
407 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(type, rtls_message_type_vals, "(unknown %d)"));
409 offset = dissect_rtls_header(tvb, pinfo, rtls_tree, offset, NULL);
411 offset = dissect_rtls_message_type(tvb, pinfo, rtls_tree, offset, type);
413 /* TODO: Check signature ? HMAC-SHA1 with shared key and RTLS packet data */
414 proto_tree_add_item(rtls_tree, hf_rtls_signature, tvb, offset, RTLS_SIGN_LENGTH, ENC_NA);
415 offset += 20;
417 return offset;
420 void
421 proto_register_rtls(void)
423 expert_module_t *expert_rtls;
425 static hf_register_info hf[] = {
427 /* RTLS Header*/
428 { &hf_rtls_message_type,
429 { "Message Type", "rtls.message_type",
430 FT_UINT16, BASE_HEX, VALS(rtls_message_type_vals), 0x0,
431 NULL, HFILL }
433 { &hf_rtls_message_id,
434 { "Message Id", "rtls.message_id",
435 FT_UINT16, BASE_DEC, NULL, 0x0,
436 NULL, HFILL }
438 { &hf_rtls_version_major,
439 { "Version Major", "rtls.version_major",
440 FT_UINT8, BASE_DEC, NULL, 0x0,
441 NULL, HFILL }
443 { &hf_rtls_version_minor,
444 { "Version Minor", "rtls.version_minor",
445 FT_UINT8, BASE_DEC, NULL, 0x0,
446 NULL, HFILL }
448 { &hf_rtls_data_length,
449 { "Data Length", "rtls.data_length",
450 FT_UINT16, BASE_DEC, NULL, 0x0,
451 NULL, HFILL }
453 { &hf_rtls_ap_mac,
454 { "AP MAC Address", "rtls.ap_mac",
455 FT_ETHER, BASE_NONE, NULL, 0x0,
456 NULL, HFILL }
458 { &hf_rtls_padding,
459 { "Padding", "rtls.padding",
460 FT_BYTES, BASE_NONE, NULL, 0x0,
461 NULL, HFILL }
463 { &hf_rtls_reserved,
464 { "Reserved", "rtls.reserved",
465 FT_BYTES, BASE_NONE, NULL, 0x0,
466 NULL, HFILL }
468 { &hf_rtls_signature,
469 { "Signature", "rtls.signature",
470 FT_BYTES, BASE_NONE, NULL, 0x0,
471 NULL, HFILL }
474 /* AR_AS_CONFIG_SET */
475 { &hf_rtls_as_tag_addr,
476 { "AS Tag Address", "rtls.as_tag_addr",
477 FT_ETHER, BASE_NONE, NULL, 0x0,
478 "Tag multicast address", HFILL }
480 /* AR_STATION_REQUEST */
481 { &hf_rtls_sr_mac_address,
482 { "MAC Address", "rtls.sr_mac_addr",
483 FT_ETHER, BASE_NONE, NULL, 0x0,
484 NULL, HFILL }
486 /* AR_NACK */
487 { &hf_rtls_nack_flags,
488 { "Flags", "rtls.nack.flags",
489 FT_UINT16, BASE_HEX, NULL, 0x00,
490 NULL, HFILL }
492 { &hf_rtls_nack_flags_internal_error,
493 { "Internal Error", "rtls.nack.flags.internal_errors",
494 FT_UINT16, BASE_HEX, NULL, 0x01,
495 NULL, HFILL }
497 { &hf_rtls_nack_flags_station_not_found,
498 { "Station Not found", "rtls.nack.flags.station_not_found",
499 FT_UINT16, BASE_HEX, NULL, 0x02,
500 NULL, HFILL }
502 { &hf_rtls_nack_flags_reserved,
503 { "Reserved", "rtls.nack.flags.reserved",
504 FT_UINT16, BASE_HEX, NULL, 0xFC,
505 NULL, HFILL }
508 /* AR_TAG_REPORT */
509 { &hf_rtls_tr_bssid,
510 { "BSSID", "rtls.tr.bssid",
511 FT_ETHER, BASE_NONE, NULL, 0x0,
512 "MAC address of the radio where the frame was received", HFILL }
514 { &hf_rtls_tr_rssi,
515 { "RSSI", "rtls.tr.rssi",
516 FT_UINT8, BASE_DEC, NULL, 0x0,
517 "Signal as a signed negative hex value", HFILL }
519 { &hf_rtls_tr_rssi_calculated,
520 { "RSSI (calculated)", "rtls.tr.rssi.calculated",
521 FT_UINT8, BASE_CUSTOM, CF_FUNC(rssi_base_custom), 0x0,
522 NULL, HFILL }
524 { &hf_rtls_tr_noise_floor,
525 { "Noise Floor", "rtls.tr.noise_floor",
526 FT_UINT8, BASE_DEC, NULL, 0x0,
527 "Noise floor of the radio", HFILL }
529 { &hf_rtls_tr_timestamp,
530 { "Timestamp", "rtls.tr.timestamp",
531 FT_UINT32, BASE_DEC, NULL, 0x0,
532 "Millisecond granularity timestamp that represents local time in AP when message was sent", HFILL }
534 { &hf_rtls_tr_tag_mac,
535 { "Tag Mac", "rtls.tr.tag_mac",
536 FT_ETHER, BASE_NONE, NULL, 0x0,
537 "MAC address of the tag", HFILL }
539 { &hf_rtls_tr_frame_control,
540 { "Frame Control", "rtls.tr.frame_control",
541 FT_UINT16, BASE_HEX, NULL, 0x0,
542 "Frame control from 802.11 header", HFILL }
544 { &hf_rtls_tr_sequence,
545 { "Sequence", "rtls.tr.sequence",
546 FT_UINT16, BASE_DEC, NULL, 0x0,
547 "Sequence number from the 802.11 header", HFILL }
549 { &hf_rtls_tr_data_rate,
550 { "Data Rate", "rtls.tr.data_rate",
551 FT_UINT8, BASE_DEC, VALS(rtls_data_rate_vals), 0x0,
552 "Data rate of chirp frame", HFILL }
554 { &hf_rtls_tr_tx_power,
555 { "Tx Power", "rtls.tr.tx_power",
556 FT_UINT8, BASE_DEC, NULL, 0x0,
557 "Transmit power in dbm", HFILL }
559 { &hf_rtls_tr_channel,
560 { "Channel", "rtls.tr.channel",
561 FT_UINT8, BASE_DEC, NULL, 0x0,
562 "Channel of tag transmission", HFILL }
564 { &hf_rtls_tr_battery,
565 { "Battery", "rtls.tr.battery",
566 FT_UINT8, BASE_DEC, NULL, 0x0,
567 "Batter level information from the chirp frame if present", HFILL }
569 /* AR_STATION_REPORT */
570 { &hf_rtls_sr_mac,
571 { "MAC", "rtls.sr.mac",
572 FT_ETHER, BASE_NONE, NULL, 0x0,
573 NULL, HFILL }
575 { &hf_rtls_sr_noise_floor,
576 { "Noise Floor", "rtls.sr.noise_floor",
577 FT_UINT8, BASE_DEC, NULL, 0x0,
578 "Noise floor of the channel where the station was last heard", HFILL }
580 { &hf_rtls_sr_data_rate,
581 { "Data Rate", "rtls.sr.data_rate",
582 FT_UINT8, BASE_DEC, VALS(rtls_data_rate_vals), 0x0,
583 "Data rate of chirp frame", HFILL }
585 { &hf_rtls_sr_channel,
586 { "Channel", "rtls.sr.channel",
587 FT_UINT8, BASE_DEC, NULL, 0x0,
588 "Channel where station was last heard", HFILL }
590 { &hf_rtls_sr_rssi,
591 { "RSSI", "rtls.sr.rssi",
592 FT_UINT8, BASE_DEC, NULL, 0x0,
593 "Signal as a signed negative hex value", HFILL }
595 { &hf_rtls_sr_rssi_calculated,
596 { "RSSI (calculated)", "rtls.sr.rssi.calculated",
597 FT_UINT8, BASE_CUSTOM, CF_FUNC(rssi_base_custom), 0x0,
598 NULL, HFILL }
600 { &hf_rtls_sr_type,
601 { "Type", "rtls.sr.type",
602 FT_UINT8, BASE_DEC, VALS(rtls_sr_type_vals), 0x0,
603 "Type of device", HFILL }
605 { &hf_rtls_sr_associated,
606 { "Associated", "rtls.sr.associated",
607 FT_UINT8, BASE_DEC, VALS(rtls_sr_associated_vals), 0x0,
608 "Association status of station", HFILL }
610 { &hf_rtls_sr_radio_bssid,
611 { "Radio BSSID", "rtls.sr.radio_bssids",
612 FT_ETHER, BASE_NONE, NULL, 0x0,
613 "Association status of station BSSID of the radio that detected the device", HFILL }
615 { &hf_rtls_sr_mon_bssid,
616 { "Mon BSSID", "rtls.sr.mon_bssids",
617 FT_ETHER, BASE_NONE, NULL, 0x0,
618 "BSSID of the AP that the station is associated to", HFILL }
620 { &hf_rtls_sr_age,
621 { "Age", "rtls.sr.age",
622 FT_UINT32, BASE_DEC, NULL, 0x0,
623 "The number of seconds since the last packet was heard from this station", HFILL }
625 /* AR_STATION_EX_REPORT */
626 { &hf_rtls_ser_mac,
627 { "MAC", "rtls.ser.mac",
628 FT_ETHER, BASE_NONE, NULL, 0x0,
629 "MAC address of station", HFILL }
631 { &hf_rtls_ser_bssid,
632 { "BSSID", "rtls.ser.bssid",
633 FT_ETHER, BASE_NONE, NULL, 0x0,
634 "BSSID with which this station is associated", HFILL }
636 { &hf_rtls_ser_essid,
637 { "ESSID", "rtls.ser.essid",
638 FT_STRING, BASE_NONE, NULL, 0x0,
639 "ESSID with which this station is associated", HFILL }
641 { &hf_rtls_ser_channel,
642 { "Channel", "rtls.ser.channel",
643 FT_UINT8, BASE_DEC, NULL, 0x0,
644 "Channel where this station is active", HFILL }
646 { &hf_rtls_ser_phy_type,
647 { "Phy type", "rtls.ser.phy_type",
648 FT_UINT8, BASE_DEC, VALS(rtls_ex_phy_type_vals), 0x0,
649 NULL, HFILL }
651 { &hf_rtls_ser_rssi,
652 { "RSSI", "rtls.ser.rssi",
653 FT_UINT8, BASE_DEC, NULL, 0x0,
654 "Average RSSI during the duration", HFILL }
656 { &hf_rtls_ser_rssi_calculated,
657 { "RSSI (calculated)", "rtls.ser.rssi.calculated",
658 FT_UINT8, BASE_CUSTOM, CF_FUNC(rssi_base_custom), 0x0,
659 NULL, HFILL }
661 { &hf_rtls_ser_duration,
662 { "Duration", "rtls.ser.duration",
663 FT_UINT16, BASE_DEC, NULL, 0x0,
664 "Average calculation duration", HFILL }
666 { &hf_rtls_ser_num_packets,
667 { "Num Packets", "rtls.ser.num_packets",
668 FT_UINT16, BASE_DEC, NULL, 0x0,
669 "Number of packets used in average RSSI calculation", HFILL }
671 { &hf_rtls_ser_noise_floor,
672 { "Noise Floor", "rtls.ser.noise_floor",
673 FT_UINT8, BASE_DEC, NULL, 0x0,
674 "Noise floor of the radio", HFILL }
676 { &hf_rtls_ser_classification,
677 { "Classification", "rtls.ser.classification",
678 FT_UINT8, BASE_DEC, VALS(rtls_ex_classification_vals), 0x0,
679 "Millisecond granularity timestamp that represents local time in AP when message was sent", HFILL }
681 /* AR_AP_EX_REPORT */
682 { &hf_rtls_aer_bssid,
683 { "BSSID", "rtls.aer.bssid",
684 FT_ETHER, BASE_NONE, NULL, 0x0,
685 "BSSID with which this station is associated", HFILL }
687 { &hf_rtls_aer_essid,
688 { "ESSID", "rtls.aer.essid",
689 FT_STRING, BASE_NONE, NULL, 0x0,
690 "ESSID with which this station is associated", HFILL }
692 { &hf_rtls_aer_channel,
693 { "Channel", "rtls.aer.channel",
694 FT_UINT8, BASE_DEC, NULL, 0x0,
695 "Channel where this station is active", HFILL }
697 { &hf_rtls_aer_phy_type,
698 { "Phy type", "rtls.aer.phy_type",
699 FT_UINT8, BASE_DEC, VALS(rtls_ex_phy_type_vals), 0x0,
700 NULL, HFILL }
702 { &hf_rtls_aer_rssi,
703 { "RSSI", "rtls.aer.rssi",
704 FT_UINT8, BASE_DEC, NULL, 0x0,
705 "Average RSSI during the duration", HFILL }
707 { &hf_rtls_aer_rssi_calculated,
708 { "RSSI (calculated)", "rtls.aer.rssi.calculated",
709 FT_UINT8, BASE_CUSTOM, CF_FUNC(rssi_base_custom), 0x0,
710 NULL, HFILL }
712 { &hf_rtls_aer_duration,
713 { "Duration", "rtls.aer.duration",
714 FT_UINT16, BASE_DEC, NULL, 0x0,
715 "Average calculation duration", HFILL }
717 { &hf_rtls_aer_num_packets,
718 { "Num Packets", "rtls.aer.num_packets",
719 FT_UINT16, BASE_DEC, NULL, 0x0,
720 "Number of packets used in average RSSI calculation", HFILL }
722 { &hf_rtls_aer_noise_floor,
723 { "Noise Floor", "rtls.aer.noise_floor",
724 FT_UINT8, BASE_DEC, NULL, 0x0,
725 "Noise floor of the radio", HFILL }
727 { &hf_rtls_aer_classification,
728 { "Classification", "rtls.aer.classification",
729 FT_UINT8, BASE_DEC, VALS(rtls_ex_classification_vals), 0x0,
730 "Millisecond granularity timestamp that represents local time in AP when message was sent", HFILL }
732 { &hf_rtls_aer_match_type,
733 { "Match Type", "rtls.aer.match_type",
734 FT_UINT8, BASE_HEX, NULL, 0x0,
735 "Internal Aruba use", HFILL }
737 { &hf_rtls_aer_match_method,
738 { "Match Method", "rtls.aer.match_method",
739 FT_UINT8, BASE_HEX, NULL, 0x0,
740 "Internal Aruba use", HFILL }
743 { &hf_rtls_cmr_messages,
744 { "Messages", "rtls.cmr_messages",
745 FT_UINT16, BASE_DEC, NULL, 0x0,
746 "number of messages", HFILL }
751 static int *ett[] = {
752 &ett_rtls,
753 &ett_rtls_message,
754 &ett_rtls_nack_flags,
758 /* Setup protocol expert items */
759 static ei_register_info ei[] = {
760 { &ei_rtls_undecoded,
761 { "rtls.undecoded", PI_UNDECODED, PI_NOTE, "Undecoded Payload", EXPFILL }
766 proto_rtls = proto_register_protocol("Real Time Location System", "RTLS", "rtls");
767 rtls_handle = register_dissector("rtls", dissect_rtls, proto_rtls);
769 proto_register_field_array(proto_rtls, hf, array_length(hf));
770 proto_register_subtree_array(ett, array_length(ett));
772 expert_rtls = expert_register_protocol(proto_rtls);
773 expert_register_field_array(expert_rtls, ei, array_length(ei));
777 void
778 proto_reg_handoff_rtls(void)
780 // If this is ever streamed (transported over TCP) we need to add recursion checks
781 dissector_add_for_decode_as_with_preference("udp.port", rtls_handle);
785 * Editor modelines - https://www.wireshark.org/tools/modelines.html
787 * Local variables:
788 * c-basic-offset: 4
789 * tab-width: 8
790 * indent-tabs-mode: nil
791 * End:
793 * vi: set shiftwidth=4 tabstop=8 expandtab:
794 * :indentSize=4:tabSize=8:noTabs=true: