Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-wifi-display.c
blob7d27ed1503576a1f00d6388116d67c5295cb38de
1 /* packet-wifi-display.c
3 * Wi-Fi Display
5 * Copyright 2011-2013 Qualcomm Atheros, Inc.
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
10 # include "config.h"
12 #include <epan/packet.h>
13 #include <epan/to_str.h>
14 #include <epan/expert.h>
15 #include <epan/tfs.h>
16 #include <wsutil/array.h>
18 #include "packet-ieee80211.h"
20 void proto_register_wifi_display(void);
21 void proto_reg_handoff_wifi_display(void);
23 static int proto_wifi_display;
25 static int hf_wfd_subelem_id;
26 static int hf_wfd_subelem_len;
28 static int hf_wfd_subelem_dev_info_type;
29 static int hf_wfd_subelem_dev_info_coupled_sink_source;
30 static int hf_wfd_subelem_dev_info_coupled_sink_sink;
31 static int hf_wfd_subelem_dev_info_available;
32 static int hf_wfd_subelem_dev_info_wsd;
33 static int hf_wfd_subelem_dev_info_pc;
34 static int hf_wfd_subelem_dev_info_content_protection;
35 static int hf_wfd_subelem_dev_info_time_sync;
36 static int hf_wfd_subelem_dev_info_control_port;
37 static int hf_wfd_subelem_dev_info_max_throughput;
38 static int hf_wfd_subelem_dev_info_audio_unsupp_pri_sink;
39 static int hf_wfd_subelem_dev_info_audio_only_supp_source;
40 static int hf_wfd_subelem_dev_info_tdls_persistent_group;
41 static int hf_wfd_subelem_dev_info_tdls_persistent_group_reinvoke;
42 static int hf_wfd_subelem_dev_info_reserved;
44 static int hf_wfd_subelem_assoc_bssid;
46 static int hf_wfd_subelem_coupled_sink_status_bitmap;
47 static int hf_wfd_subelem_coupled_sink_reserved;
48 static int hf_wfd_subelem_coupled_sink_mac_addr;
50 static int hf_wfd_subelem_session_descr_len;
51 static int hf_wfd_subelem_session_dev_addr;
52 static int hf_wfd_subelem_session_assoc_bssid;
53 static int hf_wfd_subelem_session_dev_info_type;
54 static int hf_wfd_subelem_session_dev_info_coupled_sink_source;
55 static int hf_wfd_subelem_session_dev_info_coupled_sink_sink;
56 static int hf_wfd_subelem_session_dev_info_available;
57 static int hf_wfd_subelem_session_dev_info_wsd;
58 static int hf_wfd_subelem_session_dev_info_pc;
59 static int hf_wfd_subelem_session_dev_info_content_protection;
60 static int hf_wfd_subelem_session_dev_info_time_sync;
61 static int hf_wfd_subelem_session_dev_info_audio_unsupp_pri_sink;
62 static int hf_wfd_subelem_session_dev_info_audio_only_supp_source;
63 static int hf_wfd_subelem_session_dev_info_tdls_persistent_group;
64 static int hf_wfd_subelem_session_dev_info_tdls_persistent_group_reinvoke;
65 static int hf_wfd_subelem_session_dev_info_reserved;
66 static int hf_wfd_subelem_session_dev_info_max_throughput;
67 static int hf_wfd_subelem_session_coupled_sink_status_bitmap;
68 static int hf_wfd_subelem_session_coupled_sink_reserved;
69 static int hf_wfd_subelem_session_coupled_sink_addr;
70 static int hf_wfd_subelem_session_extra_info;
72 static int hf_wfd_subelem_ext_capab;
73 static int hf_wfd_subelem_ext_capab_uibc;
74 static int hf_wfd_subelem_ext_capab_i2c_read_write;
75 static int hf_wfd_subelem_ext_capab_preferred_display_mode;
76 static int hf_wfd_subelem_ext_capab_standby_resume_control;
77 static int hf_wfd_subelem_ext_capab_tdls_persistent;
78 static int hf_wfd_subelem_ext_capab_tdls_persistent_bssid;
79 static int hf_wfd_subelem_ext_capab_reserved;
81 static int hf_wfd_subelem_alt_mac_addr;
83 static int ett_wfd_subelem;
84 static int ett_wfd_dev_info_descr;
86 static expert_field ei_wfd_subelem_len_invalid;
87 static expert_field ei_wfd_subelem_session_descr_invalid;
88 static expert_field ei_wfd_subelem_id;
90 static dissector_handle_t wifi_display_ie_handle;
92 enum wifi_display_subelem {
93 WFD_SUBELEM_DEVICE_INFO = 0,
94 WFD_SUBELEM_ASSOCIATED_BSSID = 1,
95 WFD_SUBELEM_AUDIO_FORMATS = 2,
96 WFD_SUBELEM_VIDEO_FORMATS = 3,
97 WFD_SUBELEM_3D_VIDEO_FORMATS = 4,
98 WFD_SUBELEM_CONTENT_PROTECTION = 5,
99 WFD_SUBELEM_COUPLED_SINK = 6,
100 WFD_SUBELEM_EXT_CAPAB = 7,
101 WFD_SUBELEM_LOCAL_IP_ADDRESS = 8,
102 WFD_SUBELEM_SESSION_INFO = 9,
103 WFD_SUBELEM_ALT_MAC_ADDR = 10
106 static const value_string wfd_subelem_ids[] = {
107 { WFD_SUBELEM_DEVICE_INFO, "WFD Device Information" },
108 { WFD_SUBELEM_ASSOCIATED_BSSID, "Associated BSSID" },
109 { WFD_SUBELEM_AUDIO_FORMATS, "WFD Audio Formats" },
110 { WFD_SUBELEM_VIDEO_FORMATS, "WFD Video Formats" },
111 { WFD_SUBELEM_3D_VIDEO_FORMATS, "WFD 3D Video Formats" },
112 { WFD_SUBELEM_CONTENT_PROTECTION, "WFD Content Protection" },
113 { WFD_SUBELEM_COUPLED_SINK, "Coupled Sink Information" },
114 { WFD_SUBELEM_EXT_CAPAB, "WFD Extended Capability" },
115 { WFD_SUBELEM_LOCAL_IP_ADDRESS, "Local IP Address" },
116 { WFD_SUBELEM_SESSION_INFO, "WFD Session Information" },
117 { WFD_SUBELEM_ALT_MAC_ADDR, "Alternative MAC Address" },
118 { 0, NULL }
122 static const value_string wfd_dev_info_types[] = {
123 { 0, "WFD source" },
124 { 1, "WFD primary sink" },
125 { 2, "WFD secondary sink" },
126 { 3, "WFD source/primary sink" },
127 { 0, NULL }
130 static const value_string wfd_dev_info_avail[] = {
131 { 0, "Not available for WFD Session" },
132 { 1, "Available for WFD Session" },
133 { 0, NULL }
136 static const value_string wfd_dev_info_pc[] = {
137 { 0, "P2P" },
138 { 1, "TDLS" },
139 { 0, NULL }
142 static const value_string wfd_coupled_sink_status_bitmap[] = {
143 { 0, "Not coupled/Available for Coupling" },
144 { 1, "Coupled" },
145 { 2, "Teardown Coupling" },
146 { 3, "Reserved" },
147 { 0, NULL }
150 static void
151 dissect_wfd_subelem_device_info(proto_tree *tree, tvbuff_t *tvb, int offset)
153 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_type,
154 tvb, offset, 2, ENC_BIG_ENDIAN);
155 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_coupled_sink_source,
156 tvb, offset, 2, ENC_BIG_ENDIAN);
157 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_coupled_sink_sink,
158 tvb, offset, 2, ENC_BIG_ENDIAN);
159 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_available,
160 tvb, offset, 2, ENC_BIG_ENDIAN);
161 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_wsd,
162 tvb, offset, 2, ENC_BIG_ENDIAN);
163 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_pc,
164 tvb, offset, 2, ENC_BIG_ENDIAN);
165 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_content_protection,
166 tvb, offset, 2, ENC_BIG_ENDIAN);
167 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_time_sync,
168 tvb, offset, 2, ENC_BIG_ENDIAN);
169 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_audio_unsupp_pri_sink,
170 tvb, offset, 2, ENC_BIG_ENDIAN);
171 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_audio_only_supp_source,
172 tvb, offset, 2, ENC_BIG_ENDIAN);
173 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_tdls_persistent_group,
174 tvb, offset, 2, ENC_BIG_ENDIAN);
175 proto_tree_add_item(tree,
176 hf_wfd_subelem_dev_info_tdls_persistent_group_reinvoke,
177 tvb, offset, 2, ENC_BIG_ENDIAN);
178 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_reserved,
179 tvb, offset, 2, ENC_BIG_ENDIAN);
180 offset += 2;
182 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_control_port,
183 tvb, offset, 2, ENC_BIG_ENDIAN);
184 offset += 2;
186 proto_tree_add_item(tree, hf_wfd_subelem_dev_info_max_throughput,
187 tvb, offset, 2, ENC_BIG_ENDIAN);
190 static void
191 dissect_wfd_subelem_associated_bssid(packet_info *pinfo, proto_tree *tree,
192 tvbuff_t *tvb, int offset, int len)
194 if (len < 6) {
195 expert_add_info_format(pinfo, tree, &ei_wfd_subelem_len_invalid, "Too short Wi-Fi Display Associated BSSID");
196 return;
198 proto_tree_add_item(tree, hf_wfd_subelem_assoc_bssid, tvb, offset, 6, ENC_NA);
201 static void
202 dissect_wfd_subelem_coupled_sink(packet_info *pinfo, proto_tree *tree,
203 tvbuff_t *tvb, int offset, int len)
205 if (len < 1) {
206 expert_add_info_format(pinfo, tree, &ei_wfd_subelem_len_invalid, "Too short Wi-Fi Display Coupled Sink");
207 return;
209 proto_tree_add_item(tree, hf_wfd_subelem_coupled_sink_status_bitmap,
210 tvb, offset, 1, ENC_BIG_ENDIAN);
211 proto_tree_add_item(tree, hf_wfd_subelem_coupled_sink_reserved,
212 tvb, offset, 1, ENC_BIG_ENDIAN);
213 if (len < 1 + 6) {
214 expert_add_info_format(pinfo, tree, &ei_wfd_subelem_len_invalid, "Too short Wi-Fi Display Coupled Sink");
215 return;
217 proto_tree_add_item(tree, hf_wfd_subelem_coupled_sink_mac_addr, tvb,
218 offset + 1, 6, ENC_NA);
221 static void
222 dissect_wfd_subelem_session_info(packet_info *pinfo, proto_tree *tree,
223 tvbuff_t *tvb, int offset, uint16_t len)
225 int end = offset + len, next;
226 proto_item *item;
227 proto_tree *descr;
229 while (offset < end) {
230 uint8_t dlen = tvb_get_uint8(tvb, offset);
231 next = offset + 1 + dlen;
233 descr = proto_tree_add_subtree(tree, tvb, offset, 1 + dlen,
234 ett_wfd_dev_info_descr, &item, "WFD Device Info Descriptor");
235 if (offset + 1 + dlen > end || dlen < 23) {
236 expert_add_info(pinfo, item, &ei_wfd_subelem_session_descr_invalid);
237 break;
240 proto_tree_add_item(descr, hf_wfd_subelem_session_descr_len,
241 tvb, offset, 1, ENC_BIG_ENDIAN);
242 offset++;
244 proto_tree_add_item(descr, hf_wfd_subelem_session_dev_addr, tvb, offset, 6,
245 ENC_NA);
246 proto_item_append_text(descr, ": %s", tvb_ether_to_str(pinfo->pool, tvb, offset));
247 offset += 6;
249 proto_tree_add_item(descr, hf_wfd_subelem_session_assoc_bssid,
250 tvb, offset, 6, ENC_NA);
251 offset += 6;
253 proto_tree_add_item(descr, hf_wfd_subelem_session_dev_info_type,
254 tvb, offset, 2, ENC_BIG_ENDIAN);
255 proto_tree_add_item(descr,
256 hf_wfd_subelem_session_dev_info_coupled_sink_source,
257 tvb, offset, 2, ENC_BIG_ENDIAN);
258 proto_tree_add_item(descr,
259 hf_wfd_subelem_session_dev_info_coupled_sink_sink,
260 tvb, offset, 2, ENC_BIG_ENDIAN);
261 proto_tree_add_item(descr, hf_wfd_subelem_session_dev_info_available,
262 tvb, offset, 2, ENC_BIG_ENDIAN);
263 proto_tree_add_item(descr, hf_wfd_subelem_session_dev_info_wsd,
264 tvb, offset, 2, ENC_BIG_ENDIAN);
265 proto_tree_add_item(descr, hf_wfd_subelem_session_dev_info_pc,
266 tvb, offset, 2, ENC_BIG_ENDIAN);
267 proto_tree_add_item(descr,
268 hf_wfd_subelem_session_dev_info_content_protection,
269 tvb, offset, 2, ENC_BIG_ENDIAN);
270 proto_tree_add_item(descr, hf_wfd_subelem_session_dev_info_time_sync,
271 tvb, offset, 2, ENC_BIG_ENDIAN);
272 proto_tree_add_item(tree,
273 hf_wfd_subelem_session_dev_info_audio_unsupp_pri_sink,
274 tvb, offset, 2, ENC_BIG_ENDIAN);
275 proto_tree_add_item(tree,
276 hf_wfd_subelem_session_dev_info_audio_only_supp_source,
277 tvb, offset, 2, ENC_BIG_ENDIAN);
278 proto_tree_add_item(tree,
279 hf_wfd_subelem_session_dev_info_tdls_persistent_group,
280 tvb, offset, 2, ENC_BIG_ENDIAN);
281 proto_tree_add_item(tree,
282 hf_wfd_subelem_session_dev_info_tdls_persistent_group_reinvoke,
283 tvb, offset, 2, ENC_BIG_ENDIAN);
284 proto_tree_add_item(tree,
285 hf_wfd_subelem_session_dev_info_reserved,
286 tvb, offset, 2, ENC_BIG_ENDIAN);
287 offset += 2;
289 proto_tree_add_item(descr, hf_wfd_subelem_session_dev_info_max_throughput,
290 tvb, offset, 2, ENC_BIG_ENDIAN);
291 offset += 2;
293 proto_tree_add_item(descr,
294 hf_wfd_subelem_session_coupled_sink_status_bitmap,
295 tvb, offset, 1, ENC_BIG_ENDIAN);
296 proto_tree_add_item(descr,
297 hf_wfd_subelem_session_coupled_sink_reserved,
298 tvb, offset, 1, ENC_BIG_ENDIAN);
299 offset++;
301 proto_tree_add_item(descr, hf_wfd_subelem_session_coupled_sink_addr,
302 tvb, offset, 6, ENC_NA);
303 offset += 6;
305 if (offset < next) {
306 proto_tree_add_item(descr, hf_wfd_subelem_session_extra_info, tvb, offset, next - offset, ENC_NA);
309 offset = next;
313 static void
314 dissect_wfd_subelem_ext_capab(packet_info *pinfo, proto_tree *tree,
315 tvbuff_t *tvb, int offset, int len)
317 if (len<2) {
318 expert_add_info_format(pinfo, tree, &ei_wfd_subelem_len_invalid,
319 "Too short Wi-Fi Display Extended Capability");
320 return;
322 proto_tree_add_item(tree, hf_wfd_subelem_ext_capab,
323 tvb, offset, 2, ENC_BIG_ENDIAN);
324 proto_tree_add_item(tree, hf_wfd_subelem_ext_capab_uibc,
325 tvb, offset, 2, ENC_BIG_ENDIAN);
326 proto_tree_add_item(tree, hf_wfd_subelem_ext_capab_i2c_read_write,
327 tvb, offset, 2, ENC_BIG_ENDIAN);
328 proto_tree_add_item(tree, hf_wfd_subelem_ext_capab_preferred_display_mode,
329 tvb, offset, 2, ENC_BIG_ENDIAN);
330 proto_tree_add_item(tree, hf_wfd_subelem_ext_capab_standby_resume_control,
331 tvb, offset, 2, ENC_BIG_ENDIAN);
332 proto_tree_add_item(tree, hf_wfd_subelem_ext_capab_tdls_persistent,
333 tvb, offset, 2, ENC_BIG_ENDIAN);
334 proto_tree_add_item(tree, hf_wfd_subelem_ext_capab_tdls_persistent_bssid,
335 tvb, offset, 2, ENC_BIG_ENDIAN);
336 proto_tree_add_item(tree, hf_wfd_subelem_ext_capab_reserved,
337 tvb, offset, 2, ENC_BIG_ENDIAN);
340 static void
341 dissect_wfd_subelem_alt_mac_addr(packet_info *pinfo, proto_tree *tree,
342 tvbuff_t *tvb, int offset, int len)
344 if (len<6) {
345 expert_add_info_format(pinfo, tree, &ei_wfd_subelem_len_invalid,
346 "Too short Wi-Fi Display Alternative MAC Address");
347 return;
349 proto_tree_add_item(tree, hf_wfd_subelem_alt_mac_addr,
350 tvb, offset, 6, ENC_NA);
353 static int
354 dissect_wifi_display_ie(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
356 int end = tvb_reported_length(tvb);
357 int offset = 0;
358 uint8_t id;
359 uint16_t len;
360 proto_tree *wfd_tree;
361 proto_item *subelem;
363 while (offset < end) {
364 if (end - offset < 2) {
365 expert_add_info_format(pinfo, tree, &ei_wfd_subelem_len_invalid, "Packet too short for Wi-Fi Display subelement");
366 break;
369 id = tvb_get_uint8(tvb, offset);
370 len = tvb_get_ntohs(tvb, offset + 1);
371 wfd_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + len,
372 ett_wfd_subelem, &subelem,
373 val_to_str(id, wfd_subelem_ids,
374 "Unknown subelement ID (%u)"));
375 if (offset + 3 + len > end) {
376 expert_add_info_format(pinfo, subelem, &ei_wfd_subelem_len_invalid, "Packet too short for Wi-Fi Display subelement payload");
379 proto_tree_add_item(wfd_tree, hf_wfd_subelem_id, tvb, offset, 1,
380 ENC_BIG_ENDIAN);
381 offset++;
382 proto_tree_add_item(wfd_tree, hf_wfd_subelem_len, tvb, offset, 2,
383 ENC_BIG_ENDIAN);
384 offset += 2;
386 switch (id) {
387 case WFD_SUBELEM_DEVICE_INFO:
388 dissect_wfd_subelem_device_info(wfd_tree, tvb, offset);
389 break;
390 case WFD_SUBELEM_ASSOCIATED_BSSID:
391 dissect_wfd_subelem_associated_bssid(pinfo, wfd_tree, tvb, offset, len);
392 break;
393 case WFD_SUBELEM_COUPLED_SINK:
394 dissect_wfd_subelem_coupled_sink(pinfo, wfd_tree, tvb, offset, len);
395 break;
396 case WFD_SUBELEM_SESSION_INFO:
397 dissect_wfd_subelem_session_info(pinfo, wfd_tree, tvb, offset, len);
398 break;
399 case WFD_SUBELEM_EXT_CAPAB:
400 dissect_wfd_subelem_ext_capab(pinfo, wfd_tree, tvb, offset, len);
401 break;
402 case WFD_SUBELEM_ALT_MAC_ADDR:
403 dissect_wfd_subelem_alt_mac_addr(pinfo, wfd_tree, tvb, offset, len);
404 break;
405 default:
406 expert_add_info(pinfo, subelem, &ei_wfd_subelem_id);
407 break;
410 offset += len;
413 return tvb_captured_length(tvb);
416 void
417 proto_register_wifi_display(void)
419 static hf_register_info hf[] = {
420 { &hf_wfd_subelem_id,
421 { "Subelement ID", "wifi_display.subelem.id",
422 FT_UINT8, BASE_DEC, VALS(wfd_subelem_ids), 0, NULL, HFILL }},
423 { &hf_wfd_subelem_len,
424 { "Length", "wifi_display.subelem.length",
425 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
426 { &hf_wfd_subelem_dev_info_type,
427 { "Device type", "wifi_display.subelem.dev_info.type",
428 FT_UINT16, BASE_DEC, VALS(wfd_dev_info_types), 0x0003, NULL, HFILL }},
429 { &hf_wfd_subelem_dev_info_coupled_sink_source,
430 { "Coupled sink operation supported by WFD source",
431 "wifi_display.subelem.dev_info.coupled_sink_by_source",
432 FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL }},
433 { &hf_wfd_subelem_dev_info_coupled_sink_sink,
434 { "Coupled sink operation supported by WFD sink",
435 "wifi_display.subelem.dev_info.coupled_sink_by_sink",
436 FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL }},
437 { &hf_wfd_subelem_dev_info_available,
438 { "Available for WFD Session", "wifi_display.subelem.dev_info.available",
439 FT_UINT16, BASE_DEC, VALS(wfd_dev_info_avail), 0x0030, NULL, HFILL }},
440 { &hf_wfd_subelem_dev_info_wsd,
441 { "WFD Service Discovery", "wifi_display.subelem.dev_info.wsd",
442 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }},
443 { &hf_wfd_subelem_dev_info_pc,
444 { "Preferred Connectivity", "wifi_display.subelem.dev_info.pc",
445 FT_UINT16, BASE_DEC, VALS(wfd_dev_info_pc), 0x0080, NULL, HFILL }},
446 { &hf_wfd_subelem_dev_info_content_protection,
447 { "Content Protection using HDCP2.0",
448 "wifi_display.subelem.dev_info.content_protection",
449 FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL }},
450 { &hf_wfd_subelem_dev_info_time_sync,
451 { "Time Synchronization using 802.1AS",
452 "wifi_display.subelem.dev_info.time_sync",
453 FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL }},
454 { &hf_wfd_subelem_dev_info_audio_unsupp_pri_sink,
455 { "Audio un-supported at Primary sink",
456 "wifi_display.subelem.session.audio_unsupp_pri_sink",
457 FT_BOOLEAN, 16, NULL, 0x0400, NULL, HFILL }},
458 { &hf_wfd_subelem_dev_info_audio_only_supp_source,
459 { "Audio only support af WFD source",
460 "wifi_display.subelem.session.audio_only_supp_source",
461 FT_BOOLEAN, 16, NULL, 0x0800, NULL, HFILL }},
462 { &hf_wfd_subelem_dev_info_tdls_persistent_group,
463 { "TDLS Persistent Group",
464 "wifi_display.subelem.session.tdls_persistent_group",
465 FT_BOOLEAN, 16, NULL, 0x1000, NULL, HFILL }},
466 { &hf_wfd_subelem_dev_info_tdls_persistent_group_reinvoke,
467 { "TDLS Persistent Group Re-invoke",
468 "wifi_display.subelem.session.tdls_persistent_group_reinvoke",
469 FT_BOOLEAN, 16, NULL, 0x2000, NULL, HFILL }},
470 { &hf_wfd_subelem_dev_info_reserved,
471 { "Reserved", "wifi_display.subelem.session.reserved",
472 FT_UINT16, BASE_DEC, NULL, 0xc000, NULL, HFILL }},
473 { &hf_wfd_subelem_dev_info_control_port,
474 { "Session Management Control Port",
475 "wifi_display.subelem.dev_info.control_port",
476 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
477 { &hf_wfd_subelem_dev_info_max_throughput,
478 { "WFD Device Maximum Throughput (Mbps)",
479 "wifi_display.subelem.dev_info.max_throughput",
480 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
481 { &hf_wfd_subelem_assoc_bssid,
482 { "Associated BSSID", "wifi_display.subelem.assoc_bssid.bssid",
483 FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
484 { &hf_wfd_subelem_coupled_sink_status_bitmap,
485 { "Coupled Sink Status bitmap",
486 "wifi_display.subelem.coupled_sink.status",
487 FT_UINT8, BASE_DEC, VALS(wfd_coupled_sink_status_bitmap), 0x03,
488 NULL, HFILL }},
489 { &hf_wfd_subelem_coupled_sink_reserved,
490 { "Reserved", "wifi_display.subelem.coupled_sink.reserved",
491 FT_UINT8, BASE_DEC, NULL, 0xfc, NULL, HFILL }},
492 { &hf_wfd_subelem_coupled_sink_mac_addr,
493 { "Coupled Sink MAC Address",
494 "wifi_display.subelem.coupled_sink.mac_addr",
495 FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
496 { &hf_wfd_subelem_session_descr_len,
497 { "Descriptor length",
498 "wifi_display.subelem.session.descr_len",
499 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
500 { &hf_wfd_subelem_session_dev_addr,
501 { "Device address",
502 "wifi_display.subelem.session.device_address",
503 FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
504 { &hf_wfd_subelem_session_assoc_bssid,
505 { "Associated BSSID",
506 "wifi_display.subelem.session.associated_bssid",
507 FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
508 { &hf_wfd_subelem_session_dev_info_type,
509 { "Device type", "wifi_display.subelem.session.type",
510 FT_UINT16, BASE_DEC, VALS(wfd_dev_info_types), 0x0003, NULL, HFILL }},
511 { &hf_wfd_subelem_session_dev_info_coupled_sink_source,
512 { "Coupled sink operation supported by WFD source",
513 "wifi_display.subelem.session.coupled_sink_by_source",
514 FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL }},
515 { &hf_wfd_subelem_session_dev_info_coupled_sink_sink,
516 { "Coupled sink operation supported by WFD sink",
517 "wifi_display.subelem.session.coupled_sink_by_sink",
518 FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL }},
519 { &hf_wfd_subelem_session_dev_info_available,
520 { "Available for WFD Session", "wifi_display.subelem.session.available",
521 FT_UINT16, BASE_DEC, VALS(wfd_dev_info_avail), 0x0030, NULL, HFILL }},
522 { &hf_wfd_subelem_session_dev_info_wsd,
523 { "WFD Service Discovery", "wifi_display.subelem.session.wsd",
524 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }},
525 { &hf_wfd_subelem_session_dev_info_pc,
526 { "Preferred Connectivity", "wifi_display.subelem.session.pc",
527 FT_UINT16, BASE_DEC, VALS(wfd_dev_info_pc), 0x0080, NULL, HFILL }},
528 { &hf_wfd_subelem_session_dev_info_content_protection,
529 { "Content Protection using HDCP2.0",
530 "wifi_display.subelem.session.content_protection",
531 FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL }},
532 { &hf_wfd_subelem_session_dev_info_time_sync,
533 { "Time Synchronization using 802.1AS",
534 "wifi_display.subelem.session.time_sync",
535 FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL }},
536 { &hf_wfd_subelem_session_dev_info_audio_unsupp_pri_sink,
537 { "Audio un-supported at Primary sink",
538 "wifi_display.subelem.session.audio_unsupp_pri_sink",
539 FT_BOOLEAN, 16, NULL, 0x0400, NULL, HFILL }},
540 { &hf_wfd_subelem_session_dev_info_audio_only_supp_source,
541 { "Audio only support af WFD source",
542 "wifi_display.subelem.session.audio_only_supp_source",
543 FT_BOOLEAN, 16, NULL, 0x0800, NULL, HFILL }},
544 { &hf_wfd_subelem_session_dev_info_tdls_persistent_group,
545 { "TDLS Persistent Group",
546 "wifi_display.subelem.session.tdls_persistent_group",
547 FT_BOOLEAN, 16, NULL, 0x1000, NULL, HFILL }},
548 { &hf_wfd_subelem_session_dev_info_tdls_persistent_group_reinvoke,
549 { "TDLS Persistent Group Re-invoke",
550 "wifi_display.subelem.session.tdls_persistent_group_reinvoke",
551 FT_BOOLEAN, 16, NULL, 0x2000, NULL, HFILL }},
552 { &hf_wfd_subelem_session_dev_info_reserved,
553 { "Reserved", "wifi_display.subelem.session.reserved",
554 FT_UINT16, BASE_DEC, NULL, 0xc000, NULL, HFILL }},
555 { &hf_wfd_subelem_session_dev_info_max_throughput,
556 { "WFD Device Maximum Throughput (Mbps)",
557 "wifi_display.subelem.session.max_throughput",
558 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
559 { &hf_wfd_subelem_session_coupled_sink_status_bitmap,
560 { "Coupled Sink Status bitmap",
561 "wifi_display.subelem.session.coupled_sink_status",
562 FT_UINT8, BASE_DEC, VALS(wfd_coupled_sink_status_bitmap), 0x03,
563 NULL, HFILL }},
564 { &hf_wfd_subelem_session_coupled_sink_reserved,
565 { "Reserved", "wifi_display.subelem.session.coupled_sink.reserved",
566 FT_UINT8, BASE_DEC, NULL, 0xfc, NULL, HFILL }},
567 { &hf_wfd_subelem_session_coupled_sink_addr,
568 { "Coupled peer sink address",
569 "wifi_display.subelem.session.coupled_peer_sink_addr",
570 FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
571 { &hf_wfd_subelem_session_extra_info,
572 { "Extra info in the end of descriptor",
573 "wifi_display.subelem.session.extra_info",
574 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
575 { &hf_wfd_subelem_ext_capab,
576 { "WFD Extended Capability Bitmap",
577 "wifi_display.subelem.ext_capab",
578 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
579 { &hf_wfd_subelem_ext_capab_uibc,
580 { "User Input Back Channel(UIBC)",
581 "wifi_display.subelem.ext_capab.uibc",
582 FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0001, NULL, HFILL }},
583 { &hf_wfd_subelem_ext_capab_i2c_read_write,
584 { "I2C Read/Write",
585 "wifi_display.subelem.ext_capab.i2c_read_write",
586 FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0002, NULL, HFILL }},
587 { &hf_wfd_subelem_ext_capab_preferred_display_mode,
588 { "Preferred Display Mode",
589 "wifi_display.subelem.ext_capab.preferred_display_mode",
590 FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0004, NULL, HFILL }},
591 { &hf_wfd_subelem_ext_capab_standby_resume_control,
592 { "Standby and Resume Control",
593 "wifi_display.subelem.ext_capab.standby_resume_control",
594 FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0008, NULL, HFILL }},
595 { &hf_wfd_subelem_ext_capab_tdls_persistent,
596 { "TDLS Persistent",
597 "wifi_display.subelem.ext_capab.tdls_persistent",
598 FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0010, NULL, HFILL }},
599 { &hf_wfd_subelem_ext_capab_tdls_persistent_bssid,
600 { "TDLS Persistent BSSID",
601 "wifi_display.subelem.ext_capab.tdls_persistent_bssid",
602 FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0020, NULL, HFILL }},
603 { &hf_wfd_subelem_ext_capab_reserved,
604 { "Reserved", "wifi_display.subelem.ext_capab.reserved",
605 FT_UINT16, BASE_HEX, NULL, 0xffc0, NULL, HFILL }},
606 { &hf_wfd_subelem_alt_mac_addr,
607 { "Alternative MAC Address", "wifi_display.subelem.alt_mac_addr",
608 FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
610 static int *ett[] = {
611 &ett_wfd_subelem,
612 &ett_wfd_dev_info_descr
615 static ei_register_info ei[] = {
616 { &ei_wfd_subelem_len_invalid, { "wifi_display.subelem.length.invalid", PI_MALFORMED, PI_ERROR, "Subelement length invalid", EXPFILL }},
617 { &ei_wfd_subelem_session_descr_invalid, { "wifi_display.subelem.session.descr_invalid", PI_MALFORMED, PI_ERROR, "Invalid WFD Device Info Descriptor", EXPFILL }},
618 { &ei_wfd_subelem_id, { "wifi_display.subelem.id.unknown", PI_PROTOCOL, PI_WARN, "Unknown subelement payload", EXPFILL }},
621 expert_module_t* expert_wifi_display;
623 proto_wifi_display = proto_register_protocol("Wi-Fi Display", "WFD", "wifi_display");
624 proto_register_field_array(proto_wifi_display, hf, array_length(hf));
625 proto_register_subtree_array(ett, array_length(ett));
627 expert_wifi_display = expert_register_protocol(proto_wifi_display);
628 expert_register_field_array(expert_wifi_display, ei, array_length(ei));
630 wifi_display_ie_handle = register_dissector("wifi_display_ie", dissect_wifi_display_ie, proto_wifi_display);
634 void
635 proto_reg_handoff_wifi_display(void)
637 dissector_add_uint("wlan.ie.wifi_alliance.subtype", WFA_SUBTYPE_WIFI_DISPLAY, wifi_display_ie_handle);
641 * Editor modelines
643 * Local Variables:
644 * c-basic-offset: 2
645 * tab-width: 8
646 * indent-tabs-mode: nil
647 * End:
649 * ex: set shiftwidth=2 tabstop=8 expandtab:
650 * :indentSize=2:tabSize=8:noTabs=true: