Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-awdl.c
blobb093f242b56a04d0693f825de9501dddf8204d0a
1 /* packet-awdl.c
2 * Routines for Apple Wireless Direct Link (AWDL) dissection
4 * Copyright 2017 David Kreitschmann <dkreitschmann@seemoo.tu-darmstadt.de>
5 * Copyright 2018 Milan Stute <mstute@seemoo.tu-darmstadt.de>
7 * Released as part of:
8 * Milan Stute, David Kreitschmann, and Matthias Hollick. "One Billion Apples'
9 * Secret Sauce: Recipe for the Apple Wireless Direct Link Ad hoc Protocol"
10 * in ACM MobiCom '18. https://doi.org/10.1145/3241539.3241566
12 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include <config.h>
17 #include <math.h>
19 #include <epan/packet.h>
20 #include <epan/expert.h>
21 #include <epan/oui.h>
22 #include <epan/tfs.h>
23 #include <epan/unit_strings.h>
24 #include "packet-llc.h"
25 #include "packet-ieee80211.h"
26 #include "packet-dns.h"
28 void proto_register_awdl(void);
29 void proto_reg_handoff_awdl(void);
31 static dissector_handle_t awdl_action_handle;
32 static dissector_handle_t awdl_data_handle;
34 typedef struct awdl_tagged_field_data
36 proto_item* item_tag;
37 proto_item* item_tag_length;
38 } awdl_tagged_field_data_t;
40 static const unit_name_string units_ieee80211_tu = { " TU", NULL }; /* 1 TU = 1024 microseconds */
42 static int proto_awdl;
43 static int proto_awdl_data;
45 static int hf_awdl_unknown;
47 static int hf_awdl_fixed_parameters;
48 static int hf_awdl_tagged_parameters;
50 static int hf_awdl_data_seq;
51 static int hf_awdl_data_header;
52 static int hf_awdl_data_ethertype;
54 static int hf_awdl_type;
55 static int hf_awdl_subtype;
56 static int hf_awdl_rsvd;
57 static int hf_awdl_phytime;
58 static int hf_awdl_targettime;
59 static int hf_awdl_txdelay;
61 static int hf_awdl_tag;
62 static int hf_awdl_tag_number;
63 static int hf_awdl_tag_length;
64 static int hf_awdl_tag_data;
65 static int hf_awdl_tag_padding;
67 static int hf_awdl_version;
68 static int hf_awdl_version_minor;
69 static int hf_awdl_version_major;
70 static int hf_awdl_version_devclass;
72 static int hf_awdl_datastate_flags;
73 static int hf_awdl_datastate_flags_0;
74 static int hf_awdl_datastate_flags_1;
75 static int hf_awdl_datastate_flags_2;
76 static int hf_awdl_datastate_flags_3;
77 static int hf_awdl_datastate_flags_4;
78 static int hf_awdl_datastate_flags_5;
79 static int hf_awdl_datastate_flags_6;
80 static int hf_awdl_datastate_flags_7;
81 static int hf_awdl_datastate_flags_8;
82 static int hf_awdl_datastate_flags_9;
83 static int hf_awdl_datastate_flags_10;
84 static int hf_awdl_datastate_flags_11;
85 static int hf_awdl_datastate_flags_12;
86 static int hf_awdl_datastate_flags_13;
87 static int hf_awdl_datastate_flags_14;
88 static int hf_awdl_datastate_flags_15;
89 static int hf_awdl_datastate_extflags;
90 static int hf_awdl_datastate_extflags_0;
91 static int hf_awdl_datastate_extflags_1;
92 static int hf_awdl_datastate_extflags_2;
93 static int hf_awdl_datastate_extflags_3;
94 static int hf_awdl_datastate_extflags_4;
95 static int hf_awdl_datastate_extflags_5;
96 static int hf_awdl_datastate_extflags_6;
97 static int hf_awdl_datastate_extflags_7;
98 static int hf_awdl_datastate_extflags_8;
99 static int hf_awdl_datastate_extflags_9;
100 static int hf_awdl_datastate_extflags_10;
101 static int hf_awdl_datastate_extflags_11;
102 static int hf_awdl_datastate_extflags_12;
103 static int hf_awdl_datastate_extflags_13;
104 static int hf_awdl_datastate_extflags_14to15;
105 static int hf_awdl_datastate_infra_channel;
106 static int hf_awdl_datastate_countrycode;
107 static int hf_awdl_datastate_social_channel;
108 static int hf_awdl_datastate_social_channel_map;
109 static int hf_awdl_datastate_social_channel_map_6;
110 static int hf_awdl_datastate_social_channel_map_44;
111 static int hf_awdl_datastate_social_channel_map_149;
112 static int hf_awdl_datastate_social_channel_map_unused;
113 static int hf_awdl_datastate_infra_bssid;
114 static int hf_awdl_datastate_infra_address;
115 static int hf_awdl_datastate_awdl_address;
116 static int hf_awdl_datastate_umi;
117 static int hf_awdl_datastate_umioptions;
118 static int hf_awdl_datastate_umioptions_length;
119 static int hf_awdl_datastate_logtrigger;
120 static int hf_awdl_datastate_rlfc;
121 static int hf_awdl_datastate_active_time;
122 static int hf_awdl_datastate_aw_sequence_counter;
123 static int hf_awdl_datastate_update_counter;
125 static int hf_awdl_synctree_addr;
127 static int hf_awdl_syncparams_master;
128 static int hf_awdl_syncparams_awcounter;
129 static int hf_awdl_syncparams_apbeaconalignment;
130 static int hf_awdl_syncparams_tx_chan;
131 static int hf_awdl_syncparams_tx_counter;
132 static int hf_awdl_syncparams_master_chan;
133 static int hf_awdl_syncparams_guard_time;
134 static int hf_awdl_syncparams_aw_period;
135 static int hf_awdl_syncparams_action_frame_period;
136 static int hf_awdl_syncparams_awdl_flags;
137 static int hf_awdl_syncparams_aw_ext_length;
138 static int hf_awdl_syncparams_aw_cmn_length;
139 static int hf_awdl_syncparams_aw_remaining;
140 static int hf_awdl_syncparams_ext_min;
141 static int hf_awdl_syncparams_ext_max_multi;
142 static int hf_awdl_syncparams_ext_max_uni;
143 static int hf_awdl_syncparams_ext_max_af;
144 static int hf_awdl_syncparams_presence_mode;
146 static int hf_awdl_channelseq_enc;
147 static int hf_awdl_channelseq_duplicate;
148 static int hf_awdl_channelseq_step_count;
149 static int hf_awdl_channelseq_fill_chan;
150 static int hf_awdl_channelseq_channel_count;
151 static int hf_awdl_channelseq_channel_list;
152 static int hf_awdl_channelseq_channel;
153 static int hf_awdl_channelseq_channel_number;
154 static int hf_awdl_channelseq_channel_flags;
155 static int hf_awdl_channelseq_channel_operating_class;
156 /* legacy encoding flags */
157 static int hf_awdl_channelseq_legacy_unused;
158 static int hf_awdl_channelseq_legacy_band;
159 static int hf_awdl_channelseq_legacy_bandwidth;
160 static int hf_awdl_channelseq_legacy_control_channel;
162 static int hf_awdl_electionparams_master;
163 static int hf_awdl_electionparams_flags;
164 static int hf_awdl_electionparams_id;
165 static int hf_awdl_electionparams_distance;
166 static int hf_awdl_electionparams_mastermetric;
167 static int hf_awdl_electionparams_selfmetric;
168 static int hf_awdl_electionparams_unknown;
169 static int hf_awdl_electionparams_private_master;
170 static int hf_awdl_electionparams_private_mastermetric;
171 static int hf_awdl_electionparams_private_id;
172 static int hf_awdl_electionparams_private_phc;
174 static int hf_awdl_electionparams2_master;
175 static int hf_awdl_electionparams2_other;
176 static int hf_awdl_electionparams2_mastermetric;
177 static int hf_awdl_electionparams2_selfmetric;
178 static int hf_awdl_electionparams2_mastercounter;
179 static int hf_awdl_electionparams2_selfcounter;
180 static int hf_awdl_electionparams2_distance;
181 static int hf_awdl_electionparams2_unknown;
182 static int hf_awdl_electionparams2_reserved;
184 static int hf_awdl_dns_name_len;
185 static int hf_awdl_dns_name;
186 static int hf_awdl_dns_name_label;
187 static int hf_awdl_dns_name_short;
188 static int hf_awdl_dns_type;
189 static int hf_awdl_dns_data_len;
190 static int hf_awdl_dns_txt;
191 static int hf_awdl_dns_ptr;
192 static int hf_awdl_dns_ptr_label;
193 static int hf_awdl_dns_ptr_short;
194 static int hf_awdl_dns_target;
195 static int hf_awdl_dns_target_label;
196 static int hf_awdl_dns_target_short;
197 static int hf_awdl_dns_unknown;
198 static int hf_awdl_dns_priority;
199 static int hf_awdl_dns_weight;
200 static int hf_awdl_dns_port;
202 static int hf_awdl_serviceparams_sui;
203 static int hf_awdl_serviceparams_enc_values;
204 static int hf_awdl_serviceparams_bitmask;
205 static int hf_awdl_serviceparams_bitmask_0;
206 static int hf_awdl_serviceparams_bitmask_1;
207 static int hf_awdl_serviceparams_bitmask_2;
208 static int hf_awdl_serviceparams_bitmask_3;
209 static int hf_awdl_serviceparams_bitmask_4;
210 static int hf_awdl_serviceparams_bitmask_5;
211 static int hf_awdl_serviceparams_bitmask_6;
212 static int hf_awdl_serviceparams_bitmask_7;
213 static int hf_awdl_serviceparams_bitmask_8;
214 static int hf_awdl_serviceparams_bitmask_9;
215 static int hf_awdl_serviceparams_bitmask_10;
216 static int hf_awdl_serviceparams_bitmask_11;
217 static int hf_awdl_serviceparams_bitmask_12;
218 static int hf_awdl_serviceparams_bitmask_13;
219 static int hf_awdl_serviceparams_bitmask_14;
220 static int hf_awdl_serviceparams_bitmask_15;
221 static int hf_awdl_serviceparams_bitmask_16;
222 static int hf_awdl_serviceparams_bitmask_17;
223 static int hf_awdl_serviceparams_bitmask_18;
224 static int hf_awdl_serviceparams_bitmask_19;
225 static int hf_awdl_serviceparams_bitmask_20;
226 static int hf_awdl_serviceparams_bitmask_21;
227 static int hf_awdl_serviceparams_bitmask_22;
228 static int hf_awdl_serviceparams_bitmask_23;
229 static int hf_awdl_serviceparams_bitmask_24;
230 static int hf_awdl_serviceparams_bitmask_25;
231 static int hf_awdl_serviceparams_bitmask_26;
232 static int hf_awdl_serviceparams_bitmask_27;
233 static int hf_awdl_serviceparams_bitmask_28;
234 static int hf_awdl_serviceparams_bitmask_29;
235 static int hf_awdl_serviceparams_bitmask_30;
236 static int hf_awdl_serviceparams_bitmask_31;
237 static int hf_awdl_serviceparams_values;
238 static int hf_awdl_serviceparams_values_0;
239 static int hf_awdl_serviceparams_values_1;
240 static int hf_awdl_serviceparams_values_2;
241 static int hf_awdl_serviceparams_values_3;
242 static int hf_awdl_serviceparams_values_4;
243 static int hf_awdl_serviceparams_values_5;
244 static int hf_awdl_serviceparams_values_6;
245 static int hf_awdl_serviceparams_values_7;
247 static int hf_awdl_arpa;
248 static int hf_awdl_arpa_flags;
249 static int hf_awdl_arpa_name;
250 static int hf_awdl_arpa_short;
252 static int hf_awdl_ht_unknown;
253 /* from hf_ieee80211_* from packet-ieee80211.c */
254 static int hf_awdl_ht_cap;
255 static int hf_awdl_ht_ldpc_coding;
256 static int hf_awdl_ht_chan_width;
257 static int hf_awdl_ht_sm_pwsave;
258 static int hf_awdl_ht_green;
259 static int hf_awdl_ht_short20;
260 static int hf_awdl_ht_short40;
261 static int hf_awdl_ht_tx_stbc;
262 static int hf_awdl_ht_rx_stbc;
263 static int hf_awdl_ht_delayed_block_ack;
264 static int hf_awdl_ht_max_amsdu;
265 static int hf_awdl_ht_dss_cck_40;
266 static int hf_awdl_ht_psmp;
267 static int hf_awdl_ht_40_mhz_intolerant;
268 static int hf_awdl_ht_l_sig;
269 static int hf_awdl_ampduparam;
270 static int hf_awdl_ampduparam_mpdu;
271 static int hf_awdl_ampduparam_mpdu_start_spacing;
272 static int hf_awdl_ampduparam_reserved;
273 static int hf_awdl_mcsset;
274 static int hf_awdl_mcsset_rx_bitmask;
275 static int hf_awdl_mcsset_rx_bitmask_0to7;
276 static int hf_awdl_mcsset_rx_bitmask_8to15;
277 static int hf_awdl_mcsset_rx_bitmask_16to23;
278 static int hf_awdl_mcsset_rx_bitmask_24to31;
280 static int hf_llc_apple_awdl_pid;
282 static int ett_awdl_data;
283 static int ett_awdl;
284 static int ett_awdl_fixed_parameters;
285 static int ett_awdl_tagged_parameters;
286 static int ett_awdl_unknown;
287 static int ett_awdl_tag;
288 static int ett_awdl_channelseq_flags;
289 static int ett_awdl_version;
290 static int ett_awdl_dns_record;
291 static int ett_awdl_dns_name;
292 static int ett_awdl_channelseq_channel_list;
293 static int ett_awdl_channelseq_channel;
294 static int ett_awdl_datastate_flags;
295 static int ett_awdl_datastate_social_channel_map;
296 static int ett_awdl_datastate_extflags;
297 static int ett_awdl_ht_capabilities;
298 static int ett_awdl_ht_ampduparam;
299 static int ett_awdl_ht_mcsset_tree;
300 static int ett_awdl_ht_mcsbit_tree;
301 static int ett_awdl_serviceparams_bitmask;
302 static int ett_awdl_serviceparams_values;
303 static int ett_awdl_serviceparams_value;
305 static expert_field ei_awdl_tag_length;
306 static expert_field ei_awdl_tag_data;
307 static expert_field ei_awdl_dns_data_len;
309 static dissector_table_t ethertype_subdissector_table;
310 static dissector_table_t tagged_field_table;
312 enum tag_length {
313 TAG_LENGTH_SHORT = 2, /* short tag header length, used in legacy data frames */
314 TAG_LENGTH = 3, /* normal tag header length */
317 enum {
318 AWDL_SSTH_REQUEST_TLV = 0,
319 AWDL_SERVICE_REQUEST_TLV = 1,
320 AWDL_SERVICE_RESPONSE_TLV = 2,
321 AWDL_UNKNOWN_3_TLV = 3,
322 AWDL_SYNCHRONIZATON_PARAMETERS_TLV = 4,
323 AWDL_ELECTION_PARAMETERS_TLV = 5,
324 AWDL_SERVICE_PARAMETERS_TLV = 6,
325 AWDL_ENHANCED_DATA_RATE_CAPABILITIES_TLV = 7,
326 AWDL_ENHANCED_DATA_RATE_OPERATION_TLV = 8,
327 AWDL_INFRA_TLV = 9,
328 AWDL_INVITE_TLV = 10,
329 AWDL_DBG_STRING_TLV = 11,
330 AWDL_DATA_PATH_STATE_TLV = 12,
331 AWDL_ENCAPSULATED_IP_TLV = 13,
332 AWDL_DATAPATH_DEBUG_PACKET_LIVE_TLV = 14,
333 AWDL_DATAPATH_DEBUG_AF_LIVE_TLV = 15,
334 AWDL_ARPA_TLV = 16,
335 AWDL_IEEE80211_CONTAINER_TLV = 17,
336 AWDL_CHAN_SEQ_TLV = 18,
337 AWDL_UNKNOWN_19_TLV = 19,
338 AWDL_SYNCHRONIZATION_TREE_TLV = 20,
339 AWDL_VERSION_TLV = 21,
340 AWDL_BLOOM_FILTER_TLV = 22,
341 AWDL_NAN_SYNC_TLV = 23,
342 AWDL_ELECTION_PARAMETERS_V2_TLV = 24,
345 static const value_string tag_num_vals[] = {
346 { AWDL_SSTH_REQUEST_TLV, "SSTH Request" },
347 { AWDL_SERVICE_REQUEST_TLV, "Service Request" },
348 { AWDL_SERVICE_RESPONSE_TLV, "Service Response" },
349 { AWDL_UNKNOWN_3_TLV, "Unknown" },
350 { AWDL_SYNCHRONIZATON_PARAMETERS_TLV, "Synchronization Parameters" },
351 { AWDL_ELECTION_PARAMETERS_TLV, "Election Parameters" },
352 { AWDL_SERVICE_PARAMETERS_TLV, "Service Parameters" },
353 { AWDL_ENHANCED_DATA_RATE_CAPABILITIES_TLV, "HT Capabilities (IEEE 802.11 subset)" },
354 { AWDL_ENHANCED_DATA_RATE_OPERATION_TLV, "Enhanced Data Rate Operation" },
355 { AWDL_INFRA_TLV, "Infra" },
356 { AWDL_INVITE_TLV, "Invite" },
357 { AWDL_DBG_STRING_TLV, "Debug String" },
358 { AWDL_DATA_PATH_STATE_TLV, "Data Path State" },
359 { AWDL_ENCAPSULATED_IP_TLV, "Encapsulated IP" },
360 { AWDL_DATAPATH_DEBUG_PACKET_LIVE_TLV, "Datapath Debug Packet Live" },
361 { AWDL_DATAPATH_DEBUG_AF_LIVE_TLV, "Datapath Debug AF Live" },
362 { AWDL_ARPA_TLV, "Arpa" },
363 { AWDL_IEEE80211_CONTAINER_TLV, "IEEE 802.11 Container" },
364 { AWDL_CHAN_SEQ_TLV, "Channel Sequence" },
365 { AWDL_UNKNOWN_19_TLV, "Unknown" },
366 { AWDL_SYNCHRONIZATION_TREE_TLV, "Synchronization Tree" },
367 { AWDL_VERSION_TLV, "Version" },
368 { AWDL_BLOOM_FILTER_TLV, "Bloom Filter" },
369 { AWDL_NAN_SYNC_TLV, "NAN Sync" },
370 { AWDL_ELECTION_PARAMETERS_V2_TLV, "Election Parameters v2" },
371 { 0, NULL }
373 static value_string_ext tag_num_vals_ext = VALUE_STRING_EXT_INIT(tag_num_vals);
375 static const value_string awdl_type[] = {
376 { 8, "AWDL" },
377 { 0, NULL }
380 enum {
381 AWDL_SUBTYPE_PSF = 0,
382 AWDL_SUBTYPE_MIF = 3
385 static const value_string awdl_subtype[] = {
386 { AWDL_SUBTYPE_PSF, "Periodic Synchronization Frame (PSF)" },
387 { AWDL_SUBTYPE_MIF, "Master Indication Frame (MIF)" },
388 { 0, NULL }
391 static const value_string awdl_subtype_col[] = {
392 { AWDL_SUBTYPE_PSF, "Periodic Synchronization" },
393 { AWDL_SUBTYPE_MIF, "Master Indication" },
394 { 0, NULL }
397 static const value_string awdl_subtype_short[] = {
398 { AWDL_SUBTYPE_PSF, "PSF" },
399 { AWDL_SUBTYPE_MIF, "MIF" },
400 { 0, NULL }
403 enum {
404 AWDL_CHANSEQ_ENC_CHANNELNUMBER = 0,
405 AWDL_CHANSEQ_ENC_LEGACY = 1,
406 AWDL_CHANSEQ_ENC_OPCLASS = 3,
409 static const value_string awdl_chanseq_enc[] = {
410 { AWDL_CHANSEQ_ENC_CHANNELNUMBER, "Channelnumber" },
411 { AWDL_CHANSEQ_ENC_LEGACY, "Legacy" },
412 { AWDL_CHANSEQ_ENC_OPCLASS, "Opclass" },
413 { 0, NULL }
416 static const value_string awdl_chanseq_control_channel[] = {
417 { 1, "Lower" },
418 { 2, "Upper" },
419 { 3, "Primary" },
420 { 0, NULL }
423 static const value_string awdl_chanseq_bandwidth[] = {
424 { 1, "20 MHz" },
425 { 3, "40 MHz" },
426 { 0, NULL }
429 static const value_string awdl_chanseq_band[] = {
430 { 2, "2.4 GHz" },
431 { 1, "5 GHz" },
432 { 0, NULL }
435 static const value_string awdl_chanseq_fill_chan[] = {
436 { 0xffff, "Repeat Current" },
437 { 0, NULL }
440 enum {
441 AWDL_VERSION_MACOS = 1,
442 AWDL_VERSION_IOS = 2,
443 AWDL_VERSION_WATCHOS = 4,
444 AWDL_VERSION_TVOS = 8,
447 static const value_string awdl_version_devclass[] = {
448 { AWDL_VERSION_MACOS, "macOS" },
449 { AWDL_VERSION_IOS, "iOS" },
450 { AWDL_VERSION_WATCHOS, "watchOS" },
451 { AWDL_VERSION_TVOS, "tvOS" },
452 { 0, NULL }
455 enum {
456 T_PTR = 12, /* domain name pointer */
457 T_TXT = 16, /* text strings */
458 T_SRV = 33, /* service location (RFC 2052) */
461 static const value_string dns_types_vals[] = {
462 { T_PTR, "PTR" },
463 { T_TXT, "TXT" },
464 { T_SRV, "SRV" }, /* RFC 2052 */
465 { 0, NULL }
468 static const value_string awdl_dns_compression[] = {
469 { 0xC000, "NULL" },
470 { 0xC001, "_airplay._tcp.local" },
471 { 0xC002, "_airplay._udp.local" },
472 { 0xC003, "_airplay" },
473 { 0xC004, "_raop._tcp.local" },
474 { 0xC005, "_raop._udp.local" },
475 { 0xC006, "_raop" },
476 { 0xC007, "_airdrop._tcp.local" },
477 { 0xC008, "_airdrop._udp.local" },
478 { 0xC009, "_airdrop" },
479 { 0xC00A, "_tcp.local" },
480 { 0xC00B, "_udp.local" },
481 { 0xC00C, "local" },
482 { 0xC00D, "ip6.arpa" },
483 { 0xC00E, "ip4.arpa" },
484 { 0, NULL }
487 /* from packet-ieee80211.c */
488 static const true_false_string ht_ldpc_coding_flag = {
489 "Transmitter supports receiving LDPC coded packets",
490 "Transmitter does not support receiving LDPC coded packets"
493 /* from packet-ieee80211.c */
494 static const true_false_string ht_chan_width_flag = {
495 "Transmitter supports 20MHz and 40MHz operation",
496 "Transmitter only supports 20MHz operation"
499 /* from packet-ieee80211.c */
500 static const value_string ht_sm_pwsave_flag[] = {
501 { 0x00, "Static SM Power Save mode" },
502 { 0x01, "Dynamic SM Power Save mode" },
503 { 0x02, "Reserved" },
504 { 0x03, "SM Power Save disabled" },
505 { 0x00, NULL}
508 /* from packet-ieee80211.c */
509 static const true_false_string ht_green_flag = {
510 "Transmitter is able to receive PPDUs with Green Field (GF) preamble",
511 "Transmitter is not able to receive PPDUs with Green Field (GF) preamble"
514 /* from packet-ieee80211.c */
515 static const value_string ht_rx_stbc_flag[] = {
516 {0x00, "No Rx STBC support"},
517 {0x01, "Rx support of one spatial stream"},
518 {0x02, "Rx support of one and two spatial streams"},
519 {0x03, "Rx support of one, two, and three spatial streams"},
520 {0x00, NULL}
523 /* from packet-ieee80211.c */
524 static const true_false_string ht_delayed_block_ack_flag = {
525 "Transmitter supports HT-Delayed BlockAck",
526 "Transmitter does not support HT-Delayed BlockAck"
529 /* from packet-ieee80211.c */
530 static const true_false_string ht_max_amsdu_flag = {
531 "7935 bytes",
532 "3839 bytes"
535 /* from packet-ieee80211.c */
536 static const true_false_string ht_dss_cck_40_flag = {
537 "Will/Can use DSSS/CCK in 40 MHz",
538 "Won't/Can't use of DSSS/CCK in 40 MHz"
541 /* from packet-ieee80211.c */
542 static const true_false_string ht_psmp_flag = {
543 "Will/Can support PSMP operation",
544 "Won't/Can't support PSMP operation"
547 /* from packet-ieee80211.c */
548 static const true_false_string ht_40_mhz_intolerant_flag = {
549 "Use of 40 MHz transmissions restricted/disallowed",
550 "Use of 40 MHz transmissions unrestricted/allowed"
553 /* from packet-ieee80211.c */
554 static const value_string ampduparam_mpdu_start_spacing_flags[] = {
555 {0x00, "no restriction"},
556 {0x01, "1/4 [usec]"},
557 {0x02, "1/2 [usec]"},
558 {0x03, "1 [usec]"},
559 {0x04, "2 [usec]"},
560 {0x05, "4 [usec]"},
561 {0x06, "8 [usec]"},
562 {0x07, "16 [usec]"},
563 {0x00, NULL}
566 /* from packet-ieee80211.c */
567 static const value_string mcsset_tx_max_spatial_streams_flags[] = {
568 { 0x00, "1 spatial stream" },
569 { 0x01, "2 spatial streams" },
570 { 0x02, "3 spatial streams" },
571 { 0x03, "4 spatial streams" },
572 { 0x04, "TX MCS Set Not Defined" },
573 { 0x00, NULL}
576 static const value_string apple_awdl_pid_vals[] = {
577 { 0x0800, "AWDL" },
578 { 0, NULL }
581 static proto_item *
582 add_awdl_version(tvbuff_t *tvb, int offset, proto_tree *tree) {
583 proto_item *version_item;
584 uint64_t version;
585 static int * const fields[] = {
586 &hf_awdl_version_major,
587 &hf_awdl_version_minor,
588 NULL
591 version_item = proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_awdl_version, ett_awdl_version,
592 fields, ENC_LITTLE_ENDIAN, BMT_NO_APPEND, &version);
593 proto_item_append_text(version_item, " (%u.%u)", (uint8_t) ((version >> 4) & 0xf), (uint8_t) (version & 0xf));
595 return version_item;
598 static int
599 awdl_tag_version(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) {
600 int offset = 0;
602 add_awdl_version(tvb, offset, tree);
603 offset += 1;
604 proto_tree_add_item(tree, hf_awdl_version_devclass, tvb, offset, 1, ENC_LITTLE_ENDIAN);
605 offset += 1;
607 return offset;
610 static int
611 awdl_tag_sync_tree(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) {
612 int tag_len = tvb_reported_length(tvb);
613 int offset = 0;
615 for (; offset <= tag_len - 6; offset += 6) {
616 proto_tree_add_item(tree, hf_awdl_synctree_addr, tvb, offset, 6, ENC_NA);
619 return offset;
622 inline static bool
623 test_bit_uint32(unsigned i, uint32_t n) {
624 return ((n >> i) & 1) == 1;
627 static int
628 awdl_tag_service_params(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) {
629 proto_item *values_item, *offset_item;
630 proto_tree *values_tree;
631 int offset = 0;
633 static int * const bitmask_fields[] = {
634 &hf_awdl_serviceparams_bitmask_0,
635 &hf_awdl_serviceparams_bitmask_1,
636 &hf_awdl_serviceparams_bitmask_2,
637 &hf_awdl_serviceparams_bitmask_3,
638 &hf_awdl_serviceparams_bitmask_4,
639 &hf_awdl_serviceparams_bitmask_5,
640 &hf_awdl_serviceparams_bitmask_6,
641 &hf_awdl_serviceparams_bitmask_7,
642 &hf_awdl_serviceparams_bitmask_8,
643 &hf_awdl_serviceparams_bitmask_9,
644 &hf_awdl_serviceparams_bitmask_10,
645 &hf_awdl_serviceparams_bitmask_11,
646 &hf_awdl_serviceparams_bitmask_12,
647 &hf_awdl_serviceparams_bitmask_13,
648 &hf_awdl_serviceparams_bitmask_14,
649 &hf_awdl_serviceparams_bitmask_15,
650 &hf_awdl_serviceparams_bitmask_16,
651 &hf_awdl_serviceparams_bitmask_17,
652 &hf_awdl_serviceparams_bitmask_18,
653 &hf_awdl_serviceparams_bitmask_19,
654 &hf_awdl_serviceparams_bitmask_20,
655 &hf_awdl_serviceparams_bitmask_21,
656 &hf_awdl_serviceparams_bitmask_22,
657 &hf_awdl_serviceparams_bitmask_23,
658 &hf_awdl_serviceparams_bitmask_24,
659 &hf_awdl_serviceparams_bitmask_25,
660 &hf_awdl_serviceparams_bitmask_26,
661 &hf_awdl_serviceparams_bitmask_27,
662 &hf_awdl_serviceparams_bitmask_28,
663 &hf_awdl_serviceparams_bitmask_29,
664 &hf_awdl_serviceparams_bitmask_30,
665 &hf_awdl_serviceparams_bitmask_31,
666 NULL
669 static int * const value_fields[] = {
670 &hf_awdl_serviceparams_values_0,
671 &hf_awdl_serviceparams_values_1,
672 &hf_awdl_serviceparams_values_2,
673 &hf_awdl_serviceparams_values_3,
674 &hf_awdl_serviceparams_values_4,
675 &hf_awdl_serviceparams_values_5,
676 &hf_awdl_serviceparams_values_6,
677 &hf_awdl_serviceparams_values_7,
678 NULL
681 proto_tree_add_item(tree, hf_awdl_unknown, tvb, offset, 3, ENC_NA);
682 offset += 3;
683 proto_tree_add_item(tree, hf_awdl_serviceparams_sui, tvb, offset, 2, ENC_LITTLE_ENDIAN);
684 offset += 2;
686 values_item = proto_tree_add_item(tree, hf_awdl_serviceparams_enc_values, tvb, offset, 0, ENC_NA); /* set length later */
687 values_tree = proto_item_add_subtree(values_item, ett_awdl_serviceparams_values);
689 offset_item = proto_tree_add_bitmask_with_flags(values_tree, tvb, offset, hf_awdl_serviceparams_bitmask, ett_awdl_serviceparams_bitmask, bitmask_fields, ENC_LITTLE_ENDIAN, BMT_NO_APPEND);
690 uint32_t bitmask = tvb_get_uint32(tvb, offset, ENC_LITTLE_ENDIAN);
691 offset += 4;
693 if (bitmask != 0) {
694 unsigned count = 0;
695 for (unsigned i = 0; i < 32; i++) {
696 if (test_bit_uint32(i, bitmask)) {
697 proto_item *value_item;
698 unsigned shift = i << 3;
699 value_item = proto_tree_add_bitmask(values_tree, tvb, offset, hf_awdl_serviceparams_values,
700 ett_awdl_serviceparams_value, value_fields, ENC_LITTLE_ENDIAN);
701 uint8_t value = tvb_get_uint8(tvb, offset);
702 for (unsigned k = 0; k < 8; k++) {
703 if (test_bit_uint32(k, value)) {
704 if (count == 0) {
705 proto_item_append_text(values_item, ": %u", k + shift);
706 } else {
707 proto_item_append_text(values_item, ", %u", k + shift);
709 count++;
712 proto_item_append_text(offset_item, ", %u", shift);
713 proto_item_append_text(value_item, " (offset %u)", shift);
714 offset++;
717 proto_item_set_end(values_item, tvb, offset);
720 return offset;
723 static int
724 awdl_tag_channel_sequence(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
725 proto_item *chanlist_item, *channel_item;
726 proto_tree *chanlist_tree, *channel_tree;
727 unsigned channels;
728 uint32_t chan_number;
729 wmem_strbuf_t *strbuf;
730 int offset = 0;
732 static int * const flags_fields[] = {
733 &hf_awdl_channelseq_legacy_control_channel,
734 &hf_awdl_channelseq_legacy_bandwidth,
735 &hf_awdl_channelseq_legacy_band,
736 &hf_awdl_channelseq_legacy_unused,
737 NULL
740 proto_tree_add_item_ret_uint(tree, hf_awdl_channelseq_channel_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &channels);
741 channels += 1; /* channel list length is +1 */
742 offset += 1;
744 uint8_t seq_enc = tvb_get_uint8(tvb, offset);
745 proto_tree_add_item(tree, hf_awdl_channelseq_enc, tvb, offset, 1, ENC_LITTLE_ENDIAN);
746 offset += 1;
747 proto_tree_add_item(tree, hf_awdl_channelseq_duplicate, tvb, offset, 1, ENC_LITTLE_ENDIAN);
748 offset += 1;
749 proto_tree_add_item(tree, hf_awdl_channelseq_step_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
750 offset += 1;
751 proto_tree_add_item(tree, hf_awdl_channelseq_fill_chan, tvb, offset, 2, ENC_LITTLE_ENDIAN);
752 offset += 2;
754 /* make sufficient space for channel decodings: 5 chars/channel (3-digit number + ', ') */
755 strbuf = wmem_strbuf_new_sized(pinfo->pool, 5 * channels);
757 switch (seq_enc) {
758 case AWDL_CHANSEQ_ENC_CHANNELNUMBER:
759 chanlist_item = proto_tree_add_item(tree, hf_awdl_channelseq_channel_list, tvb, offset, channels, ENC_NA);
760 chanlist_tree = proto_item_add_subtree(chanlist_item, ett_awdl_channelseq_channel_list);
761 for (unsigned i = 0; i < channels; i++) {
762 proto_tree_add_item_ret_uint(chanlist_tree, hf_awdl_channelseq_channel_number, tvb, offset, 1, ENC_LITTLE_ENDIAN, &chan_number);
763 offset += 1;
765 if (i != 0) {
766 /* not the first */
767 wmem_strbuf_append_printf(strbuf, ", %u", chan_number);
768 } else {
769 wmem_strbuf_append_printf(strbuf, "%u", chan_number);
772 break;
773 case AWDL_CHANSEQ_ENC_LEGACY:
774 chanlist_item = proto_tree_add_item(tree, hf_awdl_channelseq_channel_list, tvb, offset, 2 * channels, ENC_NA);
775 chanlist_tree = proto_item_add_subtree(chanlist_item, ett_awdl_channelseq_channel_list);
776 for (unsigned i = 0; i < channels; i++) {
777 /* channel number is 2nd byte */
778 channel_item = proto_tree_add_item_ret_uint(chanlist_tree, hf_awdl_channelseq_channel, tvb, offset + 1, 1,
779 ENC_LITTLE_ENDIAN, &chan_number);
780 channel_tree = proto_item_add_subtree(channel_item, ett_awdl_channelseq_channel);
781 proto_tree_add_bitmask(channel_tree, tvb, offset, hf_awdl_channelseq_channel_flags,
782 ett_awdl_channelseq_flags, flags_fields, ENC_LITTLE_ENDIAN);
783 offset += 1;
784 proto_tree_add_item(channel_tree, hf_awdl_channelseq_channel_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
785 offset += 1;
787 if (i != 0) {
788 /* not the first */
789 wmem_strbuf_append_printf(strbuf, ", %u", chan_number);
790 } else {
791 wmem_strbuf_append_printf(strbuf, "%u", chan_number);
794 break;
795 case AWDL_CHANSEQ_ENC_OPCLASS:
796 chanlist_item = proto_tree_add_item(tree, hf_awdl_channelseq_channel_list, tvb, offset, 2 * channels, ENC_NA);
797 chanlist_tree = proto_item_add_subtree(chanlist_item, ett_awdl_channelseq_channel_list);
798 for (unsigned i = 0; i < channels; i++) {
799 /* channel number is 1st byte */
800 channel_item = proto_tree_add_item_ret_uint(chanlist_tree, hf_awdl_channelseq_channel, tvb, offset, 1,
801 ENC_LITTLE_ENDIAN, &chan_number);
802 channel_tree = proto_item_add_subtree(channel_item, ett_awdl_channelseq_channel);
803 proto_tree_add_item(channel_tree, hf_awdl_channelseq_channel_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
804 offset += 1;
805 proto_tree_add_item(channel_tree, hf_awdl_channelseq_channel_operating_class, tvb, offset, 1, ENC_LITTLE_ENDIAN);
806 offset += 1;
808 if (i != 0) {
809 /* not the first */
810 wmem_strbuf_append_printf(strbuf, ", %u", chan_number);
811 } else {
812 wmem_strbuf_append_printf(strbuf, "%u", chan_number);
815 break;
816 default:
817 /* TODO error handling */
818 chanlist_item = NULL;
819 break;
822 if (chanlist_item) {
823 /* finally, append channel list as string */
824 proto_item_append_text(chanlist_item, ": %s", wmem_strbuf_get_str(strbuf));
827 return offset;
830 static int
831 awdl_tag_sync_params(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) {
832 int tag_len = tvb_reported_length(tvb);
833 tvbuff_t *chanseq_tvb;
834 int offset = 0;
836 proto_tree_add_item(tree, hf_awdl_syncparams_tx_chan, tvb, offset, 1, ENC_LITTLE_ENDIAN);
837 offset += 1;
838 proto_tree_add_item(tree, hf_awdl_syncparams_tx_counter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
839 offset += 2;
840 proto_tree_add_item(tree, hf_awdl_syncparams_master_chan, tvb, offset, 1, ENC_LITTLE_ENDIAN);
841 offset += 1;
842 proto_tree_add_item(tree, hf_awdl_syncparams_guard_time, tvb, offset, 1, ENC_LITTLE_ENDIAN);
843 offset += 1;
844 proto_tree_add_item(tree, hf_awdl_syncparams_aw_period, tvb, offset, 2, ENC_LITTLE_ENDIAN);
845 offset += 2;
846 proto_tree_add_item(tree, hf_awdl_syncparams_action_frame_period, tvb, offset, 2, ENC_LITTLE_ENDIAN);
847 offset += 2;
848 proto_tree_add_item(tree, hf_awdl_syncparams_awdl_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN);
849 offset += 2;
850 proto_tree_add_item(tree, hf_awdl_syncparams_aw_ext_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
851 offset += 2;
852 proto_tree_add_item(tree, hf_awdl_syncparams_aw_cmn_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
853 offset += 2;
854 proto_tree_add_item(tree, hf_awdl_syncparams_aw_remaining, tvb, offset, 2, ENC_LITTLE_ENDIAN);
855 offset += 2;
856 proto_tree_add_item(tree, hf_awdl_syncparams_ext_min, tvb, offset, 1, ENC_LITTLE_ENDIAN);
857 offset += 1;
858 proto_tree_add_item(tree, hf_awdl_syncparams_ext_max_multi, tvb, offset, 1, ENC_LITTLE_ENDIAN);
859 offset += 1;
860 proto_tree_add_item(tree, hf_awdl_syncparams_ext_max_uni, tvb, offset, 1, ENC_LITTLE_ENDIAN);
861 offset += 1;
862 proto_tree_add_item(tree, hf_awdl_syncparams_ext_max_af, tvb, offset, 1, ENC_LITTLE_ENDIAN);
863 offset += 1;
865 //the following values are also used in IOFamily
866 proto_tree_add_item(tree, hf_awdl_syncparams_master, tvb, offset, 6, ENC_NA);
867 offset += 6;
868 proto_tree_add_item(tree, hf_awdl_syncparams_presence_mode, tvb, offset, 1, ENC_NA);
869 offset += 1;
870 proto_tree_add_item(tree, hf_awdl_unknown, tvb, offset, 1, ENC_NA);
871 offset += 1;
872 proto_tree_add_item(tree, hf_awdl_syncparams_awcounter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
873 offset += 2;
874 proto_tree_add_item(tree, hf_awdl_syncparams_apbeaconalignment, tvb, offset, 2, ENC_LITTLE_ENDIAN);
875 offset += 2;
877 chanseq_tvb = tvb_new_subset_length(tvb, offset, tag_len - offset);
878 offset += awdl_tag_channel_sequence(chanseq_tvb, pinfo, tree, data);
880 return offset;
883 static int
884 awdl_tag_election_params(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) {
885 int offset = 0;
887 uint8_t private_election = tvb_get_uint8(tvb, offset);
889 proto_tree_add_item(tree, hf_awdl_electionparams_flags, tvb, offset, 1, ENC_NA);
890 offset += 1;
891 proto_tree_add_item(tree, hf_awdl_electionparams_id, tvb, offset, 2, ENC_NA);
892 offset += 2;
893 proto_tree_add_item(tree, hf_awdl_electionparams_distance, tvb, offset, 1, ENC_NA);
894 offset += 1;
895 proto_tree_add_item(tree, hf_awdl_electionparams_unknown, tvb, offset, 1, ENC_NA);
896 offset += 1;
897 proto_tree_add_item(tree, hf_awdl_electionparams_master, tvb, offset, 6, ENC_NA);
898 offset += 6;
899 proto_tree_add_item(tree, hf_awdl_electionparams_mastermetric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
900 offset += 4;
901 proto_tree_add_item(tree, hf_awdl_electionparams_selfmetric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
902 offset += 4;
904 if (private_election) {
905 proto_tree_add_item(tree, hf_awdl_unknown, tvb, offset, 2, ENC_NA);
906 offset += 2;
907 proto_tree_add_item(tree, hf_awdl_electionparams_private_master, tvb, offset, 6, ENC_NA);
908 offset += 6;
909 proto_tree_add_item(tree, hf_awdl_electionparams_private_mastermetric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
910 offset += 4;
911 proto_tree_add_item(tree, hf_awdl_electionparams_private_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
912 offset += 4;
913 proto_tree_add_item(tree, hf_awdl_electionparams_private_phc, tvb, offset, 2, ENC_LITTLE_ENDIAN);
914 offset += 2;
917 return offset;
920 static int
921 awdl_tag_election_params_v2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) {
922 int offset = 0;
924 proto_tree_add_item(tree, hf_awdl_electionparams2_master, tvb, offset, 6, ENC_NA);
925 offset += 6;
926 proto_tree_add_item(tree, hf_awdl_electionparams2_other, tvb, offset, 6, ENC_NA);
927 offset += 6;
928 proto_tree_add_item(tree, hf_awdl_electionparams2_mastercounter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
929 offset += 4;
930 proto_tree_add_item(tree, hf_awdl_electionparams2_distance, tvb, offset, 4, ENC_LITTLE_ENDIAN);
931 offset += 4;
932 proto_tree_add_item(tree, hf_awdl_electionparams2_mastermetric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
933 offset += 4;
934 proto_tree_add_item(tree, hf_awdl_electionparams2_selfmetric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
935 offset += 4;
936 proto_tree_add_item(tree, hf_awdl_electionparams2_unknown, tvb, offset, 4, ENC_LITTLE_ENDIAN);
937 offset += 4;
938 proto_tree_add_item(tree, hf_awdl_electionparams2_reserved, tvb, offset, 4, ENC_LITTLE_ENDIAN);
939 offset += 4;
940 proto_tree_add_item(tree, hf_awdl_electionparams2_selfcounter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
941 offset += 4;
943 return offset;
946 static int
947 awdl_tag_datapath_state(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) {
948 int offset = 0;
949 uint16_t flags;
951 static int * const flags_fields[] = {
952 &hf_awdl_datastate_flags_0,
953 &hf_awdl_datastate_flags_1,
954 &hf_awdl_datastate_flags_2,
955 &hf_awdl_datastate_flags_3,
956 &hf_awdl_datastate_flags_4,
957 &hf_awdl_datastate_flags_5,
958 &hf_awdl_datastate_flags_6,
959 &hf_awdl_datastate_flags_7,
960 &hf_awdl_datastate_flags_8,
961 &hf_awdl_datastate_flags_9,
962 &hf_awdl_datastate_flags_10,
963 &hf_awdl_datastate_flags_11,
964 &hf_awdl_datastate_flags_12,
965 &hf_awdl_datastate_flags_13,
966 &hf_awdl_datastate_flags_14,
967 &hf_awdl_datastate_flags_15,
968 NULL
971 static int * const channel_map_fields[] = {
972 &hf_awdl_datastate_social_channel_map_6,
973 &hf_awdl_datastate_social_channel_map_44,
974 &hf_awdl_datastate_social_channel_map_149,
975 &hf_awdl_datastate_social_channel_map_unused,
976 NULL
979 static int * const extflags_fields[] = {
980 &hf_awdl_datastate_extflags_0,
981 &hf_awdl_datastate_extflags_1,
982 &hf_awdl_datastate_extflags_2,
983 &hf_awdl_datastate_extflags_3,
984 &hf_awdl_datastate_extflags_4,
985 &hf_awdl_datastate_extflags_5,
986 &hf_awdl_datastate_extflags_6,
987 &hf_awdl_datastate_extflags_7,
988 &hf_awdl_datastate_extflags_8,
989 &hf_awdl_datastate_extflags_9,
990 &hf_awdl_datastate_extflags_10,
991 &hf_awdl_datastate_extflags_11,
992 &hf_awdl_datastate_extflags_12,
993 &hf_awdl_datastate_extflags_13,
994 &hf_awdl_datastate_extflags_14to15,
995 NULL
998 flags = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN);
999 proto_tree_add_bitmask(tree, tvb, offset, hf_awdl_datastate_flags,
1000 ett_awdl_datastate_flags, flags_fields, ENC_LITTLE_ENDIAN);
1001 offset += 2;
1003 if (flags & 0x0100) {
1004 proto_tree_add_item(tree, hf_awdl_datastate_countrycode, tvb, offset, 3, ENC_ASCII);
1005 offset += 3;
1007 if (flags & 0x0200) {
1008 /* this can either be a channel or a map indicating which channels this node supports */
1009 uint16_t map = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN);
1010 /* TODO unverified heuristic to decide whether this is a map or number */
1011 if (map & 1) {
1012 proto_tree_add_bitmask(tree, tvb, offset, hf_awdl_datastate_social_channel_map,
1013 ett_awdl_datastate_social_channel_map, channel_map_fields, ENC_LITTLE_ENDIAN);
1014 } else {
1015 /* a single channel number */
1016 proto_tree_add_item(tree, hf_awdl_datastate_social_channel, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1018 offset += 2;
1020 if (flags & 0x0001) {
1021 proto_tree_add_item(tree, hf_awdl_datastate_infra_bssid, tvb, offset, 6, ENC_NA);
1022 proto_tree_add_item(tree, hf_awdl_datastate_infra_channel, tvb, offset + 6, 2, ENC_LITTLE_ENDIAN);
1023 offset += 8;
1025 if (flags & 0x0002) {
1026 // if not set, this will be the same as 0x1
1027 proto_tree_add_item(tree, hf_awdl_datastate_infra_address, tvb, offset, 6, ENC_NA);
1028 offset += 6;
1030 if (flags & 0x0004) {
1031 proto_tree_add_item(tree, hf_awdl_datastate_awdl_address, tvb, offset, 6, ENC_NA);
1032 offset += 6;
1034 if (flags & 0x0010) {
1035 proto_tree_add_item(tree, hf_awdl_datastate_umi, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1036 offset += 2;
1038 if (flags & 0x1000) {
1039 uint16_t optionlength = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN);
1040 proto_tree_add_item(tree, hf_awdl_datastate_umioptions_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1041 offset += 2;
1042 proto_tree_add_item(tree, hf_awdl_datastate_umioptions, tvb, offset, optionlength, ENC_NA);
1043 offset += optionlength;
1045 /* now come the extended parameters */
1046 if (flags & 0x8000) {
1047 uint16_t extflags = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN);
1048 proto_tree_add_bitmask(tree, tvb, offset, hf_awdl_datastate_extflags,
1049 ett_awdl_datastate_extflags, extflags_fields, ENC_LITTLE_ENDIAN);
1050 offset += 2;
1052 if (extflags & 0x1) {
1053 /* The logtrigger is actually two bytes. */
1054 proto_tree_add_item(tree, hf_awdl_datastate_logtrigger, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1055 offset += 2;
1057 if (extflags & 0x4) {
1058 /* Meaning unknown. */
1059 proto_tree_add_item(tree, hf_awdl_datastate_rlfc, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1060 offset += 4;
1062 if (extflags & 0x40) {
1063 proto_tree_add_item(tree, hf_awdl_datastate_active_time, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1064 offset += 4;
1065 proto_tree_add_item(tree, hf_awdl_datastate_aw_sequence_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1066 offset += 4;
1067 proto_tree_add_item(tree, hf_awdl_datastate_update_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1068 offset += 4;
1072 return offset;
1075 static int
1076 awdl_tag_ieee80211_container(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
1077 int offset = 0;
1079 const uint8_t ids[] = {
1080 191, // VHT Capability
1082 offset += add_tagged_field(pinfo, tree, tvb, offset, MGT_ACTION, ids, G_N_ELEMENTS(ids), NULL);
1084 return offset;
1087 static int
1088 awdl_tag_ht_capabilities(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) {
1089 proto_item *ti, *cap_item;
1090 proto_tree *mcs_tree, *bit_tree, *cap_tree;
1091 uint8_t streams; /* 0-4 for HT and 0-8 for VHT*/
1092 int offset = 0;
1093 int tag_len = tvb_reported_length(tvb);
1095 static int * const awdl_ht[] = {
1096 &hf_awdl_ht_ldpc_coding,
1097 &hf_awdl_ht_chan_width,
1098 &hf_awdl_ht_sm_pwsave,
1099 &hf_awdl_ht_green,
1100 &hf_awdl_ht_short20,
1101 &hf_awdl_ht_short40,
1102 &hf_awdl_ht_tx_stbc,
1103 &hf_awdl_ht_rx_stbc,
1104 &hf_awdl_ht_delayed_block_ack,
1105 &hf_awdl_ht_max_amsdu,
1106 &hf_awdl_ht_dss_cck_40,
1107 &hf_awdl_ht_psmp,
1108 &hf_awdl_ht_40_mhz_intolerant,
1109 &hf_awdl_ht_l_sig,
1110 NULL
1113 proto_tree_add_item(tree, hf_awdl_ht_unknown, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1114 offset += 2;
1116 proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_awdl_ht_cap, ett_awdl_ht_capabilities,
1117 awdl_ht, ENC_LITTLE_ENDIAN, BMT_NO_APPEND);
1118 offset += 2;
1120 cap_item = proto_tree_add_item(tree, hf_awdl_ampduparam, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1121 cap_tree = proto_item_add_subtree(cap_item, ett_awdl_ht_ampduparam);
1122 ti = proto_tree_add_item(cap_tree, hf_awdl_ampduparam_mpdu, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1123 proto_item_append_text(ti, " (%04.0f[Bytes])", pow(2, 13 + (tvb_get_uint8(tvb, offset) & 0x3)) - 1);
1124 proto_tree_add_item(cap_tree, hf_awdl_ampduparam_mpdu_start_spacing, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1125 proto_tree_add_item(cap_tree, hf_awdl_ampduparam_reserved, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1126 offset += 1;
1128 /* Check how many streams are supported */
1129 for (streams = 0; streams < 4 /* max streams */ && tvb_get_uint8(tvb, offset + streams) != 0; streams++) {
1132 ti = proto_tree_add_item(tree, hf_awdl_mcsset, tvb, offset, streams, ENC_NA);
1133 mcs_tree = proto_item_add_subtree(ti, ett_awdl_ht_mcsset_tree);
1135 /* Rx MCS Bitmask */
1136 ti = proto_tree_add_item(mcs_tree, hf_awdl_mcsset_rx_bitmask, tvb, offset, streams, ENC_NA);
1137 bit_tree = proto_item_add_subtree(ti, ett_awdl_ht_mcsbit_tree);
1139 proto_tree_add_item(bit_tree, hf_awdl_mcsset_rx_bitmask_0to7, tvb, offset, streams, ENC_LITTLE_ENDIAN);
1140 offset += 1;
1141 if (offset < tag_len - 2) {
1142 proto_tree_add_item(bit_tree, hf_awdl_mcsset_rx_bitmask_8to15, tvb, offset - 1, streams, ENC_LITTLE_ENDIAN);
1143 offset += 1;
1145 if (offset < tag_len - 2) {
1146 proto_tree_add_item(bit_tree, hf_awdl_mcsset_rx_bitmask_16to23, tvb, offset - 2, streams, ENC_LITTLE_ENDIAN);
1147 offset += 1;
1149 if (offset < tag_len - 2) {
1150 proto_tree_add_item(bit_tree, hf_awdl_mcsset_rx_bitmask_24to31, tvb, offset - 3, streams, ENC_LITTLE_ENDIAN);
1151 offset += 1;
1154 proto_item_append_text(ti, ": %s", val_to_str(streams - 1, mcsset_tx_max_spatial_streams_flags, "Reserved: %d" ) );
1156 // Some padding at the end
1157 proto_tree_add_item(tree, hf_awdl_ht_unknown, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1158 offset += 2;
1160 return offset;
1164 * Decodes a AWDL-variant DNS name.
1166 * 'hfindex_regular' needs to registered as
1167 * 'hfindex_compressed' assumes a field that can be decoded with the 'awdl_dns_compression' value_string
1169 static int
1170 add_awdl_dns_name(proto_tree *tree, int hfindex_regular, int hfindex_compressed,
1171 tvbuff_t *tvb, int offset, int len, wmem_allocator_t *scope, const char **name) {
1172 int start_offset = offset;
1173 uint8_t component_len;
1174 const unsigned char *component;
1175 wmem_strbuf_t *strbuf;
1177 strbuf = wmem_strbuf_new_sized(scope, MAX_DNAME_LEN);
1179 while (offset < (len + start_offset)) {
1180 component_len = tvb_get_uint8(tvb, offset);
1181 if (component_len & 0xC0) {
1182 /* compressed label */
1183 unsigned compressed_value;
1184 proto_tree_add_item_ret_uint(tree, hfindex_compressed, tvb, offset, 2, ENC_BIG_ENDIAN, &compressed_value);
1185 if (compressed_value == 0xC000) {
1186 // 'NULL' compression -> ignore in printed string
1187 component = NULL;
1188 } else {
1189 component = val_to_str_const(compressed_value, awdl_dns_compression, "<UNKNOWN>");
1191 offset += 2;
1192 } else {
1193 /* regular label */
1194 unsigned label_len;
1195 proto_tree_add_item_ret_string_and_length(tree, hfindex_regular, tvb, offset, 1, ENC_ASCII, scope, &component, &label_len);
1196 offset += label_len;
1198 if (component) {
1199 if (wmem_strbuf_get_len(strbuf))
1200 /* not the first entry */
1201 wmem_strbuf_append_c(strbuf, '.');
1202 wmem_strbuf_append(strbuf, component);
1206 *name = wmem_strbuf_get_str(strbuf);
1208 return offset - start_offset;
1211 static int
1212 add_awdl_dns_entry(packet_info *pinfo, proto_tree *tree, int ett,
1213 int hfindex_entry, int hfindex_regular, int hfindex_compressed,
1214 tvbuff_t *tvb, int offset, int len, const char **name) {
1215 int start_offset = offset;
1216 proto_item *entry_item;
1217 proto_tree *entry_tree;
1218 const char *n;
1220 entry_item = proto_tree_add_item(tree, hfindex_entry, tvb, offset, 0, ENC_NA);
1221 entry_tree = proto_item_add_subtree(entry_item, ett);
1222 offset += add_awdl_dns_name(entry_tree, hfindex_regular, hfindex_compressed, tvb, offset, len, pinfo->pool, &n);
1223 proto_item_set_end(entry_item, tvb, offset);
1224 proto_item_append_text(entry_item, ": %s", n);
1226 if (name)
1227 (*name) = n;
1229 return offset - start_offset;
1232 static int
1233 awdl_tag_arpa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
1234 int offset = 0;
1235 int tag_len = tvb_reported_length(tvb);
1237 proto_tree_add_item(tree, hf_awdl_arpa_flags, tvb, offset, 1, ENC_NA);
1238 offset += 1;
1239 offset += add_awdl_dns_entry(pinfo, tree, ett_awdl_dns_name, hf_awdl_arpa, hf_awdl_arpa_name,
1240 hf_awdl_arpa_short, tvb, offset, tag_len - offset, NULL);
1242 return offset;
1245 static int
1246 awdl_tag_service_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
1247 proto_item *rr_item;
1248 proto_tree *rr_tree, *data_len;
1249 const char *name;
1250 int offset = 0;
1251 unsigned len, type;
1252 unsigned prio, weight, port;
1254 rr_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_awdl_dns_record, &rr_item, "");
1256 proto_tree_add_item_ret_uint(rr_tree, hf_awdl_dns_name_len, tvb, offset, 2, ENC_LITTLE_ENDIAN, &len);
1257 offset += 2;
1259 // len field includes the following type value
1260 len -= 1;
1261 offset += add_awdl_dns_entry(pinfo, rr_tree, ett_awdl_dns_name, hf_awdl_dns_name, hf_awdl_dns_name_label,
1262 hf_awdl_dns_name_short, tvb, offset, len, &name);
1264 proto_tree_add_item_ret_uint(rr_tree, hf_awdl_dns_type, tvb, offset, 1, ENC_LITTLE_ENDIAN, &type);
1265 offset += 1;
1267 proto_item_set_text(rr_item, "%s: type %s", name, val_to_str_const(type, dns_types_vals, "UNKNOWN"));
1269 data_len = proto_tree_add_item_ret_uint(rr_tree, hf_awdl_dns_data_len, tvb, offset, 2, ENC_LITTLE_ENDIAN, &len);
1270 offset += 2;
1271 // TODO could be that len field is actually uint32?
1272 proto_tree_add_item(rr_tree, hf_awdl_dns_unknown, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1273 offset += 2;
1275 switch (type) {
1276 case T_TXT:
1277 while (len > 0) {
1278 const unsigned char *txt;
1279 int label_len;
1280 proto_tree_add_item_ret_string_and_length(rr_tree, hf_awdl_dns_txt, tvb, offset, 1, ENC_ASCII,
1281 pinfo->pool, &txt, &label_len);
1282 offset += label_len;
1283 proto_item_append_text(rr_item, ", %s", txt);
1284 if (label_len > (int) len) {
1285 expert_add_info_format(pinfo, data_len, &ei_awdl_tag_length,
1286 "DNS data length is too short");
1287 break;
1289 len -= label_len;
1291 break;
1292 case T_SRV:
1293 proto_tree_add_item_ret_uint(rr_tree, hf_awdl_dns_priority, tvb, offset, 2, ENC_BIG_ENDIAN, &prio);
1294 offset += 2;
1295 proto_tree_add_item_ret_uint(rr_tree, hf_awdl_dns_weight, tvb, offset, 2, ENC_BIG_ENDIAN, &weight);
1296 offset += 2;
1297 proto_tree_add_item_ret_uint(rr_tree, hf_awdl_dns_port, tvb, offset, 2, ENC_BIG_ENDIAN, &port);
1298 offset += 2;
1299 // length field includes above fields
1300 len -= 6;
1301 offset += add_awdl_dns_entry(pinfo, rr_tree, ett_awdl_dns_name, hf_awdl_dns_target, hf_awdl_dns_target_label,
1302 hf_awdl_dns_target_short, tvb, offset, len, &name);
1303 proto_item_append_text(rr_item, ", priority %u, weight %u, port %u, target %s", prio, weight, port, name);
1304 break;
1305 case T_PTR:
1306 offset += add_awdl_dns_entry(pinfo, rr_tree, ett_awdl_dns_name, hf_awdl_dns_ptr, hf_awdl_dns_ptr_label,
1307 hf_awdl_dns_ptr_short, tvb, offset, len, &name);
1308 proto_item_append_text(rr_item, ", %s", name);
1309 break;
1310 default:
1311 break;
1314 return offset;
1317 static int
1318 awdl_add_tagged_field(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, enum tag_length hdr_len) {
1319 tvbuff_t *tag_tvb;
1320 uint32_t tag_no, tag_len;
1321 proto_tree *orig_tree = tree;
1322 proto_item *ti = NULL;
1323 proto_item *ti_len, *ti_tag;
1324 awdl_tagged_field_data_t field_data;
1325 int parsed;
1327 tag_no = tvb_get_uint8(tvb, offset);
1328 if (hdr_len == TAG_LENGTH_SHORT) {
1329 tag_len = tvb_get_uint8(tvb, offset + 1);
1330 } else {
1331 tag_len = tvb_get_uint16(tvb, offset + 1, ENC_LITTLE_ENDIAN);
1334 if (tree) {
1335 ti = proto_tree_add_item(orig_tree, hf_awdl_tag, tvb, offset, tag_len + hdr_len, ENC_NA);
1336 proto_item_append_text(ti, ": %s", val_to_str_ext(tag_no, &tag_num_vals_ext, "Unknown (%d)"));
1337 tree = proto_item_add_subtree(ti, ett_awdl_tag);
1340 ti_tag = proto_tree_add_uint(tree, hf_awdl_tag_number, tvb, offset, 1, tag_no);
1341 ti_len = proto_tree_add_uint(tree, hf_awdl_tag_length, tvb, offset + 1, hdr_len - 1, tag_len);
1342 offset += hdr_len;
1343 if (tag_len > (unsigned)tvb_reported_length_remaining(tvb, offset)) {
1344 expert_add_info_format(pinfo, ti_len, &ei_awdl_tag_length,
1345 "Tag Length is longer than remaining payload");
1348 tag_tvb = tvb_new_subset_length(tvb, offset, tag_len);
1349 field_data.item_tag = ti;
1350 field_data.item_tag_length = ti_len;
1351 if (!(parsed = dissector_try_uint_with_data(tagged_field_table, tag_no, tag_tvb, pinfo, tree, false, &field_data)))
1353 proto_tree_add_item(tree, hf_awdl_tag_data, tag_tvb, 0, tag_len, ENC_NA);
1354 expert_add_info_format(pinfo, ti_tag, &ei_awdl_tag_data,
1355 "Dissector for AWDL tag (%s) code not implemented",
1356 val_to_str_ext(tag_no, &tag_num_vals_ext, "(%d)"));
1357 proto_item_append_text(ti, ": Undecoded");
1359 else if (parsed > 0 && (unsigned int) parsed < tag_len)
1361 proto_tree_add_item(tree, hf_awdl_tag_padding, tag_tvb, parsed, tag_len - parsed, ENC_NA);
1364 return tag_len + hdr_len;
1367 static void
1368 awdl_add_tagged_parameters(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int tagged_parameters_len)
1370 int next_len;
1371 while (tagged_parameters_len > 0) {
1372 if ((next_len = awdl_add_tagged_field(pinfo, tree, tvb, offset, TAG_LENGTH)) == 0)
1373 break;
1374 if (next_len > tagged_parameters_len) {
1375 /* XXX - flag this as an error? */
1376 next_len = tagged_parameters_len;
1378 offset += next_len;
1379 tagged_parameters_len -= next_len;
1383 static proto_tree *
1384 get_tagged_parameter_tree(proto_tree * tree, tvbuff_t *tvb, int start, int size)
1386 proto_item *tagged_fields;
1388 tagged_fields = proto_tree_add_item(tree, hf_awdl_tagged_parameters, tvb, start, -1, ENC_NA);
1389 proto_item_append_text(tagged_fields, " (%d bytes)", size);
1391 return proto_item_add_subtree(tagged_fields, ett_awdl_tagged_parameters);
1394 static int
1395 dissect_awdl_action(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1397 int offset = 0;
1398 int tagged_parameter_tree_len;
1399 proto_tree *parent, *af_tree, *fixed_tree, *tag_tree;
1400 proto_item *ti, *item, *fixed_fields;
1401 uint32_t phytime, targettime;
1402 uint8_t subtype;
1404 parent = proto_tree_get_parent_tree(proto_tree_get_parent_tree(tree));
1405 ti = proto_tree_add_item(parent, proto_awdl, tvb, offset, -1, ENC_NA);
1406 af_tree = proto_item_add_subtree(ti, ett_awdl);
1408 fixed_fields = proto_tree_add_item(af_tree, hf_awdl_fixed_parameters, tvb, offset, 12, ENC_NA);
1409 fixed_tree = proto_item_add_subtree(fixed_fields, ett_awdl_fixed_parameters);
1410 proto_tree_add_item(fixed_tree, hf_awdl_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1411 offset += 1;
1412 add_awdl_version(tvb, offset, fixed_tree);
1413 offset += 1;
1414 subtype = tvb_get_uint8(tvb, offset);
1415 proto_tree_add_item(fixed_tree, hf_awdl_subtype, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1416 offset += 1;
1417 proto_tree_add_item(fixed_tree, hf_awdl_rsvd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1418 offset += 1;
1419 proto_tree_add_item(fixed_tree, hf_awdl_phytime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1420 phytime = tvb_get_uint32(tvb, offset, ENC_LITTLE_ENDIAN);
1421 offset += 4;
1422 proto_tree_add_item(fixed_tree, hf_awdl_targettime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1423 targettime = tvb_get_uint32(tvb, offset, ENC_LITTLE_ENDIAN);
1424 offset += 4;
1425 item = proto_tree_add_uint(fixed_tree, hf_awdl_txdelay, tvb, 0, 0, phytime - targettime);
1426 proto_item_set_generated(item);
1428 col_set_str(pinfo->cinfo, COL_PROTOCOL, "AWDL");
1429 col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(subtype, awdl_subtype_col, "Unknown"));
1430 proto_item_append_text(ti, ", Subtype: %s", val_to_str_const(subtype, awdl_subtype_short, "Unknown"));
1432 tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
1433 tag_tree = get_tagged_parameter_tree(af_tree, tvb, offset, tagged_parameter_tree_len);
1434 awdl_add_tagged_parameters(tvb, offset, pinfo, tag_tree, tagged_parameter_tree_len);
1435 offset += tagged_parameter_tree_len;
1437 return offset;
1440 static int
1441 dissect_awdl_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1443 int offset = 0;
1444 unsigned etype;
1445 tvbuff_t *next_tvb;
1446 proto_item *ti;
1447 proto_tree *awdl_tree;
1448 unsigned seq;
1450 col_set_str(pinfo->cinfo, COL_PROTOCOL, "AWDL Data");
1451 col_clear(pinfo->cinfo, COL_INFO);
1453 ti = proto_tree_add_item(tree, proto_awdl_data, tvb, 0, -1, ENC_NA);
1455 awdl_tree = proto_item_add_subtree(ti, ett_awdl_data);
1457 proto_tree_add_item(awdl_tree, hf_awdl_data_header, tvb, offset, 2, ENC_NA);
1458 offset += 2;
1460 proto_tree_add_item_ret_uint(awdl_tree, hf_awdl_data_seq, tvb, offset, 2, ENC_LITTLE_ENDIAN, &seq);
1461 col_add_fstr(pinfo->cinfo, COL_INFO, "Seq=%u", seq);
1462 proto_item_append_text(ti, ", Seq: %u", seq);
1463 offset += 2;
1465 if (tvb_get_uint8(tvb, offset) == 3) {
1466 // 0x0300 ("long format")
1467 proto_item *tagged_item;
1468 proto_tree *tagged_tree;
1469 int start_offset;
1470 uint8_t slen;
1472 slen = tvb_get_uint8(tvb, offset + 1);
1473 proto_tree_add_item(awdl_tree, hf_awdl_data_header, tvb, offset, 2 + slen, ENC_NA);
1474 offset += 2 + slen;
1476 tagged_item = proto_tree_add_item(awdl_tree, hf_awdl_tagged_parameters, tvb, offset, 0, ENC_NA); /* set length later */
1477 tagged_tree = proto_item_add_subtree(tagged_item, ett_awdl_tagged_parameters);
1479 start_offset = offset;
1481 while (tvb_get_uint8(tvb, offset) != 3) {
1482 offset += awdl_add_tagged_field(pinfo, tagged_tree, tvb, offset, TAG_LENGTH_SHORT);
1485 slen = tvb_get_uint8(tvb, offset + 1);
1486 proto_tree_add_item(awdl_tree, hf_awdl_data_header, tvb, offset, 2 + slen, ENC_NA);
1487 offset += 2 + slen;
1489 proto_item_set_len(tagged_item, offset - start_offset);
1490 proto_item_append_text(tagged_item, " (%d bytes)", offset - start_offset);
1493 else {
1494 // 0x0000
1495 // TODO: should have some sanity check.
1496 proto_tree_add_item(awdl_tree, hf_awdl_data_header, tvb, offset, 2, ENC_NA);
1497 offset += 2;
1500 /* Last is some ethertype */
1501 proto_tree_add_item_ret_uint(awdl_tree, hf_awdl_data_ethertype, tvb, offset, 2, ENC_BIG_ENDIAN, &etype);
1502 offset += 2;
1504 proto_item_set_len(awdl_tree, offset);
1506 next_tvb = tvb_new_subset_remaining(tvb, offset);
1507 if (!dissector_try_uint(ethertype_subdissector_table, etype, next_tvb, pinfo, tree))
1508 call_data_dissector(next_tvb, pinfo, tree);
1510 return tvb_captured_length(tvb);
1513 static void
1514 awdl_register_tags(void)
1516 dissector_add_uint("awdl.tag.number", AWDL_SERVICE_RESPONSE_TLV, create_dissector_handle(awdl_tag_service_response, proto_awdl));
1517 dissector_add_uint("awdl.tag.number", AWDL_SYNCHRONIZATON_PARAMETERS_TLV, create_dissector_handle(awdl_tag_sync_params, proto_awdl));
1518 dissector_add_uint("awdl.tag.number", AWDL_ELECTION_PARAMETERS_TLV, create_dissector_handle(awdl_tag_election_params, proto_awdl));
1519 dissector_add_uint("awdl.tag.number", AWDL_SERVICE_PARAMETERS_TLV, create_dissector_handle(awdl_tag_service_params, proto_awdl));
1520 dissector_add_uint("awdl.tag.number", AWDL_ENHANCED_DATA_RATE_CAPABILITIES_TLV, create_dissector_handle(awdl_tag_ht_capabilities, proto_awdl));
1521 dissector_add_uint("awdl.tag.number", AWDL_DATA_PATH_STATE_TLV, create_dissector_handle(awdl_tag_datapath_state, proto_awdl));
1522 dissector_add_uint("awdl.tag.number", AWDL_ARPA_TLV, create_dissector_handle(awdl_tag_arpa, proto_awdl));
1523 dissector_add_uint("awdl.tag.number", AWDL_IEEE80211_CONTAINER_TLV, create_dissector_handle(awdl_tag_ieee80211_container, proto_awdl));
1524 dissector_add_uint("awdl.tag.number", AWDL_CHAN_SEQ_TLV, create_dissector_handle(awdl_tag_channel_sequence, proto_awdl));
1525 dissector_add_uint("awdl.tag.number", AWDL_SYNCHRONIZATION_TREE_TLV, create_dissector_handle(awdl_tag_sync_tree, proto_awdl));
1526 dissector_add_uint("awdl.tag.number", AWDL_VERSION_TLV, create_dissector_handle(awdl_tag_version, proto_awdl));
1527 dissector_add_uint("awdl.tag.number", AWDL_ELECTION_PARAMETERS_V2_TLV, create_dissector_handle(awdl_tag_election_params_v2, proto_awdl));
1530 void proto_register_awdl(void)
1532 static hf_register_info hf[] = {
1533 /* Default for unknown fields */
1534 { &hf_awdl_unknown,
1535 { "Unknown", "awdl.unknown",
1536 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL
1540 /* LLC */
1541 { &hf_awdl_data_seq,
1542 { "Sequence number", "awdl_data.seq",
1543 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
1546 { &hf_awdl_data_header,
1547 { "Header data", "awdl_data.header",
1548 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL
1551 { &hf_awdl_data_ethertype,
1552 { "EtherType", "awdl_data.ethertype",
1553 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
1557 /* Action Frame */
1558 { &hf_awdl_fixed_parameters,
1559 { "Fixed parameters", "awdl.fixed.all",
1560 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL
1563 { &hf_awdl_tagged_parameters,
1564 { "Tagged parameters", "awdl.tagged.all",
1565 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL
1569 /* Fixed parameters */
1570 { &hf_awdl_type,
1571 { "Type", "awdl.type",
1572 FT_UINT8, BASE_DEC, VALS(awdl_type), 0x0, NULL, HFILL
1575 { &hf_awdl_subtype,
1576 { "Subtype", "awdl.subtype",
1577 FT_UINT8, BASE_DEC, VALS(awdl_subtype), 0x0, NULL, HFILL
1580 { &hf_awdl_rsvd,
1581 { "Reserved", "awdl.reserved",
1582 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
1585 { &hf_awdl_phytime,
1586 { "PHY Tx Time", "awdl.phytime",
1587 FT_UINT32, BASE_DEC | BASE_UNIT_STRING, UNS(&units_microseconds), 0x0,
1588 "Time shortly before the frame was sent out by the radio", HFILL
1591 { &hf_awdl_targettime,
1592 { "Target Tx Time", "awdl.targettime",
1593 FT_UINT32, BASE_DEC | BASE_UNIT_STRING, UNS(&units_microseconds), 0x0,
1594 "Time when the frame was created.", HFILL
1597 { &hf_awdl_txdelay,
1598 { "Tx Delay", "awdl.txdelay",
1599 FT_UINT32, BASE_DEC | BASE_UNIT_STRING, UNS(&units_microseconds), 0x0,
1600 "Difference between the PHY and target time stamps", HFILL
1604 /* TLV */
1605 { &hf_awdl_tag,
1606 { "Tag", "awdl.tag",
1607 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL
1610 { &hf_awdl_tag_number,
1611 { "Tag Number", "awdl.tag.number",
1612 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &tag_num_vals_ext, 0x0, NULL, HFILL
1615 { &hf_awdl_tag_length,
1616 { "Tag Length", "awdl.tag.length",
1617 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
1620 { &hf_awdl_tag_data,
1621 { "Tag Data", "awdl.tag.data",
1622 FT_BYTES, BASE_NONE, NULL, 0,
1623 "Data Interpretation of tag", HFILL
1626 { &hf_awdl_tag_padding,
1627 { "Padding (?)", "awdl.tag.padding",
1628 FT_BYTES, BASE_NONE, NULL, 0,
1629 "Unused (?) bytes at the end of the tag", HFILL
1633 /* Version */
1634 { &hf_awdl_version,
1635 { "AWDL Version", "awdl.version",
1636 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
1639 { &hf_awdl_version_major,
1640 { "AWDL Version Major", "awdl.version.major",
1641 FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL
1644 { &hf_awdl_version_minor,
1645 { "AWDL Version Minor", "awdl.version.minor",
1646 FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL
1649 { &hf_awdl_version_devclass,
1650 { "Device Class", "awdl.version.device_class",
1651 FT_UINT8, BASE_DEC, VALS(awdl_version_devclass), 0, NULL, HFILL
1655 /* Synchronization Tree */
1656 { &hf_awdl_synctree_addr,
1657 { "Address", "awdl.synctree.addr",
1658 FT_ETHER, BASE_NONE, NULL, 0x0,
1659 "From tree root to leaf", HFILL
1663 /* Data Path State */
1664 { &hf_awdl_datastate_flags,
1665 { "Flags", "awdl.datastate.flags",
1666 FT_UINT16, BASE_HEX, NULL, 0,
1667 "Subsequent fields do not follow the order in which they appear in this bitmask", HFILL
1670 { &hf_awdl_datastate_flags_0,
1671 { "Infrastructure BSSID and Channel", "awdl.datastate.flags.0",
1672 FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL
1675 { &hf_awdl_datastate_flags_1,
1676 { "Infrastructure Address", "awdl.datastate.flags.1",
1677 FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL
1680 { &hf_awdl_datastate_flags_2,
1681 { "AWDL Address", "awdl.datastate.flags.2",
1682 FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL
1685 { &hf_awdl_datastate_flags_3,
1686 { "RSDB Support", "awdl.datastate.flags.3",
1687 FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL
1690 { &hf_awdl_datastate_flags_4,
1691 { "UMI", "awdl.datastate.flags.4",
1692 FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL
1695 { &hf_awdl_datastate_flags_5,
1696 { "Dualband Support", "awdl.datastate.flags.5",
1697 FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL
1700 { &hf_awdl_datastate_flags_6,
1701 { "AirPlay Sink", "awdl.datastate.flags.6",
1702 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL
1705 { &hf_awdl_datastate_flags_7,
1706 { "Follow Channel Sequence", "awdl.datastate.flags.7",
1707 FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL
1710 { &hf_awdl_datastate_flags_8,
1711 { "Country Code", "awdl.datastate.flags.8",
1712 FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL
1715 { &hf_awdl_datastate_flags_9,
1716 { "Social Channels", "awdl.datastate.flags.9",
1717 FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL
1720 { &hf_awdl_datastate_flags_10,
1721 { "AirPlay Solo Mode", "awdl.datastate.flags.10",
1722 FT_BOOLEAN, 16, NULL, 0x0400, NULL, HFILL
1725 { &hf_awdl_datastate_flags_11,
1726 { "UMI Supported", "awdl.datastate.flags.11",
1727 FT_BOOLEAN, 16, NULL, 0x0800, NULL, HFILL
1730 { &hf_awdl_datastate_flags_12,
1731 { "Unicast Options", "awdl.datastate.flags.12",
1732 FT_BOOLEAN, 16, NULL, 0x1000, NULL, HFILL
1735 { &hf_awdl_datastate_flags_13,
1736 { "Real-Time", "awdl.datastate.flags.13",
1737 FT_BOOLEAN, 16, NULL, 0x2000, NULL, HFILL
1740 { &hf_awdl_datastate_flags_14,
1741 { "Rangeable", "awdl.datastate.flags.14",
1742 FT_BOOLEAN, 16, NULL, 0x4000, NULL, HFILL
1745 { &hf_awdl_datastate_flags_15,
1746 { "Extension Flags", "awdl.datastate.flags.15",
1747 FT_BOOLEAN, 16, NULL, 0x8000, NULL, HFILL
1750 { &hf_awdl_datastate_countrycode,
1751 { "Country Code", "awdl.datastate.countrycode",
1752 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL
1755 { &hf_awdl_datastate_social_channel,
1756 { "Social Channel", "awdl.datastate.social_channel",
1757 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
1760 { &hf_awdl_datastate_social_channel_map,
1761 { "Social Channel Map", "awdl.datastate.social_channel_map",
1762 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
1765 { &hf_awdl_datastate_social_channel_map_6,
1766 { "Channel 6", "awdl.datastate.social_channel_map.ch6",
1767 FT_BOOLEAN, 16, NULL, 0x1, NULL, HFILL
1770 { &hf_awdl_datastate_social_channel_map_44,
1771 { "Channel 44", "awdl.datastate.social_channel_map.ch44",
1772 FT_BOOLEAN, 16, NULL, 0x2, NULL, HFILL
1775 { &hf_awdl_datastate_social_channel_map_149,
1776 { "Channel 149", "awdl.datastate.social_channel_map.ch149",
1777 FT_BOOLEAN, 16, NULL, 0x4, NULL, HFILL
1780 { &hf_awdl_datastate_social_channel_map_unused,
1781 { "Unused", "awdl.datastate.social_channel_map.unused",
1782 FT_UINT16, BASE_HEX, NULL, 0xfff8, NULL, HFILL
1785 { &hf_awdl_datastate_infra_bssid,
1786 { "Infrastructure BSSID", "awdl.datastate.infra_bssid",
1787 FT_ETHER, BASE_NONE, NULL, 0x0,
1788 "Address of the AP currently connected to", HFILL
1791 { &hf_awdl_datastate_infra_channel,
1792 { "Infrastructure Channel", "awdl.datastate.infra_channel",
1793 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
1796 { &hf_awdl_datastate_infra_address,
1797 { "Infrastructure Address", "awdl.datastate.infra_addr",
1798 FT_ETHER, BASE_NONE, NULL, 0x0,
1799 "MAC address of this device", HFILL
1802 { &hf_awdl_datastate_awdl_address,
1803 { "AWDL Address", "awdl.datastate.own_awdladdr",
1804 FT_ETHER, BASE_NONE, NULL, 0x0,
1805 "Randomized Address used for AWDL", HFILL
1808 { &hf_awdl_datastate_umi,
1809 { "UMI (Airplay?)", "awdl.datastate.umi",
1810 FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
1813 { &hf_awdl_datastate_umioptions,
1814 { "Unicast Options", "awdl.datastate.unicast_options",
1815 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL
1818 { &hf_awdl_datastate_umioptions_length,
1819 { "Unicast Options Length", "awdl.datastate.unicast_options_length",
1820 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
1823 { &hf_awdl_datastate_extflags,
1824 { "Extended Flags", "awdl.datastate.extflags",
1825 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
1828 { &hf_awdl_datastate_extflags_0,
1829 { "Logtrigger ID", "awdl.datastate.extflags.0",
1830 FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL
1833 { &hf_awdl_datastate_extflags_1,
1834 { "Ranging Discovery", "awdl.datastate.extflags.1",
1835 FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL
1838 { &hf_awdl_datastate_extflags_2,
1839 { "RLFC", "awdl.datastate.extflags.2",
1840 FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL
1843 { &hf_awdl_datastate_extflags_3,
1844 { "Is Social Channel Map Supported", "awdl.datastate.extflags.3",
1845 FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL
1848 { &hf_awdl_datastate_extflags_4,
1849 { "Dynamic SDB Support", "awdl.datastate.extflags.4",
1850 FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL
1853 { &hf_awdl_datastate_extflags_5,
1854 { "Misc", "awdl.datastate.extflags.5",
1855 FT_BOOLEAN, 16, NULL, 0x0020,
1856 "Indicates the presence of the rlfc, active_time and update_counter fields.", HFILL
1859 { &hf_awdl_datastate_extflags_6,
1860 { "DFS Proxy Support", "awdl.datastate.extflags.6",
1861 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL
1864 { &hf_awdl_datastate_extflags_7,
1865 { "Unknown", "awdl.datastate.extflags.7",
1866 FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL
1869 { &hf_awdl_datastate_extflags_8,
1870 { "High Efficiency Support", "awdl.datastate.extflags.8",
1871 FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL
1874 { &hf_awdl_datastate_extflags_9,
1875 { "Sidekick Hub", "awdl.datastate.extflags.9",
1876 FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL
1879 { &hf_awdl_datastate_extflags_10,
1880 { "Fast Discovery Enabled", "awdl.datastate.extflags.10",
1881 FT_BOOLEAN, 16, NULL, 0x0400, NULL, HFILL
1884 { &hf_awdl_datastate_extflags_11,
1885 { "WiFi 6E Support", "awdl.datastate.extflags.11",
1886 FT_BOOLEAN, 16, NULL, 0x0800, NULL, HFILL
1889 { &hf_awdl_datastate_extflags_12,
1890 { "Ultra Low Latency Infra Supported", "awdl.datastate.extflags.12",
1891 FT_BOOLEAN, 16, NULL, 0x1000, NULL, HFILL
1894 { &hf_awdl_datastate_extflags_13,
1895 { "In Pro Mode", "awdl.datastate.extflags.13",
1896 FT_BOOLEAN, 16, NULL, 0x2000, NULL, HFILL
1899 { &hf_awdl_datastate_extflags_14to15,
1900 { "Unknown", "awdl.datastate.extflags.14to15",
1901 FT_UINT16, BASE_HEX_DEC, NULL, 0xc000, NULL, HFILL
1904 { &hf_awdl_datastate_logtrigger,
1905 { "Logtrigger ID", "awdl.datastate.logtrigger",
1906 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
1909 { &hf_awdl_datastate_rlfc,
1910 { "RLFC", "awdl.datastate.rlfc",
1911 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL
1914 { &hf_awdl_datastate_active_time,
1915 { "Active Time", "awdl.datastate.active_time",
1916 FT_UINT32, BASE_DEC, NULL, 0,
1917 "The amount of milliseconds, which have passed since the activation of the peer.", HFILL
1920 { &hf_awdl_datastate_aw_sequence_counter,
1921 { "AW Sequence Counter", "awdl.datastate.aw_sequence_counter",
1922 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL
1925 { &hf_awdl_datastate_update_counter,
1926 { "Update Counter", "awdl.datastate.update_counter",
1927 FT_UINT32, BASE_DEC, NULL, 0,
1928 "Incremented by one on every AF change.", HFILL
1932 /* Arpa */
1933 { &hf_awdl_arpa,
1934 { "Arpa", "awdl.arpa",
1935 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL
1938 { &hf_awdl_arpa_name,
1939 { "Host", "awdl.arpa.host",
1940 FT_UINT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
1943 { &hf_awdl_arpa_flags,
1944 { "Flags", "awdl.arpa.flags",
1945 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
1948 { &hf_awdl_arpa_short,
1949 { "Domain (compressed)", "awdl.arpa.domain",
1950 FT_UINT16, BASE_HEX, VALS(awdl_dns_compression), 0, NULL, HFILL
1954 /* Synchronization Parameters */
1955 { &hf_awdl_syncparams_awcounter,
1956 { "AW Sequence Number", "awdl.syncparams.awseqcounter",
1957 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
1960 { &hf_awdl_syncparams_apbeaconalignment,
1961 { "AP Beacon alignment delta", "awdl.syncparams.apbeaconalignment",
1962 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
1965 { &hf_awdl_syncparams_master,
1966 { "Master Address", "awdl.syncparams.master",
1967 FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL
1970 { &hf_awdl_syncparams_tx_chan,
1971 { "Next AW Channel", "awdl.syncparams.txchannel",
1972 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
1975 { &hf_awdl_syncparams_tx_counter,
1976 { "Tx Counter", "awdl.syncparams.txcounter",
1977 FT_UINT16, BASE_DEC | BASE_UNIT_STRING, UNS(&units_ieee80211_tu), 0x0,
1978 "Time until next AW starts", HFILL
1981 { &hf_awdl_syncparams_master_chan,
1982 { "Master Channel", "awdl.syncparams.masterchan",
1983 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
1986 { &hf_awdl_syncparams_guard_time,
1987 { "Guard Time", "awdl.syncparams.guardtime",
1988 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
1991 { &hf_awdl_syncparams_aw_period,
1992 { "Availability Window Period", "awdl.syncparams.awperiod",
1993 FT_UINT16, BASE_DEC | BASE_UNIT_STRING, UNS(&units_ieee80211_tu), 0x0, NULL, HFILL
1996 { &hf_awdl_syncparams_action_frame_period,
1997 { "Action Frame Period", "awdl.syncparams.afperiod",
1998 FT_UINT16, BASE_DEC | BASE_UNIT_STRING, UNS(&units_ieee80211_tu), 0x0, NULL, HFILL
2001 { &hf_awdl_syncparams_awdl_flags,
2002 { "AWDL Flags", "awdl.syncparams.awdlflags",
2003 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
2006 { &hf_awdl_syncparams_aw_ext_length,
2007 { "Availability Window Extension Length", "awdl.syncparams.aw.ext_len",
2008 FT_UINT16, BASE_DEC | BASE_UNIT_STRING, UNS(&units_ieee80211_tu), 0x0, NULL, HFILL
2011 { &hf_awdl_syncparams_aw_cmn_length,
2012 { "Availability Window Common Length", "awdl.syncparams.aw.common_len",
2013 FT_UINT16, BASE_DEC | BASE_UNIT_STRING, UNS(&units_ieee80211_tu), 0x0, NULL, HFILL
2016 { &hf_awdl_syncparams_aw_remaining,
2017 { "Remaining Availability Window Length", "awdl.syncparams.aw.remaining",
2018 FT_INT16, BASE_DEC | BASE_UNIT_STRING, UNS(&units_ieee80211_tu), 0x0, NULL, HFILL
2021 { &hf_awdl_syncparams_ext_min,
2022 { "Minimum Extension Count", "awdl.syncparams.ext.min",
2023 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
2026 { &hf_awdl_syncparams_ext_max_multi,
2027 { "Maximum Extension Count for Multicast", "awdl.syncparams.ext.max_multicast",
2028 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
2031 { &hf_awdl_syncparams_ext_max_uni,
2032 { "Maximum Extension Count for Unicast", "awdl.syncparams.ext.max_unicast",
2033 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
2036 { &hf_awdl_syncparams_ext_max_af,
2037 { "Maximum Extension Count for Action Frame", "awdl.syncparams.ext.max_af",
2038 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
2041 { &hf_awdl_syncparams_presence_mode,
2042 { "Presence Mode", "awdl.syncparams.presencemode",
2043 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
2047 /* Channel Sequence */
2048 { &hf_awdl_channelseq_channel_count,
2049 { "Number of Channels (+1)", "awdl.channelseq.channels",
2050 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
2053 { &hf_awdl_channelseq_enc,
2054 { "Encoding", "awdl.channelseq.encoding",
2055 FT_UINT8, BASE_DEC, VALS(awdl_chanseq_enc), 0x0, NULL, HFILL
2058 { &hf_awdl_channelseq_duplicate,
2059 { "Duplicate", "awdl.channelseq.duplicate",
2060 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
2063 { &hf_awdl_channelseq_step_count,
2064 { "Step Count (+1)", "awdl.channelseq.step_count",
2065 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
2068 { &hf_awdl_channelseq_fill_chan,
2069 { "Fill Channel", "awdl.channelseq.fill_channel",
2070 FT_UINT16, BASE_HEX, VALS(awdl_chanseq_fill_chan), 0x0, NULL, HFILL
2073 { &hf_awdl_channelseq_channel_list,
2074 { "Channel List", "awdl.channelseq.channel_list",
2075 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL
2078 { &hf_awdl_channelseq_channel,
2079 { "Channel", "awdl.channelseq.channel",
2080 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
2083 { &hf_awdl_channelseq_channel_number,
2084 { "Channel Number", "awdl.channelseq.channel.number",
2085 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL
2088 { &hf_awdl_channelseq_channel_operating_class,
2089 { "Operating Class", "awdl.channelseq.channel.operating_class",
2090 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
2093 { &hf_awdl_channelseq_channel_flags,
2094 { "Channel Flags", "awdl.channelseq.channel.flags",
2095 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
2098 { &hf_awdl_channelseq_legacy_unused,
2099 { "Unused", "awdl.channelseq.channel.unused",
2100 FT_UINT8, BASE_DEC, NULL, 0xc0, NULL, HFILL
2103 { &hf_awdl_channelseq_legacy_band,
2104 { "Band", "awdl.channelseq.channel.band",
2105 FT_UINT8, BASE_DEC, VALS(awdl_chanseq_band), 0x30, NULL, HFILL
2108 { &hf_awdl_channelseq_legacy_bandwidth,
2109 { "Bandwidth", "awdl.channelseq.channel.bandwidth",
2110 FT_UINT8, BASE_DEC, VALS(awdl_chanseq_bandwidth), 0x0c, NULL, HFILL
2113 { &hf_awdl_channelseq_legacy_control_channel,
2114 { "Control Channel", "awdl.channelseq.channel.control_channel",
2115 FT_UINT8, BASE_DEC, VALS(awdl_chanseq_control_channel), 0x03, NULL, HFILL
2119 /* Election Parameters */
2120 { &hf_awdl_electionparams_private_master,
2121 { "Private Master Address", "awdl.electionparams.private.master",
2122 FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL
2125 { &hf_awdl_electionparams_master,
2126 { "Master Address", "awdl.electionparams.master",
2127 FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL
2130 { &hf_awdl_electionparams_flags,
2131 { "Flags", "awdl.electionparams.flags",
2132 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
2135 { &hf_awdl_electionparams_id,
2136 { "ID", "awdl.electionparams.id",
2137 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
2140 { &hf_awdl_electionparams_distance,
2141 { "Distance to Master", "awdl.electionparams.distance",
2142 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
2145 { &hf_awdl_electionparams_mastermetric,
2146 { "Master Metric", "awdl.electionparams.mastermetric",
2147 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
2150 { &hf_awdl_electionparams_selfmetric,
2151 { "Self Metric", "awdl.electionparams.selfmetric",
2152 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
2155 { &hf_awdl_electionparams_unknown,
2156 { "Unknown", "awdl.electionparams.unknown",
2157 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
2160 { &hf_awdl_electionparams_private_mastermetric,
2161 { "Private Master Metric", "awdl.electionparams.private.mastermetric",
2162 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
2165 { &hf_awdl_electionparams_private_id,
2166 { "Private ID", "awdl.electionparams.private.id",
2167 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
2170 { &hf_awdl_electionparams_private_phc,
2171 { "PHC", "awdl.electionparams.private.phc",
2172 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
2176 /* Election Parameter v2 */
2177 { &hf_awdl_electionparams2_master,
2178 { "Master Address", "awdl.electionparams2.master",
2179 FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL
2182 { &hf_awdl_electionparams2_other,
2183 { "Other Address", "awdl.electionparams2.other",
2184 FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL
2187 { &hf_awdl_electionparams2_mastermetric,
2188 { "Master Metric", "awdl.electionparams2.mastermetric",
2189 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
2192 { &hf_awdl_electionparams2_selfmetric,
2193 { "Self Metric", "awdl.electionparams2.selfmetric",
2194 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
2197 { &hf_awdl_electionparams2_mastercounter,
2198 { "Master Counter", "awdl.electionparams2.mastercounter",
2199 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
2202 { &hf_awdl_electionparams2_selfcounter,
2203 { "Self Counter", "awdl.electionparams2.selfcounter",
2204 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
2207 { &hf_awdl_electionparams2_distance,
2208 { "Distance to Master", "awdl.electionparams2.disstance",
2209 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
2212 { &hf_awdl_electionparams2_reserved,
2213 { "Reserved", "awdl.electionparams2.reserved",
2214 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
2217 { &hf_awdl_electionparams2_unknown,
2218 { "Unknown", "awdl.electionparams2.unknown",
2219 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
2223 /* Service Response */
2224 { &hf_awdl_dns_name_len,
2225 { "Name Length", "awdl.dns.name.len",
2226 FT_UINT16, BASE_DEC, NULL, 0x0,
2227 "Includes length of type field", HFILL
2230 { &hf_awdl_dns_name,
2231 { "Name", "awdl.dns.name",
2232 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL
2235 { &hf_awdl_dns_name_label,
2236 { "Label", "awdl.dns.name.label",
2237 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
2238 "Part of a name", HFILL
2241 { &hf_awdl_dns_name_short,
2242 { "Label (compressed)", "awdl.dns.name.compressed",
2243 FT_UINT16, BASE_HEX, VALS(awdl_dns_compression), 0x0,
2244 "Part of a name", HFILL
2247 { &hf_awdl_dns_type,
2248 { "Type", "awdl.dns.type",
2249 FT_UINT8, BASE_DEC, VALS(dns_types_vals), 0x0, NULL, HFILL
2252 { &hf_awdl_dns_data_len,
2253 { "Data Length", "awdl.dns.data_len",
2254 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
2257 { &hf_awdl_dns_txt,
2258 { "TXT", "awdl.dns.txt",
2259 FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL
2262 { &hf_awdl_dns_ptr,
2263 { "Domain Name", "awdl.dns.ptr",
2264 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL
2267 { &hf_awdl_dns_ptr_label,
2268 { "Label", "awdl.dns.ptr.label",
2269 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
2270 "Part of a domain name", HFILL
2273 { &hf_awdl_dns_ptr_short,
2274 { "Label (compressed)", "awdl.dns.ptr.short",
2275 FT_UINT16, BASE_HEX, VALS(awdl_dns_compression), 0x0,
2276 "Part of a domain name", HFILL
2279 { &hf_awdl_dns_target,
2280 { "Target", "awdl.dns.target",
2281 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL
2284 { &hf_awdl_dns_target_label,
2285 { "Label", "awdl.dns.target.label",
2286 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
2287 "Part of a target", HFILL
2290 { &hf_awdl_dns_target_short,
2291 { "Label (compressed)", "awdl.dns.target.compressed",
2292 FT_UINT16, BASE_HEX, VALS(awdl_dns_compression), 0x0,
2293 "Part of a target", HFILL
2296 { &hf_awdl_dns_unknown,
2297 { "Unknown", "awdl.dns.unknown",
2298 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL
2301 { &hf_awdl_dns_priority,
2302 { "Priority", "awdl.dns.priority",
2303 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL
2306 { &hf_awdl_dns_weight,
2307 { "Weight", "awdl.dns.weight",
2308 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL
2311 { &hf_awdl_dns_port,
2312 { "Port", "awdl.dns.port",
2313 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL
2317 /* Service Parameters */
2318 { &hf_awdl_serviceparams_sui,
2319 { "SUI", "awdl.serviceparams.sui",
2320 FT_UINT16, BASE_DEC, NULL, 0x0,
2321 "Incremented by 1 for every service announcement change (should cause cache flush at receivers)", HFILL
2324 { &hf_awdl_serviceparams_enc_values,
2325 { "Encoded Values", "awdl.serviceparams.enc_values",
2326 FT_NONE, BASE_NONE, NULL, 0,
2327 "Encodes up to 256 unique 1-byte values. Calculation adds offsets to values.", HFILL
2330 { &hf_awdl_serviceparams_bitmask,
2331 { "Offsets", "awdl.serviceparams.bitmask",
2332 FT_UINT32, BASE_HEX, NULL, 0x0,
2333 "Offset is 8*i if i-th bit is set", HFILL
2336 /* Generate with Python
2337 * size = 32
2338 * for i in range(size):
2339 * print('{{ &hf_awdl_serviceparams_bitmask_{},'.format(i))
2340 * print(' {{ "{}", "awdl.serviceparams.bitmask.{}",'.format(i, i))
2341 * print(' FT_BOOLEAN, {}, NULL, {}, NULL, HFILL'.format(size, hex(1 << i)))
2342 * print(' }}'.format())
2343 * print('}},'.format())
2345 { &hf_awdl_serviceparams_bitmask_0,
2346 { "0", "awdl.serviceparams.bitmask.0",
2347 FT_BOOLEAN, 32, NULL, 0x00000001, NULL, HFILL
2350 { &hf_awdl_serviceparams_bitmask_1,
2351 { "1", "awdl.serviceparams.bitmask.1",
2352 FT_BOOLEAN, 32, NULL, 0x00000002, NULL, HFILL
2355 { &hf_awdl_serviceparams_bitmask_2,
2356 { "2", "awdl.serviceparams.bitmask.2",
2357 FT_BOOLEAN, 32, NULL, 0x00000004, NULL, HFILL
2360 { &hf_awdl_serviceparams_bitmask_3,
2361 { "3", "awdl.serviceparams.bitmask.3",
2362 FT_BOOLEAN, 32, NULL, 0x00000008, NULL, HFILL
2365 { &hf_awdl_serviceparams_bitmask_4,
2366 { "4", "awdl.serviceparams.bitmask.4",
2367 FT_BOOLEAN, 32, NULL, 0x00000010, NULL, HFILL
2370 { &hf_awdl_serviceparams_bitmask_5,
2371 { "5", "awdl.serviceparams.bitmask.5",
2372 FT_BOOLEAN, 32, NULL, 0x00000020, NULL, HFILL
2375 { &hf_awdl_serviceparams_bitmask_6,
2376 { "6", "awdl.serviceparams.bitmask.6",
2377 FT_BOOLEAN, 32, NULL, 0x00000040, NULL, HFILL
2380 { &hf_awdl_serviceparams_bitmask_7,
2381 { "7", "awdl.serviceparams.bitmask.7",
2382 FT_BOOLEAN, 32, NULL, 0x00000080, NULL, HFILL
2385 { &hf_awdl_serviceparams_bitmask_8,
2386 { "8", "awdl.serviceparams.bitmask.8",
2387 FT_BOOLEAN, 32, NULL, 0x00000100, NULL, HFILL
2390 { &hf_awdl_serviceparams_bitmask_9,
2391 { "9", "awdl.serviceparams.bitmask.9",
2392 FT_BOOLEAN, 32, NULL, 0x00000200, NULL, HFILL
2395 { &hf_awdl_serviceparams_bitmask_10,
2396 { "10", "awdl.serviceparams.bitmask.10",
2397 FT_BOOLEAN, 32, NULL, 0x00000400, NULL, HFILL
2400 { &hf_awdl_serviceparams_bitmask_11,
2401 { "11", "awdl.serviceparams.bitmask.11",
2402 FT_BOOLEAN, 32, NULL, 0x00000800, NULL, HFILL
2405 { &hf_awdl_serviceparams_bitmask_12,
2406 { "12", "awdl.serviceparams.bitmask.12",
2407 FT_BOOLEAN, 32, NULL, 0x00001000, NULL, HFILL
2410 { &hf_awdl_serviceparams_bitmask_13,
2411 { "13", "awdl.serviceparams.bitmask.13",
2412 FT_BOOLEAN, 32, NULL, 0x00002000, NULL, HFILL
2415 { &hf_awdl_serviceparams_bitmask_14,
2416 { "14", "awdl.serviceparams.bitmask.14",
2417 FT_BOOLEAN, 32, NULL, 0x00004000, NULL, HFILL
2420 { &hf_awdl_serviceparams_bitmask_15,
2421 { "15", "awdl.serviceparams.bitmask.15",
2422 FT_BOOLEAN, 32, NULL, 0x00008000, NULL, HFILL
2425 { &hf_awdl_serviceparams_bitmask_16,
2426 { "16", "awdl.serviceparams.bitmask.16",
2427 FT_BOOLEAN, 32, NULL, 0x00010000, NULL, HFILL
2430 { &hf_awdl_serviceparams_bitmask_17,
2431 { "17", "awdl.serviceparams.bitmask.17",
2432 FT_BOOLEAN, 32, NULL, 0x00020000, NULL, HFILL
2435 { &hf_awdl_serviceparams_bitmask_18,
2436 { "18", "awdl.serviceparams.bitmask.18",
2437 FT_BOOLEAN, 32, NULL, 0x00040000, NULL, HFILL
2440 { &hf_awdl_serviceparams_bitmask_19,
2441 { "19", "awdl.serviceparams.bitmask.19",
2442 FT_BOOLEAN, 32, NULL, 0x00080000, NULL, HFILL
2445 { &hf_awdl_serviceparams_bitmask_20,
2446 { "20", "awdl.serviceparams.bitmask.20",
2447 FT_BOOLEAN, 32, NULL, 0x00100000, NULL, HFILL
2450 { &hf_awdl_serviceparams_bitmask_21,
2451 { "21", "awdl.serviceparams.bitmask.21",
2452 FT_BOOLEAN, 32, NULL, 0x00200000, NULL, HFILL
2455 { &hf_awdl_serviceparams_bitmask_22,
2456 { "22", "awdl.serviceparams.bitmask.22",
2457 FT_BOOLEAN, 32, NULL, 0x00400000, NULL, HFILL
2460 { &hf_awdl_serviceparams_bitmask_23,
2461 { "23", "awdl.serviceparams.bitmask.23",
2462 FT_BOOLEAN, 32, NULL, 0x00800000, NULL, HFILL
2465 { &hf_awdl_serviceparams_bitmask_24,
2466 { "24", "awdl.serviceparams.bitmask.24",
2467 FT_BOOLEAN, 32, NULL, 0x01000000, NULL, HFILL
2470 { &hf_awdl_serviceparams_bitmask_25,
2471 { "25", "awdl.serviceparams.bitmask.25",
2472 FT_BOOLEAN, 32, NULL, 0x02000000, NULL, HFILL
2475 { &hf_awdl_serviceparams_bitmask_26,
2476 { "26", "awdl.serviceparams.bitmask.26",
2477 FT_BOOLEAN, 32, NULL, 0x04000000, NULL, HFILL
2480 { &hf_awdl_serviceparams_bitmask_27,
2481 { "27", "awdl.serviceparams.bitmask.27",
2482 FT_BOOLEAN, 32, NULL, 0x08000000, NULL, HFILL
2485 { &hf_awdl_serviceparams_bitmask_28,
2486 { "28", "awdl.serviceparams.bitmask.28",
2487 FT_BOOLEAN, 32, NULL, 0x10000000, NULL, HFILL
2490 { &hf_awdl_serviceparams_bitmask_29,
2491 { "29", "awdl.serviceparams.bitmask.29",
2492 FT_BOOLEAN, 32, NULL, 0x20000000, NULL, HFILL
2495 { &hf_awdl_serviceparams_bitmask_30,
2496 { "30", "awdl.serviceparams.bitmask.30",
2497 FT_BOOLEAN, 32, NULL, 0x40000000, NULL, HFILL
2500 { &hf_awdl_serviceparams_bitmask_31,
2501 { "31", "awdl.serviceparams.bitmask.31",
2502 FT_BOOLEAN, 32, NULL, 0x80000000, NULL, HFILL
2505 { &hf_awdl_serviceparams_values,
2506 { "Values", "awdl.serviceparams.values",
2507 FT_UINT8, BASE_HEX, NULL, 0,
2508 "Value is i if i-th bit is set", HFILL
2511 { &hf_awdl_serviceparams_values_0,
2512 { "0", "awdl.serviceparams.values.0",
2513 FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
2516 { &hf_awdl_serviceparams_values_1,
2517 { "1", "awdl.serviceparams.values.1",
2518 FT_BOOLEAN, 8, NULL, 0x2, NULL, HFILL
2521 { &hf_awdl_serviceparams_values_2,
2522 { "2", "awdl.serviceparams.values.2",
2523 FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL
2526 { &hf_awdl_serviceparams_values_3,
2527 { "3", "awdl.serviceparams.values.3",
2528 FT_BOOLEAN, 8, NULL, 0x8, NULL, HFILL
2531 { &hf_awdl_serviceparams_values_4,
2532 { "4", "awdl.serviceparams.values.4",
2533 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
2536 { &hf_awdl_serviceparams_values_5,
2537 { "5", "awdl.serviceparams.values.5",
2538 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL
2541 { &hf_awdl_serviceparams_values_6,
2542 { "6", "awdl.serviceparams.values.6",
2543 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL
2546 { &hf_awdl_serviceparams_values_7,
2547 { "7", "awdl.serviceparams.values.7",
2548 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL
2552 /* HT Capabilities */
2553 { &hf_awdl_ht_unknown,
2554 { "Unknown", "awdl.ht.unknown",
2555 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
2558 /* hf_ieee80211_* from packet-ieee80211.c */
2559 { &hf_awdl_ht_cap,
2560 { "HT Capabilities Info", "awdl.ht.capabilities",
2561 FT_UINT16, BASE_HEX, NULL, 0, "HT Capabilities information", HFILL
2564 { &hf_awdl_ht_ldpc_coding,
2565 { "HT LDPC coding capability", "awdl.ht.capabilities.ldpccoding",
2566 FT_BOOLEAN, 16, TFS(&ht_ldpc_coding_flag), 0x0001, NULL, HFILL
2569 { &hf_awdl_ht_chan_width,
2570 { "HT Support channel width", "awdl.ht.capabilities.width",
2571 FT_BOOLEAN, 16, TFS(&ht_chan_width_flag), 0x0002, NULL, HFILL
2574 { &hf_awdl_ht_sm_pwsave,
2575 { "HT SM Power Save", "awdl.ht.capabilities.sm",
2576 FT_UINT16, BASE_HEX, VALS(ht_sm_pwsave_flag), 0x000c, NULL, HFILL
2579 { &hf_awdl_ht_green,
2580 { "HT Green Field", "awdl.ht.capabilities.green",
2581 FT_BOOLEAN, 16, TFS(&ht_green_flag), 0x0010, NULL, HFILL
2584 { &hf_awdl_ht_short20,
2585 { "HT Short GI for 20MHz", "awdl.ht.capabilities.short20",
2586 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x0020, NULL, HFILL
2589 { &hf_awdl_ht_short40,
2590 { "HT Short GI for 40MHz", "awdl.ht.capabilities.short40",
2591 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x0040, NULL, HFILL
2594 { &hf_awdl_ht_tx_stbc,
2595 { "HT Tx STBC", "awdl.ht.capabilities.txstbc",
2596 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x0080, NULL, HFILL
2599 { &hf_awdl_ht_rx_stbc,
2600 { "HT Rx STBC", "awdl.ht.capabilities.rxstbc",
2601 FT_UINT16, BASE_HEX, VALS(ht_rx_stbc_flag), 0x0300, "HT Tx STBC", HFILL
2604 { &hf_awdl_ht_delayed_block_ack,
2605 { "HT Delayed Block ACK", "awdl.ht.capabilities.delayedblockack",
2606 FT_BOOLEAN, 16, TFS(&ht_delayed_block_ack_flag), 0x0400, NULL, HFILL
2609 { &hf_awdl_ht_max_amsdu,
2610 { "HT Max A-MSDU length", "awdl.ht.capabilities.amsdu",
2611 FT_BOOLEAN, 16, TFS(&ht_max_amsdu_flag), 0x0800, NULL, HFILL
2614 { &hf_awdl_ht_dss_cck_40,
2615 { "HT DSSS/CCK mode in 40MHz", "awdl.ht.capabilities.dsscck",
2616 FT_BOOLEAN, 16, TFS(&ht_dss_cck_40_flag), 0x1000, "HT DSS/CCK mode in 40MHz", HFILL
2619 { &hf_awdl_ht_psmp,
2620 { "HT PSMP Support", "awdl.ht.capabilities.psmp",
2621 FT_BOOLEAN, 16, TFS(&ht_psmp_flag), 0x2000, NULL, HFILL
2624 { &hf_awdl_ht_40_mhz_intolerant,
2625 { "HT Forty MHz Intolerant", "awdl.ht.capabilities.40mhzintolerant",
2626 FT_BOOLEAN, 16, TFS(&ht_40_mhz_intolerant_flag), 0x4000, NULL, HFILL
2629 { &hf_awdl_ht_l_sig,
2630 { "HT L-SIG TXOP Protection support", "awdl.ht.capabilities.lsig",
2631 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x8000, NULL, HFILL
2634 { &hf_awdl_ampduparam,
2635 { "A-MPDU Parameters", "awdl.ht.ampduparam",
2636 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
2639 { &hf_awdl_ampduparam_mpdu,
2640 { "Maximum Rx A-MPDU Length", "awdl.ht.ampduparam.maxlength",
2641 FT_UINT8, BASE_HEX, 0, 0x03, NULL, HFILL
2644 { &hf_awdl_ampduparam_mpdu_start_spacing,
2645 { "MPDU Density", "awdl.ht.ampduparam.mpdudensity",
2646 FT_UINT8, BASE_HEX, VALS(ampduparam_mpdu_start_spacing_flags), 0x1c, NULL, HFILL
2649 { &hf_awdl_ampduparam_reserved,
2650 { "Reserved", "awdl.ht.ampduparam.reserved",
2651 FT_UINT8, BASE_HEX, NULL, 0xE0, NULL, HFILL
2654 { &hf_awdl_mcsset,
2655 { "Rx Supported Modulation and Coding Scheme Set", "awdl.ht.mcsset",
2656 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL
2659 { &hf_awdl_mcsset_rx_bitmask,
2660 { "Rx Modulation and Coding Scheme (One bit per modulation)", "awdl.ht.mcsset.rxbitmask",
2661 FT_NONE, BASE_NONE, NULL, 0, "One bit per modulation", HFILL
2664 { &hf_awdl_mcsset_rx_bitmask_0to7,
2665 { "Rx Bitmask Bits 0-7", "awdl.ht.mcsset.rxbitmask.0to7",
2666 FT_UINT32, BASE_HEX, 0, 0x000000ff, NULL, HFILL
2669 { &hf_awdl_mcsset_rx_bitmask_8to15,
2670 { "Rx Bitmask Bits 8-15", "awdl.ht.mcsset.rxbitmask.8to15",
2671 FT_UINT32, BASE_HEX, 0, 0x0000ff00, NULL, HFILL
2674 { &hf_awdl_mcsset_rx_bitmask_16to23,
2675 { "Rx Bitmask Bits 16-23", "awdl.ht.mcsset.rxbitmask.16to23",
2676 FT_UINT32, BASE_HEX, 0, 0x00ff0000, NULL, HFILL
2679 { &hf_awdl_mcsset_rx_bitmask_24to31,
2680 { "Rx Bitmask Bits 24-31", "awdl.ht.mcsset.rxbitmask.24to31",
2681 FT_UINT32, BASE_HEX, 0, 0xff000000, NULL, HFILL
2686 static hf_register_info hf_apple_awdl_pid[] = {
2687 { &hf_llc_apple_awdl_pid,
2688 { "PID", "llc.apple_awdl_pid",
2689 FT_UINT16, BASE_HEX, VALS(apple_awdl_pid_vals), 0x0, "Protocol ID", HFILL }
2693 /* Setup protocol subtree array */
2694 static int *ett[] = {
2695 &ett_awdl_data,
2696 &ett_awdl,
2697 &ett_awdl_fixed_parameters,
2698 &ett_awdl_tagged_parameters,
2699 &ett_awdl_unknown,
2700 &ett_awdl_tag,
2701 &ett_awdl_channelseq_flags,
2702 &ett_awdl_version,
2703 &ett_awdl_dns_record,
2704 &ett_awdl_dns_name,
2705 &ett_awdl_channelseq_channel_list,
2706 &ett_awdl_channelseq_channel,
2707 &ett_awdl_datastate_flags,
2708 &ett_awdl_datastate_social_channel_map,
2709 &ett_awdl_datastate_extflags,
2710 &ett_awdl_ht_capabilities,
2711 &ett_awdl_ht_ampduparam,
2712 &ett_awdl_ht_mcsset_tree,
2713 &ett_awdl_ht_mcsbit_tree,
2714 &ett_awdl_serviceparams_bitmask,
2715 &ett_awdl_serviceparams_values,
2716 &ett_awdl_serviceparams_value,
2719 static ei_register_info ei[] = {
2720 { &ei_awdl_tag_length,
2721 { "awdl.tag.length.bad", PI_MALFORMED, PI_ERROR,
2722 "Bad tag length", EXPFILL
2725 { &ei_awdl_tag_data,
2726 { "awdl.tag.data.undecoded", PI_UNDECODED, PI_NOTE,
2727 "Dissector for AWDL tag code not implemented", EXPFILL
2730 { &ei_awdl_dns_data_len,
2731 { "awdl.dns.data_len.bad", PI_MALFORMED, PI_ERROR,
2732 "Bad DNS data length", EXPFILL
2737 expert_module_t *expert_awdl;
2739 proto_awdl_data = proto_register_protocol("Apple Wireless Direct Link data frame", "AWDL data", "awdl_data");
2740 awdl_data_handle = register_dissector("awdl_data", dissect_awdl_data, proto_awdl_data);
2742 proto_awdl = proto_register_protocol("Apple Wireless Direct Link action frame", "AWDL", "awdl");
2743 awdl_action_handle = register_dissector("awdl", dissect_awdl_action, proto_awdl);
2745 expert_awdl = expert_register_protocol(proto_awdl);
2746 expert_register_field_array(expert_awdl, ei, array_length(ei));
2748 tagged_field_table = register_dissector_table("awdl.tag.number", "AWDL Tags", proto_awdl, FT_UINT8, BASE_DEC);
2749 awdl_register_tags();
2751 proto_register_field_array(proto_awdl_data, hf, array_length(hf));
2752 proto_register_subtree_array(ett, array_length(ett));
2754 llc_add_oui(OUI_APPLE_AWDL, "llc.apple_awdl_pid", "LLC Apple AWDL OUI PID", hf_apple_awdl_pid, -1);
2757 void proto_reg_handoff_awdl(void) {
2758 dissector_add_uint("wlan.action.vendor_specific", OUI_APPLE_AWDL, awdl_action_handle);
2759 dissector_add_uint("llc.apple_awdl_pid", 0x0800, awdl_data_handle);
2761 ethertype_subdissector_table = find_dissector_table("ethertype");
2765 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2767 * Local variables:
2768 * c-basic-offset: 2
2769 * tab-width: 8
2770 * indent-tabs-mode: nil
2771 * End:
2773 * vi: set shiftwidth=2 tabstop=8 expandtab:
2774 * :indentSize=2:tabSize=8:noTabs=true: