Enhance 802.11 (Vendor Specific) HT Capability (45)
[metze/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  * 05/29/2011 - UATification of decryption keys
58  * Michael Mann <mmann78@netscape.net>
59  *
60  * 07/30/2011 - Update 802.11s packet dissecting to the ratified standard (v12.0)
61  * Brian Cavagnolo <brian@cozybit.com>
62  *
63  * Enhance 802.11 dissector by Alexis La Goutte
64  */
65
66 /*
67  * Reference :
68  * The 802.11 standard is "free", 6 month after the publication.
69  *
70  * IEEE Std 802.11-2007: Revision of IEEE Std 802.11-199
71  * include 8 amendments (802.11a,b,d,e,g,h,i,j)
72  * http://standards.ieee.org/getieee802/download/802.11-2007.pdf
73  *
74  * IEEE Std 802.11k-2008: Radio Resource Measurement of Wireless LANs
75  * http://standards.ieee.org/getieee802/download/802.11k-2008.pdf
76  *
77  * IEEE Std 802.11r-2008: Fast Basic Service Set (BSS) Transition
78  * http://standards.ieee.org/getieee802/download/802.11r-2008.pdf
79  *
80  * IEEE Std 802.11y-2008: 3650-3700 MHz Operation in USA
81  * http://standards.ieee.org/getieee802/download/802.11y-2008.pdf
82  *
83  * IEEE Std 802.11w-2009: Protected Management Frames
84  * http://standards.ieee.org/getieee802/download/802.11w-2009.pdf
85  *
86  * IEEE Std 802.11n-2009: Enhancements for Higher Throughput
87  * http://standards.ieee.org/getieee802/download/802.11n-2009.pdf
88  *
89  * IEEE Std 802.11p-2010: Wireless Access in Vehicular Environments
90  * http://standards.ieee.org/getieee802/download/802.11p-2010.pdf
91  *
92  * IEEE Std 802.11z-2010: Extensions to Direct-Link Setup (DLS)
93  * http://standards.ieee.org/getieee802/download/802.11z-2010.pdf
94  */
95
96
97 #ifdef HAVE_CONFIG_H
98 # include "config.h"
99 #endif
100
101 #include <string.h>
102 #include <math.h>
103
104 #include <glib.h>
105
106 #include <epan/packet.h>
107 #include <epan/bitswap.h>
108 #include <epan/addr_resolv.h>
109 #include <epan/strutil.h>
110 #include <epan/prefs.h>
111 #include <epan/reassemble.h>
112 #include "packet-ipx.h"
113 #include "packet-llc.h"
114 #include "packet-ieee80211.h"
115 #include <epan/etypes.h>
116 #include <epan/greproto.h>
117 #include <epan/oui.h>
118 #include <wsutil/crc32.h>
119 #include <epan/crc32-tvb.h>
120 #include <epan/tap.h>
121 #include <epan/emem.h>
122 #include <epan/crypt/wep-wpadefs.h>
123 #include <epan/expert.h>
124 #include <epan/uat.h>
125
126 #include "packet-wps.h"
127 #include "packet-wifi-p2p.h"
128
129 /*     Davide Schiera (2006-11-22): including AirPDcap project                */
130 #include <epan/crypt/airpdcap_ws.h>
131 /* Davide Schiera (2006-11-22) ---------------------------------------------- */
132
133 extern const value_string eap_type_vals[]; /* from packet-eap.c */
134
135 #ifndef roundup2
136 #define roundup2(x, y)  (((x)+((y)-1))&(~((y)-1)))  /* if y is powers of two */
137 #endif
138
139 /* Defragment fragmented 802.11 datagrams */
140 static gboolean wlan_defragment = TRUE;
141
142 /* call subdissector for retransmitted frames */
143 static gboolean wlan_subdissector = TRUE;
144
145 /* Check for the presence of the 802.11 FCS */
146 static gboolean wlan_check_fcs = FALSE;
147
148 /* Ignore vendor-specific HT elements */
149 static gboolean wlan_ignore_draft_ht = FALSE;
150
151 /* Ignore the WEP bit; assume packet is decrypted */
152 #define WLAN_IGNORE_WEP_NO     0
153 #define WLAN_IGNORE_WEP_WO_IV  1
154 #define WLAN_IGNORE_WEP_W_IV   2
155 static gint wlan_ignore_wep = WLAN_IGNORE_WEP_NO;
156
157 /* Tables for reassembly of fragments. */
158 static GHashTable *wlan_fragment_table = NULL;
159 static GHashTable *wlan_reassembled_table = NULL;
160
161 /* Statistical data */
162 static struct _wlan_stats wlan_stats;
163
164 /*-------------------------------------
165  * UAT for WEP decoder
166  *-------------------------------------
167  */
168 /* UAT entry structure. */
169 typedef struct {
170     guint8    key;
171     gchar    *string;
172 } uat_wep_key_record_t;
173
174 static uat_wep_key_record_t *uat_wep_key_records = NULL;
175 static uat_t * wep_uat = NULL;
176 static guint num_wepkeys_uat = 0;
177
178 static void* uat_wep_key_record_copy_cb(void* n, const void* o, size_t siz _U_) {
179     uat_wep_key_record_t* new_key = (uat_wep_key_record_t *)n;
180     const uat_wep_key_record_t* old_key = (const uat_wep_key_record_t *)o;
181
182     if (old_key->string) {
183         new_key->string = g_strdup(old_key->string);
184     } else {
185         new_key->string = NULL;
186     }
187
188     return new_key;
189 }
190
191 static void uat_wep_key_record_update_cb(void* r, const char** err) {
192     uat_wep_key_record_t* rec = (uat_wep_key_record_t *)r;
193     decryption_key_t* dk;
194
195     if (rec->string == NULL) {
196          *err = ep_strdup_printf("Key can't be blank");
197     } else {
198         g_strstrip(rec->string);
199         dk = parse_key_string(rec->string, rec->key);
200
201         if(dk != NULL) {
202            switch(dk->type) {
203               case AIRPDCAP_KEY_TYPE_WEP:
204               case AIRPDCAP_KEY_TYPE_WEP_40:
205               case AIRPDCAP_KEY_TYPE_WEP_104:
206                  if (rec->key != AIRPDCAP_KEY_TYPE_WEP) {
207                     *err = ep_strdup_printf("Invalid key format");
208                  }
209                  break;
210               case AIRPDCAP_KEY_TYPE_WPA_PWD:
211                  if (rec->key != AIRPDCAP_KEY_TYPE_WPA_PWD) {
212                     *err = ep_strdup_printf("Invalid key format");
213                  }
214                  break;
215               case AIRPDCAP_KEY_TYPE_WPA_PSK:
216                  if (rec->key != AIRPDCAP_KEY_TYPE_WPA_PSK) {
217                     *err = ep_strdup_printf("Invalid key format");
218                  }
219                  break;
220               default:
221                  *err = ep_strdup_printf("Invalid key format");
222                  break;
223            }
224         } else {
225            *err = ep_strdup_printf("Invalid key format");
226         }
227     }
228 }
229
230 static void uat_wep_key_record_free_cb(void*r) {
231     uat_wep_key_record_t* key = (uat_wep_key_record_t *)r;
232
233     if (key->string) g_free(key->string);
234 }
235
236 UAT_VS_DEF(uat_wep_key_records, key, uat_wep_key_record_t, 0, STRING_KEY_TYPE_WEP)
237 UAT_CSTRING_CB_DEF(uat_wep_key_records, string, uat_wep_key_record_t)
238
239 /* Stuff for the WEP decoder */
240 static gboolean enable_decryption = FALSE;
241 static void init_wepkeys(void);
242
243 /* Davide Schiera (2006-11-26): created function to decrypt WEP and WPA/WPA2  */
244 static tvbuff_t *try_decrypt(tvbuff_t *tvb, guint32 offset, guint32 len, guint8 *algorithm, guint32 *sec_header, guint32 *sec_trailer);
245
246 static int weak_iv(guchar *iv);
247 #define SSWAP(a,b) {guint8 tmp = s[a]; s[a] = s[b]; s[b] = tmp;}
248
249 typedef struct mimo_control
250   {
251     guint8 nc;
252     guint8 nr;
253     gboolean chan_width;
254     guint8 grouping;
255     guint8 coefficient_size;
256     guint8 codebook_info;
257     guint8 remaining_matrix_segment;
258   } mimo_control_t;
259
260 mimo_control_t get_mimo_control (tvbuff_t *tvb, int offset);
261 int add_mimo_csi_matrices_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl);
262 int add_mimo_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl);
263 int add_mimo_compressed_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl);
264
265 /* ************************************************************************* */
266 /*                          Miscellaneous Constants                          */
267 /* ************************************************************************* */
268 #define SHORT_STR 256
269
270 /* ************************************************************************* */
271 /*  Define some very useful macros that are used to analyze frame types etc. */
272 /* ************************************************************************* */
273
274 /*
275  * Fetch the frame control field and swap it if needed.  "fcf" and "tvb"
276  * must be valid variables.
277  */
278 #define FETCH_FCF(off) (wlan_broken_fc ? \
279   BSWAP16(tvb_get_letohs(tvb, off)) : \
280   tvb_get_letohs(tvb, off))
281
282 /*
283  * Extract the protocol version from the frame control field
284  */
285 #define FCF_PROT_VERSION(x)  ((x) & 0x3)
286
287 /*
288  * Extract the frame type from the frame control field.
289  */
290 #define FCF_FRAME_TYPE(x)    (((x) & 0xC) >> 2)
291
292 /*
293  * Extract the frame subtype from the frame control field.
294  */
295 #define FCF_FRAME_SUBTYPE(x) (((x) & 0xF0) >> 4)
296
297 /*
298  * Convert the frame type and subtype from the frame control field into
299  * one of the MGT_, CTRL_, or DATA_ values.
300  */
301 #define COMPOSE_FRAME_TYPE(x) (((x & 0x0C)<< 2)+FCF_FRAME_SUBTYPE(x))  /* Create key to (sub)type */
302
303 /*
304  * The subtype field of a data frame is, in effect, composed of 4 flag
305  * bits - CF-Ack, CF-Poll, Null (means the frame doesn't actually have
306  * any data), and QoS.
307  */
308 #define DATA_FRAME_IS_CF_ACK(x)  ((x) & 0x01)
309 #define DATA_FRAME_IS_CF_POLL(x) ((x) & 0x02)
310 #define DATA_FRAME_IS_NULL(x)    ((x) & 0x04)
311 #define DATA_FRAME_IS_QOS(x)     ((x) & 0x08)
312
313 /*
314  * Extract the flags from the frame control field.
315  */
316 #define FCF_FLAGS(x)           (((x) & 0xFF00) >> 8)
317
318 /*
319  * Bits from the flags field.
320  */
321 #define FLAG_TO_DS            0x01
322 #define FLAG_FROM_DS          0x02
323 #define FLAG_MORE_FRAGMENTS   0x04
324 #define FLAG_RETRY            0x08
325 #define FLAG_POWER_MGT        0x10
326 #define FLAG_MORE_DATA        0x20
327 #define FLAG_PROTECTED        0x40
328 #define FLAG_ORDER            0x80
329
330 /*
331  * Test bits in the flags field.
332  */
333 /*
334  * XXX - Only HAVE_FRAGMENTS, IS_PROTECTED, and IS_STRICTLY_ORDERED
335  * are in use.  Should the rest be removed?
336  */
337 #define IS_TO_DS(x)            ((x) & FLAG_TO_DS)
338 #define IS_FROM_DS(x)          ((x) & FLAG_FROM_DS)
339 #define HAVE_FRAGMENTS(x)      ((x) & FLAG_MORE_FRAGMENTS)
340 #define IS_RETRY(x)            ((x) & FLAG_RETRY)
341 #define POWER_MGT_STATUS(x)    ((x) & FLAG_POWER_MGT)
342 #define HAS_MORE_DATA(x)       ((x) & FLAG_MORE_DATA)
343 #define IS_PROTECTED(x)        ((x) & FLAG_PROTECTED)
344 #define IS_STRICTLY_ORDERED(x) ((x) & FLAG_ORDER)
345
346 /*
347  * Extract subfields from the flags field.
348  */
349 #define FLAGS_DS_STATUS(x)          ((x) & (FLAG_FROM_DS|FLAG_TO_DS))
350
351 /*
352  * Extract an indication of the types of addresses in a data frame from
353  * the frame control field.
354  */
355 #define FCF_ADDR_SELECTOR(x) ((x) & ((FLAG_TO_DS|FLAG_FROM_DS) << 8))
356
357 #define DATA_ADDR_T1         0
358 #define DATA_ADDR_T2         (FLAG_FROM_DS << 8)
359 #define DATA_ADDR_T3         (FLAG_TO_DS << 8)
360 #define DATA_ADDR_T4         ((FLAG_TO_DS|FLAG_FROM_DS) << 8)
361
362 /*
363  * Extract the fragment number and sequence number from the sequence
364  * control field.
365  */
366 #define SEQCTL_FRAGMENT_NUMBER(x) ((x) & 0x000F)
367 #define SEQCTL_SEQUENCE_NUMBER(x) (((x) & 0xFFF0) >> 4)
368
369 /*
370  * Extract subfields from the QoS control field.
371  */
372 #define QOS_TID(x)            ((x) & 0x000F)
373 #define QOS_PRIORITY(x)       ((x) & 0x0007)
374 #define QOS_EOSP(x)           (((x) & 0x0010) >> 4) /* end of service period */
375 #define QOS_ACK_POLICY(x)     (((x) & 0x0060) >> 5)
376 #define QOS_AMSDU_PRESENT(x)  (((x) & 0x0080) >> 6)
377 #define QOS_FIELD_CONTENT(x)  (((x) & 0xFF00) >> 8)
378 #define QOS_MESH_CONTROL_PRESENT(x) (((x) & 0x0100) >> 8)
379
380 #define QOS_FLAG_EOSP    0x10
381
382 /*
383  * Extract subfields from the result of QOS_FIELD_CONTENT().
384  */
385 #define QOS_PS_BUF_STATE_INDICATED(x)  (((x) & 0x02) >> 1)
386 #define QOS_PS_HIGHEST_PRI_BUF_AC(x)   (((x) & 0x0C) >> 2)
387 #define QOS_PS_QAP_BUF_LOAD(x)         (((x) & 0xF0) >> 4)
388
389 /*
390  * Extract subfields from the HT Control field.
391  * .11n D-1.10 & D-2.0, 7.1.3.5a, 32 bits.
392  */
393 #define HTC_LAC(htc)           ((htc) & 0xFF)
394 #define HTC_LAC_MAI(htc)       (((htc) >> 2) & 0xF)
395 #define HTC_IS_ASELI(htc)      (HTC_LAC_MAI(htc) == 0xE)
396 #define HTC_LAC_MAI_MRQ(htc)   ((HTC_LAC_MAI(htc))  & 0x1)
397 #define HTC_LAC_MAI_MSI(htc)   ((HTC_LAC_MAI(htc) >> 1) & 0x7)
398 #define HTC_LAC_MFSI(htc)      (((htc) >> 4) & 0x7)
399 #define HTC_LAC_ASEL_CMD(htc)  (((htc) >> 9) & 0x7)
400 #define HTC_LAC_ASEL_DATA(htc) (((htc) >> 12) & 0xF)
401 #define HTC_LAC_MFB(htc)       (((htc) >> 9) & 0x7F)
402 #define HTC_CAL_POS(htc)       (((htc) >> 16) & 0x3)
403 #define HTC_CAL_SEQ(htc)       (((htc) >> 18) & 0x3)
404 #define HTC_CSI_STEERING(htc)  (((htc) >> 22) & 0x3)
405 #define HTC_NDP_ANN(htc)       (((htc) >> 24) & 0x1)
406 #define HTC_AC_CONSTRAINT(htc) (((htc) >> 30) & 0x1)
407 #define HTC_RDG_MORE_PPDU(htc) (((htc) >> 31) & 0x1)
408
409 /*
410  * Extract subfields from the key octet in WEP-encrypted frames.
411  */
412 #define KEY_OCTET_WEP_KEY(x)   (((x) & 0xC0) >> 6)
413
414 #define KEY_EXTIV    0x20
415 #define EXTIV_LEN    8
416
417 /*
418  * Bits from the Mesh Flags field
419  */
420 #define MESH_FLAGS_ADDRESS_EXTENSION  0x3
421
422 /* ************************************************************************* */
423 /*              Constants used to identify cooked frame types                */
424 /* ************************************************************************* */
425 #define MGT_FRAME            0x00  /* Frame type is management */
426 #define CONTROL_FRAME        0x01  /* Frame type is control */
427 #define DATA_FRAME           0x02  /* Frame type is Data */
428
429 #define DATA_SHORT_HDR_LEN     24
430 #define DATA_LONG_HDR_LEN      30
431 #define MGT_FRAME_HDR_LEN      24  /* Length of Managment frame-headers */
432
433 /*
434  * COMPOSE_FRAME_TYPE() values for management frames.
435  */
436 #define MGT_ASSOC_REQ          0x00  /* association request        */
437 #define MGT_ASSOC_RESP         0x01  /* association response       */
438 #define MGT_REASSOC_REQ        0x02  /* reassociation request      */
439 #define MGT_REASSOC_RESP       0x03  /* reassociation response     */
440 #define MGT_PROBE_REQ          0x04  /* Probe request              */
441 #define MGT_PROBE_RESP         0x05  /* Probe response             */
442 #define MGT_MEASUREMENT_PILOT  0x06  /* Measurement Pilot          */
443 #define MGT_BEACON             0x08  /* Beacon frame               */
444 #define MGT_ATIM               0x09  /* ATIM                       */
445 #define MGT_DISASS             0x0A  /* Disassociation             */
446 #define MGT_AUTHENTICATION     0x0B  /* Authentication             */
447 #define MGT_DEAUTHENTICATION   0x0C  /* Deauthentication           */
448 #define MGT_ACTION             0x0D  /* Action                     */
449 #define MGT_ACTION_NO_ACK      0x0E  /* Action No Ack              */
450 #define MGT_ARUBA_WLAN         0x0F  /* Aruba WLAN Specific        */
451
452 /*
453  * COMPOSE_FRAME_TYPE() values for control frames.
454  */
455 #define CTRL_CONTROL_WRAPPER 0x17  /* Control Wrapper        */
456 #define CTRL_BLOCK_ACK_REQ   0x18  /* Block ack Request        */
457 #define CTRL_BLOCK_ACK       0x19  /* Block ack          */
458 #define CTRL_PS_POLL         0x1A  /* power-save poll               */
459 #define CTRL_RTS             0x1B  /* request to send               */
460 #define CTRL_CTS             0x1C  /* clear to send                 */
461 #define CTRL_ACKNOWLEDGEMENT 0x1D  /* acknowledgement               */
462 #define CTRL_CFP_END         0x1E  /* contention-free period end    */
463 #define CTRL_CFP_ENDACK      0x1F  /* contention-free period end/ack */
464
465 /*
466  * COMPOSE_FRAME_TYPE() values for data frames.
467  */
468 #define DATA                        0x20  /* Data                       */
469 #define DATA_CF_ACK                 0x21  /* Data + CF-Ack              */
470 #define DATA_CF_POLL                0x22  /* Data + CF-Poll             */
471 #define DATA_CF_ACK_POLL            0x23  /* Data + CF-Ack + CF-Poll    */
472 #define DATA_NULL_FUNCTION          0x24  /* Null function (no data)    */
473 #define DATA_CF_ACK_NOD             0x25  /* CF-Ack (no data)           */
474 #define DATA_CF_POLL_NOD            0x26  /* CF-Poll (No data)          */
475 #define DATA_CF_ACK_POLL_NOD        0x27  /* CF-Ack + CF-Poll (no data) */
476
477 #define DATA_QOS_DATA               0x28  /* QoS Data                   */
478 #define DATA_QOS_DATA_CF_ACK        0x29  /* QoS Data + CF-Ack        */
479 #define DATA_QOS_DATA_CF_POLL       0x2A  /* QoS Data + CF-Poll      */
480 #define DATA_QOS_DATA_CF_ACK_POLL   0x2B  /* QoS Data + CF-Ack + CF-Poll    */
481 #define DATA_QOS_NULL               0x2C  /* QoS Null        */
482 #define DATA_QOS_CF_POLL_NOD        0x2E  /* QoS CF-Poll (No Data)      */
483 #define DATA_QOS_CF_ACK_POLL_NOD    0x2F  /* QoS CF-Ack + CF-Poll (No Data) */
484
485
486 /* ************************************************************************* */
487 /*        Logical field codes (dissector's encoding of fixed fields)         */
488 /* ************************************************************************* */
489 enum fixed_field {
490   FIELD_TIMESTAMP, /* 64-bit timestamp */
491   FIELD_BEACON_INTERVAL, /* 16-bit beacon interval */
492   FIELD_CAP_INFO, /* Add capability information tree */
493   FIELD_AUTH_ALG, /* Authentication algorithm used */
494   FIELD_AUTH_TRANS_SEQ, /* Authentication sequence number */
495   FIELD_CURRENT_AP_ADDR,
496   FIELD_LISTEN_IVAL,
497   FIELD_REASON_CODE,
498   FIELD_ASSOC_ID,
499   FIELD_STATUS_CODE,
500   FIELD_CATEGORY_CODE, /* Management action category */
501   FIELD_ACTION_CODE, /* Management action code */
502   FIELD_DIALOG_TOKEN, /* Management action dialog token */
503   FIELD_WME_ACTION_CODE, /* Management notification action code */
504   FIELD_WME_DIALOG_TOKEN, /* Management notification dialog token */
505   FIELD_WME_STATUS_CODE, /* Management notification setup response status code
506                           */
507   FIELD_QOS_ACTION_CODE,
508   FIELD_QOS_TS_INFO,
509   FIELD_DLS_ACTION_CODE,
510   FIELD_DST_MAC_ADDR, /* DLS destination MAC address */
511   FIELD_SRC_MAC_ADDR, /* DLS source MAC address */
512   FIELD_DLS_TIMEOUT, /* DLS timeout value */
513   FIELD_SCHEDULE_INFO, /* Schedule Info field */
514   FIELD_ACTION, /* Action field */
515   FIELD_BLOCK_ACK_ACTION_CODE,
516   FIELD_QOS_INFO_AP,
517   FIELD_QOS_INFO_STA,
518   FIELD_BLOCK_ACK_PARAM,
519   FIELD_BLOCK_ACK_TIMEOUT,
520   FIELD_BLOCK_ACK_SSC,
521   FIELD_DELBA_PARAM_SET,
522   FIELD_MAX_REG_PWR,
523   FIELD_MEASUREMENT_PILOT_INT,
524   FIELD_COUNTRY_STR,
525   FIELD_MAX_TX_PWR,
526   FIELD_TX_PWR_USED,
527   FIELD_TRANSCEIVER_NOISE_FLOOR,
528   FIELD_DS_PARAM_SET,
529   FIELD_CHANNEL_WIDTH,
530   FIELD_SM_PWR_CNTRL,
531   FIELD_PCO_PHASE_CNTRL,
532   FIELD_PSMP_PARAM_SET,
533   FIELD_PSMP_STA_INFO,
534   FIELD_MIMO_CNTRL,
535   FIELD_ANT_SELECTION,
536   FIELD_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT,
537   FIELD_HT_INFORMATION,
538   FIELD_HT_ACTION_CODE,
539   FIELD_PA_ACTION_CODE,
540   FIELD_FT_ACTION_CODE,
541   FIELD_STA_ADDRESS,
542   FIELD_TARGET_AP_ADDRESS,
543   FIELD_GAS_COMEBACK_DELAY,
544   FIELD_GAS_FRAGMENT_ID,
545   FIELD_SA_QUERY_ACTION_CODE,
546   FIELD_TRANSACTION_ID,
547   FIELD_TDLS_ACTION_CODE,
548   FIELD_TARGET_CHANNEL,
549   FIELD_REGULATORY_CLASS,
550   FIELD_MESH_ACTION,
551   FIELD_MULTIHOP_ACTION,
552   FIELD_MESH_CONTROL,
553   FIELD_SELFPROT_ACTION,
554   FIELD_WNM_ACTION_CODE,
555   /* add any new fixed field value above this line */
556   MAX_FIELD_NUM
557 };
558
559 /* ************************************************************************* */
560 /*        Logical field codes (IEEE 802.11 encoding of tags)                 */
561 /* ************************************************************************* */
562 #define TAG_SSID                     0
563 #define TAG_SUPP_RATES               1
564 #define TAG_FH_PARAMETER             2
565 #define TAG_DS_PARAMETER             3
566 #define TAG_CF_PARAMETER             4
567 #define TAG_TIM                      5
568 #define TAG_IBSS_PARAMETER           6
569 #define TAG_COUNTRY_INFO             7
570 #define TAG_FH_HOPPING_PARAMETER     8
571 #define TAG_FH_HOPPING_TABLE         9
572 #define TAG_REQUEST                  10
573 #define TAG_QBSS_LOAD                11
574 #define TAG_EDCA_PARAM_SET           12
575 #define TAG_TSPEC                    13
576 #define TAG_TCLAS                    14
577 #define TAG_SCHEDULE                 15
578 #define TAG_CHALLENGE_TEXT           16
579
580 #define TAG_POWER_CONSTRAINT         32
581 #define TAG_POWER_CAPABILITY         33
582 #define TAG_TPC_REQUEST              34
583 #define TAG_TPC_REPORT               35
584 #define TAG_SUPPORTED_CHANNELS       36
585 #define TAG_CHANNEL_SWITCH_ANN       37
586 #define TAG_MEASURE_REQ              38
587 #define TAG_MEASURE_REP              39
588 #define TAG_QUIET                    40
589 #define TAG_IBSS_DFS                 41
590 #define TAG_ERP_INFO                 42
591 #define TAG_TS_DELAY                 43
592 #define TAG_TCLAS_PROCESS            44
593 #define TAG_HT_CAPABILITY            45  /* IEEE Stc 802.11n/D2.0 */
594 #define TAG_QOS_CAPABILITY           46
595 #define TAG_ERP_INFO_OLD             47  /* IEEE Std 802.11g/D4.0 */
596 #define TAG_RSN_IE                   48
597 /* Reserved 49 */
598 #define TAG_EXT_SUPP_RATES           50
599 #define TAG_AP_CHANNEL_REPORT        51
600 #define TAG_NEIGHBOR_REPORT          52
601 #define TAG_RCPI                     53
602 #define TAG_MOBILITY_DOMAIN          54   /* IEEE Std 802.11r-2008 */
603 #define TAG_FAST_BSS_TRANSITION      55   /* IEEE Std 802.11r-2008 */
604 #define TAG_TIMEOUT_INTERVAL         56   /* IEEE Std 802.11r-2008 */
605 #define TAG_RIC_DATA                 57   /* IEEE Std 802.11r-2008 */
606 /* 58 ??? */
607 #define TAG_SUPPORTED_REGULATORY_CLASSES            59 /* IEEE Std 802.11w-2009 */
608 #define TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT    60 /* IEEE Std 802.11w-2009 */
609 #define TAG_HT_INFO                  61   /* IEEE Stc 802.11n/D2.0 */
610 #define TAG_SECONDARY_CHANNEL_OFFSET 62   /* IEEE Stc 802.11n/D1.10/D2.0 */
611 #define TAG_TIME_ADV                 69   /* IEEE Std 802.11p-2010 */
612 #define TAG_20_40_BSS_CO_EX          72   /* IEEE P802.11n/D6.0 */
613 #define TAG_20_40_BSS_INTOL_CH_REP   73   /* IEEE P802.11n/D6.0 */
614 #define TAG_OVERLAP_BSS_SCAN_PAR     74   /* IEEE P802.11n/D6.0 */
615 #define TAG_RIC_DESCRIPTOR           75   /* IEEE Std 802.11r-2008 */
616 #define TAG_MMIE                     76   /* IEEE Std 802.11w-2009 */
617 #define TAG_TIME_ZONE                98   /* IEEE STd 802.11v-2011 */
618 #define TAG_LINK_IDENTIFIER          101  /* IEEE Std 802.11z-2010 */
619 #define TAG_WAKEUP_SCHEDULE          102  /* IEEE Std 802.11z-2010 */
620 #define TAG_CHANNEL_SWITCH_TIMING    104  /* IEEE Std 802.11z-2010 */
621 #define TAG_PTI_CONTROL              105  /* IEEE Std 802.11z-2010 */
622 #define TAG_PU_BUFFER_STATUS         106  /* IEEE Std 802.11z-2010 */
623 #define TAG_INTERWORKING             107  /* IEEE Std 802.11u-2011 */
624 #define TAG_ADVERTISEMENT_PROTOCOL   108  /* IEEE Std 802.11u-2011 */
625 #define TAG_EXPIDITED_BANDWIDTH_REQ  109  /* IEEE Std 802.11u-2011 */
626 #define TAG_QOS_MAP_SET              110  /* IEEE Std 802.11u-2011 */
627 #define TAG_ROAMING_CONSORTIUM       111  /* IEEE Std 802.11u-2011 */
628 #define TAG_EMERGENCY_ALERT_ID       112  /* IEEE Std 802.11u-2011 */
629 #define TAG_MESH_CONFIGURATION       113  /* IEEE Std 802.11s-2011 */
630 #define TAG_MESH_ID                  114  /* IEEE Std 802.11s-2011 */
631 #define TAG_MESH_PEERING_MGMT        117  /* IEEE Std 802.11s-2011 */
632 #define TAG_RANN                     126  /* IEEE Std 802.11s-2011 */
633 #define TAG_EXTENDED_CAPABILITIES    127  /* IEEE Stc 802.11n/D1.10/D2.0 */
634 #define TAG_AGERE_PROPRIETARY        128
635 #define TAG_MESH_PREQ                130  /* IEEE Std 802.11s-2011 */
636 #define TAG_MESH_PREP                131  /* IEEE Std 802.11s-2011 */
637 #define TAG_MESH_PERR                132  /* IEEE Std 802.11s-2011 */
638 #define TAG_CISCO_CCX1_CKIP          133  /* Cisco Compatible eXtensions */
639 #define TAG_CISCO_UNKNOWN_88         136  /* Cisco Compatible eXtensions? */
640 #define TAG_CISCO_UNKNOWN_95         149  /* Cisco Compatible eXtensions */
641 #define TAG_CISCO_UNKNOWN_96         150  /* Cisco Compatible eXtensions */
642 #define TAG_SYMBOL_PROPRIETARY       173
643 #define TAG_VENDOR_SPECIFIC_IE       221
644
645 static const value_string tag_num_vals[] = {
646   { TAG_SSID, "SSID parameter set" },
647   { TAG_SUPP_RATES, "Supported Rates" },
648   { TAG_FH_PARAMETER, "FH Parameter set" },
649   { TAG_DS_PARAMETER, "DS Parameter set" },
650   { TAG_CF_PARAMETER, "CF Parameter set" },
651   { TAG_TIM, "Traffic Indication Map (TIM)" },
652   { TAG_IBSS_PARAMETER, "IBSS Parameter set" },
653   { TAG_COUNTRY_INFO, "Country Information" },
654   { TAG_FH_HOPPING_PARAMETER, "Hopping Pattern Parameters" },
655   { TAG_FH_HOPPING_TABLE, "Hopping Pattern Table" },
656   { TAG_REQUEST, "Request" },
657   { TAG_QBSS_LOAD, "QBSS Load Element" },
658   { TAG_EDCA_PARAM_SET, "EDCA Parameter Set" },
659   { TAG_TSPEC, "Traffic Specification" },
660   { TAG_TCLAS, "Traffic Classification" },
661   { TAG_SCHEDULE, "Schedule" },
662   { TAG_CHALLENGE_TEXT, "Challenge text" },
663   { TAG_POWER_CONSTRAINT, "Power Constraint" },
664   { TAG_POWER_CAPABILITY, "Power Capability" },
665   { TAG_TPC_REQUEST, "TPC Request" },
666   { TAG_TPC_REPORT, "TPC Report" },
667   { TAG_SUPPORTED_CHANNELS, "Supported Channels" },
668   { TAG_CHANNEL_SWITCH_ANN, "Channel Switch Announcement" },
669   { TAG_MEASURE_REQ, "Measurement Request" },
670   { TAG_MEASURE_REP, "Measurement Report" },
671   { TAG_QUIET, "Quiet" },
672   { TAG_IBSS_DFS, "IBSS DFS" },
673   { TAG_ERP_INFO, "ERP Information" },
674   { TAG_TS_DELAY, "TS Delay" },
675   { TAG_TCLAS_PROCESS, "TCLAS Processing" },
676   { TAG_HT_CAPABILITY, "HT Capabilities (802.11n D1.10)" },
677   { TAG_QOS_CAPABILITY, "QoS Capability" },
678   { TAG_ERP_INFO_OLD, "ERP Information" }, /* Reserved... */
679   { TAG_RSN_IE, "RSN Information" },
680   { TAG_EXT_SUPP_RATES, "Extended Supported Rates" },
681   { TAG_AP_CHANNEL_REPORT, "AP Channel Report" },
682   { TAG_NEIGHBOR_REPORT, "Neighbor Report" },
683   { TAG_RCPI, "RCPI" },
684   { TAG_MOBILITY_DOMAIN, "Mobility Domain" },
685   { TAG_FAST_BSS_TRANSITION, "Fast BSS Transition" },
686   { TAG_TIMEOUT_INTERVAL, "Timeout Interval" },
687   { TAG_RIC_DATA, "RIC Data" },
688   { TAG_SUPPORTED_REGULATORY_CLASSES, "Supported Regulatory Classes" },
689   { TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT, "Extended Channel Switch Announcement" },
690   { TAG_HT_INFO, "HT Information (802.11n D1.10)" },
691   { TAG_SECONDARY_CHANNEL_OFFSET, "Secondary Channel Offset (802.11n D1.10)" },
692   { TAG_TIME_ADV, "Time Advertisement" },
693   { TAG_20_40_BSS_CO_EX, "20/40 BSS Coexistence" },
694   { TAG_20_40_BSS_INTOL_CH_REP, "20/40 BSS Intolerant Channel Report" },   /* IEEE P802.11n/D6.0 */
695   { TAG_OVERLAP_BSS_SCAN_PAR, "Overlapping BSS Scan Parameters" },       /* IEEE P802.11n/D6.0 */
696   { TAG_RIC_DESCRIPTOR, "RIC Descriptor" },
697   { TAG_MMIE, "Management MIC" },
698   { TAG_TIME_ZONE, "Time Zone" },
699   { TAG_LINK_IDENTIFIER, "Link Identifier" },
700   { TAG_WAKEUP_SCHEDULE, "Wakeup Schedule" },
701   { TAG_CHANNEL_SWITCH_TIMING, "Channel Switch Timing" },
702   { TAG_PTI_CONTROL, "PTI Control" },
703   { TAG_PU_BUFFER_STATUS, "PU Buffer Status" },
704   { TAG_INTERWORKING, "Interworking" },
705   { TAG_ADVERTISEMENT_PROTOCOL, "Advertisement Protocol"},
706   { TAG_EXPIDITED_BANDWIDTH_REQ, "Expedited Bandwidth Request" },
707   { TAG_QOS_MAP_SET, "QoS Map Set" },
708   { TAG_ROAMING_CONSORTIUM, "Roaming Consortium" },
709   { TAG_EMERGENCY_ALERT_ID, "Emergency Alert Identifier" },
710   { TAG_MESH_ID, "Mesh ID" },
711   { TAG_MESH_CONFIGURATION, "Mesh Configuration" },
712   { TAG_MESH_PEERING_MGMT, "Mesh Peering Management" },
713   { TAG_RANN, "Root Announcement" },
714   { TAG_EXTENDED_CAPABILITIES, "Extended Capabilities" },
715   { TAG_AGERE_PROPRIETARY, "Agere Proprietary" },
716   { TAG_MESH_PREQ, "Path Request" },
717   { TAG_MESH_PREP, "Path Reply" },
718   { TAG_MESH_PERR, "Path Error" },
719   { TAG_CISCO_CCX1_CKIP, "Cisco CCX1 CKIP + Device Name" },
720   { TAG_CISCO_UNKNOWN_88, "Cisco Unknown 88" },
721   { TAG_CISCO_UNKNOWN_95, "Cisco Unknown 95" },
722   { TAG_CISCO_UNKNOWN_96, "Cisco Unknown 96" },
723   { TAG_SYMBOL_PROPRIETARY, "Symbol Proprietary" },
724   { TAG_VENDOR_SPECIFIC_IE, "Vendor Specific" },
725   { 0, NULL }
726 };
727
728 #define WPA_OUI     (const guint8 *) "\x00\x50\xF2"
729 #define RSN_OUI     (const guint8 *) "\x00\x0F\xAC"
730 #define WME_OUI     (const guint8 *) "\x00\x50\xF2"
731 #define PRE_11N_OUI (const guint8 *) "\x00\x90\x4c" /* 802.11n pre 1 oui */
732 #define WFA_OUI     (const guint8 *) "\x50\x6f\x9a"
733
734 /* WFA vendor specific subtypes */
735 #define WFA_SUBTYPE_P2P 9
736
737 #define PMKID_LEN 16
738
739 /* ************************************************************************* */
740 /*              Supported Rates (7.3.2.2)                                    */
741 /* ************************************************************************* */
742
743 static const value_string ieee80211_supported_rates_vals[] = {
744   { 0x02, "1" },
745   { 0x03, "1.5" },
746   { 0x04, "2" },
747   { 0x05, "2.5" },
748   { 0x06, "3" },
749   { 0x09, "4.5" },
750   { 0x0B, "5.5" },
751   { 0x0C, "6" },
752   { 0x12, "9" },
753   { 0x16, "11" },
754   { 0x18, "12" },
755   { 0x1B, "13.5" },
756   { 0x24, "18" },
757   { 0x2C, "22" },
758   { 0x30, "24" },
759   { 0x36, "27" },
760   { 0x42, "33" },
761   { 0x48, "36" },
762   { 0x60, "48" },
763   { 0x6C, "54" },
764   { 0x82, "1(B)" },
765   { 0x83, "1.5(B)" },
766   { 0x84, "2(B)" },
767   { 0x85, "2.5(B)" },
768   { 0x86, "3(B)" },
769   { 0x89, "4.5(B)" },
770   { 0x8B, "5.5(B)" },
771   { 0x8C, "6(B)" },
772   { 0x92, "9(B)" },
773   { 0x96, "11(B)" },
774   { 0x98, "12(B)" },
775   { 0x9B, "13.5(B)" },
776   { 0xA4, "18(B)" },
777   { 0xAC, "22(B)" },
778   { 0xB0, "24(B)" },
779   { 0xB6, "27(B)" },
780   { 0xC2, "33(B)" },
781   { 0xC8, "36(B)" },
782   { 0xE0, "48(B)" },
783   { 0xEC, "54(B)" },
784   { 0xFF, "BSS requires support for mandatory features of HT PHY (IEEE 802.11 - Clause 20)" },
785   { 0,    NULL}
786 };
787 /* ************************************************************************* */
788 /*                         7.3.1.7 Reason Code field                         */
789 /* ************************************************************************* */
790 static const value_string ieee80211_reason_code[] = {
791   { 1, "Unspecified reason" },
792   { 2, "Previous authentication no longer valid" },
793   { 3, "Deauthenticated because sending STA is leaving (or has left) IBSS or ESS" },
794   { 4, "Disassociated due to inactivity" },
795   { 5, "Disassociated because AP is unable to handle all currently associated STAs" },
796   { 6, "Class 2 frame received from nonauthenticated STA" },
797   { 7, "Class 3 frame received from nonassociated STA" },
798   { 8, "Disassociated because sending STA is leaving (or has left) BSS" },
799   { 9, "STA requesting (re)association is not authenticated with responding STA" },
800   { 10, "Disassociated because the information in the Power Capability element is unacceptable" },
801   { 11, "Disassociated because the information in the Supported Channels element is unacceptable" },
802   { 12, "Reserved" },
803   { 13, "Invalid information element, i.e., an information element defined in this standard for which the content does not meet the specifications in Clause 7" },
804   { 14, "Message integrity code (MIC) failure" },
805   { 15, "4-Way Handshake timeout" },
806   { 16, "Group Key Handshake timeout" },
807   { 17, "Information element in 4-Way Handshake different from (Re)Association Request/Probe Response/Beacon frame" },
808   { 18, "Invalid group cipher" },
809   { 19, "Invalid pairwise cipher" },
810   { 20, "Invalid AKMP" },
811   { 21, "Unsupported RSN information element version" },
812   { 22, "Invalid RSN information element capabilities" },
813   { 23, "IEEE 802.1X authentication failed" },
814   { 24, "Cipher suite rejected because of the security policy" },
815   { 27, "Disassociated because session terminated by SSP request" },
816   { 28, "Disassociated because of lack of SSP roaming agreement" },
817   { 29, "Requested service rejected because of SSP cipher suite or AKM requirement " },
818   { 30, "Requested service not authorized in this location" },
819   { 31, "TS deleted because QoS AP lacks sufficient bandwidth for this QoS STA due to a change in BSS service characteristics or operational mode" },
820   { 32, "Disassociated for unspecified, QoS-related reason" },
821   { 33, "Disassociated because QoS AP lacks sufficient bandwidth for this QoS STA" },
822   { 34, "Disassociated because excessive number of frames need to be acknowledged, but are not acknowledged due to AP transmissions and/or poor channel conditions" },
823   { 35, "Disassociated because STA is transmitting outside the limits of its TXOPs" },
824   { 36, "Requested from peer STA as the STA is leaving the BSS (or resetting)" },
825   { 37, "Requested from peer STA as it does not want to use the mechanism" },
826   { 38, "Requested from peer STA as the STA received frames using the mechanism for which a setup is required" },
827   { 39, "Requested from peer STA due to timeout" },
828   { 45, "Peer STA does not support the requested cipher suite" },
829   { 46, "Disassociated because authorized access limit reached" },
830   { 47, "Disassociated due to external service requirements" },
831   { 52, "SME cancels the mesh peering instance with the reason other than reaching the maximum number of peer mesh STAs" },
832   { 53, "The mesh STA has reached the supported maximum number of peer mesh STAs" },
833   { 54, "The received information violates the Mesh Configuration policy configured in the mesh STA profile" },
834   { 55, "The mesh STA has received a Mesh Peering Close message requesting to close the mesh peering" },
835   { 56, "The mesh STA has re-sent dot11MeshMaxRetries Mesh Peering Open messages, without receiving a Mesh Peering Confirm message" },
836   { 57, "The confirmTimer for the mesh peering instance times out" },
837   { 58, "The mesh STA fails to unwrap the GTK or the values in the wrapped contents do not match" },
838   { 59, "The mesh STA receives inconsistent information about the mesh parameters between Mesh Peering Management frames" },
839   { 60, "The mesh STA fails the authenticated mesh peering exchange because due to failure in selecting either the pairwise ciphersuite or group ciphersuite" },
840   { 61, "The mesh STA does not have proxy information for this external destination" },
841   { 62, "The mesh STA does not have forwarding information for this destination" },
842   { 63, "The mesh STA determines that the link to the next hop of an active path in its forwarding information is no longer usable" },
843   { 64, "The Deauthentication frame was sent because the MAC address of the STA already exists in the mesh BSS. See 11.3.3 (Additional mechanisms for an AP collocated with a mesh STA)" },
844   { 65, "The mesh STA performs channel switch to meet regulatory requirements" },
845   { 66, "The mesh STA performs channel switch with unspecified reason" },
846   { 0,    NULL}
847 };
848
849 /* ************************************************************************* */
850 /*                         7.3.1.9 Status Code field                         */
851 /* ************************************************************************* */
852 static const value_string ieee80211_status_code[] = {
853   { 0, "Successful" },
854   { 1, "Unspecified failure" },
855   { 2, "TDLS wakeup schedule rejected but alternative schedule provided" },
856   { 3, "TDLS wakeup schedule rejected" },
857   { 5, "Security disabled" },
858   { 6, "Unacceptable lifetime" },
859   { 7, "Not in same BSS" },
860   { 10, "Cannot support all requested capabilities in the Capability Information field" },
861   { 11, "Reassociation denied due to inability to confirm that association exists" },
862   { 12, "Association denied due to reason outside the scope of this standard" },
863   { 13, "Responding STA does not support the specified authentication algorithm" },
864   { 14, "Received an Authentication frame with authentication transaction sequence number out of expected sequence" },
865   { 15, "Authentication rejected because of challenge failure" },
866   { 16, "Authentication rejected due to timeout waiting for next frame in sequence" },
867   { 17, "Association denied because AP is unable to handle additional associated STAs" },
868   { 18, "Association denied due to requesting STA not supporting all of the data rates in the BSSBasicRateSet parameter" },
869   { 19, "Association denied due to requesting STA not supporting the short preamble option" },
870   { 20, "Association denied due to requesting STA not supporting the PBCC modulation option" },
871   { 21, "Association denied due to requesting STA not supporting the Channel Agility option" },
872   { 22, "Association request rejected because Spectrum Management capability is required" },
873   { 23, "Association request rejected because the information in the Power Capability element is unacceptable" },
874   { 24, "Association request rejected because the information in the Supported Channels element is unacceptable" },
875   { 25, "Association denied due to requesting STA not supporting the Short Slot Time option" },
876   { 26, "Association denied due to requesting STA not supporting the DSSS-OFDM option" },
877   { 27, "Reserved Association denied because the requesting STA does not support HT features" },
878   { 28, "R0KH unreachable" },
879   { 29, "Association denied because the requesting STA does not support the phased coexistence operation (PCO) transition time required by the AP" },
880   { 30, "Association request rejected temporarily; try again later" },
881   { 31, "Robust Management frame policy violation" },
882   { 32, "Unspecified, QoS-related failure" },
883   { 33, "Association denied because QoS AP has insufficient bandwidth to handle another QoS STA" },
884   { 34, "Association denied due to excessive frame loss rates and/or poor conditions on current operating channel" },
885   { 35, "Association (with QoS BSS) denied because the requesting STA does not support the QoS facility" },
886   { 36, "Reserved" },
887   { 37, "The request has been declined" },
888   { 38, "The request has not been successful as one or more parameters have invalid values" },
889   { 39, "The TS has not been created because the request cannot be honored; however, a suggested TSPEC is provided so that the initiating STA may attempt to set another TS with the suggested changes to the TSPEC" },
890   { 40, "Invalid information element, i.e., an information element defined in this standard for which the content does not meet the specifications in Clause 7" },
891   { 41, "Invalid group cipher" },
892   { 42, "Invalid pairwise cipher" },
893   { 43, "Invalid AKMP" },
894   { 44, "Unsupported RSN information element version" },
895   { 45, "Invalid RSN information element capabilities" },
896   { 46, "Cipher suite rejected because of security policy" },
897   { 47, "The TS has not been created; however, the HC may be capable of creating a TS, in response to a request, after the time indicated in the TS Delay element" },
898   { 48, "Direct link is not allowed in the BSS by policy" },
899   { 49, "The Destination STA is not present within this BSS" },
900   { 50, "The Destination STA is not a QoS STA" },
901   { 51, "Association denied because the ListenInterval is too large" },
902   { 52, "Invalid FT Action frame count" },
903   { 53, "Invalid pairwise master key identifier (PMKID)" },
904   { 54, "Invalid MDIE" },
905   { 55, "Invalid FTIE" },
906   { 59, "GAS Advertisement Protocol not supported" },
907   { 60, "No outstanding GAS request" },
908   { 61, "GAS Response not received from the Advertisement Server" },
909   { 62, "STA timed out waiting for GAS Query Response" },
910   { 63, "GAS Response is larger than query response length limit" },
911   { 64, "Request refused because home network does not support request" },
912   { 65, "Advertisement Server in the network is not currently reachable" },
913   { 67, "Request refused due to permissions received via SSPN interface" },
914   { 68, "Request refused because AP does not support unauthenticated access" },
915   { 72, "Invalid contents of RSNIE" },
916   { 76, "Authentication is rejected because an Anti-Clogging Token is required" },
917   { 77, "Authentication is rejected because the offered finite cyclic group is not supported" },
918   { 78, "The TBTT adjustment request has not been successful because the STA could not find an alternative TBTT" },
919   { 79, "Transmission failure" },
920   { 0,    NULL}
921 };
922
923 /* ************************************************************************* */
924 /*                         Frame types, and their names                      */
925 /* ************************************************************************* */
926 static const value_string frame_type_subtype_vals[] = {
927   {MGT_ASSOC_REQ,             "Association Request"},
928   {MGT_ASSOC_RESP,            "Association Response"},
929   {MGT_REASSOC_REQ,           "Reassociation Request"},
930   {MGT_REASSOC_RESP,          "Reassociation Response"},
931   {MGT_PROBE_REQ,             "Probe Request"},
932   {MGT_PROBE_RESP,            "Probe Response"},
933   {MGT_MEASUREMENT_PILOT,     "Measurement Pilot"},
934   {MGT_BEACON,                "Beacon frame"},
935   {MGT_ATIM,                  "ATIM"},
936   {MGT_DISASS,                "Disassociate"},
937   {MGT_AUTHENTICATION,        "Authentication"},
938   {MGT_DEAUTHENTICATION,      "Deauthentication"},
939   {MGT_ACTION,                "Action"},
940   {MGT_ACTION_NO_ACK,         "Action No Ack"},
941   {MGT_ARUBA_WLAN,            "Aruba Management"},
942
943   {CTRL_CONTROL_WRAPPER,      "Control Wrapper"},
944   {CTRL_BLOCK_ACK_REQ,        "802.11 Block Ack Req"},
945   {CTRL_BLOCK_ACK,            "802.11 Block Ack"},
946   {CTRL_PS_POLL,              "Power-Save poll"},
947   {CTRL_RTS,                  "Request-to-send"},
948   {CTRL_CTS,                  "Clear-to-send"},
949   {CTRL_ACKNOWLEDGEMENT,      "Acknowledgement"},
950   {CTRL_CFP_END,              "CF-End (Control-frame)"},
951   {CTRL_CFP_ENDACK,           "CF-End + CF-Ack (Control-frame)"},
952
953   {DATA,                      "Data"},
954   {DATA_CF_ACK,               "Data + CF-Ack"},
955   {DATA_CF_POLL,              "Data + CF-Poll"},
956   {DATA_CF_ACK_POLL,          "Data + CF-Ack + CF-Poll"},
957   {DATA_NULL_FUNCTION,        "Null function (No data)"},
958   {DATA_CF_ACK_NOD,           "Acknowledgement (No data)"},
959   {DATA_CF_POLL_NOD,          "CF-Poll (No data)"},
960   {DATA_CF_ACK_POLL_NOD,      "CF-Ack/Poll (No data)"},
961   {DATA_QOS_DATA,             "QoS Data"},
962   {DATA_QOS_DATA_CF_ACK,      "QoS Data + CF-Acknowledgment"},
963   {DATA_QOS_DATA_CF_POLL,     "QoS Data + CF-Poll"},
964   {DATA_QOS_DATA_CF_ACK_POLL, "QoS Data + CF-Ack + CF-Poll"},
965   {DATA_QOS_NULL,             "QoS Null function (No data)"},
966   {DATA_QOS_CF_POLL_NOD,      "QoS CF-Poll (No Data)"},
967   {DATA_QOS_CF_ACK_POLL_NOD,  "QoS CF-Ack + CF-Poll (No data)"},
968   {0,                         NULL}
969 };
970
971 /* ************************************************************************* */
972 /*                             802.1D Tag Names                              */
973 /* ************************************************************************* */
974 static const char *qos_tags[8] = {
975   "Best Effort",
976   "Background",
977   "Spare",
978   "Excellent Effort",
979   "Controlled Load",
980   "Video",
981   "Voice",
982   "Network Control"
983 };
984
985 /* ************************************************************************* */
986 /*                 WME Access Category Names (by 802.1D Tag)                 */
987 /* ************************************************************************* */
988 static const char *qos_acs[8] = {
989   "Best Effort",
990   "Background",
991   "Background",
992   "Video",
993   "Video",
994   "Video",
995   "Voice",
996   "Voice"
997 };
998
999 /* ************************************************************************* */
1000 /*                   WME Access Category Names (by WME ACI)                  */
1001 /* ************************************************************************* */
1002 static const value_string wme_acs[] = {
1003   { 0, "Best Effort" },
1004   { 1, "Background" },
1005   { 2, "Video" },
1006   { 3, "Voice" },
1007   { 0, NULL }
1008 };
1009
1010 /* ************************************************************************* */
1011 /*                  Aruba Management Type                                    */
1012 /* ************************************************************************* */
1013 static const value_string aruba_mgt_typevals[] = {
1014   { 0x0001,       "Hello" },
1015   { 0x0002,       "Probe" },
1016   { 0x0003,       "MTU" },
1017   { 0x0004,       "Ageout" },
1018   { 0x0005,       "Heartbeat" },
1019   { 0x0006,       "Deauth" },
1020   { 0x0007,       "Disassoc" },
1021   { 0x0008,       "Probe response" },
1022   { 0x0009,       "Tunnel update" },
1023   { 0x000A,       "Laser beam active" },
1024   { 0x000B,       "Client IP" },
1025   { 0x000C,       "Laser beam active v2" },
1026   { 0x000D,       "AP statistics" },
1027   { 0,            NULL }
1028 };
1029
1030 /*** Begin: Action Fixed Parameter ***/
1031 #define CAT_SPECTRUM_MGMT      0
1032 #define CAT_QOS                1
1033 #define CAT_DLS                2
1034 #define CAT_BLOCK_ACK          3
1035 #define CAT_PUBLIC             4
1036
1037 #define CAT_RADIO_MEASUREMENT   5
1038 #define CAT_FAST_BSS_TRANSITION 6
1039 #define CAT_HT                  7
1040 #define CAT_SA_QUERY            8
1041 #define CAT_PUBLIC_PROTECTED    9
1042 #define CAT_WNM                 10
1043 #define CAT_UNPROTECTED_WNM     11
1044 #define CAT_TDLS                12
1045
1046 /* per 11s draft 12.0 */
1047 #define CAT_MESH                13
1048 #define CAT_MULTIHOP            14
1049 #define CAT_SELF_PROTECTED      15
1050
1051 #define CAT_MGMT_NOTIFICATION   17
1052 #define CAT_VENDOR_SPECIFIC_PROTECTED 126
1053 #define CAT_VENDOR_SPECIFIC     127
1054
1055 #define CAT_MESH_LINK_METRIC               31
1056 #define CAT_MESH_PATH_SELECTION            32
1057 #define CAT_MESH_INTERWORKING              33
1058 #define CAT_MESH_RESOURCE_COORDINATION     34
1059 #define CAT_MESH_SECURITY_ARCHITECTURE     35
1060
1061 #define SM_ACTION_MEASUREMENT_REQUEST   0
1062 #define SM_ACTION_MEASUREMENT_REPORT    1
1063 #define SM_ACTION_TPC_REQUEST           2
1064 #define SM_ACTION_TPC_REPORT            3
1065 #define SM_ACTION_CHAN_SWITCH_ANNC      4
1066 #define SM_ACTION_EXT_CHAN_SWITCH_ANNC  5
1067
1068 #define SM_ACTION_ADDTS_REQUEST     0
1069 #define SM_ACTION_ADDTS_RESPONSE    1
1070 #define SM_ACTION_DELTS             2
1071 #define SM_ACTION_QOS_SCHEDULE      3
1072
1073 #define SM_ACTION_DLS_REQUEST       0
1074 #define SM_ACTION_DLS_RESPONSE      1
1075 #define SM_ACTION_DLS_TEARDOWN      2
1076
1077 #define BA_ADD_BLOCK_ACK_REQUEST    0
1078 #define BA_ADD_BLOCK_ACK_RESPONSE   1
1079 #define BA_DELETE_BLOCK_ACK         2
1080
1081 #define PA_DSE_ENABLEMENT                  1
1082 #define PA_DSE_DEENABLEMENT                2
1083 #define PA_DSE_REG_LOC_ANNOUNCEMENT        3
1084 #define PA_EXT_CHANNEL_SWITCH_ANNOUNCEMENT 4
1085 #define PA_DSE_MEASUREMENT_REQUEST         5
1086 #define PA_DSE_MEASUREMENT_REPORT          6
1087 #define PA_MEASUREMENT_PILOT               7
1088 #define PA_DSE_POWER_CONSTRAINT            8
1089 #define PA_VENDOR_SPECIFIC                 9
1090 #define PA_GAS_INITIAL_REQUEST             10
1091 #define PA_GAS_INITIAL_RESPONSE            11
1092 #define PA_GAS_COMEBACK_REQUEST            12
1093 #define PA_GAS_COMEBACK_RESPONSE           13
1094 #define PA_TDLS_DISCOVERY_RESPONSE         14
1095
1096 #define HT_ACTION_NOTIFY_CHAN_WIDTH           0
1097 #define HT_ACTION_SM_PWR_SAVE                 1
1098 #define HT_ACTION_PSMP_ACTION                 2
1099 #define HT_ACTION_SET_PCO_PHASE               3
1100 #define HT_ACTION_MIMO_CSI                    4
1101 #define HT_ACTION_MIMO_BEAMFORMING            5
1102 #define HT_ACTION_MIMO_COMPRESSED_BEAMFORMING 6
1103 #define HT_ACTION_ANT_SEL_FEEDBACK            7
1104 #define HT_ACTION_HT_INFO_EXCHANGE            8
1105
1106 /* IEEE Std 802.11r-2008, 7.4.8, Table 7-57g */
1107 #define FT_ACTION_REQUEST               1
1108 #define FT_ACTION_RESPONSE              2
1109 #define FT_ACTION_CONFIRM               3
1110 #define FT_ACTION_ACK                   4
1111
1112 /* SA Query Action frame codes (IEEE 802.11w-2009, 7.4.9) */
1113 #define SA_QUERY_REQUEST                0
1114 #define SA_QUERY_RESPONSE               1
1115
1116 /* IEEE Std 802.11z-2010, 7.4.11, Table 7-57v1 */
1117 #define TDLS_SETUP_REQUEST              0
1118 #define TDLS_SETUP_RESPONSE             1
1119 #define TDLS_SETUP_CONFIRM              2
1120 #define TDLS_TEARDOWN                   3
1121 #define TDLS_PEER_TRAFFIC_INDICATION    4
1122 #define TDLS_CHANNEL_SWITCH_REQUEST     5
1123 #define TDLS_CHANNEL_SWITCH_RESPONSE    6
1124 #define TDLS_PEER_PSM_REQUEST           7
1125 #define TDLS_PEER_PSM_RESPONSE          8
1126 #define TDLS_PEER_TRAFFIC_RESPONSE      9
1127 #define TDLS_DISCOVERY_REQUEST          10
1128
1129 /* 11s draft 12.0, table 7-57v30 */
1130 #define MESH_ACTION_LINK_METRIC_REPORT              0
1131 #define MESH_ACTION_HWMP                            1
1132 #define MESH_ACTION_GATE_ANNOUNCE                   2
1133 #define MESH_ACTION_CONGESTION_CTL                  3
1134 #define MESH_ACTION_MCCA_SETUP_REQUEST              4
1135 #define MESH_ACTION_MCCA_SETUP_REPLY                5
1136 #define MESH_ACTION_MCCA_ADV_REQUEST                6
1137 #define MESH_ACTION_MCCA_ADV                        7
1138 #define MESH_ACTION_MCCA_TEARDOWN                   8
1139 #define MESH_ACTION_TBTT_ADJ_REQUEST                9
1140 #define MESH_ACTION_TBTT_ADJ_RESPONSE              10
1141
1142 /* 11s draft 12.0, table 7-57v42: Multihop Action field values */
1143 #define MULTIHOP_ACTION_PROXY_UPDATE                0
1144 #define MULTIHOP_ACTION_PROXY_UPDATE_CONF           1
1145
1146 /* 11s draft 12.0, table 7-57v24: Self-protected Action field values */
1147 #define SELFPROT_ACTION_MESH_PEERING_OPEN           1
1148 #define SELFPROT_ACTION_MESH_PEERING_CONFIRM        2
1149 #define SELFPROT_ACTION_MESH_PEERING_CLOSE          3
1150 #define SELFPROT_ACTION_MESH_GROUP_KEY_INFORM       4
1151 #define SELFPROT_ACTION_MESH_GROUP_KEY_ACK          5
1152
1153 /* 11s draft 12.0, table 7-43bj6: Mesh Peering Protocol Identifier field values */
1154 #define MESH_PEERING_PROTO_MGMT                     0
1155 #define MESH_PEERING_PROTO_AMPE                     1
1156 #define MESH_PEERING_PROTO_VENDOR                 255
1157
1158 /* Vendor actions */
1159 /* MARVELL */
1160 #define MRVL_ACTION_MESH_MANAGEMENT     1
1161
1162 #define MRVL_MESH_MGMT_ACTION_RREQ      0
1163 #define MRVL_MESH_MGMT_ACTION_RREP      1
1164 #define MRVL_MESH_MGMT_ACTION_RERR      2
1165 #define MRVL_MESH_MGMT_ACTION_PLDM      3
1166
1167 #define ANQP_INFO_ANQP_QUERY_LIST 256
1168 #define ANQP_INFO_ANQP_CAPAB_LIST 257
1169 #define ANQP_INFO_VENUE_NAME_INFO 258
1170 #define ANQP_INFO_EMERGENCY_CALL_NUMBER_INFO 259
1171 #define ANQP_INFO_NETWORK_AUTH_TYPE_INFO 260
1172 #define ANQP_INFO_ROAMING_CONSORTIUM_LIST 261
1173 #define ANQP_INFO_IP_ADDR_TYPE_AVAILABILITY_INFO 262
1174 #define ANQP_INFO_NAI_REALM_LIST 263
1175 #define ANQP_INFO_3GPP_CELLULAR_NETWORK_INFO 264
1176 #define ANQP_INFO_AP_GEOSPATIAL_LOCATION 265
1177 #define ANQP_INFO_AP_CIVIC_LOCATION 266
1178 #define ANQP_INFO_AP_LOCATION_PUBLIC_ID_URI 267
1179 #define ANQP_INFO_DOMAIN_NAME_LIST 268
1180 #define ANQP_INFO_EMERGENCY_ALERT_ID_URI 269
1181 #define ANQP_INFO_TDLS_CAPAB_INFO 270
1182 #define ANQP_INFO_EMERGENCY_NAI 271
1183 #define ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST 56797
1184
1185 /* ANQP information ID - IEEE Std 802.11u-2011 - Table 7-43bk */
1186 static const value_string anqp_info_id_vals[] =
1187 {
1188   {ANQP_INFO_ANQP_QUERY_LIST, "ANQP Query list"},
1189   {ANQP_INFO_ANQP_CAPAB_LIST, "ANQP Capability list"},
1190   {ANQP_INFO_VENUE_NAME_INFO, "Venue Name information"},
1191   {ANQP_INFO_EMERGENCY_CALL_NUMBER_INFO, "Emergency Call Number information"},
1192   {ANQP_INFO_NETWORK_AUTH_TYPE_INFO,
1193    "Network Authentication Type information"},
1194   {ANQP_INFO_ROAMING_CONSORTIUM_LIST, "Roaming Consortium list"},
1195   {ANQP_INFO_IP_ADDR_TYPE_AVAILABILITY_INFO,
1196    "IP Address Type Availability information"},
1197   {ANQP_INFO_NAI_REALM_LIST, "NAI Realm list"},
1198   {ANQP_INFO_3GPP_CELLULAR_NETWORK_INFO, "3GPP Cellular Network information"},
1199   {ANQP_INFO_AP_GEOSPATIAL_LOCATION, "AP Geospatial Location"},
1200   {ANQP_INFO_AP_CIVIC_LOCATION, "AP Civic Location"},
1201   {ANQP_INFO_AP_LOCATION_PUBLIC_ID_URI, "AP Location Public Identifier URI"},
1202   {ANQP_INFO_DOMAIN_NAME_LIST, "Domain Name list"},
1203   {ANQP_INFO_EMERGENCY_ALERT_ID_URI, "Emergency Alert Identifier URI"},
1204   {ANQP_INFO_TDLS_CAPAB_INFO, "TDLS Capability information"},
1205   {ANQP_INFO_EMERGENCY_NAI, "Emergency NAI"},
1206   {ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST, "ANQP vendor-specific list"},
1207   {0, NULL}
1208 };
1209
1210 /* IEEE 802.11v - WNM Action field values */
1211 enum wnm_action {
1212   WNM_EVENT_REQ = 0,
1213   WNM_EVENT_REPORT = 1,
1214   WNM_DIAGNOSTIC_REQ = 2,
1215   WNM_DIAGNOSTIC_REPORT = 3,
1216   WNM_LOCATION_CFG_REQ = 4,
1217   WNM_LOCATION_CFG_RESP = 5,
1218   WNM_BSS_TRANS_MGMT_QUERY = 6,
1219   WNM_BSS_TRANS_MGMT_REQ = 7,
1220   WNM_BSS_TRANS_MGMT_RESP = 8,
1221   WNM_FMS_REQ = 9,
1222   WNM_FMS_RESP = 10,
1223   WNM_COLLOCATED_INTERFERENCE_REQ = 11,
1224   WNM_COLLOCATED_INTERFERENCE_REPORT = 12,
1225   WNM_TFS_REQ = 13,
1226   WNM_TFS_RESP = 14,
1227   WNM_TFS_NOTIFY = 15,
1228   WNM_SLEEP_MODE_REQ = 16,
1229   WNM_SLEEP_MODE_RESP = 17,
1230   WNM_TIM_BROADCAST_REQ = 18,
1231   WNM_TIM_BROADCAST_RESP = 19,
1232   WNM_QOS_TRAFFIC_CAPAB_UPDATE = 20,
1233   WNM_CHANNEL_USAGE_REQ = 21,
1234   WNM_CHANNEL_USAGE_RESP = 22,
1235   WNM_DMS_REQ = 23,
1236   WNM_DMS_RESP = 24,
1237   WNM_TIMING_MEASUREMENT_REQ = 25,
1238   WNM_NOTIFICATION_REQ = 26,
1239   WNM_NOTIFICATION_RESP = 27
1240 };
1241
1242 static const value_string wnm_action_codes[] =
1243 {
1244   { WNM_EVENT_REQ, "Event Request" },
1245   { WNM_EVENT_REPORT, "Event Report" },
1246   { WNM_DIAGNOSTIC_REQ, "Diagnostic Request" },
1247   { WNM_DIAGNOSTIC_REPORT, "Diagnostic Report" },
1248   { WNM_LOCATION_CFG_REQ, "Location Configuration Request" },
1249   { WNM_LOCATION_CFG_RESP, "Location Configuration Response" },
1250   { WNM_BSS_TRANS_MGMT_QUERY, "BSS Transition Management Query" },
1251   { WNM_BSS_TRANS_MGMT_REQ, "BSS Transition Management Request" },
1252   { WNM_BSS_TRANS_MGMT_RESP, "BSS Transition Management Response" },
1253   { WNM_FMS_REQ, "FMS Request" },
1254   { WNM_FMS_RESP, "FMS Response" },
1255   { WNM_COLLOCATED_INTERFERENCE_REQ, "Collocated Interference Request" },
1256   { WNM_COLLOCATED_INTERFERENCE_REPORT, "Collocated Interference Report" },
1257   { WNM_TFS_REQ, "TFS Request" },
1258   { WNM_TFS_RESP, "TFS Response" },
1259   { WNM_TFS_NOTIFY, "TFS Notify" },
1260   { WNM_SLEEP_MODE_REQ, "WNM-Sleep Mode Request" },
1261   { WNM_SLEEP_MODE_RESP, "WNM-Sleep Mode Response" },
1262   { WNM_TIM_BROADCAST_REQ, "TIM Broadcast Request" },
1263   { WNM_TIM_BROADCAST_RESP, "TIM Broadcast Response" },
1264   { WNM_QOS_TRAFFIC_CAPAB_UPDATE, "QoS Traffic Capability Update" },
1265   { WNM_CHANNEL_USAGE_REQ, "Channel Usage Request" },
1266   { WNM_CHANNEL_USAGE_RESP, "Channel Usage Response" },
1267   { WNM_DMS_REQ, "DMS Request" },
1268   { WNM_DMS_RESP, "DMS Response" },
1269   { WNM_TIMING_MEASUREMENT_REQ, "Timing Measurement Request" },
1270   { WNM_NOTIFICATION_REQ, "WNM-Notification Request" },
1271   { WNM_NOTIFICATION_RESP, "WNM-Notification Response" },
1272   { 0, NULL }
1273 };
1274
1275 /*** End: Action Fixed Parameter ***/
1276
1277 static const value_string ieee80211_tag_measure_request_type_flags[] = {
1278   {0x00, "Basic Request"},
1279   {0x01, "Clear Channel Assessment (CCA) Request"},
1280   {0x02, "Receive Power Indication (RPI) Histogram Request"},
1281   {0x03, "Channel Load Request"},
1282   {0x04, "Noise Histogram Request"},
1283   {0x05, "Beacon Request"},
1284   {0x06, "Frame Request"},
1285   {0x07, "STA Statistics Request"},
1286   {0x08, "Location Configuration Indication (LCI) Request"},
1287   {0x09, "Transmit Stream Measurement Request"},
1288   {0x0A, "Measurement Pause Request"},
1289   {0x00, NULL}
1290 };
1291
1292 static const value_string ieee80211_tag_measure_report_type_flags[] = {
1293   { 0x00, "Basic Report" },
1294   { 0x01, "Clear Channel Assessment (CCA) Report" },
1295   { 0x02, "Receive Power Indication (RPI) Histogram Report" },
1296   { 0x03, "Channel Load Report" },
1297   { 0x04, "Noise Histogram Report" },
1298   { 0x05, "Beacon Report" },
1299   { 0x06, "Frame Report" },
1300   { 0x07, "STA Statistics Report" },
1301   { 0x08, "Location Configuration Information (LCI) Report" },
1302   { 0x09, "Transmit Stream Measurement Report" },
1303   { 0x00, NULL }
1304 };
1305
1306 static const true_false_string ieee80211_tag_measure_report_frame_info_frame_type_flag = {
1307   "Measurement Pilot Frame",
1308   "Beacon/Probe Response Frame"
1309 };
1310
1311 static const true_false_string ieee80211_tag_measure_map_field_bss_flag = {
1312   "At least one MPDU was received by another BSS or IBSS in the measurement period.",
1313   "No MPDUs were received from another BSS or IBSS in the measurement period."
1314 };
1315
1316 static const value_string ieee80211_tag_measure_request_measurement_mode_flags[] = {
1317   { 0x00, "Passive" },
1318   { 0x01, "Active" },
1319   { 0x02, "Beacon Table" },
1320   { 0x00, NULL }
1321 };
1322
1323 #define MEASURE_REQ_BEACON_SUB_SSID 0
1324 #define MEASURE_REQ_BEACON_SUB_BRI 1
1325 #define MEASURE_REQ_BEACON_SUB_RD 2
1326 #define MEASURE_REQ_BEACON_SUB_REQUEST 10
1327 #define MEASURE_REQ_BEACON_SUB_APCP 51
1328 #define MEASURE_REQ_BEACON_SUB_VS 221
1329
1330 static const value_string ieee80211_tag_measure_request_beacon_sub_id_flags[] = {
1331   { MEASURE_REQ_BEACON_SUB_SSID, "SSID" },
1332   { MEASURE_REQ_BEACON_SUB_BRI, "Beacon Reporting Information" },
1333   { MEASURE_REQ_BEACON_SUB_RD, "Reporting Detail" },
1334   { MEASURE_REQ_BEACON_SUB_REQUEST, "Request" },
1335   { MEASURE_REQ_BEACON_SUB_APCP, "AP Channel Report" },
1336   { MEASURE_REQ_BEACON_SUB_VS, "Vendor Specific" },
1337   { 0x00, NULL}
1338 };
1339
1340 static const value_string ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition_flags[] = {
1341   { 0x00, "Report to be issued after each measurement." },
1342   { 0x01, "The measured RCPI level is greater than an absolute threshold." },
1343   { 0x02, "The measured RCPI level is less than an absolute threshold." },
1344   { 0x03, "The measured RSNI level is greater than an absolute threshold." },
1345   { 0x04, "The measured RSNI level is less than an absolute threshold." },
1346   { 0x05, "The measured RCPI level is greater than a threshold defined by an offset from the serving AP's reference RCPI." },
1347   { 0x06, "The measured RCPI level is less than a threshold defined by an offset from the serving AP's reference RCPI." },
1348   { 0x07, "The measured RSNI level is greater than a threshold defined by an offset from the serving AP's reference RSNI." },
1349   { 0x08, "The measured RSNI level is less than a threshold defined by an offset from the serving AP's reference RSNI." },
1350   { 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." },
1351   { 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." },
1352   { 0xfe, "Report not required to be issued" },
1353   { 0x00, NULL }
1354 };
1355
1356 static const value_string ieee80211_tag_measure_request_beacon_sub_reporting_detail_flags[] = {
1357   { 0, "No fixed length fields or elements" },
1358   { 1, "All fixed length fields and any requested elements in the Request information element if present" },
1359   { 2, "All fixed length fields and elements (default, used when Reporting Detail subelement is not included in Beacon Request" },
1360   { 0x00, NULL }
1361 };
1362
1363 static const value_string ieee80211_tag_measure_request_group_id_flags[] = {
1364   { 0x00, "STA Counters from dot11CountersTable" },
1365   { 0x01, "STA Counters from dot11MacStatistics group" },
1366   { 0x02, "QoS STA Counters for UP0 from dot11QosCountersTable" },
1367   { 0x03, "QoS STA Counters for UP1 from dot11QosCountersTable" },
1368   { 0x04, "QoS STA Counters for UP2 from dot11QosCountersTable" },
1369   { 0x05, "QoS STA Counters for UP3 from dot11QosCountersTable" },
1370   { 0x06, "QoS STA Counters for UP4 from dot11QosCountersTable" },
1371   { 0x07, "QoS STA Counters for UP5 from dot11QosCountersTable" },
1372   { 0x08, "QoS STA Counters for UP6 from dot11QosCountersTable" },
1373   { 0x09, "QoS STA Counters for UP7 from dot11QosCountersTable" },
1374   { 0x0a, "BSS Average Access Delays" },
1375   { 0x0b, "STA Counters from dot11A-MSDU Group" },
1376   { 0x0c, "STA Counters from dot11A-MPDU Group" },
1377   { 0x0d, "STA Counters from dot11 BAR, Channel Width, PSMP Group" },
1378   { 0x0e, "STA Counters from dot11Protection Group" },
1379   { 0x0f, "STBC Group" },
1380   { 0x00, NULL }
1381 };
1382
1383 static const value_string ieee80211_tclas_process_flag[] = {
1384   {0x00, "Incoming MSDU's higher layer parameters have to match to the parameters in all associated TCLAS elements."},
1385   {0x01, "Incoming MSDU's higher layer parameters have to match to at least one of the associated TCLAS elements."},
1386   {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."},
1387   {0, NULL}
1388 };
1389
1390 static int proto_wlan = -1;
1391 static int proto_aggregate = -1;
1392 static packet_info * g_pinfo;
1393 static gboolean ieee80211_tvb_invalid = FALSE;
1394
1395 /* ************************************************************************* */
1396 /*                Header field info values for FC-field                      */
1397 /* ************************************************************************* */
1398 static int hf_ieee80211_fc_field = -1;
1399 static int hf_ieee80211_fc_proto_version = -1;
1400 static int hf_ieee80211_fc_frame_type = -1;
1401 static int hf_ieee80211_fc_frame_subtype = -1;
1402 static int hf_ieee80211_fc_frame_type_subtype = -1;
1403
1404 static int hf_ieee80211_fc_flags = -1;
1405 static int hf_ieee80211_fc_to_ds = -1;
1406 static int hf_ieee80211_fc_from_ds = -1;
1407 static int hf_ieee80211_fc_data_ds = -1;
1408
1409 static int hf_ieee80211_fc_more_frag = -1;
1410 static int hf_ieee80211_fc_retry = -1;
1411 static int hf_ieee80211_fc_pwr_mgt = -1;
1412 static int hf_ieee80211_fc_more_data = -1;
1413 static int hf_ieee80211_fc_protected = -1;
1414 static int hf_ieee80211_fc_order = -1;
1415
1416 typedef struct retransmit_key {
1417   guint8  bssid[6];
1418   guint8  src[6];
1419   guint16 seq_control;
1420   guint   fnum;
1421 } retransmit_key;
1422
1423 static GHashTable *fc_analyse_retransmit_table = NULL;
1424 static GHashTable *fc_first_frame_table = NULL;
1425
1426 static int hf_ieee80211_fc_analysis_retransmission = -1;
1427 static int hf_ieee80211_fc_analysis_retransmission_frame = -1;
1428
1429 /* ************************************************************************* */
1430 /*                   Header values for Duration/ID field                     */
1431 /* ************************************************************************* */
1432 static int hf_ieee80211_did_duration = -1;
1433 static int hf_ieee80211_assoc_id = -1;
1434
1435 /* ************************************************************************* */
1436 /*         Header values for different address-fields (all 4 of them)        */
1437 /* ************************************************************************* */
1438 static int hf_ieee80211_addr_da = -1;  /* Destination address subfield */
1439 static int hf_ieee80211_addr_sa = -1;  /* Source address subfield */
1440 static int hf_ieee80211_addr_ra = -1;  /* Receiver address subfield */
1441 static int hf_ieee80211_addr_ta = -1;  /* Transmitter address subfield */
1442 static int hf_ieee80211_addr_bssid = -1;  /* address is bssid */
1443
1444 static int hf_ieee80211_addr = -1;  /* Source or destination address subfield */
1445
1446
1447 /* ************************************************************************* */
1448 /*                Header values for QoS control field                        */
1449 /* ************************************************************************* */
1450 static int hf_ieee80211_qos_tid = -1;
1451 static int hf_ieee80211_qos_priority = -1;
1452 static int hf_ieee80211_qos_ack_policy = -1;
1453 static int hf_ieee80211_qos_amsdu_present = -1;
1454 static int hf_ieee80211_qos_eosp = -1;
1455 static int hf_ieee80211_qos_bit4 = -1;
1456 static int hf_ieee80211_qos_txop_limit = -1;
1457 static int hf_ieee80211_qos_buf_state_indicated = -1;
1458 static int hf_ieee80211_qos_highest_pri_buf_ac = -1;
1459 static int hf_ieee80211_qos_qap_buf_load = -1;
1460 static int hf_ieee80211_qos_txop_dur_req = -1;
1461 static int hf_ieee80211_qos_queue_size = -1;
1462
1463 /* ************************************************************************* */
1464 /*                Header values for HT control field (+HTC)                  */
1465 /* ************************************************************************* */
1466 /* 802.11nD-1.10 & 802.11nD-2.0 7.1.3.5a */
1467 static int hf_ieee80211_htc = -1;
1468 static int hf_ieee80211_htc_lac = -1;
1469 static int hf_ieee80211_htc_lac_reserved = -1;
1470 static int hf_ieee80211_htc_lac_trq = -1;
1471 static int hf_ieee80211_htc_lac_mai_aseli = -1;
1472 static int hf_ieee80211_htc_lac_mai_mrq = -1;
1473 static int hf_ieee80211_htc_lac_mai_msi = -1;
1474 static int hf_ieee80211_htc_lac_mai_reserved = -1;
1475 static int hf_ieee80211_htc_lac_mfsi = -1;
1476 static int hf_ieee80211_htc_lac_mfb = -1;
1477 static int hf_ieee80211_htc_lac_asel_command = -1;
1478 static int hf_ieee80211_htc_lac_asel_data = -1;
1479 static int hf_ieee80211_htc_cal_pos = -1;
1480 static int hf_ieee80211_htc_cal_seq = -1;
1481 static int hf_ieee80211_htc_reserved1 = -1;
1482 static int hf_ieee80211_htc_csi_steering = -1;
1483 static int hf_ieee80211_htc_ndp_announcement = -1;
1484 static int hf_ieee80211_htc_reserved2 = -1;
1485 static int hf_ieee80211_htc_ac_constraint = -1;
1486 static int hf_ieee80211_htc_rdg_more_ppdu = -1;
1487
1488 /* ************************************************************************* */
1489 /*                Header values for sequence number field                    */
1490 /* ************************************************************************* */
1491 static int hf_ieee80211_frag_number = -1;
1492 static int hf_ieee80211_seq_number = -1;
1493
1494 /* ************************************************************************* */
1495 /*                   Header values for Frame Check field                     */
1496 /* ************************************************************************* */
1497 static int hf_ieee80211_fcs = -1;
1498 static int hf_ieee80211_fcs_good = -1;
1499 static int hf_ieee80211_fcs_bad = -1;
1500
1501 /* ************************************************************************* */
1502 /*                   Header values for reassembly                            */
1503 /* ************************************************************************* */
1504 static int hf_ieee80211_fragments = -1;
1505 static int hf_ieee80211_fragment = -1;
1506 static int hf_ieee80211_fragment_overlap = -1;
1507 static int hf_ieee80211_fragment_overlap_conflict = -1;
1508 static int hf_ieee80211_fragment_multiple_tails = -1;
1509 static int hf_ieee80211_fragment_too_long_fragment = -1;
1510 static int hf_ieee80211_fragment_error = -1;
1511 static int hf_ieee80211_fragment_count = -1;
1512 static int hf_ieee80211_reassembled_in = -1;
1513 static int hf_ieee80211_reassembled_length = -1;
1514
1515 static int proto_wlan_mgt = -1;
1516
1517 static int hf_ieee80211_chan_noc =        -1;
1518 static int hf_ieee80211_chan_length =     -1;
1519 static int hf_ieee80211_chan_content =    -1;
1520 static int hf_ieee80211_chan_channel =    -1;
1521 static int hf_ieee80211_chan_adapt   =    -1;
1522 static int hf_ieee80211_chan_rate    =    -1;
1523 static int hf_ieee80211_chan_tx_pow  =    -1;
1524
1525 /* ************************************************************************* */
1526 /*                      Fixed fields found in mgt frames                     */
1527 /* ************************************************************************* */
1528 static int hf_ieee80211_fixed_parameters = -1;  /* Protocol payload for management frames */
1529
1530 static int hf_ieee80211_ff_auth_alg = -1;            /* Authentication algorithm field            */
1531 static int hf_ieee80211_ff_auth_seq = -1;            /* Authentication transaction sequence       */
1532 static int hf_ieee80211_ff_current_ap = -1;          /* Current AP MAC address                    */
1533 static int hf_ieee80211_ff_listen_ival = -1;         /* Listen interval fixed field               */
1534 static int hf_ieee80211_ff_timestamp = -1;           /* 64 bit timestamp                          */
1535 static int hf_ieee80211_ff_beacon_interval = -1;     /* 16 bit Beacon interval                    */
1536 static int hf_ieee80211_ff_assoc_id = -1;            /* 16 bit AID field                          */
1537 static int hf_ieee80211_ff_reason = -1;              /* 16 bit reason code                        */
1538 static int hf_ieee80211_ff_status_code = -1;         /* Status code                               */
1539 static int hf_ieee80211_ff_category_code = -1;       /* 8 bit Category code */
1540 static int hf_ieee80211_ff_action_code = -1;         /* 8 bit Action code */
1541 static int hf_ieee80211_ff_dialog_token = -1;        /* 8 bit Dialog token */
1542 static int hf_ieee80211_ff_wme_action_code = -1;     /* Management notification action code */
1543 static int hf_ieee80211_ff_wme_status_code = -1;     /* Management notification setup response status code */
1544 static int hf_ieee80211_ff_qos_action_code = -1;
1545 static int hf_ieee80211_ff_dls_action_code = -1;
1546 static int hf_ieee80211_ff_dst_mac_addr = -1;        /* DLS destination MAC addressi */
1547 static int hf_ieee80211_ff_src_mac_addr = -1;        /* DLS source MAC addressi */
1548 static int hf_ieee80211_ff_dls_timeout = -1;         /* DLS timeout value */
1549 static int hf_ieee80211_ff_ft_action_code = -1; /* 8 bit FT Action code */
1550 static int hf_ieee80211_ff_sta_address = -1;
1551 static int hf_ieee80211_ff_target_ap_address = -1;
1552 static int hf_ieee80211_ff_gas_comeback_delay = -1;
1553 static int hf_ieee80211_ff_gas_fragment_id = -1;
1554 static int hf_ieee80211_ff_more_gas_fragments = -1;
1555 static int hf_ieee80211_ff_query_request_length = -1;
1556 static int hf_ieee80211_ff_query_request = -1;
1557 static int hf_ieee80211_ff_query_response_length = -1;
1558 static int hf_ieee80211_ff_query_response = -1;
1559 static int hf_ieee80211_ff_anqp_info_id = -1;
1560 static int hf_ieee80211_ff_anqp_info_length = -1;
1561 static int hf_ieee80211_ff_anqp_info = -1;
1562 static int hf_ieee80211_ff_anqp_query_id = -1;
1563 static int hf_ieee80211_ff_anqp_capability = -1;
1564 static int hf_ieee80211_ff_anqp_capability_vlen = -1;
1565 static int hf_ieee80211_ff_anqp_capability_vendor = -1;
1566 static int hf_ieee80211_ff_venue_info_group = -1;
1567 static int hf_ieee80211_ff_venue_info_type = -1;
1568 static int hf_ieee80211_ff_anqp_venue_length = -1;
1569 static int hf_ieee80211_ff_anqp_venue_language = -1;
1570 static int hf_ieee80211_ff_anqp_venue_name = -1;
1571 static int hf_ieee80211_ff_anqp_nw_auth_type_indicator = -1;
1572 static int hf_ieee80211_ff_anqp_nw_auth_type_url_len = -1;
1573 static int hf_ieee80211_ff_anqp_nw_auth_type_url = -1;
1574 static int hf_ieee80211_ff_anqp_roaming_consortium_oi_len = -1;
1575 static int hf_ieee80211_ff_anqp_roaming_consortium_oi = -1;
1576 static int hf_ieee80211_ff_anqp_ip_addr_avail_ipv6 = -1;
1577 static int hf_ieee80211_ff_anqp_ip_addr_avail_ipv4 = -1;
1578 static int hf_ieee80211_ff_anqp_nai_realm_count = -1;
1579 static int hf_ieee80211_ff_anqp_nai_field_len = -1;
1580 static int hf_ieee80211_ff_anqp_nai_realm_encoding = -1;
1581 static int hf_ieee80211_ff_anqp_nai_realm_length = -1;
1582 static int hf_ieee80211_ff_anqp_nai_realm = -1;
1583 static int hf_ieee80211_ff_anqp_nai_realm_eap_count = -1;
1584 static int hf_ieee80211_ff_anqp_nai_realm_eap_len = -1;
1585 static int hf_ieee80211_ff_anqp_nai_realm_eap_method = -1;
1586 static int hf_ieee80211_ff_anqp_nai_realm_auth_param_count = -1;
1587 static int hf_ieee80211_ff_anqp_nai_realm_auth_param_id = -1;
1588 static int hf_ieee80211_ff_anqp_nai_realm_auth_param_len = -1;
1589 static int hf_ieee80211_ff_anqp_nai_realm_auth_param_value = -1;
1590 static int hf_ieee80211_3gpp_gc_gud = -1;
1591 static int hf_ieee80211_3gpp_gc_udhl = -1;
1592 static int hf_ieee80211_3gpp_gc_iei = -1;
1593 static int hf_ieee80211_3gpp_gc_plmn_len = -1;
1594 static int hf_ieee80211_3gpp_gc_num_plmns = -1;
1595 static int hf_ieee80211_3gpp_gc_plmn = -1;
1596 static int hf_ieee80211_ff_anqp_domain_name_len = -1;
1597 static int hf_ieee80211_ff_anqp_domain_name = -1;
1598 static int hf_ieee80211_ff_tdls_action_code = -1;
1599 static int hf_ieee80211_ff_target_channel = -1;
1600 static int hf_ieee80211_ff_regulatory_class = -1;
1601 static int hf_ieee80211_ff_wnm_action_code = -1;
1602 static int hf_ieee80211_ff_request_mode_pref_cand = -1;
1603 static int hf_ieee80211_ff_request_mode_abridged = -1;
1604 static int hf_ieee80211_ff_request_mode_disassoc_imminent = -1;
1605 static int hf_ieee80211_ff_request_mode_bss_term_included = -1;
1606 static int hf_ieee80211_ff_request_mode_ess_disassoc_imminent = -1;
1607 static int hf_ieee80211_ff_disassoc_timer = -1;
1608 static int hf_ieee80211_ff_validity_interval = -1;
1609 static int hf_ieee80211_ff_url_len = -1;
1610 static int hf_ieee80211_ff_url = -1;
1611
1612 static int hf_ieee80211_ff_sa_query_action_code = -1;
1613 static int hf_ieee80211_ff_transaction_id = -1;
1614
1615 /* Vendor specific */
1616 static int hf_ieee80211_ff_marvell_action_type = -1;
1617 static int hf_ieee80211_ff_marvell_mesh_mgt_action_code = -1;
1618 static int hf_ieee80211_ff_marvell_mesh_mgt_length = -1;     /* Mesh Management length */
1619 static int hf_ieee80211_ff_marvell_mesh_mgt_mode = -1;       /* Mesh Management mode */
1620 static int hf_ieee80211_ff_marvell_mesh_mgt_ttl = -1;        /* Mesh Management TTL */
1621 static int hf_ieee80211_ff_marvell_mesh_mgt_dstcount = -1;   /* Mesh Management dst count */
1622 static int hf_ieee80211_ff_marvell_mesh_mgt_hopcount = -1;   /* Mesh Management hop count */
1623 static int hf_ieee80211_ff_marvell_mesh_mgt_rreqid = -1;     /* Mesh Management RREQ ID */
1624 static int hf_ieee80211_ff_marvell_mesh_mgt_sa = -1;         /* Mesh Management src addr */
1625 static int hf_ieee80211_ff_marvell_mesh_mgt_ssn = -1;        /* Mesh Management src sequence number */
1626 static int hf_ieee80211_ff_marvell_mesh_mgt_metric = -1;     /* Mesh Management metric */
1627 static int hf_ieee80211_ff_marvell_mesh_mgt_flags = -1;      /* Mesh Management RREQ flags */
1628 static int hf_ieee80211_ff_marvell_mesh_mgt_da = -1;         /* Mesh Management dst addr */
1629 static int hf_ieee80211_ff_marvell_mesh_mgt_dsn = -1;        /* Mesh Management dst sequence number */
1630 static int hf_ieee80211_ff_marvell_mesh_mgt_lifetime = -1;   /* Mesh Management lifetime */
1631
1632
1633 static int hf_ieee80211_ff_ba_action = -1;
1634
1635 static int hf_ieee80211_ff_block_ack_params = -1;
1636 static int hf_ieee80211_ff_block_ack_params_amsdu_permitted = -1;
1637 static int hf_ieee80211_ff_block_ack_params_policy = -1;
1638 static int hf_ieee80211_ff_block_ack_params_tid = -1;
1639 static int hf_ieee80211_ff_block_ack_params_buffer_size = -1;
1640
1641 static const int *ieee80211_ff_block_ack_params_fields[] = {
1642   &hf_ieee80211_ff_block_ack_params_amsdu_permitted,
1643   &hf_ieee80211_ff_block_ack_params_policy,
1644   &hf_ieee80211_ff_block_ack_params_tid,
1645   &hf_ieee80211_ff_block_ack_params_buffer_size,
1646   NULL
1647 };
1648
1649 static int hf_ieee80211_ff_block_ack_timeout = -1;
1650
1651 static int hf_ieee80211_ff_block_ack_ssc = -1;
1652 static int hf_ieee80211_ff_block_ack_ssc_fragment = -1;
1653 static int hf_ieee80211_ff_block_ack_ssc_sequence = -1;
1654
1655 static const int *ieee80211_ff_block_ack_ssc_fields[] = {
1656   &hf_ieee80211_ff_block_ack_ssc_fragment,
1657   &hf_ieee80211_ff_block_ack_ssc_sequence,
1658   NULL
1659 };
1660
1661 static int hf_ieee80211_ff_delba_param = -1;
1662 static int hf_ieee80211_ff_delba_param_reserved = -1;
1663 static int hf_ieee80211_ff_delba_param_init = -1;
1664 static int hf_ieee80211_ff_delba_param_tid = -1;
1665
1666 static const int *ieee80211_ff_delba_param_fields[] = {
1667   &hf_ieee80211_ff_delba_param_reserved,
1668   &hf_ieee80211_ff_delba_param_init,
1669   &hf_ieee80211_ff_delba_param_tid,
1670   NULL
1671 };
1672
1673 static int hf_ieee80211_ff_max_reg_pwr = -1;
1674 static int hf_ieee80211_ff_measurement_pilot_int = -1;
1675 static int hf_ieee80211_ff_country_str = -1;
1676 static int hf_ieee80211_ff_max_tx_pwr = -1;
1677 static int hf_ieee80211_ff_tx_pwr_used = -1;
1678 static int hf_ieee80211_ff_transceiver_noise_floor = -1;
1679 static int hf_ieee80211_ff_channel_width = -1;
1680
1681 static int hf_ieee80211_ff_qos_info_ap = -1;
1682 static int hf_ieee80211_ff_qos_info_ap_edca_param_set_counter = -1;
1683 static int hf_ieee80211_ff_qos_info_ap_q_ack = -1;
1684 static int hf_ieee80211_ff_qos_info_ap_queue_req = -1;
1685 static int hf_ieee80211_ff_qos_info_ap_txop_request = -1;
1686 static int hf_ieee80211_ff_qos_info_ap_reserved = -1;
1687
1688 static const int *ieee80211_ff_qos_info_ap_fields[] = {
1689   &hf_ieee80211_ff_qos_info_ap_edca_param_set_counter,
1690   &hf_ieee80211_ff_qos_info_ap_q_ack,
1691   &hf_ieee80211_ff_qos_info_ap_queue_req,
1692   &hf_ieee80211_ff_qos_info_ap_txop_request,
1693   &hf_ieee80211_ff_qos_info_ap_reserved,
1694   NULL
1695 };
1696
1697 static int hf_ieee80211_ff_qos_info_sta = -1;
1698 static int hf_ieee80211_ff_qos_info_sta_ac_vo = -1;
1699 static int hf_ieee80211_ff_qos_info_sta_ac_vi = -1;
1700 static int hf_ieee80211_ff_qos_info_sta_ac_bk = -1;
1701 static int hf_ieee80211_ff_qos_info_sta_ac_be = -1;
1702 static int hf_ieee80211_ff_qos_info_sta_q_ack = -1;
1703 static int hf_ieee80211_ff_qos_info_sta_max_sp_len = -1;
1704 static int hf_ieee80211_ff_qos_info_sta_more_data_ack = -1;
1705
1706 static const int *ieee80211_ff_qos_info_sta_fields[] = {
1707   &hf_ieee80211_ff_qos_info_sta_ac_vo,
1708   &hf_ieee80211_ff_qos_info_sta_ac_vi,
1709   &hf_ieee80211_ff_qos_info_sta_ac_bk,
1710   &hf_ieee80211_ff_qos_info_sta_ac_be,
1711   &hf_ieee80211_ff_qos_info_sta_q_ack,
1712   &hf_ieee80211_ff_qos_info_sta_max_sp_len,
1713   &hf_ieee80211_ff_qos_info_sta_more_data_ack,
1714   NULL
1715 };
1716
1717 static int hf_ieee80211_ff_sm_pwr_save = -1;
1718 static int hf_ieee80211_ff_sm_pwr_save_enabled = -1;
1719 static int hf_ieee80211_ff_sm_pwr_save_sm_mode = -1;
1720 static int hf_ieee80211_ff_sm_pwr_save_reserved = -1;
1721
1722 static const int *ieee80211_ff_sw_pwr_save_fields[] = {
1723   &hf_ieee80211_ff_sm_pwr_save_enabled,
1724   &hf_ieee80211_ff_sm_pwr_save_sm_mode,
1725   &hf_ieee80211_ff_sm_pwr_save_reserved,
1726   NULL
1727 };
1728
1729 static int hf_ieee80211_ff_pco_phase_cntrl = -1;
1730
1731 static int hf_ieee80211_ff_psmp_param_set = -1;
1732 static int hf_ieee80211_ff_psmp_param_set_n_sta = -1;
1733 static int hf_ieee80211_ff_psmp_param_set_more_psmp = -1;
1734 static int hf_ieee80211_ff_psmp_param_set_psmp_sequence_duration = -1;
1735
1736 static const int *ieee80211_ff_psmp_param_set_fields[] = {
1737   &hf_ieee80211_ff_psmp_param_set_n_sta,
1738   &hf_ieee80211_ff_psmp_param_set_more_psmp,
1739   &hf_ieee80211_ff_psmp_param_set_psmp_sequence_duration,
1740   NULL
1741 };
1742
1743 static int hf_ieee80211_ff_mimo_cntrl = -1;
1744 static int hf_ieee80211_ff_mimo_cntrl_nc_index = -1;
1745 static int hf_ieee80211_ff_mimo_cntrl_nr_index = -1;
1746 static int hf_ieee80211_ff_mimo_cntrl_channel_width = -1;
1747 static int hf_ieee80211_ff_mimo_cntrl_grouping = -1;
1748 static int hf_ieee80211_ff_mimo_cntrl_coefficient_size = -1;
1749 static int hf_ieee80211_ff_mimo_cntrl_codebook_info = -1;
1750 static int hf_ieee80211_ff_mimo_cntrl_remaining_matrix_segment = -1;
1751 static int hf_ieee80211_ff_mimo_cntrl_reserved = -1;
1752 static int hf_ieee80211_ff_mimo_cntrl_sounding_timestamp = -1;
1753
1754 static int hf_ieee80211_ff_ant_selection = -1;
1755 static int hf_ieee80211_ff_ant_selection_0 = -1;
1756 static int hf_ieee80211_ff_ant_selection_1 = -1;
1757 static int hf_ieee80211_ff_ant_selection_2 = -1;
1758 static int hf_ieee80211_ff_ant_selection_3 = -1;
1759 static int hf_ieee80211_ff_ant_selection_4 = -1;
1760 static int hf_ieee80211_ff_ant_selection_5 = -1;
1761 static int hf_ieee80211_ff_ant_selection_6 = -1;
1762 static int hf_ieee80211_ff_ant_selection_7 = -1;
1763
1764 static const int *ieee80211_ff_ant_selection_fields[] = {
1765   &hf_ieee80211_ff_ant_selection_0,
1766   &hf_ieee80211_ff_ant_selection_1,
1767   &hf_ieee80211_ff_ant_selection_2,
1768   &hf_ieee80211_ff_ant_selection_3,
1769   &hf_ieee80211_ff_ant_selection_4,
1770   &hf_ieee80211_ff_ant_selection_5,
1771   &hf_ieee80211_ff_ant_selection_6,
1772   &hf_ieee80211_ff_ant_selection_7,
1773   NULL
1774 };
1775
1776 static int hf_ieee80211_ff_ext_channel_switch_announcement = -1;
1777 static int hf_ieee80211_ff_ext_channel_switch_announcement_switch_mode = -1;
1778 static int hf_ieee80211_ff_ext_channel_switch_announcement_new_reg_class = -1;
1779 static int hf_ieee80211_ff_ext_channel_switch_announcement_new_chan_number = -1;
1780 static int hf_ieee80211_ff_ext_channel_switch_announcement_switch_count = -1;
1781
1782 static const int *ieee80211_ff_ext_channel_switch_announcement_fields[] = {
1783   &hf_ieee80211_ff_ext_channel_switch_announcement_switch_mode,
1784   &hf_ieee80211_ff_ext_channel_switch_announcement_new_reg_class,
1785   &hf_ieee80211_ff_ext_channel_switch_announcement_new_chan_number,
1786   &hf_ieee80211_ff_ext_channel_switch_announcement_switch_count,
1787   NULL
1788 };
1789
1790 static int hf_ieee80211_ff_ht_info = -1;
1791 static int hf_ieee80211_ff_ht_info_information_request = -1;
1792 static int hf_ieee80211_ff_ht_info_40_mhz_intolerant = -1;
1793 static int hf_ieee80211_ff_ht_info_sta_chan_width = -1;
1794 static int hf_ieee80211_ff_ht_info_reserved = -1;
1795
1796 static const int *ieee80211_ff_ht_info_fields[] = {
1797   &hf_ieee80211_ff_ht_info_information_request,
1798   &hf_ieee80211_ff_ht_info_40_mhz_intolerant,
1799   &hf_ieee80211_ff_ht_info_sta_chan_width,
1800   &hf_ieee80211_ff_ht_info_reserved,
1801   NULL
1802 };
1803
1804 static int hf_ieee80211_ff_ht_action = -1;
1805
1806 static int hf_ieee80211_ff_psmp_sta_info = -1;
1807 static int hf_ieee80211_ff_psmp_sta_info_type = -1;
1808 static int hf_ieee80211_ff_psmp_sta_info_dtt_start_offset = -1;
1809 static int hf_ieee80211_ff_psmp_sta_info_dtt_duration = -1;
1810 static int hf_ieee80211_ff_psmp_sta_info_sta_id = -1;
1811 static int hf_ieee80211_ff_psmp_sta_info_utt_start_offset = -1;
1812 static int hf_ieee80211_ff_psmp_sta_info_utt_duration = -1;
1813 static int hf_ieee80211_ff_psmp_sta_info_reserved_small= -1;
1814 static int hf_ieee80211_ff_psmp_sta_info_reserved_large = -1;
1815 static int hf_ieee80211_ff_psmp_sta_info_psmp_multicast_id = -1;
1816
1817 static int hf_ieee80211_ff_mimo_csi_snr = -1;
1818
1819 /*** Begin: 802.11s additions ***/
1820 static int hf_ieee80211_ff_mesh_action = -1;
1821 static int hf_ieee80211_ff_multihop_action = -1;
1822 static int hf_ieee80211_ff_mesh_flags = -1;
1823 static int hf_ieee80211_ff_mesh_ttl = -1;
1824 static int hf_ieee80211_ff_mesh_sequence = -1;
1825 static int hf_ieee80211_ff_mesh_addr4 = -1;
1826 static int hf_ieee80211_ff_mesh_addr5 = -1;
1827 static int hf_ieee80211_ff_mesh_addr6 = -1;
1828 static int hf_ieee80211_ff_selfprot_action = -1;
1829
1830 static int hf_ieee80211_mesh_peering_proto = -1;
1831 static int hf_ieee80211_mesh_peering_local_link_id = -1;
1832 static int hf_ieee80211_mesh_peering_peer_link_id = -1;
1833
1834 static int hf_ieee80211_ff_hwmp_flags = -1;
1835 static int hf_ieee80211_ff_hwmp_hopcount = -1;
1836 static int hf_ieee80211_ff_hwmp_ttl = -1;
1837 static int hf_ieee80211_ff_hwmp_pdid = -1;
1838 static int hf_ieee80211_ff_hwmp_orig_sta = -1;
1839 static int hf_ieee80211_ff_hwmp_orig_sn = -1;
1840 static int hf_ieee80211_ff_hwmp_orig_ext = -1;
1841 static int hf_ieee80211_ff_hwmp_lifetime = -1;
1842 static int hf_ieee80211_ff_hwmp_metric = -1;
1843 static int hf_ieee80211_ff_hwmp_targ_count = -1;
1844 static int hf_ieee80211_ff_hwmp_targ_flags = -1;
1845 static int hf_ieee80211_ff_hwmp_targ_to_flags = -1;
1846 static int hf_ieee80211_ff_hwmp_targ_usn_flags = -1;
1847 static int hf_ieee80211_ff_hwmp_targ_sta = -1;
1848 static int hf_ieee80211_ff_hwmp_targ_sn = -1;
1849 static int hf_ieee80211_ff_hwmp_targ_ext = -1;
1850 static int hf_ieee80211_rann_flags = -1;
1851 static int hf_ieee80211_rann_root_sta = -1;
1852 static int hf_ieee80211_rann_sn = -1;
1853 static int hf_ieee80211_rann_interval = -1;
1854
1855 static int hf_ieee80211_mesh_config_path_sel_protocol = -1;
1856 static int hf_ieee80211_mesh_config_path_sel_metric = -1;
1857 static int hf_ieee80211_mesh_config_congestion_control = -1;
1858 static int hf_ieee80211_mesh_config_sync_method = -1;
1859 static int hf_ieee80211_mesh_config_auth_protocol = -1;
1860 static int hf_ieee80211_mesh_config_formation_info = -1;
1861 static int hf_ieee80211_mesh_config_capability = -1;
1862 static int hf_ieee80211_mesh_id = -1;
1863
1864 static int hf_ieee80211_ff_public_action = -1;
1865
1866 /* ************************************************************************* */
1867 /*            Flags found in the capability field (fixed field)              */
1868 /* ************************************************************************* */
1869 static int hf_ieee80211_ff_capture = -1;
1870 static int hf_ieee80211_ff_cf_ess = -1;
1871 static int hf_ieee80211_ff_cf_ibss = -1;
1872 static int hf_ieee80211_ff_cf_sta_poll = -1; /* CF pollable status for a STA            */
1873 static int hf_ieee80211_ff_cf_ap_poll = -1;  /* CF pollable status for an AP            */
1874 static int hf_ieee80211_ff_cf_privacy = -1;
1875 static int hf_ieee80211_ff_cf_preamble = -1;
1876 static int hf_ieee80211_ff_cf_pbcc = -1;
1877 static int hf_ieee80211_ff_cf_agility = -1;
1878 static int hf_ieee80211_ff_short_slot_time = -1;
1879 static int hf_ieee80211_ff_dsss_ofdm = -1;
1880 static int hf_ieee80211_ff_cf_spec_man = -1;
1881 static int hf_ieee80211_ff_cf_apsd = -1;
1882 static int hf_ieee80211_ff_cf_del_blk_ack = -1;
1883 static int hf_ieee80211_ff_cf_imm_blk_ack = -1;
1884
1885 /* ************************************************************************* */
1886 /*                       A-MSDU fields                                             */
1887 /* ************************************************************************* */
1888 static int hf_ieee80211_amsdu_msdu_header_text = -1;
1889
1890
1891 /* ************************************************************************* */
1892 /*                       Tagged value format fields                          */
1893 /* ************************************************************************* */
1894 static int hf_ieee80211_tagged_parameters = -1;  /* Fixed payload item */
1895 static int hf_ieee80211_tag = -1;
1896 static int hf_ieee80211_tag_number = -1;
1897 static int hf_ieee80211_tag_length = -1;
1898 static int hf_ieee80211_tag_interpretation = -1;
1899 static int hf_ieee80211_tag_oui = -1;
1900 static int hf_ieee80211_tag_ssid = -1;
1901 static int hf_ieee80211_tag_supp_rates = -1;
1902 static int hf_ieee80211_tag_fh_dwell_time = -1;
1903 static int hf_ieee80211_tag_fh_hop_set = -1;
1904 static int hf_ieee80211_tag_fh_hop_pattern = -1;
1905 static int hf_ieee80211_tag_fh_hop_index = -1;
1906 static int hf_ieee80211_tag_ds_param_channel = -1;
1907 static int hf_ieee80211_tag_cfp_count = -1;
1908 static int hf_ieee80211_tag_cfp_period = -1;
1909 static int hf_ieee80211_tag_cfp_max_duration = -1;
1910 static int hf_ieee80211_tag_cfp_dur_remaining = -1;
1911 static int hf_ieee80211_tim_dtim_count = -1;
1912 static int hf_ieee80211_tim_dtim_period = -1;
1913 static int hf_ieee80211_tim_bmapctl = -1;
1914 static int hf_ieee80211_tim_bmapctl_mcast = -1;
1915 static int hf_ieee80211_tim_bmapctl_offset = -1;
1916 static int hf_ieee80211_tim_partial_virtual_bitmap = -1;
1917 static int hf_ieee80211_tag_ibss_atim_window = -1;
1918 static int hf_ieee80211_tag_country_info_code = -1;
1919 static int hf_ieee80211_tag_country_info_env = -1;
1920 static int hf_ieee80211_tag_country_info_pad = -1;
1921 static int hf_ieee80211_tag_country_info_fnm = -1;
1922 static int hf_ieee80211_tag_country_info_fnm_fcn = -1;
1923 static int hf_ieee80211_tag_country_info_fnm_nc = -1;
1924 static int hf_ieee80211_tag_country_info_fnm_mtpl = -1;
1925 static int hf_ieee80211_tag_country_info_rrc = -1;
1926 static int hf_ieee80211_tag_country_info_rrc_rei = -1;
1927 static int hf_ieee80211_tag_country_info_rrc_rc = -1;
1928 static int hf_ieee80211_tag_country_info_rrc_cc = -1;
1929 static int hf_ieee80211_tag_fh_hopping_parameter_prime_radix = -1;
1930 static int hf_ieee80211_tag_fh_hopping_parameter_nb_channels = -1;
1931 static int hf_ieee80211_tag_fh_hopping_table_flag = -1;
1932 static int hf_ieee80211_tag_fh_hopping_table_number_of_sets = -1;
1933 static int hf_ieee80211_tag_fh_hopping_table_modulus = -1;
1934 static int hf_ieee80211_tag_fh_hopping_table_offset = -1;
1935 static int hf_ieee80211_tag_fh_hopping_random_table = -1;
1936 static int hf_ieee80211_tag_request = -1;
1937 static int hf_ieee80211_tag_challenge_text = -1;
1938
1939 static int hf_ieee80211_wep_iv = -1;
1940 static int hf_ieee80211_wep_iv_weak = -1;
1941 static int hf_ieee80211_tkip_extiv = -1;
1942 static int hf_ieee80211_ccmp_extiv = -1;
1943 static int hf_ieee80211_wep_key = -1;
1944 static int hf_ieee80211_wep_icv = -1;
1945
1946 static int hf_ieee80211_block_ack_request_control = -1;
1947 static int hf_ieee80211_block_ack_control = -1;
1948 static int hf_ieee80211_block_ack_control_ack_policy = -1;
1949 static int hf_ieee80211_block_ack_control_multi_tid = -1;
1950 static int hf_ieee80211_block_ack_control_compressed_bitmap = -1;
1951 static int hf_ieee80211_block_ack_control_reserved = -1;
1952
1953 static int hf_ieee80211_block_ack_control_basic_tid_info = -1;
1954 static int hf_ieee80211_block_ack_control_compressed_tid_info = -1;
1955 static int hf_ieee80211_block_ack_control_multi_tid_info = -1;
1956
1957 static int hf_ieee80211_block_ack_multi_tid_info = -1;
1958 static int hf_ieee80211_block_ack_request_type = -1;
1959 static int hf_ieee80211_block_ack_multi_tid_reserved = -1;
1960 static int hf_ieee80211_block_ack_multi_tid_value = -1;
1961 static int hf_ieee80211_block_ack_type = -1;
1962 static int hf_ieee80211_block_ack_bitmap = -1;
1963 static int hf_ieee80211_block_ack_bitmap_missing_frame = -1;
1964
1965 static int hf_ieee80211_tag_measure_request_measurement_mode = -1;
1966 static int hf_ieee80211_tag_measure_request_bssid = -1;
1967
1968 static int hf_ieee80211_tag_measure_request_subelement_length = -1;
1969 static int hf_ieee80211_tag_measure_request_beacon_sub_id = -1;
1970 static int hf_ieee80211_tag_measure_request_beacon_sub_ssid = -1;
1971 static int hf_ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition = -1;
1972 static int hf_ieee80211_tag_measure_request_beacon_sub_bri_threshold_offset = -1;
1973 static int hf_ieee80211_tag_measure_request_beacon_sub_reporting_detail = -1;
1974 static int hf_ieee80211_tag_measure_request_beacon_sub_request = -1;
1975 static int hf_ieee80211_tag_measure_request_beacon_unknown = -1;
1976
1977 static int hf_ieee80211_tag_measure_request_frame_request_type = -1;
1978 static int hf_ieee80211_tag_measure_request_mac_address  = -1;
1979 static int hf_ieee80211_tag_measure_request_peer_mac_address = -1;
1980 static int hf_ieee80211_tag_measure_request_group_id = -1;
1981
1982 static int hf_ieee80211_ht_cap = -1;
1983 static int hf_ieee80211_ht_vs_cap = -1;
1984 static int hf_ieee80211_ht_ldpc_coding = -1;
1985 static int hf_ieee80211_ht_chan_width = -1;
1986 static int hf_ieee80211_ht_sm_pwsave = -1;
1987 static int hf_ieee80211_ht_green = -1;
1988 static int hf_ieee80211_ht_short20 = -1;
1989 static int hf_ieee80211_ht_short40 = -1;
1990 static int hf_ieee80211_ht_tx_stbc = -1;
1991 static int hf_ieee80211_ht_rx_stbc = -1;
1992 static int hf_ieee80211_ht_delayed_block_ack = -1;
1993 static int hf_ieee80211_ht_max_amsdu = -1;
1994 static int hf_ieee80211_ht_dss_cck_40 = -1;
1995 static int hf_ieee80211_ht_psmp = -1;
1996 static int hf_ieee80211_ht_40_mhz_intolerant = -1;
1997 static int hf_ieee80211_ht_l_sig = -1;
1998
1999 static int hf_ieee80211_ampduparam = -1;
2000 static int hf_ieee80211_ampduparam_vs = -1;
2001 static int hf_ieee80211_ampduparam_mpdu = -1;
2002 static int hf_ieee80211_ampduparam_mpdu_start_spacing = -1;
2003 static int hf_ieee80211_ampduparam_reserved = -1;
2004
2005 static int hf_ieee80211_mcsset = -1;
2006 static int hf_ieee80211_mcsset_vs = -1;
2007 static int hf_ieee80211_mcsset_rx_bitmask = -1;
2008 static int hf_ieee80211_mcsset_rx_bitmask_0to7 = -1;
2009 static int hf_ieee80211_mcsset_rx_bitmask_8to15 = -1;
2010 static int hf_ieee80211_mcsset_rx_bitmask_16to23 = -1;
2011 static int hf_ieee80211_mcsset_rx_bitmask_24to31 = -1;
2012 static int hf_ieee80211_mcsset_rx_bitmask_32 = -1;
2013 static int hf_ieee80211_mcsset_rx_bitmask_33to38 = -1;
2014 static int hf_ieee80211_mcsset_rx_bitmask_39to52 = -1;
2015 static int hf_ieee80211_mcsset_rx_bitmask_53to76 = -1;
2016 static int hf_ieee80211_mcsset_highest_data_rate = -1;
2017 static int hf_ieee80211_mcsset_tx_mcs_set_defined = -1;
2018 static int hf_ieee80211_mcsset_tx_rx_mcs_set_not_equal = -1;
2019 static int hf_ieee80211_mcsset_tx_max_spatial_streams = -1;
2020 static int hf_ieee80211_mcsset_tx_unequal_modulation = -1;
2021
2022 static int hf_ieee80211_htex_cap = -1;
2023 static int hf_ieee80211_htex_vs_cap = -1;
2024 static int hf_ieee80211_htex_pco = -1;
2025 static int hf_ieee80211_htex_transtime = -1;
2026 static int hf_ieee80211_htex_mcs = -1;
2027 static int hf_ieee80211_htex_htc_support = -1;
2028 static int hf_ieee80211_htex_rd_responder = -1;
2029
2030 static int hf_ieee80211_txbf = -1;
2031 static int hf_ieee80211_txbf_vs = -1;
2032 static int hf_ieee80211_txbf_cap = -1;
2033 static int hf_ieee80211_txbf_rcv_ssc = -1;
2034 static int hf_ieee80211_txbf_tx_ssc = -1;
2035 static int hf_ieee80211_txbf_rcv_ndp = -1;
2036 static int hf_ieee80211_txbf_tx_ndp = -1;
2037 static int hf_ieee80211_txbf_impl_txbf = -1;
2038 static int hf_ieee80211_txbf_calib = -1;
2039 static int hf_ieee80211_txbf_expl_csi = -1;
2040 static int hf_ieee80211_txbf_expl_uncomp_fm = -1;
2041 static int hf_ieee80211_txbf_expl_comp_fm = -1;
2042 static int hf_ieee80211_txbf_expl_bf_csi = -1;
2043 static int hf_ieee80211_txbf_expl_uncomp_fm_feed = -1;
2044 static int hf_ieee80211_txbf_expl_comp_fm_feed = -1;
2045 static int hf_ieee80211_txbf_csi_num_bf_ant = -1;
2046 static int hf_ieee80211_txbf_min_group = -1;
2047 static int hf_ieee80211_txbf_uncomp_sm_bf_ant = -1;
2048 static int hf_ieee80211_txbf_comp_sm_bf_ant = -1;
2049 static int hf_ieee80211_txbf_csi_max_rows_bf = -1;
2050 static int hf_ieee80211_txbf_chan_est = -1;
2051 static int hf_ieee80211_txbf_resrv = -1;
2052
2053 /*** Begin: 802.11n D1.10 - HT Information IE  ***/
2054 static int hf_ieee80211_ht_info_primary_channel = -1;
2055
2056 static int hf_ieee80211_ht_info_delimiter1 = -1;
2057 static int hf_ieee80211_ht_info_secondary_channel_offset = -1;
2058 static int hf_ieee80211_ht_info_channel_width = -1;
2059 static int hf_ieee80211_ht_info_rifs_mode = -1;
2060 static int hf_ieee80211_ht_info_psmp_stas_only = -1;
2061 static int hf_ieee80211_ht_info_service_interval_granularity = -1;
2062
2063 static int hf_ieee80211_ht_info_delimiter2 = -1;
2064 static int hf_ieee80211_ht_info_operating_mode = -1;
2065 static int hf_ieee80211_ht_info_non_greenfield_sta_present = -1;
2066 static int hf_ieee80211_ht_info_transmit_burst_limit = -1;
2067 static int hf_ieee80211_ht_info_obss_non_ht_stas_present = -1;
2068 static int hf_ieee80211_ht_info_reserved_1 = -1;
2069
2070 static int hf_ieee80211_ht_info_delimiter3 = -1;
2071 static int hf_ieee80211_ht_info_reserved_2 = -1;
2072 static int hf_ieee80211_ht_info_dual_beacon = -1;
2073 static int hf_ieee80211_ht_info_dual_cts_protection = -1;
2074 static int hf_ieee80211_ht_info_secondary_beacon = -1;
2075 static int hf_ieee80211_ht_info_lsig_txop_protection_full_support = -1;
2076 static int hf_ieee80211_ht_info_pco_active = -1;
2077 static int hf_ieee80211_ht_info_pco_phase = -1;
2078 static int hf_ieee80211_ht_info_reserved_3 = -1;
2079 /*** End: 802.11n D1.10 - HT Information IE  ***/
2080
2081 static int hf_ieee80211_tag_secondary_channel_offset = -1;
2082
2083 static int hf_ieee80211_tag_power_constraint_local = -1;
2084
2085 static int hf_ieee80211_tag_power_capability_min = -1;
2086 static int hf_ieee80211_tag_power_capability_max = -1;
2087
2088 static int hf_ieee80211_tag_tpc_report_trsmt_pow = -1;
2089 static int hf_ieee80211_tag_tpc_report_link_mrg = -1;
2090
2091 static int hf_ieee80211_tag_supported_channels = -1;
2092 static int hf_ieee80211_tag_supported_channels_first = -1;
2093 static int hf_ieee80211_tag_supported_channels_range = -1;
2094
2095 static int hf_ieee80211_csa_channel_switch_mode = -1;
2096 static int hf_ieee80211_csa_new_channel_number = -1;
2097 static int hf_ieee80211_csa_channel_switch_count = -1;
2098
2099 static int hf_ieee80211_tag_measure_request_token = -1;
2100 static int hf_ieee80211_tag_measure_request_mode = -1;
2101 static int hf_ieee80211_tag_measure_request_mode_parallel = -1;
2102 static int hf_ieee80211_tag_measure_request_mode_enable = -1;
2103 static int hf_ieee80211_tag_measure_request_mode_request = -1;
2104 static int hf_ieee80211_tag_measure_request_mode_report = -1;
2105 static int hf_ieee80211_tag_measure_request_mode_duration_mandatory = -1;
2106 static int hf_ieee80211_tag_measure_request_mode_reserved = -1;
2107 static int hf_ieee80211_tag_measure_request_type = -1;
2108
2109 static int hf_ieee80211_tag_measure_request_channel_number = -1;
2110 static int hf_ieee80211_tag_measure_request_start_time = -1;
2111 static int hf_ieee80211_tag_measure_request_duration = -1;
2112
2113 static int hf_ieee80211_tag_measure_request_regulatory_class = -1;
2114 static int hf_ieee80211_tag_measure_request_randomization_interval = -1;
2115
2116 static int hf_ieee80211_tag_measure_report_measurement_token = -1;
2117 static int hf_ieee80211_tag_measure_report_mode = -1;
2118 static int hf_ieee80211_tag_measure_report_mode_late = -1;
2119 static int hf_ieee80211_tag_measure_report_mode_incapable = -1;
2120 static int hf_ieee80211_tag_measure_report_mode_refused = -1;
2121 static int hf_ieee80211_tag_measure_report_mode_reserved = -1;
2122 static int hf_ieee80211_tag_measure_report_type = -1;
2123 static int hf_ieee80211_tag_measure_report_channel_number = -1;
2124 static int hf_ieee80211_tag_measure_report_start_time = -1;
2125 static int hf_ieee80211_tag_measure_report_duration = -1;
2126
2127 static int hf_ieee80211_tag_measure_basic_map_field = -1;
2128 static int hf_ieee80211_tag_measure_map_field_bss = -1;
2129 static int hf_ieee80211_tag_measure_map_field_odfm = -1;
2130 static int hf_ieee80211_tag_measure_map_field_unident_signal = -1;
2131 static int hf_ieee80211_tag_measure_map_field_radar = -1;
2132 static int hf_ieee80211_tag_measure_map_field_unmeasured = -1;
2133 static int hf_ieee80211_tag_measure_map_field_reserved = -1;
2134
2135 static int hf_ieee80211_tag_measure_cca_busy_fraction = -1;
2136
2137 static int hf_ieee80211_tag_measure_rpi_histogram_report = -1;
2138 static int hf_ieee80211_tag_measure_rpi_histogram_report_0 = -1;
2139 static int hf_ieee80211_tag_measure_rpi_histogram_report_1 = -1;
2140 static int hf_ieee80211_tag_measure_rpi_histogram_report_2 = -1;
2141 static int hf_ieee80211_tag_measure_rpi_histogram_report_3 = -1;
2142 static int hf_ieee80211_tag_measure_rpi_histogram_report_4 = -1;
2143 static int hf_ieee80211_tag_measure_rpi_histogram_report_5 = -1;
2144 static int hf_ieee80211_tag_measure_rpi_histogram_report_6 = -1;
2145 static int hf_ieee80211_tag_measure_rpi_histogram_report_7 = -1;
2146
2147 static int hf_ieee80211_tag_measure_report_regulatory_class = -1;
2148 static int hf_ieee80211_tag_measure_report_channel_load = -1;
2149 static int hf_ieee80211_tag_measure_report_frame_info = -1;
2150 static int hf_ieee80211_tag_measure_report_frame_info_phy_type = -1;
2151 static int hf_ieee80211_tag_measure_report_frame_info_frame_type = -1;
2152 static int hf_ieee80211_tag_measure_report_rcpi = -1;
2153 static int hf_ieee80211_tag_measure_report_rsni = -1;
2154 static int hf_ieee80211_tag_measure_report_bssid = -1;
2155 static int hf_ieee80211_tag_measure_report_ant_id = -1;
2156 static int hf_ieee80211_tag_measure_report_anpi = -1;
2157 static int hf_ieee80211_tag_measure_report_ipi_density_0 = -1;
2158 static int hf_ieee80211_tag_measure_report_ipi_density_1 = -1;
2159 static int hf_ieee80211_tag_measure_report_ipi_density_2 = -1;
2160 static int hf_ieee80211_tag_measure_report_ipi_density_3 = -1;
2161 static int hf_ieee80211_tag_measure_report_ipi_density_4 = -1;
2162 static int hf_ieee80211_tag_measure_report_ipi_density_5 = -1;
2163 static int hf_ieee80211_tag_measure_report_ipi_density_6 = -1;
2164 static int hf_ieee80211_tag_measure_report_ipi_density_7 = -1;
2165 static int hf_ieee80211_tag_measure_report_ipi_density_8 = -1;
2166 static int hf_ieee80211_tag_measure_report_ipi_density_9 = -1;
2167 static int hf_ieee80211_tag_measure_report_ipi_density_10 = -1;
2168 static int hf_ieee80211_tag_measure_report_parent_tsf = -1;
2169
2170 static int hf_ieee80211_tag_quiet_count = -1;
2171 static int hf_ieee80211_tag_quiet_period = -1;
2172 static int hf_ieee80211_tag_quiet_duration = -1;
2173 static int hf_ieee80211_tag_quiet_offset = -1;
2174
2175 static int hf_ieee80211_tag_dfs_owner = -1;
2176 static int hf_ieee80211_tag_dfs_recovery_interval = -1;
2177 static int hf_ieee80211_tag_dfs_channel_map = -1;
2178 static int hf_ieee80211_tag_dfs_channel_number = -1;
2179 static int hf_ieee80211_tag_dfs_map = -1;
2180
2181 static int hf_ieee80211_tag_erp_info = -1;
2182 static int hf_ieee80211_tag_erp_info_erp_present = -1;
2183 static int hf_ieee80211_tag_erp_info_use_protection = -1;
2184 static int hf_ieee80211_tag_erp_info_barker_preamble_mode = -1;
2185 static int hf_ieee80211_tag_erp_info_reserved = -1;
2186
2187 static int hf_ieee80211_tag_extended_capabilities = -1;
2188 static int hf_ieee80211_tag_extended_capabilities_b0 = -1;
2189 static int hf_ieee80211_tag_extended_capabilities_b1 = -1;
2190 static int hf_ieee80211_tag_extended_capabilities_b2 = -1;
2191 static int hf_ieee80211_tag_extended_capabilities_b3 = -1;
2192 static int hf_ieee80211_tag_extended_capabilities_b4 = -1;
2193 static int hf_ieee80211_tag_extended_capabilities_b6 = -1;
2194 static int hf_ieee80211_tag_extended_capabilities_b27 = -1;
2195 static int hf_ieee80211_tag_extended_capabilities_b28 = -1;
2196 static int hf_ieee80211_tag_extended_capabilities_b29 = -1;
2197 static int hf_ieee80211_tag_extended_capabilities_b30 = -1;
2198 static int hf_ieee80211_tag_extended_capabilities_b31 = -1;
2199 static int hf_ieee80211_tag_extended_capabilities_b32 = -1;
2200 static int hf_ieee80211_tag_extended_capabilities_b33 = -1;
2201 static int hf_ieee80211_tag_extended_capabilities_b34 = -1;
2202 static int hf_ieee80211_tag_extended_capabilities_b36 = -1;
2203 static int hf_ieee80211_tag_extended_capabilities_b37 = -1;
2204 static int hf_ieee80211_tag_extended_capabilities_b38 = -1;
2205 static int hf_ieee80211_tag_extended_capabilities_b39 = -1;
2206 static int hf_ieee80211_tag_extended_capabilities_b40 = -1;
2207 static int hf_ieee80211_tag_extended_capabilities_serv_int_granularity = -1;
2208
2209 static int hf_ieee80211_tag_cisco_ccx1_unknown = -1;
2210 static int hf_ieee80211_tag_cisco_ccx1_name = -1;
2211 static int hf_ieee80211_tag_cisco_ccx1_clients = -1;
2212
2213 static int hf_ieee80211_tag_neighbor_report_bssid = -1;
2214 static int hf_ieee80211_tag_neighbor_report_bssid_info = -1;
2215 static int hf_ieee80211_tag_neighbor_report_bssid_info_reachability = -1;
2216 static int hf_ieee80211_tag_neighbor_report_bssid_info_security = -1;
2217 static int hf_ieee80211_tag_neighbor_report_bssid_info_key_scope = -1;
2218 /*static int hf_ieee80211_tag_neighbor_report_bssid_info_capability = -1; */ /* TODO Make this the parent tree item */
2219 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_spec_mng = -1;
2220 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_qos = -1;
2221 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_apsd = -1;
2222 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_radio_msnt = -1;
2223 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_dback = -1;
2224 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_iback = -1;
2225 static int hf_ieee80211_tag_neighbor_report_bssid_info_mobility_domain = -1;
2226 static int hf_ieee80211_tag_neighbor_report_bssid_info_high_throughput = -1;
2227 static int hf_ieee80211_tag_neighbor_report_bssid_info_reserved = -1;
2228 static int hf_ieee80211_tag_neighbor_report_reg_class = -1;
2229 static int hf_ieee80211_tag_neighbor_report_channel_number = -1;
2230 static int hf_ieee80211_tag_neighbor_report_phy_type = -1;
2231
2232 static int hf_ieee80211_tag_supported_reg_classes_current = -1;
2233 static int hf_ieee80211_tag_supported_reg_classes_alternate = -1;
2234
2235 /* IEEE Std 802.11r-2008 7.3.2.47 */
2236 static int hf_ieee80211_tag_mobility_domain_mdid = -1;
2237 static int hf_ieee80211_tag_mobility_domain_ft_capab = -1;
2238 static int hf_ieee80211_tag_mobility_domain_ft_capab_ft_over_ds = -1;
2239 static int hf_ieee80211_tag_mobility_domain_ft_capab_resource_req = -1;
2240
2241 /* IEEE Std 802.11r-2008 7.3.2.48 */
2242 static int hf_ieee80211_tag_ft_mic_control = -1;
2243 static int hf_ieee80211_tag_ft_element_count = -1;
2244 static int hf_ieee80211_tag_ft_mic = -1;
2245 static int hf_ieee80211_tag_ft_anonce = -1;
2246 static int hf_ieee80211_tag_ft_snonce = -1;
2247 static int hf_ieee80211_tag_ft_subelem_id = -1;
2248 static int hf_ieee80211_tag_ft_subelem_len = -1;
2249 static int hf_ieee80211_tag_ft_subelem_data = -1;
2250 static int hf_ieee80211_tag_ft_subelem_r1kh_id = -1;
2251 static int hf_ieee80211_tag_ft_subelem_gtk_key_info = -1;
2252 static int hf_ieee80211_tag_ft_subelem_gtk_key_id = -1;
2253 static int hf_ieee80211_tag_ft_subelem_gtk_key_length = -1;
2254 static int hf_ieee80211_tag_ft_subelem_gtk_rsc = -1;
2255 static int hf_ieee80211_tag_ft_subelem_gtk_key = -1;
2256 static int hf_ieee80211_tag_ft_subelem_r0kh_id = -1;
2257 static int hf_ieee80211_tag_ft_subelem_igtk_key_id = -1;
2258 static int hf_ieee80211_tag_ft_subelem_igtk_ipn = -1;
2259 static int hf_ieee80211_tag_ft_subelem_igtk_key_length = -1;
2260 static int hf_ieee80211_tag_ft_subelem_igtk_key = -1;
2261
2262 /* IEEE Std 802.11w-2009 7.3.2.55 */
2263 static int hf_ieee80211_tag_mmie_keyid = -1;
2264 static int hf_ieee80211_tag_mmie_ipn = -1;
2265 static int hf_ieee80211_tag_mmie_mic = -1;
2266
2267 /* IEEE Std 802.11v-2011 7.3.2.61 */
2268 static int hf_ieee80211_tag_time_adv_timing_capab = -1;
2269 static int hf_ieee80211_tag_time_adv_time_value = -1;
2270 static int hf_ieee80211_tag_time_adv_time_value_year = -1;
2271 static int hf_ieee80211_tag_time_adv_time_value_month = -1;
2272 static int hf_ieee80211_tag_time_adv_time_value_day = -1;
2273 static int hf_ieee80211_tag_time_adv_time_value_hours = -1;
2274 static int hf_ieee80211_tag_time_adv_time_value_minutes = -1;
2275 static int hf_ieee80211_tag_time_adv_time_value_seconds = -1;
2276 static int hf_ieee80211_tag_time_adv_time_value_milliseconds = -1;
2277 static int hf_ieee80211_tag_time_adv_time_value_reserved = -1;
2278 static int hf_ieee80211_tag_time_adv_time_error = -1;
2279 static int hf_ieee80211_tag_time_adv_time_update_counter = -1;
2280
2281 /* IEEE Std 802.11v-2011 7.3.2.87 */
2282 static int hf_ieee80211_tag_time_zone = -1;
2283
2284 /* IEEE Std 802.11u-2011 7.3.2.92 */
2285 static int hf_ieee80211_tag_interworking_access_network_type = -1;
2286 static int hf_ieee80211_tag_interworking_internet = -1;
2287 static int hf_ieee80211_tag_interworking_asra = -1;
2288 static int hf_ieee80211_tag_interworking_esr = -1;
2289 static int hf_ieee80211_tag_interworking_uesa = -1;
2290 static int hf_ieee80211_tag_interworking_hessid = -1;
2291
2292 /* IEEE Std 802.11u-2011 7.3.2.93 */
2293 static int hf_ieee80211_tag_adv_proto_resp_len_limit = -1;
2294 static int hf_ieee80211_tag_adv_proto_pame_bi = -1;
2295 static int hf_ieee80211_tag_adv_proto_id = -1;
2296
2297 /* IEEE Std 802.11u-2011 7.3.2.96 */
2298 static int hf_ieee80211_tag_roaming_consortium_num_anqp_oi = -1;
2299 static int hf_ieee80211_tag_roaming_consortium_oi1_len = -1;
2300 static int hf_ieee80211_tag_roaming_consortium_oi2_len = -1;
2301 static int hf_ieee80211_tag_roaming_consortium_oi1 = -1;
2302 static int hf_ieee80211_tag_roaming_consortium_oi2 = -1;
2303 static int hf_ieee80211_tag_roaming_consortium_oi3 = -1;
2304
2305 /* 802.11n 7.3.2.48 */
2306 static int hf_ieee80211_hta_cc = -1;
2307 static int hf_ieee80211_hta_cap = -1;
2308 static int hf_ieee80211_hta_ext_chan_offset = -1;
2309 static int hf_ieee80211_hta_rec_tx_width = -1;
2310 static int hf_ieee80211_hta_rifs_mode = -1;
2311 static int hf_ieee80211_hta_controlled_access = -1;
2312 static int hf_ieee80211_hta_service_interval = -1;
2313 static int hf_ieee80211_hta_operating_mode = -1;
2314 static int hf_ieee80211_hta_non_gf_devices = -1;
2315 static int hf_ieee80211_hta_basic_stbc_mcs = -1;
2316 static int hf_ieee80211_hta_dual_stbc_protection = -1;
2317 static int hf_ieee80211_hta_secondary_beacon = -1;
2318 static int hf_ieee80211_hta_lsig_txop_protection = -1;
2319 static int hf_ieee80211_hta_pco_active = -1;
2320 static int hf_ieee80211_hta_pco_phase = -1;
2321
2322 static int hf_ieee80211_antsel = -1;
2323 static int hf_ieee80211_antsel_vs = -1;
2324 static int hf_ieee80211_antsel_b0 = -1;
2325 static int hf_ieee80211_antsel_b1 = -1;
2326 static int hf_ieee80211_antsel_b2 = -1;
2327 static int hf_ieee80211_antsel_b3 = -1;
2328 static int hf_ieee80211_antsel_b4 = -1;
2329 static int hf_ieee80211_antsel_b5 = -1;
2330 static int hf_ieee80211_antsel_b6 = -1;
2331 static int hf_ieee80211_antsel_b7 = -1;
2332
2333 static int hf_ieee80211_rsn_version = -1;
2334 static int hf_ieee80211_rsn_gcs = -1;
2335 static int hf_ieee80211_rsn_gcs_oui = -1;
2336 static int hf_ieee80211_rsn_gcs_type = -1;
2337 static int hf_ieee80211_rsn_gcs_80211_type = -1;
2338 static int hf_ieee80211_rsn_pcs_count = -1;
2339 static int hf_ieee80211_rsn_pcs_list = -1;
2340 static int hf_ieee80211_rsn_pcs = -1;
2341 static int hf_ieee80211_rsn_pcs_oui = -1;
2342 static int hf_ieee80211_rsn_pcs_80211_type = -1;
2343 static int hf_ieee80211_rsn_pcs_type = -1;
2344 static int hf_ieee80211_rsn_akms_count = -1;
2345 static int hf_ieee80211_rsn_akms_list = -1;
2346 static int hf_ieee80211_rsn_akms = -1;
2347 static int hf_ieee80211_rsn_akms_oui = -1;
2348 static int hf_ieee80211_rsn_akms_80211_type = -1;
2349 static int hf_ieee80211_rsn_akms_type = -1;
2350 static int hf_ieee80211_rsn_cap = -1;
2351 static int hf_ieee80211_rsn_cap_preauth = -1;
2352 static int hf_ieee80211_rsn_cap_no_pairwise = -1;
2353 static int hf_ieee80211_rsn_cap_ptksa_replay_counter = -1;
2354 static int hf_ieee80211_rsn_cap_gtksa_replay_counter = -1;
2355 static int hf_ieee80211_rsn_cap_mfpr = -1;
2356 static int hf_ieee80211_rsn_cap_mfpc = -1;
2357 static int hf_ieee80211_rsn_cap_peerkey = -1;
2358 static int hf_ieee80211_rsn_pmkid_count = -1;
2359 static int hf_ieee80211_rsn_pmkid_list = -1;
2360 static int hf_ieee80211_rsn_pmkid = -1;
2361 static int hf_ieee80211_rsn_gmcs = -1;
2362 static int hf_ieee80211_rsn_gmcs_oui = -1;
2363 static int hf_ieee80211_rsn_gmcs_type = -1;
2364 static int hf_ieee80211_rsn_gmcs_80211_type = -1;
2365
2366 static int hf_ieee80211_wfa_ie_type = -1;
2367 static int hf_ieee80211_wfa_ie_wpa_version = -1;
2368 static int hf_ieee80211_wfa_ie_wpa_mcs = -1;
2369 static int hf_ieee80211_wfa_ie_wpa_mcs_oui = -1;
2370 static int hf_ieee80211_wfa_ie_wpa_mcs_type = -1;
2371 static int hf_ieee80211_wfa_ie_wpa_mcs_wfa_type = -1;
2372 static int hf_ieee80211_wfa_ie_wpa_ucs_count = -1;
2373 static int hf_ieee80211_wfa_ie_wpa_ucs_list = -1;
2374 static int hf_ieee80211_wfa_ie_wpa_ucs = -1;
2375 static int hf_ieee80211_wfa_ie_wpa_ucs_oui = -1;
2376 static int hf_ieee80211_wfa_ie_wpa_ucs_wfa_type = -1;
2377 static int hf_ieee80211_wfa_ie_wpa_ucs_type = -1;
2378 static int hf_ieee80211_wfa_ie_wpa_akms_count = -1;
2379 static int hf_ieee80211_wfa_ie_wpa_akms_list = -1;
2380 static int hf_ieee80211_wfa_ie_wpa_akms = -1;
2381 static int hf_ieee80211_wfa_ie_wpa_akms_oui = -1;
2382 static int hf_ieee80211_wfa_ie_wpa_akms_wfa_type = -1;
2383 static int hf_ieee80211_wfa_ie_wpa_akms_type = -1;
2384 static int hf_ieee80211_wfa_ie_wme_subtype = -1;
2385 static int hf_ieee80211_wfa_ie_wme_version = -1;
2386 static int hf_ieee80211_wfa_ie_wme_qos_info = -1;
2387 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_max_sp_length = -1;
2388 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_be = -1;
2389 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_bk = -1;
2390 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vi = -1;
2391 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vo = -1;
2392 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_reserved = -1;
2393 static int hf_ieee80211_wfa_ie_wme_qos_info_ap_u_apsd = -1;
2394 static int hf_ieee80211_wfa_ie_wme_qos_info_ap_parameter_set_count = -1;
2395 static int hf_ieee80211_wfa_ie_wme_qos_info_ap_reserved = -1;
2396 static int hf_ieee80211_wfa_ie_wme_reserved = -1;
2397 static int hf_ieee80211_wfa_ie_wme_ac_parameters = -1;
2398 static int hf_ieee80211_wfa_ie_wme_acp_aci_aifsn = -1;
2399 static int hf_ieee80211_wfa_ie_wme_acp_aci = -1;
2400 static int hf_ieee80211_wfa_ie_wme_acp_acm = -1;
2401 static int hf_ieee80211_wfa_ie_wme_acp_aifsn = -1;
2402 static int hf_ieee80211_wfa_ie_wme_acp_reserved = -1;
2403 static int hf_ieee80211_wfa_ie_wme_acp_ecw = -1;
2404 static int hf_ieee80211_wfa_ie_wme_acp_ecw_max = -1;
2405 static int hf_ieee80211_wfa_ie_wme_acp_ecw_min = -1;
2406 static int hf_ieee80211_wfa_ie_wme_acp_txop_limit = -1;
2407 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo = -1;
2408 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_tid = -1;
2409 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_direction = -1;
2410 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_psb = -1;
2411 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_up = -1;
2412 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_reserved = -1;
2413 static int hf_ieee80211_wfa_ie_wme_tspec_nor_msdu = -1;
2414 static int hf_ieee80211_wfa_ie_wme_tspec_max_msdu = -1;
2415 static int hf_ieee80211_wfa_ie_wme_tspec_min_srv = -1;
2416 static int hf_ieee80211_wfa_ie_wme_tspec_max_srv = -1;
2417 static int hf_ieee80211_wfa_ie_wme_tspec_inact_int = -1;
2418 static int hf_ieee80211_wfa_ie_wme_tspec_susp_int = -1;
2419 static int hf_ieee80211_wfa_ie_wme_tspec_srv_start = -1;
2420 static int hf_ieee80211_wfa_ie_wme_tspec_min_data = -1;
2421 static int hf_ieee80211_wfa_ie_wme_tspec_mean_data = -1;
2422 static int hf_ieee80211_wfa_ie_wme_tspec_peak_data = -1;
2423 static int hf_ieee80211_wfa_ie_wme_tspec_burst_size = -1;
2424 static int hf_ieee80211_wfa_ie_wme_tspec_delay_bound = -1;
2425 static int hf_ieee80211_wfa_ie_wme_tspec_min_phy = -1;
2426 static int hf_ieee80211_wfa_ie_wme_tspec_surplus = -1;
2427 static int hf_ieee80211_wfa_ie_wme_tspec_medium = -1;
2428
2429 static int hf_ieee80211_aironet_ie_type = -1;
2430 static int hf_ieee80211_aironet_ie_version = -1;
2431 static int hf_ieee80211_aironet_ie_data = -1;
2432 static int hf_ieee80211_aironet_ie_qos_unk1 = -1;
2433 static int hf_ieee80211_aironet_ie_qos_paramset = -1;
2434 static int hf_ieee80211_aironet_ie_qos_val = -1;
2435
2436 static int hf_ieee80211_marvell_ie_type = -1;
2437 static int hf_ieee80211_marvell_ie_mesh_subtype = -1;
2438 static int hf_ieee80211_marvell_ie_mesh_version = -1;
2439 static int hf_ieee80211_marvell_ie_mesh_active_proto_id = -1;
2440 static int hf_ieee80211_marvell_ie_mesh_active_metric_id = -1;
2441 static int hf_ieee80211_marvell_ie_mesh_cap = -1;
2442 static int hf_ieee80211_marvell_ie_data = -1;
2443
2444 static int hf_ieee80211_atheros_ie_type = -1;
2445 static int hf_ieee80211_atheros_ie_subtype = -1;
2446 static int hf_ieee80211_atheros_ie_version = -1;
2447 static int hf_ieee80211_atheros_ie_cap_f_turbop = -1;
2448 static int hf_ieee80211_atheros_ie_cap_f_comp = -1;
2449 static int hf_ieee80211_atheros_ie_cap_f_ff = -1;
2450 static int hf_ieee80211_atheros_ie_cap_f_xr = -1;
2451 static int hf_ieee80211_atheros_ie_cap_f_ar = -1;
2452 static int hf_ieee80211_atheros_ie_cap_f_burst = -1;
2453 static int hf_ieee80211_atheros_ie_cap_f_wme = -1;
2454 static int hf_ieee80211_atheros_ie_cap_f_boost = -1;
2455 static int hf_ieee80211_atheros_ie_advcap_cap = -1;
2456 static int hf_ieee80211_atheros_ie_advcap_defkey = -1;
2457 static int hf_ieee80211_atheros_ie_xr_info = -1;
2458 static int hf_ieee80211_atheros_ie_xr_base_bssid = -1;
2459 static int hf_ieee80211_atheros_ie_xr_xr_bssid = -1;
2460 static int hf_ieee80211_atheros_ie_xr_xr_beacon = -1;
2461 static int hf_ieee80211_atheros_ie_xr_base_cap = -1;
2462 static int hf_ieee80211_atheros_ie_xr_xr_cap = -1;
2463 static int hf_ieee80211_atheros_ie_data = -1;
2464
2465 /*QBSS - Version 1,2,802.11e*/
2466
2467 static int hf_ieee80211_qbss2_cal = -1;
2468 static int hf_ieee80211_qbss2_gl = -1;
2469 static int hf_ieee80211_qbss_cu = -1;
2470 static int hf_ieee80211_qbss2_cu = -1;
2471 static int hf_ieee80211_qbss_scount = -1;
2472 static int hf_ieee80211_qbss2_scount = -1;
2473 static int hf_ieee80211_qbss_version = -1;
2474 static int hf_ieee80211_qbss_adc = -1;
2475
2476 static int hf_ieee80211_tsinfo = -1;
2477 static int hf_ieee80211_tsinfo_type = -1;
2478 static int hf_ieee80211_tsinfo_tsid = -1;
2479 static int hf_ieee80211_tsinfo_dir = -1;
2480 static int hf_ieee80211_tsinfo_access = -1;
2481 static int hf_ieee80211_tsinfo_agg = -1;
2482 static int hf_ieee80211_tsinfo_apsd = -1;
2483 static int hf_ieee80211_tsinfo_up = -1;
2484 static int hf_ieee80211_tsinfo_ack = -1;
2485 static int hf_ieee80211_tsinfo_sched = -1;
2486 static int hf_ieee80211_tsinfo_rsv = -1;
2487
2488 static const int *ieee80211_tsinfo_fields[] = {
2489   &hf_ieee80211_tsinfo_type,
2490   &hf_ieee80211_tsinfo_tsid,
2491   &hf_ieee80211_tsinfo_dir,
2492   &hf_ieee80211_tsinfo_access,
2493   &hf_ieee80211_tsinfo_agg,
2494   &hf_ieee80211_tsinfo_apsd,
2495   &hf_ieee80211_tsinfo_up,
2496   &hf_ieee80211_tsinfo_ack,
2497   &hf_ieee80211_tsinfo_sched,
2498   &hf_ieee80211_tsinfo_rsv,
2499   NULL
2500 };
2501
2502 static int hf_ieee80211_tspec_nor_msdu = -1;
2503 static int hf_ieee80211_tspec_max_msdu = -1;
2504 static int hf_ieee80211_tspec_min_srv = -1;
2505 static int hf_ieee80211_tspec_max_srv = -1;
2506 static int hf_ieee80211_tspec_inact_int = -1;
2507 static int hf_ieee80211_tspec_susp_int = -1;
2508 static int hf_ieee80211_tspec_srv_start = -1;
2509 static int hf_ieee80211_tspec_min_data = -1;
2510 static int hf_ieee80211_tspec_mean_data = -1;
2511 static int hf_ieee80211_tspec_peak_data = -1;
2512 static int hf_ieee80211_tspec_burst_size = -1;
2513 static int hf_ieee80211_tspec_delay_bound = -1;
2514 static int hf_ieee80211_tspec_min_phy = -1;
2515 static int hf_ieee80211_tspec_surplus = -1;
2516 static int hf_ieee80211_tspec_medium = -1;
2517 static int hf_ieee80211_ts_delay = -1;
2518 static int hf_ieee80211_tclas_process = -1;
2519 static int hf_ieee80211_tag_qos_cap_qos_info = -1;
2520 static int hf_ieee80211_qos_info_field_vo_uapsd = -1;
2521 static int hf_ieee80211_qos_info_field_vi_uapsd = -1;
2522 static int hf_ieee80211_qos_info_field_bk_uapsd = -1;
2523 static int hf_ieee80211_qos_info_field_be_uapsd = -1;
2524 static int hf_ieee80211_qos_info_field_qack = -1;
2525 static int hf_ieee80211_qos_info_field_max_sp_length = -1;
2526 static int hf_ieee80211_qos_info_field_more_data_ack = -1;
2527 static int hf_ieee80211_qos_info_field_edca_upd_cnt = -1;
2528 static int hf_ieee80211_qos_info_field_queue_req = -1;
2529 static int hf_ieee80211_qos_info_field_txop_req = -1;
2530 static int hf_ieee80211_qos_info_field_reserved = -1;
2531 static int hf_ieee80211_tag_ext_supp_rates = -1;
2532 static int hf_ieee80211_sched_info = -1;
2533 static int hf_ieee80211_sched_info_agg = -1;
2534 static int hf_ieee80211_sched_info_tsid = -1;
2535 static int hf_ieee80211_sched_info_dir = -1;
2536 static int hf_ieee80211_sched_srv_start = -1;
2537 static int hf_ieee80211_sched_srv_int = -1;
2538 static int hf_ieee80211_sched_spec_int = -1;
2539 static int hf_ieee80211_tclas_up = -1;
2540 static int hf_ieee80211_tclas_class_type = -1;
2541 static int hf_ieee80211_tclas_class_mask = -1;
2542 static int hf_ieee80211_tclas_src_mac_addr = -1;
2543 static int hf_ieee80211_tclas_dst_mac_addr = -1;
2544 static int hf_ieee80211_tclas_ether_type = -1;
2545 static int hf_ieee80211_tclas_version = -1;
2546 static int hf_ieee80211_tclas_ipv4_src = -1;
2547 static int hf_ieee80211_tclas_ipv4_dst = -1;
2548 static int hf_ieee80211_tclas_src_port = -1;
2549 static int hf_ieee80211_tclas_dst_port = -1;
2550 static int hf_ieee80211_tclas_dscp = -1;
2551 static int hf_ieee80211_tclas_protocol = -1;
2552 static int hf_ieee80211_tclas_ipv6_src = -1;
2553 static int hf_ieee80211_tclas_ipv6_dst = -1;
2554 static int hf_ieee80211_tclas_flow = -1;
2555 static int hf_ieee80211_tclas_tag_type = -1;
2556
2557 static int hf_ieee80211_aruba = -1;
2558 static int hf_ieee80211_aruba_hb_seq = -1;
2559 static int hf_ieee80211_aruba_mtu = -1;
2560
2561 static int hf_ieee80211_tag_vendor_oui_type = -1;
2562
2563 /* IEEE Std 802.11z-2010 7.3.2.62 */
2564 static int hf_ieee80211_tag_link_id_bssid = -1;
2565 static int hf_ieee80211_tag_link_id_init_sta = -1;
2566 static int hf_ieee80211_tag_link_id_resp_sta = -1;
2567
2568 /* IEEE Std 802.11z-2010 7.3.2.63 */
2569 static int hf_ieee80211_tag_wakeup_schedule_offset = -1;
2570 static int hf_ieee80211_tag_wakeup_schedule_interval = -1;
2571 static int hf_ieee80211_tag_wakeup_schedule_awake_window_slots = -1;
2572 static int hf_ieee80211_tag_wakeup_schedule_max_awake_dur = -1;
2573 static int hf_ieee80211_tag_wakeup_schedule_idle_count = -1;
2574
2575 /* IEEE Std 802.11z-2010 7.3.2.64 */
2576 static int hf_ieee80211_tag_channel_switch_timing_switch_time = -1;
2577 static int hf_ieee80211_tag_channel_switch_timing_switch_timeout = -1;
2578
2579 /* IEEE Std 802.11z-2010 7.3.2.65 */
2580 static int hf_ieee80211_tag_pti_control_tid = -1;
2581 static int hf_ieee80211_tag_pti_control_sequence_control = -1;
2582
2583 /* IEEE Std 802.11z-2010 7.3.2.66 */
2584 static int hf_ieee80211_tag_pu_buffer_status_ac_bk = -1;
2585 static int hf_ieee80211_tag_pu_buffer_status_ac_be = -1;
2586 static int hf_ieee80211_tag_pu_buffer_status_ac_vi = -1;
2587 static int hf_ieee80211_tag_pu_buffer_status_ac_vo = -1;
2588
2589 /* IEEE Std 802.11r-2008 7.3.2.49 */
2590 static int hf_ieee80211_tag_timeout_int_type = -1;
2591 static int hf_ieee80211_tag_timeout_int_value = -1;
2592
2593 /* Ethertype 89-0d */
2594 static int hf_ieee80211_data_encap_payload_type = -1;
2595
2596 /* ************************************************************************* */
2597 /*                               Protocol trees                              */
2598 /* ************************************************************************* */
2599 static gint ett_80211 = -1;
2600 static gint ett_proto_flags = -1;
2601 static gint ett_cap_tree = -1;
2602 static gint ett_fc_tree = -1;
2603 static gint ett_cntrl_wrapper_fc = -1;
2604 static gint ett_cntrl_wrapper_payload = -1;
2605 static gint ett_fragments = -1;
2606 static gint ett_fragment = -1;
2607 static gint ett_block_ack = -1;
2608 static gint ett_block_ack_bitmap = -1;
2609 static gint ett_ath_cap_tree = -1;
2610
2611
2612 static gint ett_80211_mgt = -1;
2613 static gint ett_fixed_parameters = -1;
2614 static gint ett_tagged_parameters = -1;
2615 static gint ett_tag_bmapctl_tree = -1;
2616 static gint ett_tag_country_fnm_tree = -1;
2617 static gint ett_tag_country_rcc_tree = -1;
2618 static gint ett_qos_parameters = -1;
2619 static gint ett_qos_ps_buf_state = -1;
2620 static gint ett_qos_info_field_tree = -1;
2621 static gint ett_wep_parameters = -1;
2622 static gint ett_msh_control = -1;
2623 static gint ett_hwmp_targ_flags_tree = -1;
2624
2625 static gint ett_rsn_gcs_tree = -1;
2626 static gint ett_rsn_pcs_tree = -1;
2627 static gint ett_rsn_sub_pcs_tree = -1;
2628 static gint ett_rsn_akms_tree = -1;
2629 static gint ett_rsn_sub_akms_tree = -1;
2630 static gint ett_rsn_cap_tree = -1;
2631 static gint ett_rsn_pmkid_tree = -1;
2632 static gint ett_rsn_gmcs_tree = -1;
2633
2634 static gint ett_wpa_mcs_tree = -1;
2635 static gint ett_wpa_ucs_tree = -1;
2636 static gint ett_wpa_sub_ucs_tree = -1;
2637 static gint ett_wpa_akms_tree = -1;
2638 static gint ett_wpa_sub_akms_tree = -1;
2639 static gint ett_wme_ac = -1;
2640 static gint ett_wme_aci_aifsn = -1;
2641 static gint ett_wme_ecw = -1;
2642 static gint ett_wme_qos_info = -1;
2643
2644 static gint ett_ht_cap_tree = -1;
2645 static gint ett_ampduparam_tree = -1;
2646 static gint ett_mcsset_tree = -1;
2647 static gint ett_mcsbit_tree = -1;
2648 static gint ett_htex_cap_tree = -1;
2649 static gint ett_txbf_tree = -1;
2650 static gint ett_antsel_tree = -1;
2651 static gint ett_hta_cap_tree = -1;
2652 static gint ett_hta_cap1_tree = -1;
2653 static gint ett_hta_cap2_tree = -1;
2654 static gint ett_htc_tree = -1;
2655
2656 static gint ett_ht_info_delimiter1_tree = -1;
2657 static gint ett_ht_info_delimiter2_tree = -1;
2658 static gint ett_ht_info_delimiter3_tree = -1;
2659
2660 static gint ett_tag_measure_request_mode_tree = -1;
2661 static gint ett_tag_measure_request_type_tree = -1;
2662 static gint ett_tag_measure_report_mode_tree = -1;
2663 static gint ett_tag_measure_report_type_tree = -1;
2664 static gint ett_tag_measure_report_basic_map_tree = -1;
2665 static gint ett_tag_measure_report_rpi_tree = -1;
2666 static gint ett_tag_measure_report_frame_tree = -1;
2667 static gint ett_tag_dfs_map_tree = -1;
2668 static gint ett_tag_erp_info_tree = -1;
2669 static gint ett_tag_ex_cap = -1;
2670
2671 static gint ett_tag_supported_channels = -1;
2672
2673 static gint ett_tag_neighbor_report_bssid_info_tree = -1;
2674 static gint ett_tag_neighbor_report_bssid_info_capability_tree = -1;
2675 static gint ett_tag_neighbor_report_sub_tag_tree = -1;
2676
2677 static gint ett_tag_time_adv_tree = -1;
2678
2679 static gint ett_ff_ba_param_tree = -1;
2680 static gint ett_ff_ba_ssc_tree = -1;
2681 static gint ett_ff_delba_param_tree = -1;
2682 static gint ett_ff_qos_info = -1;
2683 static gint ett_ff_sm_pwr_save = -1;
2684 static gint ett_ff_psmp_param_set = -1;
2685 static gint ett_ff_mimo_cntrl = -1;
2686 static gint ett_ff_ant_sel = -1;
2687 static gint ett_mimo_report = -1;
2688 static gint ett_ff_chan_switch_announce = -1;
2689 static gint ett_ff_ht_info = -1;
2690 static gint ett_ff_psmp_sta_info = -1;
2691
2692 static gint ett_msdu_aggregation_parent_tree = -1;
2693 static gint ett_msdu_aggregation_subframe_tree = -1;
2694
2695 static gint ett_80211_mgt_ie = -1;
2696 static gint ett_tsinfo_tree = -1;
2697 static gint ett_sched_tree = -1;
2698
2699 static gint ett_fcs = -1;
2700
2701 static gint ett_adv_proto = -1;
2702 static gint ett_adv_proto_tuple = -1;
2703 static gint ett_gas_query = -1;
2704 static gint ett_gas_anqp = -1;
2705 static gint ett_nai_realm = -1;
2706 static gint ett_nai_realm_eap = -1;
2707 static gint ett_anqp_vendor_capab = -1;
2708
2709 static const fragment_items frag_items = {
2710   &ett_fragment,
2711   &ett_fragments,
2712   &hf_ieee80211_fragments,
2713   &hf_ieee80211_fragment,
2714   &hf_ieee80211_fragment_overlap,
2715   &hf_ieee80211_fragment_overlap_conflict,
2716   &hf_ieee80211_fragment_multiple_tails,
2717   &hf_ieee80211_fragment_too_long_fragment,
2718   &hf_ieee80211_fragment_error,
2719   &hf_ieee80211_fragment_count,
2720   &hf_ieee80211_reassembled_in,
2721   &hf_ieee80211_reassembled_length,
2722   "fragments"
2723 };
2724
2725 static enum_val_t wlan_ignore_wep_options[] = {
2726   { "no",         "No",               WLAN_IGNORE_WEP_NO    },
2727   { "without_iv", "Yes - without IV", WLAN_IGNORE_WEP_WO_IV },
2728   { "with_iv",    "Yes - with IV",    WLAN_IGNORE_WEP_W_IV  },
2729   { NULL,         NULL,               0                     }
2730 };
2731
2732 static dissector_handle_t ieee80211_handle;
2733 static dissector_handle_t llc_handle;
2734 static dissector_handle_t ipx_handle;
2735 static dissector_handle_t eth_withoutfcs_handle;
2736 static dissector_handle_t data_handle;
2737
2738 static int wlan_tap = -1;
2739
2740 static const value_string access_network_type_vals[] =
2741 {
2742   { 0, "Private network" },
2743   { 1, "Private network with guest access" },
2744   { 2, "Chargeable public network" },
2745   { 3, "Free public network" },
2746   { 4, "Personal device network" },
2747   { 5, "Emergency services only network" },
2748   { 14, "Test or experimental" },
2749   { 15, "Wildcard" },
2750   { 0, NULL }
2751 };
2752
2753 static const value_string adv_proto_id_vals[] =
2754 {
2755   {0, "Access Network Query Protocol"},
2756   {1, "MIH Information Service"},
2757   {2, "MIH Command and Event Services Capability Discovery"},
2758   {3, "Emergency Alert System (EAS)"},
2759   {4, "Location-to-Service Translation Protocol"},
2760   {221, "Vendor Specific"},
2761   {0, NULL}
2762 };
2763
2764 static const value_string timeout_int_types[] =
2765 {
2766   {1, "Reassociation deadline interval (TUs)"},
2767   {2, "Key lifetime interval (seconds)"},
2768   {3, "Association Comeback time (TUs)"},
2769   {0, NULL}
2770 };
2771
2772 static const value_string tdls_action_codes[] ={
2773   {TDLS_SETUP_REQUEST, "TDLS Setup Request"},
2774   {TDLS_SETUP_RESPONSE, "TDLS Setup Response"},
2775   {TDLS_SETUP_CONFIRM, "TDLS Setup Confirm"},
2776   {TDLS_TEARDOWN, "TDLS Teardown"},
2777   {TDLS_PEER_TRAFFIC_INDICATION, "TDLS Peer Traffic Indication"},
2778   {TDLS_CHANNEL_SWITCH_REQUEST, "TDLS Channel Switch Request"},
2779   {TDLS_CHANNEL_SWITCH_RESPONSE, "TDLS Channel Switch Response"},
2780   {TDLS_PEER_PSM_REQUEST, "TDLS Peer PSM Request"},
2781   {TDLS_PEER_PSM_RESPONSE, "TDLS Peer PSM Response"},
2782   {TDLS_PEER_TRAFFIC_RESPONSE, "TDLS Peer Traffic Response"},
2783   {TDLS_DISCOVERY_REQUEST, "TDLS Discovery Request"},
2784   {0, NULL}
2785 };
2786
2787 AIRPDCAP_CONTEXT airpdcap_ctx;
2788
2789 #define PSMP_STA_INFO_BROADCAST 0
2790 #define PSMP_STA_INFO_MULTICAST 1
2791 #define PSMP_STA_INFO_INDIVIDUALLY_ADDRESSED 2
2792
2793 #define PSMP_STA_INFO_FLAG_TYPE         0x00000003
2794 #define PSMP_STA_INFO_FLAG_DTT_START    0x00001FFC
2795 #define PSMP_STA_INFO_FLAG_DTT_DURATION 0x001FE000
2796
2797 #define PSMP_STA_INFO_FLAG_STA_ID       0x001FFFE0
2798
2799 #define PSMP_STA_INFO_FLAG_UTT_START    0x0000FFE0
2800 #define PSMP_STA_INFO_FLAG_UTT_DURATION 0x03FF0000
2801
2802 #define PSMP_STA_INFO_FLAG_IA_RESERVED  0xFC000000
2803
2804 static const value_string ff_psmp_sta_info_flags[] = {
2805   { PSMP_STA_INFO_BROADCAST, "Broadcast"},
2806   { PSMP_STA_INFO_MULTICAST, "Multicast"},
2807   { PSMP_STA_INFO_INDIVIDUALLY_ADDRESSED, "Individually Addressed"},
2808   {0, NULL}
2809 };
2810
2811 static void
2812 beacon_interval_base_custom(gchar *result, guint32 beacon_interval)
2813 {
2814    double temp_double;
2815    temp_double = (double)beacon_interval;
2816    g_snprintf(result, ITEM_LABEL_LENGTH, "%f [Seconds]", (temp_double * 1024 / 1000000) );
2817 }
2818
2819 /* ************************************************************************* */
2820 /*            Return the length of the current header (in bytes)             */
2821 /* ************************************************************************* */
2822 static int
2823 find_header_length (guint16 fcf, guint16 ctrl_fcf, gboolean is_ht)
2824 {
2825   int len;
2826   guint16 cw_fcf;
2827
2828   switch (FCF_FRAME_TYPE (fcf)) {
2829
2830   case MGT_FRAME:
2831     if (is_ht && IS_STRICTLY_ORDERED(FCF_FLAGS(fcf)))
2832       return MGT_FRAME_HDR_LEN + 4;
2833
2834     return MGT_FRAME_HDR_LEN;
2835
2836   case CONTROL_FRAME:
2837     if (COMPOSE_FRAME_TYPE(fcf) == CTRL_CONTROL_WRAPPER) {
2838       len = 6;
2839       cw_fcf = ctrl_fcf;
2840     } else {
2841       len = 0;
2842       cw_fcf = fcf;
2843     }
2844     switch (COMPOSE_FRAME_TYPE (cw_fcf)) {
2845
2846     case CTRL_CTS:
2847     case CTRL_ACKNOWLEDGEMENT:
2848       return len + 10;
2849
2850     case CTRL_RTS:
2851     case CTRL_PS_POLL:
2852     case CTRL_CFP_END:
2853     case CTRL_CFP_ENDACK:
2854     case CTRL_BLOCK_ACK_REQ:
2855     case CTRL_BLOCK_ACK:
2856       return len + 16;
2857     }
2858     return len + 4;  /* XXX */
2859
2860   case DATA_FRAME:
2861     len = (FCF_ADDR_SELECTOR(fcf) ==
2862       DATA_ADDR_T4) ? DATA_LONG_HDR_LEN : DATA_SHORT_HDR_LEN;
2863
2864     if (DATA_FRAME_IS_QOS(COMPOSE_FRAME_TYPE(fcf))) {
2865       len += 2;
2866       if (is_ht && IS_STRICTLY_ORDERED(FCF_FLAGS(fcf))) {
2867         len += 4;
2868       }
2869     }
2870
2871     return len;
2872
2873   default:
2874     return 4;  /* XXX */
2875   }
2876 }
2877
2878 /* ************************************************************************* */
2879 /* Mesh Control field helper functions
2880  *
2881  * Per IEEE 802.11s Draft 12.0 section 7.2.2.1:
2882  *
2883  * The frame body consists of either:
2884  * The MSDU (or a fragment thereof), the Mesh Control field (if and only if the
2885  * frame is transmitted by a mesh STA and the Mesh Control Present subfield of
2886  * the QoS Control field is 1)...
2887  *
2888  * We need a stateful sniffer for that.  For now, use heuristics.
2889  *
2890  * Notably, only mesh data frames contain the Mesh Control field in the header.
2891  * Other frames that contain mesh control (i.e., multihop action frames) have
2892  * it deeper in the frame body where it can be definitively identified.
2893  * Further, mesh data frames always have to-ds and from-ds either 11 or 01.  We
2894  * use these facts to make our heuristics more reliable.
2895  * ************************************************************************* */
2896 static int
2897 has_mesh_control(guint16 fcf, guint16 qos_ctl, guint8 mesh_flags)
2898 {
2899   /* assume mesh control present if the QOS field's Mesh Control Present bit is
2900    * set, all reserved bits in the mesh_flags field are zero, and the address
2901    * extension mode is not a reserved value.
2902    */
2903   return ((FCF_ADDR_SELECTOR(fcf) == DATA_ADDR_T4 || FCF_ADDR_SELECTOR(fcf) == DATA_ADDR_T2) &&
2904           (QOS_MESH_CONTROL_PRESENT(qos_ctl)) &&
2905           (mesh_flags & ~MESH_FLAGS_ADDRESS_EXTENSION) == 0 &&
2906           (mesh_flags & MESH_FLAGS_ADDRESS_EXTENSION) != MESH_FLAGS_ADDRESS_EXTENSION);
2907 }
2908
2909 static int
2910 find_mesh_control_length(guint8 mesh_flags)
2911 {
2912   return 6 + 6*(mesh_flags & MESH_FLAGS_ADDRESS_EXTENSION);
2913 }
2914
2915 mimo_control_t get_mimo_control (tvbuff_t *tvb, int offset)
2916 {
2917   guint16 mimo;
2918   mimo_control_t output;
2919
2920   mimo = tvb_get_letohs (tvb, offset);
2921
2922   output.nc = (mimo & 0x0003) + 1;
2923   output.nr = ((mimo & 0x000C) >> 2) + 1;
2924   output.chan_width = (mimo & 0x0010) >> 4;
2925   output.coefficient_size = 4; /* XXX - Is this a good default? */
2926
2927   switch ((mimo & 0x0060) >> 5)
2928     {
2929       case 0:
2930         output.grouping = 1;
2931         break;
2932
2933       case 1:
2934         output.grouping = 2;
2935         break;
2936
2937       case 2:
2938         output.grouping = 4;
2939         break;
2940
2941       default:
2942         output.grouping = 1;
2943         break;
2944     }
2945
2946   switch ((mimo & 0x0180) >> 7)
2947     {
2948       case 0:
2949         output.coefficient_size = 4;
2950         break;
2951
2952       case 1:
2953         output.coefficient_size = 5;
2954         break;
2955
2956       case 2:
2957         output.coefficient_size = 6;
2958         break;
2959
2960       case 3:
2961         output.coefficient_size = 8;
2962         break;
2963     }
2964
2965   output.codebook_info = (mimo & 0x0600) >> 9;
2966   output.remaining_matrix_segment = (mimo & 0x3800) >> 11;
2967
2968   return output;
2969 }
2970
2971 int get_mimo_na (guint8 nr, guint8 nc)
2972 {
2973   if (nr == 2 && nc == 1){
2974     return 2;
2975   }else if (nr == 2 && nc == 2){
2976     return 2;
2977   }else if (nr == 3 && nc == 1){
2978     return 4;
2979   }else if (nr == 3 && nc == 2){
2980     return 6;
2981   }else if (nr == 3 && nc == 3){
2982     return 6;
2983   }else if (nr == 4 && nc == 1){
2984     return 6;
2985   }else if (nr == 4 && nc == 2){
2986     return 10;
2987   }else if (nr == 4 && nc == 3){
2988     return 12;
2989   }else if (nr == 4 && nc == 4){
2990     return 12;
2991   }else{
2992     return 0;
2993   }
2994 }
2995
2996 int get_mimo_ns (gboolean chan_width, guint8 output_grouping)
2997 {
2998   int ns = 0;
2999
3000   if (chan_width)
3001   {
3002     switch (output_grouping)
3003       {
3004         case 1:
3005           ns = 114;
3006           break;
3007
3008           case 2:
3009             ns = 58;
3010             break;
3011
3012           case 4:
3013             ns = 30;
3014             break;
3015
3016           default:
3017             ns = 0;
3018       }
3019   } else {
3020     switch (output_grouping)
3021       {
3022         case 1:
3023           ns = 56;
3024           break;
3025
3026         case 2:
3027           ns = 30;
3028           break;
3029
3030         case 4:
3031           ns = 16;
3032           break;
3033
3034         default:
3035           ns = 0;
3036       }
3037   }
3038
3039   return ns;
3040 }
3041
3042 int add_mimo_csi_matrices_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl)
3043 {
3044   proto_item *snr_item;
3045   proto_tree *snr_tree;
3046   int csi_matrix_size, start_offset;
3047   int ns, i;
3048
3049   start_offset = offset;
3050   snr_item = proto_tree_add_text(tree, tvb, offset, mimo_cntrl.nc, "Signal to Noise Ratio");
3051   snr_tree = proto_item_add_subtree (snr_item, ett_mimo_report);
3052
3053   for (i = 1; i <= mimo_cntrl.nr; i++)
3054   {
3055     guint8 snr;
3056
3057     snr = tvb_get_guint8(tvb, offset);
3058     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);
3059     offset++;
3060   }
3061
3062   ns = get_mimo_ns(mimo_cntrl.chan_width, mimo_cntrl.grouping);
3063   csi_matrix_size = ns*(3+(2*mimo_cntrl.nc*mimo_cntrl.nr*mimo_cntrl.coefficient_size));
3064   csi_matrix_size = roundup2(csi_matrix_size, 8) / 8;
3065   proto_tree_add_text(tree, tvb, offset, csi_matrix_size, "CSI Matrices");
3066   offset += csi_matrix_size;
3067   return offset - start_offset;
3068 }
3069
3070 int add_mimo_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl)
3071 {
3072   proto_item *snr_item;
3073   proto_tree *snr_tree;
3074   int csi_matrix_size, start_offset;
3075   int ns, i;
3076
3077   start_offset = offset;
3078   snr_item = proto_tree_add_text(tree, tvb, offset, mimo_cntrl.nc, "Signal to Noise Ratio");
3079   snr_tree = proto_item_add_subtree (snr_item, ett_mimo_report);
3080
3081   for (i = 1; i <= mimo_cntrl.nc; i++)
3082   {
3083     guint8 snr;
3084
3085     snr = tvb_get_guint8(tvb, offset);
3086     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);
3087     offset++;
3088   }
3089
3090   ns = get_mimo_ns(mimo_cntrl.chan_width, mimo_cntrl.grouping);
3091   csi_matrix_size = ns*(2*mimo_cntrl.nc*mimo_cntrl.nr*mimo_cntrl.coefficient_size);
3092   csi_matrix_size = roundup2(csi_matrix_size, 8) / 8;
3093   proto_tree_add_text(tree, tvb, offset, csi_matrix_size, "Beamforming Feedback Matrices");
3094   offset += csi_matrix_size;
3095   return offset - start_offset;
3096 }
3097
3098 int add_mimo_compressed_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl)
3099 {
3100   proto_item *snr_item;
3101   proto_tree *snr_tree;
3102   int csi_matrix_size, start_offset;
3103   int ns, na, i;
3104
3105   start_offset = offset;
3106   snr_item = proto_tree_add_text(tree, tvb, offset, mimo_cntrl.nc, "Signal to Noise Ratio");
3107   snr_tree = proto_item_add_subtree (snr_item, ett_mimo_report);
3108
3109   for (i = 1; i <= mimo_cntrl.nc; i++)
3110   {
3111     guint8 snr;
3112
3113     snr = tvb_get_guint8(tvb, offset);
3114     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);
3115     offset++;
3116   }
3117
3118   na = get_mimo_na(mimo_cntrl.nr, mimo_cntrl.nc);
3119   ns = get_mimo_ns(mimo_cntrl.chan_width, mimo_cntrl.grouping);
3120   csi_matrix_size = ns*(na*((mimo_cntrl.codebook_info+1)*2 + 2)/2);
3121   csi_matrix_size = roundup2(csi_matrix_size, 8) / 8;
3122   proto_tree_add_text(tree, tvb, offset, csi_matrix_size, "Compressed Beamforming Feedback Matrices");
3123   offset += csi_matrix_size;
3124   return offset - start_offset;
3125 }
3126
3127 /* ************************************************************************* */
3128 /*          This is the capture function used to update packet counts        */
3129 /* ************************************************************************* */
3130 static void
3131 capture_ieee80211_common (const guchar * pd, int offset, int len,
3132         packet_counts * ld, gboolean fixed_length_header,
3133         gboolean datapad, gboolean is_ht)
3134 {
3135   guint16 fcf, hdr_length;
3136
3137   if (!BYTES_ARE_IN_FRAME(offset, len, 2)) {
3138     ld->other++;
3139     return;
3140   }
3141
3142   fcf = pletohs (&pd[offset]);
3143
3144   if (IS_PROTECTED(FCF_FLAGS(fcf)) && wlan_ignore_wep == WLAN_IGNORE_WEP_NO) {
3145     ld->other++;
3146     return;
3147   }
3148
3149   switch (COMPOSE_FRAME_TYPE (fcf)) {
3150
3151     case DATA:          /* We got a data frame */
3152     case DATA_CF_ACK:   /* Data with ACK */
3153     case DATA_CF_POLL:
3154     case DATA_CF_ACK_POLL:
3155     case DATA_QOS_DATA:
3156     {
3157       if (fixed_length_header) {
3158         hdr_length = DATA_LONG_HDR_LEN;
3159       } else {
3160         hdr_length = find_header_length (fcf, 0, is_ht);
3161         /* adjust the header length depending on the Mesh Control field */
3162         if (FCF_FRAME_TYPE(fcf) == DATA_FRAME &&
3163             DATA_FRAME_IS_QOS(COMPOSE_FRAME_TYPE(fcf))) {
3164
3165           guint8 mesh_flags = pd[hdr_length];
3166           guint16 qosoff = hdr_length - 2;
3167           qosoff -= is_ht ? 4 : 0;
3168           if (has_mesh_control(fcf, pletohs(&pd[qosoff]), mesh_flags)) {
3169             hdr_length += find_mesh_control_length(mesh_flags);
3170           }
3171         }
3172         if (datapad)
3173           hdr_length = roundup2(hdr_length, 4);
3174       }
3175       /* I guess some bridges take Netware Ethernet_802_3 frames,
3176          which are 802.3 frames (with a length field rather than
3177          a type field, but with no 802.2 header in the payload),
3178          and just stick the payload into an 802.11 frame.  I've seen
3179          captures that show frames of that sort.
3180
3181          We also handle some odd form of encapsulation in which a
3182          complete Ethernet frame is encapsulated within an 802.11
3183          data frame, with no 802.2 header.  This has been seen
3184          from some hardware.
3185
3186          On top of that, at least at some point it appeared that
3187          the OLPC XO sent out frames with two bytes of 0 between
3188          the "end" of the 802.11 header and the beginning of
3189          the payload.
3190
3191          So, if the packet doesn't start with 0xaa 0xaa:
3192
3193            we first use the same scheme that linux-wlan-ng does to detect
3194            those encapsulated Ethernet frames, namely looking to see whether
3195            the frame either starts with 6 octets that match the destination
3196            address from the 802.11 header or has 6 octets that match the
3197            source address from the 802.11 header following the first 6 octets,
3198            and, if so, treat it as an encapsulated Ethernet frame;
3199
3200            otherwise, we use the same scheme that we use in the Ethernet
3201            dissector to recognize Netware 802.3 frames, namely checking
3202            whether the packet starts with 0xff 0xff and, if so, treat it
3203            as an encapsulated IPX frame, and then check whether the
3204            packet starts with 0x00 0x00 and, if so, treat it as an OLPC
3205            frame. */
3206       if (!BYTES_ARE_IN_FRAME(offset+hdr_length, len, 2)) {
3207         ld->other++;
3208         return;
3209       }
3210       if (pd[offset+hdr_length] != 0xaa && pd[offset+hdr_length+1] != 0xaa) {
3211 #if 0
3212         /* XXX - this requires us to parse the header to find the source
3213            and destination addresses. */
3214         if (BYTES_ARE_IN_FRAME(offset+hdr_length, len, 12) {
3215           /* We have two MAC addresses after the header. */
3216           if (memcmp(&pd[offset+hdr_length+6], pinfo->dl_src.data, 6) == 0 ||
3217               memcmp(&pd[offset+hdr_length+6], pinfo->dl_dst.data, 6) == 0) {
3218             capture_eth (pd, offset + hdr_length, len, ld);
3219             return;
3220           }
3221         }
3222 #endif
3223         if (pd[offset+hdr_length] == 0xff && pd[offset+hdr_length+1] == 0xff)
3224           capture_ipx (ld);
3225         else if (pd[offset+hdr_length] == 0x00 && pd[offset+hdr_length+1] == 0x00)
3226           capture_llc (pd, offset + hdr_length + 2, len, ld);
3227       }
3228       else {
3229         capture_llc (pd, offset + hdr_length, len, ld);
3230       }
3231       break;
3232     }
3233
3234     default:
3235       ld->other++;
3236       break;
3237   }
3238 }
3239
3240 /*
3241  * Handle 802.11 with a variable-length link-layer header.
3242  */
3243 void
3244 capture_ieee80211 (const guchar * pd, int offset, int len, packet_counts * ld)
3245 {
3246   capture_ieee80211_common (pd, offset, len, ld, FALSE, FALSE, FALSE);
3247 }
3248
3249 /*
3250  * Handle 802.11 with a variable-length link-layer header and data padding.
3251  */
3252 void
3253 capture_ieee80211_datapad (const guchar * pd, int offset, int len,
3254                            packet_counts * ld)
3255 {
3256   capture_ieee80211_common (pd, offset, len, ld, FALSE, TRUE, FALSE);
3257 }
3258
3259 /*
3260  * Handle 802.11 with a fixed-length link-layer header (padded to the
3261  * maximum length).
3262  */
3263 void
3264 capture_ieee80211_fixed (const guchar * pd, int offset, int len, packet_counts * ld)
3265 {
3266   capture_ieee80211_common (pd, offset, len, ld, TRUE, FALSE, FALSE);
3267 }
3268
3269 /*
3270  * Handle an HT 802.11 with a variable-length link-layer header.
3271  */
3272 void
3273 capture_ieee80211_ht (const guchar * pd, int offset, int len, packet_counts * ld)
3274 {
3275   capture_ieee80211_common (pd, offset, len, ld, FALSE, FALSE, TRUE);
3276 }
3277
3278
3279 /* ************************************************************************* */
3280 /*          Add the subtree used to store the fixed parameters               */
3281 /* ************************************************************************* */
3282 static proto_tree *
3283 get_fixed_parameter_tree (proto_tree * tree, tvbuff_t *tvb, int start, int size)
3284 {
3285   proto_item *fixed_fields;
3286   fixed_fields =
3287     proto_tree_add_uint_format (tree, hf_ieee80211_fixed_parameters, tvb, start,
3288         size, size, "Fixed parameters (%d bytes)",
3289         size);
3290
3291   return proto_item_add_subtree (fixed_fields, ett_fixed_parameters);
3292 }
3293
3294
3295 /* ************************************************************************* */
3296 /*            Add the subtree used to store tagged parameters                */
3297 /* ************************************************************************* */
3298 static proto_tree *
3299 get_tagged_parameter_tree (proto_tree * tree, tvbuff_t *tvb, int start, int size)
3300 {
3301   proto_item *tagged_fields;
3302
3303   tagged_fields = proto_tree_add_uint_format (tree, hf_ieee80211_tagged_parameters,
3304     tvb,
3305     start,
3306     2,
3307     size,
3308     "Tagged parameters (%d bytes)",
3309     size);
3310   proto_item_set_len(tagged_fields, size);
3311
3312   return proto_item_add_subtree (tagged_fields, ett_tagged_parameters);
3313 }
3314
3315
3316 static int
3317 dissect_vendor_action_marvell(proto_tree *tree, tvbuff_t *tvb, int offset)
3318 {
3319   guint8 octet;
3320
3321   octet = tvb_get_guint8(tvb, offset);
3322   proto_tree_add_item (tree, hf_ieee80211_ff_marvell_action_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3323   offset++;
3324   switch (octet)
3325     {
3326       case MRVL_ACTION_MESH_MANAGEMENT:
3327         octet = tvb_get_guint8(tvb, offset);
3328         proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_action_code, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3329         offset++;
3330         switch (octet)
3331           {
3332             case MRVL_MESH_MGMT_ACTION_RREQ:
3333               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3334               offset++;
3335               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3336               offset++;
3337               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_hopcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3338               offset++;
3339               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_ttl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3340               offset++;
3341               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_rreqid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3342               offset+= 4;
3343               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_sa, tvb, offset, 6, ENC_NA);
3344               offset+= 6;
3345               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_ssn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3346               offset+= 4;
3347               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_lifetime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3348               offset+= 4;
3349               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3350               offset+= 4;
3351               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dstcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3352               offset++;
3353               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3354               offset++;
3355               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_da, tvb, offset, 6, ENC_NA);
3356               offset+= 6;
3357               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dsn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3358               offset+= 4;
3359               break;
3360             case MRVL_MESH_MGMT_ACTION_RREP:
3361               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3362               offset++;
3363               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3364               offset++;
3365               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_hopcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3366               offset++;
3367               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_ttl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3368               offset++;
3369               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_da, tvb, offset, 6, ENC_NA);
3370               offset+= 6;
3371               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dsn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3372               offset+= 4;
3373               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_lifetime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3374               offset+= 4;
3375               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3376               offset+= 4;
3377               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_sa, tvb, offset, 6, ENC_NA);
3378               offset+= 6;
3379               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_ssn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3380               offset+= 4;
3381               break;
3382             case MRVL_MESH_MGMT_ACTION_RERR:
3383               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3384               offset++;
3385               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3386               offset++;
3387               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dstcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3388               offset++;
3389               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_da, tvb, offset, 6, ENC_NA);
3390               offset+= 6;
3391               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dsn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3392               offset+= 4;
3393               break;
3394             default:
3395               break;
3396           }
3397         break;
3398       default:
3399         break;
3400     }
3401
3402   return offset;
3403 }
3404
3405 static guint
3406 dissect_advertisement_protocol(packet_info *pinfo, proto_tree *tree,
3407                                tvbuff_t *tvb, int offset, gboolean *anqp)
3408 {
3409   guint8 tag_no, tag_len, left;
3410   proto_item *item = NULL, *adv_item;
3411   proto_tree *adv_tree, *adv_tuple_tree;
3412
3413   if (anqp)
3414     *anqp = FALSE;
3415   tag_no = tvb_get_guint8(tvb, offset);
3416   if (anqp)
3417     item = proto_tree_add_item(tree, hf_ieee80211_tag_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3418
3419   tag_len = tvb_get_guint8(tvb, offset + 1);
3420   if (tag_no != TAG_ADVERTISEMENT_PROTOCOL) {
3421     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3422                            "Unexpected IE %d (expected Advertisement "
3423                            "Protocol)", tag_no);
3424     return 2 + tag_len;
3425   }
3426   if (anqp)
3427     item = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, 1, tag_len);
3428   if (tag_len < 2) {
3429     if (!anqp)
3430       item = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, 1, tag_len);
3431     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3432                            "Advertisement Protocol: IE must be at least 2 "
3433                            "octets long");
3434     return 2 + tag_len;
3435   }
3436
3437   left = tag_len;
3438   offset += 2;
3439   adv_item = proto_tree_add_text(tree, tvb, offset, left,
3440                                  "Advertisement Protocol element");
3441   adv_tree = proto_item_add_subtree(adv_item, ett_adv_proto);
3442
3443   while (left >= 2) {
3444     guint8 id;
3445
3446     id = tvb_get_guint8(tvb, offset + 1);
3447     if (id == 0)
3448       proto_item_append_text(adv_item, ": ANQP");
3449     item = proto_tree_add_text(adv_tree, tvb, offset, 2,
3450                                "Advertisement Protocol Tuple: %s",
3451                                val_to_str(id, adv_proto_id_vals,
3452                                           "Unknown (%d)"));
3453     adv_tuple_tree = proto_item_add_subtree(item, ett_adv_proto_tuple);
3454
3455     proto_tree_add_item(adv_tuple_tree,
3456                         hf_ieee80211_tag_adv_proto_resp_len_limit, tvb,
3457                         offset, 1, ENC_BIG_ENDIAN);
3458     proto_tree_add_item(adv_tuple_tree,
3459                         hf_ieee80211_tag_adv_proto_pame_bi, tvb,
3460                         offset, 1, ENC_BIG_ENDIAN);
3461     offset++;
3462     left--;
3463     proto_tree_add_item(adv_tuple_tree, hf_ieee80211_tag_adv_proto_id, tvb,
3464                         offset, 1, ENC_BIG_ENDIAN);
3465     offset++;
3466     left--;
3467
3468     if (id == 0 && anqp)
3469       *anqp = TRUE;
3470
3471     if (id == 221) {
3472       /* Vendor specific */
3473       guint8 len = tvb_get_guint8(tvb, offset);
3474       offset++;
3475       left--;
3476       if (len > left) {
3477         expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3478                                "Vendor specific info length error");
3479         return 2 + tag_len;
3480       }
3481       proto_tree_add_text(adv_tuple_tree, tvb, offset, len,
3482                           "Vendor Specific Advertisement Protocol info");
3483       offset += len;
3484       left -= len;
3485     }
3486   }
3487
3488   if (left) {
3489     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3490                            "Unexpected extra data in the end");
3491   }
3492
3493   return 2 + tag_len;
3494 }
3495
3496 static void
3497 dissect_anqp_query_list(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3498 {
3499     while (offset + 2 <= end) {
3500       proto_tree_add_item(tree, hf_ieee80211_ff_anqp_query_id,
3501                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
3502       offset += 2;
3503     }
3504     if (offset != end) {
3505       expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3506                              "Unexpected ANQP Query list format");
3507     }
3508 }
3509
3510 static void
3511 dissect_anqp_capab_list(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3512 {
3513   guint16 id, len;
3514   proto_item *item;
3515   proto_tree *vtree;
3516   guint32 oui;
3517
3518   while (offset + 2 <= end) {
3519     id = tvb_get_letohs(tvb, offset);
3520     item = proto_tree_add_item(tree, hf_ieee80211_ff_anqp_capability,
3521                                tvb, offset, 2, ENC_LITTLE_ENDIAN);
3522     offset += 2;
3523     if (id == ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST) {
3524       vtree = proto_item_add_subtree(item, ett_anqp_vendor_capab);
3525       len = tvb_get_letohs(tvb, offset);
3526       proto_tree_add_item(vtree, hf_ieee80211_ff_anqp_capability_vlen,
3527                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
3528       offset += 2;
3529       if (len < 3 || offset + len > end) {
3530         expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3531                                "Invalid vendor-specific ANQP capability");
3532         return;
3533       }
3534       oui = tvb_get_ntoh24(tvb, offset);
3535       proto_tree_add_item(vtree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
3536       offset += 3;
3537       len -= 3;
3538
3539       switch (oui) {
3540       default:
3541         proto_tree_add_item(vtree, hf_ieee80211_ff_anqp_capability_vendor,
3542                             tvb, offset, len, ENC_NA);
3543         break;
3544       }
3545
3546       offset += len;
3547     }
3548   }
3549   if (offset != end) {
3550     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3551                            "Unexpected ANQP Capability list format");
3552   }
3553 }
3554
3555 static const value_string venue_group_vals[] = {
3556   { 0, "Unspecified" },
3557   { 1, "Assembly" },
3558   { 2, "Business" },
3559   { 3, "Educational" },
3560   { 4, "Factory and Industrial" },
3561   { 5, "Institutional" },
3562   { 6, "Mercantile" },
3563   { 7, "Residential" },
3564   { 8, "Storage" },
3565   { 9, "Utility and Miscellaneous" },
3566   { 10, "Vehicular" },
3567   { 11, "Outdoor" },
3568   { 0, NULL }
3569 };
3570
3571 static void dissect_venue_info(proto_tree *tree, tvbuff_t *tvb, int offset)
3572 {
3573   proto_tree_add_item(tree, hf_ieee80211_ff_venue_info_group,
3574                       tvb, offset, 1, ENC_BIG_ENDIAN);
3575   proto_tree_add_item(tree, hf_ieee80211_ff_venue_info_type,
3576                       tvb, offset + 1, 1, ENC_BIG_ENDIAN);
3577 }
3578
3579 static void
3580 dissect_venue_name_info(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3581 {
3582   proto_item *item;
3583
3584   dissect_venue_info(tree, tvb, offset);
3585   offset += 2;
3586   while (offset + 4 <= end) {
3587     guint8 vlen = tvb_get_guint8(tvb, offset);
3588     item = proto_tree_add_item(tree, hf_ieee80211_ff_anqp_venue_length,
3589                                tvb, offset, 1, ENC_BIG_ENDIAN);
3590     offset++;
3591     if (vlen > end - offset || vlen < 3) {
3592       expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3593                              "Invalid Venue Name Duple length");
3594       break;
3595     }
3596     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_venue_language,
3597                         tvb, offset, 3, ENC_ASCII|ENC_NA);
3598     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_venue_name,
3599                         tvb, offset + 3, vlen - 3, ENC_ASCII|ENC_NA);
3600     offset += vlen;
3601   }
3602 }
3603
3604 static const value_string nw_auth_type_vals[] = {
3605   { 0, "Acceptance of terms and conditions" },
3606   { 1, "On-line enrollment supported" },
3607   { 2, "http/https redirection" },
3608   { 3, "DNS redirection" },
3609   { 0, NULL }
3610 };
3611
3612 static void
3613 dissect_network_auth_type(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3614 {
3615   while (offset + 3 <= end) {
3616     guint16 len;
3617     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_nw_auth_type_indicator,
3618                         tvb, offset, 1, ENC_BIG_ENDIAN);
3619     offset++;
3620     len = tvb_get_letohs(tvb, offset);
3621     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_nw_auth_type_url_len,
3622                         tvb, offset, 2, ENC_LITTLE_ENDIAN);
3623     offset += 2;
3624     if (len)
3625       proto_tree_add_item(tree, hf_ieee80211_ff_anqp_nw_auth_type_url,
3626                           tvb, offset, len, ENC_ASCII|ENC_NA);
3627     offset += len;
3628   }
3629 }
3630
3631 static void add_manuf(proto_item *item, tvbuff_t *tvb, int offset)
3632 {
3633   const gchar *manuf_name;
3634   manuf_name = tvb_get_manuf_name_if_known(tvb, offset);
3635   if (manuf_name == NULL)
3636     return;
3637   proto_item_append_text(item, " - %s", manuf_name);
3638 }
3639
3640 static void
3641 dissect_roaming_consortium_list(proto_tree *tree, tvbuff_t *tvb, int offset,
3642                                 int end)
3643 {
3644   proto_item *item;
3645   guint8 len;
3646
3647   while (offset < end) {
3648     len = tvb_get_guint8(tvb, offset);
3649     item = proto_tree_add_item(tree,
3650                                hf_ieee80211_ff_anqp_roaming_consortium_oi_len,
3651                                tvb, offset, 1, ENC_BIG_ENDIAN);
3652     offset++;
3653     if (len > end - offset || len < 3) {
3654       expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3655                              "Invalid Roaming Consortium OI");
3656       break;
3657     }
3658     item = proto_tree_add_item(tree,
3659                                hf_ieee80211_ff_anqp_roaming_consortium_oi,
3660                                tvb, offset, len, ENC_NA);
3661     add_manuf(item, tvb, offset);
3662     offset += len;
3663   }
3664 }
3665
3666 static const value_string ip_addr_avail_ipv6_vals[] = {
3667   { 0, "Address type not available" },
3668   { 1, "Address type available" },
3669   { 2, "Availability of the address type not known" },
3670   { 0, NULL }
3671 };
3672
3673 static const value_string ip_addr_avail_ipv4_vals[] = {
3674   { 0, "Address type not available" },
3675   { 1, "Public IPv4 address available" },
3676   { 2, "Port-restricted IPv4 address available" },
3677   { 3, "Single NATed private IPv4 address available" },
3678   { 4, "Double NATed private IPv4 address available" },
3679   { 5, "Port-restricted IPv4 address and single NATed IPv4 address available" },
3680   { 6, "Port-restricted IPv4 address and double NATed IPv4 address available" },
3681   { 7, "Availability of the address type is not known" },
3682   { 0, NULL }
3683 };
3684
3685 static void
3686 dissect_ip_addr_type_availability_info(proto_tree *tree, tvbuff_t *tvb,
3687                                        int offset)
3688 {
3689   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_ip_addr_avail_ipv6,
3690                       tvb, offset, 1, ENC_BIG_ENDIAN);
3691   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_ip_addr_avail_ipv4,
3692                       tvb, offset, 1, ENC_BIG_ENDIAN);
3693 }
3694
3695 static const value_string nai_realm_encoding_vals[] = {
3696   { 0, "Formatted in accordance with RFC 4282" },
3697   { 1, "UTF-8 formatted that is not formatted in accordance with RFC 4282" },
3698   { 0, NULL }
3699 };
3700
3701 static const value_string nai_realm_auth_param_id_vals[] = {
3702   { 1, "Expanded EAP Method" },
3703   { 2, "Non-EAP Inner Authentication Type" },
3704   { 3, "Inner Authentication EAP Method Type" },
3705   { 4, "Expanded Inner EAP Method" },
3706   { 5, "Credential Type" },
3707   { 6, "Tunneled EAP Method Credential Type" },
3708   { 221, "Vendor Specific" },
3709   { 0, NULL }
3710 };
3711
3712 static void
3713 dissect_nai_realm_list(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3714 {
3715   guint16 count, len;
3716   proto_item *item, *r_item;
3717   int f_end, eap_end;
3718   guint8 nai_len, eap_count, eap_len, auth_param_count, auth_param_len;
3719   guint8 auth_param_id;
3720   proto_tree *realm_tree, *eap_tree;
3721   guint8 *realm;
3722
3723   count = tvb_get_letohs(tvb, offset);
3724   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_nai_realm_count,
3725                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
3726   offset += 2;
3727   while (count > 0) {
3728     len = tvb_get_letohs(tvb, offset);
3729     r_item = proto_tree_add_text(tree, tvb, offset, 2 + len, "NAI Realm Data");
3730     realm_tree = proto_item_add_subtree(r_item, ett_nai_realm);
3731
3732     item = proto_tree_add_item(realm_tree, hf_ieee80211_ff_anqp_nai_field_len,
3733                                tvb, offset, 2, ENC_LITTLE_ENDIAN);
3734     offset += 2;
3735     if (offset + len > end) {
3736       expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3737                              "Invalid NAI Realm List");
3738       break;
3739     }
3740     f_end = offset + len;
3741     proto_tree_add_item(realm_tree, hf_ieee80211_ff_anqp_nai_realm_encoding,
3742                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
3743     offset++;
3744     nai_len = tvb_get_guint8(tvb, offset);
3745     item = proto_tree_add_item(realm_tree,
3746                                hf_ieee80211_ff_anqp_nai_realm_length,
3747                                tvb, offset, 1, ENC_LITTLE_ENDIAN);
3748     offset++;
3749     if (offset + nai_len > f_end) {
3750       expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3751                              "Invalid NAI Realm Data");
3752       break;
3753     }
3754     proto_tree_add_item(realm_tree, hf_ieee80211_ff_anqp_nai_realm,
3755                         tvb, offset, nai_len, ENC_ASCII|ENC_NA);
3756     realm = tvb_get_string(tvb, offset, nai_len);
3757     if (realm) {
3758       proto_item_append_text(r_item, " (%s)", realm);
3759       g_free(realm);
3760     }
3761     offset += nai_len;
3762     eap_count = tvb_get_guint8(tvb, offset);
3763     proto_tree_add_item(realm_tree, hf_ieee80211_ff_anqp_nai_realm_eap_count,
3764                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
3765     offset++;
3766
3767     while (eap_count > 0) {
3768       eap_len = tvb_get_guint8(tvb, offset);
3769       eap_end = offset + 1 + eap_len;
3770       item = proto_tree_add_text(realm_tree, tvb, offset, 1 + eap_len,
3771                                  "EAP Method");
3772       eap_tree = proto_item_add_subtree(item, ett_nai_realm_eap);
3773
3774       item = proto_tree_add_item(eap_tree,
3775                                  hf_ieee80211_ff_anqp_nai_realm_eap_len,
3776                                  tvb, offset, 1, ENC_LITTLE_ENDIAN);
3777       offset++;
3778       if (offset + eap_len > f_end) {
3779         expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3780                                "Invalid EAP Method subfield");
3781         break;
3782       }
3783
3784       proto_item_append_text(eap_tree, ": %s",
3785                              val_to_str(tvb_get_guint8(tvb, offset),
3786                                         eap_type_vals, "Unknown (%d)"));
3787       proto_tree_add_item(eap_tree, hf_ieee80211_ff_anqp_nai_realm_eap_method,
3788                           tvb, offset, 1, ENC_LITTLE_ENDIAN);
3789       offset++;
3790       auth_param_count = tvb_get_guint8(tvb, offset);
3791       proto_tree_add_item(eap_tree,
3792                           hf_ieee80211_ff_anqp_nai_realm_auth_param_count,
3793                           tvb, offset, 1, ENC_LITTLE_ENDIAN);
3794       offset++;
3795
3796       while (auth_param_count > 0) {
3797         auth_param_id = tvb_get_guint8(tvb, offset);
3798         proto_tree_add_item(eap_tree,
3799                             hf_ieee80211_ff_anqp_nai_realm_auth_param_id,
3800                             tvb, offset, 1, ENC_LITTLE_ENDIAN);
3801         offset++;
3802         auth_param_len = tvb_get_guint8(tvb, offset);
3803         proto_tree_add_item(eap_tree,
3804                             hf_ieee80211_ff_anqp_nai_realm_auth_param_len,
3805                             tvb, offset, 1, ENC_LITTLE_ENDIAN);
3806         offset++;
3807         item = proto_tree_add_item(
3808           eap_tree, hf_ieee80211_ff_anqp_nai_realm_auth_param_value,
3809           tvb, offset, auth_param_len, ENC_NA);
3810         if (auth_param_id == 3 && auth_param_len == 1) {
3811           guint8 inner_method = tvb_get_guint8(tvb, offset);
3812           const char *str;
3813           str = val_to_str(inner_method, eap_type_vals, "Unknown (%d)");
3814
3815           proto_item_append_text(eap_tree, " / %s", str);
3816           proto_item_append_text(item, " - %s", str);
3817         }
3818         offset += auth_param_len;
3819
3820         auth_param_count--;
3821       }
3822
3823       offset = eap_end;
3824       eap_count--;
3825     }
3826
3827     offset = f_end;
3828     count--;
3829   }
3830 }
3831
3832 static void
3833 dissect_3gpp_cellular_network_info(proto_tree *tree, tvbuff_t *tvb, int offset)
3834 {
3835   guint8 iei, num;
3836   proto_item *item;
3837
3838   /* See Annex A of 3GPP TS 24.234 v8.1.0 for description */
3839   proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_gud, tvb, offset, 1, ENC_BIG_ENDIAN);
3840   offset++;
3841   proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_udhl, tvb, offset, 1, ENC_BIG_ENDIAN);
3842   offset++;
3843   iei = tvb_get_guint8(tvb, offset);
3844   item = proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_iei, tvb, offset, 1, ENC_BIG_ENDIAN);
3845   if (iei == 0)
3846     proto_item_append_text(item, " (PLMN List)");
3847   else
3848     return;
3849   offset++;
3850   proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_plmn_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3851   offset++;
3852   num = tvb_get_guint8(tvb, offset);
3853   proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_num_plmns, tvb, offset, 1, ENC_BIG_ENDIAN);
3854   offset++;
3855   while (num > 0) {
3856     guint8 o1, o2, o3;
3857     if (tvb_reported_length_remaining(tvb, offset) < 3)
3858       break;
3859     num--;
3860     o1 = tvb_get_guint8(tvb, offset);
3861     o2 = tvb_get_guint8(tvb, offset + 1);
3862     o3 = tvb_get_guint8(tvb, offset + 2);
3863     proto_tree_add_string_format_value(tree, hf_ieee80211_3gpp_gc_plmn, tvb, offset, 3,
3864                                        "", "MCC %d%d%d MNC %d%d%c",
3865                                        o1 & 0x0f, (o1 & 0xf0) >> 4, o2 & 0x0f,
3866                                        o3 & 0x0f, (o3 & 0xf0) >> 4,
3867                                        ((o2 & 0xf0) == 0xf0) ? ' ' :
3868                                        ('0' + ((o2 & 0xf0) >> 4)));
3869     offset += 3;
3870   }
3871 }
3872
3873 static void
3874 dissect_domain_name_list(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3875 {
3876   guint8 len;
3877
3878   while (offset < end) {
3879     len = tvb_get_guint8(tvb, offset);
3880     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_domain_name_len,
3881                         tvb, offset, 1, ENC_BIG_ENDIAN);
3882     offset++;
3883     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_domain_name,
3884                         tvb, offset, len, ENC_ASCII|ENC_NA);
3885     offset += len;
3886   }
3887 }
3888
3889 static int
3890 dissect_anqp_info(proto_tree *tree, tvbuff_t *tvb, int offset,
3891                   gboolean request, int idx)
3892 {
3893   guint16 id, len;
3894   guint32 oui;
3895   guint8 subtype;
3896   proto_item *item;
3897
3898   item = proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info_id,
3899                              tvb, offset, 2, ENC_LITTLE_ENDIAN);
3900   id = tvb_get_letohs(tvb, offset);
3901   if (id != ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST) {
3902     if (idx == 0) {
3903       proto_item_append_text(tree, " - %s",
3904                              val_to_str(id, anqp_info_id_vals,
3905                                         "Unknown (%u)"));
3906       col_append_fstr(g_pinfo->cinfo, COL_INFO, " %s",
3907                       val_to_str(id, anqp_info_id_vals, "Unknown (%u)"));
3908     } else if (idx == 1) {
3909       proto_item_append_text(tree, ", ..");
3910       col_append_fstr(g_pinfo->cinfo, COL_INFO, ", ..");
3911     }
3912   }
3913   tree = proto_item_add_subtree(item, ett_gas_anqp);
3914   offset += 2;
3915   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info_length,
3916                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
3917   len = tvb_get_letohs(tvb, offset);
3918   offset += 2;
3919   if (tvb_reported_length_remaining(tvb, offset) < len) {
3920     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3921                            "Invalid ANQP Info length");
3922     return 4 + len;
3923   }
3924   switch (id)
3925   {
3926   case ANQP_INFO_ANQP_QUERY_LIST:
3927     dissect_anqp_query_list(tree, tvb, offset, offset + len);
3928     break;
3929   case ANQP_INFO_ANQP_CAPAB_LIST:
3930     dissect_anqp_capab_list(tree, tvb, offset, offset + len);
3931     break;
3932   case ANQP_INFO_VENUE_NAME_INFO:
3933     dissect_venue_name_info(tree, tvb, offset, offset + len);
3934     break;
3935   case ANQP_INFO_NETWORK_AUTH_TYPE_INFO:
3936     dissect_network_auth_type(tree, tvb, offset, offset + len);
3937     break;
3938   case ANQP_INFO_ROAMING_CONSORTIUM_LIST:
3939     dissect_roaming_consortium_list(tree, tvb, offset, offset + len);
3940     break;
3941   case ANQP_INFO_IP_ADDR_TYPE_AVAILABILITY_INFO:
3942     dissect_ip_addr_type_availability_info(tree, tvb, offset);
3943     break;
3944   case ANQP_INFO_NAI_REALM_LIST:
3945     dissect_nai_realm_list(tree, tvb, offset, offset + len);
3946     break;
3947   case ANQP_INFO_3GPP_CELLULAR_NETWORK_INFO:
3948     dissect_3gpp_cellular_network_info(tree, tvb, offset);
3949     break;
3950   case ANQP_INFO_DOMAIN_NAME_LIST:
3951     dissect_domain_name_list(tree, tvb, offset, offset + len);
3952     break;
3953   case ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST:
3954     oui = tvb_get_ntoh24(tvb, offset);
3955     proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
3956     offset += 3;
3957
3958     switch (oui) {
3959     case OUI_WFA:
3960       subtype = tvb_get_guint8(tvb, offset);
3961       if (subtype == WFA_SUBTYPE_P2P) {
3962         proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u: P2P ANQP",
3963                             subtype);
3964         dissect_wifi_p2p_anqp(g_pinfo, tree, tvb, offset + 1, request);
3965       } else {
3966         proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u", subtype);
3967       }
3968       break;
3969     default:
3970       proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info,
3971                           tvb, offset, len, ENC_NA);
3972       break;
3973     }
3974     break;
3975   default:
3976     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info,
3977                         tvb, offset, len, ENC_NA);
3978     break;
3979   }
3980
3981   return 4 + len;
3982 }
3983
3984 static void
3985 dissect_anqp(proto_tree *tree, tvbuff_t *tvb, int offset, gboolean request)
3986 {
3987   int idx = 0;
3988
3989   proto_item_append_text(tree, ": ANQP ");
3990   proto_item_append_text(tree, request ? "Request" : "Response");
3991   if (tvb_reported_length_remaining(tvb, offset) < 4) {
3992     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3993                            "Not enough room for ANQP header");
3994     return;
3995   }
3996   col_append_fstr(g_pinfo->cinfo, COL_INFO, ", ANQP %s",
3997                   request ? "Req" : "Resp");
3998   while (tvb_reported_length_remaining(tvb, offset) > 0) {
3999     offset += dissect_anqp_info(tree, tvb, offset, request, idx);
4000     idx++;
4001   }
4002 }
4003
4004 static guint
4005 dissect_gas_initial_request(proto_tree *tree, tvbuff_t *tvb, int offset,
4006                             gboolean anqp)
4007 {
4008   guint16 req_len;
4009   int start = offset;
4010   proto_item *item;
4011   proto_tree *query;
4012
4013   /* Query Request Length (2 octets) */
4014   req_len = tvb_get_letohs(tvb, offset);
4015
4016   item = proto_tree_add_text(tree, tvb, offset, 2 + req_len, "Query Request");
4017   if (tvb_reported_length_remaining(tvb, offset) < 2 + req_len) {
4018     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
4019                            "Invalid Query Request Length");
4020     return tvb_reported_length_remaining(tvb, offset);
4021   }
4022   query = proto_item_add_subtree(item, ett_gas_query);
4023
4024   proto_tree_add_item(query, hf_ieee80211_ff_query_request_length,
4025                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
4026   offset += 2;
4027   /*
4028    * Query Request (GAS query; formatted per protocol specified in the
4029    * Advertisement Protocol IE)
4030    */
4031   if (anqp)
4032     dissect_anqp(query, tvb, offset, TRUE);
4033   else
4034     proto_tree_add_item(query, hf_ieee80211_ff_query_request,
4035                         tvb, offset, req_len, ENC_NA);
4036   offset += req_len;
4037
4038   return offset - start;
4039 }
4040
4041 static guint
4042 dissect_gas_initial_response(proto_tree *tree, tvbuff_t *tvb, int offset,
4043                              gboolean anqp)
4044 {
4045   guint16 resp_len;
4046   int start = offset;
4047   proto_item *item;
4048   proto_tree *query;
4049
4050   /* Query Response Length (2 octets) */
4051   resp_len = tvb_get_letohs(tvb, offset);
4052
4053   item = proto_tree_add_text(tree, tvb, offset, 2 + resp_len,
4054                              "Query Response");
4055   if (tvb_reported_length_remaining(tvb, offset) < 2 + resp_len) {
4056     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
4057                            "Invalid Query Response Length");
4058     return tvb_reported_length_remaining(tvb, offset);
4059   }
4060   query = proto_item_add_subtree(item, ett_gas_query);
4061
4062   proto_tree_add_item(query, hf_ieee80211_ff_query_response_length,
4063                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
4064   offset += 2;
4065   /* Query Response (optional) */
4066   if (resp_len) {
4067     if (anqp)
4068       dissect_anqp(query, tvb, offset, FALSE);
4069     else
4070       proto_tree_add_item(query, hf_ieee80211_ff_query_response,
4071                           tvb, offset, resp_len, ENC_NA);
4072     offset += resp_len;
4073   }
4074
4075   return offset - start;
4076 }
4077
4078 static GHashTable *gas_fragment_table = NULL;
4079 static GHashTable *gas_reassembled_table = NULL;
4080
4081 static void ieee80211_gas_reassembly_init(void)
4082 {
4083   fragment_table_init(&gas_fragment_table);
4084   reassembled_table_init(&gas_reassembled_table);
4085 }
4086
4087 static gint ett_gas_resp_fragment = -1;
4088 static gint ett_gas_resp_fragments = -1;
4089
4090 static int hf_ieee80211_gas_resp_fragments = -1;
4091 static int hf_ieee80211_gas_resp_fragment = -1;
4092 static int hf_ieee80211_gas_resp_fragment_overlap = -1;
4093 static int hf_ieee80211_gas_resp_fragment_overlap_conflict = -1;
4094 static int hf_ieee80211_gas_resp_fragment_multiple_tails = -1;
4095 static int hf_ieee80211_gas_resp_fragment_too_long_fragment = -1;
4096 static int hf_ieee80211_gas_resp_fragment_error = -1;
4097 static int hf_ieee80211_gas_resp_fragment_count = -1;
4098 static int hf_ieee80211_gas_resp_reassembled_in = -1;
4099 static int hf_ieee80211_gas_resp_reassembled_length = -1;
4100
4101 static const fragment_items gas_resp_frag_items = {
4102   &ett_gas_resp_fragment,
4103   &ett_gas_resp_fragments,
4104   &hf_ieee80211_gas_resp_fragments,
4105   &hf_ieee80211_gas_resp_fragment,
4106   &hf_ieee80211_gas_resp_fragment_overlap,
4107   &hf_ieee80211_gas_resp_fragment_overlap_conflict,
4108   &hf_ieee80211_gas_resp_fragment_multiple_tails,
4109   &hf_ieee80211_gas_resp_fragment_too_long_fragment,
4110   &hf_ieee80211_gas_resp_fragment_error,
4111   &hf_ieee80211_gas_resp_fragment_count,
4112   &hf_ieee80211_gas_resp_reassembled_in,
4113   &hf_ieee80211_gas_resp_reassembled_length,
4114   "GAS Response fragments"
4115 };
4116
4117 static guint
4118 dissect_gas_comeback_response(proto_tree *tree, tvbuff_t *tvb, int offset,
4119                               gboolean anqp, guint8 frag, gboolean more,
4120                               guint8 dialog_token)
4121 {
4122   guint16 resp_len;
4123   int start = offset;
4124   proto_item *item;
4125   proto_tree *query;
4126
4127   /* Query Response Length (2 octets) */
4128   resp_len = tvb_get_letohs(tvb, offset);
4129
4130   item = proto_tree_add_text(tree, tvb, offset, 2 + resp_len,
4131                              "Query Response");
4132   if (tvb_reported_length_remaining(tvb, offset) < 2 + resp_len) {
4133     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
4134                            "Invalid Query Response Length");
4135     return tvb_reported_length_remaining(tvb, offset);
4136   }
4137   query = proto_item_add_subtree(item, ett_gas_query);
4138
4139   proto_tree_add_item(query, hf_ieee80211_ff_query_response_length,
4140                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
4141   offset += 2;
4142   /* Query Response (optional) */
4143   if (resp_len) {
4144     if (anqp && frag == 0 && !more)
4145       dissect_anqp(query, tvb, offset, FALSE);
4146     else {
4147       fragment_data *frag_msg;
4148       gboolean save_fragmented;
4149       tvbuff_t *new_tvb;
4150
4151       save_fragmented = g_pinfo->fragmented;
4152       g_pinfo->fragmented = TRUE;
4153       frag_msg = fragment_add_seq_check(tvb, offset, g_pinfo, dialog_token,
4154                                         gas_fragment_table,
4155                                         gas_reassembled_table, frag, resp_len,
4156                                         more);
4157       new_tvb = process_reassembled_data(tvb, offset, g_pinfo,
4158                                          "Reassembled GAS Query Response",
4159                                          frag_msg, &gas_resp_frag_items,
4160                                          NULL, tree);
4161       if (new_tvb) {
4162         if (anqp)
4163           dissect_anqp(query, new_tvb, 0, FALSE);
4164         else
4165           proto_tree_add_item(query, hf_ieee80211_ff_query_response,
4166                               new_tvb, 0,
4167                               tvb_reported_length_remaining(new_tvb, 0),
4168                               ENC_NA);
4169       }
4170
4171       /* The old tvb cannot be used anymore */
4172       ieee80211_tvb_invalid = TRUE;
4173
4174       g_pinfo->fragmented = save_fragmented;
4175     }
4176     offset += resp_len;
4177   }
4178
4179   return offset - start;
4180 }
4181
4182 /* ************************************************************************* */
4183 /*              Dissect and add fixed mgmt fields to protocol tree           */
4184 /* ************************************************************************* */
4185
4186 static guint
4187 add_fixed_field(proto_tree *tree, tvbuff_t *tvb, int offset,
4188                 enum fixed_field lfcode);
4189
4190 static guint64 last_timestamp;
4191
4192 static guint
4193 add_ff_timestamp(proto_tree *tree, tvbuff_t *tvb, int offset)
4194 {
4195   last_timestamp = tvb_get_letoh64(tvb, offset);
4196   proto_tree_add_item(tree, hf_ieee80211_ff_timestamp, tvb, offset, 8,
4197                       ENC_LITTLE_ENDIAN);
4198   return 8;
4199 }
4200
4201 static guint
4202 add_ff_beacon_interval(proto_tree *tree, tvbuff_t *tvb, int offset)
4203 {
4204   proto_tree_add_item(tree, hf_ieee80211_ff_beacon_interval, tvb, offset, 2,
4205                       ENC_LITTLE_ENDIAN);
4206   col_append_fstr(g_pinfo->cinfo, COL_INFO, ", BI=%d",
4207                   tvb_get_letohs(tvb, offset));
4208   return 2;
4209 }
4210
4211 static guint
4212 add_ff_cap_info(proto_tree *tree, tvbuff_t *tvb, int offset)
4213 {
4214   proto_item *cap_item;
4215   proto_tree *cap_tree;
4216
4217   cap_item = proto_tree_add_item(tree, hf_ieee80211_ff_capture, tvb, offset, 2,
4218                                  ENC_LITTLE_ENDIAN);
4219   cap_tree = proto_item_add_subtree(cap_item, ett_cap_tree);
4220
4221   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_ess, tvb, offset, 2,
4222                       ENC_LITTLE_ENDIAN);
4223   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_ibss, tvb, offset, 2,
4224                       ENC_LITTLE_ENDIAN);
4225   if ((tvb_get_letohs(tvb, offset) & 0x0001) != 0) {
4226     /* This is an AP */
4227     proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_ap_poll, tvb, offset, 2,
4228                         ENC_LITTLE_ENDIAN);
4229   } else {
4230     /* This is a STA */
4231     proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_sta_poll, tvb, offset, 2,
4232                         ENC_LITTLE_ENDIAN);
4233   }
4234
4235   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_privacy, tvb, offset, 2,
4236                       ENC_LITTLE_ENDIAN);
4237   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_preamble, tvb, offset, 2,
4238                       ENC_LITTLE_ENDIAN);
4239   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_pbcc, tvb, offset, 2,
4240                       ENC_LITTLE_ENDIAN);
4241   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_agility, tvb, offset, 2,
4242                       ENC_LITTLE_ENDIAN);
4243   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_spec_man, tvb, offset, 2,
4244                       ENC_LITTLE_ENDIAN);
4245   proto_tree_add_item(cap_tree, hf_ieee80211_ff_short_slot_time, tvb, offset,
4246                       2, ENC_LITTLE_ENDIAN);
4247   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_apsd, tvb, offset, 2,
4248                       ENC_LITTLE_ENDIAN);
4249   proto_tree_add_item(cap_tree, hf_ieee80211_ff_dsss_ofdm, tvb, offset, 2,
4250                       ENC_LITTLE_ENDIAN);
4251   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_del_blk_ack, tvb, offset, 2,
4252                       ENC_LITTLE_ENDIAN);
4253   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_imm_blk_ack, tvb, offset, 2,
4254                       ENC_LITTLE_ENDIAN);
4255   return 2;
4256 }
4257
4258 static guint
4259 add_ff_auth_alg(proto_tree *tree, tvbuff_t *tvb, int offset)
4260 {
4261   proto_tree_add_item(tree, hf_ieee80211_ff_auth_alg, tvb, offset, 2,
4262                       ENC_LITTLE_ENDIAN);
4263   return 2;
4264 }
4265
4266 static guint
4267 add_ff_auth_trans_seq(proto_tree *tree, tvbuff_t *tvb, int offset)
4268 {
4269   proto_tree_add_item(tree, hf_ieee80211_ff_auth_seq, tvb, offset, 2,
4270                       ENC_LITTLE_ENDIAN);
4271   return 2;
4272 }
4273
4274 static guint
4275 add_ff_current_ap_addr(proto_tree *tree, tvbuff_t *tvb, int offset)
4276 {
4277   proto_tree_add_item(tree, hf_ieee80211_ff_current_ap, tvb, offset, 6,
4278                       ENC_NA);
4279   return 6;
4280 }
4281
4282 static guint
4283 add_ff_listen_ival(proto_tree *tree, tvbuff_t *tvb, int offset)
4284 {
4285   proto_tree_add_item(tree, hf_ieee80211_ff_listen_ival, tvb, offset, 2,
4286                       ENC_LITTLE_ENDIAN);
4287   return 2;
4288 }
4289
4290 static guint
4291 add_ff_reason_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4292 {
4293   proto_tree_add_item(tree, hf_ieee80211_ff_reason, tvb, offset, 2,
4294                       ENC_LITTLE_ENDIAN);
4295   return 2;
4296 }
4297
4298 static guint
4299 add_ff_assoc_id(proto_tree *tree, tvbuff_t *tvb, int offset)
4300 {
4301   proto_tree_add_item(tree, hf_ieee80211_ff_assoc_id, tvb, offset, 2,
4302                       ENC_LITTLE_ENDIAN);
4303   return 2;
4304 }
4305
4306 static guint
4307 add_ff_status_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4308 {
4309   proto_tree_add_item(tree, hf_ieee80211_ff_status_code, tvb, offset, 2,
4310                       ENC_LITTLE_ENDIAN);
4311   return 2;
4312 }
4313
4314 static guint
4315 add_ff_category_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4316 {
4317   proto_tree_add_item(tree, hf_ieee80211_ff_category_code, tvb, offset, 1,
4318                       ENC_LITTLE_ENDIAN);
4319   return 1;
4320 }
4321
4322 static guint
4323 add_ff_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4324 {
4325   proto_tree_add_item(tree, hf_ieee80211_ff_action_code, tvb, offset, 1,
4326                       ENC_LITTLE_ENDIAN);
4327   return 1;
4328 }
4329
4330 static guint
4331 add_ff_dialog_token(proto_tree *tree, tvbuff_t *tvb, int offset)
4332 {
4333   proto_tree_add_item(tree, hf_ieee80211_ff_dialog_token, tvb, offset, 1,
4334                       ENC_LITTLE_ENDIAN);
4335   return 1;
4336 }
4337
4338 static guint
4339 add_ff_wme_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4340 {
4341   proto_tree_add_item(tree, hf_ieee80211_ff_wme_action_code, tvb, offset, 1,
4342                       ENC_LITTLE_ENDIAN);
4343   return 1;
4344 }
4345
4346 static guint
4347 add_ff_wme_status_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4348 {
4349   proto_tree_add_item(tree, hf_ieee80211_ff_wme_status_code, tvb, offset, 1,
4350                       ENC_LITTLE_ENDIAN);
4351   return 1;
4352 }
4353
4354 static guint
4355 add_ff_qos_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4356 {
4357   proto_tree_add_item(tree, hf_ieee80211_ff_qos_action_code, tvb, offset, 1,
4358                       ENC_LITTLE_ENDIAN);
4359   return 1;
4360 }
4361
4362 static guint
4363 add_ff_block_ack_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4364 {
4365   proto_tree_add_item(tree, hf_ieee80211_ff_ba_action, tvb, offset, 1,
4366                       ENC_LITTLE_ENDIAN);
4367   return 1;
4368 }
4369
4370 static guint
4371 add_ff_block_ack_param(proto_tree *tree, tvbuff_t *tvb, int offset)
4372 {
4373   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_block_ack_params,
4374                          ett_ff_ba_param_tree,
4375                          ieee80211_ff_block_ack_params_fields,
4376                          ENC_LITTLE_ENDIAN);
4377   return 2;
4378 }
4379
4380 static guint
4381 add_ff_block_ack_timeout(proto_tree *tree, tvbuff_t *tvb, int offset)
4382 {
4383   proto_tree_add_item(tree, hf_ieee80211_ff_block_ack_timeout, tvb, offset, 2,
4384                       ENC_LITTLE_ENDIAN);
4385   return 2;
4386 }
4387
4388 static guint
4389 add_ff_block_ack_ssc(proto_tree *tree, tvbuff_t *tvb, int offset)
4390 {
4391   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_block_ack_ssc,
4392                          ett_ff_ba_ssc_tree, ieee80211_ff_block_ack_ssc_fields,
4393                          ENC_LITTLE_ENDIAN);
4394   return 2;
4395 }
4396
4397 static guint
4398 add_ff_qos_ts_info(proto_tree *tree, tvbuff_t *tvb, int offset)
4399 {
4400   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_tsinfo,
4401                          ett_tsinfo_tree, ieee80211_tsinfo_fields,
4402                          ENC_LITTLE_ENDIAN);
4403   return 3;
4404 }
4405
4406 static guint
4407 add_ff_mesh_action(proto_tree *tree, tvbuff_t *tvb, int offset)
4408 {
4409   proto_tree_add_item(tree, hf_ieee80211_ff_mesh_action, tvb, offset, 1,
4410                       ENC_LITTLE_ENDIAN);
4411   return 1;
4412 }
4413
4414 static guint
4415 add_ff_multihop_action(proto_tree *tree, tvbuff_t *tvb, int offset)
4416 {
4417   proto_tree_add_item(tree, hf_ieee80211_ff_multihop_action, tvb, offset, 1,
4418                       ENC_LITTLE_ENDIAN);
4419   return 1;
4420 }
4421
4422 static guint
4423 add_ff_mesh_control(proto_tree *tree, tvbuff_t *tvb, int offset)
4424 {
4425   int start = offset;
4426   guint8 flags;
4427
4428   proto_tree_add_item(tree, hf_ieee80211_ff_mesh_flags, tvb, offset, 1,
4429                       ENC_LITTLE_ENDIAN);
4430   flags = tvb_get_guint8(tvb, offset);
4431   offset++;
4432   proto_tree_add_item(tree, hf_ieee80211_ff_mesh_ttl, tvb, offset, 1,
4433                       ENC_LITTLE_ENDIAN);
4434   offset++;
4435   proto_tree_add_item(tree, hf_ieee80211_ff_mesh_sequence, tvb, offset, 4,
4436                       ENC_LITTLE_ENDIAN);
4437   offset += 4;
4438
4439   switch (flags & 0x03) {
4440   case 1:
4441     proto_tree_add_item(tree, hf_ieee80211_ff_mesh_addr4, tvb, offset, 6,
4442                         ENC_NA);
4443     offset += 6;
4444     break;
4445   case 2:
4446     proto_tree_add_item(tree, hf_ieee80211_ff_mesh_addr5, tvb, offset, 6,
4447                         ENC_NA);
4448     offset += 6;
4449     proto_tree_add_item(tree, hf_ieee80211_ff_mesh_addr6, tvb, offset, 6,
4450                         ENC_NA);
4451     offset += 6;
4452     break;
4453   case 3:
4454     proto_item_append_text(tree, "Unknown Address Extension Mode");
4455     break;
4456   default:
4457     /* no default action */
4458     break;
4459   }
4460
4461   return offset - start;
4462 }
4463
4464 static guint
4465 add_ff_selfprot_action(proto_tree *tree, tvbuff_t *tvb, int offset)
4466 {
4467   proto_tree_add_item(tree, hf_ieee80211_ff_selfprot_action, tvb, offset, 1,
4468                       ENC_LITTLE_ENDIAN);
4469   return 1;
4470 }
4471
4472 static guint
4473 add_ff_dls_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4474 {
4475   proto_tree_add_item(tree, hf_ieee80211_ff_dls_action_code, tvb, offset, 1,
4476                       ENC_LITTLE_ENDIAN);
4477   return 1;
4478 }
4479
4480 static guint
4481 add_ff_dst_mac_addr(proto_tree *tree, tvbuff_t *tvb, int offset)
4482 {
4483   proto_tree_add_item(tree, hf_ieee80211_ff_dst_mac_addr, tvb, offset, 6,
4484                       ENC_NA);
4485   return 6;
4486 }
4487
4488 static guint
4489 add_ff_src_mac_addr(proto_tree *tree, tvbuff_t *tvb, int offset)
4490 {
4491   proto_tree_add_item(tree, hf_ieee80211_ff_src_mac_addr, tvb, offset, 6,
4492                       ENC_NA);
4493   return 6;
4494 }
4495
4496 static guint
4497 add_ff_dls_timeout(proto_tree *tree, tvbuff_t *tvb, int offset)
4498 {
4499   proto_tree_add_item(tree, hf_ieee80211_ff_dls_timeout, tvb, offset, 2,
4500                       ENC_LITTLE_ENDIAN);
4501   return 2;
4502 }
4503
4504 static guint
4505 add_ff_delba_param_set(proto_tree *tree, tvbuff_t *tvb, int offset)
4506 {
4507   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_delba_param,
4508                          ett_ff_ba_param_tree, ieee80211_ff_delba_param_fields,
4509                          ENC_LITTLE_ENDIAN);
4510   return 2;
4511 }
4512
4513 static guint
4514 add_ff_max_reg_pwr(proto_tree *tree, tvbuff_t *tvb, int offset)
4515 {
4516   proto_tree_add_item(tree, hf_ieee80211_ff_max_reg_pwr, tvb, offset, 2,
4517                       ENC_LITTLE_ENDIAN);
4518   return 2;
4519 }
4520
4521 static guint
4522 add_ff_measurement_pilot_int(proto_tree *tree, tvbuff_t *tvb, int offset)
4523 {
4524   proto_tree_add_item(tree, hf_ieee80211_ff_measurement_pilot_int, tvb, offset,
4525                       2, ENC_LITTLE_ENDIAN);
4526   return 2;
4527 }
4528
4529 static guint
4530 add_ff_country_str(proto_tree *tree, tvbuff_t *tvb, int offset)
4531 {
4532   proto_tree_add_string(tree, hf_ieee80211_ff_country_str, tvb, offset, 3,
4533                         ENC_BIG_ENDIAN);
4534   return 3;
4535 }
4536
4537 static guint
4538 add_ff_max_tx_pwr(proto_tree *tree, tvbuff_t *tvb, int offset)
4539 {
4540   proto_tree_add_item(tree, hf_ieee80211_ff_max_tx_pwr, tvb, offset, 1,
4541                       ENC_LITTLE_ENDIAN);
4542   return 1;
4543 }
4544
4545 static guint
4546 add_ff_tx_pwr_used(proto_tree *tree, tvbuff_t *tvb, int offset)
4547 {
4548   proto_tree_add_item(tree, hf_ieee80211_ff_tx_pwr_used, tvb, offset, 1,
4549                       ENC_LITTLE_ENDIAN);
4550   return 1;
4551 }
4552
4553 static guint
4554 add_ff_transceiver_noise_floor(proto_tree *tree, tvbuff_t *tvb, int offset)
4555 {
4556   proto_tree_add_item(tree, hf_ieee80211_ff_transceiver_noise_floor, tvb,
4557                       offset, 1, ENC_LITTLE_ENDIAN);
4558   return 1;
4559 }
4560
4561 static guint
4562 add_ff_channel_width(proto_tree *tree, tvbuff_t *tvb, int offset)
4563 {
4564   proto_tree_add_item(tree, hf_ieee80211_ff_channel_width, tvb, offset, 1,
4565                       ENC_LITTLE_ENDIAN);
4566   return 1;
4567 }
4568
4569 static guint
4570 add_ff_qos_info_ap(proto_tree *tree, tvbuff_t *tvb, int offset)
4571 {
4572   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_qos_info_ap,
4573                          ett_ff_qos_info, ieee80211_ff_qos_info_ap_fields,
4574                          ENC_LITTLE_ENDIAN);
4575   return 1;
4576 }
4577
4578 static guint
4579 add_ff_qos_info_sta(proto_tree *tree, tvbuff_t *tvb, int offset)
4580 {
4581   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_qos_info_sta,
4582                          ett_ff_qos_info, ieee80211_ff_qos_info_sta_fields,
4583                          ENC_LITTLE_ENDIAN);
4584   return 1;
4585 }
4586
4587 static guint
4588 add_ff_sm_pwr_cntrl(proto_tree *tree, tvbuff_t *tvb, int offset)
4589 {
4590   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_sm_pwr_save,
4591                          ett_ff_sm_pwr_save, ieee80211_ff_sw_pwr_save_fields,
4592                          ENC_LITTLE_ENDIAN);
4593   return 1;
4594 }
4595
4596 static guint
4597 add_ff_pco_phase_cntrl(proto_tree *tree, tvbuff_t *tvb, int offset)
4598 {
4599   proto_tree_add_item(tree, hf_ieee80211_ff_pco_phase_cntrl, tvb, offset, 1,
4600                       ENC_LITTLE_ENDIAN);
4601   return 1;
4602 }
4603
4604 static guint
4605 add_ff_psmp_param_set(proto_tree *tree, tvbuff_t *tvb, int offset)
4606 {
4607   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_psmp_param_set,
4608                          ett_ff_psmp_param_set,
4609                          ieee80211_ff_psmp_param_set_fields,
4610                          ENC_LITTLE_ENDIAN);
4611   return 2;
4612 }
4613
4614 static guint
4615 add_ff_mimo_cntrl(proto_tree *tree, tvbuff_t *tvb, int offset)
4616 {
4617   proto_item *mimo_item;
4618   proto_tree *mimo_tree;
4619
4620   mimo_item = proto_tree_add_item(tree, hf_ieee80211_ff_mimo_cntrl, tvb,
4621                                   offset, 6, ENC_NA);
4622   mimo_tree = proto_item_add_subtree(mimo_item, ett_ff_mimo_cntrl);
4623
4624   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_nc_index, tvb,
4625                       offset, 1, ENC_LITTLE_ENDIAN);
4626   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_nr_index, tvb,
4627                       offset, 1, ENC_LITTLE_ENDIAN);
4628   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_channel_width, tvb,
4629                       offset, 1, ENC_LITTLE_ENDIAN);
4630   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_grouping, tvb,
4631                       offset, 1, ENC_LITTLE_ENDIAN);
4632   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_coefficient_size,
4633                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
4634   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_codebook_info, tvb,
4635                       offset, 1, ENC_LITTLE_ENDIAN);
4636   proto_tree_add_item(mimo_tree,
4637                       hf_ieee80211_ff_mimo_cntrl_remaining_matrix_segment, tvb,
4638                       offset, 1, ENC_LITTLE_ENDIAN);
4639   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_reserved, tvb,
4640                       offset, 1, ENC_LITTLE_ENDIAN);
4641
4642   offset += 2;
4643   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_sounding_timestamp,
4644                       tvb, offset, 4, ENC_LITTLE_ENDIAN);
4645
4646   return 6;
4647 }
4648
4649 static guint
4650 add_ff_ant_selection(proto_tree *tree, tvbuff_t *tvb, int offset)
4651 {
4652   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_ant_selection,
4653                          ett_ff_ant_sel, ieee80211_ff_ant_selection_fields,
4654                          ENC_LITTLE_ENDIAN);
4655   return 1;
4656 }
4657
4658 static guint
4659 add_ff_extended_channel_switch_announcement(proto_tree *tree, tvbuff_t *tvb,
4660                                             int offset)
4661 {
4662   proto_tree_add_bitmask(tree, tvb, offset,
4663                          hf_ieee80211_ff_ext_channel_switch_announcement,
4664                          ett_ff_chan_switch_announce,
4665                          ieee80211_ff_ext_channel_switch_announcement_fields,
4666                          ENC_LITTLE_ENDIAN);
4667   return 4;
4668 }
4669
4670 static guint
4671 add_ff_ht_information(proto_tree *tree, tvbuff_t *tvb, int offset)
4672 {
4673   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_ht_info,
4674                          ett_ff_ht_info, ieee80211_ff_ht_info_fields,
4675                          ENC_LITTLE_ENDIAN);
4676   return 1;
4677 }
4678
4679 static guint
4680 add_ff_ht_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4681 {
4682   proto_tree_add_item(tree, hf_ieee80211_ff_ht_action, tvb, offset, 1,
4683                       ENC_LITTLE_ENDIAN);
4684   return 1;
4685 }
4686
4687 static guint
4688 add_ff_psmp_sta_info(proto_tree *tree, tvbuff_t *tvb, int offset)
4689 {
4690   proto_item *psmp_item;
4691   proto_tree *psmp_tree;
4692
4693   psmp_item = proto_tree_add_item(tree, hf_ieee80211_ff_psmp_sta_info, tvb,
4694                                   offset, 8, ENC_LITTLE_ENDIAN);
4695   psmp_tree = proto_item_add_subtree(psmp_item, ett_ff_psmp_sta_info);
4696
4697   proto_tree_add_item(psmp_item, hf_ieee80211_ff_psmp_sta_info_type, tvb,
4698                       offset, 4, ENC_LITTLE_ENDIAN);
4699
4700   switch (tvb_get_letohl(tvb, offset) & PSMP_STA_INFO_FLAG_TYPE) {
4701   case PSMP_STA_INFO_BROADCAST:
4702     proto_tree_add_item(psmp_tree,
4703                         hf_ieee80211_ff_psmp_sta_info_dtt_start_offset, tvb,
4704                         offset, 4, ENC_LITTLE_ENDIAN);
4705     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_duration,
4706                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4707     /* Missing 64 bit bitmask... */
4708     proto_tree_add_uint64(psmp_tree,
4709                           hf_ieee80211_ff_psmp_sta_info_reserved_large,
4710                           tvb, offset, 8,
4711                           (tvb_get_letoh64(tvb, offset) &
4712                            G_GINT64_CONSTANT(0xFFFFFFFFFFE00000)) >> 21);
4713     break;
4714   case PSMP_STA_INFO_MULTICAST:
4715     proto_tree_add_item(psmp_tree,
4716                         hf_ieee80211_ff_psmp_sta_info_dtt_start_offset, tvb,
4717                         offset, 4, ENC_LITTLE_ENDIAN);
4718     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_duration,
4719                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4720     /* Missing 64 bit bitmask... */
4721     proto_tree_add_uint64(psmp_tree,
4722                           hf_ieee80211_ff_psmp_sta_info_psmp_multicast_id,
4723                           tvb, offset, 6,
4724                           (tvb_get_letoh64(tvb, offset) &
4725                            G_GINT64_CONSTANT(0xFFFFFFFFFFE00000)) >> 21);
4726     break;
4727   case PSMP_STA_INFO_INDIVIDUALLY_ADDRESSED:
4728     proto_tree_add_item(psmp_tree,
4729                         hf_ieee80211_ff_psmp_sta_info_dtt_start_offset, tvb,
4730                         offset, 4, ENC_LITTLE_ENDIAN);
4731     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_duration,
4732                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4733     offset += 2;
4734     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_sta_id, tvb,
4735                         offset, 4, ENC_LITTLE_ENDIAN);
4736     offset += 2;
4737
4738     proto_tree_add_item(psmp_tree,
4739                         hf_ieee80211_ff_psmp_sta_info_utt_start_offset,
4740                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4741     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_utt_duration,
4742                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4743     proto_tree_add_item(psmp_tree,
4744                         hf_ieee80211_ff_psmp_sta_info_reserved_small, tvb,
4745                         offset, 4, ENC_LITTLE_ENDIAN);
4746     break;
4747   }
4748
4749   return 8;
4750 }
4751
4752 static guint
4753 add_ff_schedule_info(proto_tree *tree, tvbuff_t *tvb, int offset)
4754 {
4755   proto_item *sched_item;
4756   proto_tree *sched_tree;
4757
4758   sched_item = proto_tree_add_item(tree, hf_ieee80211_sched_info, tvb, offset,
4759                                    2, ENC_LITTLE_ENDIAN);
4760   sched_tree = proto_item_add_subtree(sched_item, ett_sched_tree);
4761
4762   proto_tree_add_item(sched_tree, hf_ieee80211_sched_info_agg, tvb, offset, 2,
4763                       ENC_LITTLE_ENDIAN);
4764   if (tvb_get_letohs(tvb, offset) & 0x0001) {
4765     proto_tree_add_item(sched_tree, hf_ieee80211_sched_info_tsid, tvb, offset,
4766                         2, ENC_LITTLE_ENDIAN);
4767     proto_tree_add_item(sched_tree, hf_ieee80211_sched_info_dir, tvb, offset,
4768                         2, ENC_LITTLE_ENDIAN);
4769   }
4770
4771   return 2;
4772 }
4773
4774 static guint
4775 add_ff_pa_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4776 {
4777   proto_tree_add_item(tree, hf_ieee80211_ff_public_action, tvb, offset, 1,
4778                       ENC_BIG_ENDIAN);
4779   return 1;
4780 }
4781
4782 static guint
4783 add_ff_action_spectrum_mgmt(proto_tree *tree, tvbuff_t *tvb, int offset)
4784 {
4785     switch (tvb_get_guint8(tvb, offset + 1)) {
4786     case SM_ACTION_MEASUREMENT_REQUEST:
4787     case SM_ACTION_MEASUREMENT_REPORT:
4788     case SM_ACTION_TPC_REQUEST:
4789     case SM_ACTION_TPC_REPORT:
4790       add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4791       add_fixed_field(tree, tvb, offset + 1, FIELD_ACTION_CODE);
4792       add_fixed_field(tree, tvb, offset + 2, FIELD_DIALOG_TOKEN);
4793       return 3;
4794     case SM_ACTION_CHAN_SWITCH_ANNC:
4795     case SM_ACTION_EXT_CHAN_SWITCH_ANNC:
4796       add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4797       add_fixed_field(tree, tvb, offset + 1, FIELD_ACTION_CODE);
4798       return 2;
4799     default:
4800       add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4801       add_fixed_field(tree, tvb, offset + 1, FIELD_ACTION_CODE);
4802       return 2;
4803     }
4804 }
4805
4806 static guint
4807 add_ff_action_qos(proto_tree *tree, tvbuff_t *tvb, int offset)
4808 {
4809   switch (tvb_get_guint8(tvb, offset + 1)) {
4810   case SM_ACTION_ADDTS_REQUEST:
4811     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4812     add_fixed_field(tree, tvb, offset + 1, FIELD_QOS_ACTION_CODE);
4813     add_fixed_field(tree, tvb, offset + 2, FIELD_DIALOG_TOKEN);
4814     return 3;
4815   case SM_ACTION_ADDTS_RESPONSE:
4816     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4817     add_fixed_field(tree, tvb, offset + 1, FIELD_QOS_ACTION_CODE);
4818     add_fixed_field(tree, tvb, offset + 2, FIELD_DIALOG_TOKEN);
4819     add_fixed_field(tree, tvb, offset + 3, FIELD_STATUS_CODE);
4820     return 5;
4821   case SM_ACTION_DELTS:
4822     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4823     add_fixed_field(tree, tvb, offset + 1, FIELD_QOS_ACTION_CODE);
4824     add_fixed_field(tree, tvb, offset + 2, FIELD_QOS_TS_INFO);
4825     add_fixed_field(tree, tvb, offset + 5, FIELD_REASON_CODE);
4826     return 7;
4827   case SM_ACTION_QOS_SCHEDULE:
4828     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4829     add_fixed_field(tree, tvb, offset + 1, FIELD_QOS_ACTION_CODE);
4830     return 2;
4831   default:
4832     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4833     return 2;
4834   }
4835 }
4836
4837 static guint
4838 add_ff_action_dls(proto_tree *tree, tvbuff_t *tvb, int offset)
4839 {
4840   switch (tvb_get_guint8(tvb, offset + 1)) {
4841   case SM_ACTION_DLS_REQUEST:
4842     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4843     add_fixed_field(tree, tvb, offset + 1, FIELD_DLS_ACTION_CODE);
4844     add_fixed_field(tree, tvb, offset + 2, FIELD_DST_MAC_ADDR);
4845     add_fixed_field(tree, tvb, offset + 8, FIELD_SRC_MAC_ADDR);
4846     add_fixed_field(tree, tvb, offset + 14, FIELD_CAP_INFO);
4847     add_fixed_field(tree, tvb, offset + 16, FIELD_DLS_TIMEOUT);
4848     return 18;
4849   case SM_ACTION_DLS_RESPONSE:
4850     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4851     add_fixed_field(tree, tvb, offset + 1, FIELD_DLS_ACTION_CODE);
4852     add_fixed_field(tree, tvb, offset + 2, FIELD_STATUS_CODE);
4853     add_fixed_field(tree, tvb, offset + 4, FIELD_DST_MAC_ADDR);
4854     add_fixed_field(tree, tvb, offset + 10, FIELD_SRC_MAC_ADDR);
4855     if (!hf_ieee80211_ff_status_code) {
4856       add_fixed_field(tree, tvb, offset + 16, FIELD_CAP_INFO);
4857     }
4858     return 16;
4859   case SM_ACTION_DLS_TEARDOWN:
4860     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4861     add_fixed_field(tree, tvb, offset + 1, FIELD_DLS_ACTION_CODE);
4862     add_fixed_field(tree, tvb, offset + 2, FIELD_DST_MAC_ADDR);
4863     add_fixed_field(tree, tvb, offset + 8, FIELD_SRC_MAC_ADDR);
4864     add_fixed_field(tree, tvb, offset + 14, FIELD_REASON_CODE);
4865     return 16;
4866   default:
4867     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4868     return 2;
4869   }
4870 }
4871
4872 static guint
4873 add_ff_action_block_ack(proto_tree *tree, tvbuff_t *tvb, int offset)
4874 {
4875   guint start = offset;
4876
4877   switch (tvb_get_guint8(tvb, offset + 1)) {
4878   case BA_ADD_BLOCK_ACK_REQUEST:
4879     offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4880     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_ACTION_CODE);
4881     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4882     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_PARAM);
4883     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_TIMEOUT);
4884     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
4885     break;
4886   case BA_ADD_BLOCK_ACK_RESPONSE:
4887     offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4888     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_ACTION_CODE);
4889     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4890     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
4891     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_PARAM);
4892     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_TIMEOUT);
4893     break;
4894   case BA_DELETE_BLOCK_ACK:
4895     offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4896     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_ACTION_CODE);
4897     offset += add_fixed_field(tree, tvb, offset, FIELD_DELBA_PARAM_SET);
4898     offset += add_fixed_field(tree, tvb, offset, FIELD_REASON_CODE);
4899     break;
4900   }
4901
4902   return offset - start;  /* Size of fixed fields */
4903 }
4904
4905 static guint
4906 add_ff_action_public(proto_tree *tree, tvbuff_t *tvb, int offset)
4907 {
4908   guint start = offset;
4909   guint32 oui;
4910   guint8 code;
4911   guint8 subtype;
4912   gboolean anqp;
4913   guint8 dialog_token;
4914   guint8 frag;
4915   gboolean more;
4916
4917   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4918   code = tvb_get_guint8(tvb, offset);
4919   offset += add_fixed_field(tree, tvb, offset, FIELD_PA_ACTION_CODE);
4920
4921   switch (code) {
4922   case PA_VENDOR_SPECIFIC:
4923     oui = tvb_get_ntoh24(tvb, offset);
4924     proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
4925     offset += 3;
4926     switch (oui) {
4927     case OUI_WFA:
4928       subtype = tvb_get_guint8(tvb, offset);
4929       proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u", subtype);
4930       offset++;
4931       if (subtype == WFA_SUBTYPE_P2P) {
4932         offset = dissect_wifi_p2p_public_action(g_pinfo, tree, tvb, offset);
4933       }
4934       break;
4935     default:
4936       /* Don't know how to handle this vendor */
4937       break;
4938     }
4939     break;
4940   case PA_GAS_INITIAL_REQUEST:
4941     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4942     offset += dissect_advertisement_protocol(g_pinfo, tree, tvb, offset,
4943                                              &anqp);
4944     offset += dissect_gas_initial_request(tree, tvb, offset, anqp);
4945     break;
4946   case PA_GAS_INITIAL_RESPONSE:
4947     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4948     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
4949     offset += add_fixed_field(tree, tvb, offset, FIELD_GAS_COMEBACK_DELAY);
4950     offset += dissect_advertisement_protocol(g_pinfo, tree, tvb, offset,
4951                                              &anqp);
4952     offset += dissect_gas_initial_response(tree, tvb, offset, anqp);
4953     break;
4954   case PA_GAS_COMEBACK_REQUEST:
4955     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4956     break;
4957   case PA_GAS_COMEBACK_RESPONSE:
4958     dialog_token = tvb_get_guint8(tvb, offset);
4959     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4960     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
4961     frag = tvb_get_guint8(tvb, offset) & 0x7f;
4962     more = (tvb_get_guint8(tvb, offset) & 0x80) != 0;
4963     offset += add_fixed_field(tree, tvb, offset, FIELD_GAS_FRAGMENT_ID);
4964     offset += add_fixed_field(tree, tvb, offset, FIELD_GAS_COMEBACK_DELAY);
4965     offset += dissect_advertisement_protocol(g_pinfo, tree, tvb, offset,
4966                                              &anqp);
4967     offset += dissect_gas_comeback_response(tree, tvb, offset, anqp, frag,
4968                                             more, dialog_token);
4969     break;
4970   case PA_TDLS_DISCOVERY_RESPONSE:
4971     col_set_str(g_pinfo->cinfo, COL_PROTOCOL, "TDLS");
4972     col_set_str(g_pinfo->cinfo, COL_INFO, "TDLS Discovery Response");
4973     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4974     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
4975     break;
4976   }
4977
4978   return offset - start;  /* Size of fixed fields */
4979 }
4980
4981 static guint
4982 add_ff_action_fast_bss_transition(proto_tree *tree, tvbuff_t *tvb, int offset)
4983 {
4984   guint start = offset;
4985   guint8 code;
4986
4987   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4988   code = tvb_get_guint8(tvb, offset);
4989   offset += add_fixed_field(tree, tvb, offset, FIELD_FT_ACTION_CODE);
4990
4991   switch (code) {
4992   case FT_ACTION_REQUEST:
4993     offset += add_fixed_field(tree, tvb, offset, FIELD_STA_ADDRESS);
4994     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
4995     /* Followed by FT Request frame body (IEs) */
4996     break;
4997   case FT_ACTION_RESPONSE:
4998     offset += add_fixed_field(tree, tvb, offset, FIELD_STA_ADDRESS);
4999     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
5000     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5001     /* Followed by FT Response frame body (IEs) */
5002     break;
5003   case FT_ACTION_CONFIRM:
5004     offset += add_fixed_field(tree, tvb, offset, FIELD_STA_ADDRESS);
5005     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
5006     /* Followed by FT Confirm frame body (IEs) */
5007     break;
5008   case FT_ACTION_ACK:
5009     offset += add_fixed_field(tree, tvb, offset, FIELD_STA_ADDRESS);
5010     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
5011     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5012     /* Followed by FT Ack frame body (IEs) */
5013     break;
5014   }
5015
5016   return offset - start;  /* Size of fixed fields */
5017 }
5018
5019 static guint
5020 add_ff_action_sa_query(proto_tree *tree, tvbuff_t *tvb, int offset)
5021 {
5022   guint start = offset;
5023   guint8 code;
5024
5025   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5026   code = tvb_get_guint8(tvb, offset);
5027   offset += add_fixed_field(tree, tvb, offset, FIELD_SA_QUERY_ACTION_CODE);
5028
5029   switch (code) {
5030   case SA_QUERY_REQUEST:
5031     offset += add_fixed_field(tree, tvb, offset, FIELD_TRANSACTION_ID);
5032     break;
5033   case SA_QUERY_RESPONSE:
5034     offset += add_fixed_field(tree, tvb, offset, FIELD_TRANSACTION_ID);
5035     break;
5036   }
5037
5038   return offset - start;  /* Size of fixed fields */
5039 }
5040
5041 static guint
5042 add_ff_action_mesh(proto_tree *tree, tvbuff_t *tvb, int offset)
5043 {
5044   guint length;
5045   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5046   offset += add_fixed_field(tree, tvb, offset, FIELD_MESH_ACTION);
5047   /* The only fixed fields are the category and mesh action.  The rest are IEs.
5048    */
5049   length = 2;
5050   if (tvb_get_guint8(tvb, 1) == MESH_ACTION_TBTT_ADJ_RESPONSE) {
5051     /* ..except for the TBTT Adjustment Response, which has a status code field
5052      */
5053     length += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5054   }
5055   return length;
5056 }
5057
5058 static guint
5059 add_ff_action_multihop(proto_tree *tree, tvbuff_t *tvb, int offset)
5060 {
5061   guint start = offset;
5062   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5063   offset += add_fixed_field(tree, tvb, offset, FIELD_MULTIHOP_ACTION);
5064   offset += add_fixed_field(tree, tvb, offset, FIELD_MESH_CONTROL);
5065   return offset - start;
5066 }
5067
5068 static guint
5069 add_ff_action_self_protected(proto_tree *tree, tvbuff_t *tvb, int offset)
5070 {
5071   guint start = offset;
5072
5073   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5074   offset += add_fixed_field(tree, tvb, offset, FIELD_SELFPROT_ACTION);
5075
5076   switch (tvb_get_guint8(tvb, start + 1)) {
5077   case SELFPROT_ACTION_MESH_PEERING_OPEN:
5078     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
5079     break;
5080   case SELFPROT_ACTION_MESH_PEERING_CONFIRM:
5081     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
5082     offset += add_fixed_field(tree, tvb, offset, FIELD_ASSOC_ID);
5083     break;
5084   }
5085
5086   return offset - start;
5087 }
5088
5089 static guint
5090 wnm_bss_trans_mgmt_req(proto_tree *tree, tvbuff_t *tvb, int offset)
5091 {
5092   int start = offset;
5093   guint8 mode;
5094   gint left;
5095
5096   offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5097
5098   mode = tvb_get_guint8(tvb, offset);
5099   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_pref_cand,
5100                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5101   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_abridged,
5102                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5103   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_disassoc_imminent,
5104                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5105   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_bss_term_included,
5106                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5107   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_ess_disassoc_imminent,
5108                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5109   offset++;
5110
5111   proto_tree_add_item(tree, hf_ieee80211_ff_disassoc_timer, tvb, offset, 2,
5112                       ENC_LITTLE_ENDIAN);
5113   offset += 2;
5114
5115   proto_tree_add_item(tree, hf_ieee80211_ff_validity_interval, tvb, offset, 1,
5116                       ENC_LITTLE_ENDIAN);
5117   offset++;
5118
5119   if (mode & 0x08) {
5120     proto_tree_add_text(tree, tvb, offset, 8, "BSS Termination Duration");
5121     offset += 8;
5122   }
5123
5124   if (mode & 0x10) {
5125     guint8 url_len;
5126     url_len = tvb_get_guint8(tvb, offset);
5127     proto_tree_add_item(tree, hf_ieee80211_ff_url_len, tvb, offset, 1,
5128                         ENC_LITTLE_ENDIAN);
5129     offset++;
5130     proto_tree_add_item(tree, hf_ieee80211_ff_url, tvb, offset, url_len,
5131                         ENC_ASCII|ENC_NA);
5132     offset += url_len;
5133   }
5134
5135   left = tvb_reported_length_remaining(tvb, offset);
5136   if (left > 0) {
5137     proto_tree_add_text(tree, tvb, offset, left,
5138                         "BSS Transition Candidate List Entries");
5139     offset += left;
5140   }
5141
5142   return offset - start;
5143 }
5144
5145 static guint
5146 add_ff_action_wnm(proto_tree *tree, tvbuff_t *tvb, int offset)
5147 {
5148   guint8 code;
5149   guint start = offset;
5150
5151   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5152   code = tvb_get_guint8(tvb, offset);
5153   offset += add_fixed_field(tree, tvb, offset, FIELD_WNM_ACTION_CODE);
5154   switch (code) {
5155   case WNM_BSS_TRANS_MGMT_REQ:
5156     offset += wnm_bss_trans_mgmt_req(tree, tvb, offset);
5157     break;
5158   }
5159
5160   return offset - start;  /* Size of fixed fields */
5161 }
5162
5163 static guint
5164 add_ff_action_tdls(proto_tree *tree, tvbuff_t *tvb, int offset)
5165 {
5166   guint8 code;
5167   guint16 status;
5168   guint start = offset;
5169
5170   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5171   code = tvb_get_guint8(tvb, offset);
5172   offset += add_fixed_field(tree, tvb, offset, FIELD_TDLS_ACTION_CODE);
5173   switch (code) {
5174   case TDLS_SETUP_REQUEST:
5175     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5176     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
5177     break;
5178   case TDLS_SETUP_RESPONSE:
5179     status = tvb_get_letohs(tvb, offset);
5180     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5181     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5182     if (tvb_reported_length_remaining(tvb, offset) < 2) {
5183       if (status == 0) {
5184         expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
5185                                "TDLS Setup Response (success) does not "
5186                                "include mandatory fields");
5187       }
5188       break;
5189     }
5190     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
5191     break;
5192   case TDLS_SETUP_CONFIRM:
5193     status = tvb_get_letohs(tvb, offset);
5194     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5195     if (tvb_reported_length_remaining(tvb, offset) < 1) {
5196       if (status == 0) {
5197         expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
5198                                "TDLS Setup Confirm (success) does not include "
5199                                "mandatory fields");
5200       }
5201       break;
5202     }
5203     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5204     break;
5205   case TDLS_TEARDOWN:
5206     offset += add_fixed_field(tree, tvb, offset, FIELD_REASON_CODE);
5207     break;
5208   case TDLS_PEER_TRAFFIC_INDICATION:
5209     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5210     break;
5211   case TDLS_CHANNEL_SWITCH_REQUEST:
5212     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_CHANNEL);
5213     offset += add_fixed_field(tree, tvb, offset, FIELD_REGULATORY_CLASS);
5214     break;
5215   case TDLS_CHANNEL_SWITCH_RESPONSE:
5216     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5217     break;
5218   case TDLS_PEER_PSM_REQUEST:
5219     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5220     break;
5221   case TDLS_PEER_PSM_RESPONSE:
5222     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5223     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5224     break;
5225   case TDLS_PEER_TRAFFIC_RESPONSE:
5226     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5227     break;
5228   case TDLS_DISCOVERY_REQUEST:
5229     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5230     break;
5231   }
5232
5233   return offset - start;  /* Size of fixed fields */
5234 }
5235
5236 static guint
5237 add_ff_action_mgmt_notification(proto_tree *tree, tvbuff_t *tvb, int offset)
5238 {
5239   guint start = offset;
5240
5241   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5242   offset += add_fixed_field(tree, tvb, offset, FIELD_WME_ACTION_CODE);
5243   offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5244   offset += add_fixed_field(tree, tvb, offset, FIELD_WME_STATUS_CODE);
5245
5246   return offset - start;  /* Size of fixed fields */
5247 }
5248
5249 static guint
5250 add_ff_action_vendor_specific(proto_tree *tree, tvbuff_t *tvb, int offset)
5251 {
5252   guint start = offset;
5253   guint32 oui;
5254   guint8 subtype;
5255
5256   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5257   oui = tvb_get_ntoh24(tvb, offset);
5258   proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
5259   offset +=3;
5260   switch (oui) {
5261   case OUI_MARVELL:
5262     offset = dissect_vendor_action_marvell(tree, tvb, offset);
5263     break;
5264   case OUI_WFA:
5265     subtype = tvb_get_guint8(tvb, offset);
5266     proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u", subtype);
5267     offset++;
5268     if (subtype == WFA_SUBTYPE_P2P) {
5269       offset = dissect_wifi_p2p_action(tree, tvb, offset);
5270     }
5271     break;
5272   default:
5273     /* Don't know how to handle this vendor */
5274     break;
5275   }
5276
5277   return offset - start;  /* Size of fixed fields */
5278 }
5279
5280 static guint
5281 add_ff_action_ht(proto_tree *tree, tvbuff_t *tvb, int offset)
5282 {
5283   guint start = offset;
5284   guint8 n_sta, i;
5285   mimo_control_t mimo_cntrl;
5286
5287   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5288   offset += add_fixed_field(tree, tvb, offset, FIELD_HT_ACTION_CODE);
5289
5290   switch (tvb_get_guint8(tvb, offset - 1)) {
5291   case HT_ACTION_NOTIFY_CHAN_WIDTH:
5292     offset += add_fixed_field(tree, tvb, offset, FIELD_CHANNEL_WIDTH);
5293     break;
5294   case HT_ACTION_SM_PWR_SAVE:
5295     offset += add_fixed_field(tree, tvb, offset, FIELD_SM_PWR_CNTRL);
5296     break;
5297   case HT_ACTION_PSMP_ACTION:
5298     n_sta = tvb_get_guint8(tvb, offset);
5299     offset += add_fixed_field(tree, tvb, offset, FIELD_PSMP_PARAM_SET);
5300     for (i = 0; i < (n_sta & 0x0F); i++) {
5301       offset += add_fixed_field(tree, tvb, offset, FIELD_PSMP_STA_INFO);
5302     }
5303     break;
5304   case HT_ACTION_SET_PCO_PHASE:
5305     offset += add_fixed_field(tree, tvb, offset, FIELD_PCO_PHASE_CNTRL);
5306     break;
5307   case HT_ACTION_MIMO_CSI:
5308     mimo_cntrl = get_mimo_control(tvb, offset);
5309     offset += add_fixed_field(tree, tvb, offset, FIELD_MIMO_CNTRL);
5310     offset += add_mimo_csi_matrices_report(tree, tvb, offset, mimo_cntrl);
5311     break;
5312   case HT_ACTION_MIMO_BEAMFORMING:
5313     mimo_cntrl = get_mimo_control(tvb, offset);
5314     offset += add_fixed_field(tree, tvb, offset, FIELD_MIMO_CNTRL);
5315     offset += add_mimo_beamforming_feedback_report(tree, tvb, offset,
5316                                                    mimo_cntrl);
5317     break;
5318   case HT_ACTION_MIMO_COMPRESSED_BEAMFORMING:
5319     mimo_cntrl = get_mimo_control(tvb, offset);
5320     offset += add_fixed_field(tree, tvb, offset, FIELD_MIMO_CNTRL);
5321     offset += add_mimo_compressed_beamforming_feedback_report(tree, tvb,
5322                                                               offset,
5323                                                               mimo_cntrl);
5324     break;
5325   case HT_ACTION_ANT_SEL_FEEDBACK:
5326     offset += add_fixed_field(tree, tvb, offset, FIELD_ANT_SELECTION);
5327     break;
5328   case HT_ACTION_HT_INFO_EXCHANGE:
5329     offset += add_fixed_field(tree, tvb, offset, FIELD_HT_INFORMATION);
5330     break;
5331   }
5332
5333   return offset - start;
5334 }
5335
5336 static guint
5337 add_ff_action(proto_tree *tree, tvbuff_t *tvb, int offset)
5338 {
5339   switch (tvb_get_guint8(tvb, offset) & 0x7f) {
5340   case CAT_SPECTRUM_MGMT:
5341     return add_ff_action_spectrum_mgmt(tree, tvb, offset);
5342   case CAT_QOS:
5343     return add_ff_action_qos(tree, tvb, offset);
5344   case CAT_DLS:
5345     return add_ff_action_dls(tree, tvb, offset);
5346   case CAT_BLOCK_ACK:
5347     return add_ff_action_block_ack(tree, tvb, offset);
5348   case CAT_PUBLIC:
5349     return add_ff_action_public(tree, tvb, offset);
5350   case CAT_FAST_BSS_TRANSITION:
5351     return add_ff_action_fast_bss_transition(tree, tvb, offset);
5352   case CAT_SA_QUERY:
5353     return add_ff_action_sa_query(tree, tvb, offset);
5354   case CAT_MESH:
5355     return add_ff_action_mesh(tree, tvb, offset);
5356   case CAT_MULTIHOP:
5357     return add_ff_action_multihop(tree, tvb, offset);
5358   case CAT_SELF_PROTECTED:
5359     return add_ff_action_self_protected(tree, tvb, offset);
5360   case CAT_WNM:
5361     return add_ff_action_wnm(tree, tvb, offset);
5362   case CAT_TDLS:
5363     return add_ff_action_tdls(tree, tvb, offset);
5364   case CAT_MGMT_NOTIFICATION:  /* Management notification frame */
5365     return add_ff_action_mgmt_notification(tree, tvb, offset);
5366   case CAT_VENDOR_SPECIFIC:  /* Vendor Specific Category */
5367     return add_ff_action_vendor_specific(tree, tvb, offset);
5368   case CAT_HT:
5369     return add_ff_action_ht(tree, tvb, offset);
5370   default:
5371     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5372     return 1;
5373   }
5374 }
5375
5376 static guint
5377 add_ff_ft_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
5378 {
5379   proto_tree_add_item(tree, hf_ieee80211_ff_ft_action_code, tvb, offset, 1,
5380                       ENC_BIG_ENDIAN);
5381   return 1;
5382 }
5383
5384 static guint
5385 add_ff_sta_address(proto_tree *tree, tvbuff_t *tvb, int offset)
5386 {
5387   proto_tree_add_item(tree, hf_ieee80211_ff_sta_address, tvb, offset, 6,
5388                       ENC_NA);
5389   return 6;
5390 }
5391
5392 static guint
5393 add_ff_target_ap_address(proto_tree *tree, tvbuff_t *tvb, int offset)
5394 {
5395   proto_tree_add_item(tree, hf_ieee80211_ff_target_ap_address, tvb, offset, 6,
5396                       ENC_NA);
5397   return 6;
5398 }
5399
5400 static guint
5401 add_ff_gas_comeback_delay(proto_tree *tree, tvbuff_t *tvb, int offset)
5402 {
5403   proto_tree_add_item(tree, hf_ieee80211_ff_gas_comeback_delay, tvb, offset, 2,
5404                       ENC_LITTLE_ENDIAN);
5405   return 2;
5406 }
5407
5408 static guint
5409 add_ff_gas_fragment_id(proto_tree *tree, tvbuff_t *tvb, int offset)
5410 {
5411   proto_tree_add_item(tree, hf_ieee80211_ff_gas_fragment_id, tvb, offset, 1,
5412                       ENC_BIG_ENDIAN);
5413   proto_tree_add_item(tree, hf_ieee80211_ff_more_gas_fragments, tvb, offset, 1,
5414                       ENC_BIG_ENDIAN);
5415   return 1;
5416 }
5417
5418 static guint
5419 add_ff_sa_query_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
5420 {
5421   proto_tree_add_item(tree, hf_ieee80211_ff_sa_query_action_code, tvb, offset,
5422                       1, ENC_BIG_ENDIAN);
5423   return 1;
5424 }
5425
5426 static guint
5427 add_ff_transaction_id(proto_tree *tree, tvbuff_t *tvb, int offset)
5428 {
5429   proto_tree_add_item(tree, hf_ieee80211_ff_transaction_id, tvb, offset, 2,
5430                       ENC_LITTLE_ENDIAN);
5431   return 2;
5432 }
5433
5434 static guint
5435 add_ff_tdls_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
5436 {
5437   guint8 code;
5438   code = tvb_get_guint8(tvb, offset);
5439   col_set_str(g_pinfo->cinfo, COL_INFO,
5440               val_to_str_const(code, tdls_action_codes,
5441                                "Unknown TDLS Action"));
5442   proto_tree_add_item(tree, hf_ieee80211_ff_tdls_action_code, tvb, offset, 1,
5443                       ENC_BIG_ENDIAN);
5444   return 1;
5445 }
5446
5447 static guint
5448 add_ff_target_channel(proto_tree *tree, tvbuff_t *tvb, int offset)
5449 {
5450   proto_tree_add_item(tree, hf_ieee80211_ff_target_channel, tvb, offset, 1,
5451                       ENC_BIG_ENDIAN);
5452   return 1;
5453 }
5454
5455 static guint
5456 add_ff_regulatory_class(proto_tree *tree, tvbuff_t *tvb, int offset)
5457 {
5458   proto_tree_add_item(tree, hf_ieee80211_ff_regulatory_class, tvb, offset, 1,
5459                       ENC_BIG_ENDIAN);
5460   return 1;
5461 }
5462
5463 static guint
5464 add_ff_wnm_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
5465 {
5466   guint8 code;
5467   code = tvb_get_guint8(tvb, offset);
5468   col_set_str(g_pinfo->cinfo, COL_INFO,
5469               val_to_str_const(code, wnm_action_codes,
5470                                "Unknown WNM Action"));
5471   proto_tree_add_item(tree, hf_ieee80211_ff_wnm_action_code, tvb, offset, 1,
5472                       ENC_BIG_ENDIAN);
5473   return 1;
5474 }
5475
5476 struct ieee80211_fixed_field_dissector {
5477   enum fixed_field lfcode;
5478   guint (*dissector)(proto_tree *tree, tvbuff_t *tvb, int offset);
5479 };
5480
5481 #define FF_FIELD(f, func) { FIELD_ ## f, add_ff_ ## func }
5482
5483 static const struct ieee80211_fixed_field_dissector ff_dissectors[] = {
5484   FF_FIELD(TIMESTAMP, timestamp),
5485   FF_FIELD(BEACON_INTERVAL, beacon_interval),
5486   FF_FIELD(CAP_INFO, cap_info),
5487   FF_FIELD(AUTH_ALG, auth_alg),
5488   FF_FIELD(AUTH_TRANS_SEQ, auth_trans_seq),
5489   FF_FIELD(CURRENT_AP_ADDR, current_ap_addr),
5490   FF_FIELD(LISTEN_IVAL, listen_ival),
5491   FF_FIELD(REASON_CODE, reason_code),
5492   FF_FIELD(ASSOC_ID, assoc_id),
5493   FF_FIELD(STATUS_CODE, status_code),
5494   FF_FIELD(CATEGORY_CODE, category_code),
5495   FF_FIELD(ACTION_CODE, action_code),
5496   FF_FIELD(DIALOG_TOKEN, dialog_token),
5497   FF_FIELD(WME_ACTION_CODE, wme_action_code),
5498   FF_FIELD(WME_STATUS_CODE, wme_status_code),
5499   FF_FIELD(QOS_ACTION_CODE, qos_action_code),
5500   FF_FIELD(BLOCK_ACK_ACTION_CODE, block_ack_action_code),
5501   FF_FIELD(BLOCK_ACK_PARAM, block_ack_param),
5502   FF_FIELD(BLOCK_ACK_TIMEOUT, block_ack_timeout),
5503   FF_FIELD(BLOCK_ACK_SSC, block_ack_ssc),
5504   FF_FIELD(QOS_TS_INFO, qos_ts_info),
5505   FF_FIELD(MESH_ACTION, mesh_action),
5506   FF_FIELD(MULTIHOP_ACTION, multihop_action),
5507   FF_FIELD(MESH_CONTROL, mesh_control),
5508   FF_FIELD(SELFPROT_ACTION, selfprot_action),
5509   FF_FIELD(DLS_ACTION_CODE, dls_action_code),
5510   FF_FIELD(DST_MAC_ADDR, dst_mac_addr),
5511   FF_FIELD(SRC_MAC_ADDR, src_mac_addr),
5512   FF_FIELD(DLS_TIMEOUT, dls_timeout),
5513   FF_FIELD(DELBA_PARAM_SET, delba_param_set),
5514   FF_FIELD(MAX_REG_PWR, max_reg_pwr),
5515   FF_FIELD(MEASUREMENT_PILOT_INT, measurement_pilot_int),
5516   FF_FIELD(COUNTRY_STR, country_str),
5517   FF_FIELD(MAX_TX_PWR, max_tx_pwr),
5518   FF_FIELD(TX_PWR_USED, tx_pwr_used),
5519   FF_FIELD(TRANSCEIVER_NOISE_FLOOR, transceiver_noise_floor),
5520   FF_FIELD(CHANNEL_WIDTH, channel_width),
5521   FF_FIELD(QOS_INFO_AP, qos_info_ap),
5522   FF_FIELD(QOS_INFO_STA, qos_info_sta),
5523   FF_FIELD(SM_PWR_CNTRL, sm_pwr_cntrl),
5524   FF_FIELD(PCO_PHASE_CNTRL, pco_phase_cntrl),
5525   FF_FIELD(PSMP_PARAM_SET, psmp_param_set),
5526   FF_FIELD(MIMO_CNTRL, mimo_cntrl),
5527   FF_FIELD(ANT_SELECTION, ant_selection),
5528   FF_FIELD(EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT,
5529            extended_channel_switch_announcement),
5530   FF_FIELD(HT_INFORMATION, ht_information),
5531   FF_FIELD(HT_ACTION_CODE, ht_action_code),
5532   FF_FIELD(PSMP_STA_INFO, psmp_sta_info),
5533   FF_FIELD(SCHEDULE_INFO, schedule_info),
5534   FF_FIELD(PA_ACTION_CODE, pa_action_code),
5535   FF_FIELD(ACTION, action),
5536   FF_FIELD(FT_ACTION_CODE, ft_action_code),
5537   FF_FIELD(STA_ADDRESS, sta_address),
5538   FF_FIELD(TARGET_AP_ADDRESS, target_ap_address),
5539   FF_FIELD(GAS_COMEBACK_DELAY, gas_comeback_delay),
5540   FF_FIELD(GAS_FRAGMENT_ID, gas_fragment_id),
5541   FF_FIELD(SA_QUERY_ACTION_CODE, sa_query_action_code),
5542   FF_FIELD(TRANSACTION_ID, transaction_id),
5543   FF_FIELD(TDLS_ACTION_CODE, tdls_action_code),
5544   FF_FIELD(TARGET_CHANNEL, target_channel),
5545   FF_FIELD(REGULATORY_CLASS, regulatory_class),
5546   FF_FIELD(WNM_ACTION_CODE, wnm_action_code),
5547   { -1, NULL }
5548 };
5549
5550 #undef FF_FIELD
5551
5552 static guint
5553 add_fixed_field(proto_tree *tree, tvbuff_t *tvb, int offset,
5554                 enum fixed_field lfcode)
5555 {
5556   int i;
5557   for (i = 0; ff_dissectors[i].dissector; i++) {
5558     if (ff_dissectors[i].lfcode == lfcode) {
5559       return ff_dissectors[i].dissector(tree, tvb, offset);
5560     }
5561   }
5562   return 0;
5563 }
5564
5565 static const value_string ieee80211_rsn_cipher_vals[] =
5566 {
5567   {0, "NONE"},
5568   {1, "WEP (40-bit)"},
5569   {2, "TKIP"},
5570   {3, "AES (OCB)"},
5571   {4, "AES (CCM)"},
5572   {5, "WEP (104-bit)"},
5573   {6, "BIP"},
5574   {7, "Group addressed traffic not allowed"},
5575   {0, NULL}
5576 };
5577
5578 static const value_string ieee80211_rsn_keymgmt_vals[] =
5579 {
5580   {0, "NONE"},
5581   {1, "WPA"},
5582   {2, "PSK"},
5583   {3, "FT over IEEE 802.1X"},
5584   {4, "FT using PSK"},
5585   {5, "WPA (SHA256)"},
5586   {6, "PSK (SHA256)"},
5587   {7, "TDLS / TPK Handshake"},
5588   {0, NULL}
5589 };
5590
5591 static void
5592 oui_base_custom(gchar *result, guint32 oui)
5593 {
5594   guint8 p_oui[3];
5595   const gchar *manuf_name;
5596   p_oui[0] = oui >> 16 & 0xFF;
5597   p_oui[1] = oui >> 8 & 0xFF;
5598   p_oui[2] = oui & 0xFF;
5599
5600   /* Attempt an OUI lookup. */
5601   manuf_name = get_manuf_name_if_known(p_oui);
5602   if (manuf_name == NULL) {
5603       /* Could not find an OUI. */
5604       g_snprintf(result, ITEM_LABEL_LENGTH, "%.2x-%.2x-%.2x", p_oui[0], p_oui[1], p_oui[2] );
5605   }
5606   else {
5607       /* Found an address string. */
5608       g_snprintf(result, ITEM_LABEL_LENGTH, "%.2x-%.2x-%.2x (%s)", p_oui[0], p_oui[1], p_oui[2], manuf_name );
5609   }
5610 }
5611 static void
5612 rsn_gcs_base_custom(gchar *result, guint32 gcs)
5613 {
5614   gchar *oui_result=NULL;
5615   oui_result = ep_alloc(SHORT_STR);
5616   oui_result[0] = '\0';
5617   oui_base_custom(oui_result, gcs >> 8);
5618   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( gcs & 0xFF, ieee80211_rsn_cipher_vals, "Unknown %d") );
5619 }
5620
5621 static void
5622 rsn_pcs_base_custom(gchar *result, guint32 pcs)
5623 {
5624   gchar *oui_result=NULL;
5625   oui_result = ep_alloc(SHORT_STR);
5626   oui_result[0] = '\0';
5627   oui_base_custom(oui_result, pcs >> 8);
5628   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( pcs & 0xFF, ieee80211_rsn_cipher_vals, "Unknown %d") );
5629
5630 }
5631 static void
5632 rsn_akms_base_custom(gchar *result, guint32 akms)
5633 {
5634   gchar *oui_result=NULL;
5635   oui_result = ep_alloc(SHORT_STR);
5636   oui_result[0] = '\0';
5637   oui_base_custom(oui_result, akms >> 8);
5638   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( akms & 0xFF, ieee80211_rsn_keymgmt_vals, "Unknown %d") );
5639 }
5640
5641 static gchar *
5642 rsn_pcs_return(guint32 pcs)
5643 {
5644   gchar *result=NULL;
5645   result = ep_alloc(SHORT_STR);
5646   result[0] = '\0';
5647   rsn_pcs_base_custom(result, pcs);
5648
5649   return result;
5650 }
5651
5652 static gchar *
5653 rsn_akms_return(guint32 akms)
5654 {
5655   gchar *result=NULL;
5656   result = ep_alloc(SHORT_STR);
5657   result[0] = '\0';
5658   rsn_akms_base_custom(result, akms);
5659
5660   return result;
5661 }
5662
5663 static void
5664 rsn_gmcs_base_custom(gchar *result, guint32 gmcs)
5665 {
5666   gchar *oui_result=NULL;
5667   oui_result = ep_alloc(SHORT_STR);
5668   oui_result[0] = '\0';
5669   oui_base_custom(oui_result, gmcs >> 8);
5670   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( gmcs & 0xFF, ieee80211_rsn_cipher_vals, "Unknown %d") );
5671 }
5672
5673 /* WPA / WME */
5674 static const value_string ieee802111_wfa_ie_type_vals[] =
5675 {
5676   { 1, "WPA Information Element" },
5677   { 2, "WMM/WME" },
5678   { 4, "WPS" },
5679   { 0, NULL }
5680 };
5681
5682 static const value_string ieee80211_wfa_ie_wpa_cipher_vals[] =
5683 {
5684   { 0, "NONE" },
5685   { 1, "WEP (40-bit)" },
5686   { 2, "TKIP" },
5687   { 3, "AES (OCB)" },
5688   { 4, "AES (CCM)" },
5689   { 5, "WEP (104-bit)" },
5690   { 6, "BIP" },
5691   { 7, "Group addressed traffic not allowed" },
5692   { 0, NULL }
5693 };
5694
5695 static const value_string ieee80211_wfa_ie_wpa_keymgmt_vals[] =
5696 {
5697   { 0, "NONE" },
5698   { 1, "WPA" },
5699   { 2, "PSK" },
5700   { 3, "FT over IEEE 802.1X" },
5701   { 4, "FT using PSK" },
5702   { 5, "WPA (SHA256)" },
5703   { 6, "PSK (SHA256)" },
5704   { 7, "TDLS / TPK Handshake" },
5705   { 0, NULL }
5706 };
5707
5708 static const value_string ieee80211_wfa_ie_wme_acs_vals[] = {
5709   { 0, "Best Effort" },
5710   { 1, "Background" },
5711   { 2, "Video" },
5712   { 3, "Voice" },
5713   { 0, NULL }
5714 };
5715
5716 static const value_string ieee80211_wfa_ie_wme_tspec_tsinfo_direction_vals[] = {
5717   { 0, "Uplink" },
5718   { 1, "Downlink" },
5719   { 2, "Direct link" },
5720   { 3, "Bidirectional link" },
5721   { 0, NULL }
5722 };
5723
5724 static const value_string ieee80211_wfa_ie_wme_tspec_tsinfo_psb_vals[] = {
5725   { 0, "Legacy" },
5726   { 1, "U-APSD" },
5727   { 0, NULL }
5728 };
5729
5730 static const value_string ieee80211_wfa_ie_wme_tspec_tsinfo_up_vals[] = {
5731   { 0, "Best Effort" },
5732   { 1, "Background" },
5733   { 2, "Spare" },
5734   { 3, "Excellent Effort" },
5735   { 4, "Controlled Load" },
5736   { 5, "Video" },
5737   { 6, "Voice" },
5738   { 7, "Network Control" },
5739   { 0, NULL }
5740 };
5741
5742 static const value_string ieee802111_wfa_ie_wme_qos_info_sta_max_sp_length_vals[] = {
5743   { 0, "WMM AP may deliver all buffered frames (MSDUs and MMPDUs)" },
5744   { 1, "WMM AP may deliver a maximum of 2 buffered frames (MSDUs and MMPDUs) per USP" },
5745   { 2, "WMM AP may deliver a maximum of 4 buffered frames (MSDUs and MMPDUs) per USP" },
5746   { 3, "WMM AP may deliver a maximum of 6 buffered frames (MSDUs and MMPDUs) per USP" },
5747   { 0, NULL}
5748 };
5749 static const true_false_string ieee802111_wfa_ie_wme_qos_info_sta_ac_tfs = { "WMM delivery and trigger enabled", "non-WMM PS" };
5750
5751 static void
5752 wpa_mcs_base_custom(gchar *result, guint32 mcs)
5753 {
5754   gchar *oui_result=NULL;
5755   oui_result = ep_alloc(SHORT_STR);
5756   oui_result[0] = '\0';
5757   oui_base_custom(oui_result, mcs >> 8);
5758   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( mcs & 0xFF, ieee80211_wfa_ie_wpa_cipher_vals, "Unknown %d") );
5759 }
5760
5761 static void
5762 wpa_ucs_base_custom(gchar *result, guint32 ucs)
5763 {
5764   gchar *oui_result=NULL;
5765   oui_result = ep_alloc(SHORT_STR);
5766   oui_result[0] = '\0';
5767   oui_base_custom(oui_result, ucs >> 8);
5768   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( ucs & 0xFF, ieee80211_wfa_ie_wpa_cipher_vals, "Unknown %d") );
5769
5770 }
5771 static void
5772 wpa_akms_base_custom(gchar *result, guint32 akms)
5773 {
5774   gchar *oui_result=NULL;
5775   oui_result = ep_alloc(SHORT_STR);
5776   oui_result[0] = '\0';
5777   oui_base_custom(oui_result, akms >> 8);
5778   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( akms & 0xFF, ieee80211_wfa_ie_wpa_keymgmt_vals, "Unknown %d") );
5779 }
5780
5781 static gchar *
5782 wpa_ucs_return(guint32 ucs)
5783 {
5784   gchar *result=NULL;
5785   result = ep_alloc(SHORT_STR);
5786   result[0] = '\0';
5787   wpa_ucs_base_custom(result, ucs);
5788
5789   return result;
5790 }
5791
5792 static gchar *
5793 wpa_akms_return(guint32 akms)
5794 {
5795   gchar *result=NULL;
5796   result = ep_alloc(SHORT_STR);
5797   result[0] = '\0';
5798   wpa_akms_base_custom(result, akms);
5799
5800   return result;
5801 }
5802
5803 static const value_string ieee802111_wfa_ie_wme_type[] =
5804 {
5805   { 0, "Information Element" },
5806   { 1, "Parameter Element" },
5807   { 2, "TSPEC Element" },
5808   { 0, NULL}
5809 };
5810
5811 static const value_string ft_subelem_id_vals[] =
5812 {
5813   {0, "Reserved"},
5814   {1, "PMK-R1 key holder identifier (R1KH-ID)"},
5815   {2, "GTK subelement"},
5816   {3, "PMK-R0 key holder identifier (R0KH-ID)"},
5817   {4, "IGTK"},
5818   {0, NULL}
5819 };
5820
5821 static int dissect_qos_info(proto_tree * tree, tvbuff_t *tvb, int offset, int ftype)
5822 {
5823   proto_tree *qos_info_tree;
5824   proto_item *qos_info_item;
5825   qos_info_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_qos_info, tvb, offset, 1, ENC_NA);
5826   qos_info_tree = proto_item_add_subtree(qos_info_item, ett_wme_qos_info);
5827
5828   switch(ftype){
5829     case MGT_ASSOC_REQ:
5830     case MGT_PROBE_REQ:
5831     case MGT_REASSOC_REQ:
5832     {
5833       /* To AP so decode as per WMM standard Figure 7 QoS Info field when sent from WMM STA*/
5834       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_max_sp_length, tvb, offset, 1, ENC_NA);
5835       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_be, tvb, offset, 1, ENC_NA);
5836       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_bk, tvb, offset, 1, ENC_NA);
5837       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vi, tvb, offset, 1, ENC_NA);
5838       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vo, tvb, offset, 1, ENC_NA);
5839       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_reserved, tvb, offset, 1, ENC_NA);
5840       break;
5841     }
5842     case MGT_BEACON:
5843     case MGT_PROBE_RESP:
5844     case MGT_ASSOC_RESP:
5845     case MGT_REASSOC_RESP:
5846     {
5847       /* From AP so decode as per WMM standard Figure 6 QoS Info field when sent from WMM AP */
5848       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_ap_u_apsd, tvb, offset, 1, ENC_NA);
5849       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_ap_parameter_set_count, tvb, offset, 1, ENC_NA);
5850       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_ap_reserved, tvb, offset, 1, ENC_NA);
5851       break;
5852     }
5853     default:
5854         expert_add_info_format(g_pinfo, qos_info_item, PI_UNDECODED, PI_WARN, "Could not deduce direction to decode correctly, ftype %u", ftype);
5855       break;
5856     }
5857
5858   offset += 1;
5859   return offset;
5860 }
5861
5862 static int
5863 dissect_vendor_ie_wpawme(proto_tree * tree, tvbuff_t * tvb, int offset, guint32 tag_len, int ftype)
5864 {
5865   guint8 type;
5866
5867   proto_tree_add_item(tree, hf_ieee80211_wfa_ie_type, tvb, offset, 1, ENC_NA);
5868   type = tvb_get_guint8(tvb, offset);
5869   proto_item_append_text(tree, ": %s", val_to_str(type, ieee802111_wfa_ie_type_vals, "Unknown %d" ));
5870   offset += 1;
5871
5872   switch(type){
5873     case 1:   /* Wi-Fi Protected Access (WPA) */
5874     {
5875       proto_item *wpa_mcs_item, *wpa_ucs_item, *wpa_akms_item;
5876       proto_item *wpa_sub_ucs_item, *wpa_sub_akms_item;
5877       proto_tree *wpa_mcs_tree, *wpa_ucs_tree, *wpa_akms_tree;
5878       proto_tree *wpa_sub_ucs_tree, *wpa_sub_akms_tree;
5879       guint16 ucs_count, akms_count;
5880       guint i;
5881
5882       proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_version, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5883       offset += 2;
5884
5885       /* Multicast Cipher Suite */
5886       wpa_mcs_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_mcs, tvb, offset, 4, ENC_BIG_ENDIAN);
5887       wpa_mcs_tree = proto_item_add_subtree(wpa_mcs_item, ett_wpa_mcs_tree);
5888       proto_tree_add_item(wpa_mcs_tree, hf_ieee80211_wfa_ie_wpa_mcs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
5889
5890       /* Check if OUI is 00:50:F2 (WFA) */
5891       if(tvb_get_ntoh24(tvb, offset) == 0x0050F2)
5892       {
5893         proto_tree_add_item(wpa_mcs_tree, hf_ieee80211_wfa_ie_wpa_mcs_wfa_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5894       } else {
5895         proto_tree_add_item(wpa_mcs_tree, hf_ieee80211_wfa_ie_wpa_mcs_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5896       }
5897       offset += 4;
5898
5899       /* Unicast Cipher Suites */
5900       proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_ucs_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5901       ucs_count = tvb_get_letohs(tvb, offset);
5902       offset += 2;
5903
5904       wpa_ucs_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_ucs_list, tvb, offset, ucs_count * 4, ENC_NA);
5905       wpa_ucs_tree = proto_item_add_subtree(wpa_ucs_item, ett_wpa_ucs_tree);
5906       for(i = 1; i <= ucs_count; i++)
5907       {
5908         wpa_sub_ucs_item = proto_tree_add_item(wpa_ucs_tree, hf_ieee80211_wfa_ie_wpa_ucs, tvb, offset, 4, ENC_BIG_ENDIAN);
5909         wpa_sub_ucs_tree = proto_item_add_subtree(wpa_sub_ucs_item, ett_wpa_sub_ucs_tree);
5910         proto_tree_add_item(wpa_sub_ucs_tree, hf_ieee80211_wfa_ie_wpa_ucs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
5911
5912         /* Check if OUI is 00:50:F2 (WFA) */
5913         if(tvb_get_ntoh24(tvb, offset) == 0x0050F2)
5914         {
5915           proto_tree_add_item(wpa_sub_ucs_tree, hf_ieee80211_wfa_ie_wpa_ucs_wfa_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5916           proto_item_append_text(wpa_ucs_item, " %s", wpa_ucs_return(tvb_get_ntohl(tvb, offset)));
5917         } else {
5918           proto_tree_add_item(wpa_sub_ucs_tree, hf_ieee80211_wfa_ie_wpa_ucs_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5919         }
5920         offset += 4;
5921       }
5922
5923       /* Authenticated Key Management Suites */
5924       proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_akms_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5925       akms_count = tvb_get_letohs(tvb, offset);
5926       offset += 2;
5927
5928       wpa_akms_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_akms_list, tvb, offset, akms_count * 4, ENC_NA);
5929       wpa_akms_tree = proto_item_add_subtree(wpa_akms_item, ett_wpa_akms_tree);
5930       for(i = 1; i <= akms_count; i++)
5931       {
5932         wpa_sub_akms_item = proto_tree_add_item(wpa_akms_tree, hf_ieee80211_wfa_ie_wpa_akms, tvb, offset, 4, ENC_BIG_ENDIAN);
5933         wpa_sub_akms_tree = proto_item_add_subtree(wpa_sub_akms_item, ett_wpa_sub_akms_tree);
5934         proto_tree_add_item(wpa_sub_akms_tree, hf_ieee80211_wfa_ie_wpa_akms_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
5935
5936         /* Check if OUI is 00:50:F2 (WFA) */
5937         if(tvb_get_ntoh24(tvb, offset) == 0x0050F2)
5938         {
5939           proto_tree_add_item(wpa_sub_akms_tree, hf_ieee80211_wfa_ie_wpa_akms_wfa_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5940           proto_item_append_text(wpa_akms_item, " %s", wpa_akms_return(tvb_get_ntohl(tvb, offset)));
5941         } else {
5942           proto_tree_add_item(wpa_sub_akms_tree, hf_ieee80211_wfa_ie_wpa_akms_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5943         }
5944         offset += 4;
5945       }
5946       break;
5947     }
5948     case 2:   /* Wireless Multimedia Enhancements (WME) */
5949     {
5950       guint8 subtype;
5951
5952       proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_subtype, tvb, offset, 1, ENC_NA);
5953       subtype = tvb_get_guint8(tvb, offset);
5954       proto_item_append_text(tree, ": %s", val_to_str(subtype, ieee802111_wfa_ie_wme_type, "Unknown %d" ));
5955       offset += 1;
5956       switch(subtype){
5957         case 0: /* WME Information Element */
5958         {
5959           proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_version, tvb, offset, 1, ENC_NA);
5960           offset += 1;
5961           /* WME QoS Info Field */
5962           offset = dissect_qos_info(tree, tvb, offset, ftype);
5963           break;
5964         }
5965         case 1: /* WME Parameter Element */
5966         {
5967           int i;
5968           proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_version, tvb, offset, 1, ENC_NA);
5969           offset += 1;
5970           /* WME QoS Info Field */
5971           offset = dissect_qos_info(tree, tvb, offset, ftype);
5972           proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_reserved, tvb, offset, 1, ENC_NA);
5973           offset += 1;
5974           /* AC Parameters */
5975           for(i = 0; i < 4; i++)
5976           {
5977             proto_item *ac_item, *aci_aifsn_item, *ecw_item;
5978             proto_tree *ac_tree, *aci_aifsn_tree, *ecw_tree;
5979             guint8 aci_aifsn, ecw;
5980
5981             ac_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_ac_parameters, tvb, offset, 4, ENC_NA);
5982             ac_tree = proto_item_add_subtree(ac_item, ett_wme_ac);
5983
5984             /* ACI/AIFSN Field */
5985             aci_aifsn_item = proto_tree_add_item(ac_tree, hf_ieee80211_wfa_ie_wme_acp_aci_aifsn, tvb, offset, 1, ENC_NA);
5986             aci_aifsn_tree = proto_item_add_subtree(aci_aifsn_item, ett_wme_aci_aifsn);
5987             proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_aci, tvb, offset, 1, ENC_NA);
5988             proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_acm, tvb, offset, 1, ENC_NA);
5989             proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_aifsn, tvb, offset, 1, ENC_NA);
5990             proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_reserved, tvb, offset, 1, ENC_NA);
5991             aci_aifsn = tvb_get_guint8(tvb, offset);
5992             proto_item_append_text(ac_item, " ACI %u (%s), ACM %s, AIFSN %u",
5993             (aci_aifsn & 0x60) >> 5, match_strval((aci_aifsn & 0x60) >> 5, ieee80211_wfa_ie_wme_acs_vals),
5994             (aci_aifsn & 0x10) ? "yes" : "no ", aci_aifsn & 0x0f);
5995             offset += 1;
5996
5997             /* ECWmin/ECWmax field */
5998             ecw_item = proto_tree_add_item(ac_tree, hf_ieee80211_wfa_ie_wme_acp_ecw, tvb, offset, 1, ENC_NA);
5999             ecw_tree = proto_item_add_subtree(ecw_item, ett_wme_ecw);
6000             proto_tree_add_item(ecw_tree, hf_ieee80211_wfa_ie_wme_acp_ecw_max, tvb, offset, 1, ENC_NA);
6001             proto_tree_add_item(ecw_tree, hf_ieee80211_wfa_ie_wme_acp_ecw_min, tvb, offset, 1, ENC_NA);
6002             ecw = tvb_get_guint8(tvb, offset);
6003             proto_item_append_text(ac_item, ", ECWmin %u ,ECWmax %u", ecw & 0x0f, (ecw & 0xf0) >> 4 );
6004             offset += 1;
6005
6006             /* TXOP Limit */
6007             proto_tree_add_item(ac_tree, hf_ieee80211_wfa_ie_wme_acp_txop_limit, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6008             proto_item_append_text(ac_item, ", TXOP %u", tvb_get_letohs(tvb, offset));
6009             offset += 2;
6010           }
6011           break;
6012         }
6013         case 3:   /* WME TSPEC Element */
6014         {
6015
6016             proto_item *tsinfo_item;
6017             proto_tree *tsinfo_tree;
6018
6019             tsinfo_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6020             tsinfo_tree = proto_item_add_subtree(tsinfo_item, ett_tsinfo_tree);
6021
6022             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_tid, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6023             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_direction, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6024             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_psb, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6025             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_up, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6026             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_reserved, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6027             offset += 3;
6028
6029             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_nor_msdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6030             offset += 2;
6031
6032             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_max_msdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6033             offset += 2;
6034
6035             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_min_srv, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6036             offset += 4;
6037
6038             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_max_srv, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6039             offset += 4;
6040
6041             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_inact_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6042             offset += 4;
6043
6044             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_susp_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6045             offset += 4;
6046
6047             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_srv_start, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6048             offset += 4;
6049
6050             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_min_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6051             offset += 4;
6052
6053             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_mean_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6054             offset += 4;
6055
6056             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_peak_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6057             offset += 4;
6058
6059             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_burst_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6060             offset += 4;
6061
6062             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_delay_bound, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6063             offset += 4;
6064
6065             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_min_phy, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6066             offset += 4;
6067
6068             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_surplus, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6069             offset += 2;
6070
6071             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_medium, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6072             offset += 2;
6073
6074           break;
6075         }
6076         default:
6077           /* No default Action */
6078         break;
6079       } /* End switch(subtype) */
6080       break;
6081     }
6082     case 4: /* WPS: Wifi Protected Setup */
6083     {
6084       dissect_wps_tlvs(tree, tvb, offset, tag_len-4, NULL);
6085     }
6086     break;
6087     default:
6088       /* No default Action...*/
6089     break;
6090   } /* End switch(type) */
6091
6092   return offset;
6093 }
6094
6095 static void
6096 dissect_vendor_ie_wfa(packet_info *pinfo, proto_item *item, tvbuff_t *tag_tvb)
6097 {
6098   gint tag_len = tvb_length(tag_tvb);
6099
6100   if (tag_len < 4)
6101     return;
6102
6103   switch (tvb_get_guint8(tag_tvb, 3)) {
6104   case WFA_SUBTYPE_P2P:
6105     dissect_wifi_p2p_ie(pinfo, item, tag_tvb, 4, tag_len - 4);
6106     proto_item_append_text(item, ": P2P");
6107     break;
6108   }
6109 }
6110
6111 static void
6112 dissect_vendor_ie_rsn(proto_item * item, proto_tree * tree, tvbuff_t * tag_tvb)
6113 {
6114   guint tag_off = 0;
6115   guint tag_len = tvb_length(tag_tvb);
6116   guint pmkid_len = tag_len - 4;
6117   char out_buff[SHORT_STR], valid_str[SHORT_STR] = "";
6118
6119   if (tag_len >= 4 && !tvb_memeql(tag_tvb, tag_off, RSN_OUI"\x04", 4)) {
6120     /* IEEE 802.11i / Key Data Encapsulation / Data Type=4 - PMKID.
6121      * This is only used within EAPOL-Key frame Key Data. */
6122     if (pmkid_len != PMKID_LEN) {
6123       g_snprintf(valid_str, SHORT_STR,
6124         "(invalid PMKID len=%d, expected 16) ", pmkid_len);
6125     }
6126     g_snprintf(out_buff, SHORT_STR, "RSN PMKID: %s%s", valid_str,
6127       tvb_bytes_to_str(tag_tvb, 4, pmkid_len));
6128     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 0,
6129       tag_len, out_buff);
6130   }
6131   proto_item_append_text(item, ": RSN");
6132 }
6133
6134 typedef enum {
6135   MARVELL_IE_MESH = 4
6136 } marvell_ie_type_t;
6137
6138 static void
6139 dissect_vendor_ie_marvell(proto_item * item _U_, proto_tree * ietree,
6140                           tvbuff_t * tvb, int offset, guint32 tag_len)
6141 {
6142   guint8 type;
6143
6144   type = tvb_get_guint8(tvb, offset);
6145   proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6146   offset += 1;
6147
6148   switch (type) {
6149   case MARVELL_IE_MESH:
6150     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_subtype, tvb,
6151                          offset++, 1, ENC_LITTLE_ENDIAN );
6152     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_version, tvb,
6153                          offset++, 1, ENC_LITTLE_ENDIAN );
6154     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_active_proto_id, tvb,
6155                          offset++, 1, ENC_LITTLE_ENDIAN );
6156     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_active_metric_id, tvb,
6157                          offset++, 1, ENC_LITTLE_ENDIAN );
6158     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_cap, tvb,
6159                          offset++, 1, ENC_LITTLE_ENDIAN );
6160     break;
6161
6162   default:
6163     proto_tree_add_item(ietree, hf_ieee80211_marvell_ie_data, tvb, offset,
6164       tag_len - 1, ENC_NA);
6165     break;
6166   }
6167 }
6168
6169 typedef enum {
6170   ATHEROS_IE_ADVCAP = 1,
6171   ATHEROS_IE_XR = 3
6172 } atheros_ie_type_t;
6173
6174 typedef enum {
6175   ATHEROS_IE_ADVCAP_S = 1
6176 } atheros_ie_advcap_subtype_t;
6177
6178 typedef enum {
6179   ATHEROS_IE_XR_S = 1
6180 } atheros_ie_xr_subtype_t;
6181
6182 typedef enum {
6183   ATHEROS_IE_CAP_TURBOP = 0x01,
6184   ATHEROS_IE_CAP_COMP = 0x02,
6185   ATHEROS_IE_CAP_FF = 0x04,
6186   ATHEROS_IE_CAP_XR = 0x08,
6187   ATHEROS_IE_CAP_AR = 0x10,
6188   ATHEROS_IE_CAP_BURST = 0x20,
6189   ATHEROS_IE_CAP_WME = 0x40,
6190   ATHEROS_IE_CAP_BOOST = 0x80
6191 } atheros_ie_cap_t;
6192
6193 static const value_string atheros_ie_type_vals[] = {
6194   { ATHEROS_IE_ADVCAP, "Advanced Capability"},
6195   { ATHEROS_IE_XR,     "eXtended Range"},
6196   { 0,                 NULL }
6197 };
6198
6199 static void
6200 dissect_vendor_ie_atheros_cap(proto_item * item _U_, tvbuff_t *tvb, int offset)
6201 {
6202   proto_tree *cap_tree;
6203
6204   cap_tree = proto_item_add_subtree(item, ett_ath_cap_tree);
6205
6206   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_turbop, tvb, offset, 1, ENC_NA);
6207   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_comp, tvb, offset, 1, ENC_NA);
6208   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_ff, tvb, offset, 1, ENC_NA);
6209   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_xr, tvb, offset, 1, ENC_NA);
6210   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_ar, tvb, offset, 1, ENC_NA);
6211   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_burst, tvb, offset, 1, ENC_NA);
6212   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_wme, tvb, offset, 1, ENC_NA);
6213   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_boost, tvb, offset, 1, ENC_NA);
6214
6215 }
6216
6217 static void
6218 dissect_vendor_ie_atheros(proto_item * item _U_, proto_tree * ietree,
6219                           tvbuff_t * tvb, int offset, guint tag_len,
6220                           packet_info * pinfo, proto_item *ti_len)
6221 {
6222   guint8 type;
6223   guint8 subtype;
6224   guint8 version;
6225   proto_item *cap_item;
6226   proto_item *ti;
6227
6228   if (tag_len <= 3) {
6229         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 6", tag_len+3); /* Add length of OUI to tag_length */
6230         return;
6231   }
6232   proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_type, tvb, offset, 1, ENC_NA);
6233   type = tvb_get_guint8(tvb, offset);
6234   proto_item_append_text(item, ": %s", val_to_str(type, atheros_ie_type_vals, "Unknown"));
6235   offset += 1;
6236   tag_len -= 1;
6237
6238   proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_subtype, tvb, offset, 1, ENC_NA);
6239   subtype = tvb_get_guint8(tvb, offset);
6240   offset += 1;
6241   tag_len -= 1;
6242
6243   proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_version, tvb, offset, 1, ENC_NA);
6244   version = tvb_get_guint8(tvb, offset);
6245   offset += 1;
6246   tag_len -= 1;
6247
6248   if(version == 0)
6249   {
6250     switch(type){
6251       case ATHEROS_IE_ADVCAP:
6252       {
6253         switch(subtype){
6254           case ATHEROS_IE_ADVCAP_S:
6255           {
6256             cap_item = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_advcap_cap, tvb, offset, 1, ENC_NA);
6257             dissect_vendor_ie_atheros_cap(cap_item, tvb, offset);
6258             offset += 1;
6259             tag_len -= 1;
6260
6261             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_advcap_defkey, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6262             offset += 2;
6263             tag_len -= 2;
6264             break;
6265           }
6266           default:
6267           /* No default Action */
6268           break;
6269         } /* End switch(subtype) */
6270         break;
6271       }
6272       case ATHEROS_IE_XR:
6273       {
6274         switch(subtype){
6275           case ATHEROS_IE_XR_S:
6276           {
6277             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_info, tvb, offset, 1, ENC_NA);
6278             offset += 1;
6279             tag_len -= 1;
6280
6281             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_base_bssid, tvb, offset, 6, ENC_NA);
6282             offset += 6;
6283             tag_len -= 6;
6284
6285             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_xr_bssid, tvb, offset, 6, ENC_NA);
6286             offset += 6;
6287             tag_len -= 6;
6288
6289             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_xr_beacon, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6290             offset += 2;
6291             tag_len -= 2;
6292
6293             cap_item = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_base_cap, tvb, offset, 1, ENC_NA);
6294             dissect_vendor_ie_atheros_cap(cap_item, tvb, offset);
6295             offset += 1;
6296             tag_len -= 1;
6297
6298             cap_item = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_xr_cap, tvb, offset, 1, ENC_NA);
6299             dissect_vendor_ie_atheros_cap(cap_item, tvb, offset);
6300             offset += 1;
6301             tag_len -= 1;
6302             break;
6303           }
6304           default:
6305           /* No default Action */
6306           break;
6307         } /* End switch(subtype) */
6308         break;
6309         default:
6310         /* No default Action */
6311         break;
6312       } /* End switch(type) */
6313
6314     }
6315   }
6316   if(tag_len > 0 ){
6317    ti = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_data, tvb, offset, tag_len, ENC_NA);
6318    expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown Data (not interpreted)");
6319   }
6320 }
6321
6322 typedef enum {
6323   AIRONET_IE_VERSION = 3,
6324   AIRONET_IE_QOS,
6325   AIRONET_IE_QBSS_V2 = 14
6326 } aironet_ie_type_t;
6327
6328 static const value_string aironet_ie_type_vals[] = {
6329   { AIRONET_IE_VERSION,   "CCX version"},
6330   { AIRONET_IE_QOS,       "Qos"},
6331   { AIRONET_IE_QBSS_V2,   "QBSS V2 - CCA"},
6332   { 0,                    NULL }
6333 };
6334
6335 static void
6336 dissect_vendor_ie_aironet(proto_item * aironet_item, proto_tree * ietree,
6337   tvbuff_t * tvb, int offset, guint32 tag_len)
6338 {
6339   guint8  type;
6340   int i;
6341   gboolean dont_change = FALSE; /* Don't change the IE item text to default */
6342
6343   type = tvb_get_guint8(tvb, offset);
6344   proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6345   offset += 1;
6346
6347   switch (type) {
6348   case AIRONET_IE_VERSION:
6349     proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_version, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6350     proto_item_append_text(aironet_item, ": Aironet CCX version = %d",
6351     tvb_get_guint8(tvb, offset));
6352     dont_change = TRUE;
6353     break;
6354   case AIRONET_IE_QOS:
6355     proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_qos_unk1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6356     offset += 1;
6357     proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_qos_paramset, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6358     offset += 1;
6359
6360     /* XXX: just copied over from WME. Maybe "Best Effort" and "Background"
6361      *  need to be swapped. Also, the "TXOP" may be TXOP - or not.
6362      */
6363     for (i = 0; i < 4; i++) {
6364       guint8 byte1, byte2;
6365       guint16 txop;
6366       byte1 = tvb_get_guint8(tvb, offset);
6367       byte2 = tvb_get_guint8(tvb, offset + 1);
6368       txop = tvb_get_letohs(tvb, offset + 2);
6369       proto_tree_add_bytes_format(ietree, hf_ieee80211_aironet_ie_qos_val, tvb, offset, 4, NULL,
6370           "CCX QoS Parameters??: ACI %u (%s), Admission Control %sMandatory, AIFSN %u, ECWmin %u, ECWmax %u, TXOP %u",
6371         (byte1 & 0x60) >> 5, val_to_str((byte1 & 0x60) >> 5, wme_acs, "(Unknown: %d)"),
6372         (byte1 & 0x10) ? "" : "not ", byte1 & 0x0f,
6373         byte2 & 0x0f, (byte2 & 0xf0) >> 4,
6374         txop);
6375       offset += 4;
6376     }
6377     break;
6378   case AIRONET_IE_QBSS_V2:
6379     /* Extract Values */
6380     proto_tree_add_item (ietree, hf_ieee80211_qbss2_scount, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6381     proto_tree_add_item (ietree, hf_ieee80211_qbss2_cu, tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6382     proto_tree_add_item (ietree, hf_ieee80211_qbss2_cal, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6383     proto_tree_add_item (ietree, hf_ieee80211_qbss2_gl, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6384     break;
6385   default:
6386     proto_tree_add_item(ietree, hf_ieee80211_aironet_ie_data, tvb, offset,
6387       tag_len - 1, ENC_NA);
6388     break;
6389   }
6390   if (!dont_change) {
6391     proto_item_append_text(aironet_item, ": Aironet %s",
6392       val_to_str(type, aironet_ie_type_vals, "Unknown"));
6393   }
6394 }
6395
6396 /* 802.11e 7.3.2.33 QoS Capability element */
6397 static int dissect_qos_capability(proto_tree * tree, tvbuff_t * tvb, int offset, int ftype)
6398 {
6399   proto_item *cap_info_item;
6400   proto_tree *cap_info_tree;
6401
6402   cap_info_item = proto_tree_add_item(tree, hf_ieee80211_tag_qos_cap_qos_info, tvb, offset, 1, ENC_NA);
6403   cap_info_tree = proto_item_add_subtree(cap_info_item, ett_qos_info_field_tree);
6404   switch(ftype){
6405     case MGT_ASSOC_REQ:
6406     case MGT_PROBE_REQ:
6407     case MGT_REASSOC_REQ:
6408     {
6409       /* To AP so decode as STA: Figure 33h-QoS Info field when set by a non-AP QSTA */
6410       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_vo_uapsd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6411       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_vi_uapsd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6412       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_bk_uapsd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6413       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_be_uapsd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6414       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_qack, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6415       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_max_sp_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6416       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_more_data_ack, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6417       break;
6418     }
6419     case MGT_BEACON:
6420     case MGT_PROBE_RESP:
6421     case MGT_ASSOC_RESP:
6422     case MGT_REASSOC_RESP:
6423     {
6424       /* From AP so decode as AP: Figure 33g-QoS Info field when sent by a QAP */
6425       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_edca_upd_cnt, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6426       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_qack, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6427       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_queue_req, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6428       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_txop_req, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6429       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_reserved, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6430       break;
6431     }
6432     default:
6433         expert_add_info_format(g_pinfo, cap_info_item, PI_UNDECODED, PI_WARN, "Could not deduce direction to decode correctly, ftype %u", ftype);
6434       break;
6435   }
6436
6437   return offset + 1;
6438 }
6439
6440 /* 7.3.2.25 RSN information element */
6441 static int
6442 dissect_rsn_ie(packet_info * pinfo, proto_tree * tree, tvbuff_t * tvb,
6443     int offset, guint32 tag_len)
6444 {
6445   proto_item *rsn_gcs_item, *rsn_pcs_item, *rsn_akms_item, *rsn_cap_item, *rsn_pmkid_item, *rsn_gmcs_item;
6446   proto_item *rsn_sub_pcs_item, *rsn_sub_akms_item;
6447   proto_item *rsn_pcs_count, *rsn_akms_count, *rsn_pmkid_count;
6448   proto_tree *rsn_gcs_tree, *rsn_pcs_tree, *rsn_akms_tree, *rsn_cap_tree, *rsn_pmkid_tree, *rsn_gmcs_tree;
6449   proto_tree *rsn_sub_pcs_tree, *rsn_sub_akms_tree;
6450   guint16 pcs_count, akms_count, pmkid_count;
6451   guint i;
6452   int tag_end = offset + tag_len;
6453
6454   proto_tree_add_item(tree, hf_ieee80211_rsn_version, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6455   offset += 2;
6456
6457   /* 7.3.2.25.1 Group Cipher suites */
6458   rsn_gcs_item = proto_tree_add_item(tree, hf_ieee80211_rsn_gcs, tvb, offset, 4, ENC_BIG_ENDIAN);
6459   rsn_gcs_tree = proto_item_add_subtree(rsn_gcs_item, ett_rsn_gcs_tree);
6460   proto_tree_add_item(rsn_gcs_tree, hf_ieee80211_rsn_gcs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
6461
6462     /* Check if OUI is 00:0F:AC (ieee80211) */
6463   if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
6464   {
6465     proto_tree_add_item(rsn_gcs_tree, hf_ieee80211_rsn_gcs_80211_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6466   } else {
6467     proto_tree_add_item(rsn_gcs_tree, hf_ieee80211_rsn_gcs_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6468   }
6469   offset += 4;
6470
6471   /* 7.3.2.25.2 Pairwise Cipher suites */
6472   rsn_pcs_count = proto_tree_add_item(tree, hf_ieee80211_rsn_pcs_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6473   pcs_count = tvb_get_letohs(tvb, offset);
6474   offset += 2;
6475
6476   if (offset + (pcs_count * 4) > tag_end)
6477   {
6478     expert_add_info_format(pinfo, rsn_pcs_count, PI_MALFORMED, PI_ERROR,
6479         "Pairwise Cipher Suite Count too large, 4*%u > %d", pcs_count, tag_end - offset);
6480     pcs_count = (tag_end - offset) / 4;
6481   }
6482
6483   rsn_pcs_item = proto_tree_add_item(tree, hf_ieee80211_rsn_pcs_list, tvb, offset, pcs_count * 4, ENC_NA);
6484   rsn_pcs_tree = proto_item_add_subtree(rsn_pcs_item, ett_rsn_pcs_tree);
6485   for(i = 1; i <= pcs_count; i++)
6486   {
6487     rsn_sub_pcs_item = proto_tree_add_item(rsn_pcs_tree, hf_ieee80211_rsn_pcs, tvb, offset, 4, ENC_BIG_ENDIAN);
6488     rsn_sub_pcs_tree = proto_item_add_subtree(rsn_sub_pcs_item, ett_rsn_sub_pcs_tree);
6489     proto_tree_add_item(rsn_sub_pcs_tree, hf_ieee80211_rsn_pcs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
6490
6491     /* Check if OUI is 00:0F:AC (ieee80211) */
6492     if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
6493     {
6494       proto_tree_add_item(rsn_sub_pcs_tree, hf_ieee80211_rsn_pcs_80211_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
6495       proto_item_append_text(rsn_pcs_item, " %s", rsn_pcs_return(tvb_get_ntohl(tvb, offset)));
6496     } else {
6497       proto_tree_add_item(rsn_sub_pcs_tree, hf_ieee80211_rsn_pcs_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
6498     }
6499     offset += 4;
6500   }
6501
6502   if(offset >= tag_end)
6503   {
6504     return offset;
6505   }
6506
6507   /* 7.3.2.25.2 AKM suites */
6508   rsn_akms_count = proto_tree_add_item(tree, hf_ieee80211_rsn_akms_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6509   akms_count = tvb_get_letohs(tvb, offset);
6510   offset += 2;
6511
6512   if (offset + (akms_count * 4) > tag_end)
6513   {
6514     expert_add_info_format(pinfo, rsn_akms_count, PI_MALFORMED, PI_ERROR,
6515         "Auth Key Management (AKM) Suite Count too large, 4*%u > %d", akms_count, tag_end - offset);
6516     akms_count = (tag_end - offset) / 4;
6517   }
6518
6519   rsn_akms_item = proto_tree_add_item(tree, hf_ieee80211_rsn_akms_list, tvb, offset, akms_count * 4, ENC_NA);
6520   rsn_akms_tree = proto_item_add_subtree(rsn_akms_item, ett_rsn_akms_tree);
6521   for(i = 1; i <= akms_count; i++)
6522   {
6523     rsn_sub_akms_item = proto_tree_add_item(rsn_akms_tree, hf_ieee80211_rsn_akms, tvb, offset, 4, ENC_BIG_ENDIAN);
6524     rsn_sub_akms_tree = proto_item_add_subtree(rsn_sub_akms_item, ett_rsn_sub_akms_tree);
6525     proto_tree_add_item(rsn_sub_akms_tree, hf_ieee80211_rsn_akms_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
6526
6527     /* Check if OUI is 00:0F:AC (ieee80211) */
6528     if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
6529     {
6530       proto_tree_add_item(rsn_sub_akms_tree, hf_ieee80211_rsn_akms_80211_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
6531       proto_item_append_text(rsn_akms_item, " %s", rsn_akms_return(tvb_get_ntohl(tvb, offset)));
6532     } else {
6533       proto_tree_add_item(rsn_sub_akms_tree, hf_ieee80211_rsn_akms_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
6534     }
6535     offset += 4;
6536   }
6537
6538   /* 7.3.2.25.3 RSN capabilities */
6539   rsn_cap_item = proto_tree_add_item(tree, hf_ieee80211_rsn_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6540   rsn_cap_tree = proto_item_add_subtree(rsn_cap_item, ett_rsn_cap_tree);
6541
6542   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_preauth, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6543   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_no_pairwise, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6544   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_ptksa_replay_counter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6545   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_gtksa_replay_counter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6546   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_mfpr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6547   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_mfpc, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6548   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_peerkey, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6549   offset += 2;
6550   if(offset >= tag_end)
6551   {
6552     return offset;
6553   }
6554   /* 7.3.2.25.4 PMKID */
6555   rsn_pmkid_count = proto_tree_add_item(tree, hf_ieee80211_rsn_pmkid_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6556   pmkid_count = tvb_get_letohs(tvb, offset);
6557   offset += 2;
6558
6559   if (offset + (pmkid_count * 16) > tag_end)
6560   {
6561     expert_add_info_format(pinfo, rsn_pmkid_count, PI_MALFORMED, PI_ERROR,
6562         "PMKID Count too large, 16*%u > %d", pmkid_count, tag_end - offset);
6563     pmkid_count = (tag_end - offset) / 16;
6564   }
6565
6566   rsn_pmkid_item = proto_tree_add_item(tree, hf_ieee80211_rsn_pmkid_list, tvb, offset, pmkid_count * 16, ENC_NA);
6567   rsn_pmkid_tree = proto_item_add_subtree(rsn_pmkid_item, ett_rsn_pmkid_tree);
6568   for(i = 1; i <= pmkid_count; i++)
6569   {
6570     proto_tree_add_item(rsn_pmkid_tree, hf_ieee80211_rsn_pmkid, tvb, offset, 16, ENC_NA);
6571     offset +=16;
6572   }
6573
6574   if(offset >= tag_end)
6575   {
6576     return offset;
6577   }
6578   /* Group Management Cipher Suite (802.11w)*/
6579   rsn_gmcs_item = proto_tree_add_item(tree, hf_ieee80211_rsn_gmcs, tvb, offset, 4, ENC_BIG_ENDIAN);
6580   rsn_gmcs_tree = proto_item_add_subtree(rsn_gmcs_item, ett_rsn_gmcs_tree);
6581   proto_tree_add_item(rsn_gmcs_tree, hf_ieee80211_rsn_gmcs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
6582   /* Check if OUI is 00:0F:AC (ieee80211) */
6583   if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
6584   {
6585     proto_tree_add_item(rsn_gmcs_tree, hf_ieee80211_rsn_gmcs_80211_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6586   } else {
6587     proto_tree_add_item(rsn_gmcs_tree, hf_ieee80211_rsn_gmcs_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6588   }
6589   offset += 4;
6590
6591   return offset;
6592 }
6593
6594 static void
6595 dissect_mobility_domain(proto_tree *tree, tvbuff_t *tvb, int offset,
6596                         guint32 tag_len)
6597 {
6598   if (tag_len < 3) {
6599     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6600                           "MDIE content length must be at least 3 bytes");
6601     return;
6602   }
6603
6604   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_mdid,
6605                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6606   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_ft_capab,
6607                       tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6608   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_ft_capab_ft_over_ds,
6609                       tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6610   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_ft_capab_resource_req,
6611                       tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6612 }
6613
6614 static void
6615 dissect_fast_bss_transition(proto_tree *tree, tvbuff_t *tvb, int offset,
6616                             guint32 tag_len)
6617 {
6618   int end = offset + tag_len;
6619   if (tag_len < 82) {
6620     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6621                           "FTIE content length must be at least 82 bytes");
6622     return;
6623   }
6624
6625   proto_tree_add_item(tree, hf_ieee80211_tag_ft_mic_control,
6626                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6627   proto_tree_add_item(tree, hf_ieee80211_tag_ft_element_count,
6628                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6629   offset += 2;
6630   proto_tree_add_item(tree, hf_ieee80211_tag_ft_mic,
6631                       tvb, offset, 16, ENC_NA);
6632   offset += 16;
6633   proto_tree_add_item(tree, hf_ieee80211_tag_ft_anonce,
6634                       tvb, offset, 32, ENC_NA);
6635   offset += 32;
6636   proto_tree_add_item(tree, hf_ieee80211_tag_ft_snonce,
6637                       tvb, offset, 32, ENC_NA);
6638   offset += 32;
6639
6640   while (offset + 2 <= end) {
6641     guint8 id, len;
6642     int s_end;
6643     proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_id,
6644                         tvb, offset, 1, ENC_BIG_ENDIAN);
6645     id = tvb_get_guint8(tvb, offset);
6646     offset++;
6647
6648     proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_len,
6649                         tvb, offset, 1, ENC_BIG_ENDIAN);
6650     len = tvb_get_guint8(tvb, offset);
6651     offset++;
6652
6653     if (offset + len > end) {
6654       proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset,
6655                             end - offset, "Invalid FTIE subelement");
6656       return;
6657     }
6658
6659     s_end = offset + len;
6660     switch (id) {
6661     case 1:
6662       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_r1kh_id,
6663                           tvb, offset, len, ENC_NA);
6664       break;
6665     case 2:
6666       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key_info,
6667                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
6668       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key_id,
6669                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
6670       offset += 2;
6671       if (offset > s_end)
6672         break;
6673       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key_length,
6674                           tvb, offset, 1, ENC_BIG_ENDIAN);
6675       offset++;
6676       if (offset > s_end)
6677         break;
6678       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_rsc,
6679                           tvb, offset, 8, ENC_NA);
6680       offset += 8;
6681       if (offset > s_end)
6682         break;
6683       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key,
6684                           tvb, offset, s_end - offset, ENC_NA);
6685       break;
6686     case 3:
6687       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_r0kh_id,
6688                           tvb, offset, len, ENC_ASCII|ENC_NA);
6689       break;
6690     case 4:
6691       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_key_id,
6692                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
6693       offset += 2;
6694       if (offset > s_end)
6695         break;
6696       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_ipn,
6697                           tvb, offset, 6, ENC_NA);
6698       offset += 6;
6699       if (offset > s_end)
6700         break;
6701       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_key_length,
6702                           tvb, offset, 1, ENC_BIG_ENDIAN);
6703       offset++;
6704       if (offset > s_end)
6705         break;
6706       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_key,
6707                           tvb, offset, 24, ENC_NA);
6708       break;
6709     default:
6710       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_data,
6711                           tvb, offset, len, ENC_NA);
6712       break;
6713     }
6714     offset = s_end;
6715   }
6716 }
6717
6718 static void
6719 dissect_mmie(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 tag_len)
6720 {
6721   if (tag_len < 16) {
6722     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6723                           "MMIE content length must be at least 16 bytes");
6724     return;
6725   }
6726
6727   proto_tree_add_item(tree, hf_ieee80211_tag_mmie_keyid, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6728   proto_tree_add_item(tree, hf_ieee80211_tag_mmie_ipn, tvb, offset + 2, 6,
6729                       ENC_NA);
6730   proto_tree_add_item(tree, hf_ieee80211_tag_mmie_mic, tvb, offset + 8, 8,
6731                       ENC_NA);
6732 }
6733
6734 static void
6735 dissect_link_identifier(proto_tree *tree, tvbuff_t *tvb, int offset,
6736                         guint32 tag_len)
6737 {
6738   if (tag_len < 18) {
6739     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6740                           "Link Identifier content length must be at least "
6741                           "18 bytes");
6742     return;
6743   }
6744
6745   proto_tree_add_item(tree, hf_ieee80211_tag_link_id_bssid, tvb,
6746                       offset, 6, ENC_NA);
6747   proto_tree_add_item(tree, hf_ieee80211_tag_link_id_init_sta, tvb,
6748                       offset + 6, 6, ENC_NA);
6749   proto_tree_add_item(tree, hf_ieee80211_tag_link_id_resp_sta, tvb,
6750                       offset + 12, 6, ENC_NA);
6751 }
6752
6753 static void
6754 dissect_wakeup_schedule(proto_tree *tree, tvbuff_t *tvb, int offset,
6755                         guint32 tag_len)
6756 {
6757   if (tag_len < 18) {
6758     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6759                           "Wakeup Schedule content length must be at least "
6760                           "18 bytes");
6761     return;
6762   }
6763
6764   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_offset, tvb,
6765                       offset, 4, ENC_LITTLE_ENDIAN);
6766   offset += 4;
6767
6768   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_interval, tvb,
6769                       offset, 4, ENC_LITTLE_ENDIAN);
6770   offset += 4;
6771
6772   proto_tree_add_item(tree,
6773                       hf_ieee80211_tag_wakeup_schedule_awake_window_slots, tvb,
6774                       offset, 4, ENC_LITTLE_ENDIAN);
6775   offset += 4;
6776
6777   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_max_awake_dur,
6778                       tvb, offset, 4, ENC_LITTLE_ENDIAN);
6779   offset += 4;
6780
6781   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_idle_count, tvb,
6782                       offset, 2, ENC_LITTLE_ENDIAN);
6783 }
6784
6785 static void
6786 dissect_channel_switch_timing(proto_tree *tree, tvbuff_t *tvb, int offset,
6787                               guint32 tag_len)
6788 {
6789   if (tag_len < 4) {
6790     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6791                           "Channel Switch Timing content length must be at "
6792                           "least 4 bytes");
6793     return;
6794   }
6795
6796   proto_tree_add_item(tree, hf_ieee80211_tag_channel_switch_timing_switch_time,
6797                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6798   offset += 2;
6799
6800   proto_tree_add_item(tree,
6801                       hf_ieee80211_tag_channel_switch_timing_switch_timeout,
6802                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6803 }
6804
6805 static void
6806 dissect_pti_control(proto_tree *tree, tvbuff_t *tvb, int offset,
6807                     guint32 tag_len)
6808 {
6809   if (tag_len < 3) {
6810     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6811                           "PTI Control content length must be at least "
6812                           "3 bytes");
6813     return;
6814   }
6815
6816   proto_tree_add_item(tree, hf_ieee80211_tag_pti_control_tid, tvb,
6817                       offset, 1, ENC_BIG_ENDIAN);
6818   offset++;
6819
6820   proto_tree_add_item(tree, hf_ieee80211_tag_pti_control_sequence_control, tvb,
6821                       offset, 2, ENC_LITTLE_ENDIAN);
6822 }
6823
6824 static void
6825 dissect_pu_buffer_status(proto_tree *tree, tvbuff_t *tvb, int offset,
6826                          guint32 tag_len)
6827 {
6828   if (tag_len < 1) {
6829     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6830                           "PU Buffer Status content length must be at least "
6831                           "1 byte");
6832     return;
6833   }
6834
6835   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_bk, tvb,
6836                       offset, 1, ENC_BIG_ENDIAN);
6837   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_be, tvb,
6838                       offset, 1, ENC_BIG_ENDIAN);
6839   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_vi, tvb,
6840                       offset, 1, ENC_BIG_ENDIAN);
6841   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_vo, tvb,
6842                       offset, 1, ENC_BIG_ENDIAN);
6843 }
6844
6845 static void
6846 dissect_timeout_interval(proto_tree *tree, tvbuff_t *tvb, int offset,
6847                          guint32 tag_len)
6848 {
6849   proto_item *pi;
6850
6851   pi = proto_tree_add_item(tree, hf_ieee80211_tag_timeout_int_type, tvb,
6852                            offset, 1, ENC_BIG_ENDIAN);
6853   if (tag_len < 5) {
6854     expert_add_info_format(g_pinfo, pi, PI_MALFORMED, PI_ERROR,
6855                            "Timeout Interval content length must be at least "
6856                           "5 bytes");
6857     return;
6858   }
6859
6860   proto_tree_add_item(tree, hf_ieee80211_tag_timeout_int_value, tvb,
6861                       offset + 1, 4, ENC_LITTLE_ENDIAN);
6862 }
6863
6864 static int
6865 dissect_mcs_set(proto_tree *tree, tvbuff_t *tvb, int offset, gboolean basic, gboolean vs) {
6866   proto_item *ti;
6867   proto_tree *mcs_tree, *bit_tree;
6868
6869   /* 16 byte Supported MCS set */
6870   if(vs)
6871   {
6872     ti = proto_tree_add_string(tree, hf_ieee80211_mcsset_vs, tvb, offset, 16,
6873       basic ? "Basic MCS Set" : "MCS Set");
6874   }else
6875   {
6876     ti = proto_tree_add_string(tree, hf_ieee80211_mcsset, tvb, offset, 16,
6877       basic ? "Basic MCS Set" : "MCS Set");
6878   }
6879   mcs_tree = proto_item_add_subtree(ti, ett_mcsset_tree);
6880
6881   /* Rx MCS Bitmask */
6882   ti = proto_tree_add_item(mcs_tree, hf_ieee80211_mcsset_rx_bitmask, tvb, offset, 10, ENC_NA);
6883   bit_tree = proto_item_add_subtree(ti, ett_mcsbit_tree);
6884
6885   /* Bits 0 - 31 */
6886   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_0to7, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6887   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_8to15, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6888   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_16to23, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6889   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_24to31, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6890   offset += 4;
6891
6892   /* Bits 32 - 52 */
6893   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_32, tvb, offset , 4, ENC_LITTLE_ENDIAN);
6894   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_33to38, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6895   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_39to52, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6896   offset += 2;
6897
6898   /* Bits 53 - 76 */
6899   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_53to76, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6900   offset += 4;
6901
6902   proto_tree_add_item(mcs_tree, hf_ieee80211_mcsset_highest_data_rate, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6903   offset += 2;
6904
6905   proto_tree_add_item(mcs_tree, hf_ieee80211_mcsset_tx_mcs_set_defined, tvb, offset, 1,
6906       ENC_LITTLE_ENDIAN);
6907   proto_tree_add_item(mcs_tree, hf_ieee80211_mcsset_tx_rx_mcs_set_not_equal, tvb, offset, 1,
6908       ENC_LITTLE_ENDIAN);
6909   proto_tree_add_item(mcs_tree, hf_ieee80211_mcsset_tx_max_spatial_streams, tvb, offset, 1,
6910       ENC_LITTLE_ENDIAN);
6911   proto_tree_add_item(mcs_tree, hf_ieee80211_mcsset_tx_unequal_modulation, tvb, offset, 1,
6912       ENC_LITTLE_ENDIAN);
6913   offset += 1;
6914
6915   offset += 3;
6916   return offset;
6917 }
6918
6919 /*  802.11n D1.10 - HT Information IE  */
6920 static void
6921 dissect_ht_info_ie_1_1(proto_tree * tree, tvbuff_t * tvb, int offset,
6922          guint32 tag_len)
6923 {
6924   proto_item *cap_item;
6925   proto_tree *cap_tree;
6926   guint32 tag_val_init_off = 0;
6927   guint16 info = 0;
6928
6929   tag_val_init_off = offset;
6930   cap_tree = tree;
6931
6932   if (tag_len < 22) {
6933     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6934               "HT Information IE content length must be at least 22 bytes");
6935     return;
6936   }
6937
6938
6939   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_primary_channel, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6940
6941   info = tvb_get_guint8 (tvb, ++offset);
6942   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_ht_info_delimiter1, tvb,
6943                     offset, 1, info,
6944                     "HT Information Subset (1 of 3): 0x%02X", info);
6945   cap_tree = proto_item_add_subtree(cap_item, ett_ht_info_delimiter1_tree);
6946   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_secondary_channel_offset, tvb, offset, 1,
6947              info);
6948   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_channel_width, tvb, offset, 1,
6949              info);
6950   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_rifs_mode, tvb, offset, 1,
6951              info);
6952   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_psmp_stas_only, tvb, offset, 1,
6953              info);
6954   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_service_interval_granularity, tvb, offset, 1,
6955              info);
6956
6957   info = tvb_get_letohs (tvb, ++offset);
6958   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_ht_info_delimiter2, tvb,
6959                     offset, 2, info,
6960                     "HT Information Subset (2 of 3): 0x%04X", info);
6961   cap_tree = proto_item_add_subtree(cap_item, ett_ht_info_delimiter2_tree);
6962   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_operating_mode, tvb, offset, 1,
6963              info);
6964   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_non_greenfield_sta_present, tvb, offset, 1,
6965              info);
6966   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_transmit_burst_limit, tvb, offset, 1,
6967              info);
6968   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_obss_non_ht_stas_present, tvb, offset, 1,
6969              info);
6970   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_reserved_1, tvb, offset, 2,
6971              info);
6972
6973   offset += 2;
6974   info = tvb_get_letohs (tvb, offset);
6975   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_ht_info_delimiter3, tvb,
6976                     offset, 2, info,
6977                     "HT Information Subset (3 of 3): 0x%04X", info);
6978   cap_tree = proto_item_add_subtree(cap_item, ett_ht_info_delimiter3_tree);
6979   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_reserved_2, tvb, offset, 1,
6980              info);
6981   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_dual_beacon, tvb, offset, 1,
6982              info);
6983   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_dual_cts_protection, tvb, offset, 1,
6984              info);
6985   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_secondary_beacon, tvb, offset+1, 1,
6986              info);
6987   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_lsig_txop_protection_full_support, tvb, offset+1, 1,
6988              info);
6989   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_pco_active, tvb, offset+1, 1,
6990              info);
6991   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_pco_phase, tvb, offset+1, 1,
6992              info);
6993   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_reserved_3, tvb, offset+1, 1,
6994              info);
6995
6996   offset += 2;
6997   cap_tree = tree;
6998
6999   dissect_mcs_set(cap_tree, tvb, offset, TRUE, FALSE);
7000   offset += 16;
7001
7002   if (tag_val_init_off - offset < tag_len){
7003     proto_tree_add_string(cap_tree, hf_ieee80211_tag_interpretation, tvb, offset,
7004        tag_len + tag_val_init_off - offset, "Unparsed Extra Data");
7005   }
7006 }
7007
7008 static const value_string time_adv_timing_capab_vals[] = {
7009   { 0, "No standardized external time source" },
7010   { 1, "Timestamp offset based on UTC" },
7011   { 2, "UTC time at which the TSF timer is 0" },
7012   { 0, NULL }
7013 };
7014
7015 static int dissect_time_adv(proto_tree *tree, tvbuff_t *tvb, int offset)
7016 {
7017   guint8 capab;
7018   proto_item *item;
7019   proto_tree *subtree;
7020   struct tm tm, *now;
7021   time_t t;
7022
7023   capab = tvb_get_guint8(tvb, offset);
7024   proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_timing_capab,
7025                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7026   offset++;
7027
7028   switch (capab) {
7029   case 1:
7030     proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_value,
7031                         tvb, offset, 10, ENC_NA);
7032     offset += 10;
7033
7034     proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_error,
7035                         tvb, offset, 5, ENC_NA);
7036     offset += 5;
7037     break;
7038   case 2:
7039     item = proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_value,
7040                                tvb, offset, 10, ENC_NA);
7041     subtree = proto_item_add_subtree(item, ett_tag_time_adv_tree);
7042     memset(&tm, 0, sizeof(tm));
7043     tm.tm_year = tvb_get_letohs(tvb, offset) - 1900;
7044     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_year,
7045                         tvb, offset, 2, ENC_LITTLE_ENDIAN);
7046     offset += 2;
7047     tm.tm_mon = tvb_get_guint8(tvb, offset) - 1;
7048     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_month,
7049                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7050     offset++;
7051     tm.tm_mday = tvb_get_guint8(tvb, offset);
7052     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_day,
7053                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7054     offset++;
7055     tm.tm_hour = tvb_get_guint8(tvb, offset);
7056     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_hours,
7057                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7058     offset++;
7059     tm.tm_min = tvb_get_guint8(tvb, offset);
7060     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_minutes,
7061                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7062     offset++;
7063     tm.tm_sec = tvb_get_guint8(tvb, offset);
7064     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_seconds,
7065                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7066     offset++;
7067     proto_tree_add_item(subtree,
7068                         hf_ieee80211_tag_time_adv_time_value_milliseconds,
7069                         tvb, offset, 2, ENC_LITTLE_ENDIAN);
7070     offset += 2;
7071     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_reserved,
7072                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7073     offset++;
7074
7075     tm.tm_isdst = -1;
7076     t = mktime(&tm);
7077     if (t != -1) {
7078       t += last_timestamp / 1000000;
7079       now = localtime(&t);
7080       if (now)
7081         proto_item_append_text(item,
7082                                ": current time=%u-%02u-%02u %02u:%02u:%02u",
7083                                now->tm_year + 1900, now->tm_mon + 1,
7084                                now->tm_mday, now->tm_hour, now->tm_min,
7085                                now->tm_sec);
7086     }
7087
7088     proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_error,
7089                         tvb, offset, 5, ENC_NA);
7090     offset += 5;
7091
7092     proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_update_counter,
7093                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7094     offset++;
7095     break;
7096   }
7097
7098   return offset;
7099 }
7100
7101 static int dissect_time_zone(proto_tree *tree, tvbuff_t *tvb, int offset,
7102                              guint32 tag_len)
7103 {
7104   proto_tree_add_item(tree, hf_ieee80211_tag_time_zone, tvb, offset, tag_len,
7105                       ENC_ASCII|ENC_NA);
7106   return offset + tag_len;
7107 }
7108
7109 static void secondary_channel_offset_ie(proto_tree * tree, tvbuff_t * tvb, int offset, guint32 tag_len)
7110 {
7111   int tag_offset;
7112
7113   if (tag_len != 1)
7114   {
7115     proto_tree_add_text (tree, tvb, offset, tag_len, "Secondary Channel Offset: Error: Tag length must be at least 1 byte long");
7116     return;
7117   }
7118
7119   tag_offset = offset;
7120   proto_tree_add_uint(tree, hf_ieee80211_tag_secondary_channel_offset, tvb, offset, 1, tvb_get_guint8 (tvb, offset));
7121
7122   offset++;
7123   if ((tag_len - (offset-tag_offset)) > 0)
7124   {
7125     proto_tree_add_text (tree, tvb, offset, tag_len - (offset-tag_offset), "Unknown Data");
7126     return;
7127   }
7128 }
7129
7130 static int
7131 dissect_ht_capability_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
7132          guint32 tag_len, proto_item *ti_len, gboolean vs )
7133 {
7134   proto_item *cap_item, *ti;
7135   proto_tree *cap_tree;
7136
7137   if (tag_len != 26) {
7138     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7139                            "HT Capability IE length %u wrong, must be = 26", tag_len);
7140     return offset;
7141   }
7142
7143   if (wlan_ignore_draft_ht && vs)
7144     return offset;
7145
7146   /* 2 byte HT Capabilities  Info*/
7147   if(vs)
7148   {
7149     cap_item = proto_tree_add_item(tree, hf_ieee80211_ht_vs_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7150   }
7151   else
7152   {
7153     cap_item = proto_tree_add_item(tree, hf_ieee80211_ht_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7154   }
7155   cap_tree = proto_item_add_subtree(cap_item, ett_ht_cap_tree);
7156   proto_tree_add_item(cap_tree, hf_ieee80211_ht_ldpc_coding, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7157   proto_tree_add_item(cap_tree, hf_ieee80211_ht_chan_width, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7158   proto_tree_add_item(cap_tree, hf_ieee80211_ht_sm_pwsave, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7159   proto_tree_add_item(cap_tree, hf_ieee80211_ht_green, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7160   proto_tree_add_item(cap_tree, hf_ieee80211_ht_short20, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7161   proto_tree_add_item(cap_tree, hf_ieee80211_ht_short40, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7162   proto_tree_add_item(cap_tree, hf_ieee80211_ht_tx_stbc, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7163   offset += 1;
7164
7165   proto_tree_add_item(cap_tree, hf_ieee80211_ht_rx_stbc, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7166   proto_tree_add_item(cap_tree, hf_ieee80211_ht_delayed_block_ack, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7167   proto_tree_add_item(cap_tree, hf_ieee80211_ht_max_amsdu, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7168   proto_tree_add_item(cap_tree, hf_ieee80211_ht_dss_cck_40, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7169   proto_tree_add_item(cap_tree, hf_ieee80211_ht_psmp, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7170   proto_tree_add_item(cap_tree, hf_ieee80211_ht_40_mhz_intolerant, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7171   proto_tree_add_item(cap_tree, hf_ieee80211_ht_l_sig, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7172   offset += 1;
7173
7174   /* 1 byte A-MPDU Parameters */
7175   if(vs)
7176   {
7177     cap_item = proto_tree_add_item(tree, hf_ieee80211_ampduparam_vs, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7178   }else
7179   {
7180     cap_item = proto_tree_add_item(tree, hf_ieee80211_ampduparam, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7181   }
7182   cap_tree = proto_item_add_subtree(cap_item, ett_ampduparam_tree);
7183   ti = proto_tree_add_item(cap_tree, hf_ieee80211_ampduparam_mpdu, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7184   proto_item_append_text(ti, " (%04.0f[Bytes])",pow(2,13+(tvb_get_guint8(tvb, offset) & 0x3))-1);
7185   proto_tree_add_item(cap_tree, hf_ieee80211_ampduparam_mpdu_start_spacing, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7186   proto_tree_add_item(cap_tree, hf_ieee80211_ampduparam_reserved, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7187   offset += 1;
7188
7189   /* 16 byte MCS set */
7190   offset = dissect_mcs_set(tree, tvb, offset, FALSE, vs);
7191
7192
7193   /* 2 byte HT Extended Capabilities */
7194   if(vs)
7195   {
7196     cap_item = proto_tree_add_item(tree, hf_ieee80211_htex_vs_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7197   } else {
7198     cap_item = proto_tree_add_item(tree, hf_ieee80211_htex_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7199   }
7200   cap_tree = proto_item_add_subtree(cap_item, ett_htex_cap_tree);
7201   proto_tree_add_item(cap_tree, hf_ieee80211_htex_pco, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7202   proto_tree_add_item(cap_tree, hf_ieee80211_htex_transtime, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7203   offset += 1;
7204   proto_tree_add_item(cap_tree, hf_ieee80211_htex_mcs, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7205   proto_tree_add_item(cap_tree, hf_ieee80211_htex_htc_support, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7206   proto_tree_add_item(cap_tree, hf_ieee80211_htex_rd_responder, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7207   offset += 1;
7208
7209
7210   /* 4 byte TxBF capabilities */
7211   if(vs)
7212   {
7213     cap_item = proto_tree_add_item(tree, hf_ieee80211_txbf_vs, tvb, offset, 4, ENC_LITTLE_ENDIAN);
7214   } else {
7215     cap_item = proto_tree_add_item(tree, hf_ieee80211_txbf, tvb, offset, 4, ENC_LITTLE_ENDIAN);
7216   }
7217   cap_tree = proto_item_add_subtree(cap_item, ett_txbf_tree);
7218   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_cap, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7219   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_rcv_ssc, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7220   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_tx_ssc, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7221   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_rcv_ndp, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7222   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_tx_ndp, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7223   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_impl_txbf, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7224   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_calib, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7225   offset +=1;
7226
7227   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_expl_csi, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7228   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_expl_uncomp_fm, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7229   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_expl_comp_fm, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7230   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_expl_bf_csi, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7231   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_expl_uncomp_fm_feed, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7232   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_expl_comp_fm_feed, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7233   offset +=1;
7234
7235   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_min_group, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7236   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_csi_num_bf_ant, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7237   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_uncomp_sm_bf_ant, tvb, offset, 1,  ENC_LITTLE_ENDIAN);
7238   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_comp_sm_bf_ant, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7239   offset += 1;
7240
7241   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_csi_max_rows_bf, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7242   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_chan_est, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7243   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_resrv, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7244   offset += 1;
7245
7246   /* 1 byte Antenna Selection (ASEL) capabilities */
7247   if(vs)
7248   {
7249     cap_item = proto_tree_add_item(tree, hf_ieee80211_antsel_vs, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7250   }
7251   else
7252   {
7253     cap_item = proto_tree_add_item(tree, hf_ieee80211_antsel, tvb,  offset, 1, ENC_LITTLE_ENDIAN);
7254   }
7255   cap_tree = proto_item_add_subtree(cap_item, ett_antsel_tree);
7256   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b0, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7257   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7258   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b2, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7259   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b3, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7260   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b4, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7261   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b5, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7262   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b6, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7263   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b7, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7264
7265   offset += 1;
7266
7267   return offset;
7268 }
7269
7270 static int
7271 dissect_ht_info_ie_1_0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
7272          guint32 tag_len, proto_item *ti_len)
7273 {
7274   proto_item *cap_item;
7275   proto_tree *cap_tree;
7276
7277   if (tag_len != 22) {
7278     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7279                            "Tag length %u wrong, must be = 22", tag_len);
7280     return offset;
7281   }
7282
7283   if (wlan_ignore_draft_ht)
7284     return offset;
7285
7286   /* 1 HT Control Channel */
7287   proto_tree_add_item(tree, hf_ieee80211_hta_cc, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7288   offset += 1;
7289
7290   /* 1 byte HT additional capabilities */
7291   cap_item = proto_tree_add_item(tree, hf_ieee80211_hta_cap, tvb, offset, 1,
7292              ENC_LITTLE_ENDIAN);
7293   cap_tree = proto_item_add_subtree(cap_item, ett_hta_cap_tree);
7294
7295   proto_tree_add_item(cap_tree, hf_ieee80211_hta_ext_chan_offset, tvb, offset, 1,
7296              ENC_LITTLE_ENDIAN);
7297   proto_tree_add_item(cap_tree, hf_ieee80211_hta_rec_tx_width, tvb, offset, 1,
7298              ENC_LITTLE_ENDIAN);
7299   proto_tree_add_item(cap_tree, hf_ieee80211_hta_rifs_mode, tvb, offset, 1,
7300              ENC_LITTLE_ENDIAN);
7301   proto_tree_add_item(cap_tree, hf_ieee80211_hta_controlled_access, tvb, offset, 1,
7302              ENC_LITTLE_ENDIAN);
7303   proto_tree_add_item(cap_tree, hf_ieee80211_hta_service_interval, tvb, offset, 1,
7304              ENC_LITTLE_ENDIAN);
7305   offset += 1;
7306
7307   /* 2 byte HT additional capabilities */
7308   cap_item = proto_tree_add_item(tree, hf_ieee80211_hta_cap, tvb, offset, 2,
7309              ENC_LITTLE_ENDIAN);
7310   cap_tree = proto_item_add_subtree(cap_item, ett_hta_cap1_tree);
7311
7312   proto_tree_add_item(cap_tree, hf_ieee80211_hta_operating_mode, tvb, offset, 2,
7313              ENC_LITTLE_ENDIAN);
7314   proto_tree_add_item(cap_tree, hf_ieee80211_hta_non_gf_devices, tvb, offset, 2,
7315              ENC_LITTLE_ENDIAN);
7316
7317   offset += 2;
7318
7319   /* 2 byte HT additional capabilities */
7320   cap_item = proto_tree_add_item(tree, hf_ieee80211_hta_cap, tvb, offset, 2,
7321              ENC_LITTLE_ENDIAN);
7322   cap_tree = proto_item_add_subtree(cap_item, ett_hta_cap2_tree);
7323
7324   proto_tree_add_item(cap_tree, hf_ieee80211_hta_basic_stbc_mcs, tvb, offset, 2,
7325              ENC_LITTLE_ENDIAN);
7326   proto_tree_add_item(cap_tree, hf_ieee80211_hta_dual_stbc_protection, tvb, offset, 2,
7327              ENC_LITTLE_ENDIAN);
7328   proto_tree_add_item(cap_tree, hf_ieee80211_hta_secondary_beacon, tvb, offset, 2,
7329              ENC_LITTLE_ENDIAN);
7330   proto_tree_add_item(cap_tree, hf_ieee80211_hta_lsig_txop_protection, tvb, offset, 2,
7331              ENC_LITTLE_ENDIAN);
7332   proto_tree_add_item(cap_tree, hf_ieee80211_hta_pco_active, tvb, offset, 2,
7333              ENC_LITTLE_ENDIAN);
7334   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_pco_phase, tvb, offset, 2,
7335              ENC_LITTLE_ENDIAN);
7336   offset += 2;
7337
7338   /* 16 byte Supported MCS set */
7339   offset = dissect_mcs_set(tree, tvb, offset, FALSE, TRUE);
7340
7341   return offset;
7342 }
7343
7344 /* 802.11n-D1.10 and 802.11n-D2.0, 7.1.3.5a */
7345
7346 /*
7347  * 7.1.3.1.10 says:
7348  * "The Order field is 1 bit in length and is set to 1 in any non-QoS Data
7349  * frame that contains an MSDU, or fragment thereof, which is being
7350  * transferred using the StrictlyOrdered service class. The presence of the
7351  * HT Control field in frames is indicated by setting the Order field to 1
7352  * in any Data type or Management type frame that  is transmitted with a
7353  * value of HT_GF or HT_MM for the FORMAT parameter of the TXVECTOR except
7354  * a non-QoS Data frame or a Control Wrapper frame. The Order field is set
7355  * to 0 in all other frames. All non-HT QoS STAs set the Order field to 0."
7356  *
7357  * ...so does this mean that we can check for the presence of +HTC by
7358  * looking for QoS frames with the Order bit set, or do we need extra
7359  * information from the PHY (which would be monumentally silly)?
7360  *
7361  * At any rate, it doesn't look like any equipment we have produces
7362  * +HTC frames, so the code is completely untested.
7363  */
7364
7365 static void
7366 dissect_ht_control(proto_tree *tree, tvbuff_t * tvb, int offset)
7367 {
7368   proto_item *ti;
7369   proto_tree *htc_tree, *lac_subtree;
7370   guint16 htc;
7371
7372   htc = tvb_get_letohs(tvb, offset);
7373
7374   ti = proto_tree_add_item(tree, hf_ieee80211_htc, tvb, offset, 4, ENC_LITTLE_ENDIAN);
7375   htc_tree = proto_item_add_subtree(ti, ett_htc_tree);
7376
7377   /* Start: Link Adaptation Control */
7378   ti = proto_tree_add_item(htc_tree, hf_ieee80211_htc_lac, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7379   lac_subtree = proto_item_add_subtree(ti, ett_htc_tree);
7380   proto_tree_add_boolean(lac_subtree, hf_ieee80211_htc_lac_reserved, tvb, offset, 1, htc);
7381   proto_tree_add_boolean(lac_subtree, hf_ieee80211_htc_lac_trq, tvb, offset, 1, htc);
7382
7383   if (HTC_IS_ASELI(htc)) {
7384     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mai_aseli, tvb, offset, 1, htc);
7385   } else {
7386     proto_tree_add_boolean(lac_subtree, hf_ieee80211_htc_lac_mai_mrq, tvb, offset, 1, htc);
7387     if (HTC_LAC_MAI_MRQ(htc)){
7388       proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mai_msi, tvb, offset, 1, htc);
7389     } else {
7390       proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mai_reserved, tvb, offset, 1, htc);
7391     }
7392   }
7393
7394   proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mfsi, tvb, offset, 2, htc);
7395   offset++;
7396
7397   if (HTC_IS_ASELI(htc)) {
7398     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_asel_command, tvb, offset, 1, htc);
7399     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_asel_data, tvb, offset, 1, htc);
7400   } else {
7401     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mfb, tvb, offset, 1, htc);
7402   }
7403   /* End: Link Adaptation Control */
7404
7405   offset++;
7406   htc = tvb_get_letohs(tvb, offset);
7407
7408   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_cal_pos, tvb, offset, 1, htc);
7409   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_cal_seq, tvb, offset, 1, htc);
7410   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_reserved1, tvb, offset, 1, htc);
7411   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_csi_steering, tvb, offset, 1, htc);
7412
7413   offset++;
7414   proto_tree_add_boolean(htc_tree, hf_ieee80211_htc_ndp_announcement, tvb, offset, 1, htc);
7415   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_reserved2, tvb, offset, 1, htc);
7416   proto_tree_add_boolean(htc_tree, hf_ieee80211_htc_ac_constraint, tvb, offset, 1, htc);
7417   proto_tree_add_boolean(htc_tree, hf_ieee80211_htc_rdg_more_ppdu, tvb, offset, 1, htc);
7418 }
7419
7420 static void
7421 dissect_frame_control(proto_tree * tree, tvbuff_t * tvb, gboolean wlan_broken_fc,
7422                       guint32 offset)
7423 {
7424   guint16 fcf, flags, frame_type_subtype;
7425   proto_tree *fc_tree, *flag_tree;
7426   proto_item *fc_item, *flag_item, *hidden_item;
7427
7428   fcf = FETCH_FCF(offset);
7429
7430   flags = FCF_FLAGS(fcf);
7431   frame_type_subtype = COMPOSE_FRAME_TYPE(fcf);
7432
7433   proto_tree_add_uint (tree, hf_ieee80211_fc_frame_type_subtype,
7434     tvb, wlan_broken_fc?offset+1:offset, 1,
7435     frame_type_subtype);
7436
7437   fc_item = proto_tree_add_uint_format (tree, hf_ieee80211_fc_field, tvb,
7438     offset, 2, fcf, "Frame Control: 0x%04X (%s)",
7439     fcf, wlan_broken_fc?"Swapped":"Normal");
7440
7441   fc_tree = proto_item_add_subtree (fc_item, ett_fc_tree);
7442
7443   proto_tree_add_uint (fc_tree, hf_ieee80211_fc_proto_version, tvb, wlan_broken_fc?offset+1:offset, 1,
7444     FCF_PROT_VERSION (fcf));
7445
7446   proto_tree_add_uint (fc_tree, hf_ieee80211_fc_frame_type, tvb, wlan_broken_fc?offset+1:offset, 1,
7447     FCF_FRAME_TYPE (fcf));
7448
7449   proto_tree_add_uint (fc_tree, hf_ieee80211_fc_frame_subtype, tvb, wlan_broken_fc?offset+1:offset, 1,
7450     FCF_FRAME_SUBTYPE (fcf));
7451
7452   flag_item = proto_tree_add_uint_format (fc_tree, hf_ieee80211_fc_flags, tvb,
7453     wlan_broken_fc?offset:offset+1, 1,
7454     flags, "Flags: 0x%X", flags);
7455
7456   flag_tree = proto_item_add_subtree (flag_item, ett_proto_flags);
7457   proto_tree_add_uint (flag_tree, hf_ieee80211_fc_data_ds, tvb, wlan_broken_fc?offset:offset+1, 1,
7458     FLAGS_DS_STATUS (flags));
7459   hidden_item = proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_to_ds, tvb, offset+1, 1, flags);
7460   PROTO_ITEM_SET_HIDDEN(hidden_item);
7461   hidden_item = proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_from_ds, tvb, offset+1, 1, flags);
7462   PROTO_ITEM_SET_HIDDEN(hidden_item);
7463   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_more_frag, tvb, wlan_broken_fc?offset:offset+1, 1,
7464     flags);
7465   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_retry, tvb, wlan_broken_fc?offset:offset+1, 1,
7466     flags);
7467   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_pwr_mgt, tvb, wlan_broken_fc?offset:offset+1, 1,
7468     flags);
7469   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_more_data, tvb, wlan_broken_fc?offset:offset+1, 1,
7470     flags);
7471   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_protected, tvb, wlan_broken_fc?offset:offset+1, 1,
7472     flags);
7473   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_order, tvb, wlan_broken_fc?offset:offset+1, 1,
7474     flags);
7475 }
7476
7477 static void
7478 dissect_vendor_ie_ht(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, 
7479                     guint offset, proto_item *item, proto_item *ti_len, gint tag_len)
7480 {
7481
7482   proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, 3, "802.11n (Pre) OUI");
7483   /* 802.11n OUI  Information Element */
7484   if (4 <= tag_len && !tvb_memeql(tvb, offset, PRE_11N_OUI"\x33", 4)) {
7485     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, 3, 1,"802.11n (Pre) HT information" );
7486
7487     dissect_ht_capability_ie(tvb, pinfo, tree, offset+4, tag_len - 4, ti_len, TRUE);
7488     proto_item_append_text(item, ": HT Capabilities (802.11n D1.10)");
7489   }
7490   else {
7491     if (4 <= tag_len && !tvb_memeql(tvb, offset, PRE_11N_OUI"\x34", 4)) {
7492       proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, 3, 1, "HT additional information (802.11n D1.00)");
7493
7494       dissect_ht_info_ie_1_0(tvb, pinfo, tree, offset+4, tag_len - 4, ti_len);
7495       proto_item_append_text(item, ": HT Additional Capabilities (802.11n D1.00)");
7496     }
7497     else {
7498         proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, 3, 1, "Unknown type");
7499         proto_item_append_text(item, ": 802.11n (pre) Unknown type");
7500         proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, 4,
7501                   tag_len - 4, "Not interpreted");
7502     }
7503   }
7504 }
7505
7506 static guint
7507 dissect_interworking(packet_info *pinfo, proto_tree *tree, proto_item *item,
7508                      tvbuff_t *tvb, int offset)
7509 {
7510   guint8 len;
7511
7512   offset++;
7513   len = tvb_get_guint8(tvb, offset);
7514   offset++;
7515
7516   if (tvb_reported_length_remaining(tvb, offset) < len || len == 0) {
7517     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7518                            "Truncated Interworking element");
7519     return offset;
7520   }
7521
7522   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_access_network_type,
7523                       tvb, offset, 1, ENC_BIG_ENDIAN);
7524   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_internet,
7525                       tvb, offset, 1, ENC_BIG_ENDIAN);
7526   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_asra,
7527                       tvb, offset, 1, ENC_BIG_ENDIAN);
7528   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_esr,
7529                       tvb, offset, 1, ENC_BIG_ENDIAN);
7530   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_uesa,
7531                       tvb, offset, 1, ENC_BIG_ENDIAN);
7532   offset++;
7533
7534   if (len == 1 + 2 || len == 1 + 2 + 6) {
7535     dissect_venue_info(tree, tvb, offset);
7536     offset += 2;
7537   }
7538
7539   if (len == 1 + 6 || len == 1 + 2 + 6) {
7540     proto_tree_add_item(tree, hf_ieee80211_tag_interworking_hessid,
7541                         tvb, offset, 6, ENC_NA);
7542     offset += 6;
7543   }
7544
7545   if (len != 1 && len != 1 + 2 && len != 1 + 6 && len != 1 + 2 + 6) {
7546     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7547                            "Invalid Interworking element length");
7548   }
7549
7550   return offset;
7551 }
7552
7553 static guint
7554 dissect_roaming_consortium(packet_info *pinfo, proto_tree *tree,
7555                            proto_item *item, tvbuff_t *tvb, int offset)
7556 {
7557   guint8 len, oi_lens, oi1_len, oi2_len;
7558   int end;
7559
7560   offset++;
7561   len = tvb_get_guint8(tvb, offset);
7562   offset++;
7563   end = offset + len;
7564
7565   if (tvb_reported_length_remaining(tvb, offset) < len || len < 2) {
7566     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7567                            "Truncated Roaming Consortium element");
7568     return 2 + len;
7569   }
7570
7571   proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_num_anqp_oi,
7572                       tvb, offset, 1, ENC_BIG_ENDIAN);
7573   offset++;
7574
7575   oi_lens = tvb_get_guint8(tvb, offset);
7576   oi1_len = oi_lens & 0x0f;
7577   oi2_len = (oi_lens & 0xf0) >> 4;
7578   proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi1_len,
7579                       tvb, offset, 1, ENC_BIG_ENDIAN);
7580   proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi2_len,
7581                       tvb, offset, 1, ENC_BIG_ENDIAN);
7582   offset++;
7583
7584   if (offset + oi1_len > end) {
7585     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7586                            "Truncated Roaming Consortium element");
7587     return 2 + len;
7588   }
7589
7590   item = proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi1,
7591                              tvb, offset, oi1_len, ENC_NA);
7592   add_manuf(item, tvb, offset);
7593   offset += oi1_len;
7594
7595   if (offset + oi2_len > end) {
7596     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7597                            "Truncated Roaming Consortium element");
7598     return 2 + len;
7599   }
7600
7601   if (oi2_len > 0) {
7602     proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi2,
7603                         tvb, offset, oi2_len, ENC_NA);
7604     offset += oi2_len;
7605   }
7606
7607   if (end > offset) {
7608     proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi3,
7609                         tvb, offset, end - offset, ENC_NA);
7610   }
7611
7612   return 2 + len;
7613 }
7614
7615
7616 /* ************************************************************************* */
7617 /*           Dissect and add tagged (optional) fields to proto tree          */
7618 /* ************************************************************************* */
7619
7620
7621 static int beacon_padding = 0; /* beacon padding bug */
7622
7623 static int ieee80211_tag_ssid(packet_info *pinfo, proto_tree *tree,
7624                               proto_item *ti, proto_item *ti_len,
7625                               guint32 tag_len, tvbuff_t *tvb, int offset)
7626 {
7627   /* 7.3.2.1 SSID element (0) */
7628   guint8 *ssid; /* The SSID may consist of arbitrary bytes */
7629
7630   if (beacon_padding != 0) /* padding bug */
7631     return offset;
7632
7633   if(tag_len > MAX_SSID_LEN) {
7634     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7635                            "SSID length (%u) greater than maximum (%u)",
7636                            tag_len, MAX_SSID_LEN);
7637   }
7638
7639   ssid = tvb_get_ephemeral_string(tvb, offset + 2, tag_len);
7640   AirPDcapSetLastSSID(&airpdcap_ctx, (CHAR *) ssid, tag_len);
7641   proto_tree_add_item(tree, hf_ieee80211_tag_ssid, tvb, offset + 2, tag_len,
7642                       ENC_ASCII|ENC_NA);
7643   if (tag_len > 0) {
7644     proto_item_append_text(ti, ": %s", ssid);
7645
7646     col_append_fstr(pinfo->cinfo, COL_INFO, ", SSID=%s", ssid);
7647
7648     /* Wlan Stats */
7649     memcpy(wlan_stats.ssid, ssid, MIN(tag_len, MAX_SSID_LEN));
7650     wlan_stats.ssid_len = tag_len;
7651   } else {
7652     proto_item_append_text(ti, ": Broadcast");
7653
7654     col_append_str(pinfo->cinfo, COL_INFO, ", SSID=Broadcast");
7655   }
7656
7657   beacon_padding++; /* padding bug */
7658
7659   return offset + 2 + tag_len;
7660 }
7661
7662 static int ieee80211_tag_supp_rates(packet_info *pinfo, proto_tree *tree,
7663                                     proto_item *ti, proto_item *ti_len,
7664                                     guint32 tag_len, tvbuff_t *tvb,
7665                                     int offset, int tag_end)
7666 {
7667   /* 7.3.2.2 Supported Rates element (1) */
7668   if (tag_len < 1) {
7669     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7670                            "Tag length %u too short, must be greater than 0",
7671                            tag_len);
7672     return offset;
7673   }
7674
7675   offset += 2;
7676
7677   while (offset < tag_end) {
7678     proto_tree_add_item(tree, hf_ieee80211_tag_supp_rates, tvb, offset, 1,
7679                         ENC_BIG_ENDIAN);
7680     proto_item_append_text(ti, " %s,",
7681                            val_to_str(tvb_get_guint8(tvb, offset),
7682                                       ieee80211_supported_rates_vals,
7683                                       "Unknown Rate") );
7684     offset++;
7685   }
7686
7687   proto_item_append_text(ti, " [Mbit/sec]");
7688
7689   return offset;
7690 }
7691
7692 static int ieee80211_tag_fh_parameter(packet_info *pinfo, proto_tree *tree,
7693                                       proto_item *ti_len, guint32 tag_len,
7694                                       tvbuff_t *tvb, int offset)
7695 {
7696   /* 7.3.2.3 FH Parameter Set element (2) */
7697   if (tag_len < 5) {
7698     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7699                            "Tag length %u too short, must be >= 5", tag_len);
7700     return offset;
7701   }
7702
7703   offset += 2;
7704
7705   proto_tree_add_item(tree, hf_ieee80211_tag_fh_dwell_time,
7706                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
7707   offset += 2;
7708
7709   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hop_set,
7710                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7711   offset++;
7712
7713   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hop_pattern,
7714                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7715   offset++;
7716
7717   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hop_index,
7718                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7719   offset++;
7720
7721   return offset;
7722 }
7723
7724 static int ieee80211_tag_ds_parameter(packet_info *pinfo, proto_tree *tree,
7725                                       proto_item *ti, proto_item *ti_len,
7726                                       guint32 tag_len, tvbuff_t *tvb,
7727                                       int offset)
7728 {
7729   /* 7.3.2.4 DS Parameter Set element (3) */
7730   if (tag_len != 1) {
7731     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7732                            "Tag length %u wrong, must be = 1", tag_len);
7733     return offset;
7734   }
7735
7736   offset += 2;
7737
7738   proto_tree_add_item(tree, hf_ieee80211_tag_ds_param_channel,
7739                       tvb, offset, 1, ENC_BIG_ENDIAN);
7740
7741   proto_item_append_text(ti, " : Current Channel: %u",
7742                          tvb_get_guint8(tvb, offset));
7743
7744   wlan_stats.channel = tvb_get_guint8(tvb, offset);
7745   offset++;
7746
7747   return offset;
7748 }
7749
7750 static int ieee80211_tag_cf_parameter(packet_info *pinfo, proto_tree *tree,
7751                                       proto_item *ti, proto_item *ti_len,
7752                                       guint32 tag_len, tvbuff_t *tvb,
7753                                       int offset)
7754 {
7755   /* 7.3.2.5 CF Parameter Set element (4) */
7756   if (tag_len != 6) {
7757     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7758                            "Tag length %u wrong, must be = 6", tag_len);
7759     return offset;
7760   }
7761
7762   offset += 2;
7763
7764   proto_tree_add_item(tree, hf_ieee80211_tag_cfp_count,
7765                       tvb, offset, 1, ENC_BIG_ENDIAN);
7766   proto_item_append_text(ti, ": CFP count %u", tvb_get_guint8(tvb, offset));
7767   offset++;
7768
7769   proto_tree_add_item(tree, hf_ieee80211_tag_cfp_period,
7770                       tvb, offset, 1, ENC_BIG_ENDIAN);
7771   proto_item_append_text(ti, ": CFP Period %u", tvb_get_guint8(tvb, offset));
7772   offset++;
7773
7774   proto_tree_add_item(tree, hf_ieee80211_tag_cfp_max_duration,
7775                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
7776   proto_item_append_text(ti, ": CFP Max Duration %u",
7777                          tvb_get_letohs(tvb, offset));
7778   offset += 2;
7779
7780   proto_tree_add_item(tree, hf_ieee80211_tag_cfp_dur_remaining,
7781                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
7782   proto_item_append_text(ti, ": CFP Dur Remaining %u",
7783                          tvb_get_letohs(tvb, offset));
7784   offset++;
7785
7786   return offset;
7787 }
7788
7789 static int ieee80211_tag_tim(packet_info *pinfo, proto_tree *tree,
7790                              proto_item *ti, proto_item *ti_len,
7791                              guint32 tag_len, tvbuff_t *tvb, int offset)
7792 {
7793   proto_tree *bmapctl_tree;
7794   proto_item *bmapctl_item;
7795
7796   /* 7.3.2.6 TIM (5) */
7797   if (tag_len < 4) {
7798     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7799                            "Tag length %u too short, must be >= 4", tag_len);
7800     return offset;
7801   }
7802
7803   offset += 2;
7804
7805   proto_tree_add_item(tree, hf_ieee80211_tim_dtim_count,
7806                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7807   proto_item_append_text(ti, ": DTIM %u of", tvb_get_guint8(tvb, offset));
7808   offset++;
7809
7810   proto_tree_add_item(tree, hf_ieee80211_tim_dtim_period,
7811                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7812   proto_item_append_text(ti, " %u bitmap", tvb_get_guint8(tvb, offset + 1));
7813   offset++;
7814
7815   bmapctl_item = proto_tree_add_item(tree, hf_ieee80211_tim_bmapctl,
7816                                      tvb, offset, 1, ENC_LITTLE_ENDIAN);
7817   bmapctl_tree = proto_item_add_subtree(bmapctl_item, ett_tag_bmapctl_tree);
7818   proto_tree_add_item(bmapctl_tree, hf_ieee80211_tim_bmapctl_mcast,
7819                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7820   proto_tree_add_item(bmapctl_tree, hf_ieee80211_tim_bmapctl_offset,
7821                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7822   offset++;
7823
7824   proto_tree_add_item(tree, hf_ieee80211_tim_partial_virtual_bitmap,
7825                       tvb, offset, tag_len - 3, ENC_NA);
7826   offset += tag_len - 3;
7827
7828   return offset;
7829 }
7830
7831 static int ieee80211_tag_ibss_parameter(packet_info *pinfo, proto_tree *tree,
7832                                         proto_item *ti, proto_item *ti_len,
7833                                         guint32 tag_len, tvbuff_t *tvb,
7834                                         int offset)
7835 {
7836   /* 7.3.2.7 IBSS Parameter Set element (6) */
7837
7838   if (tag_len != 2) {
7839     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7840                            "Tag length %u wrong, must be = 2", tag_len);
7841     return offset;
7842   }
7843
7844   offset += 2;
7845
7846   proto_tree_add_item(tree, hf_ieee80211_tag_ibss_atim_window,
7847                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
7848   proto_item_append_text(ti, ": ATIM window 0x%x",
7849                          tvb_get_letohs(tvb, offset));
7850   offset += 2;
7851
7852   return offset;
7853 }
7854
7855 static const value_string environment_vals[] = {
7856   { 0x20, "Any" },
7857   { 0x4f, "Outdoor" },
7858   { 0x49, "Indoor" },
7859   { 0,    NULL }
7860 };
7861
7862 static int ieee80211_tag_country_info(packet_info *pinfo, proto_tree *tree,
7863                                       proto_item *ti, proto_item *ti_len,
7864                                       guint32 tag_len, tvbuff_t *tvb,
7865                                       int offset, int tag_end)
7866 {
7867   /* 7.3.2.9 Country information element (7) */
7868   proto_tree *sub_tree;
7869   proto_item *sub_item;
7870
7871   if (tag_len < 6) {
7872     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7873                            "Tag length %u too short, must be >= 6", tag_len);
7874     return offset;
7875   }
7876
7877   offset += 2;
7878
7879   proto_tree_add_item(tree, hf_ieee80211_tag_country_info_code,
7880                       tvb, offset, 2, ENC_ASCII|ENC_NA);
7881   proto_item_append_text(ti, ": Country Code %s",
7882                          tvb_get_ephemeral_string(tvb, offset, 2));
7883   offset += 2;
7884
7885   proto_tree_add_item(tree, hf_ieee80211_tag_country_info_env,
7886                       tvb, offset, 1, ENC_BIG_ENDIAN);
7887   proto_item_append_text(ti, ", Environment %s",
7888                          val_to_str(tvb_get_guint8(tvb, offset),
7889                                     environment_vals,"Unknown (0x%02x)"));
7890   offset++;
7891
7892   while (offset < tag_end) {
7893     /* Padding ? */
7894     if ((tag_end - offset) < 3) {
7895       proto_tree_add_item(tree, hf_ieee80211_tag_country_info_pad,
7896                           tvb, offset, 1, ENC_NA);
7897       offset++;
7898       continue;
7899     }
7900     if (tvb_get_guint8(tvb, offset) <= 200) { /* 802.11d */
7901       sub_item = proto_tree_add_item(tree, hf_ieee80211_tag_country_info_fnm,
7902                                      tvb, offset, 3, ENC_NA);
7903       sub_tree = proto_item_add_subtree(sub_item, ett_tag_country_fnm_tree);
7904
7905       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_fnm_fcn,
7906                           tvb, offset, 1, ENC_BIG_ENDIAN);
7907       proto_item_append_text(sub_item, ": First Channel Number: %d",
7908                              tvb_get_guint8(tvb, offset));
7909       offset++;
7910       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_fnm_nc,
7911                           tvb, offset, 1, ENC_BIG_ENDIAN);
7912       proto_item_append_text(sub_item, ", Number of Channels: %d",
7913                              tvb_get_guint8(tvb, offset));
7914       offset++;
7915       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_fnm_mtpl,
7916                           tvb, offset, 1, ENC_BIG_ENDIAN);
7917       proto_item_append_text(sub_item,
7918                              ", Maximum Transmit Power Level: %d dBm",
7919                              tvb_get_guint8(tvb, offset));
7920       offset++;
7921     } else { /* 802.11j */
7922       sub_item = proto_tree_add_item(tree, hf_ieee80211_tag_country_info_rrc,
7923                                      tvb, offset, 3, ENC_NA);
7924       sub_tree = proto_item_add_subtree(sub_item, ett_tag_country_rcc_tree);
7925
7926       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_rrc_rei,
7927                           tvb, offset, 1, ENC_BIG_ENDIAN);
7928       proto_item_append_text(sub_item,
7929                              ": Regulatory Extension Identifier: %d",
7930                              tvb_get_guint8(tvb, offset));
7931       offset++;
7932       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_rrc_rc,
7933                           tvb, offset, 1, ENC_BIG_ENDIAN);
7934       proto_item_append_text(sub_item, ", Regulatory Class: %d",
7935                              tvb_get_guint8(tvb, offset));
7936       offset++;
7937       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_rrc_cc,
7938                           tvb, offset, 1, ENC_BIG_ENDIAN);
7939       proto_item_append_text(sub_item, ", Coverage Class: %d",
7940                              tvb_get_guint8(tvb, offset));
7941       offset++;
7942     }
7943   }
7944
7945   return offset;
7946 }
7947
7948 static int ieee80211_tag_fh_hopping_parameter(packet_info *pinfo,
7949                                               proto_tree *tree,
7950                                               proto_item *ti,
7951                                               proto_item *ti_len,
7952                                               guint32 tag_len, tvbuff_t *tvb,
7953                                               int offset)
7954 {
7955   /* 7.3.2.10 Hopping Pattern Parameters information element (8) */
7956   if (tag_len < 2) {
7957     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7958                            "Tag length %u too short, must be >= 2", tag_len);
7959     return offset;
7960   }
7961
7962   offset += 2;
7963
7964   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_parameter_prime_radix,
7965                       tvb, offset, 1, ENC_BIG_ENDIAN);
7966   proto_item_append_text(ti, ": Prime Radix: %u", tvb_get_guint8(tvb, offset));
7967   offset++;
7968
7969   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_parameter_nb_channels,
7970                       tvb, offset, 1, ENC_BIG_ENDIAN);
7971   proto_item_append_text(ti, ", Number of Channels: %u",
7972                          tvb_get_guint8(tvb, offset));
7973   offset++;
7974
7975   return offset;
7976 }
7977
7978 static int ieee80211_tag_fh_hopping_table(packet_info *pinfo, proto_tree *tree,
7979                                           proto_item *ti_len,
7980                                           guint32 tag_len, tvbuff_t *tvb,
7981                                           int offset, int tag_end)
7982 {
7983   /* 7.3.2.11 Hopping Pattern Table information element (9) */
7984   if (tag_len < 4) {
7985     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7986                            "Tag length %u too short, must be >= 4", tag_len);
7987     return offset;
7988   }
7989
7990   offset += 2;
7991
7992   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_flag,
7993                       tvb, offset, 1, ENC_BIG_ENDIAN);
7994   offset++;
7995
7996   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_number_of_sets,
7997                       tvb, offset, 1, ENC_BIG_ENDIAN);
7998   offset++;
7999
8000   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_modulus,
8001                       tvb, offset, 1, ENC_BIG_ENDIAN);
8002   offset++;
8003
8004   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_offset,
8005                       tvb, offset, 1, ENC_BIG_ENDIAN);
8006   offset++;
8007
8008   while (offset < tag_end) {
8009     proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_random_table,
8010                         tvb, offset, 2, ENC_BIG_ENDIAN);
8011     offset += 2;
8012   }
8013
8014   return offset;
8015 }
8016
8017 static int
8018 add_tagged_field(packet_info * pinfo, proto_tree * tree, tvbuff_t * tvb, int offset, int ftype)
8019 {
8020   guint32 oui;
8021   tvbuff_t *tag_tvb;
8022   const guint8 *tag_data_ptr;
8023   guint32 tag_no, tag_len;
8024   int n, ret;
8025   char print_buff[SHORT_STR];
8026   proto_tree * orig_tree=tree;
8027   proto_item *ti = NULL, *ti_len = NULL;
8028   int tag_end;
8029
8030   tag_no = tvb_get_guint8(tvb, offset);
8031   tag_len = tvb_get_guint8(tvb, offset + 1);
8032   tag_end = offset + 2 + tag_len;
8033   if (tree) {
8034     ti = proto_tree_add_item(orig_tree, hf_ieee80211_tag, tvb, offset, 2 + tag_len , ENC_NA);
8035     proto_item_append_text(ti, ": %s", val_to_str(tag_no, tag_num_vals, "Reserved (%d)"));
8036
8037     tree = proto_item_add_subtree(ti, ett_80211_mgt_ie);
8038
8039     proto_tree_add_item(tree, hf_ieee80211_tag_number, tvb, offset, 1, ENC_BIG_ENDIAN);
8040
8041   }
8042   ti_len = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, 1, tag_len);
8043
8044   switch (tag_no) {
8045   case TAG_SSID:
8046     offset += ieee80211_tag_ssid(pinfo, tree, ti, ti_len, tag_len, tvb,
8047                                  offset);
8048     break;
8049   case TAG_SUPP_RATES:
8050     offset += ieee80211_tag_supp_rates(pinfo, tree, ti, ti_len, tag_len, tvb,
8051                                        offset, tag_end);
8052     break;
8053   case TAG_FH_PARAMETER:
8054     offset += ieee80211_tag_fh_parameter(pinfo, tree, ti_len, tag_len, tvb,
8055                                          offset);
8056     break;
8057   case TAG_DS_PARAMETER:
8058     offset += ieee80211_tag_ds_parameter(pinfo, tree, ti, ti_len, tag_len, tvb,
8059                                          offset);
8060     break;
8061   case TAG_CF_PARAMETER:
8062     offset += ieee80211_tag_cf_parameter(pinfo, tree, ti, ti_len, tag_len, tvb,
8063                                          offset);
8064     break;
8065   case TAG_TIM:
8066     offset += ieee80211_tag_tim(pinfo, tree, ti, ti_len, tag_len, tvb, offset);
8067     break;
8068   case TAG_IBSS_PARAMETER:
8069     offset += ieee80211_tag_ibss_parameter(pinfo, tree, ti, ti_len, tag_len,
8070                                            tvb, offset);
8071     break;
8072   case TAG_COUNTRY_INFO:
8073     offset += ieee80211_tag_country_info(pinfo, tree, ti, ti_len, tag_len, tvb,
8074                                          offset, tag_end);
8075     break;
8076   case TAG_FH_HOPPING_PARAMETER:
8077     offset += ieee80211_tag_fh_hopping_parameter(pinfo, tree, ti, ti_len,
8078                                                  tag_len, tvb, offset);
8079     break;
8080   case TAG_FH_HOPPING_TABLE:
8081     offset += ieee80211_tag_fh_hopping_table(pinfo, tree, ti_len, tag_len,
8082                                              tvb, offset, tag_end);
8083     break;
8084
8085     case TAG_REQUEST: /* 7.3.2.12 Request information element (10) */
8086       while(offset < tag_end )
8087       {
8088         proto_tree_add_item(tree, hf_ieee80211_tag_request, tvb, offset, 1, ENC_BIG_ENDIAN);
8089         offset += 1;
8090       }
8091       break;
8092
8093     case TAG_QBSS_LOAD: /* 7.3.2.28 BSS Load element (11) */
8094       if (tag_len < 4 || tag_len >5)
8095       {
8096         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 4 or 5", tag_len);
8097         break;
8098       }
8099
8100       if (tag_len == 4)
8101       {
8102         /* QBSS Version 1 */
8103         proto_item_append_text(ti, " Cisco QBSS Version 1 - non CCA");
8104
8105         /* Extract Values */
8106         proto_tree_add_uint(tree, hf_ieee80211_qbss_version, tvb, offset + 2, tag_len, 1);
8107         proto_tree_add_item(tree, hf_ieee80211_qbss_scount, tvb, offset + 2, 2, ENC_LITTLE_ENDIAN);
8108         proto_tree_add_item(tree, hf_ieee80211_qbss_cu, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
8109         proto_tree_add_item(tree, hf_ieee80211_qbss_adc, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
8110       }
8111       else if (tag_len == 5)
8112       {
8113          /* QBSS Version 2 */
8114          proto_item_append_text(ti, " 802.11e CCA Version");
8115
8116          /* Extract Values */
8117          proto_tree_add_uint(tree, hf_ieee80211_qbss_version, tvb, offset + 2, tag_len, 2);
8118          proto_tree_add_item(tree, hf_ieee80211_qbss_scount, tvb, offset + 2, 2, ENC_LITTLE_ENDIAN);
8119          proto_tree_add_item(tree, hf_ieee80211_qbss_cu, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
8120          proto_tree_add_item(tree, hf_ieee80211_qbss_adc, tvb, offset + 5, 2, ENC_LITTLE_ENDIAN);
8121       }
8122       break;
8123
8124     case TAG_TSPEC: /* 7.3.2.30 TSPEC element (13) */
8125       if (tag_len != 55)
8126       {
8127         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 55", tag_len);
8128         break;
8129       }
8130       offset += 2;
8131
8132       add_fixed_field(tree, tvb, offset, FIELD_QOS_TS_INFO);
8133       offset += 3;
8134
8135       proto_tree_add_item(tree, hf_ieee80211_tspec_nor_msdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8136       offset += 2;
8137
8138       proto_tree_add_item(tree, hf_ieee80211_tspec_max_msdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8139       offset += 2;
8140
8141       proto_tree_add_item(tree, hf_ieee80211_tspec_min_srv, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8142       offset += 4;
8143
8144       proto_tree_add_item(tree, hf_ieee80211_tspec_max_srv, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8145       offset += 4;
8146
8147       proto_tree_add_item(tree, hf_ieee80211_tspec_inact_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8148       offset += 4;
8149
8150       proto_tree_add_item(tree, hf_ieee80211_tspec_susp_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8151       offset += 4;
8152
8153       proto_tree_add_item(tree, hf_ieee80211_tspec_srv_start, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8154       offset += 4;
8155
8156       proto_tree_add_item(tree, hf_ieee80211_tspec_min_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8157       offset += 4;
8158
8159       proto_tree_add_item(tree, hf_ieee80211_tspec_mean_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8160       offset += 4;
8161
8162       proto_tree_add_item(tree, hf_ieee80211_tspec_peak_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8163       offset += 4;
8164
8165       proto_tree_add_item(tree, hf_ieee80211_tspec_burst_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8166       offset += 4;
8167
8168       proto_tree_add_item(tree, hf_ieee80211_tspec_delay_bound, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8169       offset += 4;
8170
8171       proto_tree_add_item(tree, hf_ieee80211_tspec_min_phy, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8172       offset += 4;
8173
8174       proto_tree_add_item(tree, hf_ieee80211_tspec_surplus, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8175       offset += 2;
8176
8177       proto_tree_add_item(tree, hf_ieee80211_tspec_medium, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8178       offset += 2;
8179
8180       break;
8181
8182     case TAG_TCLAS: /* 7.3.2.31 TCLAS element (14) */
8183       if (tag_len < 6)
8184       {
8185         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 6", tag_len);
8186         break;
8187       }
8188       {
8189       guint8 type;
8190       guint8 version;
8191
8192       offset += 2;
8193       proto_tree_add_item(tree, hf_ieee80211_tclas_up, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8194       type = tvb_get_guint8(tvb, offset);
8195       offset += 1;
8196
8197       proto_tree_add_item(tree, hf_ieee80211_tclas_class_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8198       offset += 1;
8199
8200       proto_tree_add_item(tree, hf_ieee80211_tclas_class_mask, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8201       offset += 1;
8202
8203       switch (type)
8204         {
8205           case 0:
8206             proto_tree_add_item(tree, hf_ieee80211_tclas_src_mac_addr, tvb, offset, 6, ENC_NA);
8207             offset += 6;
8208
8209             proto_tree_add_item(tree, hf_ieee80211_tclas_dst_mac_addr, tvb, offset, 6, ENC_NA);
8210             offset += 6;
8211
8212             proto_tree_add_item(tree, hf_ieee80211_tclas_ether_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8213             offset += 2;
8214             break;
8215
8216           case 1:
8217             version = tvb_get_guint8(tvb, offset + 5);
8218             proto_tree_add_item(tree, hf_ieee80211_tclas_version, tvb, offset + 5, 1, ENC_LITTLE_ENDIAN);
8219             offset += 1;
8220             if (version == 4)
8221             {
8222               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv4_src, tvb, offset, 4, ENC_BIG_ENDIAN);
8223               offset += 4;
8224               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv4_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
8225               offset += 4;
8226               proto_tree_add_item(tree, hf_ieee80211_tclas_src_port, tvb, offset, 2, ENC_BIG_ENDIAN);
8227               offset += 2;
8228               proto_tree_add_item(tree, hf_ieee80211_tclas_dst_port, tvb, offset, 2, ENC_BIG_ENDIAN);
8229               offset += 2;
8230               proto_tree_add_item(tree, hf_ieee80211_tclas_dscp, tvb, offset, 1, ENC_BIG_ENDIAN);
8231               offset += 1;
8232               proto_tree_add_item(tree, hf_ieee80211_tclas_protocol, tvb, offset, 1, ENC_BIG_ENDIAN);
8233               offset += 1;
8234             }
8235             else if (version == 6)
8236             {
8237               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv6_src, tvb, offset, 16, ENC_NA);
8238               offset += 16;
8239               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv6_dst, tvb, offset, 16, ENC_NA);
8240               offset += 16;
8241               proto_tree_add_item(tree, hf_ieee80211_tclas_src_port, tvb, offset, 2, ENC_BIG_ENDIAN);
8242               offset += 2;
8243               proto_tree_add_item(tree, hf_ieee80211_tclas_dst_port, tvb, offset, 2, ENC_BIG_ENDIAN);
8244               offset += 2;
8245               proto_tree_add_item(tree, hf_ieee80211_tclas_flow, tvb, offset, 3, ENC_BIG_ENDIAN);
8246               offset += 3;
8247             }
8248             break;
8249
8250           case 2:
8251             proto_tree_add_item(tree, hf_ieee80211_tclas_tag_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8252             offset += 2;
8253             break;
8254
8255           default:
8256             break;
8257         }
8258       }
8259       break;
8260
8261     case TAG_SCHEDULE: /* 7.3.2.34 Schedule element (15) */
8262       if (tag_len != 14)
8263       {
8264         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 14", tag_len);
8265         break;
8266       }
8267       offset += 2;
8268
8269       add_fixed_field(tree, tvb, offset, FIELD_SCHEDULE_INFO);
8270       offset += 2;
8271
8272       proto_tree_add_item(tree, hf_ieee80211_sched_srv_start, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8273       offset += 4;
8274
8275       proto_tree_add_item(tree, hf_ieee80211_sched_srv_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8276       offset += 4;
8277
8278       proto_tree_add_item(tree, hf_ieee80211_sched_spec_int, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8279       offset += 2;
8280       break;
8281
8282     case TAG_CHALLENGE_TEXT: /* 7.3.2.8 Challenge Text element (16) */
8283       offset += 2;
8284       proto_tree_add_item(tree, hf_ieee80211_tag_challenge_text, tvb, offset, tag_len, ENC_NA);
8285       break;
8286
8287     case TAG_POWER_CONSTRAINT: /* 7.3.2.15 Power Constraint element (32) */
8288     {
8289       if (tag_len != 1)
8290       {
8291         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
8292         break;
8293       }
8294       offset += 2;
8295
8296       proto_tree_add_item(tree, hf_ieee80211_tag_power_constraint_local, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8297       proto_item_append_text(ti, " :%d", tvb_get_guint8(tvb, offset));
8298       offset += 1;
8299
8300       break;
8301     }
8302
8303     case TAG_POWER_CAPABILITY: /* 7.3.2.16 Power Capability element (33) */
8304     {
8305       if (tag_len != 2)
8306       {
8307         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 2", tag_len);
8308         break;
8309       }
8310       offset += 2;
8311
8312       proto_tree_add_item(tree, hf_ieee80211_tag_power_capability_min, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8313       proto_item_append_text(ti, " Min: %d", tvb_get_guint8(tvb, offset));
8314       offset += 1;
8315
8316       proto_tree_add_item(tree, hf_ieee80211_tag_power_capability_max, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8317       proto_item_append_text(ti, ", Max :%d", tvb_get_guint8(tvb, offset));
8318       offset += 1;
8319       break;
8320     }
8321
8322     case TAG_TPC_REQUEST: /* 7.3.2.18 TPC Request element (34) */
8323     {
8324       if (tag_len != 0)
8325       {
8326         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 0", tag_len);
8327         break;
8328       }
8329       offset += 2;
8330
8331       /* No Data */
8332       break;
8333     }
8334
8335     case TAG_TPC_REPORT: /* 7.3.2.18 TPC Report element (35) */
8336     {
8337       if (tag_len != 2)
8338       {
8339         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 2", tag_len);
8340         break;
8341       }
8342       offset += 2;
8343
8344       proto_tree_add_item(tree, hf_ieee80211_tag_tpc_report_trsmt_pow, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8345       proto_item_append_text(ti, " Transmit Power :%d", tvb_get_guint8(tvb, offset));
8346       offset += 1;
8347
8348       proto_tree_add_item(tree, hf_ieee80211_tag_tpc_report_link_mrg, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8349       proto_item_append_text(ti, ", Link Margin :%d", tvb_get_guint8(tvb, offset));
8350       offset += 1;
8351
8352       break;
8353     }
8354
8355     case TAG_SUPPORTED_CHANNELS: /* 7.3.2.19 Supported Channels element (36) */
8356       {
8357         proto_item *chan_item;
8358         proto_tree *chan_tree;
8359         guint i = 1;
8360
8361         offset += 2;
8362         if (tag_len % 2 == 1) {
8363            expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u must be even",tag_len);
8364            break;
8365         }
8366         while(offset < tag_end)
8367         {
8368           chan_item = proto_tree_add_item(tree, hf_ieee80211_tag_supported_channels, tvb, offset, 2, ENC_NA);
8369           proto_item_append_text(chan_item, " #%d", i);
8370           i++;
8371
8372           chan_tree = proto_item_add_subtree(chan_item , ett_tag_supported_channels);
8373
8374           proto_tree_add_item(chan_tree, hf_ieee80211_tag_supported_channels_first, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8375           proto_item_append_text(chan_item, " First: %d", tvb_get_guint8(tvb, offset));
8376           offset += 1;
8377
8378           proto_tree_add_item(chan_tree, hf_ieee80211_tag_supported_channels_range, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8379           proto_item_append_text(chan_item, ", Range: %d ", tvb_get_guint8(tvb, offset));
8380           offset += 1;
8381
8382         }
8383         break;
8384       }
8385     case TAG_CHANNEL_SWITCH_ANN: /* 7.3.2.20 Channel Switch Announcement element (37) */
8386     {
8387       if (tag_len != 3)
8388       {
8389         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 3", tag_len);
8390         break;
8391       }
8392       offset += 2;
8393
8394       proto_tree_add_item(tree, hf_ieee80211_csa_channel_switch_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8395       proto_item_append_text(ti, " Mode: %d", tvb_get_guint8(tvb, offset));
8396       offset += 1;
8397
8398       proto_tree_add_item(tree, hf_ieee80211_csa_new_channel_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8399       proto_item_append_text(ti, ", Number: %d ", tvb_get_guint8(tvb, offset));
8400       offset += 1;
8401
8402       proto_tree_add_item(tree, hf_ieee80211_csa_channel_switch_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8403       proto_item_append_text(ti, ", Count: %d ", tvb_get_guint8(tvb, offset));
8404       offset += 1;
8405     }
8406
8407     case TAG_MEASURE_REQ: /* 7.3.2.21 Measurement Request element (38) with update from 802.11k-2008 */
8408       if (tag_len < 3)
8409       {
8410         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 3", tag_len);
8411         break;
8412       }
8413       {
8414         guint8 request_type;
8415         proto_item *parent_item;
8416         proto_tree *sub_tree;
8417
8418         offset += 2;
8419
8420         proto_tree_add_item(tree, hf_ieee80211_tag_measure_request_token, tvb, offset, 1, ENC_NA);
8421         offset += 1;
8422
8423         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_request_mode, tvb, offset, 1, ENC_NA);
8424         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_request_mode_tree);
8425         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_parallel, tvb, offset, 1, ENC_NA);
8426         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_enable, tvb, offset, 1, ENC_NA);
8427         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_request, tvb, offset, 1, ENC_NA);
8428         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_report, tvb, offset, 1, ENC_NA);
8429         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_duration_mandatory, tvb, offset, 1, ENC_NA);
8430         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_reserved, tvb, offset, 1, ENC_NA);
8431         offset += 1;
8432
8433
8434         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_request_type, tvb, offset, 1, ENC_NA);
8435         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_request_type_tree);
8436         request_type = tvb_get_guint8 (tvb, offset);
8437         offset += 1;
8438
8439         switch(request_type) {
8440           case 0: /* Basic Request */
8441           case 1: /* Clear channel assessment (CCA) request */
8442           case 2: /* Receive power indication (RPI) histogram request */
8443           {
8444
8445             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
8446             offset += 1;
8447
8448             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8449             offset += 8;
8450
8451             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8452             offset += 2;
8453             break;
8454           }
8455           case 3: /* Channel Load Request */
8456           case 4: /* Noise Histogram Request */
8457           {
8458             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_regulatory_class, tvb, offset, 1, ENC_NA);
8459             offset += 1;
8460
8461             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
8462             offset += 1;
8463
8464             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8465             offset += 2;
8466
8467             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8468             offset += 2;
8469             /* TODO Add Optionnal Subelements */
8470             break;
8471           }
8472           case 5: /* Beacon Request */
8473           {
8474             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_regulatory_class, tvb, offset, 1, ENC_NA);
8475             offset += 1;
8476
8477             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
8478             offset += 1;
8479
8480             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8481             offset += 2;
8482
8483             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8484             offset += 2;
8485
8486             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_measurement_mode, tvb, offset, 1, ENC_NA);
8487             offset += 1;
8488
8489             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_bssid, tvb, offset, 6, ENC_NA);
8490             offset += 6;
8491
8492             while(offset < tag_end)
8493             {
8494               guint8 sub_id, sub_length, sub_tag_end;
8495               proto_item *ti;
8496               proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_id, tvb, offset, 1, ENC_NA);
8497               sub_id = tvb_get_guint8(tvb, offset);
8498               offset += 1;
8499
8500               proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_subelement_length, tvb, offset, 1, ENC_NA);
8501               sub_length = tvb_get_guint8(tvb, offset);
8502               offset += 1;
8503               sub_tag_end = offset + sub_length;
8504
8505               switch(sub_id){
8506                 case MEASURE_REQ_BEACON_SUB_SSID: /* SSID (0) */
8507                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_ssid, tvb, offset, sub_length, ENC_ASCII|ENC_NA);
8508                   offset += sub_length;
8509                   break;
8510                 case MEASURE_REQ_BEACON_SUB_BRI: /* Beacon Reporting Information (1) */
8511                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition, tvb, offset, 1, ENC_BIG_ENDIAN);
8512                   offset += 1;
8513                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_bri_threshold_offset, tvb, offset, 1, ENC_BIG_ENDIAN);
8514                   offset += 1;
8515                   break;
8516                 case MEASURE_REQ_BEACON_SUB_RD: /* Reporting Detail (2) */
8517                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_reporting_detail, tvb, offset, 1, ENC_BIG_ENDIAN);
8518                   offset += 1;
8519                   break;
8520                 case MEASURE_REQ_BEACON_SUB_REQUEST: /* Request (10) */
8521                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_request, tvb, offset, 1, ENC_BIG_ENDIAN);
8522                   offset += 1;
8523                   break;
8524                 case MEASURE_REQ_BEACON_SUB_APCP: /* Request (51) */
8525                   /* TODO */
8526                   break;
8527                 default:
8528                   /* no default action */
8529                   break;
8530              }
8531              if(offset < sub_tag_end)
8532              {
8533                ti = proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_unknown, tvb, offset, sub_tag_end - offset, ENC_NA);
8534                expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, " Unknown Data (not interpreted)");
8535                offset = sub_tag_end;
8536              }
8537             }
8538
8539             break;
8540           }
8541           case 6: /* Frame Request */
8542           {
8543             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_regulatory_class, tvb, offset, 1, ENC_NA);
8544             offset += 1;
8545
8546             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
8547             offset += 1;
8548
8549             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8550             offset += 2;
8551
8552             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8553             offset += 2;
8554
8555             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_frame_request_type, tvb, offset, 1, ENC_NA);
8556             offset += 1;
8557
8558             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mac_address, tvb, offset, 6, ENC_NA);
8559             offset += 6;
8560
8561             /* TODO Add Optionnal Subelements */
8562             break;
8563           }
8564           case 7: /* BSTA Statistics Request */
8565           {
8566             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_peer_mac_address, tvb, offset, 6, ENC_NA);
8567             offset += 6;
8568
8569             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8570             offset += 2;
8571
8572             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8573             offset += 2;
8574
8575             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_group_id, tvb, offset, 1, ENC_NA);
8576             offset += 1;
8577
8578             /* TODO Add Optionnal Subelements */
8579             break;
8580           }
8581           case 8: /* Location Configuration Indication (LCI) Request */
8582             /* TODO */
8583           case 9: /* Transmit Stream Measurement Request */
8584             /* TODO */
8585           case 255: /* Measurement Pause Request*/
8586             /* TODO */
8587           default: /* unknown */
8588             break;
8589         }
8590       }
8591
8592       break;
8593     case TAG_MEASURE_REP: /* 7.3.2.22 Measurement Report element (39) with update from 802.11k-2008 */
8594       if (tag_len < 3)
8595       {
8596         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 3", tag_len);
8597         break;
8598       }
8599       {
8600         proto_item *parent_item;
8601         proto_tree *sub_tree;
8602         guint8 report_type;
8603
8604         offset += 2;
8605         proto_tree_add_item(tree, hf_ieee80211_tag_measure_report_measurement_token, tvb, offset, 1, ENC_NA);
8606         offset += 1;
8607
8608         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_report_mode, tvb, offset, 1, ENC_NA);
8609         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_report_mode_tree);
8610         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_late, tvb, offset, 1, ENC_NA);
8611         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_incapable, tvb, offset, 1, ENC_NA);
8612         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_refused, tvb, offset, 1, ENC_NA);
8613         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_reserved, tvb, offset, 1, ENC_NA);
8614         offset += 1;
8615
8616         report_type = tvb_get_guint8(tvb, offset);
8617         parent_item = proto_tree_add_uint(tree, hf_ieee80211_tag_measure_report_type, tvb, offset, 1, ENC_NA);
8618         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_report_type_tree);
8619         offset += 1;
8620
8621         if (tag_len == 3)
8622             break;
8623         switch (report_type) {
8624           case 0: /* Basic Report */
8625           {
8626             proto_tree *sub_tree_map_field;
8627
8628             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8629             offset += 1;
8630
8631             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8632             offset += 8;
8633
8634             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8635             offset += 2;
8636
8637
8638             parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_basic_map_field, tvb, offset, 1, ENC_NA);
8639             sub_tree_map_field = proto_item_add_subtree(parent_item, ett_tag_measure_report_basic_map_tree);
8640             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_bss, tvb, offset, 1, ENC_NA);
8641             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_odfm, tvb, offset, 1, ENC_NA);
8642             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_unident_signal, tvb, offset, 1, ENC_NA);
8643             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_radar, tvb, offset, 1, ENC_NA);
8644             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_unmeasured, tvb, offset, 1, ENC_NA);
8645             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_reserved, tvb, offset, 1, ENC_NA);
8646             break;
8647           }
8648           case 1: /* Clear channel assessment (CCA) report */
8649             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8650             offset += 1;
8651
8652             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8653             offset += 8;
8654
8655             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8656             offset += 2;
8657
8658             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_cca_busy_fraction, tvb, offset, 1, ENC_NA);
8659             offset += 1;
8660             break;
8661           case 2: /* Receive power indication (RPI) histogram report */
8662             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8663             offset += 1;
8664
8665             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8666             offset += 8;
8667
8668             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8669             offset += 2;
8670
8671             parent_item = proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report, tvb, offset, 8, ENC_NA);
8672             sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_report_rpi_tree);
8673
8674             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_0, tvb, offset, 1, ENC_NA);
8675             offset += 1;
8676
8677             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_1, tvb, offset, 1, ENC_NA);
8678             offset += 1;
8679
8680             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_2, tvb, offset, 1, ENC_NA);
8681             offset += 1;
8682
8683             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_3, tvb, offset, 1, ENC_NA);
8684             offset += 1;
8685
8686             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_4, tvb, offset, 1, ENC_NA);
8687             offset += 1;
8688
8689             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_5, tvb, offset, 1, ENC_NA);
8690             offset += 1;
8691
8692             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_6, tvb, offset, 1, ENC_NA);
8693             offset += 1;
8694
8695             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_7, tvb, offset, 1, ENC_NA);
8696             offset += 1;
8697             break;
8698           case 3: /* Channel Load Report */
8699           {
8700             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
8701             offset += 1;
8702
8703             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8704             offset += 1;
8705
8706             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8707             offset += 8;
8708
8709             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8710             offset += 2;
8711
8712             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_load, tvb, offset, 1, ENC_NA);
8713             offset += 1;
8714
8715             /* TODO Add Optionnal Subelements */
8716             break;
8717           }
8718           case 4: /* Noise Histogram Report */
8719             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
8720             offset += 1;
8721
8722             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8723             offset += 1;
8724
8725             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8726             offset += 8;
8727
8728             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8729             offset += 2;
8730
8731             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ant_id, tvb, offset, 1, ENC_NA);
8732             offset += 1;
8733
8734             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_anpi, tvb, offset, 1, ENC_NA);
8735             offset += 1;
8736
8737             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_0, tvb, offset, 1, ENC_NA);
8738             offset += 1;
8739
8740             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_1, tvb, offset, 1, ENC_NA);
8741             offset += 1;
8742
8743             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_2, tvb, offset, 1, ENC_NA);
8744             offset += 1;
8745
8746             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_3, tvb, offset, 1, ENC_NA);
8747             offset += 1;
8748
8749             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_4, tvb, offset, 1, ENC_NA);
8750             offset += 1;
8751
8752             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_5, tvb, offset, 1, ENC_NA);
8753             offset += 1;
8754
8755             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_6, tvb, offset, 1, ENC_NA);
8756             offset += 1;
8757
8758             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_7, tvb, offset, 1, ENC_NA);
8759             offset += 1;
8760
8761             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_8, tvb, offset, 1, ENC_NA);
8762             offset += 1;
8763
8764             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_9, tvb, offset, 1, ENC_NA);
8765             offset += 1;
8766
8767             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_10, tvb, offset, 1, ENC_NA);
8768             offset += 1;
8769
8770             /* TODO Add Optionnal Subelements */
8771             break;
8772           case 5: /* Beacon Report */
8773           {
8774             proto_tree *sub_tree_frame_info;
8775
8776             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
8777             offset += 1;
8778
8779             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8780             offset += 1;
8781
8782             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8783             offset += 8;
8784
8785             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8786             offset += 2;
8787
8788             parent_item = proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_frame_info, tvb, offset, 1, ENC_NA);
8789             sub_tree_frame_info = proto_item_add_subtree(parent_item, ett_tag_measure_report_frame_tree);
8790             proto_tree_add_item(sub_tree_frame_info, hf_ieee80211_tag_measure_report_frame_info_phy_type, tvb, offset, 1, ENC_NA);
8791             proto_tree_add_item(sub_tree_frame_info, hf_ieee80211_tag_measure_report_frame_info_frame_type, tvb, offset, 1, ENC_NA);
8792             offset += 1;
8793
8794             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_rcpi, tvb, offset, 1, ENC_NA);
8795             offset += 1;
8796
8797             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_rsni, tvb, offset, 1, ENC_NA);
8798             offset += 1;
8799
8800             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_bssid, tvb, offset, 6, ENC_NA);
8801             offset += 6;
8802
8803             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ant_id, tvb, offset, 1, ENC_NA);
8804             offset += 1;
8805
8806             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_parent_tsf, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8807             offset += 4;
8808             /* TODO Add Optionnal Subelements */
8809             break;
8810           }
8811           case 6: /* Frame Report */
8812             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
8813             offset += 1;
8814
8815             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8816             offset += 1;
8817
8818             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8819             offset += 8;
8820
8821             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8822             offset += 2;
8823
8824             /* TODO Add Optionnal Subelements */
8825             break;
8826           case 7: /* BSTA Statistics Report */
8827             /* TODO */
8828           case 8: /* Location Configuration Information Report element */
8829             /* TODO */
8830           case 9: /* Transmit Stream Measurement Report */
8831             /* TODO */
8832           default: /* unknown */
8833             break;
8834         }
8835       }
8836
8837     case TAG_QUIET: /* 7.3.2.23 Quiet element (40) */
8838       if (tag_len != 6)
8839       {
8840         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 6", tag_len);
8841         break;
8842       }
8843       offset += 2;
8844
8845       proto_tree_add_item(tree, hf_ieee80211_tag_quiet_count, tvb, offset, 1, ENC_NA);
8846       proto_item_append_text(ti, " Count: %d", tvb_get_guint8(tvb, offset));
8847       offset += 1;
8848
8849       proto_tree_add_item(tree, hf_ieee80211_tag_quiet_period, tvb, offset, 1, ENC_NA);
8850       proto_item_append_text(ti, " Period: %d", tvb_get_guint8(tvb, offset));
8851       offset += 1;
8852
8853       proto_tree_add_item(tree, hf_ieee80211_tag_quiet_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8854       proto_item_append_text(ti, " Duration: %d", tvb_get_letohs(tvb, offset));
8855       offset += 2;
8856
8857       proto_tree_add_item(tree, hf_ieee80211_tag_quiet_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8858       proto_item_append_text(ti, " Offset: %d", tvb_get_letohs(tvb, offset));
8859       offset += 2;
8860       break;
8861
8862
8863     case TAG_IBSS_DFS: /* 7.3.2.24 IBSS DFS element (41) */
8864       if (tag_len < 7)
8865       {
8866         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be >= 7", tag_len);
8867         break;
8868       }
8869       {
8870         proto_item *ti_sup_map;
8871         proto_tree *sub_map_tree;
8872         offset += 2;
8873
8874         proto_tree_add_item(tree, hf_ieee80211_tag_dfs_owner, tvb, offset, 6, ENC_NA);
8875         proto_item_append_text(ti, " Owner: %s", tvb_ether_to_str(tvb, offset));
8876         offset += 6;
8877
8878         proto_tree_add_item(tree, hf_ieee80211_tag_dfs_recovery_interval, tvb, offset, 1, ENC_NA);
8879         offset += 1;
8880
8881         while(offset < tag_end)
8882         {
8883           ti_sup_map = proto_tree_add_item(tree, hf_ieee80211_tag_dfs_channel_map, tvb, offset, 2, ENC_NA);
8884           sub_map_tree = proto_item_add_subtree(ti_sup_map, ett_tag_dfs_map_tree);
8885           proto_tree_add_item(sub_map_tree, hf_ieee80211_tag_dfs_channel_number, tvb, offset, 1, ENC_NA);
8886           proto_tree_add_item(sub_map_tree, hf_ieee80211_tag_dfs_map, tvb, offset, 1, ENC_NA);
8887           offset += 2;
8888         }
8889         break;
8890       }
8891     case TAG_ERP_INFO: /* 7.3.2.13 ERP Information element (42) */
8892     case TAG_ERP_INFO_OLD:
8893       if (tag_len != 1)
8894       {
8895         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
8896         break;
8897       }
8898       {
8899         proto_item *ti_erp;
8900         proto_tree *erp_tree;
8901
8902         offset += 2;
8903
8904         ti_erp = proto_tree_add_item(tree, hf_ieee80211_tag_erp_info, tvb, offset, 1, ENC_NA);
8905         erp_tree = proto_item_add_subtree(ti_erp, ett_tag_erp_info_tree);
8906         proto_tree_add_item(erp_tree, hf_ieee80211_tag_erp_info_erp_present, tvb, offset, 1, ENC_NA);
8907         proto_tree_add_item(erp_tree, hf_ieee80211_tag_erp_info_use_protection, tvb, offset, 1, ENC_NA);
8908         proto_tree_add_item(erp_tree, hf_ieee80211_tag_erp_info_barker_preamble_mode, tvb, offset, 1, ENC_NA);
8909         proto_tree_add_item(erp_tree, hf_ieee80211_tag_erp_info_reserved, tvb, offset, 1, ENC_NA);
8910         offset += 1;
8911         break;
8912       }
8913
8914     case TAG_TS_DELAY: /* 7.3.2.32 TS Delay element (43) */
8915       if (tag_len != 4)
8916       {
8917         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 4", tag_len);
8918         break;
8919       }
8920       offset += 2;
8921
8922       proto_tree_add_item(tree, hf_ieee80211_ts_delay, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8923       proto_item_append_text(ti, " : %d", tvb_get_ntohl(tvb, offset) );
8924       offset += 4;
8925       break;
8926
8927     case TAG_TCLAS_PROCESS: /* 7.3.2.33 TCLAS Processing element (44) */
8928       if (tag_len != 1)
8929       {
8930         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
8931         break;
8932       }
8933       offset += 2;
8934
8935       proto_tree_add_item(tree, hf_ieee80211_tclas_process, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8936       proto_item_append_text(ti, " : %s", val_to_str(tvb_get_guint8(tvb, offset), ieee80211_tclas_process_flag, "Unknown %d"));
8937       offset += 1;
8938       break;
8939
8940     case TAG_QOS_CAPABILITY: /* 7.3.2.35 QoS Capability element (46) */
8941       if (tag_len != 1)
8942       {
8943         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
8944         break;
8945       }
8946       {
8947         /* proto_item *ti_cap;
8948         proto_tree *cap_tree; */
8949         offset += 2;
8950         offset = dissect_qos_capability(tree, tvb, offset, ftype);
8951       }
8952       break;
8953
8954     case TAG_RSN_IE: /* 7.3.2.25 RSN information element (48) */
8955       if (tag_len < 20)
8956       {
8957         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be >= 20", tag_len);
8958         break;
8959       }
8960       offset += 2;
8961
8962       offset = dissect_rsn_ie(pinfo, tree, tvb, offset, tag_len);
8963       break;
8964
8965     case TAG_EXT_SUPP_RATES: /* 7.3.2.14 Extended Supported Rates element (50) */
8966       if(tag_len < 1)
8967       {
8968         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be greater than 0", tag_len);
8969         break;
8970       }
8971       offset += 2;
8972
8973       while(offset < tag_end)
8974       {
8975         proto_tree_add_item(tree, hf_ieee80211_tag_ext_supp_rates, tvb, offset, 1, ENC_NA);
8976         proto_item_append_text(ti, " %s,", val_to_str(tvb_get_guint8(tvb, offset), ieee80211_supported_rates_vals, "Unknown Rate") );
8977         offset += 1;
8978       }
8979       proto_item_append_text(ti, " [Mbit/sec]");
8980       break;
8981
8982     case TAG_EXTENDED_CAPABILITIES: /* 7.3.2.27 Extended Capabilities information element (127) */
8983     {
8984       proto_item *ti_ex_cap;
8985       proto_tree *ex_cap_tree;
8986
8987       if (tag_len < 1)
8988       {
8989         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be greater than 0", tag_len);
8990         break;
8991       }
8992       offset += 2;
8993
8994       /* Extended Capability octet 0 */
8995       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
8996       proto_item_append_text(ti_ex_cap, " (octet 0)");
8997       ex_cap_tree = proto_item_add_subtree (ti_ex_cap, ett_tag_ex_cap);
8998       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b0, tvb, offset, 1, ENC_NA);
8999       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b1, tvb, offset, 1, ENC_NA);
9000       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b2, tvb, offset, 1, ENC_NA);
9001       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b3, tvb, offset, 1, ENC_NA);
9002       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b4, tvb, offset, 1, ENC_NA);
9003       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b6, tvb, offset, 1, ENC_NA);
9004       offset += 1;
9005
9006       /* Extended Capability octet 1 */
9007       if (offset >= tag_end) {
9008         break;
9009       }
9010       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9011       proto_item_append_text(ti_ex_cap, " (octet 1)");
9012       offset += 1;
9013
9014       /* Extended Capability octet 2 */
9015       if (offset >= tag_end) {
9016         break;
9017       }
9018       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9019       proto_item_append_text(ti_ex_cap, " (octet 2)");
9020       offset += 1;
9021
9022       /* Extended Capability octet 3 */
9023       if (offset >= tag_end) {
9024         break;
9025       }
9026       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9027       proto_item_append_text(ti_ex_cap, " (octet 3)");
9028       ex_cap_tree = proto_item_add_subtree(ti_ex_cap, ett_tag_ex_cap);
9029       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b27, tvb, offset, 1, ENC_NA);
9030       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b28, tvb, offset, 1, ENC_NA);
9031       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b29, tvb, offset, 1, ENC_NA);
9032       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b30, tvb, offset, 1, ENC_NA);
9033       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b31, tvb, offset, 1, ENC_NA);
9034       offset += 1;
9035
9036       /* Extended Capability octet 4 */
9037       if (offset >= tag_end) {
9038         break;
9039       }
9040       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9041       proto_item_append_text(ti_ex_cap, " (octet 4)");
9042       ex_cap_tree = proto_item_add_subtree(ti_ex_cap, ett_tag_ex_cap);
9043       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b32, tvb, offset, 1, ENC_NA);
9044       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b33, tvb, offset, 1, ENC_NA);
9045       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b34, tvb, offset, 1, ENC_NA);
9046       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b36, tvb, offset, 1, ENC_NA);
9047       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b37, tvb, offset, 1, ENC_NA);
9048       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b38, tvb, offset, 1, ENC_NA);
9049       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b39, tvb, offset, 1, ENC_NA);
9050       offset += 1;
9051
9052       /* Extended Capability octet 5 */
9053       if (offset >= tag_end) {
9054         break;
9055       }
9056       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9057       proto_item_append_text(ti_ex_cap, " (octet 5)");
9058       ex_cap_tree = proto_item_add_subtree(ti_ex_cap, ett_tag_ex_cap);
9059       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b40, tvb, offset, 1, ENC_NA);
9060       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_serv_int_granularity, tvb, offset, 1, ENC_NA);
9061       offset += 1;
9062
9063       break;
9064
9065     case TAG_CISCO_CCX1_CKIP: /* Cisco CCX1 CKIP + Device Name (133) */
9066       /* From WCS manual:
9067        * If Aironet IE support is enabled, the access point sends an Aironet
9068        * IE 0x85 (which contains the access point name, load, number of
9069        * associated clients, and so on) in the beacon and probe responses of
9070        * this WLAN, and the controller sends Aironet IEs 0x85 and 0x95
9071        * (which contains the management IP address of the controller and
9072        * the IP address of the access point) in the reassociation response
9073        * if it receives Aironet IE 0x85 in the reassociation request.
9074        */
9075
9076       if (tag_len < 26)
9077       {
9078         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u too short, must be >= 26", tag_len);
9079         break;
9080       }
9081       offset += 2;
9082       proto_tree_add_item(tree, hf_ieee80211_tag_cisco_ccx1_unknown, tvb, offset, 10, ENC_NA);
9083       offset += 10;
9084
9085       /* The Name of the sending device starts at offset 10 and is up to
9086          15 or 16 bytes in length, \0 padded */
9087       proto_tree_add_item(tree, hf_ieee80211_tag_cisco_ccx1_name, tvb, offset, 16, ENC_ASCII|ENC_NA);
9088       offset += 16;
9089
9090       /* Total number off associated clients and repeater access points */
9091       proto_tree_add_item(tree, hf_ieee80211_tag_cisco_ccx1_clients, tvb, offset, 1, ENC_NA);
9092       offset += 1;
9093       break;
9094
9095     case TAG_VENDOR_SPECIFIC_IE: /* 7.3.2.26 Vendor Specific information element (221) */
9096       if (tag_len < 3)
9097       {
9098         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be >= 3", tag_len);
9099         break;
9100       }
9101       {
9102
9103         offset += 2;
9104         oui = tvb_get_ntoh24(tvb, offset);
9105         tag_tvb = tvb_new_subset(tvb, offset, tag_len, tag_len);
9106         proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
9107         proto_item_append_text(ti, ": %s", uint_get_manuf_name(oui));
9108
9109         if (tag_len > 3) {
9110           proto_tree_add_item(ti, hf_ieee80211_tag_vendor_oui_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
9111         }
9112
9113       switch (oui) {
9114         /* 802.11 specific vendor ids */
9115 #       define WPAWME_OUI  0x0050F2
9116 #       define RSNOUI_VAL  0x000FAC
9117 #       define PRE11N_OUI  0x00904c
9118         case WPAWME_OUI:
9119           offset = dissect_vendor_ie_wpawme(tree, tvb, offset + 3, tag_len, ftype);
9120           break;
9121         case RSNOUI_VAL:
9122           dissect_vendor_ie_rsn(ti, tree, tag_tvb);
9123           break;
9124         case PRE11N_OUI:
9125           dissect_vendor_ie_ht(tvb, pinfo, tree, offset, ti, ti_len, tag_len);
9126           break;
9127         case OUI_WFA:
9128           dissect_vendor_ie_wfa(pinfo, ti, tag_tvb);
9129           break;
9130
9131         /* Normal IEEE vendor ids (from oui.h) */
9132         case OUI_CISCOWL:  /* Cisco Wireless (Aironet) */
9133           dissect_vendor_ie_aironet(ti, tree, tvb, offset + 3, tag_len - 3);
9134           break;
9135         case OUI_MARVELL:
9136           dissect_vendor_ie_marvell(ti, tree, tvb, offset + 3, tag_len - 3);
9137           break;
9138         case OUI_ATHEROS:
9139           dissect_vendor_ie_atheros(ti, tree, tvb, offset + 3, tag_len - 3, pinfo, ti_len);
9140           break;
9141         default:
9142           proto_tree_add_string (tree, hf_ieee80211_tag_interpretation, tvb, offset + 3,
9143             tag_len - 3, "Not interpreted");
9144           break;
9145         }
9146
9147       }
9148       break;
9149
9150     case TAG_MOBILITY_DOMAIN:
9151       dissect_mobility_domain(tree, tvb, offset + 2, tag_len);
9152       break;
9153
9154     case TAG_FAST_BSS_TRANSITION:
9155       dissect_fast_bss_transition(tree, tvb, offset + 2, tag_len);
9156       break;
9157
9158     case TAG_MMIE:
9159       dissect_mmie(tree, tvb, offset + 2, tag_len);
9160       break;
9161
9162     case TAG_TIME_ZONE:
9163       dissect_time_zone(tree, tvb, offset + 2, tag_len);
9164       break;
9165
9166     case TAG_TIMEOUT_INTERVAL:
9167       dissect_timeout_interval(tree, tvb, offset + 2, tag_len);
9168       break;
9169
9170     case TAG_LINK_IDENTIFIER:
9171       dissect_link_identifier(tree, tvb, offset + 2, tag_len);
9172       break;
9173
9174     case TAG_WAKEUP_SCHEDULE:
9175       dissect_wakeup_schedule(tree, tvb, offset + 2, tag_len);
9176       break;
9177
9178     case TAG_CHANNEL_SWITCH_TIMING:
9179       dissect_channel_switch_timing(tree, tvb, offset + 2, tag_len);
9180       break;
9181
9182     case TAG_PTI_CONTROL:
9183       dissect_pti_control(tree, tvb, offset + 2, tag_len);
9184       break;
9185
9186     case TAG_PU_BUFFER_STATUS:
9187       dissect_pu_buffer_status(tree, tvb, offset + 2, tag_len);
9188       break;
9189
9190     case TAG_HT_CAPABILITY:
9191       dissect_ht_capability_ie(tvb, pinfo, tree, offset+2, tag_len, ti_len, FALSE);
9192       break;
9193
9194     case TAG_HT_INFO:
9195       dissect_ht_info_ie_1_1(tree, tvb, offset + 2, tag_len);
9196       break;
9197
9198     case TAG_SECONDARY_CHANNEL_OFFSET:
9199       secondary_channel_offset_ie(tree, tvb, offset + 2, tag_len);
9200       break;
9201
9202     case TAG_TIME_ADV:
9203       dissect_time_adv(tree, tvb, offset + 2);
9204       break;
9205
9206     case TAG_MESH_PEERING_MGMT:
9207       {
9208         guint start = offset + 2;
9209         offset += 2;
9210         proto_tree_add_item (tree, hf_ieee80211_mesh_peering_proto, tvb, offset, 2, ENC_LITTLE_ENDIAN);
9211         offset += 2;
9212         proto_tree_add_item (tree, hf_ieee80211_mesh_peering_local_link_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
9213         offset += 2;
9214         switch (tvb_get_guint8(tvb, 1))
9215           {                                         /* Self-protected action field */
9216           case SELFPROT_ACTION_MESH_PEERING_OPEN:
9217             break;
9218
9219           case SELFPROT_ACTION_MESH_PEERING_CONFIRM:
9220             proto_tree_add_item (tree, hf_ieee80211_mesh_peering_peer_link_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
9221             offset += 2;
9222             break;
9223
9224           case SELFPROT_ACTION_MESH_PEERING_CLOSE:
9225             if (tag_len == 8 || tag_len == 24)
9226               {
9227                 proto_tree_add_item (tree, hf_ieee80211_mesh_peering_peer_link_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
9228                 offset += 2;
9229               }
9230             offset += add_fixed_field(tree, tvb, offset, FIELD_REASON_CODE);
9231             break;
9232
9233           /* unexpected values */
9234           default:
9235             proto_tree_add_text (tree, tvb, offset, tag_len, "Unexpected Self-protected action");
9236             offset += tag_len;
9237             break;
9238           }
9239         if (tag_len - (offset - start) == 16)
9240           {
9241             proto_tree_add_item(tree, hf_ieee80211_rsn_pmkid, tvb, offset, 16, ENC_NA);
9242             offset +=16;
9243           }
9244         break;
9245       }
9246
9247     case TAG_MESH_CONFIGURATION:
9248       {
9249         offset += 2;
9250         proto_tree_add_item (tree, hf_ieee80211_mesh_config_path_sel_protocol, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9251         proto_tree_add_item (tree, hf_ieee80211_mesh_config_path_sel_metric, tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
9252         proto_tree_add_item (tree, hf_ieee80211_mesh_config_congestion_control, tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
9253         proto_tree_add_item (tree, hf_ieee80211_mesh_config_sync_method, tvb, offset + 3, 1, ENC_LITTLE_ENDIAN);
9254         proto_tree_add_item (tree, hf_ieee80211_mesh_config_auth_protocol, tvb, offset + 4, 1, ENC_LITTLE_ENDIAN);
9255         proto_tree_add_item (tree, hf_ieee80211_mesh_config_formation_info, tvb, offset + 5, 1, ENC_LITTLE_ENDIAN);
9256         proto_tree_add_item (tree, hf_ieee80211_mesh_config_capability, tvb, offset + 6, 1, ENC_LITTLE_ENDIAN);
9257         break;
9258       }
9259
9260     case TAG_MESH_ID:
9261       {
9262         offset += 2;
9263
9264         proto_tree_add_item(tree, hf_ieee80211_mesh_id, tvb, offset, tag_len, ENC_ASCII|ENC_NA);
9265         if (tag_len > 0) {
9266             col_append_fstr(pinfo->cinfo, COL_INFO, ", MESHID=%s", tvb_get_ephemeral_string(tvb, offset, tag_len));
9267             proto_item_append_text(ti, ": %s", tvb_get_ephemeral_string(tvb, offset, tag_len));
9268         }
9269
9270       break;
9271       }
9272
9273     case TAG_MESH_PREQ:
9274       {
9275         guint8 flags = tvb_get_guint8(tvb, offset + 2);
9276         guint8 targs, i;
9277         proto_item *item;
9278         proto_tree *subtree;
9279
9280         offset += 2;
9281         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9282         offset += 1;
9283         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_hopcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9284         offset += 1;
9285         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_ttl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9286         offset += 1;
9287         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_pdid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9288         offset += 4;
9289         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_sta, tvb, offset, 6, ENC_NA);
9290         offset += 6;
9291         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9292         offset += 4;
9293
9294         if (flags & (1<<6)) {
9295           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_ext, tvb, offset, 6, ENC_NA);
9296           offset += 6;
9297         }
9298         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_lifetime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9299         offset += 4;
9300         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9301         offset += 4;
9302         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9303         targs = tvb_get_guint8 (tvb, offset);
9304         offset += 1;
9305         for (i = 0; i < targs; i++) {
9306           item = proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9307           subtree = proto_item_add_subtree(item, ett_hwmp_targ_flags_tree);
9308           proto_tree_add_boolean(subtree, hf_ieee80211_ff_hwmp_targ_to_flags, tvb, offset, 1, flags);
9309           proto_tree_add_boolean(subtree, hf_ieee80211_ff_hwmp_targ_usn_flags, tvb, offset, 1, flags);
9310           offset += 1;
9311           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sta, tvb, offset, 6, ENC_NA);
9312           offset += 6;
9313           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9314           offset += 4;
9315         }
9316         break;
9317       }
9318
9319     case TAG_MESH_PREP:
9320       {
9321         guint8 flags = tvb_get_guint8(tvb, offset + 2);
9322         offset += 2;
9323         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9324         offset += 1;
9325         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_hopcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9326         offset += 1;
9327         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_ttl, tvb, offset , 1, ENC_LITTLE_ENDIAN);
9328         offset += 1;
9329         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sta, tvb, offset, 6, ENC_NA);
9330         offset += 6;
9331         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9332         offset += 4;
9333         if (flags & (1<<6)) {
9334           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_ext, tvb, offset, 6, ENC_NA);
9335           offset += 6;
9336         }
9337         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_lifetime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9338         offset += 4;
9339         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9340         offset += 4;
9341         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_sta, tvb, offset, 6, ENC_NA);
9342         offset += 6;
9343         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9344         offset += 4;
9345         break;
9346       }
9347
9348     case TAG_MESH_PERR:
9349       {
9350         guint8 targs, i;
9351
9352         offset += 2;
9353         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_ttl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9354         offset += 1;
9355         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_count, tvb, offset, 1, ENC_BIG_ENDIAN);
9356         targs = tvb_get_guint8 (tvb, offset);
9357         offset += 1;
9358         for (i = 0; i < targs; i++) {
9359           guint8 flags = tvb_get_guint8(tvb, offset);
9360
9361           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9362           offset += 1;
9363           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sta, tvb, offset, 6, ENC_NA);
9364           offset += 6;
9365           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9366           offset += 4;
9367           if (flags & (1<<6)) {
9368             proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_ext, tvb, offset, 6, ENC_NA);
9369             offset += 6;
9370           }
9371           offset += add_fixed_field(tree, tvb, offset, FIELD_REASON_CODE);
9372         }
9373         break;
9374       }
9375
9376     case TAG_RANN:
9377       {
9378         offset += 2;
9379         proto_tree_add_item (tree, hf_ieee80211_rann_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
9380         offset += 1;
9381         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_hopcount, tvb, offset, 1, ENC_BIG_ENDIAN);
9382         offset += 1;
9383         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_ttl, tvb, offset, 1, ENC_BIG_ENDIAN);
9384         offset += 1;
9385         proto_tree_add_item (tree, hf_ieee80211_rann_root_sta, tvb, offset, 6, ENC_NA);
9386         offset += 6;
9387         proto_tree_add_item (tree, hf_ieee80211_rann_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9388         offset += 4;
9389         proto_tree_add_item (tree, hf_ieee80211_rann_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9390         offset += 4;
9391         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9392         offset += 4;
9393         break;
9394       }
9395       break;
9396     }
9397
9398     case TAG_INTERWORKING:
9399       dissect_interworking(pinfo, tree, ti, tvb, offset);
9400       break;
9401     case TAG_ADVERTISEMENT_PROTOCOL:
9402     {
9403       dissect_advertisement_protocol(pinfo, tree, tvb, offset, NULL);
9404       break;
9405     }
9406     case TAG_ROAMING_CONSORTIUM:
9407       dissect_roaming_consortium(pinfo, tree, ti, tvb, offset);
9408       break;
9409
9410     case TAG_NEIGHBOR_REPORT:
9411     {
9412       #define SUB_TAG_TSF_INFO                 0x01
9413       #define SUB_TAG_MEASUREMENT_PILOT_INFO   0x02
9414       #define SUB_TAG_HT_CAPABILITIES          0x03
9415       #define SUB_TAG_HT_INFO                  0x04
9416       #define SUB_TAG_SEC_CHANNEL_OFFSET       0x05
9417       #define SUB_TAG_VENDOR_SPECIFIC          0xDD
9418
9419
9420       guint tag_offset;
9421       guint8 sub_tag_id;
9422       guint32 bssid_info, info, sub_tag_length;
9423       proto_item *parent_item;
9424       proto_tree *bssid_info_subtree, *sub_tag_tree;
9425       tvbuff_t *volatile sub_tag_tvb = NULL;
9426
9427       if (tag_len < 13)
9428       {
9429         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
9430             "Neighbor Report: Error: Tag length must be at least 13 bytes long");
9431         break;
9432       }
9433       offset+=2;
9434       tag_offset = offset;
9435
9436       proto_tree_add_item(tree, hf_ieee80211_tag_neighbor_report_bssid, tvb, offset, 6, ENC_NA);
9437
9438       /*** Begin: BSSID Information ***/
9439       offset+=6;
9440       bssid_info = tvb_get_letohl (tvb, offset);
9441       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);
9442       bssid_info_subtree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_bssid_info_tree);
9443
9444       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_reachability, tvb, offset, 1, bssid_info);
9445       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_security, tvb, offset, 1, bssid_info);
9446       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_key_scope, tvb, offset, 1, bssid_info);
9447       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_spec_mng, tvb, offset, 1, bssid_info);
9448       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_qos, tvb, offset, 1, bssid_info);
9449       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_apsd, tvb, offset, 1, bssid_info);
9450       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_radio_msnt, tvb, offset, 1, bssid_info);
9451       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_dback, tvb, offset+1, 1, bssid_info);
9452       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_iback, tvb, offset+1, 1, bssid_info);
9453       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_mobility_domain, tvb, offset+1, 1, bssid_info);
9454       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_high_throughput, tvb, offset+1, 1, bssid_info);
9455       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_reserved, tvb, offset+1, 3, (bssid_info & 0xfffff000) >> 12);
9456       /*** End: BSSID Information ***/
9457
9458       offset+=4;
9459       info = tvb_get_guint8 (tvb, offset);
9460       proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_reg_class, tvb, offset, 1, info, "Regulatory Class: 0x%02X", info);
9461
9462       offset++;
9463       info = tvb_get_guint8 (tvb, offset);
9464       proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_channel_number, tvb, offset, 1, info, "Channel Number: 0x%02X", info);
9465
9466       offset++;
9467       info = tvb_get_guint8 (tvb, offset);
9468       proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_phy_type, tvb, offset, 1, info, "PHY Type: 0x%02X", info);
9469
9470       offset++;
9471       sub_tag_id = tvb_get_guint8 (tvb, offset);
9472       offset++;
9473       sub_tag_length = tvb_get_guint8 (tvb, offset);
9474
9475       offset++;
9476       sub_tag_tvb = tvb_new_subset(tvb, offset, sub_tag_length, -1);
9477
9478       switch (sub_tag_id) {
9479         case SUB_TAG_TSF_INFO:
9480           /* TODO */
9481           break;
9482         case SUB_TAG_MEASUREMENT_PILOT_INFO:
9483           /* TODO */
9484           break;
9485         case SUB_TAG_HT_CAPABILITIES:
9486           parent_item = proto_tree_add_text (tree, tvb, offset, sub_tag_length, "HT Capabilities");
9487           sub_tag_tree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_sub_tag_tree);
9488           dissect_ht_capability_ie(sub_tag_tvb, pinfo, sub_tag_tree, 0, sub_tag_length, ti_len, FALSE);
9489           break;
9490         case SUB_TAG_HT_INFO:
9491           parent_item = proto_tree_add_text (tree, tvb, offset, sub_tag_length, "HT Information");
9492           sub_tag_tree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_sub_tag_tree);
9493           dissect_ht_info_ie_1_1(sub_tag_tree, sub_tag_tvb, 0, sub_tag_length);
9494           break;
9495         case SUB_TAG_SEC_CHANNEL_OFFSET:
9496           parent_item = proto_tree_add_text (tree, tvb, offset, sub_tag_length, "Secondary Channel Offset");
9497           sub_tag_tree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_sub_tag_tree);
9498           secondary_channel_offset_ie(sub_tag_tree, sub_tag_tvb, 0, sub_tag_length);
9499           break;
9500         case SUB_TAG_VENDOR_SPECIFIC:
9501         default:
9502           break;
9503       }
9504
9505       offset += sub_tag_length;
9506
9507       if (tag_len > (offset - tag_offset))
9508       {
9509         proto_tree_add_text (tree, tvb, offset, tag_len - (offset - tag_offset), "Unknown Data");
9510         break;
9511       }
9512       break;
9513     }
9514
9515     case TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT:
9516     {
9517       guint tag_offset;
9518
9519       if (tag_len != 4)
9520       {
9521         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
9522             "Extended Channel Switch Announcement: Error: Tag length must be exactly 4 bytes long");
9523         break;
9524       }
9525
9526       offset+=2;
9527       tag_offset = offset;
9528
9529       offset+= add_fixed_field(tree, tvb, offset, FIELD_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT);
9530
9531       if (tag_len > (offset - tag_offset))
9532       {
9533         proto_tree_add_text (tree, tvb, offset, tag_len - (offset - tag_offset), "Unknown Data");
9534         break;
9535       }
9536       break;
9537     }
9538     case TAG_SUPPORTED_REGULATORY_CLASSES:
9539     {
9540       guint8 current_field;
9541       guint i;
9542
9543       if (tag_len < 2) {
9544         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
9545             "Supported Regulatory Classes: Error: Tag length must be at least 2 bytes long");
9546         break;
9547       } else if (tag_len > 32) {
9548         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
9549             "Supported Regulatory Classes: Error: Tag length must be no more than 32 bytes long");
9550         break;
9551       }
9552
9553       offset+=2;
9554
9555       current_field = tvb_get_guint8 (tvb, offset);
9556       proto_tree_add_uint(tree, hf_ieee80211_tag_supported_reg_classes_current, tvb, offset, 1, current_field);
9557
9558       offset++;
9559       /* Partially taken from the ssid section */
9560       tag_data_ptr = tvb_get_ptr (tvb, offset, tag_len);
9561       for (i = 0, n = 0; i < tag_len && n < SHORT_STR; i++) {
9562         ret = g_snprintf (print_buff + n, SHORT_STR - n, (i == tag_len-1)?"%d":"%d, ", tag_data_ptr[i]);
9563         if (ret >= SHORT_STR - n) {
9564           /* ret >= <buf_size> means buffer truncated  */
9565           break;
9566         }
9567         n += ret;
9568       }
9569       proto_tree_add_string (tree, hf_ieee80211_tag_supported_reg_classes_alternate, tvb, offset, tag_len, print_buff);
9570
9571       break;
9572     }
9573     default:
9574       tvb_ensure_bytes_exist (tvb, offset + 2, tag_len);
9575       proto_tree_add_string (tree, hf_ieee80211_tag_interpretation, tvb, offset + 1 + 1,
9576           tag_len, "Not interpreted");
9577       proto_item_append_text(ti, ": Tag %u Len %u", tag_no, tag_len);
9578       break;
9579   }
9580   if(offset < tag_end){
9581     /* TODO: add Expert info to indicate there is unknown data ! but all tagged option don't yet return offset.
9582       For the moment, this code only remove Clang Warnings about not used offset... */
9583   }
9584   return tag_len + 1 + 1;
9585 }
9586
9587 void
9588 ieee_80211_add_tagged_parameters (tvbuff_t * tvb, int offset, packet_info * pinfo,
9589   proto_tree * tree, int tagged_parameters_len, int ftype)
9590 {
9591   int next_len;
9592
9593   beacon_padding = 0; /* this is for the beacon padding confused with ssid fix */
9594   while (tagged_parameters_len > 0) {
9595     if ((next_len=add_tagged_field (pinfo, tree, tvb, offset, ftype))==0)
9596       break;
9597     if (next_len > tagged_parameters_len) {
9598       /* XXX - flag this as an error? */
9599       next_len = tagged_parameters_len;
9600     }
9601     offset += next_len;
9602     tagged_parameters_len -= next_len;
9603   }
9604 }
9605
9606 /* ************************************************************************* */
9607 /*                     Dissect 802.11 management frame                       */
9608 /* ************************************************************************* */
9609 static void
9610 dissect_ieee80211_mgt (guint16 fcf, tvbuff_t * tvb, packet_info * pinfo,
9611     proto_tree * tree)
9612 {
9613   proto_item *ti = NULL;
9614   proto_tree *mgt_tree;
9615   proto_tree *fixed_tree;
9616   proto_tree *tagged_tree;
9617   int offset = 0;
9618   int tagged_parameter_tree_len;
9619
9620   g_pinfo = pinfo;
9621   ieee80211_tvb_invalid = FALSE;
9622
9623   CHECK_DISPLAY_AS_X(data_handle,proto_wlan_mgt, tvb, pinfo, tree);
9624
9625   ti = proto_tree_add_item (tree, proto_wlan_mgt, tvb, 0, -1, ENC_NA);
9626   mgt_tree = proto_item_add_subtree (ti, ett_80211_mgt);
9627
9628   switch (COMPOSE_FRAME_TYPE(fcf))
9629   {
9630
9631     case MGT_ASSOC_REQ:
9632       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 4);
9633       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
9634       add_fixed_field(fixed_tree, tvb, 2, FIELD_LISTEN_IVAL);
9635       offset = 4;  /* Size of fixed fields */
9636
9637       tagged_parameter_tree_len =
9638           tvb_reported_length_remaining(tvb, offset);
9639       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9640                  tagged_parameter_tree_len);
9641       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9642           tagged_parameter_tree_len, MGT_ASSOC_REQ);
9643       break;
9644
9645
9646     case MGT_ASSOC_RESP:
9647       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 6);
9648       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
9649       add_fixed_field(fixed_tree, tvb, 2, FIELD_STATUS_CODE);
9650       add_fixed_field(fixed_tree, tvb, 4, FIELD_ASSOC_ID);
9651       offset = 6;  /* Size of fixed fields */
9652
9653       tagged_parameter_tree_len =
9654           tvb_reported_length_remaining(tvb, offset);
9655       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9656                  tagged_parameter_tree_len);
9657       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9658           tagged_parameter_tree_len, MGT_ASSOC_RESP);
9659       break;
9660
9661
9662     case MGT_REASSOC_REQ:
9663       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 10);
9664       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
9665       add_fixed_field(fixed_tree, tvb, 2, FIELD_LISTEN_IVAL);
9666       add_fixed_field(fixed_tree, tvb, 4, FIELD_CURRENT_AP_ADDR);
9667       offset = 10;  /* Size of fixed fields */
9668
9669       tagged_parameter_tree_len =
9670           tvb_reported_length_remaining(tvb, offset);
9671       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9672                  tagged_parameter_tree_len);
9673       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9674           tagged_parameter_tree_len, MGT_REASSOC_REQ);
9675       break;
9676
9677     case MGT_REASSOC_RESP:
9678       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 6);
9679       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
9680       add_fixed_field(fixed_tree, tvb, 2, FIELD_STATUS_CODE);
9681       add_fixed_field(fixed_tree, tvb, 4, FIELD_ASSOC_ID);
9682       offset = 6;  /* Size of fixed fields */
9683
9684       tagged_parameter_tree_len =
9685           tvb_reported_length_remaining(tvb, offset);
9686       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9687                  tagged_parameter_tree_len);
9688       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9689           tagged_parameter_tree_len, MGT_REASSOC_RESP);
9690       break;
9691
9692
9693     case MGT_PROBE_REQ:
9694       offset = 0;
9695       tagged_parameter_tree_len =
9696           tvb_reported_length_remaining(tvb, offset);
9697       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9698                  tagged_parameter_tree_len);
9699       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9700           tagged_parameter_tree_len, MGT_PROBE_REQ);
9701       break;
9702
9703     case MGT_PROBE_RESP:
9704     {
9705       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 12);
9706       add_fixed_field(fixed_tree, tvb, 0, FIELD_TIMESTAMP);
9707       add_fixed_field(fixed_tree, tvb, 8, FIELD_BEACON_INTERVAL);
9708       add_fixed_field(fixed_tree, tvb, 10, FIELD_CAP_INFO);
9709       offset = 12;  /* Size of fixed fields */
9710
9711       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9712       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset, tagged_parameter_tree_len);
9713       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree, tagged_parameter_tree_len, MGT_PROBE_RESP);
9714       break;
9715     }
9716     case MGT_MEASUREMENT_PILOT:
9717     {
9718       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 12);
9719       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_TIMESTAMP);
9720       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_MEASUREMENT_PILOT_INT);
9721       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_BEACON_INTERVAL);
9722       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_CAP_INFO);
9723       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_COUNTRY_STR);
9724       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_MAX_REG_PWR);
9725       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_MAX_TX_PWR);
9726       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_TX_PWR_USED);
9727       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_TRANSCEIVER_NOISE_FLOOR);
9728       /* TODO DS Parameter Set ??? */
9729
9730       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9731       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset, tagged_parameter_tree_len);
9732       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree, tagged_parameter_tree_len, MGT_MEASUREMENT_PILOT);
9733       break;
9734     }
9735     case MGT_BEACON:    /* Dissect protocol payload fields  */
9736       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 12);
9737       add_fixed_field(fixed_tree, tvb, 0, FIELD_TIMESTAMP);
9738       add_fixed_field(fixed_tree, tvb, 8, FIELD_BEACON_INTERVAL);
9739       add_fixed_field(fixed_tree, tvb, 10, FIELD_CAP_INFO);
9740       offset = 12;  /* Size of fixed fields */
9741
9742       tagged_parameter_tree_len =
9743           tvb_reported_length_remaining(tvb, offset);
9744       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9745       tagged_parameter_tree_len);
9746       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9747       tagged_parameter_tree_len, MGT_BEACON);
9748       break;
9749
9750     case MGT_ATIM:
9751       break;
9752
9753     case MGT_DISASS:
9754       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 2);
9755       add_fixed_field(fixed_tree, tvb, 0, FIELD_REASON_CODE);
9756       offset = 2; /* Size of fixed fields */
9757       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9758       if (tagged_parameter_tree_len > 0) {
9759         tagged_tree = get_tagged_parameter_tree(mgt_tree, tvb, offset,
9760                                                 tagged_parameter_tree_len);
9761         ieee_80211_add_tagged_parameters(tvb, offset, pinfo, tagged_tree,
9762                                          tagged_parameter_tree_len, MGT_DISASS);
9763       }
9764       break;
9765
9766     case MGT_AUTHENTICATION:
9767       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 6);
9768       add_fixed_field(fixed_tree, tvb, 0, FIELD_AUTH_ALG);
9769       add_fixed_field(fixed_tree, tvb, 2, FIELD_AUTH_TRANS_SEQ);
9770       add_fixed_field(fixed_tree, tvb, 4, FIELD_STATUS_CODE);
9771       offset = 6;  /* Size of fixed fields */
9772
9773       tagged_parameter_tree_len =
9774         tvb_reported_length_remaining(tvb, offset);
9775       if (tagged_parameter_tree_len > 0)
9776       {
9777         tagged_tree = get_tagged_parameter_tree (mgt_tree,
9778             tvb,
9779             offset,
9780             tagged_parameter_tree_len);
9781         ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9782         tagged_parameter_tree_len, MGT_AUTHENTICATION);
9783       }
9784       break;
9785
9786     case MGT_DEAUTHENTICATION:
9787       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 2);
9788       add_fixed_field(fixed_tree, tvb, 0, FIELD_REASON_CODE);
9789       offset = 2; /* Size of fixed fields */
9790       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9791       if (tagged_parameter_tree_len > 0) {
9792         tagged_tree = get_tagged_parameter_tree(mgt_tree, tvb, offset,
9793                                                 tagged_parameter_tree_len);
9794         ieee_80211_add_tagged_parameters(tvb, offset, pinfo, tagged_tree,
9795                                          tagged_parameter_tree_len, MGT_DEAUTHENTICATION);
9796       }
9797       break;
9798
9799     case MGT_ACTION:
9800     {
9801       proto_item *lcl_fixed_hdr;
9802       proto_tree *lcl_fixed_tree;
9803       lcl_fixed_hdr = proto_tree_add_text(mgt_tree, tvb, 0, 0, "Fixed parameters");
9804       lcl_fixed_tree = proto_item_add_subtree (lcl_fixed_hdr, ett_fixed_parameters);
9805
9806       offset += add_fixed_field(lcl_fixed_tree, tvb, 0, FIELD_ACTION);
9807
9808       proto_item_set_len(lcl_fixed_hdr, offset);
9809       if (ieee80211_tvb_invalid)
9810         break; /* Buffer not available for further processing */
9811       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9812       if (tagged_parameter_tree_len > 0)
9813       {
9814         tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9815           tagged_parameter_tree_len);
9816         ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9817           tagged_parameter_tree_len, MGT_ACTION);
9818       }
9819       break;
9820     }
9821     case MGT_ACTION_NO_ACK:
9822     {
9823       proto_item *lcl_fixed_hdr;
9824       proto_tree *lcl_fixed_tree;
9825       lcl_fixed_hdr = proto_tree_add_text(mgt_tree, tvb, 0, 0, "Fixed parameters");
9826       lcl_fixed_tree = proto_item_add_subtree (lcl_fixed_hdr, ett_fixed_parameters);
9827
9828       offset += add_fixed_field(lcl_fixed_tree, tvb, 0, FIELD_ACTION);
9829
9830       proto_item_set_len(lcl_fixed_hdr, offset);
9831       if (ieee80211_tvb_invalid)
9832         break; /* Buffer not available for further processing */
9833       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9834       if (tagged_parameter_tree_len > 0)
9835       {
9836         tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9837           tagged_parameter_tree_len);
9838         ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9839           tagged_parameter_tree_len, MGT_ACTION_NO_ACK);
9840       }
9841       break;
9842     }
9843     case MGT_ARUBA_WLAN:
9844     {
9845       proto_item *aruba_hdr;
9846       proto_tree *aruba_tree;
9847       guint16 type;
9848       type = tvb_get_ntohs(tvb, offset);
9849
9850       aruba_hdr = proto_tree_add_text(mgt_tree, tvb, 0, 0, "Aruba Management");
9851       aruba_tree = proto_item_add_subtree(aruba_hdr, ett_fixed_parameters);
9852
9853       proto_tree_add_item(aruba_tree, hf_ieee80211_aruba, tvb, offset, 2, ENC_BIG_ENDIAN);
9854       offset += 2;
9855       /* HeartBeat Sequence */
9856       if ( type == 0x0005 )
9857       {
9858         proto_tree_add_item(aruba_tree, hf_ieee80211_aruba_hb_seq, tvb, offset, 8, ENC_BIG_ENDIAN);
9859       }
9860       /* MTU Size */
9861       if ( type == 0x0003 )
9862       {
9863         proto_tree_add_item(aruba_tree, hf_ieee80211_aruba_mtu, tvb, offset, 2, ENC_BIG_ENDIAN);
9864       }
9865       break;
9866     }
9867   }
9868 }
9869
9870 static void
9871 set_src_addr_cols(packet_info *pinfo, const guint8 *addr, const char *type)
9872 {
9873   col_add_fstr(pinfo->cinfo, COL_RES_DL_SRC, "%s (%s)",
9874         get_ether_name(addr), type);
9875   col_add_str(pinfo->cinfo, COL_UNRES_DL_SRC, ether_to_str(addr));
9876 }
9877
9878 static void
9879 set_dst_addr_cols(packet_info *pinfo, const guint8 *addr, const char *type)
9880 {
9881   col_add_fstr(pinfo->cinfo, COL_RES_DL_DST, "%s (%s)",
9882         get_ether_name(addr), type);
9883   col_add_str(pinfo->cinfo, COL_UNRES_DL_DST, ether_to_str(addr));
9884 }
9885
9886 static guint32
9887 crc32_802_tvb_padded(tvbuff_t *tvb, guint hdr_len, guint hdr_size, guint len)
9888 {
9889   guint32 c_crc;
9890
9891   c_crc = crc32_ccitt_tvb(tvb, hdr_len);
9892   c_crc = crc32_ccitt_seed(tvb_get_ptr(tvb, hdr_size, len), len, ~c_crc);
9893
9894   /* Byte reverse. */
9895   c_crc = ((unsigned char)(c_crc>>0)<<24) |
9896     ((unsigned char)(c_crc>>8)<<16) |
9897     ((unsigned char)(c_crc>>16)<<8) |
9898     ((unsigned char)(c_crc>>24)<<0);
9899
9900   return ( c_crc );
9901 }
9902
9903 typedef enum {
9904     ENCAP_802_2,
9905     ENCAP_IPX,
9906     ENCAP_ETHERNET
9907 } encap_t;
9908
9909
9910 /* ************************************************************************* */
9911 /*                          Dissect 802.11 frame                             */
9912 /* ************************************************************************* */
9913
9914 /*
9915  * The 802.11n specification makes some fairly significant changes to the
9916  * layout of the MAC header.  The first two bits of the MAC header are the
9917  * protocol version.  You'd think that the 802.11 committee would have
9918  * bumped the version to indicate a different MAC layout, but NOOOO -- we
9919  * have to go digging for bits in various locations instead.
9920  */
9921
9922 static void
9923 dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo,
9924         proto_tree * tree, gboolean fixed_length_header, gint fcs_len,
9925         gboolean wlan_broken_fc, gboolean datapad,
9926         gboolean is_ht)
9927 {
9928   guint16 fcf, flags, frame_type_subtype, ctrl_fcf, ctrl_type_subtype;
9929   guint16 seq_control;
9930   guint32 seq_number, frag_number;
9931   gboolean more_frags;
9932   const guint8 *src = NULL;
9933   const guint8 *dst = NULL;
9934   const guint8 *bssid = NULL;
9935   proto_item *ti = NULL;
9936   proto_item *fcs_item = NULL;
9937   proto_item *cw_item = NULL;
9938   proto_item *hidden_item;
9939   proto_tree *volatile hdr_tree = NULL;
9940   proto_tree *fcs_tree = NULL;
9941   proto_tree *cw_tree = NULL;
9942   guint16 hdr_len, ohdr_len, htc_len = 0;
9943   gboolean has_fcs, fcs_good, fcs_bad;
9944   gint len, reported_len, ivlen;
9945   gboolean is_amsdu = 0;
9946   gboolean save_fragmented;
9947   tvbuff_t *volatile next_tvb = NULL;
9948   guint32 addr_type;
9949   volatile encap_t encap_type;
9950   guint8 octet1, octet2;
9951   char out_buff[SHORT_STR];
9952   gint is_iv_bad;
9953   guchar iv_buff[4];
9954   const char *addr1_str = NULL;
9955   int addr1_hf = -1;
9956   guint offset;
9957   const gchar *fts_str;
9958   gchar flag_str[] = "opmPRMFTC";
9959   gint ii;
9960   guint16 qosoff = 0, qos_control = 0;
9961   gint meshctl_len = 0;
9962   guint8 mesh_flags;
9963   guint16 meshoff = 0;
9964
9965   wlan_hdr *volatile whdr;
9966   static wlan_hdr whdrs[4];
9967   gboolean retransmitted;
9968
9969   whdr= &whdrs[0];
9970
9971   col_set_str (pinfo->cinfo, COL_PROTOCOL, "802.11");
9972   col_clear(pinfo->cinfo, COL_INFO);
9973
9974   fcf = FETCH_FCF(0);
9975   frame_type_subtype = COMPOSE_FRAME_TYPE(fcf);
9976   if (frame_type_subtype == CTRL_CONTROL_WRAPPER)
9977     ctrl_fcf = FETCH_FCF(10);
9978   else
9979     ctrl_fcf = 0;
9980
9981   if (fixed_length_header)
9982     hdr_len = DATA_LONG_HDR_LEN;
9983   else
9984     hdr_len = find_header_length (fcf, ctrl_fcf, is_ht);
9985
9986   fts_str = val_to_str_const(frame_type_subtype, frame_type_subtype_vals,
9987               "Unrecognized (Reserved frame)");
9988   col_set_str (pinfo->cinfo, COL_INFO, fts_str);
9989
9990
9991   flags = FCF_FLAGS (fcf);
9992   more_frags = HAVE_FRAGMENTS (flags);
9993
9994   for (ii = 0; ii < 8; ii++) {
9995     if (! (flags & 0x80 >> ii)) {
9996       flag_str[ii] = '.';
9997     }
9998   }
9999
10000   if (is_ht && IS_STRICTLY_ORDERED(flags) &&
10001     ((FCF_FRAME_TYPE(fcf) == MGT_FRAME) || (FCF_FRAME_TYPE(fcf) == DATA_FRAME &&
10002       DATA_FRAME_IS_QOS(frame_type_subtype)))) {
10003     htc_len = 4;
10004   }
10005
10006   /* adjust the header length depending on the Mesh Control field */
10007   if (FCF_FRAME_TYPE(fcf) == DATA_FRAME &&
10008       DATA_FRAME_IS_QOS(frame_type_subtype)) {
10009         qosoff = hdr_len - htc_len - 2;
10010         qos_control = tvb_get_letohs(tvb, qosoff);
10011         if (tvb_length(tvb) > hdr_len) {
10012             meshoff = hdr_len;
10013             mesh_flags = tvb_get_guint8 (tvb, hdr_len);
10014             if (has_mesh_control(fcf, qos_control, mesh_flags)) {
10015               meshctl_len = find_mesh_control_length(mesh_flags);
10016               hdr_len += meshctl_len;
10017             }
10018         }
10019   }
10020
10021   /*
10022    * Some portions of this code calculate offsets relative to the end of the
10023    * header.  But when the header has been padded to align the data this must
10024    * be done relative to true header size, not the padded/aligned value.  To
10025    * simplify this work we stash the original header size in ohdr_len instead
10026    * of recalculating it every time we need it.
10027    */
10028   ohdr_len = hdr_len;
10029   if (datapad)
10030     hdr_len = roundup2(hdr_len, 4);
10031
10032   /* Add the FC to the current tree */
10033   if (tree)
10034     {
10035       ti = proto_tree_add_protocol_format (tree, proto_wlan, tvb, 0, hdr_len,
10036           "IEEE 802.11 %s", fts_str);
10037       hdr_tree = proto_item_add_subtree (ti, ett_80211);
10038
10039       dissect_frame_control(hdr_tree, tvb, wlan_broken_fc, 0);
10040
10041       if (frame_type_subtype == CTRL_PS_POLL)
10042         proto_tree_add_uint(hdr_tree, hf_ieee80211_assoc_id, tvb, 2, 2, ENC_LITTLE_ENDIAN); /* Need check this line.... */
10043
10044       else
10045         proto_tree_add_uint (hdr_tree, hf_ieee80211_did_duration, tvb, 2, 2,
10046             tvb_get_letohs (tvb, 2));
10047     }
10048
10049   /*
10050    * Decode the part of the frame header that isn't the same for all
10051    * frame types.
10052    */
10053   seq_control = 0;
10054   frag_number = 0;
10055   seq_number = 0;
10056
10057   switch (FCF_FRAME_TYPE (fcf))
10058   {
10059
10060     case MGT_FRAME:
10061       /*
10062        * All management frame types have the same header.
10063        */
10064       src = tvb_get_ptr (tvb, 10, 6);
10065       dst = tvb_get_ptr (tvb, 4, 6);
10066
10067       SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src);
10068       SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src);
10069       SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst);
10070       SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, dst);
10071
10072       /* for tap */
10073       SET_ADDRESS(&whdr->bssid, AT_ETHER, 6, tvb_get_ptr(tvb, 16,6));
10074       SET_ADDRESS(&whdr->src, AT_ETHER, 6, src);
10075       SET_ADDRESS(&whdr->dst, AT_ETHER, 6, dst);
10076       whdr->type = frame_type_subtype;
10077
10078       seq_control = tvb_get_letohs(tvb, 22);
10079       frag_number = SEQCTL_FRAGMENT_NUMBER(seq_control);
10080       seq_number = SEQCTL_SEQUENCE_NUMBER(seq_control);
10081
10082       col_append_fstr(pinfo->cinfo, COL_INFO,
10083             ", SN=%d", seq_number);
10084
10085       col_append_fstr(pinfo->cinfo, COL_INFO,
10086             ", FN=%d",frag_number);
10087
10088       if (tree)
10089       {
10090         proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 4, 6, dst);
10091
10092         proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 10, 6, src);
10093
10094         proto_tree_add_item (hdr_tree, hf_ieee80211_addr_bssid, tvb, 16, 6, ENC_NA);
10095
10096         /* add items for wlan.addr filter */
10097         hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, dst);
10098         PROTO_ITEM_SET_HIDDEN(hidden_item);
10099         hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, src);
10100         PROTO_ITEM_SET_HIDDEN(hidden_item);
10101
10102         hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, ENC_NA);
10103         PROTO_ITEM_SET_HIDDEN(hidden_item);
10104
10105
10106         proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10107             frag_number);
10108
10109         proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10110             seq_number);
10111       }
10112       break;
10113
10114     case CONTROL_FRAME:
10115     {
10116       /*
10117        * Control Wrapper frames insert themselves between address 1
10118        * and address 2 in a normal control frame.  Process address 1
10119        * first, then handle the rest of the frame in dissect_control.
10120        */
10121       if (frame_type_subtype == CTRL_CONTROL_WRAPPER) {
10122         offset = 10; /* FC + D/ID + Address 1 + CFC + HTC */
10123         ctrl_fcf = FETCH_FCF(10);
10124         ctrl_type_subtype = COMPOSE_FRAME_TYPE(ctrl_fcf);
10125       } else {
10126         offset = 10; /* FC + D/ID + Address 1 */
10127         ctrl_type_subtype = frame_type_subtype;
10128       }
10129
10130       switch (ctrl_type_subtype)
10131       {
10132         case CTRL_PS_POLL:
10133           addr1_str = "BSSID";
10134           addr1_hf = hf_ieee80211_addr_bssid;
10135           break;
10136         case CTRL_RTS:
10137         case CTRL_CTS:
10138         case CTRL_ACKNOWLEDGEMENT:
10139         case CTRL_CFP_END:
10140         case CTRL_CFP_ENDACK:
10141         case CTRL_BLOCK_ACK_REQ:
10142         case CTRL_BLOCK_ACK:
10143           addr1_str = "RA";
10144           addr1_hf = hf_ieee80211_addr_ra;
10145           break;
10146         default:
10147           break;
10148       }
10149
10150       if (!addr1_str) /* XXX - Should we throw some sort of error? */
10151         break;
10152
10153       /* Add address 1 */
10154       dst = tvb_get_ptr(tvb, 4, 6);
10155       set_dst_addr_cols(pinfo, dst, addr1_str);
10156       if (tree) {
10157         proto_tree_add_item(hdr_tree, addr1_hf, tvb, 4, 6, ENC_BIG_ENDIAN);
10158         hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, ENC_NA);
10159         PROTO_ITEM_SET_HIDDEN(hidden_item);
10160       }
10161
10162       /*
10163        * Start shoving in other fields if needed.
10164        * XXX - Should we look for is_ht as well?
10165        */
10166       if (frame_type_subtype == CTRL_CONTROL_WRAPPER && tree) {
10167         cw_item = proto_tree_add_text(hdr_tree, tvb, offset, 2,
10168           "Contained Frame Control");
10169         cw_tree = proto_item_add_subtree (cw_item, ett_cntrl_wrapper_fc);
10170         dissect_frame_control(cw_tree, tvb, FALSE, offset);
10171         dissect_ht_control(hdr_tree, tvb, offset + 2);
10172         offset+=6;
10173         cw_item = proto_tree_add_text(hdr_tree, tvb, offset, 2,
10174           "Carried Frame");
10175         hdr_tree = proto_item_add_subtree (cw_item, ett_cntrl_wrapper_fc);
10176       }
10177
10178       switch (ctrl_type_subtype)
10179       {
10180         case CTRL_PS_POLL:
10181         case CTRL_CFP_END:
10182         case CTRL_CFP_ENDACK:
10183         {
10184           src = tvb_get_ptr (tvb, offset, 6);
10185           set_src_addr_cols(pinfo, src, "BSSID");
10186           if (tree) {
10187             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, ENC_NA);
10188             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, offset, 6, ENC_NA);
10189             PROTO_ITEM_SET_HIDDEN(hidden_item);
10190           }
10191           break;
10192         }
10193
10194         case CTRL_RTS:
10195         {
10196           src = tvb_get_ptr (tvb, offset, 6);
10197           set_src_addr_cols(pinfo, src, "TA");
10198           if (tree) {
10199             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, ENC_NA);
10200             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, offset, 6, ENC_NA);
10201             PROTO_ITEM_SET_HIDDEN(hidden_item);
10202           }
10203           break;
10204         }
10205
10206         case CTRL_CONTROL_WRAPPER:
10207         {
10208           /* XXX - We shouldn't see this.  Should we throw an error? */
10209           break;
10210         }
10211
10212         case CTRL_BLOCK_ACK_REQ:
10213         {
10214           src = tvb_get_ptr (tvb, offset, 6);
10215           set_src_addr_cols(pinfo, src, "TA");
10216
10217           if (tree)
10218           {
10219             guint16 bar_control;
10220             guint8 block_ack_type;
10221             proto_item *bar_parent_item;
10222             proto_tree *bar_sub_tree;
10223
10224             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, ENC_NA);
10225             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, offset, 6, ENC_NA);
10226             PROTO_ITEM_SET_HIDDEN(hidden_item);
10227             offset += 6;
10228
10229             bar_control = tvb_get_letohs(tvb, offset);
10230             block_ack_type = (bar_control & 0x0006) >> 1;
10231             proto_tree_add_uint(hdr_tree, hf_ieee80211_block_ack_request_type, tvb,
10232               offset, 1, block_ack_type);
10233             bar_parent_item = proto_tree_add_uint_format(hdr_tree,
10234               hf_ieee80211_block_ack_request_control, tvb, offset, 2, bar_control,
10235               "Block Ack Request (BAR) Control: 0x%04X", bar_control);
10236             bar_sub_tree = proto_item_add_subtree(bar_parent_item,
10237               ett_block_ack);
10238             proto_tree_add_boolean(bar_sub_tree,
10239               hf_ieee80211_block_ack_control_ack_policy, tvb, offset, 1, bar_control);
10240             proto_tree_add_boolean(bar_sub_tree, hf_ieee80211_block_ack_control_multi_tid,
10241               tvb, offset, 1, bar_control);
10242             proto_tree_add_boolean(bar_sub_tree,
10243               hf_ieee80211_block_ack_control_compressed_bitmap, tvb, offset, 1,
10244               bar_control);
10245             proto_tree_add_uint(bar_sub_tree, hf_ieee80211_block_ack_control_reserved,
10246               tvb, offset, 2, bar_control);
10247
10248             switch (block_ack_type)
10249             {
10250               case 0: /*Basic BlockAckReq */
10251               {
10252                 proto_tree_add_uint(bar_sub_tree,
10253                 hf_ieee80211_block_ack_control_basic_tid_info, tvb, offset+1, 1,
10254                   bar_control);
10255                 offset += 2;
10256
10257                 /*offset +=*/ add_fixed_field(hdr_tree, tvb, offset,
10258                   FIELD_BLOCK_ACK_SSC);
10259                 break;
10260               }
10261               case 2: /* Compressed BlockAckReq */
10262               {
10263                 proto_tree_add_uint(bar_sub_tree,
10264                 hf_ieee80211_block_ack_control_compressed_tid_info, tvb, offset+1, 1,
10265                   bar_control);
10266                 offset += 2;
10267
10268                 /*offset +=*/ add_fixed_field(hdr_tree, tvb, offset,
10269                   FIELD_BLOCK_ACK_SSC);
10270                 break;
10271               }
10272               case 3: /* Multi-TID BlockAckReq */
10273               {
10274                 guint8 tid_count;
10275                 guint i;
10276                 proto_tree *bar_mtid_tree, *bar_mtid_sub_tree;
10277
10278                 tid_count = ((bar_control & 0xF000) >> 12) + 1;
10279                 proto_tree_add_uint_format(bar_sub_tree, hf_ieee80211_block_ack_control_multi_tid_info, tvb, offset+1, 1, bar_control,
10280                 decode_numeric_bitfield(bar_control, 0xF000, 16,"Number of TIDs Present: 0x%%X"), tid_count);
10281                 offset += 2;
10282
10283                 bar_parent_item = proto_tree_add_text (hdr_tree, tvb, offset, tid_count*4, "Per TID Info");
10284                 bar_mtid_tree = proto_item_add_subtree(bar_parent_item, ett_block_ack);
10285                 for (i = 1; i <= tid_count; i++) {
10286                   bar_parent_item = proto_tree_add_uint(bar_mtid_tree, hf_ieee80211_block_ack_multi_tid_info, tvb, offset, 4, i);
10287                   bar_mtid_sub_tree = proto_item_add_subtree(bar_parent_item, ett_block_ack);
10288
10289                   bar_control = tvb_get_letohs(tvb, offset);
10290                   proto_tree_add_uint(bar_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_reserved, tvb, offset, 2, bar_control);
10291                   proto_tree_add_uint(bar_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_value, tvb, offset+1, 1, bar_control);
10292                   offset += 2;
10293
10294                   offset += add_fixed_field(bar_mtid_sub_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
10295                 }
10296                 break;
10297               }
10298             }
10299           }
10300           break;
10301         }
10302
10303         case CTRL_BLOCK_ACK:
10304         {
10305           src = tvb_get_ptr (tvb, offset, 6);
10306           set_src_addr_cols(pinfo, src, "TA");
10307
10308           if (tree)
10309           {
10310             guint16 ba_control;
10311             guint8 block_ack_type;
10312             proto_item *ba_parent_item;
10313             proto_tree *ba_sub_tree;
10314
10315             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, ENC_NA);
10316             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, offset, 6, ENC_NA);
10317             PROTO_ITEM_SET_HIDDEN(hidden_item);
10318             offset += 6;
10319
10320             ba_control = tvb_get_letohs(tvb, offset);
10321             block_ack_type = (ba_control & 0x0006) >> 1;
10322             proto_tree_add_uint(hdr_tree, hf_ieee80211_block_ack_type, tvb, offset, 1, block_ack_type);
10323             ba_parent_item = proto_tree_add_uint_format(hdr_tree,
10324               hf_ieee80211_block_ack_control, tvb, offset, 2, ba_control,
10325               "Block Ack (BA) Control: 0x%04X", ba_control);
10326             ba_sub_tree = proto_item_add_subtree(ba_parent_item, ett_block_ack);
10327             proto_tree_add_boolean(ba_sub_tree, hf_ieee80211_block_ack_control_ack_policy,
10328               tvb, offset, 1, ba_control);
10329             proto_tree_add_boolean(ba_sub_tree, hf_ieee80211_block_ack_control_multi_tid,
10330               tvb, offset, 1, ba_control);
10331             proto_tree_add_boolean(ba_sub_tree,
10332               hf_ieee80211_block_ack_control_compressed_bitmap, tvb, offset, 1,
10333               ba_control);
10334             proto_tree_add_uint(ba_sub_tree, hf_ieee80211_block_ack_control_reserved, tvb,
10335               offset, 2, ba_control);
10336
10337             switch (block_ack_type)
10338             {
10339               case 0: /*Basic BlockAck */
10340               {
10341                 proto_tree_add_uint(ba_sub_tree,
10342                 hf_ieee80211_block_ack_control_basic_tid_info, tvb, offset+1, 1,
10343                   ba_control);
10344                 offset += 2;
10345
10346                 offset += add_fixed_field(hdr_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
10347                 proto_tree_add_item(hdr_tree, hf_ieee80211_block_ack_bitmap, tvb, offset, 128, ENC_NA);
10348                 /*offset += 128;*/
10349                 break;
10350               }
10351               case 2: /* Compressed BlockAck */
10352               {
10353                 guint16 ssn;
10354                 guint64 bmap;
10355                 int f;
10356                 proto_item *ba_bitmap_item;
10357                 proto_tree *ba_bitmap_tree;
10358
10359                 proto_tree_add_uint(ba_sub_tree, hf_ieee80211_block_ack_control_basic_tid_info, tvb, offset+1, 1, ba_control);
10360                 offset += 2;
10361
10362                 ssn = tvb_get_letohs(tvb, offset);
10363                 ssn >>= 4;
10364                 offset += add_fixed_field(hdr_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
10365                 bmap = tvb_get_letoh64(tvb, offset);
10366                 ba_bitmap_item = proto_tree_add_item(hdr_tree, hf_ieee80211_block_ack_bitmap, tvb, offset, 8, ENC_NA);
10367                 ba_bitmap_tree = proto_item_add_subtree(ba_bitmap_item, ett_block_ack_bitmap);
10368                 for (f = 0; f < 64; f++) {
10369                   if (bmap & (G_GINT64_CONSTANT(1) << f))
10370                     continue;
10371                   proto_tree_add_uint_format_value(ba_bitmap_tree, hf_ieee80211_block_ack_bitmap_missing_frame,
10372                                                    tvb, offset + (f/8), 1, ssn + f, "%u", ssn + f);
10373                 }
10374                 /*offset += 8;*/
10375                 break;
10376               }
10377               case 3:  /* Multi-TID BlockAck */
10378               {
10379                 guint8 tid_count;
10380                 guint i;
10381                 proto_tree *ba_mtid_tree, *ba_mtid_sub_tree;
10382
10383                 tid_count = ((ba_control & 0xF000) >> 12) + 1;
10384                 proto_tree_add_uint_format(ba_sub_tree,
10385                 hf_ieee80211_block_ack_control_compressed_tid_info, tvb, offset+1, 1,
10386                   ba_control, decode_numeric_bitfield(ba_control, 0xF000,
10387                   16,"Number of TIDs Present: 0x%%X"), tid_count);
10388                 offset += 2;
10389
10390                 ba_parent_item = proto_tree_add_text (hdr_tree, tvb, offset, tid_count*4, "Per TID Info");
10391                 ba_mtid_tree = proto_item_add_subtree(ba_parent_item, ett_block_ack);
10392                 for (i = 1; i <= tid_count; i++) {
10393                   ba_parent_item = proto_tree_add_uint(ba_mtid_tree, hf_ieee80211_block_ack_multi_tid_info, tvb, offset, 4, i);
10394                   ba_mtid_sub_tree = proto_item_add_subtree(ba_parent_item, ett_block_ack);
10395
10396                   ba_control = tvb_get_letohs(tvb, offset);
10397                   proto_tree_add_uint(ba_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_reserved, tvb, offset, 2, ba_control);
10398                   proto_tree_add_uint(ba_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_value, tvb, offset+1, 1, ba_control);
10399                   offset += 2;
10400
10401                   offset += add_fixed_field(ba_mtid_sub_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
10402                   proto_tree_add_item(ba_mtid_sub_tree, hf_ieee80211_block_ack_bitmap, tvb, offset, 8, ENC_NA);
10403                   offset += 8;
10404                 }
10405                 break;
10406               }
10407             }
10408           }
10409           break;
10410         }
10411       }
10412       break;
10413     }
10414
10415     case DATA_FRAME:
10416       addr_type = FCF_ADDR_SELECTOR (fcf);
10417
10418       /* In order to show src/dst address we must always do the following */
10419       switch (addr_type)
10420       {
10421
10422         case DATA_ADDR_T1:
10423           src = tvb_get_ptr (tvb, 10, 6);
10424           dst = tvb_get_ptr (tvb, 4, 6);
10425           bssid = tvb_get_ptr (tvb, 16, 6);
10426           break;
10427
10428         case DATA_ADDR_T2:
10429           src = tvb_get_ptr (tvb, 16, 6);
10430           dst = tvb_get_ptr (tvb, 4, 6);
10431           bssid = tvb_get_ptr (tvb, 10, 6);
10432           break;
10433
10434         case DATA_ADDR_T3:
10435           src = tvb_get_ptr (tvb, 10, 6);
10436           dst = tvb_get_ptr (tvb, 16, 6);
10437           bssid = tvb_get_ptr (tvb, 4, 6);
10438           break;
10439
10440         case DATA_ADDR_T4:
10441           src = tvb_get_ptr (tvb, 24, 6);
10442           dst = tvb_get_ptr (tvb, 16, 6);
10443           bssid = tvb_get_ptr (tvb, 16, 6);
10444           break;
10445       }
10446
10447       SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src);
10448       SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src);
10449       SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst);
10450       SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, dst);
10451
10452       /* for tap */
10453
10454       SET_ADDRESS(&whdr->bssid, AT_ETHER, 6, bssid);
10455       SET_ADDRESS(&whdr->src, AT_ETHER, 6, src);
10456       SET_ADDRESS(&whdr->dst, AT_ETHER, 6, dst);
10457       whdr->type = frame_type_subtype;
10458
10459       seq_control = tvb_get_letohs(tvb, 22);
10460       frag_number = SEQCTL_FRAGMENT_NUMBER(seq_control);
10461       seq_number = SEQCTL_SEQUENCE_NUMBER(seq_control);
10462
10463       col_append_fstr(pinfo->cinfo, COL_INFO,
10464             ", SN=%d, FN=%d", seq_number,frag_number);
10465
10466       /* Now if we have a tree we start adding stuff */
10467       if (tree)
10468       {
10469
10470         switch (addr_type)
10471         {
10472
10473           case DATA_ADDR_T1:
10474             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 4, 6, dst);
10475             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 10, 6, src);
10476             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_bssid, tvb, 16, 6, bssid);
10477             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10478                frag_number);
10479             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10480                seq_number);
10481
10482             /* add items for wlan.addr filter */
10483             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, dst);
10484             PROTO_ITEM_SET_HIDDEN(hidden_item);
10485             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, src);
10486             PROTO_ITEM_SET_HIDDEN(hidden_item);
10487             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, ENC_NA);
10488             PROTO_ITEM_SET_HIDDEN(hidden_item);
10489             break;
10490
10491           case DATA_ADDR_T2:
10492             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 4, 6, dst);
10493             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_bssid, tvb, 10, 6, bssid);
10494             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 16, 6, src);
10495             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10496                frag_number);
10497             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10498                seq_number);
10499
10500             /* add items for wlan.addr filter */
10501             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, dst);
10502             PROTO_ITEM_SET_HIDDEN(hidden_item);
10503             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, ENC_NA);
10504             PROTO_ITEM_SET_HIDDEN(hidden_item);
10505             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, src);
10506             PROTO_ITEM_SET_HIDDEN(hidden_item);
10507             break;
10508
10509           case DATA_ADDR_T3:
10510             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_bssid, tvb, 4, 6, bssid);
10511             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 10, 6, src);
10512             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 16, 6, dst);
10513
10514             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10515                frag_number);
10516             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10517                seq_number);
10518
10519             /* add items for wlan.addr filter */
10520             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, ENC_NA);
10521             PROTO_ITEM_SET_HIDDEN(hidden_item);
10522             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, src);
10523             PROTO_ITEM_SET_HIDDEN(hidden_item);
10524             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, dst);
10525             PROTO_ITEM_SET_HIDDEN(hidden_item);
10526             break;
10527
10528           case DATA_ADDR_T4:
10529             proto_tree_add_item (hdr_tree, hf_ieee80211_addr_ra, tvb, 4, 6, ENC_NA);
10530             proto_tree_add_item (hdr_tree, hf_ieee80211_addr_ta, tvb, 10, 6, ENC_NA);
10531             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 16, 6, dst);
10532             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10533                frag_number);
10534             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10535                seq_number);
10536             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 24, 6, src);
10537
10538             /* add items for wlan.addr filter */
10539             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, ENC_NA);
10540             PROTO_ITEM_SET_HIDDEN(hidden_item);
10541             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, ENC_NA);
10542             PROTO_ITEM_SET_HIDDEN(hidden_item);
10543             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, dst);
10544             PROTO_ITEM_SET_HIDDEN(hidden_item);
10545             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 24, 6, src);
10546             PROTO_ITEM_SET_HIDDEN(hidden_item);
10547             break;
10548         }
10549
10550       }
10551       break;
10552   }
10553
10554   len = tvb_length_remaining(tvb, hdr_len);
10555   reported_len = tvb_reported_length_remaining(tvb, hdr_len);
10556
10557   switch (fcs_len)
10558     {
10559       case 0: /* Definitely has no FCS */
10560         has_fcs = FALSE;
10561         break;
10562
10563       case 4: /* Definitely has an FCS */
10564         has_fcs = TRUE;
10565         break;
10566
10567       case -2: /* Data frames have no FCS, other frames have an FCS */
10568         if (FCF_FRAME_TYPE (fcf) == DATA_FRAME)
10569           has_fcs = FALSE;
10570         else
10571           has_fcs = TRUE;
10572         break;
10573
10574       default: /* Don't know - use "wlan_check_fcs" */
10575         has_fcs = wlan_check_fcs;
10576         break;
10577     }
10578   if (has_fcs)
10579     {
10580       /*
10581        * Well, this packet should, in theory, have an FCS.
10582        * Do we have the entire packet, and does it have enough data for
10583        * the FCS?
10584        */
10585       if (reported_len < 4)
10586       {
10587         /*
10588          * The packet is claimed not to even have enough data for a 4-byte
10589          * FCS.
10590          * Pretend it doesn't have an FCS.
10591          */
10592         ;
10593       }
10594       else if (len < reported_len)
10595       {
10596         /*
10597          * The packet is claimed to have enough data for a 4-byte FCS, but
10598          * we didn't capture all of the packet.
10599          * Slice off the 4-byte FCS from the reported length, and trim the
10600          * captured length so it's no more than the reported length; that
10601          * will slice off what of the FCS, if any, is in the captured
10602          * length.
10603          */
10604         reported_len -= 4;
10605         if (len > reported_len)
10606             len = reported_len;
10607       }
10608       else
10609       {
10610         /*
10611          * We have the entire packet, and it includes a 4-byte FCS.
10612          * Slice it off, and put it into the tree.
10613          */
10614         len -= 4;
10615         reported_len -= 4;
10616         if (tree)
10617         {
10618           guint32 sent_fcs = tvb_get_ntohl(tvb, hdr_len + len);
10619           guint32 fcs;
10620
10621           if (datapad)
10622             fcs = crc32_802_tvb_padded(tvb, ohdr_len, hdr_len, len);
10623           else
10624             fcs = crc32_802_tvb(tvb, hdr_len + len);
10625           if (fcs == sent_fcs) {
10626             fcs_good = TRUE;
10627             fcs_bad = FALSE;
10628           } else {
10629             fcs_good = FALSE;
10630             fcs_bad = TRUE;
10631           }
10632
10633           if(fcs_good) {
10634             fcs_item = proto_tree_add_uint_format(hdr_tree, hf_ieee80211_fcs, tvb,
10635                 hdr_len + len, 4, sent_fcs,
10636                 "Frame check sequence: 0x%08x [correct]", sent_fcs);
10637           } else {
10638             fcs_item = proto_tree_add_uint_format(hdr_tree, hf_ieee80211_fcs, tvb,
10639                 hdr_len + len, 4, sent_fcs,
10640                 "Frame check sequence: 0x%08x [incorrect, should be 0x%08x]",
10641                 sent_fcs, fcs);
10642             flag_str[8] = '.';
10643           }
10644
10645           proto_tree_set_appendix(hdr_tree, tvb, hdr_len + len, 4);
10646
10647           fcs_tree = proto_item_add_subtree(fcs_item, ett_fcs);
10648
10649           fcs_item = proto_tree_add_boolean(fcs_tree,
10650               hf_ieee80211_fcs_good, tvb,
10651               hdr_len + len, 4,
10652               fcs_good);
10653           PROTO_ITEM_SET_GENERATED(fcs_item);
10654
10655           fcs_item = proto_tree_add_boolean(fcs_tree,
10656               hf_ieee80211_fcs_bad, tvb,
10657               hdr_len + len, 4,
10658               fcs_bad);
10659           PROTO_ITEM_SET_GENERATED(fcs_item);
10660         }
10661       }
10662     } else {
10663       flag_str[8] = '\0';
10664     }
10665
10666     proto_item_append_text(ti, ", Flags: %s", flag_str);
10667     col_append_fstr (pinfo->cinfo, COL_INFO, ", Flags=%s", flag_str);
10668
10669
10670   /*
10671    * Only management and data frames have a body, so we don't have
10672    * anything more to do for other types of frames.
10673    */
10674   switch (FCF_FRAME_TYPE (fcf))
10675     {
10676
10677     case MGT_FRAME:
10678       if (htc_len == 4) {
10679         dissect_ht_control(hdr_tree, tvb, ohdr_len - 4);
10680       }
10681       break;
10682
10683     case DATA_FRAME:
10684       if (tree && DATA_FRAME_IS_QOS(frame_type_subtype))
10685       {
10686         proto_item *qos_fields;
10687         proto_tree *qos_tree;
10688
10689         guint16 qos_tid;
10690         guint16 qos_priority;
10691         guint16 qos_ack_policy;
10692         guint16 qos_amsdu_present;
10693         guint16 qos_eosp;
10694         guint16 qos_field_content;
10695
10696         qos_fields = proto_tree_add_text(hdr_tree, tvb, qosoff, 2,
10697             "QoS Control");
10698         qos_tree = proto_item_add_subtree (qos_fields, ett_qos_parameters);
10699
10700         qos_tid = QOS_TID(qos_control);
10701         qos_priority = QOS_PRIORITY(qos_control);
10702         qos_ack_policy = QOS_ACK_POLICY(qos_control);
10703         qos_amsdu_present = QOS_AMSDU_PRESENT(qos_control);
10704         qos_eosp = QOS_EOSP(qos_control);
10705         qos_field_content = QOS_FIELD_CONTENT(qos_control);
10706
10707         proto_tree_add_uint (qos_tree, hf_ieee80211_qos_tid, tvb,
10708             qosoff, 1, qos_tid);
10709
10710         proto_tree_add_uint_format (qos_tree, hf_ieee80211_qos_priority, tvb,
10711             qosoff, 1, qos_priority,
10712             "Priority: %d (%s) (%s)",
10713             qos_priority, qos_tags[qos_priority], qos_acs[qos_priority]);
10714
10715         if (flags & FLAG_FROM_DS) {
10716           proto_tree_add_boolean (qos_tree, hf_ieee80211_qos_eosp, tvb,
10717               qosoff, 1, qos_control);
10718         } else {
10719           proto_tree_add_boolean (qos_tree, hf_ieee80211_qos_bit4, tvb,
10720               qosoff, 1, qos_control);
10721         }
10722
10723         proto_tree_add_uint (qos_tree, hf_ieee80211_qos_ack_policy, tvb, qosoff, 1,
10724             qos_ack_policy);
10725
10726         if (flags & FLAG_FROM_DS) {
10727           if (!DATA_FRAME_IS_NULL(frame_type_subtype)) {
10728             proto_tree_add_boolean(qos_tree, hf_ieee80211_qos_amsdu_present, tvb,
10729                 qosoff, 1, qos_amsdu_present);
10730             is_amsdu = qos_amsdu_present;
10731           }
10732           if (DATA_FRAME_IS_CF_POLL(frame_type_subtype)) {
10733             /* txop limit */
10734             if (qos_field_content == 0) {
10735               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_txop_limit, tvb,
10736                   qosoff + 1, 1, qos_field_content,
10737                                                 "transmit one frame immediately (0)");
10738             } else {
10739               proto_tree_add_uint (qos_tree, hf_ieee80211_qos_txop_limit, tvb,
10740                                    qosoff + 1, 1, qos_field_content);
10741             }
10742           } else {
10743             /* qap ps buffer state */
10744             proto_item *qos_ps_buf_state_fields;
10745             proto_tree *qos_ps_buf_state_tree;
10746             guint8 qap_buf_load;
10747
10748             qos_ps_buf_state_fields = proto_tree_add_text(qos_tree, tvb, qosoff + 1, 1,
10749                 "QAP PS Buffer State: 0x%x", qos_field_content);
10750             qos_ps_buf_state_tree = proto_item_add_subtree (qos_ps_buf_state_fields, ett_qos_ps_buf_state);
10751
10752             proto_tree_add_boolean (qos_ps_buf_state_tree, hf_ieee80211_qos_buf_state_indicated,
10753                                     tvb, qosoff + 1, 1, qos_field_content);
10754
10755             if (QOS_PS_BUF_STATE_INDICATED(qos_field_content)) {
10756               proto_tree_add_uint (qos_ps_buf_state_tree, hf_ieee80211_qos_highest_pri_buf_ac, tvb,
10757                   qosoff + 1, 1, qos_field_content);
10758
10759               qap_buf_load = QOS_PS_QAP_BUF_LOAD(qos_field_content);
10760               switch (qap_buf_load) {
10761
10762               case 0:
10763                 proto_tree_add_uint_format_value (qos_ps_buf_state_tree, hf_ieee80211_qos_qap_buf_load, tvb,
10764                     qosoff + 1, 1, qos_field_content,
10765                     "no buffered traffic (0)");
10766                 break;
10767
10768               default:
10769                 proto_tree_add_uint_format_value (qos_ps_buf_state_tree, hf_ieee80211_qos_qap_buf_load, tvb,
10770                     qosoff + 1, 1, qos_field_content,
10771                     "%d octets (%d)", qap_buf_load*4096, qap_buf_load);
10772                 break;
10773
10774               case 15:
10775                 proto_tree_add_uint_format_value (qos_ps_buf_state_tree, hf_ieee80211_qos_qap_buf_load, tvb,
10776                     qosoff + 1, 1, qos_field_content,
10777                     "greater than 57344 octets (15)");
10778                 break;
10779               }
10780             }
10781           }
10782         } else {
10783           if (!DATA_FRAME_IS_NULL(frame_type_subtype)) {
10784             proto_tree_add_boolean(qos_tree, hf_ieee80211_qos_amsdu_present, tvb,
10785                 qosoff, 1, qos_amsdu_present);
10786             is_amsdu = qos_amsdu_present;
10787           }
10788           if (qos_eosp) {
10789             /* queue size */
10790             switch (qos_field_content) {
10791
10792             case 0:
10793               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
10794                                                 tvb, qosoff + 1, 1, qos_field_content,
10795                   "no buffered traffic in the queue (0)");
10796               break;
10797
10798             default:
10799               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
10800                                                 tvb, qosoff + 1, 1, qos_field_content,
10801                                                 "%u bytes (%u)", qos_field_content*256, qos_field_content);
10802               break;
10803
10804             case 254:
10805               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
10806                                                 tvb, qosoff + 1, 1, qos_field_content,
10807                   "more than 64768 octets (254)");
10808               break;
10809
10810             case 255:
10811               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
10812                                                 tvb, qosoff + 1, 1, qos_field_content,
10813                   "unspecified or unknown (256)");
10814               break;
10815             }
10816           } else {
10817             /* txop duration requested */
10818             if (qos_field_content == 0) {
10819               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_txop_dur_req,
10820                                                 tvb, qosoff + 1, 1, qos_field_content,
10821                                                 "no TXOP requested (0)");
10822             } else {
10823               proto_tree_add_uint (qos_tree, hf_ieee80211_qos_txop_dur_req,
10824                                    tvb, qosoff + 1, 1, qos_field_content);
10825             }
10826           }
10827         }
10828
10829         /* Do we have +HTC? */
10830         if (htc_len == 4) {
10831           dissect_ht_control(hdr_tree, tvb, ohdr_len - 4);
10832         }
10833
10834         if (meshctl_len != 0) {
10835           proto_item *msh_fields;
10836           proto_tree *msh_tree;
10837
10838           msh_fields = proto_tree_add_text(hdr_tree, tvb, meshoff, meshctl_len, "Mesh Control field");
10839           msh_tree = proto_item_add_subtree (msh_fields, ett_msh_control);
10840           add_fixed_field(msh_tree, tvb, meshoff, FIELD_MESH_CONTROL);
10841         }
10842
10843       } /* end of qos control field */
10844       /* Davide Schiera (2006-11-21): process handshake packet with AirPDcap    */
10845       /* the processing will take care of 4-way handshake sessions for WPA    */
10846       /* and WPA2 decryption                                  */
10847       if (enable_decryption && !pinfo->fd->flags.visited) {
10848         const guint8 *enc_data = tvb_get_ptr(tvb, 0, hdr_len+reported_len);
10849         AirPDcapPacketProcess(&airpdcap_ctx, enc_data, hdr_len, hdr_len+reported_len, NULL, 0, NULL, TRUE, FALSE);
10850       }
10851       /* Davide Schiera --------------------------------------------------------  */
10852
10853       /*
10854        * No-data frames don't have a body.
10855        */
10856       if (DATA_FRAME_IS_NULL(frame_type_subtype))
10857         return;
10858
10859       if (!wlan_subdissector) {
10860         guint fnum = 0;
10861
10862         /* key: bssid:src
10863          * data: last seq_control seen and frame number
10864          */
10865         retransmitted = FALSE;
10866         if(!pinfo->fd->flags.visited){
10867           retransmit_key key;
10868           retransmit_key *result;
10869
10870           memcpy(key.bssid, bssid, 6);
10871           memcpy(key.src, src, 6);
10872           key.seq_control = 0;
10873           result = (retransmit_key *)g_hash_table_lookup(fc_analyse_retransmit_table, &key);
10874           if (result && result->seq_control == seq_control) {
10875                /* keep a pointer to the first seen frame, could be done with proto data? */
10876                fnum = result->fnum;
10877                g_hash_table_insert(fc_first_frame_table, GINT_TO_POINTER( pinfo->fd->num),
10878                   GINT_TO_POINTER(fnum));
10879                retransmitted = TRUE;
10880           } else {
10881                /* first time or new seq*/
10882                if (!result) {
10883                   result = se_alloc(sizeof(retransmit_key));
10884                   *result = key;
10885                   g_hash_table_insert(fc_analyse_retransmit_table, result, result);
10886                }
10887                result->seq_control = seq_control;
10888                result->fnum =  pinfo->fd->num;
10889            }
10890         }
10891         else if ((fnum = GPOINTER_TO_UINT(g_hash_table_lookup(fc_first_frame_table, GINT_TO_POINTER( pinfo->fd->num))))) {
10892            retransmitted = TRUE;
10893         }
10894
10895         if (retransmitted) {
10896             col_append_str(pinfo->cinfo, COL_INFO, " [retransmitted]");
10897             if (tree) {
10898                 proto_item *item;
10899
10900                 item=proto_tree_add_none_format(hdr_tree, hf_ieee80211_fc_analysis_retransmission, tvb, 0, 0, "Retransmitted frame");
10901                 PROTO_ITEM_SET_GENERATED(item);
10902                 item=proto_tree_add_uint(hdr_tree, hf_ieee80211_fc_analysis_retransmission_frame,tvb, 0, 0, fnum);
10903                 PROTO_ITEM_SET_GENERATED(item);
10904             }
10905             next_tvb = tvb_new_subset (tvb, hdr_len, len, reported_len);
10906             call_dissector(data_handle, next_tvb, pinfo, tree);
10907             goto end_of_wlan;
10908         }
10909       }
10910
10911       break;
10912
10913     case CONTROL_FRAME:
10914       return;
10915
10916     default:
10917       return;
10918     }
10919
10920   if (IS_PROTECTED(FCF_FLAGS(fcf)) && wlan_ignore_wep != WLAN_IGNORE_WEP_WO_IV) {
10921     /*
10922      * It's a WEP or WPA encrypted frame; dissect the protections parameters
10923      * and decrypt the data, if we have a matching key. Otherwise display it as data.
10924      */
10925
10926     gboolean can_decrypt = FALSE;
10927     proto_tree *wep_tree = NULL;
10928     guint32 iv;
10929     guint8 key, keybyte;
10930
10931     /* Davide Schiera (2006-11-27): define algorithms constants and macros  */
10932 #define PROTECTION_ALG_WEP  AIRPDCAP_KEY_TYPE_WEP
10933 #define PROTECTION_ALG_TKIP  AIRPDCAP_KEY_TYPE_TKIP
10934 #define PROTECTION_ALG_CCMP  AIRPDCAP_KEY_TYPE_CCMP
10935 #define PROTECTION_ALG_RSNA  PROTECTION_ALG_CCMP | PROTECTION_ALG_TKIP
10936     guint8 algorithm=G_MAXUINT8;
10937     /* Davide Schiera (2006-11-27): added macros to check the algorithm    */
10938     /* used could be TKIP or CCMP                            */
10939 #define IS_TKIP(tvb, hdr_len)  (tvb_get_guint8(tvb, hdr_len + 1) & 0x20)
10940 #define IS_CCMP(tvb, hdr_len)  (tvb_get_guint8(tvb, hdr_len + 2) == 0)
10941     /* Davide Schiera -----------------------------------------------------  */
10942
10943     /* Davide Schiera (2006-11-21): recorded original lengths to pass them  */
10944     /* to the packets process function                        */
10945     guint32 sec_header=0;
10946     guint32 sec_trailer=0;
10947
10948     next_tvb = try_decrypt(tvb, hdr_len, reported_len, &algorithm, &sec_header, &sec_trailer);
10949     /* Davide Schiera -----------------------------------------------------  */
10950
10951     keybyte = tvb_get_guint8(tvb, hdr_len + 3);
10952     key = KEY_OCTET_WEP_KEY(keybyte);
10953     if ((keybyte & KEY_EXTIV) && (len >= EXTIV_LEN)) {
10954       /* Extended IV; this frame is likely encrypted with TKIP or CCMP */
10955
10956
10957       if (tree) {
10958         proto_item *extiv_fields;
10959
10960         /* Davide Schiera (2006-11-27): differentiated CCMP and TKIP if  */
10961         /* it's possible                                */
10962         if (algorithm==PROTECTION_ALG_TKIP)
10963           extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10964               "TKIP parameters");
10965         else if (algorithm==PROTECTION_ALG_CCMP)
10966           extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10967             "CCMP parameters");
10968         else {
10969           /* Davide Schiera --------------------------------------------  */
10970           /* Davide Schiera (2006-11-27): differentiated CCMP and TKIP if*/
10971           /* it's possible                              */
10972           if (IS_TKIP(tvb, hdr_len)) {
10973             algorithm=PROTECTION_ALG_TKIP;
10974             extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10975                 "TKIP parameters");
10976           } else if (IS_CCMP(tvb, hdr_len)) {
10977             algorithm=PROTECTION_ALG_CCMP;
10978             extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10979                 "CCMP parameters");
10980           } else
10981             extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10982                 "TKIP/CCMP parameters");
10983         }
10984         proto_item_set_len (ti, hdr_len + 8);
10985
10986         wep_tree = proto_item_add_subtree (extiv_fields, ett_wep_parameters);
10987
10988         if (algorithm==PROTECTION_ALG_TKIP) {
10989           g_snprintf(out_buff, SHORT_STR, "0x%08X%02X%02X",
10990               tvb_get_letohl(tvb, hdr_len + 4),
10991               tvb_get_guint8(tvb, hdr_len),
10992               tvb_get_guint8(tvb, hdr_len + 2));
10993           proto_tree_add_string(wep_tree, hf_ieee80211_tkip_extiv, tvb, hdr_len,
10994               EXTIV_LEN, out_buff);
10995         } else if (algorithm==PROTECTION_ALG_CCMP) {
10996           g_snprintf(out_buff, SHORT_STR, "0x%08X%02X%02X",
10997               tvb_get_letohl(tvb, hdr_len + 4),
10998               tvb_get_guint8(tvb, hdr_len + 1),
10999               tvb_get_guint8(tvb, hdr_len));
11000           proto_tree_add_string(wep_tree, hf_ieee80211_ccmp_extiv, tvb, hdr_len,
11001               EXTIV_LEN, out_buff);
11002         }
11003
11004         proto_tree_add_uint(wep_tree, hf_ieee80211_wep_key, tvb, hdr_len + 3, 1, key);
11005       }
11006
11007       /* Subtract out the length of the IV. */
11008       len -= EXTIV_LEN;
11009       reported_len -= EXTIV_LEN;
11010       ivlen = EXTIV_LEN;
11011       /* It is unknown whether this is TKIP or CCMP, so let's not even try to
11012        * parse TKIP Michael MIC+ICV or CCMP MIC. */
11013
11014       /* Davide Schiera (2006-11-21): enable TKIP and CCMP decryption      */
11015       /* checking for the trailer                            */
11016       if (next_tvb!=NULL) {
11017         if (reported_len < (gint) sec_trailer) {
11018           /* There is no space for a trailer, ignore it and don't decrypt  */
11019           ;
11020         } else if (len < reported_len) {
11021           /* There is space for a trailer, but we haven't capture all the  */
11022           /* packet. Slice off the trailer, but don't try to decrypt      */
11023           reported_len -= sec_trailer;
11024           if (len > reported_len)
11025             len = reported_len;
11026         } else {
11027           /* Ok, we have a trailer and the whole packet. Decrypt it!      */
11028           /* TODO: At the moment we won't add the trailer to the tree,    */
11029           /* so don't remove the trailer from the packet              */
11030           len -= sec_trailer;
11031           reported_len -= sec_trailer;
11032           can_decrypt = TRUE;
11033         }
11034       }
11035       /* Davide Schiera --------------------------------------------------  */
11036     } else {
11037       /* No Ext. IV - WEP packet */
11038       /*
11039        * XXX - pass the IV and key to "try_decrypt_wep()", and have it pass
11040        * them to "wep_decrypt()", rather than having "wep_decrypt()" extract
11041        * them itself.
11042        *
11043        * Also, just pass the data *following* the WEP parameters as the
11044        * buffer to decrypt.
11045        */
11046       iv = tvb_get_ntoh24(tvb, hdr_len);
11047       if (tree) {
11048         proto_item *wep_fields;
11049
11050         wep_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 4,
11051             "WEP parameters");
11052
11053         wep_tree = proto_item_add_subtree (wep_fields, ett_wep_parameters);
11054         proto_tree_add_uint (wep_tree, hf_ieee80211_wep_iv, tvb, hdr_len, 3, iv);
11055         tvb_memcpy(tvb, iv_buff, hdr_len, 3);
11056         is_iv_bad = weak_iv(iv_buff);
11057         if (is_iv_bad != -1) {
11058           proto_tree_add_boolean_format (wep_tree, hf_ieee80211_wep_iv_weak,
11059               tvb, 0, 0, TRUE,
11060               "Weak IV for key byte %d",
11061               is_iv_bad);
11062         }
11063       }
11064       if (tree)
11065         proto_tree_add_uint (wep_tree, hf_ieee80211_wep_key, tvb, hdr_len + 3, 1, key);
11066
11067       /* Subtract out the length of the IV. */
11068       len -= 4;
11069       reported_len -= 4;
11070       ivlen = 4;
11071
11072       /* Davide Schiera (2006-11-27): Even if the decryption was not */
11073       /* successful, set the algorithm                               */
11074       algorithm=PROTECTION_ALG_WEP;
11075
11076       /*
11077        * Well, this packet should, in theory, have an ICV.
11078        * Do we have the entire packet, and does it have enough data for
11079        * the ICV?
11080        */
11081       if (reported_len < 4) {
11082         /*
11083          * The packet is claimed not to even have enough data for a
11084          * 4-byte ICV.
11085          * Pretend it doesn't have an ICV.
11086          */
11087         ;
11088       } else if (len < reported_len) {
11089         /*
11090          * The packet is claimed to have enough data for a 4-byte ICV,
11091          * but we didn't capture all of the packet.
11092          * Slice off the 4-byte ICV from the reported length, and trim
11093          * the captured length so it's no more than the reported length;
11094          * that will slice off what of the ICV, if any, is in the
11095          * captured length.
11096          */
11097         reported_len -= 4;
11098         if (len > reported_len)
11099           len = reported_len;
11100       } else {
11101         /*
11102          * We have the entire packet, and it includes a 4-byte ICV.
11103          * Slice it off, and put it into the tree.
11104          *
11105          * We only support decrypting if we have the the ICV.
11106          *
11107          * XXX - the ICV is encrypted; we're putting the encrypted
11108          * value, not the decrypted value, into the tree.
11109          */
11110         len -= 4;
11111         reported_len -= 4;
11112         can_decrypt = TRUE;
11113       }
11114     }
11115
11116     if (algorithm == PROTECTION_ALG_WEP) {
11117       g_strlcpy (wlan_stats.protection, "WEP", MAX_PROTECT_LEN);
11118     } else if (algorithm == PROTECTION_ALG_TKIP) {
11119       g_strlcpy (wlan_stats.protection, "TKIP", MAX_PROTECT_LEN);
11120     } else if (algorithm == PROTECTION_ALG_CCMP) {
11121       g_strlcpy (wlan_stats.protection, "CCMP", MAX_PROTECT_LEN);
11122     } else {
11123       g_strlcpy (wlan_stats.protection, "Unknown", MAX_PROTECT_LEN);
11124     }
11125
11126     /* Davide Schiera (2006-11-26): decrypted before parsing header and    */
11127     /* protection header                                  */
11128     if (!can_decrypt || next_tvb == NULL) {
11129       /*
11130        * WEP decode impossible or failed, treat payload as raw data
11131        * and don't attempt fragment reassembly or further dissection.
11132        */
11133       next_tvb = tvb_new_subset(tvb, hdr_len + ivlen, len, reported_len);
11134
11135       if (tree) {
11136         /* Davide Schiera (2006-11-21): added WEP or WPA separation      */
11137         if (algorithm==PROTECTION_ALG_WEP) {
11138           if (can_decrypt)
11139             proto_tree_add_uint_format (wep_tree, hf_ieee80211_wep_icv, tvb,
11140                 hdr_len + ivlen + len, 4,
11141                 tvb_get_ntohl(tvb, hdr_len + ivlen + len),
11142                 "WEP ICV: 0x%08x (not verified)",
11143                 tvb_get_ntohl(tvb, hdr_len + ivlen + len));
11144         } else if (algorithm==PROTECTION_ALG_CCMP) {
11145         } else if (algorithm==PROTECTION_ALG_TKIP) {
11146         }
11147       }
11148       /* Davide Schiera (2006-11-21) ----------------------------------  */
11149
11150       if (pinfo->ethertype != ETHERTYPE_CENTRINO_PROMISC && wlan_ignore_wep == WLAN_IGNORE_WEP_NO) {
11151         /* Some wireless drivers (such as Centrino) WEP payload already decrypted */
11152         call_dissector(data_handle, next_tvb, pinfo, tree);
11153         goto end_of_wlan;
11154       }
11155     } else {
11156       /* Davide Schiera (2006-11-21): added WEP or WPA separation        */
11157       if (algorithm==PROTECTION_ALG_WEP) {
11158         if (tree)
11159           proto_tree_add_uint_format (wep_tree, hf_ieee80211_wep_icv, tvb,
11160               hdr_len + ivlen + len, 4,
11161               tvb_get_ntohl(tvb, hdr_len + ivlen + len),
11162               "WEP ICV: 0x%08x (correct)",
11163               tvb_get_ntohl(tvb, hdr_len + ivlen + len));
11164
11165         add_new_data_source(pinfo, next_tvb, "Decrypted WEP data");
11166       } else if (algorithm==PROTECTION_ALG_CCMP) {
11167         add_new_data_source(pinfo, next_tvb, "Decrypted CCMP data");
11168       } else if (algorithm==PROTECTION_ALG_TKIP) {
11169         add_new_data_source(pinfo, next_tvb, "Decrypted TKIP data");
11170       }
11171       /* Davide Schiera (2006-11-21) -------------------------------------  */
11172       /* Davide Schiera (2006-11-27): undefine macros and definitions  */
11173 #undef IS_TKIP
11174 #undef IS_CCMP
11175 #undef PROTECTION_ALG_CCMP
11176 #undef PROTECTION_ALG_TKIP
11177 #undef PROTECTION_ALG_WEP
11178       /* Davide Schiera --------------------------------------------------  */
11179     }
11180
11181     /*
11182      * WEP decryption successful!
11183      *
11184      * Use the tvbuff we got back from the decryption; the data starts at
11185      * the beginning.  The lengths are already correct for the decoded WEP
11186      * payload.
11187      */
11188     hdr_len = 0;
11189
11190   } else {
11191     /*
11192      * Not a WEP-encrypted frame; just use the data from the tvbuff
11193      * handed to us.
11194      *
11195      * The payload starts at "hdr_len" (i.e., just past the 802.11
11196      * MAC header), the length of data in the tvbuff following the
11197      * 802.11 header is "len", and the length of data in the packet
11198      * following the 802.11 header is "reported_len".
11199      */
11200     next_tvb = tvb;
11201   }
11202
11203   /*
11204    * Do defragmentation if "wlan_defragment" is true, and we have more
11205    * fragments or this isn't the first fragment.
11206    *
11207    * We have to do some special handling to catch frames that
11208    * have the "More Fragments" indicator not set but that
11209    * don't show up as reassembled and don't have any other
11210    * fragments present.  Some networking interfaces appear
11211    * to do reassembly even when you're capturing raw packets
11212    * *and* show the reassembled packet without the "More
11213    * Fragments" indicator set *but* with a non-zero fragment
11214    * number.
11215    *
11216    * "fragment_add_seq_802_11()" handles that; we want to call it
11217    * even if we have a short frame, so that it does those checks - if
11218    * the frame is short, it doesn't do reassembly on it.
11219    *
11220    * (This could get some false positives if we really *did* only
11221    * capture the last fragment of a fragmented packet, but that's
11222    * life.)
11223    */
11224   save_fragmented = pinfo->fragmented;
11225   if (wlan_defragment && (more_frags || frag_number != 0)) {
11226     fragment_data *fd_head;
11227
11228     /*
11229      * If we've already seen this frame, look it up in the
11230      * table of reassembled packets, otherwise add it to
11231      * whatever reassembly is in progress, if any, and see
11232      * if it's done.
11233      */
11234     if (reported_len < 0)
11235       THROW(ReportedBoundsError);
11236     fd_head = fragment_add_seq_802_11(next_tvb, hdr_len, pinfo, seq_number,
11237         wlan_fragment_table,
11238         wlan_reassembled_table,
11239         frag_number,
11240         reported_len,
11241         more_frags);
11242     next_tvb = process_reassembled_data(tvb, hdr_len, pinfo,
11243         "Reassembled 802.11", fd_head,
11244         &frag_items, NULL, hdr_tree);
11245   } else {
11246     /*
11247      * If this is the first fragment, dissect its contents, otherwise
11248      * just show it as a fragment.
11249      */
11250     if (frag_number != 0) {
11251       /* Not the first fragment - don't dissect it. */
11252       next_tvb = NULL;
11253     } else {
11254       /* First fragment, or not fragmented.  Dissect what we have here. */
11255
11256       /* Get a tvbuff for the payload. */
11257       next_tvb = tvb_new_subset (next_tvb, hdr_len, len, reported_len);
11258
11259       /*
11260        * If this is the first fragment, but not the only fragment,
11261        * tell the next protocol that.
11262        */
11263       if (more_frags)
11264         pinfo->fragmented = TRUE;
11265       else
11266         pinfo->fragmented = FALSE;
11267     }
11268   }
11269
11270   if (next_tvb == NULL) {
11271     /* Just show this as an incomplete fragment. */
11272     col_set_str(pinfo->cinfo, COL_INFO, "Fragmented IEEE 802.11 frame");
11273     next_tvb = tvb_new_subset (tvb, hdr_len, len, reported_len);
11274     call_dissector(data_handle, next_tvb, pinfo, tree);
11275     pinfo->fragmented = save_fragmented;
11276     goto end_of_wlan;
11277   }
11278
11279   switch (FCF_FRAME_TYPE (fcf))
11280     {
11281
11282     case MGT_FRAME:
11283       dissect_ieee80211_mgt (fcf, next_tvb, pinfo, tree);
11284       break;
11285
11286     case DATA_FRAME:
11287       if (is_amsdu && tvb_reported_length_remaining(next_tvb, 0) > 4){
11288         tvbuff_t *volatile msdu_tvb = NULL;
11289         guint32 msdu_offset = 0;
11290         guint i = 1;
11291         const guint8 *lcl_src = NULL;
11292         const guint8 *lcl_dst = NULL;
11293         guint16 msdu_length;
11294         proto_item *parent_item;
11295         proto_tree *mpdu_tree;
11296         proto_tree *subframe_tree;
11297
11298         parent_item = proto_tree_add_protocol_format(tree, proto_aggregate, next_tvb, 0,
11299                                     tvb_reported_length_remaining(next_tvb, 0), "IEEE 802.11 Aggregate MSDU");
11300         mpdu_tree = proto_item_add_subtree(parent_item, ett_msdu_aggregation_parent_tree);
11301
11302         do {
11303           lcl_dst = tvb_get_ptr (next_tvb, msdu_offset, 6);
11304           lcl_src = tvb_get_ptr (next_tvb, msdu_offset+6, 6);
11305           msdu_length = tvb_get_ntohs (next_tvb, msdu_offset+12);
11306
11307           parent_item = proto_tree_add_uint_format(mpdu_tree, hf_ieee80211_amsdu_msdu_header_text, next_tvb,
11308                             msdu_offset, roundup2(msdu_offset+14+msdu_length, 4),
11309                             i, "A-MSDU Subframe #%u", i);
11310           subframe_tree = proto_item_add_subtree(parent_item, ett_msdu_aggregation_subframe_tree);
11311           i++;
11312
11313           proto_tree_add_ether(subframe_tree, hf_ieee80211_addr_da, next_tvb, msdu_offset, 6, lcl_dst);
11314           proto_tree_add_ether(subframe_tree, hf_ieee80211_addr_sa, next_tvb, msdu_offset+6, 6, lcl_src);
11315           proto_tree_add_uint_format(subframe_tree, hf_ieee80211_mcsset_highest_data_rate, next_tvb, msdu_offset+12, 2,
11316           msdu_length, "MSDU length: 0x%04X", msdu_length);
11317
11318           msdu_offset += 14;
11319           msdu_tvb = tvb_new_subset(next_tvb, msdu_offset, msdu_length, -1);
11320           call_dissector(llc_handle, msdu_tvb, pinfo, subframe_tree);
11321           msdu_offset = roundup2(msdu_offset+msdu_length, 4);
11322         } while (tvb_reported_length_remaining(next_tvb, msdu_offset) > 14);
11323
11324         break;
11325       }
11326       /* I guess some bridges take Netware Ethernet_802_3 frames,
11327          which are 802.3 frames (with a length field rather than
11328          a type field, but with no 802.2 header in the payload),
11329          and just stick the payload into an 802.11 frame.  I've seen
11330          captures that show frames of that sort.
11331
11332          We also handle some odd form of encapsulation in which a
11333          complete Ethernet frame is encapsulated within an 802.11
11334          data frame, with no 802.2 header.  This has been seen
11335          from some hardware.
11336
11337          On top of that, at least at some point it appeared that
11338          the OLPC XO sent out frames with two bytes of 0 between
11339          the "end" of the 802.11 header and the beginning of
11340          the payload.
11341
11342          So, if the packet doesn't start with 0xaa 0xaa:
11343
11344            we first use the same scheme that linux-wlan-ng does to detect
11345            those encapsulated Ethernet frames, namely looking to see whether
11346            the frame either starts with 6 octets that match the destination
11347            address from the 802.11 header or has 6 octets that match the
11348            source address from the 802.11 header following the first 6 octets,
11349            and, if so, treat it as an encapsulated Ethernet frame;
11350
11351            otherwise, we use the same scheme that we use in the Ethernet
11352            dissector to recognize Netware 802.3 frames, namely checking
11353            whether the packet starts with 0xff 0xff and, if so, treat it
11354            as an encapsulated IPX frame, and then check whether the
11355            packet starts with 0x00 0x00 and, if so, treat it as an OLPC
11356            frame. */
11357       encap_type = ENCAP_802_2;
11358       TRY {
11359         octet1 = tvb_get_guint8(next_tvb, 0);
11360         octet2 = tvb_get_guint8(next_tvb, 1);
11361         if (octet1 != 0xaa || octet2 != 0xaa) {
11362           if (tvb_memeql(next_tvb, 6, pinfo->dl_src.data, 6) == 0 ||
11363               tvb_memeql(next_tvb, 0, pinfo->dl_dst.data, 6) == 0)
11364             encap_type = ENCAP_ETHERNET;
11365           else if (octet1 == 0xff && octet2 == 0xff)
11366             encap_type = ENCAP_IPX;
11367           else if (octet1 == 0x00 && octet2 == 0x00) {
11368             proto_tree_add_text(tree, next_tvb, 0, 2, "Mysterious OLPC stuff");
11369             next_tvb = tvb_new_subset_remaining (next_tvb, 2);
11370           }
11371         }
11372       }
11373       CATCH2(BoundsError, ReportedBoundsError) {
11374       ; /* do nothing */
11375
11376       }
11377       ENDTRY;
11378
11379       switch (encap_type) {
11380
11381       case ENCAP_802_2:
11382         call_dissector(llc_handle, next_tvb, pinfo, tree);
11383         break;
11384
11385       case ENCAP_ETHERNET:
11386         call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
11387         break;
11388
11389       case ENCAP_IPX:
11390         call_dissector(ipx_handle, next_tvb, pinfo, tree);
11391         break;
11392       }
11393       break;
11394     }
11395   pinfo->fragmented = save_fragmented;
11396
11397   end_of_wlan:
11398   whdr->stats = wlan_stats;
11399   tap_queue_packet(wlan_tap, pinfo, whdr);
11400   memset (&wlan_stats, 0, sizeof wlan_stats);
11401 }
11402
11403 /*
11404  * Dissect 802.11 with a variable-length link-layer header.
11405  */
11406 static void
11407 dissect_ieee80211 (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11408 {
11409   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
11410       pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, FALSE);
11411 }
11412
11413 /*
11414  * Dissect 802.11 with a variable-length link-layer header and data padding.
11415  */
11416 static void
11417 dissect_ieee80211_datapad (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11418 {
11419   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
11420       pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, TRUE, FALSE);
11421 }
11422
11423 /*
11424  * Dissect 802.11 with a variable-length link-layer header and a byte-swapped
11425  * control field (some hardware sends out LWAPP-encapsulated 802.11
11426  * packets with the control field byte swapped).
11427  */
11428 static void
11429 dissect_ieee80211_bsfc (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11430 {
11431   dissect_ieee80211_common (tvb, pinfo, tree, FALSE, 0, TRUE, FALSE, FALSE);
11432 }
11433
11434 /*
11435  * Dissect 802.11 with a fixed-length link-layer header (padded to the
11436  * maximum length).
11437  */
11438 static void
11439 dissect_ieee80211_fixed (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11440 {
11441   dissect_ieee80211_common (tvb, pinfo, tree, TRUE, 0, FALSE, FALSE, FALSE);
11442 }
11443
11444 /*
11445  * Dissect an HT 802.11 frame with a variable-length link-layer header.
11446  * XXX - Can we tell if a frame is +HTC just by looking at the MAC header?
11447  * If so, we can dispense with this.
11448  */
11449 static void
11450 dissect_ieee80211_ht (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11451 {
11452   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
11453       pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, TRUE);
11454 }
11455
11456 static void
11457 wlan_defragment_init(void)
11458 {
11459   fragment_table_init(&wlan_fragment_table);
11460   reassembled_table_init(&wlan_reassembled_table);
11461 }
11462
11463 /* ------------- */
11464 static guint
11465 retransmit_hash(gconstpointer k)
11466 {
11467   const retransmit_key *key = (const retransmit_key *)k;
11468   guint hash_val;
11469   int i;
11470
11471   hash_val = 0;
11472   for (i = 0; i < 6; i++)
11473     hash_val += key->bssid[i];
11474
11475   for (i = 0; i < 6; i++)
11476     hash_val += key->src[i];
11477
11478   return hash_val;
11479 }
11480
11481 static gint
11482 retransmit_equal(gconstpointer k1, gconstpointer k2)
11483 {
11484   const retransmit_key *key1 = (const retransmit_key *)k1;
11485   const retransmit_key *key2 = (const retransmit_key *)k2;
11486
11487   return ( (!memcmp(key1->bssid, key2->bssid, 6) && !memcmp( key1->src, key2->src, 6))? TRUE:FALSE);
11488 }
11489
11490 static guint
11491 frame_hash(gconstpointer k)
11492 {
11493   guint32 frame = GPOINTER_TO_UINT(k);
11494
11495   return frame;
11496 }
11497
11498 static gint
11499 frame_equal(gconstpointer k1, gconstpointer k2)
11500 {
11501   guint32 frame1 = GPOINTER_TO_UINT(k1);
11502   guint32 frame2 = GPOINTER_TO_UINT(k2);
11503
11504   return frame1==frame2;
11505 }
11506
11507 static void
11508 wlan_retransmit_init(void)
11509 {
11510   if ( fc_analyse_retransmit_table ){
11511       g_hash_table_destroy(fc_analyse_retransmit_table);
11512       fc_analyse_retransmit_table = NULL;
11513   }
11514
11515   if( fc_first_frame_table ){
11516       g_hash_table_destroy(fc_first_frame_table);
11517       fc_first_frame_table = NULL;
11518   }
11519
11520   if (wlan_subdissector)
11521       return;
11522
11523   fc_analyse_retransmit_table= g_hash_table_new(retransmit_hash, retransmit_equal);
11524   fc_first_frame_table = g_hash_table_new( frame_hash, frame_equal);
11525
11526 }
11527
11528 void
11529 proto_register_ieee80211 (void)
11530 {
11531   static const value_string frame_type[] = {
11532     {MGT_FRAME,     "Management frame"},
11533     {CONTROL_FRAME, "Control frame"},
11534     {DATA_FRAME,    "Data frame"},
11535     {0,             NULL}
11536   };
11537
11538   static const value_string tofrom_ds[] = {
11539     {0,                       "Not leaving DS or network is operating "
11540       "in AD-HOC mode (To DS: 0 From DS: 0)"},
11541     {FLAG_TO_DS,              "Frame from STA to DS via an AP (To DS: 1 "
11542       "From DS: 0)"},
11543     {FLAG_FROM_DS,            "Frame from DS to a STA via AP(To DS: 0 "
11544       "From DS: 1)"},
11545     {FLAG_TO_DS|FLAG_FROM_DS, "WDS (AP to AP) or Mesh (MP to MP) Frame "
11546       "(To DS: 1 From DS: 1)"},
11547     {0, NULL}
11548   };
11549
11550   static const true_false_string tods_flag = {
11551     "Frame is entering DS",
11552     "Frame is not entering DS"
11553   };
11554
11555   static const true_false_string fromds_flag = {
11556     "Frame is exiting DS",
11557     "Frame is not exiting DS"
11558   };
11559
11560   static const true_false_string more_frags = {
11561     "More fragments follow",
11562     "This is the last fragment"
11563   };
11564
11565   static const true_false_string retry_flags = {
11566     "Frame is being retransmitted",
11567     "Frame is not being retransmitted"
11568   };
11569
11570   static const true_false_string pm_flags = {
11571     "STA will go to sleep",
11572     "STA will stay up"
11573   };
11574
11575   static const true_false_string md_flags = {
11576     "Data is buffered for STA at AP",
11577     "No data buffered"
11578   };
11579
11580   static const true_false_string protected_flags = {
11581     "Data is protected",
11582     "Data is not protected"
11583   };
11584
11585   static const true_false_string order_flags = {
11586     "Strictly ordered",
11587     "Not strictly ordered"
11588   };
11589
11590   static const true_false_string cf_ess_flags = {
11591     "Transmitter is an AP",
11592     "Transmitter is a STA"
11593   };
11594
11595
11596   static const true_false_string cf_privacy_flags = {
11597     "AP/STA can support WEP",
11598     "AP/STA cannot support WEP"
11599   };
11600
11601   static const true_false_string cf_preamble_flags = {
11602     "Short preamble allowed",
11603     "Short preamble not allowed"
11604   };
11605
11606   static const true_false_string cf_pbcc_flags = {
11607     "PBCC modulation allowed",
11608     "PBCC modulation not allowed"
11609   };
11610
11611   static const true_false_string cf_agility_flags = {
11612     "Channel agility in use",
11613     "Channel agility not in use"
11614   };
11615
11616   static const true_false_string short_slot_time_flags = {
11617     "Short slot time in use",
11618     "Short slot time not in use"
11619   };
11620
11621   static const true_false_string dsss_ofdm_flags = {
11622     "DSSS-OFDM modulation allowed",
11623     "DSSS-OFDM modulation not allowed"
11624   };
11625
11626   static const true_false_string cf_spec_man_flags = {
11627     "dot11SpectrumManagementRequired TRUE",
11628     "dot11SpectrumManagementRequired FALSE"
11629   };
11630
11631   static const true_false_string cf_apsd_flags = {
11632     "apsd implemented",
11633     "apsd not implemented"
11634   };
11635
11636   static const true_false_string cf_del_blk_ack_flags = {
11637     "delayed block ack implemented",
11638     "delayed block ack not implemented"
11639   };
11640
11641   static const true_false_string cf_imm_blk_ack_flags = {
11642     "immediate block ack implemented",
11643     "immediate block ack not implemented"
11644   };
11645   static const true_false_string cf_ibss_flags = {
11646     "Transmitter belongs to an IBSS",
11647     "Transmitter belongs to a BSS"
11648   };
11649
11650   static const true_false_string eosp_flag = {
11651     "End of service period",
11652     "Service period"
11653   };
11654
11655   static const true_false_string bit4_flag = {
11656     "Bits 8-15 of QoS Control field are Queue Size",
11657     "Bits 8-15 of QoS Control field are TXOP Duration Requested"
11658   };
11659
11660   static const true_false_string ieee80211_qos_amsdu_present_flag = {
11661     "A-MSDU",
11662     "MSDU"
11663   };
11664
11665   static const value_string sta_cf_pollable[] = {
11666     {0x00, "Station is not CF-Pollable"},
11667     {0x02, "Station is CF-Pollable, "
11668      "not requesting to be placed on the  CF-polling list"},
11669     {0x01, "Station is CF-Pollable, "
11670      "requesting to be placed on the CF-polling list"},
11671     {0x03, "Station is CF-Pollable, requesting never to be polled"},
11672     {0x0200, "QSTA requesting association in QBSS"},
11673     {0, NULL}
11674   };
11675
11676   static const value_string ap_cf_pollable[] = {
11677     {0x00, "No point coordinator at AP"},
11678     {0x02, "Point coordinator at AP for delivery only (no polling)"},
11679     {0x01, "Point coordinator at AP for delivery and polling"},
11680     {0x03, "Reserved"},
11681     {0x0200, "QAP (HC) does not use CFP for delivery of unicast data type frames"},
11682     {0x0202, "QAP (HC) uses CFP for delivery, but does not send CF-Polls to non-QoS STAs"},
11683     {0x0201, "QAP (HC) uses CFP for delivery, and sends CF-Polls to non-QoS STAs"},
11684     {0x0203, "Reserved"},
11685     {0, NULL}
11686   };
11687
11688
11689   static const value_string auth_alg[] = {
11690     {0x00, "Open System"},
11691     {0x01, "Shared key"},
11692     {0x02, "Fast BSS Transition"},
11693     {0x80, "Network EAP"},  /* Cisco proprietary? */
11694     {0, NULL}
11695   };
11696
11697   static const true_false_string ff_block_ack_params_amsdu_permitted_flag = {
11698     "Permitted in QoS Data MPDUs",
11699     "Not Permitted"
11700   };
11701
11702   static const true_false_string ff_block_ack_params_policy_flag = {
11703     "Immediate Block Ack",
11704     "Delayed Block Ack"
11705   };
11706
11707   static const value_string  ff_channel_width_vals[] = {
11708     {0x00, "20 MHz channel width only"},
11709     {0x01, "Any channel width in the STA's Supported Channel Width Set"},
11710     {0, NULL}
11711   };
11712
11713   static const true_false_string ff_qos_info_ap_q_ack_flag = {
11714       "Implemented",
11715       "Not Implemented"
11716   };
11717
11718   static const true_false_string ff_qos_info_ap_queue_req_flag = {
11719       "Can process a nonzero Queue Size subfield in the QoS Control field in QoS data frames",
11720       "Can NOT process a nonzero Queue Size subfield in the QoS Control field in QoS data frames"
11721   };
11722
11723   static const true_false_string ff_qos_info_ap_txop_request_flag = {
11724       "Can process a nonzero TXOP Duration Requested subfield in the QoS Control field in QoS data frames",
11725       "Can NOT process a nonzero TXOP Duration Requested subfield in the QoS Control field in QoS data frames"
11726   };
11727
11728   static const true_false_string ff_qos_info_sta_ac_flag = {
11729       "Trigger-enabled and Delivery-enabled",
11730       "Neither Trigger-enabled nor Delivery-enabled"
11731   };
11732
11733   static const true_false_string ff_qos_info_sta_q_ack_flag = {
11734       "Implemented",
11735       "Not Implemented"
11736   };
11737
11738   static const value_string ff_qos_info_sta_max_sp_len_flags[] = {
11739     {0x00, "AP may deliver all buffered MSDUs, A-MSDUs and MMPDUs"},
11740     {0x01, "AP may deliver a maximum of two MSDUs and MMPDUs per SP"},
11741     {0x02, "AP may deliver a maximum of four MSDUs and MMPDUs per SP"},
11742     {0x03, "AP may deliver a maximum of six MSDUs and MMPDUs per SP"},
11743     {0, NULL}
11744   };
11745
11746   static const true_false_string ff_qos_info_sta_more_data_ack_flag = {
11747       "Can process ACK frames with the More Data bit in the Frame Control field set to 1",
11748       "Can NOT process ACK frames with the More Data bit in the Frame Control field set to 1"
11749   };
11750
11751   static const true_false_string ff_sm_pwr_save_sm_mode_flag = {
11752       "Dynamic SM Power Save mode",
11753       "Static SM Power Save mode"
11754   };
11755
11756   static const true_false_string ff_pco_phase_cntrl_flag = {
11757       "40 MHz Phase",
11758       "20 MHz Phase"
11759   };
11760
11761   static const true_false_string ff_psmp_param_set_more_psmp_flag = {
11762       "More PSMP Sequences Follow",
11763       "No PSMP Sequences Follow"
11764   };
11765
11766   static const value_string ff_mimo_cntrl_nc_index_flags[] = {
11767     {0x00, "1 Column"},
11768     {0x01, "2 Columns"},
11769     {0x02, "3 Columns"},
11770     {0x03, "4 Columns"},
11771     {0, NULL}
11772   };
11773
11774   static const value_string ff_mimo_cntrl_nr_index_flags[] = {
11775     {0x00, "1 Row"},
11776     {0x01, "2 Rows"},
11777     {0x02, "3 Rows"},
11778     {0x03, "4 Rows"},
11779     {0, NULL}
11780   };
11781
11782   static const true_false_string ff_mimo_cntrl_channel_width_flag = {
11783       "40 MHz",
11784       "20 MHz"
11785   };
11786
11787   static const true_false_string ff_ht_info_information_request_flag = {
11788       "Requesting HT Information Exchange management action frame",
11789       "Should not send an HT Information Exchange management action frame"
11790   };
11791
11792   static const true_false_string ff_ht_info_40_mhz_intolerant_flag = {
11793       "Transmitting station is intolerant of 40 MHz operation",
11794       "Transmitting station permits 40 MHz operation"
11795   };
11796
11797   static const true_false_string ff_ht_info_sta_chan_width_flag = {
11798       "40 MHz",
11799       "20 MHz"
11800   };
11801
11802   static const value_string ff_ht_action_flags[] = {
11803     {HT_ACTION_NOTIFY_CHAN_WIDTH, "Notify Channel Width"},
11804     {HT_ACTION_SM_PWR_SAVE, "Spatial Multiplexing (SM) Power Save"},
11805     {HT_ACTION_PSMP_ACTION, "Power Save Multi-Poll (PSMP) action frame"},
11806     {HT_ACTION_SET_PCO_PHASE, "Set PCO Phase"},
11807     {HT_ACTION_MIMO_CSI, "MIMO CSI Matrices"},
11808     {HT_ACTION_MIMO_BEAMFORMING, "MIMO Non-compressed Beamforming"},
11809     {HT_ACTION_MIMO_COMPRESSED_BEAMFORMING, "MIMO Compressed Beamforming"},
11810     {HT_ACTION_ANT_SEL_FEEDBACK, "Antenna Selection Indices Feedback"},
11811     {HT_ACTION_HT_INFO_EXCHANGE, "HT Information Exchange"},
11812     {0x00, NULL}
11813   };
11814
11815   static const value_string ff_mimo_cntrl_grouping_flags[] = {
11816     {0x00, "No Grouping"},
11817     {0x01, "Carrier Groups of 2"},
11818     {0x02, "Carrier Groups of 4"},
11819     {0x03, "Reserved"},
11820     {0, NULL}
11821   };
11822
11823   static const value_string ff_mimo_cntrl_coefficient_size_flags[] = {
11824     {0x00, "4 Bits"},
11825     {0x01, "5 Bits"},
11826     {0x02, "6 Bits"},
11827     {0x03, "8 Bits"},
11828     {0, NULL}
11829   };
11830
11831   static const value_string ff_mimo_cntrl_codebook_info_flags[] = {
11832     {0x00, "1 bit for 'Capital Psi', 3 bits for 'Small Psi'"},
11833     {0x01, "2 bit for 'Capital Psi', 4 bits for 'Small Psi'"},
11834     {0x02, "3 bit for 'Capital Psi', 5 bits for 'Small Psi'"},
11835     {0x03, "4 bit for 'Capital Psi', 6 bits for 'Small Psi'"},
11836     {0, NULL}
11837   };
11838
11839
11840
11841   static const value_string ff_pa_action_codes[] = {
11842     {PA_DSE_ENABLEMENT, "DSE enablement"},
11843     {PA_DSE_DEENABLEMENT, "DSE deenablement"},
11844     {PA_DSE_REG_LOC_ANNOUNCEMENT, "DSE Registered Location Announcement"},
11845     {PA_EXT_CHANNEL_SWITCH_ANNOUNCEMENT, "Extended Channel Switch Announcement"},
11846     {PA_DSE_MEASUREMENT_REQUEST, "DSE measurement request"},
11847     {PA_DSE_MEASUREMENT_REPORT, "DSE measurement report"},
11848     {PA_MEASUREMENT_PILOT, "Measurement Pilot"},
11849     {PA_DSE_POWER_CONSTRAINT, "DSE power constraint"},
11850     {PA_VENDOR_SPECIFIC, "Vendor Specific"},
11851     {PA_GAS_INITIAL_REQUEST, "GAS Initial Request"},
11852     {PA_GAS_INITIAL_RESPONSE, "GAS Initial Response"},
11853     {PA_GAS_COMEBACK_REQUEST, "GAS Comeback Request"},
11854     {PA_GAS_COMEBACK_RESPONSE, "GAS Comeback Response"},
11855     {PA_TDLS_DISCOVERY_RESPONSE, "TDLS Discovery Response"},
11856     {0x00, NULL}
11857   };
11858
11859   static const value_string category_codes[] = {
11860     {CAT_SPECTRUM_MGMT, "Spectrum Management (SM)"},
11861     {0x80 | CAT_SPECTRUM_MGMT, "Spectrum Management (SM) (error)"},
11862     {CAT_QOS, "Quality of Service (QoS)"},
11863     {0x80 | CAT_QOS, "Quality of Service (QoS (error))"},
11864     {CAT_DLS, "Direct-Link Setup (DLS)"},
11865     {0x80 | CAT_DLS, "Direct-Link Setup (DLS) (error)"},
11866     {CAT_BLOCK_ACK, "Block Ack"},
11867     {0x80 | CAT_BLOCK_ACK, "Block Ack (error)"},
11868     {CAT_PUBLIC, "Public Action"},
11869     {0x80 | CAT_PUBLIC, "Public Action (error)"},
11870     {CAT_RADIO_MEASUREMENT, "Radio Measurement"},
11871     {0x80 | CAT_RADIO_MEASUREMENT, "Radio Measurement (error)"},
11872     {CAT_FAST_BSS_TRANSITION, "Fast BSS Transition"},
11873     {0x80 | CAT_FAST_BSS_TRANSITION, "Fast BSS Transition (error)"},
11874     {CAT_HT, "High Throughput"},
11875     {0x80 | CAT_HT, "High Throughput (error)"},
11876     {CAT_SA_QUERY, "SA Query"},
11877     {0x80 | CAT_SA_QUERY, "SA Query (error)"},
11878     {CAT_PUBLIC_PROTECTED, "Protected Dual of Public Action"},
11879     {0x80 | CAT_PUBLIC_PROTECTED, "Protected Dual of Public Action (error)"},
11880     {CAT_WNM, "WNM"},
11881     {0x80 | CAT_WNM, "WNM (error)"},
11882     {CAT_UNPROTECTED_WNM, "Unprotected WNM"},
11883     {0x80 | CAT_UNPROTECTED_WNM, "Unprotected WNM (error)"},
11884     {CAT_TDLS, "TDLS"},
11885     {0x80 | CAT_TDLS, "TDLS (error)"},
11886     {CAT_MESH, "MESH"},
11887     {0x80 | CAT_MESH, "Mesh (error)"},
11888     {CAT_MULTIHOP, "Multihop"},
11889     {0x80 | CAT_MULTIHOP, "Multihop (error)"},
11890     {CAT_SELF_PROTECTED, "Self-protected"},
11891     {0x80 | CAT_SELF_PROTECTED, "Self-protected (error)"},
11892     {CAT_MGMT_NOTIFICATION, "Management Notification"},
11893     {0x80 | CAT_MGMT_NOTIFICATION, "Management Notification (error)"},
11894     {CAT_VENDOR_SPECIFIC_PROTECTED, "Vendor-specific Protected"},
11895     {0x80 | CAT_VENDOR_SPECIFIC_PROTECTED, "Vendor-specific Protected (error)"},
11896     {CAT_VENDOR_SPECIFIC, "Vendor Specific"},
11897     {0x80 | CAT_VENDOR_SPECIFIC, "Vendor Specific (error)"},
11898     {0, NULL}
11899   };
11900
11901   static const value_string action_codes[] ={
11902     {SM_ACTION_MEASUREMENT_REQUEST, "Measurement Request"},
11903     {SM_ACTION_MEASUREMENT_REPORT, "Measurement Report"},
11904     {SM_ACTION_TPC_REQUEST, "TPC Request"},
11905     {SM_ACTION_TPC_REPORT, "TPC Report"},
11906     {SM_ACTION_CHAN_SWITCH_ANNC, "Channel Switch Announcement"},
11907     {0, NULL}
11908   };
11909
11910   static const value_string vendor_action_types_mrvl[] ={
11911     {MRVL_ACTION_MESH_MANAGEMENT, "Mesh Management"},
11912     {0, NULL}
11913   };
11914
11915   static const value_string mesh_mgt_action_codes_mrvl[] ={
11916     {MRVL_MESH_MGMT_ACTION_RREQ, "Route Request"},
11917     {MRVL_MESH_MGMT_ACTION_RREP, "Route Response"},
11918     {MRVL_MESH_MGMT_ACTION_RERR, "Route Error"},
11919     {MRVL_MESH_MGMT_ACTION_PLDM, "Peer Link Down"},
11920     {0, NULL}
11921   };
11922
11923   static const value_string mesh_path_selection_codes[] ={
11924     {0x0, "Hybrid Wireless Mesh Protocol"},
11925     {0, NULL}
11926   };
11927
11928   static const value_string mesh_metric_codes[] ={
11929     {0x0, "Airtime Link Metric"},
11930     {0, NULL}
11931   };
11932
11933   static const value_string wme_action_codes[] = {
11934     {0x00, "Setup request"},
11935     {0x01, "Setup response"},
11936     {0x02, "Teardown"},
11937     {0x00, NULL}
11938   };
11939
11940   static const value_string wme_status_codes[] = {
11941     {0x00, "Admission accepted"},
11942     {0x01, "Invalid parameters"},
11943     {0x03, "Refused"},
11944     {0x00, NULL}
11945   };
11946
11947   static const value_string mesh_action[] ={
11948     {MESH_ACTION_LINK_METRIC_REPORT, "Mesh Link Metric Report"},
11949     {MESH_ACTION_HWMP, "HWMP Mesh Path Selection"},
11950     {MESH_ACTION_GATE_ANNOUNCE, "Gate Announcement"},
11951     {MESH_ACTION_CONGESTION_CTL, "Congestion Control Notification"},
11952     {MESH_ACTION_MCCA_SETUP_REQUEST, "MCCA Setup Request"},
11953     {MESH_ACTION_MCCA_SETUP_REPLY, "MCCA Setup Reply"},
11954     {MESH_ACTION_MCCA_ADV_REQUEST, "MCCA Advertisement Request"},
11955     {MESH_ACTION_MCCA_ADV, "MCCA Advertisement"},
11956     {MESH_ACTION_MCCA_TEARDOWN, "MCCA Teardown"},
11957     {MESH_ACTION_TBTT_ADJ_REQUEST, "TBTT Adjustment Request"},
11958     {MESH_ACTION_TBTT_ADJ_RESPONSE, "TBTT Adjustment Response"},
11959     {0, NULL}
11960   };
11961
11962   static const value_string multihop_action[] ={
11963     {MULTIHOP_ACTION_PROXY_UPDATE, "Proxy Update"},
11964     {MULTIHOP_ACTION_PROXY_UPDATE_CONF, "Proxy Update Confirmation"},
11965     {0, NULL}
11966   };
11967
11968   static const value_string selfprot_action[] = {
11969     {SELFPROT_ACTION_MESH_PEERING_OPEN, "Mesh Peering Open"},
11970     {SELFPROT_ACTION_MESH_PEERING_CONFIRM, "Mesh Peering Confirm"},
11971     {SELFPROT_ACTION_MESH_PEERING_CLOSE, "Mesh Peering Close"},
11972     {SELFPROT_ACTION_MESH_GROUP_KEY_INFORM, "Mesh Group Key Inform"},
11973     {SELFPROT_ACTION_MESH_GROUP_KEY_ACK, "Mesh Group Key Ack"},
11974     {0, NULL}
11975   };
11976
11977   static const value_string mesh_peering_proto_ids[] = {
11978     {MESH_PEERING_PROTO_MGMT, "Mesh peering management protocol"},
11979     {MESH_PEERING_PROTO_AMPE, "Authenticated mesh peering exchange protocol"},
11980     {MESH_PEERING_PROTO_VENDOR, "Vendor specific"},
11981     {0, NULL}
11982   };
11983
11984   static const true_false_string hwmp_targ_usn_flags = {
11985     "[USN = 1] Target Sequence Number Unknown at Originator",
11986     "[USN = 0] Target Sequence Number Known at Originator"
11987   };
11988
11989   static const true_false_string hwmp_targ_to_flags = {
11990     "[TO = 1] Only Target Will Respond",
11991     "[TO = 0] Intermediate Nodes May Respond"
11992   };
11993
11994   static const value_string ack_policy[] = {
11995     {0x00, "Normal Ack"},
11996     {0x01, "No Ack"},
11997     {0x02, "No explicit acknowledgment"},
11998     {0x03, "Block Ack"},
11999     {0x00, NULL}
12000   };
12001
12002   static const value_string qos_action_codes[] = {
12003     {SM_ACTION_ADDTS_REQUEST, "ADDTS Request"},
12004     {SM_ACTION_ADDTS_RESPONSE, "ADDTS Response"},
12005     {SM_ACTION_DELTS, "DELTS"},
12006     {SM_ACTION_QOS_SCHEDULE, "Schedule"},
12007     {0, NULL}
12008   };
12009
12010   static const value_string ba_action_codes[] = {
12011     {BA_ADD_BLOCK_ACK_REQUEST, "Add Block Ack Request"},
12012     {BA_ADD_BLOCK_ACK_RESPONSE, "Add Block Ack Response"},
12013     {BA_DELETE_BLOCK_ACK, "Delete Block Ack"},
12014     {0x00, NULL}
12015   };
12016
12017   static const value_string dls_action_codes[] = {
12018     {SM_ACTION_DLS_REQUEST, "DLS Request"},
12019     {SM_ACTION_DLS_RESPONSE, "DLS Response"},
12020     {SM_ACTION_DLS_TEARDOWN, "DLS Teardown"},
12021     {0, NULL}
12022   };
12023
12024   static const value_string tsinfo_type[] = {
12025     {0x0, "Aperiodic or unspecified Traffic"},
12026     {0x1, "Periodic Traffic"},
12027     {0, NULL}
12028   };
12029
12030   static const value_string tsinfo_direction[] = {
12031     {0x00, "Uplink"},
12032     {0x01, "Downlink"},
12033     {0x02, "Direct link"},
12034     {0x03, "Bidirectional link"},
12035     {0, NULL}
12036   };
12037
12038   static const value_string tsinfo_access[] = {
12039     {0x00, "Reserved"},
12040     {0x01, "EDCA"},
12041     {0x02, "HCCA"},
12042     {0x03, "HEMM"},
12043     {0, NULL}
12044   };
12045
12046   static const value_string qos_up[] = {
12047     {0x00, "Best Effort"},
12048     {0x01, "Background"},
12049     {0x02, "Spare"},
12050     {0x03, "Excellent Effort"},
12051     {0x04, "Controlled Load"},
12052     {0x05, "Video"},
12053     {0x06, "Voice"},
12054     {0x07, "Network Control"},
12055     {0, NULL}
12056   };
12057
12058   static const value_string classifier_type[] = {
12059     {0x00, "Ethernet parameters"},
12060     {0x01, "TCP/UDP IP parameters"},
12061     {0x02, "IEEE 802.1D/Q parameters"},
12062     {0, NULL}
12063   };
12064
12065   static const true_false_string ieee80211_block_ack_control_ack_policy_flag = {
12066       "Immediate Acknowledgement Required",
12067       "Sender Does Not Require Immediate Acknowledgement"
12068   };
12069
12070   static const value_string ieee80211_block_ack_request_type_flags[] = {
12071     {0x00, "Basic Block Ack Request"},
12072     {0x01, "Reserved"},
12073     {0x02, "Compressed Block Ack Request"},
12074     {0x03, "Multi-TID Block Ack Request"},
12075     {0x00, NULL}
12076   };
12077
12078   static const value_string ieee80211_block_ack_type_flags[] = {
12079     {0x00, "Basic Block Ack"},
12080     {0x01, "Reserved"},
12081     {0x02, "Compressed Block"},
12082     {0x03, "Multi-TID Block"},
12083     {0x00, NULL}
12084   };
12085
12086   static const value_string ft_action_codes[] ={
12087     {FT_ACTION_REQUEST, "FT Request"},
12088     {FT_ACTION_RESPONSE, "FT Response"},
12089     {FT_ACTION_CONFIRM, "FT Confirm"},
12090     {FT_ACTION_ACK, "FT Ack"},
12091     {0, NULL}
12092   };
12093
12094   static const value_string sa_query_action_codes[] ={
12095     {SA_QUERY_REQUEST, "SA Query Request"},
12096     {SA_QUERY_RESPONSE, "SA Query Response"},
12097     {0, NULL}
12098   };
12099
12100   static const value_string ieee80211_data_encap_payload_types[] = {
12101     {1, "Remote Request/Response"},
12102     {2, "TDLS"},
12103     {0, NULL}
12104   };
12105
12106   static hf_register_info hf[] = {
12107     {&hf_ieee80211_fc_field,
12108      {"Frame Control Field", "wlan.fc", FT_UINT16, BASE_HEX, NULL, 0,
12109       "MAC Frame control", HFILL }},
12110
12111     {&hf_ieee80211_fc_proto_version,
12112      {"Version", "wlan.fc.version", FT_UINT8, BASE_DEC, NULL, 0,
12113       "MAC Protocol version", HFILL }},  /* 0 */
12114
12115     {&hf_ieee80211_fc_frame_type,
12116      {"Type", "wlan.fc.type", FT_UINT8, BASE_DEC, VALS(frame_type), 0,
12117       "Frame type", HFILL }},
12118
12119     {&hf_ieee80211_fc_frame_subtype,
12120      {"Subtype", "wlan.fc.subtype", FT_UINT8, BASE_DEC, NULL, 0,
12121       "Frame subtype", HFILL }},  /* 2 */
12122
12123     {&hf_ieee80211_fc_frame_type_subtype,
12124      {"Type/Subtype", "wlan.fc.type_subtype", FT_UINT8, BASE_HEX, VALS(frame_type_subtype_vals), 0,
12125       "Type and subtype combined (first byte: type, second byte: subtype)", HFILL }},
12126
12127     {&hf_ieee80211_fc_flags,
12128      {"Protocol Flags", "wlan.flags", FT_UINT8, BASE_HEX, NULL, 0,
12129       NULL, HFILL }},
12130
12131     {&hf_ieee80211_fc_data_ds,
12132      {"DS status", "wlan.fc.ds", FT_UINT8, BASE_HEX, VALS (&tofrom_ds), (FLAG_FROM_DS|FLAG_TO_DS),
12133       "Data-frame DS-traversal status", HFILL }},  /* 3 */
12134
12135     {&hf_ieee80211_fc_to_ds,
12136      {"To DS", "wlan.fc.tods", FT_BOOLEAN, 8, TFS (&tods_flag), FLAG_TO_DS,
12137       "To DS flag", HFILL }},    /* 4 */
12138
12139     {&hf_ieee80211_fc_from_ds,
12140      {"From DS", "wlan.fc.fromds", FT_BOOLEAN, 8, TFS (&fromds_flag), FLAG_FROM_DS,
12141       "From DS flag", HFILL }},    /* 5 */
12142
12143     {&hf_ieee80211_fc_more_frag,
12144      {"More Fragments", "wlan.fc.frag", FT_BOOLEAN, 8, TFS (&more_frags), FLAG_MORE_FRAGMENTS,
12145       "More Fragments flag", HFILL }},  /* 6 */
12146
12147     {&hf_ieee80211_fc_retry,
12148      {"Retry", "wlan.fc.retry", FT_BOOLEAN, 8, TFS (&retry_flags), FLAG_RETRY,
12149       "Retransmission flag", HFILL }},
12150
12151     { &hf_ieee80211_fc_analysis_retransmission,
12152      {"Retransmission", "wlan.analysis.retransmission", FT_NONE, BASE_NONE,
12153       NULL, 0x0, "This frame is a suspected wireless retransmission", HFILL }},
12154
12155     { &hf_ieee80211_fc_analysis_retransmission_frame,
12156      {"Retransmission of frame", "wlan.analysis.retransmission_frame", FT_FRAMENUM, BASE_NONE,
12157       NULL, 0x0, "This is a retransmission of frame #", HFILL }},
12158
12159     {&hf_ieee80211_fc_pwr_mgt,
12160      {"PWR MGT", "wlan.fc.pwrmgt", FT_BOOLEAN, 8, TFS (&pm_flags), FLAG_POWER_MGT,
12161       "Power management status", HFILL }},
12162
12163     {&hf_ieee80211_fc_more_data,
12164      {"More Data", "wlan.fc.moredata", FT_BOOLEAN, 8, TFS (&md_flags), FLAG_MORE_DATA,
12165       "More data flag", HFILL }},
12166
12167     {&hf_ieee80211_fc_protected,
12168      {"Protected flag", "wlan.fc.protected", FT_BOOLEAN, 8, TFS (&protected_flags), FLAG_PROTECTED,
12169       NULL, HFILL }},
12170
12171     {&hf_ieee80211_fc_order,
12172      {"Order flag", "wlan.fc.order", FT_BOOLEAN, 8, TFS (&order_flags), FLAG_ORDER,
12173       "Strictly ordered flag", HFILL }},
12174
12175     {&hf_ieee80211_assoc_id,
12176      {"Association ID","wlan.aid",FT_UINT16, BASE_DEC, NULL, 0x3FFF,
12177       "Association-ID field", HFILL }},
12178
12179     {&hf_ieee80211_did_duration,
12180      {"Duration", "wlan.duration", FT_UINT16, BASE_DEC, NULL, 0,
12181       "Duration field", HFILL }},
12182
12183     {&hf_ieee80211_addr_da,
12184      {"Destination address", "wlan.da", FT_ETHER, BASE_NONE, NULL, 0,
12185       "Destination Hardware Address", HFILL }},
12186
12187     {&hf_ieee80211_addr_sa,
12188      {"Source address", "wlan.sa", FT_ETHER, BASE_NONE, NULL, 0,
12189       "Source Hardware Address", HFILL }},
12190
12191     { &hf_ieee80211_addr,
12192       {"Hardware address", "wlan.addr", FT_ETHER, BASE_NONE, NULL, 0,
12193        "SA, DA, BSSID, RA or TA Hardware Address", HFILL }},
12194
12195     {&hf_ieee80211_addr_ra,
12196      {"Receiver address", "wlan.ra", FT_ETHER, BASE_NONE, NULL, 0,
12197       "Receiving Station Hardware Address", HFILL }},
12198
12199     {&hf_ieee80211_addr_ta,
12200      {"Transmitter address", "wlan.ta", FT_ETHER, BASE_NONE, NULL, 0,
12201       "Transmitting Station Hardware Address", HFILL }},
12202
12203     {&hf_ieee80211_addr_bssid,
12204      {"BSS Id", "wlan.bssid", FT_ETHER, BASE_NONE, NULL, 0,
12205       "Basic Service Set ID", HFILL }},
12206
12207     {&hf_ieee80211_frag_number,
12208      {"Fragment number", "wlan.frag", FT_UINT16, BASE_DEC, NULL, 0,
12209       NULL, HFILL }},
12210
12211     {&hf_ieee80211_seq_number,
12212      {"Sequence number", "wlan.seq", FT_UINT16, BASE_DEC, NULL, 0,
12213       NULL, HFILL }},
12214
12215     {&hf_ieee80211_qos_tid,
12216      {"TID", "wlan.qos.tid", FT_UINT16, BASE_DEC, NULL, 0,
12217       NULL, HFILL }},
12218
12219     {&hf_ieee80211_qos_priority,
12220      {"Priority", "wlan.qos.priority", FT_UINT16, BASE_DEC, NULL, 0,
12221       "802.1D Tag", HFILL }},
12222
12223     {&hf_ieee80211_qos_eosp,
12224      {"EOSP", "wlan.qos.eosp", FT_BOOLEAN, 8, TFS (&eosp_flag), QOS_FLAG_EOSP,
12225       "EOSP Field", HFILL }},
12226
12227     {&hf_ieee80211_qos_bit4,
12228      {"QoS bit 4", "wlan.qos.bit4", FT_BOOLEAN, 8, TFS (&bit4_flag), QOS_FLAG_EOSP,
12229       NULL, HFILL }},
12230
12231     {&hf_ieee80211_qos_ack_policy,
12232      {"Ack Policy", "wlan.qos.ack", FT_UINT8, BASE_HEX,  VALS (&ack_policy), 0,
12233       NULL, HFILL }},
12234
12235     {&hf_ieee80211_qos_amsdu_present,
12236      {"Payload Type", "wlan.qos.amsdupresent", FT_BOOLEAN, BASE_NONE,
12237       TFS(&ieee80211_qos_amsdu_present_flag), 0x0, NULL, HFILL }},
12238
12239     {&hf_ieee80211_qos_txop_limit,
12240      {"TXOP Limit", "wlan.qos.txop_limit", FT_UINT16, BASE_DEC, NULL, 0,
12241       NULL, HFILL }},
12242
12243     {&hf_ieee80211_qos_buf_state_indicated,
12244      {"Buffer State Indicated", "wlan.qos.buf_state_indicated",
12245        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12246       NULL, HFILL }},
12247
12248     {&hf_ieee80211_qos_highest_pri_buf_ac,
12249      {"Highest-Priority Buffered AC", "wlan.qos.highest_pri_buf_ac",
12250        FT_UINT8, BASE_DEC, VALS(wme_acs), 0x0C,
12251       NULL, HFILL }},
12252
12253     {&hf_ieee80211_qos_qap_buf_load,
12254      {"QAP Buffered Load", "wlan.qos.qap_buf_load",
12255        FT_UINT8, BASE_DEC, NULL, 0xF0,
12256       NULL, HFILL }},
12257
12258     {&hf_ieee80211_qos_txop_dur_req,
12259      {"TXOP Duration Requested", "wlan.qos.txop_dur_req", FT_UINT16, BASE_DEC, NULL, 0,
12260       NULL, HFILL }},
12261
12262     {&hf_ieee80211_qos_queue_size,
12263      {"Queue Size", "wlan.qos.queue_size", FT_UINT16, BASE_DEC, NULL, 0,
12264       NULL, HFILL }},
12265
12266     {&hf_ieee80211_fcs,
12267      {"Frame check sequence", "wlan.fcs", FT_UINT32, BASE_HEX,
12268       NULL, 0, "Frame Check Sequence (FCS)", HFILL }},
12269
12270     {&hf_ieee80211_fcs_good,
12271      {"Good", "wlan.fcs_good", FT_BOOLEAN, BASE_NONE,
12272       NULL, 0x0, "True if the FCS is correct", HFILL }},
12273
12274     {&hf_ieee80211_fcs_bad,
12275      {"Bad", "wlan.fcs_bad", FT_BOOLEAN, BASE_NONE,
12276       NULL, 0x0, "True if the FCS is incorrect", HFILL }},
12277
12278     {&hf_ieee80211_fragment_overlap,
12279       {"Fragment overlap", "wlan.fragment.overlap", FT_BOOLEAN, BASE_NONE,
12280        NULL, 0x0, "Fragment overlaps with other fragments", HFILL }},
12281
12282     {&hf_ieee80211_fragment_overlap_conflict,
12283       {"Conflicting data in fragment overlap", "wlan.fragment.overlap.conflict",
12284        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
12285        "Overlapping fragments contained conflicting data", HFILL }},
12286
12287     {&hf_ieee80211_fragment_multiple_tails,
12288       {"Multiple tail fragments found", "wlan.fragment.multipletails",
12289        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
12290        "Several tails were found when defragmenting the packet", HFILL }},
12291
12292     {&hf_ieee80211_fragment_too_long_fragment,
12293       {"Fragment too long", "wlan.fragment.toolongfragment",
12294        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
12295        "Fragment contained data past end of packet", HFILL }},
12296
12297     {&hf_ieee80211_fragment_error,
12298       {"Defragmentation error", "wlan.fragment.error",
12299        FT_FRAMENUM, BASE_NONE, NULL, 0x0,
12300        "Defragmentation error due to illegal fragments", HFILL }},
12301
12302     {&hf_ieee80211_fragment_count,
12303       {"Fragment count", "wlan.fragment.count", FT_UINT32, BASE_DEC, NULL, 0x0,
12304        NULL, HFILL }},
12305
12306     {&hf_ieee80211_fragment,
12307       {"802.11 Fragment", "wlan.fragment", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
12308        NULL, HFILL }},
12309
12310     {&hf_ieee80211_fragments,
12311       {"802.11 Fragments", "wlan.fragments", FT_NONE, BASE_NONE, NULL, 0x0,
12312        NULL, HFILL }},
12313
12314     {&hf_ieee80211_reassembled_in,
12315       {"Reassembled 802.11 in frame", "wlan.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
12316        "This 802.11 packet is reassembled in this frame", HFILL }},
12317
12318     {&hf_ieee80211_reassembled_length,
12319       {"Reassembled 802.11 length", "wlan.reassembled.length", FT_UINT32, BASE_DEC, NULL, 0x0,
12320        "The total length of the reassembled payload", HFILL }},
12321
12322     {&hf_ieee80211_wep_iv,
12323      {"Initialization Vector", "wlan.wep.iv", FT_UINT24, BASE_HEX, NULL, 0,
12324       NULL, HFILL }},
12325
12326     {&hf_ieee80211_wep_iv_weak,
12327      {"Weak IV", "wlan.wep.weakiv", FT_BOOLEAN, BASE_NONE, NULL,0x0,
12328        NULL,HFILL}},
12329
12330     {&hf_ieee80211_tkip_extiv,
12331      {"TKIP Ext. Initialization Vector", "wlan.tkip.extiv", FT_STRING,
12332       BASE_NONE, NULL, 0, "TKIP Extended Initialization Vector", HFILL }},
12333
12334     {&hf_ieee80211_ccmp_extiv,
12335      {"CCMP Ext. Initialization Vector", "wlan.ccmp.extiv", FT_STRING,
12336       BASE_NONE, NULL, 0, "CCMP Extended Initialization Vector", HFILL }},
12337
12338     {&hf_ieee80211_wep_key,
12339      {"Key Index", "wlan.wep.key", FT_UINT8, BASE_DEC, NULL, 0,
12340       NULL, HFILL }},
12341
12342     {&hf_ieee80211_wep_icv,
12343      {"WEP ICV", "wlan.wep.icv", FT_UINT32, BASE_HEX, NULL, 0,
12344       NULL, HFILL }},
12345
12346     {&hf_ieee80211_chan_noc,
12347      {"Number of Channels", "chan.num_chans", FT_UINT8, BASE_DEC, NULL, 0,
12348       NULL, HFILL }},
12349
12350     {&hf_ieee80211_chan_length,
12351      {"Length", "chan.chan_length", FT_UINT8, BASE_DEC, NULL, 0,
12352       NULL, HFILL }},
12353
12354     {&hf_ieee80211_chan_content,
12355      {"Contents", "chan.chan_content", FT_UINT8, BASE_DEC, NULL, 0,
12356       NULL, HFILL }},
12357
12358     {&hf_ieee80211_chan_channel,
12359      {"channel", "chan.chan_channel", FT_UINT8, BASE_DEC, NULL, 0,
12360       NULL, HFILL }},
12361
12362     {&hf_ieee80211_chan_adapt,
12363      {"Adaptable", "chan.chan_adapt", FT_UINT8, BASE_DEC, NULL, 0,
12364       NULL, HFILL }},
12365
12366     {&hf_ieee80211_chan_rate,
12367      {"Rate", "chan.chan_rate", FT_UINT8, BASE_DEC, NULL, 0,
12368       NULL, HFILL }},
12369
12370     {&hf_ieee80211_chan_tx_pow,
12371      {"Tx Power", "chan.chan_tx_pow", FT_UINT8, BASE_DEC, NULL, 0,
12372       NULL, HFILL }},
12373
12374     {&hf_ieee80211_block_ack_request_control,
12375      {"Block Ack Request (BAR) Control", "wlan.bar.control",
12376       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12377
12378     {&hf_ieee80211_block_ack_control,
12379      {"Block Ack Request Control", "wlan.ba.control",
12380       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12381
12382     {&hf_ieee80211_block_ack_control_ack_policy,
12383      {"BAR Ack Policy", "wlan.ba.control.ackpolicy",
12384       FT_BOOLEAN, 16, TFS (&ieee80211_block_ack_control_ack_policy_flag), 0x01, "Block Ack Request (BAR) Ack Policy", HFILL }},
12385
12386     {&hf_ieee80211_block_ack_control_multi_tid,
12387      {"Multi-TID", "wlan.ba.control.multitid",
12388       FT_BOOLEAN, 16, 0, 0x02, "Multi-Traffic Identifier (TID)", HFILL }},
12389
12390     {&hf_ieee80211_block_ack_control_compressed_bitmap,
12391      {"Compressed Bitmap", "wlan.ba.control.cbitmap",
12392       FT_BOOLEAN, 16, 0, 0x04, NULL, HFILL }},
12393
12394     {&hf_ieee80211_block_ack_control_reserved,
12395      {"Reserved", "wlan.ba.control.cbitmap",
12396       FT_UINT16, BASE_HEX, NULL, 0x0ff8, NULL, HFILL }},
12397
12398     {&hf_ieee80211_block_ack_control_basic_tid_info,
12399      {"TID for which a Basic BlockAck frame is requested", "wlan.ba.basic.tidinfo",
12400       FT_UINT16, BASE_HEX, NULL, 0xf000, "Traffic Identifier (TID) for which a Basic BlockAck frame is requested", HFILL }},
12401
12402     {&hf_ieee80211_block_ack_control_compressed_tid_info,
12403      {"TID for which a BlockAck frame is requested", "wlan.bar.compressed.tidinfo",
12404       FT_UINT16, BASE_HEX, NULL, 0xf000, "Traffic Identifier (TID) for which a BlockAck frame is requested", HFILL }},
12405
12406     {&hf_ieee80211_block_ack_control_multi_tid_info,
12407      {"Number of TIDs Present", "wlan.ba.mtid.tidinfo",
12408       FT_UINT16, BASE_HEX, NULL, 0xf000, "Number of Traffic Identifiers (TIDs) Present", HFILL }},
12409
12410     {&hf_ieee80211_block_ack_multi_tid_info,
12411      {"Traffic Identifier (TID) Info", "wlan.ba.mtid.tid",
12412       FT_UINT8, BASE_DEC, 0, 0, NULL, HFILL }},
12413
12414     {&hf_ieee80211_block_ack_multi_tid_reserved,
12415      {"Reserved", "wlan.bar.mtid.tidinfo.reserved",
12416       FT_UINT16, BASE_HEX, 0, 0x0fff, NULL, HFILL }},
12417
12418     {&hf_ieee80211_block_ack_multi_tid_value,
12419      {"Multi-TID Value", "wlan.bar.mtid.tidinfo.value",
12420       FT_UINT16, BASE_HEX, 0, 0xf000, NULL, HFILL }},
12421
12422     {&hf_ieee80211_block_ack_request_type,
12423      {"Block Ack Request Type", "wlan.bar.type",
12424       FT_UINT8, BASE_HEX, VALS(ieee80211_block_ack_request_type_flags), 0, "Block Ack Request (BAR) Type", HFILL }},
12425
12426     {&hf_ieee80211_block_ack_type,
12427      {"Block Ack Type", "wlan.ba.type",
12428       FT_UINT8, BASE_HEX, VALS(ieee80211_block_ack_type_flags), 0, NULL, HFILL }},
12429
12430     {&hf_ieee80211_block_ack_bitmap,
12431      {"Block Ack Bitmap", "wlan.ba.bm",
12432       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
12433
12434     {&hf_ieee80211_block_ack_bitmap_missing_frame,
12435      {"Missing frame", "wlan.ba.bm.missing_frame",
12436       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
12437
12438     {&hf_ieee80211_data_encap_payload_type,
12439      {"Payload Type", "wlan.data_encap.payload_type",
12440       FT_UINT8, BASE_DEC, VALS(ieee80211_data_encap_payload_types), 0, NULL,
12441       HFILL }},
12442
12443     {&hf_ieee80211_ff_tdls_action_code,
12444      {"Action code", "wlan_mgt.fixed.action_code",
12445       FT_UINT8, BASE_DEC, VALS(tdls_action_codes), 0,
12446       "Management action code", HFILL }},
12447
12448     {&hf_ieee80211_ff_target_channel,
12449      {"Target Channel", "wlan_mgt.fixed.target_channel",
12450       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12451
12452     {&hf_ieee80211_ff_regulatory_class,
12453      {"Regulatory Class", "wlan_mgt.fixed.regulatory_class",
12454       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12455
12456     {&hf_ieee80211_ff_wnm_action_code,
12457      {"Action code", "wlan_mgt.fixed.action_code",
12458       FT_UINT8, BASE_DEC, VALS(wnm_action_codes), 0,
12459       "Management action code", HFILL }},
12460
12461     {&hf_ieee80211_ff_request_mode_pref_cand,
12462      {"Preferred Candidate List Included",
12463       "wlan_mgt.fixed.request_mode.pref_cand",
12464       FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }},
12465     {&hf_ieee80211_ff_request_mode_abridged,
12466      {"Abridged", "wlan_mgt.fixed.request_mode.abridged",
12467       FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL }},
12468     {&hf_ieee80211_ff_request_mode_disassoc_imminent,
12469      {"Disassociation Imminent",
12470       "wlan_mgt.fixed.request_mode.disassoc_imminent",
12471       FT_UINT8, BASE_DEC, NULL, 0x04, NULL, HFILL }},
12472     {&hf_ieee80211_ff_request_mode_bss_term_included,
12473      {"BSS Termination Included",
12474       "wlan_mgt.fixed.request_mode.bss_term_included",
12475       FT_UINT8, BASE_DEC, NULL, 0x08, NULL, HFILL }},
12476     {&hf_ieee80211_ff_request_mode_ess_disassoc_imminent,
12477      {"ESS Disassociation Imminent",
12478       "wlan_mgt.fixed.request_mode.ess_disassoc_imminent",
12479       FT_UINT8, BASE_DEC, NULL, 0x10, NULL, HFILL }},
12480     {&hf_ieee80211_ff_disassoc_timer,
12481      {"Disassociation Timer", "wlan_mgt.fixed.disassoc_timer",
12482       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
12483     {&hf_ieee80211_ff_validity_interval,
12484      {"Validity Interval", "wlan_mgt.fixed.validity_interval",
12485       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12486     {&hf_ieee80211_ff_url_len,
12487      {"Session Information URL Length",
12488       "wlan_mgt.fixed.session_information.url_length",
12489       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12490     {&hf_ieee80211_ff_url,
12491      {"Session Information URL", "wlan_mgt.fixed.session_information.url",
12492       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
12493   };
12494
12495   static const true_false_string qos_info_field_qack_flags = {
12496     "STAs/APs MIB attribute dot11QAckOptionImplemented is true",
12497     "STAs/APs MIB attribute dot11QAckOptionImplemented is false"
12498   };
12499
12500   static const true_false_string qos_info_field_more_data_ack_flags = {
12501     "STA can process Ack frames with More Data bit and will remain in the awake state.",
12502     "STA cannot process Ack frames with More Data bit in Frame Controll field."
12503   };
12504
12505   static const true_false_string qos_info_field_queue_req_flags = {
12506     "AP can process a nonzero Queue Size subfield in the QoS Control field in QoS data frames",
12507     "AP cannot process Queue Size subfield in QoS data frames."
12508   };
12509
12510   /* 7.3.1.17 Table 19b-Settings of the Max SP Length subfield */
12511   static const value_string qos_info_field_max_sp_lenght_flags[] =
12512   {
12513     { 0x0, "QAP may deliver all buffered MSDUs and MMPDUs." },
12514     { 0x2, "QAP may deliver a maximum of two MSDUs and MMPDUs per SP." },
12515     { 0x1, "QAP may deliver a maximum of four MSDUs and MMPDUs per SP." },
12516     { 0x3, "QAP may deliver a maximum of six MSDUs and MMPDUs per SP." },
12517     { 0, NULL}
12518   };
12519
12520   static const true_false_string rsn_preauth_flags = {
12521     "Transmitter supports pre-authentication",
12522     "Transmitter does not support pre-authentication"
12523   };
12524
12525   static const true_false_string rsn_no_pairwise_flags = {
12526     "Transmitter cannot support WEP default key 0 simultaneously with "
12527     "Pairwise key",
12528     "Transmitter can support WEP default key 0 simultaneously with "
12529     "Pairwise key"
12530   };
12531
12532   static const value_string rsn_cap_replay_counter[] = {
12533     {0x00, "1 replay counter per PTKSA/GTKSA/STAKeySA"},
12534     {0x01, "2 replay counters per PTKSA/GTKSA/STAKeySA"},
12535     {0x02, "4 replay counters per PTKSA/GTKSA/STAKeySA"},
12536     {0x03, "16 replay counters per PTKSA/GTKSA/STAKeySA"},
12537     {0, NULL}
12538   };
12539
12540   static const true_false_string ht_ldpc_coding_flag = {
12541     "Transmitter supports receiving LDPC coded packets",
12542     "Transmitter does not support receiving LDPC coded packets"
12543   };
12544
12545   static const true_false_string ht_chan_width_flag = {
12546     "Transmitter supports 20MHz and 40MHz operation",
12547     "Transmitter only supports 20MHz operation"
12548   };
12549
12550   static const value_string ht_sm_pwsave_flag[] = {
12551     {0x00, "Static SM Power Save mode"},
12552     {0x01, "Dynamic SM Power Save mode"},
12553     {0x02, "Reserved"},
12554     {0x03, "SM Power Save disabled"},
12555     {0x00, NULL}
12556   };
12557
12558   static const true_false_string ht_green_flag = {
12559     "Transmitter is able to receive PPDUs with Green Field (GF) preamble",
12560     "Transmitter is not able to receive PPDUs with Green Field (GF) preamble"
12561   };
12562
12563   static const value_string ht_rx_stbc_flag[] = {
12564     {0x00, "No Rx STBC support"},
12565     {0x01, "Rx support of one spatial stream"},
12566     {0x02, "Rx support of one and two spatial streams"},
12567     {0x03, "Rx support of one, two, and three spatial streams"},
12568     {0x00, NULL}
12569   };
12570
12571   static const true_false_string ht_delayed_block_ack_flag = {
12572     "Transmitter supports HT-Delayed BlockAck",
12573     "Transmitter does not support HT-Delayed BlockAck"
12574   };
12575
12576   static const true_false_string ht_max_amsdu_flag = {
12577     "7935 bytes",
12578     "3839 bytes"
12579   };
12580
12581   static const true_false_string ht_dss_cck_40_flag = {
12582     "Will/Can use DSSS/CCK in 40 MHz",
12583     "Won't/Can't use of DSSS/CCK in 40 MHz"
12584   };
12585
12586   static const true_false_string ht_psmp_flag = {
12587     "Will/Can support PSMP operation",
12588     "Won't/Can't support PSMP operation"
12589   };
12590
12591   static const true_false_string ht_40_mhz_intolerant_flag = {
12592     "Use of 40 MHz transmissions restricted/disallowed",
12593     "Use of 40 MHz transmissions unrestricted/allowed"
12594   };
12595
12596   static const value_string ampduparam_mpdu_start_spacing_flags[] = {
12597     {0x00, "no restriction"},
12598     {0x01, "1/4 [usec]"},
12599     {0x02, "1/2 [usec]"},
12600     {0x03, "1 [usec]"},
12601     {0x04, "2 [usec]"},
12602     {0x05, "4 [usec]"},
12603     {0x06, "8 [usec]"},
12604     {0x07, "16 [usec]"},
12605     {0x00, NULL}
12606   };
12607
12608   static const true_false_string mcsset_tx_mcs_set_defined_flag = {
12609     "Defined",
12610     "Not Defined",
12611   };
12612
12613   static const true_false_string mcsset_tx_rx_mcs_set_not_equal_flag = {
12614     "Not Equal",
12615     "Equal",
12616   };
12617
12618   static const value_string mcsset_tx_max_spatial_streams_flags[] = {
12619     {0x00, "1 spatial stream"},
12620     {0x01, "2 spatial streams"},
12621     {0x02, "3 spatial streams"},
12622     {0x03, "4 spatial streams"},
12623     {0x00, NULL}
12624   };
12625
12626   static const value_string htex_transtime_flags[] = {
12627     {0x00, "No Transition"},
12628     {0x01, "400 usec"},
12629     {0x02, "1.5 msec"},
12630     {0x03, "5 msec"},
12631     {0x00, NULL}
12632   };
12633
12634   static const value_string htex_mcs_flags[] = {
12635     {0x00, "STA does not provide MCS feedback"},
12636     {0x01, "Reserved"},
12637     {0x02, "STA provides only unsolicited MCS feedback"},
12638     {0x03, "STA can provide MCS feedback in response to MRQ as well as unsolicited MCS feedback"},
12639     {0x00, NULL}
12640   };
12641
12642   static const value_string txbf_calib_flag[] = {
12643     {0x00, "incapable"},
12644     {0x01, "Limited involvement, cannot initiate"},
12645     {0x02, "Limited involvement, can initiate"},
12646     {0x03, "Fully capable"},
12647     {0x00, NULL}
12648   };
12649
12650   static const value_string txbf_feedback_flags[] = {
12651     {0x00, "not supported"},
12652     {0x01, "delayed feedback capable"},
12653     {0x02, "immediate feedback capable"},
12654     {0x03, "delayed and immediate feedback capable"},
12655     {0x00, NULL}
12656   };
12657
12658   static const value_string txbf_antenna_flags[] = {
12659     {0x00, "1 TX antenna sounding"},
12660     {0x01, "2 TX antenna sounding"},
12661     {0x02, "3 TX antenna sounding"},
12662     {0x03, "4 TX antenna sounding"},
12663     {0x00, NULL}
12664   };
12665
12666   static const value_string txbf_csi_max_rows_bf_flags[] = {
12667     {0x00, "1 row of CSI"},
12668     {0x01, "2 rows of CSI"},
12669     {0x02, "3 rows of CSI"},
12670     {0x03, "4 rows of CSI"},
12671     {0x00, NULL}
12672   };
12673
12674   static const value_string txbf_chan_est_flags[] = {
12675     {0x00, "1 space time stream"},
12676     {0x01, "2 space time streams"},
12677     {0x02, "3 space time streams"},
12678     {0x03, "4 space time streams"},
12679     {0x00, NULL}
12680   };
12681
12682   static const value_string txbf_min_group_flags[] = {
12683     {0x00, "No grouping supported"},
12684     {0x01, "Groups of 1,2 supported"},
12685     {0x02, "Groups of 1,4 supported"},
12686     {0x03, "Groups of 1,2,4 supported"},
12687     {0x00, NULL}
12688   };
12689
12690   static const value_string hta_ext_chan_offset_flag[] = {
12691     {0x00, "No Extension Channel"},
12692     {0x01, "Extension Channel above control channel"},
12693     {0x02, "Undefined"},
12694     {0x03, "Extension Channel below control channel"},
12695     {0x00, NULL}
12696   };
12697
12698   static const true_false_string hta_rec_tx_width_flag = {
12699     "Any channel width enabled",
12700     "Use 20MHz channel (control)"
12701   };
12702
12703   static const true_false_string hta_rifs_mode_flag = {
12704     "Use of RIFS permitted",
12705     "Use of RIFS prohibited"
12706   };
12707
12708   static const true_false_string hta_controlled_access_flag = {
12709     "Not only PSMP",
12710     "PSMP only"
12711   };
12712
12713   static const value_string hta_service_interval_flag[] = {
12714     {0x00, "5ms"},
12715     {0x01, "10ms"},
12716     {0x02, "15ms"},
12717     {0x03, "20ms"},
12718     {0x04, "25ms"},
12719     {0x05, "30ms"},
12720     {0x06, "35ms"},
12721     {0x07, "40ms"},
12722     {0x00, NULL}
12723   };
12724
12725   static const value_string hta_operating_mode_flag[] = {
12726     {0x00, "Pure HT, no protection"},
12727     {0x01, "There may be non-HT devices (control & ext channel)"},
12728     {0x02, "No non-HT is associated, but at least 1 20MHz is. protect on"},
12729     {0x03, "Mixed: no non-HT is associated, protect on"},
12730     {0x00, NULL}
12731   };
12732
12733   static const true_false_string hta_non_gf_devices_flag = {
12734     "All HT devices associated are GF capable",
12735     "One or More HT devices are not GF capable"
12736   };
12737
12738   static const true_false_string hta_dual_stbc_protection_flag = {
12739     "Dual CTS protections is used",
12740     "Regular use of RTS/CTS"
12741   };
12742
12743   static const true_false_string hta_secondary_beacon_flag = {
12744     "Secondary Beacon",
12745     "Primary Beacon"
12746   };
12747
12748   static const true_false_string hta_lsig_txop_protection_flag = {
12749     "Full Support",
12750     "Not full support"
12751   };
12752
12753   static const true_false_string hta_pco_active_flag = {
12754     "PCO is activated in the BSS",
12755     "PCO is not activated in the BSS"
12756   };
12757
12758   static const true_false_string hta_pco_phase_flag = {
12759     "Switch to 20MHz phase/keep 20MHz",
12760     "Switch to 40MHz phase/keep 40MHz"
12761   };
12762
12763   static const value_string ht_info_secondary_channel_offset_flags[] = {
12764     {0x00, "No secondary channel"},
12765     {0x01, "Secondary channel is above the primary channel"},
12766     {0x02, "Reserved"},
12767     {0x03, "Secondary channel is below the primary channel"},
12768     {0x00, NULL}
12769   };
12770
12771   static const true_false_string ht_info_channel_width_flag = {
12772     "Channel of any width supported",
12773     "20 MHz channel width only"
12774   };
12775
12776   static const true_false_string ht_info_rifs_mode_flag = {
12777     "Permitted",
12778     "Prohibited"
12779   };
12780
12781   static const true_false_string ht_info_psmp_stas_only_flag = {
12782     "Association requests are accepted from only PSMP capable STA",
12783     "Association requests are accepted regardless of PSMP capability"
12784   };
12785
12786   static const value_string ht_info_service_interval_granularity_flags[] = {
12787     {0x00, "5 ms"},
12788     {0x01, "10 ms"},
12789     {0x02, "15 ms"},
12790     {0x03, "20 ms"},
12791     {0x04, "25 ms"},
12792     {0x05, "30 ms"},
12793     {0x06, "35 ms"},
12794     {0x07, "40 ms"},
12795     {0x00, NULL}
12796   };
12797
12798   static const value_string ht_info_operating_mode_flags[] = {
12799     {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"},
12800     {0x01, "HT non-member protection mode"},
12801     {0x02, "Only HT STAs in the BSS, however, there exists at least one 20 MHz STA"},
12802     {0x03, "HT mixed mode"},
12803     {0x00, NULL}
12804   };
12805
12806   static const true_false_string ht_info_non_greenfield_sta_present_flag = {
12807     "One or more associated STAs are not greenfield capable",
12808     "All associated STAs are greenfield capable"
12809   };
12810
12811   static const true_false_string ht_info_transmit_burst_limit_flag = {
12812     "2.4 GHz - 6.16 ms | All other bands - 3.08 ms",
12813     "No limit"
12814   };
12815
12816   static const true_false_string ht_info_obss_non_ht_stas_present_flag = {
12817     "Use of protection for non-HT STAs by overlapping BSSs is needed",
12818     "Use of protection for non-HT STAs by overlapping BSSs is not needed"
12819   };
12820
12821   static const true_false_string ht_info_dual_beacon_flag = {
12822     "AP transmits a secondary beacon",
12823     "No second beacon is transmitted"
12824   };
12825
12826   static const true_false_string ht_info_dual_cts_protection_flag = {
12827     "Required",
12828     "Not required"
12829   };
12830
12831   static const true_false_string ht_info_secondary_beacon_flag = {
12832     "Secondary beacon",
12833     "Primary beacon"
12834   };
12835
12836   static const true_false_string ht_info_lsig_txop_protection_full_support_flag = {
12837     "All HT STAs in the BSS support L-SIG TXOP protection",
12838     "One or more HT STAs in the BSS do not support L-SIG TXOP protection"
12839   };
12840
12841   static const true_false_string ht_info_pco_phase_flag = {
12842     "Switch to or continue 40 MHz phase",
12843     "Switch to or continue 20 MHz phase"
12844   };
12845
12846   static const true_false_string htc_lac_trq_flag = {
12847     "Want sounding PPDU",
12848     "Don't want sounding PPDU"
12849   };
12850
12851   static const true_false_string htc_lac_mai_mrq_flag = {
12852     "MCS feedback requested",
12853     "No MCS feedback requested"
12854   };
12855
12856   static const value_string ieee80211_htc_lac_asel_command_flags[] = {
12857     {0x00, "Transmit Antenna Selection Sounding Indication (TXASSI)"},
12858     {0x01, "Transmit Antenna Selection Sounding Request (TXASSR)"},
12859     {0x02, "Receive Antenna Selection Sounding Indication (RXASSI)"},
12860     {0x03, "Receive Antenna Selection Sounding Request (RXASSR)"},
12861     {0x04, "Sounding Label"},
12862     {0x05, "No feedback, ASEL training failure"},
12863     {0x06, "Transmit Antenna Selection Sounding Indication (TXASSI) requesting feedback of explicit CSI"},
12864     {0x07, "Reserved"},
12865     {0x00, NULL}
12866   };
12867
12868   static const value_string ieee80211_htc_cal_pos_flags[] = {
12869     {0x00, "Not a calibration frame"},
12870     {0x01, "Calibration Start"},
12871     {0x02, "Sounding Response"},
12872     {0x03, "Sounding Complete"},
12873     {0x00, NULL}
12874   };
12875
12876   static const true_false_string ieee80211_htc_ndp_announcement_flag = {
12877     "NDP will follow",
12878     "No NDP will follow"
12879   };
12880
12881   static const value_string ieee80211_htc_csi_steering_flags[] = {
12882     {0x00, "No feedback required"},
12883     {0x01, "CSI"},
12884     {0x02, "Non-compressed Beamforming Feedback Matrix"},
12885     {0x03, "Compressed Beamforming Feedback Matrix"},
12886     {0x00, NULL}
12887   };
12888
12889   static const value_string ieee80211_tag_secondary_channel_offset_flags[] = {
12890     {0x00, "No Secondary Channel"},
12891     {0x01, "Above Primary Channel"},
12892     {0x02, "Reserved"},
12893     {0x03, "Below Primary Channel"},
12894     {0x00, NULL}
12895   };
12896
12897   static const value_string ieee80211_tag_ext_channel_switch_announcement_switch_mode_flags[] = {
12898     {0x00, "Frames may be transmitted before the channel switch has been completed"},
12899     {0x01, "No more frames are to be transmitted until the channel switch has been completed"},
12900     {0x00, NULL}
12901   };
12902
12903   static const value_string service_interval_granularity_vals[] = {
12904     { 0, "5 ms" },
12905     { 1, "10 ms" },
12906     { 2, "15 ms" },
12907     { 3, "20 ms" },
12908     { 4, "25 ms" },
12909     { 5, "30 ms" },
12910     { 6, "35 ms" },
12911     { 7, "40 ms" },
12912     { 0x00, NULL }
12913   };
12914
12915   static const value_string wep_type_vals[] = {
12916     { AIRPDCAP_KEY_TYPE_WEP, STRING_KEY_TYPE_WEP },
12917     { AIRPDCAP_KEY_TYPE_WPA_PWD, STRING_KEY_TYPE_WPA_PWD },
12918     { AIRPDCAP_KEY_TYPE_WPA_PSK, STRING_KEY_TYPE_WPA_PSK },
12919     { 0x00, NULL }
12920   };
12921
12922   static hf_register_info ff[] = {
12923
12924     {&hf_ieee80211_ff_timestamp,
12925      {"Timestamp", "wlan_mgt.fixed.timestamp", FT_UINT64, BASE_HEX,
12926       NULL, 0, NULL, HFILL }},
12927
12928     {&hf_ieee80211_ff_auth_alg,
12929      {"Authentication Algorithm", "wlan_mgt.fixed.auth.alg",
12930       FT_UINT16, BASE_DEC, VALS (&auth_alg), 0, NULL, HFILL }},
12931
12932     {&hf_ieee80211_ff_beacon_interval,
12933      {"Beacon Interval", "wlan_mgt.fixed.beacon", FT_UINT32, BASE_CUSTOM, beacon_interval_base_custom, 0,
12934       NULL, HFILL }},
12935
12936     {&hf_ieee80211_fixed_parameters,
12937      {"Fixed parameters", "wlan_mgt.fixed.all", FT_UINT16, BASE_DEC, NULL, 0,
12938       NULL, HFILL }},
12939
12940     {&hf_ieee80211_tagged_parameters,
12941      {"Tagged parameters", "wlan_mgt.tagged.all", FT_UINT16, BASE_DEC, NULL, 0,
12942       NULL, HFILL }},
12943
12944     {&hf_ieee80211_tag_ssid,
12945      {"SSID", "wlan_mgt.ssid", FT_STRING, BASE_NONE, NULL, 0,
12946       "Indicates the identity of an ESS or IBSS", HFILL }},
12947
12948     {&hf_ieee80211_tag_supp_rates,
12949      {"Supported Rates", "wlan_mgt.supported_rates",
12950       FT_UINT8, BASE_NONE, VALS(ieee80211_supported_rates_vals), 0x0,
12951       "In Mbit/sec, (B) for Basic Rates", HFILL }},
12952
12953     {&hf_ieee80211_tag_fh_dwell_time,
12954      {"Dwell Time", "wlan_mgt.fh.dwell_time",
12955       FT_UINT16, BASE_HEX, NULL, 0x0,
12956       "In Time Unit (TU)", HFILL }},
12957
12958     {&hf_ieee80211_tag_fh_hop_set,
12959      {"Hop Set", "wlan_mgt.fh.hop_set",
12960       FT_UINT8, BASE_DEC, NULL, 0x0,
12961       NULL, HFILL }},
12962
12963     {&hf_ieee80211_tag_fh_hop_pattern,
12964      {"Hop Pattern", "wlan_mgt.fh.hop_pattern",
12965       FT_UINT8, BASE_DEC, NULL, 0x0,
12966       NULL, HFILL }},
12967
12968     {&hf_ieee80211_tag_fh_hop_index,
12969      {"Hop Index", "wlan_mgt.fh.hop_index",
12970       FT_UINT8, BASE_DEC, NULL, 0x0,
12971       NULL, HFILL }},
12972
12973     {&hf_ieee80211_ff_block_ack_params,
12974       {"Block Ack Parameters", "wlan_mgt.fixed.baparams",
12975       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12976
12977     {&hf_ieee80211_ff_block_ack_params_amsdu_permitted,
12978       {"A-MSDUs", "wlan_mgt.fixed.baparams.amsdu",
12979       FT_BOOLEAN, 16, TFS (&ff_block_ack_params_amsdu_permitted_flag), 0x0001, "A-MSDU Permitted in QoS Data MPDUs", HFILL }},
12980
12981     {&hf_ieee80211_ff_block_ack_params_policy,
12982       {"Block Ack Policy", "wlan_mgt.fixed.baparams.policy",
12983       FT_BOOLEAN, 16, TFS (&ff_block_ack_params_policy_flag), 0x0002, NULL, HFILL }},
12984
12985     {&hf_ieee80211_ff_block_ack_params_tid,
12986       {"Traffic Identifier", "wlan_mgt.fixed.baparams.tid",
12987       FT_UINT16, BASE_HEX, NULL, 0x003C, NULL, HFILL }},
12988
12989     {&hf_ieee80211_ff_block_ack_params_buffer_size,
12990       {"Number of Buffers (1 Buffer = 2304 Bytes)", "wlan_mgt.fixed.baparams.buffersize",
12991       FT_UINT16, BASE_DEC, NULL, 0xFFC0, "Number of Buffers", HFILL }},
12992
12993     {&hf_ieee80211_ff_block_ack_timeout,
12994       {"Block Ack Timeout", "wlan_mgt.fixed.batimeout",
12995       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12996
12997     {&hf_ieee80211_ff_block_ack_ssc,
12998      {"Block Ack Starting Sequence Control (SSC)", "wlan_mgt.fixed.ssc",
12999       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
13000
13001     {&hf_ieee80211_ff_block_ack_ssc_fragment,
13002      {"Fragment", "wlan_mgt.fixed.fragment",
13003       FT_UINT16, BASE_DEC, 0, 0x000f, NULL, HFILL }},
13004
13005     {&hf_ieee80211_ff_block_ack_ssc_sequence,
13006      {"Starting Sequence Number", "wlan_mgt.fixed.sequence",
13007       FT_UINT16, BASE_DEC, 0, 0xfff0, NULL, HFILL }},
13008
13009     {&hf_ieee80211_ff_delba_param,
13010      {"Delete Block Ack (DELBA) Parameter Set", "wlan_mgt.fixed.delba.param",
13011       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
13012
13013     {&hf_ieee80211_ff_delba_param_reserved,
13014      {"Reserved", "wlan_mgt.fixed.delba.param.reserved",
13015       FT_UINT16, BASE_HEX, 0, 0x07ff, NULL, HFILL }},
13016
13017     {&hf_ieee80211_ff_delba_param_init,
13018      {"Initiator", "wlan_mgt.fixed.delba.param.initiator",
13019       FT_BOOLEAN, 16, 0, 0x0800, NULL, HFILL }},
13020
13021     {&hf_ieee80211_ff_delba_param_tid,
13022      {"TID", "wlan_mgt.fixed.delba.param.tid",
13023       FT_UINT16, BASE_HEX, 0, 0xf000, "Traffic Identifier (TID)", HFILL }},
13024
13025     {&hf_ieee80211_ff_max_reg_pwr,
13026      {"Maximum Regulation Power", "wlan_mgt.fixed.maxregpwr",
13027       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
13028
13029     {&hf_ieee80211_ff_measurement_pilot_int,
13030      {"Measurement Pilot Interval", "wlan_mgt.fixed.msmtpilotint",
13031       FT_UINT16, BASE_HEX, 0, 0, "Measurement Pilot Interval Fixed Field", HFILL }},
13032
13033     {&hf_ieee80211_ff_country_str,
13034      {"Country String", "wlan_mgt.fixed.country",
13035       FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
13036
13037     {&hf_ieee80211_ff_max_tx_pwr,
13038      {"Maximum Transmit Power", "wlan_mgt.fixed.maxtxpwr",
13039       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
13040
13041     {&hf_ieee80211_ff_tx_pwr_used,
13042      {"Transmit Power Used", "wlan_mgt.fixed.txpwr",
13043       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
13044
13045     {&hf_ieee80211_ff_transceiver_noise_floor,
13046      {"Transceiver Noise Floor", "wlan_mgt.fixed.tnoisefloor",
13047       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
13048
13049     {&hf_ieee80211_ff_channel_width,
13050      {"Supported Channel Width", "wlan_mgt.fixed.chanwidth",
13051       FT_UINT8, BASE_HEX, VALS (ff_channel_width_vals), 0, NULL, HFILL }},
13052
13053     {&hf_ieee80211_ff_qos_info_ap,
13054      {"QoS Information (AP)", "wlan_mgt.fixed.qosinfo.ap",
13055       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13056
13057     {&hf_ieee80211_ff_qos_info_ap_edca_param_set_counter,
13058      {"EDCA Parameter Set Update Count", "wlan_mgt.fixed.qosinfo.ap.edcaupdate",
13059       FT_UINT8, BASE_HEX, NULL, 0x0F, "Enhanced Distributed Channel Access (EDCA) Parameter Set Update Count", HFILL }},
13060
13061     {&hf_ieee80211_ff_qos_info_ap_q_ack,
13062      {"Q-Ack", "wlan_mgt.fixed.qosinfo.ap.qack",
13063       FT_BOOLEAN, 8, TFS (&ff_qos_info_ap_q_ack_flag), 0x10, "QoS Ack", HFILL }},
13064
13065     {&hf_ieee80211_ff_qos_info_ap_queue_req,
13066      {"Queue Request", "wlan_mgt.fixed.qosinfo.ap",
13067       FT_BOOLEAN, 8, TFS (&ff_qos_info_ap_queue_req_flag), 0x20, NULL, HFILL }},
13068
13069     {&hf_ieee80211_ff_qos_info_ap_txop_request,
13070      {"TXOP Request", "wlan_mgt.fixed.qosinfo.ap.txopreq",
13071       FT_BOOLEAN, 8, TFS (&ff_qos_info_ap_txop_request_flag), 0x40, "Transmit Opportunity (TXOP) Request", HFILL }},
13072
13073     {&hf_ieee80211_ff_qos_info_ap_reserved,
13074      {"Reserved", "wlan_mgt.fixed.qosinfo.ap.reserved",
13075       FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
13076
13077     {&hf_ieee80211_ff_qos_info_sta,
13078      {"QoS Information (STA)", "wlan_mgt.fixed.qosinfo.sta",
13079       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13080
13081     {&hf_ieee80211_ff_qos_info_sta_ac_vo,
13082      {"AC_VO", "wlan_mgt.fixed.qosinfo.sta.ac.vo",
13083       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x01, NULL, HFILL }},
13084
13085     {&hf_ieee80211_ff_qos_info_sta_ac_vi,
13086      {"AC_VI", "wlan_mgt.fixed.qosinfo.sta.ac.vi",
13087       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x02, NULL, HFILL }},
13088
13089     {&hf_ieee80211_ff_qos_info_sta_ac_bk,
13090      {"AC_BK", "wlan_mgt.fixed.qosinfo.sta.ac.bk",
13091       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x04, NULL, HFILL }},
13092
13093     {&hf_ieee80211_ff_qos_info_sta_ac_be,
13094      {"AC_BE", "wlan_mgt.fixed.qosinfo.sta.ac.be",
13095       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x08, NULL, HFILL }},
13096
13097     {&hf_ieee80211_ff_qos_info_sta_q_ack,
13098      {"Q-Ack", "wlan_mgt.fixed.qosinfo.sta.qack",
13099       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_q_ack_flag), 0x10, "QoS Ack", HFILL }},
13100
13101     {&hf_ieee80211_ff_qos_info_sta_max_sp_len,
13102      {"Service Period (SP) Length", "wlan_mgt.fixed.qosinfo.sta.splen",
13103       FT_UINT8, BASE_HEX, VALS (&ff_qos_info_sta_max_sp_len_flags) , 0x60, NULL, HFILL }},
13104
13105     {&hf_ieee80211_ff_qos_info_sta_more_data_ack,
13106      {"More Data Ack", "wlan_mgt.fixed.qosinfo.sta.moredataack",
13107       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_more_data_ack_flag), 0x80, NULL, HFILL }},
13108
13109     {&hf_ieee80211_ff_sm_pwr_save,
13110      {"Spatial Multiplexing (SM) Power Control", "wlan_mgt.fixed.sm.powercontrol",
13111       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13112
13113     {&hf_ieee80211_ff_sm_pwr_save_enabled,
13114      {"SM Power Save", "wlan_mgt.fixed.sm.powercontrol.enabled",
13115       FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x01, "Spatial Multiplexing (SM) Power Save", HFILL }},
13116
13117     {&hf_ieee80211_ff_sm_pwr_save_sm_mode,
13118      {"SM Mode", "wlan_mgt.fixed.sm.powercontrol.mode",
13119       FT_BOOLEAN, 8, TFS (&ff_sm_pwr_save_sm_mode_flag), 0x02, "Spatial Multiplexing (SM) Mode", HFILL }},
13120
13121     {&hf_ieee80211_ff_sm_pwr_save_reserved,
13122      {"Reserved", "wlan_mgt.fixed.sm.powercontrol.reserved",
13123       FT_UINT8, BASE_HEX, NULL, 0xFC, NULL, HFILL }},
13124
13125     {&hf_ieee80211_ff_pco_phase_cntrl,
13126      {"Phased Coexistence Operation (PCO) Phase Control", "wlan_mgt.fixed.pco.phasecntrl",
13127       FT_BOOLEAN, BASE_NONE, TFS (&ff_pco_phase_cntrl_flag), 0x0, NULL, HFILL }},
13128
13129     {&hf_ieee80211_ff_psmp_param_set,
13130      {"Power Save Multi-Poll (PSMP) Parameter Set", "wlan_mgt.fixed.psmp.paramset",
13131       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
13132
13133     {&hf_ieee80211_ff_psmp_param_set_n_sta,
13134      {"Number of STA Info Fields Present", "wlan_mgt.fixed.psmp.paramset.nsta",
13135       FT_UINT16, BASE_HEX, 0, 0x000F, NULL, HFILL }},
13136
13137     {&hf_ieee80211_ff_psmp_param_set_more_psmp,
13138      {"More PSMP", "wlan_mgt.fixed.psmp.paramset.more",
13139       FT_BOOLEAN, 16, TFS(&ff_psmp_param_set_more_psmp_flag), 0x0010, "More Power Save Multi-Poll (PSMP)", HFILL }},
13140
13141     {&hf_ieee80211_ff_psmp_param_set_psmp_sequence_duration,
13142      {"PSMP Sequence Duration [us]", "wlan_mgt.fixed.psmp.paramset.seqduration",
13143       FT_UINT16, BASE_DEC, 0, 0xFFE0, "Power Save Multi-Poll (PSMP) Sequence Duration", HFILL }},
13144
13145     {&hf_ieee80211_ff_mimo_cntrl,
13146      {"MIMO Control", "wlan_mgt.fixed.mimo.control.",
13147       FT_BYTES, BASE_NONE, 0, 0x0, NULL, HFILL }},
13148
13149     {&hf_ieee80211_ff_mimo_cntrl_nc_index,
13150      {"Nc Index", "wlan_mgt.fixed.mimo.control.ncindex",
13151       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_nc_index_flags), 0x0003, "Number of Columns Less One", HFILL }},
13152
13153     {&hf_ieee80211_ff_mimo_cntrl_nr_index,
13154      {"Nr Index", "wlan_mgt.fixed.mimo.control.nrindex",
13155       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_nr_index_flags), 0x000C, "Number of Rows Less One", HFILL }},
13156
13157     {&hf_ieee80211_ff_mimo_cntrl_channel_width,
13158      {"Channel Width", "wlan_mgt.fixed.mimo.control.chanwidth",
13159       FT_BOOLEAN, 16, TFS(&ff_mimo_cntrl_channel_width_flag), 0x0010, NULL, HFILL }},
13160
13161     {&hf_ieee80211_ff_mimo_cntrl_grouping,
13162      {"Grouping (Ng)", "wlan_mgt.fixed.mimo.control.grouping",
13163       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_grouping_flags), 0x0060, NULL, HFILL }},
13164
13165     {&hf_ieee80211_ff_mimo_cntrl_coefficient_size,
13166      {"Coefficient Size (Nb)", "wlan_mgt.fixed.mimo.control.cosize",
13167       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_coefficient_size_flags), 0x0180, NULL, HFILL }},
13168
13169     {&hf_ieee80211_ff_mimo_cntrl_codebook_info,
13170      {"Codebook Information", "wlan_mgt.fixed.mimo.control.codebookinfo",
13171       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_codebook_info_flags), 0x0600, NULL, HFILL }},
13172
13173     {&hf_ieee80211_ff_mimo_cntrl_remaining_matrix_segment,
13174      {"Remaining Matrix Segment", "wlan_mgt.fixed.mimo.control.matrixseg",
13175       FT_UINT16, BASE_HEX, 0, 0x3800, NULL, HFILL }},
13176
13177     {&hf_ieee80211_ff_mimo_cntrl_reserved,
13178      {"Reserved", "wlan_mgt.fixed.mimo.control.reserved",
13179       FT_UINT16, BASE_HEX, 0, 0xC000, NULL, HFILL }},
13180
13181     {&hf_ieee80211_ff_mimo_cntrl_sounding_timestamp,
13182      {"Sounding Timestamp", "wlan_mgt.fixed.mimo.control.soundingtime",
13183       FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
13184
13185     {&hf_ieee80211_ff_psmp_sta_info,
13186      {"Power Save Multi-Poll (PSMP) Station Information", "wlan_mgt.fixed.psmp.stainfo",
13187       FT_UINT64, BASE_HEX, 0, 0, NULL, HFILL }},
13188
13189     {&hf_ieee80211_ff_psmp_sta_info_type,
13190      {"Sta Info Type", "wlan_mgt.fixed.psmp.stainfo.type",
13191       FT_UINT32, BASE_HEX, VALS(ff_psmp_sta_info_flags), PSMP_STA_INFO_FLAG_TYPE, NULL, HFILL }},
13192
13193     {&hf_ieee80211_ff_psmp_sta_info_dtt_start_offset,
13194      {"DTT Start Offset", "wlan_mgt.fixed.psmp.stainfo.dttstart",
13195       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_DTT_START, NULL, HFILL }},
13196
13197     {&hf_ieee80211_ff_psmp_sta_info_dtt_duration,
13198      {"DTT Duration", "wlan_mgt.fixed.psmp.stainfo.dttduration",
13199       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_DTT_DURATION, NULL, HFILL }},
13200
13201     {&hf_ieee80211_ff_psmp_sta_info_sta_id,
13202      {"Target Station ID", "wlan_mgt.fixed.psmp.stainfo.staid",
13203       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_STA_ID, NULL, HFILL }},
13204
13205     {&hf_ieee80211_ff_psmp_sta_info_utt_start_offset,
13206      {"UTT Start Offset", "wlan_mgt.fixed.psmp.stainfo.uttstart",
13207       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_UTT_START, NULL, HFILL }},
13208
13209     {&hf_ieee80211_ff_psmp_sta_info_utt_duration,
13210      {"UTT Duration", "wlan_mgt.fixed.psmp.stainfo.uttduration",
13211       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_UTT_DURATION, NULL, HFILL }},
13212
13213     {&hf_ieee80211_ff_psmp_sta_info_reserved_small,
13214      {"Reserved", "wlan_mgt.fixed.psmp.stainfo.reserved",
13215       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_IA_RESERVED, NULL, HFILL }},
13216
13217     {&hf_ieee80211_ff_psmp_sta_info_reserved_large,
13218      {"Reserved", "wlan_mgt.fixed.psmp.stainfo.reserved",
13219       FT_UINT64, BASE_HEX, 0, 0, NULL, HFILL }},
13220
13221     {&hf_ieee80211_ff_psmp_sta_info_psmp_multicast_id,
13222      {"Power Save Multi-Poll (PSMP) Multicast ID", "wlan_mgt.fixed.psmp.stainfo.multicastid",
13223       FT_UINT64, BASE_HEX, 0, 0, NULL, HFILL }},
13224
13225     {&hf_ieee80211_ff_ant_selection,
13226      {"Antenna Selection", "wlan_mgt.fixed.antsel",
13227       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
13228
13229     {&hf_ieee80211_ff_ant_selection_0,
13230      {"Antenna 0", "wlan_mgt.fixed.antsel.ant0",
13231       FT_UINT8, BASE_HEX, 0, 0x01, NULL, HFILL }},
13232
13233     {&hf_ieee80211_ff_ant_selection_1,
13234      {"Antenna 1", "wlan_mgt.fixed.antsel.ant1",
13235       FT_UINT8, BASE_HEX, 0, 0x02, NULL, HFILL }},
13236
13237     {&hf_ieee80211_ff_ant_selection_2,
13238      {"Antenna 2", "wlan_mgt.fixed.antsel.ant2",
13239       FT_UINT8, BASE_HEX, 0, 0x04, NULL, HFILL }},
13240
13241     {&hf_ieee80211_ff_ant_selection_3,
13242      {"Antenna 3", "wlan_mgt.fixed.antsel.ant3",
13243       FT_UINT8, BASE_HEX, 0, 0x08, NULL, HFILL }},
13244
13245     {&hf_ieee80211_ff_ant_selection_4,
13246      {"Antenna 4", "wlan_mgt.fixed.antsel.ant4",
13247       FT_UINT8, BASE_HEX, 0, 0x10, NULL, HFILL }},
13248
13249     {&hf_ieee80211_ff_ant_selection_5,
13250      {"Antenna 5", "wlan_mgt.fixed.antsel.ant5",
13251       FT_UINT8, BASE_HEX, 0, 0x20, NULL, HFILL }},
13252
13253     {&hf_ieee80211_ff_ant_selection_6,
13254      {"Antenna 6", "wlan_mgt.fixed.antsel.ant6",
13255       FT_UINT8, BASE_HEX, 0, 0x40, NULL, HFILL }},
13256
13257     {&hf_ieee80211_ff_ant_selection_7,
13258      {"Antenna 7", "wlan_mgt.fixed.antsel.ant7",
13259       FT_UINT8, BASE_HEX, 0, 0x80, NULL, HFILL }},
13260
13261     {&hf_ieee80211_ff_ext_channel_switch_announcement,
13262      {"Extended Channel Switch Announcement", "wlan_mgt.fixed.extchansw",
13263       FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
13264
13265     {&hf_ieee80211_ff_ext_channel_switch_announcement_switch_mode,
13266      {"Channel Switch Mode", "wlan_mgt.fixed.extchansw.switchmode",
13267       FT_UINT32, BASE_HEX, VALS(ieee80211_tag_ext_channel_switch_announcement_switch_mode_flags), 0x000000FF, NULL, HFILL }},
13268
13269     {&hf_ieee80211_ff_ext_channel_switch_announcement_new_reg_class,
13270      {"New Regulatory Class", "wlan_mgt.fixed.extchansw.new.regclass",
13271       FT_UINT32, BASE_HEX, NULL, 0x0000FF00, NULL, HFILL }},
13272
13273     {&hf_ieee80211_ff_ext_channel_switch_announcement_new_chan_number,
13274      {"New Channel Number", "wlan_mgt.fixed.extchansw.new.channumber",
13275       FT_UINT32, BASE_HEX, NULL, 0x00FF0000, NULL, HFILL }},
13276
13277     {&hf_ieee80211_ff_ext_channel_switch_announcement_switch_count,
13278      {"Channel Switch Count", "wlan_mgt.extchanswitch.switchcount",
13279       FT_UINT32, BASE_HEX, NULL, 0xFF000000, NULL, HFILL }},
13280
13281     {&hf_ieee80211_ff_ht_info,
13282      {"HT Information", "wlan_mgt.fixed.extchansw",
13283       FT_UINT8, BASE_HEX, 0, 0, "HT Information Fixed Field", HFILL }},
13284
13285     {&hf_ieee80211_ff_ht_info_information_request,
13286      {"Information Request", "wlan_mgt.fixed.mimo.control.chanwidth",
13287       FT_BOOLEAN, 8, TFS(&ff_ht_info_information_request_flag), 0x01, NULL, HFILL }},
13288
13289     {&hf_ieee80211_ff_ht_info_40_mhz_intolerant,
13290      {"40 MHz Intolerant", "wlan_mgt.fixed.mimo.control.chanwidth",
13291       FT_BOOLEAN, 8, TFS(&ff_ht_info_40_mhz_intolerant_flag), 0x02, NULL, HFILL }},
13292
13293     {&hf_ieee80211_ff_ht_info_sta_chan_width,
13294      {"Station Channel Width", "wlan_mgt.fixed.mimo.control.chanwidth",
13295       FT_BOOLEAN, 8, TFS(&ff_ht_info_sta_chan_width_flag), 0x04, NULL, HFILL }},
13296
13297     {&hf_ieee80211_ff_ht_info_reserved,
13298      {"Reserved", "wlan_mgt.fixed.extchansw",
13299       FT_UINT8, BASE_HEX, 0, 0xF8, "Reserved Field", HFILL }},
13300
13301     {&hf_ieee80211_ff_ht_action,
13302      {"HT Action", "wlan_mgt.fixed.htact",
13303       FT_UINT8, BASE_HEX, VALS (&ff_ht_action_flags), 0, "HT Action Code", HFILL }},
13304
13305     {&hf_ieee80211_ff_mimo_csi_snr,
13306      {"Signal to Noise Ratio (SNR)", "wlan_mgt.mimo.csimatrices.snr",
13307       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13308
13309     {&hf_ieee80211_ff_public_action,
13310      {"Public Action", "wlan_mgt.fixed.publicact",
13311       FT_UINT8, BASE_HEX, VALS(ff_pa_action_codes), 0, "Public Action Code", HFILL }},
13312
13313     {&hf_ieee80211_ff_capture,
13314      {"Capabilities Information", "wlan_mgt.fixed.capabilities", FT_UINT16, BASE_HEX, NULL, 0,
13315       "Capability information", HFILL }},
13316
13317     {&hf_ieee80211_ff_cf_ess,
13318      {"ESS capabilities", "wlan_mgt.fixed.capabilities.ess",
13319       FT_BOOLEAN, 16, TFS (&cf_ess_flags), 0x0001, NULL, HFILL }},
13320
13321     {&hf_ieee80211_ff_cf_ibss,
13322      {"IBSS status", "wlan_mgt.fixed.capabilities.ibss",
13323       FT_BOOLEAN, 16, TFS (&cf_ibss_flags), 0x0002, "IBSS participation", HFILL }},
13324
13325     {&hf_ieee80211_ff_cf_sta_poll,
13326      {"CFP participation capabilities", "wlan_mgt.fixed.capabilities.cfpoll.sta",
13327       FT_UINT16, BASE_HEX, VALS (&sta_cf_pollable), 0x020C,
13328       "CF-Poll capabilities for a STA", HFILL }},
13329
13330     {&hf_ieee80211_ff_cf_ap_poll,
13331      {"CFP participation capabilities", "wlan_mgt.fixed.capabilities.cfpoll.ap",
13332       FT_UINT16, BASE_HEX, VALS (&ap_cf_pollable), 0x020C,
13333       "CF-Poll capabilities for an AP", HFILL }},
13334
13335     {&hf_ieee80211_ff_cf_privacy,
13336      {"Privacy", "wlan_mgt.fixed.capabilities.privacy",
13337       FT_BOOLEAN, 16, TFS (&cf_privacy_flags), 0x0010, "WEP support", HFILL }},
13338
13339     {&hf_ieee80211_ff_cf_preamble,
13340      {"Short Preamble", "wlan_mgt.fixed.capabilities.preamble",
13341       FT_BOOLEAN, 16, TFS (&cf_preamble_flags), 0x0020, NULL, HFILL }},
13342
13343     {&hf_ieee80211_ff_cf_pbcc,
13344      {"PBCC", "wlan_mgt.fixed.capabilities.pbcc",
13345       FT_BOOLEAN, 16, TFS (&cf_pbcc_flags), 0x0040, "PBCC Modulation", HFILL }},
13346
13347     {&hf_ieee80211_ff_cf_agility,
13348      {"Channel Agility", "wlan_mgt.fixed.capabilities.agility",
13349       FT_BOOLEAN, 16, TFS (&cf_agility_flags), 0x0080, NULL, HFILL }},
13350
13351     {&hf_ieee80211_ff_cf_spec_man,
13352      {"Spectrum Management", "wlan_mgt.fixed.capabilities.spec_man",
13353       FT_BOOLEAN, 16, TFS (&cf_spec_man_flags), 0x0100, NULL, HFILL }},
13354
13355     {&hf_ieee80211_ff_short_slot_time,
13356      {"Short Slot Time", "wlan_mgt.fixed.capabilities.short_slot_time",
13357       FT_BOOLEAN, 16, TFS (&short_slot_time_flags), 0x0400, NULL,
13358       HFILL }},
13359
13360     {&hf_ieee80211_ff_cf_apsd,
13361      {"Automatic Power Save Delivery", "wlan_mgt.fixed.capabilities.apsd",
13362       FT_BOOLEAN, 16, TFS (&cf_apsd_flags), 0x0800, NULL, HFILL }},
13363
13364     {&hf_ieee80211_ff_dsss_ofdm,
13365      {"DSSS-OFDM", "wlan_mgt.fixed.capabilities.dsss_ofdm",
13366       FT_BOOLEAN, 16, TFS (&dsss_ofdm_flags), 0x2000, "DSSS-OFDM Modulation",
13367       HFILL }},
13368
13369     {&hf_ieee80211_ff_cf_del_blk_ack,
13370      {"Delayed Block Ack", "wlan_mgt.fixed.capabilities.del_blk_ack",
13371       FT_BOOLEAN, 16, TFS (&cf_del_blk_ack_flags), 0x4000, NULL, HFILL }},
13372
13373     {&hf_ieee80211_ff_cf_imm_blk_ack,
13374      {"Immediate Block Ack", "wlan_mgt.fixed.capabilities.imm_blk_ack",
13375       FT_BOOLEAN, 16, TFS (&cf_imm_blk_ack_flags), 0x8000, NULL, HFILL }},
13376
13377     {&hf_ieee80211_ff_auth_seq,
13378      {"Authentication SEQ", "wlan_mgt.fixed.auth_seq",
13379       FT_UINT16, BASE_HEX, NULL, 0, "Authentication Sequence Number", HFILL }},
13380
13381     {&hf_ieee80211_ff_assoc_id,
13382      {"Association ID", "wlan_mgt.fixed.aid",
13383       FT_UINT16, BASE_HEX, NULL, 0x3FFF, NULL, HFILL }},
13384
13385     {&hf_ieee80211_ff_listen_ival,
13386      {"Listen Interval", "wlan_mgt.fixed.listen_ival",
13387       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
13388
13389     {&hf_ieee80211_ff_current_ap,
13390      {"Current AP", "wlan_mgt.fixed.current_ap",
13391       FT_ETHER, BASE_NONE, NULL, 0, "MAC address of current AP", HFILL }},
13392
13393     {&hf_ieee80211_ff_reason,
13394      {"Reason code", "wlan_mgt.fixed.reason_code",
13395       FT_UINT16, BASE_HEX, VALS (&ieee80211_reason_code), 0,
13396       "Reason for unsolicited notification", HFILL }},
13397
13398     {&hf_ieee80211_ff_status_code,
13399      {"Status code", "wlan_mgt.fixed.status_code",
13400       FT_UINT16, BASE_HEX, VALS (&ieee80211_status_code), 0,
13401       "Status of requested event", HFILL }},
13402
13403     {&hf_ieee80211_ff_category_code,
13404      {"Category code", "wlan_mgt.fixed.category_code",
13405       FT_UINT16, BASE_DEC, VALS (&category_codes), 0,
13406       "Management action category", HFILL }},
13407
13408     {&hf_ieee80211_ff_action_code,
13409      {"Action code", "wlan_mgt.fixed.action_code",
13410       FT_UINT16, BASE_DEC, VALS (&action_codes), 0,
13411       "Management action code", HFILL }},
13412
13413     {&hf_ieee80211_ff_dialog_token,
13414      {"Dialog token", "wlan_mgt.fixed.dialog_token",
13415       FT_UINT8, BASE_HEX, NULL, 0, "Management action dialog token", HFILL }},
13416
13417     {&hf_ieee80211_ff_marvell_action_type,
13418      {"Marvell Action type", "wlan_mgt.fixed.mrvl_action_type",
13419       FT_UINT8, BASE_DEC, VALS (&vendor_action_types_mrvl), 0,
13420       "Vendor Specific Action Type (Marvell)", HFILL }},
13421
13422     {&hf_ieee80211_ff_marvell_mesh_mgt_action_code,
13423      {"Mesh action(Marvell)", "wlan_mgt.fixed.mrvl_mesh_action",
13424       FT_UINT8, BASE_HEX, VALS (&mesh_mgt_action_codes_mrvl), 0,
13425       "Mesh action code(Marvell)", HFILL }},
13426
13427     {&hf_ieee80211_ff_marvell_mesh_mgt_length,
13428      {"Message Length", "wlan_mgt.fixed.length",
13429       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13430
13431     {&hf_ieee80211_ff_marvell_mesh_mgt_mode,
13432      {"Message Mode", "wlan_mgt.fixed.mode",
13433       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13434
13435     {&hf_ieee80211_ff_marvell_mesh_mgt_ttl,
13436      {"Message TTL", "wlan_mgt.fixed.ttl",
13437       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13438
13439     {&hf_ieee80211_ff_marvell_mesh_mgt_dstcount,
13440      {"Destination Count", "wlan_mgt.fixed.dstcount",
13441       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13442
13443     {&hf_ieee80211_ff_marvell_mesh_mgt_hopcount,
13444      {"Hop Count", "wlan_mgt.fixed.hopcount",
13445       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13446
13447     {&hf_ieee80211_ff_marvell_mesh_mgt_rreqid,
13448      {"RREQ ID", "wlan_mgt.fixed.rreqid",
13449       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
13450
13451     {&hf_ieee80211_ff_marvell_mesh_mgt_sa,
13452      {"Source Address", "wlan_mgt.fixed.sa",
13453       FT_ETHER, BASE_NONE, NULL, 0, "Source MAC address", HFILL }},
13454
13455     {&hf_ieee80211_ff_marvell_mesh_mgt_ssn,
13456      {"SSN", "wlan_mgt.fixed.ssn",
13457       FT_UINT32, BASE_DEC, NULL, 0, "Source Sequence Number", HFILL }},
13458
13459     {&hf_ieee80211_ff_marvell_mesh_mgt_metric,
13460      {"Metric", "wlan_mgt.fixed.metric",
13461       FT_UINT32, BASE_DEC, NULL, 0, "Route Metric", HFILL }},
13462
13463     {&hf_ieee80211_ff_marvell_mesh_mgt_flags,
13464      {"RREQ Flags", "wlan_mgt.fixed.hopcount",
13465       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13466
13467     {&hf_ieee80211_ff_marvell_mesh_mgt_da,
13468      {"Destination Address", "wlan_mgt.fixed.da",
13469       FT_ETHER, BASE_NONE, NULL, 0, "Destination MAC address", HFILL }},
13470
13471     {&hf_ieee80211_ff_marvell_mesh_mgt_dsn,
13472      {"DSN", "wlan_mgt.fixed.dsn",
13473       FT_UINT32, BASE_DEC, NULL, 0, "Destination Sequence Number", HFILL }},
13474
13475     {&hf_ieee80211_ff_marvell_mesh_mgt_lifetime,
13476      {"Lifetime", "wlan_mgt.fixed.lifetime",
13477       FT_UINT32, BASE_DEC, NULL, 0, "Route Lifetime", HFILL }},
13478
13479     {&hf_ieee80211_ff_wme_action_code,
13480      {"Action code", "wlan_mgt.fixed.action_code",
13481       FT_UINT16, BASE_HEX, VALS (&wme_action_codes), 0,
13482       "Management notification action code", HFILL }},
13483
13484     {&hf_ieee80211_ff_wme_status_code,
13485      {"Status code", "wlan_mgt.fixed.status_code",
13486       FT_UINT16, BASE_HEX, VALS (&wme_status_codes), 0,
13487       "Management notification setup response status code", HFILL }},
13488
13489     {&hf_ieee80211_ff_mesh_action,
13490      {"Mesh Action code", "wlan_mgt.fixed.mesh_action",
13491       FT_UINT8, BASE_HEX, VALS (&mesh_action), 0,
13492       NULL, HFILL }},
13493
13494     {&hf_ieee80211_ff_multihop_action,
13495      {"Multihop Action code", "wlan_mgt.fixed.multihop_action",
13496       FT_UINT8, BASE_HEX, VALS (&multihop_action), 0,
13497       NULL, HFILL }},
13498
13499     {&hf_ieee80211_ff_mesh_flags,
13500      {"Mesh Flags", "wlan_mgt.fixed.mesh_flags",
13501       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13502
13503     {&hf_ieee80211_ff_mesh_ttl,
13504      {"Mesh TTL", "wlan_mgt.fixed.mesh_ttl",
13505       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13506
13507     {&hf_ieee80211_ff_mesh_sequence,
13508      {"Sequence Number", "wlan_mgt.fixed.mesh_sequence",
13509       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
13510
13511     {&hf_ieee80211_ff_mesh_addr4,
13512      {"Mesh Extended Address 4", "wlan_mgt.fixed.mesh_addr4",
13513       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13514
13515     {&hf_ieee80211_ff_mesh_addr5,
13516      {"Mesh Extended Address 5", "wlan_mgt.fixed.mesh_addr5",
13517       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13518
13519     {&hf_ieee80211_ff_mesh_addr6,
13520      {"Mesh Extended Address 6", "wlan_mgt.fixed.mesh_addr6",
13521       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13522
13523     {&hf_ieee80211_ff_selfprot_action,
13524      {"Self-protected Action code", "wlan_mgt.fixed.selfprot_action",
13525       FT_UINT8, BASE_HEX, VALS (&selfprot_action), 0,
13526       NULL, HFILL }},
13527
13528     {&hf_ieee80211_mesh_peering_proto,
13529      {"Mesh Peering Protocol ID", "wlan.peering.proto",
13530       FT_UINT16, BASE_HEX, VALS (&mesh_peering_proto_ids), 0,
13531       NULL, HFILL }},
13532
13533     {&hf_ieee80211_mesh_peering_local_link_id,
13534      {"Local Link ID", "wlan.peering.local_id",
13535       FT_UINT16, BASE_HEX, NULL, 0,
13536       "Mesh Peering Management Local Link ID", HFILL }},
13537
13538     {&hf_ieee80211_mesh_peering_peer_link_id,
13539      {"Peer Link ID", "wlan.peering.peer_id",
13540       FT_UINT16, BASE_HEX, NULL, 0,
13541       "Mesh Peering Management Peer Link ID", HFILL }},
13542
13543     {&hf_ieee80211_ff_hwmp_flags,
13544      {"HWMP Flags", "wlan.hwmp.flags", FT_UINT8, BASE_HEX, NULL, 0,
13545       NULL, HFILL }},
13546
13547     {&hf_ieee80211_ff_hwmp_hopcount,
13548      {"HWMP Hop Count", "wlan.hwmp.hopcount", FT_UINT8, BASE_DEC, NULL, 0,
13549       NULL, HFILL }},
13550
13551     {&hf_ieee80211_ff_hwmp_ttl,
13552      {"HWMP TTL", "wlan.hwmp.ttl", FT_UINT8, BASE_DEC, NULL, 0,
13553       NULL, HFILL }},
13554
13555     {&hf_ieee80211_ff_hwmp_pdid,
13556      {"HWMP Path Discovery ID", "wlan.hwmp.pdid", FT_UINT32, BASE_DEC, NULL, 0,
13557       NULL, HFILL }},
13558
13559     {&hf_ieee80211_ff_hwmp_orig_sta,
13560      {"Originator STA Address", "wlan.hwmp.orig_sta", FT_ETHER, BASE_NONE, NULL, 0,
13561       NULL, HFILL }},
13562
13563     {&hf_ieee80211_ff_hwmp_orig_sn,
13564      {"HWMP Originator Sequence Number", "wlan.hwmp.orig_sn", FT_UINT32, BASE_DEC, NULL, 0,
13565       NULL, HFILL}},
13566
13567     {&hf_ieee80211_ff_hwmp_orig_ext,
13568      {"Originator External Address", "wlan.hwmp.orig_ext", FT_ETHER, BASE_NONE, NULL, 0,
13569       NULL, HFILL }},
13570
13571     {&hf_ieee80211_ff_hwmp_lifetime,
13572      {"HWMP Lifetime", "wlan.hwmp.lifetime", FT_UINT32, BASE_DEC, NULL, 0,
13573       NULL, HFILL }},
13574
13575     {&hf_ieee80211_ff_hwmp_metric,
13576      {"HWMP Metric", "wlan.hwmp.metric", FT_UINT32, BASE_DEC, NULL, 0,
13577       NULL, HFILL }},
13578
13579     {&hf_ieee80211_ff_hwmp_targ_count,
13580      {"HWMP Target Count", "wlan.hwmp.targ_count", FT_UINT8, BASE_DEC, NULL, 0,
13581       NULL, HFILL }},
13582
13583     {&hf_ieee80211_ff_hwmp_targ_flags,
13584      {"HWMP Per-Target Flags", "wlan.hwmp.targ_flags", FT_UINT8, BASE_HEX, NULL, 0,
13585       NULL, HFILL }},
13586
13587     {&hf_ieee80211_ff_hwmp_targ_to_flags,
13588      {"TO Flag", "wlan.hwmp.to_flag",
13589       FT_BOOLEAN, 8, TFS (&hwmp_targ_to_flags), 0x01,
13590       "Target Only Flag", HFILL }},
13591
13592     {&hf_ieee80211_ff_hwmp_targ_usn_flags,
13593      {"USN Flag", "wlan.hwmp.usn_flag",
13594       FT_BOOLEAN, 8, TFS (&hwmp_targ_usn_flags), 0x04,
13595       "Unknown Target HWMP Sequence Number Flag", HFILL }},
13596
13597     {&hf_ieee80211_ff_hwmp_targ_sta,
13598      {"Target STA Address", "wlan.hwmp.targ_sta", FT_ETHER, BASE_NONE, NULL, 0,
13599       NULL, HFILL }},
13600
13601     {&hf_ieee80211_ff_hwmp_targ_ext,
13602      {"Target External Address", "wlan.hwmp.targ_ext", FT_ETHER, BASE_NONE, NULL, 0,
13603       NULL, HFILL }},
13604
13605     {&hf_ieee80211_ff_hwmp_targ_sn,
13606      {"Target HWMP Sequence Number", "wlan.hwmp.targ_sn",
13607       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
13608
13609     {&hf_ieee80211_mesh_config_path_sel_protocol,
13610      {"Path Selection Protocol", "wlan.mesh.config.ps_protocol",
13611       FT_UINT8, BASE_HEX, NULL, 0,
13612       "Mesh Configuration Path Selection Protocol", HFILL }},
13613
13614     {&hf_ieee80211_mesh_config_path_sel_metric,
13615      {"Path Selection Metric", "wlan.mesh.config.ps_metric",
13616       FT_UINT8, BASE_HEX, NULL, 0,
13617       "Mesh Configuration Path Selection Metric", HFILL }},
13618
13619     {&hf_ieee80211_mesh_config_congestion_control,
13620      {"Congestion Control", "wlan.mesh.config.cong_ctl",
13621       FT_UINT8, BASE_HEX, NULL, 0,
13622       "Mesh Configuration Congestion Control", HFILL }},
13623
13624     {&hf_ieee80211_mesh_config_sync_method,
13625      {"Synchronization Method", "wlan.mesh.config.sync_method",
13626       FT_UINT8, BASE_HEX, NULL, 0,
13627       "Mesh Configuration Synchronization Method", HFILL }},
13628
13629     {&hf_ieee80211_mesh_config_auth_protocol,
13630      {"Authentication Protocol", "wlan.mesh.config.auth_protocol",
13631       FT_UINT8, BASE_HEX, NULL, 0,
13632       "Mesh Configuration Authentication Protocol", HFILL }},
13633
13634     {&hf_ieee80211_mesh_config_formation_info,
13635      {"Formation Info", "wlan.mesh.config.formation_info",
13636       FT_UINT8, BASE_HEX, NULL, 0,
13637       "Mesh Configuration Formation Info", HFILL }},
13638
13639     {&hf_ieee80211_mesh_config_capability,
13640      {"Capability", "wlan.mesh.config.cap",
13641       FT_UINT8, BASE_HEX, NULL, 0,
13642       "Mesh Configuration Capability", HFILL }},
13643
13644     {&hf_ieee80211_mesh_id,
13645      {"Mesh ID", "wlan.mesh.id",
13646       FT_STRING, BASE_NONE, NULL, 0,
13647       NULL, HFILL }},
13648
13649     {&hf_ieee80211_rann_flags,
13650      {"RANN Flags", "wlan.rann.flags",
13651       FT_UINT8, BASE_HEX, NULL, 0,
13652       "Root Announcement Flags", HFILL }},
13653
13654     {&hf_ieee80211_rann_root_sta,
13655      {"Root STA Address", "wlan.rann.root_sta", FT_ETHER, BASE_NONE, NULL, 0,
13656       "Root Mesh STA Address", HFILL }},
13657
13658     {&hf_ieee80211_rann_sn,
13659      {"Root STA Sequence Number", "wlan.rann.rann_sn",
13660       FT_UINT32, BASE_DEC, NULL, 0, "Root Mesh STA Sequence Number", HFILL }},
13661
13662     {&hf_ieee80211_rann_interval,
13663      {"RANN Interval", "wlan.rann.interval", FT_UINT32, BASE_DEC, NULL, 0,
13664       "Root Announcement Interval", HFILL }},
13665
13666     {&hf_ieee80211_ff_qos_action_code,
13667      {"Action code", "wlan_mgt.fixed.action_code",
13668       FT_UINT16, BASE_HEX, VALS (&qos_action_codes), 0,
13669       "QoS management action code", HFILL }},
13670
13671     {&hf_ieee80211_ff_ba_action,
13672      {"Action code", "wlan_mgt.fixed.action_code",
13673       FT_UINT8, BASE_HEX, VALS (&ba_action_codes), 0,
13674       "Block Ack action code", HFILL }},
13675
13676     {&hf_ieee80211_ff_dls_action_code,
13677      {"Action code", "wlan_mgt.fixed.action_code",
13678       FT_UINT16, BASE_HEX, VALS (&dls_action_codes), 0,
13679       "DLS management action code", HFILL }},
13680
13681     {&hf_ieee80211_ff_dst_mac_addr,
13682      {"Destination address", "wlan_mgt.fixed.dst_mac_addr",
13683       FT_ETHER, BASE_NONE, NULL, 0, "Destination MAC address", HFILL }},
13684
13685     {&hf_ieee80211_ff_src_mac_addr,
13686      {"Source address", "wlan_mgt.fixed.src_mac_addr",
13687       FT_ETHER, BASE_NONE, NULL, 0, "Source MAC address", HFILL }},
13688
13689     {&hf_ieee80211_ff_ft_action_code,
13690      {"Action code", "wlan_mgt.fixed.action_code",
13691       FT_UINT8, BASE_DEC, VALS(ft_action_codes), 0,
13692       "Management action code", HFILL }},
13693
13694     {&hf_ieee80211_ff_sta_address,
13695      {"STA Address", "wlan_mgt.fixed.sta_address",
13696       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13697
13698     {&hf_ieee80211_ff_target_ap_address,
13699      {"Target AP Address", "wlan_mgt.fixed.target_ap_address",
13700       FT_ETHER, BASE_NONE, NULL, 0, "Target AP MAC address", HFILL }},
13701
13702     {&hf_ieee80211_ff_gas_comeback_delay,
13703      {"GAS Comeback Delay", "wlan_mgt.fixed.gas_comeback_delay",
13704       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13705
13706     {&hf_ieee80211_ff_gas_fragment_id,
13707      {"GAS Query Response Fragment ID", "wlan_mgt.fixed.gas_fragment_id",
13708       FT_UINT8, BASE_DEC, NULL, 0x7f, NULL, HFILL
13709      }},
13710
13711     {&hf_ieee80211_ff_more_gas_fragments,
13712      {"More GAS Fragments", "wlan_mgt.fixed.more_gas_fragments",
13713       FT_UINT8, BASE_DEC, NULL, 0x80, NULL, HFILL }},
13714
13715     {&hf_ieee80211_ff_query_request_length,
13716      {"Query Request Length", "wlan_mgt.fixed.query_request_length",
13717       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13718
13719     {&hf_ieee80211_ff_query_request,
13720      {"Query Request", "wlan_mgt.fixed.query_request",
13721       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13722
13723     {&hf_ieee80211_ff_query_response_length,
13724      {"Query Response Length", "wlan_mgt.fixed.query_response_length",
13725       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13726
13727     {&hf_ieee80211_ff_query_response,
13728      {"Query Response", "wlan_mgt.fixed.query_response",
13729       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13730
13731     {&hf_ieee80211_gas_resp_fragments,
13732      {"GAS Query Response fragments", "wlan_mgt.fixed.fragments",
13733       FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13734     {&hf_ieee80211_gas_resp_fragment,
13735      {"GAS Query Response fragment", "wlan_mgt.fixed.fragment",
13736       FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13737     {&hf_ieee80211_gas_resp_fragment_overlap,
13738      {"GAS Query Response fragment overlap", "wlan_mgt.fixed.fragment.overlap",
13739       FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13740     {&hf_ieee80211_gas_resp_fragment_overlap_conflict,
13741      {"GAS Query Response fragment overlapping with conflicting data",
13742       "wlan_mgt.fixed.fragment.overlap.conflicts",
13743       FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13744     {&hf_ieee80211_gas_resp_fragment_multiple_tails,
13745      {"GAS Query Response has multiple tail fragments",
13746       "wlan_mgt.fixed.fragment.multiple_tails",
13747       FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13748     {&hf_ieee80211_gas_resp_fragment_too_long_fragment,
13749      {"GAS Query Response fragment too long",
13750       "wlan_mgt.fixed.fragment.too_long_fragment",
13751       FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13752     {&hf_ieee80211_gas_resp_fragment_error,
13753      {"GAS Query Response reassembly error", "wlan_mgt.fixed.fragment.error",
13754       FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13755     {&hf_ieee80211_gas_resp_fragment_count,
13756      {"GAS Query Response fragment count", "wlan_mgt.fixed.fragment.count",
13757       FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
13758     {&hf_ieee80211_gas_resp_reassembled_in,
13759      {"Reassembled in", "wlan_mgt.fixed.reassembled.in",
13760       FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13761     {&hf_ieee80211_gas_resp_reassembled_length,
13762      {"Reassembled length", "wlan_mgt.fixed.reassembled.length",
13763       FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
13764
13765     {&hf_ieee80211_ff_anqp_info_id,
13766      {"Info ID", "wlan_mgt.fixed.anqp.info_id",
13767       FT_UINT16, BASE_DEC, VALS(anqp_info_id_vals), 0,
13768       "Access Network Query Protocol Info ID", HFILL }},
13769
13770     {&hf_ieee80211_ff_anqp_info_length,
13771      {"Length", "wlan_mgt.fixed.anqp.info_length",
13772       FT_UINT16, BASE_DEC, NULL, 0, "Access Network Query Protocol Length",
13773       HFILL }},
13774
13775     {&hf_ieee80211_ff_anqp_info,
13776      {"Information", "wlan_mgt.fixed.anqp.info",
13777       FT_BYTES, BASE_NONE, NULL, 0,
13778       "Access Network Query Protocol Information", HFILL }},
13779
13780     {&hf_ieee80211_ff_anqp_query_id,
13781      {"ANQP Query ID", "wlan_mgt.fixed.anqp.query_id",
13782       FT_UINT16, BASE_DEC, VALS(anqp_info_id_vals), 0,
13783       "Access Network Query Protocol Query ID", HFILL }},
13784
13785     {&hf_ieee80211_ff_anqp_capability,
13786      {"ANQP Capability", "wlan_mgt.fixed.anqp.capability",
13787       FT_UINT16, BASE_DEC, VALS(anqp_info_id_vals), 0,
13788       "Access Network Query Protocol Query ID", HFILL }},
13789     {&hf_ieee80211_ff_anqp_capability_vlen,
13790      {"Vendor-specific Capability Length",
13791       "wlan_mgt.fixed.anqp.capability_vlen",
13792       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13793     {&hf_ieee80211_ff_anqp_capability_vendor,
13794      {"Vendor-specific Capability",
13795       "wlan_mgt.fixed.anqp.capability_vendor",
13796       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13797
13798     {&hf_ieee80211_ff_venue_info_group,
13799      {"Venue Group", "wlan_mgt.fixed.venue_info.group",
13800       FT_UINT8, BASE_DEC, VALS(venue_group_vals), 0, NULL, HFILL }},
13801
13802     {&hf_ieee80211_ff_venue_info_type,
13803      {"Venue Type", "wlan_mgt.fixed.venue_info.type",
13804       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13805
13806     {&hf_ieee80211_ff_anqp_venue_length,
13807      {"Venue Name Duple Length", "wlan_mgt.fixed.anqp.venue.length",
13808       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13809
13810     {&hf_ieee80211_ff_anqp_venue_language,
13811      {"Language Code", "wlan_mgt.fixed.anqp.venue.language",
13812       FT_STRING, BASE_NONE, NULL, 0,
13813       "Venue Name Language Code", HFILL }},
13814
13815     {&hf_ieee80211_ff_anqp_venue_name,
13816      {"Venue Name", "wlan_mgt.fixed.anqp.venue.name",
13817       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13818
13819     {&hf_ieee80211_ff_anqp_nw_auth_type_indicator,
13820      {"Network Authentication Type Indicator",
13821       "wlan_mgt.fixed.anqp.nw_auth_type.indicator",
13822       FT_UINT8, BASE_DEC, VALS(nw_auth_type_vals), 0, NULL, HFILL }},
13823
13824     {&hf_ieee80211_ff_anqp_nw_auth_type_url_len,
13825      {"Re-direct URL Length",
13826       "wlan_mgt.fixed.anqp.nw_auth_type.url_len",
13827       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13828
13829     {&hf_ieee80211_ff_anqp_nw_auth_type_url,
13830      {"Re-direct URL", "wlan_mgt.fixed.anqp.nw_auth_type_url",
13831       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13832
13833     {&hf_ieee80211_ff_anqp_roaming_consortium_oi_len,
13834      {"OI Length", "wlan_mgt.fixed.anqp.roaming_consortium.oi_len",
13835       FT_UINT8, BASE_DEC, NULL, 0, "Roaming Consortium OI Length", HFILL }},
13836
13837     {&hf_ieee80211_ff_anqp_roaming_consortium_oi,
13838      {"OI", "wlan_mgt.fixed.anqp.roaming_consortium.oi",
13839       FT_BYTES, BASE_NONE, NULL, 0, "Roaming Consortium OI", HFILL }},
13840
13841     {&hf_ieee80211_ff_anqp_ip_addr_avail_ipv6,
13842      {"IPv6 Address", "wlan_mgt.fixed.anqp.ip_addr_availability.ipv6",
13843       FT_UINT8, BASE_DEC, VALS(ip_addr_avail_ipv6_vals), 0x03,
13844       "IP Address Type Availability information for IPv6", HFILL }},
13845
13846     {&hf_ieee80211_ff_anqp_ip_addr_avail_ipv4,
13847      {"IPv4 Address", "wlan_mgt.fixed.anqp.ip_addr_availability.ipv4",
13848       FT_UINT8, BASE_DEC, VALS(ip_addr_avail_ipv4_vals), 0xfc,
13849       "IP Address Type Availability information for IPv4", HFILL }},
13850
13851     {&hf_ieee80211_ff_anqp_nai_realm_count,
13852      {"NAI Realm Count", "wlan_mgt.fixed.anqp.nai_realm_list.count",
13853       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13854     {&hf_ieee80211_ff_anqp_nai_field_len,
13855      {"NAI Realm Data Field Length",
13856       "wlan_mgt.fixed.anqp.nai_realm_list.field_len",
13857       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13858     {&hf_ieee80211_ff_anqp_nai_realm_encoding,
13859      {"NAI Realm Encoding",
13860       "wlan_mgt.fixed.naqp_nai_realm_list.encoding",
13861       FT_UINT8, BASE_DEC, VALS(nai_realm_encoding_vals), 0x01, NULL, HFILL }},
13862     {&hf_ieee80211_ff_anqp_nai_realm_length,
13863      {"NAI Realm Length",
13864       "wlan_mgt.fixed.naqp_nai_realm_list.realm_length",
13865       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13866     {&hf_ieee80211_ff_anqp_nai_realm,
13867      {"NAI Realm",
13868       "wlan_mgt.fixed.naqp_nai_realm_list.realm",
13869       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13870     {&hf_ieee80211_ff_anqp_nai_realm_eap_count,
13871      {"EAP Method Count",
13872       "wlan_mgt.fixed.naqp_nai_realm_list.eap_method_count",
13873       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13874     {&hf_ieee80211_ff_anqp_nai_realm_eap_len,
13875      {"EAP Method subfield Length",
13876       "wlan_mgt.fixed.naqp_nai_realm_list.eap_method_len",
13877       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13878     {&hf_ieee80211_ff_anqp_nai_realm_eap_method,
13879      {"EAP Method",
13880       "wlan_mgt.fixed.naqp_nai_realm_list.eap_method",
13881       FT_UINT8, BASE_DEC, VALS(eap_type_vals), 0, NULL, HFILL }},
13882     {&hf_ieee80211_ff_anqp_nai_realm_auth_param_count,
13883      {"Authentication Parameter Count",
13884       "wlan_mgt.fixed.naqp_nai_realm_list.auth_param_count",
13885       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13886     {&hf_ieee80211_ff_anqp_nai_realm_auth_param_id,
13887      {"Authentication Parameter ID",
13888       "wlan_mgt.fixed.naqp_nai_realm_list.auth_param_id",
13889       FT_UINT8, BASE_DEC, VALS(nai_realm_auth_param_id_vals),
13890       0, NULL, HFILL }},
13891     {&hf_ieee80211_ff_anqp_nai_realm_auth_param_len,
13892      {"Authentication Parameter Length",
13893       "wlan_mgt.fixed.naqp_nai_realm_list.auth_param_len",
13894       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13895     {&hf_ieee80211_ff_anqp_nai_realm_auth_param_value,
13896      {"Authentication Parameter Value",
13897       "wlan_mgt.fixed.naqp_nai_realm_list.auth_param_value",
13898       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13899
13900     {&hf_ieee80211_3gpp_gc_gud,
13901      {"GUD", "wlan_mgt.fixed.anqp.3gpp_cellular_info.gud",
13902       FT_UINT8, BASE_DEC, NULL, 0,
13903       "Generic container User Data", HFILL }},
13904     {&hf_ieee80211_3gpp_gc_udhl,
13905      {"UDHL", "wlan_mgt.fixed.anqp.3gpp_cellular_info.udhl",
13906       FT_UINT8, BASE_DEC, NULL, 0,
13907       "User Data Header Length", HFILL }},
13908     {&hf_ieee80211_3gpp_gc_iei,
13909      {"IEI", "wlan_mgt.fixed.anqp.3gpp_cellular_info.iei",
13910       FT_UINT8, BASE_DEC, NULL, 0,
13911       "Information Element Identity", HFILL }},
13912     {&hf_ieee80211_3gpp_gc_plmn_len,
13913      {"PLMN Length", "wlan_mgt.fixed.anqp.3gpp_cellular_info.plmn_len",
13914       FT_UINT8, BASE_DEC, NULL, 0,
13915       "Length of PLMN List value contents", HFILL }},
13916     {&hf_ieee80211_3gpp_gc_num_plmns,
13917      {"Number of PLMNs", "wlan_mgt.fixed.anqp.3gpp_cellular_info.num_plmns",
13918       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13919     {&hf_ieee80211_3gpp_gc_plmn,
13920      {"PLMN", "wlan_mgt.fixed.anqp.3gpp_cellular_info.plmn",
13921       FT_STRING, BASE_NONE, NULL, 0,
13922       "PLMN information", HFILL }},
13923
13924     {&hf_ieee80211_ff_anqp_domain_name_len,
13925      {"Domain Name Length", "wlan_mgt.fixed.anqp.domain_name_list.len",
13926       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13927     {&hf_ieee80211_ff_anqp_domain_name,
13928      {"Domain Name", "wlan_mgt.fixed.anqp.domain_name_list.name",
13929       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13930
13931     {&hf_ieee80211_ff_dls_timeout,
13932      {"DLS timeout", "wlan_mgt.fixed.dls_timeout",
13933       FT_UINT16, BASE_HEX, NULL, 0, "DLS timeout value", HFILL }},
13934
13935     {&hf_ieee80211_ff_sa_query_action_code,
13936      {"Action code", "wlan_mgt.fixed.action_code",
13937       FT_UINT8, BASE_DEC, VALS(sa_query_action_codes), 0,
13938       "Management action code", HFILL }},
13939
13940     {&hf_ieee80211_ff_transaction_id,
13941      {"Transaction Id", "wlan_mgt.fixed.transaction_id",
13942       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
13943
13944     {&hf_ieee80211_tag,
13945      {"Tag", "wlan_mgt.tag",
13946       FT_NONE, BASE_NONE, 0x0, 0,
13947       NULL, HFILL }},
13948
13949     {&hf_ieee80211_tag_number,
13950      {"Tag Number", "wlan_mgt.tag.number",
13951       FT_UINT8, BASE_DEC, VALS(tag_num_vals), 0,
13952       "Element ID", HFILL }},
13953
13954     {&hf_ieee80211_tag_length,
13955      {"Tag length", "wlan_mgt.tag.length",
13956       FT_UINT32, BASE_DEC, NULL, 0, "Length of tag", HFILL }},
13957
13958     {&hf_ieee80211_tag_interpretation,
13959      {"Tag interpretation", "wlan_mgt.tag.interpretation",
13960       FT_STRING, BASE_NONE, NULL, 0, "Interpretation of tag", HFILL }},
13961
13962     {&hf_ieee80211_tag_oui,
13963      {"OUI", "wlan_mgt.tag.oui",
13964       FT_UINT24, BASE_CUSTOM, oui_base_custom, 0, "OUI of vendor specific IE", HFILL }},
13965
13966     {&hf_ieee80211_tag_ds_param_channel,
13967      {"Current Channel", "wlan_mgt.ds.current_channel",
13968       FT_UINT8, BASE_DEC, NULL, 0,
13969       "DS Parameter Set - Current Channel", HFILL }},
13970
13971     {&hf_ieee80211_tag_cfp_count,
13972      {"CFP Count", "wlan_mgt.cfp.count",
13973       FT_UINT8, BASE_DEC, NULL, 0,
13974       "Indicates how many delivery traffic indication messages (DTIMs)", HFILL }},
13975
13976     {&hf_ieee80211_tag_cfp_period,
13977      {"CFP Period", "wlan_mgt.cfp.period",
13978       FT_UINT8, BASE_DEC, NULL, 0,
13979       "Indicates the number of DTIM intervals between the start of CFPs", HFILL }},
13980
13981     {&hf_ieee80211_tag_cfp_max_duration,
13982      {"CFP Max Duration", "wlan_mgt.cfp.max_duration",
13983       FT_UINT16, BASE_DEC, NULL, 0,
13984       "Indicates the maximum duration (in TU) of the CFP that may be generated by this PCF", HFILL }},
13985
13986     {&hf_ieee80211_tag_cfp_dur_remaining,
13987      {"CFP Dur Remaining", "wlan_mgt.cfp.dur_remaining",
13988       FT_UINT16, BASE_DEC, NULL, 0,
13989       "Indicates the maximum time (in TU) remaining in the present CFP", HFILL }},
13990
13991     {&hf_ieee80211_tag_vendor_oui_type,
13992      {"Vendor Specific OUI Type", "wlan_mgt.tag.oui.type",
13993       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13994
13995     {&hf_ieee80211_tim_dtim_count,
13996      {"DTIM count", "wlan_mgt.tim.dtim_count",
13997       FT_UINT8, BASE_DEC, NULL, 0,
13998       "Indicates how many Beacon frames (including the current frame) appear before the next DTIM", HFILL }},
13999
14000     {&hf_ieee80211_tim_dtim_period,
14001      {"DTIM period", "wlan_mgt.tim.dtim_period",
14002       FT_UINT8, BASE_DEC, NULL, 0,
14003       "Indicates the number of beacon intervals between successive DTIMs", HFILL }},
14004
14005     {&hf_ieee80211_tim_bmapctl,
14006      {"Bitmap control", "wlan_mgt.tim.bmapctl",
14007       FT_UINT8, BASE_HEX, NULL, 0,
14008       NULL, HFILL }},
14009
14010     {&hf_ieee80211_tim_bmapctl_mcast,
14011      {"Multicast", "wlan_mgt.tim.bmapctl.multicast",
14012       FT_BOOLEAN, 8, NULL, 0x1,
14013       "Contains the Traffic Indicator bit associated with Association ID 0", HFILL }},
14014
14015     {&hf_ieee80211_tim_bmapctl_offset,
14016      {"Bitmap Offset", "wlan_mgt.tim.bmapctl.offset",
14017       FT_UINT8, BASE_HEX, NULL, 0xFE,
14018       NULL, HFILL }},
14019
14020     {&hf_ieee80211_tim_partial_virtual_bitmap,
14021      {"Partial Virtual Bitmap", "wlan_mgt.tim.partial_virtual_bitmap",
14022       FT_BYTES, BASE_NONE, NULL, 0x0,
14023       NULL, HFILL }},
14024
14025     {&hf_ieee80211_tag_ibss_atim_window,
14026      {"Atim Windows", "wlan_mgt.ibss.atim_windows",
14027       FT_UINT16, BASE_HEX, NULL, 0x0,
14028       "Contains the ATIM Window length in TU", HFILL }},
14029
14030     {&hf_ieee80211_tag_country_info_code,
14031      {"Code", "wlan_mgt.country_info.code",
14032       FT_STRING, BASE_NONE, NULL, 0x0,
14033       NULL, HFILL }},
14034
14035     {&hf_ieee80211_tag_country_info_env,
14036      {"Environment", "wlan_mgt.country_info.environment",
14037       FT_UINT8, BASE_HEX, VALS(environment_vals), 0x0,
14038       NULL, HFILL }},
14039
14040     {&hf_ieee80211_tag_country_info_pad,
14041      {"Padding", "wlan_mgt.country_info.padding",
14042       FT_BYTES, BASE_NONE, NULL, 0x0,
14043       NULL, HFILL }},
14044
14045     {&hf_ieee80211_tag_country_info_fnm,
14046      {"Country Info", "wlan_mgt.country_info.fnm",
14047       FT_NONE, BASE_NONE, NULL, 0x0,
14048       NULL, HFILL }},
14049
14050     {&hf_ieee80211_tag_country_info_fnm_fcn,
14051      {"First Channel Number", "wlan_mgt.country_info.fnm.fcn",
14052       FT_UINT8, BASE_DEC, NULL, 0x0,
14053       NULL, HFILL }},
14054
14055     {&hf_ieee80211_tag_country_info_fnm_nc,
14056      {"Number of Channels", "wlan_mgt.country_info.fnm.nc",
14057       FT_UINT8, BASE_DEC, NULL, 0x0,
14058       NULL, HFILL }},
14059
14060     {&hf_ieee80211_tag_country_info_fnm_mtpl,
14061      {"Maximum Transmit Power Level (in dBm)", "wlan_mgt.country_info.fnm.mtpl",
14062       FT_UINT8, BASE_DEC, NULL, 0x0,
14063       NULL, HFILL }},
14064
14065     {&hf_ieee80211_tag_country_info_rrc,
14066      {"Country Info", "wlan_mgt.country_info.rrc",
14067       FT_NONE, BASE_NONE, NULL, 0x0,
14068       NULL, HFILL }},
14069
14070     {&hf_ieee80211_tag_country_info_rrc_rei,
14071      {"Regulatory Extension Identifier", "wlan_mgt.country_info.rrc.rei",
14072       FT_UINT8, BASE_DEC, NULL, 0x0,
14073       NULL, HFILL }},
14074
14075     {&hf_ieee80211_tag_country_info_rrc_rc,
14076      {"Regulatory Class", "wlan_mgt.country_info.rrc.rc",
14077       FT_UINT8, BASE_DEC, NULL, 0x0,
14078       NULL, HFILL }},
14079
14080     {&hf_ieee80211_tag_country_info_rrc_cc,
14081      {"Coverage Class", "wlan_mgt.country_info.rrc.cc",
14082       FT_UINT8, BASE_DEC, NULL, 0x0,
14083       NULL, HFILL }},
14084
14085     {&hf_ieee80211_tag_fh_hopping_parameter_prime_radix,
14086      {"Prime Radix", "wlan_mgt.fh_hopping.parameter.prime_radix",
14087       FT_UINT8, BASE_DEC, NULL, 0x0,
14088       NULL, HFILL }},
14089
14090     {&hf_ieee80211_tag_fh_hopping_parameter_nb_channels,
14091      {"Number of Channels", "wlan_mgt.fh_hopping.parameter.nb_channels",
14092       FT_UINT8, BASE_DEC, NULL, 0x0,
14093       NULL, HFILL }},
14094
14095     {&hf_ieee80211_tag_fh_hopping_table_flag,
14096      {"Flag", "wlan_mgt.fh_hopping.table.flag",
14097       FT_UINT8, BASE_HEX, NULL, 0x0,
14098       "Indicates that a Random Table is present when the value is 1", HFILL }},
14099
14100     {&hf_ieee80211_tag_fh_hopping_table_number_of_sets,
14101      {"Number of Sets", "wlan_mgt.fh_hopping.table.number_of_sets",
14102       FT_UINT8, BASE_DEC, NULL, 0x0,
14103       "Indicates the total number of sets within the hopping patterns", HFILL }},
14104
14105     {&hf_ieee80211_tag_fh_hopping_table_modulus,
14106      {"Modulus", "wlan_mgt.fh_hopping.table.modulus",
14107       FT_UINT8, BASE_HEX, NULL, 0x0,
14108       "Indicate the values to be used in the equations to create a hopping sequence from the Random Table information", HFILL }},
14109
14110     {&hf_ieee80211_tag_fh_hopping_table_offset,
14111      {"Offset", "wlan_mgt.fh_hopping.table.offset",
14112       FT_UINT8, BASE_HEX, NULL, 0x0,
14113       "Indicate the values to be used in the equations to create a hopping sequence from the Random Table information", HFILL }},
14114
14115     {&hf_ieee80211_tag_fh_hopping_random_table,
14116      {"Random Table", "wlan_mgt.fh_hopping.table.random_table",
14117       FT_UINT16, BASE_HEX, NULL, 0x0,
14118       "It is a vector of single octet values that indicate the random sequence to be followed during a hopping sequence", HFILL }},
14119
14120     {&hf_ieee80211_tag_request,
14121      {"Requested Element ID", "wlan_mgt.tag.request",
14122       FT_UINT8, BASE_DEC, VALS(tag_num_vals), 0,
14123       "The list of elements that are to be included in the responding STA Probe Response frame", HFILL }},
14124
14125     {&hf_ieee80211_tclas_up,
14126      {"User Priority", "wlan_mgt.tclas.user_priority",
14127       FT_UINT8, BASE_DEC, NULL, 0,
14128       "Contains the value of the UP of the associated MSDUs", HFILL }},
14129
14130     {&hf_ieee80211_tclas_class_type,
14131      {"Classifier Type", "wlan_mgt.tclas.class_type",
14132       FT_UINT8, BASE_DEC, VALS (classifier_type), 0,
14133       "Specifies the type of classifier parameters", HFILL }},
14134
14135     {&hf_ieee80211_tclas_class_mask,
14136      {"Classifier Mask", "wlan_mgt.tclas.class_mask",
14137       FT_UINT8, BASE_HEX,  NULL, 0,
14138       "Specifies a bitmap where bits that are set to 1 identify a subset of the classifier parameters", HFILL }},
14139
14140     {&hf_ieee80211_tclas_src_mac_addr,
14141      {"Source address", "wlan_mgt.tclas.type",
14142       FT_ETHER, BASE_NONE, NULL, 0,
14143       "Classifier Parameters Ethernet Type", HFILL }},
14144
14145     {&hf_ieee80211_tclas_dst_mac_addr,
14146      {"Destination address", "wlan_mgt.tclas.type",
14147       FT_ETHER, BASE_NONE, NULL, 0,
14148       NULL, HFILL }},
14149
14150     {&hf_ieee80211_tclas_ether_type,
14151      {"Ethernet Type", "wlan_mgt.tclas.type",
14152       FT_UINT8, BASE_DEC, NULL, 0,
14153       NULL, HFILL }},
14154
14155     {&hf_ieee80211_tclas_version,
14156      {"IP Version", "wlan_mgt.tclas.version",
14157       FT_UINT8, BASE_DEC, NULL, 0,
14158       NULL, HFILL }},
14159
14160     {&hf_ieee80211_tclas_ipv4_src,
14161      {"IPv4 Src Addr", "wlan_mgt.tclas.ipv4_src",
14162       FT_IPv4, BASE_NONE, NULL, 0,
14163       NULL, HFILL }},
14164
14165     {&hf_ieee80211_tclas_ipv4_dst,
14166      {"IPv4 Dst Addr", "wlan_mgt.tclas.ipv4_dst",
14167       FT_IPv4, BASE_NONE, NULL, 0,
14168       NULL, HFILL }},
14169
14170     {&hf_ieee80211_tclas_src_port,
14171      {"Source Port", "wlan_mgt.tclas.src_port",
14172       FT_UINT16, BASE_DEC, NULL, 0,
14173       NULL, HFILL }},
14174
14175     {&hf_ieee80211_tclas_dst_port,
14176      {"Destination Port", "wlan_mgt.tclas.dst_port",
14177       FT_UINT16, BASE_DEC, NULL, 0,
14178       NULL, HFILL }},
14179
14180     {&hf_ieee80211_tclas_dscp,
14181      {"IPv4 DSCP", "wlan_mgt.tclas.dscp",
14182       FT_UINT8, BASE_HEX, NULL, 0,
14183     "IPv4 Differentiated Services Code Point (DSCP) Field", HFILL }},
14184
14185     {&hf_ieee80211_tclas_protocol,
14186      {"Protocol", "wlan_mgt.tclas.protocol",
14187       FT_UINT8, BASE_HEX, NULL, 0, "IPv4 Protocol", HFILL }},
14188
14189     {&hf_ieee80211_tclas_ipv6_src,
14190      {"IPv6 Src Addr", "wlan_mgt.tclas.ipv6_src",
14191       FT_IPv6, BASE_NONE,
14192       NULL, 0, NULL, HFILL }},
14193
14194     {&hf_ieee80211_tclas_ipv6_dst,
14195      {"IPv6 Dst Addr", "wlan_mgt.tclas.ipv6_dst",
14196       FT_IPv6, BASE_NONE, NULL, 0,
14197       NULL, HFILL }},
14198
14199     {&hf_ieee80211_tclas_flow,
14200      {"Flow Label", "wlan_mgt.tclas.flow",
14201       FT_UINT24, BASE_HEX, NULL, 0,
14202       "IPv6 Flow Label", HFILL }},
14203
14204     {&hf_ieee80211_tclas_tag_type,
14205      {"802.1Q Tag Type", "wlan_mgt.tclas.tag_type",
14206       FT_UINT16, BASE_HEX, NULL, 0,
14207       NULL, HFILL }},
14208
14209     {&hf_ieee80211_tag_challenge_text,
14210      {"Challenge Text", "wlan_mgt.tag.challenge_text",
14211       FT_BYTES, BASE_NONE, NULL, 0,
14212       NULL, HFILL }},
14213
14214     {&hf_ieee80211_rsn_version,
14215      {"RSN Version", "wlan_mgt.rsn.version", FT_UINT16, BASE_DEC,
14216       NULL, 0, "Indicates the version number of the RSNA protocol", HFILL }},
14217
14218     {&hf_ieee80211_rsn_gcs,
14219      {"Group Cipher Suite", "wlan_mgt.rsn.gcs", FT_UINT32, BASE_CUSTOM,
14220       rsn_gcs_base_custom, 0, "Contains the cipher suite selector used by the BSS to protect broadcast/multicast traffic", HFILL }},
14221
14222     {&hf_ieee80211_rsn_gcs_oui,
14223      {"Group Cipher Suite OUI", "wlan_mgt.rsn.gcs.oui", FT_UINT24, BASE_CUSTOM,
14224       oui_base_custom, 0, NULL, HFILL }},
14225
14226     {&hf_ieee80211_rsn_gcs_type,
14227      {"Group Cipher Suite type", "wlan_mgt.rsn.gcs.type", FT_UINT8, BASE_DEC,
14228       NULL, 0, NULL, HFILL }},
14229
14230     {&hf_ieee80211_rsn_gcs_80211_type,
14231      {"Group Cipher Suite type", "wlan_mgt.rsn.gcs.type", FT_UINT8, BASE_DEC,
14232       VALS(ieee80211_rsn_cipher_vals), 0, NULL, HFILL }},
14233
14234     {&hf_ieee80211_rsn_pcs_count,
14235      {"Pairwise Cipher Suite Count", "wlan_mgt.rsn.pcs.count", FT_UINT16, BASE_DEC,
14236       NULL, 0, "Indicates the number of pairwise cipher suite selectors that are contained in the Pairwise Cipher Suite List", HFILL }},
14237
14238     {&hf_ieee80211_rsn_pcs_list,
14239      {"Pairwise Cipher Suite List", "wlan_mgt.rsn.pcs.list", FT_NONE, BASE_NONE,
14240       NULL, 0, "Contains a series of cipher suite selectors that indicate the pairwisecipher suites", HFILL }},
14241
14242     {&hf_ieee80211_rsn_pcs,
14243      {"Pairwise Cipher Suite", "wlan_mgt.rsn.pcs", FT_UINT32, BASE_CUSTOM,
14244       rsn_pcs_base_custom, 0, NULL, HFILL }},
14245
14246     {&hf_ieee80211_rsn_pcs_oui,
14247      {"Pairwise Cipher Suite OUI", "wlan_mgt.rsn.pcs.oui", FT_UINT24, BASE_CUSTOM,
14248       oui_base_custom, 0, NULL, HFILL }},
14249
14250     {&hf_ieee80211_rsn_pcs_type,
14251      {"Pairwise Cipher Suite type", "wlan_mgt.rsn.pcs.type", FT_UINT8, BASE_DEC,
14252       NULL, 0, NULL, HFILL }},
14253
14254     {&hf_ieee80211_rsn_pcs_80211_type,
14255      {"Pairwise Cipher Suite type", "wlan_mgt.rsn.pcs.type", FT_UINT8, BASE_DEC,
14256       VALS(ieee80211_rsn_cipher_vals), 0, NULL, HFILL }},
14257
14258     {&hf_ieee80211_rsn_akms_count,
14259      {"Auth Key Management (AKM) Suite Count", "wlan_mgt.rsn.akms.count", FT_UINT16, BASE_DEC,
14260       NULL, 0, "Indicates the number of Auth Key Management suite selectors that are contained in the Auth Key Management Suite List", HFILL }},
14261
14262     {&hf_ieee80211_rsn_akms_list,
14263      {"Auth Key Management (AKM) List", "wlan_mgt.rsn.akms.list", FT_NONE, BASE_NONE,
14264       NULL, 0, "Contains a series of cipher suite selectors that indicate the AKM suites", HFILL }},
14265
14266     {&hf_ieee80211_rsn_akms,
14267      {"Auth Key Management (AKM) Suite", "wlan_mgt.rsn.akms", FT_UINT32, BASE_CUSTOM,
14268       rsn_akms_base_custom, 0, NULL, HFILL }},
14269
14270     {&hf_ieee80211_rsn_akms_oui,
14271      {"Auth Key Management (AKM) OUI", "wlan_mgt.rsn.akms.oui", FT_UINT24, BASE_CUSTOM,
14272       oui_base_custom, 0, NULL, HFILL }},
14273
14274     {&hf_ieee80211_rsn_akms_type,
14275      {"Auth Key Management (AKM) type", "wlan_mgt.rsn.akms.type", FT_UINT8, BASE_DEC,
14276       NULL, 0, NULL, HFILL }},
14277
14278     {&hf_ieee80211_rsn_akms_80211_type,
14279      {"Auth Key Management (AKM) type", "wlan_mgt.rsn.akms.type", FT_UINT8, BASE_DEC,
14280       VALS(ieee80211_rsn_keymgmt_vals), 0, NULL, HFILL }},
14281
14282     {&hf_ieee80211_rsn_cap,
14283      {"RSN Capabilities", "wlan_mgt.rsn.capabilities", FT_UINT16, BASE_HEX,
14284       NULL, 0, "RSN Capability information", HFILL }},
14285
14286     {&hf_ieee80211_rsn_cap_preauth,
14287      {"RSN Pre-Auth capabilities", "wlan_mgt.rsn.capabilities.preauth",
14288       FT_BOOLEAN, 16, TFS(&rsn_preauth_flags), 0x0001,
14289       NULL, HFILL }},
14290
14291     {&hf_ieee80211_rsn_cap_no_pairwise,
14292      {"RSN No Pairwise capabilities", "wlan_mgt.rsn.capabilities.no_pairwise",
14293       FT_BOOLEAN, 16, TFS(&rsn_no_pairwise_flags), 0x0002,
14294       NULL, HFILL }},
14295
14296     {&hf_ieee80211_rsn_cap_ptksa_replay_counter,
14297      {"RSN PTKSA Replay Counter capabilities",
14298       "wlan_mgt.rsn.capabilities.ptksa_replay_counter",
14299       FT_UINT16, BASE_HEX, VALS(rsn_cap_replay_counter), 0x000C,
14300       NULL, HFILL }},
14301
14302     {&hf_ieee80211_rsn_cap_gtksa_replay_counter,
14303      {"RSN GTKSA Replay Counter capabilities",
14304       "wlan_mgt.rsn.capabilities.gtksa_replay_counter",
14305       FT_UINT16, BASE_HEX, VALS(rsn_cap_replay_counter), 0x0030,
14306       NULL, HFILL }},
14307
14308     {&hf_ieee80211_rsn_cap_mfpr,
14309      {"Management Frame Protection Required",
14310       "wlan_mgt.rsn.capabilities.mfpr",
14311       FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }},
14312
14313     {&hf_ieee80211_rsn_cap_mfpc,
14314      {"Management Frame Protection Capable",
14315       "wlan_mgt.rsn.capabilities.mfpc",
14316       FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL }},
14317
14318     {&hf_ieee80211_rsn_cap_peerkey,
14319      {"PeerKey Enabled",
14320       "wlan_mgt.rsn.capabilities.peerkey",
14321       FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL }},
14322
14323     {&hf_ieee80211_rsn_pmkid_count,
14324      {"PMKID Count", "wlan_mgt.rsn.pmkid.count", FT_UINT16, BASE_DEC,
14325       NULL, 0, "Indicates the number of PMKID  selectors that are contained in the PMKID Suite List", HFILL }},
14326
14327     {&hf_ieee80211_rsn_pmkid_list,
14328      {"PMKID List", "wlan_mgt.rsn.pmkid.list", FT_NONE, BASE_NONE,
14329       NULL, 0, "Contains a series of cipher suite selectors that indicate the AKM suites", HFILL }},
14330
14331     {&hf_ieee80211_rsn_pmkid,
14332      {"PMKID", "wlan_mgt.pmkid.akms", FT_BYTES, BASE_NONE,
14333       NULL, 0, NULL, HFILL }},
14334
14335     {&hf_ieee80211_rsn_gmcs,
14336      {"Group Managemement Cipher Suite", "wlan_mgt.rsn.gmcs", FT_UINT32, BASE_CUSTOM,
14337       rsn_gmcs_base_custom, 0, "Contains the cipher suite selector used by the BSS to protect broadcast/multicast traffic", HFILL }},
14338
14339     {&hf_ieee80211_rsn_gmcs_oui,
14340      {"Group Managemement Cipher Suite OUI", "wlan_mgt.rsn.gmcs.oui", FT_UINT24, BASE_CUSTOM,
14341       oui_base_custom, 0, NULL, HFILL }},
14342
14343     {&hf_ieee80211_rsn_gmcs_type,
14344      {"Group Managemement Cipher Suite type", "wlan_mgt.rsn.gmcs.type", FT_UINT8, BASE_DEC,
14345       NULL, 0, NULL, HFILL }},
14346
14347     {&hf_ieee80211_rsn_gmcs_80211_type,
14348      {"Group Managemement Cipher Suite type", "wlan_mgt.rsn.gmcs.type", FT_UINT8, BASE_DEC,
14349       VALS(ieee80211_rsn_cipher_vals), 0, NULL, HFILL }},
14350
14351
14352     {&hf_ieee80211_ht_cap,
14353      {"HT Capabilities Info", "wlan_mgt.ht.capabilities", FT_UINT16, BASE_HEX,
14354       NULL, 0, "HT Capability information", HFILL }},
14355
14356     {&hf_ieee80211_ht_vs_cap,
14357      {"HT Capabilities Info (VS)", "wlan_mgt.vs.ht.capabilities", FT_UINT16, BASE_HEX,
14358       NULL, 0, "Vendor Specific HT Capability information", HFILL }},
14359
14360     {&hf_ieee80211_ht_ldpc_coding,
14361      {"HT LDPC coding capability", "wlan_mgt.ht.capabilities.ldpccoding",
14362       FT_BOOLEAN, 16, TFS (&ht_ldpc_coding_flag), 0x0001,
14363       NULL, HFILL }},
14364
14365     {&hf_ieee80211_ht_chan_width,
14366      {"HT Support channel width", "wlan_mgt.ht.capabilities.width",
14367       FT_BOOLEAN, 16, TFS (&ht_chan_width_flag), 0x0002,
14368       NULL, HFILL }},
14369
14370     {&hf_ieee80211_ht_sm_pwsave,
14371      {"HT SM Power Save", "wlan_mgt.ht.capabilities.sm",
14372       FT_UINT16, BASE_HEX, VALS (&ht_sm_pwsave_flag), 0x000c,
14373       NULL, HFILL }},
14374
14375     {&hf_ieee80211_ht_green,
14376      {"HT Green Field", "wlan_mgt.ht.capabilities.green",
14377       FT_BOOLEAN, 16, TFS (&ht_green_flag), 0x0010,
14378       NULL, HFILL }},
14379
14380     {&hf_ieee80211_ht_short20,
14381      {"HT Short GI for 20MHz", "wlan_mgt.ht.capabilities.short20",
14382       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0020,
14383       NULL, HFILL }},
14384
14385     {&hf_ieee80211_ht_short40,
14386      {"HT Short GI for 40MHz", "wlan_mgt.ht.capabilities.short40",
14387       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0040,
14388       NULL, HFILL }},
14389
14390     {&hf_ieee80211_ht_tx_stbc,
14391      {"HT Tx STBC", "wlan_mgt.ht.capabilities.txstbc",
14392       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0080,
14393       NULL, HFILL }},
14394
14395     {&hf_ieee80211_ht_rx_stbc,
14396      {"HT Rx STBC", "wlan_mgt.ht.capabilities.rxstbc",
14397       FT_UINT16, BASE_HEX, VALS (&ht_rx_stbc_flag), 0x0300,
14398       "HT Tx STBC", HFILL }},
14399
14400     {&hf_ieee80211_ht_delayed_block_ack,
14401      {"HT Delayed Block ACK", "wlan_mgt.ht.capabilities.delayedblockack",
14402       FT_BOOLEAN, 16, TFS (&ht_delayed_block_ack_flag), 0x0400,
14403       NULL, HFILL }},
14404
14405     {&hf_ieee80211_ht_max_amsdu,
14406      {"HT Max A-MSDU length", "wlan_mgt.ht.capabilities.amsdu",
14407       FT_BOOLEAN, 16, TFS (&ht_max_amsdu_flag), 0x0800,
14408       NULL, HFILL }},
14409
14410     {&hf_ieee80211_ht_dss_cck_40,
14411      {"HT DSSS/CCK mode in 40MHz", "wlan_mgt.ht.capabilities.dsscck",
14412       FT_BOOLEAN, 16, TFS (&ht_dss_cck_40_flag), 0x1000,
14413       "HT DSS/CCK mode in 40MHz", HFILL }},
14414
14415     {&hf_ieee80211_ht_psmp,
14416      {"HT PSMP Support", "wlan_mgt.ht.capabilities.psmp",
14417       FT_BOOLEAN, 16, TFS (&ht_psmp_flag), 0x2000,
14418       NULL, HFILL }},
14419
14420     {&hf_ieee80211_ht_40_mhz_intolerant,
14421      {"HT Forty MHz Intolerant", "wlan_mgt.ht.capabilities.40mhzintolerant",
14422       FT_BOOLEAN, 16, TFS (&ht_40_mhz_intolerant_flag), 0x4000,
14423       NULL, HFILL }},
14424
14425     {&hf_ieee80211_ht_l_sig,
14426      {"HT L-SIG TXOP Protection support", "wlan_mgt.ht.capabilities.lsig",
14427       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x8000,
14428       NULL, HFILL }},
14429
14430     {&hf_ieee80211_ampduparam,
14431      {"A-MPDU Parameters", "wlan_mgt.ht.ampduparam", FT_UINT16, BASE_HEX,
14432       NULL, 0, NULL, HFILL }},
14433
14434     {&hf_ieee80211_ampduparam_vs,
14435      {"A-MPDU Parameters (VS)", "wlan_mgt.vs.ht.ampduparam", FT_UINT16, BASE_HEX,
14436       NULL, 0, "Vendor Specific A-MPDU Parameters", HFILL }},
14437
14438     {&hf_ieee80211_ampduparam_mpdu,
14439      {"Maximum Rx A-MPDU Length", "wlan_mgt.ht.ampduparam.maxlength",
14440       FT_UINT8, BASE_HEX, 0, 0x03,
14441       NULL, HFILL }},
14442
14443     {&hf_ieee80211_ampduparam_mpdu_start_spacing,
14444      {"MPDU Density", "wlan_mgt.ht.ampduparam.mpdudensity",
14445       FT_UINT8, BASE_HEX, VALS(&ampduparam_mpdu_start_spacing_flags), 0x1c,
14446       NULL, HFILL }},
14447
14448     {&hf_ieee80211_ampduparam_reserved,
14449      {"Reserved", "wlan_mgt.ht.ampduparam.reserved",
14450       FT_UINT8, BASE_HEX, NULL, 0xE0,
14451       NULL, HFILL }},
14452
14453     {&hf_ieee80211_mcsset,
14454      {"Rx Supported Modulation and Coding Scheme Set", "wlan_mgt.ht.mcsset",
14455       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
14456
14457     {&hf_ieee80211_mcsset_vs,
14458      {"Rx Supported Modulation and Coding Scheme Set (VS)", "wlan_mgt.vs.ht.mcsset",
14459       FT_STRING, BASE_NONE, NULL, 0, "Vendor Specific Rx Supported Modulation and Coding Scheme Set", HFILL }},
14460
14461     {&hf_ieee80211_mcsset_rx_bitmask,
14462      {"Rx Modulation and Coding Scheme (One bit per modulation)", "wlan_mgt.ht.mcsset.rxbitmask",
14463       FT_NONE, BASE_NONE, NULL, 0, "One bit per modulation", HFILL }},
14464
14465     {&hf_ieee80211_mcsset_rx_bitmask_0to7,
14466      {"Rx Bitmask Bits 0-7", "wlan_mgt.ht.mcsset.rxbitmask.0to7",
14467       FT_UINT32, BASE_HEX, 0, 0x000000ff, NULL, HFILL }},
14468
14469     {&hf_ieee80211_mcsset_rx_bitmask_8to15,
14470      {"Rx Bitmask Bits 8-15", "wlan_mgt.ht.mcsset.rxbitmask.8to15",
14471       FT_UINT32, BASE_HEX, 0, 0x0000ff00, NULL, HFILL }},
14472
14473     {&hf_ieee80211_mcsset_rx_bitmask_16to23,
14474      {"Rx Bitmask Bits 16-23", "wlan_mgt.ht.mcsset.rxbitmask.16to23",
14475       FT_UINT32, BASE_HEX, 0, 0x00ff0000, NULL, HFILL }},
14476
14477     {&hf_ieee80211_mcsset_rx_bitmask_24to31,
14478      {"Rx Bitmask Bits 24-31", "wlan_mgt.ht.mcsset.rxbitmask.24to31",
14479       FT_UINT32, BASE_HEX, 0, 0xff000000, NULL, HFILL }},
14480
14481     {&hf_ieee80211_mcsset_rx_bitmask_32,
14482      {"Rx Bitmask Bit 32", "wlan_mgt.ht.mcsset.rxbitmask.32",
14483       FT_UINT32, BASE_HEX, 0, 0x000001, NULL, HFILL }},
14484
14485     {&hf_ieee80211_mcsset_rx_bitmask_33to38,
14486      {"Rx Bitmask Bits 33-38", "wlan_mgt.ht.mcsset.rxbitmask.33to38",
14487       FT_UINT32, BASE_HEX, 0, 0x00007e, NULL, HFILL }},
14488
14489     {&hf_ieee80211_mcsset_rx_bitmask_39to52,
14490      {"Rx Bitmask Bits 39-52", "wlan_mgt.ht.mcsset.rxbitmask.39to52",
14491       FT_UINT32, BASE_HEX, 0, 0x1fff80, NULL, HFILL }},
14492
14493     {&hf_ieee80211_mcsset_rx_bitmask_53to76,
14494      {"Rx Bitmask Bits 53-76", "wlan_mgt.ht.mcsset.rxbitmask.53to76",
14495       FT_UINT32, BASE_HEX, 0, 0x1fffffe0, NULL, HFILL }},
14496
14497     {&hf_ieee80211_mcsset_highest_data_rate,
14498      {"Highest Supported Data Rate", "wlan_mgt.ht.mcsset.highestdatarate",
14499       FT_UINT16, BASE_HEX, 0, 0x03ff, NULL, HFILL }},
14500
14501     {&hf_ieee80211_mcsset_tx_mcs_set_defined,
14502      {"Tx Supported MCS Set", "wlan_mgt.ht.mcsset.txsetdefined",
14503       FT_BOOLEAN, 16, TFS (&mcsset_tx_mcs_set_defined_flag), 0x0001,
14504       NULL, HFILL }},
14505
14506     {&hf_ieee80211_mcsset_tx_rx_mcs_set_not_equal,
14507      {"Tx and Rx MCS Set", "wlan_mgt.ht.mcsset.txrxmcsnotequal",
14508       FT_BOOLEAN, 16, TFS (&mcsset_tx_rx_mcs_set_not_equal_flag), 0x0002,
14509       NULL, HFILL }},
14510
14511     {&hf_ieee80211_mcsset_tx_max_spatial_streams,
14512      {"Tx Maximum Number of Spatial Streams Supported", "wlan_mgt.ht.mcsset.txmaxss",
14513       FT_UINT16, BASE_HEX, VALS (&mcsset_tx_max_spatial_streams_flags) , 0x000c,
14514       NULL, HFILL }},
14515
14516     {&hf_ieee80211_mcsset_tx_unequal_modulation,
14517      {"Unequal Modulation", "wlan_mgt.ht.mcsset.txunequalmod",
14518       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0010,
14519       NULL, HFILL }},
14520
14521     {&hf_ieee80211_htex_cap,
14522      {"HT Extended Capabilities", "wlan_mgt.htex.capabilities", FT_UINT16, BASE_HEX,
14523       NULL, 0, "HT Extended Capability information", HFILL }},
14524
14525     {&hf_ieee80211_htex_vs_cap,
14526      {"HT Extended Capabilities (VS)", "wlan_mgt.vs.htex.capabilities", FT_UINT16, BASE_HEX,
14527       NULL, 0, "Vendor Specific HT Extended Capability information", HFILL }},
14528
14529     {&hf_ieee80211_htex_pco,
14530      {"Transmitter supports PCO", "wlan_mgt.htex.capabilities.pco",
14531       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0001,
14532       NULL, HFILL }},
14533
14534     {&hf_ieee80211_htex_transtime,
14535      {"Time needed to transition between 20MHz and 40MHz", "wlan_mgt.htex.capabilities.transtime",
14536       FT_UINT16, BASE_HEX, VALS (&htex_transtime_flags), 0x0006,
14537       NULL, HFILL }},
14538
14539     {&hf_ieee80211_htex_mcs,
14540      {"MCS Feedback capability", "wlan_mgt.htex.capabilities.mcs",
14541       FT_UINT16, BASE_HEX, VALS (&htex_mcs_flags), 0x0300,
14542       NULL, HFILL }},
14543
14544     {&hf_ieee80211_htex_htc_support,
14545      {"High Throughput", "wlan_mgt.htex.capabilities.htc",
14546       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0400,
14547       NULL, HFILL }},
14548
14549     {&hf_ieee80211_htex_rd_responder,
14550      {"Reverse Direction Responder", "wlan_mgt.htex.capabilities.rdresponder",
14551       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0800,
14552       NULL, HFILL }},
14553
14554     {&hf_ieee80211_txbf,
14555      {"Transmit Beam Forming (TxBF) Capabilities", "wlan_mgt.txbf", FT_UINT16, BASE_HEX,
14556       NULL, 0, NULL, HFILL }},
14557
14558     {&hf_ieee80211_txbf_vs,
14559      {"Transmit Beam Forming (TxBF) Capabilities (VS)", "wlan_mgt.vs.txbf", FT_UINT16, BASE_HEX,
14560       NULL, 0, "Vendor Specific Transmit Beam Forming (TxBF) Capabilities", HFILL }},
14561
14562     {&hf_ieee80211_txbf_cap,
14563      {"Transmit Beamforming", "wlan_mgt.txbf.txbf",
14564       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000001,
14565       NULL, HFILL }},
14566
14567     {&hf_ieee80211_txbf_rcv_ssc,
14568      {"Receive Staggered Sounding", "wlan_mgt.txbf.rxss",
14569       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000002,
14570       NULL, HFILL }},
14571
14572     {&hf_ieee80211_txbf_tx_ssc,
14573      {"Transmit Staggered Sounding", "wlan_mgt.txbf.txss",
14574       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000004,
14575       NULL, HFILL }},
14576
14577     {&hf_ieee80211_txbf_rcv_ndp,
14578      {"Receive Null Data packet (NDP)", "wlan_mgt.txbf.rxndp",
14579       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000008,
14580       NULL, HFILL }},
14581
14582     {&hf_ieee80211_txbf_tx_ndp,
14583      {"Transmit Null Data packet (NDP)", "wlan_mgt.txbf.txndp",
14584       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000010,
14585       NULL, HFILL }},
14586
14587     {&hf_ieee80211_txbf_impl_txbf,
14588      {"Implicit TxBF capable", "wlan_mgt.txbf.impltxbf",
14589       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000020,
14590       "Implicit Transmit Beamforming (TxBF) capable", HFILL }},
14591
14592     {&hf_ieee80211_txbf_calib,
14593      {"Calibration", "wlan_mgt.txbf.calibration",
14594       FT_UINT32, BASE_HEX, VALS (&txbf_calib_flag), 0x000000c0,
14595       NULL, HFILL }},
14596
14597     {&hf_ieee80211_txbf_expl_csi,
14598      {"STA can apply TxBF using CSI explicit feedback", "wlan_mgt.txbf.csi",
14599       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000100,
14600       "Station can apply TxBF using CSI explicit feedback", HFILL }},
14601
14602     {&hf_ieee80211_txbf_expl_uncomp_fm,
14603      {"STA can apply TxBF using uncompressed beamforming feedback matrix", "wlan_mgt.txbf.fm.uncompressed.tbf",
14604       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000200,
14605       "Station can apply TxBF using uncompressed beamforming feedback matrix", HFILL }},
14606
14607     {&hf_ieee80211_txbf_expl_comp_fm,
14608      {"STA can apply TxBF using compressed beamforming feedback matrix", "wlan_mgt.txbf.fm.compressed.tbf",
14609       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000400,
14610       "Station can apply TxBF using compressed beamforming feedback matrix", HFILL }},
14611
14612     {&hf_ieee80211_txbf_expl_bf_csi,
14613      {"Receiver can return explicit CSI feedback", "wlan_mgt.txbf.rcsi",
14614       FT_UINT32, BASE_HEX, VALS (&txbf_feedback_flags), 0x00001800,
14615       NULL, HFILL }},
14616
14617     {&hf_ieee80211_txbf_expl_uncomp_fm_feed,
14618      {"Receiver can return explicit uncompressed Beamforming Feedback Matrix", "wlan_mgt.txbf.fm.uncompressed.rbf",
14619       FT_UINT32, BASE_HEX, VALS (&txbf_feedback_flags), 0x00006000,
14620       NULL, HFILL }},
14621
14622     {&hf_ieee80211_txbf_expl_comp_fm_feed,
14623      {"STA can compress and use compressed Beamforming Feedback Matrix", "wlan_mgt.txbf.fm.compressed.bf",
14624       FT_UINT32, BASE_HEX, VALS (&txbf_feedback_flags), 0x00018000,
14625       "Station can compress and use compressed Beamforming Feedback Matrix", HFILL }},
14626
14627     {&hf_ieee80211_txbf_min_group,
14628      {"Minimal grouping used for explicit feedback reports", "wlan_mgt.txbf.mingroup",
14629       FT_UINT32, BASE_HEX, VALS (&txbf_min_group_flags), 0x00060000,
14630       NULL, HFILL }},
14631
14632     {&hf_ieee80211_txbf_csi_num_bf_ant,
14633      {"Max antennae STA can support when CSI feedback required", "wlan_mgt.txbf.csinumant",
14634       FT_UINT32, BASE_HEX, VALS (&txbf_antenna_flags), 0x00180000,
14635       "Max antennae station can support when CSI feedback required", HFILL }},
14636
14637     {&hf_ieee80211_txbf_uncomp_sm_bf_ant,
14638      {"Max antennae STA can support when uncompressed Beamforming feedback required", "wlan_mgt.txbf.fm.uncompressed.maxant",
14639       FT_UINT32, BASE_HEX, VALS (&txbf_antenna_flags), 0x00600000,
14640       "Max antennae station can support when uncompressed Beamforming feedback required", HFILL }},
14641
14642     {&hf_ieee80211_txbf_comp_sm_bf_ant,
14643      {"Max antennae STA can support when compressed Beamforming feedback required", "wlan_mgt.txbf.fm.compressed.maxant",
14644       FT_UINT32, BASE_HEX, VALS (&txbf_antenna_flags), 0x01800000,
14645       "Max antennae station can support when compressed Beamforming feedback required", HFILL }},
14646
14647     {&hf_ieee80211_txbf_csi_max_rows_bf,
14648      {"Maximum number of rows of CSI explicit feedback", "wlan_mgt.txbf.csi.maxrows",
14649       FT_UINT32, BASE_HEX, VALS (&txbf_csi_max_rows_bf_flags), 0x06000000,
14650       NULL, HFILL }},
14651
14652     {&hf_ieee80211_txbf_chan_est,
14653      {"Maximum number of space time streams for which channel dimensions can be simultaneously estimated", "wlan_mgt.txbf.channelest",
14654       FT_UINT32, BASE_HEX, VALS (&txbf_chan_est_flags), 0x18000000,
14655       NULL, HFILL }},
14656
14657     {&hf_ieee80211_txbf_resrv,
14658      {"Reserved", "wlan_mgt.txbf.reserved",
14659       FT_UINT32, BASE_HEX, NULL, 0xe0000000,
14660       NULL, HFILL }},
14661
14662     {&hf_ieee80211_hta_cc,
14663      {"HT Control Channel", "wlan_mgt.hta.control_channel", FT_UINT8, BASE_DEC,
14664       NULL, 0, NULL, HFILL }},
14665
14666     {&hf_ieee80211_hta_cap,
14667      {"HT Additional Capabilities", "wlan_mgt.hta.capabilities", FT_UINT16, BASE_HEX,
14668       NULL, 0, "HT Additional Capability information", HFILL }},
14669
14670     {&hf_ieee80211_hta_ext_chan_offset,
14671      {"Extension Channel Offset", "wlan_mgt.hta.capabilities.extchan",
14672       FT_UINT16, BASE_HEX, VALS (&hta_ext_chan_offset_flag), 0x0003,
14673       NULL, HFILL }},
14674
14675     {&hf_ieee80211_hta_rec_tx_width,
14676      {"Recommended Tx Channel Width", "wlan_mgt.hta.capabilities.rectxwidth",
14677       FT_BOOLEAN, 16, TFS (&hta_rec_tx_width_flag), 0x0004,
14678       "Recommended Transmit Channel Width", HFILL }},
14679
14680     {&hf_ieee80211_hta_rifs_mode,
14681      {"Reduced Interframe Spacing (RIFS) Mode", "wlan_mgt.hta.capabilities.rifsmode",
14682       FT_BOOLEAN, 16, TFS (&hta_rifs_mode_flag), 0x0008,
14683       NULL, HFILL }},
14684
14685     {&hf_ieee80211_hta_controlled_access,
14686      {"Controlled Access Only", "wlan_mgt.hta.capabilities.controlledaccess",
14687       FT_BOOLEAN, 16, TFS (&hta_controlled_access_flag), 0x0010,
14688       NULL, HFILL }},
14689
14690     {&hf_ieee80211_hta_service_interval,
14691      {"Service Interval Granularity", "wlan_mgt.hta.capabilities.serviceinterval",
14692       FT_UINT16, BASE_HEX, VALS (&hta_service_interval_flag), 0x00E0,
14693       NULL, HFILL }},
14694
14695     {&hf_ieee80211_hta_operating_mode,
14696      {"Operating Mode", "wlan_mgt.hta.capabilities.operatingmode",
14697       FT_UINT16, BASE_HEX, VALS (&hta_operating_mode_flag), 0x0003,
14698       NULL, HFILL }},
14699
14700     {&hf_ieee80211_hta_non_gf_devices,
14701      {"Non Greenfield (GF) devices Present", "wlan_mgt.hta.capabilities.nongfdevices",
14702       FT_BOOLEAN, 16, TFS (&hta_non_gf_devices_flag), 0x0004,
14703       "on Greenfield (GF) devices Present", HFILL }},
14704
14705     {&hf_ieee80211_hta_basic_stbc_mcs,
14706      {"Basic STB Modulation and Coding Scheme (MCS)", "wlan_mgt.hta.capabilities.",
14707       FT_UINT16, BASE_HEX, NULL , 0x007f,
14708       NULL, HFILL }},
14709
14710     {&hf_ieee80211_hta_dual_stbc_protection,
14711      {"Dual Clear To Send (CTS) Protection", "wlan_mgt.hta.capabilities.",
14712       FT_BOOLEAN, 16, TFS (&hta_dual_stbc_protection_flag), 0x0080,
14713       NULL, HFILL }},
14714
14715     {&hf_ieee80211_hta_secondary_beacon,
14716      {"Secondary Beacon", "wlan_mgt.hta.capabilities.",
14717       FT_BOOLEAN, 16, TFS (&hta_secondary_beacon_flag), 0x0100,
14718       NULL, HFILL }},
14719
14720     {&hf_ieee80211_hta_lsig_txop_protection,
14721      {"L-SIG TXOP Protection Support", "wlan_mgt.hta.capabilities.",
14722       FT_BOOLEAN, 16, TFS (&hta_lsig_txop_protection_flag), 0x0200,
14723       NULL, HFILL }},
14724
14725     {&hf_ieee80211_hta_pco_active,
14726      {"Phased Coexistence Operation (PCO) Active", "wlan_mgt.hta.capabilities.",
14727       FT_BOOLEAN, 16, TFS (&hta_pco_active_flag), 0x0400,
14728       NULL, HFILL }},
14729
14730     {&hf_ieee80211_hta_pco_phase,
14731      {"Phased Coexistence Operation (PCO) Phase", "wlan_mgt.hta.capabilities.",
14732       FT_BOOLEAN, 16, TFS (&hta_pco_phase_flag), 0x0800,
14733       NULL, HFILL }},
14734
14735     {&hf_ieee80211_antsel,
14736      {"Antenna Selection (ASEL) Capabilities", "wlan_mgt.asel",
14737       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14738
14739     {&hf_ieee80211_antsel_vs,
14740      {"Antenna Selection (ASEL) Capabilities (VS)", "wlan_mgt.vs.asel",
14741       FT_UINT8, BASE_HEX, NULL, 0, "Vendor Specific Antenna Selection (ASEL) Capabilities", HFILL }},
14742
14743     {&hf_ieee80211_antsel_b0,
14744      {"Antenna Selection Capable", "wlan_mgt.asel.capable",
14745       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x01, NULL, HFILL }},
14746
14747     {&hf_ieee80211_antsel_b1,
14748      {"Explicit CSI Feedback Based Tx ASEL", "wlan_mgt.asel.txcsi",
14749       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x02, NULL, HFILL }},
14750
14751     {&hf_ieee80211_antsel_b2,
14752      {"Antenna Indices Feedback Based Tx ASEL", "wlan_mgt.asel.txif",
14753       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x04, NULL, HFILL }},
14754
14755     {&hf_ieee80211_antsel_b3,
14756      {"Explicit CSI Feedback", "wlan_mgt.asel.csi",
14757       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x08, NULL, HFILL }},
14758
14759     {&hf_ieee80211_antsel_b4,
14760      {"Antenna Indices Feedback", "wlan_mgt.asel.if",
14761       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x10, NULL, HFILL }},
14762
14763     {&hf_ieee80211_antsel_b5,
14764      {"Rx ASEL", "wlan_mgt.asel.rx",
14765       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x20, NULL, HFILL }},
14766
14767     {&hf_ieee80211_antsel_b6,
14768      {"Tx Sounding PPDUs", "wlan_mgt.asel.sppdu",
14769       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x40, NULL, HFILL }},
14770
14771     {&hf_ieee80211_antsel_b7,
14772      {"Reserved", "wlan_mgt.asel.reserved",
14773       FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL }},
14774
14775     {&hf_ieee80211_ht_info_delimiter1,
14776      {"HT Information Delimiter #1", "wlan_mgt.ht.info.delim1",
14777       FT_UINT8, BASE_HEX, NULL, 0xff, NULL, HFILL }},
14778
14779     {&hf_ieee80211_ht_info_primary_channel,
14780      {"Primary Channel", "wlan_mgt.ht.info.primarychannel",
14781       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14782
14783     {&hf_ieee80211_ht_info_secondary_channel_offset,
14784      {"Secondary channel offset", "wlan_mgt.ht.info.secchanoffset",
14785       FT_UINT8, BASE_HEX, VALS (&ht_info_secondary_channel_offset_flags), 0x03, NULL, HFILL }},
14786
14787     {&hf_ieee80211_ht_info_channel_width,
14788      {"Supported channel width", "wlan_mgt.ht.info.chanwidth",
14789       FT_BOOLEAN, 8, TFS (&ht_info_channel_width_flag), 0x04, NULL, HFILL }},
14790
14791     {&hf_ieee80211_ht_info_rifs_mode,
14792      {"Reduced Interframe Spacing (RIFS)", "wlan_mgt.ht.info.rifs",
14793       FT_BOOLEAN, 8, TFS (&ht_info_rifs_mode_flag), 0x08, NULL, HFILL }},
14794
14795     {&hf_ieee80211_ht_info_psmp_stas_only,
14796      {"Power Save Multi-Poll (PSMP) stations only", "wlan_mgt.ht.info.psmponly",
14797       FT_BOOLEAN, 8, TFS (&ht_info_psmp_stas_only_flag), 0x10, NULL, HFILL }},
14798
14799     {&hf_ieee80211_ht_info_service_interval_granularity,
14800      {"Shortest service interval", "wlan_mgt.ht.info.",
14801       FT_UINT8, BASE_HEX, VALS (&ht_info_service_interval_granularity_flags), 0xe0, NULL, HFILL }},
14802
14803     {&hf_ieee80211_ht_info_delimiter2,
14804      {"HT Information Delimiter #2", "wlan_mgt.ht.info.delim2",
14805       FT_UINT16, BASE_HEX, NULL, 0xffff, NULL, HFILL }},
14806
14807     {&hf_ieee80211_ht_info_operating_mode,
14808      {"Operating mode of BSS", "wlan_mgt.ht.info.operatingmode",
14809       FT_UINT16, BASE_HEX, VALS (&ht_info_operating_mode_flags), 0x0003, NULL, HFILL }},
14810
14811     {&hf_ieee80211_ht_info_non_greenfield_sta_present,
14812      {"Non-greenfield STAs present", "wlan_mgt.ht.info.greenfield",
14813       FT_BOOLEAN, 16, TFS (&ht_info_non_greenfield_sta_present_flag), 0x0004, NULL, HFILL }},
14814
14815     {&hf_ieee80211_ht_info_transmit_burst_limit,
14816      {"Transmit burst limit", "wlan_mgt.ht.info.burstlim",
14817       FT_BOOLEAN, 16, TFS (&ht_info_transmit_burst_limit_flag), 0x0008, NULL, HFILL }},
14818
14819     {&hf_ieee80211_ht_info_obss_non_ht_stas_present,
14820      {"OBSS non-HT STAs present", "wlan_mgt.ht.info.obssnonht",
14821       FT_BOOLEAN, 16, TFS (&ht_info_obss_non_ht_stas_present_flag), 0x0010, NULL, HFILL }},
14822
14823     {&hf_ieee80211_ht_info_reserved_1,
14824      {"Reserved", "wlan_mgt.ht.info.reserved1",
14825       FT_UINT16, BASE_HEX, NULL, 0xffe0, NULL, HFILL }},
14826
14827     {&hf_ieee80211_ht_info_delimiter3,
14828      {"HT Information Delimiter #3", "wlan_mgt.ht.info.delim3",
14829       FT_UINT16, BASE_HEX, NULL, 0xffff, NULL, HFILL }},
14830
14831     {&hf_ieee80211_ht_info_reserved_2,
14832      {"Reserved", "wlan_mgt.ht.info.reserved2",
14833       FT_UINT16, BASE_HEX, NULL, 0x003f, NULL, HFILL }},
14834
14835     {&hf_ieee80211_ht_info_dual_beacon,
14836      {"Dual beacon", "wlan_mgt.ht.info.dualbeacon",
14837       FT_BOOLEAN, 16, TFS (&ht_info_dual_beacon_flag), 0x0040, NULL, HFILL }},
14838
14839     {&hf_ieee80211_ht_info_dual_cts_protection,
14840      {"Dual Clear To Send (CTS) protection", "wlan_mgt.ht.info.dualcts",
14841       FT_BOOLEAN, 16, TFS (&ht_info_dual_cts_protection_flag), 0x0080, NULL, HFILL }},
14842
14843     {&hf_ieee80211_ht_info_secondary_beacon,
14844      {"Beacon ID", "wlan_mgt.ht.info.secondarybeacon",
14845       FT_BOOLEAN, 16, TFS (&ht_info_secondary_beacon_flag), 0x0100, NULL, HFILL }},
14846
14847     {&hf_ieee80211_ht_info_lsig_txop_protection_full_support,
14848      {"L-SIG TXOP Protection Full Support", "wlan_mgt.ht.info.lsigprotsupport",
14849       FT_BOOLEAN, 16, TFS (&ht_info_lsig_txop_protection_full_support_flag), 0x0200, NULL, HFILL }},
14850
14851     {&hf_ieee80211_ht_info_pco_active,
14852      {"Phased Coexistence Operation (PCO)", "wlan_mgt.ht.info.pco.active",
14853       FT_BOOLEAN, 16, TFS (&tfs_active_inactive), 0x0400, NULL, HFILL }},
14854
14855     {&hf_ieee80211_ht_info_pco_phase,
14856      {"Phased Coexistence Operation (PCO) Phase", "wlan_mgt.ht.info.pco.phase",
14857       FT_BOOLEAN, 16, TFS (&ht_info_pco_phase_flag), 0x0800, NULL, HFILL }},
14858
14859     {&hf_ieee80211_ht_info_reserved_3,
14860      {"Reserved", "wlan_mgt.ht.info.reserved3",
14861       FT_UINT16, BASE_HEX, NULL, 0xf000, NULL, HFILL }},
14862
14863     {&hf_ieee80211_tag_secondary_channel_offset,
14864      {"Secondary Channel Offset", "wlan_mgt.secchanoffset",
14865       FT_UINT8, BASE_HEX, VALS (&ieee80211_tag_secondary_channel_offset_flags), 0,
14866       NULL, HFILL }},
14867
14868     {&hf_ieee80211_tag_power_constraint_local,
14869      {"Local Power Constraint", "wlan_mgt.powercon.local",
14870       FT_UINT8, BASE_HEX, NULL, 0,
14871       "Value that allows the mitigation requirements to be satisfied in the current channel", HFILL }},
14872
14873     {&hf_ieee80211_tag_power_capability_min,
14874      {"Minimum Transmit Power", "wlan_mgt.powercap.min",
14875       FT_UINT8, BASE_HEX, NULL, 0,
14876       "The nominal minimum transmit power with which the STA is capable of transmitting in the current channel", HFILL }},
14877
14878     {&hf_ieee80211_tag_power_capability_max,
14879      {"Maximum Transmit Power", "wlan_mgt.powercap.max",
14880       FT_UINT8, BASE_HEX, NULL, 0,
14881       "The nominal maximum transmit power with which the STA is capable of transmitting in the current channel", HFILL }},
14882
14883     {&hf_ieee80211_tag_tpc_report_trsmt_pow,
14884      {"Transmit Power", "wlan_mgt.tcprep.trsmt_pow",
14885       FT_INT8, BASE_DEC, NULL, 0,
14886       NULL, HFILL }},
14887
14888     {&hf_ieee80211_tag_tpc_report_link_mrg,
14889      {"Link Margin", "wlan_mgt.tcprep.link_mrg",
14890       FT_INT8, BASE_DEC, NULL, 0,
14891       NULL, HFILL }},
14892
14893     {&hf_ieee80211_tag_supported_channels,
14894      {"Supported Channels Set", "wlan_mgt.supchan",
14895       FT_NONE, BASE_NONE, NULL, 0,
14896       NULL, HFILL }},
14897
14898     {&hf_ieee80211_tag_supported_channels_first,
14899      {"First Supported Channel", "wlan_mgt.supchan.first",
14900       FT_UINT8, BASE_DEC, NULL, 0,
14901       NULL, HFILL }},
14902
14903     {&hf_ieee80211_tag_supported_channels_range,
14904      {"Supported Channel Range", "wlan_mgt.supchan.range",
14905       FT_UINT8, BASE_DEC, NULL, 0,
14906       NULL, HFILL }},
14907
14908     {&hf_ieee80211_csa_channel_switch_mode,
14909      {"Channel Switch Mode", "wlan_mgt.csa.channel_switch_mode",
14910       FT_UINT8, BASE_HEX, NULL, 0,
14911       "Indicates any restrictions on transmission until a channel switch", HFILL }},
14912
14913     {&hf_ieee80211_csa_new_channel_number,
14914      {"New Channel Number", "wlan_mgt.csa.new_channel_number",
14915       FT_UINT8, BASE_HEX, NULL, 0,
14916       "Set to the number of the channel to which the STA is moving", HFILL }},
14917
14918     {&hf_ieee80211_csa_channel_switch_count,
14919      {"Channel Switch Count", "wlan_mgt.csa.channel_switch_count",
14920       FT_UINT8, BASE_DEC, NULL, 0,
14921       "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 }},
14922
14923     {&hf_ieee80211_tag_measure_request_token,
14924      {"Measurement Token", "wlan_mgt.measure.req.token",
14925       FT_UINT8, BASE_HEX, NULL, 0xff, NULL, HFILL }},
14926
14927     {&hf_ieee80211_tag_measure_request_mode,
14928      {"Measurement Request Mode", "wlan_mgt.measure.req.mode",
14929       FT_UINT8, BASE_HEX, NULL, 0xff, NULL, HFILL }},
14930
14931     {&hf_ieee80211_tag_measure_request_mode_parallel,
14932      {"Parallel", "wlan_mgt.measure.req.reqmode.parallel",
14933       FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
14934
14935     {&hf_ieee80211_tag_measure_request_mode_enable,
14936      {"Measurement Request Mode Field", "wlan_mgt.measure.req.reqmode.enable",
14937       FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x02, NULL, HFILL }},
14938
14939     {&hf_ieee80211_tag_measure_request_mode_request,
14940      {"Measurement Reports", "wlan_mgt.measure.req.reqmode.request",
14941       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x04, NULL, HFILL }},
14942
14943     {&hf_ieee80211_tag_measure_request_mode_report,
14944      {"Autonomous Measurement Reports", "wlan_mgt.measure.req.reqmode.report",
14945       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x08, NULL, HFILL }},
14946
14947     {&hf_ieee80211_tag_measure_request_mode_duration_mandatory,
14948      {"Duration Mandatory", "wlan_mgt.measure.req.reqmode.duration_mandatory",
14949       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x10, NULL, HFILL }},
14950
14951     {&hf_ieee80211_tag_measure_request_mode_reserved,
14952      {"Reserved", "wlan_mgt.measure.req.reqmode.reserved",
14953       FT_UINT8, BASE_HEX, NULL, 0xE0, NULL, HFILL }},
14954
14955     {&hf_ieee80211_tag_measure_request_type,
14956      {"Measurement Request Type", "wlan_mgt.measure.req.reqtype",
14957       FT_UINT8, BASE_HEX, VALS (&ieee80211_tag_measure_request_type_flags), 0x00, NULL, HFILL }},
14958
14959     {&hf_ieee80211_tag_measure_request_channel_number,
14960      {"Measurement Channel Number", "wlan_mgt.measure.req.channelnumber",
14961       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14962
14963     {&hf_ieee80211_tag_measure_request_start_time,
14964      {"Measurement Start Time", "wlan_mgt.measure.req.starttime",
14965       FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL }},
14966
14967     {&hf_ieee80211_tag_measure_request_duration,
14968      {"Measurement Duration", "wlan_mgt.measure.req.channelnumber",
14969       FT_UINT16, BASE_HEX, NULL, 0, "in TU (1 TU = 1024 us)", HFILL }},
14970
14971     {&hf_ieee80211_tag_measure_request_regulatory_class,
14972      {"Measurement Channel Number", "wlan_mgt.measure.req.regclass",
14973       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14974
14975     {&hf_ieee80211_tag_measure_request_randomization_interval,
14976      {"Randomization Interval", "wlan_mgt.measure.req.randint",
14977       FT_UINT16, BASE_HEX, NULL, 0, "in TU (1 TU = 1024 us)", HFILL }},
14978
14979     {&hf_ieee80211_tag_measure_request_measurement_mode,
14980      {"Measurement Mode", "wlan_mgt.measure.req.measurementmode",
14981       FT_UINT8, BASE_HEX, VALS(ieee80211_tag_measure_request_measurement_mode_flags), 0, NULL, HFILL }},
14982
14983     {&hf_ieee80211_tag_measure_request_bssid,
14984      {"BSSID", "wlan_mgt.measure.req.bssid",
14985       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
14986
14987     {&hf_ieee80211_tag_measure_request_subelement_length,
14988      {"Length", "wlan_mgt.measure.req.sub.length",
14989       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14990
14991     {&hf_ieee80211_tag_measure_request_beacon_sub_id,
14992      {"SubElement ID", "wlan_mgt.measure.req.beacon.sub.id",
14993       FT_UINT8, BASE_DEC, VALS(ieee80211_tag_measure_request_beacon_sub_id_flags), 0, NULL, HFILL }},
14994
14995     {&hf_ieee80211_tag_measure_request_beacon_sub_ssid,
14996      {"SSID", "wlan_mgt.measure.req.beacon.sub.ssid",
14997       FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
14998
14999     {&hf_ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition,
15000      {"Reporting Condition", "wlan_mgt.measure.req.beacon.sub.bri.repcond",
15001       FT_UINT8, BASE_HEX, VALS(ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition_flags), 0, NULL, HFILL }},
15002
15003     {&hf_ieee80211_tag_measure_request_beacon_sub_bri_threshold_offset,
15004      {"Threshold/Offset", "wlan_mgt.measure.req.beacon.sub.bri.threshold_offset",
15005       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15006
15007     {&hf_ieee80211_tag_measure_request_beacon_sub_reporting_detail,
15008      {"Reporting Detail", "wlan_mgt.measure.req.beacon.sub.bri.reporting_detail",
15009       FT_UINT8, BASE_HEX, VALS(ieee80211_tag_measure_request_beacon_sub_reporting_detail_flags), 0, NULL, HFILL }},
15010
15011     {&hf_ieee80211_tag_measure_request_beacon_sub_request,
15012      {"Request", "wlan_mgt.measure.req.beacon.sub.request",
15013       FT_UINT8, BASE_DEC, 0, 0, NULL, HFILL }},
15014
15015     {&hf_ieee80211_tag_measure_request_beacon_unknown,
15016      {"Unknown Data", "wlan_mgt.measure.req.beacon.unknown",
15017       FT_BYTES, BASE_NONE, NULL, 0, "(not interpreted)", HFILL }},
15018
15019     {&hf_ieee80211_tag_measure_request_frame_request_type,
15020      {"Frame Request Type", "wlan_mgt.measure.req.frame_request_type",
15021       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15022
15023     {&hf_ieee80211_tag_measure_request_mac_address,
15024      {"MAC Address", "wlan_mgt.measure.req.mac_address",
15025       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
15026
15027     {&hf_ieee80211_tag_measure_request_peer_mac_address,
15028      {"Peer MAC Address", "wlan_mgt.measure.req.peer_mac_address",
15029       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
15030
15031     {&hf_ieee80211_tag_measure_request_group_id,
15032      {"Group ID", "wlan_mgt.measure.req.groupid",
15033       FT_UINT8, BASE_HEX, VALS(ieee80211_tag_measure_request_group_id_flags), 0, NULL, HFILL }},
15034
15035     {&hf_ieee80211_tag_measure_report_measurement_token,
15036      {"Measurement Token", "wlan_mgt.measure.req.token",
15037       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15038
15039     {&hf_ieee80211_tag_measure_report_mode,
15040      {"Measurement Report Mode", "wlan_mgt.measure.req.mode",
15041       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15042
15043     {&hf_ieee80211_tag_measure_report_mode_late,
15044      {"Measurement Report Mode Field", "wlan_mgt.measure.rep.repmode.late",
15045       FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x01, NULL, HFILL }},
15046
15047     {&hf_ieee80211_tag_measure_report_mode_incapable,
15048      {"Measurement Reports", "wlan_mgt.measure.rep.repmode.incapable",
15049       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x02, NULL, HFILL }},
15050
15051     {&hf_ieee80211_tag_measure_report_mode_refused,
15052      {"Autonomous Measurement Reports", "wlan_mgt.measure.rep.repmode.refused",
15053       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x04, NULL, HFILL }},
15054
15055     {&hf_ieee80211_tag_measure_report_mode_reserved,
15056      {"Reserved", "wlan_mgt.measure.rep.repmode.reserved",
15057       FT_UINT8, BASE_HEX, NULL, 0xf8, NULL, HFILL }},
15058
15059     {&hf_ieee80211_tag_measure_report_type,
15060      {"Measurement Report Type", "wlan_mgt.measure.rep.reptype",
15061       FT_UINT8, BASE_HEX, VALS (&ieee80211_tag_measure_report_type_flags), 0x00, NULL, HFILL }},
15062
15063     {&hf_ieee80211_tag_measure_report_channel_number,
15064      {"Measurement Channel Number", "wlan_mgt.measure.rep.channelnumber",
15065       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15066
15067     {&hf_ieee80211_tag_measure_report_start_time,
15068      {"Measurement Start Time", "wlan_mgt.measure.rep.starttime",
15069       FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL }},
15070
15071     {&hf_ieee80211_tag_measure_report_duration,
15072      {"Measurement Duration", "wlan_mgt.measure.rep.channelnumber",
15073       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
15074
15075     {&hf_ieee80211_tag_measure_cca_busy_fraction,
15076      {"CCA Busy Fraction", "wlan_mgt.measure.rep.ccabusy",
15077       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15078
15079     {&hf_ieee80211_tag_measure_basic_map_field,
15080      {"Map Field", "wlan_mgt.measure.rep.mapfield",
15081       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15082
15083     {&hf_ieee80211_tag_measure_map_field_bss,
15084      {"BSS", "wlan_mgt.measure.rep.repmode.mapfield.bss",
15085       FT_BOOLEAN, 8, TFS (&ieee80211_tag_measure_map_field_bss_flag), 0x01, NULL, HFILL }},
15086
15087     {&hf_ieee80211_tag_measure_map_field_odfm,
15088      {"Orthogonal Frequency Division Multiplexing (ODFM) Preamble", "wlan_mgt.measure.rep.repmode.mapfield.bss",
15089       FT_BOOLEAN, 8, TFS (&tfs_detected_not_detected), 0x02, NULL, HFILL }},
15090
15091     {&hf_ieee80211_tag_measure_map_field_unident_signal,
15092      {"Unidentified Signal", "wlan_mgt.measure.rep.repmode.mapfield.unidentsig",
15093       FT_BOOLEAN, 8, TFS (&tfs_detected_not_detected), 0x04, NULL, HFILL }},
15094
15095     {&hf_ieee80211_tag_measure_map_field_radar,
15096      {"Radar", "wlan_mgt.measure.rep.repmode.mapfield.radar",
15097       FT_BOOLEAN, 8, TFS (&tfs_detected_not_detected), 0x08, NULL, HFILL }},
15098
15099     {&hf_ieee80211_tag_measure_map_field_unmeasured,
15100      {"Unmeasured", "wlan_mgt.measure.rep.repmode.mapfield.unmeasured",
15101       FT_BOOLEAN, 8, TFS (&tfs_true_false), 0x10, NULL, HFILL }},
15102
15103     {&hf_ieee80211_tag_measure_map_field_reserved,
15104      {"Reserved", "wlan_mgt.measure.rep.repmode.mapfield.reserved",
15105       FT_UINT8, BASE_HEX, NULL, 0xe0, NULL, HFILL }},
15106
15107     {&hf_ieee80211_tag_measure_rpi_histogram_report,
15108      {"Receive Power Indicator (RPI) Histogram Report", "wlan_mgt.measure.rep.rpi.histogram_report",
15109       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
15110
15111     {&hf_ieee80211_tag_measure_rpi_histogram_report_0,
15112      {"RPI 0 Density", "wlan_mgt.measure.rep.rpi.rpi0density",
15113       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 0 Density", HFILL }},
15114
15115     {&hf_ieee80211_tag_measure_rpi_histogram_report_1,
15116      {"RPI 1 Density", "wlan_mgt.measure.rep.rpi.rpi1density",
15117       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 1 Density", HFILL }},
15118
15119     {&hf_ieee80211_tag_measure_rpi_histogram_report_2,
15120      {"RPI 2 Density", "wlan_mgt.measure.rep.rpi.rpi2density",
15121       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 2 Density", HFILL }},
15122
15123     {&hf_ieee80211_tag_measure_rpi_histogram_report_3,
15124      {"RPI 3 Density", "wlan_mgt.measure.rep.rpi.rpi3density",
15125       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 3 Density", HFILL }},
15126
15127     {&hf_ieee80211_tag_measure_rpi_histogram_report_4,
15128      {"RPI 4 Density", "wlan_mgt.measure.rep.rpi.rpi4density",
15129       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 4 Density", HFILL }},
15130
15131     {&hf_ieee80211_tag_measure_rpi_histogram_report_5,
15132      {"RPI 5 Density", "wlan_mgt.measure.rep.rpi.rpi5density",
15133       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 5 Density", HFILL }},
15134
15135     {&hf_ieee80211_tag_measure_rpi_histogram_report_6,
15136      {"RPI 6 Density", "wlan_mgt.measure.rep.rpi.rpi6density",
15137       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 6 Density", HFILL }},
15138
15139     {&hf_ieee80211_tag_measure_rpi_histogram_report_7,
15140      {"RPI 7 Density", "wlan_mgt.measure.rep.rpi.rpi7density",
15141       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 7 Density", HFILL }},
15142
15143     {&hf_ieee80211_tag_measure_report_regulatory_class,
15144      {"Regulatory Class", "wlan_mgt.measure.rep.regclass",
15145       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15146
15147     {&hf_ieee80211_tag_measure_report_channel_load,
15148      {"Channel Load", "wlan_mgt.measure.rep.chanload",
15149       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15150
15151     {&hf_ieee80211_tag_measure_report_frame_info,
15152      {"Reported Frame Information", "wlan_mgt.measure.rep.frameinfo",
15153       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15154
15155     {&hf_ieee80211_tag_measure_report_frame_info_phy_type,
15156      {"Condensed PHY", "wlan_mgt.measure.rep.frameinfo.phytype",
15157       FT_UINT8, BASE_HEX, NULL, 0x7F, NULL, HFILL }},
15158
15159     {&hf_ieee80211_tag_measure_report_frame_info_frame_type,
15160      {"Reported Frame Type", "wlan_mgt.measure.rep.frameinfo.frametype",
15161       FT_BOOLEAN, 8, TFS(&ieee80211_tag_measure_report_frame_info_frame_type_flag), 0x80, NULL, HFILL }},
15162
15163     {&hf_ieee80211_tag_measure_report_rcpi,
15164      {"Received Channel Power Indicator (RCPI)", "wlan_mgt.measure.rep.rcpi",
15165       FT_UINT8, BASE_HEX, NULL, 0, "in dBm", HFILL }},
15166
15167     {&hf_ieee80211_tag_measure_report_rsni,
15168      {"Received Signal to Noise Indicator (RSNI)", "wlan_mgt.measure.rep.rsni",
15169       FT_UINT8, BASE_HEX, NULL, 0, "in dB", HFILL }},
15170
15171     {&hf_ieee80211_tag_measure_report_bssid,
15172      {"BSSID Being Reported", "wlan_mgt.measure.rep.bssid",
15173       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
15174
15175     {&hf_ieee80211_tag_measure_report_ant_id,
15176      {"Antenna ID", "wlan_mgt.measure.rep.antid",
15177       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15178
15179     {&hf_ieee80211_tag_measure_report_anpi,
15180      {"ANPI", "wlan_mgt.measure.rep.anpi",
15181       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15182
15183     {&hf_ieee80211_tag_measure_report_ipi_density_0,
15184      {"IPI Density 0", "wlan_mgt.measure.rep.ipi_density0",
15185       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15186
15187     {&hf_ieee80211_tag_measure_report_ipi_density_1,
15188      {"IPI Density 1", "wlan_mgt.measure.rep.ipi_density1",
15189       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15190
15191     {&hf_ieee80211_tag_measure_report_ipi_density_2,
15192      {"IPI Density 2", "wlan_mgt.measure.rep.ipi_density2",
15193       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15194
15195     {&hf_ieee80211_tag_measure_report_ipi_density_3,
15196      {"IPI Density 3", "wlan_mgt.measure.rep.ipi_density3",
15197       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15198
15199     {&hf_ieee80211_tag_measure_report_ipi_density_4,
15200      {"IPI Density 4", "wlan_mgt.measure.rep.ipi_density4",
15201       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15202
15203     {&hf_ieee80211_tag_measure_report_ipi_density_5,
15204      {"IPI Density 5", "wlan_mgt.measure.rep.ipi_density5",
15205       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15206
15207     {&hf_ieee80211_tag_measure_report_ipi_density_6,
15208      {"IPI Density 6", "wlan_mgt.measure.rep.ipi_density6",
15209       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15210
15211     {&hf_ieee80211_tag_measure_report_ipi_density_7,
15212      {"IPI Density 7", "wlan_mgt.measure.rep.ipi_density7",
15213       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15214
15215      {&hf_ieee80211_tag_measure_report_ipi_density_8,
15216      {"IPI Density 8", "wlan_mgt.measure.rep.ipi_density8",
15217       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15218
15219     {&hf_ieee80211_tag_measure_report_ipi_density_9,
15220      {"IPI Density 9", "wlan_mgt.measure.rep.ipi_density9",
15221       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15222
15223     {&hf_ieee80211_tag_measure_report_ipi_density_10,
15224      {"IPI Density 10", "wlan_mgt.measure.rep.ipi_density10",
15225       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15226
15227     {&hf_ieee80211_tag_measure_report_parent_tsf,
15228      {"Parent Timing Synchronization Function (TSF)", "wlan_mgt.measure.rep.parenttsf",
15229       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
15230
15231     {&hf_ieee80211_tag_quiet_count,
15232      {"Count", "wlan_mgt.quiet.count",
15233       FT_UINT8, BASE_DEC, NULL, 0, "Set to the number of TBTTs until the beacon interval during which the next quiet interval shall start", HFILL }},
15234
15235     {&hf_ieee80211_tag_quiet_period,
15236      {"Period", "wlan_mgt.quiet.period",
15237       FT_UINT8, BASE_DEC, NULL, 0, "Set to the number of beacon intervals between the start of regularly scheduled quiet intervals", HFILL }},
15238
15239     {&hf_ieee80211_tag_quiet_duration,
15240      {"Duration", "wlan_mgt.quiet.duration",
15241       FT_UINT16, BASE_DEC, NULL, 0, "Set to the duration of the quiet interval", HFILL }},
15242
15243     {&hf_ieee80211_tag_quiet_offset,
15244      {"Offset", "wlan_mgt.quiet.offset",
15245       FT_UINT16, BASE_DEC, NULL, 0, "Set to the offset of the start of the quiet interval from the TBTT", HFILL }},
15246
15247     {&hf_ieee80211_tag_dfs_owner,
15248      {"Owner", "wlan_mgt.dfs.owner",
15249       FT_ETHER, BASE_NONE, NULL, 0, "Set to the individual IEEE MAC address of the STA that is the currently known DFS Owner in the IBSS", HFILL  }},
15250
15251     {&hf_ieee80211_tag_dfs_recovery_interval,
15252      {"Recovery Interval", "wlan_mgt.dfs.recovery_interval",
15253       FT_UINT8, BASE_DEC, NULL, 0, "Indicates the time interval that shall be used for DFS owner recovery", HFILL  }},
15254
15255     {&hf_ieee80211_tag_dfs_channel_map,
15256      {"Channel Map", "wlan_mgt.dfs.channel_map",
15257       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL  }},
15258
15259     {&hf_ieee80211_tag_dfs_channel_number,
15260      {"Channel Number", "wlan_mgt.dfs.channel_number",
15261       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL  }},
15262
15263     {&hf_ieee80211_tag_dfs_map,
15264      {"Map", "wlan_mgt.dfs.map",
15265       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL  }},
15266
15267     {&hf_ieee80211_tag_erp_info,
15268      {"ERP Information", "wlan_mgt.erp_info",
15269       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL  }},
15270
15271     {&hf_ieee80211_tag_erp_info_erp_present,
15272      {"Non ERP Present", "wlan_mgt.erp_info.erp_present",
15273       FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01, NULL, HFILL  }},
15274
15275     {&hf_ieee80211_tag_erp_info_use_protection,
15276      {"Use Protection", "wlan_mgt.erp_info.use_protection",
15277       FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02, NULL, HFILL  }},
15278
15279     {&hf_ieee80211_tag_erp_info_barker_preamble_mode,
15280      {"Barker Preamble Mode", "wlan_mgt.erp_info.barker_preamble_mode",
15281       FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x04, NULL, HFILL  }},
15282
15283     {&hf_ieee80211_tag_erp_info_reserved,
15284      {"Reserved", "wlan_mgt.erp_info.reserved",
15285       FT_UINT8, BASE_HEX, NULL, 0xF8, NULL, HFILL  }},
15286
15287     /* Table 7-35a-Capabilities field */
15288     {&hf_ieee80211_tag_extended_capabilities,
15289      {"Extended Capabilities", "wlan_mgt.extcap",
15290       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15291
15292     /* P802.11n/D6.0 */
15293     /* Extended Capability octet 0 */
15294     {&hf_ieee80211_tag_extended_capabilities_b0,
15295      {"20/40 BSS Coexistence Management Support", "wlan_mgt.extcap.infoexchange.b0",
15296       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0001, "HT Information Exchange Support", HFILL }},
15297
15298     /* P802.11p/D4.0 */
15299     {&hf_ieee80211_tag_extended_capabilities_b1,
15300      {"On-demand beacon", "wlan_mgt.extcap.infoexchange.b1",
15301       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0002, NULL, HFILL }},
15302
15303     {&hf_ieee80211_tag_extended_capabilities_b2,
15304      {"Extended Channel Switching", "wlan_mgt.extcap.infoexchange.b2",
15305       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0004, NULL, HFILL }},
15306
15307     {&hf_ieee80211_tag_extended_capabilities_b3,
15308      {"WAVE indication", "wlan_mgt.extcap.infoexchange.b3",
15309       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0008, NULL, HFILL }},
15310     /*End: P802.11p/D4.0 */
15311
15312     {&hf_ieee80211_tag_extended_capabilities_b4,
15313      {"PSMP Capability", "wlan_mgt.extcap.infoexchange.b4",
15314       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0010, NULL, HFILL }},
15315
15316     {&hf_ieee80211_tag_extended_capabilities_b6,
15317      {"S-PSMP Support", "wlan_mgt.extcap.infoexchange.b6",
15318       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0040, NULL, HFILL }},
15319
15320     /* Extended Capability octet 3 */
15321     {&hf_ieee80211_tag_extended_capabilities_b27,
15322      {"UTC TSF Offset", "wlan_mgt.extcap.infoexchange.b27",
15323       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0008, NULL, HFILL }},
15324
15325     {&hf_ieee80211_tag_extended_capabilities_b28,
15326      {"Peer U-APSD Buffer STA Support", "wlan_mgt.extcap.infoexchange.b28",
15327       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0010, NULL, HFILL }},
15328
15329     {&hf_ieee80211_tag_extended_capabilities_b29,
15330      {"TDLS Peer PSM Support", "wlan_mgt.extcap.infoexchange.b29",
15331       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0020, NULL, HFILL }},
15332
15333     {&hf_ieee80211_tag_extended_capabilities_b30,
15334      {"TDLS channel switching", "wlan_mgt.extcap.infoexchange.b30",
15335       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0040, NULL, HFILL }},
15336
15337     {&hf_ieee80211_tag_extended_capabilities_b31,
15338      {"Interworking", "wlan_mgt.extcap.infoexchange.b31",
15339       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0080, NULL, HFILL }},
15340
15341     /* Extended Capability octet 4 */
15342     {&hf_ieee80211_tag_extended_capabilities_b32,
15343      {"QoS Map", "wlan_mgt.extcap.infoexchange.b32",
15344       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0001, NULL, HFILL }},
15345
15346     {&hf_ieee80211_tag_extended_capabilities_b33,
15347      {"EBR", "wlan_mgt.extcap.infoexchange.b33",
15348       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0002, NULL, HFILL }},
15349
15350     {&hf_ieee80211_tag_extended_capabilities_b34,
15351      {"SSPN Interface", "wlan_mgt.extcap.infoexchange.b34",
15352       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0004, NULL, HFILL }},
15353
15354     {&hf_ieee80211_tag_extended_capabilities_b36,
15355      {"MSGCF Capability", "wlan_mgt.extcap.infoexchange.b36",
15356       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0010, NULL, HFILL }},
15357
15358     {&hf_ieee80211_tag_extended_capabilities_b37,
15359      {"TDLS support", "wlan_mgt.extcap.infoexchange.b37",
15360       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0020, NULL, HFILL }},
15361
15362     {&hf_ieee80211_tag_extended_capabilities_b38,
15363      {"TDLS Prohibited", "wlan_mgt.extcap.infoexchange.b38",
15364       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0040, NULL, HFILL }},
15365
15366     {&hf_ieee80211_tag_extended_capabilities_b39,
15367      {"TDLS Channel Switching Prohibited", "wlan_mgt.extcap.infoexchange.b39",
15368       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0080, NULL, HFILL }},
15369
15370     /* Extended Capability octet 5 */
15371     {&hf_ieee80211_tag_extended_capabilities_b40,
15372      {"Reject Unadmitted Frame", "wlan_mgt.extcap.infoexchange.b40",
15373       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0001, NULL, HFILL }},
15374
15375     {&hf_ieee80211_tag_extended_capabilities_serv_int_granularity,
15376      {"Service Interval Granularity",
15377       "wlan_mgt.extcap.infoexchange.serv_int_granularity",
15378       FT_UINT8, BASE_NONE, VALS(service_interval_granularity_vals), 0x000e,
15379       NULL, HFILL }},
15380
15381     {&hf_ieee80211_tag_cisco_ccx1_unknown,
15382      {"Unknown", "wlan_mgt.cisco.ccx1.unknown",
15383       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
15384
15385     {&hf_ieee80211_tag_cisco_ccx1_name,
15386      {"Name", "wlan_mgt.cisco.ccx1.name",
15387       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
15388
15389     {&hf_ieee80211_tag_cisco_ccx1_clients,
15390      {"Clients", "wlan_mgt.cisco.ccx1.clients",
15391       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15392
15393     {&hf_ieee80211_tag_neighbor_report_bssid,
15394      {"BSSID", "wlan_mgt.nreport.bssid",
15395       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
15396
15397     {&hf_ieee80211_tag_neighbor_report_bssid_info,
15398      {"BSSID Information", "wlan_mgt.nreport.bssid.info",
15399       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
15400
15401     {&hf_ieee80211_tag_neighbor_report_bssid_info_reachability,
15402      {"AP Reachability", "wlan_mgt.nreport.bssid.info.reachability",
15403       FT_UINT16, BASE_HEX, NULL, 0x0003, NULL, HFILL }},
15404
15405     {&hf_ieee80211_tag_neighbor_report_bssid_info_security,
15406      {"Security", "wlan_mgt.nreport.bssid.info.security",
15407       FT_UINT16, BASE_HEX, NULL, 0x0004, NULL, HFILL }},
15408
15409     {&hf_ieee80211_tag_neighbor_report_bssid_info_key_scope,
15410      {"Key Scope", "wlan_mgt.nreport.bssid.info.keyscope",
15411       FT_UINT16, BASE_HEX, NULL, 0x0008, NULL, HFILL }},
15412
15413     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_spec_mng,
15414      {"Capability: Spectrum Management", "wlan_mgt.nreport.bssid.info.capability.specmngt",
15415       FT_UINT16, BASE_HEX, NULL, 0x0010, NULL, HFILL }},
15416
15417     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_qos,
15418      {"Capability: QoS", "wlan_mgt.nreport.bssid.info.capability.qos",
15419       FT_UINT16, BASE_HEX, NULL, 0x0020, NULL, HFILL }},
15420
15421     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_apsd,
15422      {"Capability: APSD", "wlan_mgt.nreport.bssid.info.capability.apsd",
15423       FT_UINT16, BASE_HEX, NULL, 0x0040, NULL, HFILL }},
15424
15425     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_radio_msnt,
15426      {"Capability: Radio Measurement", "wlan_mgt.nreport.bssid.info.capability.radiomsnt",
15427       FT_UINT16, BASE_HEX, NULL, 0x0080, NULL, HFILL }},
15428
15429     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_dback,
15430      {"Capability: Delayed Block Ack", "wlan_mgt.nreport.bssid.info.capability.dback",
15431       FT_UINT16, BASE_HEX, NULL, 0x0100, NULL, HFILL }},
15432
15433     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_iback,
15434      {"Capability: Immediate Block Ack", "wlan_mgt.nreport.bssid.info.capability.iback",
15435       FT_UINT16, BASE_HEX, NULL, 0x0200, NULL, HFILL }},
15436
15437     {&hf_ieee80211_tag_neighbor_report_bssid_info_mobility_domain,
15438      {"Mobility Domain", "wlan_mgt.nreport.bssid.info.mobilitydomain",
15439       FT_UINT16, BASE_HEX, NULL, 0x0400, NULL, HFILL }},
15440
15441     {&hf_ieee80211_tag_neighbor_report_bssid_info_high_throughput,
15442      {"High Throughput", "wlan_mgt.nreport.bssid.info.hthoughput",
15443       FT_UINT16, BASE_HEX, NULL, 0x0800, NULL, HFILL }},
15444
15445     {&hf_ieee80211_tag_neighbor_report_bssid_info_reserved,
15446      {"Reserved", "wlan_mgt.nreport.bssid.info.reserved",
15447       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
15448
15449     {&hf_ieee80211_tag_neighbor_report_reg_class,
15450      {"Regulatory Class", "wlan_mgt.nreport.regclass",
15451       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15452
15453     {&hf_ieee80211_tag_neighbor_report_channel_number,
15454      {"Channel Number", "wlan_mgt.nreport.channumber",
15455       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15456
15457     {&hf_ieee80211_tag_neighbor_report_phy_type,
15458      {"PHY Type", "wlan_mgt.nreport.phytype",
15459       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15460
15461     {&hf_ieee80211_tag_supported_reg_classes_current,
15462      {"Current Regulatory Class", "wlan_mgt.supregclass.current",
15463       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15464
15465     {&hf_ieee80211_tag_supported_reg_classes_alternate,
15466      {"Alternate Regulatory Classes", "wlan_mgt.supregclass.alt",
15467       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
15468
15469     {&hf_ieee80211_wfa_ie_type,
15470      {"Type", "wlan_mgt.wfa.ie.type",
15471       FT_UINT8, BASE_HEX, VALS(ieee802111_wfa_ie_type_vals), 0, NULL, HFILL }},
15472
15473     {&hf_ieee80211_wfa_ie_wpa_version,
15474      {"WPA Version", "wlan_mgt.wfa.ie.wpa.version",
15475       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15476
15477     {&hf_ieee80211_wfa_ie_wpa_mcs,
15478      {"Multicast Cipher Suite", "wlan_mgt.wfa.ie.wpa.mcs", FT_UINT32, BASE_CUSTOM,
15479       wpa_mcs_base_custom, 0, "Contains the cipher suite selector used by the BSS to protect broadcast/multicast traffic", HFILL }},
15480
15481     {&hf_ieee80211_wfa_ie_wpa_mcs_oui,
15482      {"Multicast Cipher Suite OUI", "wlan_mgt.wfa.ie.wpa.mcs.oui", FT_UINT24, BASE_CUSTOM,
15483       oui_base_custom, 0, NULL, HFILL }},
15484
15485     {&hf_ieee80211_wfa_ie_wpa_mcs_type,
15486      {"Multicast Cipher Suite type", "wlan_mgt.wfa.ie.wpa.mcs.type", FT_UINT8, BASE_DEC,
15487       NULL, 0, NULL, HFILL }},
15488
15489     {&hf_ieee80211_wfa_ie_wpa_mcs_wfa_type,
15490      {"Multicast Cipher Suite type", "wlan_mgt.wfa.ie.wpa.mcs.type", FT_UINT8, BASE_DEC,
15491       VALS(ieee80211_wfa_ie_wpa_cipher_vals), 0, NULL, HFILL }},
15492
15493     {&hf_ieee80211_wfa_ie_wpa_ucs_count,
15494      {"Unicast Cipher Suite Count", "wlan_mgt.wfa.ie.wpa.ucs.count", FT_UINT16, BASE_DEC,
15495       NULL, 0, "Indicates the number of pairwise cipher suite selectors that are contained in the Unicast Cipher Suite List", HFILL }},
15496
15497     {&hf_ieee80211_wfa_ie_wpa_ucs_list,
15498      {"Unicast Cipher Suite List", "wlan_mgt.wfa.ie.wpa.ucs.list", FT_NONE, BASE_NONE,
15499       NULL, 0, "Contains a series of cipher suite selectors that indicate the Unicast cipher suites", HFILL }},
15500
15501     {&hf_ieee80211_wfa_ie_wpa_ucs,
15502      {"Unicast Cipher Suite", "wlan_mgt.wfa.ie.wpa.ucs", FT_UINT32, BASE_CUSTOM,
15503       wpa_ucs_base_custom, 0, NULL, HFILL }},
15504
15505     {&hf_ieee80211_wfa_ie_wpa_ucs_oui,
15506      {"Unicast Cipher Suite OUI", "wlan_mgt.wfa.ie.wpau.cs.oui", FT_UINT24, BASE_CUSTOM,
15507       oui_base_custom, 0, NULL, HFILL }},
15508
15509     {&hf_ieee80211_wfa_ie_wpa_ucs_type,
15510      {"Unicast Cipher Suite type", "wlan_mgt.wfa.ie.wpa.ucs.type", FT_UINT8, BASE_DEC,
15511       NULL, 0, NULL, HFILL }},
15512
15513     {&hf_ieee80211_wfa_ie_wpa_ucs_wfa_type,
15514      {"Unicast Cipher Suite type", "wlan_mgt.wfa.ie.wpa.ucs.type", FT_UINT8, BASE_DEC,
15515       VALS(ieee80211_wfa_ie_wpa_cipher_vals), 0, NULL, HFILL }},
15516
15517     {&hf_ieee80211_wfa_ie_wpa_akms_count,
15518      {"Auth Key Management (AKM) Suite Count", "wlan_mgt.wfa.ie.wpa.akms.count", FT_UINT16, BASE_DEC,
15519       NULL, 0, "Indicates the number of Auth Key Management suite selectors that are contained in the Auth Key Management Suite List", HFILL }},
15520
15521     {&hf_ieee80211_wfa_ie_wpa_akms_list,
15522      {"Auth Key Management (AKM) List", "wlan_mgt.wfa.ie.wpa.akms.list", FT_NONE, BASE_NONE,
15523       NULL, 0, "Contains a series of cipher suite selectors that indicate the AKM suites", HFILL }},
15524
15525     {&hf_ieee80211_wfa_ie_wpa_akms,
15526      {"Auth Key Management (AKM) Suite", "wlan_mgt.wfa.ie.wpa.akms", FT_UINT32, BASE_CUSTOM,
15527       wpa_akms_base_custom, 0, NULL, HFILL }},
15528
15529     {&hf_ieee80211_wfa_ie_wpa_akms_oui,
15530      {"Auth Key Management (AKM) OUI", "wlan_mgt.wfa.ie.wpa.akms.oui", FT_UINT24, BASE_CUSTOM,
15531       oui_base_custom, 0, NULL, HFILL }},
15532
15533     {&hf_ieee80211_wfa_ie_wpa_akms_type,
15534      {"Auth Key Management (AKM) type", "wlan_mgt.wfa.ie.wpa.akms.type", FT_UINT8, BASE_DEC,
15535       NULL, 0, NULL, HFILL }},
15536
15537     {&hf_ieee80211_wfa_ie_wpa_akms_wfa_type,
15538      {"Auth Key Management (AKM) type", "wlan_mgt.wfa.ie.wpa.type", FT_UINT8, BASE_DEC,
15539       VALS(ieee80211_wfa_ie_wpa_keymgmt_vals), 0, NULL, HFILL }},
15540
15541     {&hf_ieee80211_wfa_ie_wme_subtype,
15542      {"WME Subtype", "wlan_mgt.wfa.ie.wme.subtype",
15543       FT_UINT8, BASE_DEC, VALS(ieee802111_wfa_ie_wme_type), 0, NULL, HFILL }},
15544
15545     {&hf_ieee80211_wfa_ie_wme_version,
15546      {"WME Version", "wlan_mgt.wfa.ie.wme.version",
15547       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15548
15549     {&hf_ieee80211_wfa_ie_wme_qos_info,
15550      {"WME QoS Info", "wlan_mgt.wfa.ie.wme.qos_info",
15551       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15552
15553     {&hf_ieee80211_wfa_ie_wme_qos_info_sta_max_sp_length,
15554      {"Max SP Length", "wlan_mgt.wfa.ie.wme.qos_info.sta.max_sp_length",
15555       FT_UINT8, BASE_HEX, VALS(ieee802111_wfa_ie_wme_qos_info_sta_max_sp_length_vals), 0x60, NULL, HFILL }},
15556
15557     {&hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_be,
15558      {"AC_BE", "wlan_mgt.wfa.ie.wme.qos_info.sta.ac_be",
15559       FT_BOOLEAN, 8, TFS(&ieee802111_wfa_ie_wme_qos_info_sta_ac_tfs), 0x08, NULL, HFILL }},
15560
15561     {&hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_bk,
15562      {"AC_BK", "wlan_mgt.wfa.ie.wme.qos_info.sta.ac_bk",
15563       FT_BOOLEAN, 8, TFS(&ieee802111_wfa_ie_wme_qos_info_sta_ac_tfs), 0x04, NULL, HFILL }},
15564
15565     {&hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vi,
15566      {"AC_VI", "wlan_mgt.wfa.ie.wme.qos_info.sta.ac_vi",
15567       FT_BOOLEAN, 8, TFS(&ieee802111_wfa_ie_wme_qos_info_sta_ac_tfs), 0x02, NULL, HFILL }},
15568
15569     {&hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vo,
15570      {"AC_VO", "wlan_mgt.wfa.ie.wme.qos_info.sta.ac_vo",
15571       FT_BOOLEAN, 8, TFS(&ieee802111_wfa_ie_wme_qos_info_sta_ac_tfs), 0x01, NULL, HFILL }},
15572
15573     {&hf_ieee80211_wfa_ie_wme_qos_info_sta_reserved,
15574      {"Reserved", "wlan_mgt.wfa.ie.wme.qos_info.sta.reserved",
15575       FT_UINT8, BASE_HEX, NULL, 0x90, "Must Be Zero", HFILL }},
15576
15577     {&hf_ieee80211_wfa_ie_wme_qos_info_ap_u_apsd,
15578      {"U-APSD", "wlan_mgt.wfa.ie.wme.qos_info.ap.u_apsd",
15579       FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x80, "Indicates the WMM AP is currently supporting unscheduled automatic power save delivery", HFILL }},
15580
15581     {&hf_ieee80211_wfa_ie_wme_qos_info_ap_parameter_set_count,
15582      {"Parameter Set Count", "wlan_mgt.wfa.ie.wme.qos_info.ap.parameter_set_count",
15583       FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL }},
15584
15585     {&hf_ieee80211_wfa_ie_wme_qos_info_ap_reserved,
15586      {"Reserved", "wlan_mgt.wfa.ie.wme.qos_info.ap.reserved",
15587       FT_UINT8, BASE_HEX, NULL, 0x70, "Must Be Zero", HFILL }},
15588
15589     {&hf_ieee80211_wfa_ie_wme_reserved,
15590      {"Reserved", "wlan_mgt.wfa.ie.wme.reserved",
15591       FT_BYTES, BASE_NONE, NULL, 0, "Must Be Zero", HFILL }},
15592
15593     {&hf_ieee80211_wfa_ie_wme_ac_parameters,
15594      {"Ac Parameters", "wlan_mgt.wfa.ie.wme.acp",
15595       FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
15596
15597     {&hf_ieee80211_wfa_ie_wme_acp_aci_aifsn,
15598      {"ACI / AIFSN Field", "wlan_mgt.wfa.ie.wme.acp.aci_aifsn",
15599       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15600
15601     {&hf_ieee80211_wfa_ie_wme_acp_aci,
15602      {"ACI", "wlan_mgt.wfa.ie.wme.acp.aci",
15603       FT_UINT8, BASE_DEC, VALS(ieee80211_wfa_ie_wme_acs_vals), 0x60, NULL, HFILL }},
15604
15605     {&hf_ieee80211_wfa_ie_wme_acp_acm,
15606      {"Admission Control Mandatory", "wlan_mgt.wfa.ie.wme.acp.aci",
15607       FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
15608
15609     {&hf_ieee80211_wfa_ie_wme_acp_aifsn,
15610      {"AIFSN", "wlan_mgt.wfa.ie.wme.acp.aifsn",
15611       FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
15612
15613     {&hf_ieee80211_wfa_ie_wme_acp_reserved,
15614      {"Reserved", "wlan_mgt.wfa.ie.wme.acp.reserved",
15615       FT_UINT8, BASE_DEC, NULL, 0x80, "Must be Zero", HFILL }},
15616
15617     {&hf_ieee80211_wfa_ie_wme_acp_ecw,
15618      {"ECW", "wlan_mgt.wfa.ie.wme.acp.ecw",
15619       FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL }},
15620
15621     {&hf_ieee80211_wfa_ie_wme_acp_ecw_max,
15622      {"ECW Max", "wlan_mgt.wfa.ie.wme.acp.ecw.max",
15623       FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL }},
15624
15625     {&hf_ieee80211_wfa_ie_wme_acp_ecw_min,
15626      {"ECW Min", "wlan_mgt.wfa.ie.wme.acp.ecw.min",
15627       FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
15628
15629     {&hf_ieee80211_wfa_ie_wme_acp_txop_limit,
15630      {"TXOP Limit", "wlan_mgt.wfa.ie.wme.acp.txop_limit",
15631       FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }},
15632
15633     {&hf_ieee80211_wfa_ie_wme_tspec_tsinfo,
15634      {"TS Info", "wlan_mgt.wfa.ie.wme.tspec.ts_info",
15635       FT_UINT24, BASE_HEX, NULL, 0, "Traffic Stream (TS) Info", HFILL }},
15636
15637     {&hf_ieee80211_wfa_ie_wme_tspec_tsinfo_tid,
15638      {"TID", "wlan_mgt.wfa.ie.wme.tspec.ts_info.tid",
15639       FT_UINT24, BASE_DEC, NULL, 0x00001E, "Traffic Stream Info ID (TID)", HFILL }},
15640
15641     {&hf_ieee80211_wfa_ie_wme_tspec_tsinfo_direction,
15642      {"Direction", "wlan_mgt.wfa.ie.wme.tspec.ts_info.dir", FT_UINT24, BASE_DEC,
15643       VALS (&ieee80211_wfa_ie_wme_tspec_tsinfo_direction_vals), 0x000060, "Traffic Stream (TS) Info Direction", HFILL }},
15644
15645     {&hf_ieee80211_wfa_ie_wme_tspec_tsinfo_psb,
15646      {"PSB", "wlan_mgt.wfa.ie.wme.tspec.ts_info.psb", FT_UINT24, BASE_DEC,
15647       VALS (&ieee80211_wfa_ie_wme_tspec_tsinfo_psb_vals), 0x000400, "Traffic Stream (TS) Info Power Save Behavior (PSB)", HFILL }},
15648
15649     {&hf_ieee80211_wfa_ie_wme_tspec_tsinfo_up,
15650      {"UP", "wlan_mgt.wfa.ie.wme.tspec.ts_info.up", FT_UINT24, BASE_DEC,
15651       VALS (&ieee80211_wfa_ie_wme_tspec_tsinfo_up_vals), 0x003800, "Traffic Stream (TS) Info User Priority (UP)", HFILL }},
15652
15653     {&hf_ieee80211_wfa_ie_wme_tspec_tsinfo_reserved,
15654      {"Reserved", "wlan_mgt.wfa.ie.wme.tspec.ts_info.reserved", FT_UINT24, BASE_HEX,
15655       NULL, 0xFFC381, "Must be Zero", HFILL }},
15656
15657     {&hf_ieee80211_wfa_ie_wme_tspec_nor_msdu,
15658      {"Normal MSDU Size", "wlan_mgt.wfa.ie.wme.tspec.nor_msdu",
15659       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15660
15661     {&hf_ieee80211_wfa_ie_wme_tspec_max_msdu,
15662      {"Maximum MSDU Size", "wlan_mgt.wfa.ie.wme.tspec.max_msdu",
15663       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15664
15665     {&hf_ieee80211_wfa_ie_wme_tspec_min_srv,
15666      {"Minimum Service Interval", "wlan_mgt.wfa.ie.wme.tspec.min_srv",
15667       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15668
15669     {&hf_ieee80211_wfa_ie_wme_tspec_max_srv,
15670      {"Maximum Service Interval", "wlan_mgt.wfa.ie.wme.tspec.max_srv",
15671       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15672
15673     {&hf_ieee80211_wfa_ie_wme_tspec_inact_int,
15674      {"Inactivity Interval", "wlan_mgt.wfa.ie.wme.tspec.inact_int",
15675       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15676
15677     {&hf_ieee80211_wfa_ie_wme_tspec_susp_int,
15678      {"Suspension Interval", "wlan_mgt.wfa.ie.wme.tspec.susp_int",
15679       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15680
15681     {&hf_ieee80211_wfa_ie_wme_tspec_srv_start,
15682      {"Service Start Time", "wlan_mgt.wfa.ie.wme.tspec.srv_start",
15683       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15684
15685     {&hf_ieee80211_wfa_ie_wme_tspec_min_data,
15686      {"Minimum Data Rate", "wlan_mgt.wfa.ie.wme.tspec.min_data",
15687       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15688
15689     {&hf_ieee80211_wfa_ie_wme_tspec_mean_data,
15690      {"Mean Data Rate", "wlan_mgt.wfa.ie.wme.tspec.mean_data",
15691       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15692
15693     {&hf_ieee80211_wfa_ie_wme_tspec_peak_data,
15694      {"Peak Data Rate", "wlan_mgt.wfa.ie.wme.tspec.peak_data",
15695       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15696
15697     {&hf_ieee80211_wfa_ie_wme_tspec_burst_size,
15698      {"Burst Size", "wlan_mgt.wfa.ie.wme.tspec.burst_size",
15699       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15700
15701     {&hf_ieee80211_wfa_ie_wme_tspec_delay_bound,
15702      {"Delay Bound", "wlan_mgt.wfa.ie.wme.tspec.delay_bound",
15703       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15704
15705     {&hf_ieee80211_wfa_ie_wme_tspec_min_phy,
15706      {"Minimum PHY Rate", "wlan_mgt.wfa.ie.wme.tspec.min_phy",
15707       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15708
15709     {&hf_ieee80211_wfa_ie_wme_tspec_surplus,
15710      {"Surplus Bandwidth Allowance", "wlan_mgt.wfa.ie.wme.tspec.surplus",
15711       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15712
15713     {&hf_ieee80211_wfa_ie_wme_tspec_medium,
15714      {"Medium Time", "wlan_mgt.wfa.ie.wme.tspec.medium",
15715       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15716
15717     {&hf_ieee80211_marvell_ie_type,
15718      {"Type", "wlan_mgt.marvell.ie.type",
15719       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15720
15721     {&hf_ieee80211_marvell_ie_mesh_subtype,
15722      {"Subtype", "wlan_mgt.marvell.ie.subtype",
15723       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15724
15725     {&hf_ieee80211_marvell_ie_mesh_version,
15726      {"Version", "wlan_mgt.marvell.ie.version",
15727       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15728
15729     {&hf_ieee80211_marvell_ie_mesh_active_proto_id,
15730      {"Path Selection Protocol", "wlan_mgt.marvell.ie.proto_id",
15731       FT_UINT8, BASE_HEX, VALS(mesh_path_selection_codes), 0, NULL, HFILL }},
15732
15733     {&hf_ieee80211_marvell_ie_mesh_active_metric_id,
15734      {"Path Selection Metric", "wlan_mgt.marvell.ie.metric_id",
15735       FT_UINT8, BASE_HEX, VALS(mesh_metric_codes), 0, NULL, HFILL }},
15736
15737     {&hf_ieee80211_marvell_ie_mesh_cap,
15738      {"Mesh Capabilities", "wlan_mgt.marvell.ie.cap",
15739       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15740
15741     {&hf_ieee80211_marvell_ie_data,
15742       { "Marvell IE data", "wlan_mgt.marvell.data",
15743         FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
15744
15745     {&hf_ieee80211_atheros_ie_type,
15746      {"Type", "wlan_mgt.atheros.ie.type",
15747       FT_UINT8, BASE_HEX, VALS(atheros_ie_type_vals), 0, NULL, HFILL }},
15748
15749     {&hf_ieee80211_atheros_ie_subtype,
15750      {"Subtype", "wlan_mgt.atheros.ie.subtype",
15751       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15752
15753     {&hf_ieee80211_atheros_ie_version,
15754      {"Version", "wlan_mgt.atheros.ie.version",
15755       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15756
15757     {&hf_ieee80211_atheros_ie_cap_f_turbop,
15758      {"Turbo Prime", "wlan_mgt.ie.atheros.capabilities.turbop",
15759       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_TURBOP, NULL, HFILL }},
15760
15761     {&hf_ieee80211_atheros_ie_cap_f_comp,
15762      {"Compression", "wlan_mgt.ie.atheros.capabilities.comp",
15763       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_COMP, NULL, HFILL }},
15764
15765     {&hf_ieee80211_atheros_ie_cap_f_ff,
15766      {"Fast Frames", "wlan_mgt.ie.atheros.capabilities.ff",
15767       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_FF, NULL, HFILL }},
15768
15769     {&hf_ieee80211_atheros_ie_cap_f_xr,
15770      {"eXtended Range", "wlan_mgt.ie.atheros.capabilities.xr",
15771       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_XR, NULL, HFILL }},
15772
15773     {&hf_ieee80211_atheros_ie_cap_f_ar,
15774      {"Advanced Radar", "wlan_mgt.ie.atheros.capabilities.ar",
15775       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_AR, NULL, HFILL }},
15776
15777     {&hf_ieee80211_atheros_ie_cap_f_burst,
15778      {"Burst", "wlan_mgt.ie.atheros.capabilities.burst",
15779       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_BURST, NULL, HFILL }},
15780
15781     {&hf_ieee80211_atheros_ie_cap_f_wme,
15782      {"CWMin tuning", "wlan_mgt.ie.atheros.capabilities.wme",
15783       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_WME, NULL, HFILL }},
15784
15785     {&hf_ieee80211_atheros_ie_cap_f_boost,
15786      {"Boost", "wlan_mgt.ie.atheros.capabilities.boost",
15787       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_BOOST, NULL, HFILL }},
15788
15789     {&hf_ieee80211_atheros_ie_advcap_cap,
15790      {"Capabilities", "wlan_mgt.atheros.ie.advcap.cap",
15791       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15792
15793     {&hf_ieee80211_atheros_ie_advcap_defkey,
15794      {"Default key index", "wlan_mgt.atheros.ie.advcap.defkey",
15795       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
15796
15797     {&hf_ieee80211_atheros_ie_xr_info,
15798      {"Info", "wlan_mgt.atheros.ie.xr.info",
15799       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15800
15801     {&hf_ieee80211_atheros_ie_xr_base_bssid,
15802      {"Base BSS Id", "wlan_mgt.atheros.ie.xr.base_bssid",
15803       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
15804
15805     {&hf_ieee80211_atheros_ie_xr_xr_bssid,
15806      {"XR BSS Id", "wlan_mgt.atheros.ie.xr.xr_bssid",
15807       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
15808
15809     {&hf_ieee80211_atheros_ie_xr_xr_beacon,
15810      {"XR Beacon Interval", "wlan_mgt.atheros.ie.xr.xr_beacon",
15811       FT_UINT32, BASE_CUSTOM, beacon_interval_base_custom, 0, NULL, HFILL }},
15812
15813     {&hf_ieee80211_atheros_ie_xr_base_cap,
15814      {"Base capabilities", "wlan_mgt.atheros.ie.xr.base_cap",
15815       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15816
15817     {&hf_ieee80211_atheros_ie_xr_xr_cap,
15818      {"XR capabilities", "wlan_mgt.atheros.ie.xr.xr_cap",
15819       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15820
15821     {&hf_ieee80211_atheros_ie_data,
15822      {"Atheros IE data", "wlan_mgt.atheros.data",
15823       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
15824
15825     {&hf_ieee80211_aironet_ie_type,
15826      {"Aironet IE type", "wlan_mgt.aironet.type",
15827       FT_UINT8, BASE_DEC, VALS(aironet_ie_type_vals), 0, NULL, HFILL }},
15828
15829     {&hf_ieee80211_aironet_ie_version,
15830      {"Aironet IE CCX version?", "wlan_mgt.aironet.version",
15831       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15832
15833     {&hf_ieee80211_aironet_ie_data,
15834       { "Aironet IE data", "wlan_mgt.aironet.data",
15835         FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
15836
15837     {&hf_ieee80211_qbss_version,
15838      {"QBSS Version", "wlan_mgt.qbss.version",
15839       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15840
15841     {&hf_ieee80211_qbss_scount,
15842      {"Station Count", "wlan_mgt.qbss.scount",
15843       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15844
15845     {&hf_ieee80211_qbss_cu,
15846      {"Channel Utilization", "wlan_mgt.qbss.cu",
15847        FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15848
15849     {&hf_ieee80211_qbss_adc,
15850      {"Available Admission Capabilities", "wlan_mgt.qbss.adc",
15851      FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15852
15853     {&hf_ieee80211_qbss2_cu,
15854      {"Channel Utilization", "wlan_mgt.qbss2.cu",
15855        FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15856
15857     {&hf_ieee80211_qbss2_gl,
15858      {"G.711 CU Quantum", "wlan_mgt.qbss2.glimit",
15859       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15860
15861     {&hf_ieee80211_qbss2_cal,
15862      {"Call Admission Limit", "wlan_mgt.qbss2.cal",
15863       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15864
15865     {&hf_ieee80211_qbss2_scount,
15866      {"Station Count", "wlan_mgt.qbss2.scount",
15867       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15868
15869     {&hf_ieee80211_aironet_ie_qos_unk1,
15870      {"Aironet IE QoS unknown 1", "wlan_mgt.aironet.qos.unk1",
15871       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15872
15873     {&hf_ieee80211_aironet_ie_qos_paramset,
15874      {"Aironet IE QoS paramset", "wlan_mgt.aironet.qos.paramset",
15875       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15876
15877     {&hf_ieee80211_aironet_ie_qos_val,
15878      {"Aironet IE QoS valueset", "wlan_mgt.aironet.qos.val",
15879       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
15880
15881     {&hf_ieee80211_tsinfo,
15882      {"Traffic Stream (TS) Info", "wlan_mgt.ts_info",
15883       FT_UINT24, BASE_HEX, NULL, 0, "Traffic Stream (TS) Info field", HFILL }},
15884
15885     {&hf_ieee80211_tsinfo_type,
15886      {"Traffic Type", "wlan_mgt.ts_info.type", FT_UINT24, BASE_DEC,
15887       VALS (&tsinfo_type), 0x000001, "Traffic Stream (TS) Info Traffic Type", HFILL }},
15888
15889     {&hf_ieee80211_tsinfo_tsid,
15890      {"Traffic Stream ID (TSID)", "wlan_mgt.ts_info.tsid",
15891       FT_UINT24, BASE_DEC, NULL, 0x00001E, "Traffic Stream ID (TSID) Info TSID", HFILL }},
15892
15893     {&hf_ieee80211_tsinfo_dir,
15894      {"Direction", "wlan_mgt.ts_info.dir", FT_UINT24, BASE_DEC,
15895       VALS (&tsinfo_direction), 0x000060, "Traffic Stream (TS) Info Direction", HFILL }},
15896
15897     {&hf_ieee80211_tsinfo_access,
15898      {"Access Policy", "wlan_mgt.ts_info.dir", FT_UINT24, BASE_DEC,
15899       VALS (&tsinfo_access), 0x000180, "Traffic Stream (TS) Info Access Policy", HFILL }},
15900
15901     {&hf_ieee80211_tsinfo_agg,
15902      {"Aggregation", "wlan_mgt.ts_info.agg", FT_UINT24, BASE_DEC,
15903       NULL, 0x000200, "Traffic Stream (TS) Info Access Policy", HFILL }},
15904
15905     {&hf_ieee80211_tsinfo_apsd,
15906      {"Automatic Power-Save Delivery (APSD)", "wlan_mgt.ts_info.apsd", FT_UINT24, BASE_DEC,
15907       NULL, 0x000400, "Traffic Stream (TS) Info Automatic Power-Save Delivery (APSD)", HFILL }},
15908
15909     {&hf_ieee80211_tsinfo_up,
15910      {"User Priority", "wlan_mgt.ts_info.up", FT_UINT24, BASE_DEC,
15911       VALS (&qos_up), 0x003800, "Traffic Stream (TS) Info User Priority", HFILL }},
15912
15913     {&hf_ieee80211_tsinfo_ack,
15914      {"Ack Policy", "wlan_mgt.ts_info.ack", FT_UINT24, BASE_DEC,
15915       VALS (&ack_policy), 0x00C000, "Traffic Stream (TS) Info Ack Policy", HFILL }},
15916
15917     {&hf_ieee80211_tsinfo_sched,
15918      {"Schedule", "wlan_mgt.ts_info.sched", FT_UINT24, BASE_DEC,
15919       NULL, 0x010000, "Traffic Stream (TS) Info Schedule", HFILL }},
15920
15921     {&hf_ieee80211_tsinfo_rsv,
15922      {"Reserved", "wlan_mgt.ts_info.rsv", FT_UINT24, BASE_HEX,
15923       NULL, 0xFE0000, "Must be Zero", HFILL }},
15924
15925     {&hf_ieee80211_tspec_nor_msdu,
15926      {"Normal MSDU Size", "wlan_mgt.tspec.nor_msdu",
15927       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15928
15929     {&hf_ieee80211_tspec_max_msdu,
15930      {"Maximum MSDU Size", "wlan_mgt.tspec.max_msdu",
15931       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15932
15933     {&hf_ieee80211_tspec_min_srv,
15934      {"Minimum Service Interval", "wlan_mgt.tspec.min_srv",
15935       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15936
15937     {&hf_ieee80211_tspec_max_srv,
15938      {"Maximum Service Interval", "wlan_mgt.tspec.max_srv",
15939       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15940
15941     {&hf_ieee80211_tspec_inact_int,
15942      {"Inactivity Interval", "wlan_mgt.tspec.inact_int",
15943       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15944
15945     {&hf_ieee80211_tspec_susp_int,
15946      {"Suspension Interval", "wlan_mgt.tspec.susp_int",
15947       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15948
15949     {&hf_ieee80211_tspec_srv_start,
15950      {"Service Start Time", "wlan_mgt.tspec.srv_start",
15951       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15952
15953     {&hf_ieee80211_tspec_min_data,
15954      {"Minimum Data Rate", "wlan_mgt.tspec.min_data",
15955       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15956
15957     {&hf_ieee80211_tspec_mean_data,
15958      {"Mean Data Rate", "wlan_mgt.tspec.mean_data",
15959       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15960
15961     {&hf_ieee80211_tspec_peak_data,
15962      {"Peak Data Rate", "wlan_mgt.tspec.peak_data",
15963       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15964
15965     {&hf_ieee80211_tspec_burst_size,
15966      {"Burst Size", "wlan_mgt.tspec.burst_size",
15967       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15968
15969     {&hf_ieee80211_tspec_delay_bound,
15970      {"Delay Bound", "wlan_mgt.tspec.delay_bound",
15971       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15972
15973     {&hf_ieee80211_tspec_min_phy,
15974      {"Minimum PHY Rate", "wlan_mgt.tspec.min_phy",
15975       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15976
15977     {&hf_ieee80211_tspec_surplus,
15978      {"Surplus Bandwidth Allowance", "wlan_mgt.tspec.surplus",
15979       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15980
15981     {&hf_ieee80211_tspec_medium,
15982      {"Medium Time", "wlan_mgt.tspec.medium",
15983       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15984
15985     {&hf_ieee80211_ts_delay,
15986      {"Traffic Stream (TS) Delay", "wlan_mgt.ts_delay",
15987       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15988
15989     {&hf_ieee80211_tclas_process,
15990      {"Processing", "wlan_mgt.tclas_proc.processing", FT_UINT8, BASE_DEC,
15991       VALS(ieee80211_tclas_process_flag), 0, "TCLAS Processing", HFILL }},
15992
15993     {&hf_ieee80211_tag_qos_cap_qos_info,
15994      {"QoS Info", "wlan_mgt.tag.qos_cap.qos_info", FT_UINT8, BASE_HEX,
15995       NULL, 0, "TCLAS Processing", HFILL }},
15996
15997     {&hf_ieee80211_qos_info_field_vo_uapsd,
15998      {"AC_VO U-APSD Flag", "wlan_mgt.tag.qos_cap.qos_info.vo_uapsd",
15999        FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x01, NULL, HFILL }},
16000
16001     {&hf_ieee80211_qos_info_field_vi_uapsd,
16002      {"AC_VI U-APSD Flag", "wlan_mgt.tag.qos_cap.qos_info.vi_uapsd",
16003        FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x02, NULL, HFILL }},
16004
16005     {&hf_ieee80211_qos_info_field_bk_uapsd,
16006      {"AC_BK U-APSD Flag", "wlan_mgt.tag.qos_cap.qos_info.bk_uapsd",
16007        FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x04, NULL, HFILL }},
16008
16009     {&hf_ieee80211_qos_info_field_be_uapsd,
16010      {"AC_BE U-APSD Flag", "wlan_mgt.tag.qos_cap.qos_info.be_uapsd",
16011        FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x08, NULL, HFILL }},
16012
16013     {&hf_ieee80211_qos_info_field_qack,
16014      {"Q-ACK", "wlan_mgt.tag.qos_cap.qos_info.qack",
16015        FT_BOOLEAN, 8, TFS(&qos_info_field_qack_flags), 0x10, NULL, HFILL }},
16016
16017     {&hf_ieee80211_qos_info_field_max_sp_length,
16018      {"Max SP-Lenght", "wlan_mgt.tag.qos_cap.qos_info.max_sp_length",
16019        FT_UINT8, BASE_HEX, VALS(qos_info_field_max_sp_lenght_flags),
16020        0x60, NULL , HFILL }},
16021
16022     {&hf_ieee80211_qos_info_field_more_data_ack,
16023      {"More Data Ack", "wlan_mgt.tag.qos_cap.qos_info.more_data_ack",
16024        FT_BOOLEAN, 8, TFS(&qos_info_field_more_data_ack_flags) , 0x80, NULL, HFILL }},
16025
16026     {&hf_ieee80211_qos_info_field_edca_upd_cnt,
16027       {"EDCA Parameter Set Update Count", "wlan_mgt.tag.qos_cap.qos_info.edca_upd_cnt",
16028         FT_UINT8, BASE_DEC, NULL, 0x07, NULL, HFILL}},
16029
16030     {&hf_ieee80211_qos_info_field_queue_req,
16031       {"Queue Request", "wlan_mgt.tag.qos_cap.qos_info.queue_req",
16032         FT_BOOLEAN, 8, TFS(&qos_info_field_queue_req_flags), 0x07, NULL, HFILL}},
16033
16034     {&hf_ieee80211_qos_info_field_txop_req,
16035       {"TXOP Request", "wlan_mgt.tag.qos_cap.qos_info.txop_req",
16036         FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x40, NULL, HFILL}},
16037
16038     {&hf_ieee80211_qos_info_field_reserved,
16039       {"Reserved", "wlan_mgt.tag.qos_cap.qos_info.reserved",
16040         FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}},
16041
16042     {&hf_ieee80211_tag_ext_supp_rates,
16043      {"Extented Supported Rates", "wlan_mgt.extented_supported_rates",
16044       FT_UINT8, BASE_NONE, VALS(ieee80211_supported_rates_vals), 0x0,
16045       "In Mbit/sec, (B) for Basic Rates", HFILL }},
16046
16047     {&hf_ieee80211_sched_info,
16048      {"Schedule Info", "wlan_mgt.sched.sched_info",
16049       FT_UINT16, BASE_HEX, NULL, 0, "Schedule Info field", HFILL }},
16050
16051     {&hf_ieee80211_sched_info_agg,
16052      {"Schedule Aggregation", "wlan_mgt.sched_info.agg", FT_UINT16, BASE_DEC,
16053       NULL, 0x0001, "Traffic Stream (TS) Info Access Policy", HFILL }},
16054
16055     {&hf_ieee80211_sched_info_tsid,
16056      {"Schedule Traffic Stream ID (TSID)", "wlan_mgt.sched_info.tsid",
16057       FT_UINT16, BASE_DEC, NULL, 0x001E, "Traffic Stream ID (TSID) Info TSID", HFILL }},
16058
16059     {&hf_ieee80211_sched_info_dir,
16060      {"Schedule Direction", "wlan_mgt.sched_info.dir", FT_UINT16, BASE_DEC,
16061       VALS (&tsinfo_direction), 0x0060, "Traffic Stream (TS) Info Direction", HFILL }},
16062
16063     {&hf_ieee80211_sched_srv_start,
16064      {"Service Start Time", "wlan_mgt.sched.srv_start",
16065       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
16066
16067     {&hf_ieee80211_sched_srv_int,
16068      {"Service Interval", "wlan_mgt.sched.srv_int",
16069       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
16070
16071     {&hf_ieee80211_sched_spec_int,
16072      {"Specification Interval", "wlan_mgt.sched.spec_int",
16073       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
16074
16075     {&hf_ieee80211_aruba,
16076      {"Aruba Type", "wlan_mgt.aruba.type",
16077       FT_UINT16, BASE_DEC, VALS(aruba_mgt_typevals), 0, "Aruba Management", HFILL }},
16078
16079     {&hf_ieee80211_aruba_hb_seq,
16080      {"Aruba Heartbeat Sequence", "wlan_mgt.aruba.heartbeat_sequence",
16081       FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
16082
16083     {&hf_ieee80211_aruba_mtu,
16084      {"Aruba MTU Size", "wlan_mgt.aruba.mtu_size",
16085       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16086
16087     /* Start: HT Control (+HTC) */
16088     {&hf_ieee80211_htc,
16089      {"HT Control (+HTC)", "wlan_mgt.htc",
16090       FT_UINT32, BASE_HEX, NULL, 0, "High Throughput Control (+HTC)", HFILL }},
16091     {&hf_ieee80211_htc_lac,
16092      {"Link Adaptation Control (LAC)", "wlan_mgt.htc.lac",
16093       FT_UINT16, BASE_HEX, NULL, 0, "High Throughput Control Link Adaptation Control (LAC)", HFILL }},
16094     {&hf_ieee80211_htc_lac_reserved,
16095      {"Reserved", "wlan_mgt.htc.lac.reserved",
16096       FT_BOOLEAN, 16, NULL, 0x0001, "High Throughput Control Link Adaptation Control Reserved", HFILL }},
16097     {&hf_ieee80211_htc_lac_trq,
16098      {"Training Request (TRQ)", "wlan_mgt.htc.lac.trq",
16099       FT_BOOLEAN, 16, TFS(&htc_lac_trq_flag), 0x0002, "High Throughput Control Link Adaptation Control Training Request (TRQ)", HFILL }},
16100     {&hf_ieee80211_htc_lac_mai_aseli,
16101      {"Antenna Selection Indication (ASELI)", "wlan_mgt.htc.lac.mai.aseli",
16102       FT_UINT16, BASE_HEX, NULL, 0x003C, "High Throughput Control Link Adaptation Control MAI Antenna Selection Indication", HFILL }},
16103     {&hf_ieee80211_htc_lac_mai_mrq,
16104      {"MCS Request (MRQ)", "wlan_mgt.htc.lac.mai.mrq",
16105       FT_BOOLEAN, 16, TFS(&htc_lac_mai_mrq_flag), 0x0004, "High Throughput Control Link Adaptation Control MAI MCS Request", HFILL }},
16106     {&hf_ieee80211_htc_lac_mai_msi,
16107      {"MCS Request Sequence Identifier (MSI)", "wlan_mgt.htc.lac.mai.msi",
16108       FT_UINT16, BASE_HEX, NULL, 0x0038, "High Throughput Control Link Adaptation Control MAI MCS Request Sequence Identifier", HFILL }},
16109     {&hf_ieee80211_htc_lac_mai_reserved,
16110      {"Reserved", "wlan_mgt.htc.lac.mai.reserved",
16111       FT_UINT16, BASE_HEX, NULL, 0x0038, "High Throughput Control Link Adaptation Control MAI Reserved", HFILL }},
16112     {&hf_ieee80211_htc_lac_mfsi,
16113      {"MCS Feedback Sequence Identifier (MFSI)", "wlan_mgt.htc.lac.mfsi",
16114       FT_UINT16, BASE_DEC, NULL, 0x01C0, "High Throughput Control Link Adaptation Control MCS Feedback Sequence Identifier (MSI)", HFILL }},
16115     {&hf_ieee80211_htc_lac_asel_command,
16116      {"Antenna Selection (ASEL) Command", "wlan_mgt.htc.lac.asel.command",
16117       FT_UINT16, BASE_HEX, VALS (&ieee80211_htc_lac_asel_command_flags), 0x0E00, "High Throughput Control Link Adaptation Control Antenna Selection (ASEL) Command", HFILL }},
16118     {&hf_ieee80211_htc_lac_asel_data,
16119      {"Antenna Selection (ASEL) Data", "wlan_mgt.htc.lac.asel.data",
16120       FT_UINT16, BASE_HEX, NULL, 0xF000, "High Throughput Control Link Adaptation Control Antenna Selection (ASEL) Data", HFILL }},
16121     {&hf_ieee80211_htc_lac_mfb,
16122      {"MCS Feedback (MFB)", "wlan_mgt.htc.lac.mfb",
16123       FT_UINT16, BASE_HEX, NULL, 0xFE00, "High Throughput Control Link Adaptation Control MCS Feedback", HFILL }},
16124     {&hf_ieee80211_htc_cal_pos,
16125      {"Calibration Position", "wlan_mgt.htc.cal.pos",
16126       FT_UINT16, BASE_DEC, VALS (&ieee80211_htc_cal_pos_flags), 0x0003, "High Throughput Control Calibration Position", HFILL }},
16127     {&hf_ieee80211_htc_cal_seq,
16128      {"Calibration Sequence Identifier", "wlan_mgt.htc.cal.seq",
16129       FT_UINT16, BASE_DEC, NULL, 0x000C, "High Throughput Control Calibration Sequence Identifier", HFILL }},
16130     {&hf_ieee80211_htc_reserved1,
16131      {"Reserved", "wlan_mgt.htc.reserved1",
16132       FT_UINT16, BASE_DEC, NULL, 0x0030, "High Throughput Control Reserved", HFILL }},
16133     {&hf_ieee80211_htc_csi_steering,
16134      {"CSI/Steering", "wlan_mgt.htc.csi_steering",
16135       FT_UINT16, BASE_DEC, VALS (&ieee80211_htc_csi_steering_flags), 0x00C0, "High Throughput Control CSI/Steering", HFILL }},
16136     {&hf_ieee80211_htc_ndp_announcement,
16137      {"NDP Announcement", "wlan_mgt.htc.ndp_announcement",
16138       FT_BOOLEAN, 16, TFS(&ieee80211_htc_ndp_announcement_flag), 0x0100, "High Throughput Control NDP Announcement", HFILL }},
16139     {&hf_ieee80211_htc_reserved2,
16140      {"Reserved", "wlan_mgt.htc.reserved2",
16141       FT_UINT16, BASE_HEX, NULL, 0x3E00, "High Throughput Control Reserved", HFILL }},
16142     {&hf_ieee80211_htc_ac_constraint,
16143      {"AC Constraint", "wlan_mgt.htc.ac_constraint",
16144       FT_BOOLEAN, 16, NULL, 0x4000, "High Throughput Control AC Constraint", HFILL }},
16145     {&hf_ieee80211_htc_rdg_more_ppdu,
16146      {"RDG/More PPDU", "wlan_mgt.htc.rdg_more_ppdu",
16147       FT_BOOLEAN, 16, NULL, 0x8000, "High Throughput Control RDG/More PPDU", HFILL }},
16148     /* End: HT Control (+HTC) */
16149
16150     /* MDIE */
16151     {&hf_ieee80211_tag_mobility_domain_mdid,
16152      {"Mobility Domain Identifier", "wlan_mgt.mobility_domain.mdid",
16153       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
16154     {&hf_ieee80211_tag_mobility_domain_ft_capab,
16155      {"FT Capability and Policy", "wlan_mgt.mobility_domain.ft_capab",
16156       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
16157     {&hf_ieee80211_tag_mobility_domain_ft_capab_ft_over_ds,
16158      {"Fast BSS Transition over DS",
16159       "wlan_mgt.mobility_domain.ft_capab.ft_over_ds",
16160       FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL }},
16161     {&hf_ieee80211_tag_mobility_domain_ft_capab_resource_req,
16162      {"Resource Request Protocol Capability",
16163       "wlan_mgt.mobility_domain.ft_capab.resource_req",
16164       FT_UINT8, BASE_HEX, NULL, 0x02, NULL, HFILL }},
16165
16166     /* FTIE */
16167     {&hf_ieee80211_tag_ft_mic_control,
16168      {"MIC Control", "wlan_mgt.ft.mic_control",
16169       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
16170     {&hf_ieee80211_tag_ft_element_count,
16171      {"Element Count", "wlan_mgt.ft.element_count",
16172       FT_UINT16, BASE_DEC, NULL, 0xff00, NULL, HFILL }},
16173     {&hf_ieee80211_tag_ft_mic,
16174      {"MIC", "wlan_mgt.ft.mic",
16175       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16176     {&hf_ieee80211_tag_ft_anonce,
16177      {"ANonce", "wlan_mgt.ft.anonce",
16178       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16179     {&hf_ieee80211_tag_ft_snonce,
16180      {"SNonce", "wlan_mgt.ft.snonce",
16181       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16182     {&hf_ieee80211_tag_ft_subelem_id,
16183      {"Subelement ID", "wlan_mgt.ft.subelem.id",
16184       FT_UINT8, BASE_DEC, VALS(ft_subelem_id_vals), 0, NULL, HFILL }},
16185     {&hf_ieee80211_tag_ft_subelem_len,
16186      {"Length", "wlan_mgt.ft.subelem.len",
16187       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16188     {&hf_ieee80211_tag_ft_subelem_data,
16189      {"Data", "wlan_mgt.ft.subelem.data",
16190       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16191     {&hf_ieee80211_tag_ft_subelem_r1kh_id,
16192      {"PMK-R1 key holder identifier (R1KH-ID)", "wlan_mgt.ft.subelem.r1kh_id",
16193       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16194     {&hf_ieee80211_tag_ft_subelem_gtk_key_info,
16195      {"Key Info", "wlan_mgt.ft.subelem.gtk.key_info",
16196       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
16197     {&hf_ieee80211_tag_ft_subelem_gtk_key_id,
16198      {"Key ID", "wlan_mgt.ft.subelem.gtk.key_id",
16199       FT_UINT16, BASE_DEC, NULL, 0x0003, NULL, HFILL }},
16200     {&hf_ieee80211_tag_ft_subelem_gtk_key_length,
16201      {"Key Length", "wlan_mgt.ft.subelem.gtk.key_length",
16202       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
16203     {&hf_ieee80211_tag_ft_subelem_gtk_rsc,
16204      {"RSC", "wlan_mgt.ft.subelem.gtk.rsc",
16205       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16206     {&hf_ieee80211_tag_ft_subelem_gtk_key,
16207      {"GTK", "wlan_mgt.ft.subelem.gtk.key",
16208       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16209     {&hf_ieee80211_tag_ft_subelem_r0kh_id,
16210      {"PMK-R0 key holder identifier (R0KH-ID)", "wlan_mgt.ft.subelem.r0kh_id",
16211       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
16212     {&hf_ieee80211_tag_ft_subelem_igtk_key_id,
16213      {"Key ID", "wlan_mgt.ft.subelem.igtk.key_id",
16214       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16215     {&hf_ieee80211_tag_ft_subelem_igtk_ipn,
16216      {"IPN", "wlan_mgt.ft.subelem.igtk.ipn",
16217       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16218     {&hf_ieee80211_tag_ft_subelem_igtk_key_length,
16219      {"Key Length", "wlan_mgt.ft.subelem.igtk.key_length",
16220       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
16221     {&hf_ieee80211_tag_ft_subelem_igtk_key,
16222      {"Wrapped Key (IGTK)", "wlan_mgt.ft.subelem.igtk.key",
16223       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16224
16225     /* MMIE */
16226     {&hf_ieee80211_tag_mmie_keyid,
16227      {"KeyID", "wlan_mgt.mmie.keyid",
16228       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16229     {&hf_ieee80211_tag_mmie_ipn,
16230      {"IPN", "wlan_mgt.mmie.ipn",
16231       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16232     {&hf_ieee80211_tag_mmie_mic,
16233      {"MIC", "wlan_mgt.mmie.mic",
16234       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16235
16236     /* Time Advertisement */
16237     {&hf_ieee80211_tag_time_adv_timing_capab,
16238      {"Timing capabilities", "wlan_mgt.time_adv.timing_capab",
16239       FT_UINT8, BASE_DEC, VALS(time_adv_timing_capab_vals), 0, NULL, HFILL }},
16240     {&hf_ieee80211_tag_time_adv_time_value,
16241      {"Time Value", "wlan_mgt.time_adv.time_value",
16242       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16243     {&hf_ieee80211_tag_time_adv_time_value_year,
16244      {"Time Value: Year", "wlan_mgt.time_adv.time_value.year",
16245       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16246     {&hf_ieee80211_tag_time_adv_time_value_month,
16247      {"Time Value: Month", "wlan_mgt.time_adv.time_value.month",
16248       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16249     {&hf_ieee80211_tag_time_adv_time_value_day,
16250      {"Time Value: Day", "wlan_mgt.time_adv.time_value.month",
16251       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16252     {&hf_ieee80211_tag_time_adv_time_value_hours,
16253      {"Time Value: Hours", "wlan_mgt.time_adv.time_value.hours",
16254       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16255     {&hf_ieee80211_tag_time_adv_time_value_minutes,
16256      {"Time Value: Minutes", "wlan_mgt.time_adv.time_value.minutes",
16257       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16258     {&hf_ieee80211_tag_time_adv_time_value_seconds,
16259      {"Time Value: Seconds", "wlan_mgt.time_adv.time_value.seconds",
16260       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16261     {&hf_ieee80211_tag_time_adv_time_value_milliseconds,
16262      {"Time Value: Milliseconds", "wlan_mgt.time_adv.time_value.milliseconds",
16263       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16264     {&hf_ieee80211_tag_time_adv_time_value_reserved,
16265      {"Time Value: Reserved", "wlan_mgt.time_adv.time_value.reserved",
16266       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16267     {&hf_ieee80211_tag_time_adv_time_error,
16268      {"Time Error", "wlan_mgt.time_adv.time_error",
16269       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16270     {&hf_ieee80211_tag_time_adv_time_update_counter,
16271      {"Time Update Counter", "wlan_mgt.time_adv.time_update_counter",
16272       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16273
16274     /* Time Zone */
16275     {&hf_ieee80211_tag_time_zone,
16276      {"Time Zone", "wlan_mgt.time_zone",
16277       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
16278
16279     /* Interworking */
16280     {&hf_ieee80211_tag_interworking_access_network_type,
16281      {"Access Network Type", "wlan_mgt.interworking.access_network_type",
16282       FT_UINT8, BASE_DEC, VALS(access_network_type_vals), 0x0f, NULL, HFILL }},
16283     {&hf_ieee80211_tag_interworking_internet,
16284      {"Internet", "wlan_mgt.interworking.internet",
16285       FT_UINT8, BASE_DEC, NULL, 0x10, NULL, HFILL }},
16286     {&hf_ieee80211_tag_interworking_asra,
16287      {"ASRA", "wlan_mgt.interworking.asra",
16288       FT_UINT8, BASE_DEC, NULL, 0x20, "Additional Step Required for Access",
16289       HFILL }},
16290     {&hf_ieee80211_tag_interworking_esr,
16291      {"ESR", "wlan_mgt.interworking.esr",
16292       FT_UINT8, BASE_DEC, NULL, 0x40, "Emergency services reachable", HFILL }},
16293     {&hf_ieee80211_tag_interworking_uesa,
16294      {"UESA", "wlan_mgt.interworking.uesa",
16295       FT_UINT8, BASE_DEC, NULL, 0x80,
16296       "Unauthenticated emergency service accessible", HFILL }},
16297     {&hf_ieee80211_tag_interworking_hessid,
16298      {"HESSID", "wlan_mgt.interworking.hessid",
16299       FT_ETHER, BASE_NONE, NULL, 0, "Homogeneous ESS identifier", HFILL }},
16300
16301     /* Advertisement Protocol */
16302     {&hf_ieee80211_tag_adv_proto_resp_len_limit,
16303      {"Query Response Length Limit", "wlan_mgt.adv_proto.resp_len_limit",
16304       FT_UINT8, BASE_DEC, NULL, 0x7f, NULL, HFILL }},
16305     {&hf_ieee80211_tag_adv_proto_pame_bi,
16306      {"PAME-BI", "wlan_mgt.adv_proto.pame_bi",
16307       FT_UINT8, BASE_DEC, NULL, 0x80,
16308       "Pre-Association Message Xchange BSSID Independent (PAME-BI)", HFILL }},
16309     {&hf_ieee80211_tag_adv_proto_id,
16310      {"Advertisement Protocol ID", "wlan_mgt.adv_proto.id",
16311       FT_UINT8, BASE_DEC, VALS(adv_proto_id_vals), 0, NULL, HFILL }},
16312
16313     /* Roaming Consortium */
16314     {&hf_ieee80211_tag_roaming_consortium_num_anqp_oi,
16315      {"Number of ANQP OIs", "wlan_mgt.roaming_consortium.num_anqp_oi",
16316       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16317     {&hf_ieee80211_tag_roaming_consortium_oi1_len,
16318      {"OI #1 Length", "wlan_mgt.roaming_consortium.oi1_len",
16319       FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL }},
16320     {&hf_ieee80211_tag_roaming_consortium_oi2_len,
16321      {"OI #2 Length", "wlan_mgt.roaming_consortium.oi2_len",
16322       FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL }},
16323     {&hf_ieee80211_tag_roaming_consortium_oi1,
16324      {"OI #1", "wlan_mgt.roaming_consortium.oi1",
16325       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16326     {&hf_ieee80211_tag_roaming_consortium_oi2,
16327      {"OI #2", "wlan_mgt.roaming_consortium.oi2",
16328       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16329     {&hf_ieee80211_tag_roaming_consortium_oi3,
16330      {"OI #3", "wlan_mgt.roaming_consortium.oi3",
16331       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16332
16333     /* Timeout Interval */
16334     {&hf_ieee80211_tag_timeout_int_type,
16335      {"Timeout Interval Type", "wlan_mgt.timeout_int.type",
16336       FT_UINT8, BASE_DEC, VALS(timeout_int_types), 0, NULL, HFILL }},
16337     {&hf_ieee80211_tag_timeout_int_value,
16338      {"Timeout Interval Value", "wlan_mgt.timeout_int.value",
16339       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
16340
16341     /* Link Identifier */
16342     {&hf_ieee80211_tag_link_id_bssid,
16343      {"BSSID", "wlan_mgt.link_id.bssid",
16344       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
16345     {&hf_ieee80211_tag_link_id_init_sta,
16346      {"TDLS initiator STA Address", "wlan_mgt.link_id.init_sta",
16347       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
16348     {&hf_ieee80211_tag_link_id_resp_sta,
16349      {"TDLS responder STA Address", "wlan_mgt.link_id.resp_sta",
16350       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
16351
16352     /* Wakeup Schedule */
16353     {&hf_ieee80211_tag_wakeup_schedule_offset,
16354      {"Offset", "wlan_mgt.wakeup_schedule.offset",
16355       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
16356     {&hf_ieee80211_tag_wakeup_schedule_interval,
16357      {"Interval", "wlan_mgt.wakeup_schedule.interval",
16358       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
16359     {&hf_ieee80211_tag_wakeup_schedule_awake_window_slots,
16360      {"Awake Window Slots", "wlan_mgt.wakeup_schedule.awake_window_slots",
16361       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
16362     {&hf_ieee80211_tag_wakeup_schedule_max_awake_dur,
16363      {"Maximum Awake Window Duration",
16364       "wlan_mgt.wakeup_schedule.max_awake_dur",
16365       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
16366     {&hf_ieee80211_tag_wakeup_schedule_idle_count,
16367      {"Idle Count", "wlan_mgt.wakeup_schedule.idle_count",
16368       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16369
16370     /* Channel Switch Timing */
16371     {&hf_ieee80211_tag_channel_switch_timing_switch_time,
16372      {"Switch Time", "wlan_mgt.channel_switch_timing.switch_time",
16373       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16374     {&hf_ieee80211_tag_channel_switch_timing_switch_timeout,
16375      {"Switch Timeout", "wlan_mgt.channel_switch_timing.switch_timeout",
16376       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16377
16378     /* PTI Control */
16379     {&hf_ieee80211_tag_pti_control_tid,
16380      {"TID", "wlan_mgt.pti_control.tid",
16381       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16382     {&hf_ieee80211_tag_pti_control_sequence_control,
16383      {"Sequence Control", "wlan_mgt.pti_control.sequence_control",
16384       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
16385
16386     /* PU Buffer Status */
16387     {&hf_ieee80211_tag_pu_buffer_status_ac_bk,
16388      {"AC_BK traffic available", "wlan_mgt.pu_buffer_status.ac_bk",
16389       FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }},
16390     {&hf_ieee80211_tag_pu_buffer_status_ac_be,
16391      {"AC_BE traffic available", "wlan_mgt.pu_buffer_status.ac_be",
16392       FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL }},
16393     {&hf_ieee80211_tag_pu_buffer_status_ac_vi,
16394      {"AC_VI traffic available", "wlan_mgt.pu_buffer_status.ac_vi",
16395       FT_UINT8, BASE_DEC, NULL, 0x04, NULL, HFILL }},
16396     {&hf_ieee80211_tag_pu_buffer_status_ac_vo,
16397      {"AC_VO traffic available", "wlan_mgt.pu_buffer_status.ac_vo",
16398       FT_UINT8, BASE_DEC, NULL, 0x08, NULL, HFILL }}
16399   };
16400
16401   static hf_register_info aggregate_fields[] = {
16402     {&hf_ieee80211_amsdu_msdu_header_text,
16403      {"MAC Service Data Unit (MSDU)", "wlan_aggregate.msduheader", FT_UINT16,
16404       BASE_DEC, 0, 0x0000, NULL, HFILL }}
16405   };
16406
16407   static uat_field_t wep_uat_flds[] = {
16408
16409       UAT_FLD_VS(uat_wep_key_records, key, "Key type", wep_type_vals,
16410                         "Decryption key type used"),
16411       UAT_FLD_CSTRING(uat_wep_key_records, string, "Key",
16412                         "wep:<wep hexadecimal key>\n"
16413                         "wpa-pwd:<passphrase>[:<ssid>]\n"
16414                         "wpa-psk:<wpa hexadecimal key>"),
16415       UAT_END_FIELDS
16416     };
16417
16418   static gint *tree_array[] = {
16419     &ett_80211,
16420     &ett_fc_tree,
16421     &ett_proto_flags,
16422     &ett_fragments,
16423     &ett_fragment,
16424     &ett_block_ack,
16425     &ett_block_ack_bitmap,
16426     &ett_80211_mgt,
16427     &ett_fixed_parameters,
16428     &ett_tagged_parameters,
16429     &ett_tag_bmapctl_tree,
16430     &ett_tag_country_fnm_tree,
16431     &ett_tag_country_rcc_tree,
16432     &ett_qos_parameters,
16433     &ett_qos_ps_buf_state,
16434     &ett_qos_info_field_tree,
16435     &ett_wep_parameters,
16436     &ett_msh_control,
16437     &ett_hwmp_targ_flags_tree,
16438     &ett_cap_tree,
16439     &ett_rsn_gcs_tree,
16440     &ett_rsn_pcs_tree,
16441     &ett_rsn_sub_pcs_tree,
16442     &ett_rsn_akms_tree,
16443     &ett_rsn_sub_akms_tree,
16444     &ett_rsn_cap_tree,
16445     &ett_rsn_pmkid_tree,
16446     &ett_rsn_gmcs_tree,
16447     &ett_wpa_mcs_tree,
16448     &ett_wpa_ucs_tree,
16449     &ett_wpa_sub_ucs_tree,
16450     &ett_wpa_akms_tree,
16451     &ett_wpa_sub_akms_tree,
16452     &ett_wme_ac,
16453     &ett_wme_aci_aifsn,
16454     &ett_wme_ecw,
16455     &ett_wme_qos_info,
16456     &ett_ht_cap_tree,
16457     &ett_ath_cap_tree,
16458     &ett_ff_ba_param_tree,
16459     &ett_ff_qos_info,
16460     &ett_ff_sm_pwr_save,
16461     &ett_ff_psmp_param_set,
16462     &ett_ff_mimo_cntrl,
16463     &ett_ff_ant_sel,
16464     &ett_ff_chan_switch_announce,
16465     &ett_ff_ht_info,
16466     &ett_ff_psmp_sta_info,
16467     &ett_ff_delba_param_tree,
16468     &ett_ff_ba_ssc_tree,
16469     &ett_mimo_report,
16470     &ett_cntrl_wrapper_fc,
16471     &ett_cntrl_wrapper_payload,
16472     &ett_ht_info_delimiter1_tree,
16473     &ett_ht_info_delimiter2_tree,
16474     &ett_ht_info_delimiter3_tree,
16475     &ett_msdu_aggregation_parent_tree,
16476     &ett_msdu_aggregation_subframe_tree,
16477     &ett_tag_measure_request_mode_tree,
16478     &ett_tag_measure_request_type_tree,
16479     &ett_tag_measure_report_mode_tree,
16480     &ett_tag_measure_report_type_tree,
16481     &ett_tag_measure_report_basic_map_tree,
16482     &ett_tag_measure_report_rpi_tree,
16483     &ett_tag_measure_report_frame_tree,
16484     &ett_tag_dfs_map_tree,
16485     &ett_tag_erp_info_tree,
16486     &ett_tag_ex_cap,
16487     &ett_tag_supported_channels,
16488     &ett_tag_neighbor_report_bssid_info_tree,
16489     &ett_tag_neighbor_report_bssid_info_capability_tree,
16490     &ett_tag_neighbor_report_sub_tag_tree,
16491     &ett_ampduparam_tree,
16492     &ett_mcsset_tree,
16493     &ett_mcsbit_tree,
16494     &ett_htex_cap_tree,
16495     &ett_txbf_tree,
16496     &ett_hta_cap_tree,
16497     &ett_hta_cap1_tree,
16498     &ett_hta_cap2_tree,
16499     &ett_htc_tree,
16500     &ett_antsel_tree,
16501     &ett_80211_mgt_ie,
16502     &ett_tsinfo_tree,
16503     &ett_sched_tree,
16504     &ett_fcs,
16505     &ett_tag_time_adv_tree,
16506     &ett_adv_proto,
16507     &ett_adv_proto_tuple,
16508     &ett_gas_query,
16509     &ett_gas_resp_fragment,
16510     &ett_gas_resp_fragments,
16511     &ett_gas_anqp,
16512     &ett_nai_realm,
16513     &ett_nai_realm_eap,
16514     &ett_anqp_vendor_capab
16515   };
16516   module_t *wlan_module;
16517
16518   memset (&wlan_stats, 0, sizeof wlan_stats);
16519
16520   proto_aggregate = proto_register_protocol("IEEE 802.11 wireless LAN aggregate frame",
16521       "IEEE 802.11 Aggregate Data", "wlan_aggregate");
16522   proto_register_field_array(proto_aggregate, aggregate_fields, array_length(aggregate_fields));
16523   proto_wlan = proto_register_protocol ("IEEE 802.11 wireless LAN",
16524       "IEEE 802.11", "wlan");
16525   proto_register_field_array (proto_wlan, hf, array_length (hf));
16526   proto_wlan_mgt = proto_register_protocol ("IEEE 802.11 wireless LAN management frame",
16527       "802.11 MGT", "wlan_mgt");
16528   proto_register_field_array (proto_wlan_mgt, ff, array_length (ff));
16529   proto_register_subtree_array (tree_array, array_length (tree_array));
16530
16531   register_dissector("wlan", dissect_ieee80211, proto_wlan);
16532   register_dissector("wlan_fixed", dissect_ieee80211_fixed, proto_wlan);
16533   register_dissector("wlan_bsfc", dissect_ieee80211_bsfc, proto_wlan);
16534   register_dissector("wlan_datapad", dissect_ieee80211_datapad, proto_wlan);
16535   register_dissector("wlan_ht", dissect_ieee80211_ht, proto_wlan);
16536   register_init_routine(wlan_defragment_init);
16537   register_init_routine(wlan_retransmit_init);
16538   register_init_routine(ieee80211_gas_reassembly_init);
16539
16540   wlan_tap = register_tap("wlan");
16541
16542   /* Register configuration options */
16543   wlan_module = prefs_register_protocol(proto_wlan, init_wepkeys);
16544   prefs_register_bool_preference(wlan_module, "defragment",
16545     "Reassemble fragmented 802.11 datagrams",
16546     "Whether fragmented 802.11 datagrams should be reassembled",
16547      &wlan_defragment);
16548
16549   prefs_register_bool_preference(wlan_module, "ignore_draft_ht",
16550     "Ignore vendor-specific HT elements",
16551     "Don't dissect 802.11n draft HT elements (which might contain duplicate information).",
16552     &wlan_ignore_draft_ht);
16553
16554   prefs_register_bool_preference(wlan_module, "retransmitted",
16555     "Call subdissector for retransmitted 802.11 frames",
16556     "Whether retransmitted 802.11 frames should be subdissected",
16557     &wlan_subdissector);
16558
16559   prefs_register_bool_preference(wlan_module, "check_fcs",
16560     "Assume packets have FCS",
16561     "Some 802.11 cards include the FCS at the end of a packet, others do not.",
16562     &wlan_check_fcs);
16563
16564   /* Davide Schiera (2006-11-26): changed "WEP bit" in "Protection bit"    */
16565   /*    (according to the document IEEE Std 802.11i-2004)              */
16566   prefs_register_enum_preference(wlan_module, "ignore_wep",
16567     "Ignore the Protection bit",
16568     "Some 802.11 cards leave the Protection bit set even though the packet is decrypted, "
16569     "and some also leave the IV (initialization vector).",
16570     &wlan_ignore_wep, wlan_ignore_wep_options, TRUE);
16571
16572   prefs_register_obsolete_preference(wlan_module, "wep_keys");
16573
16574   /* Davide Schiera (2006-11-26): added reference to WPA/WPA2 decryption    */
16575   prefs_register_bool_preference(wlan_module, "enable_decryption",
16576     "Enable decryption", "Enable WEP and WPA/WPA2 decryption",
16577     &enable_decryption);
16578
16579   prefs_register_static_text_preference(wlan_module, "info_decryption_key",
16580     "Key examples: 01:02:03:04:05 (40/64-bit WEP),\n"
16581     "010203040506070809101111213 (104/128-bit WEP),\n"
16582     "MyPassword[:MyAP] (WPA + plaintext password [+ SSID]),\n"
16583     "0102030405...6061626364 (WPA + 256-bit key).  "
16584     "Invalid keys will be ignored.",
16585     "Valid key formats");
16586
16587     wep_uat = uat_new("WEP and WPA Decryption Keys",
16588             sizeof(uat_wep_key_record_t),  /* record size */
16589             "80211_keys",               /* filename */
16590             TRUE,                       /* from_profile */
16591             (void*) &uat_wep_key_records,  /* data_ptr */
16592             &num_wepkeys_uat,           /* numitems_ptr */
16593             UAT_CAT_CRYPTO,             /* category */
16594             NULL,                       /* help */
16595             uat_wep_key_record_copy_cb,        /* copy callback */
16596             uat_wep_key_record_update_cb,      /* update callback */
16597             uat_wep_key_record_free_cb,        /* free callback */
16598             NULL,                       /* post update callback */
16599             wep_uat_flds);             /* UAT field definitions */
16600
16601     prefs_register_uat_preference(wlan_module,
16602                                    "wep_key_table",
16603                                    "Decryption Keys",
16604                                    "WEP and pre-shared WPA keys",
16605                                    wep_uat);
16606 }
16607
16608 static void
16609 dissect_data_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
16610 {
16611   int offset = 0;
16612   guint8 type;
16613   int tagged_parameter_tree_len;
16614   proto_tree *tagged_tree;
16615
16616   g_pinfo = pinfo;
16617
16618   type = tvb_get_guint8(tvb, offset);
16619   proto_tree_add_item(tree, hf_ieee80211_data_encap_payload_type, tvb, offset,
16620                       1, ENC_BIG_ENDIAN);
16621   offset++;
16622   switch (type) {
16623   case 1:
16624     col_set_str(pinfo->cinfo, COL_PROTOCOL, "RRB");
16625     /* TODO: IEEE 802.11r */
16626     break;
16627   case 2:
16628     col_set_str(pinfo->cinfo, COL_PROTOCOL, "TDLS");
16629     col_clear(pinfo->cinfo, COL_INFO);
16630     offset += add_fixed_field(tree, tvb, offset, FIELD_ACTION);
16631     tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
16632     if (tagged_parameter_tree_len > 0) {
16633       tagged_tree = get_tagged_parameter_tree(tree, tvb, offset,
16634                                               tagged_parameter_tree_len);
16635       ieee_80211_add_tagged_parameters(tvb, offset, pinfo, tagged_tree,
16636                                        tagged_parameter_tree_len, -1);
16637     }
16638     break;
16639   }
16640 }
16641
16642 void
16643 proto_reg_handoff_ieee80211(void)
16644 {
16645   dissector_handle_t data_encap_handle;
16646
16647   /*
16648    * Get handles for the LLC, IPX and Ethernet  dissectors.
16649    */
16650   llc_handle = find_dissector("llc");
16651   ipx_handle = find_dissector("ipx");
16652   eth_withoutfcs_handle = find_dissector("eth_withoutfcs");
16653   data_handle = find_dissector("data");
16654
16655   ieee80211_handle = find_dissector("wlan");
16656   dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11, ieee80211_handle);
16657   dissector_add_uint("ethertype", ETHERTYPE_CENTRINO_PROMISC, ieee80211_handle);
16658
16659   /* Register handoff to Aruba GRE */
16660   dissector_add_uint("gre.proto", GRE_ARUBA_8200, ieee80211_handle);
16661   dissector_add_uint("gre.proto", GRE_ARUBA_8210, ieee80211_handle);
16662   dissector_add_uint("gre.proto", GRE_ARUBA_8220, ieee80211_handle);
16663   dissector_add_uint("gre.proto", GRE_ARUBA_8230, ieee80211_handle);
16664   dissector_add_uint("gre.proto", GRE_ARUBA_8240, ieee80211_handle);
16665   dissector_add_uint("gre.proto", GRE_ARUBA_8250, ieee80211_handle);
16666   dissector_add_uint("gre.proto", GRE_ARUBA_8260, ieee80211_handle);
16667   dissector_add_uint("gre.proto", GRE_ARUBA_8270, ieee80211_handle);
16668   dissector_add_uint("gre.proto", GRE_ARUBA_8280, ieee80211_handle);
16669   dissector_add_uint("gre.proto", GRE_ARUBA_8290, ieee80211_handle);
16670   dissector_add_uint("gre.proto", GRE_ARUBA_82A0, ieee80211_handle);
16671   dissector_add_uint("gre.proto", GRE_ARUBA_82B0, ieee80211_handle);
16672   dissector_add_uint("gre.proto", GRE_ARUBA_82C0, ieee80211_handle);
16673   dissector_add_uint("gre.proto", GRE_ARUBA_82D0, ieee80211_handle);
16674   dissector_add_uint("gre.proto", GRE_ARUBA_82E0, ieee80211_handle);
16675   dissector_add_uint("gre.proto", GRE_ARUBA_82F0, ieee80211_handle);
16676   dissector_add_uint("gre.proto", GRE_ARUBA_8300, ieee80211_handle);
16677   dissector_add_uint("gre.proto", GRE_ARUBA_8310, ieee80211_handle);
16678   dissector_add_uint("gre.proto", GRE_ARUBA_8320, ieee80211_handle);
16679   dissector_add_uint("gre.proto", GRE_ARUBA_8330, ieee80211_handle);
16680   dissector_add_uint("gre.proto", GRE_ARUBA_8340, ieee80211_handle);
16681   dissector_add_uint("gre.proto", GRE_ARUBA_8350, ieee80211_handle);
16682   dissector_add_uint("gre.proto", GRE_ARUBA_8360, ieee80211_handle);
16683   dissector_add_uint("gre.proto", GRE_ARUBA_8370, ieee80211_handle);
16684
16685   data_encap_handle = create_dissector_handle(dissect_data_encap, proto_wlan);
16686   dissector_add_uint("ethertype", ETHERTYPE_IEEE80211_DATA_ENCAP,
16687                 data_encap_handle);
16688 }
16689
16690 /* Davide Schiera (2006-11-26): this function will try to decrypt with WEP or  */
16691 /* WPA and return a tvb to the caller to add a new tab. It returns the    */
16692 /* algorithm used for decryption (WEP, TKIP, CCMP) and the header and    */
16693 /* trailer lengths.                                      */
16694 static tvbuff_t *
16695 try_decrypt(tvbuff_t *tvb, guint offset, guint len, guint8 *algorithm, guint32 *sec_header, guint32 *sec_trailer) {
16696   const guint8 *enc_data;
16697   guint8 *tmp = NULL;
16698   tvbuff_t *decr_tvb = NULL;
16699   guint32 dec_caplen;
16700   guchar dec_data[AIRPDCAP_MAX_CAPLEN];
16701   AIRPDCAP_KEY_ITEM used_key;
16702
16703   if (!enable_decryption)
16704     return NULL;
16705
16706   /* get the entire packet                                  */
16707   enc_data = tvb_get_ptr(tvb, 0, len+offset);
16708
16709   /*  process packet with AirPDcap                              */
16710   if (AirPDcapPacketProcess(&airpdcap_ctx, enc_data, offset, offset+len, dec_data, &dec_caplen, &used_key, FALSE, TRUE)==AIRPDCAP_RET_SUCCESS)
16711   {
16712     *algorithm=used_key.KeyType;
16713     switch (*algorithm) {
16714       case AIRPDCAP_KEY_TYPE_WEP:
16715         *sec_header=AIRPDCAP_WEP_HEADER;
16716         *sec_trailer=AIRPDCAP_WEP_TRAILER;
16717         break;
16718       case AIRPDCAP_KEY_TYPE_CCMP:
16719         *sec_header=AIRPDCAP_RSNA_HEADER;
16720         *sec_trailer=AIRPDCAP_CCMP_TRAILER;
16721         break;
16722       case AIRPDCAP_KEY_TYPE_TKIP:
16723         *sec_header=AIRPDCAP_RSNA_HEADER;
16724         *sec_trailer=AIRPDCAP_TKIP_TRAILER;
16725         break;
16726       default:
16727         return NULL;
16728     }
16729
16730     /* allocate buffer for decrypted payload                      */
16731     tmp = g_memdup(dec_data+offset, dec_caplen-offset);
16732
16733     len=dec_caplen-offset;
16734
16735     /* decrypt successful, let's set up a new data tvb.              */
16736     decr_tvb = tvb_new_child_real_data(tvb, tmp, len, len);
16737     tvb_set_free_cb(decr_tvb, g_free);
16738   } else
16739     g_free(tmp);
16740
16741   return decr_tvb;
16742 }
16743 /*  Davide Schiera -----------------------------------------------------------  */
16744
16745
16746 /* Collect our WEP and WPA keys */
16747 static
16748 void set_airpdcap_keys(void)
16749 {
16750   guint i = 0;
16751   AIRPDCAP_KEY_ITEM key;
16752   PAIRPDCAP_KEYS_COLLECTION keys;
16753   decryption_key_t* dk = NULL;
16754   GByteArray *bytes = NULL;
16755   gboolean res;
16756
16757   keys=(PAIRPDCAP_KEYS_COLLECTION)g_malloc(sizeof(AIRPDCAP_KEYS_COLLECTION));
16758   keys->nKeys = 0;
16759
16760   for(i = 0; (uat_wep_key_records != NULL) && (i < num_wepkeys_uat) && (i < MAX_ENCRYPTION_KEYS); i++)
16761   {
16762     dk = parse_key_string(uat_wep_key_records[i].string, uat_wep_key_records[i].key);
16763
16764     if(dk != NULL)
16765     {
16766       if(dk->type == AIRPDCAP_KEY_TYPE_WEP)
16767       {
16768         key.KeyType = AIRPDCAP_KEY_TYPE_WEP;
16769
16770         bytes = g_byte_array_new();
16771         res = hex_str_to_bytes(dk->key->str, bytes, FALSE);
16772
16773         if (dk->key->str && res && bytes->len > 0 && bytes->len <= AIRPDCAP_WEP_KEY_MAXLEN)
16774         {
16775           /*
16776            * WEP key is correct (well, the can be even or odd, so it is not
16777            * a real check, I think... is a check performed somewhere in the
16778            * AirPDcap function??? )
16779            */
16780           memcpy(key.KeyData.Wep.WepKey, bytes->data, bytes->len);
16781           key.KeyData.Wep.WepKeyLen = bytes->len;
16782           keys->Keys[keys->nKeys] = key;
16783           keys->nKeys++;
16784         }
16785       }
16786       else if(dk->type == AIRPDCAP_KEY_TYPE_WPA_PWD)
16787       {
16788         key.KeyType = AIRPDCAP_KEY_TYPE_WPA_PWD;
16789
16790         /* XXX - This just lops the end if the key off if it's too long.
16791          *       Should we handle this more gracefully? */
16792         g_strlcpy(key.UserPwd.Passphrase, dk->key->str, AIRPDCAP_WPA_PASSPHRASE_MAX_LEN+1);
16793
16794         key.UserPwd.SsidLen = 0;
16795         if(dk->ssid != NULL && dk->ssid->len <= AIRPDCAP_WPA_SSID_MAX_LEN)
16796         {
16797           memcpy(key.UserPwd.Ssid, dk->ssid->data, dk->ssid->len);
16798           key.UserPwd.SsidLen = dk->ssid->len;
16799         }
16800
16801         keys->Keys[keys->nKeys] = key;
16802         keys->nKeys++;
16803       }
16804       else if(dk->type == AIRPDCAP_KEY_TYPE_WPA_PMK)
16805       {
16806         key.KeyType = AIRPDCAP_KEY_TYPE_WPA_PMK;
16807
16808         bytes = g_byte_array_new();
16809         hex_str_to_bytes(dk->key->str, bytes, FALSE);
16810
16811         /* XXX - Pass the correct array of bytes... */
16812         if (bytes->len <= AIRPDCAP_WPA_PMK_LEN) {
16813           memcpy(key.KeyData.Wpa.Pmk, bytes->data, bytes->len);
16814
16815           keys->Keys[keys->nKeys] = key;
16816           keys->nKeys++;
16817         }
16818       }
16819     }
16820   }
16821
16822   /* Now set the keys */
16823   AirPDcapSetKeys(&airpdcap_ctx,keys->Keys,keys->nKeys);
16824   g_free(keys);
16825   if (bytes)
16826     g_byte_array_free(bytes, TRUE);
16827
16828 }
16829
16830 static void init_wepkeys(void) {
16831
16832   /*
16833    * XXX - AirPDcap - That God sends it to us beautiful (che dio ce la mandi bona)
16834    * The next lines will add a key to the AirPDcap context. The keystring will be added
16835    * to the old WEP array too, but we don't care, because the packets will come here
16836    * already decrypted... One of these days we will fix this too
16837    */
16838   set_airpdcap_keys();
16839 }
16840 /*
16841  * This code had been taken from AirSnort crack.c function classify()
16842  * Permission granted by snax <at> shmoo dot com
16843  * weak_iv - determine which key byte an iv is useful in resolving
16844  * parm     - p, pointer to the first byte of an IV
16845  * return   -  n - this IV is weak for byte n of a WEP key
16846  *            -1 - this IV is not weak for any key bytes
16847  *
16848  * This function tests for IVs that are known to satisfy the criteria
16849  * for a weak IV as specified in FMS section 7.1
16850  *
16851  */
16852 static int
16853 weak_iv(guchar *iv)
16854 {
16855   guchar sum, k;
16856
16857   if (iv[1] == 255 && iv[0] > 2 && iv[0] < 16) {
16858     return iv[0] -3;
16859   }
16860
16861   sum = iv[0] + iv[1];
16862   if (sum == 1) {
16863     if (iv[2] <= 0x0a) {
16864       return iv[2] +2;
16865     }
16866     else if (iv[2] == 0xff){
16867       return 0;
16868     }
16869   }
16870   k = 0xfe - iv[2];
16871   if (sum == k  && (iv[2] >= 0xf2 && iv[2] <= 0xfe && iv[2] != 0xfd)){
16872     return k;
16873   }
16874   return -1;
16875 }
16876
16877 /*
16878  * Editor modelines
16879  *
16880  * Local Variables:
16881  * c-basic-offset: 2
16882  * tab-width: 8
16883  * indent-tabs-mode: nil
16884  * End:
16885  *
16886  * ex: set shiftwidth=2 tabstop=8 expandtab:
16887  * :indentSize=2:tabSize=8:noTabs=true:
16888  */