3db808af65a1d871e9614741c66b01047c2ed4b0
[obnox/wireshark/wip.git] / epan / dissectors / packet-ieee80211.c
1 /* packet-ieee80211.c
2  * Routines for Wireless LAN (IEEE 802.11) dissection
3  * Copyright 2000, Axis Communications AB
4  * Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com
5  *
6  * $Id$
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 Gerald Combs
11  *
12  * Copied from README.developer
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27  *
28  * Credits:
29  *
30  * The following people helped me by pointing out bugs etc. Thank you!
31  *
32  * Marco Molteni
33  * Lena-Marie Nilsson
34  * Magnus Hultman-Persson
35  */
36
37 /*
38  * 09/12/2003 - Added dissection of country information tag
39  *
40  * Ritchie<at>tipsybottle.com
41  *
42  * 03/22/2004 - Added dissection of RSN IE
43  * Jouni Malinen <jkmaline@cc.hut.fi>
44  *
45  * 10/24/2005 - Add dissection for 802.11e
46  * Zhu Yi <yi.zhu@intel.com>
47  *
48  * Dutin Johnson - 802.11n and portions of 802.11k and 802.11ma
49  * dustin@dustinj.us & dustin.johnson@cacetech.com
50  *
51  * 01/31/2008 - Added dissection of 802.11s
52  * Javier Cardona <javier@cozybit.com>
53  *
54  * 04/21/2008 - Added dissection for 802.11p
55  * Arada Systems <http://www.aradasystems.com>
56  *
57  * Enhance 802.11 dissector by Alexis La Goutte
58  */
59
60 /*
61  * Reference :
62  * The 802.11 standard is "free", 6 month after the publication.
63  *
64  * IEEE Std 802.11-2007: Revision of IEEE Std 802.11-199
65  * include 8 amendments (802.11a,b,d,e,g,h,i,j)
66  * http://standards.ieee.org/getieee802/download/802.11-2007.pdf
67  *
68  * IEEE Std 802.11k-2008: Radio Resource Measurement of Wireless LANs
69  * http://standards.ieee.org/getieee802/download/802.11k-2008.pdf
70  *
71  * IEEE Std 802.11r-2008: Fast Basic Service Set (BSS) Transition
72  * http://standards.ieee.org/getieee802/download/802.11r-2008.pdf
73  *
74  * IEEE Std 802.11y-2008: 3650-3700 MHz Operation in USA
75  * http://standards.ieee.org/getieee802/download/802.11y-2008.pdf
76  *
77  * IEEE Std 802.11w-2009: Protected Management Frames
78  * http://standards.ieee.org/getieee802/download/802.11w-2009.pdf
79  *
80  * IEEE Std 802.11n-2009: Enhancements for Higher Throughput
81  * http://standards.ieee.org/getieee802/download/802.11n-2009.pdf
82  *
83  * IEEE Std 802.11p-2010: Wireless Access in Vehicular Environments
84  * http://standards.ieee.org/getieee802/download/802.11p-2010.pdf
85  */
86
87 #ifdef HAVE_CONFIG_H
88 # include "config.h"
89 #endif
90
91 #include <stdio.h>
92 #include <stdlib.h>
93
94 #include <string.h>
95 #include <glib.h>
96 #include <math.h>
97 #include <epan/bitswap.h>
98 #include <epan/proto.h>
99 #include <epan/packet.h>
100 #include <epan/addr_resolv.h>
101 #include <epan/strutil.h>
102 #include <epan/prefs.h>
103 #include <epan/reassemble.h>
104 #include "packet-ipx.h"
105 #include "packet-llc.h"
106 #include "packet-ieee80211.h"
107 #include <epan/etypes.h>
108 #include <epan/greproto.h>
109 #include <epan/oui.h>
110 #include <epan/crc32.h>
111 #include <epan/tap.h>
112 #include <epan/emem.h>
113 #include <epan/crypt/wep-wpadefs.h>
114 #include <epan/expert.h>
115
116 #include <ctype.h>
117 #include "isprint.h"
118
119 #include "packet-wps.h"
120 #include "packet-wifi-p2p.h"
121
122 #ifndef roundup2
123 #define roundup2(x, y)  (((x)+((y)-1))&(~((y)-1)))  /* if y is powers of two */
124 #endif
125
126 /* Defragment fragmented 802.11 datagrams */
127 static gboolean wlan_defragment = TRUE;
128
129 /* call subdissector for retransmitted frames */
130 static gboolean wlan_subdissector = TRUE;
131
132 /* Check for the presence of the 802.11 FCS */
133 static gboolean wlan_check_fcs = FALSE;
134
135 /* Ignore vendor-specific HT elements */
136 static gboolean wlan_ignore_draft_ht = FALSE;
137
138 /* Ignore the WEP bit; assume packet is decrypted */
139 #define WLAN_IGNORE_WEP_NO     0
140 #define WLAN_IGNORE_WEP_WO_IV  1
141 #define WLAN_IGNORE_WEP_W_IV   2
142 static gint wlan_ignore_wep = WLAN_IGNORE_WEP_NO;
143
144 /* Tables for reassembly of fragments. */
145 static GHashTable *wlan_fragment_table = NULL;
146 static GHashTable *wlan_reassembled_table = NULL;
147
148 /* Statistical data */
149 static struct _wlan_stats wlan_stats;
150
151 /* Stuff for the WEP decoder */
152 static gboolean enable_decryption = FALSE;
153 static void init_wepkeys(void);
154
155 #ifndef HAVE_AIRPDCAP
156 static gint num_wepkeys = 0;
157 static guint8 **wep_keys = NULL;
158 static int *wep_keylens = NULL;
159 static tvbuff_t *try_decrypt_wep(tvbuff_t *tvb, guint32 offset, guint32 len);
160 static int wep_decrypt(guint8 *buf, guint32 len, int key_override);
161 #else
162 /* Davide Schiera (2006-11-26): created function to decrypt WEP and WPA/WPA2  */
163 static tvbuff_t *try_decrypt(tvbuff_t *tvb, guint32 offset, guint32 len, guint8 *algorithm, guint32 *sec_header, guint32 *sec_trailer);
164 #endif
165
166 static int weak_iv(guchar *iv);
167 #define SSWAP(a,b) {guint8 tmp = s[a]; s[a] = s[b]; s[b] = tmp;}
168
169 /* #define USE_ENV */
170 /* When this is set, an unlimited number of WEP keys can be set in the
171    environment:
172
173    WIRESHARK_WEPKEYNUM=##
174    WIRESHARK_WEPKEY1=aa:bb:cc:dd:...
175    WIRESHARK_WEPKEY2=aa:bab:cc:dd:ee:...
176
177    ... you get the idea.
178
179    otherwise you're limited to specifying four keys in the preference system.
180  */
181
182 #ifndef USE_ENV
183 static char *wep_keystr[MAX_ENCRYPTION_KEYS];
184 #endif
185
186 typedef struct mimo_control
187   {
188     guint8 nc;
189     guint8 nr;
190     gboolean chan_width;
191     guint8 grouping;
192     guint8 coefficient_size;
193     guint8 codebook_info;
194     guint8 remaining_matrix_segment;
195   } mimo_control_t;
196
197 mimo_control_t get_mimo_control (tvbuff_t *tvb, int offset);
198 int add_mimo_csi_matrices_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl);
199 int add_mimo_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl);
200 int add_mimo_compressed_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl);
201
202 /* ************************************************************************* */
203 /*                          Miscellaneous Constants                          */
204 /* ************************************************************************* */
205 #define SHORT_STR 256
206
207 /* ************************************************************************* */
208 /*  Define some very useful macros that are used to analyze frame types etc. */
209 /* ************************************************************************* */
210
211 /*
212  * Fetch the frame control field and swap it if needed.  "fcf" and "tvb"
213  * must be valid variables.
214  */
215 #define FETCH_FCF(off) (wlan_broken_fc ? \
216   BSWAP16(tvb_get_letohs(tvb, off)) : \
217   tvb_get_letohs(tvb, off))
218
219 /*
220  * Extract the protocol version from the frame control field
221  */
222 #define FCF_PROT_VERSION(x)  ((x) & 0x3)
223
224 /*
225  * Extract the frame type from the frame control field.
226  */
227 #define FCF_FRAME_TYPE(x)    (((x) & 0xC) >> 2)
228
229 /*
230  * Extract the frame subtype from the frame control field.
231  */
232 #define FCF_FRAME_SUBTYPE(x) (((x) & 0xF0) >> 4)
233
234 /*
235  * Convert the frame type and subtype from the frame control field into
236  * one of the MGT_, CTRL_, or DATA_ values.
237  */
238 #define COMPOSE_FRAME_TYPE(x) (((x & 0x0C)<< 2)+FCF_FRAME_SUBTYPE(x))  /* Create key to (sub)type */
239
240 /*
241  * The subtype field of a data frame is, in effect, composed of 4 flag
242  * bits - CF-Ack, CF-Poll, Null (means the frame doesn't actually have
243  * any data), and QoS.
244  */
245 #define DATA_FRAME_IS_CF_ACK(x)  ((x) & 0x01)
246 #define DATA_FRAME_IS_CF_POLL(x) ((x) & 0x02)
247 #define DATA_FRAME_IS_NULL(x)    ((x) & 0x04)
248 #define DATA_FRAME_IS_QOS(x)     ((x) & 0x08)
249
250 /*
251  * Extract the flags from the frame control field.
252  */
253 #define FCF_FLAGS(x)           (((x) & 0xFF00) >> 8)
254
255 /*
256  * Bits from the flags field.
257  */
258 #define FLAG_TO_DS            0x01
259 #define FLAG_FROM_DS          0x02
260 #define FLAG_MORE_FRAGMENTS   0x04
261 #define FLAG_RETRY            0x08
262 #define FLAG_POWER_MGT        0x10
263 #define FLAG_MORE_DATA        0x20
264 #define FLAG_PROTECTED        0x40
265 #define FLAG_ORDER            0x80
266
267 /*
268  * Test bits in the flags field.
269  */
270 /*
271  * XXX - Only HAVE_FRAGMENTS, IS_PROTECTED, and IS_STRICTLY_ORDERED
272  * are in use.  Should the rest be removed?
273  */
274 #define IS_TO_DS(x)            ((x) & FLAG_TO_DS)
275 #define IS_FROM_DS(x)          ((x) & FLAG_FROM_DS)
276 #define HAVE_FRAGMENTS(x)      ((x) & FLAG_MORE_FRAGMENTS)
277 #define IS_RETRY(x)            ((x) & FLAG_RETRY)
278 #define POWER_MGT_STATUS(x)    ((x) & FLAG_POWER_MGT)
279 #define HAS_MORE_DATA(x)       ((x) & FLAG_MORE_DATA)
280 #define IS_PROTECTED(x)        ((x) & FLAG_PROTECTED)
281 #define IS_STRICTLY_ORDERED(x) ((x) & FLAG_ORDER)
282
283 /*
284  * Extract subfields from the flags field.
285  */
286 #define FLAGS_DS_STATUS(x)          ((x) & (FLAG_FROM_DS|FLAG_TO_DS))
287
288 /*
289  * Extract an indication of the types of addresses in a data frame from
290  * the frame control field.
291  */
292 #define FCF_ADDR_SELECTOR(x) ((x) & ((FLAG_TO_DS|FLAG_FROM_DS) << 8))
293
294 #define DATA_ADDR_T1         0
295 #define DATA_ADDR_T2         (FLAG_FROM_DS << 8)
296 #define DATA_ADDR_T3         (FLAG_TO_DS << 8)
297 #define DATA_ADDR_T4         ((FLAG_TO_DS|FLAG_FROM_DS) << 8)
298
299 /*
300  * Extract the fragment number and sequence number from the sequence
301  * control field.
302  */
303 #define SEQCTL_FRAGMENT_NUMBER(x) ((x) & 0x000F)
304 #define SEQCTL_SEQUENCE_NUMBER(x) (((x) & 0xFFF0) >> 4)
305
306 /*
307  * Extract subfields from the QoS control field.
308  */
309 #define QOS_TID(x)            ((x) & 0x000F)
310 #define QOS_PRIORITY(x)       ((x) & 0x0007)
311 #define QOS_EOSP(x)           (((x) & 0x0010) >> 4) /* end of service period */
312 #define QOS_ACK_POLICY(x)     (((x) & 0x0060) >> 5)
313 #define QOS_AMSDU_PRESENT(x)  (((x) & 0x0080) >> 6)
314 #define QOS_FIELD_CONTENT(x)  (((x) & 0xFF00) >> 8)
315
316 #define QOS_FLAG_EOSP    0x10
317
318 /*
319  * Extract subfields from the result of QOS_FIELD_CONTENT().
320  */
321 #define QOS_PS_BUF_STATE_INDICATED(x)  (((x) & 0x02) >> 1)
322 #define QOS_PS_HIGHEST_PRI_BUF_AC(x)   (((x) & 0x0C) >> 2)
323 #define QOS_PS_QAP_BUF_LOAD(x)         (((x) & 0xF0) >> 4)
324
325 /*
326  * Extract subfields from the HT Control field.
327  * .11n D-1.10 & D-2.0, 7.1.3.5a, 32 bits.
328  */
329 #define HTC_LAC(htc)           ((htc) & 0xFF)
330 #define HTC_LAC_MAI(htc)       (((htc) >> 2) & 0xF)
331 #define HTC_IS_ASELI(htc)      (HTC_LAC_MAI(htc) == 0xE)
332 #define HTC_LAC_MAI_MRQ(htc)   ((HTC_LAC_MAI(htc))  & 0x1)
333 #define HTC_LAC_MAI_MSI(htc)   ((HTC_LAC_MAI(htc) >> 1) & 0x7)
334 #define HTC_LAC_MFSI(htc)      (((htc) >> 4) & 0x7)
335 #define HTC_LAC_ASEL_CMD(htc)  (((htc) >> 9) & 0x7)
336 #define HTC_LAC_ASEL_DATA(htc) (((htc) >> 12) & 0xF)
337 #define HTC_LAC_MFB(htc)       (((htc) >> 9) & 0x7F)
338 #define HTC_CAL_POS(htc)       (((htc) >> 16) & 0x3)
339 #define HTC_CAL_SEQ(htc)       (((htc) >> 18) & 0x3)
340 #define HTC_CSI_STEERING(htc)  (((htc) >> 22) & 0x3)
341 #define HTC_NDP_ANN(htc)       (((htc) >> 24) & 0x1)
342 #define HTC_AC_CONSTRAINT(htc) (((htc) >> 30) & 0x1)
343 #define HTC_RDG_MORE_PPDU(htc) (((htc) >> 31) & 0x1)
344
345 /*
346  * Extract subfields from the key octet in WEP-encrypted frames.
347  */
348 #define KEY_OCTET_WEP_KEY(x)   (((x) & 0xC0) >> 6)
349
350 #define KEY_EXTIV    0x20
351 #define EXTIV_LEN    8
352
353 /* Uncomment for 802.11s draft (mesh) support */
354 /* #define MESH_OVERRIDES 1 */
355 #ifdef MESH_OVERRIDES
356 /*
357  * Bits from the Mesh Flags field
358  */
359 #define MESH_FLAGS_ADDRESS_EXTENSION  0x3
360 #endif /* MESH_OVERRIDES */
361
362 /* ************************************************************************* */
363 /*              Constants used to identify cooked frame types                */
364 /* ************************************************************************* */
365 #define MGT_FRAME            0x00  /* Frame type is management */
366 #define CONTROL_FRAME        0x01  /* Frame type is control */
367 #define DATA_FRAME           0x02  /* Frame type is Data */
368
369 #define DATA_SHORT_HDR_LEN     24
370 #define DATA_LONG_HDR_LEN      30
371 #define MGT_FRAME_HDR_LEN      24  /* Length of Managment frame-headers */
372
373 /*
374  * COMPOSE_FRAME_TYPE() values for management frames.
375  */
376 #define MGT_ASSOC_REQ          0x00  /* association request        */
377 #define MGT_ASSOC_RESP         0x01  /* association response       */
378 #define MGT_REASSOC_REQ        0x02  /* reassociation request      */
379 #define MGT_REASSOC_RESP       0x03  /* reassociation response     */
380 #define MGT_PROBE_REQ          0x04  /* Probe request              */
381 #define MGT_PROBE_RESP         0x05  /* Probe response             */
382 #define MGT_MEASUREMENT_PILOT  0x06  /* Measurement Pilot          */
383 #define MGT_BEACON             0x08  /* Beacon frame               */
384 #define MGT_ATIM               0x09  /* ATIM                       */
385 #define MGT_DISASS             0x0A  /* Disassociation             */
386 #define MGT_AUTHENTICATION     0x0B  /* Authentication             */
387 #define MGT_DEAUTHENTICATION   0x0C  /* Deauthentication           */
388 #define MGT_ACTION             0x0D  /* Action                     */
389 #define MGT_ACTION_NO_ACK      0x0E  /* Action No Ack              */
390 #define MGT_ARUBA_WLAN         0x0F  /* Aruba WLAN Specific        */
391
392 /*
393  * COMPOSE_FRAME_TYPE() values for control frames.
394  */
395 #define CTRL_CONTROL_WRAPPER 0x17  /* Control Wrapper        */
396 #define CTRL_BLOCK_ACK_REQ   0x18  /* Block ack Request        */
397 #define CTRL_BLOCK_ACK       0x19  /* Block ack          */
398 #define CTRL_PS_POLL         0x1A  /* power-save poll               */
399 #define CTRL_RTS             0x1B  /* request to send               */
400 #define CTRL_CTS             0x1C  /* clear to send                 */
401 #define CTRL_ACKNOWLEDGEMENT 0x1D  /* acknowledgement               */
402 #define CTRL_CFP_END         0x1E  /* contention-free period end    */
403 #define CTRL_CFP_ENDACK      0x1F  /* contention-free period end/ack */
404
405 /*
406  * COMPOSE_FRAME_TYPE() values for data frames.
407  */
408 #define DATA                        0x20  /* Data                       */
409 #define DATA_CF_ACK                 0x21  /* Data + CF-Ack              */
410 #define DATA_CF_POLL                0x22  /* Data + CF-Poll             */
411 #define DATA_CF_ACK_POLL            0x23  /* Data + CF-Ack + CF-Poll    */
412 #define DATA_NULL_FUNCTION          0x24  /* Null function (no data)    */
413 #define DATA_CF_ACK_NOD             0x25  /* CF-Ack (no data)           */
414 #define DATA_CF_POLL_NOD            0x26  /* CF-Poll (No data)          */
415 #define DATA_CF_ACK_POLL_NOD        0x27  /* CF-Ack + CF-Poll (no data) */
416
417 #define DATA_QOS_DATA               0x28  /* QoS Data                   */
418 #define DATA_QOS_DATA_CF_ACK        0x29  /* QoS Data + CF-Ack        */
419 #define DATA_QOS_DATA_CF_POLL       0x2A  /* QoS Data + CF-Poll      */
420 #define DATA_QOS_DATA_CF_ACK_POLL   0x2B  /* QoS Data + CF-Ack + CF-Poll    */
421 #define DATA_QOS_NULL               0x2C  /* QoS Null        */
422 #define DATA_QOS_CF_POLL_NOD        0x2E  /* QoS CF-Poll (No Data)      */
423 #define DATA_QOS_CF_ACK_POLL_NOD    0x2F  /* QoS CF-Ack + CF-Poll (No Data) */
424
425
426 /* ************************************************************************* */
427 /*        Logical field codes (dissector's encoding of fixed fields)         */
428 /* ************************************************************************* */
429 #define FIELD_TIMESTAMP                 0x01  /* 64-bit timestamp                       */
430 #define FIELD_BEACON_INTERVAL           0x02  /* 16-bit beacon interval                 */
431 #define FIELD_CAP_INFO                  0x03  /* Add capability information tree        */
432 #define FIELD_AUTH_ALG                  0x04  /* Authentication algorithm used          */
433 #define FIELD_AUTH_TRANS_SEQ            0x05  /* Authentication sequence number         */
434 #define FIELD_CURRENT_AP_ADDR           0x06
435 #define FIELD_LISTEN_IVAL               0x07
436 #define FIELD_REASON_CODE               0x08
437 #define FIELD_ASSOC_ID                  0x09
438 #define FIELD_STATUS_CODE               0x0A
439 #define FIELD_CATEGORY_CODE             0x0B  /* Management action category */
440 #define FIELD_ACTION_CODE               0x0C  /* Management action code */
441 #define FIELD_DIALOG_TOKEN              0x0D  /* Management action dialog token */
442 #define FIELD_WME_ACTION_CODE           0x0E  /* Management notification action code */
443 #define FIELD_WME_DIALOG_TOKEN          0x0F  /* Management notification dialog token */
444 #define FIELD_WME_STATUS_CODE           0x10  /* Management notification setup response status code */
445 #define FIELD_QOS_ACTION_CODE           0x11
446 #define FIELD_QOS_TS_INFO               0x12
447 #define FIELD_DLS_ACTION_CODE           0x13
448 #define FIELD_DST_MAC_ADDR              0X14  /* DLS destination MAC address */
449 #define FIELD_SRC_MAC_ADDR              0X15  /* DLS source MAC address */
450 #define FIELD_DLS_TIMEOUT               0X16  /* DLS timeout value */
451 #define FIELD_SCHEDULE_INFO             0X17  /* Schedule Info field */
452 #define FIELD_ACTION                    0X18  /* Action field */
453 #define FIELD_BLOCK_ACK_ACTION_CODE     0x19
454 #define FIELD_QOS_INFO_AP               0x1A
455 #define FIELD_QOS_INFO_STA              0x1B
456 #define FIELD_BLOCK_ACK_PARAM           0x1C
457 #define FIELD_BLOCK_ACK_TIMEOUT         0x1D
458 #define FIELD_BLOCK_ACK_SSC             0x1E
459 #define FIELD_DELBA_PARAM_SET           0x1F
460 #define FIELD_MAX_REG_PWR               0x20
461 #define FIELD_MEASUREMENT_PILOT_INT     0x21
462 #define FIELD_COUNTRY_STR               0x22
463 #define FIELD_MAX_TX_PWR                0x23
464 #define FIELD_TX_PWR_USED               0x24
465 #define FIELD_TRANSCEIVER_NOISE_FLOOR   0x25
466 #define FIELD_DS_PARAM_SET              0x26
467 #define FIELD_CHANNEL_WIDTH             0x27
468 #define FIELD_SM_PWR_CNTRL              0x28
469 #define FIELD_PCO_PHASE_CNTRL           0x29
470 #define FIELD_PSMP_PARAM_SET            0x2A
471 #define FIELD_PSMP_STA_INFO             0x2B
472 #define FIELD_MIMO_CNTRL                0x2C
473 #define FIELD_ANT_SELECTION             0x2D
474 #define FIELD_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT 0x2E
475 #define FIELD_HT_INFORMATION            0x2F
476 #define FIELD_HT_ACTION_CODE            0x30
477 #define FIELD_PA_ACTION_CODE            0x31
478 #define FIELD_FT_ACTION_CODE            0x32
479 #define FIELD_STA_ADDRESS               0x33
480 #define FIELD_TARGET_AP_ADDRESS         0x34
481 #define FIELD_MESH_MGT_ACTION_PS_CODE   0x35    /* Mesh Management action peer link code */
482 #define FIELD_MESH_MGT_ACTION_PL_CODE   0x36    /* Mesh Management action peer link code */
483 #define FIELD_GAS_COMEBACK_DELAY        0x37
484 #define FIELD_GAS_FRAGMENT_ID           0x38
485 #define FIELD_SA_QUERY_ACTION_CODE      0x39
486 #define FIELD_TRANSACTION_ID            0x3A
487 #define FIELD_TDLS_ACTION_CODE          0x3B
488 #define FIELD_TARGET_CHANNEL            0x3C
489 #define FIELD_REGULATORY_CLASS          0x3D
490
491
492 /* ************************************************************************* */
493 /*        Logical field codes (IEEE 802.11 encoding of tags)                 */
494 /* ************************************************************************* */
495 #define TAG_SSID                     0
496 #define TAG_SUPP_RATES               1
497 #define TAG_FH_PARAMETER             2
498 #define TAG_DS_PARAMETER             3
499 #define TAG_CF_PARAMETER             4
500 #define TAG_TIM                      5
501 #define TAG_IBSS_PARAMETER           6
502 #define TAG_COUNTRY_INFO             7
503 #define TAG_FH_HOPPING_PARAMETER     8
504 #define TAG_FH_HOPPING_TABLE         9
505 #define TAG_REQUEST                  10
506 #define TAG_QBSS_LOAD                11
507 #define TAG_EDCA_PARAM_SET           12
508 #define TAG_TSPEC                    13
509 #define TAG_TCLAS                    14
510 #define TAG_SCHEDULE                 15
511 #define TAG_CHALLENGE_TEXT           16
512
513 #define TAG_POWER_CONSTRAINT         32
514 #define TAG_POWER_CAPABILITY         33
515 #define TAG_TPC_REQUEST              34
516 #define TAG_TPC_REPORT               35
517 /* 36 - 41 below */
518 #define TAG_ERP_INFO                 42
519 #define TAG_TS_DELAY                 43
520 #define TAG_TCLAS_PROCESS            44
521 #define TAG_HT_CAPABILITY            45  /* IEEE Stc 802.11n/D2.0 */
522 #define TAG_QOS_CAPABILITY           46
523 #define TAG_ERP_INFO_OLD             47  /* IEEE Std 802.11g/D4.0 */
524 #define TAG_RSN_IE                   48
525 /* Reserved 49 */
526 #define TAG_EXT_SUPP_RATES           50
527 #define TAG_AP_CHANNEL_REPORT        51
528 /* 52 below */
529 #define TAG_RCPI                     53
530 #define TAG_MOBILITY_DOMAIN          54  /* IEEE Std 802.11r-2008 */
531 /* 55 below */
532 #define TAG_TIMEOUT_INTERVAL         56  /* IEEE Std 802.11r-2008 */
533 #define TAG_RIC_DATA                 57  /* IEEE Std 802.11r-2008 */
534 /* 58 ??? */
535 #define TAG_SUPPORTED_REGULATORY_CLASSES            59 /* IEEE Std 802.11w-2009 */
536 #define TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT    60 /* IEEE Std 802.11w-2009 */
537 #define TAG_HT_INFO                  61  /* IEEE Stc 802.11n/D2.0 */
538 #define TAG_SECONDARY_CHANNEL_OFFSET 62  /* IEEE Stc 802.11n/D1.10/D2.0 */
539 /* 69 below */
540 #define TAG_20_40_BSS_CO_EX          72   /* IEEE P802.11n/D6.0 */
541 #define TAG_20_40_BSS_INTOL_CH_REP   73   /* IEEE P802.11n/D6.0 */
542 #define TAG_OVERLAP_BSS_SCAN_PAR     74   /* IEEE P802.11n/D6.0 */
543 #define TAG_RIC_DESCRIPTOR           75   /* IEEE Std 802.11r-2008 */
544 #define TAG_MMIE                     76   /* IEEE Std 802.11w-2009 */
545 #define TAG_LINK_IDENTIFIER          101  /* IEEE Std 802.11z-2010 */
546 #define TAG_WAKEUP_SCHEDULE          102  /* IEEE Std 802.11z-2010 */
547 #define TAG_CHANNEL_SWITCH_TIMING    104  /* IEEE Std 802.11z-2010 */
548 #define TAG_PTI_CONTROL              105  /* IEEE Std 802.11z-2010 */
549 #define TAG_PU_BUFFER_STATUS         106  /* IEEE Std 802.11z-2010 */
550 #define TAG_ADVERTISEMENT_PROTOCOL   108  /* IEEE P802.11u/D10.0 */
551 #define TAG_EXTENDED_CAPABILITIES    127   /* IEEE Stc 802.11n/D1.10/D2.0 */
552 #define TAG_AGERE_PROPRIETARY        128
553 #define TAG_CISCO_CCX1_CKIP          133  /* Cisco Compatible eXtensions */
554 #define TAG_CISCO_UNKNOWN_88         136  /* Cisco Compatible eXtensions? */
555 #define TAG_CISCO_UNKNOWN_95         149  /* Cisco Compatible eXtensions */
556 #define TAG_CISCO_UNKNOWN_96         150  /* Cisco Compatible eXtensions */
557 #define TAG_SYMBOL_PROPRIETARY       173
558 #define TAG_VENDOR_SPECIFIC_IE       221
559
560 #ifndef MESH_OVERRIDES
561 #define TAG_SUPPORTED_CHANNELS       36
562 #define TAG_CHANNEL_SWITCH_ANN       37
563 #define TAG_MEASURE_REQ              38
564 #define TAG_MEASURE_REP              39
565 #define TAG_QUIET                    40
566 #define TAG_IBSS_DFS                 41
567 #define TAG_NEIGHBOR_REPORT          52
568 #define TAG_FAST_BSS_TRANSITION      55  /* IEEE Std 802.11r-2008 */
569 #define TAG_WSIE                     69   /* tag of the Wave Service Information (802.11p) */
570 #else /* MESH_OVERRIDES */
571 #define TAG_SUPPORTED_CHANNELS       224
572 #define TAG_CHANNEL_SWITCH_ANN       225
573 #define TAG_MEASURE_REQ              226
574 #define TAG_MEASURE_REP              227
575 #define TAG_QUIET                    228
576 #define TAG_IBSS_DFS                 229
577 /* Not yet assigned by ANA */
578 #define TAG_MESH_CONFIGURATION    51
579 #define TAG_MESH_ID               52
580 #define TAG_MESH_PEER_LINK_MGMT   55
581 #define TAG_MESH_PREQ             68
582 #define TAG_MESH_PREP             69
583 #define TAG_MESH_PERR             70
584 #endif /* MESH_OVERRIDES */
585
586 static const range_string tag_num_vals[] = {
587   { TAG_SSID, TAG_SSID, "SSID parameter set" },
588   { TAG_SUPP_RATES, TAG_SUPP_RATES, "Supported Rates" },
589   { TAG_FH_PARAMETER, TAG_FH_PARAMETER, "FH Parameter set" },
590   { TAG_DS_PARAMETER, TAG_DS_PARAMETER, "DS Parameter set" },
591   { TAG_CF_PARAMETER, TAG_CF_PARAMETER, "CF Parameter set" },
592   { TAG_TIM, TAG_TIM, "Traffic Indication Map (TIM)" },
593   { TAG_IBSS_PARAMETER, TAG_IBSS_PARAMETER, "IBSS Parameter set" },
594   { TAG_COUNTRY_INFO, TAG_COUNTRY_INFO, "Country Information" },
595   { TAG_FH_HOPPING_PARAMETER, TAG_FH_HOPPING_PARAMETER, "Hopping Pattern Parameters" },
596   { TAG_FH_HOPPING_TABLE, TAG_FH_HOPPING_TABLE, "Hopping Pattern Table" },
597   { TAG_REQUEST, TAG_REQUEST, "Request" },
598   { TAG_QBSS_LOAD, TAG_QBSS_LOAD, "QBSS Load Element" },
599   { TAG_EDCA_PARAM_SET, TAG_EDCA_PARAM_SET, "EDCA Parameter Set" },
600   { TAG_TSPEC, TAG_TSPEC, "Traffic Specification" },
601   { TAG_TCLAS, TAG_TCLAS, "Traffic Classification" },
602   { TAG_SCHEDULE, TAG_SCHEDULE, "Schedule" },
603   { TAG_CHALLENGE_TEXT, TAG_CHALLENGE_TEXT,"Challenge text" },
604   { 17, 31, "Reserved" },
605   { TAG_POWER_CONSTRAINT, TAG_POWER_CONSTRAINT, "Power Constraint" },
606   { TAG_POWER_CAPABILITY, TAG_POWER_CAPABILITY, "Power Capability" },
607   { TAG_TPC_REQUEST, TAG_TPC_REQUEST, "TPC Request" },
608   { TAG_TPC_REPORT, TAG_TPC_REPORT, "TPC Report" },
609   { TAG_SUPPORTED_CHANNELS, TAG_SUPPORTED_CHANNELS, "Supported Channels" },
610   { TAG_CHANNEL_SWITCH_ANN, TAG_CHANNEL_SWITCH_ANN, "Channel Switch Announcement" },
611   { TAG_MEASURE_REQ, TAG_MEASURE_REQ, "Measurement Request" },
612   { TAG_MEASURE_REP, TAG_MEASURE_REP, "Measurement Report" },
613   { TAG_QUIET, TAG_QUIET, "Quiet" },
614   { TAG_IBSS_DFS, TAG_IBSS_DFS, "IBSS DFS" },
615   { TAG_ERP_INFO, TAG_ERP_INFO, "ERP Information" },
616   { TAG_TS_DELAY, TAG_TS_DELAY, "TS Delay" },
617   { TAG_TCLAS_PROCESS, TAG_TCLAS_PROCESS, "TCLAS Processing" },
618   { TAG_HT_CAPABILITY, TAG_HT_CAPABILITY, "HT Capabilities (802.11n D1.10)" },
619   { TAG_QOS_CAPABILITY, TAG_QOS_CAPABILITY, "QoS Capability" },
620   { TAG_ERP_INFO_OLD, TAG_ERP_INFO_OLD, "ERP Information" }, /* Reserved... */
621   { TAG_RSN_IE, TAG_RSN_IE, "RSN Information" },
622   { TAG_EXT_SUPP_RATES, TAG_EXT_SUPP_RATES, "Extended Supported Rates" },
623   { TAG_AP_CHANNEL_REPORT, TAG_AP_CHANNEL_REPORT, "AP Channel Report" },
624 #ifndef MESH_OVERRIDES
625   { TAG_NEIGHBOR_REPORT, TAG_NEIGHBOR_REPORT, "Neighbor Report" },
626 #endif
627   { TAG_RCPI, TAG_RCPI, "RCPI" },
628   { TAG_MOBILITY_DOMAIN, TAG_MOBILITY_DOMAIN, "Mobility Domain" },
629 #ifndef MESH_OVERRIDES
630   { TAG_FAST_BSS_TRANSITION, TAG_FAST_BSS_TRANSITION, "Fast BSS Transition" },
631 #endif
632   { TAG_TIMEOUT_INTERVAL, TAG_TIMEOUT_INTERVAL,"Timeout Interval" },
633   { TAG_RIC_DATA, TAG_RIC_DATA, "RIC Data" },
634   { TAG_SUPPORTED_REGULATORY_CLASSES, TAG_SUPPORTED_REGULATORY_CLASSES, "Supported Regulatory Classes" },
635   { TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT, TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT, "Extended Channel Switch Announcement" },
636 #ifndef MESH_OVERRIDES
637   { TAG_WSIE, TAG_WSIE, "Wave Service Information" }, /* www.aradasystems.com */
638 #endif
639   { TAG_20_40_BSS_CO_EX, TAG_20_40_BSS_CO_EX, "20/40 BSS Coexistence" },
640   { TAG_20_40_BSS_INTOL_CH_REP, TAG_20_40_BSS_INTOL_CH_REP, "20/40 BSS Intolerant Channel Report" },   /* IEEE P802.11n/D6.0 */
641   { TAG_OVERLAP_BSS_SCAN_PAR, TAG_OVERLAP_BSS_SCAN_PAR, "Overlapping BSS Scan Parameters" },       /* IEEE P802.11n/D6.0 */
642   { TAG_RIC_DESCRIPTOR, TAG_RIC_DESCRIPTOR, "RIC Descriptor" },
643   { TAG_MMIE, TAG_MMIE, "Management MIC" },
644   { TAG_LINK_IDENTIFIER, TAG_LINK_IDENTIFIER, "Link Identifier" },
645   { TAG_WAKEUP_SCHEDULE, TAG_WAKEUP_SCHEDULE, "Wakeup Schedule" },
646   { TAG_CHANNEL_SWITCH_TIMING, TAG_CHANNEL_SWITCH_TIMING, "Channel Switch Timing" },
647   { TAG_PTI_CONTROL, TAG_PTI_CONTROL, "PTI Control" },
648   { TAG_PU_BUFFER_STATUS, TAG_PU_BUFFER_STATUS, "PU Buffer Status" },
649   { TAG_ADVERTISEMENT_PROTOCOL, TAG_ADVERTISEMENT_PROTOCOL, "Advertisement Protocol"},
650   { TAG_EXTENDED_CAPABILITIES, TAG_EXTENDED_CAPABILITIES, "Extended Capabilities" },
651   { TAG_AGERE_PROPRIETARY, TAG_AGERE_PROPRIETARY, "Agere Proprietary" },
652   { TAG_CISCO_CCX1_CKIP, TAG_CISCO_CCX1_CKIP, "Cisco CCX1 CKIP + Device Name" },
653   { TAG_CISCO_UNKNOWN_88, TAG_CISCO_UNKNOWN_88, "Cisco Unknown 88" },
654   { TAG_CISCO_UNKNOWN_95, TAG_CISCO_UNKNOWN_95, "Cisco Unknown 95" },
655   { TAG_CISCO_UNKNOWN_96, TAG_CISCO_UNKNOWN_96, "Cisco Unknown 96" },
656   { TAG_SYMBOL_PROPRIETARY, TAG_SYMBOL_PROPRIETARY, "Symbol Proprietary" },
657   { TAG_VENDOR_SPECIFIC_IE, TAG_VENDOR_SPECIFIC_IE, "Vendor Specific" },
658 #ifdef MESH_OVERRIDES
659   { TAG_MESH_ID, TAG_MESH_ID, "Mesh ID" },
660   { TAG_MESH_CONFIGURATION, TAG_MESH_CONFIGURATION, "Mesh Configuration" },
661   { TAG_MESH_PEER_LINK_MGMT, TAG_MESH_PEER_LINK_MGMT, "Mesh Peer Link Management" },
662   { TAG_MESH_PREQ, TAG_MESH_PREQ, "Mesh Path Request" },
663   { TAG_MESH_PREP, TAG_MESH_PREP, "Mesh Path Response" },
664   { TAG_MESH_PERR, TAG_MESH_PERR, "Mesh Path Error" },
665 #endif /* MESH_OVERRIDES */
666   { 0, 0, NULL }
667 };
668
669 #define WPA_OUI     (const guint8 *) "\x00\x50\xF2"
670 #define RSN_OUI     (const guint8 *) "\x00\x0F\xAC"
671 #define WME_OUI     (const guint8 *) "\x00\x50\xF2"
672 #define PRE_11N_OUI (const guint8 *) "\x00\x90\x4c" /* 802.11n pre 1 oui */
673 #define WFA_OUI     (const guint8 *) "\x50\x6f\x9a"
674
675 /* WFA vendor specific subtypes */
676 #define WFA_SUBTYPE_P2P 9
677
678 #define PMKID_LEN 16
679
680 /* ************************************************************************* */
681 /*              Wireless Access in Vehicular Environment  IEEE 802.11p       */
682 /* ************************************************************************* */
683 #define WAVE_ACID       0x0001
684 #define WAVE_ACM        0x0002
685 #define WAVE_ACF        0x0004
686 #define WAVE_PRIORITY   0x0008
687 #define WAVE_CHANNEL    0x0010
688 #define WAVE_IPV6ADDR   0x0020
689 #define WAVE_PEERMAC    0x0040
690
691 /* ************************************************************************* */
692 /*              Supported Rates (7.3.2.2)                                    */
693 /* ************************************************************************* */
694
695 static const value_string ieee80211_supported_rates_vals[] = {
696   { 0x02, "1" },
697   { 0x03, "1.5" },
698   { 0x04, "2" },
699   { 0x05, "2.5" },
700   { 0x06, "3" },
701   { 0x09, "4.5" },
702   { 0x0B, "5.5" },
703   { 0x0C, "6" },
704   { 0x12, "9" },
705   { 0x16, "11" },
706   { 0x18, "12" },
707   { 0x1B, "13.5" },
708   { 0x24, "18" },
709   { 0x2C, "22" },
710   { 0x30, "24" },
711   { 0x36, "27" },
712   { 0x42, "33" },
713   { 0x48, "36" },
714   { 0x60, "48" },
715   { 0x6C, "54" },
716   { 0x82, "1(B)" },
717   { 0x83, "1.5(B)" },
718   { 0x84, "2(B)" },
719   { 0x85, "2.5(B)" },
720   { 0x86, "3(B)" },
721   { 0x89, "4.5(B)" },
722   { 0x8B, "5.5(B)" },
723   { 0x8C, "6(B)" },
724   { 0x92, "9(B)" },
725   { 0x96, "11(B)" },
726   { 0x98, "12(B)" },
727   { 0x9B, "13.5(B)" },
728   { 0xA4, "18(B)" },
729   { 0xAC, "22(B)" },
730   { 0xB0, "24(B)" },
731   { 0xB6, "27(B)" },
732   { 0xC2, "33(B)" },
733   { 0xC8, "36(B)" },
734   { 0xE0, "48(B)" },
735   { 0xEC, "54(B)" },
736   { 0xFF, "BSS requires support for mandatory features of HT PHY (IEEE 802.11 - Clause 20)" },
737   { 0,    NULL}
738 };
739 /* ************************************************************************* */
740 /*                         Frame types, and their names                      */
741 /* ************************************************************************* */
742 static const value_string frame_type_subtype_vals[] = {
743   {MGT_ASSOC_REQ,             "Association Request"},
744   {MGT_ASSOC_RESP,            "Association Response"},
745   {MGT_REASSOC_REQ,           "Reassociation Request"},
746   {MGT_REASSOC_RESP,          "Reassociation Response"},
747   {MGT_PROBE_REQ,             "Probe Request"},
748   {MGT_PROBE_RESP,            "Probe Response"},
749   {MGT_MEASUREMENT_PILOT,     "Measurement Pilot"},
750   {MGT_BEACON,                "Beacon frame"},
751   {MGT_ATIM,                  "ATIM"},
752   {MGT_DISASS,                "Disassociate"},
753   {MGT_AUTHENTICATION,        "Authentication"},
754   {MGT_DEAUTHENTICATION,      "Deauthentication"},
755   {MGT_ACTION,                "Action"},
756   {MGT_ACTION_NO_ACK,         "Action No Ack"},
757   {MGT_ARUBA_WLAN,            "Aruba Management"},
758
759   {CTRL_CONTROL_WRAPPER,      "Control Wrapper"},
760   {CTRL_BLOCK_ACK_REQ,        "802.11 Block Ack Req"},
761   {CTRL_BLOCK_ACK,            "802.11 Block Ack"},
762   {CTRL_PS_POLL,              "Power-Save poll"},
763   {CTRL_RTS,                  "Request-to-send"},
764   {CTRL_CTS,                  "Clear-to-send"},
765   {CTRL_ACKNOWLEDGEMENT,      "Acknowledgement"},
766   {CTRL_CFP_END,              "CF-End (Control-frame)"},
767   {CTRL_CFP_ENDACK,           "CF-End + CF-Ack (Control-frame)"},
768
769   {DATA,                      "Data"},
770   {DATA_CF_ACK,               "Data + CF-Ack"},
771   {DATA_CF_POLL,              "Data + CF-Poll"},
772   {DATA_CF_ACK_POLL,          "Data + CF-Ack + CF-Poll"},
773   {DATA_NULL_FUNCTION,        "Null function (No data)"},
774   {DATA_CF_ACK_NOD,           "Acknowledgement (No data)"},
775   {DATA_CF_POLL_NOD,          "CF-Poll (No data)"},
776   {DATA_CF_ACK_POLL_NOD,      "CF-Ack/Poll (No data)"},
777   {DATA_QOS_DATA,             "QoS Data"},
778   {DATA_QOS_DATA_CF_ACK,      "QoS Data + CF-Acknowledgment"},
779   {DATA_QOS_DATA_CF_POLL,     "QoS Data + CF-Poll"},
780   {DATA_QOS_DATA_CF_ACK_POLL, "QoS Data + CF-Ack + CF-Poll"},
781   {DATA_QOS_NULL,             "QoS Null function (No data)"},
782   {DATA_QOS_CF_POLL_NOD,      "QoS CF-Poll (No Data)"},
783   {DATA_QOS_CF_ACK_POLL_NOD,  "QoS CF-Ack + CF-Poll (No data)"},
784   {0,                         NULL}
785 };
786
787 /* ************************************************************************* */
788 /*                             802.1D Tag Names                              */
789 /* ************************************************************************* */
790 static const char *qos_tags[8] = {
791   "Best Effort",
792   "Background",
793   "Spare",
794   "Excellent Effort",
795   "Controlled Load",
796   "Video",
797   "Voice",
798   "Network Control"
799 };
800
801 /* ************************************************************************* */
802 /*                 WME Access Category Names (by 802.1D Tag)                 */
803 /* ************************************************************************* */
804 static const char *qos_acs[8] = {
805   "Best Effort",
806   "Background",
807   "Background",
808   "Video",
809   "Video",
810   "Video",
811   "Voice",
812   "Voice"
813 };
814
815 /* ************************************************************************* */
816 /*                   WME Access Category Names (by WME ACI)                  */
817 /* ************************************************************************* */
818 static const value_string wme_acs[] = {
819   { 0, "Best Effort" },
820   { 1, "Background" },
821   { 2, "Video" },
822   { 3, "Voice" },
823   { 0, NULL }
824 };
825
826 /* ************************************************************************* */
827 /*                  Aruba Management Type                                    */
828 /* ************************************************************************* */
829 static const value_string aruba_mgt_typevals[] = {
830   { 0x0001,       "Hello" },
831   { 0x0002,       "Probe" },
832   { 0x0003,       "MTU" },
833   { 0x0004,       "Ageout" },
834   { 0x0005,       "Heartbeat" },
835   { 0x0006,       "Deauth" },
836   { 0x0007,       "Disassoc" },
837   { 0x0008,       "Probe response" },
838   { 0x0009,       "Tunnel update" },
839   { 0x000A,       "Laser beam active" },
840   { 0x000B,       "Client IP" },
841   { 0x000C,       "Laser beam active v2" },
842   { 0x000D,       "AP statistics" },
843   { 0,            NULL }
844 };
845
846 /*** Begin: Action Fixed Parameter ***/
847 #define CAT_SPECTRUM_MGMT      0
848 #define CAT_QOS                1
849 #define CAT_DLS                2
850 #define CAT_BLOCK_ACK          3
851 #define CAT_PUBLIC             4
852
853 #define CAT_RADIO_MEASUREMENT   5
854 #define CAT_FAST_BSS_TRANSITION 6
855 #define CAT_HT                  7
856 #define CAT_SA_QUERY            8
857 #define CAT_PUBLIC_PROTECTED    9
858 #define CAT_TDLS                12
859 #define CAT_MGMT_NOTIFICATION   17
860 #define CAT_VENDOR_SPECIFIC_PROTECTED 126
861 #define CAT_VENDOR_SPECIFIC     127
862
863 #ifdef MESH_OVERRIDES
864 #define CAT_MESH_PEER_LINK                 30 /* Per 802.11s draft 1.08.  ANA will probably revise this */
865 #define CAT_MESH_LINK_METRIC               31
866 #define CAT_MESH_PATH_SELECTION            32
867 #define CAT_MESH_INTERWORKING              33
868 #define CAT_MESH_RESOURCE_COORDINATION     34
869 #define CAT_MESH_SECURITY_ARCHITECTURE     35
870 #endif /* MESH_OVERRIDES */
871
872 #define SM_ACTION_MEASUREMENT_REQUEST   0
873 #define SM_ACTION_MEASUREMENT_REPORT    1
874 #define SM_ACTION_TPC_REQUEST           2
875 #define SM_ACTION_TPC_REPORT            3
876 #define SM_ACTION_CHAN_SWITCH_ANNC      4
877 #define SM_ACTION_EXT_CHAN_SWITCH_ANNC  5
878
879 #define SM_ACTION_ADDTS_REQUEST     0
880 #define SM_ACTION_ADDTS_RESPONSE    1
881 #define SM_ACTION_DELTS             2
882 #define SM_ACTION_QOS_SCHEDULE      3
883
884 #define SM_ACTION_DLS_REQUEST       0
885 #define SM_ACTION_DLS_RESPONSE      1
886 #define SM_ACTION_DLS_TEARDOWN      2
887
888 #define BA_ADD_BLOCK_ACK_REQUEST    0
889 #define BA_ADD_BLOCK_ACK_RESPONSE   1
890 #define BA_DELETE_BLOCK_ACK         2
891
892 #define PA_DSE_ENABLEMENT                  1
893 #define PA_DSE_DEENABLEMENT                2
894 #define PA_DSE_REG_LOC_ANNOUNCEMENT        3
895 #define PA_EXT_CHANNEL_SWITCH_ANNOUNCEMENT 4
896 #define PA_DSE_MEASUREMENT_REQUEST         5
897 #define PA_DSE_MEASUREMENT_REPORT          6
898 #define PA_MEASUREMENT_PILOT               7
899 #define PA_DSE_POWER_CONSTRAINT            8
900 #define PA_VENDOR_SPECIFIC                 9
901 #define PA_GAS_INITIAL_REQUEST             10
902 #define PA_GAS_INITIAL_RESPONSE            11
903 #define PA_GAS_COMEBACK_REQUEST            12
904 #define PA_GAS_COMEBACK_RESPONSE           13
905 #define PA_TDLS_DISCOVERY_RESPONSE         14
906
907 #define HT_ACTION_NOTIFY_CHAN_WIDTH           0
908 #define HT_ACTION_SM_PWR_SAVE                 1
909 #define HT_ACTION_PSMP_ACTION                 2
910 #define HT_ACTION_SET_PCO_PHASE               3
911 #define HT_ACTION_MIMO_CSI                    4
912 #define HT_ACTION_MIMO_BEAMFORMING            5
913 #define HT_ACTION_MIMO_COMPRESSED_BEAMFORMING 6
914 #define HT_ACTION_ANT_SEL_FEEDBACK            7
915 #define HT_ACTION_HT_INFO_EXCHANGE            8
916
917 /* IEEE Std 802.11r-2008, 7.4.8, Table 7-57g */
918 #define FT_ACTION_REQUEST               1
919 #define FT_ACTION_RESPONSE              2
920 #define FT_ACTION_CONFIRM               3
921 #define FT_ACTION_ACK                   4
922
923 /* SA Query Action frame codes (IEEE 802.11w-2009, 7.4.9) */
924 #define SA_QUERY_REQUEST                0
925 #define SA_QUERY_RESPONSE               1
926
927 /* IEEE Std 802.11z-2010, 7.4.11, Table 7-57v1 */
928 #define TDLS_SETUP_REQUEST              0
929 #define TDLS_SETUP_RESPONSE             1
930 #define TDLS_SETUP_CONFIRM              2
931 #define TDLS_TEARDOWN                   3
932 #define TDLS_PEER_TRAFFIC_INDICATION    4
933 #define TDLS_CHANNEL_SWITCH_REQUEST     5
934 #define TDLS_CHANNEL_SWITCH_RESPONSE    6
935 #define TDLS_PEER_PSM_REQUEST           7
936 #define TDLS_PEER_PSM_RESPONSE          8
937 #define TDLS_PEER_TRAFFIC_RESPONSE      9
938 #define TDLS_DISCOVERY_REQUEST          10
939
940 #ifdef MESH_OVERRIDES
941 #define MESH_PL_PEER_LINK_OPEN                      0
942 #define MESH_PL_PEER_LINK_CONFIRM                   1
943 #define MESH_PL_PEER_LINK_CLOSE                     2
944
945 #define MESH_PS_PATH_REQUEST                        0
946 #define MESH_PS_PATH_REPLY                          1
947 #define MESH_PS_PATH_ERROR                          2
948 #define MESH_PS_ROOT_ANNOUNCEMENT                   3
949 #endif /* MESH_OVERRIDES */
950
951 /* 11s draft, table 7-22 */
952 #define MESH_LINK_CANCELLED                     2
953 #define MESH_MAX_NEIGHBORS                      3
954 #define MESH_CONFIG_POLICY_VIOLATION            4
955 #define MESH_CLOSE_RCVD                         5
956 #define MESH_MAX_RETRIES                        6
957 #define MESH_CONFIRM_TIMEOUT                    7
958
959 /* Vendor actions */
960 /* MARVELL */
961 #define MRVL_ACTION_MESH_MANAGEMENT     1
962
963 #define MRVL_MESH_MGMT_ACTION_RREQ      0
964 #define MRVL_MESH_MGMT_ACTION_RREP      1
965 #define MRVL_MESH_MGMT_ACTION_RERR      2
966 #define MRVL_MESH_MGMT_ACTION_PLDM      3
967
968 /*** End: Action Fixed Parameter ***/
969
970 static const value_string ieee80211_tag_measure_request_type_flags[] = {
971   {0x00, "Basic Request"},
972   {0x01, "Clear Channel Assessment (CCA) Request"},
973   {0x02, "Receive Power Indication (RPI) Histogram Request"},
974   {0x03, "Channel Load Request"},
975   {0x04, "Noise Histogram Request"},
976   {0x05, "Beacon Request"},
977   {0x06, "Frame Request"},
978   {0x07, "STA Statistics Request"},
979   {0x08, "Location Configuration Indication (LCI) Request"},
980   {0x09, "Transmit Stream Measurement Request"},
981   {0x0A, "Measurement Pause Request"},
982   {0x00, NULL}
983 };
984
985 static const value_string ieee80211_tag_measure_report_type_flags[] = {
986   { 0x00, "Basic Report" },
987   { 0x01, "Clear Channel Assessment (CCA) Report" },
988   { 0x02, "Receive Power Indication (RPI) Histogram Report" },
989   { 0x03, "Channel Load Report" },
990   { 0x04, "Noise Histogram Report" },
991   { 0x05, "Beacon Report" },
992   { 0x06, "Frame Report" },
993   { 0x07, "STA Statistics Report" },
994   { 0x08, "Location Configuration Information (LCI) Report" },
995   { 0x09, "Transmit Stream Measurement Report" },
996   { 0x00, NULL }
997 };
998
999 static const true_false_string ieee80211_tag_measure_report_frame_info_frame_type_flag = {
1000   "Measurement Pilot Frame",
1001   "Beacon/Probe Response Frame"
1002 };
1003
1004 static const true_false_string ieee80211_tag_measure_map_field_bss_flag = {
1005   "At least one MPDU was received by another BSS or IBSS in the measurement period.",
1006   "No MPDUs were received from another BSS or IBSS in the measurement period."
1007 };
1008
1009 static const value_string ieee80211_tag_measure_request_measurement_mode_flags[] = {
1010   { 0x00, "Passive" },
1011   { 0x01, "Active" },
1012   { 0x02, "Beacon Table" },
1013   { 0x00, NULL }
1014 };
1015
1016 #define MEASURE_REQ_BEACON_SUB_SSID 0
1017 #define MEASURE_REQ_BEACON_SUB_BRI 1
1018 #define MEASURE_REQ_BEACON_SUB_RD 2
1019 #define MEASURE_REQ_BEACON_SUB_REQUEST 10
1020 #define MEASURE_REQ_BEACON_SUB_APCP 51
1021 #define MEASURE_REQ_BEACON_SUB_VS 221
1022
1023 static const value_string ieee80211_tag_measure_request_beacon_sub_id_flags[] = {
1024   { MEASURE_REQ_BEACON_SUB_SSID, "SSID" },
1025   { MEASURE_REQ_BEACON_SUB_BRI, "Beacon Reporting Information" },
1026   { MEASURE_REQ_BEACON_SUB_RD, "Reporting Detail" },
1027   { MEASURE_REQ_BEACON_SUB_REQUEST, "Request" },
1028   { MEASURE_REQ_BEACON_SUB_APCP, "AP Channel Report" },
1029   { MEASURE_REQ_BEACON_SUB_VS, "Vendor Specific" },
1030   { 0x00, NULL}
1031 };
1032
1033 static const value_string ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition_flags[] = {
1034   { 0x00, "Report to be issued after each measurement." },
1035   { 0x01, "The measured RCPI level is greater than an absolute threshold." },
1036   { 0x02, "The measured RCPI level is less than an absolute threshold." },
1037   { 0x03, "The measured RSNI level is greater than an absolute threshold." },
1038   { 0x04, "The measured RSNI level is less than an absolute threshold." },
1039   { 0x05, "The measured RCPI level is greater than a threshold defined by an offset from the serving AP's reference RCPI." },
1040   { 0x06, "The measured RCPI level is less than a threshold defined by an offset from the serving AP's reference RCPI." },
1041   { 0x07, "The measured RSNI level is greater than a threshold defined by an offset from the serving AP's reference RSNI." },
1042   { 0x08, "The measured RSNI level is less than a threshold defined by an offset from the serving AP's reference RSNI." },
1043   { 0x09, "The measured RCPI level is in a range bound by the serving AP's reference RCPI and an offset from the serving AP's reference RCPI." },
1044   { 0x0a, "The measured RSNI level is in a range bound by the serving AP's reference RSNI and an offset from the serving AP's reference RSNI." },
1045   { 0xfe, "Report not required to be issued" },
1046   { 0x00, NULL }
1047 };
1048
1049 static const value_string ieee80211_tag_measure_request_beacon_sub_reporting_detail_flags[] = {
1050   { 0, "No fixed length fields or elements" },
1051   { 1, "All fixed length fields and any requested elements in the Request information element if present" },
1052   { 2, "All fixed length fields and elements (default, used when Reporting Detail subelement is not included in Beacon Request" },
1053   { 0x00, NULL }
1054 };
1055
1056 static const value_string ieee80211_tag_measure_request_group_id_flags[] = {
1057   { 0x00, "STA Counters from dot11CountersTable" },
1058   { 0x01, "STA Counters from dot11MacStatistics group" },
1059   { 0x02, "QoS STA Counters for UP0 from dot11QosCountersTable" },
1060   { 0x03, "QoS STA Counters for UP1 from dot11QosCountersTable" },
1061   { 0x04, "QoS STA Counters for UP2 from dot11QosCountersTable" },
1062   { 0x05, "QoS STA Counters for UP3 from dot11QosCountersTable" },
1063   { 0x06, "QoS STA Counters for UP4 from dot11QosCountersTable" },
1064   { 0x07, "QoS STA Counters for UP5 from dot11QosCountersTable" },
1065   { 0x08, "QoS STA Counters for UP6 from dot11QosCountersTable" },
1066   { 0x09, "QoS STA Counters for UP7 from dot11QosCountersTable" },
1067   { 0x0a, "BSS Average Access Delays" },
1068   { 0x0b, "STA Counters from dot11A-MSDU Group" },
1069   { 0x0c, "STA Counters from dot11A-MPDU Group" },
1070   { 0x0d, "STA Counters from dot11 BAR, Channel Width, PSMP Group" },
1071   { 0x0e, "STA Counters from dot11Protection Group" },
1072   { 0x0f, "STBC Group" },
1073   { 0x00, NULL }
1074 };
1075
1076 static int proto_wlan = -1;
1077 static int proto_aggregate = -1;
1078 static packet_info * g_pinfo;
1079
1080 static int proto_radio = -1;
1081 static int proto_wlancap = -1;
1082 static int proto_prism = -1;
1083
1084 /* ************************************************************************* */
1085 /*                Header field info values for radio information             */
1086 /* ************************************************************************* */
1087 static int hf_mactime = -1;
1088 static int hf_hosttime = -1;
1089 static int hf_data_rate = -1;
1090 static int hf_channel = -1;
1091 static int hf_channel_frequency = -1;
1092 static int hf_normrssi_antsignal = -1;
1093 static int hf_dbm_antsignal = -1;
1094 static int hf_rawrssi_antsignal = -1;
1095 static int hf_normrssi_antnoise = -1;
1096 static int hf_dbm_antnoise = -1;
1097 static int hf_rawrssi_antnoise = -1;
1098 static int hf_signal_strength = -1;
1099
1100 /* Prism radio header */
1101
1102 static int hf_ieee80211_prism_msgcode = -1;
1103 static int hf_ieee80211_prism_msglen = -1;
1104 static int hf_ieee80211_prism_devname = -1;
1105 static int hf_ieee80211_prism_did = -1;
1106 static int hf_ieee80211_prism_did_type = -1;
1107 static int hf_ieee80211_prism_did_status = -1;
1108 static int hf_ieee80211_prism_did_length = -1;
1109 static int hf_ieee80211_prism_did_hosttime = -1;
1110 static int hf_ieee80211_prism_did_mactime = -1;
1111 static int hf_ieee80211_prism_did_channel = -1;
1112 static int hf_ieee80211_prism_did_rssi = -1;
1113 static int hf_ieee80211_prism_did_sq = -1;
1114 static int hf_ieee80211_prism_did_signal = -1;
1115 static int hf_ieee80211_prism_did_noise = -1;
1116 static int hf_ieee80211_prism_did_rate = -1;
1117 static int hf_ieee80211_prism_did_istx = -1;
1118 static int hf_ieee80211_prism_did_frmlen = -1;
1119 static int hf_ieee80211_prism_did_unknown = -1;
1120
1121 /* AVS WLANCAP radio header */
1122 static int hf_wlan_magic = -1;
1123 static int hf_wlan_version = -1;
1124 static int hf_wlan_length = -1;
1125 static int hf_wlan_phytype = -1;
1126 static int hf_wlan_antenna = -1;
1127 static int hf_wlan_priority = -1;
1128 static int hf_wlan_ssi_type = -1;
1129 static int hf_wlan_preamble = -1;
1130 static int hf_wlan_encoding = -1;
1131 static int hf_wlan_sequence = -1;
1132 static int hf_wlan_drops = -1;
1133 static int hf_wlan_receiver_addr = -1;
1134 static int hf_wlan_padding = -1;
1135
1136 /* ************************************************************************* */
1137 /*                Header field info values for FC-field                      */
1138 /* ************************************************************************* */
1139 static int hf_ieee80211_fc_field = -1;
1140 static int hf_ieee80211_fc_proto_version = -1;
1141 static int hf_ieee80211_fc_frame_type = -1;
1142 static int hf_ieee80211_fc_frame_subtype = -1;
1143 static int hf_ieee80211_fc_frame_type_subtype = -1;
1144
1145 static int hf_ieee80211_fc_flags = -1;
1146 static int hf_ieee80211_fc_to_ds = -1;
1147 static int hf_ieee80211_fc_from_ds = -1;
1148 static int hf_ieee80211_fc_data_ds = -1;
1149
1150 static int hf_ieee80211_fc_more_frag = -1;
1151 static int hf_ieee80211_fc_retry = -1;
1152 static int hf_ieee80211_fc_pwr_mgt = -1;
1153 static int hf_ieee80211_fc_more_data = -1;
1154 static int hf_ieee80211_fc_protected = -1;
1155 static int hf_ieee80211_fc_order = -1;
1156
1157 typedef struct retransmit_key {
1158   guint8  bssid[6];
1159   guint8  src[6];
1160   guint16 seq_control;
1161   guint   fnum;
1162 } retransmit_key;
1163
1164 static GHashTable *fc_analyse_retransmit_table = NULL;
1165 static GHashTable *fc_first_frame_table = NULL;
1166
1167 static int hf_ieee80211_fc_analysis_retransmission = -1;
1168 static int hf_ieee80211_fc_analysis_retransmission_frame = -1;
1169
1170 /* ************************************************************************* */
1171 /*                   Header values for Duration/ID field                     */
1172 /* ************************************************************************* */
1173 static int hf_ieee80211_did_duration = -1;
1174 static int hf_ieee80211_assoc_id = -1;
1175
1176 /* ************************************************************************* */
1177 /*         Header values for different address-fields (all 4 of them)        */
1178 /* ************************************************************************* */
1179 static int hf_ieee80211_addr_da = -1;  /* Destination address subfield */
1180 static int hf_ieee80211_addr_sa = -1;  /* Source address subfield */
1181 static int hf_ieee80211_addr_ra = -1;  /* Receiver address subfield */
1182 static int hf_ieee80211_addr_ta = -1;  /* Transmitter address subfield */
1183 static int hf_ieee80211_addr_bssid = -1;  /* address is bssid */
1184
1185 static int hf_ieee80211_addr = -1;  /* Source or destination address subfield */
1186
1187
1188 /* ************************************************************************* */
1189 /*                Header values for QoS control field                        */
1190 /* ************************************************************************* */
1191 static int hf_ieee80211_qos_priority = -1;
1192 static int hf_ieee80211_qos_ack_policy = -1;
1193 static int hf_ieee80211_qos_amsdu_present = -1;
1194 static int hf_ieee80211_qos_eosp = -1;
1195 static int hf_ieee80211_qos_bit4 = -1;
1196 static int hf_ieee80211_qos_txop_limit = -1;
1197 static int hf_ieee80211_qos_buf_state_indicated = -1;
1198 static int hf_ieee80211_qos_highest_pri_buf_ac = -1;
1199 static int hf_ieee80211_qos_qap_buf_load = -1;
1200 static int hf_ieee80211_qos_txop_dur_req = -1;
1201 static int hf_ieee80211_qos_queue_size = -1;
1202
1203 /* ************************************************************************* */
1204 /*                Header values for HT control field (+HTC)                  */
1205 /* ************************************************************************* */
1206 /* 802.11nD-1.10 & 802.11nD-2.0 7.1.3.5a */
1207 static int hf_ieee80211_htc = -1;
1208 static int hf_ieee80211_htc_lac = -1;
1209 static int hf_ieee80211_htc_lac_reserved = -1;
1210 static int hf_ieee80211_htc_lac_trq = -1;
1211 static int hf_ieee80211_htc_lac_mai_aseli = -1;
1212 static int hf_ieee80211_htc_lac_mai_mrq = -1;
1213 static int hf_ieee80211_htc_lac_mai_msi = -1;
1214 static int hf_ieee80211_htc_lac_mai_reserved = -1;
1215 static int hf_ieee80211_htc_lac_mfsi = -1;
1216 static int hf_ieee80211_htc_lac_mfb = -1;
1217 static int hf_ieee80211_htc_lac_asel_command = -1;
1218 static int hf_ieee80211_htc_lac_asel_data = -1;
1219 static int hf_ieee80211_htc_cal_pos = -1;
1220 static int hf_ieee80211_htc_cal_seq = -1;
1221 static int hf_ieee80211_htc_reserved1 = -1;
1222 static int hf_ieee80211_htc_csi_steering = -1;
1223 static int hf_ieee80211_htc_ndp_announcement = -1;
1224 static int hf_ieee80211_htc_reserved2 = -1;
1225 static int hf_ieee80211_htc_ac_constraint = -1;
1226 static int hf_ieee80211_htc_rdg_more_ppdu = -1;
1227
1228 /* ************************************************************************* */
1229 /*                Header values for sequence number field                    */
1230 /* ************************************************************************* */
1231 static int hf_ieee80211_frag_number = -1;
1232 static int hf_ieee80211_seq_number = -1;
1233
1234 /* ************************************************************************* */
1235 /*                   Header values for Frame Check field                     */
1236 /* ************************************************************************* */
1237 static int hf_ieee80211_fcs = -1;
1238 static int hf_ieee80211_fcs_good = -1;
1239 static int hf_ieee80211_fcs_bad = -1;
1240
1241 /* ************************************************************************* */
1242 /*                   Header values for reassembly                            */
1243 /* ************************************************************************* */
1244 static int hf_ieee80211_fragments = -1;
1245 static int hf_ieee80211_fragment = -1;
1246 static int hf_ieee80211_fragment_overlap = -1;
1247 static int hf_ieee80211_fragment_overlap_conflict = -1;
1248 static int hf_ieee80211_fragment_multiple_tails = -1;
1249 static int hf_ieee80211_fragment_too_long_fragment = -1;
1250 static int hf_ieee80211_fragment_error = -1;
1251 static int hf_ieee80211_fragment_count = -1;
1252 static int hf_ieee80211_reassembled_in = -1;
1253 static int hf_ieee80211_reassembled_length = -1;
1254
1255 static int proto_wlan_mgt = -1;
1256
1257 /* ************************************************************************* */
1258 /*                   Header values for WAVE                                  */
1259 /* ************************************************************************* */
1260
1261 static int hf_ieee80211_pst_timingquality = -1;
1262 static int hf_ieee80211_pst_providercount = -1;
1263 static int hf_ieee80211_pst_providercap =   -1;
1264 static int hf_ieee80211_pst_length =        -1;
1265 static int hf_ieee80211_pst_contents =      -1;
1266 static int hf_ieee80211_pst_acid =        -1;
1267 static int hf_ieee80211_pst_acm_length =  -1;
1268 static int hf_ieee80211_pst_acm_contents =-1;
1269 static int hf_ieee80211_pst_acf =         -1;
1270 static int hf_ieee80211_pst_priority =    -1;
1271 static int hf_ieee80211_pst_ipv6addr =    -1;
1272 static int hf_ieee80211_pst_serviceport = -1;
1273 static int hf_ieee80211_pst_addressing =  -1;
1274 static int hf_ieee80211_pst_macaddr =     -1;
1275 static int hf_ieee80211_pst_channel =     -1;
1276
1277 static int hf_ieee80211_chan_noc =        -1;
1278 static int hf_ieee80211_chan_length =     -1;
1279 static int hf_ieee80211_chan_content =    -1;
1280 static int hf_ieee80211_chan_channel =    -1;
1281 static int hf_ieee80211_chan_adapt   =    -1;
1282 static int hf_ieee80211_chan_rate    =    -1;
1283 static int hf_ieee80211_chan_tx_pow  =    -1;
1284
1285 #ifdef MESH_OVERRIDES
1286 /* ************************************************************************* */
1287 /*                   Header values for Mesh Header field                     */
1288 /* ************************************************************************* */
1289 static int hf_ieee80211_mesh_ttl = -1;
1290 static int hf_ieee80211_mesh_seq = -1;
1291 static int hf_ieee80211_mesh_flags = -1;
1292 static int hf_ieee80211_mesh_ae1 = -1;
1293 static int hf_ieee80211_mesh_ae2 = -1;
1294 static int hf_ieee80211_mesh_ae3 = -1;
1295 #endif /* MESH_OVERRIDES */
1296
1297 /* ************************************************************************* */
1298 /*                      Fixed fields found in mgt frames                     */
1299 /* ************************************************************************* */
1300 static int hf_ieee80211_fixed_parameters = -1;  /* Protocol payload for management frames */
1301
1302 static int hf_ieee80211_ff_auth_alg = -1;            /* Authentication algorithm field            */
1303 static int hf_ieee80211_ff_auth_seq = -1;            /* Authentication transaction sequence       */
1304 static int hf_ieee80211_ff_current_ap = -1;          /* Current AP MAC address                    */
1305 static int hf_ieee80211_ff_listen_ival = -1;         /* Listen interval fixed field               */
1306 static int hf_ieee80211_ff_timestamp = -1;           /* 64 bit timestamp                          */
1307 static int hf_ieee80211_ff_beacon_interval = -1;     /* 16 bit Beacon interval                    */
1308 static int hf_ieee80211_ff_assoc_id = -1;            /* 16 bit AID field                          */
1309 static int hf_ieee80211_ff_reason = -1;              /* 16 bit reason code                        */
1310 static int hf_ieee80211_ff_status_code = -1;         /* Status code                               */
1311 static int hf_ieee80211_ff_category_code = -1;       /* 8 bit Category code */
1312 static int hf_ieee80211_ff_action_code = -1;         /* 8 bit Action code */
1313 static int hf_ieee80211_ff_dialog_token = -1;        /* 8 bit Dialog token */
1314 static int hf_ieee80211_ff_wme_action_code = -1;     /* Management notification action code */
1315 static int hf_ieee80211_ff_wme_status_code = -1;     /* Management notification setup response status code */
1316 static int hf_ieee80211_ff_qos_action_code = -1;
1317 static int hf_ieee80211_ff_dls_action_code = -1;
1318 static int hf_ieee80211_ff_dst_mac_addr = -1;        /* DLS destination MAC addressi */
1319 static int hf_ieee80211_ff_src_mac_addr = -1;        /* DLS source MAC addressi */
1320 static int hf_ieee80211_ff_dls_timeout = -1;         /* DLS timeout value */
1321 static int hf_ieee80211_ff_ft_action_code = -1; /* 8 bit FT Action code */
1322 static int hf_ieee80211_ff_sta_address = -1;
1323 static int hf_ieee80211_ff_target_ap_address = -1;
1324 static int hf_ieee80211_ff_gas_comeback_delay = -1;
1325 static int hf_ieee80211_ff_gas_fragment_id = -1;
1326 static int hf_ieee80211_ff_more_gas_fragments = -1;
1327 static int hf_ieee80211_ff_query_request_length = -1;
1328 static int hf_ieee80211_ff_query_request = -1;
1329 static int hf_ieee80211_ff_query_response_length = -1;
1330 static int hf_ieee80211_ff_query_response = -1;
1331 static int hf_ieee80211_ff_anqp_info_id = -1;
1332 static int hf_ieee80211_ff_anqp_info_length = -1;
1333 static int hf_ieee80211_ff_anqp_info = -1;
1334 static int hf_ieee80211_ff_tdls_action_code = -1;
1335 static int hf_ieee80211_ff_target_channel = -1;
1336 static int hf_ieee80211_ff_regulatory_class = -1;
1337
1338 static int hf_ieee80211_ff_sa_query_action_code = -1;
1339 static int hf_ieee80211_ff_transaction_id = -1;
1340
1341 /* Vendor specific */
1342 static int hf_ieee80211_ff_marvell_action_type = -1;
1343 static int hf_ieee80211_ff_marvell_mesh_mgt_action_code = -1;
1344 static int hf_ieee80211_ff_mesh_mgt_length = -1;     /* Mesh Management length */
1345 static int hf_ieee80211_ff_mesh_mgt_mode = -1;       /* Mesh Management mode */
1346 static int hf_ieee80211_ff_mesh_mgt_ttl = -1;        /* Mesh Management TTL */
1347 static int hf_ieee80211_ff_mesh_mgt_dstcount = -1;   /* Mesh Management dst count */
1348 static int hf_ieee80211_ff_mesh_mgt_hopcount = -1;   /* Mesh Management hop count */
1349 static int hf_ieee80211_ff_mesh_mgt_rreqid = -1;     /* Mesh Management RREQ ID */
1350 static int hf_ieee80211_ff_mesh_mgt_sa = -1;         /* Mesh Management src addr */
1351 static int hf_ieee80211_ff_mesh_mgt_ssn = -1;        /* Mesh Management src sequence number */
1352 static int hf_ieee80211_ff_mesh_mgt_metric = -1;     /* Mesh Management metric */
1353 static int hf_ieee80211_ff_mesh_mgt_flags = -1;      /* Mesh Management RREQ flags */
1354 static int hf_ieee80211_ff_mesh_mgt_da = -1;         /* Mesh Management dst addr */
1355 static int hf_ieee80211_ff_mesh_mgt_dsn = -1;        /* Mesh Management dst sequence number */
1356 static int hf_ieee80211_ff_mesh_mgt_lifetime = -1;   /* Mesh Management lifetime */
1357
1358
1359 static int hf_ieee80211_ff_ba_action = -1;
1360
1361 static int hf_ieee80211_ff_block_ack_params = -1;
1362 static int hf_ieee80211_ff_block_ack_params_amsdu_permitted = -1;
1363 static int hf_ieee80211_ff_block_ack_params_policy = -1;
1364 static int hf_ieee80211_ff_block_ack_params_tid = -1;
1365 static int hf_ieee80211_ff_block_ack_params_buffer_size = -1;
1366
1367 static int hf_ieee80211_ff_block_ack_timeout = -1;
1368
1369 static int hf_ieee80211_ff_block_ack_ssc = -1;
1370 static int hf_ieee80211_ff_block_ack_ssc_fragment = -1;
1371 static int hf_ieee80211_ff_block_ack_ssc_sequence = -1;
1372
1373 static int hf_ieee80211_ff_delba_param = -1;
1374 static int hf_ieee80211_ff_delba_param_reserved = -1;
1375 static int hf_ieee80211_ff_delba_param_init = -1;
1376 static int hf_ieee80211_ff_delba_param_tid = -1;
1377
1378 static int hf_ieee80211_ff_max_reg_pwr = -1;
1379 static int hf_ieee80211_ff_measurement_pilot_int = -1;
1380 static int hf_ieee80211_ff_country_str = -1;
1381 static int hf_ieee80211_ff_max_tx_pwr = -1;
1382 static int hf_ieee80211_ff_tx_pwr_used = -1;
1383 static int hf_ieee80211_ff_transceiver_noise_floor = -1;
1384 static int hf_ieee80211_ff_channel_width = -1;
1385
1386 static int hf_ieee80211_ff_qos_info_ap = -1;
1387 static int hf_ieee80211_ff_qos_info_ap_edca_param_set_counter = -1;
1388 static int hf_ieee80211_ff_qos_info_ap_q_ack = -1;
1389 static int hf_ieee80211_ff_qos_info_ap_queue_req = -1;
1390 static int hf_ieee80211_ff_qos_info_ap_txop_request = -1;
1391 static int hf_ieee80211_ff_qos_info_ap_reserved = -1;
1392
1393 static int hf_ieee80211_ff_qos_info_sta = -1;
1394 static int hf_ieee80211_ff_qos_info_sta_ac_vo = -1;
1395 static int hf_ieee80211_ff_qos_info_sta_ac_vi = -1;
1396 static int hf_ieee80211_ff_qos_info_sta_ac_bk = -1;
1397 static int hf_ieee80211_ff_qos_info_sta_ac_be = -1;
1398 static int hf_ieee80211_ff_qos_info_sta_q_ack = -1;
1399 static int hf_ieee80211_ff_qos_info_sta_max_sp_len = -1;
1400 static int hf_ieee80211_ff_qos_info_sta_more_data_ack = -1;
1401
1402 static int hf_ieee80211_ff_sm_pwr_save = -1;
1403 static int hf_ieee80211_ff_sm_pwr_save_enabled = -1;
1404 static int hf_ieee80211_ff_sm_pwr_save_sm_mode = -1;
1405 static int hf_ieee80211_ff_sm_pwr_save_reserved = -1;
1406
1407 static int hf_ieee80211_ff_pco_phase_cntrl = -1;
1408
1409 static int hf_ieee80211_ff_psmp_param_set = -1;
1410 static int hf_ieee80211_ff_psmp_param_set_n_sta = -1;
1411 static int hf_ieee80211_ff_psmp_param_set_more_psmp = -1;
1412 static int hf_ieee80211_ff_psmp_param_set_psmp_sequence_duration = -1;
1413
1414 static int hf_ieee80211_ff_mimo_cntrl = -1;
1415 static int hf_ieee80211_ff_mimo_cntrl_nc_index = -1;
1416 static int hf_ieee80211_ff_mimo_cntrl_nr_index = -1;
1417 static int hf_ieee80211_ff_mimo_cntrl_channel_width = -1;
1418 static int hf_ieee80211_ff_mimo_cntrl_grouping = -1;
1419 static int hf_ieee80211_ff_mimo_cntrl_coefficient_size = -1;
1420 static int hf_ieee80211_ff_mimo_cntrl_codebook_info = -1;
1421 static int hf_ieee80211_ff_mimo_cntrl_remaining_matrix_segment = -1;
1422 static int hf_ieee80211_ff_mimo_cntrl_reserved = -1;
1423 static int hf_ieee80211_ff_mimo_cntrl_sounding_timestamp = -1;
1424
1425 static int hf_ieee80211_ff_ant_selection = -1;
1426 static int hf_ieee80211_ff_ant_selection_0 = -1;
1427 static int hf_ieee80211_ff_ant_selection_1 = -1;
1428 static int hf_ieee80211_ff_ant_selection_2 = -1;
1429 static int hf_ieee80211_ff_ant_selection_3 = -1;
1430 static int hf_ieee80211_ff_ant_selection_4 = -1;
1431 static int hf_ieee80211_ff_ant_selection_5 = -1;
1432 static int hf_ieee80211_ff_ant_selection_6 = -1;
1433 static int hf_ieee80211_ff_ant_selection_7 = -1;
1434
1435 static int hf_ieee80211_ff_ext_channel_switch_announcement = -1;
1436 static int hf_ieee80211_ff_ext_channel_switch_announcement_switch_mode = -1;
1437 static int hf_ieee80211_ff_ext_channel_switch_announcement_new_reg_class = -1;
1438 static int hf_ieee80211_ff_ext_channel_switch_announcement_new_chan_number = -1;
1439 static int hf_ieee80211_ff_ext_channel_switch_announcement_switch_count = -1;
1440
1441 static int hf_ieee80211_ff_ht_info = -1;
1442 static int hf_ieee80211_ff_ht_info_information_request = -1;
1443 static int hf_ieee80211_ff_ht_info_40_mhz_intolerant = -1;
1444 static int hf_ieee80211_ff_ht_info_sta_chan_width = -1;
1445 static int hf_ieee80211_ff_ht_info_reserved = -1;
1446
1447 static int hf_ieee80211_ff_ht_action = -1;
1448
1449 static int hf_ieee80211_ff_psmp_sta_info = -1;
1450 static int hf_ieee80211_ff_psmp_sta_info_type = -1;
1451 static int hf_ieee80211_ff_psmp_sta_info_dtt_start_offset = -1;
1452 static int hf_ieee80211_ff_psmp_sta_info_dtt_duration = -1;
1453 static int hf_ieee80211_ff_psmp_sta_info_sta_id = -1;
1454 static int hf_ieee80211_ff_psmp_sta_info_utt_start_offset = -1;
1455 static int hf_ieee80211_ff_psmp_sta_info_utt_duration = -1;
1456 static int hf_ieee80211_ff_psmp_sta_info_reserved_small= -1;
1457 static int hf_ieee80211_ff_psmp_sta_info_reserved_large = -1;
1458 static int hf_ieee80211_ff_psmp_sta_info_psmp_multicast_id = -1;
1459
1460 static int hf_ieee80211_ff_mimo_csi_snr = -1;
1461
1462 #ifdef MESH_OVERRIDES
1463
1464 /*** Begin: Mesh Frame Format ***/
1465 static int hf_ieee80211_ff_mesh_mgt_action_ps_code = -1;/* Mesh Management path selection action code */
1466 static int hf_ieee80211_ff_mesh_mgt_action_pl_code = -1;/* Mesh Management peer link action code */
1467 /* NB: see above for more items */
1468 static int hf_ieee80211_ff_mesh_mgt_dest_flags = -1;     /* Mesh Management destination flags */
1469 static int hf_ieee80211_ff_mesh_mgt_srccount = -1;  /* Mesh Management src count */
1470 static int hf_ieee80211_ff_mesh_mgt_dest_do_flags = -1;  /* Mesh Management Destination Only flag */
1471 static int hf_ieee80211_ff_mesh_mgt_dest_rf_flags = -1;  /* Mesh Management Reply and Forward flag */
1472
1473
1474 /* variable header fields */
1475 static int hf_ieee80211_mesh_mgt_pl_subtype = -1;/* Mesh Management peer link frame subtype */
1476 static int hf_ieee80211_mesh_mgt_pl_local_link_id = -1;/* Mesh Management local link id */
1477 static int hf_ieee80211_mesh_mgt_pl_peer_link_id = -1;/* Mesh Management peer link id */
1478 static int hf_ieee80211_mesh_mgt_pl_reason_code = -1;/* Mesh Management peer link reason code */
1479 static int hf_ieee80211_mesh_config_version = -1;
1480 static int hf_ieee80211_mesh_config_path_sel_protocol = -1;
1481 static int hf_ieee80211_mesh_config_path_sel_metric = -1;
1482 static int hf_ieee80211_mesh_config_congestion_control = -1;
1483 static int hf_ieee80211_mesh_config_channel_prec = -1;
1484 static int hf_ieee80211_mesh_config_capability = -1;
1485 static int hf_ieee80211_mesh_id = -1;
1486 /*** End: Mesh Frame Format ***/
1487
1488 #endif /* MESH_OVERRIDES */
1489
1490 static int hf_ieee80211_ff_public_action = -1;
1491
1492 /* ************************************************************************* */
1493 /*            Flags found in the capability field (fixed field)              */
1494 /* ************************************************************************* */
1495 static int hf_ieee80211_ff_capture = -1;
1496 static int hf_ieee80211_ff_cf_ess = -1;
1497 static int hf_ieee80211_ff_cf_ibss = -1;
1498 static int hf_ieee80211_ff_cf_sta_poll = -1; /* CF pollable status for a STA            */
1499 static int hf_ieee80211_ff_cf_ap_poll = -1;  /* CF pollable status for an AP            */
1500 static int hf_ieee80211_ff_cf_privacy = -1;
1501 static int hf_ieee80211_ff_cf_preamble = -1;
1502 static int hf_ieee80211_ff_cf_pbcc = -1;
1503 static int hf_ieee80211_ff_cf_agility = -1;
1504 static int hf_ieee80211_ff_short_slot_time = -1;
1505 static int hf_ieee80211_ff_dsss_ofdm = -1;
1506 static int hf_ieee80211_ff_cf_spec_man = -1;
1507 static int hf_ieee80211_ff_cf_apsd = -1;
1508 static int hf_ieee80211_ff_cf_del_blk_ack = -1;
1509 static int hf_ieee80211_ff_cf_imm_blk_ack = -1;
1510
1511 /* ************************************************************************* */
1512 /*                       A-MSDU fields                                             */
1513 /* ************************************************************************* */
1514 static int hf_ieee80211_amsdu_msdu_header_text = -1;
1515
1516
1517 /* ************************************************************************* */
1518 /*                       Tagged value format fields                          */
1519 /* ************************************************************************* */
1520 static int hf_ieee80211_tagged_parameters = -1;  /* Fixed payload item */
1521 static int hf_ieee80211_tag = -1;
1522 static int hf_ieee80211_tag_number = -1;
1523 static int hf_ieee80211_tag_length = -1;
1524 static int hf_ieee80211_tag_interpretation = -1;
1525 static int hf_ieee80211_tag_oui = -1;
1526 static int hf_ieee80211_tag_ssid = -1;
1527 static int hf_ieee80211_tag_supp_rates = -1;
1528 static int hf_ieee80211_tag_fh_dwell_time = -1;
1529 static int hf_ieee80211_tag_fh_hop_set = -1;
1530 static int hf_ieee80211_tag_fh_hop_pattern = -1;
1531 static int hf_ieee80211_tag_fh_hop_index = -1;
1532 static int hf_ieee80211_tag_ds_param_channel = -1;
1533 static int hf_ieee80211_tag_cfp_count = -1;
1534 static int hf_ieee80211_tag_cfp_period = -1;
1535 static int hf_ieee80211_tag_cfp_max_duration = -1;
1536 static int hf_ieee80211_tag_cfp_dur_remaining = -1;
1537 static int hf_ieee80211_tim_dtim_count = -1;
1538 static int hf_ieee80211_tim_dtim_period = -1;
1539 static int hf_ieee80211_tim_bmapctl = -1;
1540 static int hf_ieee80211_tim_bmapctl_mcast = -1;
1541 static int hf_ieee80211_tim_bmapctl_offset = -1;
1542 static int hf_ieee80211_tim_partial_virtual_bitmap = -1;
1543 static int hf_ieee80211_tag_ibss_atim_window = -1;
1544 static int hf_ieee80211_tag_country_info_code = -1;
1545 static int hf_ieee80211_tag_country_info_env = -1;
1546 static int hf_ieee80211_tag_country_info_fnm = -1;
1547 static int hf_ieee80211_tag_country_info_fnm_fcn = -1;
1548 static int hf_ieee80211_tag_country_info_fnm_nc = -1;
1549 static int hf_ieee80211_tag_country_info_fnm_mtpl = -1;
1550 static int hf_ieee80211_tag_country_info_rrc = -1;
1551 static int hf_ieee80211_tag_country_info_rrc_rei = -1;
1552 static int hf_ieee80211_tag_country_info_rrc_rc = -1;
1553 static int hf_ieee80211_tag_country_info_rrc_cc = -1;
1554 static int hf_ieee80211_tag_fh_hopping_parameter_prime_radix = -1;
1555 static int hf_ieee80211_tag_fh_hopping_parameter_nb_channels = -1;
1556 static int hf_ieee80211_tag_fh_hopping_table_flag = -1;
1557 static int hf_ieee80211_tag_fh_hopping_table_number_of_sets = -1;
1558 static int hf_ieee80211_tag_fh_hopping_table_modulus = -1;
1559 static int hf_ieee80211_tag_fh_hopping_table_offset = -1;
1560 static int hf_ieee80211_tag_fh_hopping_random_table = -1;
1561 static int hf_ieee80211_tag_request = -1;
1562 static int hf_ieee80211_tag_challenge_text = -1;
1563
1564 static int hf_ieee80211_wep_iv = -1;
1565 static int hf_ieee80211_wep_iv_weak = -1;
1566 static int hf_ieee80211_tkip_extiv = -1;
1567 static int hf_ieee80211_ccmp_extiv = -1;
1568 static int hf_ieee80211_wep_key = -1;
1569 static int hf_ieee80211_wep_icv = -1;
1570
1571 static int hf_ieee80211_block_ack_request_control = -1;
1572 static int hf_ieee80211_block_ack_control = -1;
1573 static int hf_ieee80211_block_ack_control_ack_policy = -1;
1574 static int hf_ieee80211_block_ack_control_multi_tid = -1;
1575 static int hf_ieee80211_block_ack_control_compressed_bitmap = -1;
1576 static int hf_ieee80211_block_ack_control_reserved = -1;
1577
1578 static int hf_ieee80211_block_ack_control_basic_tid_info = -1;
1579 static int hf_ieee80211_block_ack_control_compressed_tid_info = -1;
1580 static int hf_ieee80211_block_ack_control_multi_tid_info = -1;
1581
1582 static int hf_ieee80211_block_ack_multi_tid_info = -1;
1583 static int hf_ieee80211_block_ack_request_type = -1;
1584 static int hf_ieee80211_block_ack_multi_tid_reserved = -1;
1585 static int hf_ieee80211_block_ack_multi_tid_value = -1;
1586 static int hf_ieee80211_block_ack_type = -1;
1587 static int hf_ieee80211_block_ack_bitmap = -1;
1588
1589 static int hf_ieee80211_tag_measure_request_measurement_mode = -1;
1590 static int hf_ieee80211_tag_measure_request_bssid = -1;
1591
1592 static int hf_ieee80211_tag_measure_request_subelement_length = -1;
1593 static int hf_ieee80211_tag_measure_request_beacon_sub_id = -1;
1594 static int hf_ieee80211_tag_measure_request_beacon_sub_ssid = -1;
1595 static int hf_ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition = -1;
1596 static int hf_ieee80211_tag_measure_request_beacon_sub_bri_threshold_offset = -1;
1597 static int hf_ieee80211_tag_measure_request_beacon_sub_reporting_detail = -1;
1598 static int hf_ieee80211_tag_measure_request_beacon_sub_request = -1;
1599 static int hf_ieee80211_tag_measure_request_beacon_unknown = -1;
1600
1601 static int hf_ieee80211_tag_measure_request_frame_request_type = -1;
1602 static int hf_ieee80211_tag_measure_request_mac_address  = -1;
1603 static int hf_ieee80211_tag_measure_request_peer_mac_address = -1;
1604 static int hf_ieee80211_tag_measure_request_group_id = -1;
1605
1606 static int hf_ieee80211_ht_cap = -1;
1607 static int hf_ieee80211_ht_vs_cap = -1;
1608 static int hf_ieee80211_ht_ldpc_coding = -1;
1609 static int hf_ieee80211_ht_chan_width = -1;
1610 static int hf_ieee80211_ht_sm_pwsave = -1;
1611 static int hf_ieee80211_ht_green = -1;
1612 static int hf_ieee80211_ht_short20 = -1;
1613 static int hf_ieee80211_ht_short40 = -1;
1614 static int hf_ieee80211_ht_tx_stbc = -1;
1615 static int hf_ieee80211_ht_rx_stbc = -1;
1616 static int hf_ieee80211_ht_delayed_block_ack = -1;
1617 static int hf_ieee80211_ht_max_amsdu = -1;
1618 static int hf_ieee80211_ht_dss_cck_40 = -1;
1619 static int hf_ieee80211_ht_psmp = -1;
1620 static int hf_ieee80211_ht_40_mhz_intolerant = -1;
1621 static int hf_ieee80211_ht_l_sig = -1;
1622
1623 static int hf_ieee80211_ampduparam = -1;
1624 static int hf_ieee80211_ampduparam_vs = -1;
1625 static int hf_ieee80211_ampduparam_mpdu = -1;
1626 static int hf_ieee80211_ampduparam_mpdu_start_spacing = -1;
1627 static int hf_ieee80211_ampduparam_reserved = -1;
1628
1629 static int hf_ieee80211_mcsset = -1;
1630 static int hf_ieee80211_mcsset_vs = -1;
1631 static int hf_ieee80211_mcsset_rx_bitmask_0to7 = -1;
1632 static int hf_ieee80211_mcsset_rx_bitmask_8to15 = -1;
1633 static int hf_ieee80211_mcsset_rx_bitmask_16to23 = -1;
1634 static int hf_ieee80211_mcsset_rx_bitmask_24to31 = -1;
1635 static int hf_ieee80211_mcsset_rx_bitmask_32 = -1;
1636 static int hf_ieee80211_mcsset_rx_bitmask_33to38 = -1;
1637 static int hf_ieee80211_mcsset_rx_bitmask_39to52 = -1;
1638 static int hf_ieee80211_mcsset_rx_bitmask_53to76 = -1;
1639 static int hf_ieee80211_mcsset_highest_data_rate = -1;
1640 static int hf_ieee80211_mcsset_tx_mcs_set_defined = -1;
1641 static int hf_ieee80211_mcsset_tx_rx_mcs_set_not_equal = -1;
1642 static int hf_ieee80211_mcsset_tx_max_spatial_streams = -1;
1643 static int hf_ieee80211_mcsset_tx_unequal_modulation = -1;
1644
1645 static int hf_ieee80211_htex_cap = -1;
1646 static int hf_ieee80211_htex_vs_cap = -1;
1647 static int hf_ieee80211_htex_pco = -1;
1648 static int hf_ieee80211_htex_transtime = -1;
1649 static int hf_ieee80211_htex_mcs = -1;
1650 static int hf_ieee80211_htex_htc_support = -1;
1651 static int hf_ieee80211_htex_rd_responder = -1;
1652
1653 static int hf_ieee80211_txbf = -1;
1654 static int hf_ieee80211_txbf_vs = -1;
1655 static int hf_ieee80211_txbf_cap = -1;
1656 static int hf_ieee80211_txbf_rcv_ssc = -1;
1657 static int hf_ieee80211_txbf_tx_ssc = -1;
1658 static int hf_ieee80211_txbf_rcv_ndp = -1;
1659 static int hf_ieee80211_txbf_tx_ndp = -1;
1660 static int hf_ieee80211_txbf_impl_txbf = -1;
1661 static int hf_ieee80211_txbf_calib = -1;
1662 static int hf_ieee80211_txbf_expl_csi = -1;
1663 static int hf_ieee80211_txbf_expl_uncomp_fm = -1;
1664 static int hf_ieee80211_txbf_expl_comp_fm = -1;
1665 static int hf_ieee80211_txbf_expl_bf_csi = -1;
1666 static int hf_ieee80211_txbf_expl_uncomp_fm_feed = -1;
1667 static int hf_ieee80211_txbf_expl_comp_fm_feed = -1;
1668 static int hf_ieee80211_txbf_csi_num_bf_ant = -1;
1669 static int hf_ieee80211_txbf_min_group = -1;
1670 static int hf_ieee80211_txbf_uncomp_sm_bf_ant = -1;
1671 static int hf_ieee80211_txbf_comp_sm_bf_ant = -1;
1672 static int hf_ieee80211_txbf_csi_max_rows_bf = -1;
1673 static int hf_ieee80211_txbf_chan_est = -1;
1674 static int hf_ieee80211_txbf_resrv = -1;
1675
1676 /*** Begin: 802.11n D1.10 - HT Information IE  ***/
1677 static int hf_ieee80211_ht_info_primary_channel = -1;
1678
1679 static int hf_ieee80211_ht_info_delimiter1 = -1;
1680 static int hf_ieee80211_ht_info_secondary_channel_offset = -1;
1681 static int hf_ieee80211_ht_info_channel_width = -1;
1682 static int hf_ieee80211_ht_info_rifs_mode = -1;
1683 static int hf_ieee80211_ht_info_psmp_stas_only = -1;
1684 static int hf_ieee80211_ht_info_service_interval_granularity = -1;
1685
1686 static int hf_ieee80211_ht_info_delimiter2 = -1;
1687 static int hf_ieee80211_ht_info_operating_mode = -1;
1688 static int hf_ieee80211_ht_info_non_greenfield_sta_present = -1;
1689 static int hf_ieee80211_ht_info_transmit_burst_limit = -1;
1690 static int hf_ieee80211_ht_info_obss_non_ht_stas_present = -1;
1691 static int hf_ieee80211_ht_info_reserved_1 = -1;
1692
1693 static int hf_ieee80211_ht_info_delimiter3 = -1;
1694 static int hf_ieee80211_ht_info_reserved_2 = -1;
1695 static int hf_ieee80211_ht_info_dual_beacon = -1;
1696 static int hf_ieee80211_ht_info_dual_cts_protection = -1;
1697 static int hf_ieee80211_ht_info_secondary_beacon = -1;
1698 static int hf_ieee80211_ht_info_lsig_txop_protection_full_support = -1;
1699 static int hf_ieee80211_ht_info_pco_active = -1;
1700 static int hf_ieee80211_ht_info_pco_phase = -1;
1701 static int hf_ieee80211_ht_info_reserved_3 = -1;
1702 /*** End: 802.11n D1.10 - HT Information IE  ***/
1703
1704 static int hf_ieee80211_tag_secondary_channel_offset = -1;
1705
1706 static int hf_ieee80211_tag_power_constraint_local = -1;
1707
1708 static int hf_ieee80211_tag_power_capability_min = -1;
1709 static int hf_ieee80211_tag_power_capability_max = -1;
1710
1711 static int hf_ieee80211_tag_tpc_report_trsmt_pow = -1;
1712 static int hf_ieee80211_tag_tpc_report_link_mrg = -1;
1713
1714 static int hf_ieee80211_tag_supported_channels = -1;
1715 static int hf_ieee80211_tag_supported_channels_first = -1;
1716 static int hf_ieee80211_tag_supported_channels_range = -1;
1717
1718 static int hf_ieee80211_csa_channel_switch_mode = -1;
1719 static int hf_ieee80211_csa_new_channel_number = -1;
1720 static int hf_ieee80211_csa_channel_switch_count = -1;
1721
1722 static int hf_ieee80211_tag_measure_request_token = -1;
1723 static int hf_ieee80211_tag_measure_request_mode = -1;
1724 static int hf_ieee80211_tag_measure_request_mode_parallel = -1;
1725 static int hf_ieee80211_tag_measure_request_mode_enable = -1;
1726 static int hf_ieee80211_tag_measure_request_mode_request = -1;
1727 static int hf_ieee80211_tag_measure_request_mode_report = -1;
1728 static int hf_ieee80211_tag_measure_request_mode_duration_mandatory = -1;
1729 static int hf_ieee80211_tag_measure_request_mode_reserved = -1;
1730 static int hf_ieee80211_tag_measure_request_type = -1;
1731
1732 static int hf_ieee80211_tag_measure_request_channel_number = -1;
1733 static int hf_ieee80211_tag_measure_request_start_time = -1;
1734 static int hf_ieee80211_tag_measure_request_duration = -1;
1735
1736 static int hf_ieee80211_tag_measure_request_regulatory_class = -1;
1737 static int hf_ieee80211_tag_measure_request_randomization_interval = -1;
1738
1739 static int hf_ieee80211_tag_measure_report_measurement_token = -1;
1740 static int hf_ieee80211_tag_measure_report_mode = -1;
1741 static int hf_ieee80211_tag_measure_report_mode_late = -1;
1742 static int hf_ieee80211_tag_measure_report_mode_incapable = -1;
1743 static int hf_ieee80211_tag_measure_report_mode_refused = -1;
1744 static int hf_ieee80211_tag_measure_report_mode_reserved = -1;
1745 static int hf_ieee80211_tag_measure_report_type = -1;
1746 static int hf_ieee80211_tag_measure_report_channel_number = -1;
1747 static int hf_ieee80211_tag_measure_report_start_time = -1;
1748 static int hf_ieee80211_tag_measure_report_duration = -1;
1749
1750 static int hf_ieee80211_tag_measure_basic_map_field = -1;
1751 static int hf_ieee80211_tag_measure_map_field_bss = -1;
1752 static int hf_ieee80211_tag_measure_map_field_odfm = -1;
1753 static int hf_ieee80211_tag_measure_map_field_unident_signal = -1;
1754 static int hf_ieee80211_tag_measure_map_field_radar = -1;
1755 static int hf_ieee80211_tag_measure_map_field_unmeasured = -1;
1756 static int hf_ieee80211_tag_measure_map_field_reserved = -1;
1757
1758 static int hf_ieee80211_tag_measure_cca_busy_fraction = -1;
1759
1760 static int hf_ieee80211_tag_measure_rpi_histogram_report = -1;
1761 static int hf_ieee80211_tag_measure_rpi_histogram_report_0 = -1;
1762 static int hf_ieee80211_tag_measure_rpi_histogram_report_1 = -1;
1763 static int hf_ieee80211_tag_measure_rpi_histogram_report_2 = -1;
1764 static int hf_ieee80211_tag_measure_rpi_histogram_report_3 = -1;
1765 static int hf_ieee80211_tag_measure_rpi_histogram_report_4 = -1;
1766 static int hf_ieee80211_tag_measure_rpi_histogram_report_5 = -1;
1767 static int hf_ieee80211_tag_measure_rpi_histogram_report_6 = -1;
1768 static int hf_ieee80211_tag_measure_rpi_histogram_report_7 = -1;
1769
1770 static int hf_ieee80211_tag_measure_report_regulatory_class = -1;
1771 static int hf_ieee80211_tag_measure_report_channel_load = -1;
1772 static int hf_ieee80211_tag_measure_report_frame_info = -1;
1773 static int hf_ieee80211_tag_measure_report_frame_info_phy_type = -1;
1774 static int hf_ieee80211_tag_measure_report_frame_info_frame_type = -1;
1775 static int hf_ieee80211_tag_measure_report_rcpi = -1;
1776 static int hf_ieee80211_tag_measure_report_rsni = -1;
1777 static int hf_ieee80211_tag_measure_report_bssid = -1;
1778 static int hf_ieee80211_tag_measure_report_ant_id = -1;
1779 static int hf_ieee80211_tag_measure_report_anpi = -1;
1780 static int hf_ieee80211_tag_measure_report_ipi_density_0 = -1;
1781 static int hf_ieee80211_tag_measure_report_ipi_density_1 = -1;
1782 static int hf_ieee80211_tag_measure_report_ipi_density_2 = -1;
1783 static int hf_ieee80211_tag_measure_report_ipi_density_3 = -1;
1784 static int hf_ieee80211_tag_measure_report_ipi_density_4 = -1;
1785 static int hf_ieee80211_tag_measure_report_ipi_density_5 = -1;
1786 static int hf_ieee80211_tag_measure_report_ipi_density_6 = -1;
1787 static int hf_ieee80211_tag_measure_report_ipi_density_7 = -1;
1788 static int hf_ieee80211_tag_measure_report_ipi_density_8 = -1;
1789 static int hf_ieee80211_tag_measure_report_ipi_density_9 = -1;
1790 static int hf_ieee80211_tag_measure_report_ipi_density_10 = -1;
1791 static int hf_ieee80211_tag_measure_report_parent_tsf = -1;
1792
1793 static int hf_ieee80211_tag_extended_capabilities = -1;
1794 static int hf_ieee80211_tag_extended_capabilities_b0 = -1;
1795 static int hf_ieee80211_tag_extended_capabilities_b1 = -1;
1796 static int hf_ieee80211_tag_extended_capabilities_b2 = -1;
1797 static int hf_ieee80211_tag_extended_capabilities_b3 = -1;
1798 static int hf_ieee80211_tag_extended_capabilities_b4 = -1;
1799 static int hf_ieee80211_tag_extended_capabilities_b6 = -1;
1800 static int hf_ieee80211_tag_extended_capabilities_b28 = -1;
1801 static int hf_ieee80211_tag_extended_capabilities_b29 = -1;
1802 static int hf_ieee80211_tag_extended_capabilities_b30 = -1;
1803 static int hf_ieee80211_tag_extended_capabilities_b37 = -1;
1804 static int hf_ieee80211_tag_extended_capabilities_b38 = -1;
1805 static int hf_ieee80211_tag_extended_capabilities_b39 = -1;
1806 static int hf_ieee80211_tag_extended_capabilities_b40 = -1;
1807 static int hf_ieee80211_tag_extended_capabilities_serv_int_granularity = -1;
1808
1809 static int hf_ieee80211_tag_neighbor_report_bssid = -1;
1810 static int hf_ieee80211_tag_neighbor_report_bssid_info = -1;
1811 static int hf_ieee80211_tag_neighbor_report_bssid_info_reachability = -1;
1812 static int hf_ieee80211_tag_neighbor_report_bssid_info_security = -1;
1813 static int hf_ieee80211_tag_neighbor_report_bssid_info_key_scope = -1;
1814 /*static int hf_ieee80211_tag_neighbor_report_bssid_info_capability = -1; */ /* TODO Make this the parent tree item */
1815 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_spec_mng = -1;
1816 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_qos = -1;
1817 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_apsd = -1;
1818 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_radio_msnt = -1;
1819 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_dback = -1;
1820 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_iback = -1;
1821 static int hf_ieee80211_tag_neighbor_report_bssid_info_mobility_domain = -1;
1822 static int hf_ieee80211_tag_neighbor_report_bssid_info_high_throughput = -1;
1823 static int hf_ieee80211_tag_neighbor_report_bssid_info_reserved = -1;
1824 static int hf_ieee80211_tag_neighbor_report_reg_class = -1;
1825 static int hf_ieee80211_tag_neighbor_report_channel_number = -1;
1826 static int hf_ieee80211_tag_neighbor_report_phy_type = -1;
1827
1828 static int hf_ieee80211_tag_supported_reg_classes_current = -1;
1829 static int hf_ieee80211_tag_supported_reg_classes_alternate = -1;
1830
1831 /* IEEE Std 802.11r-2008 7.3.2.47 */
1832 static int hf_ieee80211_tag_mobility_domain_mdid = -1;
1833 static int hf_ieee80211_tag_mobility_domain_ft_capab = -1;
1834 static int hf_ieee80211_tag_mobility_domain_ft_capab_ft_over_ds = -1;
1835 static int hf_ieee80211_tag_mobility_domain_ft_capab_resource_req = -1;
1836
1837 /* IEEE Std 802.11r-2008 7.3.2.48 */
1838 static int hf_ieee80211_tag_ft_mic_control = -1;
1839 static int hf_ieee80211_tag_ft_element_count = -1;
1840 static int hf_ieee80211_tag_ft_mic = -1;
1841 static int hf_ieee80211_tag_ft_anonce = -1;
1842 static int hf_ieee80211_tag_ft_snonce = -1;
1843 static int hf_ieee80211_tag_ft_subelem_id = -1;
1844 static int hf_ieee80211_tag_ft_subelem_len = -1;
1845 static int hf_ieee80211_tag_ft_subelem_data = -1;
1846 static int hf_ieee80211_tag_ft_subelem_r1kh_id = -1;
1847 static int hf_ieee80211_tag_ft_subelem_gtk_key_info = -1;
1848 static int hf_ieee80211_tag_ft_subelem_gtk_key_id = -1;
1849 static int hf_ieee80211_tag_ft_subelem_gtk_key_length = -1;
1850 static int hf_ieee80211_tag_ft_subelem_gtk_rsc = -1;
1851 static int hf_ieee80211_tag_ft_subelem_gtk_key = -1;
1852 static int hf_ieee80211_tag_ft_subelem_r0kh_id = -1;
1853 static int hf_ieee80211_tag_ft_subelem_igtk_key_id = -1;
1854 static int hf_ieee80211_tag_ft_subelem_igtk_ipn = -1;
1855 static int hf_ieee80211_tag_ft_subelem_igtk_key_length = -1;
1856 static int hf_ieee80211_tag_ft_subelem_igtk_key = -1;
1857
1858 /* IEEE Std 802.11w-2009 7.3.2.55 */
1859 static int hf_ieee80211_tag_mmie_keyid = -1;
1860 static int hf_ieee80211_tag_mmie_ipn = -1;
1861 static int hf_ieee80211_tag_mmie_mic = -1;
1862
1863 /* IEEE P802.11u/D10.0, 7.3.2.91 */
1864 static int hf_ieee80211_tag_adv_proto_resp_len_limit = -1;
1865 static int hf_ieee80211_tag_adv_proto_pame_bi = -1;
1866 static int hf_ieee80211_tag_adv_proto_id = -1;
1867
1868 /* 802.11n 7.3.2.48 */
1869 static int hf_ieee80211_hta_cap = -1;
1870 static int hf_ieee80211_hta_ext_chan_offset = -1;
1871 static int hf_ieee80211_hta_rec_tx_width = -1;
1872 static int hf_ieee80211_hta_rifs_mode = -1;
1873 static int hf_ieee80211_hta_controlled_access = -1;
1874 static int hf_ieee80211_hta_service_interval = -1;
1875 static int hf_ieee80211_hta_operating_mode = -1;
1876 static int hf_ieee80211_hta_non_gf_devices = -1;
1877 static int hf_ieee80211_hta_basic_stbc_mcs = -1;
1878 static int hf_ieee80211_hta_dual_stbc_protection = -1;
1879 static int hf_ieee80211_hta_secondary_beacon = -1;
1880 static int hf_ieee80211_hta_lsig_txop_protection = -1;
1881 static int hf_ieee80211_hta_pco_active = -1;
1882 static int hf_ieee80211_hta_pco_phase = -1;
1883
1884 static int hf_ieee80211_antsel = -1;
1885 static int hf_ieee80211_antsel_vs = -1;
1886 static int hf_ieee80211_antsel_b0 = -1;
1887 static int hf_ieee80211_antsel_b1 = -1;
1888 static int hf_ieee80211_antsel_b2 = -1;
1889 static int hf_ieee80211_antsel_b3 = -1;
1890 static int hf_ieee80211_antsel_b4 = -1;
1891 static int hf_ieee80211_antsel_b5 = -1;
1892 static int hf_ieee80211_antsel_b6 = -1;
1893 static int hf_ieee80211_antsel_b7 = -1;
1894
1895 static int hf_ieee80211_rsn_version = -1;
1896 static int hf_ieee80211_rsn_gcs = -1;
1897 static int hf_ieee80211_rsn_gcs_oui = -1;
1898 static int hf_ieee80211_rsn_gcs_type = -1;
1899 static int hf_ieee80211_rsn_gcs_80211_type = -1;
1900 static int hf_ieee80211_rsn_pcs_count = -1;
1901 static int hf_ieee80211_rsn_pcs_list = -1;
1902 static int hf_ieee80211_rsn_pcs = -1;
1903 static int hf_ieee80211_rsn_pcs_oui = -1;
1904 static int hf_ieee80211_rsn_pcs_80211_type = -1;
1905 static int hf_ieee80211_rsn_pcs_type = -1;
1906 static int hf_ieee80211_rsn_akms_count = -1;
1907 static int hf_ieee80211_rsn_akms_list = -1;
1908 static int hf_ieee80211_rsn_akms = -1;
1909 static int hf_ieee80211_rsn_akms_oui = -1;
1910 static int hf_ieee80211_rsn_akms_80211_type = -1;
1911 static int hf_ieee80211_rsn_akms_type = -1;
1912 static int hf_ieee80211_rsn_cap = -1;
1913 static int hf_ieee80211_rsn_cap_preauth = -1;
1914 static int hf_ieee80211_rsn_cap_no_pairwise = -1;
1915 static int hf_ieee80211_rsn_cap_ptksa_replay_counter = -1;
1916 static int hf_ieee80211_rsn_cap_gtksa_replay_counter = -1;
1917 static int hf_ieee80211_rsn_cap_mfpr = -1;
1918 static int hf_ieee80211_rsn_cap_mfpc = -1;
1919 static int hf_ieee80211_rsn_cap_peerkey = -1;
1920 static int hf_ieee80211_rsn_pmkid_count = -1;
1921 static int hf_ieee80211_rsn_pmkid_list = -1;
1922 static int hf_ieee80211_rsn_pmkid = -1;
1923 static int hf_ieee80211_rsn_gmcs = -1;
1924 static int hf_ieee80211_rsn_gmcs_oui = -1;
1925 static int hf_ieee80211_rsn_gmcs_type = -1;
1926 static int hf_ieee80211_rsn_gmcs_80211_type = -1;
1927
1928 static int hf_ieee80211_aironet_ie_type = -1;
1929 static int hf_ieee80211_aironet_ie_version = -1;
1930 static int hf_ieee80211_aironet_ie_data = -1;
1931 static int hf_ieee80211_aironet_ie_qos_unk1 = -1;
1932 static int hf_ieee80211_aironet_ie_qos_paramset = -1;
1933 static int hf_ieee80211_aironet_ie_qos_val = -1;
1934
1935 static int hf_ieee80211_marvell_ie_type = -1;
1936 static int hf_ieee80211_marvell_ie_mesh_subtype = -1;
1937 static int hf_ieee80211_marvell_ie_mesh_version = -1;
1938 static int hf_ieee80211_marvell_ie_mesh_active_proto_id = -1;
1939 static int hf_ieee80211_marvell_ie_mesh_active_metric_id = -1;
1940 static int hf_ieee80211_marvell_ie_mesh_cap = -1;
1941 static int hf_ieee80211_marvell_ie_data = -1;
1942
1943 static int hf_ieee80211_atheros_ie_type = -1;
1944 static int hf_ieee80211_atheros_ie_subtype = -1;
1945 static int hf_ieee80211_atheros_ie_version = -1;
1946 static int hf_ieee80211_atheros_ie_cap_f_turbop = -1;
1947 static int hf_ieee80211_atheros_ie_cap_f_comp = -1;
1948 static int hf_ieee80211_atheros_ie_cap_f_ff = -1;
1949 static int hf_ieee80211_atheros_ie_cap_f_xr = -1;
1950 static int hf_ieee80211_atheros_ie_cap_f_ar = -1;
1951 static int hf_ieee80211_atheros_ie_cap_f_burst = -1;
1952 static int hf_ieee80211_atheros_ie_cap_f_wme = -1;
1953 static int hf_ieee80211_atheros_ie_cap_f_boost = -1;
1954 static int hf_ieee80211_atheros_ie_advcap_cap = -1;
1955 static int hf_ieee80211_atheros_ie_advcap_defkey = -1;
1956 static int hf_ieee80211_atheros_ie_xr_info = -1;
1957 static int hf_ieee80211_atheros_ie_xr_base_bssid = -1;
1958 static int hf_ieee80211_atheros_ie_xr_xr_bssid = -1;
1959 static int hf_ieee80211_atheros_ie_xr_xr_beacon = -1;
1960 static int hf_ieee80211_atheros_ie_xr_base_cap = -1;
1961 static int hf_ieee80211_atheros_ie_xr_xr_cap = -1;
1962 static int hf_ieee80211_atheros_ie_data = -1;
1963
1964 /*QBSS - Version 1,2,802.11e*/
1965
1966 static int hf_ieee80211_qbss2_cal = -1;
1967 static int hf_ieee80211_qbss2_gl = -1;
1968 static int hf_ieee80211_qbss_cu = -1;
1969 static int hf_ieee80211_qbss2_cu = -1;
1970 static int hf_ieee80211_qbss_scount = -1;
1971 static int hf_ieee80211_qbss2_scount = -1;
1972 static int hf_ieee80211_qbss_version = -1;
1973 static int hf_ieee80211_qbss_adc = -1;
1974
1975 static int hf_ieee80211_tsinfo = -1;
1976 static int hf_ieee80211_tsinfo_type = -1;
1977 static int hf_ieee80211_tsinfo_tsid = -1;
1978 static int hf_ieee80211_tsinfo_dir = -1;
1979 static int hf_ieee80211_tsinfo_access = -1;
1980 static int hf_ieee80211_tsinfo_agg = -1;
1981 static int hf_ieee80211_tsinfo_apsd = -1;
1982 static int hf_ieee80211_tsinfo_up = -1;
1983 static int hf_ieee80211_tsinfo_ack = -1;
1984 static int hf_ieee80211_tsinfo_sched = -1;
1985 static int hf_ieee80211_tsinfo_rsv = -1;
1986 static int hf_ieee80211_tspec_nor_msdu = -1;
1987 static int hf_ieee80211_tspec_max_msdu = -1;
1988 static int hf_ieee80211_tspec_min_srv = -1;
1989 static int hf_ieee80211_tspec_max_srv = -1;
1990 static int hf_ieee80211_tspec_inact_int = -1;
1991 static int hf_ieee80211_tspec_susp_int = -1;
1992 static int hf_ieee80211_tspec_srv_start = -1;
1993 static int hf_ieee80211_tspec_min_data = -1;
1994 static int hf_ieee80211_tspec_mean_data = -1;
1995 static int hf_ieee80211_tspec_peak_data = -1;
1996 static int hf_ieee80211_tspec_burst_size = -1;
1997 static int hf_ieee80211_tspec_delay_bound = -1;
1998 static int hf_ieee80211_tspec_min_phy = -1;
1999 static int hf_ieee80211_tspec_surplus = -1;
2000 static int hf_ieee80211_tspec_medium = -1;
2001 static int hf_ieee80211_ts_delay = -1;
2002 static int hf_ieee80211_tclass_process = -1;
2003 static int hf_ieee80211_sched_info = -1;
2004 static int hf_ieee80211_sched_info_agg = -1;
2005 static int hf_ieee80211_sched_info_tsid = -1;
2006 static int hf_ieee80211_sched_info_dir = -1;
2007 static int hf_ieee80211_sched_srv_start = -1;
2008 static int hf_ieee80211_sched_srv_int = -1;
2009 static int hf_ieee80211_sched_spec_int = -1;
2010 static int hf_ieee80211_action = -1;
2011 static int hf_ieee80211_tclas_up = -1;
2012 static int hf_ieee80211_tclas_class_type = -1;
2013 static int hf_ieee80211_tclas_class_mask = -1;
2014 static int hf_ieee80211_tclas_src_mac_addr = -1;
2015 static int hf_ieee80211_tclas_dst_mac_addr = -1;
2016 static int hf_ieee80211_tclas_ether_type = -1;
2017 static int hf_ieee80211_tclas_version = -1;
2018 static int hf_ieee80211_tclas_ipv4_src = -1;
2019 static int hf_ieee80211_tclas_ipv4_dst = -1;
2020 static int hf_ieee80211_tclas_src_port = -1;
2021 static int hf_ieee80211_tclas_dst_port = -1;
2022 static int hf_ieee80211_tclas_dscp = -1;
2023 static int hf_ieee80211_tclas_protocol = -1;
2024 static int hf_ieee80211_tclas_ipv6_src = -1;
2025 static int hf_ieee80211_tclas_ipv6_dst = -1;
2026 static int hf_ieee80211_tclas_flow = -1;
2027 static int hf_ieee80211_tclas_tag_type = -1;
2028
2029 static int hf_ieee80211_aruba = -1;
2030 static int hf_ieee80211_aruba_hb_seq = -1;
2031 static int hf_ieee80211_aruba_mtu = -1;
2032
2033 static int hf_ieee80211_tag_vendor_oui_type = -1;
2034
2035 /* IEEE Std 802.11z-2010 7.3.2.62 */
2036 static int hf_ieee80211_tag_link_id_bssid = -1;
2037 static int hf_ieee80211_tag_link_id_init_sta = -1;
2038 static int hf_ieee80211_tag_link_id_resp_sta = -1;
2039
2040 /* IEEE Std 802.11z-2010 7.3.2.63 */
2041 static int hf_ieee80211_tag_wakeup_schedule_offset = -1;
2042 static int hf_ieee80211_tag_wakeup_schedule_interval = -1;
2043 static int hf_ieee80211_tag_wakeup_schedule_awake_window_slots = -1;
2044 static int hf_ieee80211_tag_wakeup_schedule_max_awake_dur = -1;
2045 static int hf_ieee80211_tag_wakeup_schedule_idle_count = -1;
2046
2047 /* IEEE Std 802.11z-2010 7.3.2.64 */
2048 static int hf_ieee80211_tag_channel_switch_timing_switch_time = -1;
2049 static int hf_ieee80211_tag_channel_switch_timing_switch_timeout = -1;
2050
2051 /* IEEE Std 802.11z-2010 7.3.2.65 */
2052 static int hf_ieee80211_tag_pti_control_tid = -1;
2053 static int hf_ieee80211_tag_pti_control_sequence_control = -1;
2054
2055 /* IEEE Std 802.11z-2010 7.3.2.66 */
2056 static int hf_ieee80211_tag_pu_buffer_status_ac_bk = -1;
2057 static int hf_ieee80211_tag_pu_buffer_status_ac_be = -1;
2058 static int hf_ieee80211_tag_pu_buffer_status_ac_vi = -1;
2059 static int hf_ieee80211_tag_pu_buffer_status_ac_vo = -1;
2060
2061 /* IEEE Std 802.11r-2008 7.3.2.49 */
2062 static int hf_ieee80211_tag_timeout_int_type = -1;
2063 static int hf_ieee80211_tag_timeout_int_value = -1;
2064
2065 /* Ethertype 89-0d */
2066 static int hf_ieee80211_data_encap_payload_type = -1;
2067
2068 /* ************************************************************************* */
2069 /*                               Protocol trees                              */
2070 /* ************************************************************************* */
2071 static gint ett_80211 = -1;
2072 static gint ett_proto_flags = -1;
2073 static gint ett_cap_tree = -1;
2074 static gint ett_fc_tree = -1;
2075 static gint ett_cntrl_wrapper_fc = -1;
2076 static gint ett_cntrl_wrapper_payload = -1;
2077 static gint ett_fragments = -1;
2078 static gint ett_fragment = -1;
2079 static gint ett_block_ack = -1;
2080 static gint ett_ath_cap_tree = -1;
2081
2082
2083 static gint ett_80211_mgt = -1;
2084 static gint ett_fixed_parameters = -1;
2085 static gint ett_tagged_parameters = -1;
2086 static gint ett_tag_bmapctl_tree = -1;
2087 static gint ett_tag_country_fnm_tree = -1;
2088 static gint ett_tag_country_rcc_tree = -1;
2089 static gint ett_qos_parameters = -1;
2090 static gint ett_qos_ps_buf_state = -1;
2091 static gint ett_wep_parameters = -1;
2092 #ifdef MESH_OVERRIDES
2093 static gint ett_msh_parameters = -1;
2094 static gint ett_msh_dest_flags_tree = -1;
2095 #endif /* MESH_OVERRIDES */
2096
2097 static gint ett_rsn_gcs_tree = -1;
2098 static gint ett_rsn_pcs_tree = -1;
2099 static gint ett_rsn_sub_pcs_tree = -1;
2100 static gint ett_rsn_akms_tree = -1;
2101 static gint ett_rsn_sub_akms_tree = -1;
2102 static gint ett_rsn_cap_tree = -1;
2103 static gint ett_rsn_pmkid_tree = -1;
2104 static gint ett_rsn_gmcs_tree = -1;
2105
2106 static gint ett_ht_cap_tree = -1;
2107 static gint ett_ampduparam_tree = -1;
2108 static gint ett_mcsset_tree = -1;
2109 static gint ett_mcsbit_tree = -1;
2110 static gint ett_htex_cap_tree = -1;
2111 static gint ett_txbf_tree = -1;
2112 static gint ett_antsel_tree = -1;
2113 static gint ett_hta_cap_tree = -1;
2114 static gint ett_hta_cap1_tree = -1;
2115 static gint ett_hta_cap2_tree = -1;
2116 static gint ett_htc_tree = -1;
2117
2118 static gint ett_ht_info_delimiter1_tree = -1;
2119 static gint ett_ht_info_delimiter2_tree = -1;
2120 static gint ett_ht_info_delimiter3_tree = -1;
2121
2122 static gint ett_tag_measure_request_mode_tree = -1;
2123 static gint ett_tag_measure_request_type_tree = -1;
2124 static gint ett_tag_measure_report_mode_tree = -1;
2125 static gint ett_tag_measure_report_type_tree = -1;
2126 static gint ett_tag_measure_report_basic_map_tree = -1;
2127 static gint ett_tag_measure_report_rpi_tree = -1;
2128 static gint ett_tag_measure_report_frame_tree = -1;
2129
2130 static gint ett_tag_ex_cap = -1;
2131
2132 static gint ett_tag_supported_channels = -1;
2133
2134 static gint ett_tag_neighbor_report_bssid_info_tree = -1;
2135 static gint ett_tag_neighbor_report_bssid_info_capability_tree = -1;
2136 static gint ett_tag_neighbor_report_sub_tag_tree = -1;
2137
2138 static gint ett_ff_ba_param_tree = -1;
2139 static gint ett_ff_ba_ssc_tree = -1;
2140 static gint ett_ff_delba_param_tree = -1;
2141 static gint ett_ff_qos_info = -1;
2142 static gint ett_ff_sm_pwr_save = -1;
2143 static gint ett_ff_psmp_param_set = -1;
2144 static gint ett_ff_mimo_cntrl = -1;
2145 static gint ett_ff_ant_sel = -1;
2146 static gint ett_mimo_report = -1;
2147 static gint ett_ff_chan_switch_announce = -1;
2148 static gint ett_ff_ht_info = -1;
2149 static gint ett_ff_psmp_sta_info = -1;
2150
2151 static gint ett_msdu_aggregation_parent_tree = -1;
2152 static gint ett_msdu_aggregation_subframe_tree = -1;
2153
2154 /***  Begin: WAVE Service information element Dissection - IEEE 802.11p Draft 4.0 ***/
2155 static gint ett_pst_tree = -1;
2156 static gint ett_pst_cap_tree = -1;
2157 static gint ett_chan_noc_tree = -1;
2158 static gint ett_wave_chnl_tree = -1;
2159
2160 /***  End: WAVE Service information element Dissection - IEEE 802.11p Draft 4.0 ***/
2161
2162 static gint ett_80211_mgt_ie = -1;
2163 static gint ett_tsinfo_tree = -1;
2164 static gint ett_sched_tree = -1;
2165
2166 static gint ett_fcs = -1;
2167
2168 static gint ett_radio = -1;
2169 static gint ett_prism = -1;
2170 static gint ett_prism_did = -1;
2171
2172 static gint ett_adv_proto = -1;
2173 static gint ett_adv_proto_tuple = -1;
2174 static gint ett_gas_query = -1;
2175 static gint ett_gas_anqp = -1;
2176
2177 static const fragment_items frag_items = {
2178   &ett_fragment,
2179   &ett_fragments,
2180   &hf_ieee80211_fragments,
2181   &hf_ieee80211_fragment,
2182   &hf_ieee80211_fragment_overlap,
2183   &hf_ieee80211_fragment_overlap_conflict,
2184   &hf_ieee80211_fragment_multiple_tails,
2185   &hf_ieee80211_fragment_too_long_fragment,
2186   &hf_ieee80211_fragment_error,
2187   &hf_ieee80211_fragment_count,
2188   &hf_ieee80211_reassembled_in,
2189   &hf_ieee80211_reassembled_length,
2190   "fragments"
2191 };
2192
2193 static enum_val_t wlan_ignore_wep_options[] = {
2194   { "no",         "No",               WLAN_IGNORE_WEP_NO    },
2195   { "without_iv", "Yes - without IV", WLAN_IGNORE_WEP_WO_IV },
2196   { "with_iv",    "Yes - with IV",    WLAN_IGNORE_WEP_W_IV  },
2197   { NULL,         NULL,               0                     }
2198 };
2199
2200 static dissector_handle_t ieee80211_handle;
2201 static dissector_handle_t llc_handle;
2202 static dissector_handle_t ipx_handle;
2203 static dissector_handle_t eth_withoutfcs_handle;
2204 static dissector_handle_t data_handle;
2205 static dissector_handle_t wlancap_handle;
2206
2207 static int wlan_tap = -1;
2208
2209 static const value_string adv_proto_id_vals[] =
2210 {
2211   {0, "Access Network Query Protocol"},
2212   {1, "MIH Information Service"},
2213   {2, "MIH Command and Event Services Capability Discovery"},
2214   {3, "Emergency Alert System (EAS)"},
2215   {4, "Location-to-Service Translation Protocol"},
2216   {221, "Vendor Specific"},
2217   {0, NULL}
2218 };
2219
2220 static const value_string timeout_int_types[] =
2221 {
2222   {1, "Reassociation deadline interval (TUs)"},
2223   {2, "Key lifetime interval (seconds)"},
2224   {3, "Association Comeback time (TUs)"},
2225   {0, NULL}
2226 };
2227
2228 static const value_string tdls_action_codes[] ={
2229   {TDLS_SETUP_REQUEST, "TDLS Setup Request"},
2230   {TDLS_SETUP_RESPONSE, "TDLS Setup Response"},
2231   {TDLS_SETUP_CONFIRM, "TDLS Setup Confirm"},
2232   {TDLS_TEARDOWN, "TDLS Teardown"},
2233   {TDLS_PEER_TRAFFIC_INDICATION, "TDLS Peer Traffic Indication"},
2234   {TDLS_CHANNEL_SWITCH_REQUEST, "TDLS Channel Switch Request"},
2235   {TDLS_CHANNEL_SWITCH_RESPONSE, "TDLS Channel Switch Response"},
2236   {TDLS_PEER_PSM_REQUEST, "TDLS Peer PSM Request"},
2237   {TDLS_PEER_PSM_RESPONSE, "TDLS Peer PSM Response"},
2238   {TDLS_PEER_TRAFFIC_RESPONSE, "TDLS Peer Traffic Response"},
2239   {TDLS_DISCOVERY_REQUEST, "TDLS Discovery Request"},
2240   {0, NULL}
2241 };
2242
2243 #define PSMP_STA_INFO_BROADCAST 0
2244 #define PSMP_STA_INFO_MULTICAST 1
2245 #define PSMP_STA_INFO_INDIVIDUALLY_ADDRESSED 2
2246
2247 #define PSMP_STA_INFO_FLAG_TYPE         0x00000003
2248 #define PSMP_STA_INFO_FLAG_DTT_START    0x00001FFC
2249 #define PSMP_STA_INFO_FLAG_DTT_DURATION 0x001FE000
2250
2251 #define PSMP_STA_INFO_FLAG_STA_ID       0x001FFFE0
2252
2253 #define PSMP_STA_INFO_FLAG_UTT_START    0x0000FFE0
2254 #define PSMP_STA_INFO_FLAG_UTT_DURATION 0x03FF0000
2255
2256 #define PSMP_STA_INFO_FLAG_IA_RESERVED  0xFC000000
2257
2258 static const value_string ff_psmp_sta_info_flags[] = {
2259   { PSMP_STA_INFO_BROADCAST, "Broadcast"},
2260   { PSMP_STA_INFO_MULTICAST, "Multicast"},
2261   { PSMP_STA_INFO_INDIVIDUALLY_ADDRESSED, "Individually Addressed"},
2262   {0, NULL}
2263 };
2264
2265 static void
2266 beacon_interval_base_custom(gchar *result, guint32 beacon_interval)
2267 {
2268    double temp_double;
2269    temp_double = (double)beacon_interval;
2270    g_snprintf(result, ITEM_LABEL_LENGTH, "%f [Seconds]", (temp_double * 1024 / 1000000) );
2271 }
2272
2273 /*     Davide Schiera (2006-11-22): including AirPDcap project                */
2274 #ifdef HAVE_AIRPDCAP
2275 #include <epan/crypt/airpdcap_ws.h>
2276 AIRPDCAP_CONTEXT airpdcap_ctx;
2277 #else
2278 int airpdcap_ctx;
2279 #endif
2280 /* Davide Schiera (2006-11-22) ---------------------------------------------- */
2281
2282
2283 /* ************************************************************************* */
2284 /*            Return the length of the current header (in bytes)             */
2285 /* ************************************************************************* */
2286 static int
2287 find_header_length (guint16 fcf, guint16 ctrl_fcf, gboolean is_ht)
2288 {
2289   int len;
2290   guint16 cw_fcf;
2291
2292   switch (FCF_FRAME_TYPE (fcf)) {
2293
2294   case MGT_FRAME:
2295     if (is_ht && IS_STRICTLY_ORDERED(FCF_FLAGS(fcf)))
2296       return MGT_FRAME_HDR_LEN + 4;
2297
2298     return MGT_FRAME_HDR_LEN;
2299
2300   case CONTROL_FRAME:
2301     if (COMPOSE_FRAME_TYPE(fcf) == CTRL_CONTROL_WRAPPER) {
2302       len = 6;
2303       cw_fcf = ctrl_fcf;
2304     } else {
2305       len = 0;
2306       cw_fcf = fcf;
2307     }
2308     switch (COMPOSE_FRAME_TYPE (cw_fcf)) {
2309
2310     case CTRL_CTS:
2311     case CTRL_ACKNOWLEDGEMENT:
2312       return len + 10;
2313
2314     case CTRL_RTS:
2315     case CTRL_PS_POLL:
2316     case CTRL_CFP_END:
2317     case CTRL_CFP_ENDACK:
2318     case CTRL_BLOCK_ACK_REQ:
2319     case CTRL_BLOCK_ACK:
2320       return len + 16;
2321     }
2322     return len + 4;  /* XXX */
2323
2324   case DATA_FRAME:
2325     len = (FCF_ADDR_SELECTOR(fcf) ==
2326       DATA_ADDR_T4) ? DATA_LONG_HDR_LEN : DATA_SHORT_HDR_LEN;
2327
2328     if (DATA_FRAME_IS_QOS(COMPOSE_FRAME_TYPE(fcf))) {
2329       len += 2;
2330       if (is_ht && IS_STRICTLY_ORDERED(FCF_FLAGS(fcf))) {
2331         len += 4;
2332       }
2333     }
2334
2335     return len;
2336
2337   default:
2338     return 4;  /* XXX */
2339   }
2340 }
2341
2342 #ifdef MESH_OVERRIDES
2343 /* ************************************************************************* */
2344 /*            Return the length of the mesh header if any (in bytes)
2345  *
2346  * Per IEEE 802.11-07/0799r8:
2347  * 7.1.3.5a.1 The Mesh Header field (...) is present in Data frames if and
2348  * only if they are transmitted between peer MPs with an established peer
2349  * link.  Data frames including the Mesh Header field are referred to as
2350  * Mesh Data frames.
2351  *
2352  * We need a stateful sniffer for that.  For now, use heuristics:  If we
2353  * find valid mesh flags (currently, only MESH_FLAGS_ADDRESS_EXTENSION) at the
2354  * offset where mesh flags should be, assume we're dealing with a mesh header.
2355  * ************************************************************************* */
2356 static int
2357 find_mesh_header_length(const guchar * pd, int offset, guint16 fcf)
2358 {
2359   guint8 mesh_flags;
2360
2361   switch (FCF_FRAME_TYPE (fcf)) {
2362
2363   case MGT_FRAME:
2364     /* TODO: Multihop Action Frames */
2365     return 0;
2366
2367   case DATA_FRAME:
2368     mesh_flags = pd[offset];
2369
2370     /* heuristics:                                                      */
2371     /* asume mesh if all reserved bits in the mesh_flags field are zero */
2372     if ((mesh_flags & ~MESH_FLAGS_ADDRESS_EXTENSION) == 0)
2373       return 6 + 6*(mesh_flags & MESH_FLAGS_ADDRESS_EXTENSION);
2374     break;
2375   }
2376   return 0;
2377 }
2378 #endif /* MESH_OVERRIDES */
2379
2380 mimo_control_t get_mimo_control (tvbuff_t *tvb, int offset)
2381 {
2382   guint16 mimo;
2383   mimo_control_t output;
2384
2385   mimo = tvb_get_letohs (tvb, offset);
2386
2387   output.nc = (mimo & 0x0003) + 1;
2388   output.nr = ((mimo & 0x000C) >> 2) + 1;
2389   output.chan_width = (mimo & 0x0010) >> 4;
2390   output.coefficient_size = 4; /* XXX - Is this a good default? */
2391
2392   switch ((mimo & 0x0060) >> 5)
2393     {
2394       case 0:
2395         output.grouping = 1;
2396         break;
2397
2398       case 1:
2399         output.grouping = 2;
2400         break;
2401
2402       case 2:
2403         output.grouping = 4;
2404         break;
2405
2406       default:
2407         output.grouping = 1;
2408         break;
2409     }
2410
2411   switch ((mimo & 0x0180) >> 7)
2412     {
2413       case 0:
2414         output.coefficient_size = 4;
2415         break;
2416
2417       case 1:
2418         output.coefficient_size = 5;
2419         break;
2420
2421       case 2:
2422         output.coefficient_size = 6;
2423         break;
2424
2425       case 3:
2426         output.coefficient_size = 8;
2427         break;
2428     }
2429
2430   output.codebook_info = (mimo & 0x0600) >> 9;
2431   output.remaining_matrix_segment = (mimo & 0x3800) >> 11;
2432
2433   return output;
2434 }
2435
2436 int get_mimo_na (guint8 nr, guint8 nc)
2437 {
2438   if (nr == 2 && nc == 1){
2439     return 2;
2440   }else if (nr == 2 && nc == 2){
2441     return 2;
2442   }else if (nr == 3 && nc == 1){
2443     return 4;
2444   }else if (nr == 3 && nc == 2){
2445     return 6;
2446   }else if (nr == 3 && nc == 3){
2447     return 6;
2448   }else if (nr == 4 && nc == 1){
2449     return 6;
2450   }else if (nr == 4 && nc == 2){
2451     return 10;
2452   }else if (nr == 4 && nc == 3){
2453     return 12;
2454   }else if (nr == 4 && nc == 4){
2455     return 12;
2456   }else{
2457     return 0;
2458   }
2459 }
2460
2461 int get_mimo_ns (gboolean chan_width, guint8 output_grouping)
2462 {
2463   int ns = 0;
2464
2465   if (chan_width)
2466   {
2467       switch (output_grouping)
2468       {
2469         case 1:
2470           ns = 114;
2471           break;
2472
2473           case 2:
2474             ns = 58;
2475             break;
2476
2477           case 4:
2478             ns = 30;
2479             break;
2480
2481           default:
2482             ns = 0;
2483       }
2484   } else {
2485     switch (output_grouping)
2486     {
2487       case 1:
2488         ns = 56;
2489         break;
2490
2491       case 2:
2492         ns = 30;
2493         break;
2494
2495       case 4:
2496         ns = 16;
2497         break;
2498
2499       default:
2500         ns = 0;
2501     }
2502   }
2503
2504   return ns;
2505 }
2506
2507 int add_mimo_csi_matrices_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl)
2508 {
2509   proto_item *snr_item;
2510   proto_tree *snr_tree;
2511   int csi_matrix_size, start_offset;
2512   int ns, i;
2513
2514   start_offset = offset;
2515   snr_item = proto_tree_add_text(tree, tvb, offset, mimo_cntrl.nc, "Signal to Noise Ratio");
2516   snr_tree = proto_item_add_subtree (snr_item, ett_mimo_report);
2517
2518   for (i=1; i <= mimo_cntrl.nr; i++)
2519   {
2520     guint8 snr;
2521
2522     snr = tvb_get_guint8(tvb, offset);
2523     proto_tree_add_uint_format(snr_tree, hf_ieee80211_ff_mimo_csi_snr, tvb, offset, 1, snr, "Channel %d - Signal to Noise Ratio: 0x%02X", i, snr);
2524     offset++;
2525   }
2526
2527   ns = get_mimo_ns(mimo_cntrl.chan_width, mimo_cntrl.grouping);
2528   csi_matrix_size = ns*(3+(2*mimo_cntrl.nc*mimo_cntrl.nr*mimo_cntrl.coefficient_size));
2529   csi_matrix_size = roundup2(csi_matrix_size, 8) / 8;
2530   proto_tree_add_text(tree, tvb, offset, csi_matrix_size, "CSI Matrices");
2531   offset += csi_matrix_size;
2532   return offset - start_offset;
2533 }
2534
2535 int add_mimo_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl)
2536 {
2537   proto_item *snr_item;
2538   proto_tree *snr_tree;
2539   int csi_matrix_size, start_offset;
2540   int ns, i;
2541
2542   start_offset = offset;
2543   snr_item = proto_tree_add_text(tree, tvb, offset, mimo_cntrl.nc, "Signal to Noise Ratio");
2544   snr_tree = proto_item_add_subtree (snr_item, ett_mimo_report);
2545
2546   for (i=1; i <= mimo_cntrl.nc; i++)
2547   {
2548     guint8 snr;
2549
2550     snr = tvb_get_guint8(tvb, offset);
2551     proto_tree_add_uint_format(snr_tree, hf_ieee80211_ff_mimo_csi_snr, tvb, offset, 1, snr, "Stream %d - Signal to Noise Ratio: 0x%02X", i, snr);
2552     offset++;
2553   }
2554
2555   ns = get_mimo_ns(mimo_cntrl.chan_width, mimo_cntrl.grouping);
2556   csi_matrix_size = ns*(2*mimo_cntrl.nc*mimo_cntrl.nr*mimo_cntrl.coefficient_size);
2557   csi_matrix_size = roundup2(csi_matrix_size, 8) / 8;
2558   proto_tree_add_text(tree, tvb, offset, csi_matrix_size, "Beamforming Feedback Matrices");
2559   offset += csi_matrix_size;
2560   return offset - start_offset;
2561 }
2562
2563 int add_mimo_compressed_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl)
2564 {
2565   proto_item *snr_item;
2566   proto_tree *snr_tree;
2567   int csi_matrix_size, start_offset;
2568   int ns, na, i;
2569
2570   start_offset = offset;
2571   snr_item = proto_tree_add_text(tree, tvb, offset, mimo_cntrl.nc, "Signal to Noise Ratio");
2572   snr_tree = proto_item_add_subtree (snr_item, ett_mimo_report);
2573
2574   for (i=1; i <= mimo_cntrl.nc; i++)
2575   {
2576     guint8 snr;
2577
2578     snr = tvb_get_guint8(tvb, offset);
2579     proto_tree_add_uint_format(snr_tree, hf_ieee80211_ff_mimo_csi_snr, tvb, offset, 1, snr, "Stream %d - Signal to Noise Ratio: 0x%02X", i, snr);
2580     offset++;
2581   }
2582
2583   na = get_mimo_na(mimo_cntrl.nr, mimo_cntrl.nc);
2584   ns = get_mimo_ns(mimo_cntrl.chan_width, mimo_cntrl.grouping);
2585   csi_matrix_size = ns*(na*((mimo_cntrl.codebook_info+1)*2 + 2)/2);
2586   csi_matrix_size = roundup2(csi_matrix_size, 8) / 8;
2587   proto_tree_add_text(tree, tvb, offset, csi_matrix_size, "Compressed Beamforming Feedback Matrices");
2588   offset += csi_matrix_size;
2589   return offset - start_offset;
2590 }
2591
2592 /* ************************************************************************* */
2593 /*          This is the capture function used to update packet counts        */
2594 /* ************************************************************************* */
2595 static void
2596 capture_ieee80211_common (const guchar * pd, int offset, int len,
2597         packet_counts * ld, gboolean fixed_length_header,
2598         gboolean datapad, gboolean is_ht)
2599 {
2600   guint16 fcf, hdr_length;
2601 #ifdef MESH_OVERRIDES
2602   guint16 meshdr_length;
2603 #endif /* MESH_OVERRIDES */
2604
2605   if (!BYTES_ARE_IN_FRAME(offset, len, 2)) {
2606     ld->other++;
2607     return;
2608   }
2609
2610   fcf = pletohs (&pd[offset]);
2611
2612   if (IS_PROTECTED(FCF_FLAGS(fcf)) && wlan_ignore_wep == WLAN_IGNORE_WEP_NO) {
2613     ld->other++;
2614     return;
2615   }
2616
2617   switch (COMPOSE_FRAME_TYPE (fcf)) {
2618
2619     case DATA:          /* We got a data frame */
2620     case DATA_CF_ACK:   /* Data with ACK */
2621     case DATA_CF_POLL:
2622     case DATA_CF_ACK_POLL:
2623     case DATA_QOS_DATA:
2624     {
2625       if (fixed_length_header) {
2626         hdr_length = DATA_LONG_HDR_LEN;
2627 #ifdef MESH_OVERRIDES
2628         meshdr_length = 0;
2629 #endif /* MESH_OVERRIDES */
2630       } else {
2631         hdr_length = find_header_length (fcf, 0, is_ht);
2632 #ifdef MESH_OVERRIDES
2633         if (datapad)
2634           hdr_length = roundup2(hdr_length, 4);
2635         meshdr_length = find_mesh_header_length(pd, offset + hdr_length, fcf);
2636         g_warning("mesh hdr_length %d hdr_length %d\n", meshdr_length, hdr_length);
2637         hdr_length += meshdr_length;
2638       }
2639 #else /* MESH_OVERRIDES */
2640       }
2641       if (datapad)
2642         hdr_length = roundup2(hdr_length, 4);
2643 #endif /* MESH_OVERRIDES */
2644       /* I guess some bridges take Netware Ethernet_802_3 frames,
2645          which are 802.3 frames (with a length field rather than
2646          a type field, but with no 802.2 header in the payload),
2647          and just stick the payload into an 802.11 frame.  I've seen
2648          captures that show frames of that sort.
2649
2650          We also handle some odd form of encapsulation in which a
2651          complete Ethernet frame is encapsulated within an 802.11
2652          data frame, with no 802.2 header.  This has been seen
2653          from some hardware.
2654
2655          On top of that, at least at some point it appeared that
2656          the OLPC XO sent out frames with two bytes of 0 between
2657          the "end" of the 802.11 header and the beginning of
2658          the payload.
2659
2660          So, if the packet doesn't start with 0xaa 0xaa:
2661
2662            we first use the same scheme that linux-wlan-ng does to detect
2663            those encapsulated Ethernet frames, namely looking to see whether
2664            the frame either starts with 6 octets that match the destination
2665            address from the 802.11 header or has 6 octets that match the
2666            source address from the 802.11 header following the first 6 octets,
2667            and, if so, treat it as an encapsulated Ethernet frame;
2668
2669            otherwise, we use the same scheme that we use in the Ethernet
2670            dissector to recognize Netware 802.3 frames, namely checking
2671            whether the packet starts with 0xff 0xff and, if so, treat it
2672            as an encapsulated IPX frame, and then check whether the
2673            packet starts with 0x00 0x00 and, if so, treat it as an OLPC
2674            frame. */
2675       if (!BYTES_ARE_IN_FRAME(offset+hdr_length, len, 2)) {
2676         ld->other++;
2677         return;
2678       }
2679       if (pd[offset+hdr_length] != 0xaa && pd[offset+hdr_length+1] != 0xaa) {
2680 #if 0
2681         /* XXX - this requires us to parse the header to find the source
2682            and destination addresses. */
2683         if (BYTES_ARE_IN_FRAME(offset+hdr_length, len, 12) {
2684           /* We have two MAC addresses after the header. */
2685           if (memcmp(&pd[offset+hdr_length+6], pinfo->dl_src.data, 6) == 0 ||
2686               memcmp(&pd[offset+hdr_length+6], pinfo->dl_dst.data, 6) == 0) {
2687             capture_eth (pd, offset + hdr_length, len, ld);
2688             return;
2689           }
2690         }
2691 #endif
2692         if (pd[offset+hdr_length] == 0xff && pd[offset+hdr_length+1] == 0xff)
2693           capture_ipx (ld);
2694         else if (pd[offset+hdr_length] == 0x00 && pd[offset+hdr_length+1] == 0x00)
2695           capture_llc (pd, offset + hdr_length + 2, len, ld);
2696       }
2697       else {
2698         capture_llc (pd, offset + hdr_length, len, ld);
2699       }
2700       break;
2701     }
2702
2703     default:
2704       ld->other++;
2705       break;
2706   }
2707 }
2708
2709 /*
2710  * Handle 802.11 with a variable-length link-layer header.
2711  */
2712 void
2713 capture_ieee80211 (const guchar * pd, int offset, int len, packet_counts * ld)
2714 {
2715   capture_ieee80211_common (pd, offset, len, ld, FALSE, FALSE, FALSE);
2716 }
2717
2718 /*
2719  * Handle 802.11 with a variable-length link-layer header and data padding.
2720  */
2721 void
2722 capture_ieee80211_datapad (const guchar * pd, int offset, int len,
2723                            packet_counts * ld)
2724 {
2725   capture_ieee80211_common (pd, offset, len, ld, FALSE, TRUE, FALSE);
2726 }
2727
2728 /*
2729  * Handle 802.11 with a fixed-length link-layer header (padded to the
2730  * maximum length).
2731  */
2732 void
2733 capture_ieee80211_fixed (const guchar * pd, int offset, int len, packet_counts * ld)
2734 {
2735   capture_ieee80211_common (pd, offset, len, ld, TRUE, FALSE, FALSE);
2736 }
2737
2738 /*
2739  * Handle an HT 802.11 with a variable-length link-layer header.
2740  */
2741 void
2742 capture_ieee80211_ht (const guchar * pd, int offset, int len, packet_counts * ld)
2743 {
2744   capture_ieee80211_common (pd, offset, len, ld, FALSE, FALSE, TRUE);
2745 }
2746
2747 #define WLANCAP_MAGIC_COOKIE_BASE 0x80211000
2748 #define WLANCAP_MAGIC_COOKIE_V1 0x80211001
2749 #define WLANCAP_MAGIC_COOKIE_V2 0x80211002
2750
2751
2752 /*
2753  * Prism II-based wlan devices have a monitoring mode that sticks
2754  * a proprietary header on each packet with lots of good
2755  * information.  This file is responsible for decoding that
2756  * data.
2757  *
2758  * Support by Tim Newsham
2759  *
2760  * A value from the header.
2761  *
2762  * It appears from looking at the linux-wlan-ng and Prism II HostAP
2763  * drivers, and various patches to the orinoco_cs drivers to add
2764  * Prism headers, that:
2765  *
2766  *      the "did" identifies what the value is (i.e., what it's the value
2767  *      of);
2768  *
2769  *      "status" is 0 if the value is present or 1 if it's absent;
2770  *
2771  *      "len" is the length of the value (always 4, in that code);
2772  *
2773  *      "data" is the value of the data (or 0 if not present).
2774  *
2775  * Note: all of those values are in the *host* byte order of the machine
2776  * on which the capture was written.
2777  */
2778
2779
2780 /*
2781  * Header attached during Prism monitor mode.
2782  *
2783  * At least according to one paper I've seen, the Prism 2.5 chip set
2784  * provides:
2785  *
2786  *      RSSI (receive signal strength indication) is "the total power
2787  *      received by the radio hardware while receiving the frame,
2788  *      including signal, interfereence, and background noise";
2789  *
2790  *      "silence value" is "the total power observed just before the
2791  *      start of the frame".
2792  *
2793  * None of the drivers I looked at supply the "rssi" or "sq" value,
2794  * but they do supply "signal" and "noise" values, along with a "rate"
2795  * value that's 1/5 of the raw value from what is presumably a raw
2796  * HFA384x frame descriptor, with the comment "set to 802.11 units",
2797  * which presumably means the units are 500 Kb/s.
2798  *
2799  * I infer from the current NetBSD "wi" driver that "signal" and "noise"
2800  * are adjusted dBm values, with the dBm value having 100 added to it
2801  * for the Prism II cards (although the NetBSD code has an XXX comment
2802  * for the #define for WI_PRISM_DBM_OFFSET) and 149 (with no XXX comment)
2803  * for the Orinoco cards.
2804  *
2805  * XXX - what about other drivers that supply Prism headers, such as
2806  * old versions of the MadWifi driver?
2807  */
2808
2809 #define PRISM_HEADER_LENGTH     144             /* Default Prism Header Length */
2810 #define PRISM_DID_HOSTTIME      0x00010044      /* Host time element */
2811 #define PRISM_DID_MACTIME       0x00020044      /* Mac time element */
2812 #define PRISM_DID_CHANNEL       0x00030044      /* Channel element */
2813 #define PRISM_DID_RSSI          0x00040044      /* RSSI element */
2814 #define PRISM_DID_SQ            0x00050044      /* SQ element */
2815 #define PRISM_DID_SIGNAL        0x00060044      /* Signal element */
2816 #define PRISM_DID_NOISE         0x00070044      /* Noise element */
2817 #define PRISM_DID_RATE          0x00080044      /* Rate element */
2818 #define PRISM_DID_ISTX          0x00090044      /* Is Tx frame */
2819 #define PRISM_DID_FRMLEN        0x000A0044      /* Frame length */
2820
2821 static const value_string prism_did_vals[] =
2822 {
2823   { PRISM_DID_HOSTTIME,   "Host Time" },
2824   { PRISM_DID_MACTIME,    "Mac Time" },
2825   { PRISM_DID_CHANNEL,    "Channel" },
2826   { PRISM_DID_RSSI,       "RSSI" },
2827   { PRISM_DID_SQ,         "SQ" },
2828   { PRISM_DID_SIGNAL,     "Signal" },
2829   { PRISM_DID_NOISE,      "Noise" },
2830   { PRISM_DID_RATE,       "Rate" },
2831   { PRISM_DID_ISTX,       "Is Tx" },
2832   { PRISM_DID_FRMLEN,     "Frame Length" },
2833   { 0, NULL}
2834 };
2835
2836 static const value_string prism_status_vals[] =
2837 {
2838   { 0,   "Not Supplied" },
2839   { 1,   "Supplied" },
2840   { 0, NULL}
2841 };
2842
2843 static const value_string prism_istx_vals[] =
2844 {
2845   { 0,   "Rx Packet" },
2846   { 1,   "Tx Packet" },
2847   { 0, NULL}
2848 };
2849
2850 static void
2851 prism_rate_base_custom(gchar *result, guint32 rate)
2852 {
2853    g_snprintf(result, ITEM_LABEL_LENGTH, "%u.%u", rate /2, rate & 1 ? 5 : 0);
2854 }
2855
2856 static gchar *
2857 prism_rate_return(guint32 rate)
2858 {
2859     gchar *result=NULL;
2860     result = ep_alloc(SHORT_STR);
2861     result[0] = '\0';
2862     prism_rate_base_custom(result, rate);
2863
2864     return result;
2865 }
2866
2867
2868 void
2869 capture_prism(const guchar *pd, int offset, int len, packet_counts *ld)
2870 {
2871   guint32 cookie;
2872
2873   if (!BYTES_ARE_IN_FRAME(offset, len, 4)) {
2874     ld->other++;
2875     return;
2876   }
2877
2878   /* Some captures with DLT_PRISM have the AVS WLAN header */
2879   cookie = pntohl(pd);
2880   if ((cookie == WLANCAP_MAGIC_COOKIE_V1) ||
2881       (cookie == WLANCAP_MAGIC_COOKIE_V2)) {
2882     capture_wlancap(pd, offset, len, ld);
2883     return;
2884   }
2885
2886   /* Prism header */
2887   if (!BYTES_ARE_IN_FRAME(offset, len, PRISM_HEADER_LENGTH)) {
2888     ld->other++;
2889     return;
2890   }
2891   offset += PRISM_HEADER_LENGTH;
2892
2893   /* 802.11 header follows */
2894   capture_ieee80211(pd, offset, len, ld);
2895 }
2896
2897 void
2898 capture_wlancap(const guchar *pd, int offset, int len, packet_counts *ld)
2899 {
2900   guint32 length;
2901
2902   if (!BYTES_ARE_IN_FRAME(offset, len, sizeof(guint32)*2)) {
2903     ld->other++;
2904     return;
2905   }
2906
2907   length = pntohl(pd+sizeof(guint32));
2908
2909   if (!BYTES_ARE_IN_FRAME(offset, len, length)) {
2910     ld->other++;
2911     return;
2912   }
2913
2914   offset += length;
2915
2916   /* 802.11 header follows */
2917   capture_ieee80211(pd, offset, len, ld);
2918 }
2919
2920 /* ************************************************************************* */
2921 /*          Add the subtree used to store the fixed parameters               */
2922 /* ************************************************************************* */
2923 static proto_tree *
2924 get_fixed_parameter_tree (proto_tree * tree, tvbuff_t *tvb, int start, int size)
2925 {
2926   proto_item *fixed_fields;
2927   fixed_fields =
2928     proto_tree_add_uint_format (tree, hf_ieee80211_fixed_parameters, tvb, start,
2929         size, size, "Fixed parameters (%d bytes)",
2930         size);
2931
2932   return proto_item_add_subtree (fixed_fields, ett_fixed_parameters);
2933 }
2934
2935
2936 /* ************************************************************************* */
2937 /*            Add the subtree used to store tagged parameters                */
2938 /* ************************************************************************* */
2939 static proto_tree *
2940 get_tagged_parameter_tree (proto_tree * tree, tvbuff_t *tvb, int start, int size)
2941 {
2942   proto_item *tagged_fields;
2943
2944   tagged_fields = proto_tree_add_uint_format (tree, hf_ieee80211_tagged_parameters,
2945     tvb,
2946     start,
2947     2,
2948     size,
2949     "Tagged parameters (%d bytes)",
2950     size);
2951
2952   return proto_item_add_subtree (tagged_fields, ett_tagged_parameters);
2953 }
2954
2955
2956 static int
2957 dissect_vendor_action_marvell(proto_tree *tree, tvbuff_t *tvb, int offset)
2958 {
2959   guint8 octet;
2960
2961   octet = tvb_get_guint8(tvb, offset);
2962   proto_tree_add_item (tree, hf_ieee80211_ff_marvell_action_type, tvb, offset, 1, TRUE);
2963   offset++;
2964   switch (octet)
2965     {
2966       case MRVL_ACTION_MESH_MANAGEMENT:
2967         octet = tvb_get_guint8(tvb, offset);
2968         proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_action_code, tvb, offset, 1, TRUE);
2969         offset++;
2970         switch (octet)
2971           {
2972             case MRVL_MESH_MGMT_ACTION_RREQ:
2973               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_length, tvb, offset, 1, TRUE);
2974               offset++;
2975               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_mode, tvb, offset, 1, TRUE);
2976               offset++;
2977               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_hopcount, tvb, offset, 1, TRUE);
2978               offset++;
2979               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_ttl, tvb, offset, 1, TRUE);
2980               offset++;
2981               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_rreqid, tvb, offset, 4, TRUE);
2982               offset+= 4;
2983               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_sa, tvb, offset, 6, FALSE);
2984               offset+= 6;
2985               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_ssn, tvb, offset, 4, TRUE);
2986               offset+= 4;
2987               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_lifetime, tvb, offset, 4, TRUE);
2988               offset+= 4;
2989               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_metric, tvb, offset, 4, TRUE);
2990               offset+= 4;
2991               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_dstcount, tvb, offset, 1, TRUE);
2992               offset++;
2993               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_flags, tvb, offset, 1, TRUE);
2994               offset++;
2995               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_da, tvb, offset, 6, FALSE);
2996               offset+= 6;
2997               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_dsn, tvb, offset, 4, TRUE);
2998               offset+= 4;
2999               break;
3000             case MRVL_MESH_MGMT_ACTION_RREP:
3001               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_length, tvb, offset, 1, TRUE);
3002               offset++;
3003               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_mode, tvb, offset, 1, TRUE);
3004               offset++;
3005               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_hopcount, tvb, offset, 1, TRUE);
3006               offset++;
3007               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_ttl, tvb, offset, 1, TRUE);
3008               offset++;
3009               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_da, tvb, offset, 6, FALSE);
3010               offset+= 6;
3011               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_dsn, tvb, offset, 4, TRUE);
3012               offset+= 4;
3013               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_lifetime, tvb, offset, 4, TRUE);
3014               offset+= 4;
3015               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_metric, tvb, offset, 4, TRUE);
3016               offset+= 4;
3017               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_sa, tvb, offset, 6, FALSE);
3018               offset+= 6;
3019               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_ssn, tvb, offset, 4, TRUE);
3020               offset+= 4;
3021               break;
3022             case MRVL_MESH_MGMT_ACTION_RERR:
3023               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_length, tvb, offset, 1, TRUE);
3024               offset++;
3025               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_mode, tvb, offset, 1, TRUE);
3026               offset++;
3027               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_dstcount, tvb, offset, 1, TRUE);
3028               offset++;
3029               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_da, tvb, offset, 6, FALSE);
3030               offset+= 6;
3031               proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_dsn, tvb, offset, 4, TRUE);
3032               offset+= 4;
3033               break;
3034             default:
3035               break;
3036           }
3037         break;
3038       default:
3039         break;
3040     }
3041
3042   return offset;
3043 }
3044
3045 static guint
3046 dissect_advertisement_protocol(packet_info *pinfo, proto_tree *tree,
3047                                tvbuff_t *tvb, int offset, gboolean *anqp)
3048 {
3049   guint8 tag_no, tag_len, left;
3050   proto_item *item = NULL;
3051   proto_tree *adv_tree, *adv_tuple_tree;
3052
3053   if (anqp)
3054     *anqp = FALSE;
3055   tag_no = tvb_get_guint8(tvb, offset);
3056   item = proto_tree_add_item(tree, hf_ieee80211_tag_number, tvb, offset, 1, TRUE);
3057
3058   tag_len = tvb_get_guint8(tvb, offset + 1);
3059   if (tag_no != TAG_ADVERTISEMENT_PROTOCOL) {
3060     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3061                            "Unexpected IE %d (expected Advertisement "
3062                            "Protocol)", tag_no);
3063     return 2 + tag_len;
3064   }
3065   item = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, 1, tag_len);
3066   if (tag_len < 2) {
3067     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3068                            "Advertisement Protocol: IE must be at least 2 "
3069                            "octets long");
3070     return 2 + tag_len;
3071   }
3072
3073   left = tag_len;
3074   offset += 2;
3075   item = proto_tree_add_text(tree, tvb, offset, left,
3076                              "Advertisement Protocol element");
3077   adv_tree = proto_item_add_subtree(item, ett_adv_proto);
3078
3079   while (left >= 2) {
3080     guint8 id;
3081
3082     id = tvb_get_guint8(tvb, offset + 1);
3083     item = proto_tree_add_text(adv_tree, tvb, offset, 2,
3084                                "Advertisement Protocol Tuple: %s",
3085                                val_to_str(id, adv_proto_id_vals,
3086                                           "Unknown (%d)"));
3087     adv_tuple_tree = proto_item_add_subtree(item, ett_adv_proto_tuple);
3088
3089     proto_tree_add_item(adv_tuple_tree,
3090                         hf_ieee80211_tag_adv_proto_resp_len_limit, tvb,
3091                         offset, 1, FALSE);
3092     proto_tree_add_item(adv_tuple_tree,
3093                         hf_ieee80211_tag_adv_proto_pame_bi, tvb,
3094                         offset, 1, FALSE);
3095     offset++;
3096     left--;
3097     proto_tree_add_item(adv_tuple_tree, hf_ieee80211_tag_adv_proto_id, tvb,
3098                         offset, 1, FALSE);
3099     offset++;
3100     left--;
3101
3102     if (id == 0 && anqp)
3103       *anqp = TRUE;
3104
3105     if (id == 221) {
3106       /* Vendor specific */
3107       guint8 len = tvb_get_guint8(tvb, offset);
3108       offset++;
3109       left--;
3110       if (len > left) {
3111         expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3112                                "Vendor specific info length error");
3113         return 2 + tag_len;
3114       }
3115       proto_tree_add_text(adv_tuple_tree, tvb, offset, len,
3116                           "Vendor Specific Advertisement Protocol info");
3117       offset += len;
3118       left -= len;
3119     }
3120   }
3121
3122   if (left) {
3123     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3124                            "Unexpected extra data in the end");
3125   }
3126
3127   return 2 + tag_len;
3128 }
3129
3130 static void
3131 dissect_anqp(proto_tree *tree, tvbuff_t *tvb, int offset, gboolean request)
3132 {
3133   guint16 id, len;
3134
3135   proto_tree_add_text(tree, tvb, offset, 4,
3136                       request ? "Access Network Query Protocol Request" :
3137                       "Access Network Query Protocol Response");
3138   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info_id,
3139                       tvb, offset, 2, TRUE);
3140   id = tvb_get_letohs(tvb, offset);
3141   offset += 2;
3142   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info_length,
3143                       tvb, offset, 2, TRUE);
3144   len = tvb_get_letohs(tvb, offset);
3145   offset += 2;
3146   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info,
3147                       tvb, offset, len, FALSE);
3148   if (id == 56797) {
3149     /* ANQP vendor-specific list */
3150     guint32 oui;
3151     guint8 subtype;
3152     const guint8 *tag_data_ptr;
3153
3154     oui = tvb_get_ntoh24(tvb, offset);
3155     tag_data_ptr = tvb_get_ptr(tvb, offset, 3);
3156     proto_tree_add_bytes_format(tree, hf_ieee80211_tag_oui, tvb, offset, 3,
3157                                 tag_data_ptr, "Vendor: %s",
3158                                 get_manuf_name(tag_data_ptr));
3159     offset += 3;
3160
3161     switch (oui) {
3162     case OUI_WFA:
3163       subtype = tvb_get_guint8(tvb, offset);
3164       if (subtype == WFA_SUBTYPE_P2P) {
3165         proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u: P2P ANQP",
3166                             subtype);
3167         dissect_wifi_p2p_anqp(g_pinfo, tree, tvb, offset + 1, request);
3168       } else {
3169         proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u", subtype);
3170       }
3171     }
3172   }
3173 }
3174
3175 static guint
3176 dissect_gas_initial_request(proto_tree *tree, tvbuff_t *tvb, int offset,
3177                             gboolean anqp)
3178 {
3179   guint16 req_len;
3180   int start = offset;
3181   proto_item *item;
3182   proto_tree *query, *anqp_tree;
3183
3184   /* Query Request Length (2 octets) */
3185   req_len = tvb_get_letohs(tvb, offset);
3186
3187   item = proto_tree_add_text(tree, tvb, offset, 2 + req_len, "Query Request");
3188   query = proto_item_add_subtree(item, ett_gas_query);
3189
3190   proto_tree_add_item(query, hf_ieee80211_ff_query_request_length,
3191                       tvb, offset, 2, TRUE);
3192   offset += 2;
3193   /*
3194    * Query Request (GAS query; formatted per protocol specified in the
3195    * Advertisement Protocol IE)
3196    */
3197   item = proto_tree_add_item(query, hf_ieee80211_ff_query_request,
3198                              tvb, offset, req_len, FALSE);
3199   if (anqp) {
3200     anqp_tree = proto_item_add_subtree(item, ett_gas_anqp);
3201     dissect_anqp(anqp_tree, tvb, offset, TRUE);
3202   }
3203   offset += req_len;
3204
3205   return offset - start;
3206 }
3207
3208 static guint
3209 dissect_gas_initial_response(proto_tree *tree, tvbuff_t *tvb, int offset,
3210                              gboolean anqp)
3211 {
3212   guint16 resp_len;
3213   int start = offset;
3214   proto_item *item;
3215   proto_tree *query, *anqp_tree;
3216
3217   /* Query Response Length (2 octets) */
3218   resp_len = tvb_get_letohs(tvb, offset);
3219
3220   item = proto_tree_add_text(tree, tvb, offset, 2 + resp_len,
3221                              "Query Response");
3222   query = proto_item_add_subtree(item, ett_gas_query);
3223
3224   proto_tree_add_item(query, hf_ieee80211_ff_query_response_length,
3225                       tvb, offset, 2, TRUE);
3226   offset += 2;
3227   /* Query Response (optional) */
3228   if (resp_len) {
3229     item = proto_tree_add_item(query, hf_ieee80211_ff_query_response,
3230                                tvb, offset, resp_len, FALSE);
3231     if (anqp) {
3232       anqp_tree = proto_item_add_subtree(item, ett_gas_anqp);
3233       dissect_anqp(anqp_tree, tvb, offset, FALSE);
3234     }
3235     offset += resp_len;
3236   }
3237
3238   return offset - start;
3239 }
3240
3241 static guint
3242 dissect_gas_comeback_response(proto_tree *tree, tvbuff_t *tvb, int offset,
3243                               gboolean anqp, guint8 frag)
3244 {
3245   guint16 resp_len;
3246   int start = offset;
3247   proto_item *item;
3248   proto_tree *query, *anqp_tree;
3249
3250   /* Query Response Length (2 octets) */
3251   resp_len = tvb_get_letohs(tvb, offset);
3252
3253   item = proto_tree_add_text(tree, tvb, offset, 2 + resp_len,
3254                              "Query Response");
3255   query = proto_item_add_subtree(item, ett_gas_query);
3256
3257   proto_tree_add_item(query, hf_ieee80211_ff_query_response_length,
3258                       tvb, offset, 2, TRUE);
3259   offset += 2;
3260   /* Query Response (optional) */
3261   if (resp_len) {
3262     item = proto_tree_add_item(query, hf_ieee80211_ff_query_response,
3263                                tvb, offset, resp_len, FALSE);
3264     if (anqp && frag == 0) {
3265       anqp_tree = proto_item_add_subtree(item, ett_gas_anqp);
3266       dissect_anqp(anqp_tree, tvb, offset, FALSE);
3267     }
3268     offset += resp_len;
3269   }
3270
3271   return offset - start;
3272 }
3273
3274 /* ************************************************************************* */
3275 /*              Dissect and add fixed mgmt fields to protocol tree           */
3276 /* ************************************************************************* */
3277 static guint
3278 add_fixed_field(proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode)
3279 {
3280
3281   guint length = 0;
3282
3283   switch (lfcode)
3284   {
3285     case FIELD_TIMESTAMP:
3286       proto_tree_add_item(tree, hf_ieee80211_ff_timestamp, tvb, offset, 8, TRUE);
3287       length += 8;
3288       break;
3289
3290     case FIELD_BEACON_INTERVAL:
3291       {
3292         proto_tree_add_item(tree, hf_ieee80211_ff_beacon_interval, tvb, offset, 2, TRUE);
3293         col_append_fstr(g_pinfo->cinfo, COL_INFO, ", BI=%d", tvb_get_letohs (tvb, offset));
3294         length += 2;
3295         break;
3296       }
3297
3298     case FIELD_CAP_INFO:
3299       {
3300
3301         proto_item *cap_item;
3302         proto_tree *cap_tree;
3303
3304         cap_item = proto_tree_add_item(tree, hf_ieee80211_ff_capture, tvb, offset, 2, TRUE);
3305         cap_tree = proto_item_add_subtree (cap_item, ett_cap_tree);
3306
3307         proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_ess, tvb, offset, 2, TRUE);
3308         proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_ibss, tvb, offset, 2, TRUE);
3309         if ((tvb_get_letohs(tvb, offset) & 0x0001) != 0)  /* This is an AP */
3310           proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_ap_poll, tvb, offset, 2, TRUE);
3311         else      /* This is a STA */
3312           proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_sta_poll, tvb, offset, 2, TRUE);
3313
3314         proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_privacy, tvb, offset, 2, TRUE);
3315         proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_preamble, tvb, offset, 2, TRUE);
3316         proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_pbcc, tvb, offset, 2, TRUE);
3317         proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_agility, tvb, offset, 2, TRUE);
3318         proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_spec_man, tvb, offset, 2, TRUE);
3319         proto_tree_add_item(cap_tree, hf_ieee80211_ff_short_slot_time, tvb, offset, 2, TRUE);
3320         proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_apsd, tvb, offset, 2, TRUE);
3321         proto_tree_add_item(cap_tree, hf_ieee80211_ff_dsss_ofdm, tvb, offset, 2, TRUE);
3322         proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_del_blk_ack, tvb, offset, 2, TRUE);
3323         proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_imm_blk_ack, tvb, offset, 2, TRUE);
3324         length += 2;
3325         break;
3326       }
3327     case FIELD_AUTH_ALG:
3328       proto_tree_add_item(tree, hf_ieee80211_ff_auth_alg, tvb, offset, 2, TRUE);
3329       length += 2;
3330       break;
3331
3332     case FIELD_AUTH_TRANS_SEQ:
3333       proto_tree_add_item(tree, hf_ieee80211_ff_auth_seq, tvb, offset, 2, TRUE);
3334       length += 2;
3335       break;
3336
3337     case FIELD_CURRENT_AP_ADDR:
3338       proto_tree_add_item(tree, hf_ieee80211_ff_current_ap, tvb, offset, 6, FALSE);
3339       length += 6;
3340       break;
3341
3342     case FIELD_LISTEN_IVAL:
3343       proto_tree_add_item(tree, hf_ieee80211_ff_listen_ival, tvb, offset, 2, TRUE);
3344       length += 2;
3345       break;
3346
3347     case FIELD_REASON_CODE:
3348       proto_tree_add_item(tree, hf_ieee80211_ff_reason, tvb, offset, 2, TRUE);
3349       length += 2;
3350       break;
3351
3352     case FIELD_ASSOC_ID:
3353       proto_tree_add_item(tree, hf_ieee80211_ff_assoc_id, tvb, offset, 2, TRUE);
3354       length += 2;
3355       break;
3356
3357     case FIELD_STATUS_CODE:
3358       proto_tree_add_item(tree, hf_ieee80211_ff_status_code, tvb, offset, 2, TRUE);
3359       length += 2;
3360       break;
3361
3362     case FIELD_CATEGORY_CODE:
3363       proto_tree_add_item(tree, hf_ieee80211_ff_category_code, tvb, offset, 1, TRUE);
3364       length += 1;
3365       break;
3366
3367     case FIELD_ACTION_CODE:
3368       proto_tree_add_item(tree, hf_ieee80211_ff_action_code, tvb, offset, 1, TRUE);
3369       length += 1;
3370       break;
3371
3372     case FIELD_DIALOG_TOKEN:
3373       proto_tree_add_item(tree, hf_ieee80211_ff_dialog_token, tvb, offset, 1, TRUE);
3374       length += 1;
3375       break;
3376
3377     case FIELD_WME_ACTION_CODE:
3378       proto_tree_add_item(tree, hf_ieee80211_ff_wme_action_code, tvb, offset, 1, TRUE);
3379       length += 1;
3380       break;
3381
3382     case FIELD_WME_STATUS_CODE:
3383       proto_tree_add_item(tree, hf_ieee80211_ff_wme_status_code, tvb, offset, 1, TRUE);
3384       length += 1;
3385       break;
3386
3387     case FIELD_QOS_ACTION_CODE:
3388       proto_tree_add_item(tree, hf_ieee80211_ff_qos_action_code, tvb, offset, 1, TRUE);
3389       length += 1;
3390       break;
3391
3392     case FIELD_BLOCK_ACK_ACTION_CODE:
3393       proto_tree_add_item(tree, hf_ieee80211_ff_ba_action, tvb, offset, 1, TRUE);
3394       length += 1;
3395       break;
3396
3397     case FIELD_BLOCK_ACK_PARAM:
3398       {
3399         proto_item *param_item;
3400         proto_tree *param_tree;
3401
3402         param_item = proto_tree_add_item(tree, hf_ieee80211_ff_block_ack_params, tvb, offset, 2, TRUE);
3403         param_tree = proto_item_add_subtree (param_item, ett_ff_ba_param_tree);
3404
3405         proto_tree_add_item(param_tree, hf_ieee80211_ff_block_ack_params_amsdu_permitted, tvb, offset, 2, TRUE);
3406         proto_tree_add_item(param_tree, hf_ieee80211_ff_block_ack_params_policy, tvb, offset, 2, TRUE);
3407         proto_tree_add_item(param_tree, hf_ieee80211_ff_block_ack_params_tid, tvb, offset, 2, TRUE);
3408         proto_tree_add_item(param_tree, hf_ieee80211_ff_block_ack_params_buffer_size, tvb, offset, 2, TRUE);
3409         length += 2;
3410         break;
3411       }
3412
3413     case FIELD_BLOCK_ACK_TIMEOUT:
3414       {
3415         proto_tree_add_item(tree, hf_ieee80211_ff_block_ack_timeout, tvb, offset, 2, TRUE);
3416         length += 2;
3417         break;
3418       }
3419
3420     case FIELD_BLOCK_ACK_SSC:
3421       {
3422         proto_item *ssc_item;
3423         proto_tree *ssc_tree;
3424
3425         ssc_item = proto_tree_add_item(tree, hf_ieee80211_ff_block_ack_ssc, tvb, offset, 2, TRUE);
3426         ssc_tree = proto_item_add_subtree (ssc_item, ett_ff_ba_ssc_tree);
3427
3428         proto_tree_add_item(ssc_tree, hf_ieee80211_ff_block_ack_ssc_fragment, tvb, offset, 2, TRUE);
3429         proto_tree_add_item(ssc_tree, hf_ieee80211_ff_block_ack_ssc_sequence, tvb, offset, 2, TRUE);
3430         length += 2;
3431         break;
3432       }
3433
3434     case FIELD_QOS_TS_INFO:
3435       {
3436         proto_item *tsinfo_item;
3437         proto_tree *tsinfo_tree;
3438
3439         tsinfo_item = proto_tree_add_item(tree, hf_ieee80211_tsinfo, tvb, offset, 3, TRUE);
3440         tsinfo_tree = proto_item_add_subtree(tsinfo_item, ett_tsinfo_tree);
3441
3442         proto_tree_add_item(tsinfo_tree, hf_ieee80211_tsinfo_type, tvb, offset, 3, TRUE);
3443         proto_tree_add_item(tsinfo_tree, hf_ieee80211_tsinfo_tsid, tvb, offset, 3, TRUE);
3444         proto_tree_add_item(tsinfo_tree, hf_ieee80211_tsinfo_dir, tvb, offset, 3, TRUE);
3445         proto_tree_add_item(tsinfo_tree, hf_ieee80211_tsinfo_access, tvb, offset, 3, TRUE);
3446         proto_tree_add_item(tsinfo_tree, hf_ieee80211_tsinfo_agg, tvb, offset, 3, TRUE);
3447         proto_tree_add_item(tsinfo_tree, hf_ieee80211_tsinfo_apsd, tvb, offset, 3, TRUE);
3448         proto_tree_add_item(tsinfo_tree, hf_ieee80211_tsinfo_up, tvb, offset, 3, TRUE);
3449         proto_tree_add_item(tsinfo_tree, hf_ieee80211_tsinfo_ack, tvb, offset, 3, TRUE);
3450         proto_tree_add_item(tsinfo_tree, hf_ieee80211_tsinfo_sched, tvb, offset, 3, TRUE);
3451         proto_tree_add_item(tsinfo_tree, hf_ieee80211_tsinfo_rsv, tvb, offset, 3, TRUE);
3452         length += 3;
3453         break;
3454       }
3455
3456 #ifdef MESH_OVERRIDES
3457     /* Mesh Management */
3458     case FIELD_MESH_MGT_ACTION_PS_CODE:
3459       proto_tree_add_item(tree, hf_ieee80211_ff_mesh_mgt_action_ps_code, tvb, offset, 1, TRUE);
3460       length += 1;
3461       break;
3462
3463     case FIELD_MESH_MGT_ACTION_PL_CODE:
3464       proto_tree_add_item(tree, hf_ieee80211_ff_mesh_mgt_action_pl_code, tvb, offset, 1, TRUE);
3465       length += 1;
3466       break;
3467 #endif /* MESH_OVERRIDES */
3468
3469     case FIELD_DLS_ACTION_CODE:
3470       proto_tree_add_item(tree, hf_ieee80211_ff_dls_action_code, tvb, offset, 1, TRUE);
3471       length += 1;
3472       break;
3473
3474     case FIELD_DST_MAC_ADDR:
3475       proto_tree_add_item(tree, hf_ieee80211_ff_dst_mac_addr, tvb, offset, 6, TRUE);
3476       length += 6;
3477       break;
3478
3479     case FIELD_SRC_MAC_ADDR:
3480       proto_tree_add_item(tree, hf_ieee80211_ff_src_mac_addr, tvb, offset, 6, TRUE);
3481       length += 6;
3482       break;
3483
3484     case FIELD_DLS_TIMEOUT:
3485       proto_tree_add_item(tree, hf_ieee80211_ff_dls_timeout, tvb, offset, 2, TRUE);
3486       length += 2;
3487       break;
3488
3489     case FIELD_DELBA_PARAM_SET:
3490       {
3491         proto_item *param_item;
3492         proto_tree *param_tree;
3493
3494         param_item = proto_tree_add_item(tree, hf_ieee80211_ff_delba_param, tvb, offset, 2, TRUE);
3495         param_tree = proto_item_add_subtree (param_item, ett_ff_ba_param_tree);
3496
3497         proto_tree_add_item(param_tree, hf_ieee80211_ff_delba_param_reserved, tvb, offset, 2, TRUE);
3498         proto_tree_add_item(param_tree, hf_ieee80211_ff_delba_param_init, tvb, offset, 2, TRUE);
3499         proto_tree_add_item(param_tree, hf_ieee80211_ff_delba_param_tid, tvb, offset, 2, TRUE);
3500         length += 2;
3501         break;
3502       }
3503
3504     case FIELD_MAX_REG_PWR:
3505       proto_tree_add_item(tree, hf_ieee80211_ff_max_reg_pwr, tvb, offset, 2, TRUE);
3506       length += 2;
3507       break;
3508
3509     case FIELD_MEASUREMENT_PILOT_INT:
3510       proto_tree_add_item(tree, hf_ieee80211_ff_measurement_pilot_int, tvb, offset, 2, TRUE);
3511       length += 2;
3512       break;
3513
3514     case FIELD_COUNTRY_STR:
3515       proto_tree_add_string (tree, hf_ieee80211_ff_country_str, tvb, offset, 3, FALSE);
3516       length += 3;
3517       break;
3518
3519
3520     case FIELD_MAX_TX_PWR:
3521       proto_tree_add_item(tree, hf_ieee80211_ff_max_tx_pwr, tvb, offset, 1, TRUE);
3522       length += 1;
3523       break;
3524
3525     case FIELD_TX_PWR_USED:
3526       proto_tree_add_item(tree, hf_ieee80211_ff_tx_pwr_used, tvb, offset, 1, TRUE);
3527       length += 1;
3528       break;
3529
3530     case FIELD_TRANSCEIVER_NOISE_FLOOR:
3531       proto_tree_add_item(tree, hf_ieee80211_ff_transceiver_noise_floor, tvb, offset, 1, TRUE);
3532       length += 1;
3533       break;
3534
3535     case FIELD_CHANNEL_WIDTH:
3536       proto_tree_add_item(tree, hf_ieee80211_ff_channel_width, tvb, offset, 1, TRUE);
3537       length += 1;
3538       break;
3539
3540     case FIELD_QOS_INFO_AP:
3541       {
3542         proto_item *info_item;
3543         proto_tree *info_tree;
3544
3545         info_item = proto_tree_add_item(tree, hf_ieee80211_ff_qos_info_ap, tvb, offset, 1, TRUE);
3546         info_tree = proto_item_add_subtree (info_item, ett_ff_qos_info);
3547
3548         proto_tree_add_item(info_tree, hf_ieee80211_ff_qos_info_ap_edca_param_set_counter, tvb, offset, 1, TRUE);
3549         proto_tree_add_item(info_tree, hf_ieee80211_ff_qos_info_ap_q_ack, tvb, offset, 1, TRUE);
3550         proto_tree_add_item(info_tree, hf_ieee80211_ff_qos_info_ap_queue_req, tvb, offset, 1, TRUE);
3551         proto_tree_add_item(info_tree, hf_ieee80211_ff_qos_info_ap_txop_request, tvb, offset, 1, TRUE);
3552         proto_tree_add_item(info_tree, hf_ieee80211_ff_qos_info_ap_reserved, tvb, offset, 1, TRUE);
3553         length += 1;
3554         break;
3555       }
3556
3557     case FIELD_QOS_INFO_STA:
3558       {
3559         proto_item *info_item;
3560         proto_tree *info_tree;
3561
3562         info_item = proto_tree_add_item(tree, hf_ieee80211_ff_qos_info_sta, tvb, offset, 1, TRUE);
3563         info_tree = proto_item_add_subtree (info_item, ett_ff_qos_info);
3564
3565         proto_tree_add_item(info_tree, hf_ieee80211_ff_qos_info_sta_ac_vo, tvb, offset, 1, TRUE);
3566         proto_tree_add_item(info_tree, hf_ieee80211_ff_qos_info_sta_ac_vi, tvb, offset, 1, TRUE);
3567         proto_tree_add_item(info_tree, hf_ieee80211_ff_qos_info_sta_ac_bk, tvb, offset, 1, TRUE);
3568         proto_tree_add_item(info_tree, hf_ieee80211_ff_qos_info_sta_ac_be, tvb, offset, 1, TRUE);
3569         proto_tree_add_item(info_tree, hf_ieee80211_ff_qos_info_sta_q_ack, tvb, offset, 1, TRUE);
3570         proto_tree_add_item(info_tree, hf_ieee80211_ff_qos_info_sta_max_sp_len, tvb, offset, 1, TRUE);
3571         proto_tree_add_item(info_tree, hf_ieee80211_ff_qos_info_sta_more_data_ack, tvb, offset, 1, TRUE);
3572         length += 1;
3573         break;
3574       }
3575
3576     case FIELD_SM_PWR_CNTRL:
3577       {
3578         proto_item *info_item;
3579         proto_tree *info_tree;
3580
3581         info_item = proto_tree_add_item(tree, hf_ieee80211_ff_sm_pwr_save, tvb, offset, 1, TRUE);
3582         info_tree = proto_item_add_subtree (info_item, ett_ff_sm_pwr_save);
3583
3584         proto_tree_add_item(info_tree, hf_ieee80211_ff_sm_pwr_save_enabled, tvb, offset, 1, TRUE);
3585         proto_tree_add_item(info_tree, hf_ieee80211_ff_sm_pwr_save_sm_mode, tvb, offset, 1, TRUE);
3586         proto_tree_add_item(info_tree, hf_ieee80211_ff_sm_pwr_save_reserved, tvb, offset, 1, TRUE);
3587         length += 1;
3588         break;
3589       }
3590
3591     case FIELD_PCO_PHASE_CNTRL:
3592         proto_tree_add_item(tree, hf_ieee80211_ff_pco_phase_cntrl, tvb, offset, 1, TRUE);
3593         length += 1;
3594         break;
3595
3596     case FIELD_PSMP_PARAM_SET:
3597       {
3598         proto_item *param_item;
3599         proto_tree *param_tree;
3600
3601         param_item = proto_tree_add_item(tree, hf_ieee80211_ff_psmp_param_set, tvb, offset, 2, TRUE);
3602         param_tree = proto_item_add_subtree (param_item, ett_ff_psmp_param_set);
3603
3604         proto_tree_add_item(param_tree, hf_ieee80211_ff_psmp_param_set_n_sta, tvb, offset, 2, TRUE);
3605         proto_tree_add_item(param_tree, hf_ieee80211_ff_psmp_param_set_more_psmp, tvb, offset, 2, TRUE );
3606         proto_tree_add_item(param_tree, hf_ieee80211_ff_psmp_param_set_psmp_sequence_duration, tvb, offset, 2, TRUE);
3607         length += 2;
3608         break;
3609       }
3610
3611     case FIELD_MIMO_CNTRL:
3612       {
3613         proto_item *mimo_item;
3614         proto_tree *mimo_tree;
3615
3616         mimo_item = proto_tree_add_item(tree, hf_ieee80211_ff_mimo_cntrl, tvb, offset, 6, TRUE);
3617         mimo_tree = proto_item_add_subtree (mimo_item, ett_ff_mimo_cntrl);
3618
3619         proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_nc_index, tvb, offset, 1, TRUE);
3620         proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_nr_index, tvb, offset, 1, TRUE);
3621         proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_channel_width, tvb, offset, 1, TRUE);
3622         proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_grouping, tvb, offset, 1, TRUE);
3623         proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_coefficient_size, tvb, offset, 2, TRUE);
3624         proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_codebook_info, tvb, offset, 1, TRUE);
3625         proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_remaining_matrix_segment, tvb, offset, 1, TRUE);
3626         proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_reserved, tvb, offset, 1, TRUE);
3627
3628         offset += 2;
3629         proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_sounding_timestamp, tvb, offset, 4, TRUE);
3630         length += 6;
3631         break;
3632       }
3633
3634     case FIELD_ANT_SELECTION:
3635       {
3636         proto_item *ant_item;
3637         proto_tree *ant_tree;
3638
3639         ant_item = proto_tree_add_item(tree, hf_ieee80211_ff_ant_selection, tvb, offset, 1, TRUE);
3640         ant_tree = proto_item_add_subtree (ant_item, ett_ff_ant_sel);
3641
3642         proto_tree_add_item(ant_tree, hf_ieee80211_ff_ant_selection_0, tvb, offset, 1, TRUE);
3643         proto_tree_add_item(ant_tree, hf_ieee80211_ff_ant_selection_1, tvb, offset, 1, TRUE);
3644         proto_tree_add_item(ant_tree, hf_ieee80211_ff_ant_selection_2, tvb, offset, 1, TRUE);
3645         proto_tree_add_item(ant_tree, hf_ieee80211_ff_ant_selection_3, tvb, offset, 1, TRUE);
3646         proto_tree_add_item(ant_tree, hf_ieee80211_ff_ant_selection_4, tvb, offset, 1, TRUE);
3647         proto_tree_add_item(ant_tree, hf_ieee80211_ff_ant_selection_5, tvb, offset, 1, TRUE);
3648         proto_tree_add_item(ant_tree, hf_ieee80211_ff_ant_selection_6, tvb, offset, 1, TRUE);
3649         proto_tree_add_item(ant_tree, hf_ieee80211_ff_ant_selection_7, tvb, offset, 1, TRUE);
3650
3651         length += 1;
3652         break;
3653       }
3654
3655     case FIELD_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT:
3656       {
3657         proto_item *chan_item;
3658         proto_tree *chan_tree;
3659
3660         chan_item = proto_tree_add_item(tree, hf_ieee80211_ff_ext_channel_switch_announcement, tvb, offset, 4, TRUE);
3661         chan_tree = proto_item_add_subtree (chan_item, ett_ff_chan_switch_announce);
3662
3663         proto_tree_add_item(chan_tree, hf_ieee80211_ff_ext_channel_switch_announcement_switch_mode, tvb, offset, 4, TRUE);
3664         proto_tree_add_item(chan_tree, hf_ieee80211_ff_ext_channel_switch_announcement_new_reg_class, tvb, offset, 4, TRUE);
3665         proto_tree_add_item(chan_tree, hf_ieee80211_ff_ext_channel_switch_announcement_new_chan_number, tvb, offset, 4, TRUE);
3666         proto_tree_add_item(chan_tree, hf_ieee80211_ff_ext_channel_switch_announcement_switch_count, tvb, offset, 4, TRUE);
3667         length += 4;
3668         break;
3669       }
3670
3671     case FIELD_HT_INFORMATION:
3672       {
3673         proto_item *ht_item;
3674         proto_tree *ht_tree;
3675
3676         ht_item = proto_tree_add_uint(tree, hf_ieee80211_ff_ht_info, tvb, offset, 1, TRUE);
3677         ht_tree = proto_item_add_subtree (ht_item, ett_ff_ht_info);
3678
3679         proto_tree_add_item(ht_tree, hf_ieee80211_ff_ht_info_information_request, tvb, offset, 1, TRUE);
3680         proto_tree_add_item(ht_tree, hf_ieee80211_ff_ht_info_40_mhz_intolerant, tvb, offset, 1, TRUE);
3681         proto_tree_add_item(ht_tree, hf_ieee80211_ff_ht_info_sta_chan_width, tvb, offset, 1, TRUE);
3682         proto_tree_add_item(ht_tree, hf_ieee80211_ff_ht_info_reserved, tvb, offset, 1, TRUE);
3683         length += 1;
3684         break;
3685       }
3686
3687     case FIELD_HT_ACTION_CODE:
3688         proto_tree_add_item(tree, hf_ieee80211_ff_ht_action, tvb, offset, 1,  TRUE);
3689         length += 1;
3690         break;
3691
3692     case FIELD_PSMP_STA_INFO:
3693       {
3694
3695         proto_item *psmp_item;
3696         proto_tree *psmp_tree;
3697
3698         psmp_item = proto_tree_add_item(tree, hf_ieee80211_ff_psmp_sta_info, tvb, offset, 8, TRUE);
3699         psmp_tree = proto_item_add_subtree(psmp_item, ett_ff_psmp_sta_info);
3700
3701         proto_tree_add_item(psmp_item, hf_ieee80211_ff_psmp_sta_info_type, tvb, offset, 4, TRUE);
3702
3703         switch (tvb_get_letohl(tvb, offset) & PSMP_STA_INFO_FLAG_TYPE)
3704           {
3705             case PSMP_STA_INFO_BROADCAST:
3706               {
3707                 proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_start_offset, tvb, offset, 4, TRUE);
3708                 proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_duration, tvb, offset, 4, TRUE);
3709                 /* Missing 64 bit bitmask... */
3710                 proto_tree_add_uint64(psmp_tree, hf_ieee80211_ff_psmp_sta_info_reserved_large, tvb, offset, 8, (tvb_get_letoh64 (tvb, offset) & G_GINT64_CONSTANT(0xFFFFFFFFFFE00000)) >> 21);
3711                 break;
3712               }
3713
3714             case PSMP_STA_INFO_MULTICAST:
3715               {
3716                 proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_start_offset, tvb, offset, 4, TRUE);
3717                 proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_duration, tvb, offset, 4, TRUE);
3718                 /* Missing 64 bit bitmask... */
3719                 proto_tree_add_uint64(psmp_tree, hf_ieee80211_ff_psmp_sta_info_psmp_multicast_id, tvb, offset, 6, (tvb_get_letoh64 (tvb, offset) & G_GINT64_CONSTANT(0xFFFFFFFFFFE00000)) >> 21);
3720                 break;
3721               }
3722
3723             case PSMP_STA_INFO_INDIVIDUALLY_ADDRESSED:
3724               {
3725                 proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_start_offset, tvb, offset, 4, TRUE);
3726                 proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_duration, tvb, offset, 4, TRUE);
3727
3728                 offset+=2;
3729                 proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_sta_id, tvb, offset, 4, TRUE);
3730                 offset+=2;
3731
3732                 proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_utt_start_offset, tvb, offset, 4, TRUE);
3733                 proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_utt_duration, tvb, offset, 4, TRUE);
3734                 proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_reserved_small, tvb, offset, 4, TRUE);
3735                 break;
3736               }
3737           }
3738         length += 8;
3739         break;
3740       }
3741
3742     case FIELD_SCHEDULE_INFO:
3743       {
3744         proto_item *sched_item;
3745         proto_tree *sched_tree;
3746
3747         sched_item = proto_tree_add_item(tree, hf_ieee80211_sched_info, tvb, offset, 2, TRUE);
3748         sched_tree = proto_item_add_subtree(sched_item, ett_sched_tree);
3749
3750         proto_tree_add_item(sched_tree, hf_ieee80211_sched_info_agg, tvb, offset, 2, TRUE);
3751         if (tvb_get_letohs(tvb, offset) & 0x0001)
3752         {
3753           proto_tree_add_item(sched_tree, hf_ieee80211_sched_info_tsid, tvb, offset, 2, TRUE);
3754           proto_tree_add_item(sched_tree, hf_ieee80211_sched_info_dir, tvb, offset, 2, TRUE);
3755         }
3756
3757         length += 2;
3758         break;
3759       }
3760
3761     case FIELD_PA_ACTION_CODE:
3762         proto_tree_add_item(tree, hf_ieee80211_ff_public_action, tvb, offset, 1, FALSE);
3763         length += 1;
3764         break;
3765
3766     case FIELD_ACTION:
3767       {
3768         proto_item *action_item;
3769         proto_tree *action_tree;
3770
3771         action_item = proto_tree_add_item(tree, hf_ieee80211_action, tvb, offset, 1, TRUE);
3772         action_tree = proto_item_add_subtree(action_item, ett_sched_tree);
3773
3774         switch (tvb_get_guint8(tvb, offset) & 0x7f)
3775           {
3776             case CAT_SPECTRUM_MGMT:
3777               {
3778                 switch (tvb_get_guint8(tvb, offset+1))
3779                   {
3780                     case SM_ACTION_MEASUREMENT_REQUEST:
3781                     case SM_ACTION_MEASUREMENT_REPORT:
3782                     case SM_ACTION_TPC_REQUEST:
3783                     case SM_ACTION_TPC_REPORT:
3784                       add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3785                       add_fixed_field(action_tree, tvb, offset+1, FIELD_ACTION_CODE);
3786                       add_fixed_field(action_tree, tvb, offset+2, FIELD_DIALOG_TOKEN);
3787                       length += 3;  /* Size of fixed fields */
3788                       break;
3789
3790                     case SM_ACTION_CHAN_SWITCH_ANNC:
3791                     case SM_ACTION_EXT_CHAN_SWITCH_ANNC:
3792                       add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3793                       add_fixed_field(action_tree, tvb, offset+1, FIELD_ACTION_CODE);
3794                       length += 2;  /* Size of fixed fields */
3795                       break;
3796
3797                     default:
3798                       add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3799                       add_fixed_field(action_tree, tvb, offset+1, FIELD_ACTION_CODE);
3800                       length += 2;  /* Size of fixed fields */
3801                       break;
3802                   }
3803                 break;
3804               }
3805
3806             case CAT_QOS:
3807               {
3808                 switch (tvb_get_guint8(tvb, offset+1))
3809                   {
3810                     case SM_ACTION_ADDTS_REQUEST:
3811                       add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3812                       add_fixed_field(action_tree, tvb, offset+1, FIELD_QOS_ACTION_CODE);
3813                       add_fixed_field(action_tree, tvb, offset+2, FIELD_DIALOG_TOKEN);
3814                       length += 3;
3815                       break;
3816
3817                     case SM_ACTION_ADDTS_RESPONSE:
3818                       add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3819                       add_fixed_field(action_tree, tvb, offset+1, FIELD_QOS_ACTION_CODE);
3820                       add_fixed_field(action_tree, tvb, offset+2, FIELD_DIALOG_TOKEN);
3821                       add_fixed_field(action_tree, tvb, offset+3, FIELD_STATUS_CODE);
3822                       length += 5;
3823                       break;
3824
3825                     case SM_ACTION_DELTS:
3826                       add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3827                       add_fixed_field(action_tree, tvb, offset+1, FIELD_QOS_ACTION_CODE);
3828                       add_fixed_field(action_tree, tvb, offset+2, FIELD_QOS_TS_INFO);
3829                       add_fixed_field(action_tree, tvb, offset+5, FIELD_REASON_CODE);
3830                       length += 7;
3831                       break;
3832
3833                     case SM_ACTION_QOS_SCHEDULE:
3834                       add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3835                       add_fixed_field(action_tree, tvb, offset+1, FIELD_QOS_ACTION_CODE);
3836                       length += 2;
3837                       break;
3838
3839                     default:
3840                       add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3841                       length += 2;  /* Size of fixed fields */
3842                       break;
3843                   }
3844                 break;
3845               }
3846
3847             case CAT_DLS:
3848               {
3849                 switch (tvb_get_guint8(tvb, offset+1))
3850                   {
3851                     case SM_ACTION_DLS_REQUEST:
3852                       add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3853                       add_fixed_field(action_tree, tvb, offset+1, FIELD_DLS_ACTION_CODE);
3854                       add_fixed_field(action_tree, tvb, offset+2, FIELD_DST_MAC_ADDR);
3855                       add_fixed_field(action_tree, tvb, offset+8, FIELD_SRC_MAC_ADDR);
3856                       add_fixed_field(action_tree, tvb, offset+14, FIELD_CAP_INFO);
3857                       add_fixed_field(action_tree, tvb, offset+16, FIELD_DLS_TIMEOUT);
3858                       length += 18;
3859                       break;
3860
3861                     case SM_ACTION_DLS_RESPONSE:
3862                       add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3863                       add_fixed_field(action_tree, tvb, offset+1, FIELD_DLS_ACTION_CODE);
3864                       add_fixed_field(action_tree, tvb, offset+2, FIELD_STATUS_CODE);
3865                       add_fixed_field(action_tree, tvb, offset+4, FIELD_DST_MAC_ADDR);
3866                       add_fixed_field(action_tree, tvb, offset+10, FIELD_SRC_MAC_ADDR);
3867                       length += 16;
3868                       if (!hf_ieee80211_ff_status_code)
3869                         add_fixed_field(action_tree, tvb, offset+16, FIELD_CAP_INFO);
3870                       break;
3871
3872                     case SM_ACTION_DLS_TEARDOWN:
3873                       add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3874                       add_fixed_field(action_tree, tvb, offset+1, FIELD_DLS_ACTION_CODE);
3875                       add_fixed_field(action_tree, tvb, offset+2, FIELD_DST_MAC_ADDR);
3876                       add_fixed_field(action_tree, tvb, offset+8, FIELD_SRC_MAC_ADDR);
3877                       add_fixed_field(action_tree, tvb, offset+14, FIELD_REASON_CODE);
3878                       length += 16;
3879                       break;
3880
3881                     default:
3882                       add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3883                       length += 2;  /* Size of fixed fields */
3884                       break;
3885                   }
3886                 break;
3887               }
3888
3889             case CAT_BLOCK_ACK:
3890               {
3891                 switch (tvb_get_guint8(tvb, offset+1))
3892                   {
3893                     case BA_ADD_BLOCK_ACK_REQUEST:
3894                       {
3895                         guint start = offset;
3896
3897                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3898                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_BLOCK_ACK_ACTION_CODE);
3899                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
3900                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_BLOCK_ACK_PARAM);
3901                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_BLOCK_ACK_TIMEOUT);
3902                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
3903                         length = offset - start;  /* Size of fixed fields */
3904                         break;
3905                       }
3906                     case BA_ADD_BLOCK_ACK_RESPONSE:
3907                       {
3908                         guint start = offset;
3909
3910                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3911                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_BLOCK_ACK_ACTION_CODE);
3912                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
3913                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_STATUS_CODE);
3914                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_BLOCK_ACK_PARAM);
3915                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_BLOCK_ACK_TIMEOUT);
3916                         length = offset - start;  /* Size of fixed fields */
3917                         break;
3918                       }
3919                     case BA_DELETE_BLOCK_ACK:
3920                       {
3921                         guint start = offset;
3922
3923                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3924                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_BLOCK_ACK_ACTION_CODE);
3925                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_DELBA_PARAM_SET);
3926                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_REASON_CODE);
3927                         length = offset - start;  /* Size of fixed fields */
3928                         break;
3929                       }
3930                   }
3931                 break;
3932               }
3933
3934             case CAT_PUBLIC:
3935               {
3936                 guint start = offset;
3937                 guint32 oui;
3938                 const guint8 *tag_data_ptr;
3939                 guint8 code;
3940                 guint8 subtype;
3941
3942                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
3943                 code = tvb_get_guint8(tvb, offset);
3944                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_PA_ACTION_CODE);
3945
3946                 switch (code)
3947                   {
3948                     case PA_VENDOR_SPECIFIC:
3949                       oui = tvb_get_ntoh24(tvb, offset);
3950                       tag_data_ptr = tvb_get_ptr(tvb, offset, 3);
3951                       proto_tree_add_bytes_format(action_tree, hf_ieee80211_tag_oui, tvb, offset, 3,
3952                                                   tag_data_ptr, "Vendor: %s", get_manuf_name(tag_data_ptr));
3953                       offset += 3;
3954                       switch (oui)
3955                       {
3956                       case OUI_WFA:
3957                         subtype = tvb_get_guint8(tvb, offset);
3958                         proto_tree_add_text(action_tree, tvb, offset, 1,
3959                                             "Subtype %u", subtype);
3960                         offset++;
3961                         if (subtype == WFA_SUBTYPE_P2P)
3962                           offset = dissect_wifi_p2p_public_action(action_tree, tvb, offset);
3963                         break;
3964                       default:
3965                         /* Don't know how to handle this vendor */
3966                         break;
3967                       }
3968                       break;
3969                     case PA_GAS_INITIAL_REQUEST:
3970                     {
3971                       gboolean anqp;
3972                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
3973                       offset += dissect_advertisement_protocol(g_pinfo, action_tree, tvb, offset, &anqp);
3974                       offset += dissect_gas_initial_request(action_tree, tvb, offset, anqp);
3975                       break;
3976                     }
3977                     case PA_GAS_INITIAL_RESPONSE:
3978                     {
3979                       gboolean anqp;
3980                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
3981                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_STATUS_CODE);
3982                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_GAS_COMEBACK_DELAY);
3983                       offset += dissect_advertisement_protocol(g_pinfo, action_tree, tvb, offset, &anqp);
3984                       offset += dissect_gas_initial_response(action_tree, tvb, offset, anqp);
3985                       break;
3986                     }
3987                     case PA_GAS_COMEBACK_REQUEST:
3988                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
3989                       break;
3990                     case PA_GAS_COMEBACK_RESPONSE:
3991                     {
3992                       gboolean anqp;
3993                       guint8 frag;
3994                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
3995                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_STATUS_CODE);
3996                       frag = tvb_get_guint8(tvb, offset) & 0x7f;
3997                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_GAS_FRAGMENT_ID);
3998                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_GAS_COMEBACK_DELAY);
3999                       offset += dissect_advertisement_protocol(g_pinfo, action_tree, tvb, offset, &anqp);
4000                       offset += dissect_gas_comeback_response(action_tree, tvb, offset, anqp, frag);
4001                       break;
4002                     }
4003                     case PA_TDLS_DISCOVERY_RESPONSE:
4004                       col_set_str(g_pinfo->cinfo, COL_PROTOCOL, "TDLS");
4005                       col_set_str(g_pinfo->cinfo, COL_INFO, "TDLS Discovery Response");
4006                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
4007                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_CAP_INFO);
4008                       break;
4009                   }
4010                 length += offset - start;  /* Size of fixed fields */
4011                 break;
4012               }
4013
4014             case CAT_FAST_BSS_TRANSITION:
4015               {
4016                 guint start = offset;
4017                 guint8 code;
4018                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4019                 code = tvb_get_guint8(tvb, offset);
4020                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_FT_ACTION_CODE);
4021
4022                 switch (code) {
4023                 case FT_ACTION_REQUEST:
4024                   offset += add_fixed_field(action_tree, tvb, offset, FIELD_STA_ADDRESS);
4025                   offset += add_fixed_field(action_tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
4026                   /* Followed by FT Request frame body (IEs) */
4027                   break;
4028                 case FT_ACTION_RESPONSE:
4029                   offset += add_fixed_field(action_tree, tvb, offset, FIELD_STA_ADDRESS);
4030                   offset += add_fixed_field(action_tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
4031                   offset += add_fixed_field(action_tree, tvb, offset, FIELD_STATUS_CODE);
4032                   /* Followed by FT Response frame body (IEs) */
4033                   break;
4034                 case FT_ACTION_CONFIRM:
4035                   offset += add_fixed_field(action_tree, tvb, offset, FIELD_STA_ADDRESS);
4036                   offset += add_fixed_field(action_tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
4037                   /* Followed by FT Confirm frame body (IEs) */
4038                   break;
4039                 case FT_ACTION_ACK:
4040                   offset += add_fixed_field(action_tree, tvb, offset, FIELD_STA_ADDRESS);
4041                   offset += add_fixed_field(action_tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
4042                   offset += add_fixed_field(action_tree, tvb, offset, FIELD_STATUS_CODE);
4043                   /* Followed by FT Ack frame body (IEs) */
4044                   break;
4045                 }
4046
4047                 length += offset - start;  /* Size of fixed fields */
4048                 break;
4049               }
4050
4051             case CAT_SA_QUERY:
4052               {
4053                 guint start = offset;
4054                 guint8 code;
4055                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4056                 code = tvb_get_guint8(tvb, offset);
4057                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_SA_QUERY_ACTION_CODE);
4058
4059                 switch (code) {
4060                 case SA_QUERY_REQUEST:
4061                   offset += add_fixed_field(action_tree, tvb, offset, FIELD_TRANSACTION_ID);
4062                   break;
4063                 case SA_QUERY_RESPONSE:
4064                   offset += add_fixed_field(action_tree, tvb, offset, FIELD_TRANSACTION_ID);
4065                   break;
4066                 }
4067
4068                 length += offset - start;  /* Size of fixed fields */
4069                 break;
4070               }
4071
4072 #ifdef MESH_OVERRIDES
4073             case CAT_MESH_PEER_LINK:
4074               /* Non-IE fixed fields here.  edit TAG_MESH_* for IE fields */
4075               switch (tvb_get_guint8(tvb, 1))
4076                 {
4077                 guint offset;
4078                 case MESH_PL_PEER_LINK_OPEN:
4079                   offset = 0;
4080                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4081                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_MESH_MGT_ACTION_PL_CODE);
4082                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_CAP_INFO);
4083                   length = offset;
4084                   break;
4085
4086                 case MESH_PL_PEER_LINK_CONFIRM:
4087                   offset = 0;
4088                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4089                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_MESH_MGT_ACTION_PL_CODE);
4090                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_CAP_INFO);
4091                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_STATUS_CODE);
4092                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_ASSOC_ID);
4093                   length = offset;
4094                   break;
4095
4096                 case MESH_PL_PEER_LINK_CLOSE:
4097                   offset = 0;
4098                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4099                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_MESH_MGT_ACTION_PL_CODE);
4100                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_REASON_CODE);
4101                   length = offset;   /* Size of fixed fields */
4102                   break;
4103
4104                 default:
4105                   offset = 0;
4106                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4107                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_MESH_MGT_ACTION_PL_CODE);
4108                   length = offset;   /* Size of fixed fields */
4109                   break;
4110                 }
4111               break;
4112
4113             case CAT_MESH_PATH_SELECTION:
4114               switch (tvb_get_guint8(tvb, 1))
4115                 {
4116                 guint offset;
4117                 /* defined values */
4118                 case MESH_PS_PATH_REQUEST:
4119                   offset = 0;
4120                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4121                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_MESH_MGT_ACTION_PS_CODE);
4122                   length = offset;
4123                   break;
4124
4125                 case MESH_PS_PATH_REPLY:
4126                   offset = 0;
4127                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4128                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_MESH_MGT_ACTION_PS_CODE);
4129                   length = offset;
4130                   break;
4131
4132                 case MESH_PS_PATH_ERROR:
4133                   offset = 0;
4134                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4135                   offset += add_fixed_field (action_tree, tvb, offset, FIELD_MESH_MGT_ACTION_PS_CODE);
4136                   length = offset;
4137                   break;
4138
4139                 case MESH_PS_ROOT_ANNOUNCEMENT:
4140                   offset = 0;
4141                   offset += add_fixed_field (action_tree, tvb, 0, FIELD_CATEGORY_CODE);
4142                   offset += add_fixed_field (action_tree, tvb, 1, FIELD_MESH_MGT_ACTION_PS_CODE);
4143                   length = offset;
4144                   break;
4145
4146                 /* undefined values */
4147                 default:
4148                   offset = 0;
4149                   offset += add_fixed_field (action_tree, tvb, 0, FIELD_CATEGORY_CODE);
4150                   offset += add_fixed_field (action_tree, tvb, 1, FIELD_MESH_MGT_ACTION_PS_CODE);
4151                   length = offset;
4152                   break;
4153                 }
4154               break;
4155 #endif /* MESH_OVERRIDES */
4156
4157           case CAT_TDLS:
4158           {
4159             guint8 code;
4160             guint16 status;
4161             guint start = offset;
4162
4163             offset += add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4164             code = tvb_get_guint8(tvb, offset);
4165             offset += add_fixed_field(action_tree, tvb, offset, FIELD_TDLS_ACTION_CODE);
4166             switch (code) {
4167             case TDLS_SETUP_REQUEST:
4168               offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
4169               offset += add_fixed_field(action_tree, tvb, offset, FIELD_CAP_INFO);
4170               break;
4171             case TDLS_SETUP_RESPONSE:
4172               status = tvb_get_letohs(tvb, offset);
4173               offset += add_fixed_field(action_tree, tvb, offset, FIELD_STATUS_CODE);
4174               offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
4175               if (tvb_reported_length_remaining(tvb, offset) < 2) {
4176                 if (status == 0) {
4177                   expert_add_info_format(g_pinfo, action_item, PI_MALFORMED, PI_ERROR, "TDLS Setup Response (success) does not include mandatory fields");
4178                 }
4179                 break;
4180               }
4181               offset += add_fixed_field(action_tree, tvb, offset, FIELD_CAP_INFO);
4182               break;
4183             case TDLS_SETUP_CONFIRM:
4184               status = tvb_get_letohs(tvb, offset);
4185               offset += add_fixed_field(action_tree, tvb, offset, FIELD_STATUS_CODE);
4186               if (tvb_reported_length_remaining(tvb, offset) < 1) {
4187                 if (status == 0) {
4188                   expert_add_info_format(g_pinfo, action_item, PI_MALFORMED, PI_ERROR, "TDLS Setup Confirm (success) does not include mandatory fields");
4189                 }
4190                 break;
4191               }
4192               offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
4193               break;
4194             case TDLS_TEARDOWN:
4195               offset += add_fixed_field(action_tree, tvb, offset, FIELD_REASON_CODE);
4196               break;
4197             case TDLS_PEER_TRAFFIC_INDICATION:
4198               offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
4199               break;
4200             case TDLS_CHANNEL_SWITCH_REQUEST:
4201               offset += add_fixed_field(action_tree, tvb, offset, FIELD_TARGET_CHANNEL);
4202               offset += add_fixed_field(action_tree, tvb, offset, FIELD_REGULATORY_CLASS);
4203               break;
4204             case TDLS_CHANNEL_SWITCH_RESPONSE:
4205               offset += add_fixed_field(action_tree, tvb, offset, FIELD_STATUS_CODE);
4206               break;
4207             case TDLS_PEER_PSM_REQUEST:
4208               offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
4209               break;
4210             case TDLS_PEER_PSM_RESPONSE:
4211               offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
4212               offset += add_fixed_field(action_tree, tvb, offset, FIELD_STATUS_CODE);
4213               break;
4214             case TDLS_PEER_TRAFFIC_RESPONSE:
4215               offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
4216               break;
4217             case TDLS_DISCOVERY_REQUEST:
4218               offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
4219               break;
4220             }
4221
4222             length = offset - start;  /* Size of fixed fields */
4223             break;
4224           }
4225
4226             case CAT_MGMT_NOTIFICATION:  /* Management notification frame */
4227               {
4228                 guint start = offset;
4229
4230                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4231                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_WME_ACTION_CODE);
4232                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_DIALOG_TOKEN);
4233                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_WME_STATUS_CODE);
4234                 length = offset - start;  /* Size of fixed fields */
4235                 break;
4236               }
4237
4238             case CAT_VENDOR_SPECIFIC:  /* Vendor Specific Category */
4239               {
4240                 guint start = offset;
4241                 guint32 oui;
4242                 const guint8 *tag_data_ptr;
4243                 guint8 subtype;
4244
4245                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4246                 oui = tvb_get_ntoh24(tvb, offset);
4247                 tag_data_ptr = tvb_get_ptr(tvb, offset, 3);
4248                 proto_tree_add_bytes_format (action_tree, hf_ieee80211_tag_oui, tvb, offset, 3,
4249                                              tag_data_ptr, "Vendor: %s", get_manuf_name(tag_data_ptr));
4250                 offset += 3;
4251                 switch (oui)
4252                   {
4253                     case OUI_MARVELL:
4254                       offset = dissect_vendor_action_marvell(action_tree, tvb, offset);
4255                       break;
4256                     case OUI_WFA:
4257                       subtype = tvb_get_guint8(tvb, offset);
4258                       proto_tree_add_text(action_tree, tvb, offset, 1,
4259                                           "Subtype %u", subtype);
4260                       offset++;
4261                       if (subtype == WFA_SUBTYPE_P2P)
4262                         offset = dissect_wifi_p2p_action(action_tree, tvb,
4263                                                          offset);
4264                       break;
4265                     default:
4266                       /* Don't know how to handle this vendor */
4267                       break;
4268                   }/* switch(oui) */
4269                 length = offset - start;  /* Size of fixed fields */
4270                 break;
4271               }/* Case vendor specific */
4272
4273             case CAT_HT:
4274               {
4275                 guint start = 0;
4276                 start = offset;
4277
4278                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4279                 offset += add_fixed_field(action_tree, tvb, offset, FIELD_HT_ACTION_CODE);
4280                 switch (tvb_get_guint8(tvb, offset-1))
4281                   {
4282                     case HT_ACTION_NOTIFY_CHAN_WIDTH:
4283                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_CHANNEL_WIDTH);
4284                       break;
4285
4286                     case HT_ACTION_SM_PWR_SAVE:
4287                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_SM_PWR_CNTRL);
4288                       break;
4289
4290                     case HT_ACTION_PSMP_ACTION:
4291                       {
4292                         guint8 n_sta, i;
4293
4294                         n_sta = tvb_get_guint8(tvb, offset);
4295                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_PSMP_PARAM_SET);
4296
4297                         for (i=0; i< (n_sta & 0x0F); i++)
4298                           offset += add_fixed_field(action_tree, tvb, offset, FIELD_PSMP_STA_INFO);
4299
4300                         break;
4301                       }
4302
4303                     case HT_ACTION_SET_PCO_PHASE:
4304                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_PCO_PHASE_CNTRL);
4305                       break;
4306
4307                     case HT_ACTION_MIMO_CSI:
4308                       {
4309                         mimo_control_t mimo_cntrl;
4310                         mimo_cntrl = get_mimo_control(tvb, offset);
4311                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_MIMO_CNTRL);
4312                         offset += add_mimo_csi_matrices_report(action_tree, tvb, offset, mimo_cntrl);
4313                         break;
4314                       }
4315
4316                     case HT_ACTION_MIMO_BEAMFORMING:
4317                       {
4318                         mimo_control_t mimo_cntrl;
4319                         mimo_cntrl = get_mimo_control(tvb, offset);
4320                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_MIMO_CNTRL);
4321                         offset += add_mimo_beamforming_feedback_report(action_tree, tvb, offset, mimo_cntrl);
4322                         break;
4323                       }
4324
4325                     case HT_ACTION_MIMO_COMPRESSED_BEAMFORMING:
4326                       {
4327                         mimo_control_t mimo_cntrl;
4328                         mimo_cntrl = get_mimo_control(tvb, offset);
4329                         offset += add_fixed_field(action_tree, tvb, offset, FIELD_MIMO_CNTRL);
4330                         offset += add_mimo_compressed_beamforming_feedback_report(action_tree, tvb, offset, mimo_cntrl);
4331                         break;
4332                       }
4333
4334                     case HT_ACTION_ANT_SEL_FEEDBACK:
4335                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_ANT_SELECTION);
4336                       break;
4337
4338                     case HT_ACTION_HT_INFO_EXCHANGE:
4339                       offset += add_fixed_field(action_tree, tvb, offset, FIELD_HT_INFORMATION);
4340                       break;
4341
4342                     default:
4343                       /* Unknown */
4344                       break;
4345                   }
4346                 length = offset - start;
4347                 break;
4348               }
4349
4350             default:
4351               add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
4352               length += 1;  /* Size of fixed fields */
4353               break;
4354           }
4355         break;
4356       }
4357
4358     case FIELD_FT_ACTION_CODE:
4359       proto_tree_add_item(tree, hf_ieee80211_ff_ft_action_code, tvb, offset, 1, FALSE);
4360       length += 1;
4361       break;
4362
4363     case FIELD_STA_ADDRESS:
4364       proto_tree_add_item(tree, hf_ieee80211_ff_sta_address, tvb, offset, 6, FALSE);
4365       length += 6;
4366       break;
4367
4368     case FIELD_TARGET_AP_ADDRESS:
4369       proto_tree_add_item(tree, hf_ieee80211_ff_target_ap_address, tvb, offset, 6, FALSE);
4370       length += 6;
4371       break;
4372
4373     case FIELD_GAS_COMEBACK_DELAY:
4374       proto_tree_add_item(tree, hf_ieee80211_ff_gas_comeback_delay, tvb, offset, 2, TRUE);
4375       length += 2;
4376       break;
4377
4378     case FIELD_GAS_FRAGMENT_ID:
4379       proto_tree_add_item(tree, hf_ieee80211_ff_gas_fragment_id, tvb, offset, 1, FALSE);
4380       proto_tree_add_item(tree, hf_ieee80211_ff_more_gas_fragments, tvb, offset, 1, FALSE);
4381       length += 1;
4382       break;
4383
4384     case FIELD_SA_QUERY_ACTION_CODE:
4385       proto_tree_add_item(tree, hf_ieee80211_ff_sa_query_action_code, tvb, offset, 1, FALSE);
4386       length += 1;
4387       break;
4388
4389     case FIELD_TRANSACTION_ID:
4390       proto_tree_add_item(tree, hf_ieee80211_ff_transaction_id, tvb, offset, 2, TRUE);
4391       length += 2;
4392       break;
4393
4394     case FIELD_TDLS_ACTION_CODE:
4395     {
4396       guint8 code;
4397       code = tvb_get_guint8(tvb, offset);
4398       col_set_str(g_pinfo->cinfo, COL_INFO, val_to_str_const(code, tdls_action_codes, "Unknown TDLS Action"));
4399       proto_tree_add_item(tree, hf_ieee80211_ff_tdls_action_code, tvb, offset, 1, FALSE);
4400       length += 1;
4401       break;
4402     }
4403
4404     case FIELD_TARGET_CHANNEL:
4405       proto_tree_add_item(tree, hf_ieee80211_ff_target_channel, tvb, offset, 1,  FALSE);
4406       length += 1;
4407       break;
4408
4409     case FIELD_REGULATORY_CLASS:
4410       proto_tree_add_item(tree, hf_ieee80211_ff_regulatory_class, tvb, offset, 1, FALSE);
4411       length += 1;
4412       break;
4413   }
4414   return length;
4415 }
4416
4417 static const value_string wpa_cipher_vals[] =
4418 {
4419   {0, "NONE"},
4420   {1, "WEP (40-bit)"},
4421   {2, "TKIP"},
4422   {3, "AES (OCB)"},
4423   {4, "AES (CCM)"},
4424   {5, "WEP (104-bit)"},
4425   {6, "BIP"},
4426   {7, "Group addressed traffic not allowed"},
4427   {0, NULL}
4428 };
4429
4430 static const value_string ieee80211_rsn_cipher_vals[] =
4431 {
4432   {0, "NONE"},
4433   {1, "WEP (40-bit)"},
4434   {2, "TKIP"},
4435   {3, "AES (OCB)"},
4436   {4, "AES (CCM)"},
4437   {5, "WEP (104-bit)"},
4438   {6, "BIP"},
4439   {7, "Group addressed traffic not allowed"},
4440   {0, NULL}
4441 };
4442
4443 static const value_string ieee80211_rsn_keymgmt_vals[] =
4444 {
4445   {0, "NONE"},
4446   {1, "WPA"},
4447   {2, "PSK"},
4448   {3, "FT over IEEE 802.1X"},
4449   {4, "FT using PSK"},
4450   {5, "WPA (SHA256)"},
4451   {6, "PSK (SHA256)"},
4452   {7, "TDLS / TPK Handshake"},
4453   {0, NULL}
4454 };
4455
4456 static void
4457 oui_base_custom(gchar *result, guint32 oui)
4458 {
4459   guint8 p_oui[3];
4460   const gchar *manuf_name;
4461   p_oui[0] = oui >> 16 & 0xFF;
4462   p_oui[1] = oui >> 8 & 0xFF;
4463   p_oui[2] = oui & 0xFF;
4464
4465   /* Attempt an OUI lookup. */
4466   manuf_name = get_manuf_name_if_known(p_oui);
4467   if (manuf_name == NULL) {
4468       /* Could not find an OUI. */
4469       g_snprintf(result, ITEM_LABEL_LENGTH, "%.2x-%.2x-%.2x", p_oui[0], p_oui[1], p_oui[2] );
4470   }
4471   else {
4472       /* Found an address string. */
4473       g_snprintf(result, ITEM_LABEL_LENGTH, "%.2x-%.2x-%.2x (%s)", p_oui[0], p_oui[1], p_oui[2], manuf_name );
4474   }
4475 }
4476 static void
4477 rsn_gcs_base_custom(gchar *result, guint32 gcs)
4478 {
4479   gchar *oui_result=NULL;
4480   oui_result = ep_alloc(SHORT_STR);
4481   oui_result[0] = '\0';
4482   oui_base_custom(oui_result, gcs >>8);
4483   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( gcs & 0xFF, ieee80211_rsn_cipher_vals, "Unknown %d") );
4484 }
4485
4486 static void
4487 rsn_pcs_base_custom(gchar *result, guint32 pcs)
4488 {
4489   gchar *oui_result=NULL;
4490   oui_result = ep_alloc(SHORT_STR);
4491   oui_result[0] = '\0';
4492   oui_base_custom(oui_result, pcs >>8);
4493   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( pcs & 0xFF, ieee80211_rsn_cipher_vals, "Unknown %d") );
4494
4495 }
4496 static void
4497 rsn_akms_base_custom(gchar *result, guint32 akms)
4498 {
4499   gchar *oui_result=NULL;
4500   oui_result = ep_alloc(SHORT_STR);
4501   oui_result[0] = '\0';
4502   oui_base_custom(oui_result, akms >>8);
4503   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( akms & 0xFF, ieee80211_rsn_keymgmt_vals, "Unknown %d") );
4504 }
4505
4506 static gchar *
4507 rsn_pcs_return(guint32 pcs)
4508 {
4509     gchar *result=NULL;
4510     result = ep_alloc(SHORT_STR);
4511     result[0] = '\0';
4512     rsn_pcs_base_custom(result, pcs);
4513
4514     return result;
4515 }
4516
4517 static gchar *
4518 rsn_akms_return(guint32 akms)
4519 {
4520     gchar *result=NULL;
4521     result = ep_alloc(SHORT_STR);
4522     result[0] = '\0';
4523     rsn_akms_base_custom(result, akms);
4524
4525     return result;
4526 }
4527
4528 static void
4529 rsn_gmcs_base_custom(gchar *result, guint32 gmcs)
4530 {
4531   gchar *oui_result=NULL;
4532   oui_result = ep_alloc(SHORT_STR);
4533   oui_result[0] = '\0';
4534   oui_base_custom(oui_result, gmcs >>8);
4535   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( gmcs & 0xFF, ieee80211_rsn_cipher_vals, "Unknown %d") );
4536 }
4537
4538 static const value_string wpa_keymgmt_vals[] =
4539 {
4540   {0, "NONE"},
4541   {1, "WPA"},
4542   {2, "PSK"},
4543   {3, "FT over IEEE 802.1X"},
4544   {4, "FT using PSK"},
4545   {5, "WPA (SHA256)"},
4546   {6, "PSK (SHA256)"},
4547   {7, "TDLS / TPK Handshake"},
4548   {0, NULL}
4549 };
4550
4551 static const value_string ft_subelem_id_vals[] =
4552 {
4553   {0, "Reserved"},
4554   {1, "PMK-R1 key holder identifier (R1KH-ID)"},
4555   {2, "GTK subelement"},
4556   {3, "PMK-R0 key holder identifier (R0KH-ID)"},
4557   {4, "IGTK"},
4558   {0, NULL}
4559 };
4560
4561 static const value_string anqp_info_id_vals[] =
4562 {
4563   {256, "ANQP Query list"},
4564   {257, "ANQP Capability list"},
4565   {258, "Venue Name information"},
4566   {259, "Emergency Call Number information"},
4567   {260, "Network Authentication Type information"},
4568   {261, "Roaming Consortium list"},
4569   {262, "IP Address Type Availability information"},
4570   {263, "NAI Realm list"},
4571   {264, "3GPP Cellular Network information"},
4572   {265, "AP Geospatial Location"},
4573   {266, "AP Civic Location"},
4574   {267, "AP Location Public Identifier URI"},
4575   {268, "Domain Name list"},
4576   {269, "Emergency Alert Identifier URI"},
4577   {270, "TDLS Discovery"},
4578   {56797, "ANQP vendor-specific list"},
4579   {0, NULL}
4580 };
4581
4582
4583 static void
4584 dissect_vendor_ie_wpawme(proto_item * item, proto_tree * tree, tvbuff_t * tag_tvb)
4585 {
4586   gint tag_off = 0;
4587   gint tag_len = tvb_length(tag_tvb);
4588   gchar out_buff[SHORT_STR];
4589   guint i, byte1, byte2;
4590
4591   /* Wi-Fi Protected Access (WPA) Information Element */
4592   if (tag_off + 6 <= tag_len && !tvb_memeql(tag_tvb, tag_off, WPA_OUI"\x01", 4)) {
4593     g_snprintf(out_buff, SHORT_STR, "WPA IE, type %u, version %u",
4594       tvb_get_guint8(tag_tvb, tag_off + 3), tvb_get_letohs(tag_tvb, tag_off + 4));
4595     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 6, out_buff);
4596     tag_off += 6;
4597     if (tag_off + 4 <= tag_len) {
4598       /* multicast cipher suite */
4599       if (!tvb_memeql(tag_tvb, tag_off, WPA_OUI, 3)) {
4600         g_snprintf(out_buff, SHORT_STR, "Multicast cipher suite: %s",
4601           val_to_str(tvb_get_guint8(tag_tvb, tag_off + 3), wpa_cipher_vals,
4602             "UNKNOWN"));
4603         proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 4,
4604           out_buff);
4605         tag_off += 4;
4606         /* unicast cipher suites */
4607         if (tag_off + 2 <= tag_len) {
4608           g_snprintf(out_buff, SHORT_STR,
4609             "# of unicast cipher suites: %u", tvb_get_letohs(tag_tvb, tag_off));
4610           proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 2,
4611             out_buff);
4612           tag_off += 2;
4613           i = 1;
4614           while (tag_off + 4 <= tag_len) {
4615             if (!tvb_memeql(tag_tvb, tag_off, WPA_OUI, 3)) {
4616               g_snprintf(out_buff, SHORT_STR,
4617                 "Unicast cipher suite %u: %s", i,
4618                 val_to_str(tvb_get_guint8(tag_tvb, tag_off + 3),
4619                   wpa_cipher_vals, "UNKNOWN"));
4620               proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 4,
4621                 out_buff);
4622               tag_off += 4;
4623               i ++;
4624             }
4625             else
4626               break;
4627           }
4628           /* authenticated key management suites */
4629           if (tag_off + 2 <= tag_len) {
4630             g_snprintf(out_buff, SHORT_STR,
4631               "# of auth key management suites: %u", tvb_get_letohs(tag_tvb, tag_off));
4632             proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 2,
4633               out_buff);
4634             tag_off += 2;
4635             i = 1;
4636             while (tag_off + 4 <= tag_len) {
4637               if (!tvb_memeql(tag_tvb, tag_off, WPA_OUI, 3)) {
4638                 g_snprintf(out_buff, SHORT_STR,
4639                   "auth key management suite %u: %s", i,
4640                   val_to_str(tvb_get_guint8(tag_tvb, tag_off + 3),
4641                     wpa_keymgmt_vals, "UNKNOWN"));
4642                 proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 4,
4643                   out_buff);
4644                 tag_off += 4;
4645                 i ++;
4646               }
4647               else
4648                 break;
4649             }
4650           }
4651         }
4652       }
4653     }
4654     if (tag_off < tag_len)
4655       proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb,
4656         tag_off, tag_len - tag_off, "Not interpreted");
4657       proto_item_append_text(item, ": WPA");
4658   } else if (tag_off + 7 <= tag_len && !tvb_memeql(tag_tvb, tag_off, WME_OUI"\x02\x00", 5)) {
4659     /* Wireless Multimedia Enhancements (WME) Information Element */
4660     g_snprintf(out_buff, SHORT_STR,
4661       "WME IE: type %u, subtype %u, version %u, parameter set %u",
4662       tvb_get_guint8(tag_tvb, tag_off+3), tvb_get_guint8(tag_tvb, tag_off+4),
4663       tvb_get_guint8(tag_tvb, tag_off+5), tvb_get_guint8(tag_tvb, tag_off+6));
4664     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 7,
4665       out_buff);
4666     proto_item_append_text(item, ": WME");
4667   } else if (tag_off + 24 <= tag_len && !tvb_memeql(tag_tvb, tag_off, WME_OUI"\x02\x01", 5)) {
4668     /* Wireless Multimedia Enhancements (WME) Parameter Element */
4669     g_snprintf(out_buff, SHORT_STR,
4670       "WME PE: type %u, subtype %u, version %u, parameter set %u",
4671       tvb_get_guint8(tag_tvb, tag_off+3), tvb_get_guint8(tag_tvb, tag_off+4),
4672       tvb_get_guint8(tag_tvb, tag_off+5), tvb_get_guint8(tag_tvb, tag_off+6));
4673     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 7,
4674       out_buff);
4675     tag_off += 8;
4676     for (i = 0; i < 4; i++) {
4677       byte1 = tvb_get_guint8(tag_tvb, tag_off);
4678       byte2 = tvb_get_guint8(tag_tvb, tag_off + 1);
4679       g_snprintf(out_buff, SHORT_STR,
4680         "WME AC Parameters: ACI %u (%s), Admission Control %sMandatory, AIFSN %u, ECWmin %u, ECWmax %u, TXOP %u",
4681          (byte1 & 0x60) >> 5, match_strval((byte1 & 0x60) >> 5, wme_acs),
4682          (byte1 & 0x10) ? "" : "not ", byte1 & 0x0f,
4683          byte2 & 0x0f, (byte2 & 0xf0) >> 4,
4684          tvb_get_letohs(tag_tvb, tag_off + 2));
4685       proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 4,
4686         out_buff);
4687       tag_off += 4;
4688     }
4689     proto_item_append_text(item, ": WME");
4690   } else if (tag_off + 56 <= tag_len && !tvb_memeql(tag_tvb, tag_off, WME_OUI"\x02\x02", 5)) {
4691     /* Wireless Multimedia Enhancements (WME) TSPEC Element */
4692     guint16 ts_info, msdu_size, surplus_bandwidth;
4693     const char *direction[] = { "Uplink", "Downlink", "Reserved", "Bi-directional" };
4694     const value_string fields[] = {
4695       {13, "Minimum Service Interval"},
4696       {17, "Maximum Service Interval"},
4697       {21, "Inactivity Interval"},
4698       {25, "Suspension Interval"},
4699       {29, "Service Start Time"},
4700       {33, "Minimum Data Rate"},
4701       {37, "Mean Data Rate"},
4702       {41, "Peak Data Rate"},
4703       {45, "Maximum Burst Size"},
4704       {49, "Delay Bound"},
4705       {53, "Minimum PHY Rate"},
4706       {0, NULL}
4707     };
4708     const char *field;
4709
4710     g_snprintf(out_buff, SHORT_STR,
4711       "WME TSPEC: type %u, subtype %u, version %u",
4712       tvb_get_guint8(tag_tvb, tag_off+3), tvb_get_guint8(tag_tvb, tag_off+4),
4713       tvb_get_guint8(tag_tvb, tag_off+5));
4714     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 6,
4715       out_buff);
4716     tag_off += 6;
4717
4718     ts_info = tvb_get_letohs(tag_tvb, tag_off);
4719     byte1 = (ts_info >> 11) & 0x7;
4720     g_snprintf(out_buff, SHORT_STR,
4721       "WME TS Info: Priority %u (%s) (%s), Contention-based access %sset, %s",
4722       byte1, qos_tags[byte1], qos_acs[byte1],
4723       (ts_info & 0x0080) ? "" : "not ",
4724       direction[(ts_info >> 5) & 0x3]);
4725     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 3,
4726       out_buff);
4727     tag_off += 3;
4728
4729     msdu_size = tvb_get_letohs(tag_tvb, tag_off);
4730     g_snprintf(out_buff, SHORT_STR,
4731       "WME TSPEC: %s MSDU Size %u",
4732       (msdu_size & 0x8000) ? "Fixed" : "Nominal", msdu_size & 0x7fff);
4733     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 2,
4734       out_buff);
4735     tag_off += 2;
4736
4737     g_snprintf(out_buff, SHORT_STR,
4738       "WME TSPEC: Maximum MSDU Size %u", tvb_get_letohs(tag_tvb, tag_off));
4739     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 2,
4740       out_buff);
4741     tag_off += 2;
4742
4743     while ((field = val_to_str(tag_off, fields, "Unknown"))) {
4744       g_snprintf(out_buff, SHORT_STR,
4745         "WME TSPEC: %s %u", field, tvb_get_letohl(tag_tvb, tag_off));
4746       proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 4,
4747         out_buff);
4748       tag_off += 4;
4749       if (tag_off == 57)
4750         break;
4751     }
4752
4753     surplus_bandwidth = tvb_get_letohs(tag_tvb, tag_off);
4754     g_snprintf(out_buff, SHORT_STR,
4755       "WME TSPEC: Surplus Bandwidth Allowance Factor %u.%u",
4756       (surplus_bandwidth >> 13) & 0x7, (surplus_bandwidth & 0x1fff));
4757     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 2,
4758       out_buff);
4759     tag_off += 2;
4760
4761     g_snprintf(out_buff, SHORT_STR,
4762       "WME TSPEC: Medium Time %u", tvb_get_letohs(tag_tvb, tag_off));
4763     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, tag_off, 2,
4764       out_buff);
4765     tag_off += 2;
4766     proto_item_append_text(item, ": WME");
4767   } else if (tag_off + 6 <= tag_len && !tvb_memeql(tag_tvb, tag_off, WPA_OUI"\x04", 4)) {
4768     dissect_wps_tlvs(item, tag_tvb, tag_off+4, tag_len-4, NULL);
4769     proto_item_append_text(item, ": WPS");
4770   }
4771 }
4772
4773 static void
4774 dissect_vendor_ie_wfa(packet_info *pinfo, proto_item *item, tvbuff_t *tag_tvb)
4775 {
4776   gint tag_len = tvb_length(tag_tvb);
4777
4778   if (tag_len < 4)
4779     return;
4780
4781   switch (tvb_get_guint8(tag_tvb, 3)) {
4782   case WFA_SUBTYPE_P2P:
4783     dissect_wifi_p2p_ie(pinfo, item, tag_tvb, 4, tag_len - 4);
4784     proto_item_append_text(item, ": P2P");
4785     break;
4786   }
4787 }
4788
4789 static void
4790 dissect_vendor_ie_rsn(proto_item * item, proto_tree * tree, tvbuff_t * tag_tvb)
4791 {
4792   guint tag_off = 0;
4793   guint tag_len = tvb_length(tag_tvb);
4794   guint pmkid_len = tag_len - 4;
4795   char out_buff[SHORT_STR], valid_str[SHORT_STR] = "";
4796
4797   if (tag_len >= 4 && !tvb_memeql(tag_tvb, tag_off, RSN_OUI"\x04", 4)) {
4798     /* IEEE 802.11i / Key Data Encapsulation / Data Type=4 - PMKID.
4799      * This is only used within EAPOL-Key frame Key Data. */
4800     if (pmkid_len != PMKID_LEN) {
4801       g_snprintf(valid_str, SHORT_STR,
4802         "(invalid PMKID len=%d, expected 16) ", pmkid_len);
4803     }
4804     g_snprintf(out_buff, SHORT_STR, "RSN PMKID: %s%s", valid_str,
4805       tvb_bytes_to_str(tag_tvb, 4, pmkid_len));
4806     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 0,
4807       tag_len, out_buff);
4808   }
4809   proto_item_append_text(item, ": RSN");
4810 }
4811
4812 typedef enum {
4813   MARVELL_IE_MESH = 4
4814 } marvell_ie_type_t;
4815
4816 static void
4817 dissect_vendor_ie_marvell(proto_item * item _U_, proto_tree * ietree,
4818                           tvbuff_t * tvb, int offset, guint32 tag_len)
4819 {
4820   guint8 type;
4821
4822   type = tvb_get_guint8(tvb, offset);
4823   proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_type, tvb, offset, 1, TRUE);
4824   offset += 1;
4825
4826   switch (type) {
4827   case MARVELL_IE_MESH:
4828     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_subtype, tvb,
4829                          offset++, 1, TRUE );
4830     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_version, tvb,
4831                          offset++, 1, TRUE );
4832     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_active_proto_id, tvb,
4833                          offset++, 1, TRUE );
4834     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_active_metric_id, tvb,
4835                          offset++, 1, TRUE );
4836     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_cap, tvb,
4837                          offset++, 1, TRUE );
4838     break;
4839
4840   default:
4841     proto_tree_add_item(ietree, hf_ieee80211_marvell_ie_data, tvb, offset,
4842       tag_len - 1, FALSE);
4843     break;
4844   }
4845 }
4846
4847 typedef enum {
4848   ATHEROS_IE_ADVCAP = 1,
4849   ATHEROS_IE_XR = 3,
4850 } atheros_ie_type_t;
4851
4852 typedef enum {
4853   ATHEROS_IE_ADVCAP_S = 1,
4854 } atheros_ie_advcap_subtype_t;
4855
4856 typedef enum {
4857   ATHEROS_IE_XR_S = 1,
4858 } atheros_ie_xr_subtype_t;
4859
4860 typedef enum {
4861   ATHEROS_IE_CAP_TURBOP = 0x01,
4862   ATHEROS_IE_CAP_COMP = 0x02,
4863   ATHEROS_IE_CAP_FF = 0x04,
4864   ATHEROS_IE_CAP_XR = 0x08,
4865   ATHEROS_IE_CAP_AR = 0x10,
4866   ATHEROS_IE_CAP_BURST = 0x20,
4867   ATHEROS_IE_CAP_WME = 0x40,
4868   ATHEROS_IE_CAP_BOOST = 0x80
4869 } atheros_ie_cap_t;
4870
4871 static const value_string atheros_ie_type_vals[] = {
4872   { ATHEROS_IE_ADVCAP, "Advanced Capability"},
4873   { ATHEROS_IE_XR,     "eXtended Range"},
4874   { 0,                 NULL }
4875 };
4876
4877 static void
4878 dissect_vendor_ie_atheros_cap(proto_item * item _U_, tvbuff_t *tvb, int offset)
4879 {
4880   proto_tree *cap_tree;
4881
4882   cap_tree = proto_item_add_subtree(item, ett_ath_cap_tree);
4883
4884   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_turbop, tvb, offset, 1, ENC_NA);
4885   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_comp, tvb, offset, 1, ENC_NA);
4886   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_ff, tvb, offset, 1, ENC_NA);
4887   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_xr, tvb, offset, 1, ENC_NA);
4888   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_ar, tvb, offset, 1, ENC_NA);
4889   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_burst, tvb, offset, 1, ENC_NA);
4890   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_wme, tvb, offset, 1, ENC_NA);
4891   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_boost, tvb, offset, 1, ENC_NA);
4892
4893 }
4894
4895 static void
4896 dissect_vendor_ie_atheros(proto_item * item _U_, proto_tree * ietree,
4897                           tvbuff_t * tvb, int offset, guint tag_len,
4898                           packet_info * pinfo, int tag_end, proto_item *ti_len)
4899 {
4900   guint8 type;
4901   guint8 subtype;
4902   guint8 version;
4903   proto_item *cap_item;
4904   proto_item *ti;
4905
4906   if (tag_len <= 6) {
4907         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 6", tag_len);
4908         return;
4909   }
4910   proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_type, tvb, offset, 1, ENC_NA);
4911   type = tvb_get_guint8(tvb, offset);
4912   proto_item_append_text(item, ": %s", val_to_str(type, atheros_ie_type_vals, "Unknown"));
4913   offset += 1;
4914
4915   proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_subtype, tvb, offset, 1, ENC_NA);
4916   subtype = tvb_get_guint8(tvb, offset);
4917   offset += 1;
4918
4919   proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_version, tvb, offset, 1, ENC_NA);
4920   version = tvb_get_guint8(tvb, offset);
4921   offset += 1;
4922
4923   if(version == 0)
4924   {
4925     switch(type){
4926       case ATHEROS_IE_ADVCAP:
4927       {
4928         switch(subtype){
4929           case ATHEROS_IE_ADVCAP_S:
4930           {
4931             cap_item = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_advcap_cap, tvb, offset, 1, ENC_NA);
4932             dissect_vendor_ie_atheros_cap(cap_item, tvb, offset);
4933             offset += 1;
4934
4935             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_advcap_defkey, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4936             offset += 2;
4937             break;
4938           }
4939           default:
4940           /* No default Action */
4941           break;
4942         } /* End switch(subtype) */
4943         break;
4944       }
4945       case ATHEROS_IE_XR:
4946       {
4947         switch(subtype){
4948           case ATHEROS_IE_XR_S:
4949           {
4950             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_info, tvb, offset, 1, ENC_NA);
4951             offset += 1;
4952
4953             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_base_bssid, tvb, offset, 6, ENC_NA);
4954             offset += 6;
4955
4956             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_xr_bssid, tvb, offset, 6, ENC_NA);
4957             offset += 6;
4958
4959             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_xr_beacon, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4960             offset += 2;
4961
4962             cap_item = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_base_cap, tvb, offset, 1, ENC_NA);
4963             dissect_vendor_ie_atheros_cap(cap_item, tvb, offset);
4964             offset += 1;
4965
4966             cap_item = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_xr_cap, tvb, offset, 1, ENC_NA);
4967             dissect_vendor_ie_atheros_cap(cap_item, tvb, offset);
4968             offset += 1;
4969             break;
4970           }
4971           default:
4972           /* No default Action */
4973           break;
4974         break;
4975         } /* End switch(subtype) */
4976         default:
4977         /* No default Action */
4978         break;
4979       } /* End switch(type) */
4980
4981     }
4982   }
4983   if(offset < tag_end){
4984    ti = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_data, tvb, offset, tag_len, FALSE);
4985    expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown Data (not interpreted)");
4986   }
4987
4988
4989 }
4990
4991 typedef enum {
4992   AIRONET_IE_VERSION = 3,
4993   AIRONET_IE_QOS,
4994   AIRONET_IE_QBSS_V2 = 14
4995 } aironet_ie_type_t;
4996
4997 static const value_string aironet_ie_type_vals[] = {
4998   { AIRONET_IE_VERSION,   "CCX version"},
4999   { AIRONET_IE_QOS,       "Qos"},
5000   { AIRONET_IE_QBSS_V2,   "QBSS V2 - CCA"},
5001   { 0,                    NULL }
5002 };
5003
5004 static void
5005 dissect_vendor_ie_aironet(proto_item * aironet_item, proto_tree * ietree,
5006   tvbuff_t * tvb, int offset, guint32 tag_len)
5007 {
5008   guint8  type;
5009   int i;
5010   gboolean dont_change = FALSE; /* Don't change the IE item text to default */
5011
5012   type = tvb_get_guint8(tvb, offset);
5013   proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_type, tvb, offset, 1, TRUE);
5014   offset += 1;
5015
5016   switch (type) {
5017   case AIRONET_IE_VERSION:
5018     proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_version, tvb, offset, 1, TRUE);
5019     proto_item_append_text(aironet_item, ": Aironet CCX version = %d",
5020     tvb_get_guint8(tvb, offset));
5021     dont_change = TRUE;
5022     break;
5023   case AIRONET_IE_QOS:
5024     proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_qos_unk1, tvb, offset, 1, TRUE);
5025     offset += 1;
5026     proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_qos_paramset, tvb, offset, 1, TRUE);
5027     offset += 1;
5028
5029     /* XXX: just copied over from WME. Maybe "Best Effort" and "Background"
5030      *  need to be swapped. Also, the "TXOP" may be TXOP - or not.
5031      */
5032     for (i = 0; i < 4; i++) {
5033       guint8 byte1, byte2;
5034       guint16 txop;
5035       byte1 = tvb_get_guint8(tvb, offset);
5036       byte2 = tvb_get_guint8(tvb, offset + 1);
5037       txop = tvb_get_letohs(tvb, offset + 2);
5038       proto_tree_add_bytes_format(ietree, hf_ieee80211_aironet_ie_qos_val, tvb, offset, 4, NULL,
5039           "CCX QoS Parameters??: ACI %u (%s), Admission Control %sMandatory, AIFSN %u, ECWmin %u, ECWmax %u, TXOP %u",
5040         (byte1 & 0x60) >> 5, match_strval((byte1 & 0x60) >> 5, wme_acs),
5041         (byte1 & 0x10) ? "" : "not ", byte1 & 0x0f,
5042         byte2 & 0x0f, (byte2 & 0xf0) >> 4,
5043         txop);
5044       offset += 4;
5045     }
5046     break;
5047   case AIRONET_IE_QBSS_V2:
5048     /* Extract Values */
5049     proto_tree_add_item (ietree, hf_ieee80211_qbss2_scount, tvb, offset, 2, TRUE);
5050     proto_tree_add_item (ietree, hf_ieee80211_qbss2_cu, tvb, offset + 2, 1, FALSE);
5051     proto_tree_add_item (ietree, hf_ieee80211_qbss2_cal, tvb, offset + 3, 1, FALSE);
5052     proto_tree_add_item (ietree, hf_ieee80211_qbss2_gl, tvb, offset + 4, 1, FALSE);
5053     break;
5054   default:
5055     proto_tree_add_item(ietree, hf_ieee80211_aironet_ie_data, tvb, offset,
5056       tag_len - 1, FALSE);
5057     break;
5058   }
5059   if (!dont_change) {
5060     proto_item_append_text(aironet_item, ": Aironet %s",
5061       val_to_str(type, aironet_ie_type_vals, "Unknown"));
5062   }
5063 }
5064 /* 7.3.2.25 RSN information element */
5065 static void
5066 dissect_rsn_ie(proto_tree * tree, tvbuff_t * tvb, int offset, guint32 tag_len)
5067 {
5068   proto_item *rsn_gcs_item, *rsn_pcs_item, *rsn_akms_item, *rsn_cap_item, *rsn_pmkid_item, *rsn_gmcs_item;
5069   proto_item *rsn_sub_pcs_item, *rsn_sub_akms_item;
5070   proto_tree *rsn_gcs_tree, *rsn_pcs_tree, *rsn_akms_tree, *rsn_cap_tree, *rsn_pmkid_tree, *rsn_gmcs_tree;
5071   proto_tree *rsn_sub_pcs_tree, *rsn_sub_akms_tree;
5072   guint16 i, pcs_count, akms_count, pmkid_count;
5073   int tag_end = offset + tag_len;
5074
5075   proto_tree_add_item(tree, hf_ieee80211_rsn_version, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5076   offset += 2;
5077
5078   /* 7.3.2.25.1 Cipher suites */
5079   rsn_gcs_item = proto_tree_add_item(tree, hf_ieee80211_rsn_gcs, tvb, offset, 4, FALSE);
5080   rsn_gcs_tree = proto_item_add_subtree(rsn_gcs_item, ett_rsn_gcs_tree);
5081   proto_tree_add_item(rsn_gcs_tree, hf_ieee80211_rsn_gcs_oui, tvb, offset, 3, FALSE);
5082     /* Check if OUI is 00:0F:AC (ieee80211) */
5083   if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
5084   {
5085     proto_tree_add_item(rsn_gcs_tree, hf_ieee80211_rsn_gcs_80211_type, tvb, offset + 3, 1, FALSE);
5086   } else {
5087     proto_tree_add_item(rsn_gcs_tree, hf_ieee80211_rsn_gcs_type, tvb, offset + 3, 1, FALSE);
5088   }
5089   offset += 4;
5090
5091   proto_tree_add_item(tree, hf_ieee80211_rsn_pcs_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5092   pcs_count = tvb_get_letohs(tvb, offset);
5093   offset += 2;
5094
5095   rsn_pcs_item = proto_tree_add_item(tree, hf_ieee80211_rsn_pcs_list, tvb, offset, pcs_count * 4, FALSE);
5096   rsn_pcs_tree = proto_item_add_subtree(rsn_pcs_item, ett_rsn_pcs_tree);
5097   for(i=1; i <= pcs_count; i++)
5098   {
5099     rsn_sub_pcs_item = proto_tree_add_item(rsn_pcs_tree, hf_ieee80211_rsn_pcs, tvb, offset, 4, FALSE);
5100     rsn_sub_pcs_tree = proto_item_add_subtree(rsn_sub_pcs_item, ett_rsn_sub_pcs_tree);
5101     proto_tree_add_item(rsn_sub_pcs_tree, hf_ieee80211_rsn_pcs_oui, tvb, offset, 3, FALSE);
5102     /* Check if OUI is 00:0F:AC (ieee80211) */
5103     if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
5104     {
5105       proto_tree_add_item(rsn_sub_pcs_tree, hf_ieee80211_rsn_pcs_80211_type, tvb, offset+3, 1, FALSE);
5106       proto_item_append_text(rsn_pcs_item, " %s", rsn_pcs_return(tvb_get_ntohl(tvb, offset)));
5107     } else {
5108       proto_tree_add_item(rsn_sub_pcs_tree, hf_ieee80211_rsn_pcs_type, tvb, offset+3, 1, FALSE);
5109     }
5110     offset += 4;
5111   }
5112
5113   /* 7.3.2.25.2 AKM suites */
5114   proto_tree_add_item(tree, hf_ieee80211_rsn_akms_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5115   akms_count = tvb_get_letohs(tvb, offset);
5116   offset += 2;
5117
5118   rsn_akms_item = proto_tree_add_item(tree, hf_ieee80211_rsn_akms_list, tvb, offset, akms_count * 4, FALSE);
5119   rsn_akms_tree = proto_item_add_subtree(rsn_akms_item, ett_rsn_akms_tree);
5120   for(i=1; i <= akms_count; i++)
5121   {
5122     rsn_sub_akms_item = proto_tree_add_item(rsn_akms_tree, hf_ieee80211_rsn_akms, tvb, offset, 4, FALSE);
5123     rsn_sub_akms_tree = proto_item_add_subtree(rsn_sub_akms_item, ett_rsn_sub_akms_tree);
5124     proto_tree_add_item(rsn_sub_akms_tree, hf_ieee80211_rsn_akms_oui, tvb, offset, 3, FALSE);
5125
5126     /* Check if OUI is 00:0F:AC (ieee80211) */
5127     if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
5128     {
5129       proto_tree_add_item(rsn_sub_akms_tree, hf_ieee80211_rsn_akms_80211_type, tvb, offset+3, 1, FALSE);
5130       proto_item_append_text(rsn_akms_item, " %s", rsn_akms_return(tvb_get_ntohl(tvb, offset)));
5131     } else {
5132       proto_tree_add_item(rsn_sub_akms_tree, hf_ieee80211_rsn_akms_type, tvb, offset+3, 1, FALSE);
5133     }
5134     offset += 4;
5135   }
5136
5137   /* 7.3.2.25.3 RSN capabilities */
5138   rsn_cap_item = proto_tree_add_item(tree, hf_ieee80211_rsn_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5139   rsn_cap_tree = proto_item_add_subtree(rsn_cap_item, ett_rsn_cap_tree);
5140
5141   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_preauth, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5142   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_no_pairwise, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5143   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_ptksa_replay_counter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5144   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_gtksa_replay_counter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5145   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_mfpr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5146   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_mfpc, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5147   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_peerkey, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5148   offset += 2;
5149   if(offset >= tag_end)
5150   {
5151     return;
5152   }
5153   /* 7.3.2.25.4 PMKID */
5154   proto_tree_add_item(tree, hf_ieee80211_rsn_pmkid_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5155   pmkid_count = tvb_get_letohs(tvb, offset);
5156   offset += 2;
5157
5158   rsn_pmkid_item = proto_tree_add_item(tree, hf_ieee80211_rsn_pmkid_list, tvb, offset, pmkid_count * 16, FALSE);
5159   rsn_pmkid_tree = proto_item_add_subtree(rsn_pmkid_item, ett_rsn_pmkid_tree);
5160   for(i=1; i <= pmkid_count; i++)
5161   {
5162     proto_tree_add_item(rsn_pmkid_tree, hf_ieee80211_rsn_pmkid, tvb, offset, 16, FALSE);
5163     offset +=16;
5164   }
5165
5166   if(offset >= tag_end)
5167   {
5168     return;
5169   }
5170   /* Group Management Cipher Suite (802.11w)*/
5171   rsn_gmcs_item = proto_tree_add_item(tree, hf_ieee80211_rsn_gmcs, tvb, offset, 4, FALSE);
5172   rsn_gmcs_tree = proto_item_add_subtree(rsn_gmcs_item, ett_rsn_gmcs_tree);
5173   proto_tree_add_item(rsn_gmcs_tree, hf_ieee80211_rsn_gmcs_oui, tvb, offset, 3, FALSE);
5174   /* Check if OUI is 00:0F:AC (ieee80211) */
5175   if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
5176   {
5177     proto_tree_add_item(rsn_gmcs_tree, hf_ieee80211_rsn_gmcs_80211_type, tvb, offset + 3, 1, FALSE);
5178   } else {
5179     proto_tree_add_item(rsn_gmcs_tree, hf_ieee80211_rsn_gmcs_type, tvb, offset + 3, 1, FALSE);
5180   }
5181   offset += 4;
5182
5183 }
5184
5185 static void
5186 dissect_mobility_domain(proto_tree *tree, tvbuff_t *tvb, int offset,
5187                         guint32 tag_len)
5188 {
5189   if (tag_len < 3) {
5190     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5191                           "MDIE content length must be at least 3 bytes");
5192     return;
5193   }
5194
5195   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_mdid,
5196                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
5197   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_ft_capab,
5198                       tvb, offset + 2, 1, FALSE);
5199   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_ft_capab_ft_over_ds,
5200                       tvb, offset + 2, 1, FALSE);
5201   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_ft_capab_resource_req,
5202                       tvb, offset + 2, 1, FALSE);
5203 }
5204
5205 #ifndef MESH_OVERRIDES
5206 static void
5207 dissect_fast_bss_transition(proto_tree *tree, tvbuff_t *tvb, int offset,
5208                             guint32 tag_len)
5209 {
5210   int end = offset + tag_len;
5211   if (tag_len < 82) {
5212     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5213                           "FTIE content length must be at least 82 bytes");
5214     return;
5215   }
5216
5217   proto_tree_add_item(tree, hf_ieee80211_tag_ft_mic_control,
5218                       tvb, offset, 2, TRUE);
5219   proto_tree_add_item(tree, hf_ieee80211_tag_ft_element_count,
5220                       tvb, offset, 2, TRUE);
5221   offset += 2;
5222   proto_tree_add_item(tree, hf_ieee80211_tag_ft_mic,
5223                       tvb, offset, 16, FALSE);
5224   offset += 16;
5225   proto_tree_add_item(tree, hf_ieee80211_tag_ft_anonce,
5226                       tvb, offset, 32, FALSE);
5227   offset += 32;
5228   proto_tree_add_item(tree, hf_ieee80211_tag_ft_snonce,
5229                       tvb, offset, 32, FALSE);
5230   offset += 32;
5231
5232   while (offset + 2 <= end) {
5233     guint8 id, len;
5234     int s_end;
5235     proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_id,
5236                         tvb, offset, 1, FALSE);
5237     id = tvb_get_guint8(tvb, offset);
5238     offset++;
5239
5240     proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_len,
5241                         tvb, offset, 1, FALSE);
5242     len = tvb_get_guint8(tvb, offset);
5243     offset++;
5244
5245     if (offset + len > end) {
5246       proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset,
5247                             end - offset, "Invalid FTIE subelement");
5248       return;
5249     }
5250
5251     s_end = offset + len;
5252     switch (id) {
5253     case 1:
5254       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_r1kh_id,
5255                           tvb, offset, len, FALSE);
5256       break;
5257     case 2:
5258       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key_info,
5259                           tvb, offset, 2, TRUE);
5260       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key_id,
5261                           tvb, offset, 2, TRUE);
5262       offset += 2;
5263       if (offset > s_end)
5264         break;
5265       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key_length,
5266                           tvb, offset, 1, FALSE);
5267       offset++;
5268       if (offset > s_end)
5269         break;
5270       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_rsc,
5271                           tvb, offset, 8, FALSE);
5272       offset += 8;
5273       if (offset > s_end)
5274         break;
5275       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key,
5276                           tvb, offset, s_end - offset, FALSE);
5277       break;
5278     case 3:
5279       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_r0kh_id,
5280                           tvb, offset, len, FALSE);
5281       break;
5282     case 4:
5283       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_key_id,
5284                           tvb, offset, 2, TRUE);
5285       offset += 2;
5286       if (offset > s_end)
5287         break;
5288       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_ipn,
5289                           tvb, offset, 6, FALSE);
5290       offset += 6;
5291       if (offset > s_end)
5292         break;
5293       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_key_length,
5294                           tvb, offset, 1, FALSE);
5295       offset++;
5296       if (offset > s_end)
5297         break;
5298       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_key,
5299                           tvb, offset, 24, FALSE);
5300       break;
5301     default:
5302       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_data,
5303                           tvb, offset, len, FALSE);
5304       break;
5305     }
5306     offset = s_end;
5307   }
5308 }
5309 #endif /* MESH_OVERRIDES */
5310
5311 static void
5312 dissect_mmie(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 tag_len)
5313 {
5314   if (tag_len < 16) {
5315     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5316                           "MMIE content length must be at least 16 bytes");
5317     return;
5318   }
5319
5320   proto_tree_add_item(tree, hf_ieee80211_tag_mmie_keyid, tvb, offset, 2, TRUE);
5321   proto_tree_add_item(tree, hf_ieee80211_tag_mmie_ipn, tvb, offset + 2, 6,
5322                       TRUE);
5323   proto_tree_add_item(tree, hf_ieee80211_tag_mmie_mic, tvb, offset + 8, 8,
5324                       FALSE);
5325 }
5326
5327 static void
5328 dissect_link_identifier(proto_tree *tree, tvbuff_t *tvb, int offset,
5329                         guint32 tag_len)
5330 {
5331   if (tag_len < 18) {
5332     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5333                           "Link Identifier content length must be at least "
5334                           "18 bytes");
5335     return;
5336   }
5337
5338   proto_tree_add_item(tree, hf_ieee80211_tag_link_id_bssid, tvb,
5339                       offset, 6, FALSE);
5340   proto_tree_add_item(tree, hf_ieee80211_tag_link_id_init_sta, tvb,
5341                       offset + 6, 6, FALSE);
5342   proto_tree_add_item(tree, hf_ieee80211_tag_link_id_resp_sta, tvb,
5343                       offset + 12, 6, FALSE);
5344 }
5345
5346 static void
5347 dissect_wakeup_schedule(proto_tree *tree, tvbuff_t *tvb, int offset,
5348                         guint32 tag_len)
5349 {
5350   if (tag_len < 18) {
5351     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5352                           "Wakeup Schedule content length must be at least "
5353                           "18 bytes");
5354     return;
5355   }
5356
5357   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_offset, tvb,
5358                       offset, 4, TRUE);
5359   offset += 4;
5360
5361   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_interval, tvb,
5362                       offset, 4, TRUE);
5363   offset += 4;
5364
5365   proto_tree_add_item(tree,
5366                       hf_ieee80211_tag_wakeup_schedule_awake_window_slots, tvb,
5367                       offset, 4, TRUE);
5368   offset += 4;
5369
5370   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_max_awake_dur,
5371                       tvb, offset, 4, TRUE);
5372   offset += 4;
5373
5374   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_idle_count, tvb,
5375                       offset, 2, TRUE);
5376 }
5377
5378 static void
5379 dissect_channel_switch_timing(proto_tree *tree, tvbuff_t *tvb, int offset,
5380                               guint32 tag_len)
5381 {
5382   if (tag_len < 4) {
5383     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5384                           "Channel Switch Timing content length must be at "
5385                           "least 4 bytes");
5386     return;
5387   }
5388
5389   proto_tree_add_item(tree, hf_ieee80211_tag_channel_switch_timing_switch_time,
5390                       tvb, offset, 2, TRUE);
5391   offset += 2;
5392
5393   proto_tree_add_item(tree,
5394                       hf_ieee80211_tag_channel_switch_timing_switch_timeout,
5395                       tvb, offset, 2, TRUE);
5396 }
5397
5398 static void
5399 dissect_pti_control(proto_tree *tree, tvbuff_t *tvb, int offset,
5400                     guint32 tag_len)
5401 {
5402   if (tag_len < 3) {
5403     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5404                           "PTI Control content length must be at least "
5405                           "3 bytes");
5406     return;
5407   }
5408
5409   proto_tree_add_item(tree, hf_ieee80211_tag_pti_control_tid, tvb,
5410                       offset, 1, FALSE);
5411   offset++;
5412
5413   proto_tree_add_item(tree, hf_ieee80211_tag_pti_control_sequence_control, tvb,
5414                       offset, 2, TRUE);
5415 }
5416
5417 static void
5418 dissect_pu_buffer_status(proto_tree *tree, tvbuff_t *tvb, int offset,
5419                          guint32 tag_len)
5420 {
5421   if (tag_len < 1) {
5422     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5423                           "PU Buffer Status content length must be at least "
5424                           "1 byte");
5425     return;
5426   }
5427
5428   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_bk, tvb,
5429                       offset, 1, FALSE);
5430   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_be, tvb,
5431                       offset, 1, FALSE);
5432   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_vi, tvb,
5433                       offset, 1, FALSE);
5434   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_vo, tvb,
5435                       offset, 1, FALSE);
5436 }
5437
5438 static void
5439 dissect_timeout_interval(proto_tree *tree, tvbuff_t *tvb, int offset,
5440                          guint32 tag_len)
5441 {
5442   proto_item *pi;
5443
5444   pi = proto_tree_add_item(tree, hf_ieee80211_tag_timeout_int_type, tvb,
5445                            offset, 1, FALSE);
5446   if (tag_len < 5) {
5447     expert_add_info_format(g_pinfo, pi, PI_MALFORMED, PI_ERROR,
5448                            "Timeout Interval content length must be at least "
5449                           "5 bytes");
5450     return;
5451   }
5452
5453   proto_tree_add_item(tree, hf_ieee80211_tag_timeout_int_value, tvb,
5454                       offset + 1, 4, TRUE);
5455 }
5456
5457 static void
5458 dissect_mcs_set(proto_tree *tree, tvbuff_t *tvb, int offset, gboolean basic, gboolean vs) {
5459   proto_item *ti;
5460   proto_tree *mcs_tree, *bit_tree;
5461   guint16 capability;
5462
5463   /* 16 byte Supported MCS set */
5464   if(vs)
5465   {
5466     ti = proto_tree_add_string(tree, hf_ieee80211_mcsset_vs, tvb, offset, 16,
5467       basic ? "Basic MCS Set" : "MCS Set");
5468   }else
5469   {
5470     ti = proto_tree_add_string(tree, hf_ieee80211_mcsset, tvb, offset, 16,
5471       basic ? "Basic MCS Set" : "MCS Set");
5472   }
5473   mcs_tree = proto_item_add_subtree(ti, ett_mcsset_tree);
5474
5475   /* Rx MCS Bitmask */
5476   ti = proto_tree_add_string(mcs_tree, hf_ieee80211_tag_interpretation, tvb, offset,
5477       10, "Rx Modulation and Coding Scheme (One bit per modulation)");
5478   bit_tree = proto_item_add_subtree(ti, ett_mcsbit_tree);
5479
5480   /* Bits 0 - 31 */
5481   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_0to7, tvb, offset, 4, TRUE);
5482   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_8to15, tvb, offset, 4, TRUE);
5483   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_16to23, tvb, offset, 4, TRUE);
5484   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_24to31, tvb, offset, 4, TRUE);
5485
5486   /* Bits 32 - 52 */
5487   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_32, tvb, offset + 4, 4, TRUE);
5488   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_33to38, tvb, offset + 4, 4, TRUE);
5489   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_39to52, tvb, offset + 4, 4, TRUE);
5490
5491   /* Bits 53 - 76 */
5492   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_53to76, tvb, offset + 6, 4, TRUE);
5493
5494   capability = tvb_get_letohs (tvb, offset+10);
5495   proto_tree_add_uint_format(mcs_tree, hf_ieee80211_mcsset_highest_data_rate, tvb, offset + 10, 2,
5496       capability, "Highest Supported Data Rate: 0x%04X", capability);
5497   capability = tvb_get_letohs (tvb, offset+12);
5498   proto_tree_add_boolean(mcs_tree, hf_ieee80211_mcsset_tx_mcs_set_defined, tvb, offset + 12, 1,
5499       capability);
5500   proto_tree_add_boolean(mcs_tree, hf_ieee80211_mcsset_tx_rx_mcs_set_not_equal, tvb, offset + 12, 1,
5501       capability);
5502   proto_tree_add_uint(mcs_tree, hf_ieee80211_mcsset_tx_max_spatial_streams, tvb, offset + 12, 1,
5503       capability);
5504   proto_tree_add_boolean(mcs_tree, hf_ieee80211_mcsset_tx_unequal_modulation, tvb, offset + 12, 1,
5505       capability);
5506 }
5507
5508 /*  802.11n D1.10 - HT Information IE  */
5509 static void
5510 dissect_ht_info_ie_1_1(proto_tree * tree, tvbuff_t * tvb, int offset,
5511          guint32 tag_len)
5512 {
5513   proto_item *cap_item;
5514   proto_tree *cap_tree;
5515   guint32 tag_val_init_off = 0;
5516   guint16 info = 0;
5517
5518   tag_val_init_off = offset;
5519   cap_tree = tree;
5520
5521   if (tag_len < 22) {
5522     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5523               "HT Information IE content length must be at least 22 bytes");
5524     return;
5525   }
5526
5527   info = tvb_get_guint8 (tvb, offset);
5528   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_primary_channel, tvb, offset, 1, TRUE);
5529
5530   info = tvb_get_guint8 (tvb, ++offset);
5531   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_ht_info_delimiter1, tvb,
5532                     offset, 1, info,
5533                     "HT Information Subset (1 of 3): 0x%02X", info);
5534   cap_tree = proto_item_add_subtree(cap_item, ett_ht_info_delimiter1_tree);
5535   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_secondary_channel_offset, tvb, offset, 1,
5536              info);
5537   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_channel_width, tvb, offset, 1,
5538              info);
5539   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_rifs_mode, tvb, offset, 1,
5540              info);
5541   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_psmp_stas_only, tvb, offset, 1,
5542              info);
5543   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_service_interval_granularity, tvb, offset, 1,
5544              info);
5545
5546   info = tvb_get_letohs (tvb, ++offset);
5547   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_ht_info_delimiter2, tvb,
5548                     offset, 2, info,
5549                     "HT Information Subset (2 of 3): 0x%04X", info);
5550   cap_tree = proto_item_add_subtree(cap_item, ett_ht_info_delimiter2_tree);
5551   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_operating_mode, tvb, offset, 1,
5552              info);
5553   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_non_greenfield_sta_present, tvb, offset, 1,
5554              info);
5555   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_transmit_burst_limit, tvb, offset, 1,
5556              info);
5557   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_obss_non_ht_stas_present, tvb, offset, 1,
5558              info);
5559   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_reserved_1, tvb, offset, 2,
5560              info);
5561
5562   offset += 2;
5563   info = tvb_get_letohs (tvb, offset);
5564   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_ht_info_delimiter3, tvb,
5565                     offset, 2, info,
5566                     "HT Information Subset (3 of 3): 0x%04X", info);
5567   cap_tree = proto_item_add_subtree(cap_item, ett_ht_info_delimiter3_tree);
5568   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_reserved_2, tvb, offset, 1,
5569              info);
5570   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_dual_beacon, tvb, offset, 1,
5571              info);
5572   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_dual_cts_protection, tvb, offset, 1,
5573              info);
5574   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_secondary_beacon, tvb, offset+1, 1,
5575              info);
5576   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_lsig_txop_protection_full_support, tvb, offset+1, 1,
5577              info);
5578   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_pco_active, tvb, offset+1, 1,
5579              info);
5580   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_pco_phase, tvb, offset+1, 1,
5581              info);
5582   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_reserved_3, tvb, offset+1, 1,
5583              info);
5584
5585   offset += 2;
5586   cap_tree = tree;
5587
5588   dissect_mcs_set(cap_tree, tvb, offset, TRUE, FALSE);
5589   offset += 16;
5590
5591   if (tag_val_init_off - offset < tag_len){
5592     proto_tree_add_string(cap_tree, hf_ieee80211_tag_interpretation, tvb, offset,
5593        tag_len + tag_val_init_off - offset, "Unparsed Extra Data");
5594   }
5595 }
5596
5597 #ifndef MESH_OVERRIDES
5598 /***  WAVE Service information element Dissection - IEEE 802.11p Draft 4.0 ***/
5599 static void
5600 dissect_wsie_ie(proto_tree * tree, tvbuff_t * tvb, int offset, guint32 tag_len _U_)
5601 {
5602   proto_item *pst_item, *cap_item, *chan_noc_item, *chnl_item;
5603   proto_tree *pst_tree, *cap_tree, *chan_noc_tree, *chnl_tree;
5604
5605   guint8 providercount, pst_contents, pst_acm_length;
5606   int i;
5607   guint16 pst_length = 0;
5608   guint16 chan_noc;
5609   guint8 chan_length = 0;
5610   int local_offset;
5611
5612   proto_tree_add_item(tree, hf_ieee80211_pst_timingquality, tvb, offset, 2, TRUE);
5613   offset+=2;
5614
5615   providercount = tvb_get_guint8 (tvb, offset);
5616   pst_item = proto_tree_add_item(tree, hf_ieee80211_pst_providercount, tvb, offset, 1, TRUE);
5617   pst_tree = proto_item_add_subtree(pst_item, ett_pst_tree);
5618   offset++;
5619
5620   for (i=0;i<providercount;i++) {
5621
5622     local_offset = offset;
5623     cap_item = proto_tree_add_item(pst_tree, hf_ieee80211_pst_providercap, tvb, local_offset, 0, TRUE);
5624     proto_item_append_text(cap_item, ": %u", i+1);
5625     cap_tree = proto_item_add_subtree(cap_item, ett_pst_cap_tree);
5626
5627     pst_length = tvb_get_letohl(tvb, local_offset);
5628     proto_item_set_len(cap_item, pst_length);
5629     proto_tree_add_item(cap_tree, hf_ieee80211_pst_length, tvb, local_offset, 2, TRUE);
5630     local_offset += 2;
5631
5632     pst_contents = tvb_get_guint8 (tvb, local_offset);
5633     proto_tree_add_item(cap_tree, hf_ieee80211_pst_contents, tvb, local_offset, 1, TRUE);
5634     local_offset += 1;
5635
5636     if (pst_contents & WAVE_ACID) {
5637       proto_tree_add_item(cap_tree, hf_ieee80211_pst_acid, tvb, local_offset, 1, TRUE);
5638       local_offset += 1;
5639     }
5640
5641     if (pst_contents & WAVE_ACM) {
5642       pst_acm_length = tvb_get_guint8 (tvb, local_offset);
5643       proto_tree_add_item(cap_tree, hf_ieee80211_pst_acm_length, tvb, local_offset, 1, TRUE);
5644       local_offset += 1;
5645       proto_tree_add_item(cap_tree, hf_ieee80211_pst_acm_contents, tvb, local_offset, pst_acm_length, FALSE);
5646       local_offset += pst_acm_length;
5647     }
5648     if (pst_contents & WAVE_ACF) {
5649       proto_tree_add_item(cap_tree, hf_ieee80211_pst_acf, tvb, local_offset, 32, FALSE);
5650       local_offset += 32;
5651     }
5652     if (pst_contents & WAVE_PRIORITY) {
5653       proto_tree_add_item(cap_tree, hf_ieee80211_pst_priority, tvb, local_offset, 1, TRUE);
5654       local_offset += 1;
5655     }
5656     if (pst_contents & WAVE_IPV6ADDR) {
5657       proto_tree_add_item(cap_tree, hf_ieee80211_pst_ipv6addr, tvb, local_offset, 16, FALSE);
5658       local_offset += 16;
5659       proto_tree_add_item(cap_tree, hf_ieee80211_pst_serviceport, tvb, local_offset, 2, FALSE);
5660       local_offset += 2;
5661       proto_tree_add_item(cap_tree, hf_ieee80211_pst_addressing, tvb, local_offset, 1, FALSE);
5662       local_offset += 1;
5663     }
5664     if (pst_contents & WAVE_PEERMAC) {
5665       proto_tree_add_item(cap_tree, hf_ieee80211_pst_macaddr, tvb, local_offset, 6, FALSE);
5666       local_offset += 6;
5667     }
5668     if (pst_contents & WAVE_CHANNEL) {
5669       proto_tree_add_item(cap_tree, hf_ieee80211_pst_channel, tvb, local_offset, 1, FALSE);
5670       local_offset += 1;
5671     }
5672
5673     offset = offset + pst_length;
5674   }
5675
5676   chan_noc = tvb_get_guint8 (tvb, offset);
5677   chan_noc_item = proto_tree_add_item(tree, hf_ieee80211_chan_noc, tvb, offset, 1, TRUE);
5678   chan_noc_tree = proto_item_add_subtree(chan_noc_item,ett_chan_noc_tree);
5679   offset++;
5680
5681   if (chan_noc != 0){
5682     for (i=0;i<chan_noc;i++) {
5683       chan_length = tvb_get_guint8 (tvb, offset);
5684       chnl_item = proto_tree_add_text (chan_noc_tree, tvb, offset, chan_length, "Channel :%u Information ", i+1);
5685       chnl_tree = proto_item_add_subtree(chnl_item, ett_wave_chnl_tree);
5686       proto_tree_add_item(chnl_tree, hf_ieee80211_chan_length, tvb, offset, 1, TRUE);
5687       proto_tree_add_item(chnl_tree, hf_ieee80211_chan_content, tvb, offset+1, 1, TRUE);
5688       proto_tree_add_item(chnl_tree, hf_ieee80211_chan_channel, tvb, offset+2, 1, TRUE);
5689       proto_tree_add_item(chnl_tree, hf_ieee80211_chan_adapt, tvb, offset+3, 1, TRUE);
5690       proto_tree_add_item(chnl_tree, hf_ieee80211_chan_rate, tvb, offset+4, 1, TRUE);
5691       proto_tree_add_item(chnl_tree, hf_ieee80211_chan_tx_pow, tvb, offset+5, 1, TRUE);
5692       offset = offset + chan_length;
5693     }
5694   }
5695 }
5696 #endif /* MESH_OVERRIDES */
5697
5698 static void secondary_channel_offset_ie(proto_tree * tree, tvbuff_t * tvb, int offset, guint32 tag_len)
5699 {
5700   int tag_offset;
5701
5702   if (tag_len != 1)
5703   {
5704     proto_tree_add_text (tree, tvb, offset, tag_len, "Secondary Channel Offset: Error: Tag length must be at least 1 byte long");
5705     return;
5706   }
5707
5708   tag_offset = offset;
5709   proto_tree_add_uint(tree, hf_ieee80211_tag_secondary_channel_offset, tvb, offset, 1, tvb_get_guint8 (tvb, offset));
5710
5711   offset++;
5712   if ((tag_len - (offset-tag_offset)) > 0)
5713   {
5714     proto_tree_add_text (tree, tvb, offset, tag_len - (offset-tag_offset), "Unknown Data");
5715     return;
5716   }
5717 }
5718
5719 static void
5720 dissect_ht_capability_ie(proto_tree * tree, tvbuff_t * tvb, int offset,
5721          guint32 tag_len, gboolean vs)
5722 {
5723   proto_item *cap_item;
5724   proto_tree *cap_tree;
5725   guint16 capability;
5726   guint32 txbfcap;
5727   guint32 tag_val_off = 0;
5728
5729   if (tag_val_off + 2 > tag_len) {
5730     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5731         "Not interpreted");
5732     return;
5733   }
5734
5735   if (tag_len != 26) {
5736     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5737               "HT Capabilities IE content length must be exactly 26 bytes");
5738     return;
5739   }
5740
5741   if (wlan_ignore_draft_ht && vs)
5742     return;
5743
5744   /* 2 byte HT Capabilities  Info*/
5745   capability = tvb_get_letohs (tvb, offset);
5746   if(vs)
5747   {
5748     cap_item = proto_tree_add_item(tree, hf_ieee80211_ht_vs_cap, tvb, offset, 2, TRUE);
5749   }
5750   else
5751   {
5752     cap_item = proto_tree_add_item(tree, hf_ieee80211_ht_cap, tvb, offset, 2, TRUE);
5753   }
5754   cap_tree = proto_item_add_subtree(cap_item, ett_ht_cap_tree);
5755   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_ldpc_coding, tvb, offset, 1,
5756              capability);
5757   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_chan_width, tvb, offset, 1,
5758              capability);
5759   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_sm_pwsave, tvb, offset, 1,
5760              capability);
5761   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_green, tvb, offset, 1,
5762              capability);
5763   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_short20, tvb, offset, 1,
5764              capability);
5765   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_short40, tvb, offset, 1,
5766              capability);
5767   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_tx_stbc, tvb, offset, 1,
5768              capability);
5769   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_rx_stbc, tvb, offset+1, 1,
5770              capability);
5771   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_delayed_block_ack, tvb, offset+1, 1,
5772              capability);
5773   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_max_amsdu, tvb, offset+1, 1,
5774              capability);
5775   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_dss_cck_40, tvb, offset+1, 1,
5776              capability);
5777   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_psmp, tvb, offset+1, 1,
5778              capability);
5779   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_40_mhz_intolerant, tvb, offset+1, 1,
5780              capability);
5781   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_l_sig, tvb, offset+1, 1,
5782              capability);
5783
5784   offset += 2;
5785   tag_val_off += 2;
5786
5787   /* 1 byte A-MPDU Parameters */
5788   capability = tvb_get_guint8 (tvb, offset);
5789   if(vs)
5790   {
5791     cap_item = proto_tree_add_item(tree, hf_ieee80211_ampduparam_vs, tvb, offset, 1, TRUE);
5792   }else
5793   {
5794     cap_item = proto_tree_add_item(tree, hf_ieee80211_ampduparam, tvb, offset, 1, TRUE);
5795   }
5796   cap_tree = proto_item_add_subtree(cap_item, ett_ampduparam_tree);
5797   proto_tree_add_uint_format(cap_tree, hf_ieee80211_ampduparam_mpdu, tvb, offset, 1, capability,
5798                              "%sMaximum Rx A-MPDU Length: %04.0f [Bytes]",
5799                              decode_numeric_bitfield(capability, 0x03, 8, ""),
5800                              pow(2,13+(capability & 0x3))-1);
5801   proto_tree_add_uint(cap_tree, hf_ieee80211_ampduparam_mpdu_start_spacing, tvb, offset, 1, capability);
5802   proto_tree_add_uint(cap_tree, hf_ieee80211_ampduparam_reserved, tvb, offset, 1, capability);
5803   offset += 1;
5804   tag_val_off += 1;
5805
5806   /* 16 byte MCS set */
5807   dissect_mcs_set(tree, tvb, offset, FALSE, vs);
5808   offset += 16;
5809   tag_val_off += 16;
5810
5811   /* 2 byte HT Extended Capabilities */
5812   capability = tvb_get_letohs (tvb, offset);
5813   if(vs)
5814   {
5815     cap_item = proto_tree_add_item(tree, hf_ieee80211_htex_vs_cap, tvb, offset, 2, TRUE);
5816   } else {
5817     cap_item = proto_tree_add_item(tree, hf_ieee80211_htex_cap, tvb, offset, 2, TRUE);
5818   }
5819   cap_tree = proto_item_add_subtree(cap_item, ett_htex_cap_tree);
5820   proto_tree_add_boolean(cap_tree, hf_ieee80211_htex_pco, tvb, offset, 1,
5821              capability);
5822   proto_tree_add_uint(cap_tree, hf_ieee80211_htex_transtime, tvb, offset, 1,
5823              capability);
5824   proto_tree_add_uint(cap_tree, hf_ieee80211_htex_mcs, tvb, offset+1, 1,
5825              capability);
5826   proto_tree_add_boolean(cap_tree, hf_ieee80211_htex_htc_support, tvb, offset+1, 1,
5827              capability);
5828   proto_tree_add_boolean(cap_tree, hf_ieee80211_htex_rd_responder, tvb, offset+1, 1,
5829              capability);
5830
5831   offset += 2;
5832   tag_val_off += 2;
5833
5834   /* 4 byte TxBF capabilities */
5835   txbfcap = tvb_get_letohl (tvb, offset);
5836   if(vs)
5837   {
5838     cap_item = proto_tree_add_item(tree, hf_ieee80211_txbf_vs, tvb, offset, 4, TRUE);
5839   } else {
5840     cap_item = proto_tree_add_item(tree, hf_ieee80211_txbf, tvb, offset, 4, TRUE);
5841   }
5842   cap_tree = proto_item_add_subtree(cap_item, ett_txbf_tree);
5843   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_cap, tvb, offset, 1,
5844              txbfcap);
5845   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_rcv_ssc, tvb, offset, 1,
5846              txbfcap);
5847   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_tx_ssc, tvb, offset, 1,
5848              txbfcap);
5849   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_rcv_ndp, tvb, offset, 1,
5850              txbfcap);
5851   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_tx_ndp, tvb, offset, 1,
5852              txbfcap);
5853   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_impl_txbf, tvb, offset, 1,
5854              txbfcap);
5855   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_calib, tvb, offset, 1,
5856              txbfcap);
5857   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_expl_csi, tvb, offset+1, 1,
5858              txbfcap);
5859   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_expl_uncomp_fm, tvb, offset+1, 1,
5860              txbfcap);
5861   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_expl_comp_fm, tvb, offset+1, 1,
5862              txbfcap);
5863   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_expl_bf_csi, tvb, offset+1, 1,
5864              txbfcap);
5865   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_expl_uncomp_fm_feed, tvb, offset+1, 1,
5866              txbfcap);
5867   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_expl_comp_fm_feed, tvb, offset+1, 2,
5868              txbfcap);
5869   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_min_group, tvb, offset+2, 1,
5870              txbfcap);
5871   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_csi_num_bf_ant, tvb, offset+2, 1,
5872              txbfcap);
5873   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_uncomp_sm_bf_ant, tvb, offset+2, 1,
5874              txbfcap);
5875   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_comp_sm_bf_ant, tvb, offset+2, 2,
5876              txbfcap);
5877   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_csi_max_rows_bf, tvb, offset+3, 1,
5878              txbfcap);
5879   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_chan_est, tvb, offset+3, 1,
5880              txbfcap);
5881   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_resrv, tvb, offset+3, 1,
5882              txbfcap);
5883
5884   offset += 4;
5885   tag_val_off += 4;
5886
5887   /* 1 byte Antenna Selection (ASEL) capabilities */
5888   capability = tvb_get_guint8 (tvb, offset);
5889   if(vs)
5890   {
5891     cap_item = proto_tree_add_item(tree, hf_ieee80211_antsel_vs, tvb, offset, 1, TRUE);
5892   }
5893   else
5894   {
5895     cap_item = proto_tree_add_item(tree, hf_ieee80211_antsel, tvb,  offset, 1, TRUE);
5896   }
5897   cap_tree = proto_item_add_subtree(cap_item, ett_antsel_tree);
5898   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b0, tvb, offset, 1,
5899              capability);
5900   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b1, tvb, offset, 1,
5901              capability);
5902   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b2, tvb, offset, 1,
5903              capability);
5904   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b3, tvb, offset, 1,
5905              capability);
5906   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b4, tvb, offset, 1,
5907              capability);
5908   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b5, tvb, offset, 1,
5909              capability);
5910   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b6, tvb, offset, 1,
5911              capability);
5912   proto_tree_add_uint(cap_tree, hf_ieee80211_antsel_b7, tvb, offset, 1,
5913              capability);
5914
5915   offset += 1;
5916   tag_val_off += 1;
5917 }
5918
5919 static void
5920 dissect_ht_info_ie_1_0(proto_tree * tree, tvbuff_t * tvb, int offset,
5921          guint32 tag_len)
5922 {
5923   proto_item *cap_item;
5924   proto_tree *cap_tree;
5925   guint16 capability;
5926   guint32 tag_val_off = 0;
5927   gchar out_buff[SHORT_STR];
5928
5929   if (tag_val_off + 2 > tag_len) {
5930     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5931         "Not interpreted");
5932     return;
5933   }
5934
5935   if (tag_len < 22) {
5936     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
5937               "HT Additional Capabilities IE content length must be 22");
5938     return;
5939   }
5940
5941   if (wlan_ignore_draft_ht)
5942     return;
5943
5944   g_snprintf(out_buff, SHORT_STR, "Control Channel %d",
5945              tvb_get_guint8(tvb, offset));
5946   proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, 1, out_buff);
5947   offset += 1;
5948   tag_val_off += 1;
5949
5950   /* 1 byte HT additional capabilities */
5951   capability = tvb_get_guint8 (tvb, offset);
5952   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_hta_cap, tvb,
5953                     offset, 1, capability,
5954                     "HT Additional Capabilities: 0x%04X", capability);
5955   cap_tree = proto_item_add_subtree(cap_item, ett_hta_cap_tree);
5956   proto_tree_add_uint(cap_tree, hf_ieee80211_hta_ext_chan_offset, tvb, offset, 1,
5957              capability);
5958   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_rec_tx_width, tvb, offset, 1,
5959              capability);
5960   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_rifs_mode, tvb, offset, 1,
5961              capability);
5962   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_controlled_access, tvb, offset, 1,
5963              capability);
5964   proto_tree_add_uint(cap_tree, hf_ieee80211_hta_service_interval, tvb, offset, 1,
5965              capability);
5966   offset += 1;
5967   tag_val_off += 1;
5968
5969   /* 2 byte HT additional capabilities */
5970   capability = tvb_get_letohs (tvb, offset);
5971   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_hta_cap, tvb,
5972                     offset, 2, capability,
5973                     "HT Additional Capabilities: 0x%04X", capability);
5974   cap_tree = proto_item_add_subtree(cap_item, ett_hta_cap1_tree);
5975   proto_tree_add_uint(cap_tree, hf_ieee80211_hta_operating_mode, tvb, offset, 2,
5976              capability);
5977   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_non_gf_devices, tvb, offset, 2,
5978              capability);
5979
5980   offset += 2;
5981   tag_val_off += 2;
5982
5983   /* 2 byte HT additional capabilities */
5984   capability = tvb_get_letohs (tvb, offset);
5985   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_hta_cap, tvb,
5986                     offset, 2, capability,
5987                     "HT Additional Capabilities: 0x%04X", capability);
5988   cap_tree = proto_item_add_subtree(cap_item, ett_hta_cap2_tree);
5989   proto_tree_add_uint(cap_tree, hf_ieee80211_hta_basic_stbc_mcs, tvb, offset, 2,
5990              capability);
5991   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_dual_stbc_protection, tvb, offset, 2,
5992              capability);
5993   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_secondary_beacon, tvb, offset, 2,
5994              capability);
5995   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_lsig_txop_protection, tvb, offset, 2,
5996              capability);
5997   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_pco_active, tvb, offset, 2,
5998              capability);
5999   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_pco_phase, tvb, offset, 2,
6000              capability);
6001   offset += 2;
6002   tag_val_off += 2;
6003
6004   /* 16 byte Supported MCS set */
6005   dissect_mcs_set(tree, tvb, offset, FALSE, TRUE);
6006   offset += 16;
6007   tag_val_off += 16;
6008
6009    if (tag_val_off < tag_len)
6010      proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset,
6011                tag_len - tag_val_off, "Not interpreted");
6012 }
6013
6014 /* 802.11n-D1.10 and 802.11n-D2.0, 7.1.3.5a */
6015
6016 /*
6017  * 7.1.3.1.10 says:
6018  * "The Order field is 1 bit in length and is set to 1 in any non-QoS Data
6019  * frame that contains an MSDU, or fragment thereof, which is being
6020  * transferred using the StrictlyOrdered service class. The presence of the
6021  * HT Control field in frames is indicated by setting the Order field to 1
6022  * in any Data type or Management type frame that  is transmitted with a
6023  * value of HT_GF or HT_MM for the FORMAT parameter of the TXVECTOR except
6024  * a non-QoS Data frame or a Control Wrapper frame. The Order field is set
6025  * to 0 in all other frames. All non-HT QoS STAs set the Order field to 0."
6026  *
6027  * ...so does this mean that we can check for the presence of +HTC by
6028  * looking for QoS frames with the Order bit set, or do we need extra
6029  * information from the PHY (which would be monumentally silly)?
6030  *
6031  * At any rate, it doesn't look like any equipment we have produces
6032  * +HTC frames, so the code is completely untested.
6033  */
6034
6035 static void
6036 dissect_ht_control(proto_tree *tree, tvbuff_t * tvb, int offset)
6037 {
6038   proto_item *ti;
6039   proto_tree *htc_tree, *lac_subtree;
6040   guint16 htc;
6041
6042   htc = tvb_get_letohs(tvb, offset);
6043
6044   ti = proto_tree_add_item(tree, hf_ieee80211_htc, tvb, offset, 4, TRUE);
6045   htc_tree = proto_item_add_subtree(ti, ett_htc_tree);
6046
6047   /* Start: Link Adaptation Control */
6048   ti = proto_tree_add_item(htc_tree, hf_ieee80211_htc_lac, tvb, offset, 2, TRUE);
6049   lac_subtree = proto_item_add_subtree(ti, ett_htc_tree);
6050   proto_tree_add_item(lac_subtree, hf_ieee80211_htc_lac_reserved, tvb, offset, 1, htc);
6051   proto_tree_add_item(lac_subtree, hf_ieee80211_htc_lac_trq, tvb, offset, 1, TRUE);
6052
6053   if (HTC_IS_ASELI(htc)) {
6054     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mai_aseli, tvb, offset, 1, htc);
6055   } else {
6056     proto_tree_add_item(lac_subtree, hf_ieee80211_htc_lac_mai_mrq, tvb, offset, 1, TRUE);
6057     if (HTC_LAC_MAI_MRQ(htc)){
6058       proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mai_msi, tvb, offset, 1, htc);
6059     } else {
6060       proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mai_reserved, tvb, offset, 1, htc);
6061     }
6062   }
6063
6064   proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mfsi, tvb, offset, 2, htc);
6065   offset++;
6066
6067   if (HTC_IS_ASELI(htc)) {
6068     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_asel_command, tvb, offset, 1, htc);
6069     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_asel_data, tvb, offset, 1, htc);
6070   } else {
6071     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mfb, tvb, offset, 1, htc);
6072   }
6073   /* End: Link Adaptation Control */
6074
6075   offset++;
6076   htc = tvb_get_letohs(tvb, offset);
6077
6078   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_cal_pos, tvb, offset, 1, htc);
6079   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_cal_seq, tvb, offset, 1, htc);
6080   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_reserved1, tvb, offset, 1, htc);
6081   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_csi_steering, tvb, offset, 1, htc);
6082
6083   offset++;
6084   proto_tree_add_boolean(htc_tree, hf_ieee80211_htc_ndp_announcement, tvb, offset, 1, htc);
6085   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_reserved2, tvb, offset, 1, htc);
6086   proto_tree_add_boolean(htc_tree, hf_ieee80211_htc_ac_constraint, tvb, offset, 1, htc);
6087   proto_tree_add_boolean(htc_tree, hf_ieee80211_htc_rdg_more_ppdu, tvb, offset, 1, htc);
6088 }
6089
6090 static void
6091 dissect_frame_control(proto_tree * tree, tvbuff_t * tvb, gboolean wlan_broken_fc,
6092                       guint32 offset)
6093 {
6094   guint16 fcf, flags, frame_type_subtype;
6095   proto_tree *fc_tree, *flag_tree;
6096   proto_item *fc_item, *flag_item, *hidden_item;
6097
6098   fcf = FETCH_FCF(offset);
6099
6100   flags = FCF_FLAGS(fcf);
6101   frame_type_subtype = COMPOSE_FRAME_TYPE(fcf);
6102
6103   proto_tree_add_uint (tree, hf_ieee80211_fc_frame_type_subtype,
6104     tvb, wlan_broken_fc?offset+1:offset, 1,
6105     frame_type_subtype);
6106
6107   fc_item = proto_tree_add_uint_format (tree, hf_ieee80211_fc_field, tvb,
6108     offset, 2, fcf, "Frame Control: 0x%04X (%s)",
6109     fcf, wlan_broken_fc?"Swapped":"Normal");
6110
6111   fc_tree = proto_item_add_subtree (fc_item, ett_fc_tree);
6112
6113   proto_tree_add_uint (fc_tree, hf_ieee80211_fc_proto_version, tvb, wlan_broken_fc?offset+1:offset, 1,
6114     FCF_PROT_VERSION (fcf));
6115
6116   proto_tree_add_uint (fc_tree, hf_ieee80211_fc_frame_type, tvb, wlan_broken_fc?offset+1:offset, 1,
6117     FCF_FRAME_TYPE (fcf));
6118
6119   proto_tree_add_uint (fc_tree, hf_ieee80211_fc_frame_subtype, tvb, wlan_broken_fc?offset+1:offset, 1,
6120     FCF_FRAME_SUBTYPE (fcf));
6121
6122   flag_item = proto_tree_add_uint_format (fc_tree, hf_ieee80211_fc_flags, tvb,
6123     wlan_broken_fc?offset:offset+1, 1,
6124     flags, "Flags: 0x%X", flags);
6125
6126   flag_tree = proto_item_add_subtree (flag_item, ett_proto_flags);
6127   proto_tree_add_uint (flag_tree, hf_ieee80211_fc_data_ds, tvb, wlan_broken_fc?offset:offset+1, 1,
6128     FLAGS_DS_STATUS (flags));
6129   hidden_item = proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_to_ds, tvb, offset+1, 1, flags);
6130   PROTO_ITEM_SET_HIDDEN(hidden_item);
6131   hidden_item = proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_from_ds, tvb, offset+1, 1, flags);
6132   PROTO_ITEM_SET_HIDDEN(hidden_item);
6133   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_more_frag, tvb, wlan_broken_fc?offset:offset+1, 1,
6134     flags);
6135   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_retry, tvb, wlan_broken_fc?offset:offset+1, 1,
6136     flags);
6137   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_pwr_mgt, tvb, wlan_broken_fc?offset:offset+1, 1,
6138     flags);
6139   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_more_data, tvb, wlan_broken_fc?offset:offset+1, 1,
6140     flags);
6141   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_protected, tvb, wlan_broken_fc?offset:offset+1, 1,
6142     flags);
6143   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_order, tvb, wlan_broken_fc?offset:offset+1, 1,
6144     flags);
6145 }
6146
6147 static void
6148 dissect_vendor_ie_ht(proto_item * item, proto_tree * tree, tvbuff_t * tag_tvb)
6149 {
6150   gint tag_len = tvb_length(tag_tvb);
6151
6152   proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 0, 3, "802.11n (Pre) OUI");
6153   /* 802.11n OUI  Information Element */
6154   if (4 <= tag_len && !tvb_memeql(tag_tvb, 0, PRE_11N_OUI"\x33", 4)) {
6155     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 3, 1,"802.11n (Pre) HT information" );
6156
6157     dissect_ht_capability_ie(tree, tag_tvb, 4, tag_len - 4, TRUE);
6158     proto_item_append_text(item, ": HT Capabilities (802.11n D1.10)");
6159   }
6160   else {
6161     if (4 <= tag_len && !tvb_memeql(tag_tvb, 0, PRE_11N_OUI"\x34", 4)) {
6162       proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 3, 1, "HT additional information (802.11n D1.00)");
6163
6164       dissect_ht_info_ie_1_0(tree, tag_tvb, 4, tag_len - 4);
6165       proto_item_append_text(item, ": HT Additional Capabilities (802.11n D1.00)");
6166     }
6167     else {
6168         proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 3, 1, "Unknown type");
6169         proto_item_append_text(item, ": 802.11n (pre) Unknown type");
6170         proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 4,
6171                   tag_len - 4, "Not interpreted");
6172     }
6173   }
6174 }
6175
6176
6177 /* ************************************************************************* */
6178 /*           Dissect and add tagged (optional) fields to proto tree          */
6179 /* ************************************************************************* */
6180
6181
6182
6183 static const value_string environment_vals[] = {
6184   { 0x20, "Any" },
6185   { 0x4f, "Outdoor" },
6186   { 0x49, "Indoor" },
6187   { 0,    NULL }
6188 };
6189
6190 static int beacon_padding = 0; /* beacon padding bug */
6191 static int
6192 add_tagged_field(packet_info * pinfo, proto_tree * tree, tvbuff_t * tvb, int offset)
6193 {
6194   guint32 oui;
6195   tvbuff_t *tag_tvb;
6196   const guint8 *tag_data_ptr;
6197   guint32 tag_no, tag_len;
6198   int n, ret;
6199   char out_buff[SHORT_STR];
6200   char print_buff[SHORT_STR];
6201   proto_tree * orig_tree=tree;
6202   proto_item *ti = NULL, *ti_len = NULL;
6203   int tag_end;
6204   guint8 tag_len_len; /* The length of the length parameter in bytes*/
6205
6206   tag_no = tvb_get_guint8(tvb, offset);
6207 #ifndef MESH_OVERRIDES
6208   if(tag_no == TAG_WSIE){
6209     tag_len_len = 2;
6210     tag_len = tvb_get_letohl(tvb, offset + 1);
6211   } else
6212 #endif /* MESH_OVERRIDES */
6213   {
6214     tag_len_len = 1;
6215     tag_len = tvb_get_guint8(tvb, offset + 1);
6216   }
6217   tag_end = offset + 2 + tag_len;
6218   if (tree) {
6219     ti = proto_tree_add_item(orig_tree, hf_ieee80211_tag, tvb, offset, 2 + tag_len , FALSE);
6220     proto_item_append_text(ti, ": %s", rval_to_str(tag_no, tag_num_vals, "Reserved tag Number"));
6221
6222     tree = proto_item_add_subtree(ti, ett_80211_mgt_ie);
6223
6224     proto_tree_add_item(tree, hf_ieee80211_tag_number, tvb, offset, 1, FALSE);
6225
6226   }
6227   ti_len = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, tag_len_len, tag_len);
6228
6229   switch (tag_no)
6230   {
6231
6232     case TAG_SSID:  /* 7.3.2.1 SSID element (0) */
6233       if(beacon_padding == 0) /* padding bug */
6234       {
6235         guint8 *ssid; /* The SSID may consist of arbitrary bytes */
6236
6237         if(tag_len > MAX_SSID_LEN) {
6238           expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
6239                                  "SSID length (%u) greater than maximum (%u)",
6240                                  tag_len, MAX_SSID_LEN);
6241         }
6242
6243         ssid = tvb_get_ephemeral_string(tvb, offset + 2, tag_len);
6244 #ifdef HAVE_AIRPDCAP
6245         AirPDcapSetLastSSID(&airpdcap_ctx, (CHAR *) ssid, tag_len);
6246 #endif
6247         proto_tree_add_item(tree, hf_ieee80211_tag_ssid, tvb, offset + 2, tag_len, FALSE);
6248         if (tag_len > 0) {
6249           proto_item_append_text(ti, ": %s", ssid);
6250
6251           col_append_fstr(pinfo->cinfo, COL_INFO, ", SSID=%s", ssid );
6252
6253           /* Wlan Stats */
6254           memcpy(wlan_stats.ssid, ssid, MIN(tag_len, MAX_SSID_LEN));
6255           wlan_stats.ssid_len = tag_len;
6256         } else {
6257           proto_item_append_text(ti, ": Broadcast");
6258
6259           col_append_str(pinfo->cinfo, COL_INFO, ", SSID=Broadcast");
6260         }
6261
6262         beacon_padding++; /* padding bug */
6263       }
6264       break;
6265
6266     case TAG_SUPP_RATES: /* 7.3.2.2 Supported Rates element (1) */
6267     case TAG_EXT_SUPP_RATES:
6268       if(tag_len < 1)
6269       {
6270         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be greater than 0", tag_len);
6271         break;
6272       }
6273       offset += 2;
6274
6275       while(offset < tag_end)
6276       {
6277         proto_tree_add_item(tree, hf_ieee80211_tag_supp_rates, tvb, offset, 1, FALSE);
6278         proto_item_append_text(ti, " %s,", val_to_str(tvb_get_guint8(tvb, offset), ieee80211_supported_rates_vals, "Unknown Rate") );
6279         offset += 1;
6280       }
6281       proto_item_append_text(ti, " [Mbit/sec]");
6282       break;
6283
6284     case TAG_FH_PARAMETER: /* 7.3.2.3 FH Parameter Set element (2) */
6285       if(tag_len < 5)
6286       {
6287         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 5", tag_len);
6288         break;
6289       }
6290       offset += 2;
6291
6292       proto_tree_add_item(tree, hf_ieee80211_tag_fh_dwell_time, tvb, offset, 2, TRUE);
6293       offset += 2;
6294
6295       proto_tree_add_item(tree, hf_ieee80211_tag_fh_hop_set, tvb, offset, 1, TRUE);
6296       offset += 1;
6297
6298       proto_tree_add_item(tree, hf_ieee80211_tag_fh_hop_pattern, tvb, offset, 1, TRUE);
6299       offset += 1;
6300
6301       proto_tree_add_item(tree, hf_ieee80211_tag_fh_hop_index, tvb, offset, 1, TRUE);
6302       offset += 1;
6303       break;
6304
6305     case TAG_DS_PARAMETER: /* 7.3.2.4 DS Parameter Set element (3) */
6306       if(tag_len != 1)
6307       {
6308         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u wrong, must be = 1", tag_len);
6309         break;
6310       }
6311       offset += 2;
6312
6313       proto_tree_add_item(tree, hf_ieee80211_tag_ds_param_channel, tvb, offset , 1, FALSE);
6314
6315       proto_item_append_text(ti, " : Current Channel: %u", tvb_get_guint8(tvb, offset));
6316
6317       wlan_stats.channel = tvb_get_guint8(tvb, offset);
6318       break;
6319
6320     case TAG_CF_PARAMETER: /* 7.3.2.5 CF Parameter Set element (4) */
6321       if(tag_len != 6)
6322       {
6323         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u wrong, must be = 6", tag_len);
6324         break;
6325       }
6326       offset += 2;
6327
6328       proto_tree_add_item(tree, hf_ieee80211_tag_cfp_count, tvb, offset , 1, FALSE);
6329       proto_item_append_text(ti, ": CFP count %u", tvb_get_guint8(tvb, offset));
6330       offset += 1;
6331
6332       proto_tree_add_item(tree, hf_ieee80211_tag_cfp_period, tvb, offset , 1, FALSE);
6333       proto_item_append_text(ti, ": CFP Period %u", tvb_get_guint8(tvb, offset));
6334       offset += 1;
6335
6336       proto_tree_add_item(tree, hf_ieee80211_tag_cfp_max_duration, tvb, offset , 2, TRUE);
6337       proto_item_append_text(ti, ": CFP Max Duration %u", tvb_get_letohs(tvb, offset));
6338       offset += 2;
6339
6340       proto_tree_add_item(tree, hf_ieee80211_tag_cfp_dur_remaining, tvb, offset , 2, TRUE);
6341       proto_item_append_text(ti, ": CFP Dur Remaining %u", tvb_get_letohs(tvb, offset));
6342       offset += 2;
6343       break;
6344
6345     case TAG_TIM: /* 7.3.2.6 TIM (5) */
6346       {
6347       proto_tree *bmapctl_tree;
6348       proto_item *bmapctl_item;
6349       if (tag_len < 4)
6350       {
6351         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 4", tag_len);
6352         break;
6353       }
6354       offset += 2;
6355
6356       proto_tree_add_item(tree, hf_ieee80211_tim_dtim_count, tvb, offset, 1, TRUE);
6357       proto_item_append_text(ti, ": DTIM %u of", tvb_get_guint8(tvb, offset));
6358       offset += 1;
6359
6360       proto_tree_add_item(tree, hf_ieee80211_tim_dtim_period, tvb, offset, 1, TRUE);
6361       proto_item_append_text(ti, " %u bitmap", tvb_get_guint8(tvb, offset + 1));
6362       offset += 1;
6363
6364       bmapctl_item = proto_tree_add_item(tree, hf_ieee80211_tim_bmapctl, tvb, offset, 1, TRUE);
6365       bmapctl_tree = proto_item_add_subtree(bmapctl_item, ett_tag_bmapctl_tree);
6366       proto_tree_add_item(bmapctl_tree, hf_ieee80211_tim_bmapctl_mcast, tvb, offset, 1, TRUE);
6367       proto_tree_add_item(bmapctl_tree, hf_ieee80211_tim_bmapctl_offset, tvb, offset, 1, TRUE);
6368       offset += 1;
6369
6370       proto_tree_add_item(tree, hf_ieee80211_tim_partial_virtual_bitmap, tvb, offset, tag_len - 3, TRUE);
6371
6372     break;
6373     }
6374     case TAG_IBSS_PARAMETER: /* 7.3.2.7 IBSS Parameter Set element (6) */
6375       if(tag_len != 2)
6376       {
6377         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u wrong, must be = 2", tag_len);
6378         break;
6379       }
6380       offset += 2;
6381
6382       proto_tree_add_item(tree, hf_ieee80211_tag_ibss_atim_window, tvb, offset, 2, TRUE);
6383       proto_item_append_text(ti, ": ATIM window 0x%x", tvb_get_letohs(tvb, offset));
6384
6385       break;
6386     case TAG_COUNTRY_INFO: /* 7.3.2.9 Country information element (7) */
6387       {
6388         proto_tree *sub_tree;
6389         proto_item *sub_item;
6390         if (tag_len < 6)
6391         {
6392           expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 6", tag_len);
6393           break;
6394         }
6395         offset += 2;
6396
6397         proto_tree_add_item(tree, hf_ieee80211_tag_country_info_code, tvb, offset, 2, FALSE);
6398         proto_item_append_text(ti, ": Country Code %s", tvb_get_ephemeral_string(tvb, offset, 2));
6399         offset += 2;
6400
6401         proto_tree_add_item(tree, hf_ieee80211_tag_country_info_env, tvb, offset, 1, FALSE);
6402         proto_item_append_text(ti, ", Environment %s", val_to_str(tvb_get_guint8(tvb, offset), environment_vals,"Unknown (0x%02x)"));
6403         offset += 1;
6404
6405         while(offset < tag_end)
6406         {
6407           if(tvb_get_guint8(tvb, offset) <= 200) { /* 802.11d */
6408             sub_item = proto_tree_add_item(tree, hf_ieee80211_tag_country_info_fnm, tvb, offset, 3, FALSE);
6409             sub_tree = proto_item_add_subtree(sub_item, ett_tag_country_fnm_tree);
6410
6411             proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_fnm_fcn, tvb, offset, 1, FALSE);
6412             proto_item_append_text(sub_item, ": First Channel Number: %d", tvb_get_guint8(tvb, offset));
6413             offset += 1;
6414             proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_fnm_nc, tvb, offset, 1, FALSE);
6415             proto_item_append_text(sub_item, ", Number of Channels: %d", tvb_get_guint8(tvb, offset));
6416             offset += 1;
6417             proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_fnm_mtpl, tvb, offset, 1, FALSE);
6418             proto_item_append_text(sub_item, ", Maximum Transmit Power Level: %d dBm", tvb_get_guint8(tvb, offset));
6419             offset += 1;
6420           } else { /* 802.11j */
6421             sub_item = proto_tree_add_item(tree, hf_ieee80211_tag_country_info_rrc, tvb, offset, 3, FALSE);
6422             sub_tree = proto_item_add_subtree(sub_item, ett_tag_country_rcc_tree);
6423
6424             proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_rrc_rei, tvb, offset, 1, FALSE);
6425             proto_item_append_text(sub_item, ": Regulatory Extension Identifier: %d", tvb_get_guint8(tvb, offset));
6426             offset += 1;
6427             proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_rrc_rc, tvb, offset, 1, FALSE);
6428             proto_item_append_text(sub_item, ", Regulatory Class: %d", tvb_get_guint8(tvb, offset));
6429             offset += 1;
6430             proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_rrc_cc, tvb, offset, 1, FALSE);
6431             proto_item_append_text(sub_item, ", Coverage Class: %d", tvb_get_guint8(tvb, offset));
6432             offset += 1;
6433           }
6434
6435         }
6436
6437       }
6438       break;
6439
6440     case TAG_FH_HOPPING_PARAMETER: /* 7.3.2.10 Hopping Pattern Parameters information element (8) */
6441       if (tag_len < 2)
6442       {
6443         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 2", tag_len);
6444         break;
6445       }
6446       offset += 2;
6447
6448       proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_parameter_prime_radix, tvb, offset, 1, FALSE);
6449       proto_item_append_text(ti, ": Prime Radix: %u", tvb_get_guint8(tvb, offset));
6450       offset += 1;
6451
6452       proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_parameter_nb_channels, tvb, offset, 1, FALSE);
6453       proto_item_append_text(ti, ", Number of Channels: %u", tvb_get_guint8(tvb, offset));
6454       offset += 1;
6455       break;
6456
6457     case TAG_FH_HOPPING_TABLE: /* 7.3.2.11 Hopping Pattern Table information element (9) */
6458       if (tag_len < 4)
6459       {
6460         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 4", tag_len);
6461         break;
6462       }
6463       offset += 2;
6464
6465       proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_flag, tvb, offset, 1, FALSE);
6466       offset += 1;
6467
6468       proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_number_of_sets, tvb, offset, 1, FALSE);
6469       offset += 1;
6470
6471       proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_modulus, tvb, offset, 1, FALSE);
6472       offset += 1;
6473
6474       proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_offset, tvb, offset, 1, FALSE);
6475       offset += 1;
6476
6477       while(offset < tag_end )
6478       {
6479         proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_random_table, tvb, offset, 2, FALSE);
6480         offset += 2;
6481       }
6482       break;
6483
6484     case TAG_REQUEST: /* 7.3.2.12 Request information element (10) */
6485       while(offset < tag_end )
6486       {
6487         proto_tree_add_item(tree, hf_ieee80211_tag_request, tvb, offset, 1, FALSE);
6488         offset += 1;
6489       }
6490       break;
6491
6492     case TAG_QBSS_LOAD: /* 7.3.2.28 BSS Load element (11) */
6493       if (tag_len < 4 || tag_len >5)
6494       {
6495         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 4 or 5", tag_len);
6496         break;
6497       }
6498
6499       if (tag_len == 4)
6500       {
6501         /* QBSS Version 1 */
6502         proto_item_append_text(ti, " Cisco QBSS Version 1 - non CCA");
6503
6504         /* Extract Values */
6505         proto_tree_add_uint(tree, hf_ieee80211_qbss_version, tvb, offset + 2, tag_len, 1);
6506         proto_tree_add_item(tree, hf_ieee80211_qbss_scount, tvb, offset + 2, 2, TRUE);
6507         proto_tree_add_item(tree, hf_ieee80211_qbss_cu, tvb, offset + 4, 1, FALSE);
6508         proto_tree_add_item(tree, hf_ieee80211_qbss_adc, tvb, offset + 5, 1, FALSE);
6509       }
6510       else if (tag_len == 5)
6511       {
6512          /* QBSS Version 2 */
6513          proto_item_append_text(ti, " 802.11e CCA Version");
6514
6515          /* Extract Values */
6516          proto_tree_add_uint(tree, hf_ieee80211_qbss_version, tvb, offset + 2, tag_len, 2);
6517          proto_tree_add_item(tree, hf_ieee80211_qbss_scount, tvb, offset + 2, 2, TRUE);
6518          proto_tree_add_item(tree, hf_ieee80211_qbss_cu, tvb, offset + 4, 1, FALSE);
6519          proto_tree_add_item(tree, hf_ieee80211_qbss_adc, tvb, offset + 5, 2, TRUE);
6520       }
6521       break;
6522
6523     case TAG_TSPEC: /* 7.3.2.30 TSPEC element (13) */
6524       if (tag_len != 55)
6525       {
6526         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 55", tag_len);
6527         break;
6528       }
6529       offset += 2;
6530
6531       add_fixed_field(tree, tvb, offset, FIELD_QOS_TS_INFO);
6532       offset += 3;
6533
6534       proto_tree_add_item(tree, hf_ieee80211_tspec_nor_msdu, tvb, offset, 2, TRUE);
6535       offset += 2;
6536
6537       proto_tree_add_item(tree, hf_ieee80211_tspec_max_msdu, tvb, offset, 2, TRUE);
6538       offset += 2;
6539
6540       proto_tree_add_item(tree, hf_ieee80211_tspec_min_srv, tvb, offset, 4, TRUE);
6541       offset += 4;
6542
6543       proto_tree_add_item(tree, hf_ieee80211_tspec_max_srv, tvb, offset, 4, TRUE);
6544       offset += 4;
6545
6546       proto_tree_add_item(tree, hf_ieee80211_tspec_inact_int, tvb, offset, 4, TRUE);
6547       offset += 4;
6548
6549       proto_tree_add_item(tree, hf_ieee80211_tspec_susp_int, tvb, offset, 4, TRUE);
6550       offset += 4;
6551
6552       proto_tree_add_item(tree, hf_ieee80211_tspec_srv_start, tvb, offset, 4, TRUE);
6553       offset += 4;
6554
6555       proto_tree_add_item(tree, hf_ieee80211_tspec_min_data, tvb, offset, 4, TRUE);
6556       offset += 4;
6557
6558       proto_tree_add_item(tree, hf_ieee80211_tspec_mean_data, tvb, offset, 4, TRUE);
6559       offset += 4;
6560
6561       proto_tree_add_item(tree, hf_ieee80211_tspec_peak_data, tvb, offset, 4, TRUE);
6562       offset += 4;
6563
6564       proto_tree_add_item(tree, hf_ieee80211_tspec_burst_size, tvb, offset, 4, TRUE);
6565       offset += 4;
6566
6567       proto_tree_add_item(tree, hf_ieee80211_tspec_delay_bound, tvb, offset, 4, TRUE);
6568       offset += 4;
6569
6570       proto_tree_add_item(tree, hf_ieee80211_tspec_min_phy, tvb, offset, 4, TRUE);
6571       offset += 4;
6572
6573       proto_tree_add_item(tree, hf_ieee80211_tspec_surplus, tvb, offset, 2, TRUE);
6574       offset += 2;
6575
6576       proto_tree_add_item(tree, hf_ieee80211_tspec_medium, tvb, offset, 2, TRUE);
6577       offset += 2;
6578
6579       break;
6580
6581     case TAG_TCLAS: /* 7.3.2.31 TCLAS element (14) */
6582       if (tag_len < 6)
6583       {
6584         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 6", tag_len);
6585         break;
6586       }
6587       {
6588       guint8 type;
6589       guint8 version;
6590
6591       offset += 2;
6592       proto_tree_add_item(tree, hf_ieee80211_tclas_up, tvb, offset, 1, TRUE);
6593       type = tvb_get_guint8(tvb, offset);
6594       offset += 1;
6595
6596       proto_tree_add_item(tree, hf_ieee80211_tclas_class_type, tvb, offset, 1, TRUE);
6597       offset += 1;
6598
6599       proto_tree_add_item(tree, hf_ieee80211_tclas_class_mask, tvb, offset, 1, TRUE);
6600       offset += 1;
6601
6602       switch (type)
6603         {
6604           case 0:
6605             proto_tree_add_item(tree, hf_ieee80211_tclas_src_mac_addr, tvb, offset, 6, TRUE);
6606             offset += 6;
6607
6608             proto_tree_add_item(tree, hf_ieee80211_tclas_dst_mac_addr, tvb, offset, 6, TRUE);
6609             offset += 6;
6610
6611             proto_tree_add_item(tree, hf_ieee80211_tclas_ether_type, tvb, offset, 2, TRUE);
6612             offset += 2;
6613             break;
6614
6615           case 1:
6616             version = tvb_get_guint8(tvb, offset + 5);
6617             proto_tree_add_item(tree, hf_ieee80211_tclas_version, tvb, offset + 5, 1, TRUE);
6618             offset += 1;
6619             if (version == 4)
6620             {
6621               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv4_src, tvb, offset, 4, FALSE);
6622               offset += 4;
6623               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv4_dst, tvb, offset, 4, FALSE);
6624               offset += 4;
6625               proto_tree_add_item(tree, hf_ieee80211_tclas_src_port, tvb, offset, 2, FALSE);
6626               offset += 2;
6627               proto_tree_add_item(tree, hf_ieee80211_tclas_dst_port, tvb, offset, 2, FALSE);
6628               offset += 2;
6629               proto_tree_add_item(tree, hf_ieee80211_tclas_dscp, tvb, offset, 1, FALSE);
6630               offset += 1;
6631               proto_tree_add_item(tree, hf_ieee80211_tclas_protocol, tvb, offset, 1, FALSE);
6632               offset += 1;
6633             }
6634             else if (version == 6)
6635             {
6636               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv6_src, tvb, offset, 16, FALSE);
6637               offset += 16;
6638               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv6_dst, tvb, offset, 16, FALSE);
6639               offset += 16;
6640               proto_tree_add_item(tree, hf_ieee80211_tclas_src_port, tvb, offset, 2, FALSE);
6641               offset += 2;
6642               proto_tree_add_item(tree, hf_ieee80211_tclas_dst_port, tvb, offset, 2, FALSE);
6643               offset += 2;
6644               proto_tree_add_item(tree, hf_ieee80211_tclas_flow, tvb, offset, 3, FALSE);
6645               offset += 3;
6646             }
6647             break;
6648
6649           case 2:
6650             proto_tree_add_item(tree, hf_ieee80211_tclas_tag_type, tvb, offset, 2, TRUE);
6651             offset += 2;
6652             break;
6653
6654           default:
6655             break;
6656         }
6657       }
6658       break;
6659
6660     case TAG_SCHEDULE: /* 7.3.2.34 Schedule element (15) */
6661       if (tag_len != 14)
6662       {
6663         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 14", tag_len);
6664         break;
6665       }
6666       offset += 2;
6667
6668       add_fixed_field(tree, tvb, offset, FIELD_SCHEDULE_INFO);
6669       offset += 2;
6670
6671       proto_tree_add_item(tree, hf_ieee80211_sched_srv_start, tvb, offset, 4, TRUE);
6672       offset += 4;
6673
6674       proto_tree_add_item(tree, hf_ieee80211_sched_srv_int, tvb, offset, 4, TRUE);
6675       offset += 4;
6676
6677       proto_tree_add_item(tree, hf_ieee80211_sched_spec_int, tvb, offset, 2, TRUE);
6678       offset += 2;
6679       break;
6680
6681     case TAG_CHALLENGE_TEXT: /* 7.3.2.8 Challenge Text element (16) */
6682       offset += 2;
6683       proto_tree_add_item(tree, hf_ieee80211_tag_challenge_text, tvb, offset, tag_len, FALSE);
6684       break;
6685
6686     case TAG_POWER_CONSTRAINT: /* 7.3.2.15 Power Constraint element (32) */
6687     {
6688       if (tag_len != 1)
6689       {
6690         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
6691         break;
6692       }
6693       offset += 2;
6694
6695       proto_tree_add_item(tree, hf_ieee80211_tag_power_constraint_local, tvb, offset, 1, TRUE);
6696       proto_item_append_text(ti, " :%d", tvb_get_guint8(tvb, offset));
6697       offset += 1;
6698
6699       break;
6700     }
6701
6702     case TAG_POWER_CAPABILITY: /* 7.3.2.16 Power Capability element (33) */
6703     {
6704       if (tag_len != 2)
6705       {
6706         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 2", tag_len);
6707         break;
6708       }
6709       offset += 2;
6710
6711       proto_tree_add_item(tree, hf_ieee80211_tag_power_capability_min, tvb, offset, 1, TRUE);
6712       proto_item_append_text(ti, " Min: %d", tvb_get_guint8(tvb, offset));
6713       offset += 1;
6714
6715       proto_tree_add_item(tree, hf_ieee80211_tag_power_capability_max, tvb, offset, 1, TRUE);
6716       proto_item_append_text(ti, ", Max :%d", tvb_get_guint8(tvb, offset));
6717       offset += 1;
6718       break;
6719     }
6720
6721     case TAG_TPC_REQUEST: /* 7.3.2.18 TPC Request element (34) */
6722     {
6723       if (tag_len != 0)
6724       {
6725         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 0", tag_len);
6726         break;
6727       }
6728       offset += 2;
6729
6730       /* No Data */
6731       break;
6732     }
6733
6734     case TAG_TPC_REPORT: /* 7.3.2.18 TPC Report element (35) */
6735     {
6736       if (tag_len != 2)
6737       {
6738         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 2", tag_len);
6739         break;
6740       }
6741       offset += 2;
6742
6743       proto_tree_add_item(tree, hf_ieee80211_tag_tpc_report_trsmt_pow, tvb, offset, 1, TRUE);
6744       proto_item_append_text(ti, " Transmit Power :%d", tvb_get_guint8(tvb, offset));
6745       offset += 1;
6746
6747       proto_tree_add_item(tree, hf_ieee80211_tag_tpc_report_link_mrg, tvb, offset, 1, TRUE);
6748       proto_item_append_text(ti, ", Link Margin :%d", tvb_get_guint8(tvb, offset));
6749       offset += 1;
6750
6751       break;
6752     }
6753
6754     case TAG_SUPPORTED_CHANNELS: /* 7.3.2.19 Supported Channels element (36) */
6755       {
6756         proto_item *chan_item;
6757         proto_tree *chan_tree;
6758         guint i=1;
6759
6760         offset += 2;
6761         if (tag_len % 2 == 1) {
6762            expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u must be even",tag_len);
6763            break;
6764         }
6765         while(offset < tag_end)
6766         {
6767           chan_item = proto_tree_add_item(tree, hf_ieee80211_tag_supported_channels, tvb, offset, 2, FALSE);
6768           proto_item_append_text(chan_item, " #%d", i);
6769           i++;
6770
6771           chan_tree = proto_item_add_subtree(chan_item , ett_tag_supported_channels);
6772
6773           proto_tree_add_item(chan_tree, hf_ieee80211_tag_supported_channels_first, tvb, offset, 1, TRUE);
6774           proto_item_append_text(chan_item, " First: %d", tvb_get_guint8(tvb, offset));
6775           offset += 1;
6776
6777           proto_tree_add_item(chan_tree, hf_ieee80211_tag_supported_channels_range, tvb, offset, 1, TRUE);
6778           proto_item_append_text(chan_item, ", Range: %d ", tvb_get_guint8(tvb, offset));
6779           offset += 1;
6780
6781         }
6782         break;
6783       }
6784     case TAG_CHANNEL_SWITCH_ANN: /* 7.3.2.20 Channel Switch Announcement element (37) */
6785     {
6786       if (tag_len != 3)
6787       {
6788         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 3", tag_len);
6789         break;
6790       }
6791       offset += 2;
6792
6793       proto_tree_add_item(tree, hf_ieee80211_csa_channel_switch_mode, tvb, offset, 1, TRUE);
6794       proto_item_append_text(ti, " Mode: %d", tvb_get_guint8(tvb, offset));
6795       offset += 1;
6796
6797       proto_tree_add_item(tree, hf_ieee80211_csa_new_channel_number, tvb, offset, 1, TRUE);
6798       proto_item_append_text(ti, ", Number: %d ", tvb_get_guint8(tvb, offset));
6799       offset += 1;
6800
6801       proto_tree_add_item(tree, hf_ieee80211_csa_channel_switch_count, tvb, offset, 1, TRUE);
6802       proto_item_append_text(ti, ", Count: %d ", tvb_get_guint8(tvb, offset));
6803       offset += 1;
6804     }
6805
6806     case TAG_MEASURE_REQ: /* 7.3.2.21 Measurement Request element (38) with update from 802.11k-2008 */
6807       if (tag_len < 3)
6808       {
6809         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 3", tag_len);
6810         break;
6811       }
6812       {
6813         guint8 request_type;
6814         guint tag_offset;
6815         proto_item *parent_item;
6816         proto_tree *sub_tree;
6817
6818         offset += 2;
6819         tag_offset = offset;
6820
6821         proto_tree_add_item(tree, hf_ieee80211_tag_measure_request_token, tvb, offset, 1, ENC_NA);
6822         offset += 1;
6823
6824         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_request_mode, tvb, offset, 1, ENC_NA);
6825         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_request_mode_tree);
6826         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_parallel, tvb, offset, 1, ENC_NA);
6827         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_enable, tvb, offset, 1, ENC_NA);
6828         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_request, tvb, offset, 1, ENC_NA);
6829         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_report, tvb, offset, 1, ENC_NA);
6830         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_duration_mandatory, tvb, offset, 1, ENC_NA);
6831         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_reserved, tvb, offset, 1, ENC_NA);
6832         offset += 1;
6833
6834
6835         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_request_type, tvb, offset, 1, ENC_NA);
6836         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_request_type_tree);
6837         request_type = tvb_get_guint8 (tvb, offset);
6838         offset += 1;
6839
6840         switch(request_type) {
6841           case 0: /* Basic Request */
6842           case 1: /* Clear channel assessment (CCA) request */
6843           case 2: /* Receive power indication (RPI) histogram request */
6844           {
6845
6846             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
6847             offset += 1;
6848
6849             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
6850             offset += 8;
6851
6852             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6853             offset += 2;
6854             break;
6855           }
6856           case 3: /* Channel Load Request */
6857           case 4: /* Noise Histogram Request */
6858           {
6859             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_regulatory_class, tvb, offset, 1, ENC_NA);
6860             offset += 1;
6861
6862             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
6863             offset += 1;
6864
6865             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6866             offset += 2;
6867
6868             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6869             offset += 2;
6870             /* TODO Add Optionnal Subelements */
6871             break;
6872           }
6873           case 5: /* Beacon Request */
6874           {
6875             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_regulatory_class, tvb, offset, 1, ENC_NA);
6876             offset += 1;
6877
6878             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
6879             offset += 1;
6880
6881             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6882             offset += 2;
6883
6884             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6885             offset += 2;
6886
6887             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_measurement_mode, tvb, offset, 1, ENC_NA);
6888             offset += 1;
6889
6890             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_bssid, tvb, offset, 6, ENC_NA);
6891             offset += 6;
6892
6893             while(offset < tag_end)
6894             {
6895               guint8 sub_id, sub_length, sub_tag_end;
6896               proto_item *ti;
6897               proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_id, tvb, offset, 1, ENC_NA);
6898               sub_id = tvb_get_guint8(tvb, offset);
6899               offset += 1;
6900
6901               proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_subelement_length, tvb, offset, 1, ENC_NA);
6902               sub_length = tvb_get_guint8(tvb, offset);
6903               offset += 1;
6904               sub_tag_end = offset + sub_length;
6905
6906               switch(sub_id){
6907                 case MEASURE_REQ_BEACON_SUB_SSID: /* SSID (0) */
6908                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_ssid, tvb, offset, sub_length, FALSE);
6909                   offset += sub_length;
6910                   break;
6911                 case MEASURE_REQ_BEACON_SUB_BRI: /* Beacon Reporting Information (1) */
6912                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition, tvb, offset, 1, FALSE);
6913                   offset += 1;
6914                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_bri_threshold_offset, tvb, offset, 1, FALSE);
6915                   offset += 1;
6916                   break;
6917                 case MEASURE_REQ_BEACON_SUB_RD: /* Reporting Detail (2) */
6918                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_reporting_detail, tvb, offset, 1, FALSE);
6919                   offset += 1;
6920                   break;
6921                 case MEASURE_REQ_BEACON_SUB_REQUEST: /* Request (10) */
6922                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_request, tvb, offset, 1, FALSE);
6923                   offset += 1;
6924                   break;
6925                 case MEASURE_REQ_BEACON_SUB_APCP: /* Request (51) */
6926                   /* TODO */
6927                   break;
6928                 default:
6929                   /* no default action */
6930                   break;
6931              }
6932              if(offset < sub_tag_end)
6933              {
6934                 ti = proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_unknown, tvb, offset, sub_tag_end - offset, ENC_NA);
6935                 expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, " Unknown Data (not interpreted)");
6936                 offset = sub_tag_end;
6937              }
6938             }
6939
6940             break;
6941           }
6942           case 6: /* Frame Request */
6943           {
6944             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_regulatory_class, tvb, offset, 1, ENC_NA);
6945             offset += 1;
6946
6947             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
6948             offset += 1;
6949
6950             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6951             offset += 2;
6952
6953             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6954             offset += 2;
6955
6956             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_frame_request_type, tvb, offset, 1, ENC_NA);
6957             offset += 1;
6958
6959             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mac_address, tvb, offset, 6, ENC_NA);
6960             offset += 6;
6961
6962             /* TODO Add Optionnal Subelements */
6963             break;
6964           }
6965           case 7: /* BSTA Statistics Request */
6966           {
6967             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_peer_mac_address, tvb, offset, 6, ENC_NA);
6968             offset += 6;
6969
6970             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6971             offset += 2;
6972
6973             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6974             offset += 2;
6975
6976             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_group_id, tvb, offset, 1, ENC_NA);
6977             offset += 1;
6978
6979             /* TODO Add Optionnal Subelements */
6980             break;
6981           }
6982           case 8: /* Location Configuration Indication (LCI) Request */
6983             /* TODO */
6984           case 9: /* Transmit Stream Measurement Request */
6985             /* TODO */
6986           case 255: /* Measurement Pause Request*/
6987             /* TODO */
6988           default: /* unknown */
6989             break;
6990         }
6991       }
6992
6993       break;
6994     case TAG_MEASURE_REP: /* 7.3.2.22 Measurement Report element (39) with update from 802.11k-2008 */
6995       if (tag_len < 3)
6996       {
6997         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 3", tag_len);
6998         break;
6999       }
7000       {
7001         proto_item *parent_item;
7002         proto_tree *sub_tree;
7003         guint8 report_type;
7004
7005         offset += 2;
7006         proto_tree_add_item(tree, hf_ieee80211_tag_measure_report_measurement_token, tvb, offset, 1, ENC_NA);
7007         offset += 1;
7008
7009         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_report_mode, tvb, offset, 1, ENC_NA);
7010         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_report_mode_tree);
7011         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_late, tvb, offset, 1, ENC_NA);
7012         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_incapable, tvb, offset, 1, ENC_NA);
7013         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_refused, tvb, offset, 1, ENC_NA);
7014         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_reserved, tvb, offset, 1, ENC_NA);
7015         offset += 1;
7016
7017         report_type = tvb_get_guint8(tvb, offset);
7018         parent_item = proto_tree_add_uint(tree, hf_ieee80211_tag_measure_report_type, tvb, offset, 1, ENC_NA);
7019         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_report_type_tree);
7020         offset += 1;
7021
7022         if (tag_len == 3)
7023             break;
7024         switch (report_type) {
7025           case 0: /* Basic Report */
7026           {
7027             proto_tree *sub_tree_map_field;
7028
7029             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
7030             offset += 1;
7031
7032             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
7033             offset += 8;
7034
7035             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7036             offset += 2;
7037
7038
7039             parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_basic_map_field, tvb, offset, 1, ENC_NA);
7040             sub_tree_map_field = proto_item_add_subtree(parent_item, ett_tag_measure_report_basic_map_tree);
7041             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_bss, tvb, offset, 1, ENC_NA);
7042             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_odfm, tvb, offset, 1, ENC_NA);
7043             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_unident_signal, tvb, offset, 1, ENC_NA);
7044             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_radar, tvb, offset, 1, ENC_NA);
7045             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_unmeasured, tvb, offset, 1, ENC_NA);
7046             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_reserved, tvb, offset, 1, ENC_NA);
7047             break;
7048           }
7049           case 1: /* Clear channel assessment (CCA) report */
7050             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
7051             offset += 1;
7052
7053             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
7054             offset += 8;
7055
7056             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7057             offset += 2;
7058
7059             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_cca_busy_fraction, tvb, offset, 1, ENC_NA);
7060             offset += 1;
7061             break;
7062           case 2: /* Receive power indication (RPI) histogram report */
7063             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
7064             offset += 1;
7065
7066             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
7067             offset += 8;
7068
7069             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7070             offset += 2;
7071
7072             parent_item = proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report, tvb, offset, 8, ENC_NA);
7073             sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_report_rpi_tree);
7074
7075             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_0, tvb, offset, 1, ENC_NA);
7076             offset += 1;
7077
7078             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_1, tvb, offset, 1, ENC_NA);
7079             offset += 1;
7080
7081             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_2, tvb, offset, 1, ENC_NA);
7082             offset += 1;
7083
7084             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_3, tvb, offset, 1, ENC_NA);
7085             offset += 1;
7086
7087             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_4, tvb, offset, 1, ENC_NA);
7088             offset += 1;
7089
7090             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_5, tvb, offset, 1, ENC_NA);
7091             offset += 1;
7092
7093             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_6, tvb, offset, 1, ENC_NA);
7094             offset += 1;
7095
7096             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_7, tvb, offset, 1, ENC_NA);
7097             offset += 1;
7098             break;
7099           case 3: /* Channel Load Report */
7100           {
7101             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
7102             offset += 1;
7103
7104             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
7105             offset += 1;
7106
7107             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
7108             offset += 8;
7109
7110             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7111             offset += 2;
7112
7113             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_load, tvb, offset, 1, ENC_NA);
7114             offset += 1;
7115
7116             /* TODO Add Optionnal Subelements */
7117             break;
7118           }
7119           case 4: /* Noise Histogram Report */
7120             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
7121             offset += 1;
7122
7123             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
7124             offset += 1;
7125
7126             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
7127             offset += 8;
7128
7129             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7130             offset += 2;
7131
7132             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ant_id, tvb, offset, 1, ENC_NA);
7133             offset += 1;
7134
7135             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_anpi, tvb, offset, 1, ENC_NA);
7136             offset += 1;
7137
7138             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_0, tvb, offset, 1, ENC_NA);
7139             offset += 1;
7140
7141             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_1, tvb, offset, 1, ENC_NA);
7142             offset += 1;
7143
7144             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_2, tvb, offset, 1, ENC_NA);
7145             offset += 1;
7146
7147             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_3, tvb, offset, 1, ENC_NA);
7148             offset += 1;
7149
7150             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_4, tvb, offset, 1, ENC_NA);
7151             offset += 1;
7152
7153             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_5, tvb, offset, 1, ENC_NA);
7154             offset += 1;
7155
7156             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_6, tvb, offset, 1, ENC_NA);
7157             offset += 1;
7158
7159             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_7, tvb, offset, 1, ENC_NA);
7160             offset += 1;
7161
7162             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_8, tvb, offset, 1, ENC_NA);
7163             offset += 1;
7164
7165             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_9, tvb, offset, 1, ENC_NA);
7166             offset += 1;
7167
7168             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_10, tvb, offset, 1, ENC_NA);
7169             offset += 1;
7170
7171             /* TODO Add Optionnal Subelements */
7172             break;
7173           case 5: /* Beacon Report */
7174           {
7175             proto_tree *sub_tree_frame_info;
7176
7177             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
7178             offset += 1;
7179
7180             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
7181             offset += 1;
7182
7183             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
7184             offset += 8;
7185
7186             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7187             offset += 2;
7188
7189             parent_item = proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_frame_info, tvb, offset, 1, ENC_NA);
7190             sub_tree_frame_info = proto_item_add_subtree(parent_item, ett_tag_measure_report_frame_tree);
7191             proto_tree_add_item(sub_tree_frame_info, hf_ieee80211_tag_measure_report_frame_info_phy_type, tvb, offset, 1, ENC_NA);
7192             proto_tree_add_item(sub_tree_frame_info, hf_ieee80211_tag_measure_report_frame_info_frame_type, tvb, offset, 1, ENC_NA);
7193             offset += 1;
7194
7195             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_rcpi, tvb, offset, 1, ENC_NA);
7196             offset += 1;
7197
7198             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_rsni, tvb, offset, 1, ENC_NA);
7199             offset += 1;
7200
7201             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_bssid, tvb, offset, 6, ENC_NA);
7202             offset += 6;
7203
7204             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ant_id, tvb, offset, 1, ENC_NA);
7205             offset += 1;
7206
7207             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_parent_tsf, tvb, offset, 4, ENC_LITTLE_ENDIAN);
7208             offset += 4;
7209             /* TODO Add Optionnal Subelements */
7210             break;
7211           }
7212           case 6: /* Frame Report */
7213             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
7214             offset += 1;
7215
7216             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
7217             offset += 1;
7218
7219             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
7220             offset += 8;
7221
7222             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7223             offset += 2;
7224
7225             /* TODO Add Optionnal Subelements */
7226             break;
7227           case 7: /* BSTA Statistics Report */
7228             /* TODO */
7229           case 8: /* Location Configuration Information Report element */
7230             /* TODO */
7231           case 9: /* Transmit Stream Measurement Report */
7232             /* TODO */
7233           default: /* unknown */
7234             break;
7235         }
7236       }
7237     case TAG_TCLAS_PROCESS:
7238       if (tag_len != 1)
7239       {
7240         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
7241         break;
7242       }
7243       offset += 2;
7244
7245       proto_tree_add_item(tree, hf_ieee80211_tclass_process, tvb, offset, 1, TRUE);
7246       break;
7247
7248     case TAG_ERP_INFO:
7249     case TAG_ERP_INFO_OLD:
7250       {
7251         guint8 erp_info;
7252
7253         if (tag_len < 1)
7254         {
7255           proto_tree_add_text (tree, tvb, offset + 2, tag_len, "Tag length %u too short, must be >= 1",
7256                                tag_len);
7257           break;
7258         }
7259         erp_info = tvb_get_guint8 (tvb, offset + 2);
7260         g_snprintf (print_buff, SHORT_STR, "%sNon-ERP STAs, %suse protection, %s preambles",
7261                   erp_info & 0x01 ? "" : "no ",
7262                   erp_info & 0x02 ? "" : "do not ",
7263                   /* 802.11g, 7.3.2.13: 1 means "one or more ... STAs
7264                    * are not short preamble capable" */
7265                   erp_info & 0x04 ? "long": "short or long");
7266         g_snprintf (out_buff, SHORT_STR,
7267                   "ERP info: 0x%x (%s)",erp_info,print_buff);
7268         proto_tree_add_string (tree, hf_ieee80211_tag_interpretation, tvb, offset + 2,
7269                                tag_len, out_buff);
7270         proto_item_append_text(ti, ": %s", print_buff);
7271       }
7272       break;
7273
7274     case TAG_TS_DELAY:
7275       if (tag_len != 4)
7276       {
7277         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
7278             "TS_DELAY tag length %u != 4", tag_len);
7279         break;
7280       }
7281       proto_tree_add_item(tree, hf_ieee80211_ts_delay, tvb, offset + 2, 4, TRUE);
7282       break;
7283
7284     case TAG_CISCO_CCX1_CKIP:
7285       /* From WCS manual:
7286        * If Aironet IE support is enabled, the access point sends an Aironet
7287        * IE 0x85 (which contains the access point name, load, number of
7288        * associated clients, and so on) in the beacon and probe responses of
7289        * this WLAN, and the controller sends Aironet IEs 0x85 and 0x95
7290        * (which contains the management IP address of the controller and
7291        * the IP address of the access point) in the reassociation response
7292        * if it receives Aironet IE 0x85 in the reassociation request.
7293        */
7294
7295       /* The Name of the sending device starts at offset 10 and is up to
7296          15 or 16 bytes in length, \0 padded */
7297       if (tag_len < 26)
7298       {
7299         proto_tree_add_text (tree, tvb, offset + 2, tag_len, "Tag length %u too short, must be >= 26",
7300                              tag_len);
7301         break;
7302       }
7303       /* A cisco AP transmits the first 15 bytes of the AP name, probably
7304          followed by '\0' for ASCII termination */
7305       g_snprintf (out_buff, SHORT_STR, "%.16s",
7306                 tvb_format_stringzpad(tvb, offset + 12, 16));
7307       proto_tree_add_string_format (tree, hf_ieee80211_tag_interpretation, tvb, offset + 2,
7308            tag_len, "", "Tag interpretation: Unknown + Name: %s #Clients: %u",
7309            out_buff,
7310            /* Total number off associated clients and repeater access points */
7311            tvb_get_guint8(tvb, offset + 28));
7312       col_append_fstr(pinfo->cinfo, COL_INFO, ", Name=\"%s\"", out_buff);
7313       break;
7314
7315 /* Std 802.11-2007
7316  * 7.3.2.26 Vendor Specific information element
7317  * The
7318  * information element is in the format shown in Figure 7-75 and requires that the first 3 octets of the
7319  * information field contain the OUI of the entity that has defined the content of the particular Vendor Specific
7320  * information element. The length of the information field (n) is 3 >= n =< 255. The OUI field shall be a public
7321  * OUI assigned by the IEEE. It is 3 octets in length. The length of the vendor-specific content is n-3 octets.
7322  *
7323  *          Element ID Length OUI Vendor-specific content
7324  * Octets   1          1      3    n-3
7325  */
7326
7327     case TAG_VENDOR_SPECIFIC_IE:
7328       tvb_ensure_bytes_exist (tvb, offset + 2, tag_len);
7329       if (tag_len >= 3) {
7330         oui = tvb_get_ntoh24(tvb, offset + 2);
7331         tag_tvb = tvb_new_subset(tvb, offset + 2, tag_len, tag_len);
7332         tag_data_ptr = tvb_get_ptr(tag_tvb, 0, 3);
7333         proto_tree_add_bytes_format (tree, hf_ieee80211_tag_oui, tvb, offset + 2, 3,
7334           tag_data_ptr, "Vendor: %s", get_manuf_name(tag_data_ptr));
7335         proto_item_append_text(ti, ": %s", get_manuf_name(tag_data_ptr));
7336         if (tag_len > 3) {
7337           proto_tree_add_item(ti, hf_ieee80211_tag_vendor_oui_type, tag_tvb,
7338                               3, 1, FALSE);
7339         }
7340
7341 #define WPAWME_OUI  0x0050F2
7342 #define RSNOUI_VAL  0x000FAC
7343 #define PRE11N_OUI  0x00904c
7344
7345       switch (oui) {
7346         case WPAWME_OUI:
7347           dissect_vendor_ie_wpawme(ti, tree, tag_tvb);
7348           break;
7349         case RSNOUI_VAL:
7350           dissect_vendor_ie_rsn(ti, tree, tag_tvb);
7351           break;
7352         case OUI_CISCOWL:  /* Cisco Wireless (Aironet) */
7353           dissect_vendor_ie_aironet(ti, tree, tvb, offset + 5, tag_len - 3);
7354           break;
7355         case PRE11N_OUI:
7356           dissect_vendor_ie_ht(ti, tree, tag_tvb);
7357           break;
7358         case OUI_MARVELL:
7359           dissect_vendor_ie_marvell(ti, tree, tvb, offset + 5, tag_len - 3);
7360           break;
7361         case OUI_WFA:
7362           dissect_vendor_ie_wfa(pinfo, ti, tag_tvb);
7363           break;
7364         case OUI_ATHEROS:
7365           dissect_vendor_ie_atheros(ti, tree, tvb, offset + 5, tag_len, pinfo, tag_end, ti_len);
7366           break;
7367         default:
7368           proto_tree_add_string (tree, hf_ieee80211_tag_interpretation, tvb, offset + 5,
7369             tag_len - 3, "Not interpreted");
7370           break;
7371         }
7372
7373       }
7374       break;
7375
7376     case TAG_RSN_IE:
7377       /* Add Expert Info to check tag_len ? */
7378       dissect_rsn_ie(tree, tvb, offset + 2, tag_len);
7379       break;
7380
7381     case TAG_MOBILITY_DOMAIN:
7382       dissect_mobility_domain(tree, tvb, offset + 2, tag_len);
7383       break;
7384
7385 #ifndef MESH_OVERRIDES
7386     case TAG_FAST_BSS_TRANSITION:
7387       dissect_fast_bss_transition(tree, tvb, offset + 2, tag_len);
7388       break;
7389 #endif /* MESH_OVERRIDES */
7390
7391     case TAG_MMIE:
7392       dissect_mmie(tree, tvb, offset + 2, tag_len);
7393       break;
7394
7395     case TAG_TIMEOUT_INTERVAL:
7396       dissect_timeout_interval(tree, tvb, offset + 2, tag_len);
7397       break;
7398
7399     case TAG_LINK_IDENTIFIER:
7400       dissect_link_identifier(tree, tvb, offset + 2, tag_len);
7401       break;
7402
7403     case TAG_WAKEUP_SCHEDULE:
7404       dissect_wakeup_schedule(tree, tvb, offset + 2, tag_len);
7405       break;
7406
7407     case TAG_CHANNEL_SWITCH_TIMING:
7408       dissect_channel_switch_timing(tree, tvb, offset + 2, tag_len);
7409       break;
7410
7411     case TAG_PTI_CONTROL:
7412       dissect_pti_control(tree, tvb, offset + 2, tag_len);
7413       break;
7414
7415     case TAG_PU_BUFFER_STATUS:
7416       dissect_pu_buffer_status(tree, tvb, offset + 2, tag_len);
7417       break;
7418
7419     case TAG_HT_CAPABILITY:
7420       dissect_ht_capability_ie(tree, tvb, offset + 2, tag_len, FALSE);
7421       break;
7422
7423     case TAG_HT_INFO:
7424       dissect_ht_info_ie_1_1(tree, tvb, offset + 2, tag_len);
7425       break;
7426     case TAG_SECONDARY_CHANNEL_OFFSET:
7427       secondary_channel_offset_ie(tree, tvb, offset + 2, tag_len);
7428       break;
7429
7430 #ifndef MESH_OVERRIDES
7431     /***  Begin: WAVE Service information element Dissection - IEEE 802.11p Draft 4.0 ***/
7432     case TAG_WSIE:
7433       dissect_wsie_ie(tree, tvb, offset + 3, tag_len);
7434       break;
7435     /***  End: WAVE Service information element Dissection - IEEE 802.11p Draft 4.0 ***/
7436 #endif /* MESH_OVERRIDES */
7437
7438
7439
7440 #ifdef MESH_OVERRIDES
7441     case TAG_MESH_PEER_LINK_MGMT:
7442       {
7443         offset += 2;
7444         proto_tree_add_item (tree, hf_ieee80211_mesh_mgt_pl_subtype, tvb, offset, 1, TRUE);
7445         offset += 1;
7446         switch (tvb_get_guint8(tvb, 1))
7447           {                                         /* IE subtype */
7448           case MESH_PL_PEER_LINK_OPEN:
7449             proto_tree_add_item (tree, hf_ieee80211_mesh_mgt_pl_local_link_id, tvb, offset, 2, TRUE);
7450             break;
7451
7452           case MESH_PL_PEER_LINK_CONFIRM:
7453             proto_tree_add_item (tree, hf_ieee80211_mesh_mgt_pl_local_link_id, tvb, offset, 2, TRUE);
7454             proto_tree_add_item (tree, hf_ieee80211_mesh_mgt_pl_peer_link_id, tvb, offset + 2, 2, TRUE);
7455             break;
7456
7457           case MESH_PL_PEER_LINK_CLOSE:
7458             proto_tree_add_item (tree, hf_ieee80211_mesh_mgt_pl_local_link_id, tvb, offset, 2, TRUE);
7459             proto_tree_add_item (tree, hf_ieee80211_mesh_mgt_pl_peer_link_id, tvb, offset + 2, 2, TRUE);
7460             proto_tree_add_item (tree, hf_ieee80211_mesh_mgt_pl_reason_code, tvb, offset + 4, 2, TRUE);
7461             break;
7462
7463           /* undefined values */
7464           default:
7465             proto_tree_add_text (tree, tvb, offset, tag_len, "Unknown Peer Link Message Subtype");
7466             break;
7467           }
7468         break;
7469       }
7470
7471     case TAG_MESH_CONFIGURATION:
7472       {
7473         offset += 2;
7474         proto_tree_add_item (tree, hf_ieee80211_mesh_config_version, tvb, offset, 1, TRUE);
7475         proto_tree_add_item (tree, hf_ieee80211_mesh_config_path_sel_protocol, tvb, offset + 1, 4, TRUE);
7476         proto_tree_add_item (tree, hf_ieee80211_mesh_config_path_sel_metric, tvb, offset + 5, 4, TRUE);
7477         proto_tree_add_item (tree, hf_ieee80211_mesh_config_congestion_control, tvb, offset + 9, 4, TRUE);
7478         proto_tree_add_item (tree, hf_ieee80211_mesh_config_channel_prec, tvb, offset + 13, 4, TRUE);
7479         proto_tree_add_item (tree, hf_ieee80211_mesh_config_capability, tvb, offset + 17, 2, TRUE);
7480         break;
7481       }
7482
7483     case TAG_MESH_ID:
7484       {
7485         offset += 2;
7486
7487         proto_tree_add_item(tree, hf_ieee80211_mesh_id, tvb, offset, tag_len, FALSE);
7488         if (tag_len > 0) {
7489             col_append_fstr(pinfo->cinfo, COL_INFO, ", MESHID=%s", tvb_get_ephemeral_string(tvb, offset, tag_len));
7490             proto_item_append_text(ti, ": %s", tvb_get_ephemeral_string(tvb, offset, tag_len));
7491         }
7492
7493       break;
7494       }
7495
7496     case TAG_MESH_PREQ:
7497       {
7498         guint8 flags;
7499         proto_item *item;
7500         proto_tree *subtree;
7501
7502         offset += 2;
7503         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_flags, tvb, offset, 1, TRUE);
7504         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_hopcount, tvb, offset + 1, 1, TRUE);
7505         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_ttl, tvb, offset + 2, 1, TRUE);
7506         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_rreqid, tvb, offset + 3, 4, TRUE);
7507         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_sa, tvb, offset + 7, 6, FALSE);
7508         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_ssn, tvb, offset + 13, 4, TRUE);
7509         /* TODO: display proxied address if present */
7510         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_lifetime, tvb, offset + 17, 4, TRUE);
7511         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_metric, tvb, offset + 21, 4, TRUE);
7512         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_dstcount, tvb, offset + 25, 1, TRUE);
7513         flags = tvb_get_letohs (tvb, offset + 26);
7514         item = proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_dest_flags, tvb, offset + 26, 1, TRUE);
7515         subtree = proto_item_add_subtree(item, ett_msh_dest_flags_tree);
7516         proto_tree_add_boolean(subtree, hf_ieee80211_ff_mesh_mgt_dest_do_flags, tvb, offset + 26, 1, flags);
7517         proto_tree_add_boolean(subtree, hf_ieee80211_ff_mesh_mgt_dest_rf_flags, tvb, offset + 26, 1, flags);
7518         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_da, tvb, offset + 27, 6, FALSE);
7519         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_dsn, tvb, offset + 33, 4, TRUE);
7520         break;
7521       }
7522
7523     case TAG_MESH_PREP:
7524       {
7525         offset += 2;
7526         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_flags, tvb, offset, 1, TRUE);
7527         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_hopcount, tvb, offset + 1, 1, TRUE);
7528         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_ttl, tvb, offset + 2, 1, TRUE);
7529         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_da, tvb, offset + 3, 6, FALSE);
7530         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_dsn, tvb, offset + 9, 4, TRUE);
7531         /* TODO: display proxied address if present */
7532         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_lifetime, tvb, offset + 13, 4, TRUE);
7533         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_metric, tvb, offset + 17, 4, TRUE);
7534         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_sa, tvb, offset + 21, 6, FALSE);
7535         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_ssn, tvb, offset + 27, 4, TRUE);
7536         break;
7537       }
7538
7539     case TAG_MESH_PERR:
7540       {
7541         offset += 2;
7542         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_flags, tvb, offset, 1, TRUE);
7543         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_srccount, tvb, offset + 1, 1, FALSE);
7544         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_sa, tvb, offset + 2, 6, FALSE);
7545         proto_tree_add_item (tree, hf_ieee80211_ff_mesh_mgt_ssn, tvb, offset + 8, 4, TRUE);
7546         break;
7547       }
7548 #endif /* MESH_OVERRIDES */
7549
7550       break;
7551     /* The Capabilities field is a bit field indicating the capabilities being advertised
7552      * by the STA transmitting the information element
7553      */
7554     case TAG_EXTENDED_CAPABILITIES:
7555     {
7556       guint tag_offset;
7557       guint8 info_exchange;
7558       proto_item *tii;
7559       proto_tree *ex_cap_tree;
7560
7561       if (tag_len < 1)
7562       {
7563         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
7564             "Extended Capabilities: Error: Tag length must be at least 1 byte long");
7565         break;
7566       }
7567       offset+=2;
7568       tag_offset = offset;
7569
7570       /* Extended Capability octet 0 */
7571       info_exchange = tvb_get_guint8 (tvb, offset);
7572       tii = proto_tree_add_item (tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, FALSE);
7573       ex_cap_tree = proto_item_add_subtree (tii, ett_tag_ex_cap);
7574       proto_tree_add_item (ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b0, tvb, offset, 1, FALSE);
7575       proto_tree_add_item (ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b1, tvb, offset, 1, FALSE);
7576       proto_tree_add_item (ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b2, tvb, offset, 1, FALSE);
7577       proto_tree_add_item (ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b3, tvb, offset, 1, FALSE);
7578       proto_tree_add_item (ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b4, tvb, offset, 1, FALSE);
7579       proto_tree_add_item (ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b6, tvb, offset, 1, FALSE);
7580       offset++;
7581
7582       if (tag_len > offset - tag_offset) {
7583         /* Extended Capability octet 1 */
7584         offset++;
7585       }
7586
7587       if (tag_len > offset - tag_offset) {
7588         /* Extended Capability octet 2 */
7589         offset++;
7590       }
7591
7592       if (tag_len > offset - tag_offset) {
7593         /* Extended Capability octet 3 */
7594         tii = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb,
7595                                   offset, 1, FALSE);
7596         ex_cap_tree = proto_item_add_subtree(tii, ett_tag_ex_cap);
7597         proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b28,
7598                             tvb, offset, 1, FALSE);
7599         proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b29,
7600                             tvb, offset, 1, FALSE);
7601         proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b30,
7602                             tvb, offset, 1, FALSE);
7603         offset++;
7604       }
7605
7606       if (tag_len > offset - tag_offset) {
7607         /* Extended Capability octet 4 */
7608         tii = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb,
7609                                   offset, 1, FALSE);
7610         ex_cap_tree = proto_item_add_subtree(tii, ett_tag_ex_cap);
7611         proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b37,
7612                             tvb, offset, 1, FALSE);
7613         proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b38,
7614                             tvb, offset, 1, FALSE);
7615         proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b39,
7616                             tvb, offset, 1, FALSE);
7617         offset++;
7618       }
7619
7620       if (tag_len > offset - tag_offset) {
7621         /* Extended Capability octet 5 */
7622         tii = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb,
7623                                   offset, 1, FALSE);
7624         ex_cap_tree = proto_item_add_subtree(tii, ett_tag_ex_cap);
7625         proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b40,
7626                             tvb, offset, 1, FALSE);
7627         proto_tree_add_item(ex_cap_tree,
7628                             hf_ieee80211_tag_extended_capabilities_serv_int_granularity,
7629                             tvb, offset, 1, FALSE);
7630         offset++;
7631       }
7632
7633       if (tag_len > (offset - tag_offset))
7634       {
7635         proto_tree_add_text (tree, tvb, offset, tag_len - (offset - tag_offset), "Unknown Data");
7636         break;
7637       }
7638       break;
7639     }
7640     case TAG_ADVERTISEMENT_PROTOCOL:
7641     {
7642       dissect_advertisement_protocol(pinfo, tree, tvb, offset, NULL);
7643       break;
7644     }
7645
7646 #ifndef MESH_OVERRIDES
7647     case TAG_NEIGHBOR_REPORT:
7648     {
7649       #define SUB_TAG_TSF_INFO                 0x01
7650       #define SUB_TAG_MEASUREMENT_PILOT_INFO   0x02
7651       #define SUB_TAG_HT_CAPABILITIES          0x03
7652       #define SUB_TAG_HT_INFO                  0x04
7653       #define SUB_TAG_SEC_CHANNEL_OFFSET       0x05
7654       #define SUB_TAG_VENDOR_SPECIFIC          0xDD
7655
7656
7657       guint tag_offset;
7658       guint8 sub_tag_id;
7659       guint32 bssid_info, info, sub_tag_length;
7660       proto_item *parent_item;
7661       proto_tree *bssid_info_subtree, *sub_tag_tree;
7662       tvbuff_t *volatile sub_tag_tvb = NULL;
7663
7664       if (tag_len < 13)
7665       {
7666         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
7667             "Neighbor Report: Error: Tag length must be at least 13 bytes long");
7668         break;
7669       }
7670       offset+=2;
7671       tag_offset = offset;
7672
7673       proto_tree_add_item(tree, hf_ieee80211_tag_neighbor_report_bssid, tvb, offset, 6, ENC_NA);
7674
7675       /*** Begin: BSSID Information ***/
7676       offset+=6;
7677       bssid_info = tvb_get_letohl (tvb, offset);
7678       parent_item = proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_bssid_info, tvb, offset, 4, bssid_info, "BSSID Information: 0x%08X", bssid_info);
7679       bssid_info_subtree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_bssid_info_tree);
7680
7681       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_reachability, tvb, offset, 1, bssid_info);
7682       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_security, tvb, offset, 1, bssid_info);
7683       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_key_scope, tvb, offset, 1, bssid_info);
7684       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_spec_mng, tvb, offset, 1, bssid_info);
7685       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_qos, tvb, offset, 1, bssid_info);
7686       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_apsd, tvb, offset, 1, bssid_info);
7687       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_radio_msnt, tvb, offset, 1, bssid_info);
7688       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_dback, tvb, offset+1, 1, bssid_info);
7689       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_iback, tvb, offset+1, 1, bssid_info);
7690       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_mobility_domain, tvb, offset+1, 1, bssid_info);
7691       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_high_throughput, tvb, offset+1, 1, bssid_info);
7692       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_reserved, tvb, offset+1, 3, (bssid_info & 0xfffff000) >> 12);
7693       /*** End: BSSID Information ***/
7694
7695       offset+=4;
7696       info = tvb_get_guint8 (tvb, offset);
7697       proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_reg_class, tvb, offset, 1, info, "Regulatory Class: 0x%02X", info);
7698
7699       offset++;
7700       info = tvb_get_guint8 (tvb, offset);
7701       proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_channel_number, tvb, offset, 1, info, "Channel Number: 0x%02X", info);
7702
7703       offset++;
7704       info = tvb_get_guint8 (tvb, offset);
7705       proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_phy_type, tvb, offset, 1, info, "PHY Type: 0x%02X", info);
7706
7707       offset++;
7708       sub_tag_id = tvb_get_guint8 (tvb, offset);
7709       offset++;
7710       sub_tag_length = tvb_get_guint8 (tvb, offset);
7711
7712       offset++;
7713       sub_tag_tvb = tvb_new_subset(tvb, offset, sub_tag_length, -1);
7714
7715       switch (sub_tag_id) {
7716         case SUB_TAG_TSF_INFO:
7717           /* TODO */
7718           break;
7719         case SUB_TAG_MEASUREMENT_PILOT_INFO:
7720           /* TODO */
7721           break;
7722         case SUB_TAG_HT_CAPABILITIES:
7723           parent_item = proto_tree_add_text (tree, tvb, offset, sub_tag_length, "HT Capabilities");
7724           sub_tag_tree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_sub_tag_tree);
7725           dissect_ht_capability_ie(sub_tag_tree, sub_tag_tvb, 0, sub_tag_length, FALSE);
7726           break;
7727         case SUB_TAG_HT_INFO:
7728           parent_item = proto_tree_add_text (tree, tvb, offset, sub_tag_length, "HT Information");
7729           sub_tag_tree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_sub_tag_tree);
7730           dissect_ht_info_ie_1_1(sub_tag_tree, sub_tag_tvb, 0, sub_tag_length);
7731           break;
7732         case SUB_TAG_SEC_CHANNEL_OFFSET:
7733           parent_item = proto_tree_add_text (tree, tvb, offset, sub_tag_length, "Secondary Channel Offset");
7734           sub_tag_tree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_sub_tag_tree);
7735           secondary_channel_offset_ie(sub_tag_tree, sub_tag_tvb, 0, sub_tag_length);
7736           break;
7737         case SUB_TAG_VENDOR_SPECIFIC:
7738         default:
7739           break;
7740       }
7741
7742       offset += sub_tag_length;
7743
7744       if (tag_len > (offset - tag_offset))
7745       {
7746         proto_tree_add_text (tree, tvb, offset, tag_len - (offset - tag_offset), "Unknown Data");
7747         break;
7748       }
7749       break;
7750     }
7751 #endif /* MESH_OVERRIDES */
7752
7753     case TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT:
7754     {
7755       guint tag_offset;
7756
7757       if (tag_len != 4)
7758       {
7759         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
7760             "Extended Channel Switch Announcement: Error: Tag length must be exactly 4 bytes long");
7761         break;
7762       }
7763
7764       offset+=2;
7765       tag_offset = offset;
7766
7767       offset+= add_fixed_field(tree, tvb, offset, FIELD_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT);
7768
7769       if (tag_len > (offset - tag_offset))
7770       {
7771         proto_tree_add_text (tree, tvb, offset, tag_len - (offset - tag_offset), "Unknown Data");
7772         break;
7773       }
7774       break;
7775     }
7776     case TAG_SUPPORTED_REGULATORY_CLASSES:
7777     {
7778       guint tag_offset;
7779       guint8 current_field;
7780       guint i;
7781
7782       if (tag_len < 2) {
7783         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
7784             "Supported Regulatory Classes: Error: Tag length must be at least 2 bytes long");
7785         break;
7786       } else if (tag_len > 32) {
7787         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
7788             "Supported Regulatory Classes: Error: Tag length must be no more than 32 bytes long");
7789         break;
7790       }
7791
7792       offset+=2;
7793       tag_offset = offset;
7794
7795       current_field = tvb_get_guint8 (tvb, offset);
7796       proto_tree_add_uint(tree, hf_ieee80211_tag_supported_reg_classes_current, tvb, offset, 1, current_field);
7797
7798       offset++;
7799       /* Partially taken from the ssid section */
7800       tag_data_ptr = tvb_get_ptr (tvb, offset, tag_len);
7801       for (i = 0, n = 0; i < tag_len && n < SHORT_STR; i++) {
7802         ret = g_snprintf (print_buff + n, SHORT_STR - n, (i == tag_len-1)?"%d":"%d, ", tag_data_ptr[i]);
7803         if (ret >= SHORT_STR - n) {
7804           /* ret >= <buf_size> means buffer truncated  */
7805           break;
7806         }
7807         n += ret;
7808       }
7809       proto_tree_add_string (tree, hf_ieee80211_tag_supported_reg_classes_alternate, tvb, offset, tag_len, print_buff);
7810
7811       break;
7812     }
7813     default:
7814       tvb_ensure_bytes_exist (tvb, offset + 2, tag_len);
7815       proto_tree_add_string (tree, hf_ieee80211_tag_interpretation, tvb, offset + 1 + tag_len_len,
7816           tag_len, "Not interpreted");
7817       proto_item_append_text(ti, ": Tag %u Len %u", tag_no, tag_len);
7818       break;
7819   }
7820
7821   return tag_len + 1 + tag_len_len;
7822 }
7823
7824 void
7825 ieee_80211_add_tagged_parameters (tvbuff_t * tvb, int offset, packet_info * pinfo,
7826   proto_tree * tree, int tagged_parameters_len)
7827 {
7828   int next_len;
7829
7830   beacon_padding = 0; /* this is for the beacon padding confused with ssid fix */
7831   while (tagged_parameters_len > 0) {
7832     if ((next_len=add_tagged_field (pinfo, tree, tvb, offset))==0)
7833       break;
7834     if (next_len > tagged_parameters_len) {
7835       /* XXX - flag this as an error? */
7836       next_len = tagged_parameters_len;
7837     }
7838     offset += next_len;
7839     tagged_parameters_len -= next_len;
7840   }
7841 }
7842
7843 /* ************************************************************************* */
7844 /*                     Dissect 802.11 management frame                       */
7845 /* ************************************************************************* */
7846 static void
7847 dissect_ieee80211_mgt (guint16 fcf, tvbuff_t * tvb, packet_info * pinfo,
7848     proto_tree * tree)
7849 {
7850   proto_item *ti = NULL;
7851   proto_tree *mgt_tree;
7852   proto_tree *fixed_tree;
7853   proto_tree *tagged_tree;
7854   int offset = 0;
7855   int tagged_parameter_tree_len;
7856
7857   g_pinfo = pinfo;
7858
7859   CHECK_DISPLAY_AS_X(data_handle,proto_wlan_mgt, tvb, pinfo, tree);
7860
7861   ti = proto_tree_add_item (tree, proto_wlan_mgt, tvb, 0, -1, FALSE);
7862   mgt_tree = proto_item_add_subtree (ti, ett_80211_mgt);
7863
7864   switch (COMPOSE_FRAME_TYPE(fcf))
7865   {
7866
7867     case MGT_ASSOC_REQ:
7868       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 4);
7869       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
7870       add_fixed_field(fixed_tree, tvb, 2, FIELD_LISTEN_IVAL);
7871       offset = 4;  /* Size of fixed fields */
7872
7873       tagged_parameter_tree_len =
7874           tvb_reported_length_remaining(tvb, offset);
7875       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
7876                  tagged_parameter_tree_len);
7877       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
7878           tagged_parameter_tree_len);
7879       break;
7880
7881
7882     case MGT_ASSOC_RESP:
7883       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 6);
7884       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
7885       add_fixed_field(fixed_tree, tvb, 2, FIELD_STATUS_CODE);
7886       add_fixed_field(fixed_tree, tvb, 4, FIELD_ASSOC_ID);
7887       offset = 6;  /* Size of fixed fields */
7888
7889       tagged_parameter_tree_len =
7890           tvb_reported_length_remaining(tvb, offset);
7891       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
7892                  tagged_parameter_tree_len);
7893       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
7894           tagged_parameter_tree_len);
7895       break;
7896
7897
7898     case MGT_REASSOC_REQ:
7899       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 10);
7900       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
7901       add_fixed_field(fixed_tree, tvb, 2, FIELD_LISTEN_IVAL);
7902       add_fixed_field(fixed_tree, tvb, 4, FIELD_CURRENT_AP_ADDR);
7903       offset = 10;  /* Size of fixed fields */
7904
7905       tagged_parameter_tree_len =
7906           tvb_reported_length_remaining(tvb, offset);
7907       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
7908                  tagged_parameter_tree_len);
7909       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
7910           tagged_parameter_tree_len);
7911       break;
7912
7913     case MGT_REASSOC_RESP:
7914       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 6);
7915       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
7916       add_fixed_field(fixed_tree, tvb, 2, FIELD_STATUS_CODE);
7917       add_fixed_field(fixed_tree, tvb, 4, FIELD_ASSOC_ID);
7918       offset = 6;  /* Size of fixed fields */
7919
7920       tagged_parameter_tree_len =
7921           tvb_reported_length_remaining(tvb, offset);
7922       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
7923                  tagged_parameter_tree_len);
7924       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
7925           tagged_parameter_tree_len);
7926       break;
7927
7928
7929     case MGT_PROBE_REQ:
7930       offset = 0;
7931       tagged_parameter_tree_len =
7932           tvb_reported_length_remaining(tvb, offset);
7933       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
7934                  tagged_parameter_tree_len);
7935       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
7936           tagged_parameter_tree_len);
7937       break;
7938
7939     case MGT_PROBE_RESP:
7940     {
7941       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 12);
7942       add_fixed_field(fixed_tree, tvb, 0, FIELD_TIMESTAMP);
7943       add_fixed_field(fixed_tree, tvb, 8, FIELD_BEACON_INTERVAL);
7944       add_fixed_field(fixed_tree, tvb, 10, FIELD_CAP_INFO);
7945       offset = 12;  /* Size of fixed fields */
7946
7947       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
7948       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset, tagged_parameter_tree_len);
7949       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree, tagged_parameter_tree_len);
7950       break;
7951     }
7952     case MGT_MEASUREMENT_PILOT:
7953     {
7954       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 12);
7955       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_TIMESTAMP);
7956       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_MEASUREMENT_PILOT_INT);
7957       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_BEACON_INTERVAL);
7958       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_CAP_INFO);
7959       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_COUNTRY_STR);
7960       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_MAX_REG_PWR);
7961       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_MAX_TX_PWR);
7962       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_TX_PWR_USED);
7963       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_TRANSCEIVER_NOISE_FLOOR);
7964       /* TODO DS Parameter Set ??? */
7965
7966       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
7967       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset, tagged_parameter_tree_len);
7968       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree, tagged_parameter_tree_len);
7969       break;
7970     }
7971     case MGT_BEACON:    /* Dissect protocol payload fields  */
7972       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 12);
7973       add_fixed_field(fixed_tree, tvb, 0, FIELD_TIMESTAMP);
7974       add_fixed_field(fixed_tree, tvb, 8, FIELD_BEACON_INTERVAL);
7975       add_fixed_field(fixed_tree, tvb, 10, FIELD_CAP_INFO);
7976       offset = 12;  /* Size of fixed fields */
7977
7978       tagged_parameter_tree_len =
7979           tvb_reported_length_remaining(tvb, offset);
7980       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
7981       tagged_parameter_tree_len);
7982       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
7983       tagged_parameter_tree_len);
7984       break;
7985
7986     case MGT_ATIM:
7987       break;
7988
7989     case MGT_DISASS:
7990       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 2);
7991       add_fixed_field(fixed_tree, tvb, 0, FIELD_REASON_CODE);
7992       offset = 2; /* Size of fixed fields */
7993       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
7994       if (tagged_parameter_tree_len > 0) {
7995         tagged_tree = get_tagged_parameter_tree(mgt_tree, tvb, offset,
7996                                                 tagged_parameter_tree_len);
7997         ieee_80211_add_tagged_parameters(tvb, offset, pinfo, tagged_tree,
7998                                          tagged_parameter_tree_len);
7999       }
8000       break;
8001
8002     case MGT_AUTHENTICATION:
8003       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 6);
8004       add_fixed_field(fixed_tree, tvb, 0, FIELD_AUTH_ALG);
8005       add_fixed_field(fixed_tree, tvb, 2, FIELD_AUTH_TRANS_SEQ);
8006       add_fixed_field(fixed_tree, tvb, 4, FIELD_STATUS_CODE);
8007       offset = 6;  /* Size of fixed fields */
8008
8009       tagged_parameter_tree_len =
8010         tvb_reported_length_remaining(tvb, offset);
8011       if (tagged_parameter_tree_len != 0)
8012       {
8013         tagged_tree = get_tagged_parameter_tree (mgt_tree,
8014             tvb,
8015             offset,
8016             tagged_parameter_tree_len);
8017         ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
8018         tagged_parameter_tree_len);
8019       }
8020       break;
8021
8022     case MGT_DEAUTHENTICATION:
8023       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 2);
8024       add_fixed_field(fixed_tree, tvb, 0, FIELD_REASON_CODE);
8025       offset = 2; /* Size of fixed fields */
8026       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
8027       if (tagged_parameter_tree_len > 0) {
8028         tagged_tree = get_tagged_parameter_tree(mgt_tree, tvb, offset,
8029                                                 tagged_parameter_tree_len);
8030         ieee_80211_add_tagged_parameters(tvb, offset, pinfo, tagged_tree,
8031                                          tagged_parameter_tree_len);
8032       }
8033       break;
8034
8035     case MGT_ACTION:
8036     {
8037       proto_item *lcl_fixed_hdr;
8038       proto_tree *lcl_fixed_tree;
8039       lcl_fixed_hdr = proto_tree_add_text(mgt_tree, tvb, 0, 0, "Fixed parameters");
8040       lcl_fixed_tree = proto_item_add_subtree (lcl_fixed_hdr, ett_fixed_parameters);
8041
8042       offset += add_fixed_field(lcl_fixed_tree, tvb, 0, FIELD_ACTION);
8043
8044       proto_item_set_len(lcl_fixed_hdr, offset);
8045       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
8046       if (tagged_parameter_tree_len != 0)
8047       {
8048         tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
8049           tagged_parameter_tree_len);
8050         ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
8051           tagged_parameter_tree_len);
8052       }
8053       break;
8054     }
8055     case MGT_ACTION_NO_ACK:
8056     {
8057       proto_item *lcl_fixed_hdr;
8058       proto_tree *lcl_fixed_tree;
8059       lcl_fixed_hdr = proto_tree_add_text(mgt_tree, tvb, 0, 0, "Fixed parameters");
8060       lcl_fixed_tree = proto_item_add_subtree (lcl_fixed_hdr, ett_fixed_parameters);
8061
8062       offset += add_fixed_field(lcl_fixed_tree, tvb, 0, FIELD_ACTION);
8063
8064       proto_item_set_len(lcl_fixed_hdr, offset);
8065       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
8066       if (tagged_parameter_tree_len != 0)
8067       {
8068         tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
8069           tagged_parameter_tree_len);
8070         ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
8071           tagged_parameter_tree_len);
8072       }
8073       break;
8074     }
8075     case MGT_ARUBA_WLAN:
8076     {
8077       proto_item *aruba_hdr;
8078       proto_tree *aruba_tree;
8079       guint16 type;
8080       type = tvb_get_ntohs(tvb, offset);
8081
8082       aruba_hdr = proto_tree_add_text(mgt_tree, tvb, 0, 0, "Aruba Management");
8083       aruba_tree = proto_item_add_subtree(aruba_hdr, ett_fixed_parameters);
8084
8085       proto_tree_add_item(aruba_tree, hf_ieee80211_aruba, tvb, offset, 2, FALSE);
8086       offset += 2;
8087       /* HeartBeat Sequence */
8088       if ( type == 0x0005 )
8089       {
8090         proto_tree_add_item(aruba_tree, hf_ieee80211_aruba_hb_seq, tvb, offset, 8, FALSE);
8091       }
8092       /* MTU Size */
8093       if ( type == 0x0003 )
8094       {
8095         proto_tree_add_item(aruba_tree, hf_ieee80211_aruba_mtu, tvb, offset, 2, FALSE);
8096       }
8097       break;
8098     }
8099   }
8100 }
8101
8102 static void
8103 set_src_addr_cols(packet_info *pinfo, const guint8 *addr, const char *type)
8104 {
8105   col_add_fstr(pinfo->cinfo, COL_RES_DL_SRC, "%s (%s)",
8106         get_ether_name(addr), type);
8107   col_add_str(pinfo->cinfo, COL_UNRES_DL_SRC, ether_to_str(addr));
8108 }
8109
8110 static void
8111 set_dst_addr_cols(packet_info *pinfo, const guint8 *addr, const char *type)
8112 {
8113   col_add_fstr(pinfo->cinfo, COL_RES_DL_DST, "%s (%s)",
8114         get_ether_name(addr), type);
8115   col_add_str(pinfo->cinfo, COL_UNRES_DL_DST, ether_to_str(addr));
8116 }
8117
8118 static guint32
8119 crc32_802_tvb_padded(tvbuff_t *tvb, guint hdr_len, guint hdr_size, guint len)
8120 {
8121   guint32 c_crc;
8122
8123   c_crc = crc32_ccitt_tvb(tvb, hdr_len);
8124   c_crc = crc32_ccitt_seed(tvb_get_ptr(tvb, hdr_size, len), len, ~c_crc);
8125
8126   /* Byte reverse. */
8127   c_crc = ((unsigned char)(c_crc>>0)<<24) |
8128     ((unsigned char)(c_crc>>8)<<16) |
8129     ((unsigned char)(c_crc>>16)<<8) |
8130     ((unsigned char)(c_crc>>24)<<0);
8131
8132   return ( c_crc );
8133 }
8134
8135 typedef enum {
8136     ENCAP_802_2,
8137     ENCAP_IPX,
8138     ENCAP_ETHERNET
8139 } encap_t;
8140
8141
8142 /* ************************************************************************* */
8143 /*                          Dissect 802.11 frame                             */
8144 /* ************************************************************************* */
8145
8146 /*
8147  * The 802.11n specification makes some fairly significant changes to the
8148  * layout of the MAC header.  The first two bits of the MAC header are the
8149  * protocol version.  You'd think that the 802.11 committee would have
8150  * bumped the version to indicate a different MAC layout, but NOOOO -- we
8151  * have to go digging for bits in various locations instead.
8152  */
8153
8154 static void
8155 dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo,
8156         proto_tree * tree, gboolean fixed_length_header, gint fcs_len,
8157         gboolean wlan_broken_fc, gboolean datapad,
8158         gboolean is_ht)
8159 {
8160   guint16 fcf, flags, frame_type_subtype, ctrl_fcf, ctrl_type_subtype;
8161   guint16 seq_control;
8162   guint32 seq_number, frag_number;
8163   gboolean more_frags;
8164   const guint8 *src = NULL;
8165   const guint8 *dst = NULL;
8166   const guint8 *bssid = NULL;
8167   proto_item *ti = NULL;
8168   proto_item *fcs_item = NULL;
8169   proto_item *cw_item = NULL;
8170   proto_item *hidden_item;
8171   proto_tree *volatile hdr_tree = NULL;
8172   proto_tree *fcs_tree = NULL;
8173   proto_tree *cw_tree = NULL;
8174   guint16 hdr_len, ohdr_len, htc_len = 0;
8175   gboolean has_fcs, fcs_good, fcs_bad;
8176   gint len, reported_len, ivlen;
8177   gboolean is_amsdu = 0;
8178   gboolean save_fragmented;
8179   tvbuff_t *volatile next_tvb = NULL;
8180   guint32 addr_type;
8181   volatile encap_t encap_type;
8182   guint8 octet1, octet2;
8183   char out_buff[SHORT_STR];
8184   gint is_iv_bad;
8185   guchar iv_buff[4];
8186   const char *addr1_str = NULL;
8187   int addr1_hf = -1;
8188   guint offset;
8189   const gchar *fts_str;
8190   gchar flag_str[] = "opmPRMFTC";
8191   gint ii;
8192
8193   wlan_hdr *volatile whdr;
8194   static wlan_hdr whdrs[4];
8195   gboolean retransmitted;
8196
8197   whdr= &whdrs[0];
8198
8199   col_set_str (pinfo->cinfo, COL_PROTOCOL, "802.11");
8200   col_clear(pinfo->cinfo, COL_INFO);
8201
8202   fcf = FETCH_FCF(0);
8203   frame_type_subtype = COMPOSE_FRAME_TYPE(fcf);
8204   if (frame_type_subtype == CTRL_CONTROL_WRAPPER)
8205     ctrl_fcf = FETCH_FCF(10);
8206   else
8207     ctrl_fcf = 0;
8208
8209   if (fixed_length_header)
8210     hdr_len = DATA_LONG_HDR_LEN;
8211   else
8212     hdr_len = find_header_length (fcf, ctrl_fcf, is_ht);
8213   ohdr_len = hdr_len;
8214   if (datapad)
8215     hdr_len = roundup2(hdr_len, 4);
8216
8217   fts_str = val_to_str_const(frame_type_subtype, frame_type_subtype_vals,
8218               "Unrecognized (Reserved frame)");
8219   col_set_str (pinfo->cinfo, COL_INFO, fts_str);
8220
8221
8222   flags = FCF_FLAGS (fcf);
8223   more_frags = HAVE_FRAGMENTS (flags);
8224
8225   for (ii = 0; ii < 8; ii++) {
8226     if (! (flags & 0x80 >> ii)) {
8227       flag_str[ii] = '.';
8228     }
8229   }
8230
8231   if (is_ht && IS_STRICTLY_ORDERED(flags) &&
8232     ((FCF_FRAME_TYPE(fcf) == MGT_FRAME) || (FCF_FRAME_TYPE(fcf) == DATA_FRAME &&
8233       DATA_FRAME_IS_QOS(frame_type_subtype)))) {
8234     htc_len = 4;
8235   }
8236
8237   /* Add the FC to the current tree */
8238   if (tree)
8239     {
8240       ti = proto_tree_add_protocol_format (tree, proto_wlan, tvb, 0, hdr_len,
8241           "IEEE 802.11 %s", fts_str);
8242       hdr_tree = proto_item_add_subtree (ti, ett_80211);
8243
8244       dissect_frame_control(hdr_tree, tvb, wlan_broken_fc, 0);
8245
8246       if (frame_type_subtype == CTRL_PS_POLL)
8247         proto_tree_add_uint(hdr_tree, hf_ieee80211_assoc_id, tvb, 2, 2, TRUE);
8248
8249       else
8250         proto_tree_add_uint (hdr_tree, hf_ieee80211_did_duration, tvb, 2, 2,
8251             tvb_get_letohs (tvb, 2));
8252     }
8253
8254   /*
8255    * Decode the part of the frame header that isn't the same for all
8256    * frame types.
8257    */
8258   seq_control = 0;
8259   frag_number = 0;
8260   seq_number = 0;
8261
8262   switch (FCF_FRAME_TYPE (fcf))
8263   {
8264
8265     case MGT_FRAME:
8266       /*
8267        * All management frame types have the same header.
8268        */
8269       src = tvb_get_ptr (tvb, 10, 6);
8270       dst = tvb_get_ptr (tvb, 4, 6);
8271
8272       SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src);
8273       SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src);
8274       SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst);
8275       SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, dst);
8276
8277       /* for tap */
8278       SET_ADDRESS(&whdr->bssid, AT_ETHER, 6, tvb_get_ptr(tvb, 16,6));
8279       SET_ADDRESS(&whdr->src, AT_ETHER, 6, src);
8280       SET_ADDRESS(&whdr->dst, AT_ETHER, 6, dst);
8281       whdr->type = frame_type_subtype;
8282
8283       seq_control = tvb_get_letohs(tvb, 22);
8284       frag_number = SEQCTL_FRAGMENT_NUMBER(seq_control);
8285       seq_number = SEQCTL_SEQUENCE_NUMBER(seq_control);
8286
8287       col_append_fstr(pinfo->cinfo, COL_INFO,
8288             ", SN=%d", seq_number);
8289
8290       col_append_fstr(pinfo->cinfo, COL_INFO,
8291             ", FN=%d",frag_number);
8292
8293       if (tree)
8294       {
8295         proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 4, 6, dst);
8296
8297         proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 10, 6, src);
8298
8299         /* add items for wlan.addr filter */
8300         hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, dst);
8301         PROTO_ITEM_SET_HIDDEN(hidden_item);
8302         hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, src);
8303         PROTO_ITEM_SET_HIDDEN(hidden_item);
8304
8305         proto_tree_add_item (hdr_tree, hf_ieee80211_addr_bssid, tvb, 16, 6, ENC_NA);
8306
8307         proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
8308             frag_number);
8309
8310         proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
8311             seq_number);
8312       }
8313       break;
8314
8315     case CONTROL_FRAME:
8316     {
8317       /*
8318        * Control Wrapper frames insert themselves between address 1
8319        * and address 2 in a normal control frame.  Process address 1
8320        * first, then handle the rest of the frame in dissect_control.
8321        */
8322       if (frame_type_subtype == CTRL_CONTROL_WRAPPER) {
8323         offset = 10; /* FC + D/ID + Address 1 + CFC + HTC */
8324         ctrl_fcf = FETCH_FCF(10);
8325         ctrl_type_subtype = COMPOSE_FRAME_TYPE(ctrl_fcf);
8326       } else {
8327         offset = 10; /* FC + D/ID + Address 1 */
8328         ctrl_fcf = fcf;
8329         ctrl_type_subtype = frame_type_subtype;
8330       }
8331
8332       switch (ctrl_type_subtype)
8333       {
8334         case CTRL_PS_POLL:
8335           addr1_str = "BSSID";
8336           addr1_hf = hf_ieee80211_addr_bssid;
8337           break;
8338         case CTRL_RTS:
8339         case CTRL_CTS:
8340         case CTRL_ACKNOWLEDGEMENT:
8341         case CTRL_CFP_END:
8342         case CTRL_CFP_ENDACK:
8343         case CTRL_BLOCK_ACK_REQ:
8344         case CTRL_BLOCK_ACK:
8345           addr1_str = "RA";
8346           addr1_hf = hf_ieee80211_addr_ra;
8347           break;
8348         default:
8349           break;
8350       }
8351
8352       if (!addr1_str) /* XXX - Should we throw some sort of error? */
8353         break;
8354
8355       /* Add address 1 */
8356       dst = tvb_get_ptr(tvb, 4, 6);
8357       set_dst_addr_cols(pinfo, dst, addr1_str);
8358       if (tree) {
8359         proto_tree_add_item(hdr_tree, addr1_hf, tvb, 4, 6, FALSE);
8360       }
8361
8362       /*
8363        * Start shoving in other fields if needed.
8364        * XXX - Should we look for is_ht as well?
8365        */
8366       if (frame_type_subtype == CTRL_CONTROL_WRAPPER && tree) {
8367         cw_item = proto_tree_add_text(hdr_tree, tvb, offset, 2,
8368           "Contained Frame Control");
8369         cw_tree = proto_item_add_subtree (cw_item, ett_cntrl_wrapper_fc);
8370         dissect_frame_control(cw_tree, tvb, FALSE, offset);
8371         dissect_ht_control(hdr_tree, tvb, offset + 2);
8372         offset+=6;
8373         cw_item = proto_tree_add_text(hdr_tree, tvb, offset, 2,
8374           "Carried Frame");
8375         hdr_tree = proto_item_add_subtree (cw_item, ett_cntrl_wrapper_fc);
8376       }
8377
8378       switch (ctrl_type_subtype)
8379       {
8380         case CTRL_PS_POLL:
8381         case CTRL_CFP_END:
8382         case CTRL_CFP_ENDACK:
8383         {
8384           src = tvb_get_ptr (tvb, offset, 6);
8385           set_src_addr_cols(pinfo, src, "BSSID");
8386           if (tree) {
8387             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, FALSE);
8388           }
8389           break;
8390         }
8391
8392         case CTRL_RTS:
8393         {
8394           src = tvb_get_ptr (tvb, offset, 6);
8395           set_src_addr_cols(pinfo, src, "TA");
8396           if (tree) {
8397             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, FALSE);
8398           }
8399           break;
8400         }
8401
8402         case CTRL_CONTROL_WRAPPER:
8403         {
8404           /* XXX - We shouldn't see this.  Should we throw an error? */
8405           break;
8406         }
8407
8408         case CTRL_BLOCK_ACK_REQ:
8409         {
8410           src = tvb_get_ptr (tvb, offset, 6);
8411           set_src_addr_cols(pinfo, src, "TA");
8412
8413           if (tree)
8414           {
8415             guint16 bar_control;
8416             guint8 block_ack_type;
8417             proto_item *bar_parent_item;
8418             proto_tree *bar_sub_tree;
8419
8420             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, FALSE);
8421             offset += 6;
8422
8423             bar_control = tvb_get_letohs(tvb, offset);
8424             block_ack_type = (bar_control & 0x0006) >> 1;
8425             proto_tree_add_uint(hdr_tree, hf_ieee80211_block_ack_request_type, tvb,
8426               offset, 1, block_ack_type);
8427             bar_parent_item = proto_tree_add_uint_format(hdr_tree,
8428               hf_ieee80211_block_ack_request_control, tvb, offset, 2, bar_control,
8429               "Block Ack Request (BAR) Control: 0x%04X", bar_control);
8430             bar_sub_tree = proto_item_add_subtree(bar_parent_item,
8431               ett_block_ack);
8432             proto_tree_add_boolean(bar_sub_tree,
8433               hf_ieee80211_block_ack_control_ack_policy, tvb, offset, 1, bar_control);
8434             proto_tree_add_boolean(bar_sub_tree, hf_ieee80211_block_ack_control_multi_tid,
8435               tvb, offset, 1, bar_control);
8436             proto_tree_add_boolean(bar_sub_tree,
8437               hf_ieee80211_block_ack_control_compressed_bitmap, tvb, offset, 1,
8438               bar_control);
8439             proto_tree_add_uint(bar_sub_tree, hf_ieee80211_block_ack_control_reserved,
8440               tvb, offset, 2, bar_control);
8441
8442             switch (block_ack_type)
8443             {
8444               case 0: /*Basic BlockAckReq */
8445               {
8446                 proto_tree_add_uint(bar_sub_tree,
8447                 hf_ieee80211_block_ack_control_basic_tid_info, tvb, offset+1, 1,
8448                   bar_control);
8449                 offset += 2;
8450
8451                 offset += add_fixed_field(hdr_tree, tvb, offset,
8452                   FIELD_BLOCK_ACK_SSC);
8453                 break;
8454               }
8455               case 2: /* Compressed BlockAckReq */
8456               {
8457                 proto_tree_add_uint(bar_sub_tree,
8458                 hf_ieee80211_block_ack_control_compressed_tid_info, tvb, offset+1, 1,
8459                   bar_control);
8460                 offset += 2;
8461
8462                 offset += add_fixed_field(hdr_tree, tvb, offset,
8463                   FIELD_BLOCK_ACK_SSC);
8464                 break;
8465               }
8466               case 3: /* Multi-TID BlockAckReq */
8467               {
8468                 guint8 tid_count, i;
8469                 proto_tree *bar_mtid_tree, *bar_mtid_sub_tree;
8470
8471                 tid_count = ((bar_control & 0xF000) >> 12) + 1;
8472                 proto_tree_add_uint_format(bar_sub_tree, hf_ieee80211_block_ack_control_multi_tid_info, tvb, offset+1, 1, bar_control,
8473                 decode_numeric_bitfield(bar_control, 0xF000, 16,"Number of TIDs Present: 0x%%X"), tid_count);
8474                 offset += 2;
8475
8476                 bar_parent_item = proto_tree_add_text (hdr_tree, tvb, offset, tid_count*4, "Per TID Info");
8477                 bar_mtid_tree = proto_item_add_subtree(bar_parent_item, ett_block_ack);
8478                 for (i = 1; i <= tid_count; i++) {
8479                   bar_parent_item = proto_tree_add_uint(bar_mtid_tree, hf_ieee80211_block_ack_multi_tid_info, tvb, offset, 4, i);
8480                   bar_mtid_sub_tree = proto_item_add_subtree(bar_parent_item, ett_block_ack);
8481
8482                   bar_control = tvb_get_letohs(tvb, offset);
8483                   proto_tree_add_uint(bar_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_reserved, tvb, offset, 2, bar_control);
8484                   proto_tree_add_uint(bar_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_value, tvb, offset+1, 1, bar_control);
8485                   offset += 2;
8486
8487                   offset += add_fixed_field(bar_mtid_sub_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
8488                 }
8489                 break;
8490               }
8491             }
8492           }
8493           break;
8494         }
8495
8496         case CTRL_BLOCK_ACK:
8497         {
8498           src = tvb_get_ptr (tvb, offset, 6);
8499           set_src_addr_cols(pinfo, src, "TA");
8500
8501           if (tree)
8502           {
8503             guint16 ba_control;
8504             guint8 block_ack_type;
8505             proto_item *ba_parent_item;
8506             proto_tree *ba_sub_tree;
8507
8508             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, FALSE);
8509             offset += 6;
8510
8511             ba_control = tvb_get_letohs(tvb, offset);
8512             block_ack_type = (ba_control & 0x0006) >> 1;
8513             proto_tree_add_uint(hdr_tree, hf_ieee80211_block_ack_type, tvb, offset, 1, block_ack_type);
8514             ba_parent_item = proto_tree_add_uint_format(hdr_tree,
8515               hf_ieee80211_block_ack_control, tvb, offset, 2, ba_control,
8516               "Block Ack (BA) Control: 0x%04X", ba_control);
8517             ba_sub_tree = proto_item_add_subtree(ba_parent_item, ett_block_ack);
8518             proto_tree_add_boolean(ba_sub_tree, hf_ieee80211_block_ack_control_ack_policy,
8519               tvb, offset, 1, ba_control);
8520             proto_tree_add_boolean(ba_sub_tree, hf_ieee80211_block_ack_control_multi_tid,
8521               tvb, offset, 1, ba_control);
8522             proto_tree_add_boolean(ba_sub_tree,
8523               hf_ieee80211_block_ack_control_compressed_bitmap, tvb, offset, 1,
8524               ba_control);
8525             proto_tree_add_uint(ba_sub_tree, hf_ieee80211_block_ack_control_reserved, tvb,
8526               offset, 2, ba_control);
8527
8528             switch (block_ack_type)
8529             {
8530               case 0: /*Basic BlockAck */
8531               {
8532                 proto_tree_add_uint(ba_sub_tree,
8533                 hf_ieee80211_block_ack_control_basic_tid_info, tvb, offset+1, 1,
8534                   ba_control);
8535                 offset += 2;
8536
8537                 offset += add_fixed_field(hdr_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
8538                 proto_tree_add_item(hdr_tree, hf_ieee80211_block_ack_bitmap, tvb, offset, 128, FALSE);
8539                 offset += 128;
8540                 break;
8541               }
8542               case 2: /* Compressed BlockAck */
8543               {
8544                 proto_tree_add_uint(ba_sub_tree, hf_ieee80211_block_ack_control_basic_tid_info, tvb, offset+1, 1, ba_control);
8545                 offset += 2;
8546
8547                 offset += add_fixed_field(hdr_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
8548                 proto_tree_add_item(hdr_tree, hf_ieee80211_block_ack_bitmap, tvb, offset, 8, FALSE);
8549                 offset += 8;
8550                 break;
8551               }
8552               case 3:  /* Multi-TID BlockAck */
8553               {
8554                 guint8 tid_count, i;
8555                 proto_tree *ba_mtid_tree, *ba_mtid_sub_tree;
8556
8557                 tid_count = ((ba_control & 0xF000) >> 12) + 1;
8558                 proto_tree_add_uint_format(ba_sub_tree,
8559                 hf_ieee80211_block_ack_control_compressed_tid_info, tvb, offset+1, 1,
8560                   ba_control, decode_numeric_bitfield(ba_control, 0xF000,
8561                   16,"Number of TIDs Present: 0x%%X"), tid_count);
8562                 offset += 2;
8563
8564                 ba_parent_item = proto_tree_add_text (hdr_tree, tvb, offset, tid_count*4, "Per TID Info");
8565                 ba_mtid_tree = proto_item_add_subtree(ba_parent_item, ett_block_ack);
8566                 for (i=1; i<=tid_count; i++) {
8567                   ba_parent_item = proto_tree_add_uint(ba_mtid_tree, hf_ieee80211_block_ack_multi_tid_info, tvb, offset, 4, i);
8568                   ba_mtid_sub_tree = proto_item_add_subtree(ba_parent_item, ett_block_ack);
8569
8570                   ba_control = tvb_get_letohs(tvb, offset);
8571                   proto_tree_add_uint(ba_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_reserved, tvb, offset, 2, ba_control);
8572                   proto_tree_add_uint(ba_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_value, tvb, offset+1, 1, ba_control);
8573                   offset += 2;
8574
8575                   offset += add_fixed_field(ba_mtid_sub_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
8576                   proto_tree_add_item(ba_mtid_sub_tree, hf_ieee80211_block_ack_bitmap, tvb, offset, 8, FALSE);
8577                   offset += 8;
8578                 }
8579                 break;
8580               }
8581             }
8582           }
8583           break;
8584         }
8585       }
8586       break;
8587     }
8588
8589     case DATA_FRAME:
8590       addr_type = FCF_ADDR_SELECTOR (fcf);
8591
8592       /* In order to show src/dst address we must always do the following */
8593       switch (addr_type)
8594       {
8595
8596         case DATA_ADDR_T1:
8597           src = tvb_get_ptr (tvb, 10, 6);
8598           dst = tvb_get_ptr (tvb, 4, 6);
8599           bssid = tvb_get_ptr (tvb, 16, 6);
8600           break;
8601
8602         case DATA_ADDR_T2:
8603           src = tvb_get_ptr (tvb, 16, 6);
8604           dst = tvb_get_ptr (tvb, 4, 6);
8605           bssid = tvb_get_ptr (tvb, 10, 6);
8606           break;
8607
8608         case DATA_ADDR_T3:
8609           src = tvb_get_ptr (tvb, 10, 6);
8610           dst = tvb_get_ptr (tvb, 16, 6);
8611           bssid = tvb_get_ptr (tvb, 4, 6);
8612           break;
8613
8614         case DATA_ADDR_T4:
8615           src = tvb_get_ptr (tvb, 24, 6);
8616           dst = tvb_get_ptr (tvb, 16, 6);
8617           bssid = tvb_get_ptr (tvb, 16, 6);
8618           break;
8619       }
8620
8621       SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src);
8622       SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src);
8623       SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst);
8624       SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, dst);
8625
8626       /* for tap */
8627
8628       SET_ADDRESS(&whdr->bssid, AT_ETHER, 6, bssid);
8629       SET_ADDRESS(&whdr->src, AT_ETHER, 6, src);
8630       SET_ADDRESS(&whdr->dst, AT_ETHER, 6, dst);
8631       whdr->type = frame_type_subtype;
8632
8633       seq_control = tvb_get_letohs(tvb, 22);
8634       frag_number = SEQCTL_FRAGMENT_NUMBER(seq_control);
8635       seq_number = SEQCTL_SEQUENCE_NUMBER(seq_control);
8636
8637       col_append_fstr(pinfo->cinfo, COL_INFO,
8638             ", SN=%d, FN=%d", seq_number,frag_number);
8639
8640       /* Now if we have a tree we start adding stuff */
8641       if (tree)
8642       {
8643
8644         switch (addr_type)
8645         {
8646
8647           case DATA_ADDR_T1:
8648             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 4, 6, dst);
8649             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 10, 6, src);
8650             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_bssid, tvb, 16, 6, bssid);
8651             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
8652                frag_number);
8653             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
8654                seq_number);
8655
8656             /* add items for wlan.addr filter */
8657             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, dst);
8658             PROTO_ITEM_SET_HIDDEN(hidden_item);
8659             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, src);
8660             PROTO_ITEM_SET_HIDDEN(hidden_item);
8661             break;
8662
8663           case DATA_ADDR_T2:
8664             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 4, 6, dst);
8665             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_bssid, tvb, 10, 6, bssid);
8666             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 16, 6, src);
8667             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
8668                frag_number);
8669             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
8670                seq_number);
8671
8672             /* add items for wlan.addr filter */
8673             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, dst);
8674             PROTO_ITEM_SET_HIDDEN(hidden_item);
8675             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, src);
8676             PROTO_ITEM_SET_HIDDEN(hidden_item);
8677             break;
8678
8679           case DATA_ADDR_T3:
8680             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_bssid, tvb, 4, 6, bssid);
8681             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 10, 6, src);
8682             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 16, 6, dst);
8683
8684             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
8685                frag_number);
8686             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
8687                seq_number);
8688
8689             /* add items for wlan.addr filter */
8690             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, src);
8691             PROTO_ITEM_SET_HIDDEN(hidden_item);
8692             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, dst);
8693             PROTO_ITEM_SET_HIDDEN(hidden_item);
8694             break;
8695
8696           case DATA_ADDR_T4:
8697             proto_tree_add_item (hdr_tree, hf_ieee80211_addr_ra, tvb, 4, 6, ENC_NA);
8698             proto_tree_add_item (hdr_tree, hf_ieee80211_addr_ta, tvb, 10, 6, ENC_NA);
8699             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 16, 6, dst);
8700             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
8701                frag_number);
8702             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
8703                seq_number);
8704             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 24, 6, src);
8705
8706             /* add items for wlan.addr filter */
8707             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, dst);
8708             PROTO_ITEM_SET_HIDDEN(hidden_item);
8709             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 24, 6, src);
8710             PROTO_ITEM_SET_HIDDEN(hidden_item);
8711             break;
8712         }
8713
8714       }
8715
8716 #ifdef MESH_OVERRIDES
8717       if (tree &&
8718           (FCF_ADDR_SELECTOR(fcf) == DATA_ADDR_T4 ||
8719            FCF_ADDR_SELECTOR(fcf) == DATA_ADDR_T2))
8720       {
8721         proto_item *msh_fields;
8722         proto_tree *msh_tree;
8723
8724         guint16 mshoff;
8725         guint8 mesh_flags;
8726         guint8 mesh_ttl;
8727         guint32 mesh_seq_number;
8728         guint8 mesh_hdr_len;
8729
8730         mshoff = hdr_len;
8731         mesh_flags = tvb_get_guint8(tvb, mshoff + 0);
8732         /* heuristic method to determine if this is a mesh frame */
8733         if (mesh_flags & ~MESH_FLAGS_ADDRESS_EXTENSION) {
8734 #if 0
8735           g_warning("Invalid mesh flags: %x.  Interpreting as WDS frame.\n",  mesh_flags);
8736 #endif
8737           break;
8738         }
8739         mesh_hdr_len = find_mesh_header_length(tvb_get_ptr(tvb, mshoff, 1), 0, fcf);
8740         mesh_ttl = tvb_get_guint8(tvb, mshoff + 1);
8741         mesh_seq_number = 0xffffff & tvb_get_letohl(tvb, mshoff + 2);
8742
8743         msh_fields = proto_tree_add_text(hdr_tree, tvb, mshoff, mesh_hdr_len, "Mesh Header");
8744         msh_tree = proto_item_add_subtree (msh_fields, ett_msh_parameters);
8745
8746         proto_tree_add_boolean_format (msh_tree, hf_ieee80211_mesh_flags,
8747               tvb, mshoff, 1, mesh_flags, "Address Extension %x", mesh_flags & MESH_FLAGS_ADDRESS_EXTENSION);
8748         proto_tree_add_uint (msh_tree, hf_ieee80211_mesh_ttl, tvb, mshoff + 1, 1, mesh_ttl);
8749         proto_tree_add_uint (msh_tree, hf_ieee80211_mesh_seq, tvb, mshoff + 2, 4, mesh_seq_number);
8750         switch (mesh_hdr_len) {
8751           case 24:
8752             proto_tree_add_item(msh_tree, hf_ieee80211_mesh_ae3, tvb, mshoff + 18, 6, ENC_NA);
8753           case 18:
8754             proto_tree_add_item(msh_tree, hf_ieee80211_mesh_ae2, tvb, mshoff + 12, 6, ENC_NA);
8755           case 12:
8756             proto_tree_add_item(msh_tree, hf_ieee80211_mesh_ae1, tvb, mshoff + 6, 6, ENC_NA);
8757           case 6:
8758             break;
8759           default:
8760             expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
8761                 "Invalid mesh header length (%d)\n",
8762                 mesh_hdr_len);
8763         }
8764         hdr_len += mesh_hdr_len;
8765       }
8766 #endif /* MESH_OVERRIDES */
8767       break;
8768   }
8769
8770   len = tvb_length_remaining(tvb, hdr_len);
8771   reported_len = tvb_reported_length_remaining(tvb, hdr_len);
8772
8773   switch (fcs_len)
8774     {
8775       case 0: /* Definitely has no FCS */
8776         has_fcs = FALSE;
8777         break;
8778
8779       case 4: /* Definitely has an FCS */
8780         has_fcs = TRUE;
8781         break;
8782
8783       default: /* Don't know - use "wlan_check_fcs" */
8784         has_fcs = wlan_check_fcs;
8785         break;
8786     }
8787   if (has_fcs)
8788     {
8789       /*
8790        * Well, this packet should, in theory, have an FCS.
8791        * Do we have the entire packet, and does it have enough data for
8792        * the FCS?
8793        */
8794       if (reported_len < 4)
8795       {
8796         /*
8797          * The packet is claimed not to even have enough data for a 4-byte
8798          * FCS.
8799          * Pretend it doesn't have an FCS.
8800          */
8801         ;
8802       }
8803       else if (len < reported_len)
8804       {
8805         /*
8806          * The packet is claimed to have enough data for a 4-byte FCS, but
8807          * we didn't capture all of the packet.
8808          * Slice off the 4-byte FCS from the reported length, and trim the
8809          * captured length so it's no more than the reported length; that
8810          * will slice off what of the FCS, if any, is in the captured
8811          * length.
8812          */
8813         reported_len -= 4;
8814         if (len > reported_len)
8815             len = reported_len;
8816       }
8817       else
8818       {
8819         /*
8820          * We have the entire packet, and it includes a 4-byte FCS.
8821          * Slice it off, and put it into the tree.
8822          */
8823         len -= 4;
8824         reported_len -= 4;
8825         if (tree)
8826         {
8827           guint32 sent_fcs = tvb_get_ntohl(tvb, hdr_len + len);
8828           guint32 fcs;
8829
8830           if (datapad)
8831             fcs = crc32_802_tvb_padded(tvb, ohdr_len, hdr_len, len);
8832           else
8833             fcs = crc32_802_tvb(tvb, hdr_len + len);
8834           if (fcs == sent_fcs) {
8835             fcs_good = TRUE;
8836             fcs_bad = FALSE;
8837           } else {
8838             fcs_good = FALSE;
8839             fcs_bad = TRUE;
8840           }
8841
8842           if(fcs_good) {
8843             fcs_item = proto_tree_add_uint_format(hdr_tree, hf_ieee80211_fcs, tvb,
8844                 hdr_len + len, 4, sent_fcs,
8845                 "Frame check sequence: 0x%08x [correct]", sent_fcs);
8846           } else {
8847             fcs_item = proto_tree_add_uint_format(hdr_tree, hf_ieee80211_fcs, tvb,
8848                 hdr_len + len, 4, sent_fcs,
8849                 "Frame check sequence: 0x%08x [incorrect, should be 0x%08x]",
8850                 sent_fcs, fcs);
8851             flag_str[8] = '.';
8852           }
8853
8854           proto_tree_set_appendix(hdr_tree, tvb, hdr_len + len, 4);
8855
8856           fcs_tree = proto_item_add_subtree(fcs_item, ett_fcs);
8857
8858           fcs_item = proto_tree_add_boolean(fcs_tree,
8859               hf_ieee80211_fcs_good, tvb,
8860               hdr_len + len, 4,
8861               fcs_good);
8862           PROTO_ITEM_SET_GENERATED(fcs_item);
8863
8864           fcs_item = proto_tree_add_boolean(fcs_tree,
8865               hf_ieee80211_fcs_bad, tvb,
8866               hdr_len + len, 4,
8867               fcs_bad);
8868           PROTO_ITEM_SET_GENERATED(fcs_item);
8869         }
8870       }
8871     } else {
8872       flag_str[8] = '\0';
8873     }
8874
8875     proto_item_append_text(ti, ", Flags: %s", flag_str);
8876     col_append_fstr (pinfo->cinfo, COL_INFO, ", Flags=%s", flag_str);
8877
8878
8879   /*
8880    * Only management and data frames have a body, so we don't have
8881    * anything more to do for other types of frames.
8882    */
8883   switch (FCF_FRAME_TYPE (fcf))
8884     {
8885
8886     case MGT_FRAME:
8887       if (htc_len == 4) {
8888         dissect_ht_control(hdr_tree, tvb, ohdr_len - 4);
8889       }
8890       break;
8891
8892     case DATA_FRAME:
8893       if (tree && DATA_FRAME_IS_QOS(frame_type_subtype))
8894       {
8895         proto_item *qos_fields;
8896         proto_tree *qos_tree;
8897
8898         guint16 qosoff;
8899         guint16 qos_control;
8900         guint16 qos_priority;
8901         guint16 qos_ack_policy;
8902         guint16 qos_amsdu_present;
8903         guint16 qos_eosp;
8904         guint16 qos_field_content;
8905
8906         /*
8907          * We calculate the offset to the QoS header data as
8908          * an offset relative to the end of the header.  But
8909          * when the header has been padded to align the data
8910          * this must be done relative to true header size, not
8911          * the padded/aligned value.  To simplify this work we
8912          * stash the original header size in ohdr_len instead
8913          * of recalculating it.
8914          */
8915         qosoff = ohdr_len - htc_len - 2;
8916         qos_fields = proto_tree_add_text(hdr_tree, tvb, qosoff, 2,
8917             "QoS Control");
8918         qos_tree = proto_item_add_subtree (qos_fields, ett_qos_parameters);
8919
8920         qos_control = tvb_get_letohs(tvb, qosoff + 0);
8921         qos_priority = QOS_PRIORITY(qos_control);
8922         qos_ack_policy = QOS_ACK_POLICY(qos_control);
8923         qos_amsdu_present = QOS_AMSDU_PRESENT(qos_control);
8924         qos_eosp = QOS_EOSP(qos_control);
8925         qos_field_content = QOS_FIELD_CONTENT(qos_control);
8926
8927         proto_tree_add_uint_format (qos_tree, hf_ieee80211_qos_priority, tvb,
8928             qosoff, 1, qos_priority,
8929             "Priority: %d (%s) (%s)",
8930             qos_priority, qos_tags[qos_priority], qos_acs[qos_priority]);
8931
8932         if (flags & FLAG_FROM_DS) {
8933           proto_tree_add_boolean (qos_tree, hf_ieee80211_qos_eosp, tvb,
8934               qosoff, 1, qos_control);
8935         } else {
8936           proto_tree_add_boolean (qos_tree, hf_ieee80211_qos_bit4, tvb,
8937               qosoff, 1, qos_control);
8938         }
8939
8940         proto_tree_add_uint (qos_tree, hf_ieee80211_qos_ack_policy, tvb, qosoff, 1,
8941             qos_ack_policy);
8942
8943         if (flags & FLAG_FROM_DS) {
8944           if (!DATA_FRAME_IS_NULL(frame_type_subtype)) {
8945             proto_tree_add_boolean(qos_tree, hf_ieee80211_qos_amsdu_present, tvb,
8946                 qosoff, 1, qos_amsdu_present);
8947             is_amsdu = qos_amsdu_present;
8948           }
8949           if (DATA_FRAME_IS_CF_POLL(frame_type_subtype)) {
8950             /* txop limit */
8951             if (qos_field_content == 0) {
8952               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_txop_limit, tvb,
8953                   qosoff + 1, 1, qos_field_content,
8954                                                 "transmit one frame immediately (0)");
8955             } else {
8956               proto_tree_add_uint (qos_tree, hf_ieee80211_qos_txop_limit, tvb,
8957                                    qosoff + 1, 1, qos_field_content);
8958             }
8959           } else {
8960             /* qap ps buffer state */
8961             proto_item *qos_ps_buf_state_fields;
8962             proto_tree *qos_ps_buf_state_tree;
8963             guint8 qap_buf_load;
8964
8965             qos_ps_buf_state_fields = proto_tree_add_text(qos_tree, tvb, qosoff + 1, 1,
8966                 "QAP PS Buffer State: 0x%x", qos_field_content);
8967             qos_ps_buf_state_tree = proto_item_add_subtree (qos_ps_buf_state_fields, ett_qos_ps_buf_state);
8968
8969             proto_tree_add_boolean (qos_ps_buf_state_tree, hf_ieee80211_qos_buf_state_indicated,
8970                                     tvb, qosoff + 1, 1, qos_field_content);
8971
8972             if (QOS_PS_BUF_STATE_INDICATED(qos_field_content)) {
8973               proto_tree_add_uint (qos_ps_buf_state_tree, hf_ieee80211_qos_highest_pri_buf_ac, tvb,
8974                   qosoff + 1, 1, qos_field_content);
8975
8976               qap_buf_load = QOS_PS_QAP_BUF_LOAD(qos_field_content);
8977               switch (qap_buf_load) {
8978
8979               case 0:
8980                 proto_tree_add_uint_format_value (qos_ps_buf_state_tree, hf_ieee80211_qos_qap_buf_load, tvb,
8981                     qosoff + 1, 1, qos_field_content,
8982                     "no buffered traffic (0)");
8983                 break;
8984
8985               default:
8986                 proto_tree_add_uint_format_value (qos_ps_buf_state_tree, hf_ieee80211_qos_qap_buf_load, tvb,
8987                     qosoff + 1, 1, qos_field_content,
8988                     "%d octets (%d)", qap_buf_load*4096, qap_buf_load);
8989                 break;
8990
8991               case 15:
8992                 proto_tree_add_uint_format_value (qos_ps_buf_state_tree, hf_ieee80211_qos_qap_buf_load, tvb,
8993                     qosoff + 1, 1, qos_field_content,
8994                     "greater than 57344 octets (15)");
8995                 break;
8996               }
8997             }
8998           }
8999         } else {
9000           if (!DATA_FRAME_IS_NULL(frame_type_subtype)) {
9001             proto_tree_add_boolean(qos_tree, hf_ieee80211_qos_amsdu_present, tvb,
9002                 qosoff, 1, qos_amsdu_present);
9003             is_amsdu = qos_amsdu_present;
9004           }
9005           if (qos_eosp) {
9006             /* queue size */
9007             switch (qos_field_content) {
9008
9009             case 0:
9010               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
9011                                                 tvb, qosoff + 1, 1, qos_field_content,
9012                   "no buffered traffic in the queue (0)");
9013               break;
9014
9015             default:
9016               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
9017                                                 tvb, qosoff + 1, 1, qos_field_content,
9018                                                 "%u bytes (%u)", qos_field_content*256, qos_field_content);
9019               break;
9020
9021             case 254:
9022               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
9023                                                 tvb, qosoff + 1, 1, qos_field_content,
9024                   "more than 64768 octets (254)");
9025               break;
9026
9027             case 255:
9028               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
9029                                                 tvb, qosoff + 1, 1, qos_field_content,
9030                   "unspecified or unknown (256)");
9031               break;
9032             }
9033           } else {
9034             /* txop duration requested */
9035             if (qos_field_content == 0) {
9036               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_txop_dur_req,
9037                                                 tvb, qosoff + 1, 1, qos_field_content,
9038                                                 "no TXOP requested (0)");
9039             } else {
9040               proto_tree_add_uint (qos_tree, hf_ieee80211_qos_txop_dur_req,
9041                                    tvb, qosoff + 1, 1, qos_field_content);
9042             }
9043           }
9044         }
9045
9046         /* Do we have +HTC? */
9047         if (htc_len == 4) {
9048           dissect_ht_control(hdr_tree, tvb, ohdr_len - 4);
9049         }
9050       } /* end of qos control field */
9051
9052 #ifdef HAVE_AIRPDCAP
9053       /* Davide Schiera (2006-11-21): process handshake packet with AirPDcap    */
9054       /* the processing will take care of 4-way handshake sessions for WPA    */
9055       /* and WPA2 decryption                                  */
9056       if (enable_decryption && !pinfo->fd->flags.visited) {
9057         const guint8 *enc_data = tvb_get_ptr(tvb, 0, hdr_len+reported_len);
9058         AirPDcapPacketProcess(&airpdcap_ctx, enc_data, hdr_len, hdr_len+reported_len, NULL, 0, NULL, TRUE, FALSE);
9059       }
9060       /* Davide Schiera --------------------------------------------------------  */
9061 #endif
9062
9063       /*
9064        * No-data frames don't have a body.
9065        */
9066       if (DATA_FRAME_IS_NULL(frame_type_subtype))
9067         return;
9068
9069       if (!wlan_subdissector) {
9070         guint fnum = 0;
9071
9072         /* key: bssid:src
9073          * data: last seq_control seen and frame number
9074          */
9075         retransmitted = FALSE;
9076         if(!pinfo->fd->flags.visited){
9077           retransmit_key key;
9078           retransmit_key *result;
9079
9080           memcpy(key.bssid, bssid, 6);
9081           memcpy(key.src, src, 6);
9082           key.seq_control = 0;
9083           result = (retransmit_key *)g_hash_table_lookup(fc_analyse_retransmit_table, &key);
9084           if (result && result->seq_control == seq_control) {
9085                /* keep a pointer to the first seen frame, could be done with proto data? */
9086                fnum = result->fnum;
9087                g_hash_table_insert(fc_first_frame_table, GINT_TO_POINTER( pinfo->fd->num),
9088                   GINT_TO_POINTER(fnum));
9089                retransmitted = TRUE;
9090           } else {
9091                /* first time or new seq*/
9092                if (!result) {
9093                   result = se_alloc(sizeof(retransmit_key));
9094                   *result = key;
9095                   g_hash_table_insert(fc_analyse_retransmit_table, result, result);
9096                }
9097                result->seq_control = seq_control;
9098                result->fnum =  pinfo->fd->num;
9099            }
9100         }
9101         else if ((fnum = GPOINTER_TO_UINT(g_hash_table_lookup(fc_first_frame_table, GINT_TO_POINTER( pinfo->fd->num))))) {
9102            retransmitted = TRUE;
9103         }
9104
9105         if (retransmitted) {
9106             col_append_str(pinfo->cinfo, COL_INFO, " [retransmitted]");
9107             if (tree) {
9108                 proto_item *item;
9109
9110                 item=proto_tree_add_none_format(hdr_tree, hf_ieee80211_fc_analysis_retransmission, tvb, 0, 0, "Retransmitted frame");
9111                 PROTO_ITEM_SET_GENERATED(item);
9112                 item=proto_tree_add_uint(hdr_tree, hf_ieee80211_fc_analysis_retransmission_frame,tvb, 0, 0, fnum);
9113                 PROTO_ITEM_SET_GENERATED(item);
9114             }
9115             next_tvb = tvb_new_subset (tvb, hdr_len, len, reported_len);
9116             call_dissector(data_handle, next_tvb, pinfo, tree);
9117             goto end_of_wlan;
9118         }
9119       }
9120
9121       break;
9122
9123     case CONTROL_FRAME:
9124       return;
9125
9126     default:
9127       return;
9128     }
9129
9130   if (IS_PROTECTED(FCF_FLAGS(fcf)) && wlan_ignore_wep != WLAN_IGNORE_WEP_WO_IV) {
9131     /*
9132      * It's a WEP or WPA encrypted frame; dissect the protections parameters
9133      * and decrypt the data, if we have a matching key. Otherwise display it as data.
9134      */
9135
9136     gboolean can_decrypt = FALSE;
9137     proto_tree *wep_tree = NULL;
9138     guint32 iv;
9139     guint8 key, keybyte;
9140
9141     /* Davide Schiera (2006-11-27): define algorithms constants and macros  */
9142 #ifdef HAVE_AIRPDCAP
9143 #define PROTECTION_ALG_TKIP  AIRPDCAP_KEY_TYPE_TKIP
9144 #define PROTECTION_ALG_CCMP  AIRPDCAP_KEY_TYPE_CCMP
9145 #define PROTECTION_ALG_WEP  AIRPDCAP_KEY_TYPE_WEP
9146 #define PROTECTION_ALG_RSNA  PROTECTION_ALG_CCMP | PROTECTION_ALG_TKIP
9147 #else
9148 #define PROTECTION_ALG_WEP  0
9149 #define PROTECTION_ALG_TKIP  1
9150 #define PROTECTION_ALG_CCMP  2
9151 #define PROTECTION_ALG_RSNA  PROTECTION_ALG_CCMP | PROTECTION_ALG_TKIP
9152 #endif
9153     guint8 algorithm=G_MAXUINT8;
9154     /* Davide Schiera (2006-11-27): added macros to check the algorithm    */
9155     /* used could be TKIP or CCMP                            */
9156 #define IS_TKIP(tvb, hdr_len)  (tvb_get_guint8(tvb, hdr_len + 1) & 0x20)
9157 #define IS_CCMP(tvb, hdr_len)  (tvb_get_guint8(tvb, hdr_len + 2) == 0)
9158     /* Davide Schiera -----------------------------------------------------  */
9159
9160 #ifdef  HAVE_AIRPDCAP
9161     /* Davide Schiera (2006-11-21): recorded original lengths to pass them  */
9162     /* to the packets process function                        */
9163     guint32 sec_header=0;
9164     guint32 sec_trailer=0;
9165
9166     next_tvb = try_decrypt(tvb, hdr_len, reported_len, &algorithm, &sec_header, &sec_trailer);
9167 #endif
9168     /* Davide Schiera -----------------------------------------------------  */
9169
9170     keybyte = tvb_get_guint8(tvb, hdr_len + 3);
9171     key = KEY_OCTET_WEP_KEY(keybyte);
9172     if ((keybyte & KEY_EXTIV) && (len >= EXTIV_LEN)) {
9173       /* Extended IV; this frame is likely encrypted with TKIP or CCMP */
9174
9175
9176       if (tree) {
9177         proto_item *extiv_fields;
9178
9179 #ifdef HAVE_AIRPDCAP
9180         /* Davide Schiera (2006-11-27): differentiated CCMP and TKIP if  */
9181         /* it's possible                                */
9182         if (algorithm==PROTECTION_ALG_TKIP)
9183           extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
9184               "TKIP parameters");
9185         else if (algorithm==PROTECTION_ALG_CCMP)
9186           extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
9187             "CCMP parameters");
9188         else {
9189           /* Davide Schiera --------------------------------------------  */
9190 #endif
9191           /* Davide Schiera (2006-11-27): differentiated CCMP and TKIP if*/
9192           /* it's possible                              */
9193           if (IS_TKIP(tvb, hdr_len)) {
9194             algorithm=PROTECTION_ALG_TKIP;
9195             extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
9196                 "TKIP parameters");
9197           } else if (IS_CCMP(tvb, hdr_len)) {
9198             algorithm=PROTECTION_ALG_CCMP;
9199             extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
9200                 "CCMP parameters");
9201           } else
9202             extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
9203                 "TKIP/CCMP parameters");
9204 #ifdef HAVE_AIRPDCAP
9205         }
9206 #endif
9207         proto_item_set_len (ti, hdr_len + 8);
9208
9209         wep_tree = proto_item_add_subtree (extiv_fields, ett_wep_parameters);
9210
9211         if (algorithm==PROTECTION_ALG_TKIP) {
9212           g_snprintf(out_buff, SHORT_STR, "0x%08X%02X%02X",
9213               tvb_get_letohl(tvb, hdr_len + 4),
9214               tvb_get_guint8(tvb, hdr_len),
9215               tvb_get_guint8(tvb, hdr_len + 2));
9216           proto_tree_add_string(wep_tree, hf_ieee80211_tkip_extiv, tvb, hdr_len,
9217               EXTIV_LEN, out_buff);
9218         } else if (algorithm==PROTECTION_ALG_CCMP) {
9219           g_snprintf(out_buff, SHORT_STR, "0x%08X%02X%02X",
9220               tvb_get_letohl(tvb, hdr_len + 4),
9221               tvb_get_guint8(tvb, hdr_len + 1),
9222               tvb_get_guint8(tvb, hdr_len));
9223           proto_tree_add_string(wep_tree, hf_ieee80211_ccmp_extiv, tvb, hdr_len,
9224               EXTIV_LEN, out_buff);
9225         }
9226
9227         proto_tree_add_uint(wep_tree, hf_ieee80211_wep_key, tvb, hdr_len + 3, 1, key);
9228       }
9229
9230       /* Subtract out the length of the IV. */
9231       len -= EXTIV_LEN;
9232       reported_len -= EXTIV_LEN;
9233       ivlen = EXTIV_LEN;
9234       /* It is unknown whether this is TKIP or CCMP, so let's not even try to
9235        * parse TKIP Michael MIC+ICV or CCMP MIC. */
9236
9237 #ifdef HAVE_AIRPDCAP
9238       /* Davide Schiera (2006-11-21): enable TKIP and CCMP decryption      */
9239       /* checking for the trailer                            */
9240       if (next_tvb!=NULL) {
9241         if (reported_len < (gint) sec_trailer) {
9242           /* There is no space for a trailer, ignore it and don't decrypt  */
9243           ;
9244         } else if (len < reported_len) {
9245           /* There is space for a trailer, but we haven't capture all the  */
9246           /* packet. Slice off the trailer, but don't try to decrypt      */
9247           reported_len -= sec_trailer;
9248           if (len > reported_len)
9249             len = reported_len;
9250         } else {
9251           /* Ok, we have a trailer and the whole packet. Decrypt it!      */
9252           /* TODO: At the moment we won't add the trailer to the tree,    */
9253           /* so don't remove the trailer from the packet              */
9254           len -= sec_trailer;
9255           reported_len -= sec_trailer;
9256           can_decrypt = TRUE;
9257         }
9258       }
9259       /* Davide Schiera --------------------------------------------------  */
9260 #endif
9261     } else {
9262       /* No Ext. IV - WEP packet */
9263       /*
9264        * XXX - pass the IV and key to "try_decrypt_wep()", and have it pass
9265        * them to "wep_decrypt()", rather than having "wep_decrypt()" extract
9266        * them itself.
9267        *
9268        * Also, just pass the data *following* the WEP parameters as the
9269        * buffer to decrypt.
9270        */
9271       iv = tvb_get_ntoh24(tvb, hdr_len);
9272       if (tree) {
9273         proto_item *wep_fields;
9274
9275         wep_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 4,
9276             "WEP parameters");
9277
9278         wep_tree = proto_item_add_subtree (wep_fields, ett_wep_parameters);
9279         proto_tree_add_uint (wep_tree, hf_ieee80211_wep_iv, tvb, hdr_len, 3, iv);
9280         tvb_memcpy(tvb, iv_buff, hdr_len, 3);
9281         is_iv_bad = weak_iv(iv_buff);
9282         if (is_iv_bad != -1) {
9283           proto_tree_add_boolean_format (wep_tree, hf_ieee80211_wep_iv_weak,
9284               tvb, 0, 0, TRUE,
9285               "Weak IV for key byte %d",
9286               is_iv_bad);
9287         }
9288       }
9289       if (tree)
9290         proto_tree_add_uint (wep_tree, hf_ieee80211_wep_key, tvb, hdr_len + 3, 1, key);
9291
9292       /* Subtract out the length of the IV. */
9293       len -= 4;
9294       reported_len -= 4;
9295       ivlen = 4;
9296
9297       /* Davide Schiera (2006-11-27): Even if the decryption was not */
9298       /* successful, set the algorithm                               */
9299       algorithm=PROTECTION_ALG_WEP;
9300
9301       /*
9302        * Well, this packet should, in theory, have an ICV.
9303        * Do we have the entire packet, and does it have enough data for
9304        * the ICV?
9305        */
9306       if (reported_len < 4) {
9307         /*
9308          * The packet is claimed not to even have enough data for a
9309          * 4-byte ICV.
9310          * Pretend it doesn't have an ICV.
9311          */
9312         ;
9313       } else if (len < reported_len) {
9314         /*
9315          * The packet is claimed to have enough data for a 4-byte ICV,
9316          * but we didn't capture all of the packet.
9317          * Slice off the 4-byte ICV from the reported length, and trim
9318          * the captured length so it's no more than the reported length;
9319          * that will slice off what of the ICV, if any, is in the
9320          * captured length.
9321          */
9322         reported_len -= 4;
9323         if (len > reported_len)
9324           len = reported_len;
9325       } else {
9326         /*
9327          * We have the entire packet, and it includes a 4-byte ICV.
9328          * Slice it off, and put it into the tree.
9329          *
9330          * We only support decrypting if we have the the ICV.
9331          *
9332          * XXX - the ICV is encrypted; we're putting the encrypted
9333          * value, not the decrypted value, into the tree.
9334          */
9335         len -= 4;
9336         reported_len -= 4;
9337         can_decrypt = TRUE;
9338       }
9339     }
9340
9341     if (algorithm == PROTECTION_ALG_WEP) {
9342       g_strlcpy (wlan_stats.protection, "WEP", MAX_PROTECT_LEN);
9343     } else if (algorithm == PROTECTION_ALG_TKIP) {
9344       g_strlcpy (wlan_stats.protection, "TKIP", MAX_PROTECT_LEN);
9345     } else if (algorithm == PROTECTION_ALG_CCMP) {
9346       g_strlcpy (wlan_stats.protection, "CCMP", MAX_PROTECT_LEN);
9347     } else {
9348       g_strlcpy (wlan_stats.protection, "Unknown", MAX_PROTECT_LEN);
9349     }
9350
9351 #ifndef HAVE_AIRPDCAP
9352     if (can_decrypt)
9353       next_tvb = try_decrypt_wep(tvb, hdr_len, reported_len + 8);
9354 #else
9355     /* Davide Schiera (2006-11-26): decrypted before parsing header and    */
9356     /* protection header                                  */
9357 #endif
9358     if (!can_decrypt || next_tvb == NULL) {
9359       /*
9360        * WEP decode impossible or failed, treat payload as raw data
9361        * and don't attempt fragment reassembly or further dissection.
9362        */
9363       next_tvb = tvb_new_subset(tvb, hdr_len + ivlen, len, reported_len);
9364
9365       if (tree) {
9366         /* Davide Schiera (2006-11-21): added WEP or WPA separation      */
9367         if (algorithm==PROTECTION_ALG_WEP) {
9368           if (can_decrypt)
9369             proto_tree_add_uint_format (wep_tree, hf_ieee80211_wep_icv, tvb,
9370                 hdr_len + ivlen + len, 4,
9371                 tvb_get_ntohl(tvb, hdr_len + ivlen + len),
9372                 "WEP ICV: 0x%08x (not verified)",
9373                 tvb_get_ntohl(tvb, hdr_len + ivlen + len));
9374         } else if (algorithm==PROTECTION_ALG_CCMP) {
9375         } else if (algorithm==PROTECTION_ALG_TKIP) {
9376         }
9377       }
9378       /* Davide Schiera (2006-11-21) ----------------------------------  */
9379
9380       if (pinfo->ethertype != ETHERTYPE_CENTRINO_PROMISC && wlan_ignore_wep == WLAN_IGNORE_WEP_NO) {
9381         /* Some wireless drivers (such as Centrino) WEP payload already decrypted */
9382         call_dissector(data_handle, next_tvb, pinfo, tree);
9383         goto end_of_wlan;
9384       }
9385     } else {
9386       /* Davide Schiera (2006-11-21): added WEP or WPA separation        */
9387       if (algorithm==PROTECTION_ALG_WEP) {
9388         if (tree)
9389           proto_tree_add_uint_format (wep_tree, hf_ieee80211_wep_icv, tvb,
9390               hdr_len + ivlen + len, 4,
9391               tvb_get_ntohl(tvb, hdr_len + ivlen + len),
9392               "WEP ICV: 0x%08x (correct)",
9393               tvb_get_ntohl(tvb, hdr_len + ivlen + len));
9394
9395         add_new_data_source(pinfo, next_tvb, "Decrypted WEP data");
9396       } else if (algorithm==PROTECTION_ALG_CCMP) {
9397         add_new_data_source(pinfo, next_tvb, "Decrypted CCMP data");
9398       } else if (algorithm==PROTECTION_ALG_TKIP) {
9399         add_new_data_source(pinfo, next_tvb, "Decrypted TKIP data");
9400       }
9401       /* Davide Schiera (2006-11-21) -------------------------------------  */
9402       /* Davide Schiera (2006-11-27): undefine macros and definitions  */
9403 #undef IS_TKIP
9404 #undef IS_CCMP
9405 #undef PROTECTION_ALG_CCMP
9406 #undef PROTECTION_ALG_TKIP
9407 #undef PROTECTION_ALG_WEP
9408       /* Davide Schiera --------------------------------------------------  */
9409     }
9410
9411     /*
9412      * WEP decryption successful!
9413      *
9414      * Use the tvbuff we got back from the decryption; the data starts at
9415      * the beginning.  The lengths are already correct for the decoded WEP
9416      * payload.
9417      */
9418     hdr_len = 0;
9419
9420   } else {
9421     /*
9422      * Not a WEP-encrypted frame; just use the data from the tvbuff
9423      * handed to us.
9424      *
9425      * The payload starts at "hdr_len" (i.e., just past the 802.11
9426      * MAC header), the length of data in the tvbuff following the
9427      * 802.11 header is "len", and the length of data in the packet
9428      * following the 802.11 header is "reported_len".
9429      */
9430     next_tvb = tvb;
9431   }
9432
9433   /*
9434    * Do defragmentation if "wlan_defragment" is true, and we have more
9435    * fragments or this isn't the first fragment.
9436    *
9437    * We have to do some special handling to catch frames that
9438    * have the "More Fragments" indicator not set but that
9439    * don't show up as reassembled and don't have any other
9440    * fragments present.  Some networking interfaces appear
9441    * to do reassembly even when you're capturing raw packets
9442    * *and* show the reassembled packet without the "More
9443    * Fragments" indicator set *but* with a non-zero fragment
9444    * number.
9445    *
9446    * "fragment_add_seq_802_11()" handles that; we want to call it
9447    * even if we have a short frame, so that it does those checks - if
9448    * the frame is short, it doesn't do reassembly on it.
9449    *
9450    * (This could get some false positives if we really *did* only
9451    * capture the last fragment of a fragmented packet, but that's
9452    * life.)
9453    */
9454   save_fragmented = pinfo->fragmented;
9455   if (wlan_defragment && (more_frags || frag_number != 0)) {
9456     fragment_data *fd_head;
9457
9458     /*
9459      * If we've already seen this frame, look it up in the
9460      * table of reassembled packets, otherwise add it to
9461      * whatever reassembly is in progress, if any, and see
9462      * if it's done.
9463      */
9464     if (reported_len < 0)
9465       THROW(ReportedBoundsError);
9466     fd_head = fragment_add_seq_802_11(next_tvb, hdr_len, pinfo, seq_number,
9467         wlan_fragment_table,
9468         wlan_reassembled_table,
9469         frag_number,
9470         reported_len,
9471         more_frags);
9472     next_tvb = process_reassembled_data(tvb, hdr_len, pinfo,
9473         "Reassembled 802.11", fd_head,
9474         &frag_items, NULL, hdr_tree);
9475   } else {
9476     /*
9477      * If this is the first fragment, dissect its contents, otherwise
9478      * just show it as a fragment.
9479      */
9480     if (frag_number != 0) {
9481       /* Not the first fragment - don't dissect it. */
9482       next_tvb = NULL;
9483     } else {
9484       /* First fragment, or not fragmented.  Dissect what we have here. */
9485
9486       /* Get a tvbuff for the payload. */
9487       next_tvb = tvb_new_subset (next_tvb, hdr_len, len, reported_len);
9488
9489       /*
9490        * If this is the first fragment, but not the only fragment,
9491        * tell the next protocol that.
9492        */
9493       if (more_frags)
9494         pinfo->fragmented = TRUE;
9495       else
9496         pinfo->fragmented = FALSE;
9497     }
9498   }
9499
9500   if (next_tvb == NULL) {
9501     /* Just show this as an incomplete fragment. */
9502     col_set_str(pinfo->cinfo, COL_INFO, "Fragmented IEEE 802.11 frame");
9503     next_tvb = tvb_new_subset (tvb, hdr_len, len, reported_len);
9504     call_dissector(data_handle, next_tvb, pinfo, tree);
9505     pinfo->fragmented = save_fragmented;
9506     goto end_of_wlan;
9507   }
9508
9509   switch (FCF_FRAME_TYPE (fcf))
9510     {
9511
9512     case MGT_FRAME:
9513       dissect_ieee80211_mgt (fcf, next_tvb, pinfo, tree);
9514       break;
9515
9516     case DATA_FRAME:
9517       if (is_amsdu && tvb_reported_length_remaining(next_tvb, 0) > 4){
9518         tvbuff_t *volatile msdu_tvb = NULL;
9519         guint32 msdu_offset = 0;
9520         guint16 i = 1;
9521         const guint8 *lcl_src = NULL;
9522         const guint8 *lcl_dst = NULL;
9523         guint16 msdu_length;
9524         proto_item *parent_item;
9525         proto_tree *mpdu_tree;
9526         proto_tree *subframe_tree;
9527
9528         parent_item = proto_tree_add_protocol_format(tree, proto_aggregate, next_tvb, 0,
9529                                     tvb_reported_length_remaining(next_tvb, 0), "IEEE 802.11 Aggregate MSDU");
9530         mpdu_tree = proto_item_add_subtree(parent_item, ett_msdu_aggregation_parent_tree);
9531
9532         do {
9533           lcl_dst = tvb_get_ptr (next_tvb, msdu_offset, 6);
9534           lcl_src = tvb_get_ptr (next_tvb, msdu_offset+6, 6);
9535           msdu_length = tvb_get_ntohs (next_tvb, msdu_offset+12);
9536
9537           parent_item = proto_tree_add_uint_format(mpdu_tree, hf_ieee80211_amsdu_msdu_header_text, next_tvb,
9538                             msdu_offset, roundup2(msdu_offset+14+msdu_length, 4),
9539                             i, "A-MSDU Subframe #%u", i);
9540           subframe_tree = proto_item_add_subtree(parent_item, ett_msdu_aggregation_subframe_tree);
9541           i++;
9542
9543           proto_tree_add_ether(subframe_tree, hf_ieee80211_addr_da, next_tvb, msdu_offset, 6, lcl_dst);
9544           proto_tree_add_ether(subframe_tree, hf_ieee80211_addr_sa, next_tvb, msdu_offset+6, 6, lcl_src);
9545           proto_tree_add_uint_format(subframe_tree, hf_ieee80211_mcsset_highest_data_rate, next_tvb, msdu_offset+12, 2,
9546           msdu_length, "MSDU length: 0x%04X", msdu_length);
9547
9548           msdu_offset += 14;
9549           msdu_tvb = tvb_new_subset(next_tvb, msdu_offset, msdu_length, -1);
9550           call_dissector(llc_handle, msdu_tvb, pinfo, subframe_tree);
9551           msdu_offset = roundup2(msdu_offset+msdu_length, 4);
9552         } while (tvb_reported_length_remaining(next_tvb, msdu_offset) > 14);
9553
9554         break;
9555       }
9556       /* I guess some bridges take Netware Ethernet_802_3 frames,
9557          which are 802.3 frames (with a length field rather than
9558          a type field, but with no 802.2 header in the payload),
9559          and just stick the payload into an 802.11 frame.  I've seen
9560          captures that show frames of that sort.
9561
9562          We also handle some odd form of encapsulation in which a
9563          complete Ethernet frame is encapsulated within an 802.11
9564          data frame, with no 802.2 header.  This has been seen
9565          from some hardware.
9566
9567          On top of that, at least at some point it appeared that
9568          the OLPC XO sent out frames with two bytes of 0 between
9569          the "end" of the 802.11 header and the beginning of
9570          the payload.
9571
9572          So, if the packet doesn't start with 0xaa 0xaa:
9573
9574            we first use the same scheme that linux-wlan-ng does to detect
9575            those encapsulated Ethernet frames, namely looking to see whether
9576            the frame either starts with 6 octets that match the destination
9577            address from the 802.11 header or has 6 octets that match the
9578            source address from the 802.11 header following the first 6 octets,
9579            and, if so, treat it as an encapsulated Ethernet frame;
9580
9581            otherwise, we use the same scheme that we use in the Ethernet
9582            dissector to recognize Netware 802.3 frames, namely checking
9583            whether the packet starts with 0xff 0xff and, if so, treat it
9584            as an encapsulated IPX frame, and then check whether the
9585            packet starts with 0x00 0x00 and, if so, treat it as an OLPC
9586            frame. */
9587       encap_type = ENCAP_802_2;
9588       TRY {
9589         octet1 = tvb_get_guint8(next_tvb, 0);
9590         octet2 = tvb_get_guint8(next_tvb, 1);
9591         if (octet1 != 0xaa || octet2 != 0xaa) {
9592           if (tvb_memeql(next_tvb, 6, pinfo->dl_src.data, 6) == 0 ||
9593               tvb_memeql(next_tvb, 0, pinfo->dl_dst.data, 6) == 0)
9594             encap_type = ENCAP_ETHERNET;
9595           else if (octet1 == 0xff && octet2 == 0xff)
9596             encap_type = ENCAP_IPX;
9597           else if (octet1 == 0x00 && octet2 == 0x00) {
9598             proto_tree_add_text(tree, next_tvb, 0, 2, "Mysterious OLPC stuff");
9599             next_tvb = tvb_new_subset_remaining (next_tvb, 2);
9600           }
9601         }
9602       }
9603       CATCH2(BoundsError, ReportedBoundsError) {
9604       ; /* do nothing */
9605
9606       }
9607       ENDTRY;
9608
9609       switch (encap_type) {
9610
9611       case ENCAP_802_2:
9612         call_dissector(llc_handle, next_tvb, pinfo, tree);
9613         break;
9614
9615       case ENCAP_ETHERNET:
9616         call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
9617         break;
9618
9619       case ENCAP_IPX:
9620         call_dissector(ipx_handle, next_tvb, pinfo, tree);
9621         break;
9622       }
9623       break;
9624     }
9625   pinfo->fragmented = save_fragmented;
9626
9627   end_of_wlan:
9628   whdr->stats = wlan_stats;
9629   tap_queue_packet(wlan_tap, pinfo, whdr);
9630   memset (&wlan_stats, 0, sizeof wlan_stats);
9631 }
9632
9633 /*
9634  * Dissect 802.11 with a variable-length link-layer header.
9635  */
9636 static void
9637 dissect_ieee80211 (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
9638 {
9639   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
9640       pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, FALSE);
9641 }
9642
9643 /*
9644  * Dissect 802.11 with a variable-length link-layer header and data padding.
9645  */
9646 static void
9647 dissect_ieee80211_datapad (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
9648 {
9649   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
9650       pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, TRUE, FALSE);
9651 }
9652
9653 /*
9654  * Dissect 802.11 with a variable-length link-layer header and a pseudo-
9655  * header containing radio information.
9656  */
9657 static void
9658 dissect_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
9659 {
9660   proto_item *ti = NULL;
9661   proto_tree *radio_tree = NULL;
9662
9663   col_set_str(pinfo->cinfo, COL_PROTOCOL, "Radio");
9664   col_clear(pinfo->cinfo, COL_INFO);
9665
9666   /* Add the radio information to the column information */
9667   col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%u.%u",
9668         pinfo->pseudo_header->ieee_802_11.data_rate / 2,
9669         pinfo->pseudo_header->ieee_802_11.data_rate & 1 ? 5 : 0);
9670     /* XX - this is a percentage, not a dBm or normalized or raw RSSI */
9671   col_add_fstr(pinfo->cinfo, COL_RSSI, "%u",
9672         pinfo->pseudo_header->ieee_802_11.signal_level);
9673
9674   if (tree) {
9675     ti = proto_tree_add_item(tree, proto_radio, tvb, 0, 0, FALSE);
9676     radio_tree = proto_item_add_subtree (ti, ett_radio);
9677
9678     proto_tree_add_uint64_format(radio_tree, hf_data_rate, tvb, 0, 0,
9679              (guint64)pinfo->pseudo_header->ieee_802_11.data_rate * 500000,
9680              "Data Rate: %u.%u Mb/s",
9681              pinfo->pseudo_header->ieee_802_11.data_rate / 2,
9682              pinfo->pseudo_header->ieee_802_11.data_rate & 1 ? 5 : 0);
9683
9684     proto_tree_add_uint(radio_tree, hf_channel, tvb, 0, 0,
9685             pinfo->pseudo_header->ieee_802_11.channel);
9686
9687     proto_tree_add_uint_format(radio_tree, hf_signal_strength, tvb, 0, 0,
9688             pinfo->pseudo_header->ieee_802_11.signal_level,
9689             "Signal Strength: %u%%",
9690             pinfo->pseudo_header->ieee_802_11.signal_level);
9691   }
9692
9693   pinfo->current_proto = "IEEE 802.11";
9694   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
9695      pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, FALSE);
9696 }
9697
9698 /*
9699  * Dissect 802.11 with a variable-length link-layer header and a byte-swapped
9700  * control field (some hardware sends out LWAPP-encapsulated 802.11
9701  * packets with the control field byte swapped).
9702  */
9703 static void
9704 dissect_ieee80211_bsfc (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
9705 {
9706   dissect_ieee80211_common (tvb, pinfo, tree, FALSE, 0, TRUE, FALSE, FALSE);
9707 }
9708
9709 /*
9710  * Dissect 802.11 with a fixed-length link-layer header (padded to the
9711  * maximum length).
9712  */
9713 static void
9714 dissect_ieee80211_fixed (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
9715 {
9716   dissect_ieee80211_common (tvb, pinfo, tree, TRUE, 0, FALSE, FALSE, FALSE);
9717 }
9718
9719 /*
9720  * Dissect an HT 802.11 frame with a variable-length link-layer header.
9721  * XXX - Can we tell if a frame is +HTC just by looking at the MAC header?
9722  * If so, we can dispense with this.
9723  */
9724 static void
9725 dissect_ieee80211_ht (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
9726 {
9727   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
9728       pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, TRUE);
9729 }
9730
9731 static void
9732 wlan_defragment_init(void)
9733 {
9734   fragment_table_init(&wlan_fragment_table);
9735   reassembled_table_init(&wlan_reassembled_table);
9736 }
9737
9738 /* ------------- */
9739 static guint
9740 retransmit_hash(gconstpointer k)
9741 {
9742   const retransmit_key *key = (const retransmit_key *)k;
9743   guint hash_val;
9744   int i;
9745
9746   hash_val = 0;
9747   for (i = 0; i < 6; i++)
9748     hash_val += key->bssid[i];
9749
9750   for (i = 0; i < 6; i++)
9751     hash_val += key->src[i];
9752
9753   return hash_val;
9754 }
9755
9756 static gint
9757 retransmit_equal(gconstpointer k1, gconstpointer k2)
9758 {
9759   const retransmit_key *key1 = (const retransmit_key *)k1;
9760   const retransmit_key *key2 = (const retransmit_key *)k2;
9761
9762   return ( (!memcmp(key1->bssid, key2->bssid, 6) && !memcmp( key1->src, key2->src, 6))? TRUE:FALSE);
9763 }
9764
9765 static guint
9766 frame_hash(gconstpointer k)
9767 {
9768   guint32 frame = GPOINTER_TO_UINT(k);
9769
9770   return frame;
9771 }
9772
9773 static gint
9774 frame_equal(gconstpointer k1, gconstpointer k2)
9775 {
9776   guint32 frame1 = GPOINTER_TO_UINT(k1);
9777   guint32 frame2 = GPOINTER_TO_UINT(k2);
9778
9779   return frame1==frame2;
9780 }
9781
9782 static void
9783 wlan_retransmit_init(void)
9784 {
9785   if ( fc_analyse_retransmit_table ){
9786       g_hash_table_destroy(fc_analyse_retransmit_table);
9787       fc_analyse_retransmit_table = NULL;
9788   }
9789
9790   if( fc_first_frame_table ){
9791       g_hash_table_destroy(fc_first_frame_table);
9792       fc_first_frame_table = NULL;
9793   }
9794
9795   if (wlan_subdissector)
9796       return;
9797
9798   fc_analyse_retransmit_table= g_hash_table_new(retransmit_hash, retransmit_equal);
9799   fc_first_frame_table = g_hash_table_new( frame_hash, frame_equal);
9800
9801 }
9802
9803 static void
9804 dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
9805 {
9806     proto_tree *prism_tree = NULL, *prism_did_tree = NULL;
9807     proto_item *ti = NULL, *ti_did = NULL;
9808     tvbuff_t *next_tvb;
9809     int offset;
9810     guint32 msgcode, msglen, did;
9811     guint8 *devname;
9812
9813     offset = 0;
9814     did = 0;
9815
9816     /* handle the new capture type. */
9817     msgcode = tvb_get_ntohl(tvb, offset);
9818     if ((msgcode == WLANCAP_MAGIC_COOKIE_V1) ||
9819         (msgcode == WLANCAP_MAGIC_COOKIE_V2)) {
9820       call_dissector(wlancap_handle, tvb, pinfo, tree);
9821       return;
9822     }
9823
9824     col_set_str(pinfo->cinfo, COL_PROTOCOL, "Prism");
9825     col_clear(pinfo->cinfo, COL_INFO);
9826
9827     if(tree) {
9828         ti = proto_tree_add_item(tree, proto_prism, tvb, 0, 144, FALSE);
9829         prism_tree = proto_item_add_subtree(ti, ett_prism);
9830     }
9831
9832     /* Message Code */
9833     if(tree) {
9834         proto_tree_add_item(prism_tree, hf_ieee80211_prism_msgcode, tvb, offset, 4, TRUE);
9835     }
9836     msgcode = tvb_get_letohl(tvb, offset);
9837     offset += 4;
9838
9839     /* Message Length */
9840     if(tree) {
9841         proto_tree_add_item(prism_tree, hf_ieee80211_prism_msglen, tvb, offset, 4, TRUE);
9842     }
9843     msglen = tvb_get_letohl(tvb, offset);
9844     offset += 4;
9845
9846     /* Device Name */
9847     if(tree) {
9848        proto_tree_add_item(prism_tree, hf_ieee80211_prism_devname, tvb, offset, 16, TRUE);
9849     }
9850     devname = tvb_get_ephemeral_string(tvb, offset, 16);
9851     offset += 16;
9852
9853     col_add_fstr(pinfo->cinfo, COL_INFO, "Device: %s, Message 0x%x, Length %d", devname, msgcode, msglen);
9854
9855
9856     while(offset < PRISM_HEADER_LENGTH)
9857     {
9858         /* DID */
9859         if(tree) {
9860             ti_did = proto_tree_add_item(prism_tree, hf_ieee80211_prism_did, tvb, offset, 12, TRUE);
9861             prism_did_tree = proto_item_add_subtree(ti_did, ett_prism_did);
9862
9863             proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_type, tvb, offset, 4, TRUE);
9864             did = tvb_get_letohl(tvb, offset);
9865             proto_item_append_text(ti_did, " %s", val_to_str(did, prism_did_vals, "Unknown %x") );
9866         }
9867         offset += 4;
9868
9869
9870         /* Status */
9871         if(tree) {
9872             proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_status, tvb, offset, 2, TRUE);
9873         }
9874         offset += 2;
9875
9876         /* Length */
9877         if(tree) {
9878             proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_length, tvb, offset, 2, TRUE);
9879         }
9880         offset += 2;
9881
9882         /* Data... */
9883         switch(did){
9884           case PRISM_DID_HOSTTIME:
9885             if(tree){
9886                 proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_hosttime, tvb, offset, 4, TRUE);
9887                 proto_item_append_text(ti_did, " %d", tvb_get_letohl(tvb, offset) );
9888             }
9889           break;
9890           case PRISM_DID_MACTIME:
9891             if(tree){
9892                 proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_mactime, tvb, offset, 4, TRUE);
9893                 proto_item_append_text(ti_did, " %d", tvb_get_letohl(tvb, offset) );
9894             }
9895           break;
9896           case PRISM_DID_CHANNEL:
9897             if(tree){
9898                 proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_channel, tvb, offset, 4, TRUE);
9899                 proto_item_append_text(ti_did, " %d", tvb_get_letohl(tvb, offset) );
9900             }
9901             col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u", tvb_get_letohl(tvb, offset));
9902           break;
9903           case PRISM_DID_RSSI:
9904             if(tree){
9905                 proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_rssi, tvb, offset, 4, TRUE);
9906                 proto_item_append_text(ti_did, " 0x%x", tvb_get_letohl(tvb, offset) );
9907             }
9908             col_add_fstr(pinfo->cinfo, COL_RSSI, "%d", tvb_get_letohl(tvb, offset));
9909           break;
9910           case PRISM_DID_SQ:
9911             if(tree){
9912                   proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_sq, tvb, offset, 4, TRUE);
9913                   proto_item_append_text(ti_did, " 0x%x", tvb_get_letohl(tvb, offset) );
9914             }
9915           break;
9916           case PRISM_DID_SIGNAL:
9917             if(tree){
9918                 proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_signal, tvb, offset, 4, TRUE);
9919                 proto_item_append_text(ti_did, " 0x%x", tvb_get_letohl(tvb, offset) );
9920             }
9921           break;
9922           case PRISM_DID_NOISE:
9923             if(tree){
9924                 proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_noise, tvb, offset, 4, TRUE);
9925                 proto_item_append_text(ti_did, " 0x%x", tvb_get_letohl(tvb, offset) );
9926             }
9927           break;
9928           case PRISM_DID_RATE:
9929             if(tree){
9930                 proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_rate, tvb, offset, 4, TRUE);
9931                 proto_item_append_text(ti_did, " %s Mb/s", prism_rate_return(tvb_get_letohl(tvb, offset)) );
9932             }
9933             col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%s", prism_rate_return(tvb_get_letohl(tvb, offset)) );
9934
9935           break;
9936           case PRISM_DID_ISTX:
9937             if(tree){
9938                 proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_istx, tvb, offset, 4, TRUE);
9939                 proto_item_append_text(ti_did, " 0x%x", tvb_get_letohl(tvb, offset) );
9940             }
9941           break;
9942           case PRISM_DID_FRMLEN:
9943             if(tree){
9944                 proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_frmlen, tvb, offset, 4, TRUE);
9945                 proto_item_append_text(ti_did, " %d", tvb_get_letohl(tvb, offset) );
9946             }
9947           break;
9948           default:
9949             if(tree){
9950                   proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_unknown, tvb, offset, 4, TRUE);
9951             }
9952           break;
9953         }
9954         offset += 4;
9955     }
9956
9957     /* dissect the 802.11 header next */
9958     next_tvb = tvb_new_subset_remaining(tvb, offset);
9959     call_dissector(ieee80211_handle, next_tvb, pinfo, tree);
9960 }
9961
9962 /*
9963  * AVS linux-wlan-based products use a new sniff header to replace the
9964  * old Prism header.  This one has additional fields, is designed to be
9965  * non-hardware-specific, and more importantly, version and length fields
9966  * so it can be extended later without breaking anything.
9967  *
9968  * Support by Solomon Peachy
9969  *
9970  * Description, from the capturefrm.txt file in the linux-wlan-ng 0.2.9
9971  * release (linux-wlan-ng-0.2.9/doc/capturefrm.txt):
9972  *
9973 AVS Capture Frame Format
9974 Version 2.1.1
9975
9976 1. Introduction
9977 The original header format for "monitor mode" or capturing frames was
9978 a considerable hack.  The document covers a redesign of that format.
9979
9980   Any questions, corrections, or proposed changes go to info@linux-wlan.com
9981
9982 2. Frame Format
9983 All sniff frames follow the same format:
9984
9985         Offset  Name            Size            Description
9986         --------------------------------------------------------------------
9987         0       CaptureHeader                   AVS capture metadata header
9988         64      802.11Header    [10-30]         802.11 frame header
9989         ??      802.11Payload   [0-2312]        802.11 frame payload
9990         ??      802.11FCS       4               802.11 frame check sequence
9991
9992 Note that the header and payload are variable length and the payload
9993 may be empty.
9994
9995 If the hardware does not supply the FCS to the driver, then the frame shall
9996 have a FCS of 0xFFFFFFFF.
9997
9998 3. Byte Order
9999 All multibyte fields of the capture header are in "network" byte
10000 order.  The "host to network" and "network to host" functions should
10001 work just fine.  All the remaining multibyte fields are ordered
10002 according to their respective standards.
10003
10004 4. Capture Header Format
10005 The following fields make up the AVS capture header:
10006
10007         Offset  Name            Type
10008         ------------------------------
10009         0       version         uint32
10010         4       length          uint32
10011         8       mactime         uint64
10012         16      hosttime        uint64
10013         24      phytype         uint32
10014         28      frequency       uint32
10015         32      datarate        uint32
10016         36      antenna         uint32
10017         40      priority        uint32
10018         44      ssi_type        uint32
10019         48      ssi_signal      int32
10020         52      ssi_noise       int32
10021         56      preamble        uint32
10022         60      encoding        uint32
10023         64      sequence        uint32
10024         68      drops           uint32
10025         72      receiver_addr   uint8[6]
10026         78      padding         uint8[2]
10027         ------------------------------
10028         80
10029
10030 The following subsections detail the fields of the capture header.
10031
10032 4.1 version
10033 The version field identifies this type of frame as a subtype of
10034 ETH_P_802111_CAPTURE as received by an ARPHRD_IEEE80211_PRISM or
10035 an ARPHRD_IEEE80211_CAPTURE device.  The value of this field shall be
10036 0x80211002.  As new revisions of this header are necessary, we can
10037 increment the version appropriately.
10038
10039 4.2 length
10040 The length field contains the length of the entire AVS capture header,
10041 in bytes.
10042
10043 4.3 mactime
10044 Many WLAN devices supply a relatively high resolution frame reception
10045 time value.  This field contains the value supplied by the device.  If
10046 the device does not supply a receive time value, this field shall be
10047 set to zero.  The units for this field are microseconds.
10048
10049 If possible, this time value should be absolute, representing the number
10050 of microseconds elapsed since the UNIX epoch.
10051
10052 4.4 hosttime
10053 The hosttime field is set to the current value of the host maintained
10054 clock variable when the frame is received by the host.
10055
10056 If possible, this time value should be absolute, representing the number
10057 of microseconds elapsed since the UNIX epoch.
10058
10059 4.5 phytype
10060 The phytype field identifies what type of PHY is employed by the WLAN
10061 device used to capture this frame.  The valid values are:
10062
10063         PhyType                         Value
10064         -------------------------------------
10065         phytype_fhss_dot11_97            1
10066         phytype_dsss_dot11_97            2
10067         phytype_irbaseband               3
10068         phytype_dsss_dot11_b             4
10069         phytype_pbcc_dot11_b             5
10070         phytype_ofdm_dot11_g             6
10071         phytype_pbcc_dot11_g             7
10072         phytype_ofdm_dot11_a             8
10073         phytype_dss_ofdm_dot11_g         9
10074
10075 4.6 frequency
10076
10077 This represents the frequency or channel number of the receiver at the
10078 time the frame was received.  It is interpreted as follows:
10079
10080 For frequency hopping radios, this field is broken in to the
10081 following subfields:
10082
10083         Byte    Subfield
10084         ------------------------
10085         Byte0   Hop Set
10086         Byte1   Hop Pattern
10087         Byte2   Hop Index
10088         Byte3   reserved
10089
10090 For non-hopping radios, the frequency is interpreted as follows:
10091
10092        Value                Meaning
10093     -----------------------------------------
10094        < 256           Channel number (using externally-defined
10095                          channelization)
10096        < 10000         Center frequency, in MHz
10097       >= 10000         Center frequency, in KHz
10098
10099 4.7 datarate
10100 The data rate field contains the rate at which the frame was received
10101 in units of 100kbps.
10102
10103 4.8 antenna
10104 For WLAN devices that indicate the receive antenna for each frame, the
10105 antenna field shall contain an index value into the dot11AntennaList.
10106 If the device does not indicate a receive antenna value, this field
10107 shall be set to zero.
10108
10109 4.9 priority
10110 The priority field indicates the receive priority of the frame.  The
10111 value is in the range [0-15] with the value 0 reserved to indicate
10112 contention period and the value 6 reserved to indicate contention free
10113 period.
10114
10115 4.10 ssi_type
10116 The ssi_type field is used to indicate what type of signal strength
10117 information is present: "None", "Normalized RSSI" or "dBm".  "None"
10118 indicates that the underlying WLAN device does not supply any signal
10119 strength at all and the ssi_* values are unset.  "Normalized RSSI"
10120 values are integers in the range [0-1000] where higher numbers
10121 indicate stronger signal.  "dBm" values indicate an actual signal
10122 strength measurement quantity and are usually in the range [-108 - 10].
10123 The following values indicate the three types:
10124
10125         Value   Description
10126         ---------------------------------------------
10127         0       None
10128         1       Normalized RSSI
10129         2       dBm
10130         3       Raw RSSI
10131
10132 4.11 ssi_signal
10133 The ssi_signal field contains the signal strength value reported by
10134 the WLAN device for this frame.  Note that this is a signed quantity
10135 and if the ssi_type value is "dBm" that the value may be negative.
10136
10137 4.12 ssi_noise
10138 The ssi_noise field contains the noise or "silence" value reported by
10139 the WLAN device.  This value is commonly defined to be the "signal
10140 strength reported immediately prior to the baseband processor lock on
10141 the frame preamble".  If the hardware does not provide noise data, this
10142 shall equal 0xffffffff.
10143
10144 4.12 preamble
10145 For PHYs that support variable preamble lengths, the preamble field
10146 indicates the preamble type used for this frame.  The values are:
10147
10148         Value   Description
10149         ---------------------------------------------
10150         0       Undefined
10151         1       Short Preamble
10152         2       Long Preamble
10153
10154 4.13 encoding
10155 This specifies the encoding of the received packet.  For PHYs that support
10156 multiple encoding types, this will tell us which one was used.
10157
10158         Value   Description
10159         ---------------------------------------------
10160         0       Unknown
10161         1       CCK
10162         2       PBCC
10163         3       OFDM
10164         4       DSSS-OFDM
10165         5       BPSK
10166         6       QPSK
10167         7       16QAM
10168         8       64QAM
10169
10170 4.14 sequence
10171 This is a receive frame sequence counter.  The sniff host shall
10172 increment this by one for every valid frame received off the medium.
10173 By watching for gaps in the sequence numbers we can determine when
10174 packets are lost due to unreliable transport, rather than a frame never
10175 being received to begin with.
10176
10177 4.15 drops
10178 This is a counter of the number of known frame drops that occured.  This
10179 is particularly useful when the system or hardware cannot keep up with
10180 the sniffer load.
10181
10182 4.16 receiver_addr
10183 This specifies the MAC address of the receiver of this frame.
10184 It is six octets in length.  This field is followed by two octets of
10185 padding to keep the structure 32-bit word aligned.
10186
10187 ================================
10188
10189 Changes: v2->v2.1
10190
10191  * Added contact e-mail address to introduction
10192  * Added sniffer_addr, drop count, and sequence fields, bringing total
10193    length to 80 bytes
10194  * Bumped version to 0x80211002
10195  * Mactime is specified in microseconds, not nanoseconds
10196  * Added 64QAM, 16QAM, BPSK, QPSK encodings
10197
10198 ================================
10199
10200 Changes: v2.1->v2.1.1
10201
10202  * Renamed 'channel' to 'frequency'
10203  * Clarified the interpretation of the frequency/channel field.
10204  * Renamed 'sniffer address' to 'receiver address'
10205  * Clarified timestamp fields.
10206  */
10207
10208 /*
10209  * Signal/noise strength type values.
10210  */
10211 #define SSI_NONE        0       /* no SSI information */
10212 #define SSI_NORM_RSSI   1       /* normalized RSSI - 0-1000 */
10213 #define SSI_DBM         2       /* dBm */
10214 #define SSI_RAW_RSSI    3       /* raw RSSI from the hardware */
10215
10216 static void
10217 dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
10218 {
10219     proto_tree *wlan_tree = NULL;
10220     proto_item *ti;
10221     tvbuff_t *next_tvb;
10222     int offset;
10223     guint32 version;
10224     guint32 length;
10225     guint32 channel;
10226     guint32 datarate;
10227     guint32 ssi_type;
10228     guint32 antnoise;
10229
10230     col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN");
10231     col_clear(pinfo->cinfo, COL_INFO);
10232     offset = 0;
10233
10234     version = tvb_get_ntohl(tvb, offset) - WLANCAP_MAGIC_COOKIE_BASE;
10235
10236     length = tvb_get_ntohl(tvb, offset+4);
10237
10238     col_add_fstr(pinfo->cinfo, COL_INFO, "AVS WLAN Capture v%x, Length %d",version, length);
10239
10240     if (version > 2) {
10241       goto skip;
10242     }
10243
10244     /* Dissect the AVS header */
10245     if (tree) {
10246       ti = proto_tree_add_item(tree, proto_wlancap, tvb, 0, length, FALSE);
10247       wlan_tree = proto_item_add_subtree(ti, ett_radio);
10248       proto_tree_add_item(wlan_tree, hf_wlan_magic, tvb, offset, 4, FALSE);
10249       proto_tree_add_item(wlan_tree, hf_wlan_version, tvb, offset, 4, FALSE);
10250     }
10251     offset+=4;
10252     if (tree)
10253       proto_tree_add_item(wlan_tree, hf_wlan_length, tvb, offset, 4, FALSE);
10254     offset+=4;
10255     if (tree)
10256       proto_tree_add_item(wlan_tree, hf_mactime, tvb, offset, 8, FALSE);
10257     offset+=8;
10258     if (tree)
10259       proto_tree_add_item(wlan_tree, hf_hosttime, tvb, offset, 8, FALSE);
10260     offset+=8;
10261     if (tree)
10262       proto_tree_add_item(wlan_tree, hf_wlan_phytype, tvb, offset, 4, FALSE);
10263     offset+=4;
10264
10265     /* XXX cook channel (fh uses different numbers) */
10266     channel = tvb_get_ntohl(tvb, offset);
10267     if (channel < 256) {
10268       col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u", channel);
10269       if (tree)
10270         proto_tree_add_uint(wlan_tree, hf_channel, tvb, offset, 4, channel);
10271     } else if (channel < 10000) {
10272       col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u MHz", channel);
10273       if (tree)
10274         proto_tree_add_uint_format(wlan_tree, hf_channel_frequency, tvb, offset,
10275                                    4, channel, "Frequency: %u MHz", channel);
10276     } else {
10277       col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u KHz", channel);
10278       if (tree)
10279         proto_tree_add_uint_format(wlan_tree, hf_channel_frequency, tvb, offset,
10280                                    4, channel, "Frequency: %u KHz", channel);
10281     }
10282     offset+=4;
10283     datarate = tvb_get_ntohl(tvb, offset);
10284     if (datarate < 100000) {
10285       /* In units of 100 Kb/s; convert to b/s */
10286       datarate *= 100000;
10287     }
10288
10289     col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%u.%u",
10290                    datarate / 1000000,
10291                    ((datarate % 1000000) > 500000) ? 5 : 0);
10292     if (tree) {
10293       proto_tree_add_uint64_format(wlan_tree, hf_data_rate, tvb, offset, 4,
10294                                    datarate,
10295                                    "Data Rate: %u.%u Mb/s",
10296                                    datarate/1000000,
10297                                    ((datarate % 1000000) > 500000) ? 5 : 0);
10298     }
10299     offset+=4;
10300     if (tree)
10301       proto_tree_add_item(wlan_tree, hf_wlan_antenna, tvb, offset, 4, FALSE);
10302     offset+=4;
10303     if (tree)
10304       proto_tree_add_item(wlan_tree, hf_wlan_priority, tvb, offset, 4, FALSE);
10305     offset+=4;
10306     ssi_type = tvb_get_ntohl(tvb, offset);
10307     if (tree)
10308       proto_tree_add_uint(wlan_tree, hf_wlan_ssi_type, tvb, offset, 4, ssi_type);
10309     offset+=4;
10310     switch (ssi_type) {
10311
10312     case SSI_NONE:
10313     default:
10314       /* either there is no SSI information, or we don't know what type it is */
10315       break;
10316
10317     case SSI_NORM_RSSI:
10318       /* Normalized RSSI */
10319       col_add_fstr(pinfo->cinfo, COL_RSSI, "%u (norm)", tvb_get_ntohl(tvb, offset));
10320       if (tree)
10321         proto_tree_add_item(wlan_tree, hf_normrssi_antsignal, tvb, offset, 4, FALSE);
10322       break;
10323
10324     case SSI_DBM:
10325       /* dBm */
10326       col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", tvb_get_ntohl(tvb, offset));
10327       if (tree)
10328         proto_tree_add_item(wlan_tree, hf_dbm_antsignal, tvb, offset, 4, FALSE);
10329       break;
10330
10331     case SSI_RAW_RSSI:
10332       /* Raw RSSI */
10333       col_add_fstr(pinfo->cinfo, COL_RSSI, "%u (raw)", tvb_get_ntohl(tvb, offset));
10334       if (tree)
10335         proto_tree_add_item(wlan_tree, hf_rawrssi_antsignal, tvb, offset, 4, FALSE);
10336       break;
10337     }
10338     offset+=4;
10339     antnoise = tvb_get_ntohl(tvb, offset);
10340     /* 0xffffffff means "hardware does not provide noise data" */
10341     if (antnoise != 0xffffffff) {
10342       switch (ssi_type) {
10343
10344       case SSI_NONE:
10345       default:
10346         /* either there is no SSI information, or we don't know what type it is */
10347         break;
10348
10349       case SSI_NORM_RSSI:
10350         /* Normalized RSSI */
10351         if (tree)
10352           proto_tree_add_uint(wlan_tree, hf_normrssi_antnoise, tvb, offset, 4, antnoise);
10353         break;
10354
10355       case SSI_DBM:
10356         /* dBm */
10357         if (tree)
10358           proto_tree_add_int(wlan_tree, hf_dbm_antnoise, tvb, offset, 4, antnoise);
10359         break;
10360
10361       case SSI_RAW_RSSI:
10362         /* Raw RSSI */
10363         if (tree)
10364           proto_tree_add_uint(wlan_tree, hf_rawrssi_antnoise, tvb, offset, 4, antnoise);
10365         break;
10366       }
10367     }
10368     offset+=4;
10369     if (tree)
10370       proto_tree_add_item(wlan_tree, hf_wlan_preamble, tvb, offset, 4, FALSE);
10371     offset+=4;
10372     if (tree)
10373       proto_tree_add_item(wlan_tree, hf_wlan_encoding, tvb, offset, 4, FALSE);
10374     offset+=4;
10375     if (version > 1) {
10376       if (tree)
10377         proto_tree_add_item(wlan_tree, hf_wlan_sequence, tvb, offset, 4, FALSE);
10378       offset+=4;
10379       if (tree)
10380         proto_tree_add_item(wlan_tree, hf_wlan_drops, tvb, offset, 4, FALSE);
10381       offset+=4;
10382       if (tree)
10383         proto_tree_add_item(wlan_tree, hf_wlan_receiver_addr, tvb, offset, 6, FALSE);
10384       offset+=6;
10385       if (tree)
10386         proto_tree_add_item(wlan_tree, hf_wlan_padding, tvb, offset, 2, FALSE);
10387       offset+=2;
10388     }
10389
10390
10391  skip:
10392     offset = length;
10393
10394     /* dissect the 802.11 header next */
10395     next_tvb = tvb_new_subset_remaining(tvb, offset);
10396     call_dissector(ieee80211_handle, next_tvb, pinfo, tree);
10397 }
10398
10399 void
10400 proto_register_ieee80211 (void)
10401 {
10402   int i;
10403   GString *key_name, *key_title, *key_desc;
10404
10405   static const value_string frame_type[] = {
10406     {MGT_FRAME,     "Management frame"},
10407     {CONTROL_FRAME, "Control frame"},
10408     {DATA_FRAME,    "Data frame"},
10409     {0,             NULL}
10410   };
10411
10412   static const value_string tofrom_ds[] = {
10413     {0,                       "Not leaving DS or network is operating "
10414       "in AD-HOC mode (To DS: 0 From DS: 0)"},
10415     {FLAG_TO_DS,              "Frame from STA to DS via an AP (To DS: 1 "
10416       "From DS: 0)"},
10417     {FLAG_FROM_DS,            "Frame from DS to a STA via AP(To DS: 0 "
10418       "From DS: 1)"},
10419 #ifdef MESH_OVERRIDES
10420     {FLAG_TO_DS|FLAG_FROM_DS, "WDS (AP to AP) or Mesh (MP to MP) Frame "
10421       "(To DS: 1 From DS: 1)"},
10422 #else /* MESH_OVERRIDES */
10423     {FLAG_TO_DS|FLAG_FROM_DS, "Frame part of WDS from one AP to another "
10424       "AP (To DS: 1 From DS: 1)"},
10425 #endif /* MESH_OVERRIDES */
10426     {0, NULL}
10427   };
10428
10429   static const true_false_string tods_flag = {
10430     "Frame is entering DS",
10431     "Frame is not entering DS"
10432   };
10433
10434   static const true_false_string fromds_flag = {
10435     "Frame is exiting DS",
10436     "Frame is not exiting DS"
10437   };
10438
10439   static const true_false_string more_frags = {
10440     "More fragments follow",
10441     "This is the last fragment"
10442   };
10443
10444   static const true_false_string retry_flags = {
10445     "Frame is being retransmitted",
10446     "Frame is not being retransmitted"
10447   };
10448
10449   static const true_false_string pm_flags = {
10450     "STA will go to sleep",
10451     "STA will stay up"
10452   };
10453
10454   static const true_false_string md_flags = {
10455     "Data is buffered for STA at AP",
10456     "No data buffered"
10457   };
10458
10459   static const true_false_string protected_flags = {
10460     "Data is protected",
10461     "Data is not protected"
10462   };
10463
10464   static const true_false_string order_flags = {
10465     "Strictly ordered",
10466     "Not strictly ordered"
10467   };
10468
10469   static const true_false_string cf_ess_flags = {
10470     "Transmitter is an AP",
10471     "Transmitter is a STA"
10472   };
10473
10474
10475   static const true_false_string cf_privacy_flags = {
10476     "AP/STA can support WEP",
10477     "AP/STA cannot support WEP"
10478   };
10479
10480   static const true_false_string cf_preamble_flags = {
10481     "Short preamble allowed",
10482     "Short preamble not allowed"
10483   };
10484
10485   static const true_false_string cf_pbcc_flags = {
10486     "PBCC modulation allowed",
10487     "PBCC modulation not allowed"
10488   };
10489
10490   static const true_false_string cf_agility_flags = {
10491     "Channel agility in use",
10492     "Channel agility not in use"
10493   };
10494
10495   static const true_false_string short_slot_time_flags = {
10496     "Short slot time in use",
10497     "Short slot time not in use"
10498   };
10499
10500   static const true_false_string dsss_ofdm_flags = {
10501     "DSSS-OFDM modulation allowed",
10502     "DSSS-OFDM modulation not allowed"
10503   };
10504
10505   static const true_false_string cf_spec_man_flags = {
10506     "dot11SpectrumManagementRequired TRUE",
10507     "dot11SpectrumManagementRequired FALSE"
10508   };
10509
10510   static const true_false_string cf_apsd_flags = {
10511     "apsd implemented",
10512     "apsd not implemented"
10513   };
10514
10515   static const true_false_string cf_del_blk_ack_flags = {
10516     "delayed block ack implemented",
10517     "delayed block ack not implemented"
10518   };
10519
10520   static const true_false_string cf_imm_blk_ack_flags = {
10521     "immediate block ack implemented",
10522     "immediate block ack not implemented"
10523   };
10524   static const true_false_string cf_ibss_flags = {
10525     "Transmitter belongs to an IBSS",
10526     "Transmitter belongs to a BSS"
10527   };
10528
10529   static const true_false_string eosp_flag = {
10530     "End of service period",
10531     "Service period"
10532   };
10533
10534   static const true_false_string bit4_flag = {
10535     "Bits 8-15 of QoS Control field are Queue Size",
10536     "Bits 8-15 of QoS Control field are TXOP Duration Requested"
10537   };
10538
10539   static const true_false_string ieee80211_qos_amsdu_present_flag = {
10540     "A-MSDU",
10541     "MSDU"
10542   };
10543
10544   static const value_string sta_cf_pollable[] = {
10545     {0x00, "Station is not CF-Pollable"},
10546     {0x02, "Station is CF-Pollable, "
10547      "not requesting to be placed on the  CF-polling list"},
10548     {0x01, "Station is CF-Pollable, "
10549      "requesting to be placed on the CF-polling list"},
10550     {0x03, "Station is CF-Pollable, requesting never to be polled"},
10551     {0x0200, "QSTA requesting association in QBSS"},
10552     {0, NULL}
10553   };
10554
10555   static const value_string ap_cf_pollable[] = {
10556     {0x00, "No point coordinator at AP"},
10557     {0x02, "Point coordinator at AP for delivery only (no polling)"},
10558     {0x01, "Point coordinator at AP for delivery and polling"},
10559     {0x03, "Reserved"},
10560     {0x0200, "QAP (HC) does not use CFP for delivery of unicast data type frames"},
10561     {0x0202, "QAP (HC) uses CFP for delivery, but does not send CF-Polls to non-QoS STAs"},
10562     {0x0201, "QAP (HC) uses CFP for delivery, and sends CF-Polls to non-QoS STAs"},
10563     {0x0203, "Reserved"},
10564     {0, NULL}
10565   };
10566
10567
10568   static const value_string auth_alg[] = {
10569     {0x00, "Open System"},
10570     {0x01, "Shared key"},
10571     {0x02, "Fast BSS Transition"},
10572     {0x80, "Network EAP"},  /* Cisco proprietary? */
10573     {0, NULL}
10574   };
10575
10576   static const true_false_string ff_block_ack_params_amsdu_permitted_flag = {
10577     "Permitted in QoS Data MPDUs",
10578     "Not Permitted"
10579   };
10580
10581   static const true_false_string ff_block_ack_params_policy_flag = {
10582     "Immediate Block Ack",
10583     "Delayed Block Ack"
10584   };
10585
10586   static const value_string  ff_channel_width_vals[] = {
10587     {0x00, "20 MHz channel width only"},
10588     {0x01, "Any channel width in the STA's Supported Channel Width Set"},
10589     {0, NULL}
10590   };
10591
10592   static const true_false_string ff_qos_info_ap_q_ack_flag = {
10593       "Implemented",
10594       "Not Implemented"
10595   };
10596
10597   static const true_false_string ff_qos_info_ap_queue_req_flag = {
10598       "Can process a nonzero Queue Size subfield in the QoS Control field in QoS data frames",
10599       "Can NOT process a nonzero Queue Size subfield in the QoS Control field in QoS data frames"
10600   };
10601
10602   static const true_false_string ff_qos_info_ap_txop_request_flag = {
10603       "Can process a nonzero TXOP Duration Requested subfield in the QoS Control field in QoS data frames",
10604       "Can NOT process a nonzero TXOP Duration Requested subfield in the QoS Control field in QoS data frames"
10605   };
10606
10607   static const true_false_string ff_qos_info_sta_ac_flag = {
10608       "Trigger-enabled and Delivery-enabled",
10609       "Neither Trigger-enabled nor Delivery-enabled"
10610   };
10611
10612   static const true_false_string ff_qos_info_sta_q_ack_flag = {
10613       "Implemented",
10614       "Not Implemented"
10615   };
10616
10617   static const value_string ff_qos_info_sta_max_sp_len_flags[] = {
10618     {0x00, "AP may deliver all buffered MSDUs, A-MSDUs and MMPDUs"},
10619     {0x01, "AP may deliver a maximum of two MSDUs and MMPDUs per SP"},
10620     {0x02, "AP may deliver a maximum of four MSDUs and MMPDUs per SP"},
10621     {0x03, "AP may deliver a maximum of six MSDUs and MMPDUs per SP"},
10622     {0, NULL}
10623   };
10624
10625   static const true_false_string ff_qos_info_sta_more_data_ack_flag = {
10626       "Can process ACK frames with the More Data bit in the Frame Control field set to 1",
10627       "Can NOT process ACK frames with the More Data bit in the Frame Control field set to 1"
10628   };
10629
10630   static const true_false_string ff_sm_pwr_save_sm_mode_flag = {
10631       "Dynamic SM Power Save mode",
10632       "Static SM Power Save mode"
10633   };
10634
10635   static const true_false_string ff_pco_phase_cntrl_flag = {
10636       "40 MHz Phase",
10637       "20 MHz Phase"
10638   };
10639
10640   static const true_false_string ff_psmp_param_set_more_psmp_flag = {
10641       "More PSMP Sequences Follow",
10642       "No PSMP Sequences Follow"
10643   };
10644
10645   static const value_string ff_mimo_cntrl_nc_index_flags[] = {
10646     {0x00, "1 Column"},
10647     {0x01, "2 Columns"},
10648     {0x02, "3 Columns"},
10649     {0x03, "4 Columns"},
10650     {0, NULL}
10651   };
10652
10653   static const value_string ff_mimo_cntrl_nr_index_flags[] = {
10654     {0x00, "1 Row"},
10655     {0x01, "2 Rows"},
10656     {0x02, "3 Rows"},
10657     {0x03, "4 Rows"},
10658     {0, NULL}
10659   };
10660
10661   static const true_false_string ff_mimo_cntrl_channel_width_flag = {
10662       "40 MHz",
10663       "20 MHz"
10664   };
10665
10666   static const true_false_string ff_ht_info_information_request_flag = {
10667       "Requesting HT Information Exchange management action frame",
10668       "Should not send an HT Information Exchange management action frame"
10669   };
10670
10671   static const true_false_string ff_ht_info_40_mhz_intolerant_flag = {
10672       "Transmitting station is intolerant of 40 MHz operation",
10673       "Transmitting station permits 40 MHz operation"
10674   };
10675
10676   static const true_false_string ff_ht_info_sta_chan_width_flag = {
10677       "40 MHz",
10678       "20 MHz"
10679   };
10680
10681   static const value_string ff_ht_action_flags[] = {
10682     {HT_ACTION_NOTIFY_CHAN_WIDTH, "Notify Channel Width"},
10683     {HT_ACTION_SM_PWR_SAVE, "Spatial Multiplexing (SM) Power Save"},
10684     {HT_ACTION_PSMP_ACTION, "Power Save Multi-Poll (PSMP) action frame"},
10685     {HT_ACTION_SET_PCO_PHASE, "Set PCO Phase"},
10686     {HT_ACTION_MIMO_CSI, "MIMO CSI Matrices"},
10687     {HT_ACTION_MIMO_BEAMFORMING, "MIMO Non-compressed Beamforming"},
10688     {HT_ACTION_MIMO_COMPRESSED_BEAMFORMING, "MIMO Compressed Beamforming"},
10689     {HT_ACTION_ANT_SEL_FEEDBACK, "Antenna Selection Indices Feedback"},
10690     {HT_ACTION_HT_INFO_EXCHANGE, "HT Information Exchange"},
10691     {0x00, NULL}
10692   };
10693
10694   static const value_string ff_mimo_cntrl_grouping_flags[] = {
10695     {0x00, "No Grouping"},
10696     {0x01, "Carrier Groups of 2"},
10697     {0x02, "Carrier Groups of 4"},
10698     {0x03, "Reserved"},
10699     {0, NULL}
10700   };
10701
10702   static const value_string ff_mimo_cntrl_coefficient_size_flags[] = {
10703     {0x00, "4 Bits"},
10704     {0x01, "5 Bits"},
10705     {0x02, "6 Bits"},
10706     {0x03, "8 Bits"},
10707     {0, NULL}
10708   };
10709
10710   static const value_string ff_mimo_cntrl_codebook_info_flags[] = {
10711     {0x00, "1 bit for 'Capital Psi', 3 bits for 'Small Psi'"},
10712     {0x01, "2 bit for 'Capital Psi', 4 bits for 'Small Psi'"},
10713     {0x02, "3 bit for 'Capital Psi', 5 bits for 'Small Psi'"},
10714     {0x03, "4 bit for 'Capital Psi', 6 bits for 'Small Psi'"},
10715     {0, NULL}
10716   };
10717
10718
10719
10720   static const value_string ff_pa_action_codes[] = {
10721     {PA_DSE_ENABLEMENT, "DSE enablement"},
10722     {PA_DSE_DEENABLEMENT, "DSE deenablement"},
10723     {PA_DSE_REG_LOC_ANNOUNCEMENT, "DSE Registered Location Announcement"},
10724     {PA_EXT_CHANNEL_SWITCH_ANNOUNCEMENT, "Extended Channel Switch Announcement"},
10725     {PA_DSE_MEASUREMENT_REQUEST, "DSE measurement request"},
10726     {PA_DSE_MEASUREMENT_REPORT, "DSE measurement report"},
10727     {PA_MEASUREMENT_PILOT, "Measurement Pilot"},
10728     {PA_DSE_POWER_CONSTRAINT, "DSE power constraint"},
10729     {PA_VENDOR_SPECIFIC, "Vendor Specific"},
10730     {PA_GAS_INITIAL_REQUEST, "GAS Initial Request"},
10731     {PA_GAS_INITIAL_RESPONSE, "GAS Initial Response"},
10732     {PA_GAS_COMEBACK_REQUEST, "GAS Comeback Request"},
10733     {PA_GAS_COMEBACK_RESPONSE, "GAS Comeback Response"},
10734     {PA_TDLS_DISCOVERY_RESPONSE, "TDLS Discovery Response"},
10735     {0x00, NULL}
10736   };
10737
10738   static const value_string reason_codes[] = {
10739     {0x00, "Reserved"},
10740     {0x01, "Unspecified reason"},
10741     {0x02, "Previous authentication no longer valid"},
10742     {0x03, "Deauthenticated because sending STA is leaving (has left) "
10743      "IBSS or ESS"},
10744     {0x04, "Disassociated due to inactivity"},
10745     {0x05, "Disassociated because AP is unable to handle all currently "
10746      "associated stations"},
10747     {0x06, "Class 2 frame received from nonauthenticated station"},
10748     {0x07, "Class 3 frame received from nonassociated station"},
10749     {0x08, "Disassociated because sending STA is leaving (has left) BSS"},
10750     {0x09, "Station requesting (re)association is not authenticated with "
10751       "responding station"},
10752     {0x0A, "Disassociated because the information in the Power Capability "
10753       "element is unacceptable"},
10754     {0x0B, "Disassociated because the information in the Supported"
10755       "Channels element is unacceptable"},
10756     {0x0D, "Invalid Information Element"},
10757     {0x0E, "Michael MIC failure"},
10758     {0x0F, "4-Way Handshake timeout"},
10759     {0x10, "Group key update timeout"},
10760     {0x11, "Information element in 4-Way Handshake different from "
10761      "(Re)Association Request/Probe Response/Beacon"},
10762     {0x12, "Group Cipher is not valid"},
10763     {0x13, "Pairwise Cipher is not valid"},
10764     {0x14, "AKMP is not valid"},
10765     {0x15, "Unsupported RSN IE version"},
10766     {0x16, "Invalid RSN IE Capabilities"},
10767     {0x17, "IEEE 802.1X Authentication failed"},
10768     {0x18, "Cipher suite is rejected per security policy"},
10769     {0x19, "TDLS direct-link teardown due to TDLS peer STA unreachable via "
10770      "the TDLS direct link"},
10771     {0x1A, "TDLS direct-link teardown for unspecified reason"},
10772     {0x20, "Disassociated for unspecified, QoS-related reason"},
10773     {0x21, "Disassociated because QoS AP lacks sufficient bandwidth for this QoS STA"},
10774     {0x22, "Disassociated because of excessive number of frames that need to be "
10775       "acknowledged, but are not acknowledged for AP transmissions and/or poor "
10776       "channel conditions"},
10777     {0x23, "Disassociated because STA is transmitting outside the limits of its TXOPs"},
10778     {0x24, "Requested from peer STA as the STA is leaving the BSS (or resetting)"},
10779     {0x25, "Requested from peer STA as it does not want to use the mechanism"},
10780     {0x26, "Requested from peer STA as the STA received frames using the mechanism "
10781       "for which a set up is required"},
10782     {0x27, "Requested from peer STA due to time out"},
10783     {0x2D, "Peer STA does not support the requested cipher suite"},
10784     {0x2E, "Association denied due to requesting STA not supporting HT features"},
10785     {0x00, NULL}
10786   };
10787
10788
10789   static const value_string status_codes[] = {
10790     {0x00, "Successful"},
10791     {0x01, "Unspecified failure"},
10792     {0x02, "TDLS wakeup schedule rejected but alternative schedule provided"},
10793     {0x03, "TDLS wakeup schedule rejected"},
10794     {0x05, "Security disabled"},
10795     {0x06, "Unacceptable lifetime"},
10796     {0x07, "Not in same BSS"},
10797     {0x0A, "Cannot support all requested capabilities in the "
10798      "Capability information field"},
10799     {0x0B, "Reassociation denied due to inability to confirm that "
10800      "association exists"},
10801     {0x0C, "Association denied due to reason outside the scope of this "
10802      "standard"},
10803
10804     {0x0D, "Responding station does not support the specified authentication "
10805      "algorithm"},
10806     {0x0E, "Received an Authentication frame with authentication sequence "
10807      "transaction sequence number out of expected sequence"},
10808     {0x0F, "Authentication rejected because of challenge failure"},
10809     {0x10, "Authentication rejected due to timeout waiting for next "
10810      "frame in sequence"},
10811     {0x11, "Association denied because AP is unable to handle additional "
10812      "associated stations"},
10813     {0x12, "Association denied due to requesting station not supporting all "
10814      "of the datarates in the BSSBasicServiceSet Parameter"},
10815     {0x13, "Association denied due to requesting station not supporting "
10816      "short preamble operation"},
10817     {0x14, "Association denied due to requesting station not supporting "
10818      "PBCC encoding"},
10819     {0x15, "Association denied due to requesting station not supporting "
10820      "channel agility"},
10821     {0x16, "Association request rejected because Spectrum Management"
10822       "capability is required"},
10823     {0x17, "Association request rejected because the information in the"
10824       "Power Capability element is unacceptable"},
10825     {0x18, "Association request rejected because the information in the"
10826       "Supported Channels element is unacceptable"},
10827     {0x19, "Association denied due to requesting station not supporting "
10828      "short slot operation"},
10829     {0x1A, "Association denied due to requesting station not supporting "
10830      "DSSS-OFDM operation"},
10831     {0x1C, "R0KH unreachable"},
10832     {0x1E, "Association request rejected temporarily; try again later"},
10833     {0x1F, "Robust Management frame policy violation"},
10834     {0x20, "Unspecified, QoS-related failure"},
10835     {0x21, "Association denied due to QAP having insufficient bandwidth "
10836       "to handle another QSTA"},
10837     {0x22, "Association denied due to excessive frame loss rates and/or "
10838       "poor conditions on current operating channel"},
10839     {0x23, "Association (with QBSS) denied due to requesting station not "
10840       "supporting the QoS facility"},
10841     {0x24, "Association denied due to requesting station not supporting "
10842       "Block Ack"},
10843     {0x25, "The request has been declined."},
10844     {0x26, "The request has not been successful as one or more parameters "
10845       "have invalid values."},
10846     {0x27, "The TS has not been created because the request cannot be honored. "
10847       "However, a suggested TSPEC is provided so that the initiating QSTA may "
10848       "attempt to set another TS with the suggested changes to the TSPEC."},
10849     {0x28, "Invalid Information Element"},
10850     {0x29, "Group Cipher is not valid"},
10851     {0x2A, "Pairwise Cipher is not valid"},
10852     {0x2B, "AKMP is not valid"},
10853     {0x2C, "Unsupported RSN IE version"},
10854     {0x2D, "Invalid RSN IE Capabilities"},
10855     {0x2E, "Cipher suite is rejected per security policy"},
10856     {0x2F, "The TS has not been created. However, the HC may be capable of "
10857       "creating a TS, in response to a request, after the time indicated in the TS Delay element."},
10858     {0x30, "Direct Link is not allowed in the BSS by policy"},
10859     {0x31, "Destination STA is not present within this QBSS."},
10860     {0x32, "The Destination STA is not a QSTA."},
10861     {0x34, "Invalid FT Action frame count"},
10862     {0x35, "Invalid pairwise master key identifier (PMKID)"},
10863     {0x36, "Invalid MDIE"},
10864     {0x37, "Invalid FTIE"},
10865     {0x3B, "GAS Advertisement Protocol not supported"},
10866     {0x3C, "No outstanding GAS request"},
10867     {0x3D, "GAS Response not received from the Advertisement Server"},
10868     {0x3E, "STA timed out waiting for GAS Query Response"},
10869     {0x3F, "GAS Response is larger than query response length limit"},
10870     {0x40, "Advertisement Server in the network is not currently reachable"},
10871     {0x41, "Requested information is not available for this BSSID"},
10872     {0x42, "Transmission failure"},
10873     {0x43, "Request refused due to permissions received via SSPN interface"},
10874     {0x44, "Request refused because AP does not support unauthenticated "
10875      "access"},
10876     {0x48, "Invalid contents of RSNIE"},
10877     {0x00, NULL}
10878   };
10879
10880   static const value_string category_codes[] = {
10881     {CAT_SPECTRUM_MGMT, "Spectrum Management (SM)"},
10882     {0x80 | CAT_SPECTRUM_MGMT, "Spectrum Management (SM) (error)"},
10883     {CAT_QOS, "Quality of Service (QoS)"},
10884     {0x80 | CAT_QOS, "Quality of Service (QoS (error))"},
10885     {CAT_DLS, "Direct-Link Setup (DLS)"},
10886     {0x80 | CAT_DLS, "Direct-Link Setup (DLS) (error)"},
10887     {CAT_BLOCK_ACK, "Block Ack"},
10888     {0x80 | CAT_BLOCK_ACK, "Block Ack (error)"},
10889     {CAT_PUBLIC, "Public Action"},
10890     {0x80 | CAT_PUBLIC, "Public Action (error)"},
10891 #ifdef MESH_OVERRIDES
10892     {CAT_MESH_PEER_LINK, "Mesh Peer Link"},
10893     {0x80 | CAT_MESH_PEER_LINK, "Mesh Peer Link"},
10894     {CAT_MESH_LINK_METRIC, "Mesh Link Metric"},
10895     {0x80 | CAT_MESH_LINK_METRIC, "Mesh Link Metric"},
10896     {CAT_MESH_PATH_SELECTION, "Mesh Path Selection"},
10897     {0x80 | CAT_MESH_PATH_SELECTION, "Mesh Path Selection"},
10898     {CAT_MESH_INTERWORKING, "Mesh Internetworking"},
10899     {0x80 | CAT_MESH_INTERWORKING, "Mesh Internetworking"},
10900     {CAT_MESH_RESOURCE_COORDINATION, "Mesh Resource Coordination"},
10901     {0x80 | CAT_MESH_RESOURCE_COORDINATION, "Mesh Resource Coordination"},
10902     {CAT_MESH_SECURITY_ARCHITECTURE, "Mesh Security Arch"},
10903     {0x80 | CAT_MESH_SECURITY_ARCHITECTURE, "Mesh Security Arch"},
10904 #endif /* MESH_OVERRIDES */
10905     {CAT_RADIO_MEASUREMENT, "Radio Measurement"},
10906     {0x80 | CAT_RADIO_MEASUREMENT, "Radio Measurement (error)"},
10907     {CAT_FAST_BSS_TRANSITION, "Fast BSS Transition"},
10908     {0x80 | CAT_FAST_BSS_TRANSITION, "Fast BSS Transition (error)"},
10909     {CAT_HT, "High Throughput"},
10910     {0x80 | CAT_HT, "High Throughput (error)"},
10911     {CAT_SA_QUERY, "SA Query"},
10912     {0x80 | CAT_SA_QUERY, "SA Query (error)"},
10913     {CAT_PUBLIC_PROTECTED, "Protected Dual of Public Action"},
10914     {0x80 | CAT_PUBLIC_PROTECTED, "Protected Dual of Public Action (error)"},
10915     {CAT_TDLS, "TDLS"},
10916     {0x80 | CAT_TDLS, "TDLS (error)"},
10917     {CAT_MGMT_NOTIFICATION, "Management Notification"},
10918     {0x80 | CAT_MGMT_NOTIFICATION, "Management Notification (error)"},
10919     {CAT_VENDOR_SPECIFIC_PROTECTED, "Vendor-specific Protected"},
10920     {0x80 | CAT_VENDOR_SPECIFIC_PROTECTED, "Vendor-specific Protected (error)"},
10921     {CAT_VENDOR_SPECIFIC, "Vendor Specific"},
10922     {0x80 | CAT_VENDOR_SPECIFIC, "Vendor Specific (error)"},
10923     {0, NULL}
10924   };
10925
10926   static const value_string action_codes[] ={
10927     {SM_ACTION_MEASUREMENT_REQUEST, "Measurement Request"},
10928     {SM_ACTION_MEASUREMENT_REPORT, "Measurement Report"},
10929     {SM_ACTION_TPC_REQUEST, "TPC Request"},
10930     {SM_ACTION_TPC_REPORT, "TPC Report"},
10931     {SM_ACTION_CHAN_SWITCH_ANNC, "Channel Switch Announcement"},
10932     {0, NULL}
10933   };
10934
10935   static const value_string vendor_action_types_mrvl[] ={
10936     {MRVL_ACTION_MESH_MANAGEMENT, "Mesh Management"},
10937     {0, NULL}
10938   };
10939
10940   static const value_string mesh_mgt_action_codes_mrvl[] ={
10941     {MRVL_MESH_MGMT_ACTION_RREQ, "Route Request"},
10942     {MRVL_MESH_MGMT_ACTION_RREP, "Route Response"},
10943     {MRVL_MESH_MGMT_ACTION_RERR, "Route Error"},
10944     {MRVL_MESH_MGMT_ACTION_PLDM, "Peer Link Down"},
10945     {0, NULL}
10946   };
10947
10948   static const value_string mesh_path_selection_codes[] ={
10949     {0x0, "Hybrid Wireless Mesh Protocol"},
10950     {0, NULL}
10951   };
10952
10953   static const value_string mesh_metric_codes[] ={
10954     {0x0, "Airtime Link Metric"},
10955     {0, NULL}
10956   };
10957
10958   static const value_string wme_action_codes[] = {
10959     {0x00, "Setup request"},
10960     {0x01, "Setup response"},
10961     {0x02, "Teardown"},
10962     {0x00, NULL}
10963   };
10964
10965   static const value_string wme_status_codes[] = {
10966     {0x00, "Admission accepted"},
10967     {0x01, "Invalid parameters"},
10968     {0x03, "Refused"},
10969     {0x00, NULL}
10970   };
10971
10972 #ifdef MESH_OVERRIDES
10973   static const value_string mesh_mgt_action_ps_codes[] ={
10974     {MESH_PS_PATH_REQUEST, "Path Request"},
10975     {MESH_PS_PATH_REPLY, "Path Reply"},
10976     {MESH_PS_PATH_ERROR, "Path Error"},
10977     {MESH_PS_ROOT_ANNOUNCEMENT, "Root Announcement"},
10978     {0, NULL}
10979   };
10980
10981   static const value_string mesh_mgt_action_pl_codes[] ={
10982     {MESH_PL_PEER_LINK_OPEN, "Peer Link Open"},
10983     {MESH_PL_PEER_LINK_CONFIRM, "Peer Link Confirm"},
10984     {MESH_PL_PEER_LINK_CLOSE, "Peer Link Close"},
10985     {0, NULL}
10986   };
10987
10988   static const value_string mesh_mgt_pl_reason_codes[] = {
10989     {MESH_LINK_CANCELLED, "Link Cancelled"},
10990     {MESH_MAX_NEIGHBORS, "Maximum Number of Peers Reached"},
10991     {MESH_CONFIG_POLICY_VIOLATION, "Policy Violation"},
10992     {MESH_CLOSE_RCVD, "Close Received"},
10993     {MESH_MAX_RETRIES, "Maximum Retries"},
10994     {MESH_CONFIRM_TIMEOUT, "Confirm Timeout"},
10995     {0x00, NULL}
10996   };
10997
10998   static const true_false_string mesh_dest_rf_flags ={
10999     "[RF = 1] Intermediate Nodes That Respond Will Also Forward",
11000     "[RF = 0] Intermediate Nodes That Respond Will Not Forward"
11001   };
11002
11003   static const true_false_string mesh_dest_do_flags ={
11004     "[DO = 1] Only Destination Will Respond",
11005     "[DO = 0] Intermediate Nodes May Respond"
11006   };
11007 #endif /* MESH_OVERRIDES */
11008
11009   static const value_string ack_policy[] = {
11010     {0x00, "Normal Ack"},
11011     {0x01, "No Ack"},
11012     {0x02, "No explicit acknowledgment"},
11013     {0x03, "Block Ack"},
11014     {0x00, NULL}
11015   };
11016
11017   static const value_string qos_action_codes[] = {
11018     {SM_ACTION_ADDTS_REQUEST, "ADDTS Request"},
11019     {SM_ACTION_ADDTS_RESPONSE, "ADDTS Response"},
11020     {SM_ACTION_DELTS, "DELTS"},
11021     {SM_ACTION_QOS_SCHEDULE, "Schedule"},
11022     {0, NULL}
11023   };
11024
11025   static const value_string ba_action_codes[] = {
11026     {BA_ADD_BLOCK_ACK_REQUEST, "Add Block Ack Request"},
11027     {BA_ADD_BLOCK_ACK_RESPONSE, "Add Block Ack Response"},
11028     {BA_DELETE_BLOCK_ACK, "Delete Block Ack"},
11029     {0x00, NULL}
11030   };
11031
11032   static const value_string dls_action_codes[] = {
11033     {SM_ACTION_DLS_REQUEST, "DLS Request"},
11034     {SM_ACTION_DLS_RESPONSE, "DLS Response"},
11035     {SM_ACTION_DLS_TEARDOWN, "DLS Teardown"},
11036     {0, NULL}
11037   };
11038
11039   static const value_string tsinfo_type[] = {
11040     {0x0, "Aperiodic or unspecified Traffic"},
11041     {0x1, "Periodic Traffic"},
11042     {0, NULL}
11043   };
11044
11045   static const value_string tsinfo_direction[] = {
11046     {0x00, "Uplink"},
11047     {0x01, "Downlink"},
11048     {0x02, "Direct link"},
11049     {0x03, "Bidirectional link"},
11050     {0, NULL}
11051   };
11052
11053   static const value_string tsinfo_access[] = {
11054     {0x00, "Reserved"},
11055     {0x01, "EDCA"},
11056     {0x02, "HCCA"},
11057     {0x03, "HEMM"},
11058     {0, NULL}
11059   };
11060
11061   static const value_string qos_up[] = {
11062     {0x00, "Best Effort"},
11063     {0x01, "Background"},
11064     {0x02, "Spare"},
11065     {0x03, "Excellent Effort"},
11066     {0x04, "Controlled Load"},
11067     {0x05, "Video"},
11068     {0x06, "Voice"},
11069     {0x07, "Network Control"},
11070     {0, NULL}
11071   };
11072
11073   static const value_string classifier_type[] = {
11074     {0x00, "Ethernet parameters"},
11075     {0x01, "TCP/UDP IP parameters"},
11076     {0x02, "IEEE 802.1D/Q parameters"},
11077     {0, NULL}
11078   };
11079
11080   static const value_string tclas_process[] = {
11081     {0x00, "Incoming MSDU's higher layer parameters have to match to the parameters in all associated TCLAS elements."},
11082     {0x01, "Incoming MSDU's higher layer parameters have to match to at least one of the associated TCLAS elements."},
11083     {0x02, "Incoming MSDU's that do not belong to any other TS are classified to the TS for which this TCLAS Processing element is used. In this case, there will not be any associated TCLAS elements."},
11084     {0, NULL}
11085   };
11086
11087   static const true_false_string ieee80211_block_ack_control_ack_policy_flag = {
11088       "Immediate Acknowledgement Required",
11089       "Sender Does Not Require Immediate Acknowledgement"
11090   };
11091
11092   static const value_string ieee80211_block_ack_request_type_flags[] = {
11093     {0x00, "Basic Block Ack Request"},
11094     {0x01, "Reserved"},
11095     {0x02, "Compressed Block Ack Request"},
11096     {0x03, "Multi-TID Block Ack Request"},
11097     {0x00, NULL}
11098   };
11099
11100   static const value_string ieee80211_block_ack_type_flags[] = {
11101     {0x00, "Basic Block Ack"},
11102     {0x01, "Reserved"},
11103     {0x02, "Compressed Block"},
11104     {0x03, "Multi-TID Block"},
11105     {0x00, NULL}
11106   };
11107
11108   static const value_string phy_type[] = {
11109     { 0, "Unknown" },
11110     { 1, "FHSS 802.11 '97" },
11111     { 2, "DSSS 802.11 '97" },
11112     { 3, "IR Baseband" },
11113     { 4, "DSSS 802.11b" },
11114     { 5, "PBCC 802.11b" },
11115     { 6, "OFDM 802.11g" },
11116     { 7, "PBCC 802.11g" },
11117     { 8, "OFDM 802.11a" },
11118     { 0, NULL }
11119   };
11120
11121   static const value_string encoding_type[] = {
11122     { 0, "Unknown" },
11123     { 1, "CCK" },
11124     { 2, "PBCC" },
11125     { 3, "OFDM" },
11126     { 4, "DSS-OFDM" },
11127     { 5, "BPSK" },
11128     { 6, "QPSK" },
11129     { 7, "16QAM" },
11130     { 8, "64QAM" },
11131     { 0, NULL }
11132   };
11133
11134   static const value_string ssi_type[] = {
11135     { SSI_NONE, "None" },
11136     { SSI_NORM_RSSI, "Normalized RSSI" },
11137     { SSI_DBM, "dBm" },
11138     { SSI_RAW_RSSI, "Raw RSSI" },
11139     { 0, NULL }
11140   };
11141
11142   static const value_string preamble_type[] = {
11143     { 0, "Unknown" },
11144     { 1, "Short" },
11145     { 2, "Long" },
11146     { 0, NULL }
11147   };
11148
11149   static const value_string ft_action_codes[] ={
11150     {FT_ACTION_REQUEST, "FT Request"},
11151     {FT_ACTION_RESPONSE, "FT Response"},
11152     {FT_ACTION_CONFIRM, "FT Confirm"},
11153     {FT_ACTION_ACK, "FT Ack"},
11154     {0, NULL}
11155   };
11156
11157   static const value_string sa_query_action_codes[] ={
11158     {SA_QUERY_REQUEST, "SA Query Request"},
11159     {SA_QUERY_RESPONSE, "SA Query Response"},
11160     {0, NULL}
11161   };
11162
11163   static const value_string ieee80211_data_encap_payload_types[] = {
11164     {1, "Remote Request/Response"},
11165     {2, "TDLS"},
11166     {0, NULL}
11167   };
11168
11169   static hf_register_info hf[] = {
11170     {&hf_mactime,
11171      {"MAC timestamp", "wlan.mactime", FT_UINT64, BASE_DEC, NULL, 0x0,
11172       "Value in microseconds of the MAC's Time Synchronization Function timer when the first bit of the MPDU arrived at the MAC", HFILL }},
11173
11174     {&hf_hosttime,
11175      {"Host timestamp", "wlan.hosttime", FT_UINT64, BASE_DEC, NULL, 0x0,
11176       NULL, HFILL }},
11177
11178     {&hf_data_rate,
11179      {"Data Rate", "wlan.data_rate", FT_UINT64, BASE_DEC, NULL, 0,
11180       "Data rate (b/s)", HFILL }},
11181
11182     {&hf_channel,
11183      {"Channel", "wlan.channel", FT_UINT8, BASE_DEC, NULL, 0,
11184       "802.11 channel number that this frame was sent/received on", HFILL }},
11185
11186     {&hf_channel_frequency,
11187      {"Channel frequency", "wlan.channel_frequency", FT_UINT32, BASE_DEC, NULL, 0x0,
11188       "Channel frequency in megahertz that this frame was sent/received on", HFILL }},
11189
11190     {&hf_wlan_antenna,
11191      {"Antenna", "wlan.antenna", FT_UINT32, BASE_DEC, NULL, 0x0,
11192       "Antenna number this frame was sent/received over (starting at 0)", HFILL } },
11193
11194     {&hf_normrssi_antsignal,
11195      {"Normalized RSSI Signal", "wlan.normrssi_antsignal", FT_UINT32, BASE_DEC, NULL, 0x0,
11196       "RF signal power at the antenna, normalized to the range 0-1000", HFILL }},
11197
11198     {&hf_dbm_antsignal,
11199      {"SSI Signal (dBm)", "wlan.dbm_antsignal", FT_INT32, BASE_DEC, NULL, 0x0,
11200       "RF signal power at the antenna from a fixed, arbitrary value in decibels from one milliwatt", HFILL }},
11201
11202     {&hf_rawrssi_antsignal,
11203      {"Raw RSSI Signal", "wlan.rawrssi_antsignal", FT_UINT32, BASE_DEC, NULL, 0x0,
11204       "RF signal power at the antenna, reported as RSSI by the adapter", HFILL }},
11205
11206     {&hf_normrssi_antnoise,
11207      {"Normalized RSSI Noise", "wlan.normrssi_antnoise", FT_UINT32, BASE_DEC, NULL, 0x0,
11208       "RF noise power at the antenna, normalized to the range 0-1000", HFILL }},
11209
11210     {&hf_dbm_antnoise,
11211      {"SSI Noise (dBm)", "wlan.dbm_antnoise", FT_INT32, BASE_DEC, NULL, 0x0,
11212       "RF noise power at the antenna from a fixed, arbitrary value in decibels per one milliwatt", HFILL }},
11213
11214     {&hf_rawrssi_antnoise,
11215      {"Raw RSSI Noise", "wlan.rawrssi_antnoise", FT_UINT32, BASE_DEC, NULL, 0x0,
11216       "RF noise power at the antenna, reported as RSSI by the adapter", HFILL }},
11217
11218     {&hf_signal_strength,
11219      {"Signal Strength", "wlan.signal_strength", FT_UINT8, BASE_DEC, NULL, 0,
11220       "Signal strength (Percentage)", HFILL }},
11221
11222     {&hf_ieee80211_fc_field,
11223      {"Frame Control Field", "wlan.fc", FT_UINT16, BASE_HEX, NULL, 0,
11224       "MAC Frame control", HFILL }},
11225
11226     {&hf_ieee80211_fc_proto_version,
11227      {"Version", "wlan.fc.version", FT_UINT8, BASE_DEC, NULL, 0,
11228       "MAC Protocol version", HFILL }},  /* 0 */
11229
11230     {&hf_ieee80211_fc_frame_type,
11231      {"Type", "wlan.fc.type", FT_UINT8, BASE_DEC, VALS(frame_type), 0,
11232       "Frame type", HFILL }},
11233
11234     {&hf_ieee80211_fc_frame_subtype,
11235      {"Subtype", "wlan.fc.subtype", FT_UINT8, BASE_DEC, NULL, 0,
11236       "Frame subtype", HFILL }},  /* 2 */
11237
11238     {&hf_ieee80211_fc_frame_type_subtype,
11239      {"Type/Subtype", "wlan.fc.type_subtype", FT_UINT8, BASE_HEX, VALS(frame_type_subtype_vals), 0,
11240       "Type and subtype combined (first byte: type, second byte: subtype)", HFILL }},
11241
11242     {&hf_ieee80211_fc_flags,
11243      {"Protocol Flags", "wlan.flags", FT_UINT8, BASE_HEX, NULL, 0,
11244       NULL, HFILL }},
11245
11246     {&hf_ieee80211_fc_data_ds,
11247      {"DS status", "wlan.fc.ds", FT_UINT8, BASE_HEX, VALS (&tofrom_ds), (FLAG_FROM_DS|FLAG_TO_DS),
11248       "Data-frame DS-traversal status", HFILL }},  /* 3 */
11249
11250     {&hf_ieee80211_fc_to_ds,
11251      {"To DS", "wlan.fc.tods", FT_BOOLEAN, 8, TFS (&tods_flag), FLAG_TO_DS,
11252       "To DS flag", HFILL }},    /* 4 */
11253
11254     {&hf_ieee80211_fc_from_ds,
11255      {"From DS", "wlan.fc.fromds", FT_BOOLEAN, 8, TFS (&fromds_flag), FLAG_FROM_DS,
11256       "From DS flag", HFILL }},    /* 5 */
11257
11258     {&hf_ieee80211_fc_more_frag,
11259      {"More Fragments", "wlan.fc.frag", FT_BOOLEAN, 8, TFS (&more_frags), FLAG_MORE_FRAGMENTS,
11260       "More Fragments flag", HFILL }},  /* 6 */
11261
11262     {&hf_ieee80211_fc_retry,
11263      {"Retry", "wlan.fc.retry", FT_BOOLEAN, 8, TFS (&retry_flags), FLAG_RETRY,
11264       "Retransmission flag", HFILL }},
11265
11266     { &hf_ieee80211_fc_analysis_retransmission,
11267      {"Retransmission", "wlan.analysis.retransmission", FT_NONE, BASE_NONE,
11268       NULL, 0x0, "This frame is a suspected wireless retransmission", HFILL }},
11269
11270     { &hf_ieee80211_fc_analysis_retransmission_frame,
11271      {"Retransmission of frame", "wlan.analysis.retransmission_frame", FT_FRAMENUM, BASE_NONE,
11272       NULL, 0x0, "This is a retransmission of frame #", HFILL }},
11273
11274     {&hf_ieee80211_fc_pwr_mgt,
11275      {"PWR MGT", "wlan.fc.pwrmgt", FT_BOOLEAN, 8, TFS (&pm_flags), FLAG_POWER_MGT,
11276       "Power management status", HFILL }},
11277
11278     {&hf_ieee80211_fc_more_data,
11279      {"More Data", "wlan.fc.moredata", FT_BOOLEAN, 8, TFS (&md_flags), FLAG_MORE_DATA,
11280       "More data flag", HFILL }},
11281
11282     {&hf_ieee80211_fc_protected,
11283      {"Protected flag", "wlan.fc.protected", FT_BOOLEAN, 8, TFS (&protected_flags), FLAG_PROTECTED,
11284       NULL, HFILL }},
11285
11286     {&hf_ieee80211_fc_order,
11287      {"Order flag", "wlan.fc.order", FT_BOOLEAN, 8, TFS (&order_flags), FLAG_ORDER,
11288       "Strictly ordered flag", HFILL }},
11289
11290     {&hf_ieee80211_assoc_id,
11291      {"Association ID","wlan.aid",FT_UINT16, BASE_DEC, NULL, 0x3FFF,
11292       "Association-ID field", HFILL }},
11293
11294     {&hf_ieee80211_did_duration,
11295      {"Duration", "wlan.duration", FT_UINT16, BASE_DEC, NULL, 0,
11296       "Duration field", HFILL }},
11297
11298     {&hf_ieee80211_addr_da,
11299      {"Destination address", "wlan.da", FT_ETHER, BASE_NONE, NULL, 0,
11300       "Destination Hardware Address", HFILL }},
11301
11302     {&hf_ieee80211_addr_sa,
11303      {"Source address", "wlan.sa", FT_ETHER, BASE_NONE, NULL, 0,
11304       "Source Hardware Address", HFILL }},
11305
11306     { &hf_ieee80211_addr,
11307       {"Source or Destination address", "wlan.addr", FT_ETHER, BASE_NONE, NULL, 0,
11308        "Source or Destination Hardware Address", HFILL }},
11309
11310     {&hf_ieee80211_addr_ra,
11311      {"Receiver address", "wlan.ra", FT_ETHER, BASE_NONE, NULL, 0,
11312       "Receiving Station Hardware Address", HFILL }},
11313
11314     {&hf_ieee80211_addr_ta,
11315      {"Transmitter address", "wlan.ta", FT_ETHER, BASE_NONE, NULL, 0,
11316       "Transmitting Station Hardware Address", HFILL }},
11317
11318     {&hf_ieee80211_addr_bssid,
11319      {"BSS Id", "wlan.bssid", FT_ETHER, BASE_NONE, NULL, 0,
11320       "Basic Service Set ID", HFILL }},
11321
11322     {&hf_ieee80211_frag_number,
11323      {"Fragment number", "wlan.frag", FT_UINT16, BASE_DEC, NULL, 0,
11324       NULL, HFILL }},
11325
11326     {&hf_ieee80211_seq_number,
11327      {"Sequence number", "wlan.seq", FT_UINT16, BASE_DEC, NULL, 0,
11328       NULL, HFILL }},
11329
11330     {&hf_ieee80211_qos_priority,
11331      {"Priority", "wlan.qos.priority", FT_UINT16, BASE_DEC, NULL, 0,
11332       "802.1D Tag", HFILL }},
11333
11334     {&hf_ieee80211_qos_eosp,
11335      {"EOSP", "wlan.qos.eosp", FT_BOOLEAN, 8, TFS (&eosp_flag), QOS_FLAG_EOSP,
11336       "EOSP Field", HFILL }},
11337
11338     {&hf_ieee80211_qos_bit4,
11339      {"QoS bit 4", "wlan.qos.bit4", FT_BOOLEAN, 8, TFS (&bit4_flag), QOS_FLAG_EOSP,
11340       NULL, HFILL }},
11341
11342     {&hf_ieee80211_qos_ack_policy,
11343      {"Ack Policy", "wlan.qos.ack", FT_UINT8, BASE_HEX,  VALS (&ack_policy), 0,
11344       NULL, HFILL }},
11345
11346     {&hf_ieee80211_qos_amsdu_present,
11347      {"Payload Type", "wlan.qos.amsdupresent", FT_BOOLEAN, BASE_NONE,
11348       TFS (&ieee80211_qos_amsdu_present_flag), 0x0, NULL, HFILL }},
11349
11350     {&hf_ieee80211_qos_txop_limit,
11351      {"TXOP Limit", "wlan.qos.txop_limit", FT_UINT16, BASE_DEC, NULL, 0,
11352       NULL, HFILL }},
11353
11354     {&hf_ieee80211_qos_buf_state_indicated,
11355      {"Buffer State Indicated", "wlan.qos.buf_state_indicated",
11356        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
11357       NULL, HFILL }},
11358
11359     {&hf_ieee80211_qos_highest_pri_buf_ac,
11360      {"Highest-Priority Buffered AC", "wlan.qos.highest_pri_buf_ac",
11361        FT_UINT8, BASE_DEC, VALS(wme_acs), 0x0C,
11362       NULL, HFILL }},
11363
11364     {&hf_ieee80211_qos_qap_buf_load,
11365      {"QAP Buffered Load", "wlan.qos.qap_buf_load",
11366        FT_UINT8, BASE_DEC, NULL, 0xF0,
11367       NULL, HFILL }},
11368
11369     {&hf_ieee80211_qos_txop_dur_req,
11370      {"TXOP Duration Requested", "wlan.qos.txop_dur_req", FT_UINT16, BASE_DEC, NULL, 0,
11371       NULL, HFILL }},
11372
11373     {&hf_ieee80211_qos_queue_size,
11374      {"Queue Size", "wlan.qos.queue_size", FT_UINT16, BASE_DEC, NULL, 0,
11375       NULL, HFILL }},
11376
11377     {&hf_ieee80211_fcs,
11378      {"Frame check sequence", "wlan.fcs", FT_UINT32, BASE_HEX,
11379       NULL, 0, "Frame Check Sequence (FCS)", HFILL }},
11380
11381     {&hf_ieee80211_fcs_good,
11382      {"Good", "wlan.fcs_good", FT_BOOLEAN, BASE_NONE,
11383       NULL, 0x0, "True if the FCS is correct", HFILL }},
11384
11385     {&hf_ieee80211_fcs_bad,
11386      {"Bad", "wlan.fcs_bad", FT_BOOLEAN, BASE_NONE,
11387       NULL, 0x0, "True if the FCS is incorrect", HFILL }},
11388
11389     {&hf_ieee80211_fragment_overlap,
11390       {"Fragment overlap", "wlan.fragment.overlap", FT_BOOLEAN, BASE_NONE,
11391        NULL, 0x0, "Fragment overlaps with other fragments", HFILL }},
11392
11393     {&hf_ieee80211_fragment_overlap_conflict,
11394       {"Conflicting data in fragment overlap", "wlan.fragment.overlap.conflict",
11395        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11396        "Overlapping fragments contained conflicting data", HFILL }},
11397
11398     {&hf_ieee80211_fragment_multiple_tails,
11399       {"Multiple tail fragments found", "wlan.fragment.multipletails",
11400        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11401        "Several tails were found when defragmenting the packet", HFILL }},
11402
11403     {&hf_ieee80211_fragment_too_long_fragment,
11404       {"Fragment too long", "wlan.fragment.toolongfragment",
11405        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11406        "Fragment contained data past end of packet", HFILL }},
11407
11408     {&hf_ieee80211_fragment_error,
11409       {"Defragmentation error", "wlan.fragment.error",
11410        FT_FRAMENUM, BASE_NONE, NULL, 0x0,
11411        "Defragmentation error due to illegal fragments", HFILL }},
11412
11413     {&hf_ieee80211_fragment_count,
11414       {"Fragment count", "wlan.fragment.count", FT_UINT32, BASE_DEC, NULL, 0x0,
11415        NULL, HFILL }},
11416
11417     {&hf_ieee80211_fragment,
11418       {"802.11 Fragment", "wlan.fragment", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
11419        NULL, HFILL }},
11420
11421     {&hf_ieee80211_fragments,
11422       {"802.11 Fragments", "wlan.fragments", FT_NONE, BASE_NONE, NULL, 0x0,
11423        NULL, HFILL }},
11424
11425     {&hf_ieee80211_reassembled_in,
11426       {"Reassembled 802.11 in frame", "wlan.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
11427        "This 802.11 packet is reassembled in this frame", HFILL }},
11428
11429     {&hf_ieee80211_reassembled_length,
11430       {"Reassembled 802.11 length", "wlan.reassembled.length", FT_UINT32, BASE_DEC, NULL, 0x0,
11431        "The total length of the reassembled payload", HFILL }},
11432
11433     {&hf_ieee80211_wep_iv,
11434      {"Initialization Vector", "wlan.wep.iv", FT_UINT24, BASE_HEX, NULL, 0,
11435       NULL, HFILL }},
11436
11437     {&hf_ieee80211_wep_iv_weak,
11438      {"Weak IV", "wlan.wep.weakiv", FT_BOOLEAN,BASE_NONE, NULL,0x0,
11439        NULL,HFILL}},
11440
11441     {&hf_ieee80211_tkip_extiv,
11442      {"TKIP Ext. Initialization Vector", "wlan.tkip.extiv", FT_STRING,
11443       BASE_NONE, NULL, 0, "TKIP Extended Initialization Vector", HFILL }},
11444
11445     {&hf_ieee80211_ccmp_extiv,
11446      {"CCMP Ext. Initialization Vector", "wlan.ccmp.extiv", FT_STRING,
11447       BASE_NONE, NULL, 0, "CCMP Extended Initialization Vector", HFILL }},
11448
11449     {&hf_ieee80211_wep_key,
11450      {"Key Index", "wlan.wep.key", FT_UINT8, BASE_DEC, NULL, 0,
11451       NULL, HFILL }},
11452
11453     {&hf_ieee80211_wep_icv,
11454      {"WEP ICV", "wlan.wep.icv", FT_UINT32, BASE_HEX, NULL, 0,
11455       NULL, HFILL }},
11456     /***  Begin: WAVE Service information element Dissection - IEEE 802.11p Draft 4.0 ***/
11457
11458
11459     {&hf_ieee80211_pst_timingquality,
11460      {"Timing Quality", "pst.timingQuality", FT_UINT16, BASE_DEC, NULL, 0,
11461       "PST Timing Quality", HFILL }},
11462
11463     {&hf_ieee80211_pst_providercount,
11464      {"No. of Providers announcing their Services", "pst.providerCount", FT_UINT8, BASE_DEC, NULL, 0,
11465       "Provider Count", HFILL }},
11466
11467     {&hf_ieee80211_pst_providercap,
11468      {"Capabilities of Provider", "pst.providercap", FT_NONE, BASE_NONE, NULL, 0,
11469       NULL, HFILL }},
11470
11471     {&hf_ieee80211_pst_length,
11472      {"Provider Service Table Length", "pst.length", FT_UINT16, BASE_DEC, NULL, 0,
11473       "PST Length", HFILL }},
11474
11475     {&hf_ieee80211_pst_contents,
11476      {"Provider Service Table Contents", "pst.contents", FT_UINT8, BASE_HEX, NULL, 0,
11477       "PST Contents", HFILL }},
11478
11479     {&hf_ieee80211_pst_acid,
11480      {"Application Class ID (ACID)", "pst.ACID", FT_UINT8, BASE_DEC, NULL, 0,
11481       "PST ACID", HFILL }},
11482
11483     {&hf_ieee80211_pst_acm_length,
11484      {"Application Context Mask (ACM) Length", "pst.ACM.length", FT_UINT8, BASE_DEC, NULL, 0,
11485       "PST ACM Length", HFILL }},
11486
11487     {&hf_ieee80211_pst_acm_contents,
11488      {"Application Context Mask Contents (ACM)", "pst.ACM.contents", FT_STRING, BASE_NONE, NULL, 0,
11489       "PST ACM Contents", HFILL }},
11490
11491     {&hf_ieee80211_pst_acf,
11492      {"Application Contents Field (ACF)", "pst.ACF", FT_STRING, BASE_NONE, NULL, 0,
11493       "PST ACF", HFILL }},
11494
11495     {&hf_ieee80211_pst_priority,
11496      {"Application Priority", "pst.priority", FT_UINT8, BASE_DEC, NULL, 0,
11497       "PST Priority", HFILL }},
11498
11499     {&hf_ieee80211_pst_ipv6addr,
11500      {"Internet Protocol V6 Address", "pst.ipv6addr", FT_IPv6, BASE_NONE, NULL, 0,
11501       "IP v6 Addr", HFILL }},
11502
11503     {&hf_ieee80211_pst_macaddr,
11504      {"Medium Access Control Address (MAC addr)", "pst.macaddr", FT_ETHER, BASE_NONE, NULL, 0,
11505       "MAC Address", HFILL }},
11506
11507     {&hf_ieee80211_pst_serviceport,
11508      {"Service Port", "pst.serviceport", FT_UINT16, BASE_DEC, NULL, 0,
11509       "PST Service Port", HFILL }},
11510
11511     {&hf_ieee80211_pst_addressing,
11512      {"Addressing", "pst.addressing", FT_UINT8, BASE_DEC, NULL, 0,
11513       "PST Addressing", HFILL }},
11514
11515     {&hf_ieee80211_pst_channel,
11516      {"Service (IEE802.11) Channel", "pst.channel", FT_UINT8, BASE_DEC, NULL, 0,
11517       "PST Service Channel", HFILL }},
11518
11519     {&hf_ieee80211_chan_noc,
11520      {"Number of Channels", "chan.chan_uknown", FT_UINT8, BASE_DEC, NULL, 0,
11521       NULL, HFILL }},
11522
11523     {&hf_ieee80211_chan_length,
11524      {"Length", "chan.chan_length", FT_UINT8, BASE_DEC, NULL, 0,
11525       NULL, HFILL }},
11526
11527     {&hf_ieee80211_chan_content,
11528      {"Contents", "chan.chan_content", FT_UINT8, BASE_DEC, NULL, 0,
11529       NULL, HFILL }},
11530
11531     {&hf_ieee80211_chan_channel,
11532      {"channel", "chan.chan_channel", FT_UINT8, BASE_DEC, NULL, 0,
11533       NULL, HFILL }},
11534
11535     {&hf_ieee80211_chan_adapt,
11536      {"Adaptable", "chan.chan_adapt", FT_UINT8, BASE_DEC, NULL, 0,
11537       NULL, HFILL }},
11538
11539     {&hf_ieee80211_chan_rate,
11540      {"Rate", "chan.chan_rate", FT_UINT8, BASE_DEC, NULL, 0,
11541       NULL, HFILL }},
11542
11543     {&hf_ieee80211_chan_tx_pow,
11544      {"Tx Power", "chan.chan_tx_pow", FT_UINT8, BASE_DEC, NULL, 0,
11545       NULL, HFILL }},
11546
11547     {&hf_ieee80211_block_ack_request_control,
11548      {"Block Ack Request (BAR) Control", "wlan.bar.control",
11549       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
11550
11551     {&hf_ieee80211_block_ack_control,
11552      {"Block Ack Request Control", "wlan.ba.control",
11553       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
11554
11555     {&hf_ieee80211_block_ack_control_ack_policy,
11556      {"BAR Ack Policy", "wlan.ba.control.ackpolicy",
11557       FT_BOOLEAN, 16, TFS (&ieee80211_block_ack_control_ack_policy_flag), 0x01, "Block Ack Request (BAR) Ack Policy", HFILL }},
11558
11559     {&hf_ieee80211_block_ack_control_multi_tid,
11560      {"Multi-TID", "wlan.ba.control.multitid",
11561       FT_BOOLEAN, 16, 0, 0x02, "Multi-Traffic Identifier (TID)", HFILL }},
11562
11563     {&hf_ieee80211_block_ack_control_compressed_bitmap,
11564      {"Compressed Bitmap", "wlan.ba.control.cbitmap",
11565       FT_BOOLEAN, 16, 0, 0x04, NULL, HFILL }},
11566
11567     {&hf_ieee80211_block_ack_control_reserved,
11568      {"Reserved", "wlan.ba.control.cbitmap",
11569       FT_UINT16, BASE_HEX, NULL, 0x0ff8, NULL, HFILL }},
11570
11571     {&hf_ieee80211_block_ack_control_basic_tid_info,
11572      {"TID for which a Basic BlockAck frame is requested", "wlan.ba.basic.tidinfo",
11573       FT_UINT16, BASE_HEX, NULL, 0xf000, "Traffic Identifier (TID) for which a Basic BlockAck frame is requested", HFILL }},
11574
11575     {&hf_ieee80211_block_ack_control_compressed_tid_info,
11576      {"TID for which a BlockAck frame is requested", "wlan.bar.compressed.tidinfo",
11577       FT_UINT16, BASE_HEX, NULL, 0xf000, "Traffic Identifier (TID) for which a BlockAck frame is requested", HFILL }},
11578
11579     {&hf_ieee80211_block_ack_control_multi_tid_info,
11580      {"Number of TIDs Present", "wlan.ba.mtid.tidinfo",
11581       FT_UINT16, BASE_HEX, NULL, 0xf000, "Number of Traffic Identifiers (TIDs) Present", HFILL }},
11582
11583     {&hf_ieee80211_block_ack_multi_tid_info,
11584      {"Traffic Identifier (TID) Info", "wlan.ba.mtid.tid",
11585       FT_UINT8, BASE_DEC, 0, 0, NULL, HFILL }},
11586
11587     {&hf_ieee80211_block_ack_multi_tid_reserved,
11588      {"Reserved", "wlan.bar.mtid.tidinfo.reserved",
11589       FT_UINT16, BASE_HEX, 0, 0x0fff, NULL, HFILL }},
11590
11591     {&hf_ieee80211_block_ack_multi_tid_value,
11592      {"Multi-TID Value", "wlan.bar.mtid.tidinfo.value",
11593       FT_UINT16, BASE_HEX, 0, 0xf000, NULL, HFILL }},
11594
11595     {&hf_ieee80211_block_ack_request_type,
11596      {"Block Ack Request Type", "wlan.bar.type",
11597       FT_UINT8, BASE_HEX, VALS(ieee80211_block_ack_request_type_flags), 0, "Block Ack Request (BAR) Type", HFILL }},
11598
11599     {&hf_ieee80211_block_ack_type,
11600      {"Block Ack Type", "wlan.ba.type",
11601       FT_UINT8, BASE_HEX, VALS(ieee80211_block_ack_type_flags), 0, NULL, HFILL }},
11602
11603     {&hf_ieee80211_block_ack_bitmap,
11604      {"Block Ack Bitmap", "wlan.ba.bm",
11605       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
11606
11607     {&hf_ieee80211_data_encap_payload_type,
11608      {"Payload Type", "wlan.data_encap.payload_type",
11609       FT_UINT8, BASE_DEC, VALS(ieee80211_data_encap_payload_types), 0, NULL,
11610       HFILL }},
11611
11612     {&hf_ieee80211_ff_tdls_action_code,
11613      {"Action code", "wlan_mgt.fixed.action_code",
11614       FT_UINT8, BASE_DEC, VALS(&tdls_action_codes), 0,
11615       "Management action code", HFILL }},
11616
11617     {&hf_ieee80211_ff_target_channel,
11618      {"Target Channel", "wlan_mgt.fixed.target_channel",
11619       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
11620
11621     {&hf_ieee80211_ff_regulatory_class,
11622      {"Regulatory Class", "wlan_mgt.fixed.regulatory_class",
11623       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }}
11624
11625 #ifdef MESH_OVERRIDES
11626     ,
11627     {&hf_ieee80211_mesh_flags,
11628       {"Mesh Flags", "wlan.mesh.flags",
11629        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11630        NULL, HFILL }},
11631
11632     {&hf_ieee80211_mesh_seq,
11633       {"Mesh Seq", "wlan.mesh.seq", FT_UINT32, BASE_DEC, NULL, 0,
11634        "Mesh End-to-End sequence number", HFILL }},
11635
11636     {&hf_ieee80211_mesh_ttl,
11637       {"Mesh TTL", "wlan.mesh.ttl", FT_UINT8, BASE_DEC, NULL, 0,
11638        NULL, HFILL }},
11639
11640     {&hf_ieee80211_mesh_ae1,
11641       {"Mesh A4", "wlan.mesh.a4", FT_ETHER, BASE_NONE, NULL, 0,
11642        "Mesh Address4", HFILL }},
11643
11644     {&hf_ieee80211_mesh_ae2,
11645       {"Mesh A5", "wlan.mesh.a5", FT_ETHER, BASE_NONE, NULL, 0,
11646        "Mesh Address5", HFILL }},
11647
11648     {&hf_ieee80211_mesh_ae3,
11649       {"Mesh A6", "wlan.mesh.a6", FT_ETHER, BASE_NONE, NULL, 0,
11650        "Mesh Address6", HFILL }}
11651
11652 #endif /* MESH_OVERRIDES */
11653   };
11654
11655   static hf_register_info hf_prism[] = {
11656     /* Prism-specific header fields
11657        XXX - make as many of these generic as possible. */
11658     { &hf_ieee80211_prism_msgcode,
11659      {"Message Code", "prism.msgcode", FT_UINT32, BASE_DEC, NULL, 0x0,
11660       NULL, HFILL }},
11661
11662     { &hf_ieee80211_prism_msglen,
11663      {"Message Length", "prism.msglen", FT_UINT32, BASE_DEC, NULL, 0x0,
11664       NULL, HFILL }},
11665
11666     { &hf_ieee80211_prism_devname,
11667      {"Device Name", "prism.devname", FT_STRING, BASE_NONE, NULL, 0x0,
11668       NULL, HFILL }},
11669
11670     { &hf_ieee80211_prism_did,
11671      {"DID", "prism.did.type", FT_NONE, BASE_NONE, NULL, 0x0,
11672       NULL, HFILL }},
11673
11674     { &hf_ieee80211_prism_did_type,
11675      {"DID", "prism.did.type", FT_UINT32, BASE_HEX, VALS(&prism_did_vals), 0x0,
11676       "Different ID for each parameter", HFILL }},
11677
11678     { &hf_ieee80211_prism_did_status,
11679      {"Status", "prism.did.status", FT_UINT16, BASE_DEC, VALS(&prism_status_vals), 0x0,
11680       "Supplied by the driver or not", HFILL }},
11681
11682     { &hf_ieee80211_prism_did_length,
11683      {"Length", "prism.did.length", FT_UINT16, BASE_DEC, NULL, 0x0,
11684       "Length of data", HFILL }},
11685
11686     { &hf_ieee80211_prism_did_hosttime,
11687      {"Host Time", "prism.did.hosttime", FT_UINT32, BASE_DEC, NULL, 0x0,
11688       "In jiffies - for our system this is in 10ms units", HFILL }},
11689
11690     { &hf_ieee80211_prism_did_mactime,
11691      {"Mac Time", "prism.did.hosttime", FT_UINT32, BASE_DEC, NULL, 0x0,
11692       "In micro-seconds", HFILL }},
11693
11694     { &hf_ieee80211_prism_did_channel,
11695      {"Channel", "prism.did.hosttime", FT_UINT32, BASE_DEC, NULL, 0x0,
11696       NULL, HFILL }},
11697
11698     { &hf_ieee80211_prism_did_rssi,
11699      {"RSSI", "prism.did.rssi", FT_UINT32, BASE_HEX, NULL, 0x0,
11700       NULL, HFILL }},
11701
11702     { &hf_ieee80211_prism_did_sq,
11703      {"SQ", "prism.did.sq", FT_UINT32, BASE_HEX, NULL, 0x0,
11704       NULL, HFILL }},
11705
11706     { &hf_ieee80211_prism_did_signal,
11707      {"Signal", "prism.did.signal", FT_UINT32, BASE_HEX, NULL, 0x0,
11708       NULL, HFILL }},
11709
11710     { &hf_ieee80211_prism_did_noise,
11711      {"Noise", "prism.did.noise", FT_UINT32, BASE_HEX, NULL, 0x0,
11712       NULL, HFILL }},
11713
11714     { &hf_ieee80211_prism_did_rate,
11715      {"Rate (In Mb/s)", "prism.did.rate", FT_UINT32, BASE_CUSTOM, prism_rate_base_custom, 0x0,
11716       "In Mb/s", HFILL }},
11717
11718     { &hf_ieee80211_prism_did_istx,
11719      {"IsTX", "prism.did.istx", FT_UINT32, BASE_HEX, VALS(&prism_istx_vals), 0x0,
11720       "Type of packet (RX or TX ?)", HFILL }},
11721
11722     { &hf_ieee80211_prism_did_frmlen,
11723      {"Frame Length", "prism.did.frmlen", FT_UINT32, BASE_HEX_DEC, NULL, 0x0,
11724       "Length of the following frame in bytes", HFILL }},
11725
11726     { &hf_ieee80211_prism_did_unknown,
11727      {"Unknown DID Field", "prism.did.unknown", FT_UINT32, BASE_HEX_DEC, NULL, 0x0,
11728       NULL, HFILL }}
11729   };
11730
11731   static hf_register_info hf_wlancap[] = {
11732     /* AVS-specific header fields.
11733        XXX - make as many of these generic as possible. */
11734     {&hf_wlan_magic,
11735      {"Header magic", "wlancap.magic", FT_UINT32, BASE_HEX, NULL, 0xFFFFFFF0, NULL, HFILL } },
11736     { &hf_wlan_version, { "Header revision", "wlancap.version", FT_UINT32,
11737                           BASE_DEC, NULL, 0xF, NULL, HFILL } },
11738     { &hf_wlan_length, { "Header length", "wlancap.length", FT_UINT32,
11739                          BASE_DEC, NULL, 0x0, NULL, HFILL } },
11740     {&hf_wlan_phytype,
11741      {"PHY type", "wlan.phytype", FT_UINT32, BASE_DEC, VALS(phy_type), 0x0,
11742       NULL, HFILL } },
11743
11744     { &hf_wlan_priority, { "Priority", "wlancap.priority", FT_UINT32, BASE_DEC,
11745                            NULL, 0x0, NULL, HFILL } },
11746     { &hf_wlan_ssi_type, { "SSI Type", "wlancap.ssi_type", FT_UINT32, BASE_DEC,
11747                            VALS(ssi_type), 0x0, NULL, HFILL } },
11748     { &hf_wlan_preamble, { "Preamble", "wlancap.preamble", FT_UINT32,
11749                            BASE_DEC, VALS(preamble_type), 0x0, NULL, HFILL } },
11750     { &hf_wlan_encoding, { "Encoding Type", "wlancap.encoding", FT_UINT32,
11751                            BASE_DEC, VALS(encoding_type), 0x0, NULL, HFILL } },
11752     { &hf_wlan_sequence, { "Receive sequence", "wlancap.sequence", FT_UINT32,
11753                            BASE_DEC, NULL, 0x0, NULL, HFILL } },
11754     { &hf_wlan_drops, { "Known Dropped Frames", "wlancap.drops", FT_UINT32,
11755                            BASE_DEC, NULL, 0x0, NULL, HFILL } },
11756     { &hf_wlan_receiver_addr, { "Receiver Address", "wlancap.receiver_addr", FT_ETHER,
11757                            BASE_NONE, NULL, 0x0, "Receiver Hardware Address", HFILL } },
11758     { &hf_wlan_padding, { "Padding", "wlancap.padding", FT_BYTES,
11759                            BASE_NONE, NULL, 0x0, NULL, HFILL } }
11760   };
11761
11762   static const true_false_string rsn_preauth_flags = {
11763     "Transmitter supports pre-authentication",
11764     "Transmitter does not support pre-authentication"
11765   };
11766
11767   static const true_false_string rsn_no_pairwise_flags = {
11768     "Transmitter cannot support WEP default key 0 simultaneously with "
11769     "Pairwise key",
11770     "Transmitter can support WEP default key 0 simultaneously with "
11771     "Pairwise key"
11772   };
11773
11774   static const value_string rsn_cap_replay_counter[] = {
11775     {0x00, "1 replay counter per PTKSA/GTKSA/STAKeySA"},
11776     {0x01, "2 replay counters per PTKSA/GTKSA/STAKeySA"},
11777     {0x02, "4 replay counters per PTKSA/GTKSA/STAKeySA"},
11778     {0x03, "16 replay counters per PTKSA/GTKSA/STAKeySA"},
11779     {0, NULL}
11780   };
11781
11782   static const true_false_string ht_ldpc_coding_flag = {
11783     "Transmitter supports receiving LDPC coded packets",
11784     "Transmitter does not support receiving LDPC coded packets"
11785   };
11786
11787   static const true_false_string ht_chan_width_flag = {
11788     "Transmitter supports 20MHz and 40MHz operation",
11789     "Transmitter only supports 20MHz operation"
11790   };
11791
11792   static const value_string ht_sm_pwsave_flag[] = {
11793     {0x00, "Static SM Power Save mode"},
11794     {0x01, "Dynamic SM Power Save mode"},
11795     {0x02, "Reserved"},
11796     {0x03, "SM Power Save disabled"},
11797     {0x00, NULL}
11798   };
11799
11800   static const true_false_string ht_green_flag = {
11801     "Transmitter is able to receive PPDUs with Green Field (GF) preamble",
11802     "Transmitter is not able to receive PPDUs with Green Field (GF) preamble"
11803   };
11804
11805   static const value_string ht_rx_stbc_flag[] = {
11806     {0x00, "No Rx STBC support"},
11807     {0x01, "Rx support of one spatial stream"},
11808     {0x02, "Rx support of one and two spatial streams"},
11809     {0x03, "Rx support of one, two, and three spatial streams"},
11810     {0x00, NULL}
11811   };
11812
11813   static const true_false_string ht_delayed_block_ack_flag = {
11814     "Transmitter supports HT-Delayed BlockAck",
11815     "Transmitter does not support HT-Delayed BlockAck"
11816   };
11817
11818   static const true_false_string ht_max_amsdu_flag = {
11819     "7935 bytes",
11820     "3839 bytes"
11821   };
11822
11823   static const true_false_string ht_dss_cck_40_flag = {
11824     "Will/Can use DSSS/CCK in 40 MHz",
11825     "Won't/Can't use of DSSS/CCK in 40 MHz"
11826   };
11827
11828   static const true_false_string ht_psmp_flag = {
11829     "Will/Can support PSMP operation",
11830     "Won't/Can't support PSMP operation"
11831   };
11832
11833   static const true_false_string ht_40_mhz_intolerant_flag = {
11834     "Use of 40 MHz transmissions restricted/disallowed",
11835     "Use of 40 MHz transmissions unrestricted/allowed"
11836   };
11837
11838   static const value_string ampduparam_mpdu_start_spacing_flags[] = {
11839     {0x00, "no restriction"},
11840     {0x01, "1/4 [usec]"},
11841     {0x02, "1/2 [usec]"},
11842     {0x03, "1 [usec]"},
11843     {0x04, "2 [usec]"},
11844     {0x05, "4 [usec]"},
11845     {0x06, "8 [usec]"},
11846     {0x07, "16 [usec]"},
11847     {0x00, NULL}
11848   };
11849
11850   static const true_false_string mcsset_tx_mcs_set_defined_flag = {
11851     "Defined",
11852     "Not Defined",
11853   };
11854
11855   static const true_false_string mcsset_tx_rx_mcs_set_not_equal_flag = {
11856     "Not Equal",
11857     "Equal",
11858   };
11859
11860   static const value_string mcsset_tx_max_spatial_streams_flags[] = {
11861     {0x00, "1 spatial stream"},
11862     {0x01, "2 spatial streams"},
11863     {0x02, "3 spatial streams"},
11864     {0x03, "4 spatial streams"},
11865     {0x00, NULL}
11866   };
11867
11868   static const value_string htex_transtime_flags[] = {
11869     {0x00, "No Transition"},
11870     {0x01, "400 usec"},
11871     {0x02, "1.5 msec"},
11872     {0x03, "5 msec"},
11873     {0x00, NULL}
11874   };
11875
11876   static const value_string htex_mcs_flags[] = {
11877     {0x00, "STA does not provide MCS feedback"},
11878     {0x01, "Reserved"},
11879     {0x02, "STA provides only unsolicited MCS feedback"},
11880     {0x03, "STA can provide MCS feedback in response to MRQ as well as unsolicited MCS feedback"},
11881     {0x00, NULL}
11882   };
11883
11884   static const value_string txbf_calib_flag[] = {
11885     {0x00, "incapable"},
11886     {0x01, "Limited involvement, cannot initiate"},
11887     {0x02, "Limited involvement, can initiate"},
11888     {0x03, "Fully capable"},
11889     {0x00, NULL}
11890   };
11891
11892   static const value_string txbf_feedback_flags[] = {
11893     {0x00, "not supported"},
11894     {0x01, "delayed feedback capable"},
11895     {0x02, "immediate feedback capable"},
11896     {0x03, "delayed and immediate feedback capable"},
11897     {0x00, NULL}
11898   };
11899
11900   static const value_string txbf_antenna_flags[] = {
11901     {0x00, "1 TX antenna sounding"},
11902     {0x01, "2 TX antenna sounding"},
11903     {0x02, "3 TX antenna sounding"},
11904     {0x03, "4 TX antenna sounding"},
11905     {0x00, NULL}
11906   };
11907
11908   static const value_string txbf_csi_max_rows_bf_flags[] = {
11909     {0x00, "1 row of CSI"},
11910     {0x01, "2 rows of CSI"},
11911     {0x02, "3 rows of CSI"},
11912     {0x03, "4 rows of CSI"},
11913     {0x00, NULL}
11914   };
11915
11916   static const value_string txbf_chan_est_flags[] = {
11917     {0x00, "1 space time stream"},
11918     {0x01, "2 space time streams"},
11919     {0x02, "3 space time streams"},
11920     {0x03, "4 space time streams"},
11921     {0x00, NULL}
11922   };
11923
11924   static const value_string txbf_min_group_flags[] = {
11925     {0x00, "No grouping supported"},
11926     {0x01, "Groups of 1,2 supported"},
11927     {0x02, "Groups of 1,4 supported"},
11928     {0x03, "Groups of 1,2,4 supported"},
11929     {0x00, NULL}
11930   };
11931
11932   static const value_string hta_ext_chan_offset_flag[] = {
11933     {0x00, "No Extension Channel"},
11934     {0x01, "Extension Channel above control channel"},
11935     {0x02, "Undefined"},
11936     {0x03, "Extension Channel below control channel"},
11937     {0x00, NULL}
11938   };
11939
11940   static const true_false_string hta_rec_tx_width_flag = {
11941     "Any channel width enabled",
11942     "Use 20MHz channel (control)"
11943   };
11944
11945   static const true_false_string hta_rifs_mode_flag = {
11946     "Use of RIFS permitted",
11947     "Use of RIFS prohibited"
11948   };
11949
11950   static const true_false_string hta_controlled_access_flag = {
11951     "Not only PSMP",
11952     "PSMP only"
11953   };
11954
11955   static const value_string hta_service_interval_flag[] = {
11956     {0x00, "5ms"},
11957     {0x01, "10ms"},
11958     {0x02, "15ms"},
11959     {0x03, "20ms"},
11960     {0x04, "25ms"},
11961     {0x05, "30ms"},
11962     {0x06, "35ms"},
11963     {0x07, "40ms"},
11964     {0x00, NULL}
11965   };
11966
11967   static const value_string hta_operating_mode_flag[] = {
11968     {0x00, "Pure HT, no protection"},
11969     {0x01, "There may be non-HT devices (control & ext channel)"},
11970     {0x02, "No non-HT is associated, but at least 1 20MHz is. protect on"},
11971     {0x03, "Mixed: no non-HT is associated, protect on"},
11972     {0x00, NULL}
11973   };
11974
11975   static const true_false_string hta_non_gf_devices_flag = {
11976     "All HT devices associated are GF capable",
11977     "One or More HT devices are not GF capable"
11978   };
11979
11980   static const true_false_string hta_dual_stbc_protection_flag = {
11981     "Dual CTS protections is used",
11982     "Regular use of RTS/CTS"
11983   };
11984
11985   static const true_false_string hta_secondary_beacon_flag = {
11986     "Secondary Beacon",
11987     "Primary Beacon"
11988   };
11989
11990   static const true_false_string hta_lsig_txop_protection_flag = {
11991     "Full Support",
11992     "Not full support"
11993   };
11994
11995   static const true_false_string hta_pco_active_flag = {
11996     "PCO is activated in the BSS",
11997     "PCO is not activated in the BSS"
11998   };
11999
12000   static const true_false_string hta_pco_phase_flag = {
12001     "Switch to 20MHz phase/keep 20MHz",
12002     "Switch to 40MHz phase/keep 40MHz"
12003   };
12004
12005   static const value_string ht_info_secondary_channel_offset_flags[] = {
12006     {0x00, "No secondary channel"},
12007     {0x01, "Secondary channel is above the primary channel"},
12008     {0x02, "Reserved"},
12009     {0x03, "Secondary channel is below the primary channel"},
12010     {0x00, NULL}
12011   };
12012
12013   static const true_false_string ht_info_channel_width_flag = {
12014     "Channel of any width supported",
12015     "20 MHz channel width only"
12016   };
12017
12018   static const true_false_string ht_info_rifs_mode_flag = {
12019     "Permitted",
12020     "Prohibited"
12021   };
12022
12023   static const true_false_string ht_info_psmp_stas_only_flag = {
12024     "Association requests are accepted from only PSMP capable STA",
12025     "Association requests are accepted regardless of PSMP capability"
12026   };
12027
12028   static const value_string ht_info_service_interval_granularity_flags[] = {
12029     {0x00, "5 ms"},
12030     {0x01, "10 ms"},
12031     {0x02, "15 ms"},
12032     {0x03, "20 ms"},
12033     {0x04, "25 ms"},
12034     {0x05, "30 ms"},
12035     {0x06, "35 ms"},
12036     {0x07, "40 ms"},
12037     {0x00, NULL}
12038   };
12039
12040   static const value_string ht_info_operating_mode_flags[] = {
12041     {0x00, "All STAs are - 20/40 MHz HT or in a 20/40 MHz BSS or are 20 MHz HT in a 20 MHz BSS"},
12042     {0x01, "HT non-member protection mode"},
12043     {0x02, "Only HT STAs in the BSS, however, there exists at least one 20 MHz STA"},
12044     {0x03, "HT mixed mode"},
12045     {0x00, NULL}
12046   };
12047
12048   static const true_false_string ht_info_non_greenfield_sta_present_flag = {
12049     "One or more associated STAs are not greenfield capable",
12050     "All associated STAs are greenfield capable"
12051   };
12052
12053   static const true_false_string ht_info_transmit_burst_limit_flag = {
12054     "2.4 GHz - 6.16 ms | All other bands - 3.08 ms",
12055     "No limit"
12056   };
12057
12058   static const true_false_string ht_info_obss_non_ht_stas_present_flag = {
12059     "Use of protection for non-HT STAs by overlapping BSSs is needed",
12060     "Use of protection for non-HT STAs by overlapping BSSs is not needed"
12061   };
12062
12063   static const true_false_string ht_info_dual_beacon_flag = {
12064     "AP transmits a secondary beacon",
12065     "No second beacon is transmitted"
12066   };
12067
12068   static const true_false_string ht_info_dual_cts_protection_flag = {
12069     "Required",
12070     "Not required"
12071   };
12072
12073   static const true_false_string ht_info_secondary_beacon_flag = {
12074     "Secondary beacon",
12075     "Primary beacon"
12076   };
12077
12078   static const true_false_string ht_info_lsig_txop_protection_full_support_flag = {
12079     "All HT STAs in the BSS support L-SIG TXOP protection",
12080     "One or more HT STAs in the BSS do not support L-SIG TXOP protection"
12081   };
12082
12083   static const true_false_string ht_info_pco_phase_flag = {
12084     "Switch to or continue 40 MHz phase",
12085     "Switch to or continue 20 MHz phase"
12086   };
12087
12088   static const true_false_string htc_lac_trq_flag = {
12089     "Want sounding PPDU",
12090     "Don't want sounding PPDU"
12091   };
12092
12093   static const true_false_string htc_lac_mai_mrq_flag = {
12094     "MCS feedback requested",
12095     "No MCS feedback requested"
12096   };
12097
12098   static const value_string ieee80211_htc_lac_asel_command_flags[] = {
12099     {0x00, "Transmit Antenna Selection Sounding Indication (TXASSI)"},
12100     {0x01, "Transmit Antenna Selection Sounding Request (TXASSR)"},
12101     {0x02, "Receive Antenna Selection Sounding Indication (RXASSI)"},
12102     {0x03, "Receive Antenna Selection Sounding Request (RXASSR)"},
12103     {0x04, "Sounding Label"},
12104     {0x05, "No feedback, ASEL training failure"},
12105     {0x06, "Transmit Antenna Selection Sounding Indication (TXASSI) requesting feedback of explicit CSI"},
12106     {0x07, "Reserved"},
12107     {0x00, NULL}
12108   };
12109
12110   static const value_string ieee80211_htc_cal_pos_flags[] = {
12111     {0x00, "Not a calibration frame"},
12112     {0x01, "Calibration Start"},
12113     {0x02, "Sounding Response"},
12114     {0x03, "Sounding Complete"},
12115     {0x00, NULL}
12116   };
12117
12118   static const true_false_string ieee80211_htc_ndp_announcement_flag = {
12119     "NDP will follow",
12120     "No NDP will follow"
12121   };
12122
12123   static const value_string ieee80211_htc_csi_steering_flags[] = {
12124     {0x00, "No feedback required"},
12125     {0x01, "CSI"},
12126     {0x02, "Non-compressed Beamforming Feedback Matrix"},
12127     {0x03, "Compressed Beamforming Feedback Matrix"},
12128     {0x00, NULL}
12129   };
12130
12131   static const value_string ieee80211_tag_secondary_channel_offset_flags[] = {
12132     {0x00, "No Secondary Channel"},
12133     {0x01, "Above Primary Channel"},
12134     {0x02, "Reserved"},
12135     {0x03, "Below Primary Channel"},
12136     {0x00, NULL}
12137   };
12138
12139   static const value_string ieee80211_tag_ext_channel_switch_announcement_switch_mode_flags[] = {
12140     {0x00, "Frames may be transmitted before the channel switch has been completed"},
12141     {0x01, "No more frames are to be transmitted until the channel switch has been completed"},
12142     {0x00, NULL}
12143   };
12144
12145   static const value_string service_interval_granularity_vals[] = {
12146     { 0, "5 ms" },
12147     { 1, "10 ms" },
12148     { 2, "15 ms" },
12149     { 3, "20 ms" },
12150     { 4, "25 ms" },
12151     { 5, "30 ms" },
12152     { 6, "35 ms" },
12153     { 7, "40 ms" },
12154     { 0x00, NULL }
12155   };
12156
12157   static hf_register_info ff[] = {
12158
12159     {&hf_ieee80211_ff_timestamp,
12160      {"Timestamp", "wlan_mgt.fixed.timestamp", FT_UINT64, BASE_HEX,
12161       NULL, 0, NULL, HFILL }},
12162
12163     {&hf_ieee80211_ff_auth_alg,
12164      {"Authentication Algorithm", "wlan_mgt.fixed.auth.alg",
12165       FT_UINT16, BASE_DEC, VALS (&auth_alg), 0, NULL, HFILL }},
12166
12167     {&hf_ieee80211_ff_beacon_interval,
12168      {"Beacon Interval", "wlan_mgt.fixed.beacon", FT_UINT32, BASE_CUSTOM, beacon_interval_base_custom, 0,
12169       NULL, HFILL }},
12170
12171     {&hf_ieee80211_fixed_parameters,
12172      {"Fixed parameters", "wlan_mgt.fixed.all", FT_UINT16, BASE_DEC, NULL, 0,
12173       NULL, HFILL }},
12174
12175     {&hf_ieee80211_tagged_parameters,
12176      {"Tagged parameters", "wlan_mgt.tagged.all", FT_UINT16, BASE_DEC, NULL, 0,
12177       NULL, HFILL }},
12178
12179     {&hf_ieee80211_tag_ssid,
12180      {"SSID", "wlan_mgt.ssid", FT_STRING, BASE_NONE, NULL, 0,
12181       "Indicates the identity of an ESS or IBSS", HFILL }},
12182
12183     {&hf_ieee80211_tag_supp_rates,
12184      {"Supported Rates", "wlan_mgt.supported_rates",
12185       FT_UINT8, BASE_NONE, VALS(ieee80211_supported_rates_vals), 0x0,
12186       "In Mbit/sec, (B) for Basic Rates", HFILL }},
12187
12188     {&hf_ieee80211_tag_fh_dwell_time,
12189      {"Dwell Time", "wlan_mgt.fh.dwell_time",
12190       FT_UINT16, BASE_HEX, NULL, 0x0,
12191       "In Time Unit (TU)", HFILL }},
12192
12193     {&hf_ieee80211_tag_fh_hop_set,
12194      {"Hop Set", "wlan_mgt.fh.hop_set",
12195       FT_UINT8, BASE_DEC, NULL, 0x0,
12196       NULL, HFILL }},
12197
12198     {&hf_ieee80211_tag_fh_hop_pattern,
12199      {"Hop Pattern", "wlan_mgt.fh.hop_pattern",
12200       FT_UINT8, BASE_DEC, NULL, 0x0,
12201       NULL, HFILL }},
12202
12203     {&hf_ieee80211_tag_fh_hop_index,
12204      {"Hop Index", "wlan_mgt.fh.hop_index",
12205       FT_UINT8, BASE_DEC, NULL, 0x0,
12206       NULL, HFILL }},
12207
12208     {&hf_ieee80211_ff_block_ack_params,
12209       {"Block Ack Parameters", "wlan_mgt.fixed.baparams",
12210       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12211
12212     {&hf_ieee80211_ff_block_ack_params_amsdu_permitted,
12213       {"A-MSDUs", "wlan_mgt.fixed.baparams.amsdu",
12214       FT_BOOLEAN, 16, TFS (&ff_block_ack_params_amsdu_permitted_flag), 0x0001, "A-MSDU Permitted in QoS Data MPDUs", HFILL }},
12215
12216     {&hf_ieee80211_ff_block_ack_params_policy,
12217       {"Block Ack Policy", "wlan_mgt.fixed.baparams.policy",
12218       FT_BOOLEAN, 16, TFS (&ff_block_ack_params_policy_flag), 0x0002, NULL, HFILL }},
12219
12220     {&hf_ieee80211_ff_block_ack_params_tid,
12221       {"Traffic Identifier", "wlan_mgt.fixed.baparams.tid",
12222       FT_UINT16, BASE_HEX, NULL, 0x003C, NULL, HFILL }},
12223
12224     {&hf_ieee80211_ff_block_ack_params_buffer_size,
12225       {"Number of Buffers (1 Buffer = 2304 Bytes)", "wlan_mgt.fixed.baparams.buffersize",
12226       FT_UINT16, BASE_DEC, NULL, 0xFFC0, "Number of Buffers", HFILL }},
12227
12228     {&hf_ieee80211_ff_block_ack_timeout,
12229       {"Block Ack Timeout", "wlan_mgt.fixed.batimeout",
12230       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12231
12232     {&hf_ieee80211_ff_block_ack_ssc,
12233      {"Block Ack Starting Sequence Control (SSC)", "wlan_mgt.fixed.ssc",
12234       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
12235
12236     {&hf_ieee80211_ff_block_ack_ssc_fragment,
12237      {"Fragment", "wlan_mgt.fixed.fragment",
12238       FT_UINT16, BASE_DEC, 0, 0x000f, NULL, HFILL }},
12239
12240     {&hf_ieee80211_ff_block_ack_ssc_sequence,
12241      {"Starting Sequence Number", "wlan_mgt.fixed.sequence",
12242       FT_UINT16, BASE_DEC, 0, 0xfff0, NULL, HFILL }},
12243
12244     {&hf_ieee80211_ff_delba_param,
12245      {"Delete Block Ack (DELBA) Parameter Set", "wlan_mgt.fixed.delba.param",
12246       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
12247
12248     {&hf_ieee80211_ff_delba_param_reserved,
12249      {"Reserved", "wlan_mgt.fixed.delba.param.reserved",
12250       FT_UINT16, BASE_HEX, 0, 0x07ff, NULL, HFILL }},
12251
12252     {&hf_ieee80211_ff_delba_param_init,
12253      {"Initiator", "wlan_mgt.fixed.delba.param.initiator",
12254       FT_BOOLEAN, 16, 0, 0x0800, NULL, HFILL }},
12255
12256     {&hf_ieee80211_ff_delba_param_tid,
12257      {"TID", "wlan_mgt.fixed.delba.param.tid",
12258       FT_UINT16, BASE_HEX, 0, 0xf000, "Traffic Identifier (TID)", HFILL }},
12259
12260     {&hf_ieee80211_ff_max_reg_pwr,
12261      {"Maximum Regulation Power", "wlan_mgt.fixed.maxregpwr",
12262       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
12263
12264     {&hf_ieee80211_ff_measurement_pilot_int,
12265      {"Measurement Pilot Interval", "wlan_mgt.fixed.msmtpilotint",
12266       FT_UINT16, BASE_HEX, 0, 0, "Measurement Pilot Interval Fixed Field", HFILL }},
12267
12268     {&hf_ieee80211_ff_country_str,
12269      {"Country String", "wlan_mgt.fixed.country",
12270       FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
12271
12272     {&hf_ieee80211_ff_max_tx_pwr,
12273      {"Maximum Transmit Power", "wlan_mgt.fixed.maxtxpwr",
12274       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
12275
12276     {&hf_ieee80211_ff_tx_pwr_used,
12277      {"Transmit Power Used", "wlan_mgt.fixed.txpwr",
12278       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
12279
12280     {&hf_ieee80211_ff_transceiver_noise_floor,
12281      {"Transceiver Noise Floor", "wlan_mgt.fixed.tnoisefloor",
12282       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
12283
12284     {&hf_ieee80211_ff_channel_width,
12285      {"Supported Channel Width", "wlan_mgt.fixed.chanwidth",
12286       FT_UINT8, BASE_HEX, VALS (ff_channel_width_vals), 0, NULL, HFILL }},
12287
12288     {&hf_ieee80211_ff_qos_info_ap,
12289      {"QoS Information (AP)", "wlan_mgt.fixed.qosinfo.ap",
12290       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
12291
12292     {&hf_ieee80211_ff_qos_info_ap_edca_param_set_counter,
12293      {"EDCA Parameter Set Update Count", "wlan_mgt.fixed.qosinfo.ap.edcaupdate",
12294       FT_UINT8, BASE_HEX, NULL, 0x0F, "Enhanced Distributed Channel Access (EDCA) Parameter Set Update Count", HFILL }},
12295
12296     {&hf_ieee80211_ff_qos_info_ap_q_ack,
12297      {"Q-Ack", "wlan_mgt.fixed.qosinfo.ap.qack",
12298       FT_BOOLEAN, 8, TFS (&ff_qos_info_ap_q_ack_flag), 0x10, "QoS Ack", HFILL }},
12299
12300     {&hf_ieee80211_ff_qos_info_ap_queue_req,
12301      {"Queue Request", "wlan_mgt.fixed.qosinfo.ap",
12302       FT_BOOLEAN, 8, TFS (&ff_qos_info_ap_queue_req_flag), 0x20, NULL, HFILL }},
12303
12304     {&hf_ieee80211_ff_qos_info_ap_txop_request,
12305      {"TXOP Request", "wlan_mgt.fixed.qosinfo.ap.txopreq",
12306       FT_BOOLEAN, 8, TFS (&ff_qos_info_ap_txop_request_flag), 0x40, "Transmit Opportunity (TXOP) Request", HFILL }},
12307
12308     {&hf_ieee80211_ff_qos_info_ap_reserved,
12309      {"Reserved", "wlan_mgt.fixed.qosinfo.ap.reserved",
12310       FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
12311
12312     {&hf_ieee80211_ff_qos_info_sta,
12313      {"QoS Information (STA)", "wlan_mgt.fixed.qosinfo.sta",
12314       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
12315
12316     {&hf_ieee80211_ff_qos_info_sta_ac_vo,
12317      {"AC_VO", "wlan_mgt.fixed.qosinfo.sta.ac.vo",
12318       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x01, NULL, HFILL }},
12319
12320     {&hf_ieee80211_ff_qos_info_sta_ac_vi,
12321      {"AC_VI", "wlan_mgt.fixed.qosinfo.sta.ac.vi",
12322       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x02, NULL, HFILL }},
12323
12324     {&hf_ieee80211_ff_qos_info_sta_ac_bk,
12325      {"AC_BK", "wlan_mgt.fixed.qosinfo.sta.ac.bk",
12326       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x04, NULL, HFILL }},
12327
12328     {&hf_ieee80211_ff_qos_info_sta_ac_be,
12329      {"AC_BE", "wlan_mgt.fixed.qosinfo.sta.ac.be",
12330       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x08, NULL, HFILL }},
12331
12332     {&hf_ieee80211_ff_qos_info_sta_q_ack,
12333      {"Q-Ack", "wlan_mgt.fixed.qosinfo.sta.qack",
12334       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_q_ack_flag), 0x10, "QoS Ack", HFILL }},
12335
12336     {&hf_ieee80211_ff_qos_info_sta_max_sp_len,
12337      {"Service Period (SP) Length", "wlan_mgt.fixed.qosinfo.sta.splen",
12338       FT_UINT8, BASE_HEX, VALS (&ff_qos_info_sta_max_sp_len_flags) , 0x60, NULL, HFILL }},
12339
12340     {&hf_ieee80211_ff_qos_info_sta_more_data_ack,
12341      {"More Data Ack", "wlan_mgt.fixed.qosinfo.sta.moredataack",
12342       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_more_data_ack_flag), 0x80, NULL, HFILL }},
12343
12344     {&hf_ieee80211_ff_sm_pwr_save,
12345      {"Spatial Multiplexing (SM) Power Control", "wlan_mgt.fixed.sm.powercontrol",
12346       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
12347
12348     {&hf_ieee80211_ff_sm_pwr_save_enabled,
12349      {"SM Power Save", "wlan_mgt.fixed.sm.powercontrol.enabled",
12350       FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x01, "Spatial Multiplexing (SM) Power Save", HFILL }},
12351
12352     {&hf_ieee80211_ff_sm_pwr_save_sm_mode,
12353      {"SM Mode", "wlan_mgt.fixed.sm.powercontrol.mode",
12354       FT_BOOLEAN, 8, TFS (&ff_sm_pwr_save_sm_mode_flag), 0x02, "Spatial Multiplexing (SM) Mode", HFILL }},
12355
12356     {&hf_ieee80211_ff_sm_pwr_save_reserved,
12357      {"Reserved", "wlan_mgt.fixed.sm.powercontrol.reserved",
12358       FT_UINT8, BASE_HEX, NULL, 0xFC, NULL, HFILL }},
12359
12360     {&hf_ieee80211_ff_pco_phase_cntrl,
12361      {"Phased Coexistence Operation (PCO) Phase Control", "wlan_mgt.fixed.pco.phasecntrl",
12362       FT_BOOLEAN, BASE_NONE, TFS (&ff_pco_phase_cntrl_flag), 0x0, NULL, HFILL }},
12363
12364     {&hf_ieee80211_ff_psmp_param_set,
12365      {"Power Save Multi-Poll (PSMP) Parameter Set", "wlan_mgt.fixed.psmp.paramset",
12366       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
12367
12368     {&hf_ieee80211_ff_psmp_param_set_n_sta,
12369      {"Number of STA Info Fields Present", "wlan_mgt.fixed.psmp.paramset.nsta",
12370       FT_UINT16, BASE_HEX, 0, 0x000F, NULL, HFILL }},
12371
12372     {&hf_ieee80211_ff_psmp_param_set_more_psmp,
12373      {"More PSMP", "wlan_mgt.fixed.psmp.paramset.more",
12374       FT_BOOLEAN, 16, TFS(&ff_psmp_param_set_more_psmp_flag), 0x0010, "More Power Save Multi-Poll (PSMP)", HFILL }},
12375
12376     {&hf_ieee80211_ff_psmp_param_set_psmp_sequence_duration,
12377      {"PSMP Sequence Duration [us]", "wlan_mgt.fixed.psmp.paramset.seqduration",
12378       FT_UINT16, BASE_DEC, 0, 0xFFE0, "Power Save Multi-Poll (PSMP) Sequence Duration", HFILL }},
12379
12380     {&hf_ieee80211_ff_mimo_cntrl,
12381      {"MIMO Control", "wlan_mgt.fixed.mimo.control.",
12382       FT_BYTES, BASE_NONE, 0, 0x0, NULL, HFILL }},
12383
12384     {&hf_ieee80211_ff_mimo_cntrl_nc_index,
12385      {"Nc Index", "wlan_mgt.fixed.mimo.control.ncindex",
12386       FT_UINT16, BASE_HEX, VALS(&ff_mimo_cntrl_nc_index_flags), 0x0003, "Number of Columns Less One", HFILL }},
12387
12388     {&hf_ieee80211_ff_mimo_cntrl_nr_index,
12389      {"Nr Index", "wlan_mgt.fixed.mimo.control.nrindex",
12390       FT_UINT16, BASE_HEX, VALS(&ff_mimo_cntrl_nr_index_flags), 0x000C, "Number of Rows Less One", HFILL }},
12391
12392     {&hf_ieee80211_ff_mimo_cntrl_channel_width,
12393      {"Channel Width", "wlan_mgt.fixed.mimo.control.chanwidth",
12394       FT_BOOLEAN, 16, TFS(&ff_mimo_cntrl_channel_width_flag), 0x0010, NULL, HFILL }},
12395
12396     {&hf_ieee80211_ff_mimo_cntrl_grouping,
12397      {"Grouping (Ng)", "wlan_mgt.fixed.mimo.control.grouping",
12398       FT_UINT16, BASE_HEX, VALS(&ff_mimo_cntrl_grouping_flags), 0x0060, NULL, HFILL }},
12399
12400     {&hf_ieee80211_ff_mimo_cntrl_coefficient_size,
12401      {"Coefficient Size (Nb)", "wlan_mgt.fixed.mimo.control.cosize",
12402       FT_UINT16, BASE_HEX, VALS(&ff_mimo_cntrl_coefficient_size_flags), 0x0180, NULL, HFILL }},
12403
12404     {&hf_ieee80211_ff_mimo_cntrl_codebook_info,
12405      {"Codebook Information", "wlan_mgt.fixed.mimo.control.codebookinfo",
12406       FT_UINT16, BASE_HEX, VALS(&ff_mimo_cntrl_codebook_info_flags), 0x0600, NULL, HFILL }},
12407
12408     {&hf_ieee80211_ff_mimo_cntrl_remaining_matrix_segment,
12409      {"Remaining Matrix Segment", "wlan_mgt.fixed.mimo.control.matrixseg",
12410       FT_UINT16, BASE_HEX, 0, 0x3800, NULL, HFILL }},
12411
12412     {&hf_ieee80211_ff_mimo_cntrl_reserved,
12413      {"Reserved", "wlan_mgt.fixed.mimo.control.reserved",
12414       FT_UINT16, BASE_HEX, 0, 0xC000, NULL, HFILL }},
12415
12416     {&hf_ieee80211_ff_mimo_cntrl_sounding_timestamp,
12417      {"Sounding Timestamp", "wlan_mgt.fixed.mimo.control.soundingtime",
12418       FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
12419
12420     {&hf_ieee80211_ff_psmp_sta_info,
12421      {"Power Save Multi-Poll (PSMP) Station Information", "wlan_mgt.fixed.psmp.stainfo",
12422       FT_UINT64, BASE_HEX, 0, 0, NULL, HFILL }},
12423
12424     {&hf_ieee80211_ff_psmp_sta_info_type,
12425      {"Sta Info Type", "wlan_mgt.fixed.psmp.stainfo.type",
12426       FT_UINT32, BASE_HEX, VALS(&ff_psmp_sta_info_flags), PSMP_STA_INFO_FLAG_TYPE, NULL, HFILL }},
12427
12428     {&hf_ieee80211_ff_psmp_sta_info_dtt_start_offset,
12429      {"DTT Start Offset", "wlan_mgt.fixed.psmp.stainfo.dttstart",
12430       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_DTT_START, NULL, HFILL }},
12431
12432     {&hf_ieee80211_ff_psmp_sta_info_dtt_duration,
12433      {"DTT Duration", "wlan_mgt.fixed.psmp.stainfo.dttduration",
12434       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_DTT_DURATION, NULL, HFILL }},
12435
12436     {&hf_ieee80211_ff_psmp_sta_info_sta_id,
12437      {"Target Station ID", "wlan_mgt.fixed.psmp.stainfo.staid",
12438       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_STA_ID, NULL, HFILL }},
12439
12440     {&hf_ieee80211_ff_psmp_sta_info_utt_start_offset,
12441      {"UTT Start Offset", "wlan_mgt.fixed.psmp.stainfo.uttstart",
12442       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_UTT_START, NULL, HFILL }},
12443
12444     {&hf_ieee80211_ff_psmp_sta_info_utt_duration,
12445      {"UTT Duration", "wlan_mgt.fixed.psmp.stainfo.uttduration",
12446       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_UTT_DURATION, NULL, HFILL }},
12447
12448     {&hf_ieee80211_ff_psmp_sta_info_reserved_small,
12449      {"Reserved", "wlan_mgt.fixed.psmp.stainfo.reserved",
12450       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_IA_RESERVED, NULL, HFILL }},
12451
12452     {&hf_ieee80211_ff_psmp_sta_info_reserved_large,
12453      {"Reserved", "wlan_mgt.fixed.psmp.stainfo.reserved",
12454       FT_UINT64, BASE_HEX, 0, 0, NULL, HFILL }},
12455
12456     {&hf_ieee80211_ff_psmp_sta_info_psmp_multicast_id,
12457      {"Power Save Multi-Poll (PSMP) Multicast ID", "wlan_mgt.fixed.psmp.stainfo.multicastid",
12458       FT_UINT64, BASE_HEX, 0, 0, NULL, HFILL }},
12459
12460     {&hf_ieee80211_ff_ant_selection,
12461      {"Antenna Selection", "wlan_mgt.fixed.antsel",
12462       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
12463
12464     {&hf_ieee80211_ff_ant_selection_0,
12465      {"Antenna 0", "wlan_mgt.fixed.antsel.ant0",
12466       FT_UINT8, BASE_HEX, 0, 0x01, NULL, HFILL }},
12467
12468     {&hf_ieee80211_ff_ant_selection_1,
12469      {"Antenna 1", "wlan_mgt.fixed.antsel.ant1",
12470       FT_UINT8, BASE_HEX, 0, 0x02, NULL, HFILL }},
12471
12472     {&hf_ieee80211_ff_ant_selection_2,
12473      {"Antenna 2", "wlan_mgt.fixed.antsel.ant2",
12474       FT_UINT8, BASE_HEX, 0, 0x04, NULL, HFILL }},
12475
12476     {&hf_ieee80211_ff_ant_selection_3,
12477      {"Antenna 3", "wlan_mgt.fixed.antsel.ant3",
12478       FT_UINT8, BASE_HEX, 0, 0x08, NULL, HFILL }},
12479
12480     {&hf_ieee80211_ff_ant_selection_4,
12481      {"Antenna 4", "wlan_mgt.fixed.antsel.ant4",
12482       FT_UINT8, BASE_HEX, 0, 0x10, NULL, HFILL }},
12483
12484     {&hf_ieee80211_ff_ant_selection_5,
12485      {"Antenna 5", "wlan_mgt.fixed.antsel.ant5",
12486       FT_UINT8, BASE_HEX, 0, 0x20, NULL, HFILL }},
12487
12488     {&hf_ieee80211_ff_ant_selection_6,
12489      {"Antenna 6", "wlan_mgt.fixed.antsel.ant6",
12490       FT_UINT8, BASE_HEX, 0, 0x40, NULL, HFILL }},
12491
12492     {&hf_ieee80211_ff_ant_selection_7,
12493      {"Antenna 7", "wlan_mgt.fixed.antsel.ant7",
12494       FT_UINT8, BASE_HEX, 0, 0x80, NULL, HFILL }},
12495
12496     {&hf_ieee80211_ff_ext_channel_switch_announcement,
12497      {"Extended Channel Switch Announcement", "wlan_mgt.fixed.extchansw",
12498       FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
12499
12500     {&hf_ieee80211_ff_ext_channel_switch_announcement_switch_mode,
12501      {"Channel Switch Mode", "wlan_mgt.fixed.extchansw.switchmode",
12502       FT_UINT32, BASE_HEX, VALS(&ieee80211_tag_ext_channel_switch_announcement_switch_mode_flags), 0x000000FF, NULL, HFILL }},
12503
12504     {&hf_ieee80211_ff_ext_channel_switch_announcement_new_reg_class,
12505      {"New Regulatory Class", "wlan_mgt.fixed.extchansw.new.regclass",
12506       FT_UINT32, BASE_HEX, NULL, 0x0000FF00, NULL, HFILL }},
12507
12508     {&hf_ieee80211_ff_ext_channel_switch_announcement_new_chan_number,
12509      {"New Channel Number", "wlan_mgt.fixed.extchansw.new.channumber",
12510       FT_UINT32, BASE_HEX, NULL, 0x00FF0000, NULL, HFILL }},
12511
12512     {&hf_ieee80211_ff_ext_channel_switch_announcement_switch_count,
12513      {"Channel Switch Count", "wlan_mgt.extchanswitch.switchcount",
12514       FT_UINT32, BASE_HEX, NULL, 0xFF000000, NULL, HFILL }},
12515
12516     {&hf_ieee80211_ff_ht_info,
12517      {"HT Information", "wlan_mgt.fixed.extchansw",
12518       FT_UINT8, BASE_HEX, 0, 0, "HT Information Fixed Field", HFILL }},
12519
12520     {&hf_ieee80211_ff_ht_info_information_request,
12521      {"Information Request", "wlan_mgt.fixed.mimo.control.chanwidth",
12522       FT_BOOLEAN, 8, TFS(&ff_ht_info_information_request_flag), 0x01, NULL, HFILL }},
12523
12524     {&hf_ieee80211_ff_ht_info_40_mhz_intolerant,
12525      {"40 MHz Intolerant", "wlan_mgt.fixed.mimo.control.chanwidth",
12526       FT_BOOLEAN, 8, TFS(&ff_ht_info_40_mhz_intolerant_flag), 0x02, NULL, HFILL }},
12527
12528     {&hf_ieee80211_ff_ht_info_sta_chan_width,
12529      {"Station Channel Width", "wlan_mgt.fixed.mimo.control.chanwidth",
12530       FT_BOOLEAN, 8, TFS(&ff_ht_info_sta_chan_width_flag), 0x04, NULL, HFILL }},
12531
12532     {&hf_ieee80211_ff_ht_info_reserved,
12533      {"Reserved", "wlan_mgt.fixed.extchansw",
12534       FT_UINT8, BASE_HEX, 0, 0xF8, "Reserved Field", HFILL }},
12535
12536     {&hf_ieee80211_ff_ht_action,
12537      {"HT Action", "wlan_mgt.fixed.htact",
12538       FT_UINT8, BASE_HEX, VALS (&ff_ht_action_flags), 0, "HT Action Code", HFILL }},
12539
12540     {&hf_ieee80211_ff_mimo_csi_snr,
12541      {"Signal to Noise Ratio (SNR)", "wlan_mgt.mimo.csimatrices.snr",
12542       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
12543
12544     {&hf_ieee80211_ff_public_action,
12545      {"Public Action", "wlan_mgt.fixed.publicact",
12546       FT_UINT8, BASE_HEX, VALS(ff_pa_action_codes), 0, "Public Action Code", HFILL }},
12547
12548     {&hf_ieee80211_ff_capture,
12549      {"Capabilities Information", "wlan_mgt.fixed.capabilities", FT_UINT16, BASE_HEX, NULL, 0,
12550       "Capability information", HFILL }},
12551
12552     {&hf_ieee80211_ff_cf_ess,
12553      {"ESS capabilities", "wlan_mgt.fixed.capabilities.ess",
12554       FT_BOOLEAN, 16, TFS (&cf_ess_flags), 0x0001, NULL, HFILL }},
12555
12556     {&hf_ieee80211_ff_cf_ibss,
12557      {"IBSS status", "wlan_mgt.fixed.capabilities.ibss",
12558       FT_BOOLEAN, 16, TFS (&cf_ibss_flags), 0x0002, "IBSS participation", HFILL }},
12559
12560     {&hf_ieee80211_ff_cf_sta_poll,
12561      {"CFP participation capabilities", "wlan_mgt.fixed.capabilities.cfpoll.sta",
12562       FT_UINT16, BASE_HEX, VALS (&sta_cf_pollable), 0x020C,
12563       "CF-Poll capabilities for a STA", HFILL }},
12564
12565     {&hf_ieee80211_ff_cf_ap_poll,
12566      {"CFP participation capabilities", "wlan_mgt.fixed.capabilities.cfpoll.ap",
12567       FT_UINT16, BASE_HEX, VALS (&ap_cf_pollable), 0x020C,
12568       "CF-Poll capabilities for an AP", HFILL }},
12569
12570     {&hf_ieee80211_ff_cf_privacy,
12571      {"Privacy", "wlan_mgt.fixed.capabilities.privacy",
12572       FT_BOOLEAN, 16, TFS (&cf_privacy_flags), 0x0010, "WEP support", HFILL }},
12573
12574     {&hf_ieee80211_ff_cf_preamble,
12575      {"Short Preamble", "wlan_mgt.fixed.capabilities.preamble",
12576       FT_BOOLEAN, 16, TFS (&cf_preamble_flags), 0x0020, NULL, HFILL }},
12577
12578     {&hf_ieee80211_ff_cf_pbcc,
12579      {"PBCC", "wlan_mgt.fixed.capabilities.pbcc",
12580       FT_BOOLEAN, 16, TFS (&cf_pbcc_flags), 0x0040, "PBCC Modulation", HFILL }},
12581
12582     {&hf_ieee80211_ff_cf_agility,
12583      {"Channel Agility", "wlan_mgt.fixed.capabilities.agility",
12584       FT_BOOLEAN, 16, TFS (&cf_agility_flags), 0x0080, NULL, HFILL }},
12585
12586     {&hf_ieee80211_ff_cf_spec_man,
12587      {"Spectrum Management", "wlan_mgt.fixed.capabilities.spec_man",
12588       FT_BOOLEAN, 16, TFS (&cf_spec_man_flags), 0x0100, NULL, HFILL }},
12589
12590     {&hf_ieee80211_ff_short_slot_time,
12591      {"Short Slot Time", "wlan_mgt.fixed.capabilities.short_slot_time",
12592       FT_BOOLEAN, 16, TFS (&short_slot_time_flags), 0x0400, NULL,
12593       HFILL }},
12594
12595     {&hf_ieee80211_ff_cf_apsd,
12596      {"Automatic Power Save Delivery", "wlan_mgt.fixed.capabilities.apsd",
12597       FT_BOOLEAN, 16, TFS (&cf_apsd_flags), 0x0800, NULL, HFILL }},
12598
12599     {&hf_ieee80211_ff_dsss_ofdm,
12600      {"DSSS-OFDM", "wlan_mgt.fixed.capabilities.dsss_ofdm",
12601       FT_BOOLEAN, 16, TFS (&dsss_ofdm_flags), 0x2000, "DSSS-OFDM Modulation",
12602       HFILL }},
12603
12604     {&hf_ieee80211_ff_cf_del_blk_ack,
12605      {"Delayed Block Ack", "wlan_mgt.fixed.capabilities.del_blk_ack",
12606       FT_BOOLEAN, 16, TFS (&cf_del_blk_ack_flags), 0x4000, NULL, HFILL }},
12607
12608     {&hf_ieee80211_ff_cf_imm_blk_ack,
12609      {"Immediate Block Ack", "wlan_mgt.fixed.capabilities.imm_blk_ack",
12610       FT_BOOLEAN, 16, TFS (&cf_imm_blk_ack_flags), 0x8000, NULL, HFILL }},
12611
12612     {&hf_ieee80211_ff_auth_seq,
12613      {"Authentication SEQ", "wlan_mgt.fixed.auth_seq",
12614       FT_UINT16, BASE_HEX, NULL, 0, "Authentication Sequence Number", HFILL }},
12615
12616     {&hf_ieee80211_ff_assoc_id,
12617      {"Association ID", "wlan_mgt.fixed.aid",
12618       FT_UINT16, BASE_HEX, NULL, 0x3FFF, NULL, HFILL }},
12619
12620     {&hf_ieee80211_ff_listen_ival,
12621      {"Listen Interval", "wlan_mgt.fixed.listen_ival",
12622       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12623
12624     {&hf_ieee80211_ff_current_ap,
12625      {"Current AP", "wlan_mgt.fixed.current_ap",
12626       FT_ETHER, BASE_NONE, NULL, 0, "MAC address of current AP", HFILL }},
12627
12628     {&hf_ieee80211_ff_reason,
12629      {"Reason code", "wlan_mgt.fixed.reason_code",
12630       FT_UINT16, BASE_HEX, VALS (&reason_codes), 0,
12631       "Reason for unsolicited notification", HFILL }},
12632
12633     {&hf_ieee80211_ff_status_code,
12634      {"Status code", "wlan_mgt.fixed.status_code",
12635       FT_UINT16, BASE_HEX, VALS (&status_codes), 0,
12636       "Status of requested event", HFILL }},
12637
12638     {&hf_ieee80211_ff_category_code,
12639      {"Category code", "wlan_mgt.fixed.category_code",
12640       FT_UINT16, BASE_DEC, VALS (&category_codes), 0,
12641       "Management action category", HFILL }},
12642
12643     {&hf_ieee80211_ff_action_code,
12644      {"Action code", "wlan_mgt.fixed.action_code",
12645       FT_UINT16, BASE_DEC, VALS (&action_codes), 0,
12646       "Management action code", HFILL }},
12647
12648     {&hf_ieee80211_ff_dialog_token,
12649      {"Dialog token", "wlan_mgt.fixed.dialog_token",
12650       FT_UINT8, BASE_HEX, NULL, 0, "Management action dialog token", HFILL }},
12651
12652     {&hf_ieee80211_ff_marvell_action_type,
12653      {"Marvell Action type", "wlan_mgt.fixed.mrvl_action_type",
12654       FT_UINT8, BASE_DEC, VALS (&vendor_action_types_mrvl), 0,
12655       "Vendor Specific Action Type (Marvell)", HFILL }},
12656
12657     {&hf_ieee80211_ff_marvell_mesh_mgt_action_code,
12658      {"Mesh action(Marvell)", "wlan_mgt.fixed.mrvl_mesh_action",
12659       FT_UINT8, BASE_HEX, VALS (&mesh_mgt_action_codes_mrvl), 0,
12660       "Mesh action code(Marvell)", HFILL }},
12661
12662     {&hf_ieee80211_ff_mesh_mgt_length,
12663      {"Message Length", "wlan_mgt.fixed.length",
12664       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12665
12666     {&hf_ieee80211_ff_mesh_mgt_mode,
12667      {"Message Mode", "wlan_mgt.fixed.mode",
12668       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
12669
12670     {&hf_ieee80211_ff_mesh_mgt_ttl,
12671      {"Message TTL", "wlan_mgt.fixed.ttl",
12672       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12673
12674     {&hf_ieee80211_ff_mesh_mgt_dstcount,
12675      {"Destination Count", "wlan_mgt.fixed.dstcount",
12676       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12677
12678     {&hf_ieee80211_ff_mesh_mgt_hopcount,
12679      {"Hop Count", "wlan_mgt.fixed.hopcount",
12680       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12681
12682     {&hf_ieee80211_ff_mesh_mgt_rreqid,
12683      {"RREQ ID", "wlan_mgt.fixed.rreqid",
12684       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
12685
12686     {&hf_ieee80211_ff_mesh_mgt_sa,
12687      {"Source Address", "wlan_mgt.fixed.sa",
12688       FT_ETHER, BASE_NONE, NULL, 0, "Source MAC address", HFILL }},
12689
12690     {&hf_ieee80211_ff_mesh_mgt_ssn,
12691      {"SSN", "wlan_mgt.fixed.ssn",
12692       FT_UINT32, BASE_DEC, NULL, 0, "Source Sequence Number", HFILL }},
12693
12694     {&hf_ieee80211_ff_mesh_mgt_metric,
12695      {"Metric", "wlan_mgt.fixed.metric",
12696       FT_UINT32, BASE_DEC, NULL, 0, "Route Metric", HFILL }},
12697
12698     {&hf_ieee80211_ff_mesh_mgt_flags,
12699      {"RREQ Flags", "wlan_mgt.fixed.hopcount",
12700       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
12701
12702     {&hf_ieee80211_ff_mesh_mgt_da,
12703      {"Destination Address", "wlan_mgt.fixed.da",
12704       FT_ETHER, BASE_NONE, NULL, 0, "Destination MAC address", HFILL }},
12705
12706     {&hf_ieee80211_ff_mesh_mgt_dsn,
12707      {"DSN", "wlan_mgt.fixed.dsn",
12708       FT_UINT32, BASE_DEC, NULL, 0, "Destination Sequence Number", HFILL }},
12709
12710     {&hf_ieee80211_ff_mesh_mgt_lifetime,
12711      {"Lifetime", "wlan_mgt.fixed.lifetime",
12712       FT_UINT32, BASE_DEC, NULL, 0, "Route Lifetime", HFILL }},
12713
12714     {&hf_ieee80211_ff_wme_action_code,
12715      {"Action code", "wlan_mgt.fixed.action_code",
12716       FT_UINT16, BASE_HEX, VALS (&wme_action_codes), 0,
12717       "Management notification action code", HFILL }},
12718
12719     {&hf_ieee80211_ff_wme_status_code,
12720      {"Status code", "wlan_mgt.fixed.status_code",
12721       FT_UINT16, BASE_HEX, VALS (&wme_status_codes), 0,
12722       "Management notification setup response status code", HFILL }},
12723
12724 #ifdef MESH_OVERRIDES
12725     {&hf_ieee80211_ff_mesh_mgt_action_ps_code,
12726      {"Action code", "wlan_mgt.fixed.action_code",
12727       FT_UINT16, BASE_HEX, VALS (&mesh_mgt_action_ps_codes), 0,
12728       "Mesh Management Path Selection action code", HFILL }},
12729
12730     {&hf_ieee80211_ff_mesh_mgt_action_pl_code,
12731      {"Action code", "wlan_mgt.fixed.action_code",
12732       FT_UINT16, BASE_HEX, VALS (&mesh_mgt_action_pl_codes), 0,
12733       "Mesh Management Peer Link action code", HFILL }},
12734
12735     {&hf_ieee80211_mesh_mgt_pl_local_link_id,
12736      {"Local Link ID", "wlan.pl.local_id",
12737       FT_UINT16, BASE_HEX, NULL, 0,
12738       "Mesh Management Local Link ID", HFILL }},
12739
12740     {&hf_ieee80211_mesh_mgt_pl_subtype,
12741      {"Peer Link Subtype", "wlan.pl.subtype",
12742       FT_UINT16, BASE_HEX, VALS (&mesh_mgt_action_pl_codes), 0,
12743       "Mesh Management Peer Link Subtype", HFILL }},
12744
12745     {&hf_ieee80211_mesh_mgt_pl_reason_code,
12746      {"Reason Code", "wlan.pl.reason_code",
12747       FT_UINT16, BASE_HEX, VALS (&mesh_mgt_pl_reason_codes), 0,
12748       "Mesh Management Reason Code", HFILL }},
12749
12750     {&hf_ieee80211_mesh_mgt_pl_peer_link_id,
12751      {"Peer Link ID", "wlan.pl.peer_id",
12752       FT_UINT16, BASE_HEX, NULL, 0,
12753       "Mesh Management Peer Link ID", HFILL }},
12754
12755     {&hf_ieee80211_mesh_config_version,
12756      {"Version", "wlan.mesh.config.version",
12757       FT_UINT16, BASE_HEX, NULL, 0,
12758       "Mesh Configuration Version", HFILL }},
12759
12760     {&hf_ieee80211_mesh_config_path_sel_protocol,
12761      {"Path Selection Protocol", "wlan.mesh.config.ps_protocol",
12762       FT_UINT16, BASE_HEX, NULL, 0,
12763       "Mesh Configuration Path Selection Protocol", HFILL }},
12764
12765     {&hf_ieee80211_mesh_config_path_sel_metric,
12766      {"Path Selection Metric", "wlan.mesh.config.ps_metric",
12767       FT_UINT16, BASE_HEX, NULL, 0,
12768       "Mesh Configuration Path Selection Metric", HFILL }},
12769
12770     {&hf_ieee80211_mesh_config_congestion_control,
12771      {"Congestion Control", "wlan.mesh.config.cong_ctl",
12772       FT_UINT16, BASE_HEX, NULL, 0,
12773       "Mesh Configuration Congestion Control", HFILL }},
12774
12775     {&hf_ieee80211_mesh_config_channel_prec,
12776      {"Channel Precedence", "wlan.mesh.config.chan_prec",
12777       FT_UINT16, BASE_HEX, NULL, 0,
12778       "Mesh Configuration Channel Precedence", HFILL }},
12779
12780     {&hf_ieee80211_mesh_config_capability,
12781      {"Capability", "wlan.mesh.config.cap",
12782       FT_UINT16, BASE_HEX, NULL, 0,
12783       "Mesh Configuration Capability", HFILL }},
12784
12785     {&hf_ieee80211_mesh_id,
12786      {"Mesh ID", "wlan.mesh.id",
12787       FT_STRING, BASE_NONE, NULL, 0,
12788       NULL, HFILL }},
12789
12790     {&hf_ieee80211_ff_mesh_mgt_dest_flags,
12791      {"Destination Flags", "wlan.preq.dest_flags",
12792       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
12793
12794     {&hf_ieee80211_ff_mesh_mgt_dest_do_flags,
12795      {"Destination Flags", "wlan.preq.dest_flags.do",
12796       FT_BOOLEAN, 8, TFS (&mesh_dest_do_flags), 0x01,
12797       "Dest Flags", HFILL }},
12798
12799     {&hf_ieee80211_ff_mesh_mgt_dest_rf_flags,
12800      {"Destination Flags", "wlan.preq.dest_flags.rf",
12801       FT_BOOLEAN, 8, TFS (&mesh_dest_rf_flags), 0x02,
12802       "Dest Flags", HFILL }},
12803
12804     {&hf_ieee80211_ff_mesh_mgt_srccount,
12805      {"Source Count", "wlan.mesh.srccount",
12806       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12807 #endif /* MESH_OVERRIDES */
12808
12809     {&hf_ieee80211_ff_qos_action_code,
12810      {"Action code", "wlan_mgt.fixed.action_code",
12811       FT_UINT16, BASE_HEX, VALS (&qos_action_codes), 0,
12812       "QoS management action code", HFILL }},
12813
12814     {&hf_ieee80211_ff_ba_action,
12815      {"Action code", "wlan_mgt.fixed.action_code",
12816       FT_UINT8, BASE_HEX, VALS (&ba_action_codes), 0,
12817       "Block Ack action code", HFILL }},
12818
12819     {&hf_ieee80211_ff_dls_action_code,
12820      {"Action code", "wlan_mgt.fixed.action_code",
12821       FT_UINT16, BASE_HEX, VALS (&dls_action_codes), 0,
12822       "DLS management action code", HFILL }},
12823
12824     {&hf_ieee80211_ff_dst_mac_addr,
12825      {"Destination address", "wlan_mgt.fixed.dst_mac_addr",
12826       FT_ETHER, BASE_NONE, NULL, 0, "Destination MAC address", HFILL }},
12827
12828     {&hf_ieee80211_ff_src_mac_addr,
12829      {"Source address", "wlan_mgt.fixed.src_mac_addr",
12830       FT_ETHER, BASE_NONE, NULL, 0, "Source MAC address", HFILL }},
12831
12832     {&hf_ieee80211_ff_ft_action_code,
12833      {"Action code", "wlan_mgt.fixed.action_code",
12834       FT_UINT8, BASE_DEC, VALS(&ft_action_codes), 0,
12835       "Management action code", HFILL }},
12836
12837     {&hf_ieee80211_ff_sta_address,
12838      {"STA Address", "wlan_mgt.fixed.sta_address",
12839       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
12840
12841     {&hf_ieee80211_ff_target_ap_address,
12842      {"Target AP Address", "wlan_mgt.fixed.target_ap_address",
12843       FT_ETHER, BASE_NONE, NULL, 0, "Target AP MAC address", HFILL }},
12844
12845     {&hf_ieee80211_ff_gas_comeback_delay,
12846      {"GAS Comeback Delay", "wlan_mgt.fixed.gas_comeback_delay",
12847       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
12848
12849     {&hf_ieee80211_ff_gas_fragment_id,
12850      {"GAS Query Response Fragment ID", "wlan_mgt.fixed.gas_fragment_id",
12851       FT_UINT8, BASE_DEC, NULL, 0x7f, NULL, HFILL
12852      }},
12853
12854     {&hf_ieee80211_ff_more_gas_fragments,
12855      {"More GAS Fragments", "wlan_mgt.fixed.more_gas_fragments",
12856       FT_UINT8, BASE_DEC, NULL, 0x80, NULL, HFILL }},
12857
12858     {&hf_ieee80211_ff_query_request_length,
12859      {"Query Request Length", "wlan_mgt.fixed.query_request_length",
12860       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
12861
12862     {&hf_ieee80211_ff_query_request,
12863      {"Query Request", "wlan_mgt.fixed.query_request",
12864       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
12865
12866     {&hf_ieee80211_ff_query_response_length,
12867      {"Query Response Length", "wlan_mgt.fixed.query_response_length",
12868       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
12869
12870     {&hf_ieee80211_ff_query_response,
12871      {"Query Response", "wlan_mgt.fixed.query_response",
12872       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
12873
12874     {&hf_ieee80211_ff_anqp_info_id,
12875      {"Info ID", "wlan_mgt.fixed.anqp.info_id",
12876       FT_UINT16, BASE_DEC, VALS(&anqp_info_id_vals), 0,
12877       "Access Network Query Protocol Info ID", HFILL }},
12878
12879     {&hf_ieee80211_ff_anqp_info_length,
12880      {"Length", "wlan_mgt.fixed.anqp.info_length",
12881       FT_UINT16, BASE_DEC, NULL, 0, "Access Network Query Protocol Length",
12882       HFILL }},
12883
12884     {&hf_ieee80211_ff_anqp_info,
12885      {"Information", "wlan_mgt.fixed.anqp.info",
12886       FT_BYTES, BASE_NONE, NULL, 0,
12887       "Access Network Query Protocol Information", HFILL }},
12888
12889     {&hf_ieee80211_ff_dls_timeout,
12890      {"DLS timeout", "wlan_mgt.fixed.dls_timeout",
12891       FT_UINT16, BASE_HEX, NULL, 0, "DLS timeout value", HFILL }},
12892
12893     {&hf_ieee80211_ff_sa_query_action_code,
12894      {"Action code", "wlan_mgt.fixed.action_code",
12895       FT_UINT8, BASE_DEC, VALS(&sa_query_action_codes), 0,
12896       "Management action code", HFILL }},
12897
12898     {&hf_ieee80211_ff_transaction_id,
12899      {"Transaction Id", "wlan_mgt.fixed.transaction_id",
12900       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12901
12902     {&hf_ieee80211_tag,
12903      {"Tag", "wlan_mgt.tag",
12904       FT_NONE, BASE_NONE, 0x0, 0,
12905       NULL, HFILL }},
12906
12907     {&hf_ieee80211_tag_number,
12908      {"Tag Number", "wlan_mgt.tag.number",
12909       FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(tag_num_vals), 0,
12910       "Element ID", HFILL }},
12911
12912     {&hf_ieee80211_tag_length,
12913      {"Tag length", "wlan_mgt.tag.length",
12914       FT_UINT32, BASE_DEC, NULL, 0, "Length of tag", HFILL }},
12915
12916     {&hf_ieee80211_tag_interpretation,
12917      {"Tag interpretation", "wlan_mgt.tag.interpretation",
12918       FT_STRING, BASE_NONE, NULL, 0, "Interpretation of tag", HFILL }},
12919
12920     {&hf_ieee80211_tag_oui,
12921      {"OUI", "wlan_mgt.tag.oui",
12922       FT_BYTES, BASE_NONE, NULL, 0, "OUI of vendor specific IE", HFILL }},
12923
12924     {&hf_ieee80211_tag_ds_param_channel,
12925      {"Current Channel", "wlan_mgt.ds.current_channel",
12926       FT_UINT8, BASE_DEC, NULL, 0,
12927       "DS Parameter Set - Current Channel", HFILL }},
12928
12929     {&hf_ieee80211_tag_cfp_count,
12930      {"CFP Count", "wlan_mgt.cfp.count",
12931       FT_UINT8, BASE_DEC, NULL, 0,
12932       "Indicates how many delivery traffic indication messages (DTIMs)", HFILL }},
12933
12934     {&hf_ieee80211_tag_cfp_period,
12935      {"CFP Period", "wlan_mgt.cfp.period",
12936       FT_UINT8, BASE_DEC, NULL, 0,
12937       "Indicates the number of DTIM intervals between the start of CFPs", HFILL }},
12938
12939     {&hf_ieee80211_tag_cfp_max_duration,
12940      {"CFP Max Duration", "wlan_mgt.cfp.max_duration",
12941       FT_UINT16, BASE_DEC, NULL, 0,
12942       "Indicates the maximum duration (in TU) of the CFP that may be generated by this PCF", HFILL }},
12943
12944     {&hf_ieee80211_tag_cfp_dur_remaining,
12945      {"CFP Dur Remaining", "wlan_mgt.cfp.dur_remaining",
12946       FT_UINT16, BASE_DEC, NULL, 0,
12947       "Indicates the maximum time (in TU) remaining in the present CFP", HFILL }},
12948
12949     {&hf_ieee80211_tag_vendor_oui_type,
12950      {"Vendor Specific OUI Type", "wlan_mgt.tag.oui.type",
12951       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12952
12953     {&hf_ieee80211_tim_dtim_count,
12954      {"DTIM count", "wlan_mgt.tim.dtim_count",
12955       FT_UINT8, BASE_DEC, NULL, 0,
12956       "Indicates how many Beacon frames (including the current frame) appear before the next DTIM", HFILL }},
12957
12958     {&hf_ieee80211_tim_dtim_period,
12959      {"DTIM period", "wlan_mgt.tim.dtim_period",
12960       FT_UINT8, BASE_DEC, NULL, 0,
12961       "Indicates the number of beacon intervals between successive DTIMs", HFILL }},
12962
12963     {&hf_ieee80211_tim_bmapctl,
12964      {"Bitmap control", "wlan_mgt.tim.bmapctl",
12965       FT_UINT8, BASE_HEX, NULL, 0,
12966       NULL, HFILL }},
12967
12968     {&hf_ieee80211_tim_bmapctl_mcast,
12969      {"Multicast", "wlan_mgt.tim.bmapctl.multicast",
12970       FT_BOOLEAN, 8, NULL, 0x1,
12971       "Contains the Traffic Indicator bit associated with Association ID 0", HFILL }},
12972
12973     {&hf_ieee80211_tim_bmapctl_offset,
12974      {"Bitmap Offset", "wlan_mgt.tim.bmapctl.offset",
12975       FT_UINT8, BASE_HEX, NULL, 0xFE,
12976       NULL, HFILL }},
12977
12978     {&hf_ieee80211_tim_partial_virtual_bitmap,
12979      {"Partial Virtual Bitmap", "wlan_mgt.tim.partial_virtual_bitmap",
12980       FT_BYTES, BASE_NONE, NULL, 0x0,
12981       NULL, HFILL }},
12982
12983     {&hf_ieee80211_tag_ibss_atim_window,
12984      {"Atim Windows", "wlan_mgt.ibss.atim_windows",
12985       FT_UINT16, BASE_HEX, NULL, 0x0,
12986       "Contains the ATIM Window length in TU", HFILL }},
12987
12988     {&hf_ieee80211_tag_country_info_code,
12989      {"Code", "wlan_mgt.country_info.code",
12990       FT_STRING, BASE_NONE, NULL, 0x0,
12991       NULL, HFILL }},
12992
12993     {&hf_ieee80211_tag_country_info_env,
12994      {"Environment", "wlan_mgt.country_info.environment",
12995       FT_UINT8, BASE_HEX, VALS(environment_vals), 0x0,
12996       NULL, HFILL }},
12997
12998     {&hf_ieee80211_tag_country_info_fnm,
12999      {"Country Info", "wlan_mgt.country_info.fnm",
13000       FT_NONE, BASE_NONE, NULL, 0x0,
13001       NULL, HFILL }},
13002
13003     {&hf_ieee80211_tag_country_info_fnm_fcn,
13004      {"First Channel Number", "wlan_mgt.country_info.fnm.fcn",
13005       FT_UINT8, BASE_DEC, NULL, 0x0,
13006       NULL, HFILL }},
13007
13008     {&hf_ieee80211_tag_country_info_fnm_nc,
13009      {"Number of Channels", "wlan_mgt.country_info.fnm.nc",
13010       FT_UINT8, BASE_DEC, NULL, 0x0,
13011       NULL, HFILL }},
13012
13013     {&hf_ieee80211_tag_country_info_fnm_mtpl,
13014      {"Maximum Transmit Power Level (in dBm)", "wlan_mgt.country_info.fnm.mtpl",
13015       FT_UINT8, BASE_DEC, NULL, 0x0,
13016       NULL, HFILL }},
13017
13018     {&hf_ieee80211_tag_country_info_rrc,
13019      {"Country Info", "wlan_mgt.country_info.rrc",
13020       FT_NONE, BASE_NONE, NULL, 0x0,
13021       NULL, HFILL }},
13022
13023     {&hf_ieee80211_tag_country_info_rrc_rei,
13024      {"Regulatory Extension Identifier", "wlan_mgt.country_info.rrc.rei",
13025       FT_UINT8, BASE_DEC, NULL, 0x0,
13026       NULL, HFILL }},
13027
13028     {&hf_ieee80211_tag_country_info_rrc_rc,
13029      {"Regulatory Class", "wlan_mgt.country_info.rrc.rc",
13030       FT_UINT8, BASE_DEC, NULL, 0x0,
13031       NULL, HFILL }},
13032
13033     {&hf_ieee80211_tag_country_info_rrc_cc,
13034      {"Coverage Class", "wlan_mgt.country_info.rrc.cc",
13035       FT_UINT8, BASE_DEC, NULL, 0x0,
13036       NULL, HFILL }},
13037
13038     {&hf_ieee80211_tag_fh_hopping_parameter_prime_radix,
13039      {"Prime Radix", "wlan_mgt.fh_hopping.parameter.prime_radix",
13040       FT_UINT8, BASE_DEC, NULL, 0x0,
13041       NULL, HFILL }},
13042
13043     {&hf_ieee80211_tag_fh_hopping_parameter_nb_channels,
13044      {"Number of Channels", "wlan_mgt.fh_hopping.parameter.nb_channels",
13045       FT_UINT8, BASE_DEC, NULL, 0x0,
13046       NULL, HFILL }},
13047
13048     {&hf_ieee80211_tag_fh_hopping_table_flag,
13049      {"Flag", "wlan_mgt.fh_hopping.table.flag",
13050       FT_UINT8, BASE_HEX, NULL, 0x0,
13051       "Indicates that a Random Table is present when the value is 1", HFILL }},
13052
13053     {&hf_ieee80211_tag_fh_hopping_table_number_of_sets,
13054      {"Number of Sets", "wlan_mgt.fh_hopping.table.number_of_sets",
13055       FT_UINT8, BASE_DEC, NULL, 0x0,
13056       "Indicates the total number of sets within the hopping patterns", HFILL }},
13057
13058     {&hf_ieee80211_tag_fh_hopping_table_modulus,
13059      {"Modulus", "wlan_mgt.fh_hopping.table.modulus",
13060       FT_UINT8, BASE_HEX, NULL, 0x0,
13061       "Indicate the values to be used in the equations to create a hopping sequence from the Random Table information", HFILL }},
13062
13063     {&hf_ieee80211_tag_fh_hopping_table_offset,
13064      {"Offset", "wlan_mgt.fh_hopping.table.offset",
13065       FT_UINT8, BASE_HEX, NULL, 0x0,
13066       "Indicate the values to be used in the equations to create a hopping sequence from the Random Table information", HFILL }},
13067
13068     {&hf_ieee80211_tag_fh_hopping_random_table,
13069      {"Random Table", "wlan_mgt.fh_hopping.table.random_table",
13070       FT_UINT16, BASE_HEX, NULL, 0x0,
13071       "It is a vector of single octet values that indicate the random sequence to be followed during a hopping sequence", HFILL }},
13072
13073     {&hf_ieee80211_tag_request,
13074      {"Requested Element ID", "wlan_mgt.tag.request",
13075       FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(tag_num_vals), 0,
13076       "The list of elements that are to be included in the responding STA Probe Response frame", HFILL }},
13077
13078     {&hf_ieee80211_tclas_up,
13079      {"User Priority", "wlan_mgt.tclas.user_priority",
13080       FT_UINT8, BASE_DEC, NULL, 0,
13081       "Contains the value of the UP of the associated MSDUs", HFILL }},
13082
13083     {&hf_ieee80211_tclas_class_type,
13084      {"Classifier Type", "wlan_mgt.tclas.class_type",
13085       FT_UINT8, BASE_DEC, VALS (classifier_type), 0,
13086       "Specifies the type of classifier parameters", HFILL }},
13087
13088     {&hf_ieee80211_tclas_class_mask,
13089      {"Classifier Mask", "wlan_mgt.tclas.class_mask",
13090       FT_UINT8, BASE_HEX,  NULL, 0,
13091       "Specifies a bitmap where bits that are set to 1 identify a subset of the classifier parameters", HFILL }},
13092
13093     {&hf_ieee80211_tclas_src_mac_addr,
13094      {"Source address", "wlan_mgt.tclas.type",
13095       FT_ETHER, BASE_NONE, NULL, 0,
13096       "Classifier Parameters Ethernet Type", HFILL }},
13097
13098     {&hf_ieee80211_tclas_dst_mac_addr,
13099      {"Destination address", "wlan_mgt.tclas.type",
13100       FT_ETHER, BASE_NONE, NULL, 0,
13101       NULL, HFILL }},
13102
13103     {&hf_ieee80211_tclas_ether_type,
13104      {"Ethernet Type", "wlan_mgt.tclas.type",
13105       FT_UINT8, BASE_DEC, NULL, 0,
13106       NULL, HFILL }},
13107
13108     {&hf_ieee80211_tclas_version,
13109      {"IP Version", "wlan_mgt.tclas.version",
13110       FT_UINT8, BASE_DEC, NULL, 0,
13111       NULL, HFILL }},
13112
13113     {&hf_ieee80211_tclas_ipv4_src,
13114      {"IPv4 Src Addr", "wlan_mgt.tclas.ipv4_src",
13115       FT_IPv4, BASE_NONE, NULL, 0,
13116       NULL, HFILL }},
13117
13118     {&hf_ieee80211_tclas_ipv4_dst,
13119      {"IPv4 Dst Addr", "wlan_mgt.tclas.ipv4_dst",
13120       FT_IPv4, BASE_NONE, NULL, 0,
13121       NULL, HFILL }},
13122
13123     {&hf_ieee80211_tclas_src_port,
13124      {"Source Port", "wlan_mgt.tclas.src_port",
13125       FT_UINT16, BASE_DEC, NULL, 0,
13126       NULL, HFILL }},
13127
13128     {&hf_ieee80211_tclas_dst_port,
13129      {"Destination Port", "wlan_mgt.tclas.dst_port",
13130       FT_UINT16, BASE_DEC, NULL, 0,
13131       NULL, HFILL }},
13132
13133     {&hf_ieee80211_tclas_dscp,
13134      {"IPv4 DSCP", "wlan_mgt.tclas.dscp",
13135       FT_UINT8, BASE_HEX, NULL, 0,
13136     "IPv4 Differentiated Services Code Point (DSCP) Field", HFILL }},
13137
13138     {&hf_ieee80211_tclas_protocol,
13139      {"Protocol", "wlan_mgt.tclas.protocol",
13140       FT_UINT8, BASE_HEX, NULL, 0, "IPv4 Protocol", HFILL }},
13141
13142     {&hf_ieee80211_tclas_ipv6_src,
13143      {"IPv6 Src Addr", "wlan_mgt.tclas.ipv6_src",
13144       FT_IPv6, BASE_NONE,
13145       NULL, 0, NULL, HFILL }},
13146
13147     {&hf_ieee80211_tclas_ipv6_dst,
13148      {"IPv6 Dst Addr", "wlan_mgt.tclas.ipv6_dst",
13149       FT_IPv6, BASE_NONE, NULL, 0,
13150       NULL, HFILL }},
13151
13152     {&hf_ieee80211_tclas_flow,
13153      {"Flow Label", "wlan_mgt.tclas.flow",
13154       FT_UINT24, BASE_HEX, NULL, 0,
13155       "IPv6 Flow Label", HFILL }},
13156
13157     {&hf_ieee80211_tclas_tag_type,
13158      {"802.1Q Tag Type", "wlan_mgt.tclas.tag_type",
13159       FT_UINT16, BASE_HEX, NULL, 0,
13160       NULL, HFILL }},
13161
13162     {&hf_ieee80211_tag_challenge_text,
13163      {"Challenge Text", "wlan_mgt.tag.challenge_text",
13164       FT_BYTES, BASE_NONE, NULL, 0,
13165       NULL, HFILL }},
13166
13167     {&hf_ieee80211_rsn_version,
13168      {"RSN Version", "wlan_mgt.rsn.version", FT_UINT16, BASE_DEC,
13169       NULL, 0, "Indicates the version number of the RSNA protocol", HFILL }},
13170
13171     {&hf_ieee80211_rsn_gcs,
13172      {"Group Cipher Suite", "wlan_mgt.rsn.gcs", FT_UINT32, BASE_CUSTOM,
13173       rsn_gcs_base_custom, 0, "Contains the cipher suite selector used by the BSS to protect broadcast/multicast traffic", HFILL }},
13174
13175     {&hf_ieee80211_rsn_gcs_oui,
13176      {"Group Cipher Suite OUI", "wlan_mgt.rsn.gcs.oui", FT_UINT24, BASE_CUSTOM,
13177       oui_base_custom, 0, NULL, HFILL }},
13178
13179     {&hf_ieee80211_rsn_gcs_type,
13180      {"Group Cipher Suite type", "wlan_mgt.rsn.gcs.type", FT_UINT8, BASE_DEC,
13181       NULL, 0, NULL, HFILL }},
13182
13183     {&hf_ieee80211_rsn_gcs_80211_type,
13184      {"Group Cipher Suite type", "wlan_mgt.rsn.gcs.type", FT_UINT8, BASE_DEC,
13185       VALS(ieee80211_rsn_cipher_vals), 0, NULL, HFILL }},
13186
13187     {&hf_ieee80211_rsn_pcs_count,
13188      {"Pairwise Cipher Suite Count", "wlan_mgt.rsn.pcs.count", FT_UINT16, BASE_DEC,
13189       NULL, 0, "Indicates the number of pairwise cipher suite selectors that are contained in the Pairwise Cipher Suite List", HFILL }},
13190
13191     {&hf_ieee80211_rsn_pcs_list,
13192      {"Pairwise Cipher Suite List", "wlan_mgt.rsn.pcs.list", FT_NONE, BASE_NONE,
13193       NULL, 0, "Contains a series of cipher suite selectors that indicate the pairwisecipher suites", HFILL }},
13194
13195     {&hf_ieee80211_rsn_pcs,
13196      {"Pairwise Cipher Suite", "wlan_mgt.rsn.pcs", FT_UINT32, BASE_CUSTOM,
13197       rsn_pcs_base_custom, 0, NULL, HFILL }},
13198
13199     {&hf_ieee80211_rsn_pcs_oui,
13200      {"Pairwise Cipher Suite OUI", "wlan_mgt.rsn.pcs.oui", FT_UINT24, BASE_CUSTOM,
13201       oui_base_custom, 0, NULL, HFILL }},
13202
13203     {&hf_ieee80211_rsn_pcs_type,
13204      {"Pairwise Cipher Suite type", "wlan_mgt.rsn.pcs.type", FT_UINT8, BASE_DEC,
13205       NULL, 0, NULL, HFILL }},
13206
13207     {&hf_ieee80211_rsn_pcs_80211_type,
13208      {"Pairwise Cipher Suite type", "wlan_mgt.rsn.pcs.type", FT_UINT8, BASE_DEC,
13209       VALS(ieee80211_rsn_cipher_vals), 0, NULL, HFILL }},
13210
13211     {&hf_ieee80211_rsn_akms_count,
13212      {"Auth Key Management (AKM) Suite Count", "wlan_mgt.rsn.akms.count", FT_UINT16, BASE_DEC,
13213       NULL, 0, "Indicates the number of Auth Key Management suite selectors that are contained in the Auth Key Management Suite List", HFILL }},
13214
13215     {&hf_ieee80211_rsn_akms_list,
13216      {"Auth Key Management (AKM) List", "wlan_mgt.rsn.akms.list", FT_NONE, BASE_NONE,
13217       NULL, 0, "Contains a series of cipher suite selectors that indicate the AKM suites", HFILL }},
13218
13219     {&hf_ieee80211_rsn_akms,
13220      {"Auth Key Management (AKM) Suite", "wlan_mgt.rsn.akms", FT_UINT32, BASE_CUSTOM,
13221       rsn_akms_base_custom, 0, NULL, HFILL }},
13222
13223     {&hf_ieee80211_rsn_akms_oui,
13224      {"Auth Key Management (AKM) OUI", "wlan_mgt.rsn.akms.oui", FT_UINT24, BASE_CUSTOM,
13225       oui_base_custom, 0, NULL, HFILL }},
13226
13227     {&hf_ieee80211_rsn_akms_type,
13228      {"Auth Key Management (AKM) type", "wlan_mgt.rsn.akms.type", FT_UINT8, BASE_DEC,
13229       NULL, 0, NULL, HFILL }},
13230
13231     {&hf_ieee80211_rsn_akms_80211_type,
13232      {"Auth Key Management (AKM) type", "wlan_mgt.rsn.akms.type", FT_UINT8, BASE_DEC,
13233       VALS(ieee80211_rsn_keymgmt_vals), 0, NULL, HFILL }},
13234
13235     {&hf_ieee80211_rsn_cap,
13236      {"RSN Capabilities", "wlan_mgt.rsn.capabilities", FT_UINT16, BASE_HEX,
13237       NULL, 0, "RSN Capability information", HFILL }},
13238
13239     {&hf_ieee80211_rsn_cap_preauth,
13240      {"RSN Pre-Auth capabilities", "wlan_mgt.rsn.capabilities.preauth",
13241       FT_BOOLEAN, 16, TFS(&rsn_preauth_flags), 0x0001,
13242       NULL, HFILL }},
13243
13244     {&hf_ieee80211_rsn_cap_no_pairwise,
13245      {"RSN No Pairwise capabilities", "wlan_mgt.rsn.capabilities.no_pairwise",
13246       FT_BOOLEAN, 16, TFS(&rsn_no_pairwise_flags), 0x0002,
13247       NULL, HFILL }},
13248
13249     {&hf_ieee80211_rsn_cap_ptksa_replay_counter,
13250      {"RSN PTKSA Replay Counter capabilities",
13251       "wlan_mgt.rsn.capabilities.ptksa_replay_counter",
13252       FT_UINT16, BASE_HEX, VALS(&rsn_cap_replay_counter), 0x000C,
13253       NULL, HFILL }},
13254
13255     {&hf_ieee80211_rsn_cap_gtksa_replay_counter,
13256      {"RSN GTKSA Replay Counter capabilities",
13257       "wlan_mgt.rsn.capabilities.gtksa_replay_counter",
13258       FT_UINT16, BASE_HEX, VALS(&rsn_cap_replay_counter), 0x0030,
13259       NULL, HFILL }},
13260
13261     {&hf_ieee80211_rsn_cap_mfpr,
13262      {"Management Frame Protection Required",
13263       "wlan_mgt.rsn.capabilities.mfpr",
13264       FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }},
13265
13266     {&hf_ieee80211_rsn_cap_mfpc,
13267      {"Management Frame Protection Capable",
13268       "wlan_mgt.rsn.capabilities.mfpc",
13269       FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL }},
13270
13271     {&hf_ieee80211_rsn_cap_peerkey,
13272      {"PeerKey Enabled",
13273       "wlan_mgt.rsn.capabilities.peerkey",
13274       FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL }},
13275
13276     {&hf_ieee80211_rsn_pmkid_count,
13277      {"PMKID Count", "wlan_mgt.rsn.pmkid.count", FT_UINT16, BASE_DEC,
13278       NULL, 0, "Indicates the number of PMKID  selectors that are contained in the PMKID Suite List", HFILL }},
13279
13280     {&hf_ieee80211_rsn_pmkid_list,
13281      {"PMKID List", "wlan_mgt.rsn.pmkid.list", FT_NONE, BASE_NONE,
13282       NULL, 0, "Contains a series of cipher suite selectors that indicate the AKM suites", HFILL }},
13283
13284     {&hf_ieee80211_rsn_pmkid,
13285      {"PMKID", "wlan_mgt.pmkid.akms", FT_BYTES, BASE_NONE,
13286       NULL, 0, NULL, HFILL }},
13287
13288     {&hf_ieee80211_rsn_gmcs,
13289      {"Group Managemement Cipher Suite", "wlan_mgt.rsn.gmcs", FT_UINT32, BASE_CUSTOM,
13290       rsn_gmcs_base_custom, 0, "Contains the cipher suite selector used by the BSS to protect broadcast/multicast traffic", HFILL }},
13291
13292     {&hf_ieee80211_rsn_gmcs_oui,
13293      {"Group Managemement Cipher Suite OUI", "wlan_mgt.rsn.gmcs.oui", FT_UINT24, BASE_CUSTOM,
13294       oui_base_custom, 0, NULL, HFILL }},
13295
13296     {&hf_ieee80211_rsn_gmcs_type,
13297      {"Group Managemement Cipher Suite type", "wlan_mgt.rsn.gmcs.type", FT_UINT8, BASE_DEC,
13298       NULL, 0, NULL, HFILL }},
13299
13300     {&hf_ieee80211_rsn_gmcs_80211_type,
13301      {"Group Managemement Cipher Suite type", "wlan_mgt.rsn.gmcs.type", FT_UINT8, BASE_DEC,
13302       VALS(ieee80211_rsn_cipher_vals), 0, NULL, HFILL }},
13303
13304
13305     {&hf_ieee80211_ht_cap,
13306      {"HT Capabilities Info", "wlan_mgt.ht.capabilities", FT_UINT16, BASE_HEX,
13307       NULL, 0, "HT Capability information", HFILL }},
13308
13309     {&hf_ieee80211_ht_vs_cap,
13310      {"HT Capabilities Info (VS)", "wlan_mgt.vs.ht.capabilities", FT_UINT16, BASE_HEX,
13311       NULL, 0, "Vendor Specific HT Capability information", HFILL }},
13312
13313     {&hf_ieee80211_ht_ldpc_coding,
13314      {"HT LDPC coding capability", "wlan_mgt.ht.capabilities.ldpccoding",
13315       FT_BOOLEAN, 16, TFS (&ht_ldpc_coding_flag), 0x0001,
13316       NULL, HFILL }},
13317
13318     {&hf_ieee80211_ht_chan_width,
13319      {"HT Support channel width", "wlan_mgt.ht.capabilities.width",
13320       FT_BOOLEAN, 16, TFS (&ht_chan_width_flag), 0x0002,
13321       NULL, HFILL }},
13322
13323     {&hf_ieee80211_ht_sm_pwsave,
13324      {"HT SM Power Save", "wlan_mgt.ht.capabilities.sm",
13325       FT_UINT16, BASE_HEX, VALS (&ht_sm_pwsave_flag), 0x000c,
13326       NULL, HFILL }},
13327
13328     {&hf_ieee80211_ht_green,
13329      {"HT Green Field", "wlan_mgt.ht.capabilities.green",
13330       FT_BOOLEAN, 16, TFS (&ht_green_flag), 0x0010,
13331       NULL, HFILL }},
13332
13333     {&hf_ieee80211_ht_short20,
13334      {"HT Short GI for 20MHz", "wlan_mgt.ht.capabilities.short20",
13335       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0020,
13336       NULL, HFILL }},
13337
13338     {&hf_ieee80211_ht_short40,
13339      {"HT Short GI for 40MHz", "wlan_mgt.ht.capabilities.short40",
13340       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0040,
13341       NULL, HFILL }},
13342
13343     {&hf_ieee80211_ht_tx_stbc,
13344      {"HT Tx STBC", "wlan_mgt.ht.capabilities.txstbc",
13345       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0080,
13346       NULL, HFILL }},
13347
13348     {&hf_ieee80211_ht_rx_stbc,
13349      {"HT Rx STBC", "wlan_mgt.ht.capabilities.rxstbc",
13350       FT_UINT16, BASE_HEX, VALS (&ht_rx_stbc_flag), 0x0300,
13351       "HT Tx STBC", HFILL }},
13352
13353     {&hf_ieee80211_ht_delayed_block_ack,
13354      {"HT Delayed Block ACK", "wlan_mgt.ht.capabilities.delayedblockack",
13355       FT_BOOLEAN, 16, TFS (&ht_delayed_block_ack_flag), 0x0400,
13356       NULL, HFILL }},
13357
13358     {&hf_ieee80211_ht_max_amsdu,
13359      {"HT Max A-MSDU length", "wlan_mgt.ht.capabilities.amsdu",
13360       FT_BOOLEAN, 16, TFS (&ht_max_amsdu_flag), 0x0800,
13361       NULL, HFILL }},
13362
13363     {&hf_ieee80211_ht_dss_cck_40,
13364      {"HT DSSS/CCK mode in 40MHz", "wlan_mgt.ht.capabilities.dsscck",
13365       FT_BOOLEAN, 16, TFS (&ht_dss_cck_40_flag), 0x1000,
13366       "HT DSS/CCK mode in 40MHz", HFILL }},
13367
13368     {&hf_ieee80211_ht_psmp,
13369      {"HT PSMP Support", "wlan_mgt.ht.capabilities.psmp",
13370       FT_BOOLEAN, 16, TFS (&ht_psmp_flag), 0x2000,
13371       NULL, HFILL }},
13372
13373     {&hf_ieee80211_ht_40_mhz_intolerant,
13374      {"HT Forty MHz Intolerant", "wlan_mgt.ht.capabilities.40mhzintolerant",
13375       FT_BOOLEAN, 16, TFS (&ht_40_mhz_intolerant_flag), 0x4000,
13376       NULL, HFILL }},
13377
13378     {&hf_ieee80211_ht_l_sig,
13379      {"HT L-SIG TXOP Protection support", "wlan_mgt.ht.capabilities.lsig",
13380       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x8000,
13381       NULL, HFILL }},
13382
13383     {&hf_ieee80211_ampduparam,
13384      {"A-MPDU Parameters", "wlan_mgt.ht.ampduparam", FT_UINT16, BASE_HEX,
13385       NULL, 0, NULL, HFILL }},
13386
13387     {&hf_ieee80211_ampduparam_vs,
13388      {"A-MPDU Parameters (VS)", "wlan_mgt.vs.ht.ampduparam", FT_UINT16, BASE_HEX,
13389       NULL, 0, "Vendor Specific A-MPDU Parameters", HFILL }},
13390
13391     {&hf_ieee80211_ampduparam_mpdu,
13392      {"Maximum Rx A-MPDU Length", "wlan_mgt.ht.ampduparam.maxlength",
13393       FT_UINT8, BASE_HEX, 0 , 0x03,
13394       NULL, HFILL }},
13395
13396     {&hf_ieee80211_ampduparam_mpdu_start_spacing,
13397      {"MPDU Density", "wlan_mgt.ht.ampduparam.mpdudensity",
13398       FT_UINT8, BASE_HEX, VALS (&ampduparam_mpdu_start_spacing_flags) , 0x1c,
13399       NULL, HFILL }},
13400
13401     {&hf_ieee80211_ampduparam_reserved,
13402      {"Reserved", "wlan_mgt.ht.ampduparam.reserved",
13403       FT_UINT8, BASE_HEX, NULL, 0xE0,
13404       NULL, HFILL }},
13405
13406     {&hf_ieee80211_mcsset,
13407      {"Rx Supported Modulation and Coding Scheme Set", "wlan_mgt.ht.mcsset",
13408       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13409
13410     {&hf_ieee80211_mcsset_vs,
13411      {"Rx Supported Modulation and Coding Scheme Set (VS)", "wlan_mgt.vs.ht.mcsset",
13412       FT_STRING, BASE_NONE, NULL, 0, "Vendor Specific Rx Supported Modulation and Coding Scheme Set", HFILL }},
13413
13414     {&hf_ieee80211_mcsset_rx_bitmask_0to7,
13415      {"Rx Bitmask Bits 0-7", "wlan_mgt.ht.mcsset.rxbitmask.0to7",
13416       FT_UINT32, BASE_HEX, 0, 0x000000ff, NULL, HFILL }},
13417
13418     {&hf_ieee80211_mcsset_rx_bitmask_8to15,
13419      {"Rx Bitmask Bits 8-15", "wlan_mgt.ht.mcsset.rxbitmask.8to15",
13420       FT_UINT32, BASE_HEX, 0, 0x0000ff00, NULL, HFILL }},
13421
13422     {&hf_ieee80211_mcsset_rx_bitmask_16to23,
13423      {"Rx Bitmask Bits 16-23", "wlan_mgt.ht.mcsset.rxbitmask.16to23",
13424       FT_UINT32, BASE_HEX, 0, 0x00ff0000, NULL, HFILL }},
13425
13426     {&hf_ieee80211_mcsset_rx_bitmask_24to31,
13427      {"Rx Bitmask Bits 24-31", "wlan_mgt.ht.mcsset.rxbitmask.24to31",
13428       FT_UINT32, BASE_HEX, 0, 0xff000000, NULL, HFILL }},
13429
13430     {&hf_ieee80211_mcsset_rx_bitmask_32,
13431      {"Rx Bitmask Bit 32", "wlan_mgt.ht.mcsset.rxbitmask.32",
13432       FT_UINT32, BASE_HEX, 0, 0x000001, NULL, HFILL }},
13433
13434     {&hf_ieee80211_mcsset_rx_bitmask_33to38,
13435      {"Rx Bitmask Bits 33-38", "wlan_mgt.ht.mcsset.rxbitmask.33to38",
13436       FT_UINT32, BASE_HEX, 0, 0x00007e, NULL, HFILL }},
13437
13438     {&hf_ieee80211_mcsset_rx_bitmask_39to52,
13439      {"Rx Bitmask Bits 39-52", "wlan_mgt.ht.mcsset.rxbitmask.39to52",
13440       FT_UINT32, BASE_HEX, 0, 0x1fff80, NULL, HFILL }},
13441
13442     {&hf_ieee80211_mcsset_rx_bitmask_53to76,
13443      {"Rx Bitmask Bits 53-76", "wlan_mgt.ht.mcsset.rxbitmask.53to76",
13444       FT_UINT32, BASE_HEX, 0, 0x1fffffe0, NULL, HFILL }},
13445
13446     {&hf_ieee80211_mcsset_highest_data_rate,
13447      {"Highest Supported Data Rate", "wlan_mgt.ht.mcsset.highestdatarate",
13448       FT_UINT16, BASE_HEX, 0, 0x03ff, NULL, HFILL }},
13449
13450     {&hf_ieee80211_mcsset_tx_mcs_set_defined,
13451      {"Tx Supported MCS Set", "wlan_mgt.ht.mcsset.txsetdefined",
13452       FT_BOOLEAN, 16, TFS (&mcsset_tx_mcs_set_defined_flag), 0x0001,
13453       NULL, HFILL }},
13454
13455     {&hf_ieee80211_mcsset_tx_rx_mcs_set_not_equal,
13456      {"Tx and Rx MCS Set", "wlan_mgt.ht.mcsset.txrxmcsnotequal",
13457       FT_BOOLEAN, 16, TFS (&mcsset_tx_rx_mcs_set_not_equal_flag), 0x0002,
13458       NULL, HFILL }},
13459
13460     {&hf_ieee80211_mcsset_tx_max_spatial_streams,
13461      {"Tx Maximum Number of Spatial Streams Supported", "wlan_mgt.ht.mcsset.txmaxss",
13462       FT_UINT16, BASE_HEX, VALS (&mcsset_tx_max_spatial_streams_flags) , 0x000c,
13463       NULL, HFILL }},
13464
13465     {&hf_ieee80211_mcsset_tx_unequal_modulation,
13466      {"Unequal Modulation", "wlan_mgt.ht.mcsset.txunequalmod",
13467       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0010,
13468       NULL, HFILL }},
13469
13470     {&hf_ieee80211_htex_cap,
13471      {"HT Extended Capabilities", "wlan_mgt.htex.capabilities", FT_UINT16, BASE_HEX,
13472       NULL, 0, "HT Extended Capability information", HFILL }},
13473
13474     {&hf_ieee80211_htex_vs_cap,
13475      {"HT Extended Capabilities (VS)", "wlan_mgt.vs.htex.capabilities", FT_UINT16, BASE_HEX,
13476       NULL, 0, "Vendor Specific HT Extended Capability information", HFILL }},
13477
13478     {&hf_ieee80211_htex_pco,
13479      {"Transmitter supports PCO", "wlan_mgt.htex.capabilities.pco",
13480       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0001,
13481       NULL, HFILL }},
13482
13483     {&hf_ieee80211_htex_transtime,
13484      {"Time needed to transition between 20MHz and 40MHz", "wlan_mgt.htex.capabilities.transtime",
13485       FT_UINT16, BASE_HEX, VALS (&htex_transtime_flags), 0x0006,
13486       NULL, HFILL }},
13487
13488     {&hf_ieee80211_htex_mcs,
13489      {"MCS Feedback capability", "wlan_mgt.htex.capabilities.mcs",
13490       FT_UINT16, BASE_HEX, VALS (&htex_mcs_flags), 0x0300,
13491       NULL, HFILL }},
13492
13493     {&hf_ieee80211_htex_htc_support,
13494      {"High Throughput", "wlan_mgt.htex.capabilities.htc",
13495       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0400,
13496       NULL, HFILL }},
13497
13498     {&hf_ieee80211_htex_rd_responder,
13499      {"Reverse Direction Responder", "wlan_mgt.htex.capabilities.rdresponder",
13500       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0800,
13501       NULL, HFILL }},
13502
13503     {&hf_ieee80211_txbf,
13504      {"Transmit Beam Forming (TxBF) Capabilities", "wlan_mgt.txbf", FT_UINT16, BASE_HEX,
13505       NULL, 0, NULL, HFILL }},
13506
13507     {&hf_ieee80211_txbf_vs,
13508      {"Transmit Beam Forming (TxBF) Capabilities (VS)", "wlan_mgt.vs.txbf", FT_UINT16, BASE_HEX,
13509       NULL, 0, "Vendor Specific Transmit Beam Forming (TxBF) Capabilities", HFILL }},
13510
13511     {&hf_ieee80211_txbf_cap,
13512      {"Transmit Beamforming", "wlan_mgt.txbf.txbf",
13513       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000001,
13514       NULL, HFILL }},
13515
13516     {&hf_ieee80211_txbf_rcv_ssc,
13517      {"Receive Staggered Sounding", "wlan_mgt.txbf.rxss",
13518       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000002,
13519       NULL, HFILL }},
13520
13521     {&hf_ieee80211_txbf_tx_ssc,
13522      {"Transmit Staggered Sounding", "wlan_mgt.txbf.txss",
13523       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000004,
13524       NULL, HFILL }},
13525
13526     {&hf_ieee80211_txbf_rcv_ndp,
13527      {"Receive Null Data packet (NDP)", "wlan_mgt.txbf.rxndp",
13528       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000008,
13529       NULL, HFILL }},
13530
13531     {&hf_ieee80211_txbf_tx_ndp,
13532      {"Transmit Null Data packet (NDP)", "wlan_mgt.txbf.txndp",
13533       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000010,
13534       NULL, HFILL }},
13535
13536     {&hf_ieee80211_txbf_impl_txbf,
13537      {"Implicit TxBF capable", "wlan_mgt.txbf.impltxbf",
13538       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000020,
13539       "Implicit Transmit Beamforming (TxBF) capable", HFILL }},
13540
13541     {&hf_ieee80211_txbf_calib,
13542      {"Calibration", "wlan_mgt.txbf.calibration",
13543       FT_UINT32, BASE_HEX, VALS (&txbf_calib_flag), 0x000000c0,
13544       NULL, HFILL }},
13545
13546     {&hf_ieee80211_txbf_expl_csi,
13547      {"STA can apply TxBF using CSI explicit feedback", "wlan_mgt.txbf.csi",
13548       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000100,
13549       "Station can apply TxBF using CSI explicit feedback", HFILL }},
13550
13551     {&hf_ieee80211_txbf_expl_uncomp_fm,
13552      {"STA can apply TxBF using uncompressed beamforming feedback matrix", "wlan_mgt.txbf.fm.uncompressed.tbf",
13553       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000200,
13554       "Station can apply TxBF using uncompressed beamforming feedback matrix", HFILL }},
13555
13556     {&hf_ieee80211_txbf_expl_comp_fm,
13557      {"STA can apply TxBF using compressed beamforming feedback matrix", "wlan_mgt.txbf.fm.compressed.tbf",
13558       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000400,
13559       "Station can apply TxBF using compressed beamforming feedback matrix", HFILL }},
13560
13561     {&hf_ieee80211_txbf_expl_bf_csi,
13562      {"Receiver can return explicit CSI feedback", "wlan_mgt.txbf.rcsi",
13563       FT_UINT32, BASE_HEX, VALS (&txbf_feedback_flags), 0x00001800,
13564       NULL, HFILL }},
13565
13566     {&hf_ieee80211_txbf_expl_uncomp_fm_feed,
13567      {"Receiver can return explicit uncompressed Beamforming Feedback Matrix", "wlan_mgt.txbf.fm.uncompressed.rbf",
13568       FT_UINT32, BASE_HEX, VALS (&txbf_feedback_flags), 0x00006000,
13569       NULL, HFILL }},
13570
13571     {&hf_ieee80211_txbf_expl_comp_fm_feed,
13572      {"STA can compress and use compressed Beamforming Feedback Matrix", "wlan_mgt.txbf.fm.compressed.bf",
13573       FT_UINT32, BASE_HEX, VALS (&txbf_feedback_flags), 0x00018000,
13574       "Station can compress and use compressed Beamforming Feedback Matrix", HFILL }},
13575
13576     {&hf_ieee80211_txbf_min_group,
13577      {"Minimal grouping used for explicit feedback reports", "wlan_mgt.txbf.mingroup",
13578       FT_UINT32, BASE_HEX, VALS (&txbf_min_group_flags), 0x00060000,
13579       NULL, HFILL }},
13580
13581     {&hf_ieee80211_txbf_csi_num_bf_ant,
13582      {"Max antennae STA can support when CSI feedback required", "wlan_mgt.txbf.csinumant",
13583       FT_UINT32, BASE_HEX, VALS (&txbf_antenna_flags), 0x00180000,
13584       "Max antennae station can support when CSI feedback required", HFILL }},
13585
13586     {&hf_ieee80211_txbf_uncomp_sm_bf_ant,
13587      {"Max antennae STA can support when uncompressed Beamforming feedback required", "wlan_mgt.txbf.fm.uncompressed.maxant",
13588       FT_UINT32, BASE_HEX, VALS (&txbf_antenna_flags), 0x00600000,
13589       "Max antennae station can support when uncompressed Beamforming feedback required", HFILL }},
13590
13591     {&hf_ieee80211_txbf_comp_sm_bf_ant,
13592      {"Max antennae STA can support when compressed Beamforming feedback required", "wlan_mgt.txbf.fm.compressed.maxant",
13593       FT_UINT32, BASE_HEX, VALS (&txbf_antenna_flags), 0x01800000,
13594       "Max antennae station can support when compressed Beamforming feedback required", HFILL }},
13595
13596     {&hf_ieee80211_txbf_csi_max_rows_bf,
13597      {"Maximum number of rows of CSI explicit feedback", "wlan_mgt.txbf.csi.maxrows",
13598       FT_UINT32, BASE_HEX, VALS (&txbf_csi_max_rows_bf_flags), 0x06000000,
13599       NULL, HFILL }},
13600
13601     {&hf_ieee80211_txbf_chan_est,
13602      {"Maximum number of space time streams for which channel dimensions can be simultaneously estimated", "wlan_mgt.txbf.channelest",
13603       FT_UINT32, BASE_HEX, VALS (&txbf_chan_est_flags), 0x18000000,
13604       NULL, HFILL }},
13605
13606     {&hf_ieee80211_txbf_resrv,
13607      {"Reserved", "wlan_mgt.txbf.reserved",
13608       FT_UINT32, BASE_HEX, NULL, 0xe0000000,
13609       NULL, HFILL }},
13610
13611     {&hf_ieee80211_hta_cap,
13612      {"HT Additional Capabilities", "wlan_mgt.hta.capabilities", FT_UINT16, BASE_HEX,
13613       NULL, 0, "HT Additional Capability information", HFILL }},
13614
13615     {&hf_ieee80211_hta_ext_chan_offset,
13616      {"Extension Channel Offset", "wlan_mgt.hta.capabilities.extchan",
13617       FT_UINT16, BASE_HEX, VALS (&hta_ext_chan_offset_flag), 0x0003,
13618       NULL, HFILL }},
13619
13620     {&hf_ieee80211_hta_rec_tx_width,
13621      {"Recommended Tx Channel Width", "wlan_mgt.hta.capabilities.rectxwidth",
13622       FT_BOOLEAN, 16, TFS (&hta_rec_tx_width_flag), 0x0004,
13623       "Recommended Transmit Channel Width", HFILL }},
13624
13625     {&hf_ieee80211_hta_rifs_mode,
13626      {"Reduced Interframe Spacing (RIFS) Mode", "wlan_mgt.hta.capabilities.rifsmode",
13627       FT_BOOLEAN, 16, TFS (&hta_rifs_mode_flag), 0x0008,
13628       NULL, HFILL }},
13629
13630     {&hf_ieee80211_hta_controlled_access,
13631      {"Controlled Access Only", "wlan_mgt.hta.capabilities.controlledaccess",
13632       FT_BOOLEAN, 16, TFS (&hta_controlled_access_flag), 0x0010,
13633       NULL, HFILL }},
13634
13635     {&hf_ieee80211_hta_service_interval,
13636      {"Service Interval Granularity", "wlan_mgt.hta.capabilities.serviceinterval",
13637       FT_UINT16, BASE_HEX, VALS (&hta_service_interval_flag), 0x00E0,
13638       NULL, HFILL }},
13639
13640     {&hf_ieee80211_hta_operating_mode,
13641      {"Operating Mode", "wlan_mgt.hta.capabilities.operatingmode",
13642       FT_UINT16, BASE_HEX, VALS (&hta_operating_mode_flag), 0x0003,
13643       NULL, HFILL }},
13644
13645     {&hf_ieee80211_hta_non_gf_devices,
13646      {"Non Greenfield (GF) devices Present", "wlan_mgt.hta.capabilities.nongfdevices",
13647       FT_BOOLEAN, 16, TFS (&hta_non_gf_devices_flag), 0x0004,
13648       "on Greenfield (GF) devices Present", HFILL }},
13649
13650     {&hf_ieee80211_hta_basic_stbc_mcs,
13651      {"Basic STB Modulation and Coding Scheme (MCS)", "wlan_mgt.hta.capabilities.",
13652       FT_UINT16, BASE_HEX, NULL , 0x007f,
13653       NULL, HFILL }},
13654
13655     {&hf_ieee80211_hta_dual_stbc_protection,
13656      {"Dual Clear To Send (CTS) Protection", "wlan_mgt.hta.capabilities.",
13657       FT_BOOLEAN, 16, TFS (&hta_dual_stbc_protection_flag), 0x0080,
13658       NULL, HFILL }},
13659
13660     {&hf_ieee80211_hta_secondary_beacon,
13661      {"Secondary Beacon", "wlan_mgt.hta.capabilities.",
13662       FT_BOOLEAN, 16, TFS (&hta_secondary_beacon_flag), 0x0100,
13663       NULL, HFILL }},
13664
13665     {&hf_ieee80211_hta_lsig_txop_protection,
13666      {"L-SIG TXOP Protection Support", "wlan_mgt.hta.capabilities.",
13667       FT_BOOLEAN, 16, TFS (&hta_lsig_txop_protection_flag), 0x0200,
13668       NULL, HFILL }},
13669
13670     {&hf_ieee80211_hta_pco_active,
13671      {"Phased Coexistence Operation (PCO) Active", "wlan_mgt.hta.capabilities.",
13672       FT_BOOLEAN, 16, TFS (&hta_pco_active_flag), 0x0400,
13673       NULL, HFILL }},
13674
13675     {&hf_ieee80211_hta_pco_phase,
13676      {"Phased Coexistence Operation (PCO) Phase", "wlan_mgt.hta.capabilities.",
13677       FT_BOOLEAN, 16, TFS (&hta_pco_phase_flag), 0x0800,
13678       NULL, HFILL }},
13679
13680     {&hf_ieee80211_antsel,
13681      {"Antenna Selection (ASEL) Capabilities", "wlan_mgt.asel",
13682       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13683
13684     {&hf_ieee80211_antsel_vs,
13685      {"Antenna Selection (ASEL) Capabilities (VS)", "wlan_mgt.vs.asel",
13686       FT_UINT8, BASE_HEX, NULL, 0, "Vendor Specific Antenna Selection (ASEL) Capabilities", HFILL }},
13687
13688     {&hf_ieee80211_antsel_b0,
13689      {"Antenna Selection Capable", "wlan_mgt.asel.capable",
13690       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x01, NULL, HFILL }},
13691
13692     {&hf_ieee80211_antsel_b1,
13693      {"Explicit CSI Feedback Based Tx ASEL", "wlan_mgt.asel.txcsi",
13694       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x02, NULL, HFILL }},
13695
13696     {&hf_ieee80211_antsel_b2,
13697      {"Antenna Indices Feedback Based Tx ASEL", "wlan_mgt.asel.txif",
13698       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x04, NULL, HFILL }},
13699
13700     {&hf_ieee80211_antsel_b3,
13701      {"Explicit CSI Feedback", "wlan_mgt.asel.csi",
13702       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x08, NULL, HFILL }},
13703
13704     {&hf_ieee80211_antsel_b4,
13705      {"Antenna Indices Feedback", "wlan_mgt.asel.if",
13706       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x10, NULL, HFILL }},
13707
13708     {&hf_ieee80211_antsel_b5,
13709      {"Rx ASEL", "wlan_mgt.asel.rx",
13710       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x20, NULL, HFILL }},
13711
13712     {&hf_ieee80211_antsel_b6,
13713      {"Tx Sounding PPDUs", "wlan_mgt.asel.sppdu",
13714       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x40, NULL, HFILL }},
13715
13716     {&hf_ieee80211_antsel_b7,
13717      {"Reserved", "wlan_mgt.asel.reserved",
13718       FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL }},
13719
13720     {&hf_ieee80211_ht_info_delimiter1,
13721      {"HT Information Delimiter #1", "wlan_mgt.ht.info.delim1",
13722       FT_UINT8, BASE_HEX, NULL, 0xff, NULL, HFILL }},
13723
13724     {&hf_ieee80211_ht_info_primary_channel,
13725      {"Primary Channel", "wlan_mgt.ht.info.primarychannel",
13726       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13727
13728     {&hf_ieee80211_ht_info_secondary_channel_offset,
13729      {"Secondary channel offset", "wlan_mgt.ht.info.secchanoffset",
13730       FT_UINT8, BASE_HEX, VALS (&ht_info_secondary_channel_offset_flags), 0x03, NULL, HFILL }},
13731
13732     {&hf_ieee80211_ht_info_channel_width,
13733      {"Supported channel width", "wlan_mgt.ht.info.chanwidth",
13734       FT_BOOLEAN, 8, TFS (&ht_info_channel_width_flag), 0x04, NULL, HFILL }},
13735
13736     {&hf_ieee80211_ht_info_rifs_mode,
13737      {"Reduced Interframe Spacing (RIFS)", "wlan_mgt.ht.info.rifs",
13738       FT_BOOLEAN, 8, TFS (&ht_info_rifs_mode_flag), 0x08, NULL, HFILL }},
13739
13740     {&hf_ieee80211_ht_info_psmp_stas_only,
13741      {"Power Save Multi-Poll (PSMP) stations only", "wlan_mgt.ht.info.psmponly",
13742       FT_BOOLEAN, 8, TFS (&ht_info_psmp_stas_only_flag), 0x10, NULL, HFILL }},
13743
13744     {&hf_ieee80211_ht_info_service_interval_granularity,
13745      {"Shortest service interval", "wlan_mgt.ht.info.",
13746       FT_UINT8, BASE_HEX, VALS (&ht_info_service_interval_granularity_flags), 0xe0, NULL, HFILL }},
13747
13748     {&hf_ieee80211_ht_info_delimiter2,
13749      {"HT Information Delimiter #2", "wlan_mgt.ht.info.delim2",
13750       FT_UINT16, BASE_HEX, NULL, 0xffff, NULL, HFILL }},
13751
13752     {&hf_ieee80211_ht_info_operating_mode,
13753      {"Operating mode of BSS", "wlan_mgt.ht.info.operatingmode",
13754       FT_UINT16, BASE_HEX, VALS (&ht_info_operating_mode_flags), 0x0003, NULL, HFILL }},
13755
13756     {&hf_ieee80211_ht_info_non_greenfield_sta_present,
13757      {"Non-greenfield STAs present", "wlan_mgt.ht.info.greenfield",
13758       FT_BOOLEAN, 16, TFS (&ht_info_non_greenfield_sta_present_flag), 0x0004, NULL, HFILL }},
13759
13760     {&hf_ieee80211_ht_info_transmit_burst_limit,
13761      {"Transmit burst limit", "wlan_mgt.ht.info.burstlim",
13762       FT_BOOLEAN, 16, TFS (&ht_info_transmit_burst_limit_flag), 0x0008, NULL, HFILL }},
13763
13764     {&hf_ieee80211_ht_info_obss_non_ht_stas_present,
13765      {"OBSS non-HT STAs present", "wlan_mgt.ht.info.obssnonht",
13766       FT_BOOLEAN, 16, TFS (&ht_info_obss_non_ht_stas_present_flag), 0x0010, NULL, HFILL }},
13767
13768     {&hf_ieee80211_ht_info_reserved_1,
13769      {"Reserved", "wlan_mgt.ht.info.reserved1",
13770       FT_UINT16, BASE_HEX, NULL, 0xffe0, NULL, HFILL }},
13771
13772     {&hf_ieee80211_ht_info_delimiter3,
13773      {"HT Information Delimiter #3", "wlan_mgt.ht.info.delim3",
13774       FT_UINT16, BASE_HEX, NULL, 0xffff, NULL, HFILL }},
13775
13776     {&hf_ieee80211_ht_info_reserved_2,
13777      {"Reserved", "wlan_mgt.ht.info.reserved2",
13778       FT_UINT16, BASE_HEX, NULL, 0x003f, NULL, HFILL }},
13779
13780     {&hf_ieee80211_ht_info_dual_beacon,
13781      {"Dual beacon", "wlan_mgt.ht.info.dualbeacon",
13782       FT_BOOLEAN, 16, TFS (&ht_info_dual_beacon_flag), 0x0040, NULL, HFILL }},
13783
13784     {&hf_ieee80211_ht_info_dual_cts_protection,
13785      {"Dual Clear To Send (CTS) protection", "wlan_mgt.ht.info.dualcts",
13786       FT_BOOLEAN, 16, TFS (&ht_info_dual_cts_protection_flag), 0x0080, NULL, HFILL }},
13787
13788     {&hf_ieee80211_ht_info_secondary_beacon,
13789      {"Beacon ID", "wlan_mgt.ht.info.secondarybeacon",
13790       FT_BOOLEAN, 16, TFS (&ht_info_secondary_beacon_flag), 0x0100, NULL, HFILL }},
13791
13792     {&hf_ieee80211_ht_info_lsig_txop_protection_full_support,
13793      {"L-SIG TXOP Protection Full Support", "wlan_mgt.ht.info.lsigprotsupport",
13794       FT_BOOLEAN, 16, TFS (&ht_info_lsig_txop_protection_full_support_flag), 0x0200, NULL, HFILL }},
13795
13796     {&hf_ieee80211_ht_info_pco_active,
13797      {"Phased Coexistence Operation (PCO)", "wlan_mgt.ht.info.pco.active",
13798       FT_BOOLEAN, 16, TFS (&tfs_active_inactive), 0x0400, NULL, HFILL }},
13799
13800     {&hf_ieee80211_ht_info_pco_phase,
13801      {"Phased Coexistence Operation (PCO) Phase", "wlan_mgt.ht.info.pco.phase",
13802       FT_BOOLEAN, 16, TFS (&ht_info_pco_phase_flag), 0x0800, NULL, HFILL }},
13803
13804     {&hf_ieee80211_ht_info_reserved_3,
13805      {"Reserved", "wlan_mgt.ht.info.reserved3",
13806       FT_UINT16, BASE_HEX, NULL, 0xf000, NULL, HFILL }},
13807
13808     {&hf_ieee80211_tag_secondary_channel_offset,
13809      {"Secondary Channel Offset", "wlan_mgt.secchanoffset",
13810       FT_UINT8, BASE_HEX, VALS (&ieee80211_tag_secondary_channel_offset_flags), 0,
13811       NULL, HFILL }},
13812
13813     {&hf_ieee80211_tag_power_constraint_local,
13814      {"Local Power Constraint", "wlan_mgt.powercon.local",
13815       FT_UINT8, BASE_HEX, NULL, 0,
13816       "Value that allows the mitigation requirements to be satisfied in the current channel", HFILL }},
13817
13818     {&hf_ieee80211_tag_power_capability_min,
13819      {"Minimum Transmit Power", "wlan_mgt.powercap.min",
13820       FT_UINT8, BASE_HEX, NULL, 0,
13821       "The nominal minimum transmit power with which the STA is capable of transmitting in the current channel", HFILL }},
13822
13823     {&hf_ieee80211_tag_power_capability_max,
13824      {"Maximum Transmit Power", "wlan_mgt.powercap.max",
13825       FT_UINT8, BASE_HEX, NULL, 0,
13826       "The nominal maximum transmit power with which the STA is capable of transmitting in the current channel", HFILL }},
13827
13828     {&hf_ieee80211_tag_tpc_report_trsmt_pow,
13829      {"Transmit Power", "wlan_mgt.tcprep.trsmt_pow",
13830       FT_INT8, BASE_DEC, NULL, 0,
13831       NULL, HFILL }},
13832
13833     {&hf_ieee80211_tag_tpc_report_link_mrg,
13834      {"Link Margin", "wlan_mgt.tcprep.link_mrg",
13835       FT_INT8, BASE_DEC, NULL, 0,
13836       NULL, HFILL }},
13837
13838     {&hf_ieee80211_tag_supported_channels,
13839      {"Supported Channels Set", "wlan_mgt.supchan",
13840       FT_NONE, BASE_NONE, NULL, 0,
13841       NULL, HFILL }},
13842
13843     {&hf_ieee80211_tag_supported_channels_first,
13844      {"First Supported Channel", "wlan_mgt.supchan.first",
13845       FT_UINT8, BASE_HEX, NULL, 0,
13846       NULL, HFILL }},
13847
13848     {&hf_ieee80211_tag_supported_channels_range,
13849      {"Supported Channel Range", "wlan_mgt.supchan.range",
13850       FT_UINT8, BASE_HEX, NULL, 0,
13851       NULL, HFILL }},
13852
13853     {&hf_ieee80211_csa_channel_switch_mode,
13854      {"Channel Switch Mode", "wlan_mgt.csa.channel_switch_mode",
13855       FT_UINT8, BASE_HEX, NULL, 0,
13856       "Indicates any restrictions on transmission until a channel switch", HFILL }},
13857
13858     {&hf_ieee80211_csa_new_channel_number,
13859      {"New Channel Number", "wlan_mgt.csa.new_channel_number",
13860       FT_UINT8, BASE_HEX, NULL, 0,
13861       "Set to the number of the channel to which the STA is moving", HFILL }},
13862
13863     {&hf_ieee80211_csa_channel_switch_count,
13864      {"Channel Switch Count", "wlan_mgt.csa.channel_switch_count",
13865       FT_UINT8, BASE_DEC, NULL, 0,
13866       "Set to the number of TBTTs until the STA sending the Channel Switch Announcement element switches to the new channel or shall be set to 0", HFILL }},
13867
13868     {&hf_ieee80211_tag_measure_request_token,
13869      {"Measurement Token", "wlan_mgt.measure.req.token",
13870       FT_UINT8, BASE_HEX, NULL, 0xff, NULL, HFILL }},
13871
13872     {&hf_ieee80211_tag_measure_request_mode,
13873      {"Measurement Request Mode", "wlan_mgt.measure.req.mode",
13874       FT_UINT8, BASE_HEX, NULL, 0xff, NULL, HFILL }},
13875
13876     {&hf_ieee80211_tag_measure_request_mode_parallel,
13877      {"Parallel", "wlan_mgt.measure.req.reqmode.parallel",
13878       FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
13879
13880     {&hf_ieee80211_tag_measure_request_mode_enable,
13881      {"Measurement Request Mode Field", "wlan_mgt.measure.req.reqmode.enable",
13882       FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x02, NULL, HFILL }},
13883
13884     {&hf_ieee80211_tag_measure_request_mode_request,
13885      {"Measurement Reports", "wlan_mgt.measure.req.reqmode.request",
13886       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x04, NULL, HFILL }},
13887
13888     {&hf_ieee80211_tag_measure_request_mode_report,
13889      {"Autonomous Measurement Reports", "wlan_mgt.measure.req.reqmode.report",
13890       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x08, NULL, HFILL }},
13891
13892     {&hf_ieee80211_tag_measure_request_mode_duration_mandatory,
13893      {"Duration Mandatory", "wlan_mgt.measure.req.reqmode.duration_mandatory",
13894       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x10, NULL, HFILL }},
13895
13896     {&hf_ieee80211_tag_measure_request_mode_reserved,
13897      {"Reserved", "wlan_mgt.measure.req.reqmode.reserved",
13898       FT_UINT8, BASE_HEX, NULL, 0xE0, NULL, HFILL }},
13899
13900     {&hf_ieee80211_tag_measure_request_type,
13901      {"Measurement Request Type", "wlan_mgt.measure.req.reqtype",
13902       FT_UINT8, BASE_HEX, VALS (&ieee80211_tag_measure_request_type_flags), 0x00, NULL, HFILL }},
13903
13904     {&hf_ieee80211_tag_measure_request_channel_number,
13905      {"Measurement Channel Number", "wlan_mgt.measure.req.channelnumber",
13906       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13907
13908     {&hf_ieee80211_tag_measure_request_start_time,
13909      {"Measurement Start Time", "wlan_mgt.measure.req.starttime",
13910       FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL }},
13911
13912     {&hf_ieee80211_tag_measure_request_duration,
13913      {"Measurement Duration", "wlan_mgt.measure.req.channelnumber",
13914       FT_UINT16, BASE_HEX, NULL, 0, "in TU (1 TU = 1024 us)", HFILL }},
13915
13916     {&hf_ieee80211_tag_measure_request_regulatory_class,
13917      {"Measurement Channel Number", "wlan_mgt.measure.req.regclass",
13918       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13919
13920     {&hf_ieee80211_tag_measure_request_randomization_interval,
13921      {"Randomization Interval", "wlan_mgt.measure.req.randint",
13922       FT_UINT16, BASE_HEX, NULL, 0, "in TU (1 TU = 1024 us)", HFILL }},
13923
13924     {&hf_ieee80211_tag_measure_request_measurement_mode,
13925      {"Measurement Mode", "wlan_mgt.measure.req.measurementmode",
13926       FT_UINT8, BASE_HEX, VALS(ieee80211_tag_measure_request_measurement_mode_flags), 0, NULL, HFILL }},
13927
13928     {&hf_ieee80211_tag_measure_request_bssid,
13929      {"BSSID", "wlan_mgt.measure.req.bssid",
13930       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13931
13932     {&hf_ieee80211_tag_measure_request_subelement_length,
13933      {"Length", "wlan_mgt.measure.req.sub.length",
13934       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13935
13936     {&hf_ieee80211_tag_measure_request_beacon_sub_id,
13937      {"SubElement ID", "wlan_mgt.measure.req.beacon.sub.id",
13938       FT_UINT8, BASE_DEC, VALS(ieee80211_tag_measure_request_beacon_sub_id_flags), 0, NULL, HFILL }},
13939
13940     {&hf_ieee80211_tag_measure_request_beacon_sub_ssid,
13941      {"SSID", "wlan_mgt.measure.req.beacon.sub.ssid",
13942       FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
13943
13944     {&hf_ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition,
13945      {"Reporting Condition", "wlan_mgt.measure.req.beacon.sub.bri.repcond",
13946       FT_UINT8, BASE_HEX, VALS(ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition_flags), 0, NULL, HFILL }},
13947
13948     {&hf_ieee80211_tag_measure_request_beacon_sub_bri_threshold_offset,
13949      {"Threshold/Offset", "wlan_mgt.measure.req.beacon.sub.bri.threshold_offset",
13950       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13951
13952     {&hf_ieee80211_tag_measure_request_beacon_sub_reporting_detail,
13953      {"Reporting Detail", "wlan_mgt.measure.req.beacon.sub.bri.reporting_detail",
13954       FT_UINT8, BASE_HEX, VALS(ieee80211_tag_measure_request_beacon_sub_reporting_detail_flags), 0, NULL, HFILL }},
13955
13956     {&hf_ieee80211_tag_measure_request_beacon_sub_request,
13957      {"Request", "wlan_mgt.measure.req.beacon.sub.request",
13958       FT_UINT8, BASE_DEC, 0, 0, NULL, HFILL }},
13959
13960     {&hf_ieee80211_tag_measure_request_beacon_unknown,
13961      {"Unknown Data", "wlan_mgt.measure.req.beacon.unknown",
13962       FT_BYTES, BASE_NONE, NULL, 0, "(not interpreted)", HFILL }},
13963
13964     {&hf_ieee80211_tag_measure_request_frame_request_type,
13965      {"Frame Request Type", "wlan_mgt.measure.req.frame_request_type",
13966       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13967
13968     {&hf_ieee80211_tag_measure_request_mac_address,
13969      {"MAC Address", "wlan_mgt.measure.req.mac_address",
13970       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13971
13972     {&hf_ieee80211_tag_measure_request_peer_mac_address,
13973      {"Peer MAC Address", "wlan_mgt.measure.req.peer_mac_address",
13974       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13975
13976     {&hf_ieee80211_tag_measure_request_group_id,
13977      {"Group ID", "wlan_mgt.measure.req.groupid",
13978       FT_UINT8, BASE_HEX, VALS(ieee80211_tag_measure_request_group_id_flags), 0, NULL, HFILL }},
13979
13980     {&hf_ieee80211_tag_measure_report_measurement_token,
13981      {"Measurement Token", "wlan_mgt.measure.req.token",
13982       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13983
13984     {&hf_ieee80211_tag_measure_report_mode,
13985      {"Measurement Report Mode", "wlan_mgt.measure.req.mode",
13986       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13987
13988     {&hf_ieee80211_tag_measure_report_mode_late,
13989      {"Measurement Report Mode Field", "wlan_mgt.measure.rep.repmode.late",
13990       FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x01, NULL, HFILL }},
13991
13992     {&hf_ieee80211_tag_measure_report_mode_incapable,
13993      {"Measurement Reports", "wlan_mgt.measure.rep.repmode.incapable",
13994       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x02, NULL, HFILL }},
13995
13996     {&hf_ieee80211_tag_measure_report_mode_refused,
13997      {"Autonomous Measurement Reports", "wlan_mgt.measure.rep.repmode.refused",
13998       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x04, NULL, HFILL }},
13999
14000     {&hf_ieee80211_tag_measure_report_mode_reserved,
14001      {"Reserved", "wlan_mgt.measure.rep.repmode.reserved",
14002       FT_UINT8, BASE_HEX, NULL, 0xf8, NULL, HFILL }},
14003
14004     {&hf_ieee80211_tag_measure_report_type,
14005      {"Measurement Report Type", "wlan_mgt.measure.rep.reptype",
14006       FT_UINT8, BASE_HEX, VALS (&ieee80211_tag_measure_report_type_flags), 0x00, NULL, HFILL }},
14007
14008     {&hf_ieee80211_tag_measure_report_channel_number,
14009      {"Measurement Channel Number", "wlan_mgt.measure.rep.channelnumber",
14010       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14011
14012     {&hf_ieee80211_tag_measure_report_start_time,
14013      {"Measurement Start Time", "wlan_mgt.measure.rep.starttime",
14014       FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL }},
14015
14016     {&hf_ieee80211_tag_measure_report_duration,
14017      {"Measurement Duration", "wlan_mgt.measure.rep.channelnumber",
14018       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
14019
14020     {&hf_ieee80211_tag_measure_cca_busy_fraction,
14021      {"CCA Busy Fraction", "wlan_mgt.measure.rep.ccabusy",
14022       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14023
14024     {&hf_ieee80211_tag_measure_basic_map_field,
14025      {"Map Field", "wlan_mgt.measure.rep.mapfield",
14026       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14027
14028     {&hf_ieee80211_tag_measure_map_field_bss,
14029      {"BSS", "wlan_mgt.measure.rep.repmode.mapfield.bss",
14030       FT_BOOLEAN, 8, TFS (&ieee80211_tag_measure_map_field_bss_flag), 0x01, NULL, HFILL }},
14031
14032     {&hf_ieee80211_tag_measure_map_field_odfm,
14033      {"Orthogonal Frequency Division Multiplexing (ODFM) Preamble", "wlan_mgt.measure.rep.repmode.mapfield.bss",
14034       FT_BOOLEAN, 8, TFS (&tfs_detected_not_detected), 0x02, NULL, HFILL }},
14035
14036     {&hf_ieee80211_tag_measure_map_field_unident_signal,
14037      {"Unidentified Signal", "wlan_mgt.measure.rep.repmode.mapfield.unidentsig",
14038       FT_BOOLEAN, 8, TFS (&tfs_detected_not_detected), 0x04, NULL, HFILL }},
14039
14040     {&hf_ieee80211_tag_measure_map_field_radar,
14041      {"Radar", "wlan_mgt.measure.rep.repmode.mapfield.radar",
14042       FT_BOOLEAN, 8, TFS (&tfs_detected_not_detected), 0x08, NULL, HFILL }},
14043
14044     {&hf_ieee80211_tag_measure_map_field_unmeasured,
14045      {"Unmeasured", "wlan_mgt.measure.rep.repmode.mapfield.unmeasured",
14046       FT_BOOLEAN, 8, TFS (&tfs_true_false), 0x10, NULL, HFILL }},
14047
14048     {&hf_ieee80211_tag_measure_map_field_reserved,
14049      {"Reserved", "wlan_mgt.measure.rep.repmode.mapfield.reserved",
14050       FT_UINT8, BASE_HEX, NULL, 0xe0, NULL, HFILL }},
14051
14052     {&hf_ieee80211_tag_measure_rpi_histogram_report,
14053      {"Receive Power Indicator (RPI) Histogram Report", "wlan_mgt.measure.rep.rpi.histogram_report",
14054       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14055
14056     {&hf_ieee80211_tag_measure_rpi_histogram_report_0,
14057      {"RPI 0 Density", "wlan_mgt.measure.rep.rpi.rpi0density",
14058       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 0 Density", HFILL }},
14059
14060     {&hf_ieee80211_tag_measure_rpi_histogram_report_1,
14061      {"RPI 1 Density", "wlan_mgt.measure.rep.rpi.rpi1density",
14062       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 1 Density", HFILL }},
14063
14064     {&hf_ieee80211_tag_measure_rpi_histogram_report_2,
14065      {"RPI 2 Density", "wlan_mgt.measure.rep.rpi.rpi2density",
14066       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 2 Density", HFILL }},
14067
14068     {&hf_ieee80211_tag_measure_rpi_histogram_report_3,
14069      {"RPI 3 Density", "wlan_mgt.measure.rep.rpi.rpi3density",
14070       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 3 Density", HFILL }},
14071
14072     {&hf_ieee80211_tag_measure_rpi_histogram_report_4,
14073      {"RPI 4 Density", "wlan_mgt.measure.rep.rpi.rpi4density",
14074       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 4 Density", HFILL }},
14075
14076     {&hf_ieee80211_tag_measure_rpi_histogram_report_5,
14077      {"RPI 5 Density", "wlan_mgt.measure.rep.rpi.rpi5density",
14078       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 5 Density", HFILL }},
14079
14080     {&hf_ieee80211_tag_measure_rpi_histogram_report_6,
14081      {"RPI 6 Density", "wlan_mgt.measure.rep.rpi.rpi6density",
14082       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 6 Density", HFILL }},
14083
14084     {&hf_ieee80211_tag_measure_rpi_histogram_report_7,
14085      {"RPI 7 Density", "wlan_mgt.measure.rep.rpi.rpi7density",
14086       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 7 Density", HFILL }},
14087
14088     {&hf_ieee80211_tag_measure_report_regulatory_class,
14089      {"Regulatory Class", "wlan_mgt.measure.rep.regclass",
14090       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14091
14092     {&hf_ieee80211_tag_measure_report_channel_load,
14093      {"Channel Load", "wlan_mgt.measure.rep.chanload",
14094       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14095
14096     {&hf_ieee80211_tag_measure_report_frame_info,
14097      {"Reported Frame Information", "wlan_mgt.measure.rep.frameinfo",
14098       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14099
14100     {&hf_ieee80211_tag_measure_report_frame_info_phy_type,
14101      {"Condensed PHY", "wlan_mgt.measure.rep.frameinfo.phytype",
14102       FT_UINT8, BASE_HEX, NULL, 0x7F, NULL, HFILL }},
14103
14104     {&hf_ieee80211_tag_measure_report_frame_info_frame_type,
14105      {"Reported Frame Type", "wlan_mgt.measure.rep.frameinfo.frametype",
14106       FT_UINT8, BASE_HEX, TFS(&ieee80211_tag_measure_report_frame_info_frame_type_flag), 0x80, NULL, HFILL }},
14107
14108     {&hf_ieee80211_tag_measure_report_rcpi,
14109      {"Received Channel Power Indicator (RCPI)", "wlan_mgt.measure.rep.rcpi",
14110       FT_UINT8, BASE_HEX, NULL, 0, "in dBm", HFILL }},
14111
14112     {&hf_ieee80211_tag_measure_report_rsni,
14113      {"Received Signal to Noise Indicator (RSNI)", "wlan_mgt.measure.rep.rsni",
14114       FT_UINT8, BASE_HEX, NULL, 0, "in dB", HFILL }},
14115
14116     {&hf_ieee80211_tag_measure_report_bssid,
14117      {"BSSID Being Reported", "wlan_mgt.measure.rep.bssid",
14118       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
14119
14120     {&hf_ieee80211_tag_measure_report_ant_id,
14121      {"Antenna ID", "wlan_mgt.measure.rep.antid",
14122       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14123
14124     {&hf_ieee80211_tag_measure_report_anpi,
14125      {"ANPI", "wlan_mgt.measure.rep.anpi",
14126       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14127
14128     {&hf_ieee80211_tag_measure_report_ipi_density_0,
14129      {"IPI Density 0", "wlan_mgt.measure.rep.ipi_density0",
14130       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14131
14132     {&hf_ieee80211_tag_measure_report_ipi_density_1,
14133      {"IPI Density 1", "wlan_mgt.measure.rep.ipi_density1",
14134       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14135
14136     {&hf_ieee80211_tag_measure_report_ipi_density_2,
14137      {"IPI Density 2", "wlan_mgt.measure.rep.ipi_density2",
14138       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14139
14140     {&hf_ieee80211_tag_measure_report_ipi_density_3,
14141      {"IPI Density 3", "wlan_mgt.measure.rep.ipi_density3",
14142       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14143
14144     {&hf_ieee80211_tag_measure_report_ipi_density_4,
14145      {"IPI Density 4", "wlan_mgt.measure.rep.ipi_density4",
14146       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14147
14148     {&hf_ieee80211_tag_measure_report_ipi_density_5,
14149      {"IPI Density 5", "wlan_mgt.measure.rep.ipi_density5",
14150       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14151
14152     {&hf_ieee80211_tag_measure_report_ipi_density_6,
14153      {"IPI Density 6", "wlan_mgt.measure.rep.ipi_density6",
14154       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14155
14156     {&hf_ieee80211_tag_measure_report_ipi_density_7,
14157      {"IPI Density 7", "wlan_mgt.measure.rep.ipi_density7",
14158       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14159
14160      {&hf_ieee80211_tag_measure_report_ipi_density_8,
14161      {"IPI Density 8", "wlan_mgt.measure.rep.ipi_density8",
14162       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14163
14164     {&hf_ieee80211_tag_measure_report_ipi_density_9,
14165      {"IPI Density 9", "wlan_mgt.measure.rep.ipi_density9",
14166       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14167
14168     {&hf_ieee80211_tag_measure_report_ipi_density_10,
14169      {"IPI Density 10", "wlan_mgt.measure.rep.ipi_density10",
14170       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14171
14172     {&hf_ieee80211_tag_measure_report_parent_tsf,
14173      {"Parent Timing Synchronization Function (TSF)", "wlan_mgt.measure.rep.parenttsf",
14174       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
14175
14176     /* Table 7-35a-Capabilities field */
14177     {&hf_ieee80211_tag_extended_capabilities,
14178      {"Extended Capabilities", "wlan_mgt.extcap",
14179       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14180
14181     /* P802.11n/D6.0 */
14182     /* Extended Capability octet 0 */
14183     {&hf_ieee80211_tag_extended_capabilities_b0,
14184      {"20/40 BSS Coexistence Management Support", "wlan_mgt.extcap.infoexchange.b0",
14185       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0001, "HT Information Exchange Support", HFILL }},
14186
14187     /* P802.11p/D4.0 */
14188     {&hf_ieee80211_tag_extended_capabilities_b1,
14189      {"On-demand beacon", "wlan_mgt.extcap.infoexchange.b1",
14190       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0002, NULL, HFILL }},
14191
14192     {&hf_ieee80211_tag_extended_capabilities_b2,
14193      {"Extended Channel Switching", "wlan_mgt.extcap.infoexchange.b2",
14194       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0004, NULL, HFILL }},
14195
14196     {&hf_ieee80211_tag_extended_capabilities_b3,
14197      {"WAVE indication", "wlan_mgt.extcap.infoexchange.b3",
14198       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0008, NULL, HFILL }},
14199     /*End: P802.11p/D4.0 */
14200
14201     {&hf_ieee80211_tag_extended_capabilities_b4,
14202      {"PSMP Capability", "wlan_mgt.extcap.infoexchange.b4",
14203       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0010, NULL, HFILL }},
14204
14205     {&hf_ieee80211_tag_extended_capabilities_b6,
14206      {"S-PSMP Support", "wlan_mgt.extcap.infoexchange.b6",
14207       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0040, NULL, HFILL }},
14208
14209     /* Extended Capability octet 3 */
14210     {&hf_ieee80211_tag_extended_capabilities_b28,
14211      {"Peer U-APSD Buffer STA Support", "wlan_mgt.extcap.infoexchange.b28",
14212       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0010, NULL, HFILL }},
14213
14214     {&hf_ieee80211_tag_extended_capabilities_b29,
14215      {"TDLS Peer PSM Support", "wlan_mgt.extcap.infoexchange.b29",
14216       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0020, NULL, HFILL }},
14217
14218     {&hf_ieee80211_tag_extended_capabilities_b30,
14219      {"TDLS channel switching", "wlan_mgt.extcap.infoexchange.b30",
14220       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0040, NULL, HFILL }},
14221
14222     /* Extended Capability octet 4 */
14223     {&hf_ieee80211_tag_extended_capabilities_b37,
14224      {"TDLS support", "wlan_mgt.extcap.infoexchange.b37",
14225       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0020, NULL, HFILL }},
14226
14227     {&hf_ieee80211_tag_extended_capabilities_b38,
14228      {"TDLS Prohibited", "wlan_mgt.extcap.infoexchange.b38",
14229       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0040, NULL, HFILL }},
14230
14231     {&hf_ieee80211_tag_extended_capabilities_b39,
14232      {"TDLS Channel Switching Prohibited", "wlan_mgt.extcap.infoexchange.b39",
14233       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0080, NULL, HFILL }},
14234
14235     /* Extended Capability octet 5 */
14236     {&hf_ieee80211_tag_extended_capabilities_b40,
14237      {"Reject Unadmitted Frame", "wlan_mgt.extcap.infoexchange.b40",
14238       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0001, NULL, HFILL }},
14239
14240     {&hf_ieee80211_tag_extended_capabilities_serv_int_granularity,
14241      {"Service Interval Granularity",
14242       "wlan_mgt.extcap.infoexchange.serv_int_granularity",
14243       FT_UINT8, BASE_NONE, VALS(service_interval_granularity_vals), 0x000e,
14244       NULL, HFILL }},
14245
14246     {&hf_ieee80211_tag_neighbor_report_bssid,
14247      {"BSSID", "wlan_mgt.nreport.bssid",
14248       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
14249
14250     {&hf_ieee80211_tag_neighbor_report_bssid_info,
14251      {"BSSID Information", "wlan_mgt.nreport.bssid.info",
14252       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
14253
14254     {&hf_ieee80211_tag_neighbor_report_bssid_info_reachability,
14255      {"AP Reachability", "wlan_mgt.nreport.bssid.info.reachability",
14256       FT_UINT16, BASE_HEX, NULL, 0x0003, NULL, HFILL }},
14257
14258     {&hf_ieee80211_tag_neighbor_report_bssid_info_security,
14259      {"Security", "wlan_mgt.nreport.bssid.info.security",
14260       FT_UINT16, BASE_HEX, NULL, 0x0004, NULL, HFILL }},
14261
14262     {&hf_ieee80211_tag_neighbor_report_bssid_info_key_scope,
14263      {"Key Scope", "wlan_mgt.nreport.bssid.info.keyscope",
14264       FT_UINT16, BASE_HEX, NULL, 0x0008, NULL, HFILL }},
14265
14266     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_spec_mng,
14267      {"Capability: Spectrum Management", "wlan_mgt.nreport.bssid.info.capability.specmngt",
14268       FT_UINT16, BASE_HEX, NULL, 0x0010, NULL, HFILL }},
14269
14270     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_qos,
14271      {"Capability: QoS", "wlan_mgt.nreport.bssid.info.capability.qos",
14272       FT_UINT16, BASE_HEX, NULL, 0x0020, NULL, HFILL }},
14273
14274     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_apsd,
14275      {"Capability: APSD", "wlan_mgt.nreport.bssid.info.capability.apsd",
14276       FT_UINT16, BASE_HEX, NULL, 0x0040, NULL, HFILL }},
14277
14278     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_radio_msnt,
14279      {"Capability: Radio Measurement", "wlan_mgt.nreport.bssid.info.capability.radiomsnt",
14280       FT_UINT16, BASE_HEX, NULL, 0x0080, NULL, HFILL }},
14281
14282     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_dback,
14283      {"Capability: Delayed Block Ack", "wlan_mgt.nreport.bssid.info.capability.dback",
14284       FT_UINT16, BASE_HEX, NULL, 0x0100, NULL, HFILL }},
14285
14286     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_iback,
14287      {"Capability: Immediate Block Ack", "wlan_mgt.nreport.bssid.info.capability.iback",
14288       FT_UINT16, BASE_HEX, NULL, 0x0200, NULL, HFILL }},
14289
14290     {&hf_ieee80211_tag_neighbor_report_bssid_info_mobility_domain,
14291      {"Mobility Domain", "wlan_mgt.nreport.bssid.info.mobilitydomain",
14292       FT_UINT16, BASE_HEX, NULL, 0x0400, NULL, HFILL }},
14293
14294     {&hf_ieee80211_tag_neighbor_report_bssid_info_high_throughput,
14295      {"High Throughput", "wlan_mgt.nreport.bssid.info.hthoughput",
14296       FT_UINT16, BASE_HEX, NULL, 0x0800, NULL, HFILL }},
14297
14298     {&hf_ieee80211_tag_neighbor_report_bssid_info_reserved,
14299      {"Reserved", "wlan_mgt.nreport.bssid.info.reserved",
14300       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
14301
14302     {&hf_ieee80211_tag_neighbor_report_reg_class,
14303      {"Regulatory Class", "wlan_mgt.nreport.regclass",
14304       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14305
14306     {&hf_ieee80211_tag_neighbor_report_channel_number,
14307      {"Channel Number", "wlan_mgt.nreport.channumber",
14308       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14309
14310     {&hf_ieee80211_tag_neighbor_report_phy_type,
14311      {"PHY Type", "wlan_mgt.nreport.phytype",
14312       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14313
14314     {&hf_ieee80211_tag_supported_reg_classes_current,
14315      {"Current Regulatory Class", "wlan_mgt.supregclass.current",
14316       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14317
14318     {&hf_ieee80211_tag_supported_reg_classes_alternate,
14319      {"Alternate Regulatory Classes", "wlan_mgt.supregclass.alt",
14320       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
14321
14322     {&hf_ieee80211_marvell_ie_type,
14323      {"Type", "wlan_mgt.marvell.ie.type",
14324       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14325
14326     {&hf_ieee80211_marvell_ie_mesh_subtype,
14327      {"Subtype", "wlan_mgt.marvell.ie.subtype",
14328       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14329
14330     {&hf_ieee80211_marvell_ie_mesh_version,
14331      {"Version", "wlan_mgt.marvell.ie.version",
14332       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14333
14334     {&hf_ieee80211_marvell_ie_mesh_active_proto_id,
14335      {"Path Selection Protocol", "wlan_mgt.marvell.ie.proto_id",
14336       FT_UINT8, BASE_HEX, VALS(mesh_path_selection_codes), 0, NULL, HFILL }},
14337
14338     {&hf_ieee80211_marvell_ie_mesh_active_metric_id,
14339      {"Path Selection Metric", "wlan_mgt.marvell.ie.metric_id",
14340       FT_UINT8, BASE_HEX, VALS(mesh_metric_codes), 0, NULL, HFILL }},
14341
14342     {&hf_ieee80211_marvell_ie_mesh_cap,
14343      {"Mesh Capabilities", "wlan_mgt.marvell.ie.cap",
14344       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14345
14346     {&hf_ieee80211_marvell_ie_data,
14347       { "Marvell IE data", "wlan_mgt.marvell.data",
14348         FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
14349
14350     {&hf_ieee80211_atheros_ie_type,
14351      {"Type", "wlan_mgt.atheros.ie.type",
14352       FT_UINT8, BASE_HEX, VALS(atheros_ie_type_vals), 0, NULL, HFILL }},
14353
14354     {&hf_ieee80211_atheros_ie_subtype,
14355      {"Subtype", "wlan_mgt.atheros.ie.subtype",
14356       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14357
14358     {&hf_ieee80211_atheros_ie_version,
14359      {"Version", "wlan_mgt.atheros.ie.version",
14360       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14361
14362     {&hf_ieee80211_atheros_ie_cap_f_turbop,
14363      {"Turbo Prime", "wlan_mgt.ie.atheros.capabilities.turbop",
14364       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_TURBOP, NULL, HFILL }},
14365
14366     {&hf_ieee80211_atheros_ie_cap_f_comp,
14367      {"Compression", "wlan_mgt.ie.atheros.capabilities.comp",
14368       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_COMP, NULL, HFILL }},
14369
14370     {&hf_ieee80211_atheros_ie_cap_f_ff,
14371      {"Fast Frames", "wlan_mgt.ie.atheros.capabilities.ff",
14372       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_FF, NULL, HFILL }},
14373
14374     {&hf_ieee80211_atheros_ie_cap_f_xr,
14375      {"eXtended Range", "wlan_mgt.ie.atheros.capabilities.xr",
14376       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_XR, NULL, HFILL }},
14377
14378     {&hf_ieee80211_atheros_ie_cap_f_ar,
14379      {"Advanced Radar", "wlan_mgt.ie.atheros.capabilities.ar",
14380       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_AR, NULL, HFILL }},
14381
14382     {&hf_ieee80211_atheros_ie_cap_f_burst,
14383      {"Burst", "wlan_mgt.ie.atheros.capabilities.burst",
14384       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_BURST, NULL, HFILL }},
14385
14386     {&hf_ieee80211_atheros_ie_cap_f_wme,
14387      {"CWMin tuning", "wlan_mgt.ie.atheros.capabilities.wme",
14388       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_WME, NULL, HFILL }},
14389
14390     {&hf_ieee80211_atheros_ie_cap_f_boost,
14391      {"Boost", "wlan_mgt.ie.atheros.capabilities.boost",
14392       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_BOOST, NULL, HFILL }},
14393
14394     {&hf_ieee80211_atheros_ie_advcap_cap,
14395      {"Capabilities", "wlan_mgt.atheros.ie.advcap.cap",
14396       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14397
14398     {&hf_ieee80211_atheros_ie_advcap_defkey,
14399      {"Default key index", "wlan_mgt.atheros.ie.advcap.defkey",
14400       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
14401
14402     {&hf_ieee80211_atheros_ie_xr_info,
14403      {"Info", "wlan_mgt.atheros.ie.xr.info",
14404       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14405
14406     {&hf_ieee80211_atheros_ie_xr_base_bssid,
14407      {"Base BSS Id", "wlan_mgt.atheros.ie.xr.base_bssid",
14408       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
14409
14410     {&hf_ieee80211_atheros_ie_xr_xr_bssid,
14411      {"XR BSS Id", "wlan_mgt.atheros.ie.xr.xr_bssid",
14412       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
14413
14414     {&hf_ieee80211_atheros_ie_xr_xr_beacon,
14415      {"XR Beacon Interval", "wlan_mgt.atheros.ie.xr.xr_beacon",
14416       FT_UINT32, BASE_CUSTOM, beacon_interval_base_custom, 0, NULL, HFILL }},
14417
14418     {&hf_ieee80211_atheros_ie_xr_base_cap,
14419      {"Base capabilities", "wlan_mgt.atheros.ie.xr.base_cap",
14420       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14421
14422     {&hf_ieee80211_atheros_ie_xr_xr_cap,
14423      {"XR capabilities", "wlan_mgt.atheros.ie.xr.xr_cap",
14424       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14425
14426     {&hf_ieee80211_atheros_ie_data,
14427      {"Atheros IE data", "wlan_mgt.atheros.data",
14428       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14429
14430     {&hf_ieee80211_aironet_ie_type,
14431      {"Aironet IE type", "wlan_mgt.aironet.type",
14432       FT_UINT8, BASE_DEC, VALS(aironet_ie_type_vals), 0, NULL, HFILL }},
14433
14434     {&hf_ieee80211_aironet_ie_version,
14435      {"Aironet IE CCX version?", "wlan_mgt.aironet.version",
14436       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14437
14438     {&hf_ieee80211_aironet_ie_data,
14439       { "Aironet IE data", "wlan_mgt.aironet.data",
14440         FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
14441
14442     {&hf_ieee80211_qbss_version,
14443      {"QBSS Version", "wlan_mgt.qbss.version",
14444       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14445
14446     {&hf_ieee80211_qbss_scount,
14447      {"Station Count", "wlan_mgt.qbss.scount",
14448       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
14449
14450     {&hf_ieee80211_qbss_cu,
14451      {"Channel Utilization", "wlan_mgt.qbss.cu",
14452        FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14453
14454     {&hf_ieee80211_qbss_adc,
14455      {"Available Admission Capabilities", "wlan_mgt.qbss.adc",
14456      FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14457
14458     {&hf_ieee80211_qbss2_cu,
14459      {"Channel Utilization", "wlan_mgt.qbss2.cu",
14460        FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14461
14462     {&hf_ieee80211_qbss2_gl,
14463      {"G.711 CU Quantum", "wlan_mgt.qbss2.glimit",
14464       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14465
14466     {&hf_ieee80211_qbss2_cal,
14467      {"Call Admission Limit", "wlan_mgt.qbss2.cal",
14468       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14469
14470     {&hf_ieee80211_qbss2_scount,
14471      {"Station Count", "wlan_mgt.qbss2.scount",
14472       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
14473
14474     {&hf_ieee80211_aironet_ie_qos_unk1,
14475      {"Aironet IE QoS unknown 1", "wlan_mgt.aironet.qos.unk1",
14476       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14477
14478     {&hf_ieee80211_aironet_ie_qos_paramset,
14479      {"Aironet IE QoS paramset", "wlan_mgt.aironet.qos.paramset",
14480       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14481
14482     {&hf_ieee80211_aironet_ie_qos_val,
14483      {"Aironet IE QoS valueset", "wlan_mgt.aironet.qos.val",
14484       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14485
14486     {&hf_ieee80211_tsinfo,
14487      {"Traffic Stream (TS) Info", "wlan_mgt.ts_info",
14488       FT_UINT24, BASE_HEX, NULL, 0, "Traffic Stream (TS) Info field", HFILL }},
14489
14490     {&hf_ieee80211_tsinfo_type,
14491      {"Traffic Type", "wlan_mgt.ts_info.type", FT_UINT24, BASE_DEC,
14492       VALS (&tsinfo_type), 0x000001, "Traffic Stream (TS) Info Traffic Type", HFILL }},
14493
14494     {&hf_ieee80211_tsinfo_tsid,
14495      {"Traffic Stream ID (TSID)", "wlan_mgt.ts_info.tsid",
14496       FT_UINT24, BASE_DEC, NULL, 0x00001E, "Traffic Stream ID (TSID) Info TSID", HFILL }},
14497
14498     {&hf_ieee80211_tsinfo_dir,
14499      {"Direction", "wlan_mgt.ts_info.dir", FT_UINT24, BASE_DEC,
14500       VALS (&tsinfo_direction), 0x000060, "Traffic Stream (TS) Info Direction", HFILL }},
14501
14502     {&hf_ieee80211_tsinfo_access,
14503      {"Access Policy", "wlan_mgt.ts_info.dir", FT_UINT24, BASE_DEC,
14504       VALS (&tsinfo_access), 0x000180, "Traffic Stream (TS) Info Access Policy", HFILL }},
14505
14506     {&hf_ieee80211_tsinfo_agg,
14507      {"Aggregation", "wlan_mgt.ts_info.agg", FT_UINT24, BASE_DEC,
14508       NULL, 0x000200, "Traffic Stream (TS) Info Access Policy", HFILL }},
14509
14510     {&hf_ieee80211_tsinfo_apsd,
14511      {"Automatic Power-Save Delivery (APSD)", "wlan_mgt.ts_info.apsd", FT_UINT24, BASE_DEC,
14512       NULL, 0x000400, "Traffic Stream (TS) Info Automatic Power-Save Delivery (APSD)", HFILL }},
14513
14514     {&hf_ieee80211_tsinfo_up,
14515      {"User Priority", "wlan_mgt.ts_info.up", FT_UINT24, BASE_DEC,
14516       VALS (&qos_up), 0x003800, "Traffic Stream (TS) Info User Priority", HFILL }},
14517
14518     {&hf_ieee80211_tsinfo_ack,
14519      {"Ack Policy", "wlan_mgt.ts_info.ack", FT_UINT24, BASE_DEC,
14520       VALS (&ack_policy), 0x00C000, "Traffic Stream (TS) Info Ack Policy", HFILL }},
14521
14522     {&hf_ieee80211_tsinfo_sched,
14523      {"Schedule", "wlan_mgt.ts_info.sched", FT_UINT24, BASE_DEC,
14524       NULL, 0x010000, "Traffic Stream (TS) Info Schedule", HFILL }},
14525
14526     {&hf_ieee80211_tsinfo_rsv,
14527      {"Reserved", "wlan_mgt.ts_info.rsv", FT_UINT24, BASE_HEX,
14528       NULL, 0xFE0000, "Must be Zero", HFILL }},
14529
14530     {&hf_ieee80211_tspec_nor_msdu,
14531      {"Normal MSDU Size", "wlan_mgt.tspec.nor_msdu",
14532       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
14533
14534     {&hf_ieee80211_tspec_max_msdu,
14535      {"Maximum MSDU Size", "wlan_mgt.tspec.max_msdu",
14536       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
14537
14538     {&hf_ieee80211_tspec_min_srv,
14539      {"Minimum Service Interval", "wlan_mgt.tspec.min_srv",
14540       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14541
14542     {&hf_ieee80211_tspec_max_srv,
14543      {"Maximum Service Interval", "wlan_mgt.tspec.max_srv",
14544       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14545
14546     {&hf_ieee80211_tspec_inact_int,
14547      {"Inactivity Interval", "wlan_mgt.tspec.inact_int",
14548       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14549
14550     {&hf_ieee80211_tspec_susp_int,
14551      {"Suspension Interval", "wlan_mgt.tspec.susp_int",
14552       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14553
14554     {&hf_ieee80211_tspec_srv_start,
14555      {"Service Start Time", "wlan_mgt.tspec.srv_start",
14556       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14557
14558     {&hf_ieee80211_tspec_min_data,
14559      {"Minimum Data Rate", "wlan_mgt.tspec.min_data",
14560       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14561
14562     {&hf_ieee80211_tspec_mean_data,
14563      {"Mean Data Rate", "wlan_mgt.tspec.mean_data",
14564       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14565
14566     {&hf_ieee80211_tspec_peak_data,
14567      {"Peak Data Rate", "wlan_mgt.tspec.peak_data",
14568       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14569
14570     {&hf_ieee80211_tspec_burst_size,
14571      {"Burst Size", "wlan_mgt.tspec.burst_size",
14572       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14573
14574     {&hf_ieee80211_tspec_delay_bound,
14575      {"Delay Bound", "wlan_mgt.tspec.delay_bound",
14576       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14577
14578     {&hf_ieee80211_tspec_min_phy,
14579      {"Minimum PHY Rate", "wlan_mgt.tspec.min_phy",
14580       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14581
14582     {&hf_ieee80211_tspec_surplus,
14583      {"Surplus Bandwidth Allowance", "wlan_mgt.tspec.surplus",
14584       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
14585
14586     {&hf_ieee80211_tspec_medium,
14587      {"Medium Time", "wlan_mgt.tspec.medium",
14588       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
14589
14590     {&hf_ieee80211_ts_delay,
14591      {"Traffic Stream (TS) Delay", "wlan_mgt.ts_delay",
14592       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14593
14594     {&hf_ieee80211_tclass_process,
14595      {"Processing", "wlan_mgt.tclas_proc.processing", FT_UINT8, BASE_DEC,
14596       VALS (tclas_process), 0, "TCLAS Processing", HFILL }},
14597
14598     {&hf_ieee80211_sched_info,
14599      {"Schedule Info", "wlan_mgt.sched.sched_info",
14600       FT_UINT16, BASE_HEX, NULL, 0, "Schedule Info field", HFILL }},
14601
14602     {&hf_ieee80211_sched_info_agg,
14603      {"Schedule Aggregation", "wlan_mgt.sched_info.agg", FT_UINT16, BASE_DEC,
14604       NULL, 0x0001, "Traffic Stream (TS) Info Access Policy", HFILL }},
14605
14606     {&hf_ieee80211_sched_info_tsid,
14607      {"Schedule Traffic Stream ID (TSID)", "wlan_mgt.sched_info.tsid",
14608       FT_UINT16, BASE_DEC, NULL, 0x001E, "Traffic Stream ID (TSID) Info TSID", HFILL }},
14609
14610     {&hf_ieee80211_sched_info_dir,
14611      {"Schedule Direction", "wlan_mgt.sched_info.dir", FT_UINT16, BASE_DEC,
14612       VALS (&tsinfo_direction), 0x0060, "Traffic Stream (TS) Info Direction", HFILL }},
14613
14614     {&hf_ieee80211_sched_srv_start,
14615      {"Service Start Time", "wlan_mgt.sched.srv_start",
14616       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
14617
14618     {&hf_ieee80211_sched_srv_int,
14619      {"Service Interval", "wlan_mgt.sched.srv_int",
14620       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
14621
14622     {&hf_ieee80211_sched_spec_int,
14623      {"Specification Interval", "wlan_mgt.sched.spec_int",
14624       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
14625
14626     {&hf_ieee80211_action,
14627      {"Action", "wlan_mgt.fixed.action",
14628       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14629
14630
14631     {&hf_ieee80211_aruba,
14632      {"Aruba Type", "wlan_mgt.aruba.type",
14633       FT_UINT16, BASE_DEC, VALS(aruba_mgt_typevals), 0, "Aruba Management", HFILL }},
14634
14635     {&hf_ieee80211_aruba_hb_seq,
14636      {"Aruba Heartbeat Sequence", "wlan_mgt.aruba.heartbeat_sequence",
14637       FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
14638
14639     {&hf_ieee80211_aruba_mtu,
14640      {"Aruba MTU Size", "wlan_mgt.aruba.mtu_size",
14641       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
14642
14643     /* Start: HT Control (+HTC) */
14644     {&hf_ieee80211_htc,
14645      {"HT Control (+HTC)", "wlan_mgt.htc",
14646       FT_UINT32, BASE_HEX, NULL, 0, "High Throughput Control (+HTC)", HFILL }},
14647     {&hf_ieee80211_htc_lac,
14648      {"Link Adaptation Control (LAC)", "wlan_mgt.htc.lac",
14649       FT_UINT16, BASE_HEX, NULL, 0, "High Throughput Control Link Adaptation Control (LAC)", HFILL }},
14650     {&hf_ieee80211_htc_lac_reserved,
14651      {"Reserved", "wlan_mgt.htc.lac.reserved",
14652       FT_BOOLEAN, 16, NULL, 0x0001, "High Throughput Control Link Adaptation Control Reserved", HFILL }},
14653     {&hf_ieee80211_htc_lac_trq,
14654      {"Training Request (TRQ)", "wlan_mgt.htc.lac.trq",
14655       FT_BOOLEAN, 16, TFS(&htc_lac_trq_flag), 0x0002, "High Throughput Control Link Adaptation Control Training Request (TRQ)", HFILL }},
14656     {&hf_ieee80211_htc_lac_mai_aseli,
14657      {"Antenna Selection Indication (ASELI)", "wlan_mgt.htc.lac.mai.aseli",
14658       FT_UINT16, BASE_HEX, NULL, 0x003C, "High Throughput Control Link Adaptation Control MAI Antenna Selection Indication", HFILL }},
14659     {&hf_ieee80211_htc_lac_mai_mrq,
14660      {"MCS Request (MRQ)", "wlan_mgt.htc.lac.mai.mrq",
14661       FT_BOOLEAN, 16, TFS(&htc_lac_mai_mrq_flag), 0x0004, "High Throughput Control Link Adaptation Control MAI MCS Request", HFILL }},
14662     {&hf_ieee80211_htc_lac_mai_msi,
14663      {"MCS Request Sequence Identifier (MSI)", "wlan_mgt.htc.lac.mai.msi",
14664       FT_UINT16, BASE_HEX, NULL, 0x0038, "High Throughput Control Link Adaptation Control MAI MCS Request Sequence Identifier", HFILL }},
14665     {&hf_ieee80211_htc_lac_mai_reserved,
14666      {"Reserved", "wlan_mgt.htc.lac.mai.reserved",
14667       FT_UINT16, BASE_HEX, NULL, 0x0038, "High Throughput Control Link Adaptation Control MAI Reserved", HFILL }},
14668     {&hf_ieee80211_htc_lac_mfsi,
14669      {"MCS Feedback Sequence Identifier (MFSI)", "wlan_mgt.htc.lac.mfsi",
14670       FT_UINT16, BASE_DEC, NULL, 0x01C0, "High Throughput Control Link Adaptation Control MCS Feedback Sequence Identifier (MSI)", HFILL }},
14671     {&hf_ieee80211_htc_lac_asel_command,
14672      {"Antenna Selection (ASEL) Command", "wlan_mgt.htc.lac.asel.command",
14673       FT_UINT16, BASE_HEX, VALS (&ieee80211_htc_lac_asel_command_flags), 0x0E00, "High Throughput Control Link Adaptation Control Antenna Selection (ASEL) Command", HFILL }},
14674     {&hf_ieee80211_htc_lac_asel_data,
14675      {"Antenna Selection (ASEL) Data", "wlan_mgt.htc.lac.asel.data",
14676       FT_UINT16, BASE_HEX, NULL, 0xF000, "High Throughput Control Link Adaptation Control Antenna Selection (ASEL) Data", HFILL }},
14677     {&hf_ieee80211_htc_lac_mfb,
14678      {"MCS Feedback (MFB)", "wlan_mgt.htc.lac.mfb",
14679       FT_UINT16, BASE_HEX, NULL, 0xFE00, "High Throughput Control Link Adaptation Control MCS Feedback", HFILL }},
14680     {&hf_ieee80211_htc_cal_pos,
14681      {"Calibration Position", "wlan_mgt.htc.cal.pos",
14682       FT_UINT16, BASE_DEC, VALS (&ieee80211_htc_cal_pos_flags), 0x0003, "High Throughput Control Calibration Position", HFILL }},
14683     {&hf_ieee80211_htc_cal_seq,
14684      {"Calibration Sequence Identifier", "wlan_mgt.htc.cal.seq",
14685       FT_UINT16, BASE_DEC, NULL, 0x000C, "High Throughput Control Calibration Sequence Identifier", HFILL }},
14686     {&hf_ieee80211_htc_reserved1,
14687      {"Reserved", "wlan_mgt.htc.reserved1",
14688       FT_UINT16, BASE_DEC, NULL, 0x0030, "High Throughput Control Reserved", HFILL }},
14689     {&hf_ieee80211_htc_csi_steering,
14690      {"CSI/Steering", "wlan_mgt.htc.csi_steering",
14691       FT_UINT16, BASE_DEC, VALS (&ieee80211_htc_csi_steering_flags), 0x00C0, "High Throughput Control CSI/Steering", HFILL }},
14692     {&hf_ieee80211_htc_ndp_announcement,
14693      {"NDP Announcement", "wlan_mgt.htc.ndp_announcement",
14694       FT_BOOLEAN, 16, TFS(&ieee80211_htc_ndp_announcement_flag), 0x0100, "High Throughput Control NDP Announcement", HFILL }},
14695     {&hf_ieee80211_htc_reserved2,
14696      {"Reserved", "wlan_mgt.htc.reserved2",
14697       FT_UINT16, BASE_HEX, NULL, 0x3E00, "High Throughput Control Reserved", HFILL }},
14698     {&hf_ieee80211_htc_ac_constraint,
14699      {"AC Constraint", "wlan_mgt.htc.ac_constraint",
14700       FT_BOOLEAN, 16, NULL, 0x4000, "High Throughput Control AC Constraint", HFILL }},
14701     {&hf_ieee80211_htc_rdg_more_ppdu,
14702      {"RDG/More PPDU", "wlan_mgt.htc.rdg_more_ppdu",
14703       FT_BOOLEAN, 16, NULL, 0x8000, "High Throughput Control RDG/More PPDU", HFILL }},
14704     /* End: HT Control (+HTC) */
14705
14706     /* MDIE */
14707     {&hf_ieee80211_tag_mobility_domain_mdid,
14708      {"Mobility Domain Identifier", "wlan_mgt.mobility_domain.mdid",
14709       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
14710     {&hf_ieee80211_tag_mobility_domain_ft_capab,
14711      {"FT Capability and Policy", "wlan_mgt.mobility_domain.ft_capab",
14712       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14713     {&hf_ieee80211_tag_mobility_domain_ft_capab_ft_over_ds,
14714      {"Fast BSS Transition over DS",
14715       "wlan_mgt.mobility_domain.ft_capab.ft_over_ds",
14716       FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL }},
14717     {&hf_ieee80211_tag_mobility_domain_ft_capab_resource_req,
14718      {"Resource Request Protocol Capability",
14719       "wlan_mgt.mobility_domain.ft_capab.resource_req",
14720       FT_UINT8, BASE_HEX, NULL, 0x02, NULL, HFILL }},
14721
14722     /* FTIE */
14723     {&hf_ieee80211_tag_ft_mic_control,
14724      {"MIC Control", "wlan_mgt.ft.mic_control",
14725       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
14726     {&hf_ieee80211_tag_ft_element_count,
14727      {"Element Count", "wlan_mgt.ft.element_count",
14728       FT_UINT16, BASE_DEC, NULL, 0xff00, NULL, HFILL }},
14729     {&hf_ieee80211_tag_ft_mic,
14730      {"MIC", "wlan_mgt.ft.mic",
14731       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14732     {&hf_ieee80211_tag_ft_anonce,
14733      {"ANonce", "wlan_mgt.ft.anonce",
14734       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14735     {&hf_ieee80211_tag_ft_snonce,
14736      {"SNonce", "wlan_mgt.ft.snonce",
14737       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14738     {&hf_ieee80211_tag_ft_subelem_id,
14739      {"Subelement ID", "wlan_mgt.ft.subelem.id",
14740       FT_UINT8, BASE_DEC, VALS(ft_subelem_id_vals), 0, NULL, HFILL }},
14741     {&hf_ieee80211_tag_ft_subelem_len,
14742      {"Length", "wlan_mgt.ft.subelem.len",
14743       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14744     {&hf_ieee80211_tag_ft_subelem_data,
14745      {"Data", "wlan_mgt.ft.subelem.data",
14746       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14747     {&hf_ieee80211_tag_ft_subelem_r1kh_id,
14748      {"PMK-R1 key holder identifier (R1KH-ID)", "wlan_mgt.ft.subelem.r1kh_id",
14749       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14750     {&hf_ieee80211_tag_ft_subelem_gtk_key_info,
14751      {"Key Info", "wlan_mgt.ft.subelem.gtk.key_info",
14752       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
14753     {&hf_ieee80211_tag_ft_subelem_gtk_key_id,
14754      {"Key ID", "wlan_mgt.ft.subelem.gtk.key_id",
14755       FT_UINT16, BASE_DEC, NULL, 0x0003, NULL, HFILL }},
14756     {&hf_ieee80211_tag_ft_subelem_gtk_key_length,
14757      {"Key Length", "wlan_mgt.ft.subelem.gtk.key_length",
14758       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14759     {&hf_ieee80211_tag_ft_subelem_gtk_rsc,
14760      {"RSC", "wlan_mgt.ft.subelem.gtk.rsc",
14761       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14762     {&hf_ieee80211_tag_ft_subelem_gtk_key,
14763      {"GTK", "wlan_mgt.ft.subelem.gtk.key",
14764       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14765     {&hf_ieee80211_tag_ft_subelem_r0kh_id,
14766      {"PMK-R0 key holder identifier (R0KH-ID)", "wlan_mgt.ft.subelem.r0kh_id",
14767       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
14768     {&hf_ieee80211_tag_ft_subelem_igtk_key_id,
14769      {"Key ID", "wlan_mgt.ft.subelem.igtk.key_id",
14770       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
14771     {&hf_ieee80211_tag_ft_subelem_igtk_ipn,
14772      {"IPN", "wlan_mgt.ft.subelem.igtk.ipn",
14773       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14774     {&hf_ieee80211_tag_ft_subelem_igtk_key_length,
14775      {"Key Length", "wlan_mgt.ft.subelem.igtk.key_length",
14776       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14777     {&hf_ieee80211_tag_ft_subelem_igtk_key,
14778      {"Wrapped Key (IGTK)", "wlan_mgt.ft.subelem.igtk.key",
14779       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14780
14781     /* MMIE */
14782     {&hf_ieee80211_tag_mmie_keyid,
14783      {"KeyID", "wlan_mgt.mmie.keyid",
14784       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
14785     {&hf_ieee80211_tag_mmie_ipn,
14786      {"IPN", "wlan_mgt.mmie.ipn",
14787       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14788     {&hf_ieee80211_tag_mmie_mic,
14789      {"MIC", "wlan_mgt.mmie.mic",
14790       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14791
14792     /* Advertisement Protocol */
14793     {&hf_ieee80211_tag_adv_proto_resp_len_limit,
14794      {"Query Response Length Limit", "wlan_mgt.adv_proto.resp_len_limit",
14795       FT_UINT8, BASE_DEC, NULL, 0x7f, NULL, HFILL }},
14796     {&hf_ieee80211_tag_adv_proto_pame_bi,
14797      {"PAME-BI", "wlan_mgt.adv_proto.pame_bi",
14798       FT_UINT8, BASE_DEC, NULL, 0x80,
14799       "Pre-Association Message Xchange BSSID Independent (PAME-BI)", HFILL }},
14800     {&hf_ieee80211_tag_adv_proto_id,
14801      {"Advertisement Protocol ID", "wlan_mgt.adv_proto.id",
14802       FT_UINT8, BASE_DEC, VALS(adv_proto_id_vals), 0, NULL, HFILL }},
14803
14804     /* Timeout Interval */
14805     {&hf_ieee80211_tag_timeout_int_type,
14806      {"Timeout Interval Type", "wlan_mgt.timeout_int.type",
14807       FT_UINT8, BASE_DEC, VALS(timeout_int_types), 0, NULL, HFILL }},
14808     {&hf_ieee80211_tag_timeout_int_value,
14809      {"Timeout Interval Value", "wlan_mgt.timeout_int.value",
14810       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14811
14812     /* Link Identifier */
14813     {&hf_ieee80211_tag_link_id_bssid,
14814      {"BSSID", "wlan_mgt.link_id.bssid",
14815       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
14816     {&hf_ieee80211_tag_link_id_init_sta,
14817      {"TDLS initiator STA Address", "wlan_mgt.link_id.init_sta",
14818       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
14819     {&hf_ieee80211_tag_link_id_resp_sta,
14820      {"TDLS responder STA Address", "wlan_mgt.link_id.resp_sta",
14821       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
14822
14823     /* Wakeup Schedule */
14824     {&hf_ieee80211_tag_wakeup_schedule_offset,
14825      {"Offset", "wlan_mgt.wakeup_schedule.offset",
14826       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14827     {&hf_ieee80211_tag_wakeup_schedule_interval,
14828      {"Interval", "wlan_mgt.wakeup_schedule.interval",
14829       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14830     {&hf_ieee80211_tag_wakeup_schedule_awake_window_slots,
14831      {"Awake Window Slots", "wlan_mgt.wakeup_schedule.awake_window_slots",
14832       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14833     {&hf_ieee80211_tag_wakeup_schedule_max_awake_dur,
14834      {"Maximum Awake Window Duration",
14835       "wlan_mgt.wakeup_schedule.max_awake_dur",
14836       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
14837     {&hf_ieee80211_tag_wakeup_schedule_idle_count,
14838      {"Idle Count", "wlan_mgt.wakeup_schedule.idle_count",
14839       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
14840
14841     /* Channel Switch Timing */
14842     {&hf_ieee80211_tag_channel_switch_timing_switch_time,
14843      {"Switch Time", "wlan_mgt.channel_switch_timing.switch_time",
14844       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
14845     {&hf_ieee80211_tag_channel_switch_timing_switch_timeout,
14846      {"Switch Timeout", "wlan_mgt.channel_switch_timing.switch_timeout",
14847       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
14848
14849     /* PTI Control */
14850     {&hf_ieee80211_tag_pti_control_tid,
14851      {"TID", "wlan_mgt.pti_control.tid",
14852       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14853     {&hf_ieee80211_tag_pti_control_sequence_control,
14854      {"Sequence Control", "wlan_mgt.pti_control.sequence_control",
14855       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
14856
14857     /* PU Buffer Status */
14858     {&hf_ieee80211_tag_pu_buffer_status_ac_bk,
14859      {"AC_BK traffic available", "wlan_mgt.pu_buffer_status.ac_bk",
14860       FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }},
14861     {&hf_ieee80211_tag_pu_buffer_status_ac_be,
14862      {"AC_BE traffic available", "wlan_mgt.pu_buffer_status.ac_be",
14863       FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL }},
14864     {&hf_ieee80211_tag_pu_buffer_status_ac_vi,
14865      {"AC_VI traffic available", "wlan_mgt.pu_buffer_status.ac_vi",
14866       FT_UINT8, BASE_DEC, NULL, 0x04, NULL, HFILL }},
14867     {&hf_ieee80211_tag_pu_buffer_status_ac_vo,
14868      {"AC_VO traffic available", "wlan_mgt.pu_buffer_status.ac_vo",
14869       FT_UINT8, BASE_DEC, NULL, 0x08, NULL, HFILL }}
14870   };
14871
14872   static hf_register_info aggregate_fields[] = {
14873     {&hf_ieee80211_amsdu_msdu_header_text,
14874      {"MAC Service Data Unit (MSDU)", "wlan_aggregate.msduheader", FT_UINT16,
14875       BASE_DEC, 0, 0x0000, NULL, HFILL }}
14876   };
14877
14878   static gint *tree_array[] = {
14879     &ett_80211,
14880     &ett_fc_tree,
14881     &ett_proto_flags,
14882     &ett_fragments,
14883     &ett_fragment,
14884     &ett_block_ack,
14885     &ett_80211_mgt,
14886     &ett_fixed_parameters,
14887     &ett_tagged_parameters,
14888     &ett_tag_bmapctl_tree,
14889     &ett_tag_country_fnm_tree,
14890     &ett_tag_country_rcc_tree,
14891     &ett_qos_parameters,
14892     &ett_qos_ps_buf_state,
14893     &ett_wep_parameters,
14894 #ifdef MESH_OVERRIDES
14895     &ett_msh_parameters,
14896     &ett_msh_dest_flags_tree,
14897 #endif /* MESH_OVERRIDES */
14898     &ett_cap_tree,
14899     &ett_rsn_gcs_tree,
14900     &ett_rsn_pcs_tree,
14901     &ett_rsn_sub_pcs_tree,
14902     &ett_rsn_akms_tree,
14903     &ett_rsn_sub_akms_tree,
14904     &ett_rsn_cap_tree,
14905     &ett_rsn_pmkid_tree,
14906     &ett_rsn_gmcs_tree,
14907     &ett_ht_cap_tree,
14908     &ett_ath_cap_tree,
14909     &ett_ff_ba_param_tree,
14910     &ett_ff_qos_info,
14911     &ett_ff_sm_pwr_save,
14912     &ett_ff_psmp_param_set,
14913     &ett_ff_mimo_cntrl,
14914     &ett_ff_ant_sel,
14915     &ett_ff_chan_switch_announce,
14916     &ett_ff_ht_info,
14917     &ett_ff_psmp_sta_info,
14918     &ett_ff_delba_param_tree,
14919     &ett_ff_ba_ssc_tree,
14920     &ett_mimo_report,
14921     &ett_cntrl_wrapper_fc,
14922     &ett_cntrl_wrapper_payload,
14923     &ett_ht_info_delimiter1_tree,
14924     &ett_ht_info_delimiter2_tree,
14925     &ett_ht_info_delimiter3_tree,
14926     &ett_msdu_aggregation_parent_tree,
14927     &ett_msdu_aggregation_subframe_tree,
14928     &ett_tag_measure_request_mode_tree,
14929     &ett_tag_measure_request_type_tree,
14930     &ett_tag_measure_report_mode_tree,
14931     &ett_tag_measure_report_type_tree,
14932     &ett_tag_measure_report_basic_map_tree,
14933     &ett_tag_measure_report_rpi_tree,
14934     &ett_tag_measure_report_frame_tree,
14935     &ett_tag_ex_cap,
14936     &ett_tag_supported_channels,
14937     &ett_tag_neighbor_report_bssid_info_tree,
14938     &ett_tag_neighbor_report_bssid_info_capability_tree,
14939     &ett_tag_neighbor_report_sub_tag_tree,
14940     &ett_ampduparam_tree,
14941     &ett_mcsset_tree,
14942     &ett_mcsbit_tree,
14943     &ett_htex_cap_tree,
14944     &ett_txbf_tree,
14945     &ett_hta_cap_tree,
14946     &ett_hta_cap1_tree,
14947     &ett_hta_cap2_tree,
14948     &ett_htc_tree,
14949     &ett_antsel_tree,
14950     &ett_80211_mgt_ie,
14951     &ett_tsinfo_tree,
14952     &ett_sched_tree,
14953     &ett_fcs,
14954     &ett_radio,
14955     &ett_prism,
14956     &ett_prism_did,
14957     &ett_pst_tree,
14958     &ett_pst_cap_tree,
14959     &ett_chan_noc_tree,
14960     &ett_wave_chnl_tree,
14961     &ett_adv_proto,
14962     &ett_adv_proto_tuple,
14963     &ett_gas_query,
14964     &ett_gas_anqp
14965   };
14966   module_t *wlan_module;
14967
14968   memset (&wlan_stats, 0, sizeof wlan_stats);
14969
14970   proto_aggregate = proto_register_protocol("IEEE 802.11 wireless LAN aggregate frame",
14971       "IEEE 802.11 Aggregate Data", "wlan_aggregate");
14972   proto_register_field_array(proto_aggregate, aggregate_fields, array_length(aggregate_fields));
14973   proto_wlan = proto_register_protocol ("IEEE 802.11 wireless LAN",
14974       "IEEE 802.11", "wlan");
14975   proto_register_field_array (proto_wlan, hf, array_length (hf));
14976   proto_wlan_mgt = proto_register_protocol ("IEEE 802.11 wireless LAN management frame",
14977       "802.11 MGT", "wlan_mgt");
14978   proto_register_field_array (proto_wlan_mgt, ff, array_length (ff));
14979   proto_register_subtree_array (tree_array, array_length (tree_array));
14980
14981   register_dissector("wlan", dissect_ieee80211, proto_wlan);
14982   register_dissector("wlan_fixed", dissect_ieee80211_fixed, proto_wlan);
14983   register_dissector("wlan_bsfc", dissect_ieee80211_bsfc, proto_wlan);
14984   register_dissector("wlan_datapad", dissect_ieee80211_datapad, proto_wlan);
14985   register_dissector("wlan_ht", dissect_ieee80211_ht, proto_wlan);
14986   register_init_routine(wlan_defragment_init);
14987   register_init_routine(wlan_retransmit_init);
14988
14989   proto_radio = proto_register_protocol("802.11 radio information", "Radio", "radio");
14990
14991   proto_prism = proto_register_protocol("Prism capture header", "Prism", "prism");
14992   proto_register_field_array(proto_prism, hf_prism, array_length(hf_prism));
14993
14994   proto_wlancap = proto_register_protocol("AVS WLAN Capture header",
14995       "AVS WLANCAP", "wlancap");
14996   proto_register_field_array(proto_wlancap, hf_wlancap, array_length(hf_wlancap));
14997   register_dissector("wlancap", dissect_wlancap, proto_wlancap);
14998
14999   wlan_tap = register_tap("wlan");
15000
15001   /* Register configuration options */
15002   wlan_module = prefs_register_protocol(proto_wlan, init_wepkeys);
15003   prefs_register_bool_preference(wlan_module, "defragment",
15004     "Reassemble fragmented 802.11 datagrams",
15005     "Whether fragmented 802.11 datagrams should be reassembled",
15006      &wlan_defragment);
15007
15008   prefs_register_bool_preference(wlan_module, "ignore_draft_ht",
15009     "Ignore vendor-specific HT elements",
15010     "Don't dissect 802.11n draft HT elements (which might contain duplicate information).",
15011     &wlan_ignore_draft_ht);
15012
15013   prefs_register_bool_preference(wlan_module, "retransmitted",
15014     "Call subdissector for retransmitted 802.11 frames",
15015     "Whether retransmitted 802.11 frames should be subdissected",
15016     &wlan_subdissector);
15017
15018   prefs_register_bool_preference(wlan_module, "check_fcs",
15019     "Assume packets have FCS",
15020     "Some 802.11 cards include the FCS at the end of a packet, others do not.",
15021     &wlan_check_fcs);
15022
15023   /* Davide Schiera (2006-11-26): changed "WEP bit" in "Protection bit"    */
15024   /*    (according to the document IEEE Std 802.11i-2004)              */
15025   prefs_register_enum_preference(wlan_module, "ignore_wep",
15026     "Ignore the Protection bit",
15027     "Some 802.11 cards leave the Protection bit set even though the packet is decrypted, "
15028     "and some also leave the IV (initialization vector).",
15029     &wlan_ignore_wep, wlan_ignore_wep_options, TRUE);
15030
15031 #ifndef USE_ENV
15032
15033   prefs_register_obsolete_preference(wlan_module, "wep_keys");
15034
15035 #ifdef HAVE_AIRPDCAP
15036   /* Davide Schiera (2006-11-26): added reference to WPA/WPA2 decryption    */
15037   prefs_register_bool_preference(wlan_module, "enable_decryption",
15038     "Enable decryption", "Enable WEP and WPA/WPA2 decryption",
15039     &enable_decryption);
15040 #else
15041   prefs_register_bool_preference(wlan_module, "enable_decryption",
15042     "Enable decryption", "Enable WEP decryption",
15043     &enable_decryption);
15044 #endif
15045
15046 #ifdef HAVE_AIRPDCAP
15047   prefs_register_static_text_preference(wlan_module, "info_decryption_key",
15048     "Key examples: 01:02:03:04:05 (40/64-bit WEP),\n"
15049     "010203040506070809101111213 (104/128-bit WEP),\n"
15050     "wpa-pwd:MyPassword[:MyAP] (WPA + plaintext password [+ SSID]),\n"
15051     "wpa-psk:0102030405...6061626364 (WPA + 256-bit key).  "
15052     "Invalid keys will be ignored.",
15053     "Valid key formats");
15054 #else
15055   prefs_register_static_text_preference(wlan_module, "info_decryption_key",
15056     "Key examples: 01:02:03:04:05 (40/64-bit WEP),\n"
15057     "010203040506070809101111213 (104/128-bit WEP)",
15058     "Valid key formats");
15059 #endif
15060
15061   for (i = 0; i < MAX_ENCRYPTION_KEYS; i++) {
15062     key_name = g_string_new("");
15063     key_title = g_string_new("");
15064     key_desc = g_string_new("");
15065     wep_keystr[i] = NULL;
15066     /* prefs_register_*_preference() expects unique strings, so
15067      * we build them using g_string_printf and just leave them
15068      * allocated. */
15069 #ifdef HAVE_AIRPDCAP
15070     g_string_printf(key_name, "wep_key%d", i + 1);
15071     g_string_printf(key_title, "Key #%d", i + 1);
15072     /* Davide Schiera (2006-11-26): modified keys input tooltip          */
15073     g_string_printf(key_desc,
15074       "Key #%d string can be:"
15075       "   <wep hexadecimal key>;"
15076       "   wep:<wep hexadecimal key>;"
15077       "   wpa-pwd:<passphrase>[:<ssid>];"
15078       "   wpa-psk:<wpa hexadecimal key>", i + 1);
15079 #else
15080     g_string_printf(key_name, "wep_key%d", i + 1);
15081     g_string_printf(key_title, "WEP key #%d", i + 1);
15082     g_string_printf(key_desc, "WEP key #%d can be:"
15083                     "   <wep hexadecimal key>;"
15084                     "   wep:<wep hexadecimal key>", i + 1);
15085 #endif
15086
15087     prefs_register_string_preference(wlan_module, key_name->str,
15088                                      key_title->str, key_desc->str, (const char **) &wep_keystr[i]);
15089
15090     g_string_free(key_name, FALSE);
15091     g_string_free(key_title, FALSE);
15092     g_string_free(key_desc, FALSE);
15093   }
15094 #endif
15095 }
15096
15097 static void
15098 dissect_data_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
15099 {
15100   int offset = 0;
15101   guint8 type;
15102   int tagged_parameter_tree_len;
15103   proto_tree *tagged_tree;
15104
15105   g_pinfo = pinfo;
15106
15107   type = tvb_get_guint8(tvb, offset);
15108   proto_tree_add_item(tree, hf_ieee80211_data_encap_payload_type, tvb, offset,
15109                       1, FALSE);
15110   offset++;
15111   switch (type) {
15112   case 1:
15113     col_set_str(pinfo->cinfo, COL_PROTOCOL, "RRB");
15114     /* TODO: IEEE 802.11r */
15115     break;
15116   case 2:
15117     col_set_str(pinfo->cinfo, COL_PROTOCOL, "TDLS");
15118     col_clear(pinfo->cinfo, COL_INFO);
15119     offset += add_fixed_field(tree, tvb, offset, FIELD_ACTION);
15120     tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
15121     if (tagged_parameter_tree_len != 0) {
15122       tagged_tree = get_tagged_parameter_tree(tree, tvb, offset,
15123                                               tagged_parameter_tree_len);
15124       ieee_80211_add_tagged_parameters(tvb, offset, pinfo, tagged_tree,
15125                                        tagged_parameter_tree_len);
15126     }
15127     break;
15128   }
15129 }
15130
15131 void
15132 proto_reg_handoff_ieee80211(void)
15133 {
15134   dissector_handle_t radio_handle;
15135   dissector_handle_t prism_handle;
15136   dissector_handle_t data_encap_handle;
15137
15138   /*
15139    * Get handles for the LLC, IPX and Ethernet  dissectors.
15140    */
15141   llc_handle = find_dissector("llc");
15142   ipx_handle = find_dissector("ipx");
15143   eth_withoutfcs_handle = find_dissector("eth_withoutfcs");
15144   data_handle = find_dissector("data");
15145
15146   ieee80211_handle = find_dissector("wlan");
15147   dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11, ieee80211_handle);
15148   dissector_add_uint("ethertype", ETHERTYPE_CENTRINO_PROMISC, ieee80211_handle);
15149
15150   /* Register handoff to radio-header dissectors */
15151   radio_handle = create_dissector_handle(dissect_radio, proto_radio);
15152   dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_WITH_RADIO, radio_handle);
15153
15154   prism_handle = create_dissector_handle(dissect_prism, proto_prism);
15155   dissector_add_uint("wtap_encap", WTAP_ENCAP_PRISM_HEADER, prism_handle);
15156
15157   wlancap_handle = create_dissector_handle(dissect_wlancap, proto_wlancap);
15158   dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_WLAN_AVS, wlancap_handle);
15159
15160   /* Register handoff to Aruba GRE */
15161   dissector_add_uint("gre.proto", GRE_ARUBA_8200, ieee80211_handle);
15162   dissector_add_uint("gre.proto", GRE_ARUBA_8210, ieee80211_handle);
15163   dissector_add_uint("gre.proto", GRE_ARUBA_8220, ieee80211_handle);
15164   dissector_add_uint("gre.proto", GRE_ARUBA_8230, ieee80211_handle);
15165   dissector_add_uint("gre.proto", GRE_ARUBA_8240, ieee80211_handle);
15166   dissector_add_uint("gre.proto", GRE_ARUBA_8250, ieee80211_handle);
15167   dissector_add_uint("gre.proto", GRE_ARUBA_8260, ieee80211_handle);
15168   dissector_add_uint("gre.proto", GRE_ARUBA_8270, ieee80211_handle);
15169   dissector_add_uint("gre.proto", GRE_ARUBA_8280, ieee80211_handle);
15170   dissector_add_uint("gre.proto", GRE_ARUBA_8290, ieee80211_handle);
15171   dissector_add_uint("gre.proto", GRE_ARUBA_82A0, ieee80211_handle);
15172   dissector_add_uint("gre.proto", GRE_ARUBA_82B0, ieee80211_handle);
15173   dissector_add_uint("gre.proto", GRE_ARUBA_82C0, ieee80211_handle);
15174   dissector_add_uint("gre.proto", GRE_ARUBA_82D0, ieee80211_handle);
15175   dissector_add_uint("gre.proto", GRE_ARUBA_82E0, ieee80211_handle);
15176   dissector_add_uint("gre.proto", GRE_ARUBA_82F0, ieee80211_handle);
15177   dissector_add_uint("gre.proto", GRE_ARUBA_8300, ieee80211_handle);
15178   dissector_add_uint("gre.proto", GRE_ARUBA_8310, ieee80211_handle);
15179   dissector_add_uint("gre.proto", GRE_ARUBA_8320, ieee80211_handle);
15180   dissector_add_uint("gre.proto", GRE_ARUBA_8330, ieee80211_handle);
15181   dissector_add_uint("gre.proto", GRE_ARUBA_8340, ieee80211_handle);
15182   dissector_add_uint("gre.proto", GRE_ARUBA_8350, ieee80211_handle);
15183   dissector_add_uint("gre.proto", GRE_ARUBA_8360, ieee80211_handle);
15184   dissector_add_uint("gre.proto", GRE_ARUBA_8370, ieee80211_handle);
15185
15186   data_encap_handle = create_dissector_handle(dissect_data_encap, proto_wlan);
15187   dissector_add_uint("ethertype", ETHERTYPE_IEEE80211_DATA_ENCAP,
15188                 data_encap_handle);
15189 }
15190
15191 #ifdef HAVE_AIRPDCAP
15192 /* Davide Schiera (2006-11-26): this function will try to decrypt with WEP or  */
15193 /* WPA and return a tvb to the caller to add a new tab. It returns the    */
15194 /* algorithm used for decryption (WEP, TKIP, CCMP) and the header and    */
15195 /* trailer lengths.                                      */
15196 static tvbuff_t *
15197 try_decrypt(tvbuff_t *tvb, guint offset, guint len, guint8 *algorithm, guint32 *sec_header, guint32 *sec_trailer) {
15198   const guint8 *enc_data;
15199   guint8 *tmp = NULL;
15200   tvbuff_t *decr_tvb = NULL;
15201   guint32 dec_caplen;
15202   guchar dec_data[AIRPDCAP_MAX_CAPLEN];
15203   AIRPDCAP_KEY_ITEM used_key;
15204
15205   if (!enable_decryption)
15206     return NULL;
15207
15208   /* get the entire packet                                  */
15209   enc_data = tvb_get_ptr(tvb, 0, len+offset);
15210
15211   /*  process packet with AirPDcap                              */
15212   if (AirPDcapPacketProcess(&airpdcap_ctx, enc_data, offset, offset+len, dec_data, &dec_caplen, &used_key, FALSE, TRUE)==AIRPDCAP_RET_SUCCESS)
15213   {
15214     *algorithm=used_key.KeyType;
15215     switch (*algorithm) {
15216       case AIRPDCAP_KEY_TYPE_WEP:
15217         *sec_header=AIRPDCAP_WEP_HEADER;
15218         *sec_trailer=AIRPDCAP_WEP_TRAILER;
15219         break;
15220       case AIRPDCAP_KEY_TYPE_CCMP:
15221         *sec_header=AIRPDCAP_RSNA_HEADER;
15222         *sec_trailer=AIRPDCAP_CCMP_TRAILER;
15223         break;
15224       case AIRPDCAP_KEY_TYPE_TKIP:
15225         *sec_header=AIRPDCAP_RSNA_HEADER;
15226         *sec_trailer=AIRPDCAP_TKIP_TRAILER;
15227         break;
15228       default:
15229         return NULL;
15230     }
15231
15232     /* allocate buffer for decrypted payload                      */
15233     tmp = g_memdup(dec_data+offset, dec_caplen-offset);
15234
15235     len=dec_caplen-offset;
15236
15237     /* decrypt successful, let's set up a new data tvb.              */
15238     decr_tvb = tvb_new_child_real_data(tvb, tmp, len, len);
15239     tvb_set_free_cb(decr_tvb, g_free);
15240   } else
15241     g_free(tmp);
15242
15243   return decr_tvb;
15244 }
15245 /*  Davide Schiera -----------------------------------------------------------  */
15246 #else
15247
15248 static tvbuff_t *try_decrypt_wep(tvbuff_t *tvb, guint32 offset, guint32 len) {
15249   const guint8 *enc_data;
15250   guint8 *tmp = NULL;
15251   int i;
15252   tvbuff_t *decr_tvb = NULL;
15253
15254   if (! enable_decryption)
15255     return NULL;
15256
15257   enc_data = tvb_get_ptr(tvb, offset, len);
15258
15259   if ((tmp = g_malloc(len)) == NULL)
15260     return NULL;  /* krap! */
15261
15262   /* try once with the key index in the packet, then look through our list. */
15263   for (i = 0; i < num_wepkeys; i++) {
15264     /* copy the encrypted data over to the tmp buffer */
15265 #if 0
15266     printf("trying %d\n", i);
15267 #endif
15268     memcpy(tmp, enc_data, len);
15269     if (wep_decrypt(tmp, len, i) == 0) {
15270
15271       /* decrypt successful, let's set up a new data tvb. */
15272       decr_tvb = tvb_new_child_real_data(tvb, tmp, len-8, len-8);
15273       tvb_set_free_cb(decr_tvb, g_free);
15274
15275       break;
15276     }
15277   }
15278
15279   if (!decr_tvb)
15280     g_free(tmp);
15281
15282 #if 0
15283   printf("de-wep %p\n", decr_tvb);
15284 #endif
15285
15286   return decr_tvb;
15287 }
15288 #endif
15289
15290 /*
15291  * Convert a raw WEP key or one prefixed with "wep:" to a byte array.
15292  * Separators are allowed.
15293  */
15294 /* XXX This is duplicated in epan/airpdcap.c:parse_key_string() */
15295 static gboolean
15296 wep_str_to_bytes(const char *hex_str, GByteArray *bytes) {
15297   char *first_nibble = (char *) hex_str;
15298
15299   if (g_ascii_strncasecmp(hex_str, STRING_KEY_TYPE_WEP ":", 4) == 0) {
15300     first_nibble += 4;
15301   }
15302
15303   return hex_str_to_bytes(first_nibble, bytes, FALSE);
15304 }
15305
15306 /* Collect our WEP and WPA keys */
15307 #ifdef HAVE_AIRPDCAP
15308 static
15309 void set_airpdcap_keys(void)
15310 {
15311   guint i = 0;
15312   AIRPDCAP_KEY_ITEM key;
15313   PAIRPDCAP_KEYS_COLLECTION keys;
15314   decryption_key_t* dk = NULL;
15315   GByteArray *bytes = NULL;
15316   gboolean res;
15317   gchar* tmpk = NULL;
15318
15319   keys=(PAIRPDCAP_KEYS_COLLECTION)g_malloc(sizeof(AIRPDCAP_KEYS_COLLECTION));
15320   keys->nKeys = 0;
15321
15322   for(i = 0; i < MAX_ENCRYPTION_KEYS; i++)
15323   {
15324     tmpk = g_strdup(wep_keystr[i]);
15325
15326     dk = parse_key_string(tmpk);
15327
15328     if(dk != NULL)
15329     {
15330       if(dk->type == AIRPDCAP_KEY_TYPE_WEP)
15331       {
15332         key.KeyType = AIRPDCAP_KEY_TYPE_WEP;
15333
15334         bytes = g_byte_array_new();
15335         res = wep_str_to_bytes(dk->key->str, bytes);
15336
15337         if (dk->key->str && res && bytes->len > 0 && bytes->len <= AIRPDCAP_WEP_KEY_MAXLEN)
15338         {
15339           /*
15340            * WEP key is correct (well, the can be even or odd, so it is not
15341            * a real check, I think... is a check performed somewhere in the
15342            * AirPDcap function??? )
15343            */
15344           memcpy(key.KeyData.Wep.WepKey, bytes->data, bytes->len);
15345           key.KeyData.Wep.WepKeyLen = bytes->len;
15346           keys->Keys[keys->nKeys] = key;
15347           keys->nKeys++;
15348         }
15349       }
15350       else if(dk->type == AIRPDCAP_KEY_TYPE_WPA_PWD)
15351       {
15352         key.KeyType = AIRPDCAP_KEY_TYPE_WPA_PWD;
15353
15354         /* XXX - This just lops the end if the key off if it's too long.
15355          *       Should we handle this more gracefully? */
15356         g_strlcpy(key.UserPwd.Passphrase, dk->key->str, AIRPDCAP_WPA_PASSPHRASE_MAX_LEN+1);
15357
15358         key.UserPwd.SsidLen = 0;
15359         if(dk->ssid != NULL && dk->ssid->len <= AIRPDCAP_WPA_SSID_MAX_LEN)
15360         {
15361           memcpy(key.UserPwd.Ssid, dk->ssid->data, dk->ssid->len);
15362           key.UserPwd.SsidLen = dk->ssid->len;
15363         }
15364
15365         keys->Keys[keys->nKeys] = key;
15366         keys->nKeys++;
15367       }
15368       else if(dk->type == AIRPDCAP_KEY_TYPE_WPA_PMK)
15369       {
15370         key.KeyType = AIRPDCAP_KEY_TYPE_WPA_PMK;
15371
15372         bytes = g_byte_array_new();
15373         res = wep_str_to_bytes(dk->key->str, bytes);
15374
15375         /* XXX - Pass the correct array of bytes... */
15376         if (bytes-> len <= AIRPDCAP_WPA_PMK_LEN) {
15377           memcpy(key.KeyData.Wpa.Pmk, bytes->data, bytes->len);
15378
15379           keys->Keys[keys->nKeys] = key;
15380           keys->nKeys++;
15381         }
15382       }
15383     }
15384     g_free(tmpk);
15385   }
15386
15387   /* Now set the keys */
15388   AirPDcapSetKeys(&airpdcap_ctx,keys->Keys,keys->nKeys);
15389   g_free(keys);
15390   if (bytes)
15391     g_byte_array_free(bytes, TRUE);
15392
15393 }
15394 #endif
15395
15396 #ifndef HAVE_AIRPDCAP
15397 /* de-weps the block.  if successful, buf* will point to the data start. */
15398 static int wep_decrypt(guint8 *buf, guint32 len, int keyidx) {
15399   guint32 i, j, k, crc, keylen;
15400   guint8 s[256], key[128], c_crc[4];
15401   guint8 *dpos, *cpos;
15402
15403   /* Needs to be at least 8 bytes of payload */
15404   if (len < 8)
15405     return -1;
15406
15407   /* initialize the first bytes of the key from the IV */
15408   key[0] = buf[0];
15409   key[1] = buf[1];
15410   key[2] = buf[2];
15411
15412   if (keyidx < 0 || keyidx >= num_wepkeys)
15413     return -1;
15414
15415   keylen = wep_keylens[keyidx];
15416
15417   if (keylen == 0)
15418     return -1;
15419   if (wep_keys[keyidx] == NULL)
15420     return -1;
15421
15422   keylen+=3;  /* add in ICV bytes */
15423
15424   /* copy the rest of the key over from the designated key */
15425   memcpy(key+3, wep_keys[keyidx], wep_keylens[keyidx]);
15426
15427 #if 0
15428   printf("%d: %02x %02x %02x (%d %d) %02x:%02x:%02x:%02x:%02x\n", len, key[0], key[1], key[2], keyidx, keylen, key[3], key[4], key[5], key[6], key[7]);
15429 #endif
15430
15431   /* set up the RC4 state */
15432   for (i = 0; i < 256; i++)
15433     s[i] = i;
15434   j = 0;
15435   for (i = 0; i < 256; i++) {
15436     j = (j + s[i] + key[i % keylen]) & 0xff;
15437     SSWAP(i,j);
15438   }
15439
15440   /* Apply the RC4 to the data, update the CRC32 */
15441   cpos = buf+4;
15442   dpos = buf;
15443   crc = ~0;
15444   i = j = 0;
15445   for (k = 0; k < (len -8); k++) {
15446     i = (i+1) & 0xff;
15447     j = (j+s[i]) & 0xff;
15448     SSWAP(i,j);
15449 #if 0
15450     printf("%d -- %02x ", k, *dpos);
15451 #endif
15452     *dpos = *cpos++ ^ s[(s[i] + s[j]) & 0xff];
15453 #if 0
15454     printf("%02x\n", *dpos);
15455 #endif
15456     crc = crc32_ccitt_table[(crc ^ *dpos++) & 0xff] ^ (crc >> 8);
15457   }
15458   crc = ~crc;
15459
15460   /* now let's check the crc */
15461   c_crc[0] = crc;
15462   c_crc[1] = crc >> 8;
15463   c_crc[2] = crc >> 16;
15464   c_crc[3] = crc >> 24;
15465
15466   for (k = 0; k < 4; k++) {
15467     i = (i + 1) & 0xff;
15468     j = (j+s[i]) & 0xff;
15469     SSWAP(i,j);
15470 #if 0
15471     printf("-- %02x %02x\n", *dpos, c_crc[k]);
15472 #endif
15473     if ((*cpos++ ^ s[(s[i] + s[j]) & 0xff]) != c_crc[k])
15474       return -1; /* ICV mismatch */
15475   }
15476
15477   return 0;
15478 }
15479 #endif
15480
15481 static void init_wepkeys(void) {
15482 #ifndef  HAVE_AIRPDCAP
15483   const char *tmp;
15484   int i, keyidx;
15485   GByteArray *bytes;
15486   gboolean res;
15487
15488   if (wep_keys) {
15489     for (i = 0; i < num_wepkeys; i++)
15490       g_free(wep_keys[i]);
15491     g_free(wep_keys);
15492   }
15493   g_free(wep_keylens);
15494
15495 #ifdef USE_ENV
15496   guint8 *buf;
15497
15498   tmp = getenv("WIRESHARK_WEPKEYNUM");
15499   if (!tmp) {
15500     num_wepkeys = 0;
15501     return;
15502   }
15503   num_wepkeys = atoi(tmp);
15504
15505   if (num_wepkeys < 1)
15506     return;
15507 #endif
15508
15509   /* Figure out how many valid keys we have */
15510   bytes = g_byte_array_new();
15511   num_wepkeys = 0;
15512   for ( i = 0; i < MAX_ENCRYPTION_KEYS; i++) {
15513     g_strstrip(wep_keystr[i]);
15514     res = wep_str_to_bytes(wep_keystr[i], bytes);
15515     if (wep_keystr[i] && res && bytes-> len > 0) {
15516       num_wepkeys++;
15517     }
15518   }
15519
15520   wep_keys = g_malloc0(num_wepkeys * sizeof(guint8*));
15521   wep_keylens = g_malloc(num_wepkeys * sizeof(int));
15522
15523   for (i = 0, keyidx = 0; i < MAX_ENCRYPTION_KEYS && keyidx < num_wepkeys; i++) {
15524     wep_keys[keyidx] = NULL;
15525     wep_keylens[keyidx] = 0;
15526
15527 #ifdef USE_ENV
15528     buf = ep_strdup_printf("WIRESHARK_WEPKEY%d", i+1);
15529     tmp = getenv(buf);
15530 #else
15531     tmp = wep_keystr[i];
15532 #endif
15533
15534     if (tmp) {
15535 #if 0
15536 #ifdef USE_ENV
15537       printf("%s -- %s\n", buf, tmp);
15538 #else
15539       printf("%d -- %s\n", i+1, tmp);
15540 #endif
15541 #endif
15542
15543       g_free(wep_keys[keyidx]);
15544
15545       res = wep_str_to_bytes(tmp, bytes);
15546       if (tmp && res && bytes->len > 0) {
15547         if (bytes->len > 32) {
15548           bytes->len = 32;
15549         }
15550         wep_keys[keyidx] = g_malloc0(32 * sizeof(guint8));
15551         memcpy(wep_keys[keyidx], bytes->data, bytes->len * sizeof(guint8));
15552         wep_keylens[keyidx] = bytes->len;
15553         keyidx++;
15554 #if 0
15555         printf("%d: %d bytes\n", i, bytes->len);
15556         printf("%d: %s\n", i, bytes_to_str(bytes->data, bytes->len));
15557 #endif
15558       } else {
15559 #if 0
15560         printf("res: %d  bytes->len: %d\n", res, bytes->len);
15561 #endif
15562         if (tmp[0] != 'w') /* Assume it begins with "wep:" or "wpa-*:" */
15563           g_warning("Could not parse WEP key %d: %s", i + 1, tmp);
15564       }
15565     }
15566   }
15567   g_byte_array_free(bytes, TRUE);
15568
15569 #else /* HAVE_AIRPDCAP defined */
15570
15571   /*
15572    * XXX - AirPDcap - That God sends it to us beautiful (che dio ce la mandi bona)
15573    * The next lines will add a key to the AirPDcap context. The keystring will be added
15574    * to the old WEP array too, but we don't care, because the packets will come here
15575    * already decrypted... One of these days we will fix this too
15576    */
15577   set_airpdcap_keys();
15578 #endif /* HAVE_AIRPDCAP */
15579 }
15580 /*
15581  * This code had been taken from AirSnort crack.c function classify()
15582  * Permission granted by snax <at> shmoo dot com
15583  * weak_iv - determine which key byte an iv is useful in resolving
15584  * parm     - p, pointer to the first byte of an IV
15585  * return   -  n - this IV is weak for byte n of a WEP key
15586  *            -1 - this IV is not weak for any key bytes
15587  *
15588  * This function tests for IVs that are known to satisfy the criteria
15589  * for a weak IV as specified in FMS section 7.1
15590  *
15591  */
15592 static int
15593 weak_iv(guchar *iv)
15594 {
15595   guchar sum, k;
15596
15597   if (iv[1] == 255 && iv[0] > 2 && iv[0] < 16) {
15598     return iv[0] -3;
15599   }
15600
15601   sum = iv[0] + iv[1];
15602   if (sum == 1) {
15603     if (iv[2] <= 0x0a) {
15604       return iv[2] +2;
15605     }
15606     else if (iv[2] == 0xff){
15607       return 0;
15608     }
15609   }
15610   k = 0xfe - iv[2];
15611   if (sum == k  && (iv[2] >= 0xf2 && iv[2] <= 0xfe && iv[2] != 0xfd)){
15612     return k;
15613   }
15614   return -1;
15615 }
15616
15617 /*
15618  * Editor modelines
15619  *
15620  * Local Variables:
15621  * c-basic-offset: 2
15622  * tab-width: 8
15623  * indent-tabs-mode: nil
15624  * End:
15625  *
15626  * ex: set shiftwidth=2 tabstop=8 expandtab
15627  * :indentSize=2:tabSize=8:noTabs=true:
15628  */