Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
[obnox/wireshark/wip.git] / epan / dissectors / packet-ieee80211.c
1 /* packet-ieee80211.c
2  * Routines for Wireless LAN (IEEE 802.11) dissection
3  * Copyright 2000, Axis Communications AB
4  * Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com
5  *
6  * $Id$
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 Gerald Combs
11  *
12  * Copied from README.developer
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27  *
28  * Credits:
29  *
30  * The following people helped me by pointing out bugs etc. Thank you!
31  *
32  * Marco Molteni
33  * Lena-Marie Nilsson
34  * Magnus Hultman-Persson
35  */
36
37 /*
38  * 09/12/2003 - Added dissection of country information tag
39  *
40  * Ritchie<at>tipsybottle.com
41  *
42  * 03/22/2004 - Added dissection of RSN IE
43  * Jouni Malinen <jkmaline@cc.hut.fi>
44  *
45  * 10/24/2005 - Add dissection for 802.11e
46  * Zhu Yi <yi.zhu@intel.com>
47  *
48  * Dutin Johnson - 802.11n and portions of 802.11k and 802.11ma
49  * dustin@dustinj.us & dustin.johnson@cacetech.com
50  *
51  * 01/31/2008 - Added dissection of 802.11s
52  * Javier Cardona <javier@cozybit.com>
53  *
54  * 04/21/2008 - Added dissection for 802.11p
55  * Arada Systems <http://www.aradasystems.com>
56  *
57  * 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 <stdlib.h>
102 #include <string.h>
103 #include <math.h>
104
105 #include <glib.h>
106
107 #include <epan/packet.h>
108 #include <epan/bitswap.h>
109 #include <epan/addr_resolv.h>
110 #include <epan/strutil.h>
111 #include <epan/prefs.h>
112 #include <epan/reassemble.h>
113 #include "packet-ipx.h"
114 #include "packet-llc.h"
115 #include "packet-ieee80211.h"
116 #include <epan/etypes.h>
117 #include <epan/greproto.h>
118 #include <epan/oui.h>
119 #include <wsutil/crc32.h>
120 #include <epan/crc32-tvb.h>
121 #include <epan/tap.h>
122 #include <epan/emem.h>
123 #include <epan/crypt/wep-wpadefs.h>
124 #include <epan/expert.h>
125 #include <epan/uat.h>
126
127 #include "packet-wps.h"
128 #include "packet-wifi-p2p.h"
129
130 /*     Davide Schiera (2006-11-22): including AirPDcap project                */
131 #include <epan/crypt/airpdcap_ws.h>
132 /* Davide Schiera (2006-11-22) ---------------------------------------------- */
133
134 extern const value_string eap_type_vals[]; /* from packet-eap.c */
135
136 #ifndef roundup2
137 #define roundup2(x, y)  (((x)+((y)-1))&(~((y)-1)))  /* if y is powers of two */
138 #endif
139
140 /* Defragment fragmented 802.11 datagrams */
141 static gboolean wlan_defragment = TRUE;
142
143 /* call subdissector for retransmitted frames */
144 static gboolean wlan_subdissector = TRUE;
145
146 /* Check for the presence of the 802.11 FCS */
147 static gboolean wlan_check_fcs = FALSE;
148
149 /* Ignore vendor-specific HT elements */
150 static gboolean wlan_ignore_draft_ht = FALSE;
151
152 /* Ignore the WEP bit; assume packet is decrypted */
153 #define WLAN_IGNORE_WEP_NO     0
154 #define WLAN_IGNORE_WEP_WO_IV  1
155 #define WLAN_IGNORE_WEP_W_IV   2
156 static gint wlan_ignore_wep = WLAN_IGNORE_WEP_NO;
157
158 /* Tables for reassembly of fragments. */
159 static GHashTable *wlan_fragment_table = NULL;
160 static GHashTable *wlan_reassembled_table = NULL;
161
162 /* Statistical data */
163 static struct _wlan_stats wlan_stats;
164
165 /*-------------------------------------
166  * UAT for WEP decoder
167  *-------------------------------------
168  */
169 /* UAT entry structure. */
170 typedef struct {
171     guint8    key;
172     gchar    *string;
173 } uat_wep_key_record_t;
174
175 static uat_wep_key_record_t *uat_wep_key_records = NULL;
176 static uat_t * wep_uat = NULL;
177 static guint num_wepkeys_uat = 0;
178
179 static void* uat_wep_key_record_copy_cb(void* n, const void* o, size_t siz _U_) {
180     uat_wep_key_record_t* new_key = (uat_wep_key_record_t *)n;
181     const uat_wep_key_record_t* old_key = (uat_wep_key_record_t *)o;
182
183     if (old_key->string) {
184         new_key->string = g_strdup(old_key->string);
185     } else {
186         new_key->string = NULL;
187     }
188
189     return new_key;
190 }
191
192 static void uat_wep_key_record_update_cb(void* r, const char** err) {
193     uat_wep_key_record_t* rec = (uat_wep_key_record_t *)r;
194     decryption_key_t* dk;
195
196     if (rec->string == NULL) {
197          *err = ep_strdup_printf("Key can't be blank");
198     } else {
199         g_strstrip(rec->string);
200         dk = parse_key_string(rec->string, rec->key);
201
202         if(dk != NULL) {
203            switch(dk->type) {
204               case AIRPDCAP_KEY_TYPE_WEP:
205               case AIRPDCAP_KEY_TYPE_WEP_40:
206               case AIRPDCAP_KEY_TYPE_WEP_104:
207                  if (rec->key != AIRPDCAP_KEY_TYPE_WEP) {
208                     *err = ep_strdup_printf("Invalid key format");
209                  }
210                  break;
211               case AIRPDCAP_KEY_TYPE_WPA_PWD:
212                  if (rec->key != AIRPDCAP_KEY_TYPE_WPA_PWD) {
213                     *err = ep_strdup_printf("Invalid key format");
214                  }
215                  break;
216               case AIRPDCAP_KEY_TYPE_WPA_PSK:
217                  if (rec->key != AIRPDCAP_KEY_TYPE_WPA_PSK) {
218                     *err = ep_strdup_printf("Invalid key format");
219                  }
220                  break;
221               default:
222                  *err = ep_strdup_printf("Invalid key format");
223                  break;
224            }
225         } else {
226            *err = ep_strdup_printf("Invalid key format");
227         }
228     }
229 }
230
231 static void uat_wep_key_record_free_cb(void*r) {
232     uat_wep_key_record_t* key = (uat_wep_key_record_t *)r;
233
234     if (key->string) g_free(key->string);
235 }
236
237 UAT_VS_DEF(uat_wep_key_records, key, uat_wep_key_record_t, 0, STRING_KEY_TYPE_WEP)
238 UAT_CSTRING_CB_DEF(uat_wep_key_records, string, uat_wep_key_record_t)
239
240 /* Stuff for the WEP decoder */
241 static gboolean enable_decryption = FALSE;
242 static void init_wepkeys(void);
243
244 /* Davide Schiera (2006-11-26): created function to decrypt WEP and WPA/WPA2  */
245 static tvbuff_t *try_decrypt(tvbuff_t *tvb, guint32 offset, guint32 len, guint8 *algorithm, guint32 *sec_header, guint32 *sec_trailer);
246
247 static int weak_iv(guchar *iv);
248 #define SSWAP(a,b) {guint8 tmp = s[a]; s[a] = s[b]; s[b] = tmp;}
249
250 typedef struct mimo_control
251   {
252     guint8 nc;
253     guint8 nr;
254     gboolean chan_width;
255     guint8 grouping;
256     guint8 coefficient_size;
257     guint8 codebook_info;
258     guint8 remaining_matrix_segment;
259   } mimo_control_t;
260
261 mimo_control_t get_mimo_control (tvbuff_t *tvb, int offset);
262 int add_mimo_csi_matrices_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl);
263 int add_mimo_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl);
264 int add_mimo_compressed_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl);
265
266 /* ************************************************************************* */
267 /*                          Miscellaneous Constants                          */
268 /* ************************************************************************* */
269 #define SHORT_STR 256
270
271 /* ************************************************************************* */
272 /*  Define some very useful macros that are used to analyze frame types etc. */
273 /* ************************************************************************* */
274
275 /*
276  * Fetch the frame control field and swap it if needed.  "fcf" and "tvb"
277  * must be valid variables.
278  */
279 #define FETCH_FCF(off) (wlan_broken_fc ? \
280   BSWAP16(tvb_get_letohs(tvb, off)) : \
281   tvb_get_letohs(tvb, off))
282
283 /*
284  * Extract the protocol version from the frame control field
285  */
286 #define FCF_PROT_VERSION(x)  ((x) & 0x3)
287
288 /*
289  * Extract the frame type from the frame control field.
290  */
291 #define FCF_FRAME_TYPE(x)    (((x) & 0xC) >> 2)
292
293 /*
294  * Extract the frame subtype from the frame control field.
295  */
296 #define FCF_FRAME_SUBTYPE(x) (((x) & 0xF0) >> 4)
297
298 /*
299  * Convert the frame type and subtype from the frame control field into
300  * one of the MGT_, CTRL_, or DATA_ values.
301  */
302 #define COMPOSE_FRAME_TYPE(x) (((x & 0x0C)<< 2)+FCF_FRAME_SUBTYPE(x))  /* Create key to (sub)type */
303
304 /*
305  * The subtype field of a data frame is, in effect, composed of 4 flag
306  * bits - CF-Ack, CF-Poll, Null (means the frame doesn't actually have
307  * any data), and QoS.
308  */
309 #define DATA_FRAME_IS_CF_ACK(x)  ((x) & 0x01)
310 #define DATA_FRAME_IS_CF_POLL(x) ((x) & 0x02)
311 #define DATA_FRAME_IS_NULL(x)    ((x) & 0x04)
312 #define DATA_FRAME_IS_QOS(x)     ((x) & 0x08)
313
314 /*
315  * Extract the flags from the frame control field.
316  */
317 #define FCF_FLAGS(x)           (((x) & 0xFF00) >> 8)
318
319 /*
320  * Bits from the flags field.
321  */
322 #define FLAG_TO_DS            0x01
323 #define FLAG_FROM_DS          0x02
324 #define FLAG_MORE_FRAGMENTS   0x04
325 #define FLAG_RETRY            0x08
326 #define FLAG_POWER_MGT        0x10
327 #define FLAG_MORE_DATA        0x20
328 #define FLAG_PROTECTED        0x40
329 #define FLAG_ORDER            0x80
330
331 /*
332  * Test bits in the flags field.
333  */
334 /*
335  * XXX - Only HAVE_FRAGMENTS, IS_PROTECTED, and IS_STRICTLY_ORDERED
336  * are in use.  Should the rest be removed?
337  */
338 #define IS_TO_DS(x)            ((x) & FLAG_TO_DS)
339 #define IS_FROM_DS(x)          ((x) & FLAG_FROM_DS)
340 #define HAVE_FRAGMENTS(x)      ((x) & FLAG_MORE_FRAGMENTS)
341 #define IS_RETRY(x)            ((x) & FLAG_RETRY)
342 #define POWER_MGT_STATUS(x)    ((x) & FLAG_POWER_MGT)
343 #define HAS_MORE_DATA(x)       ((x) & FLAG_MORE_DATA)
344 #define IS_PROTECTED(x)        ((x) & FLAG_PROTECTED)
345 #define IS_STRICTLY_ORDERED(x) ((x) & FLAG_ORDER)
346
347 /*
348  * Extract subfields from the flags field.
349  */
350 #define FLAGS_DS_STATUS(x)          ((x) & (FLAG_FROM_DS|FLAG_TO_DS))
351
352 /*
353  * Extract an indication of the types of addresses in a data frame from
354  * the frame control field.
355  */
356 #define FCF_ADDR_SELECTOR(x) ((x) & ((FLAG_TO_DS|FLAG_FROM_DS) << 8))
357
358 #define DATA_ADDR_T1         0
359 #define DATA_ADDR_T2         (FLAG_FROM_DS << 8)
360 #define DATA_ADDR_T3         (FLAG_TO_DS << 8)
361 #define DATA_ADDR_T4         ((FLAG_TO_DS|FLAG_FROM_DS) << 8)
362
363 /*
364  * Extract the fragment number and sequence number from the sequence
365  * control field.
366  */
367 #define SEQCTL_FRAGMENT_NUMBER(x) ((x) & 0x000F)
368 #define SEQCTL_SEQUENCE_NUMBER(x) (((x) & 0xFFF0) >> 4)
369
370 /*
371  * Extract subfields from the QoS control field.
372  */
373 #define QOS_TID(x)            ((x) & 0x000F)
374 #define QOS_PRIORITY(x)       ((x) & 0x0007)
375 #define QOS_EOSP(x)           (((x) & 0x0010) >> 4) /* end of service period */
376 #define QOS_ACK_POLICY(x)     (((x) & 0x0060) >> 5)
377 #define QOS_AMSDU_PRESENT(x)  (((x) & 0x0080) >> 6)
378 #define QOS_FIELD_CONTENT(x)  (((x) & 0xFF00) >> 8)
379 #define QOS_MESH_CONTROL_PRESENT(x) (((x) & 0x0100) >> 8)
380
381 #define QOS_FLAG_EOSP    0x10
382
383 /*
384  * Extract subfields from the result of QOS_FIELD_CONTENT().
385  */
386 #define QOS_PS_BUF_STATE_INDICATED(x)  (((x) & 0x02) >> 1)
387 #define QOS_PS_HIGHEST_PRI_BUF_AC(x)   (((x) & 0x0C) >> 2)
388 #define QOS_PS_QAP_BUF_LOAD(x)         (((x) & 0xF0) >> 4)
389
390 /*
391  * Extract subfields from the HT Control field.
392  * .11n D-1.10 & D-2.0, 7.1.3.5a, 32 bits.
393  */
394 #define HTC_LAC(htc)           ((htc) & 0xFF)
395 #define HTC_LAC_MAI(htc)       (((htc) >> 2) & 0xF)
396 #define HTC_IS_ASELI(htc)      (HTC_LAC_MAI(htc) == 0xE)
397 #define HTC_LAC_MAI_MRQ(htc)   ((HTC_LAC_MAI(htc))  & 0x1)
398 #define HTC_LAC_MAI_MSI(htc)   ((HTC_LAC_MAI(htc) >> 1) & 0x7)
399 #define HTC_LAC_MFSI(htc)      (((htc) >> 4) & 0x7)
400 #define HTC_LAC_ASEL_CMD(htc)  (((htc) >> 9) & 0x7)
401 #define HTC_LAC_ASEL_DATA(htc) (((htc) >> 12) & 0xF)
402 #define HTC_LAC_MFB(htc)       (((htc) >> 9) & 0x7F)
403 #define HTC_CAL_POS(htc)       (((htc) >> 16) & 0x3)
404 #define HTC_CAL_SEQ(htc)       (((htc) >> 18) & 0x3)
405 #define HTC_CSI_STEERING(htc)  (((htc) >> 22) & 0x3)
406 #define HTC_NDP_ANN(htc)       (((htc) >> 24) & 0x1)
407 #define HTC_AC_CONSTRAINT(htc) (((htc) >> 30) & 0x1)
408 #define HTC_RDG_MORE_PPDU(htc) (((htc) >> 31) & 0x1)
409
410 /*
411  * Extract subfields from the key octet in WEP-encrypted frames.
412  */
413 #define KEY_OCTET_WEP_KEY(x)   (((x) & 0xC0) >> 6)
414
415 #define KEY_EXTIV    0x20
416 #define EXTIV_LEN    8
417
418 /*
419  * Bits from the Mesh Flags field
420  */
421 #define MESH_FLAGS_ADDRESS_EXTENSION  0x3
422
423 /* ************************************************************************* */
424 /*              Constants used to identify cooked frame types                */
425 /* ************************************************************************* */
426 #define MGT_FRAME            0x00  /* Frame type is management */
427 #define CONTROL_FRAME        0x01  /* Frame type is control */
428 #define DATA_FRAME           0x02  /* Frame type is Data */
429
430 #define DATA_SHORT_HDR_LEN     24
431 #define DATA_LONG_HDR_LEN      30
432 #define MGT_FRAME_HDR_LEN      24  /* Length of Managment frame-headers */
433
434 /*
435  * COMPOSE_FRAME_TYPE() values for management frames.
436  */
437 #define MGT_ASSOC_REQ          0x00  /* association request        */
438 #define MGT_ASSOC_RESP         0x01  /* association response       */
439 #define MGT_REASSOC_REQ        0x02  /* reassociation request      */
440 #define MGT_REASSOC_RESP       0x03  /* reassociation response     */
441 #define MGT_PROBE_REQ          0x04  /* Probe request              */
442 #define MGT_PROBE_RESP         0x05  /* Probe response             */
443 #define MGT_MEASUREMENT_PILOT  0x06  /* Measurement Pilot          */
444 #define MGT_BEACON             0x08  /* Beacon frame               */
445 #define MGT_ATIM               0x09  /* ATIM                       */
446 #define MGT_DISASS             0x0A  /* Disassociation             */
447 #define MGT_AUTHENTICATION     0x0B  /* Authentication             */
448 #define MGT_DEAUTHENTICATION   0x0C  /* Deauthentication           */
449 #define MGT_ACTION             0x0D  /* Action                     */
450 #define MGT_ACTION_NO_ACK      0x0E  /* Action No Ack              */
451 #define MGT_ARUBA_WLAN         0x0F  /* Aruba WLAN Specific        */
452
453 /*
454  * COMPOSE_FRAME_TYPE() values for control frames.
455  */
456 #define CTRL_CONTROL_WRAPPER 0x17  /* Control Wrapper        */
457 #define CTRL_BLOCK_ACK_REQ   0x18  /* Block ack Request        */
458 #define CTRL_BLOCK_ACK       0x19  /* Block ack          */
459 #define CTRL_PS_POLL         0x1A  /* power-save poll               */
460 #define CTRL_RTS             0x1B  /* request to send               */
461 #define CTRL_CTS             0x1C  /* clear to send                 */
462 #define CTRL_ACKNOWLEDGEMENT 0x1D  /* acknowledgement               */
463 #define CTRL_CFP_END         0x1E  /* contention-free period end    */
464 #define CTRL_CFP_ENDACK      0x1F  /* contention-free period end/ack */
465
466 /*
467  * COMPOSE_FRAME_TYPE() values for data frames.
468  */
469 #define DATA                        0x20  /* Data                       */
470 #define DATA_CF_ACK                 0x21  /* Data + CF-Ack              */
471 #define DATA_CF_POLL                0x22  /* Data + CF-Poll             */
472 #define DATA_CF_ACK_POLL            0x23  /* Data + CF-Ack + CF-Poll    */
473 #define DATA_NULL_FUNCTION          0x24  /* Null function (no data)    */
474 #define DATA_CF_ACK_NOD             0x25  /* CF-Ack (no data)           */
475 #define DATA_CF_POLL_NOD            0x26  /* CF-Poll (No data)          */
476 #define DATA_CF_ACK_POLL_NOD        0x27  /* CF-Ack + CF-Poll (no data) */
477
478 #define DATA_QOS_DATA               0x28  /* QoS Data                   */
479 #define DATA_QOS_DATA_CF_ACK        0x29  /* QoS Data + CF-Ack        */
480 #define DATA_QOS_DATA_CF_POLL       0x2A  /* QoS Data + CF-Poll      */
481 #define DATA_QOS_DATA_CF_ACK_POLL   0x2B  /* QoS Data + CF-Ack + CF-Poll    */
482 #define DATA_QOS_NULL               0x2C  /* QoS Null        */
483 #define DATA_QOS_CF_POLL_NOD        0x2E  /* QoS CF-Poll (No Data)      */
484 #define DATA_QOS_CF_ACK_POLL_NOD    0x2F  /* QoS CF-Ack + CF-Poll (No Data) */
485
486
487 /* ************************************************************************* */
488 /*        Logical field codes (dissector's encoding of fixed fields)         */
489 /* ************************************************************************* */
490 enum fixed_field {
491   FIELD_TIMESTAMP, /* 64-bit timestamp */
492   FIELD_BEACON_INTERVAL, /* 16-bit beacon interval */
493   FIELD_CAP_INFO, /* Add capability information tree */
494   FIELD_AUTH_ALG, /* Authentication algorithm used */
495   FIELD_AUTH_TRANS_SEQ, /* Authentication sequence number */
496   FIELD_CURRENT_AP_ADDR,
497   FIELD_LISTEN_IVAL,
498   FIELD_REASON_CODE,
499   FIELD_ASSOC_ID,
500   FIELD_STATUS_CODE,
501   FIELD_CATEGORY_CODE, /* Management action category */
502   FIELD_ACTION_CODE, /* Management action code */
503   FIELD_DIALOG_TOKEN, /* Management action dialog token */
504   FIELD_WME_ACTION_CODE, /* Management notification action code */
505   FIELD_WME_DIALOG_TOKEN, /* Management notification dialog token */
506   FIELD_WME_STATUS_CODE, /* Management notification setup response status code
507                           */
508   FIELD_QOS_ACTION_CODE,
509   FIELD_QOS_TS_INFO,
510   FIELD_DLS_ACTION_CODE,
511   FIELD_DST_MAC_ADDR, /* DLS destination MAC address */
512   FIELD_SRC_MAC_ADDR, /* DLS source MAC address */
513   FIELD_DLS_TIMEOUT, /* DLS timeout value */
514   FIELD_SCHEDULE_INFO, /* Schedule Info field */
515   FIELD_ACTION, /* Action field */
516   FIELD_BLOCK_ACK_ACTION_CODE,
517   FIELD_QOS_INFO_AP,
518   FIELD_QOS_INFO_STA,
519   FIELD_BLOCK_ACK_PARAM,
520   FIELD_BLOCK_ACK_TIMEOUT,
521   FIELD_BLOCK_ACK_SSC,
522   FIELD_DELBA_PARAM_SET,
523   FIELD_MAX_REG_PWR,
524   FIELD_MEASUREMENT_PILOT_INT,
525   FIELD_COUNTRY_STR,
526   FIELD_MAX_TX_PWR,
527   FIELD_TX_PWR_USED,
528   FIELD_TRANSCEIVER_NOISE_FLOOR,
529   FIELD_DS_PARAM_SET,
530   FIELD_CHANNEL_WIDTH,
531   FIELD_SM_PWR_CNTRL,
532   FIELD_PCO_PHASE_CNTRL,
533   FIELD_PSMP_PARAM_SET,
534   FIELD_PSMP_STA_INFO,
535   FIELD_MIMO_CNTRL,
536   FIELD_ANT_SELECTION,
537   FIELD_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT,
538   FIELD_HT_INFORMATION,
539   FIELD_HT_ACTION_CODE,
540   FIELD_PA_ACTION_CODE,
541   FIELD_FT_ACTION_CODE,
542   FIELD_STA_ADDRESS,
543   FIELD_TARGET_AP_ADDRESS,
544   FIELD_GAS_COMEBACK_DELAY,
545   FIELD_GAS_FRAGMENT_ID,
546   FIELD_SA_QUERY_ACTION_CODE,
547   FIELD_TRANSACTION_ID,
548   FIELD_TDLS_ACTION_CODE,
549   FIELD_TARGET_CHANNEL,
550   FIELD_REGULATORY_CLASS,
551   FIELD_MESH_ACTION,
552   FIELD_MULTIHOP_ACTION,
553   FIELD_MESH_CONTROL,
554   FIELD_SELFPROT_ACTION,
555   FIELD_WNM_ACTION_CODE,
556   /* add any new fixed field value above this line */
557   MAX_FIELD_NUM
558 };
559
560 /* ************************************************************************* */
561 /*        Logical field codes (IEEE 802.11 encoding of tags)                 */
562 /* ************************************************************************* */
563 #define TAG_SSID                     0
564 #define TAG_SUPP_RATES               1
565 #define TAG_FH_PARAMETER             2
566 #define TAG_DS_PARAMETER             3
567 #define TAG_CF_PARAMETER             4
568 #define TAG_TIM                      5
569 #define TAG_IBSS_PARAMETER           6
570 #define TAG_COUNTRY_INFO             7
571 #define TAG_FH_HOPPING_PARAMETER     8
572 #define TAG_FH_HOPPING_TABLE         9
573 #define TAG_REQUEST                  10
574 #define TAG_QBSS_LOAD                11
575 #define TAG_EDCA_PARAM_SET           12
576 #define TAG_TSPEC                    13
577 #define TAG_TCLAS                    14
578 #define TAG_SCHEDULE                 15
579 #define TAG_CHALLENGE_TEXT           16
580
581 #define TAG_POWER_CONSTRAINT         32
582 #define TAG_POWER_CAPABILITY         33
583 #define TAG_TPC_REQUEST              34
584 #define TAG_TPC_REPORT               35
585 #define TAG_SUPPORTED_CHANNELS       36
586 #define TAG_CHANNEL_SWITCH_ANN       37
587 #define TAG_MEASURE_REQ              38
588 #define TAG_MEASURE_REP              39
589 #define TAG_QUIET                    40
590 #define TAG_IBSS_DFS                 41
591 #define TAG_ERP_INFO                 42
592 #define TAG_TS_DELAY                 43
593 #define TAG_TCLAS_PROCESS            44
594 #define TAG_HT_CAPABILITY            45  /* IEEE Stc 802.11n/D2.0 */
595 #define TAG_QOS_CAPABILITY           46
596 #define TAG_ERP_INFO_OLD             47  /* IEEE Std 802.11g/D4.0 */
597 #define TAG_RSN_IE                   48
598 /* Reserved 49 */
599 #define TAG_EXT_SUPP_RATES           50
600 #define TAG_AP_CHANNEL_REPORT        51
601 #define TAG_NEIGHBOR_REPORT          52
602 #define TAG_RCPI                     53
603 #define TAG_MOBILITY_DOMAIN          54   /* IEEE Std 802.11r-2008 */
604 #define TAG_FAST_BSS_TRANSITION      55   /* IEEE Std 802.11r-2008 */
605 #define TAG_TIMEOUT_INTERVAL         56   /* IEEE Std 802.11r-2008 */
606 #define TAG_RIC_DATA                 57   /* IEEE Std 802.11r-2008 */
607 /* 58 ??? */
608 #define TAG_SUPPORTED_REGULATORY_CLASSES            59 /* IEEE Std 802.11w-2009 */
609 #define TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT    60 /* IEEE Std 802.11w-2009 */
610 #define TAG_HT_INFO                  61   /* IEEE Stc 802.11n/D2.0 */
611 #define TAG_SECONDARY_CHANNEL_OFFSET 62   /* IEEE Stc 802.11n/D1.10/D2.0 */
612 #define TAG_TIME_ADV                 69   /* IEEE Std 802.11p-2010 */
613 #define TAG_20_40_BSS_CO_EX          72   /* IEEE P802.11n/D6.0 */
614 #define TAG_20_40_BSS_INTOL_CH_REP   73   /* IEEE P802.11n/D6.0 */
615 #define TAG_OVERLAP_BSS_SCAN_PAR     74   /* IEEE P802.11n/D6.0 */
616 #define TAG_RIC_DESCRIPTOR           75   /* IEEE Std 802.11r-2008 */
617 #define TAG_MMIE                     76   /* IEEE Std 802.11w-2009 */
618 #define TAG_TIME_ZONE                98   /* IEEE STd 802.11v-2011 */
619 #define TAG_LINK_IDENTIFIER          101  /* IEEE Std 802.11z-2010 */
620 #define TAG_WAKEUP_SCHEDULE          102  /* IEEE Std 802.11z-2010 */
621 #define TAG_CHANNEL_SWITCH_TIMING    104  /* IEEE Std 802.11z-2010 */
622 #define TAG_PTI_CONTROL              105  /* IEEE Std 802.11z-2010 */
623 #define TAG_PU_BUFFER_STATUS         106  /* IEEE Std 802.11z-2010 */
624 #define TAG_INTERWORKING             107  /* IEEE Std 802.11u-2011 */
625 #define TAG_ADVERTISEMENT_PROTOCOL   108  /* IEEE Std 802.11u-2011 */
626 #define TAG_EXPIDITED_BANDWIDTH_REQ  109  /* IEEE Std 802.11u-2011 */
627 #define TAG_QOS_MAP_SET              110  /* IEEE Std 802.11u-2011 */
628 #define TAG_ROAMING_CONSORTIUM       111  /* IEEE Std 802.11u-2011 */
629 #define TAG_EMERGENCY_ALERT_ID       112  /* IEEE Std 802.11u-2011 */
630 #define TAG_MESH_CONFIGURATION       113  /* IEEE Std 802.11s-2011 */
631 #define TAG_MESH_ID                  114  /* IEEE Std 802.11s-2011 */
632 #define TAG_MESH_PEERING_MGMT        117  /* IEEE Std 802.11s-2011 */
633 #define TAG_RANN                     126  /* IEEE Std 802.11s-2011 */
634 #define TAG_EXTENDED_CAPABILITIES    127  /* IEEE Stc 802.11n/D1.10/D2.0 */
635 #define TAG_AGERE_PROPRIETARY        128
636 #define TAG_MESH_PREQ                130  /* IEEE Std 802.11s-2011 */
637 #define TAG_MESH_PREP                131  /* IEEE Std 802.11s-2011 */
638 #define TAG_MESH_PERR                132  /* IEEE Std 802.11s-2011 */
639 #define TAG_CISCO_CCX1_CKIP          133  /* Cisco Compatible eXtensions */
640 #define TAG_CISCO_UNKNOWN_88         136  /* Cisco Compatible eXtensions? */
641 #define TAG_CISCO_UNKNOWN_95         149  /* Cisco Compatible eXtensions */
642 #define TAG_CISCO_UNKNOWN_96         150  /* Cisco Compatible eXtensions */
643 #define TAG_SYMBOL_PROPRIETARY       173
644 #define TAG_VENDOR_SPECIFIC_IE       221
645
646 static const value_string tag_num_vals[] = {
647   { TAG_SSID, "SSID parameter set" },
648   { TAG_SUPP_RATES, "Supported Rates" },
649   { TAG_FH_PARAMETER, "FH Parameter set" },
650   { TAG_DS_PARAMETER, "DS Parameter set" },
651   { TAG_CF_PARAMETER, "CF Parameter set" },
652   { TAG_TIM, "Traffic Indication Map (TIM)" },
653   { TAG_IBSS_PARAMETER, "IBSS Parameter set" },
654   { TAG_COUNTRY_INFO, "Country Information" },
655   { TAG_FH_HOPPING_PARAMETER, "Hopping Pattern Parameters" },
656   { TAG_FH_HOPPING_TABLE, "Hopping Pattern Table" },
657   { TAG_REQUEST, "Request" },
658   { TAG_QBSS_LOAD, "QBSS Load Element" },
659   { TAG_EDCA_PARAM_SET, "EDCA Parameter Set" },
660   { TAG_TSPEC, "Traffic Specification" },
661   { TAG_TCLAS, "Traffic Classification" },
662   { TAG_SCHEDULE, "Schedule" },
663   { TAG_CHALLENGE_TEXT, "Challenge text" },
664   { TAG_POWER_CONSTRAINT, "Power Constraint" },
665   { TAG_POWER_CAPABILITY, "Power Capability" },
666   { TAG_TPC_REQUEST, "TPC Request" },
667   { TAG_TPC_REPORT, "TPC Report" },
668   { TAG_SUPPORTED_CHANNELS, "Supported Channels" },
669   { TAG_CHANNEL_SWITCH_ANN, "Channel Switch Announcement" },
670   { TAG_MEASURE_REQ, "Measurement Request" },
671   { TAG_MEASURE_REP, "Measurement Report" },
672   { TAG_QUIET, "Quiet" },
673   { TAG_IBSS_DFS, "IBSS DFS" },
674   { TAG_ERP_INFO, "ERP Information" },
675   { TAG_TS_DELAY, "TS Delay" },
676   { TAG_TCLAS_PROCESS, "TCLAS Processing" },
677   { TAG_HT_CAPABILITY, "HT Capabilities (802.11n D1.10)" },
678   { TAG_QOS_CAPABILITY, "QoS Capability" },
679   { TAG_ERP_INFO_OLD, "ERP Information" }, /* Reserved... */
680   { TAG_RSN_IE, "RSN Information" },
681   { TAG_EXT_SUPP_RATES, "Extended Supported Rates" },
682   { TAG_AP_CHANNEL_REPORT, "AP Channel Report" },
683   { TAG_NEIGHBOR_REPORT, "Neighbor Report" },
684   { TAG_RCPI, "RCPI" },
685   { TAG_MOBILITY_DOMAIN, "Mobility Domain" },
686   { TAG_FAST_BSS_TRANSITION, "Fast BSS Transition" },
687   { TAG_TIMEOUT_INTERVAL, "Timeout Interval" },
688   { TAG_RIC_DATA, "RIC Data" },
689   { TAG_SUPPORTED_REGULATORY_CLASSES, "Supported Regulatory Classes" },
690   { TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT, "Extended Channel Switch Announcement" },
691   { TAG_HT_INFO, "HT Information (802.11n D1.10)" },
692   { TAG_SECONDARY_CHANNEL_OFFSET, "Secondary Channel Offset (802.11n D1.10)" },
693   { TAG_TIME_ADV, "Time Advertisement" },
694   { TAG_20_40_BSS_CO_EX, "20/40 BSS Coexistence" },
695   { TAG_20_40_BSS_INTOL_CH_REP, "20/40 BSS Intolerant Channel Report" },   /* IEEE P802.11n/D6.0 */
696   { TAG_OVERLAP_BSS_SCAN_PAR, "Overlapping BSS Scan Parameters" },       /* IEEE P802.11n/D6.0 */
697   { TAG_RIC_DESCRIPTOR, "RIC Descriptor" },
698   { TAG_MMIE, "Management MIC" },
699   { TAG_TIME_ZONE, "Time Zone" },
700   { TAG_LINK_IDENTIFIER, "Link Identifier" },
701   { TAG_WAKEUP_SCHEDULE, "Wakeup Schedule" },
702   { TAG_CHANNEL_SWITCH_TIMING, "Channel Switch Timing" },
703   { TAG_PTI_CONTROL, "PTI Control" },
704   { TAG_PU_BUFFER_STATUS, "PU Buffer Status" },
705   { TAG_INTERWORKING, "Interworking" },
706   { TAG_ADVERTISEMENT_PROTOCOL, "Advertisement Protocol"},
707   { TAG_EXPIDITED_BANDWIDTH_REQ, "Expedited Bandwidth Request" },
708   { TAG_QOS_MAP_SET, "QoS Map Set" },
709   { TAG_ROAMING_CONSORTIUM, "Roaming Consortium" },
710   { TAG_EMERGENCY_ALERT_ID, "Emergency Alert Identifier" },
711   { TAG_MESH_ID, "Mesh ID" },
712   { TAG_MESH_CONFIGURATION, "Mesh Configuration" },
713   { TAG_MESH_PEERING_MGMT, "Mesh Peering Management" },
714   { TAG_RANN, "Root Announcement" },
715   { TAG_EXTENDED_CAPABILITIES, "Extended Capabilities" },
716   { TAG_AGERE_PROPRIETARY, "Agere Proprietary" },
717   { TAG_MESH_PREQ, "Path Request" },
718   { TAG_MESH_PREP, "Path Reply" },
719   { TAG_MESH_PERR, "Path Error" },
720   { TAG_CISCO_CCX1_CKIP, "Cisco CCX1 CKIP + Device Name" },
721   { TAG_CISCO_UNKNOWN_88, "Cisco Unknown 88" },
722   { TAG_CISCO_UNKNOWN_95, "Cisco Unknown 95" },
723   { TAG_CISCO_UNKNOWN_96, "Cisco Unknown 96" },
724   { TAG_SYMBOL_PROPRIETARY, "Symbol Proprietary" },
725   { TAG_VENDOR_SPECIFIC_IE, "Vendor Specific" },
726   { 0, NULL }
727 };
728
729 #define WPA_OUI     (const guint8 *) "\x00\x50\xF2"
730 #define RSN_OUI     (const guint8 *) "\x00\x0F\xAC"
731 #define WME_OUI     (const guint8 *) "\x00\x50\xF2"
732 #define PRE_11N_OUI (const guint8 *) "\x00\x90\x4c" /* 802.11n pre 1 oui */
733 #define WFA_OUI     (const guint8 *) "\x50\x6f\x9a"
734
735 /* WFA vendor specific subtypes */
736 #define WFA_SUBTYPE_P2P 9
737
738 #define PMKID_LEN 16
739
740 /* ************************************************************************* */
741 /*              Supported Rates (7.3.2.2)                                    */
742 /* ************************************************************************* */
743
744 static const value_string ieee80211_supported_rates_vals[] = {
745   { 0x02, "1" },
746   { 0x03, "1.5" },
747   { 0x04, "2" },
748   { 0x05, "2.5" },
749   { 0x06, "3" },
750   { 0x09, "4.5" },
751   { 0x0B, "5.5" },
752   { 0x0C, "6" },
753   { 0x12, "9" },
754   { 0x16, "11" },
755   { 0x18, "12" },
756   { 0x1B, "13.5" },
757   { 0x24, "18" },
758   { 0x2C, "22" },
759   { 0x30, "24" },
760   { 0x36, "27" },
761   { 0x42, "33" },
762   { 0x48, "36" },
763   { 0x60, "48" },
764   { 0x6C, "54" },
765   { 0x82, "1(B)" },
766   { 0x83, "1.5(B)" },
767   { 0x84, "2(B)" },
768   { 0x85, "2.5(B)" },
769   { 0x86, "3(B)" },
770   { 0x89, "4.5(B)" },
771   { 0x8B, "5.5(B)" },
772   { 0x8C, "6(B)" },
773   { 0x92, "9(B)" },
774   { 0x96, "11(B)" },
775   { 0x98, "12(B)" },
776   { 0x9B, "13.5(B)" },
777   { 0xA4, "18(B)" },
778   { 0xAC, "22(B)" },
779   { 0xB0, "24(B)" },
780   { 0xB6, "27(B)" },
781   { 0xC2, "33(B)" },
782   { 0xC8, "36(B)" },
783   { 0xE0, "48(B)" },
784   { 0xEC, "54(B)" },
785   { 0xFF, "BSS requires support for mandatory features of HT PHY (IEEE 802.11 - Clause 20)" },
786   { 0,    NULL}
787 };
788 /* ************************************************************************* */
789 /*                         7.3.1.7 Reason Code field                         */
790 /* ************************************************************************* */
791 static const value_string ieee80211_reason_code[] = {
792   { 1, "Unspecified reason" },
793   { 2, "Previous authentication no longer valid" },
794   { 3, "Deauthenticated because sending STA is leaving (or has left) IBSS or ESS" },
795   { 4, "Disassociated due to inactivity" },
796   { 5, "Disassociated because AP is unable to handle all currently associated STAs" },
797   { 6, "Class 2 frame received from nonauthenticated STA" },
798   { 7, "Class 3 frame received from nonassociated STA" },
799   { 8, "Disassociated because sending STA is leaving (or has left) BSS" },
800   { 9, "STA requesting (re)association is not authenticated with responding STA" },
801   { 10, "Disassociated because the information in the Power Capability element is unacceptable" },
802   { 11, "Disassociated because the information in the Supported Channels element is unacceptable" },
803   { 12, "Reserved" },
804   { 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" },
805   { 14, "Message integrity code (MIC) failure" },
806   { 15, "4-Way Handshake timeout" },
807   { 16, "Group Key Handshake timeout" },
808   { 17, "Information element in 4-Way Handshake different from (Re)Association Request/Probe Response/Beacon frame" },
809   { 18, "Invalid group cipher" },
810   { 19, "Invalid pairwise cipher" },
811   { 20, "Invalid AKMP" },
812   { 21, "Unsupported RSN information element version" },
813   { 22, "Invalid RSN information element capabilities" },
814   { 23, "IEEE 802.1X authentication failed" },
815   { 24, "Cipher suite rejected because of the security policy" },
816   { 27, "Disassociated because session terminated by SSP request" },
817   { 28, "Disassociated because of lack of SSP roaming agreement" },
818   { 29, "Requested service rejected because of SSP cipher suite or AKM requirement " },
819   { 30, "Requested service not authorized in this location" },
820   { 31, "TS deleted because QoS AP lacks sufficient bandwidth for this QoS STA due to a change in BSS service characteristics or operational mode" },
821   { 32, "Disassociated for unspecified, QoS-related reason" },
822   { 33, "Disassociated because QoS AP lacks sufficient bandwidth for this QoS STA" },
823   { 34, "Disassociated because excessive number of frames need to be acknowledged, but are not acknowledged due to AP transmissions and/or poor channel conditions" },
824   { 35, "Disassociated because STA is transmitting outside the limits of its TXOPs" },
825   { 36, "Requested from peer STA as the STA is leaving the BSS (or resetting)" },
826   { 37, "Requested from peer STA as it does not want to use the mechanism" },
827   { 38, "Requested from peer STA as the STA received frames using the mechanism for which a setup is required" },
828   { 39, "Requested from peer STA due to timeout" },
829   { 45, "Peer STA does not support the requested cipher suite" },
830   { 46, "Disassociated because authorized access limit reached" },
831   { 47, "Disassociated due to external service requirements" },
832   { 52, "SME cancels the mesh peering instance with the reason other than reaching the maximum number of peer mesh STAs" },
833   { 53, "The mesh STA has reached the supported maximum number of peer mesh STAs" },
834   { 54, "The received information violates the Mesh Configuration policy configured in the mesh STA profile" },
835   { 55, "The mesh STA has received a Mesh Peering Close message requesting to close the mesh peering" },
836   { 56, "The mesh STA has re-sent dot11MeshMaxRetries Mesh Peering Open messages, without receiving a Mesh Peering Confirm message" },
837   { 57, "The confirmTimer for the mesh peering instance times out" },
838   { 58, "The mesh STA fails to unwrap the GTK or the values in the wrapped contents do not match" },
839   { 59, "The mesh STA receives inconsistent information about the mesh parameters between Mesh Peering Management frames" },
840   { 60, "The mesh STA fails the authenticated mesh peering exchange because due to failure in selecting either the pairwise ciphersuite or group ciphersuite" },
841   { 61, "The mesh STA does not have proxy information for this external destination" },
842   { 62, "The mesh STA does not have forwarding information for this destination" },
843   { 63, "The mesh STA determines that the link to the next hop of an active path in its forwarding information is no longer usable" },
844   { 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)" },
845   { 65, "The mesh STA performs channel switch to meet regulatory requirements" },
846   { 66, "The mesh STA performs channel switch with unspecified reason" },
847   { 0,    NULL}
848 };
849
850 /* ************************************************************************* */
851 /*                         7.3.1.9 Status Code field                         */
852 /* ************************************************************************* */
853 static const value_string ieee80211_status_code[] = {
854   { 0, "Successful" },
855   { 1, "Unspecified failure" },
856   { 2, "TDLS wakeup schedule rejected but alternative schedule provided" },
857   { 3, "TDLS wakeup schedule rejected" },
858   { 5, "Security disabled" },
859   { 6, "Unacceptable lifetime" },
860   { 7, "Not in same BSS" },
861   { 10, "Cannot support all requested capabilities in the Capability Information field" },
862   { 11, "Reassociation denied due to inability to confirm that association exists" },
863   { 12, "Association denied due to reason outside the scope of this standard" },
864   { 13, "Responding STA does not support the specified authentication algorithm" },
865   { 14, "Received an Authentication frame with authentication transaction sequence number out of expected sequence" },
866   { 15, "Authentication rejected because of challenge failure" },
867   { 16, "Authentication rejected due to timeout waiting for next frame in sequence" },
868   { 17, "Association denied because AP is unable to handle additional associated STAs" },
869   { 18, "Association denied due to requesting STA not supporting all of the data rates in the BSSBasicRateSet parameter" },
870   { 19, "Association denied due to requesting STA not supporting the short preamble option" },
871   { 20, "Association denied due to requesting STA not supporting the PBCC modulation option" },
872   { 21, "Association denied due to requesting STA not supporting the Channel Agility option" },
873   { 22, "Association request rejected because Spectrum Management capability is required" },
874   { 23, "Association request rejected because the information in the Power Capability element is unacceptable" },
875   { 24, "Association request rejected because the information in the Supported Channels element is unacceptable" },
876   { 25, "Association denied due to requesting STA not supporting the Short Slot Time option" },
877   { 26, "Association denied due to requesting STA not supporting the DSSS-OFDM option" },
878   { 27, "Reserved Association denied because the requesting STA does not support HT features" },
879   { 28, "R0KH unreachable" },
880   { 29, "Association denied because the requesting STA does not support the phased coexistence operation (PCO) transition time required by the AP" },
881   { 30, "Association request rejected temporarily; try again later" },
882   { 31, "Robust Management frame policy violation" },
883   { 32, "Unspecified, QoS-related failure" },
884   { 33, "Association denied because QoS AP has insufficient bandwidth to handle another QoS STA" },
885   { 34, "Association denied due to excessive frame loss rates and/or poor conditions on current operating channel" },
886   { 35, "Association (with QoS BSS) denied because the requesting STA does not support the QoS facility" },
887   { 36, "Reserved" },
888   { 37, "The request has been declined" },
889   { 38, "The request has not been successful as one or more parameters have invalid values" },
890   { 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" },
891   { 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" },
892   { 41, "Invalid group cipher" },
893   { 42, "Invalid pairwise cipher" },
894   { 43, "Invalid AKMP" },
895   { 44, "Unsupported RSN information element version" },
896   { 45, "Invalid RSN information element capabilities" },
897   { 46, "Cipher suite rejected because of security policy" },
898   { 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" },
899   { 48, "Direct link is not allowed in the BSS by policy" },
900   { 49, "The Destination STA is not present within this BSS" },
901   { 50, "The Destination STA is not a QoS STA" },
902   { 51, "Association denied because the ListenInterval is too large" },
903   { 52, "Invalid FT Action frame count" },
904   { 53, "Invalid pairwise master key identifier (PMKID)" },
905   { 54, "Invalid MDIE" },
906   { 55, "Invalid FTIE" },
907   { 59, "GAS Advertisement Protocol not supported" },
908   { 60, "No outstanding GAS request" },
909   { 61, "GAS Response not received from the Advertisement Server" },
910   { 62, "STA timed out waiting for GAS Query Response" },
911   { 63, "GAS Response is larger than query response length limit" },
912   { 64, "Request refused because home network does not support request" },
913   { 65, "Advertisement Server in the network is not currently reachable" },
914   { 67, "Request refused due to permissions received via SSPN interface" },
915   { 68, "Request refused because AP does not support unauthenticated access" },
916   { 72, "Invalid contents of RSNIE" },
917   { 76, "Authentication is rejected because an Anti-Clogging Token is required" },
918   { 77, "Authentication is rejected because the offered finite cyclic group is not supported" },
919   { 78, "The TBTT adjustment request has not been successful because the STA could not find an alternative TBTT" },
920   { 79, "Transmission failure" },
921   { 0,    NULL}
922 };
923
924 /* ************************************************************************* */
925 /*                         Frame types, and their names                      */
926 /* ************************************************************************* */
927 static const value_string frame_type_subtype_vals[] = {
928   {MGT_ASSOC_REQ,             "Association Request"},
929   {MGT_ASSOC_RESP,            "Association Response"},
930   {MGT_REASSOC_REQ,           "Reassociation Request"},
931   {MGT_REASSOC_RESP,          "Reassociation Response"},
932   {MGT_PROBE_REQ,             "Probe Request"},
933   {MGT_PROBE_RESP,            "Probe Response"},
934   {MGT_MEASUREMENT_PILOT,     "Measurement Pilot"},
935   {MGT_BEACON,                "Beacon frame"},
936   {MGT_ATIM,                  "ATIM"},
937   {MGT_DISASS,                "Disassociate"},
938   {MGT_AUTHENTICATION,        "Authentication"},
939   {MGT_DEAUTHENTICATION,      "Deauthentication"},
940   {MGT_ACTION,                "Action"},
941   {MGT_ACTION_NO_ACK,         "Action No Ack"},
942   {MGT_ARUBA_WLAN,            "Aruba Management"},
943
944   {CTRL_CONTROL_WRAPPER,      "Control Wrapper"},
945   {CTRL_BLOCK_ACK_REQ,        "802.11 Block Ack Req"},
946   {CTRL_BLOCK_ACK,            "802.11 Block Ack"},
947   {CTRL_PS_POLL,              "Power-Save poll"},
948   {CTRL_RTS,                  "Request-to-send"},
949   {CTRL_CTS,                  "Clear-to-send"},
950   {CTRL_ACKNOWLEDGEMENT,      "Acknowledgement"},
951   {CTRL_CFP_END,              "CF-End (Control-frame)"},
952   {CTRL_CFP_ENDACK,           "CF-End + CF-Ack (Control-frame)"},
953
954   {DATA,                      "Data"},
955   {DATA_CF_ACK,               "Data + CF-Ack"},
956   {DATA_CF_POLL,              "Data + CF-Poll"},
957   {DATA_CF_ACK_POLL,          "Data + CF-Ack + CF-Poll"},
958   {DATA_NULL_FUNCTION,        "Null function (No data)"},
959   {DATA_CF_ACK_NOD,           "Acknowledgement (No data)"},
960   {DATA_CF_POLL_NOD,          "CF-Poll (No data)"},
961   {DATA_CF_ACK_POLL_NOD,      "CF-Ack/Poll (No data)"},
962   {DATA_QOS_DATA,             "QoS Data"},
963   {DATA_QOS_DATA_CF_ACK,      "QoS Data + CF-Acknowledgment"},
964   {DATA_QOS_DATA_CF_POLL,     "QoS Data + CF-Poll"},
965   {DATA_QOS_DATA_CF_ACK_POLL, "QoS Data + CF-Ack + CF-Poll"},
966   {DATA_QOS_NULL,             "QoS Null function (No data)"},
967   {DATA_QOS_CF_POLL_NOD,      "QoS CF-Poll (No Data)"},
968   {DATA_QOS_CF_ACK_POLL_NOD,  "QoS CF-Ack + CF-Poll (No data)"},
969   {0,                         NULL}
970 };
971
972 /* ************************************************************************* */
973 /*                             802.1D Tag Names                              */
974 /* ************************************************************************* */
975 static const char *qos_tags[8] = {
976   "Best Effort",
977   "Background",
978   "Spare",
979   "Excellent Effort",
980   "Controlled Load",
981   "Video",
982   "Voice",
983   "Network Control"
984 };
985
986 /* ************************************************************************* */
987 /*                 WME Access Category Names (by 802.1D Tag)                 */
988 /* ************************************************************************* */
989 static const char *qos_acs[8] = {
990   "Best Effort",
991   "Background",
992   "Background",
993   "Video",
994   "Video",
995   "Video",
996   "Voice",
997   "Voice"
998 };
999
1000 /* ************************************************************************* */
1001 /*                   WME Access Category Names (by WME ACI)                  */
1002 /* ************************************************************************* */
1003 static const value_string wme_acs[] = {
1004   { 0, "Best Effort" },
1005   { 1, "Background" },
1006   { 2, "Video" },
1007   { 3, "Voice" },
1008   { 0, NULL }
1009 };
1010
1011 /* ************************************************************************* */
1012 /*                  Aruba Management Type                                    */
1013 /* ************************************************************************* */
1014 static const value_string aruba_mgt_typevals[] = {
1015   { 0x0001,       "Hello" },
1016   { 0x0002,       "Probe" },
1017   { 0x0003,       "MTU" },
1018   { 0x0004,       "Ageout" },
1019   { 0x0005,       "Heartbeat" },
1020   { 0x0006,       "Deauth" },
1021   { 0x0007,       "Disassoc" },
1022   { 0x0008,       "Probe response" },
1023   { 0x0009,       "Tunnel update" },
1024   { 0x000A,       "Laser beam active" },
1025   { 0x000B,       "Client IP" },
1026   { 0x000C,       "Laser beam active v2" },
1027   { 0x000D,       "AP statistics" },
1028   { 0,            NULL }
1029 };
1030
1031 /*** Begin: Action Fixed Parameter ***/
1032 #define CAT_SPECTRUM_MGMT      0
1033 #define CAT_QOS                1
1034 #define CAT_DLS                2
1035 #define CAT_BLOCK_ACK          3
1036 #define CAT_PUBLIC             4
1037
1038 #define CAT_RADIO_MEASUREMENT   5
1039 #define CAT_FAST_BSS_TRANSITION 6
1040 #define CAT_HT                  7
1041 #define CAT_SA_QUERY            8
1042 #define CAT_PUBLIC_PROTECTED    9
1043 #define CAT_WNM                 10
1044 #define CAT_UNPROTECTED_WNM     11
1045 #define CAT_TDLS                12
1046
1047 /* per 11s draft 12.0 */
1048 #define CAT_MESH                13
1049 #define CAT_MULTIHOP            14
1050 #define CAT_SELF_PROTECTED      15
1051
1052 #define CAT_MGMT_NOTIFICATION   17
1053 #define CAT_VENDOR_SPECIFIC_PROTECTED 126
1054 #define CAT_VENDOR_SPECIFIC     127
1055
1056 #define CAT_MESH_LINK_METRIC               31
1057 #define CAT_MESH_PATH_SELECTION            32
1058 #define CAT_MESH_INTERWORKING              33
1059 #define CAT_MESH_RESOURCE_COORDINATION     34
1060 #define CAT_MESH_SECURITY_ARCHITECTURE     35
1061
1062 #define SM_ACTION_MEASUREMENT_REQUEST   0
1063 #define SM_ACTION_MEASUREMENT_REPORT    1
1064 #define SM_ACTION_TPC_REQUEST           2
1065 #define SM_ACTION_TPC_REPORT            3
1066 #define SM_ACTION_CHAN_SWITCH_ANNC      4
1067 #define SM_ACTION_EXT_CHAN_SWITCH_ANNC  5
1068
1069 #define SM_ACTION_ADDTS_REQUEST     0
1070 #define SM_ACTION_ADDTS_RESPONSE    1
1071 #define SM_ACTION_DELTS             2
1072 #define SM_ACTION_QOS_SCHEDULE      3
1073
1074 #define SM_ACTION_DLS_REQUEST       0
1075 #define SM_ACTION_DLS_RESPONSE      1
1076 #define SM_ACTION_DLS_TEARDOWN      2
1077
1078 #define BA_ADD_BLOCK_ACK_REQUEST    0
1079 #define BA_ADD_BLOCK_ACK_RESPONSE   1
1080 #define BA_DELETE_BLOCK_ACK         2
1081
1082 #define PA_DSE_ENABLEMENT                  1
1083 #define PA_DSE_DEENABLEMENT                2
1084 #define PA_DSE_REG_LOC_ANNOUNCEMENT        3
1085 #define PA_EXT_CHANNEL_SWITCH_ANNOUNCEMENT 4
1086 #define PA_DSE_MEASUREMENT_REQUEST         5
1087 #define PA_DSE_MEASUREMENT_REPORT          6
1088 #define PA_MEASUREMENT_PILOT               7
1089 #define PA_DSE_POWER_CONSTRAINT            8
1090 #define PA_VENDOR_SPECIFIC                 9
1091 #define PA_GAS_INITIAL_REQUEST             10
1092 #define PA_GAS_INITIAL_RESPONSE            11
1093 #define PA_GAS_COMEBACK_REQUEST            12
1094 #define PA_GAS_COMEBACK_RESPONSE           13
1095 #define PA_TDLS_DISCOVERY_RESPONSE         14
1096
1097 #define HT_ACTION_NOTIFY_CHAN_WIDTH           0
1098 #define HT_ACTION_SM_PWR_SAVE                 1
1099 #define HT_ACTION_PSMP_ACTION                 2
1100 #define HT_ACTION_SET_PCO_PHASE               3
1101 #define HT_ACTION_MIMO_CSI                    4
1102 #define HT_ACTION_MIMO_BEAMFORMING            5
1103 #define HT_ACTION_MIMO_COMPRESSED_BEAMFORMING 6
1104 #define HT_ACTION_ANT_SEL_FEEDBACK            7
1105 #define HT_ACTION_HT_INFO_EXCHANGE            8
1106
1107 /* IEEE Std 802.11r-2008, 7.4.8, Table 7-57g */
1108 #define FT_ACTION_REQUEST               1
1109 #define FT_ACTION_RESPONSE              2
1110 #define FT_ACTION_CONFIRM               3
1111 #define FT_ACTION_ACK                   4
1112
1113 /* SA Query Action frame codes (IEEE 802.11w-2009, 7.4.9) */
1114 #define SA_QUERY_REQUEST                0
1115 #define SA_QUERY_RESPONSE               1
1116
1117 /* IEEE Std 802.11z-2010, 7.4.11, Table 7-57v1 */
1118 #define TDLS_SETUP_REQUEST              0
1119 #define TDLS_SETUP_RESPONSE             1
1120 #define TDLS_SETUP_CONFIRM              2
1121 #define TDLS_TEARDOWN                   3
1122 #define TDLS_PEER_TRAFFIC_INDICATION    4
1123 #define TDLS_CHANNEL_SWITCH_REQUEST     5
1124 #define TDLS_CHANNEL_SWITCH_RESPONSE    6
1125 #define TDLS_PEER_PSM_REQUEST           7
1126 #define TDLS_PEER_PSM_RESPONSE          8
1127 #define TDLS_PEER_TRAFFIC_RESPONSE      9
1128 #define TDLS_DISCOVERY_REQUEST          10
1129
1130 /* 11s draft 12.0, table 7-57v30 */
1131 #define MESH_ACTION_LINK_METRIC_REPORT              0
1132 #define MESH_ACTION_HWMP                            1
1133 #define MESH_ACTION_GATE_ANNOUNCE                   2
1134 #define MESH_ACTION_CONGESTION_CTL                  3
1135 #define MESH_ACTION_MCCA_SETUP_REQUEST              4
1136 #define MESH_ACTION_MCCA_SETUP_REPLY                5
1137 #define MESH_ACTION_MCCA_ADV_REQUEST                6
1138 #define MESH_ACTION_MCCA_ADV                        7
1139 #define MESH_ACTION_MCCA_TEARDOWN                   8
1140 #define MESH_ACTION_TBTT_ADJ_REQUEST                9
1141 #define MESH_ACTION_TBTT_ADJ_RESPONSE              10
1142
1143 /* 11s draft 12.0, table 7-57v42: Multihop Action field values */
1144 #define MULTIHOP_ACTION_PROXY_UPDATE                0
1145 #define MULTIHOP_ACTION_PROXY_UPDATE_CONF           1
1146
1147 /* 11s draft 12.0, table 7-57v24: Self-protected Action field values */
1148 #define SELFPROT_ACTION_MESH_PEERING_OPEN           1
1149 #define SELFPROT_ACTION_MESH_PEERING_CONFIRM        2
1150 #define SELFPROT_ACTION_MESH_PEERING_CLOSE          3
1151 #define SELFPROT_ACTION_MESH_GROUP_KEY_INFORM       4
1152 #define SELFPROT_ACTION_MESH_GROUP_KEY_ACK          5
1153
1154 /* 11s draft 12.0, table 7-43bj6: Mesh Peering Protocol Identifier field values */
1155 #define MESH_PEERING_PROTO_MGMT                     0
1156 #define MESH_PEERING_PROTO_AMPE                     1
1157 #define MESH_PEERING_PROTO_VENDOR                 255
1158
1159 /* Vendor actions */
1160 /* MARVELL */
1161 #define MRVL_ACTION_MESH_MANAGEMENT     1
1162
1163 #define MRVL_MESH_MGMT_ACTION_RREQ      0
1164 #define MRVL_MESH_MGMT_ACTION_RREP      1
1165 #define MRVL_MESH_MGMT_ACTION_RERR      2
1166 #define MRVL_MESH_MGMT_ACTION_PLDM      3
1167
1168 #define ANQP_INFO_ANQP_QUERY_LIST 256
1169 #define ANQP_INFO_ANQP_CAPAB_LIST 257
1170 #define ANQP_INFO_VENUE_NAME_INFO 258
1171 #define ANQP_INFO_EMERGENCY_CALL_NUMBER_INFO 259
1172 #define ANQP_INFO_NETWORK_AUTH_TYPE_INFO 260
1173 #define ANQP_INFO_ROAMING_CONSORTIUM_LIST 261
1174 #define ANQP_INFO_IP_ADDR_TYPE_AVAILABILITY_INFO 262
1175 #define ANQP_INFO_NAI_REALM_LIST 263
1176 #define ANQP_INFO_3GPP_CELLULAR_NETWORK_INFO 264
1177 #define ANQP_INFO_AP_GEOSPATIAL_LOCATION 265
1178 #define ANQP_INFO_AP_CIVIC_LOCATION 266
1179 #define ANQP_INFO_AP_LOCATION_PUBLIC_ID_URI 267
1180 #define ANQP_INFO_DOMAIN_NAME_LIST 268
1181 #define ANQP_INFO_EMERGENCY_ALERT_ID_URI 269
1182 #define ANQP_INFO_TDLS_CAPAB_INFO 270
1183 #define ANQP_INFO_EMERGENCY_NAI 271
1184 #define ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST 56797
1185
1186 /* ANQP information ID - IEEE Std 802.11u-2011 - Table 7-43bk */
1187 static const value_string anqp_info_id_vals[] =
1188 {
1189   {ANQP_INFO_ANQP_QUERY_LIST, "ANQP Query list"},
1190   {ANQP_INFO_ANQP_CAPAB_LIST, "ANQP Capability list"},
1191   {ANQP_INFO_VENUE_NAME_INFO, "Venue Name information"},
1192   {ANQP_INFO_EMERGENCY_CALL_NUMBER_INFO, "Emergency Call Number information"},
1193   {ANQP_INFO_NETWORK_AUTH_TYPE_INFO,
1194    "Network Authentication Type information"},
1195   {ANQP_INFO_ROAMING_CONSORTIUM_LIST, "Roaming Consortium list"},
1196   {ANQP_INFO_IP_ADDR_TYPE_AVAILABILITY_INFO,
1197    "IP Address Type Availability information"},
1198   {ANQP_INFO_NAI_REALM_LIST, "NAI Realm list"},
1199   {ANQP_INFO_3GPP_CELLULAR_NETWORK_INFO, "3GPP Cellular Network information"},
1200   {ANQP_INFO_AP_GEOSPATIAL_LOCATION, "AP Geospatial Location"},
1201   {ANQP_INFO_AP_CIVIC_LOCATION, "AP Civic Location"},
1202   {ANQP_INFO_AP_LOCATION_PUBLIC_ID_URI, "AP Location Public Identifier URI"},
1203   {ANQP_INFO_DOMAIN_NAME_LIST, "Domain Name list"},
1204   {ANQP_INFO_EMERGENCY_ALERT_ID_URI, "Emergency Alert Identifier URI"},
1205   {ANQP_INFO_TDLS_CAPAB_INFO, "TDLS Capability information"},
1206   {ANQP_INFO_EMERGENCY_NAI, "Emergency NAI"},
1207   {ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST, "ANQP vendor-specific list"},
1208   {0, NULL}
1209 };
1210
1211 /* IEEE 802.11v - WNM Action field values */
1212 enum wnm_action {
1213   WNM_EVENT_REQ = 0,
1214   WNM_EVENT_REPORT = 1,
1215   WNM_DIAGNOSTIC_REQ = 2,
1216   WNM_DIAGNOSTIC_REPORT = 3,
1217   WNM_LOCATION_CFG_REQ = 4,
1218   WNM_LOCATION_CFG_RESP = 5,
1219   WNM_BSS_TRANS_MGMT_QUERY = 6,
1220   WNM_BSS_TRANS_MGMT_REQ = 7,
1221   WNM_BSS_TRANS_MGMT_RESP = 8,
1222   WNM_FMS_REQ = 9,
1223   WNM_FMS_RESP = 10,
1224   WNM_COLLOCATED_INTERFERENCE_REQ = 11,
1225   WNM_COLLOCATED_INTERFERENCE_REPORT = 12,
1226   WNM_TFS_REQ = 13,
1227   WNM_TFS_RESP = 14,
1228   WNM_TFS_NOTIFY = 15,
1229   WNM_SLEEP_MODE_REQ = 16,
1230   WNM_SLEEP_MODE_RESP = 17,
1231   WNM_TIM_BROADCAST_REQ = 18,
1232   WNM_TIM_BROADCAST_RESP = 19,
1233   WNM_QOS_TRAFFIC_CAPAB_UPDATE = 20,
1234   WNM_CHANNEL_USAGE_REQ = 21,
1235   WNM_CHANNEL_USAGE_RESP = 22,
1236   WNM_DMS_REQ = 23,
1237   WNM_DMS_RESP = 24,
1238   WNM_TIMING_MEASUREMENT_REQ = 25,
1239   WNM_NOTIFICATION_REQ = 26,
1240   WNM_NOTIFICATION_RESP = 27
1241 };
1242
1243 static const value_string wnm_action_codes[] =
1244 {
1245   { WNM_EVENT_REQ, "Event Request" },
1246   { WNM_EVENT_REPORT, "Event Report" },
1247   { WNM_DIAGNOSTIC_REQ, "Diagnostic Request" },
1248   { WNM_DIAGNOSTIC_REPORT, "Diagnostic Report" },
1249   { WNM_LOCATION_CFG_REQ, "Location Configuration Request" },
1250   { WNM_LOCATION_CFG_RESP, "Location Configuration Response" },
1251   { WNM_BSS_TRANS_MGMT_QUERY, "BSS Transition Management Query" },
1252   { WNM_BSS_TRANS_MGMT_REQ, "BSS Transition Management Request" },
1253   { WNM_BSS_TRANS_MGMT_RESP, "BSS Transition Management Response" },
1254   { WNM_FMS_REQ, "FMS Request" },
1255   { WNM_FMS_RESP, "FMS Response" },
1256   { WNM_COLLOCATED_INTERFERENCE_REQ, "Collocated Interference Request" },
1257   { WNM_COLLOCATED_INTERFERENCE_REPORT, "Collocated Interference Report" },
1258   { WNM_TFS_REQ, "TFS Request" },
1259   { WNM_TFS_RESP, "TFS Response" },
1260   { WNM_TFS_NOTIFY, "TFS Notify" },
1261   { WNM_SLEEP_MODE_REQ, "WNM-Sleep Mode Request" },
1262   { WNM_SLEEP_MODE_RESP, "WNM-Sleep Mode Response" },
1263   { WNM_TIM_BROADCAST_REQ, "TIM Broadcast Request" },
1264   { WNM_TIM_BROADCAST_RESP, "TIM Broadcast Response" },
1265   { WNM_QOS_TRAFFIC_CAPAB_UPDATE, "QoS Traffic Capability Update" },
1266   { WNM_CHANNEL_USAGE_REQ, "Channel Usage Request" },
1267   { WNM_CHANNEL_USAGE_RESP, "Channel Usage Response" },
1268   { WNM_DMS_REQ, "DMS Request" },
1269   { WNM_DMS_RESP, "DMS Response" },
1270   { WNM_TIMING_MEASUREMENT_REQ, "Timing Measurement Request" },
1271   { WNM_NOTIFICATION_REQ, "WNM-Notification Request" },
1272   { WNM_NOTIFICATION_RESP, "WNM-Notification Response" },
1273   { 0, NULL }
1274 };
1275
1276 /*** End: Action Fixed Parameter ***/
1277
1278 static const value_string ieee80211_tag_measure_request_type_flags[] = {
1279   {0x00, "Basic Request"},
1280   {0x01, "Clear Channel Assessment (CCA) Request"},
1281   {0x02, "Receive Power Indication (RPI) Histogram Request"},
1282   {0x03, "Channel Load Request"},
1283   {0x04, "Noise Histogram Request"},
1284   {0x05, "Beacon Request"},
1285   {0x06, "Frame Request"},
1286   {0x07, "STA Statistics Request"},
1287   {0x08, "Location Configuration Indication (LCI) Request"},
1288   {0x09, "Transmit Stream Measurement Request"},
1289   {0x0A, "Measurement Pause Request"},
1290   {0x00, NULL}
1291 };
1292
1293 static const value_string ieee80211_tag_measure_report_type_flags[] = {
1294   { 0x00, "Basic Report" },
1295   { 0x01, "Clear Channel Assessment (CCA) Report" },
1296   { 0x02, "Receive Power Indication (RPI) Histogram Report" },
1297   { 0x03, "Channel Load Report" },
1298   { 0x04, "Noise Histogram Report" },
1299   { 0x05, "Beacon Report" },
1300   { 0x06, "Frame Report" },
1301   { 0x07, "STA Statistics Report" },
1302   { 0x08, "Location Configuration Information (LCI) Report" },
1303   { 0x09, "Transmit Stream Measurement Report" },
1304   { 0x00, NULL }
1305 };
1306
1307 static const true_false_string ieee80211_tag_measure_report_frame_info_frame_type_flag = {
1308   "Measurement Pilot Frame",
1309   "Beacon/Probe Response Frame"
1310 };
1311
1312 static const true_false_string ieee80211_tag_measure_map_field_bss_flag = {
1313   "At least one MPDU was received by another BSS or IBSS in the measurement period.",
1314   "No MPDUs were received from another BSS or IBSS in the measurement period."
1315 };
1316
1317 static const value_string ieee80211_tag_measure_request_measurement_mode_flags[] = {
1318   { 0x00, "Passive" },
1319   { 0x01, "Active" },
1320   { 0x02, "Beacon Table" },
1321   { 0x00, NULL }
1322 };
1323
1324 #define MEASURE_REQ_BEACON_SUB_SSID 0
1325 #define MEASURE_REQ_BEACON_SUB_BRI 1
1326 #define MEASURE_REQ_BEACON_SUB_RD 2
1327 #define MEASURE_REQ_BEACON_SUB_REQUEST 10
1328 #define MEASURE_REQ_BEACON_SUB_APCP 51
1329 #define MEASURE_REQ_BEACON_SUB_VS 221
1330
1331 static const value_string ieee80211_tag_measure_request_beacon_sub_id_flags[] = {
1332   { MEASURE_REQ_BEACON_SUB_SSID, "SSID" },
1333   { MEASURE_REQ_BEACON_SUB_BRI, "Beacon Reporting Information" },
1334   { MEASURE_REQ_BEACON_SUB_RD, "Reporting Detail" },
1335   { MEASURE_REQ_BEACON_SUB_REQUEST, "Request" },
1336   { MEASURE_REQ_BEACON_SUB_APCP, "AP Channel Report" },
1337   { MEASURE_REQ_BEACON_SUB_VS, "Vendor Specific" },
1338   { 0x00, NULL}
1339 };
1340
1341 static const value_string ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition_flags[] = {
1342   { 0x00, "Report to be issued after each measurement." },
1343   { 0x01, "The measured RCPI level is greater than an absolute threshold." },
1344   { 0x02, "The measured RCPI level is less than an absolute threshold." },
1345   { 0x03, "The measured RSNI level is greater than an absolute threshold." },
1346   { 0x04, "The measured RSNI level is less than an absolute threshold." },
1347   { 0x05, "The measured RCPI level is greater than a threshold defined by an offset from the serving AP's reference RCPI." },
1348   { 0x06, "The measured RCPI level is less than a threshold defined by an offset from the serving AP's reference RCPI." },
1349   { 0x07, "The measured RSNI level is greater than a threshold defined by an offset from the serving AP's reference RSNI." },
1350   { 0x08, "The measured RSNI level is less than a threshold defined by an offset from the serving AP's reference RSNI." },
1351   { 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." },
1352   { 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." },
1353   { 0xfe, "Report not required to be issued" },
1354   { 0x00, NULL }
1355 };
1356
1357 static const value_string ieee80211_tag_measure_request_beacon_sub_reporting_detail_flags[] = {
1358   { 0, "No fixed length fields or elements" },
1359   { 1, "All fixed length fields and any requested elements in the Request information element if present" },
1360   { 2, "All fixed length fields and elements (default, used when Reporting Detail subelement is not included in Beacon Request" },
1361   { 0x00, NULL }
1362 };
1363
1364 static const value_string ieee80211_tag_measure_request_group_id_flags[] = {
1365   { 0x00, "STA Counters from dot11CountersTable" },
1366   { 0x01, "STA Counters from dot11MacStatistics group" },
1367   { 0x02, "QoS STA Counters for UP0 from dot11QosCountersTable" },
1368   { 0x03, "QoS STA Counters for UP1 from dot11QosCountersTable" },
1369   { 0x04, "QoS STA Counters for UP2 from dot11QosCountersTable" },
1370   { 0x05, "QoS STA Counters for UP3 from dot11QosCountersTable" },
1371   { 0x06, "QoS STA Counters for UP4 from dot11QosCountersTable" },
1372   { 0x07, "QoS STA Counters for UP5 from dot11QosCountersTable" },
1373   { 0x08, "QoS STA Counters for UP6 from dot11QosCountersTable" },
1374   { 0x09, "QoS STA Counters for UP7 from dot11QosCountersTable" },
1375   { 0x0a, "BSS Average Access Delays" },
1376   { 0x0b, "STA Counters from dot11A-MSDU Group" },
1377   { 0x0c, "STA Counters from dot11A-MPDU Group" },
1378   { 0x0d, "STA Counters from dot11 BAR, Channel Width, PSMP Group" },
1379   { 0x0e, "STA Counters from dot11Protection Group" },
1380   { 0x0f, "STBC Group" },
1381   { 0x00, NULL }
1382 };
1383
1384 static const value_string ieee80211_tclas_process_flag[] = {
1385   {0x00, "Incoming MSDU's higher layer parameters have to match to the parameters in all associated TCLAS elements."},
1386   {0x01, "Incoming MSDU's higher layer parameters have to match to at least one of the associated TCLAS elements."},
1387   {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."},
1388   {0, NULL}
1389 };
1390
1391 static int proto_wlan = -1;
1392 static int proto_aggregate = -1;
1393 static packet_info * g_pinfo;
1394 static gboolean ieee80211_tvb_invalid = FALSE;
1395
1396 /* ************************************************************************* */
1397 /*                Header field info values for FC-field                      */
1398 /* ************************************************************************* */
1399 static int hf_ieee80211_fc_field = -1;
1400 static int hf_ieee80211_fc_proto_version = -1;
1401 static int hf_ieee80211_fc_frame_type = -1;
1402 static int hf_ieee80211_fc_frame_subtype = -1;
1403 static int hf_ieee80211_fc_frame_type_subtype = -1;
1404
1405 static int hf_ieee80211_fc_flags = -1;
1406 static int hf_ieee80211_fc_to_ds = -1;
1407 static int hf_ieee80211_fc_from_ds = -1;
1408 static int hf_ieee80211_fc_data_ds = -1;
1409
1410 static int hf_ieee80211_fc_more_frag = -1;
1411 static int hf_ieee80211_fc_retry = -1;
1412 static int hf_ieee80211_fc_pwr_mgt = -1;
1413 static int hf_ieee80211_fc_more_data = -1;
1414 static int hf_ieee80211_fc_protected = -1;
1415 static int hf_ieee80211_fc_order = -1;
1416
1417 typedef struct retransmit_key {
1418   guint8  bssid[6];
1419   guint8  src[6];
1420   guint16 seq_control;
1421   guint   fnum;
1422 } retransmit_key;
1423
1424 static GHashTable *fc_analyse_retransmit_table = NULL;
1425 static GHashTable *fc_first_frame_table = NULL;
1426
1427 static int hf_ieee80211_fc_analysis_retransmission = -1;
1428 static int hf_ieee80211_fc_analysis_retransmission_frame = -1;
1429
1430 /* ************************************************************************* */
1431 /*                   Header values for Duration/ID field                     */
1432 /* ************************************************************************* */
1433 static int hf_ieee80211_did_duration = -1;
1434 static int hf_ieee80211_assoc_id = -1;
1435
1436 /* ************************************************************************* */
1437 /*         Header values for different address-fields (all 4 of them)        */
1438 /* ************************************************************************* */
1439 static int hf_ieee80211_addr_da = -1;  /* Destination address subfield */
1440 static int hf_ieee80211_addr_sa = -1;  /* Source address subfield */
1441 static int hf_ieee80211_addr_ra = -1;  /* Receiver address subfield */
1442 static int hf_ieee80211_addr_ta = -1;  /* Transmitter address subfield */
1443 static int hf_ieee80211_addr_bssid = -1;  /* address is bssid */
1444
1445 static int hf_ieee80211_addr = -1;  /* Source or destination address subfield */
1446
1447
1448 /* ************************************************************************* */
1449 /*                Header values for QoS control field                        */
1450 /* ************************************************************************* */
1451 static int hf_ieee80211_qos_tid = -1;
1452 static int hf_ieee80211_qos_priority = -1;
1453 static int hf_ieee80211_qos_ack_policy = -1;
1454 static int hf_ieee80211_qos_amsdu_present = -1;
1455 static int hf_ieee80211_qos_eosp = -1;
1456 static int hf_ieee80211_qos_bit4 = -1;
1457 static int hf_ieee80211_qos_txop_limit = -1;
1458 static int hf_ieee80211_qos_buf_state_indicated = -1;
1459 static int hf_ieee80211_qos_highest_pri_buf_ac = -1;
1460 static int hf_ieee80211_qos_qap_buf_load = -1;
1461 static int hf_ieee80211_qos_txop_dur_req = -1;
1462 static int hf_ieee80211_qos_queue_size = -1;
1463
1464 /* ************************************************************************* */
1465 /*                Header values for HT control field (+HTC)                  */
1466 /* ************************************************************************* */
1467 /* 802.11nD-1.10 & 802.11nD-2.0 7.1.3.5a */
1468 static int hf_ieee80211_htc = -1;
1469 static int hf_ieee80211_htc_lac = -1;
1470 static int hf_ieee80211_htc_lac_reserved = -1;
1471 static int hf_ieee80211_htc_lac_trq = -1;
1472 static int hf_ieee80211_htc_lac_mai_aseli = -1;
1473 static int hf_ieee80211_htc_lac_mai_mrq = -1;
1474 static int hf_ieee80211_htc_lac_mai_msi = -1;
1475 static int hf_ieee80211_htc_lac_mai_reserved = -1;
1476 static int hf_ieee80211_htc_lac_mfsi = -1;
1477 static int hf_ieee80211_htc_lac_mfb = -1;
1478 static int hf_ieee80211_htc_lac_asel_command = -1;
1479 static int hf_ieee80211_htc_lac_asel_data = -1;
1480 static int hf_ieee80211_htc_cal_pos = -1;
1481 static int hf_ieee80211_htc_cal_seq = -1;
1482 static int hf_ieee80211_htc_reserved1 = -1;
1483 static int hf_ieee80211_htc_csi_steering = -1;
1484 static int hf_ieee80211_htc_ndp_announcement = -1;
1485 static int hf_ieee80211_htc_reserved2 = -1;
1486 static int hf_ieee80211_htc_ac_constraint = -1;
1487 static int hf_ieee80211_htc_rdg_more_ppdu = -1;
1488
1489 /* ************************************************************************* */
1490 /*                Header values for sequence number field                    */
1491 /* ************************************************************************* */
1492 static int hf_ieee80211_frag_number = -1;
1493 static int hf_ieee80211_seq_number = -1;
1494
1495 /* ************************************************************************* */
1496 /*                   Header values for Frame Check field                     */
1497 /* ************************************************************************* */
1498 static int hf_ieee80211_fcs = -1;
1499 static int hf_ieee80211_fcs_good = -1;
1500 static int hf_ieee80211_fcs_bad = -1;
1501
1502 /* ************************************************************************* */
1503 /*                   Header values for reassembly                            */
1504 /* ************************************************************************* */
1505 static int hf_ieee80211_fragments = -1;
1506 static int hf_ieee80211_fragment = -1;
1507 static int hf_ieee80211_fragment_overlap = -1;
1508 static int hf_ieee80211_fragment_overlap_conflict = -1;
1509 static int hf_ieee80211_fragment_multiple_tails = -1;
1510 static int hf_ieee80211_fragment_too_long_fragment = -1;
1511 static int hf_ieee80211_fragment_error = -1;
1512 static int hf_ieee80211_fragment_count = -1;
1513 static int hf_ieee80211_reassembled_in = -1;
1514 static int hf_ieee80211_reassembled_length = -1;
1515
1516 static int proto_wlan_mgt = -1;
1517
1518 static int hf_ieee80211_chan_noc =        -1;
1519 static int hf_ieee80211_chan_length =     -1;
1520 static int hf_ieee80211_chan_content =    -1;
1521 static int hf_ieee80211_chan_channel =    -1;
1522 static int hf_ieee80211_chan_adapt   =    -1;
1523 static int hf_ieee80211_chan_rate    =    -1;
1524 static int hf_ieee80211_chan_tx_pow  =    -1;
1525
1526 /* ************************************************************************* */
1527 /*                      Fixed fields found in mgt frames                     */
1528 /* ************************************************************************* */
1529 static int hf_ieee80211_fixed_parameters = -1;  /* Protocol payload for management frames */
1530
1531 static int hf_ieee80211_ff_auth_alg = -1;            /* Authentication algorithm field            */
1532 static int hf_ieee80211_ff_auth_seq = -1;            /* Authentication transaction sequence       */
1533 static int hf_ieee80211_ff_current_ap = -1;          /* Current AP MAC address                    */
1534 static int hf_ieee80211_ff_listen_ival = -1;         /* Listen interval fixed field               */
1535 static int hf_ieee80211_ff_timestamp = -1;           /* 64 bit timestamp                          */
1536 static int hf_ieee80211_ff_beacon_interval = -1;     /* 16 bit Beacon interval                    */
1537 static int hf_ieee80211_ff_assoc_id = -1;            /* 16 bit AID field                          */
1538 static int hf_ieee80211_ff_reason = -1;              /* 16 bit reason code                        */
1539 static int hf_ieee80211_ff_status_code = -1;         /* Status code                               */
1540 static int hf_ieee80211_ff_category_code = -1;       /* 8 bit Category code */
1541 static int hf_ieee80211_ff_action_code = -1;         /* 8 bit Action code */
1542 static int hf_ieee80211_ff_dialog_token = -1;        /* 8 bit Dialog token */
1543 static int hf_ieee80211_ff_wme_action_code = -1;     /* Management notification action code */
1544 static int hf_ieee80211_ff_wme_status_code = -1;     /* Management notification setup response status code */
1545 static int hf_ieee80211_ff_qos_action_code = -1;
1546 static int hf_ieee80211_ff_dls_action_code = -1;
1547 static int hf_ieee80211_ff_dst_mac_addr = -1;        /* DLS destination MAC addressi */
1548 static int hf_ieee80211_ff_src_mac_addr = -1;        /* DLS source MAC addressi */
1549 static int hf_ieee80211_ff_dls_timeout = -1;         /* DLS timeout value */
1550 static int hf_ieee80211_ff_ft_action_code = -1; /* 8 bit FT Action code */
1551 static int hf_ieee80211_ff_sta_address = -1;
1552 static int hf_ieee80211_ff_target_ap_address = -1;
1553 static int hf_ieee80211_ff_gas_comeback_delay = -1;
1554 static int hf_ieee80211_ff_gas_fragment_id = -1;
1555 static int hf_ieee80211_ff_more_gas_fragments = -1;
1556 static int hf_ieee80211_ff_query_request_length = -1;
1557 static int hf_ieee80211_ff_query_request = -1;
1558 static int hf_ieee80211_ff_query_response_length = -1;
1559 static int hf_ieee80211_ff_query_response = -1;
1560 static int hf_ieee80211_ff_anqp_info_id = -1;
1561 static int hf_ieee80211_ff_anqp_info_length = -1;
1562 static int hf_ieee80211_ff_anqp_info = -1;
1563 static int hf_ieee80211_ff_anqp_query_id = -1;
1564 static int hf_ieee80211_ff_anqp_capability = -1;
1565 static int hf_ieee80211_ff_anqp_capability_vlen = -1;
1566 static int hf_ieee80211_ff_anqp_capability_vendor = -1;
1567 static int hf_ieee80211_ff_venue_info_group = -1;
1568 static int hf_ieee80211_ff_venue_info_type = -1;
1569 static int hf_ieee80211_ff_anqp_venue_length = -1;
1570 static int hf_ieee80211_ff_anqp_venue_language = -1;
1571 static int hf_ieee80211_ff_anqp_venue_name = -1;
1572 static int hf_ieee80211_ff_anqp_nw_auth_type_indicator = -1;
1573 static int hf_ieee80211_ff_anqp_nw_auth_type_url_len = -1;
1574 static int hf_ieee80211_ff_anqp_nw_auth_type_url = -1;
1575 static int hf_ieee80211_ff_anqp_roaming_consortium_oi_len = -1;
1576 static int hf_ieee80211_ff_anqp_roaming_consortium_oi = -1;
1577 static int hf_ieee80211_ff_anqp_ip_addr_avail_ipv6 = -1;
1578 static int hf_ieee80211_ff_anqp_ip_addr_avail_ipv4 = -1;
1579 static int hf_ieee80211_ff_anqp_nai_realm_count = -1;
1580 static int hf_ieee80211_ff_anqp_nai_field_len = -1;
1581 static int hf_ieee80211_ff_anqp_nai_realm_encoding = -1;
1582 static int hf_ieee80211_ff_anqp_nai_realm_length = -1;
1583 static int hf_ieee80211_ff_anqp_nai_realm = -1;
1584 static int hf_ieee80211_ff_anqp_nai_realm_eap_count = -1;
1585 static int hf_ieee80211_ff_anqp_nai_realm_eap_len = -1;
1586 static int hf_ieee80211_ff_anqp_nai_realm_eap_method = -1;
1587 static int hf_ieee80211_ff_anqp_nai_realm_auth_param_count = -1;
1588 static int hf_ieee80211_ff_anqp_nai_realm_auth_param_id = -1;
1589 static int hf_ieee80211_ff_anqp_nai_realm_auth_param_len = -1;
1590 static int hf_ieee80211_ff_anqp_nai_realm_auth_param_value = -1;
1591 static int hf_ieee80211_3gpp_gc_gud = -1;
1592 static int hf_ieee80211_3gpp_gc_udhl = -1;
1593 static int hf_ieee80211_3gpp_gc_iei = -1;
1594 static int hf_ieee80211_3gpp_gc_plmn_len = -1;
1595 static int hf_ieee80211_3gpp_gc_num_plmns = -1;
1596 static int hf_ieee80211_3gpp_gc_plmn = -1;
1597 static int hf_ieee80211_ff_anqp_domain_name_len = -1;
1598 static int hf_ieee80211_ff_anqp_domain_name = -1;
1599 static int hf_ieee80211_ff_tdls_action_code = -1;
1600 static int hf_ieee80211_ff_target_channel = -1;
1601 static int hf_ieee80211_ff_regulatory_class = -1;
1602 static int hf_ieee80211_ff_wnm_action_code = -1;
1603 static int hf_ieee80211_ff_request_mode_pref_cand = -1;
1604 static int hf_ieee80211_ff_request_mode_abridged = -1;
1605 static int hf_ieee80211_ff_request_mode_disassoc_imminent = -1;
1606 static int hf_ieee80211_ff_request_mode_bss_term_included = -1;
1607 static int hf_ieee80211_ff_request_mode_ess_disassoc_imminent = -1;
1608 static int hf_ieee80211_ff_disassoc_timer = -1;
1609 static int hf_ieee80211_ff_validity_interval = -1;
1610 static int hf_ieee80211_ff_url_len = -1;
1611 static int hf_ieee80211_ff_url = -1;
1612
1613 static int hf_ieee80211_ff_sa_query_action_code = -1;
1614 static int hf_ieee80211_ff_transaction_id = -1;
1615
1616 /* Vendor specific */
1617 static int hf_ieee80211_ff_marvell_action_type = -1;
1618 static int hf_ieee80211_ff_marvell_mesh_mgt_action_code = -1;
1619 static int hf_ieee80211_ff_marvell_mesh_mgt_length = -1;     /* Mesh Management length */
1620 static int hf_ieee80211_ff_marvell_mesh_mgt_mode = -1;       /* Mesh Management mode */
1621 static int hf_ieee80211_ff_marvell_mesh_mgt_ttl = -1;        /* Mesh Management TTL */
1622 static int hf_ieee80211_ff_marvell_mesh_mgt_dstcount = -1;   /* Mesh Management dst count */
1623 static int hf_ieee80211_ff_marvell_mesh_mgt_hopcount = -1;   /* Mesh Management hop count */
1624 static int hf_ieee80211_ff_marvell_mesh_mgt_rreqid = -1;     /* Mesh Management RREQ ID */
1625 static int hf_ieee80211_ff_marvell_mesh_mgt_sa = -1;         /* Mesh Management src addr */
1626 static int hf_ieee80211_ff_marvell_mesh_mgt_ssn = -1;        /* Mesh Management src sequence number */
1627 static int hf_ieee80211_ff_marvell_mesh_mgt_metric = -1;     /* Mesh Management metric */
1628 static int hf_ieee80211_ff_marvell_mesh_mgt_flags = -1;      /* Mesh Management RREQ flags */
1629 static int hf_ieee80211_ff_marvell_mesh_mgt_da = -1;         /* Mesh Management dst addr */
1630 static int hf_ieee80211_ff_marvell_mesh_mgt_dsn = -1;        /* Mesh Management dst sequence number */
1631 static int hf_ieee80211_ff_marvell_mesh_mgt_lifetime = -1;   /* Mesh Management lifetime */
1632
1633
1634 static int hf_ieee80211_ff_ba_action = -1;
1635
1636 static int hf_ieee80211_ff_block_ack_params = -1;
1637 static int hf_ieee80211_ff_block_ack_params_amsdu_permitted = -1;
1638 static int hf_ieee80211_ff_block_ack_params_policy = -1;
1639 static int hf_ieee80211_ff_block_ack_params_tid = -1;
1640 static int hf_ieee80211_ff_block_ack_params_buffer_size = -1;
1641
1642 static const int *ieee80211_ff_block_ack_params_fields[] = {
1643   &hf_ieee80211_ff_block_ack_params_amsdu_permitted,
1644   &hf_ieee80211_ff_block_ack_params_policy,
1645   &hf_ieee80211_ff_block_ack_params_tid,
1646   &hf_ieee80211_ff_block_ack_params_buffer_size,
1647   NULL
1648 };
1649
1650 static int hf_ieee80211_ff_block_ack_timeout = -1;
1651
1652 static int hf_ieee80211_ff_block_ack_ssc = -1;
1653 static int hf_ieee80211_ff_block_ack_ssc_fragment = -1;
1654 static int hf_ieee80211_ff_block_ack_ssc_sequence = -1;
1655
1656 static const int *ieee80211_ff_block_ack_ssc_fields[] = {
1657   &hf_ieee80211_ff_block_ack_ssc_fragment,
1658   &hf_ieee80211_ff_block_ack_ssc_sequence,
1659   NULL
1660 };
1661
1662 static int hf_ieee80211_ff_delba_param = -1;
1663 static int hf_ieee80211_ff_delba_param_reserved = -1;
1664 static int hf_ieee80211_ff_delba_param_init = -1;
1665 static int hf_ieee80211_ff_delba_param_tid = -1;
1666
1667 static const int *ieee80211_ff_delba_param_fields[] = {
1668   &hf_ieee80211_ff_delba_param_reserved,
1669   &hf_ieee80211_ff_delba_param_init,
1670   &hf_ieee80211_ff_delba_param_tid,
1671   NULL
1672 };
1673
1674 static int hf_ieee80211_ff_max_reg_pwr = -1;
1675 static int hf_ieee80211_ff_measurement_pilot_int = -1;
1676 static int hf_ieee80211_ff_country_str = -1;
1677 static int hf_ieee80211_ff_max_tx_pwr = -1;
1678 static int hf_ieee80211_ff_tx_pwr_used = -1;
1679 static int hf_ieee80211_ff_transceiver_noise_floor = -1;
1680 static int hf_ieee80211_ff_channel_width = -1;
1681
1682 static int hf_ieee80211_ff_qos_info_ap = -1;
1683 static int hf_ieee80211_ff_qos_info_ap_edca_param_set_counter = -1;
1684 static int hf_ieee80211_ff_qos_info_ap_q_ack = -1;
1685 static int hf_ieee80211_ff_qos_info_ap_queue_req = -1;
1686 static int hf_ieee80211_ff_qos_info_ap_txop_request = -1;
1687 static int hf_ieee80211_ff_qos_info_ap_reserved = -1;
1688
1689 static const int *ieee80211_ff_qos_info_ap_fields[] = {
1690   &hf_ieee80211_ff_qos_info_ap_edca_param_set_counter,
1691   &hf_ieee80211_ff_qos_info_ap_q_ack,
1692   &hf_ieee80211_ff_qos_info_ap_queue_req,
1693   &hf_ieee80211_ff_qos_info_ap_txop_request,
1694   &hf_ieee80211_ff_qos_info_ap_reserved,
1695   NULL
1696 };
1697
1698 static int hf_ieee80211_ff_qos_info_sta = -1;
1699 static int hf_ieee80211_ff_qos_info_sta_ac_vo = -1;
1700 static int hf_ieee80211_ff_qos_info_sta_ac_vi = -1;
1701 static int hf_ieee80211_ff_qos_info_sta_ac_bk = -1;
1702 static int hf_ieee80211_ff_qos_info_sta_ac_be = -1;
1703 static int hf_ieee80211_ff_qos_info_sta_q_ack = -1;
1704 static int hf_ieee80211_ff_qos_info_sta_max_sp_len = -1;
1705 static int hf_ieee80211_ff_qos_info_sta_more_data_ack = -1;
1706
1707 static const int *ieee80211_ff_qos_info_sta_fields[] = {
1708   &hf_ieee80211_ff_qos_info_sta_ac_vo,
1709   &hf_ieee80211_ff_qos_info_sta_ac_vi,
1710   &hf_ieee80211_ff_qos_info_sta_ac_bk,
1711   &hf_ieee80211_ff_qos_info_sta_ac_be,
1712   &hf_ieee80211_ff_qos_info_sta_q_ack,
1713   &hf_ieee80211_ff_qos_info_sta_max_sp_len,
1714   &hf_ieee80211_ff_qos_info_sta_more_data_ack,
1715   NULL
1716 };
1717
1718 static int hf_ieee80211_ff_sm_pwr_save = -1;
1719 static int hf_ieee80211_ff_sm_pwr_save_enabled = -1;
1720 static int hf_ieee80211_ff_sm_pwr_save_sm_mode = -1;
1721 static int hf_ieee80211_ff_sm_pwr_save_reserved = -1;
1722
1723 static const int *ieee80211_ff_sw_pwr_save_fields[] = {
1724   &hf_ieee80211_ff_sm_pwr_save_enabled,
1725   &hf_ieee80211_ff_sm_pwr_save_sm_mode,
1726   &hf_ieee80211_ff_sm_pwr_save_reserved,
1727   NULL
1728 };
1729
1730 static int hf_ieee80211_ff_pco_phase_cntrl = -1;
1731
1732 static int hf_ieee80211_ff_psmp_param_set = -1;
1733 static int hf_ieee80211_ff_psmp_param_set_n_sta = -1;
1734 static int hf_ieee80211_ff_psmp_param_set_more_psmp = -1;
1735 static int hf_ieee80211_ff_psmp_param_set_psmp_sequence_duration = -1;
1736
1737 static const int *ieee80211_ff_psmp_param_set_fields[] = {
1738   &hf_ieee80211_ff_psmp_param_set_n_sta,
1739   &hf_ieee80211_ff_psmp_param_set_more_psmp,
1740   &hf_ieee80211_ff_psmp_param_set_psmp_sequence_duration,
1741   NULL
1742 };
1743
1744 static int hf_ieee80211_ff_mimo_cntrl = -1;
1745 static int hf_ieee80211_ff_mimo_cntrl_nc_index = -1;
1746 static int hf_ieee80211_ff_mimo_cntrl_nr_index = -1;
1747 static int hf_ieee80211_ff_mimo_cntrl_channel_width = -1;
1748 static int hf_ieee80211_ff_mimo_cntrl_grouping = -1;
1749 static int hf_ieee80211_ff_mimo_cntrl_coefficient_size = -1;
1750 static int hf_ieee80211_ff_mimo_cntrl_codebook_info = -1;
1751 static int hf_ieee80211_ff_mimo_cntrl_remaining_matrix_segment = -1;
1752 static int hf_ieee80211_ff_mimo_cntrl_reserved = -1;
1753 static int hf_ieee80211_ff_mimo_cntrl_sounding_timestamp = -1;
1754
1755 static int hf_ieee80211_ff_ant_selection = -1;
1756 static int hf_ieee80211_ff_ant_selection_0 = -1;
1757 static int hf_ieee80211_ff_ant_selection_1 = -1;
1758 static int hf_ieee80211_ff_ant_selection_2 = -1;
1759 static int hf_ieee80211_ff_ant_selection_3 = -1;
1760 static int hf_ieee80211_ff_ant_selection_4 = -1;
1761 static int hf_ieee80211_ff_ant_selection_5 = -1;
1762 static int hf_ieee80211_ff_ant_selection_6 = -1;
1763 static int hf_ieee80211_ff_ant_selection_7 = -1;
1764
1765 static const int *ieee80211_ff_ant_selection_fields[] = {
1766   &hf_ieee80211_ff_ant_selection_0,
1767   &hf_ieee80211_ff_ant_selection_1,
1768   &hf_ieee80211_ff_ant_selection_2,
1769   &hf_ieee80211_ff_ant_selection_3,
1770   &hf_ieee80211_ff_ant_selection_4,
1771   &hf_ieee80211_ff_ant_selection_5,
1772   &hf_ieee80211_ff_ant_selection_6,
1773   &hf_ieee80211_ff_ant_selection_7,
1774   NULL
1775 };
1776
1777 static int hf_ieee80211_ff_ext_channel_switch_announcement = -1;
1778 static int hf_ieee80211_ff_ext_channel_switch_announcement_switch_mode = -1;
1779 static int hf_ieee80211_ff_ext_channel_switch_announcement_new_reg_class = -1;
1780 static int hf_ieee80211_ff_ext_channel_switch_announcement_new_chan_number = -1;
1781 static int hf_ieee80211_ff_ext_channel_switch_announcement_switch_count = -1;
1782
1783 static const int *ieee80211_ff_ext_channel_switch_announcement_fields[] = {
1784   &hf_ieee80211_ff_ext_channel_switch_announcement_switch_mode,
1785   &hf_ieee80211_ff_ext_channel_switch_announcement_new_reg_class,
1786   &hf_ieee80211_ff_ext_channel_switch_announcement_new_chan_number,
1787   &hf_ieee80211_ff_ext_channel_switch_announcement_switch_count,
1788   NULL
1789 };
1790
1791 static int hf_ieee80211_ff_ht_info = -1;
1792 static int hf_ieee80211_ff_ht_info_information_request = -1;
1793 static int hf_ieee80211_ff_ht_info_40_mhz_intolerant = -1;
1794 static int hf_ieee80211_ff_ht_info_sta_chan_width = -1;
1795 static int hf_ieee80211_ff_ht_info_reserved = -1;
1796
1797 static const int *ieee80211_ff_ht_info_fields[] = {
1798   &hf_ieee80211_ff_ht_info_information_request,
1799   &hf_ieee80211_ff_ht_info_40_mhz_intolerant,
1800   &hf_ieee80211_ff_ht_info_sta_chan_width,
1801   &hf_ieee80211_ff_ht_info_reserved,
1802   NULL
1803 };
1804
1805 static int hf_ieee80211_ff_ht_action = -1;
1806
1807 static int hf_ieee80211_ff_psmp_sta_info = -1;
1808 static int hf_ieee80211_ff_psmp_sta_info_type = -1;
1809 static int hf_ieee80211_ff_psmp_sta_info_dtt_start_offset = -1;
1810 static int hf_ieee80211_ff_psmp_sta_info_dtt_duration = -1;
1811 static int hf_ieee80211_ff_psmp_sta_info_sta_id = -1;
1812 static int hf_ieee80211_ff_psmp_sta_info_utt_start_offset = -1;
1813 static int hf_ieee80211_ff_psmp_sta_info_utt_duration = -1;
1814 static int hf_ieee80211_ff_psmp_sta_info_reserved_small= -1;
1815 static int hf_ieee80211_ff_psmp_sta_info_reserved_large = -1;
1816 static int hf_ieee80211_ff_psmp_sta_info_psmp_multicast_id = -1;
1817
1818 static int hf_ieee80211_ff_mimo_csi_snr = -1;
1819
1820 /*** Begin: 802.11s additions ***/
1821 static int hf_ieee80211_ff_mesh_action = -1;
1822 static int hf_ieee80211_ff_multihop_action = -1;
1823 static int hf_ieee80211_ff_mesh_flags = -1;
1824 static int hf_ieee80211_ff_mesh_ttl = -1;
1825 static int hf_ieee80211_ff_mesh_sequence = -1;
1826 static int hf_ieee80211_ff_mesh_addr4 = -1;
1827 static int hf_ieee80211_ff_mesh_addr5 = -1;
1828 static int hf_ieee80211_ff_mesh_addr6 = -1;
1829 static int hf_ieee80211_ff_selfprot_action = -1;
1830
1831 static int hf_ieee80211_mesh_peering_proto = -1;
1832 static int hf_ieee80211_mesh_peering_local_link_id = -1;
1833 static int hf_ieee80211_mesh_peering_peer_link_id = -1;
1834
1835 static int hf_ieee80211_ff_hwmp_flags = -1;
1836 static int hf_ieee80211_ff_hwmp_hopcount = -1;
1837 static int hf_ieee80211_ff_hwmp_ttl = -1;
1838 static int hf_ieee80211_ff_hwmp_pdid = -1;
1839 static int hf_ieee80211_ff_hwmp_orig_sta = -1;
1840 static int hf_ieee80211_ff_hwmp_orig_sn = -1;
1841 static int hf_ieee80211_ff_hwmp_orig_ext = -1;
1842 static int hf_ieee80211_ff_hwmp_lifetime = -1;
1843 static int hf_ieee80211_ff_hwmp_metric = -1;
1844 static int hf_ieee80211_ff_hwmp_targ_count = -1;
1845 static int hf_ieee80211_ff_hwmp_targ_flags = -1;
1846 static int hf_ieee80211_ff_hwmp_targ_to_flags = -1;
1847 static int hf_ieee80211_ff_hwmp_targ_usn_flags = -1;
1848 static int hf_ieee80211_ff_hwmp_targ_sta = -1;
1849 static int hf_ieee80211_ff_hwmp_targ_sn = -1;
1850 static int hf_ieee80211_ff_hwmp_targ_ext = -1;
1851 static int hf_ieee80211_rann_flags = -1;
1852 static int hf_ieee80211_rann_root_sta = -1;
1853 static int hf_ieee80211_rann_sn = -1;
1854 static int hf_ieee80211_rann_interval = -1;
1855
1856 static int hf_ieee80211_mesh_config_path_sel_protocol = -1;
1857 static int hf_ieee80211_mesh_config_path_sel_metric = -1;
1858 static int hf_ieee80211_mesh_config_congestion_control = -1;
1859 static int hf_ieee80211_mesh_config_sync_method = -1;
1860 static int hf_ieee80211_mesh_config_auth_protocol = -1;
1861 static int hf_ieee80211_mesh_config_formation_info = -1;
1862 static int hf_ieee80211_mesh_config_capability = -1;
1863 static int hf_ieee80211_mesh_id = -1;
1864
1865 static int hf_ieee80211_ff_public_action = -1;
1866
1867 /* ************************************************************************* */
1868 /*            Flags found in the capability field (fixed field)              */
1869 /* ************************************************************************* */
1870 static int hf_ieee80211_ff_capture = -1;
1871 static int hf_ieee80211_ff_cf_ess = -1;
1872 static int hf_ieee80211_ff_cf_ibss = -1;
1873 static int hf_ieee80211_ff_cf_sta_poll = -1; /* CF pollable status for a STA            */
1874 static int hf_ieee80211_ff_cf_ap_poll = -1;  /* CF pollable status for an AP            */
1875 static int hf_ieee80211_ff_cf_privacy = -1;
1876 static int hf_ieee80211_ff_cf_preamble = -1;
1877 static int hf_ieee80211_ff_cf_pbcc = -1;
1878 static int hf_ieee80211_ff_cf_agility = -1;
1879 static int hf_ieee80211_ff_short_slot_time = -1;
1880 static int hf_ieee80211_ff_dsss_ofdm = -1;
1881 static int hf_ieee80211_ff_cf_spec_man = -1;
1882 static int hf_ieee80211_ff_cf_apsd = -1;
1883 static int hf_ieee80211_ff_cf_del_blk_ack = -1;
1884 static int hf_ieee80211_ff_cf_imm_blk_ack = -1;
1885
1886 /* ************************************************************************* */
1887 /*                       A-MSDU fields                                             */
1888 /* ************************************************************************* */
1889 static int hf_ieee80211_amsdu_msdu_header_text = -1;
1890
1891
1892 /* ************************************************************************* */
1893 /*                       Tagged value format fields                          */
1894 /* ************************************************************************* */
1895 static int hf_ieee80211_tagged_parameters = -1;  /* Fixed payload item */
1896 static int hf_ieee80211_tag = -1;
1897 static int hf_ieee80211_tag_number = -1;
1898 static int hf_ieee80211_tag_length = -1;
1899 static int hf_ieee80211_tag_interpretation = -1;
1900 static int hf_ieee80211_tag_oui = -1;
1901 static int hf_ieee80211_tag_ssid = -1;
1902 static int hf_ieee80211_tag_supp_rates = -1;
1903 static int hf_ieee80211_tag_fh_dwell_time = -1;
1904 static int hf_ieee80211_tag_fh_hop_set = -1;
1905 static int hf_ieee80211_tag_fh_hop_pattern = -1;
1906 static int hf_ieee80211_tag_fh_hop_index = -1;
1907 static int hf_ieee80211_tag_ds_param_channel = -1;
1908 static int hf_ieee80211_tag_cfp_count = -1;
1909 static int hf_ieee80211_tag_cfp_period = -1;
1910 static int hf_ieee80211_tag_cfp_max_duration = -1;
1911 static int hf_ieee80211_tag_cfp_dur_remaining = -1;
1912 static int hf_ieee80211_tim_dtim_count = -1;
1913 static int hf_ieee80211_tim_dtim_period = -1;
1914 static int hf_ieee80211_tim_bmapctl = -1;
1915 static int hf_ieee80211_tim_bmapctl_mcast = -1;
1916 static int hf_ieee80211_tim_bmapctl_offset = -1;
1917 static int hf_ieee80211_tim_partial_virtual_bitmap = -1;
1918 static int hf_ieee80211_tag_ibss_atim_window = -1;
1919 static int hf_ieee80211_tag_country_info_code = -1;
1920 static int hf_ieee80211_tag_country_info_env = -1;
1921 static int hf_ieee80211_tag_country_info_pad = -1;
1922 static int hf_ieee80211_tag_country_info_fnm = -1;
1923 static int hf_ieee80211_tag_country_info_fnm_fcn = -1;
1924 static int hf_ieee80211_tag_country_info_fnm_nc = -1;
1925 static int hf_ieee80211_tag_country_info_fnm_mtpl = -1;
1926 static int hf_ieee80211_tag_country_info_rrc = -1;
1927 static int hf_ieee80211_tag_country_info_rrc_rei = -1;
1928 static int hf_ieee80211_tag_country_info_rrc_rc = -1;
1929 static int hf_ieee80211_tag_country_info_rrc_cc = -1;
1930 static int hf_ieee80211_tag_fh_hopping_parameter_prime_radix = -1;
1931 static int hf_ieee80211_tag_fh_hopping_parameter_nb_channels = -1;
1932 static int hf_ieee80211_tag_fh_hopping_table_flag = -1;
1933 static int hf_ieee80211_tag_fh_hopping_table_number_of_sets = -1;
1934 static int hf_ieee80211_tag_fh_hopping_table_modulus = -1;
1935 static int hf_ieee80211_tag_fh_hopping_table_offset = -1;
1936 static int hf_ieee80211_tag_fh_hopping_random_table = -1;
1937 static int hf_ieee80211_tag_request = -1;
1938 static int hf_ieee80211_tag_challenge_text = -1;
1939
1940 static int hf_ieee80211_wep_iv = -1;
1941 static int hf_ieee80211_wep_iv_weak = -1;
1942 static int hf_ieee80211_tkip_extiv = -1;
1943 static int hf_ieee80211_ccmp_extiv = -1;
1944 static int hf_ieee80211_wep_key = -1;
1945 static int hf_ieee80211_wep_icv = -1;
1946
1947 static int hf_ieee80211_block_ack_request_control = -1;
1948 static int hf_ieee80211_block_ack_control = -1;
1949 static int hf_ieee80211_block_ack_control_ack_policy = -1;
1950 static int hf_ieee80211_block_ack_control_multi_tid = -1;
1951 static int hf_ieee80211_block_ack_control_compressed_bitmap = -1;
1952 static int hf_ieee80211_block_ack_control_reserved = -1;
1953
1954 static int hf_ieee80211_block_ack_control_basic_tid_info = -1;
1955 static int hf_ieee80211_block_ack_control_compressed_tid_info = -1;
1956 static int hf_ieee80211_block_ack_control_multi_tid_info = -1;
1957
1958 static int hf_ieee80211_block_ack_multi_tid_info = -1;
1959 static int hf_ieee80211_block_ack_request_type = -1;
1960 static int hf_ieee80211_block_ack_multi_tid_reserved = -1;
1961 static int hf_ieee80211_block_ack_multi_tid_value = -1;
1962 static int hf_ieee80211_block_ack_type = -1;
1963 static int hf_ieee80211_block_ack_bitmap = -1;
1964 static int hf_ieee80211_block_ack_bitmap_missing_frame = -1;
1965
1966 static int hf_ieee80211_tag_measure_request_measurement_mode = -1;
1967 static int hf_ieee80211_tag_measure_request_bssid = -1;
1968
1969 static int hf_ieee80211_tag_measure_request_subelement_length = -1;
1970 static int hf_ieee80211_tag_measure_request_beacon_sub_id = -1;
1971 static int hf_ieee80211_tag_measure_request_beacon_sub_ssid = -1;
1972 static int hf_ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition = -1;
1973 static int hf_ieee80211_tag_measure_request_beacon_sub_bri_threshold_offset = -1;
1974 static int hf_ieee80211_tag_measure_request_beacon_sub_reporting_detail = -1;
1975 static int hf_ieee80211_tag_measure_request_beacon_sub_request = -1;
1976 static int hf_ieee80211_tag_measure_request_beacon_unknown = -1;
1977
1978 static int hf_ieee80211_tag_measure_request_frame_request_type = -1;
1979 static int hf_ieee80211_tag_measure_request_mac_address  = -1;
1980 static int hf_ieee80211_tag_measure_request_peer_mac_address = -1;
1981 static int hf_ieee80211_tag_measure_request_group_id = -1;
1982
1983 static int hf_ieee80211_ht_cap = -1;
1984 static int hf_ieee80211_ht_vs_cap = -1;
1985 static int hf_ieee80211_ht_ldpc_coding = -1;
1986 static int hf_ieee80211_ht_chan_width = -1;
1987 static int hf_ieee80211_ht_sm_pwsave = -1;
1988 static int hf_ieee80211_ht_green = -1;
1989 static int hf_ieee80211_ht_short20 = -1;
1990 static int hf_ieee80211_ht_short40 = -1;
1991 static int hf_ieee80211_ht_tx_stbc = -1;
1992 static int hf_ieee80211_ht_rx_stbc = -1;
1993 static int hf_ieee80211_ht_delayed_block_ack = -1;
1994 static int hf_ieee80211_ht_max_amsdu = -1;
1995 static int hf_ieee80211_ht_dss_cck_40 = -1;
1996 static int hf_ieee80211_ht_psmp = -1;
1997 static int hf_ieee80211_ht_40_mhz_intolerant = -1;
1998 static int hf_ieee80211_ht_l_sig = -1;
1999
2000 static int hf_ieee80211_ampduparam = -1;
2001 static int hf_ieee80211_ampduparam_vs = -1;
2002 static int hf_ieee80211_ampduparam_mpdu = -1;
2003 static int hf_ieee80211_ampduparam_mpdu_start_spacing = -1;
2004 static int hf_ieee80211_ampduparam_reserved = -1;
2005
2006 static int hf_ieee80211_mcsset = -1;
2007 static int hf_ieee80211_mcsset_vs = -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_cap = -1;
2307 static int hf_ieee80211_hta_ext_chan_offset = -1;
2308 static int hf_ieee80211_hta_rec_tx_width = -1;
2309 static int hf_ieee80211_hta_rifs_mode = -1;
2310 static int hf_ieee80211_hta_controlled_access = -1;
2311 static int hf_ieee80211_hta_service_interval = -1;
2312 static int hf_ieee80211_hta_operating_mode = -1;
2313 static int hf_ieee80211_hta_non_gf_devices = -1;
2314 static int hf_ieee80211_hta_basic_stbc_mcs = -1;
2315 static int hf_ieee80211_hta_dual_stbc_protection = -1;
2316 static int hf_ieee80211_hta_secondary_beacon = -1;
2317 static int hf_ieee80211_hta_lsig_txop_protection = -1;
2318 static int hf_ieee80211_hta_pco_active = -1;
2319 static int hf_ieee80211_hta_pco_phase = -1;
2320
2321 static int hf_ieee80211_antsel = -1;
2322 static int hf_ieee80211_antsel_vs = -1;
2323 static int hf_ieee80211_antsel_b0 = -1;
2324 static int hf_ieee80211_antsel_b1 = -1;
2325 static int hf_ieee80211_antsel_b2 = -1;
2326 static int hf_ieee80211_antsel_b3 = -1;
2327 static int hf_ieee80211_antsel_b4 = -1;
2328 static int hf_ieee80211_antsel_b5 = -1;
2329 static int hf_ieee80211_antsel_b6 = -1;
2330 static int hf_ieee80211_antsel_b7 = -1;
2331
2332 static int hf_ieee80211_rsn_version = -1;
2333 static int hf_ieee80211_rsn_gcs = -1;
2334 static int hf_ieee80211_rsn_gcs_oui = -1;
2335 static int hf_ieee80211_rsn_gcs_type = -1;
2336 static int hf_ieee80211_rsn_gcs_80211_type = -1;
2337 static int hf_ieee80211_rsn_pcs_count = -1;
2338 static int hf_ieee80211_rsn_pcs_list = -1;
2339 static int hf_ieee80211_rsn_pcs = -1;
2340 static int hf_ieee80211_rsn_pcs_oui = -1;
2341 static int hf_ieee80211_rsn_pcs_80211_type = -1;
2342 static int hf_ieee80211_rsn_pcs_type = -1;
2343 static int hf_ieee80211_rsn_akms_count = -1;
2344 static int hf_ieee80211_rsn_akms_list = -1;
2345 static int hf_ieee80211_rsn_akms = -1;
2346 static int hf_ieee80211_rsn_akms_oui = -1;
2347 static int hf_ieee80211_rsn_akms_80211_type = -1;
2348 static int hf_ieee80211_rsn_akms_type = -1;
2349 static int hf_ieee80211_rsn_cap = -1;
2350 static int hf_ieee80211_rsn_cap_preauth = -1;
2351 static int hf_ieee80211_rsn_cap_no_pairwise = -1;
2352 static int hf_ieee80211_rsn_cap_ptksa_replay_counter = -1;
2353 static int hf_ieee80211_rsn_cap_gtksa_replay_counter = -1;
2354 static int hf_ieee80211_rsn_cap_mfpr = -1;
2355 static int hf_ieee80211_rsn_cap_mfpc = -1;
2356 static int hf_ieee80211_rsn_cap_peerkey = -1;
2357 static int hf_ieee80211_rsn_pmkid_count = -1;
2358 static int hf_ieee80211_rsn_pmkid_list = -1;
2359 static int hf_ieee80211_rsn_pmkid = -1;
2360 static int hf_ieee80211_rsn_gmcs = -1;
2361 static int hf_ieee80211_rsn_gmcs_oui = -1;
2362 static int hf_ieee80211_rsn_gmcs_type = -1;
2363 static int hf_ieee80211_rsn_gmcs_80211_type = -1;
2364
2365 static int hf_ieee80211_wfa_ie_type = -1;
2366 static int hf_ieee80211_wfa_ie_wpa_version = -1;
2367 static int hf_ieee80211_wfa_ie_wpa_mcs = -1;
2368 static int hf_ieee80211_wfa_ie_wpa_mcs_oui = -1;
2369 static int hf_ieee80211_wfa_ie_wpa_mcs_type = -1;
2370 static int hf_ieee80211_wfa_ie_wpa_mcs_wfa_type = -1;
2371 static int hf_ieee80211_wfa_ie_wpa_ucs_count = -1;
2372 static int hf_ieee80211_wfa_ie_wpa_ucs_list = -1;
2373 static int hf_ieee80211_wfa_ie_wpa_ucs = -1;
2374 static int hf_ieee80211_wfa_ie_wpa_ucs_oui = -1;
2375 static int hf_ieee80211_wfa_ie_wpa_ucs_wfa_type = -1;
2376 static int hf_ieee80211_wfa_ie_wpa_ucs_type = -1;
2377 static int hf_ieee80211_wfa_ie_wpa_akms_count = -1;
2378 static int hf_ieee80211_wfa_ie_wpa_akms_list = -1;
2379 static int hf_ieee80211_wfa_ie_wpa_akms = -1;
2380 static int hf_ieee80211_wfa_ie_wpa_akms_oui = -1;
2381 static int hf_ieee80211_wfa_ie_wpa_akms_wfa_type = -1;
2382 static int hf_ieee80211_wfa_ie_wpa_akms_type = -1;
2383 static int hf_ieee80211_wfa_ie_wme_subtype = -1;
2384 static int hf_ieee80211_wfa_ie_wme_version = -1;
2385 static int hf_ieee80211_wfa_ie_wme_qos_info = -1;
2386 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_max_sp_length = -1;
2387 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_be = -1;
2388 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_bk = -1;
2389 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vi = -1;
2390 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vo = -1;
2391 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_reserved = -1;
2392 static int hf_ieee80211_wfa_ie_wme_qos_info_ap_u_apsd = -1;
2393 static int hf_ieee80211_wfa_ie_wme_qos_info_ap_parameter_set_count = -1;
2394 static int hf_ieee80211_wfa_ie_wme_qos_info_ap_reserved = -1;
2395 static int hf_ieee80211_wfa_ie_wme_reserved = -1;
2396 static int hf_ieee80211_wfa_ie_wme_ac_parameters = -1;
2397 static int hf_ieee80211_wfa_ie_wme_acp_aci_aifsn = -1;
2398 static int hf_ieee80211_wfa_ie_wme_acp_aci = -1;
2399 static int hf_ieee80211_wfa_ie_wme_acp_acm = -1;
2400 static int hf_ieee80211_wfa_ie_wme_acp_aifsn = -1;
2401 static int hf_ieee80211_wfa_ie_wme_acp_reserved = -1;
2402 static int hf_ieee80211_wfa_ie_wme_acp_ecw = -1;
2403 static int hf_ieee80211_wfa_ie_wme_acp_ecw_max = -1;
2404 static int hf_ieee80211_wfa_ie_wme_acp_ecw_min = -1;
2405 static int hf_ieee80211_wfa_ie_wme_acp_txop_limit = -1;
2406 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo = -1;
2407 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_tid = -1;
2408 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_direction = -1;
2409 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_psb = -1;
2410 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_up = -1;
2411 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_reserved = -1;
2412 static int hf_ieee80211_wfa_ie_wme_tspec_nor_msdu = -1;
2413 static int hf_ieee80211_wfa_ie_wme_tspec_max_msdu = -1;
2414 static int hf_ieee80211_wfa_ie_wme_tspec_min_srv = -1;
2415 static int hf_ieee80211_wfa_ie_wme_tspec_max_srv = -1;
2416 static int hf_ieee80211_wfa_ie_wme_tspec_inact_int = -1;
2417 static int hf_ieee80211_wfa_ie_wme_tspec_susp_int = -1;
2418 static int hf_ieee80211_wfa_ie_wme_tspec_srv_start = -1;
2419 static int hf_ieee80211_wfa_ie_wme_tspec_min_data = -1;
2420 static int hf_ieee80211_wfa_ie_wme_tspec_mean_data = -1;
2421 static int hf_ieee80211_wfa_ie_wme_tspec_peak_data = -1;
2422 static int hf_ieee80211_wfa_ie_wme_tspec_burst_size = -1;
2423 static int hf_ieee80211_wfa_ie_wme_tspec_delay_bound = -1;
2424 static int hf_ieee80211_wfa_ie_wme_tspec_min_phy = -1;
2425 static int hf_ieee80211_wfa_ie_wme_tspec_surplus = -1;
2426 static int hf_ieee80211_wfa_ie_wme_tspec_medium = -1;
2427
2428 static int hf_ieee80211_aironet_ie_type = -1;
2429 static int hf_ieee80211_aironet_ie_version = -1;
2430 static int hf_ieee80211_aironet_ie_data = -1;
2431 static int hf_ieee80211_aironet_ie_qos_unk1 = -1;
2432 static int hf_ieee80211_aironet_ie_qos_paramset = -1;
2433 static int hf_ieee80211_aironet_ie_qos_val = -1;
2434
2435 static int hf_ieee80211_marvell_ie_type = -1;
2436 static int hf_ieee80211_marvell_ie_mesh_subtype = -1;
2437 static int hf_ieee80211_marvell_ie_mesh_version = -1;
2438 static int hf_ieee80211_marvell_ie_mesh_active_proto_id = -1;
2439 static int hf_ieee80211_marvell_ie_mesh_active_metric_id = -1;
2440 static int hf_ieee80211_marvell_ie_mesh_cap = -1;
2441 static int hf_ieee80211_marvell_ie_data = -1;
2442
2443 static int hf_ieee80211_atheros_ie_type = -1;
2444 static int hf_ieee80211_atheros_ie_subtype = -1;
2445 static int hf_ieee80211_atheros_ie_version = -1;
2446 static int hf_ieee80211_atheros_ie_cap_f_turbop = -1;
2447 static int hf_ieee80211_atheros_ie_cap_f_comp = -1;
2448 static int hf_ieee80211_atheros_ie_cap_f_ff = -1;
2449 static int hf_ieee80211_atheros_ie_cap_f_xr = -1;
2450 static int hf_ieee80211_atheros_ie_cap_f_ar = -1;
2451 static int hf_ieee80211_atheros_ie_cap_f_burst = -1;
2452 static int hf_ieee80211_atheros_ie_cap_f_wme = -1;
2453 static int hf_ieee80211_atheros_ie_cap_f_boost = -1;
2454 static int hf_ieee80211_atheros_ie_advcap_cap = -1;
2455 static int hf_ieee80211_atheros_ie_advcap_defkey = -1;
2456 static int hf_ieee80211_atheros_ie_xr_info = -1;
2457 static int hf_ieee80211_atheros_ie_xr_base_bssid = -1;
2458 static int hf_ieee80211_atheros_ie_xr_xr_bssid = -1;
2459 static int hf_ieee80211_atheros_ie_xr_xr_beacon = -1;
2460 static int hf_ieee80211_atheros_ie_xr_base_cap = -1;
2461 static int hf_ieee80211_atheros_ie_xr_xr_cap = -1;
2462 static int hf_ieee80211_atheros_ie_data = -1;
2463
2464 /*QBSS - Version 1,2,802.11e*/
2465
2466 static int hf_ieee80211_qbss2_cal = -1;
2467 static int hf_ieee80211_qbss2_gl = -1;
2468 static int hf_ieee80211_qbss_cu = -1;
2469 static int hf_ieee80211_qbss2_cu = -1;
2470 static int hf_ieee80211_qbss_scount = -1;
2471 static int hf_ieee80211_qbss2_scount = -1;
2472 static int hf_ieee80211_qbss_version = -1;
2473 static int hf_ieee80211_qbss_adc = -1;
2474
2475 static int hf_ieee80211_tsinfo = -1;
2476 static int hf_ieee80211_tsinfo_type = -1;
2477 static int hf_ieee80211_tsinfo_tsid = -1;
2478 static int hf_ieee80211_tsinfo_dir = -1;
2479 static int hf_ieee80211_tsinfo_access = -1;
2480 static int hf_ieee80211_tsinfo_agg = -1;
2481 static int hf_ieee80211_tsinfo_apsd = -1;
2482 static int hf_ieee80211_tsinfo_up = -1;
2483 static int hf_ieee80211_tsinfo_ack = -1;
2484 static int hf_ieee80211_tsinfo_sched = -1;
2485 static int hf_ieee80211_tsinfo_rsv = -1;
2486
2487 static const int *ieee80211_tsinfo_fields[] = {
2488   &hf_ieee80211_tsinfo_type,
2489   &hf_ieee80211_tsinfo_tsid,
2490   &hf_ieee80211_tsinfo_dir,
2491   &hf_ieee80211_tsinfo_access,
2492   &hf_ieee80211_tsinfo_agg,
2493   &hf_ieee80211_tsinfo_apsd,
2494   &hf_ieee80211_tsinfo_up,
2495   &hf_ieee80211_tsinfo_ack,
2496   &hf_ieee80211_tsinfo_sched,
2497   &hf_ieee80211_tsinfo_rsv,
2498   NULL
2499 };
2500
2501 static int hf_ieee80211_tspec_nor_msdu = -1;
2502 static int hf_ieee80211_tspec_max_msdu = -1;
2503 static int hf_ieee80211_tspec_min_srv = -1;
2504 static int hf_ieee80211_tspec_max_srv = -1;
2505 static int hf_ieee80211_tspec_inact_int = -1;
2506 static int hf_ieee80211_tspec_susp_int = -1;
2507 static int hf_ieee80211_tspec_srv_start = -1;
2508 static int hf_ieee80211_tspec_min_data = -1;
2509 static int hf_ieee80211_tspec_mean_data = -1;
2510 static int hf_ieee80211_tspec_peak_data = -1;
2511 static int hf_ieee80211_tspec_burst_size = -1;
2512 static int hf_ieee80211_tspec_delay_bound = -1;
2513 static int hf_ieee80211_tspec_min_phy = -1;
2514 static int hf_ieee80211_tspec_surplus = -1;
2515 static int hf_ieee80211_tspec_medium = -1;
2516 static int hf_ieee80211_ts_delay = -1;
2517 static int hf_ieee80211_tclas_process = -1;
2518 static int hf_ieee80211_tag_qos_cap_qos_info = -1;
2519 static int hf_ieee80211_qos_info_field_vo_uapsd = -1;
2520 static int hf_ieee80211_qos_info_field_vi_uapsd = -1;
2521 static int hf_ieee80211_qos_info_field_bk_uapsd = -1;
2522 static int hf_ieee80211_qos_info_field_be_uapsd = -1;
2523 static int hf_ieee80211_qos_info_field_qack = -1;
2524 static int hf_ieee80211_qos_info_field_max_sp_length = -1;
2525 static int hf_ieee80211_qos_info_field_more_data_ack = -1;
2526 static int hf_ieee80211_qos_info_field_edca_upd_cnt = -1;
2527 static int hf_ieee80211_qos_info_field_queue_req = -1;
2528 static int hf_ieee80211_qos_info_field_txop_req = -1;
2529 static int hf_ieee80211_qos_info_field_reserved = -1;
2530 static int hf_ieee80211_tag_ext_supp_rates = -1;
2531 static int hf_ieee80211_sched_info = -1;
2532 static int hf_ieee80211_sched_info_agg = -1;
2533 static int hf_ieee80211_sched_info_tsid = -1;
2534 static int hf_ieee80211_sched_info_dir = -1;
2535 static int hf_ieee80211_sched_srv_start = -1;
2536 static int hf_ieee80211_sched_srv_int = -1;
2537 static int hf_ieee80211_sched_spec_int = -1;
2538 static int hf_ieee80211_tclas_up = -1;
2539 static int hf_ieee80211_tclas_class_type = -1;
2540 static int hf_ieee80211_tclas_class_mask = -1;
2541 static int hf_ieee80211_tclas_src_mac_addr = -1;
2542 static int hf_ieee80211_tclas_dst_mac_addr = -1;
2543 static int hf_ieee80211_tclas_ether_type = -1;
2544 static int hf_ieee80211_tclas_version = -1;
2545 static int hf_ieee80211_tclas_ipv4_src = -1;
2546 static int hf_ieee80211_tclas_ipv4_dst = -1;
2547 static int hf_ieee80211_tclas_src_port = -1;
2548 static int hf_ieee80211_tclas_dst_port = -1;
2549 static int hf_ieee80211_tclas_dscp = -1;
2550 static int hf_ieee80211_tclas_protocol = -1;
2551 static int hf_ieee80211_tclas_ipv6_src = -1;
2552 static int hf_ieee80211_tclas_ipv6_dst = -1;
2553 static int hf_ieee80211_tclas_flow = -1;
2554 static int hf_ieee80211_tclas_tag_type = -1;
2555
2556 static int hf_ieee80211_aruba = -1;
2557 static int hf_ieee80211_aruba_hb_seq = -1;
2558 static int hf_ieee80211_aruba_mtu = -1;
2559
2560 static int hf_ieee80211_tag_vendor_oui_type = -1;
2561
2562 /* IEEE Std 802.11z-2010 7.3.2.62 */
2563 static int hf_ieee80211_tag_link_id_bssid = -1;
2564 static int hf_ieee80211_tag_link_id_init_sta = -1;
2565 static int hf_ieee80211_tag_link_id_resp_sta = -1;
2566
2567 /* IEEE Std 802.11z-2010 7.3.2.63 */
2568 static int hf_ieee80211_tag_wakeup_schedule_offset = -1;
2569 static int hf_ieee80211_tag_wakeup_schedule_interval = -1;
2570 static int hf_ieee80211_tag_wakeup_schedule_awake_window_slots = -1;
2571 static int hf_ieee80211_tag_wakeup_schedule_max_awake_dur = -1;
2572 static int hf_ieee80211_tag_wakeup_schedule_idle_count = -1;
2573
2574 /* IEEE Std 802.11z-2010 7.3.2.64 */
2575 static int hf_ieee80211_tag_channel_switch_timing_switch_time = -1;
2576 static int hf_ieee80211_tag_channel_switch_timing_switch_timeout = -1;
2577
2578 /* IEEE Std 802.11z-2010 7.3.2.65 */
2579 static int hf_ieee80211_tag_pti_control_tid = -1;
2580 static int hf_ieee80211_tag_pti_control_sequence_control = -1;
2581
2582 /* IEEE Std 802.11z-2010 7.3.2.66 */
2583 static int hf_ieee80211_tag_pu_buffer_status_ac_bk = -1;
2584 static int hf_ieee80211_tag_pu_buffer_status_ac_be = -1;
2585 static int hf_ieee80211_tag_pu_buffer_status_ac_vi = -1;
2586 static int hf_ieee80211_tag_pu_buffer_status_ac_vo = -1;
2587
2588 /* IEEE Std 802.11r-2008 7.3.2.49 */
2589 static int hf_ieee80211_tag_timeout_int_type = -1;
2590 static int hf_ieee80211_tag_timeout_int_value = -1;
2591
2592 /* Ethertype 89-0d */
2593 static int hf_ieee80211_data_encap_payload_type = -1;
2594
2595 /* ************************************************************************* */
2596 /*                               Protocol trees                              */
2597 /* ************************************************************************* */
2598 static gint ett_80211 = -1;
2599 static gint ett_proto_flags = -1;
2600 static gint ett_cap_tree = -1;
2601 static gint ett_fc_tree = -1;
2602 static gint ett_cntrl_wrapper_fc = -1;
2603 static gint ett_cntrl_wrapper_payload = -1;
2604 static gint ett_fragments = -1;
2605 static gint ett_fragment = -1;
2606 static gint ett_block_ack = -1;
2607 static gint ett_block_ack_bitmap = -1;
2608 static gint ett_ath_cap_tree = -1;
2609
2610
2611 static gint ett_80211_mgt = -1;
2612 static gint ett_fixed_parameters = -1;
2613 static gint ett_tagged_parameters = -1;
2614 static gint ett_tag_bmapctl_tree = -1;
2615 static gint ett_tag_country_fnm_tree = -1;
2616 static gint ett_tag_country_rcc_tree = -1;
2617 static gint ett_qos_parameters = -1;
2618 static gint ett_qos_ps_buf_state = -1;
2619 static gint ett_qos_info_field_tree = -1;
2620 static gint ett_wep_parameters = -1;
2621 static gint ett_msh_control = -1;
2622 static gint ett_hwmp_targ_flags_tree = -1;
2623
2624 static gint ett_rsn_gcs_tree = -1;
2625 static gint ett_rsn_pcs_tree = -1;
2626 static gint ett_rsn_sub_pcs_tree = -1;
2627 static gint ett_rsn_akms_tree = -1;
2628 static gint ett_rsn_sub_akms_tree = -1;
2629 static gint ett_rsn_cap_tree = -1;
2630 static gint ett_rsn_pmkid_tree = -1;
2631 static gint ett_rsn_gmcs_tree = -1;
2632
2633 static gint ett_wpa_mcs_tree = -1;
2634 static gint ett_wpa_ucs_tree = -1;
2635 static gint ett_wpa_sub_ucs_tree = -1;
2636 static gint ett_wpa_akms_tree = -1;
2637 static gint ett_wpa_sub_akms_tree = -1;
2638 static gint ett_wme_ac = -1;
2639 static gint ett_wme_aci_aifsn = -1;
2640 static gint ett_wme_ecw = -1;
2641 static gint ett_wme_qos_info = -1;
2642
2643 static gint ett_ht_cap_tree = -1;
2644 static gint ett_ampduparam_tree = -1;
2645 static gint ett_mcsset_tree = -1;
2646 static gint ett_mcsbit_tree = -1;
2647 static gint ett_htex_cap_tree = -1;
2648 static gint ett_txbf_tree = -1;
2649 static gint ett_antsel_tree = -1;
2650 static gint ett_hta_cap_tree = -1;
2651 static gint ett_hta_cap1_tree = -1;
2652 static gint ett_hta_cap2_tree = -1;
2653 static gint ett_htc_tree = -1;
2654
2655 static gint ett_ht_info_delimiter1_tree = -1;
2656 static gint ett_ht_info_delimiter2_tree = -1;
2657 static gint ett_ht_info_delimiter3_tree = -1;
2658
2659 static gint ett_tag_measure_request_mode_tree = -1;
2660 static gint ett_tag_measure_request_type_tree = -1;
2661 static gint ett_tag_measure_report_mode_tree = -1;
2662 static gint ett_tag_measure_report_type_tree = -1;
2663 static gint ett_tag_measure_report_basic_map_tree = -1;
2664 static gint ett_tag_measure_report_rpi_tree = -1;
2665 static gint ett_tag_measure_report_frame_tree = -1;
2666 static gint ett_tag_dfs_map_tree = -1;
2667 static gint ett_tag_erp_info_tree = -1;
2668 static gint ett_tag_ex_cap = -1;
2669
2670 static gint ett_tag_supported_channels = -1;
2671
2672 static gint ett_tag_neighbor_report_bssid_info_tree = -1;
2673 static gint ett_tag_neighbor_report_bssid_info_capability_tree = -1;
2674 static gint ett_tag_neighbor_report_sub_tag_tree = -1;
2675
2676 static gint ett_tag_time_adv_tree = -1;
2677
2678 static gint ett_ff_ba_param_tree = -1;
2679 static gint ett_ff_ba_ssc_tree = -1;
2680 static gint ett_ff_delba_param_tree = -1;
2681 static gint ett_ff_qos_info = -1;
2682 static gint ett_ff_sm_pwr_save = -1;
2683 static gint ett_ff_psmp_param_set = -1;
2684 static gint ett_ff_mimo_cntrl = -1;
2685 static gint ett_ff_ant_sel = -1;
2686 static gint ett_mimo_report = -1;
2687 static gint ett_ff_chan_switch_announce = -1;
2688 static gint ett_ff_ht_info = -1;
2689 static gint ett_ff_psmp_sta_info = -1;
2690
2691 static gint ett_msdu_aggregation_parent_tree = -1;
2692 static gint ett_msdu_aggregation_subframe_tree = -1;
2693
2694 static gint ett_80211_mgt_ie = -1;
2695 static gint ett_tsinfo_tree = -1;
2696 static gint ett_sched_tree = -1;
2697
2698 static gint ett_fcs = -1;
2699
2700 static gint ett_adv_proto = -1;
2701 static gint ett_adv_proto_tuple = -1;
2702 static gint ett_gas_query = -1;
2703 static gint ett_gas_anqp = -1;
2704 static gint ett_nai_realm = -1;
2705 static gint ett_nai_realm_eap = -1;
2706 static gint ett_anqp_vendor_capab = -1;
2707
2708 static const fragment_items frag_items = {
2709   &ett_fragment,
2710   &ett_fragments,
2711   &hf_ieee80211_fragments,
2712   &hf_ieee80211_fragment,
2713   &hf_ieee80211_fragment_overlap,
2714   &hf_ieee80211_fragment_overlap_conflict,
2715   &hf_ieee80211_fragment_multiple_tails,
2716   &hf_ieee80211_fragment_too_long_fragment,
2717   &hf_ieee80211_fragment_error,
2718   &hf_ieee80211_fragment_count,
2719   &hf_ieee80211_reassembled_in,
2720   &hf_ieee80211_reassembled_length,
2721   "fragments"
2722 };
2723
2724 static enum_val_t wlan_ignore_wep_options[] = {
2725   { "no",         "No",               WLAN_IGNORE_WEP_NO    },
2726   { "without_iv", "Yes - without IV", WLAN_IGNORE_WEP_WO_IV },
2727   { "with_iv",    "Yes - with IV",    WLAN_IGNORE_WEP_W_IV  },
2728   { NULL,         NULL,               0                     }
2729 };
2730
2731 static dissector_handle_t ieee80211_handle;
2732 static dissector_handle_t llc_handle;
2733 static dissector_handle_t ipx_handle;
2734 static dissector_handle_t eth_withoutfcs_handle;
2735 static dissector_handle_t data_handle;
2736
2737 static int wlan_tap = -1;
2738
2739 static const value_string access_network_type_vals[] =
2740 {
2741   { 0, "Private network" },
2742   { 1, "Private network with guest access" },
2743   { 2, "Chargeable public network" },
2744   { 3, "Free public network" },
2745   { 4, "Personal device network" },
2746   { 5, "Emergency services only network" },
2747   { 14, "Test or experimental" },
2748   { 15, "Wildcard" },
2749   { 0, NULL }
2750 };
2751
2752 static const value_string adv_proto_id_vals[] =
2753 {
2754   {0, "Access Network Query Protocol"},
2755   {1, "MIH Information Service"},
2756   {2, "MIH Command and Event Services Capability Discovery"},
2757   {3, "Emergency Alert System (EAS)"},
2758   {4, "Location-to-Service Translation Protocol"},
2759   {221, "Vendor Specific"},
2760   {0, NULL}
2761 };
2762
2763 static const value_string timeout_int_types[] =
2764 {
2765   {1, "Reassociation deadline interval (TUs)"},
2766   {2, "Key lifetime interval (seconds)"},
2767   {3, "Association Comeback time (TUs)"},
2768   {0, NULL}
2769 };
2770
2771 static const value_string tdls_action_codes[] ={
2772   {TDLS_SETUP_REQUEST, "TDLS Setup Request"},
2773   {TDLS_SETUP_RESPONSE, "TDLS Setup Response"},
2774   {TDLS_SETUP_CONFIRM, "TDLS Setup Confirm"},
2775   {TDLS_TEARDOWN, "TDLS Teardown"},
2776   {TDLS_PEER_TRAFFIC_INDICATION, "TDLS Peer Traffic Indication"},
2777   {TDLS_CHANNEL_SWITCH_REQUEST, "TDLS Channel Switch Request"},
2778   {TDLS_CHANNEL_SWITCH_RESPONSE, "TDLS Channel Switch Response"},
2779   {TDLS_PEER_PSM_REQUEST, "TDLS Peer PSM Request"},
2780   {TDLS_PEER_PSM_RESPONSE, "TDLS Peer PSM Response"},
2781   {TDLS_PEER_TRAFFIC_RESPONSE, "TDLS Peer Traffic Response"},
2782   {TDLS_DISCOVERY_REQUEST, "TDLS Discovery Request"},
2783   {0, NULL}
2784 };
2785
2786 AIRPDCAP_CONTEXT airpdcap_ctx;
2787
2788 #define PSMP_STA_INFO_BROADCAST 0
2789 #define PSMP_STA_INFO_MULTICAST 1
2790 #define PSMP_STA_INFO_INDIVIDUALLY_ADDRESSED 2
2791
2792 #define PSMP_STA_INFO_FLAG_TYPE         0x00000003
2793 #define PSMP_STA_INFO_FLAG_DTT_START    0x00001FFC
2794 #define PSMP_STA_INFO_FLAG_DTT_DURATION 0x001FE000
2795
2796 #define PSMP_STA_INFO_FLAG_STA_ID       0x001FFFE0
2797
2798 #define PSMP_STA_INFO_FLAG_UTT_START    0x0000FFE0
2799 #define PSMP_STA_INFO_FLAG_UTT_DURATION 0x03FF0000
2800
2801 #define PSMP_STA_INFO_FLAG_IA_RESERVED  0xFC000000
2802
2803 static const value_string ff_psmp_sta_info_flags[] = {
2804   { PSMP_STA_INFO_BROADCAST, "Broadcast"},
2805   { PSMP_STA_INFO_MULTICAST, "Multicast"},
2806   { PSMP_STA_INFO_INDIVIDUALLY_ADDRESSED, "Individually Addressed"},
2807   {0, NULL}
2808 };
2809
2810 static void
2811 beacon_interval_base_custom(gchar *result, guint32 beacon_interval)
2812 {
2813    double temp_double;
2814    temp_double = (double)beacon_interval;
2815    g_snprintf(result, ITEM_LABEL_LENGTH, "%f [Seconds]", (temp_double * 1024 / 1000000) );
2816 }
2817
2818 /* ************************************************************************* */
2819 /*            Return the length of the current header (in bytes)             */
2820 /* ************************************************************************* */
2821 static int
2822 find_header_length (guint16 fcf, guint16 ctrl_fcf, gboolean is_ht)
2823 {
2824   int len;
2825   guint16 cw_fcf;
2826
2827   switch (FCF_FRAME_TYPE (fcf)) {
2828
2829   case MGT_FRAME:
2830     if (is_ht && IS_STRICTLY_ORDERED(FCF_FLAGS(fcf)))
2831       return MGT_FRAME_HDR_LEN + 4;
2832
2833     return MGT_FRAME_HDR_LEN;
2834
2835   case CONTROL_FRAME:
2836     if (COMPOSE_FRAME_TYPE(fcf) == CTRL_CONTROL_WRAPPER) {
2837       len = 6;
2838       cw_fcf = ctrl_fcf;
2839     } else {
2840       len = 0;
2841       cw_fcf = fcf;
2842     }
2843     switch (COMPOSE_FRAME_TYPE (cw_fcf)) {
2844
2845     case CTRL_CTS:
2846     case CTRL_ACKNOWLEDGEMENT:
2847       return len + 10;
2848
2849     case CTRL_RTS:
2850     case CTRL_PS_POLL:
2851     case CTRL_CFP_END:
2852     case CTRL_CFP_ENDACK:
2853     case CTRL_BLOCK_ACK_REQ:
2854     case CTRL_BLOCK_ACK:
2855       return len + 16;
2856     }
2857     return len + 4;  /* XXX */
2858
2859   case DATA_FRAME:
2860     len = (FCF_ADDR_SELECTOR(fcf) ==
2861       DATA_ADDR_T4) ? DATA_LONG_HDR_LEN : DATA_SHORT_HDR_LEN;
2862
2863     if (DATA_FRAME_IS_QOS(COMPOSE_FRAME_TYPE(fcf))) {
2864       len += 2;
2865       if (is_ht && IS_STRICTLY_ORDERED(FCF_FLAGS(fcf))) {
2866         len += 4;
2867       }
2868     }
2869
2870     return len;
2871
2872   default:
2873     return 4;  /* XXX */
2874   }
2875 }
2876
2877 /* ************************************************************************* */
2878 /* Mesh Control field helper functions
2879  *
2880  * Per IEEE 802.11s Draft 12.0 section 7.2.2.1:
2881  *
2882  * The frame body consists of either:
2883  * The MSDU (or a fragment thereof), the Mesh Control field (if and only if the
2884  * frame is transmitted by a mesh STA and the Mesh Control Present subfield of
2885  * the QoS Control field is 1)...
2886  *
2887  * We need a stateful sniffer for that.  For now, use heuristics.
2888  *
2889  * Notably, only mesh data frames contain the Mesh Control field in the header.
2890  * Other frames that contain mesh control (i.e., multihop action frames) have
2891  * it deeper in the frame body where it can be definitively identified.
2892  * Further, mesh data frames always have to-ds and from-ds either 11 or 01.  We
2893  * use these facts to make our heuristics more reliable.
2894  * ************************************************************************* */
2895 static int
2896 has_mesh_control(guint16 fcf, guint16 qos_ctl, guint8 mesh_flags)
2897 {
2898   /* assume mesh control present if the QOS field's Mesh Control Present bit is
2899    * set, all reserved bits in the mesh_flags field are zero, and the address
2900    * extension mode is not a reserved value.
2901    */
2902   return ((FCF_ADDR_SELECTOR(fcf) == DATA_ADDR_T4 || FCF_ADDR_SELECTOR(fcf) == DATA_ADDR_T2) &&
2903           (QOS_MESH_CONTROL_PRESENT(qos_ctl)) &&
2904           (mesh_flags & ~MESH_FLAGS_ADDRESS_EXTENSION) == 0 &&
2905           (mesh_flags & MESH_FLAGS_ADDRESS_EXTENSION) != MESH_FLAGS_ADDRESS_EXTENSION);
2906 }
2907
2908 static int
2909 find_mesh_control_length(guint8 mesh_flags)
2910 {
2911   return 6 + 6*(mesh_flags & MESH_FLAGS_ADDRESS_EXTENSION);
2912 }
2913
2914 mimo_control_t get_mimo_control (tvbuff_t *tvb, int offset)
2915 {
2916   guint16 mimo;
2917   mimo_control_t output;
2918
2919   mimo = tvb_get_letohs (tvb, offset);
2920
2921   output.nc = (mimo & 0x0003) + 1;
2922   output.nr = ((mimo & 0x000C) >> 2) + 1;
2923   output.chan_width = (mimo & 0x0010) >> 4;
2924   output.coefficient_size = 4; /* XXX - Is this a good default? */
2925
2926   switch ((mimo & 0x0060) >> 5)
2927     {
2928       case 0:
2929         output.grouping = 1;
2930         break;
2931
2932       case 1:
2933         output.grouping = 2;
2934         break;
2935
2936       case 2:
2937         output.grouping = 4;
2938         break;
2939
2940       default:
2941         output.grouping = 1;
2942         break;
2943     }
2944
2945   switch ((mimo & 0x0180) >> 7)
2946     {
2947       case 0:
2948         output.coefficient_size = 4;
2949         break;
2950
2951       case 1:
2952         output.coefficient_size = 5;
2953         break;
2954
2955       case 2:
2956         output.coefficient_size = 6;
2957         break;
2958
2959       case 3:
2960         output.coefficient_size = 8;
2961         break;
2962     }
2963
2964   output.codebook_info = (mimo & 0x0600) >> 9;
2965   output.remaining_matrix_segment = (mimo & 0x3800) >> 11;
2966
2967   return output;
2968 }
2969
2970 int get_mimo_na (guint8 nr, guint8 nc)
2971 {
2972   if (nr == 2 && nc == 1){
2973     return 2;
2974   }else if (nr == 2 && nc == 2){
2975     return 2;
2976   }else if (nr == 3 && nc == 1){
2977     return 4;
2978   }else if (nr == 3 && nc == 2){
2979     return 6;
2980   }else if (nr == 3 && nc == 3){
2981     return 6;
2982   }else if (nr == 4 && nc == 1){
2983     return 6;
2984   }else if (nr == 4 && nc == 2){
2985     return 10;
2986   }else if (nr == 4 && nc == 3){
2987     return 12;
2988   }else if (nr == 4 && nc == 4){
2989     return 12;
2990   }else{
2991     return 0;
2992   }
2993 }
2994
2995 int get_mimo_ns (gboolean chan_width, guint8 output_grouping)
2996 {
2997   int ns = 0;
2998
2999   if (chan_width)
3000   {
3001     switch (output_grouping)
3002       {
3003         case 1:
3004           ns = 114;
3005           break;
3006
3007           case 2:
3008             ns = 58;
3009             break;
3010
3011           case 4:
3012             ns = 30;
3013             break;
3014
3015           default:
3016             ns = 0;
3017       }
3018   } else {
3019     switch (output_grouping)
3020       {
3021         case 1:
3022           ns = 56;
3023           break;
3024
3025         case 2:
3026           ns = 30;
3027           break;
3028
3029         case 4:
3030           ns = 16;
3031           break;
3032
3033         default:
3034           ns = 0;
3035       }
3036   }
3037
3038   return ns;
3039 }
3040
3041 int add_mimo_csi_matrices_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl)
3042 {
3043   proto_item *snr_item;
3044   proto_tree *snr_tree;
3045   int csi_matrix_size, start_offset;
3046   int ns, i;
3047
3048   start_offset = offset;
3049   snr_item = proto_tree_add_text(tree, tvb, offset, mimo_cntrl.nc, "Signal to Noise Ratio");
3050   snr_tree = proto_item_add_subtree (snr_item, ett_mimo_report);
3051
3052   for (i=1; i <= mimo_cntrl.nr; i++)
3053   {
3054     guint8 snr;
3055
3056     snr = tvb_get_guint8(tvb, offset);
3057     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);
3058     offset++;
3059   }
3060
3061   ns = get_mimo_ns(mimo_cntrl.chan_width, mimo_cntrl.grouping);
3062   csi_matrix_size = ns*(3+(2*mimo_cntrl.nc*mimo_cntrl.nr*mimo_cntrl.coefficient_size));
3063   csi_matrix_size = roundup2(csi_matrix_size, 8) / 8;
3064   proto_tree_add_text(tree, tvb, offset, csi_matrix_size, "CSI Matrices");
3065   offset += csi_matrix_size;
3066   return offset - start_offset;
3067 }
3068
3069 int add_mimo_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl)
3070 {
3071   proto_item *snr_item;
3072   proto_tree *snr_tree;
3073   int csi_matrix_size, start_offset;
3074   int ns, i;
3075
3076   start_offset = offset;
3077   snr_item = proto_tree_add_text(tree, tvb, offset, mimo_cntrl.nc, "Signal to Noise Ratio");
3078   snr_tree = proto_item_add_subtree (snr_item, ett_mimo_report);
3079
3080   for (i=1; i <= mimo_cntrl.nc; i++)
3081   {
3082     guint8 snr;
3083
3084     snr = tvb_get_guint8(tvb, offset);
3085     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);
3086     offset++;
3087   }
3088
3089   ns = get_mimo_ns(mimo_cntrl.chan_width, mimo_cntrl.grouping);
3090   csi_matrix_size = ns*(2*mimo_cntrl.nc*mimo_cntrl.nr*mimo_cntrl.coefficient_size);
3091   csi_matrix_size = roundup2(csi_matrix_size, 8) / 8;
3092   proto_tree_add_text(tree, tvb, offset, csi_matrix_size, "Beamforming Feedback Matrices");
3093   offset += csi_matrix_size;
3094   return offset - start_offset;
3095 }
3096
3097 int add_mimo_compressed_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl)
3098 {
3099   proto_item *snr_item;
3100   proto_tree *snr_tree;
3101   int csi_matrix_size, start_offset;
3102   int ns, na, i;
3103
3104   start_offset = offset;
3105   snr_item = proto_tree_add_text(tree, tvb, offset, mimo_cntrl.nc, "Signal to Noise Ratio");
3106   snr_tree = proto_item_add_subtree (snr_item, ett_mimo_report);
3107
3108   for (i=1; i <= mimo_cntrl.nc; i++)
3109   {
3110     guint8 snr;
3111
3112     snr = tvb_get_guint8(tvb, offset);
3113     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);
3114     offset++;
3115   }
3116
3117   na = get_mimo_na(mimo_cntrl.nr, mimo_cntrl.nc);
3118   ns = get_mimo_ns(mimo_cntrl.chan_width, mimo_cntrl.grouping);
3119   csi_matrix_size = ns*(na*((mimo_cntrl.codebook_info+1)*2 + 2)/2);
3120   csi_matrix_size = roundup2(csi_matrix_size, 8) / 8;
3121   proto_tree_add_text(tree, tvb, offset, csi_matrix_size, "Compressed Beamforming Feedback Matrices");
3122   offset += csi_matrix_size;
3123   return offset - start_offset;
3124 }
3125
3126 /* ************************************************************************* */
3127 /*          This is the capture function used to update packet counts        */
3128 /* ************************************************************************* */
3129 static void
3130 capture_ieee80211_common (const guchar * pd, int offset, int len,
3131         packet_counts * ld, gboolean fixed_length_header,
3132         gboolean datapad, gboolean is_ht)
3133 {
3134   guint16 fcf, hdr_length;
3135
3136   if (!BYTES_ARE_IN_FRAME(offset, len, 2)) {
3137     ld->other++;
3138     return;
3139   }
3140
3141   fcf = pletohs (&pd[offset]);
3142
3143   if (IS_PROTECTED(FCF_FLAGS(fcf)) && wlan_ignore_wep == WLAN_IGNORE_WEP_NO) {
3144     ld->other++;
3145     return;
3146   }
3147
3148   switch (COMPOSE_FRAME_TYPE (fcf)) {
3149
3150     case DATA:          /* We got a data frame */
3151     case DATA_CF_ACK:   /* Data with ACK */
3152     case DATA_CF_POLL:
3153     case DATA_CF_ACK_POLL:
3154     case DATA_QOS_DATA:
3155     {
3156       if (fixed_length_header) {
3157         hdr_length = DATA_LONG_HDR_LEN;
3158       } else {
3159         hdr_length = find_header_length (fcf, 0, is_ht);
3160         /* adjust the header length depending on the Mesh Control field */
3161         if (FCF_FRAME_TYPE(fcf) == DATA_FRAME &&
3162             DATA_FRAME_IS_QOS(COMPOSE_FRAME_TYPE(fcf))) {
3163
3164           guint8 mesh_flags = pd[hdr_length];
3165           guint16 qosoff = hdr_length - 2;
3166           qosoff -= is_ht ? 4 : 0;
3167           if (has_mesh_control(fcf, pletohs(&pd[qosoff]), mesh_flags)) {
3168             hdr_length += find_mesh_control_length(mesh_flags);
3169           }
3170         }
3171         if (datapad)
3172           hdr_length = roundup2(hdr_length, 4);
3173       }
3174       /* I guess some bridges take Netware Ethernet_802_3 frames,
3175          which are 802.3 frames (with a length field rather than
3176          a type field, but with no 802.2 header in the payload),
3177          and just stick the payload into an 802.11 frame.  I've seen
3178          captures that show frames of that sort.
3179
3180          We also handle some odd form of encapsulation in which a
3181          complete Ethernet frame is encapsulated within an 802.11
3182          data frame, with no 802.2 header.  This has been seen
3183          from some hardware.
3184
3185          On top of that, at least at some point it appeared that
3186          the OLPC XO sent out frames with two bytes of 0 between
3187          the "end" of the 802.11 header and the beginning of
3188          the payload.
3189
3190          So, if the packet doesn't start with 0xaa 0xaa:
3191
3192            we first use the same scheme that linux-wlan-ng does to detect
3193            those encapsulated Ethernet frames, namely looking to see whether
3194            the frame either starts with 6 octets that match the destination
3195            address from the 802.11 header or has 6 octets that match the
3196            source address from the 802.11 header following the first 6 octets,
3197            and, if so, treat it as an encapsulated Ethernet frame;
3198
3199            otherwise, we use the same scheme that we use in the Ethernet
3200            dissector to recognize Netware 802.3 frames, namely checking
3201            whether the packet starts with 0xff 0xff and, if so, treat it
3202            as an encapsulated IPX frame, and then check whether the
3203            packet starts with 0x00 0x00 and, if so, treat it as an OLPC
3204            frame. */
3205       if (!BYTES_ARE_IN_FRAME(offset+hdr_length, len, 2)) {
3206         ld->other++;
3207         return;
3208       }
3209       if (pd[offset+hdr_length] != 0xaa && pd[offset+hdr_length+1] != 0xaa) {
3210 #if 0
3211         /* XXX - this requires us to parse the header to find the source
3212            and destination addresses. */
3213         if (BYTES_ARE_IN_FRAME(offset+hdr_length, len, 12) {
3214           /* We have two MAC addresses after the header. */
3215           if (memcmp(&pd[offset+hdr_length+6], pinfo->dl_src.data, 6) == 0 ||
3216               memcmp(&pd[offset+hdr_length+6], pinfo->dl_dst.data, 6) == 0) {
3217             capture_eth (pd, offset + hdr_length, len, ld);
3218             return;
3219           }
3220         }
3221 #endif
3222         if (pd[offset+hdr_length] == 0xff && pd[offset+hdr_length+1] == 0xff)
3223           capture_ipx (ld);
3224         else if (pd[offset+hdr_length] == 0x00 && pd[offset+hdr_length+1] == 0x00)
3225           capture_llc (pd, offset + hdr_length + 2, len, ld);
3226       }
3227       else {
3228         capture_llc (pd, offset + hdr_length, len, ld);
3229       }
3230       break;
3231     }
3232
3233     default:
3234       ld->other++;
3235       break;
3236   }
3237 }
3238
3239 /*
3240  * Handle 802.11 with a variable-length link-layer header.
3241  */
3242 void
3243 capture_ieee80211 (const guchar * pd, int offset, int len, packet_counts * ld)
3244 {
3245   capture_ieee80211_common (pd, offset, len, ld, FALSE, FALSE, FALSE);
3246 }
3247
3248 /*
3249  * Handle 802.11 with a variable-length link-layer header and data padding.
3250  */
3251 void
3252 capture_ieee80211_datapad (const guchar * pd, int offset, int len,
3253                            packet_counts * ld)
3254 {
3255   capture_ieee80211_common (pd, offset, len, ld, FALSE, TRUE, FALSE);
3256 }
3257
3258 /*
3259  * Handle 802.11 with a fixed-length link-layer header (padded to the
3260  * maximum length).
3261  */
3262 void
3263 capture_ieee80211_fixed (const guchar * pd, int offset, int len, packet_counts * ld)
3264 {
3265   capture_ieee80211_common (pd, offset, len, ld, TRUE, FALSE, FALSE);
3266 }
3267
3268 /*
3269  * Handle an HT 802.11 with a variable-length link-layer header.
3270  */
3271 void
3272 capture_ieee80211_ht (const guchar * pd, int offset, int len, packet_counts * ld)
3273 {
3274   capture_ieee80211_common (pd, offset, len, ld, FALSE, FALSE, TRUE);
3275 }
3276
3277
3278 /* ************************************************************************* */
3279 /*          Add the subtree used to store the fixed parameters               */
3280 /* ************************************************************************* */
3281 static proto_tree *
3282 get_fixed_parameter_tree (proto_tree * tree, tvbuff_t *tvb, int start, int size)
3283 {
3284   proto_item *fixed_fields;
3285   fixed_fields =
3286     proto_tree_add_uint_format (tree, hf_ieee80211_fixed_parameters, tvb, start,
3287         size, size, "Fixed parameters (%d bytes)",
3288         size);
3289
3290   return proto_item_add_subtree (fixed_fields, ett_fixed_parameters);
3291 }
3292
3293
3294 /* ************************************************************************* */
3295 /*            Add the subtree used to store tagged parameters                */
3296 /* ************************************************************************* */
3297 static proto_tree *
3298 get_tagged_parameter_tree (proto_tree * tree, tvbuff_t *tvb, int start, int size)
3299 {
3300   proto_item *tagged_fields;
3301
3302   tagged_fields = proto_tree_add_uint_format (tree, hf_ieee80211_tagged_parameters,
3303     tvb,
3304     start,
3305     2,
3306     size,
3307     "Tagged parameters (%d bytes)",
3308     size);
3309
3310   return proto_item_add_subtree (tagged_fields, ett_tagged_parameters);
3311 }
3312
3313
3314 static int
3315 dissect_vendor_action_marvell(proto_tree *tree, tvbuff_t *tvb, int offset)
3316 {
3317   guint8 octet;
3318
3319   octet = tvb_get_guint8(tvb, offset);
3320   proto_tree_add_item (tree, hf_ieee80211_ff_marvell_action_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3321   offset++;
3322   switch (octet)
3323     {
3324       case MRVL_ACTION_MESH_MANAGEMENT:
3325         octet = tvb_get_guint8(tvb, offset);
3326         proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_action_code, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3327         offset++;
3328         switch (octet)
3329           {
3330             case MRVL_MESH_MGMT_ACTION_RREQ:
3331               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3332               offset++;
3333               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3334               offset++;
3335               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_hopcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3336               offset++;
3337               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_ttl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3338               offset++;
3339               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_rreqid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3340               offset+= 4;
3341               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_sa, tvb, offset, 6, ENC_NA);
3342               offset+= 6;
3343               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_ssn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3344               offset+= 4;
3345               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_lifetime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3346               offset+= 4;
3347               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3348               offset+= 4;
3349               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dstcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3350               offset++;
3351               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3352               offset++;
3353               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_da, tvb, offset, 6, ENC_NA);
3354               offset+= 6;
3355               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dsn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3356               offset+= 4;
3357               break;
3358             case MRVL_MESH_MGMT_ACTION_RREP:
3359               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3360               offset++;
3361               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3362               offset++;
3363               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_hopcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3364               offset++;
3365               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_ttl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3366               offset++;
3367               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_da, tvb, offset, 6, ENC_NA);
3368               offset+= 6;
3369               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dsn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3370               offset+= 4;
3371               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_lifetime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3372               offset+= 4;
3373               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3374               offset+= 4;
3375               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_sa, tvb, offset, 6, ENC_NA);
3376               offset+= 6;
3377               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_ssn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3378               offset+= 4;
3379               break;
3380             case MRVL_MESH_MGMT_ACTION_RERR:
3381               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3382               offset++;
3383               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3384               offset++;
3385               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dstcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3386               offset++;
3387               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_da, tvb, offset, 6, ENC_NA);
3388               offset+= 6;
3389               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dsn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3390               offset+= 4;
3391               break;
3392             default:
3393               break;
3394           }
3395         break;
3396       default:
3397         break;
3398     }
3399
3400   return offset;
3401 }
3402
3403 static guint
3404 dissect_advertisement_protocol(packet_info *pinfo, proto_tree *tree,
3405                                tvbuff_t *tvb, int offset, gboolean *anqp)
3406 {
3407   guint8 tag_no, tag_len, left;
3408   proto_item *item = NULL, *adv_item;
3409   proto_tree *adv_tree, *adv_tuple_tree;
3410
3411   if (anqp)
3412     *anqp = FALSE;
3413   tag_no = tvb_get_guint8(tvb, offset);
3414   if (anqp)
3415     item = proto_tree_add_item(tree, hf_ieee80211_tag_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3416
3417   tag_len = tvb_get_guint8(tvb, offset + 1);
3418   if (tag_no != TAG_ADVERTISEMENT_PROTOCOL) {
3419     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3420                            "Unexpected IE %d (expected Advertisement "
3421                            "Protocol)", tag_no);
3422     return 2 + tag_len;
3423   }
3424   if (anqp)
3425     item = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, 1, tag_len);
3426   if (tag_len < 2) {
3427     if (!anqp)
3428       item = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, 1, tag_len);
3429     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3430                            "Advertisement Protocol: IE must be at least 2 "
3431                            "octets long");
3432     return 2 + tag_len;
3433   }
3434
3435   left = tag_len;
3436   offset += 2;
3437   adv_item = proto_tree_add_text(tree, tvb, offset, left,
3438                                  "Advertisement Protocol element");
3439   adv_tree = proto_item_add_subtree(adv_item, ett_adv_proto);
3440
3441   while (left >= 2) {
3442     guint8 id;
3443
3444     id = tvb_get_guint8(tvb, offset + 1);
3445     if (id == 0)
3446       proto_item_append_text(adv_item, ": ANQP");
3447     item = proto_tree_add_text(adv_tree, tvb, offset, 2,
3448                                "Advertisement Protocol Tuple: %s",
3449                                val_to_str(id, adv_proto_id_vals,
3450                                           "Unknown (%d)"));
3451     adv_tuple_tree = proto_item_add_subtree(item, ett_adv_proto_tuple);
3452
3453     proto_tree_add_item(adv_tuple_tree,
3454                         hf_ieee80211_tag_adv_proto_resp_len_limit, tvb,
3455                         offset, 1, ENC_BIG_ENDIAN);
3456     proto_tree_add_item(adv_tuple_tree,
3457                         hf_ieee80211_tag_adv_proto_pame_bi, tvb,
3458                         offset, 1, ENC_BIG_ENDIAN);
3459     offset++;
3460     left--;
3461     proto_tree_add_item(adv_tuple_tree, hf_ieee80211_tag_adv_proto_id, tvb,
3462                         offset, 1, ENC_BIG_ENDIAN);
3463     offset++;
3464     left--;
3465
3466     if (id == 0 && anqp)
3467       *anqp = TRUE;
3468
3469     if (id == 221) {
3470       /* Vendor specific */
3471       guint8 len = tvb_get_guint8(tvb, offset);
3472       offset++;
3473       left--;
3474       if (len > left) {
3475         expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3476                                "Vendor specific info length error");
3477         return 2 + tag_len;
3478       }
3479       proto_tree_add_text(adv_tuple_tree, tvb, offset, len,
3480                           "Vendor Specific Advertisement Protocol info");
3481       offset += len;
3482       left -= len;
3483     }
3484   }
3485
3486   if (left) {
3487     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3488                            "Unexpected extra data in the end");
3489   }
3490
3491   return 2 + tag_len;
3492 }
3493
3494 static void
3495 dissect_anqp_query_list(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3496 {
3497     while (offset + 2 <= end) {
3498       proto_tree_add_item(tree, hf_ieee80211_ff_anqp_query_id,
3499                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
3500       offset += 2;
3501     }
3502     if (offset != end) {
3503       expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3504                              "Unexpected ANQP Query list format");
3505     }
3506 }
3507
3508 static void
3509 dissect_anqp_capab_list(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3510 {
3511   guint16 id, len;
3512   proto_item *item;
3513   proto_tree *vtree;
3514   guint32 oui;
3515
3516   while (offset + 2 <= end) {
3517     id = tvb_get_letohs(tvb, offset);
3518     item = proto_tree_add_item(tree, hf_ieee80211_ff_anqp_capability,
3519                                tvb, offset, 2, ENC_LITTLE_ENDIAN);
3520     offset += 2;
3521     if (id == ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST) {
3522       vtree = proto_item_add_subtree(item, ett_anqp_vendor_capab);
3523       len = tvb_get_letohs(tvb, offset);
3524       proto_tree_add_item(vtree, hf_ieee80211_ff_anqp_capability_vlen,
3525                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
3526       offset += 2;
3527       if (len < 3 || offset + len > end) {
3528         expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3529                                "Invalid vendor-specific ANQP capability");
3530         return;
3531       }
3532       oui = tvb_get_ntoh24(tvb, offset);
3533       proto_tree_add_item(vtree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
3534       offset += 3;
3535       len -= 3;
3536
3537       switch (oui) {
3538       default:
3539         proto_tree_add_item(vtree, hf_ieee80211_ff_anqp_capability_vendor,
3540                             tvb, offset, len, ENC_NA);
3541         break;
3542       }
3543
3544       offset += len;
3545     }
3546   }
3547   if (offset != end) {
3548     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3549                            "Unexpected ANQP Capability list format");
3550   }
3551 }
3552
3553 static const value_string venue_group_vals[] = {
3554   { 0, "Unspecified" },
3555   { 1, "Assembly" },
3556   { 2, "Business" },
3557   { 3, "Educational" },
3558   { 4, "Factory and Industrial" },
3559   { 5, "Institutional" },
3560   { 6, "Mercantile" },
3561   { 7, "Residential" },
3562   { 8, "Storage" },
3563   { 9, "Utility and Miscellaneous" },
3564   { 10, "Vehicular" },
3565   { 11, "Outdoor" },
3566   { 0, NULL }
3567 };
3568
3569 static void dissect_venue_info(proto_tree *tree, tvbuff_t *tvb, int offset)
3570 {
3571   proto_tree_add_item(tree, hf_ieee80211_ff_venue_info_group,
3572                       tvb, offset, 1, ENC_BIG_ENDIAN);
3573   proto_tree_add_item(tree, hf_ieee80211_ff_venue_info_type,
3574                       tvb, offset + 1, 1, ENC_BIG_ENDIAN);
3575 }
3576
3577 static void
3578 dissect_venue_name_info(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3579 {
3580   proto_item *item;
3581
3582   dissect_venue_info(tree, tvb, offset);
3583   offset += 2;
3584   while (offset + 4 <= end) {
3585     guint8 vlen = tvb_get_guint8(tvb, offset);
3586     item = proto_tree_add_item(tree, hf_ieee80211_ff_anqp_venue_length,
3587                                tvb, offset, 1, ENC_BIG_ENDIAN);
3588     offset++;
3589     if (vlen > end - offset || vlen < 3) {
3590       expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3591                              "Invalid Venue Name Duple length");
3592       break;
3593     }
3594     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_venue_language,
3595                         tvb, offset, 3, ENC_ASCII|ENC_NA);
3596     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_venue_name,
3597                         tvb, offset + 3, vlen - 3, ENC_ASCII|ENC_NA);
3598     offset += vlen;
3599   }
3600 }
3601
3602 static const value_string nw_auth_type_vals[] = {
3603   { 0, "Acceptance of terms and conditions" },
3604   { 1, "On-line enrollment supported" },
3605   { 2, "http/https redirection" },
3606   { 3, "DNS redirection" },
3607   { 0, NULL }
3608 };
3609
3610 static void
3611 dissect_network_auth_type(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3612 {
3613   while (offset + 3 <= end) {
3614     guint16 len;
3615     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_nw_auth_type_indicator,
3616                         tvb, offset, 1, ENC_BIG_ENDIAN);
3617     offset++;
3618     len = tvb_get_letohs(tvb, offset);
3619     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_nw_auth_type_url_len,
3620                         tvb, offset, 2, ENC_LITTLE_ENDIAN);
3621     offset += 2;
3622     if (len)
3623       proto_tree_add_item(tree, hf_ieee80211_ff_anqp_nw_auth_type_url,
3624                           tvb, offset, len, ENC_ASCII|ENC_NA);
3625     offset += len;
3626   }
3627 }
3628
3629 static void add_manuf(proto_item *item, tvbuff_t *tvb, int offset)
3630 {
3631   const gchar *manuf_name;
3632   manuf_name = tvb_get_manuf_name_if_known(tvb, offset);
3633   if (manuf_name == NULL)
3634     return;
3635   proto_item_append_text(item, " - %s", manuf_name);
3636 }
3637
3638 static void
3639 dissect_roaming_consortium_list(proto_tree *tree, tvbuff_t *tvb, int offset,
3640                                 int end)
3641 {
3642   proto_item *item;
3643   guint8 len;
3644
3645   while (offset < end) {
3646     len = tvb_get_guint8(tvb, offset);
3647     item = proto_tree_add_item(tree,
3648                                hf_ieee80211_ff_anqp_roaming_consortium_oi_len,
3649                                tvb, offset, 1, ENC_BIG_ENDIAN);
3650     offset++;
3651     if (len > end - offset || len < 3) {
3652       expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3653                              "Invalid Roaming Consortium OI");
3654       break;
3655     }
3656     item = proto_tree_add_item(tree,
3657                                hf_ieee80211_ff_anqp_roaming_consortium_oi,
3658                                tvb, offset, len, ENC_NA);
3659     add_manuf(item, tvb, offset);
3660     offset += len;
3661   }
3662 }
3663
3664 static const value_string ip_addr_avail_ipv6_vals[] = {
3665   { 0, "Address type not available" },
3666   { 1, "Address type available" },
3667   { 2, "Availability of the address type not known" },
3668   { 0, NULL }
3669 };
3670
3671 static const value_string ip_addr_avail_ipv4_vals[] = {
3672   { 0, "Address type not available" },
3673   { 1, "Public IPv4 address available" },
3674   { 2, "Port-restricted IPv4 address available" },
3675   { 3, "Single NATed private IPv4 address available" },
3676   { 4, "Double NATed private IPv4 address available" },
3677   { 5, "Port-restricted IPv4 address and single NATed IPv4 address available" },
3678   { 6, "Port-restricted IPv4 address and double NATed IPv4 address available" },
3679   { 7, "Availability of the address type is not known" },
3680   { 0, NULL }
3681 };
3682
3683 static void
3684 dissect_ip_addr_type_availability_info(proto_tree *tree, tvbuff_t *tvb,
3685                                        int offset)
3686 {
3687   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_ip_addr_avail_ipv6,
3688                       tvb, offset, 1, ENC_BIG_ENDIAN);
3689   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_ip_addr_avail_ipv4,
3690                       tvb, offset, 1, ENC_BIG_ENDIAN);
3691 }
3692
3693 static const value_string nai_realm_encoding_vals[] = {
3694   { 0, "Formatted in accordance with RFC 4282" },
3695   { 1, "UTF-8 formatted that is not formatted in accordance with RFC 4282" },
3696   { 0, NULL }
3697 };
3698
3699 static const value_string nai_realm_auth_param_id_vals[] = {
3700   { 1, "Expanded EAP Method" },
3701   { 2, "Non-EAP Inner Authentication Type" },
3702   { 3, "Inner Authentication EAP Method Type" },
3703   { 4, "Expanded Inner EAP Method" },
3704   { 5, "Credential Type" },
3705   { 6, "Tunneled EAP Method Credential Type" },
3706   { 221, "Vendor Specific" },
3707   { 0, NULL }
3708 };
3709
3710 static void
3711 dissect_nai_realm_list(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3712 {
3713   guint16 count, len;
3714   proto_item *item, *r_item;
3715   int f_end, eap_end;
3716   guint8 nai_len, eap_count, eap_len, auth_param_count, auth_param_len;
3717   guint8 auth_param_id;
3718   proto_tree *realm_tree, *eap_tree;
3719   guint8 *realm;
3720
3721   count = tvb_get_letohs(tvb, offset);
3722   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_nai_realm_count,
3723                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
3724   offset += 2;
3725   while (count > 0) {
3726     len = tvb_get_letohs(tvb, offset);
3727     r_item = proto_tree_add_text(tree, tvb, offset, 2 + len, "NAI Realm Data");
3728     realm_tree = proto_item_add_subtree(r_item, ett_nai_realm);
3729
3730     item = proto_tree_add_item(realm_tree, hf_ieee80211_ff_anqp_nai_field_len,
3731                                tvb, offset, 2, ENC_LITTLE_ENDIAN);
3732     offset += 2;
3733     if (offset + len > end) {
3734       expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3735                              "Invalid NAI Realm List");
3736       break;
3737     }
3738     f_end = offset + len;
3739     proto_tree_add_item(realm_tree, hf_ieee80211_ff_anqp_nai_realm_encoding,
3740                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
3741     offset++;
3742     nai_len = tvb_get_guint8(tvb, offset);
3743     item = proto_tree_add_item(realm_tree,
3744                                hf_ieee80211_ff_anqp_nai_realm_length,
3745                                tvb, offset, 1, ENC_LITTLE_ENDIAN);
3746     offset++;
3747     if (offset + nai_len > f_end) {
3748       expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3749                              "Invalid NAI Realm Data");
3750       break;
3751     }
3752     proto_tree_add_item(realm_tree, hf_ieee80211_ff_anqp_nai_realm,
3753                         tvb, offset, nai_len, ENC_ASCII|ENC_NA);
3754     realm = tvb_get_string(tvb, offset, nai_len);
3755     if (realm) {
3756       proto_item_append_text(r_item, " (%s)", realm);
3757       g_free(realm);
3758     }
3759     offset += nai_len;
3760     eap_count = tvb_get_guint8(tvb, offset);
3761     proto_tree_add_item(realm_tree, hf_ieee80211_ff_anqp_nai_realm_eap_count,
3762                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
3763     offset++;
3764
3765     while (eap_count > 0) {
3766       eap_len = tvb_get_guint8(tvb, offset);
3767       eap_end = offset + 1 + eap_len;
3768       item = proto_tree_add_text(realm_tree, tvb, offset, 1 + eap_len,
3769                                  "EAP Method");
3770       eap_tree = proto_item_add_subtree(item, ett_nai_realm_eap);
3771
3772       item = proto_tree_add_item(eap_tree,
3773                                  hf_ieee80211_ff_anqp_nai_realm_eap_len,
3774                                  tvb, offset, 1, ENC_LITTLE_ENDIAN);
3775       offset++;
3776       if (offset + eap_len > f_end) {
3777         expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3778                                "Invalid EAP Method subfield");
3779         break;
3780       }
3781
3782       proto_item_append_text(eap_tree, ": %s",
3783                              val_to_str(tvb_get_guint8(tvb, offset),
3784                                         eap_type_vals, "Unknown (%d)"));
3785       proto_tree_add_item(eap_tree, hf_ieee80211_ff_anqp_nai_realm_eap_method,
3786                           tvb, offset, 1, ENC_LITTLE_ENDIAN);
3787       offset++;
3788       auth_param_count = tvb_get_guint8(tvb, offset);
3789       proto_tree_add_item(eap_tree,
3790                           hf_ieee80211_ff_anqp_nai_realm_auth_param_count,
3791                           tvb, offset, 1, ENC_LITTLE_ENDIAN);
3792       offset++;
3793
3794       while (auth_param_count > 0) {
3795         auth_param_id = tvb_get_guint8(tvb, offset);
3796         proto_tree_add_item(eap_tree,
3797                             hf_ieee80211_ff_anqp_nai_realm_auth_param_id,
3798                             tvb, offset, 1, ENC_LITTLE_ENDIAN);
3799         offset++;
3800         auth_param_len = tvb_get_guint8(tvb, offset);
3801         proto_tree_add_item(eap_tree,
3802                             hf_ieee80211_ff_anqp_nai_realm_auth_param_len,
3803                             tvb, offset, 1, ENC_LITTLE_ENDIAN);
3804         offset++;
3805         item = proto_tree_add_item(
3806           eap_tree, hf_ieee80211_ff_anqp_nai_realm_auth_param_value,
3807           tvb, offset, auth_param_len, ENC_NA);
3808         if (auth_param_id == 3 && auth_param_len == 1) {
3809           guint8 inner_method = tvb_get_guint8(tvb, offset);
3810           const char *str;
3811           str = val_to_str(inner_method, eap_type_vals, "Unknown (%d)");
3812
3813           proto_item_append_text(eap_tree, " / %s", str);
3814           proto_item_append_text(item, " - %s", str);
3815         }
3816         offset += auth_param_len;
3817
3818         auth_param_count--;
3819       }
3820
3821       offset = eap_end;
3822       eap_count--;
3823     }
3824
3825     offset = f_end;
3826     count--;
3827   }
3828 }
3829
3830 static void
3831 dissect_3gpp_cellular_network_info(proto_tree *tree, tvbuff_t *tvb, int offset)
3832 {
3833   guint8 iei, num;
3834   proto_item *item;
3835
3836   /* See Annex A of 3GPP TS 24.234 v8.1.0 for description */
3837   proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_gud, tvb, offset, 1, ENC_BIG_ENDIAN);
3838   offset++;
3839   proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_udhl, tvb, offset, 1, ENC_BIG_ENDIAN);
3840   offset++;
3841   iei = tvb_get_guint8(tvb, offset);
3842   item = proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_iei, tvb, offset, 1, ENC_BIG_ENDIAN);
3843   if (iei == 0)
3844     proto_item_append_text(item, " (PLMN List)");
3845   else
3846     return;
3847   offset++;
3848   proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_plmn_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3849   offset++;
3850   num = tvb_get_guint8(tvb, offset);
3851   proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_num_plmns, tvb, offset, 1, ENC_BIG_ENDIAN);
3852   offset++;
3853   while (num > 0) {
3854     guint8 o1, o2, o3;
3855     if (tvb_reported_length_remaining(tvb, offset) < 3)
3856       break;
3857     num--;
3858     o1 = tvb_get_guint8(tvb, offset);
3859     o2 = tvb_get_guint8(tvb, offset + 1);
3860     o3 = tvb_get_guint8(tvb, offset + 2);
3861     proto_tree_add_string_format_value(tree, hf_ieee80211_3gpp_gc_plmn, tvb, offset, 3,
3862                                        "", "MCC %d%d%d MNC %d%d%c",
3863                                        o1 & 0x0f, (o1 & 0xf0) >> 4, o2 & 0x0f,
3864                                        o3 & 0x0f, (o3 & 0xf0) >> 4,
3865                                        ((o2 & 0xf0) == 0xf0) ? ' ' :
3866                                        ('0' + ((o2 & 0xf0) >> 4)));
3867     offset += 3;
3868   }
3869 }
3870
3871 static void
3872 dissect_domain_name_list(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3873 {
3874   guint8 len;
3875
3876   while (offset < end) {
3877     len = tvb_get_guint8(tvb, offset);
3878     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_domain_name_len,
3879                         tvb, offset, 1, ENC_BIG_ENDIAN);
3880     offset++;
3881     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_domain_name,
3882                         tvb, offset, len, ENC_ASCII|ENC_NA);
3883     offset += len;
3884   }
3885 }
3886
3887 static int
3888 dissect_anqp_info(proto_tree *tree, tvbuff_t *tvb, int offset,
3889                   gboolean request, int idx)
3890 {
3891   guint16 id, len;
3892   guint32 oui;
3893   guint8 subtype;
3894   proto_item *item;
3895
3896   item = proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info_id,
3897                              tvb, offset, 2, ENC_LITTLE_ENDIAN);
3898   id = tvb_get_letohs(tvb, offset);
3899   if (id != ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST) {
3900     if (idx == 0) {
3901       proto_item_append_text(tree, " - %s",
3902                              val_to_str(id, anqp_info_id_vals,
3903                                         "Unknown (%u)"));
3904       col_append_fstr(g_pinfo->cinfo, COL_INFO, " %s",
3905                       val_to_str(id, anqp_info_id_vals, "Unknown (%u)"));
3906     } else if (idx == 1) {
3907       proto_item_append_text(tree, ", ..");
3908       col_append_fstr(g_pinfo->cinfo, COL_INFO, ", ..");
3909     }
3910   }
3911   tree = proto_item_add_subtree(item, ett_gas_anqp);
3912   offset += 2;
3913   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info_length,
3914                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
3915   len = tvb_get_letohs(tvb, offset);
3916   offset += 2;
3917   if (tvb_reported_length_remaining(tvb, offset) < len) {
3918     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3919                            "Invalid ANQP Info length");
3920     return 4 + len;
3921   }
3922   switch (id)
3923   {
3924   case ANQP_INFO_ANQP_QUERY_LIST:
3925     dissect_anqp_query_list(tree, tvb, offset, offset + len);
3926     break;
3927   case ANQP_INFO_ANQP_CAPAB_LIST:
3928     dissect_anqp_capab_list(tree, tvb, offset, offset + len);
3929     break;
3930   case ANQP_INFO_VENUE_NAME_INFO:
3931     dissect_venue_name_info(tree, tvb, offset, offset + len);
3932     break;
3933   case ANQP_INFO_NETWORK_AUTH_TYPE_INFO:
3934     dissect_network_auth_type(tree, tvb, offset, offset + len);
3935     break;
3936   case ANQP_INFO_ROAMING_CONSORTIUM_LIST:
3937     dissect_roaming_consortium_list(tree, tvb, offset, offset + len);
3938     break;
3939   case ANQP_INFO_IP_ADDR_TYPE_AVAILABILITY_INFO:
3940     dissect_ip_addr_type_availability_info(tree, tvb, offset);
3941     break;
3942   case ANQP_INFO_NAI_REALM_LIST:
3943     dissect_nai_realm_list(tree, tvb, offset, offset + len);
3944     break;
3945   case ANQP_INFO_3GPP_CELLULAR_NETWORK_INFO:
3946     dissect_3gpp_cellular_network_info(tree, tvb, offset);
3947     break;
3948   case ANQP_INFO_DOMAIN_NAME_LIST:
3949     dissect_domain_name_list(tree, tvb, offset, offset + len);
3950     break;
3951   case ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST:
3952     oui = tvb_get_ntoh24(tvb, offset);
3953     proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
3954     offset += 3;
3955
3956     switch (oui) {
3957     case OUI_WFA:
3958       subtype = tvb_get_guint8(tvb, offset);
3959       if (subtype == WFA_SUBTYPE_P2P) {
3960         proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u: P2P ANQP",
3961                             subtype);
3962         dissect_wifi_p2p_anqp(g_pinfo, tree, tvb, offset + 1, request);
3963       } else {
3964         proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u", subtype);
3965       }
3966       break;
3967     default:
3968       proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info,
3969                           tvb, offset, len, ENC_NA);
3970       break;
3971     }
3972     break;
3973   default:
3974     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info,
3975                         tvb, offset, len, ENC_NA);
3976     break;
3977   }
3978
3979   return 4 + len;
3980 }
3981
3982 static void
3983 dissect_anqp(proto_tree *tree, tvbuff_t *tvb, int offset, gboolean request)
3984 {
3985   int idx = 0;
3986
3987   proto_item_append_text(tree, ": ANQP ");
3988   proto_item_append_text(tree, request ? "Request" : "Response");
3989   if (tvb_reported_length_remaining(tvb, offset) < 4) {
3990     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3991                            "Not enough room for ANQP header");
3992     return;
3993   }
3994   col_append_fstr(g_pinfo->cinfo, COL_INFO, ", ANQP %s",
3995                   request ? "Req" : "Resp");
3996   while (tvb_reported_length_remaining(tvb, offset) > 0) {
3997     offset += dissect_anqp_info(tree, tvb, offset, request, idx);
3998     idx++;
3999   }
4000 }
4001
4002 static guint
4003 dissect_gas_initial_request(proto_tree *tree, tvbuff_t *tvb, int offset,
4004                             gboolean anqp)
4005 {
4006   guint16 req_len;
4007   int start = offset;
4008   proto_item *item;
4009   proto_tree *query;
4010
4011   /* Query Request Length (2 octets) */
4012   req_len = tvb_get_letohs(tvb, offset);
4013
4014   item = proto_tree_add_text(tree, tvb, offset, 2 + req_len, "Query Request");
4015   if (tvb_reported_length_remaining(tvb, offset) < 2 + req_len) {
4016     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
4017                            "Invalid Query Request Length");
4018     return tvb_reported_length_remaining(tvb, offset);
4019   }
4020   query = proto_item_add_subtree(item, ett_gas_query);
4021
4022   proto_tree_add_item(query, hf_ieee80211_ff_query_request_length,
4023                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
4024   offset += 2;
4025   /*
4026    * Query Request (GAS query; formatted per protocol specified in the
4027    * Advertisement Protocol IE)
4028    */
4029   if (anqp)
4030     dissect_anqp(query, tvb, offset, TRUE);
4031   else
4032     proto_tree_add_item(query, hf_ieee80211_ff_query_request,
4033                         tvb, offset, req_len, ENC_NA);
4034   offset += req_len;
4035
4036   return offset - start;
4037 }
4038
4039 static guint
4040 dissect_gas_initial_response(proto_tree *tree, tvbuff_t *tvb, int offset,
4041                              gboolean anqp)
4042 {
4043   guint16 resp_len;
4044   int start = offset;
4045   proto_item *item;
4046   proto_tree *query;
4047
4048   /* Query Response Length (2 octets) */
4049   resp_len = tvb_get_letohs(tvb, offset);
4050
4051   item = proto_tree_add_text(tree, tvb, offset, 2 + resp_len,
4052                              "Query Response");
4053   if (tvb_reported_length_remaining(tvb, offset) < 2 + resp_len) {
4054     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
4055                            "Invalid Query Response Length");
4056     return tvb_reported_length_remaining(tvb, offset);
4057   }
4058   query = proto_item_add_subtree(item, ett_gas_query);
4059
4060   proto_tree_add_item(query, hf_ieee80211_ff_query_response_length,
4061                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
4062   offset += 2;
4063   /* Query Response (optional) */
4064   if (resp_len) {
4065     if (anqp)
4066       dissect_anqp(query, tvb, offset, FALSE);
4067     else
4068       proto_tree_add_item(query, hf_ieee80211_ff_query_response,
4069                           tvb, offset, resp_len, ENC_NA);
4070     offset += resp_len;
4071   }
4072
4073   return offset - start;
4074 }
4075
4076 static GHashTable *gas_fragment_table = NULL;
4077 static GHashTable *gas_reassembled_table = NULL;
4078
4079 static void ieee80211_gas_reassembly_init(void)
4080 {
4081   fragment_table_init(&gas_fragment_table);
4082   reassembled_table_init(&gas_reassembled_table);
4083 }
4084
4085 static gint ett_gas_resp_fragment = -1;
4086 static gint ett_gas_resp_fragments = -1;
4087
4088 static int hf_ieee80211_gas_resp_fragments = -1;
4089 static int hf_ieee80211_gas_resp_fragment = -1;
4090 static int hf_ieee80211_gas_resp_fragment_overlap = -1;
4091 static int hf_ieee80211_gas_resp_fragment_overlap_conflict = -1;
4092 static int hf_ieee80211_gas_resp_fragment_multiple_tails = -1;
4093 static int hf_ieee80211_gas_resp_fragment_too_long_fragment = -1;
4094 static int hf_ieee80211_gas_resp_fragment_error = -1;
4095 static int hf_ieee80211_gas_resp_fragment_count = -1;
4096 static int hf_ieee80211_gas_resp_reassembled_in = -1;
4097 static int hf_ieee80211_gas_resp_reassembled_length = -1;
4098
4099 static const fragment_items gas_resp_frag_items = {
4100   &ett_gas_resp_fragment,
4101   &ett_gas_resp_fragments,
4102   &hf_ieee80211_gas_resp_fragments,
4103   &hf_ieee80211_gas_resp_fragment,
4104   &hf_ieee80211_gas_resp_fragment_overlap,
4105   &hf_ieee80211_gas_resp_fragment_overlap_conflict,
4106   &hf_ieee80211_gas_resp_fragment_multiple_tails,
4107   &hf_ieee80211_gas_resp_fragment_too_long_fragment,
4108   &hf_ieee80211_gas_resp_fragment_error,
4109   &hf_ieee80211_gas_resp_fragment_count,
4110   &hf_ieee80211_gas_resp_reassembled_in,
4111   &hf_ieee80211_gas_resp_reassembled_length,
4112   "GAS Response fragments"
4113 };
4114
4115 static guint
4116 dissect_gas_comeback_response(proto_tree *tree, tvbuff_t *tvb, int offset,
4117                               gboolean anqp, guint8 frag, gboolean more,
4118                               guint8 dialog_token)
4119 {
4120   guint16 resp_len;
4121   int start = offset;
4122   proto_item *item;
4123   proto_tree *query;
4124
4125   /* Query Response Length (2 octets) */
4126   resp_len = tvb_get_letohs(tvb, offset);
4127
4128   item = proto_tree_add_text(tree, tvb, offset, 2 + resp_len,
4129                              "Query Response");
4130   if (tvb_reported_length_remaining(tvb, offset) < 2 + resp_len) {
4131     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
4132                            "Invalid Query Response Length");
4133     return tvb_reported_length_remaining(tvb, offset);
4134   }
4135   query = proto_item_add_subtree(item, ett_gas_query);
4136
4137   proto_tree_add_item(query, hf_ieee80211_ff_query_response_length,
4138                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
4139   offset += 2;
4140   /* Query Response (optional) */
4141   if (resp_len) {
4142     if (anqp && frag == 0 && !more)
4143       dissect_anqp(query, tvb, offset, FALSE);
4144     else {
4145       fragment_data *frag_msg;
4146       gboolean save_fragmented;
4147       tvbuff_t *new_tvb;
4148
4149       save_fragmented = g_pinfo->fragmented;
4150       g_pinfo->fragmented = TRUE;
4151       frag_msg = fragment_add_seq_check(tvb, offset, g_pinfo, dialog_token,
4152                                         gas_fragment_table,
4153                                         gas_reassembled_table, frag, resp_len,
4154                                         more);
4155       new_tvb = process_reassembled_data(tvb, offset, g_pinfo,
4156                                          "Reassembled GAS Query Response",
4157                                          frag_msg, &gas_resp_frag_items,
4158                                          NULL, tree);
4159       if (new_tvb) {
4160         if (anqp)
4161           dissect_anqp(query, new_tvb, 0, FALSE);
4162         else
4163           proto_tree_add_item(query, hf_ieee80211_ff_query_response,
4164                               new_tvb, 0,
4165                               tvb_reported_length_remaining(new_tvb, 0),
4166                               ENC_NA);
4167       }
4168
4169       /* The old tvb cannot be used anymore */
4170       ieee80211_tvb_invalid = TRUE;
4171
4172       g_pinfo->fragmented = save_fragmented;
4173     }
4174     offset += resp_len;
4175   }
4176
4177   return offset - start;
4178 }
4179
4180 /* ************************************************************************* */
4181 /*              Dissect and add fixed mgmt fields to protocol tree           */
4182 /* ************************************************************************* */
4183
4184 static guint
4185 add_fixed_field(proto_tree *tree, tvbuff_t *tvb, int offset,
4186                 enum fixed_field lfcode);
4187
4188 static guint64 last_timestamp;
4189
4190 static guint
4191 add_ff_timestamp(proto_tree *tree, tvbuff_t *tvb, int offset)
4192 {
4193   last_timestamp = tvb_get_letoh64(tvb, offset);
4194   proto_tree_add_item(tree, hf_ieee80211_ff_timestamp, tvb, offset, 8,
4195                       ENC_LITTLE_ENDIAN);
4196   return 8;
4197 }
4198
4199 static guint
4200 add_ff_beacon_interval(proto_tree *tree, tvbuff_t *tvb, int offset)
4201 {
4202   proto_tree_add_item(tree, hf_ieee80211_ff_beacon_interval, tvb, offset, 2,
4203                       ENC_LITTLE_ENDIAN);
4204   col_append_fstr(g_pinfo->cinfo, COL_INFO, ", BI=%d",
4205                   tvb_get_letohs(tvb, offset));
4206   return 2;
4207 }
4208
4209 static guint
4210 add_ff_cap_info(proto_tree *tree, tvbuff_t *tvb, int offset)
4211 {
4212   proto_item *cap_item;
4213   proto_tree *cap_tree;
4214
4215   cap_item = proto_tree_add_item(tree, hf_ieee80211_ff_capture, tvb, offset, 2,
4216                                  ENC_LITTLE_ENDIAN);
4217   cap_tree = proto_item_add_subtree(cap_item, ett_cap_tree);
4218
4219   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_ess, tvb, offset, 2,
4220                       ENC_LITTLE_ENDIAN);
4221   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_ibss, tvb, offset, 2,
4222                       ENC_LITTLE_ENDIAN);
4223   if ((tvb_get_letohs(tvb, offset) & 0x0001) != 0) {
4224     /* This is an AP */
4225     proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_ap_poll, tvb, offset, 2,
4226                         ENC_LITTLE_ENDIAN);
4227   } else {
4228     /* This is a STA */
4229     proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_sta_poll, tvb, offset, 2,
4230                         ENC_LITTLE_ENDIAN);
4231   }
4232
4233   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_privacy, tvb, offset, 2,
4234                       ENC_LITTLE_ENDIAN);
4235   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_preamble, tvb, offset, 2,
4236                       ENC_LITTLE_ENDIAN);
4237   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_pbcc, tvb, offset, 2,
4238                       ENC_LITTLE_ENDIAN);
4239   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_agility, tvb, offset, 2,
4240                       ENC_LITTLE_ENDIAN);
4241   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_spec_man, tvb, offset, 2,
4242                       ENC_LITTLE_ENDIAN);
4243   proto_tree_add_item(cap_tree, hf_ieee80211_ff_short_slot_time, tvb, offset,
4244                       2, ENC_LITTLE_ENDIAN);
4245   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_apsd, tvb, offset, 2,
4246                       ENC_LITTLE_ENDIAN);
4247   proto_tree_add_item(cap_tree, hf_ieee80211_ff_dsss_ofdm, tvb, offset, 2,
4248                       ENC_LITTLE_ENDIAN);
4249   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_del_blk_ack, tvb, offset, 2,
4250                       ENC_LITTLE_ENDIAN);
4251   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_imm_blk_ack, tvb, offset, 2,
4252                       ENC_LITTLE_ENDIAN);
4253   return 2;
4254 }
4255
4256 static guint
4257 add_ff_auth_alg(proto_tree *tree, tvbuff_t *tvb, int offset)
4258 {
4259   proto_tree_add_item(tree, hf_ieee80211_ff_auth_alg, tvb, offset, 2,
4260                       ENC_LITTLE_ENDIAN);
4261   return 2;
4262 }
4263
4264 static guint
4265 add_ff_auth_trans_seq(proto_tree *tree, tvbuff_t *tvb, int offset)
4266 {
4267   proto_tree_add_item(tree, hf_ieee80211_ff_auth_seq, tvb, offset, 2,
4268                       ENC_LITTLE_ENDIAN);
4269   return 2;
4270 }
4271
4272 static guint
4273 add_ff_current_ap_addr(proto_tree *tree, tvbuff_t *tvb, int offset)
4274 {
4275   proto_tree_add_item(tree, hf_ieee80211_ff_current_ap, tvb, offset, 6,
4276                       ENC_NA);
4277   return 6;
4278 }
4279
4280 static guint
4281 add_ff_listen_ival(proto_tree *tree, tvbuff_t *tvb, int offset)
4282 {
4283   proto_tree_add_item(tree, hf_ieee80211_ff_listen_ival, tvb, offset, 2,
4284                       ENC_LITTLE_ENDIAN);
4285   return 2;
4286 }
4287
4288 static guint
4289 add_ff_reason_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4290 {
4291   proto_tree_add_item(tree, hf_ieee80211_ff_reason, tvb, offset, 2,
4292                       ENC_LITTLE_ENDIAN);
4293   return 2;
4294 }
4295
4296 static guint
4297 add_ff_assoc_id(proto_tree *tree, tvbuff_t *tvb, int offset)
4298 {
4299   proto_tree_add_item(tree, hf_ieee80211_ff_assoc_id, tvb, offset, 2,
4300                       ENC_LITTLE_ENDIAN);
4301   return 2;
4302 }
4303
4304 static guint
4305 add_ff_status_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4306 {
4307   proto_tree_add_item(tree, hf_ieee80211_ff_status_code, tvb, offset, 2,
4308                       ENC_LITTLE_ENDIAN);
4309   return 2;
4310 }
4311
4312 static guint
4313 add_ff_category_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4314 {
4315   proto_tree_add_item(tree, hf_ieee80211_ff_category_code, tvb, offset, 1,
4316                       ENC_LITTLE_ENDIAN);
4317   return 1;
4318 }
4319
4320 static guint
4321 add_ff_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4322 {
4323   proto_tree_add_item(tree, hf_ieee80211_ff_action_code, tvb, offset, 1,
4324                       ENC_LITTLE_ENDIAN);
4325   return 1;
4326 }
4327
4328 static guint
4329 add_ff_dialog_token(proto_tree *tree, tvbuff_t *tvb, int offset)
4330 {
4331   proto_tree_add_item(tree, hf_ieee80211_ff_dialog_token, tvb, offset, 1,
4332                       ENC_LITTLE_ENDIAN);
4333   return 1;
4334 }
4335
4336 static guint
4337 add_ff_wme_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4338 {
4339   proto_tree_add_item(tree, hf_ieee80211_ff_wme_action_code, tvb, offset, 1,
4340                       ENC_LITTLE_ENDIAN);
4341   return 1;
4342 }
4343
4344 static guint
4345 add_ff_wme_status_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4346 {
4347   proto_tree_add_item(tree, hf_ieee80211_ff_wme_status_code, tvb, offset, 1,
4348                       ENC_LITTLE_ENDIAN);
4349   return 1;
4350 }
4351
4352 static guint
4353 add_ff_qos_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4354 {
4355   proto_tree_add_item(tree, hf_ieee80211_ff_qos_action_code, tvb, offset, 1,
4356                       ENC_LITTLE_ENDIAN);
4357   return 1;
4358 }
4359
4360 static guint
4361 add_ff_block_ack_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4362 {
4363   proto_tree_add_item(tree, hf_ieee80211_ff_ba_action, tvb, offset, 1,
4364                       ENC_LITTLE_ENDIAN);
4365   return 1;
4366 }
4367
4368 static guint
4369 add_ff_block_ack_param(proto_tree *tree, tvbuff_t *tvb, int offset)
4370 {
4371   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_block_ack_params,
4372                          ett_ff_ba_param_tree,
4373                          ieee80211_ff_block_ack_params_fields,
4374                          ENC_LITTLE_ENDIAN);
4375   return 2;
4376 }
4377
4378 static guint
4379 add_ff_block_ack_timeout(proto_tree *tree, tvbuff_t *tvb, int offset)
4380 {
4381   proto_tree_add_item(tree, hf_ieee80211_ff_block_ack_timeout, tvb, offset, 2,
4382                       ENC_LITTLE_ENDIAN);
4383   return 2;
4384 }
4385
4386 static guint
4387 add_ff_block_ack_ssc(proto_tree *tree, tvbuff_t *tvb, int offset)
4388 {
4389   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_block_ack_ssc,
4390                          ett_ff_ba_ssc_tree, ieee80211_ff_block_ack_ssc_fields,
4391                          ENC_LITTLE_ENDIAN);
4392   return 2;
4393 }
4394
4395 static guint
4396 add_ff_qos_ts_info(proto_tree *tree, tvbuff_t *tvb, int offset)
4397 {
4398   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_tsinfo,
4399                          ett_tsinfo_tree, ieee80211_tsinfo_fields,
4400                          ENC_LITTLE_ENDIAN);
4401   return 3;
4402 }
4403
4404 static guint
4405 add_ff_mesh_action(proto_tree *tree, tvbuff_t *tvb, int offset)
4406 {
4407   proto_tree_add_item(tree, hf_ieee80211_ff_mesh_action, tvb, offset, 1,
4408                       ENC_LITTLE_ENDIAN);
4409   return 1;
4410 }
4411
4412 static guint
4413 add_ff_multihop_action(proto_tree *tree, tvbuff_t *tvb, int offset)
4414 {
4415   proto_tree_add_item(tree, hf_ieee80211_ff_multihop_action, tvb, offset, 1,
4416                       ENC_LITTLE_ENDIAN);
4417   return 1;
4418 }
4419
4420 static guint
4421 add_ff_mesh_control(proto_tree *tree, tvbuff_t *tvb, int offset)
4422 {
4423   int start = offset;
4424
4425   proto_tree_add_item(tree, hf_ieee80211_ff_mesh_flags, tvb, offset, 1,
4426                       ENC_LITTLE_ENDIAN);
4427   offset++;
4428   proto_tree_add_item(tree, hf_ieee80211_ff_mesh_ttl, tvb, offset, 1,
4429                       ENC_LITTLE_ENDIAN);
4430   offset++;
4431   proto_tree_add_item(tree, hf_ieee80211_ff_mesh_sequence, tvb, offset, 4,
4432                       ENC_LITTLE_ENDIAN);
4433   offset += 4;
4434
4435   switch (tvb_get_guint8(tvb, offset) & 0x03) {
4436   case 1:
4437     proto_tree_add_item(tree, hf_ieee80211_ff_mesh_addr4, tvb, offset, 6,
4438                         ENC_NA);
4439     offset += 6;
4440     break;
4441   case 2:
4442     proto_tree_add_item(tree, hf_ieee80211_ff_mesh_addr5, tvb, offset, 6,
4443                         ENC_NA);
4444     offset += 6;
4445     proto_tree_add_item(tree, hf_ieee80211_ff_mesh_addr6, tvb, offset, 6,
4446                         ENC_NA);
4447     offset += 6;
4448     break;
4449   case 3:
4450     proto_item_append_text(tree, "Unknown Address Extension Mode");
4451     break;
4452   default:
4453     /* no default action */
4454     break;
4455   }
4456
4457   return offset - start;
4458 }
4459
4460 static guint
4461 add_ff_selfprot_action(proto_tree *tree, tvbuff_t *tvb, int offset)
4462 {
4463   proto_tree_add_item(tree, hf_ieee80211_ff_selfprot_action, tvb, offset, 1,
4464                       ENC_LITTLE_ENDIAN);
4465   return 1;
4466 }
4467
4468 static guint
4469 add_ff_dls_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4470 {
4471   proto_tree_add_item(tree, hf_ieee80211_ff_dls_action_code, tvb, offset, 1,
4472                       ENC_LITTLE_ENDIAN);
4473   return 1;
4474 }
4475
4476 static guint
4477 add_ff_dst_mac_addr(proto_tree *tree, tvbuff_t *tvb, int offset)
4478 {
4479   proto_tree_add_item(tree, hf_ieee80211_ff_dst_mac_addr, tvb, offset, 6,
4480                       ENC_NA);
4481   return 6;
4482 }
4483
4484 static guint
4485 add_ff_src_mac_addr(proto_tree *tree, tvbuff_t *tvb, int offset)
4486 {
4487   proto_tree_add_item(tree, hf_ieee80211_ff_src_mac_addr, tvb, offset, 6,
4488                       ENC_NA);
4489   return 6;
4490 }
4491
4492 static guint
4493 add_ff_dls_timeout(proto_tree *tree, tvbuff_t *tvb, int offset)
4494 {
4495   proto_tree_add_item(tree, hf_ieee80211_ff_dls_timeout, tvb, offset, 2,
4496                       ENC_LITTLE_ENDIAN);
4497   return 2;
4498 }
4499
4500 static guint
4501 add_ff_delba_param_set(proto_tree *tree, tvbuff_t *tvb, int offset)
4502 {
4503   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_delba_param,
4504                          ett_ff_ba_param_tree, ieee80211_ff_delba_param_fields,
4505                          ENC_LITTLE_ENDIAN);
4506   return 2;
4507 }
4508
4509 static guint
4510 add_ff_max_reg_pwr(proto_tree *tree, tvbuff_t *tvb, int offset)
4511 {
4512   proto_tree_add_item(tree, hf_ieee80211_ff_max_reg_pwr, tvb, offset, 2,
4513                       ENC_LITTLE_ENDIAN);
4514   return 2;
4515 }
4516
4517 static guint
4518 add_ff_measurement_pilot_int(proto_tree *tree, tvbuff_t *tvb, int offset)
4519 {
4520   proto_tree_add_item(tree, hf_ieee80211_ff_measurement_pilot_int, tvb, offset,
4521                       2, ENC_LITTLE_ENDIAN);
4522   return 2;
4523 }
4524
4525 static guint
4526 add_ff_country_str(proto_tree *tree, tvbuff_t *tvb, int offset)
4527 {
4528   proto_tree_add_string(tree, hf_ieee80211_ff_country_str, tvb, offset, 3,
4529                         ENC_BIG_ENDIAN);
4530   return 3;
4531 }
4532
4533 static guint
4534 add_ff_max_tx_pwr(proto_tree *tree, tvbuff_t *tvb, int offset)
4535 {
4536   proto_tree_add_item(tree, hf_ieee80211_ff_max_tx_pwr, tvb, offset, 1,
4537                       ENC_LITTLE_ENDIAN);
4538   return 1;
4539 }
4540
4541 static guint
4542 add_ff_tx_pwr_used(proto_tree *tree, tvbuff_t *tvb, int offset)
4543 {
4544   proto_tree_add_item(tree, hf_ieee80211_ff_tx_pwr_used, tvb, offset, 1,
4545                       ENC_LITTLE_ENDIAN);
4546   return 1;
4547 }
4548
4549 static guint
4550 add_ff_transceiver_noise_floor(proto_tree *tree, tvbuff_t *tvb, int offset)
4551 {
4552   proto_tree_add_item(tree, hf_ieee80211_ff_transceiver_noise_floor, tvb,
4553                       offset, 1, ENC_LITTLE_ENDIAN);
4554   return 1;
4555 }
4556
4557 static guint
4558 add_ff_channel_width(proto_tree *tree, tvbuff_t *tvb, int offset)
4559 {
4560   proto_tree_add_item(tree, hf_ieee80211_ff_channel_width, tvb, offset, 1,
4561                       ENC_LITTLE_ENDIAN);
4562   return 1;
4563 }
4564
4565 static guint
4566 add_ff_qos_info_ap(proto_tree *tree, tvbuff_t *tvb, int offset)
4567 {
4568   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_qos_info_ap,
4569                          ett_ff_qos_info, ieee80211_ff_qos_info_ap_fields,
4570                          ENC_LITTLE_ENDIAN);
4571   return 1;
4572 }
4573
4574 static guint
4575 add_ff_qos_info_sta(proto_tree *tree, tvbuff_t *tvb, int offset)
4576 {
4577   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_qos_info_sta,
4578                          ett_ff_qos_info, ieee80211_ff_qos_info_sta_fields,
4579                          ENC_LITTLE_ENDIAN);
4580   return 1;
4581 }
4582
4583 static guint
4584 add_ff_sm_pwr_cntrl(proto_tree *tree, tvbuff_t *tvb, int offset)
4585 {
4586   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_sm_pwr_save,
4587                          ett_ff_sm_pwr_save, ieee80211_ff_sw_pwr_save_fields,
4588                          ENC_LITTLE_ENDIAN);
4589   return 1;
4590 }
4591
4592 static guint
4593 add_ff_pco_phase_cntrl(proto_tree *tree, tvbuff_t *tvb, int offset)
4594 {
4595   proto_tree_add_item(tree, hf_ieee80211_ff_pco_phase_cntrl, tvb, offset, 1,
4596                       ENC_LITTLE_ENDIAN);
4597   return 1;
4598 }
4599
4600 static guint
4601 add_ff_psmp_param_set(proto_tree *tree, tvbuff_t *tvb, int offset)
4602 {
4603   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_psmp_param_set,
4604                          ett_ff_psmp_param_set,
4605                          ieee80211_ff_psmp_param_set_fields,
4606                          ENC_LITTLE_ENDIAN);
4607   return 2;
4608 }
4609
4610 static guint
4611 add_ff_mimo_cntrl(proto_tree *tree, tvbuff_t *tvb, int offset)
4612 {
4613   proto_item *mimo_item;
4614   proto_tree *mimo_tree;
4615
4616   mimo_item = proto_tree_add_item(tree, hf_ieee80211_ff_mimo_cntrl, tvb,
4617                                   offset, 6, ENC_NA);
4618   mimo_tree = proto_item_add_subtree(mimo_item, ett_ff_mimo_cntrl);
4619
4620   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_nc_index, tvb,
4621                       offset, 1, ENC_LITTLE_ENDIAN);
4622   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_nr_index, tvb,
4623                       offset, 1, ENC_LITTLE_ENDIAN);
4624   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_channel_width, tvb,
4625                       offset, 1, ENC_LITTLE_ENDIAN);
4626   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_grouping, tvb,
4627                       offset, 1, ENC_LITTLE_ENDIAN);
4628   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_coefficient_size,
4629                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
4630   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_codebook_info, tvb,
4631                       offset, 1, ENC_LITTLE_ENDIAN);
4632   proto_tree_add_item(mimo_tree,
4633                       hf_ieee80211_ff_mimo_cntrl_remaining_matrix_segment, tvb,
4634                       offset, 1, ENC_LITTLE_ENDIAN);
4635   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_reserved, tvb,
4636                       offset, 1, ENC_LITTLE_ENDIAN);
4637
4638   offset += 2;
4639   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_sounding_timestamp,
4640                       tvb, offset, 4, ENC_LITTLE_ENDIAN);
4641
4642   return 6;
4643 }
4644
4645 static guint
4646 add_ff_ant_selection(proto_tree *tree, tvbuff_t *tvb, int offset)
4647 {
4648   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_ant_selection,
4649                          ett_ff_ant_sel, ieee80211_ff_ant_selection_fields,
4650                          ENC_LITTLE_ENDIAN);
4651   return 1;
4652 }
4653
4654 static guint
4655 add_ff_extended_channel_switch_announcement(proto_tree *tree, tvbuff_t *tvb,
4656                                             int offset)
4657 {
4658   proto_tree_add_bitmask(tree, tvb, offset,
4659                          hf_ieee80211_ff_ext_channel_switch_announcement,
4660                          ett_ff_chan_switch_announce,
4661                          ieee80211_ff_ext_channel_switch_announcement_fields,
4662                          ENC_LITTLE_ENDIAN);
4663   return 4;
4664 }
4665
4666 static guint
4667 add_ff_ht_information(proto_tree *tree, tvbuff_t *tvb, int offset)
4668 {
4669   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_ht_info,
4670                          ett_ff_ht_info, ieee80211_ff_ht_info_fields,
4671                          ENC_LITTLE_ENDIAN);
4672   return 1;
4673 }
4674
4675 static guint
4676 add_ff_ht_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4677 {
4678   proto_tree_add_item(tree, hf_ieee80211_ff_ht_action, tvb, offset, 1,
4679                       ENC_LITTLE_ENDIAN);
4680   return 1;
4681 }
4682
4683 static guint
4684 add_ff_psmp_sta_info(proto_tree *tree, tvbuff_t *tvb, int offset)
4685 {
4686   proto_item *psmp_item;
4687   proto_tree *psmp_tree;
4688
4689   psmp_item = proto_tree_add_item(tree, hf_ieee80211_ff_psmp_sta_info, tvb,
4690                                   offset, 8, ENC_LITTLE_ENDIAN);
4691   psmp_tree = proto_item_add_subtree(psmp_item, ett_ff_psmp_sta_info);
4692
4693   proto_tree_add_item(psmp_item, hf_ieee80211_ff_psmp_sta_info_type, tvb,
4694                       offset, 4, ENC_LITTLE_ENDIAN);
4695
4696   switch (tvb_get_letohl(tvb, offset) & PSMP_STA_INFO_FLAG_TYPE) {
4697   case PSMP_STA_INFO_BROADCAST:
4698     proto_tree_add_item(psmp_tree,
4699                         hf_ieee80211_ff_psmp_sta_info_dtt_start_offset, tvb,
4700                         offset, 4, ENC_LITTLE_ENDIAN);
4701     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_duration,
4702                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4703     /* Missing 64 bit bitmask... */
4704     proto_tree_add_uint64(psmp_tree,
4705                           hf_ieee80211_ff_psmp_sta_info_reserved_large,
4706                           tvb, offset, 8,
4707                           (tvb_get_letoh64(tvb, offset) &
4708                            G_GINT64_CONSTANT(0xFFFFFFFFFFE00000)) >> 21);
4709     break;
4710   case PSMP_STA_INFO_MULTICAST:
4711     proto_tree_add_item(psmp_tree,
4712                         hf_ieee80211_ff_psmp_sta_info_dtt_start_offset, tvb,
4713                         offset, 4, ENC_LITTLE_ENDIAN);
4714     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_duration,
4715                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4716     /* Missing 64 bit bitmask... */
4717     proto_tree_add_uint64(psmp_tree,
4718                           hf_ieee80211_ff_psmp_sta_info_psmp_multicast_id,
4719                           tvb, offset, 6,
4720                           (tvb_get_letoh64(tvb, offset) &
4721                            G_GINT64_CONSTANT(0xFFFFFFFFFFE00000)) >> 21);
4722     break;
4723   case PSMP_STA_INFO_INDIVIDUALLY_ADDRESSED:
4724     proto_tree_add_item(psmp_tree,
4725                         hf_ieee80211_ff_psmp_sta_info_dtt_start_offset, tvb,
4726                         offset, 4, ENC_LITTLE_ENDIAN);
4727     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_duration,
4728                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4729     offset += 2;
4730     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_sta_id, tvb,
4731                         offset, 4, ENC_LITTLE_ENDIAN);
4732     offset += 2;
4733
4734     proto_tree_add_item(psmp_tree,
4735                         hf_ieee80211_ff_psmp_sta_info_utt_start_offset,
4736                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4737     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_utt_duration,
4738                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4739     proto_tree_add_item(psmp_tree,
4740                         hf_ieee80211_ff_psmp_sta_info_reserved_small, tvb,
4741                         offset, 4, ENC_LITTLE_ENDIAN);
4742     break;
4743   }
4744
4745   return 8;
4746 }
4747
4748 static guint
4749 add_ff_schedule_info(proto_tree *tree, tvbuff_t *tvb, int offset)
4750 {
4751   proto_item *sched_item;
4752   proto_tree *sched_tree;
4753
4754   sched_item = proto_tree_add_item(tree, hf_ieee80211_sched_info, tvb, offset,
4755                                    2, ENC_LITTLE_ENDIAN);
4756   sched_tree = proto_item_add_subtree(sched_item, ett_sched_tree);
4757
4758   proto_tree_add_item(sched_tree, hf_ieee80211_sched_info_agg, tvb, offset, 2,
4759                       ENC_LITTLE_ENDIAN);
4760   if (tvb_get_letohs(tvb, offset) & 0x0001) {
4761     proto_tree_add_item(sched_tree, hf_ieee80211_sched_info_tsid, tvb, offset,
4762                         2, ENC_LITTLE_ENDIAN);
4763     proto_tree_add_item(sched_tree, hf_ieee80211_sched_info_dir, tvb, offset,
4764                         2, ENC_LITTLE_ENDIAN);
4765   }
4766
4767   return 2;
4768 }
4769
4770 static guint
4771 add_ff_pa_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4772 {
4773   proto_tree_add_item(tree, hf_ieee80211_ff_public_action, tvb, offset, 1,
4774                       ENC_BIG_ENDIAN);
4775   return 1;
4776 }
4777
4778 static guint
4779 add_ff_action_spectrum_mgmt(proto_tree *tree, tvbuff_t *tvb, int offset)
4780 {
4781     switch (tvb_get_guint8(tvb, offset + 1)) {
4782     case SM_ACTION_MEASUREMENT_REQUEST:
4783     case SM_ACTION_MEASUREMENT_REPORT:
4784     case SM_ACTION_TPC_REQUEST:
4785     case SM_ACTION_TPC_REPORT:
4786       add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4787       add_fixed_field(tree, tvb, offset + 1, FIELD_ACTION_CODE);
4788       add_fixed_field(tree, tvb, offset + 2, FIELD_DIALOG_TOKEN);
4789       return 3;
4790     case SM_ACTION_CHAN_SWITCH_ANNC:
4791     case SM_ACTION_EXT_CHAN_SWITCH_ANNC:
4792       add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4793       add_fixed_field(tree, tvb, offset + 1, FIELD_ACTION_CODE);
4794       return 2;
4795     default:
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     }
4800 }
4801
4802 static guint
4803 add_ff_action_qos(proto_tree *tree, tvbuff_t *tvb, int offset)
4804 {
4805   switch (tvb_get_guint8(tvb, offset + 1)) {
4806   case SM_ACTION_ADDTS_REQUEST:
4807     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4808     add_fixed_field(tree, tvb, offset + 1, FIELD_QOS_ACTION_CODE);
4809     add_fixed_field(tree, tvb, offset + 2, FIELD_DIALOG_TOKEN);
4810     return 3;
4811   case SM_ACTION_ADDTS_RESPONSE:
4812     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4813     add_fixed_field(tree, tvb, offset + 1, FIELD_QOS_ACTION_CODE);
4814     add_fixed_field(tree, tvb, offset + 2, FIELD_DIALOG_TOKEN);
4815     add_fixed_field(tree, tvb, offset + 3, FIELD_STATUS_CODE);
4816     return 5;
4817   case SM_ACTION_DELTS:
4818     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4819     add_fixed_field(tree, tvb, offset + 1, FIELD_QOS_ACTION_CODE);
4820     add_fixed_field(tree, tvb, offset + 2, FIELD_QOS_TS_INFO);
4821     add_fixed_field(tree, tvb, offset + 5, FIELD_REASON_CODE);
4822     return 7;
4823   case SM_ACTION_QOS_SCHEDULE:
4824     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4825     add_fixed_field(tree, tvb, offset + 1, FIELD_QOS_ACTION_CODE);
4826     return 2;
4827   default:
4828     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4829     return 2;
4830   }
4831 }
4832
4833 static guint
4834 add_ff_action_dls(proto_tree *tree, tvbuff_t *tvb, int offset)
4835 {
4836   switch (tvb_get_guint8(tvb, offset + 1)) {
4837   case SM_ACTION_DLS_REQUEST:
4838     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4839     add_fixed_field(tree, tvb, offset + 1, FIELD_DLS_ACTION_CODE);
4840     add_fixed_field(tree, tvb, offset + 2, FIELD_DST_MAC_ADDR);
4841     add_fixed_field(tree, tvb, offset + 8, FIELD_SRC_MAC_ADDR);
4842     add_fixed_field(tree, tvb, offset + 14, FIELD_CAP_INFO);
4843     add_fixed_field(tree, tvb, offset + 16, FIELD_DLS_TIMEOUT);
4844     return 18;
4845   case SM_ACTION_DLS_RESPONSE:
4846     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4847     add_fixed_field(tree, tvb, offset + 1, FIELD_DLS_ACTION_CODE);
4848     add_fixed_field(tree, tvb, offset + 2, FIELD_STATUS_CODE);
4849     add_fixed_field(tree, tvb, offset + 4, FIELD_DST_MAC_ADDR);
4850     add_fixed_field(tree, tvb, offset + 10, FIELD_SRC_MAC_ADDR);
4851     if (!hf_ieee80211_ff_status_code) {
4852       add_fixed_field(tree, tvb, offset + 16, FIELD_CAP_INFO);
4853     }
4854     return 16;
4855   case SM_ACTION_DLS_TEARDOWN:
4856     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4857     add_fixed_field(tree, tvb, offset + 1, FIELD_DLS_ACTION_CODE);
4858     add_fixed_field(tree, tvb, offset + 2, FIELD_DST_MAC_ADDR);
4859     add_fixed_field(tree, tvb, offset + 8, FIELD_SRC_MAC_ADDR);
4860     add_fixed_field(tree, tvb, offset + 14, FIELD_REASON_CODE);
4861     return 16;
4862   default:
4863     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4864     return 2;
4865   }
4866 }
4867
4868 static guint
4869 add_ff_action_block_ack(proto_tree *tree, tvbuff_t *tvb, int offset)
4870 {
4871   guint start = offset;
4872
4873   switch (tvb_get_guint8(tvb, offset + 1)) {
4874   case BA_ADD_BLOCK_ACK_REQUEST:
4875     offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4876     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_ACTION_CODE);
4877     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4878     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_PARAM);
4879     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_TIMEOUT);
4880     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
4881     break;
4882   case BA_ADD_BLOCK_ACK_RESPONSE:
4883     offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4884     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_ACTION_CODE);
4885     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4886     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
4887     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_PARAM);
4888     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_TIMEOUT);
4889     break;
4890   case BA_DELETE_BLOCK_ACK:
4891     offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4892     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_ACTION_CODE);
4893     offset += add_fixed_field(tree, tvb, offset, FIELD_DELBA_PARAM_SET);
4894     offset += add_fixed_field(tree, tvb, offset, FIELD_REASON_CODE);
4895     break;
4896   }
4897
4898   return offset - start;  /* Size of fixed fields */
4899 }
4900
4901 static guint
4902 add_ff_action_public(proto_tree *tree, tvbuff_t *tvb, int offset)
4903 {
4904   guint start = offset;
4905   guint32 oui;
4906   guint8 code;
4907   guint8 subtype;
4908   gboolean anqp;
4909   guint8 dialog_token;
4910   guint8 frag;
4911   gboolean more;
4912
4913   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4914   code = tvb_get_guint8(tvb, offset);
4915   offset += add_fixed_field(tree, tvb, offset, FIELD_PA_ACTION_CODE);
4916
4917   switch (code) {
4918   case PA_VENDOR_SPECIFIC:
4919     oui = tvb_get_ntoh24(tvb, offset);
4920     proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
4921     offset += 3;
4922     switch (oui) {
4923     case OUI_WFA:
4924       subtype = tvb_get_guint8(tvb, offset);
4925       proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u", subtype);
4926       offset++;
4927       if (subtype == WFA_SUBTYPE_P2P) {
4928         offset = dissect_wifi_p2p_public_action(g_pinfo, tree, tvb, offset);
4929       }
4930       break;
4931     default:
4932       /* Don't know how to handle this vendor */
4933       break;
4934     }
4935     break;
4936   case PA_GAS_INITIAL_REQUEST:
4937     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4938     offset += dissect_advertisement_protocol(g_pinfo, tree, tvb, offset,
4939                                              &anqp);
4940     offset += dissect_gas_initial_request(tree, tvb, offset, anqp);
4941     break;
4942   case PA_GAS_INITIAL_RESPONSE:
4943     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4944     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
4945     offset += add_fixed_field(tree, tvb, offset, FIELD_GAS_COMEBACK_DELAY);
4946     offset += dissect_advertisement_protocol(g_pinfo, tree, tvb, offset,
4947                                              &anqp);
4948     offset += dissect_gas_initial_response(tree, tvb, offset, anqp);
4949     break;
4950   case PA_GAS_COMEBACK_REQUEST:
4951     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4952     break;
4953   case PA_GAS_COMEBACK_RESPONSE:
4954     dialog_token = tvb_get_guint8(tvb, offset);
4955     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4956     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
4957     frag = tvb_get_guint8(tvb, offset) & 0x7f;
4958     more = (tvb_get_guint8(tvb, offset) & 0x80) != 0;
4959     offset += add_fixed_field(tree, tvb, offset, FIELD_GAS_FRAGMENT_ID);
4960     offset += add_fixed_field(tree, tvb, offset, FIELD_GAS_COMEBACK_DELAY);
4961     offset += dissect_advertisement_protocol(g_pinfo, tree, tvb, offset,
4962                                              &anqp);
4963     offset += dissect_gas_comeback_response(tree, tvb, offset, anqp, frag,
4964                                             more, dialog_token);
4965     break;
4966   case PA_TDLS_DISCOVERY_RESPONSE:
4967     col_set_str(g_pinfo->cinfo, COL_PROTOCOL, "TDLS");
4968     col_set_str(g_pinfo->cinfo, COL_INFO, "TDLS Discovery Response");
4969     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4970     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
4971     break;
4972   }
4973
4974   return offset - start;  /* Size of fixed fields */
4975 }
4976
4977 static guint
4978 add_ff_action_fast_bss_transition(proto_tree *tree, tvbuff_t *tvb, int offset)
4979 {
4980   guint start = offset;
4981   guint8 code;
4982
4983   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4984   code = tvb_get_guint8(tvb, offset);
4985   offset += add_fixed_field(tree, tvb, offset, FIELD_FT_ACTION_CODE);
4986
4987   switch (code) {
4988   case FT_ACTION_REQUEST:
4989     offset += add_fixed_field(tree, tvb, offset, FIELD_STA_ADDRESS);
4990     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
4991     /* Followed by FT Request frame body (IEs) */
4992     break;
4993   case FT_ACTION_RESPONSE:
4994     offset += add_fixed_field(tree, tvb, offset, FIELD_STA_ADDRESS);
4995     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
4996     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
4997     /* Followed by FT Response frame body (IEs) */
4998     break;
4999   case FT_ACTION_CONFIRM:
5000     offset += add_fixed_field(tree, tvb, offset, FIELD_STA_ADDRESS);
5001     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
5002     /* Followed by FT Confirm frame body (IEs) */
5003     break;
5004   case FT_ACTION_ACK:
5005     offset += add_fixed_field(tree, tvb, offset, FIELD_STA_ADDRESS);
5006     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
5007     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5008     /* Followed by FT Ack frame body (IEs) */
5009     break;
5010   }
5011
5012   return offset - start;  /* Size of fixed fields */
5013 }
5014
5015 static guint
5016 add_ff_action_sa_query(proto_tree *tree, tvbuff_t *tvb, int offset)
5017 {
5018   guint start = offset;
5019   guint8 code;
5020
5021   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5022   code = tvb_get_guint8(tvb, offset);
5023   offset += add_fixed_field(tree, tvb, offset, FIELD_SA_QUERY_ACTION_CODE);
5024
5025   switch (code) {
5026   case SA_QUERY_REQUEST:
5027     offset += add_fixed_field(tree, tvb, offset, FIELD_TRANSACTION_ID);
5028     break;
5029   case SA_QUERY_RESPONSE:
5030     offset += add_fixed_field(tree, tvb, offset, FIELD_TRANSACTION_ID);
5031     break;
5032   }
5033
5034   return offset - start;  /* Size of fixed fields */
5035 }
5036
5037 static guint
5038 add_ff_action_mesh(proto_tree *tree, tvbuff_t *tvb, int offset)
5039 {
5040   guint length;
5041   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5042   offset += add_fixed_field(tree, tvb, offset, FIELD_MESH_ACTION);
5043   /* The only fixed fields are the category and mesh action.  The rest are IEs.
5044    */
5045   length = 2;
5046   if (tvb_get_guint8(tvb, 1) == MESH_ACTION_TBTT_ADJ_RESPONSE) {
5047     /* ..except for the TBTT Adjustment Response, which has a status code field
5048      */
5049     length += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5050   }
5051   return length;
5052 }
5053
5054 static guint
5055 add_ff_action_multihop(proto_tree *tree, tvbuff_t *tvb, int offset)
5056 {
5057   guint start = offset;
5058   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5059   offset += add_fixed_field(tree, tvb, offset, FIELD_MULTIHOP_ACTION);
5060   offset += add_fixed_field(tree, tvb, offset, FIELD_MESH_CONTROL);
5061   return offset - start;
5062 }
5063
5064 static guint
5065 add_ff_action_self_protected(proto_tree *tree, tvbuff_t *tvb, int offset)
5066 {
5067   guint start = offset;
5068
5069   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5070   offset += add_fixed_field(tree, tvb, offset, FIELD_SELFPROT_ACTION);
5071
5072   switch (tvb_get_guint8(tvb, start + 1)) {
5073   case SELFPROT_ACTION_MESH_PEERING_OPEN:
5074     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
5075     break;
5076   case SELFPROT_ACTION_MESH_PEERING_CONFIRM:
5077     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
5078     offset += add_fixed_field(tree, tvb, offset, FIELD_ASSOC_ID);
5079     break;
5080   }
5081
5082   return offset - start;
5083 }
5084
5085 static guint
5086 wnm_bss_trans_mgmt_req(proto_tree *tree, tvbuff_t *tvb, int offset)
5087 {
5088   int start = offset;
5089   guint8 mode;
5090   gint left;
5091
5092   offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5093
5094   mode = tvb_get_guint8(tvb, offset);
5095   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_pref_cand,
5096                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5097   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_abridged,
5098                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5099   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_disassoc_imminent,
5100                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5101   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_bss_term_included,
5102                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5103   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_ess_disassoc_imminent,
5104                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5105   offset++;
5106
5107   proto_tree_add_item(tree, hf_ieee80211_ff_disassoc_timer, tvb, offset, 2,
5108                       ENC_LITTLE_ENDIAN);
5109   offset += 2;
5110
5111   proto_tree_add_item(tree, hf_ieee80211_ff_validity_interval, tvb, offset, 1,
5112                       ENC_LITTLE_ENDIAN);
5113   offset++;
5114
5115   if (mode & 0x08) {
5116     proto_tree_add_text(tree, tvb, offset, 8, "BSS Termination Duration");
5117     offset += 8;
5118   }
5119
5120   if (mode & 0x10) {
5121     guint8 url_len;
5122     url_len = tvb_get_guint8(tvb, offset);
5123     proto_tree_add_item(tree, hf_ieee80211_ff_url_len, tvb, offset, 1,
5124                         ENC_LITTLE_ENDIAN);
5125     offset++;
5126     proto_tree_add_item(tree, hf_ieee80211_ff_url, tvb, offset, url_len,
5127                         ENC_ASCII|ENC_NA);
5128     offset += url_len;
5129   }
5130
5131   left = tvb_reported_length_remaining(tvb, offset);
5132   if (left > 0) {
5133     proto_tree_add_text(tree, tvb, offset, left,
5134                         "BSS Transition Candidate List Entries");
5135     offset += left;
5136   }
5137
5138   return offset - start;
5139 }
5140
5141 static guint
5142 add_ff_action_wnm(proto_tree *tree, tvbuff_t *tvb, int offset)
5143 {
5144   guint8 code;
5145   guint start = offset;
5146
5147   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5148   code = tvb_get_guint8(tvb, offset);
5149   offset += add_fixed_field(tree, tvb, offset, FIELD_WNM_ACTION_CODE);
5150   switch (code) {
5151   case WNM_BSS_TRANS_MGMT_REQ:
5152     offset += wnm_bss_trans_mgmt_req(tree, tvb, offset);
5153     break;
5154   }
5155
5156   return offset - start;  /* Size of fixed fields */
5157 }
5158
5159 static guint
5160 add_ff_action_tdls(proto_tree *tree, tvbuff_t *tvb, int offset)
5161 {
5162   guint8 code;
5163   guint16 status;
5164   guint start = offset;
5165
5166   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5167   code = tvb_get_guint8(tvb, offset);
5168   offset += add_fixed_field(tree, tvb, offset, FIELD_TDLS_ACTION_CODE);
5169   switch (code) {
5170   case TDLS_SETUP_REQUEST:
5171     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5172     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
5173     break;
5174   case TDLS_SETUP_RESPONSE:
5175     status = tvb_get_letohs(tvb, offset);
5176     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5177     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5178     if (tvb_reported_length_remaining(tvb, offset) < 2) {
5179       if (status == 0) {
5180         expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
5181                                "TDLS Setup Response (success) does not "
5182                                "include mandatory fields");
5183       }
5184       break;
5185     }
5186     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
5187     break;
5188   case TDLS_SETUP_CONFIRM:
5189     status = tvb_get_letohs(tvb, offset);
5190     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5191     if (tvb_reported_length_remaining(tvb, offset) < 1) {
5192       if (status == 0) {
5193         expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
5194                                "TDLS Setup Confirm (success) does not include "
5195                                "mandatory fields");
5196       }
5197       break;
5198     }
5199     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5200     break;
5201   case TDLS_TEARDOWN:
5202     offset += add_fixed_field(tree, tvb, offset, FIELD_REASON_CODE);
5203     break;
5204   case TDLS_PEER_TRAFFIC_INDICATION:
5205     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5206     break;
5207   case TDLS_CHANNEL_SWITCH_REQUEST:
5208     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_CHANNEL);
5209     offset += add_fixed_field(tree, tvb, offset, FIELD_REGULATORY_CLASS);
5210     break;
5211   case TDLS_CHANNEL_SWITCH_RESPONSE:
5212     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5213     break;
5214   case TDLS_PEER_PSM_REQUEST:
5215     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5216     break;
5217   case TDLS_PEER_PSM_RESPONSE:
5218     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5219     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5220     break;
5221   case TDLS_PEER_TRAFFIC_RESPONSE:
5222     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5223     break;
5224   case TDLS_DISCOVERY_REQUEST:
5225     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5226     break;
5227   }
5228
5229   return offset - start;  /* Size of fixed fields */
5230 }
5231
5232 static guint
5233 add_ff_action_mgmt_notification(proto_tree *tree, tvbuff_t *tvb, int offset)
5234 {
5235   guint start = offset;
5236
5237   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5238   offset += add_fixed_field(tree, tvb, offset, FIELD_WME_ACTION_CODE);
5239   offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5240   offset += add_fixed_field(tree, tvb, offset, FIELD_WME_STATUS_CODE);
5241
5242   return offset - start;  /* Size of fixed fields */
5243 }
5244
5245 static guint
5246 add_ff_action_vendor_specific(proto_tree *tree, tvbuff_t *tvb, int offset)
5247 {
5248   guint start = offset;
5249   guint32 oui;
5250   guint8 subtype;
5251
5252   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5253   oui = tvb_get_ntoh24(tvb, offset);
5254   proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
5255   offset +=3;
5256   switch (oui) {
5257   case OUI_MARVELL:
5258     offset = dissect_vendor_action_marvell(tree, tvb, offset);
5259     break;
5260   case OUI_WFA:
5261     subtype = tvb_get_guint8(tvb, offset);
5262     proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u", subtype);
5263     offset++;
5264     if (subtype == WFA_SUBTYPE_P2P) {
5265       offset = dissect_wifi_p2p_action(tree, tvb, offset);
5266     }
5267     break;
5268   default:
5269     /* Don't know how to handle this vendor */
5270     break;
5271   }
5272
5273   return offset - start;  /* Size of fixed fields */
5274 }
5275
5276 static guint
5277 add_ff_action_ht(proto_tree *tree, tvbuff_t *tvb, int offset)
5278 {
5279   guint start = offset;
5280   guint8 n_sta, i;
5281   mimo_control_t mimo_cntrl;
5282
5283   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5284   offset += add_fixed_field(tree, tvb, offset, FIELD_HT_ACTION_CODE);
5285
5286   switch (tvb_get_guint8(tvb, offset - 1)) {
5287   case HT_ACTION_NOTIFY_CHAN_WIDTH:
5288     offset += add_fixed_field(tree, tvb, offset, FIELD_CHANNEL_WIDTH);
5289     break;
5290   case HT_ACTION_SM_PWR_SAVE:
5291     offset += add_fixed_field(tree, tvb, offset, FIELD_SM_PWR_CNTRL);
5292     break;
5293   case HT_ACTION_PSMP_ACTION:
5294     n_sta = tvb_get_guint8(tvb, offset);
5295     offset += add_fixed_field(tree, tvb, offset, FIELD_PSMP_PARAM_SET);
5296     for (i = 0; i < (n_sta & 0x0F); i++) {
5297       offset += add_fixed_field(tree, tvb, offset, FIELD_PSMP_STA_INFO);
5298     }
5299     break;
5300   case HT_ACTION_SET_PCO_PHASE:
5301     offset += add_fixed_field(tree, tvb, offset, FIELD_PCO_PHASE_CNTRL);
5302     break;
5303   case HT_ACTION_MIMO_CSI:
5304     mimo_cntrl = get_mimo_control(tvb, offset);
5305     offset += add_fixed_field(tree, tvb, offset, FIELD_MIMO_CNTRL);
5306     offset += add_mimo_csi_matrices_report(tree, tvb, offset, mimo_cntrl);
5307     break;
5308   case HT_ACTION_MIMO_BEAMFORMING:
5309     mimo_cntrl = get_mimo_control(tvb, offset);
5310     offset += add_fixed_field(tree, tvb, offset, FIELD_MIMO_CNTRL);
5311     offset += add_mimo_beamforming_feedback_report(tree, tvb, offset,
5312                                                    mimo_cntrl);
5313     break;
5314   case HT_ACTION_MIMO_COMPRESSED_BEAMFORMING:
5315     mimo_cntrl = get_mimo_control(tvb, offset);
5316     offset += add_fixed_field(tree, tvb, offset, FIELD_MIMO_CNTRL);
5317     offset += add_mimo_compressed_beamforming_feedback_report(tree, tvb,
5318                                                               offset,
5319                                                               mimo_cntrl);
5320     break;
5321   case HT_ACTION_ANT_SEL_FEEDBACK:
5322     offset += add_fixed_field(tree, tvb, offset, FIELD_ANT_SELECTION);
5323     break;
5324   case HT_ACTION_HT_INFO_EXCHANGE:
5325     offset += add_fixed_field(tree, tvb, offset, FIELD_HT_INFORMATION);
5326     break;
5327   }
5328
5329   return offset - start;
5330 }
5331
5332 static guint
5333 add_ff_action(proto_tree *tree, tvbuff_t *tvb, int offset)
5334 {
5335   switch (tvb_get_guint8(tvb, offset) & 0x7f) {
5336   case CAT_SPECTRUM_MGMT:
5337     return add_ff_action_spectrum_mgmt(tree, tvb, offset);
5338   case CAT_QOS:
5339     return add_ff_action_qos(tree, tvb, offset);
5340   case CAT_DLS:
5341     return add_ff_action_dls(tree, tvb, offset);
5342   case CAT_BLOCK_ACK:
5343     return add_ff_action_block_ack(tree, tvb, offset);
5344   case CAT_PUBLIC:
5345     return add_ff_action_public(tree, tvb, offset);
5346   case CAT_FAST_BSS_TRANSITION:
5347     return add_ff_action_fast_bss_transition(tree, tvb, offset);
5348   case CAT_SA_QUERY:
5349     return add_ff_action_sa_query(tree, tvb, offset);
5350   case CAT_MESH:
5351     return add_ff_action_mesh(tree, tvb, offset);
5352   case CAT_MULTIHOP:
5353     return add_ff_action_multihop(tree, tvb, offset);
5354   case CAT_SELF_PROTECTED:
5355     return add_ff_action_self_protected(tree, tvb, offset);
5356   case CAT_WNM:
5357     return add_ff_action_wnm(tree, tvb, offset);
5358   case CAT_TDLS:
5359     return add_ff_action_tdls(tree, tvb, offset);
5360   case CAT_MGMT_NOTIFICATION:  /* Management notification frame */
5361     return add_ff_action_mgmt_notification(tree, tvb, offset);
5362   case CAT_VENDOR_SPECIFIC:  /* Vendor Specific Category */
5363     return add_ff_action_vendor_specific(tree, tvb, offset);
5364   case CAT_HT:
5365     return add_ff_action_ht(tree, tvb, offset);
5366   default:
5367     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5368     return 1;
5369   }
5370 }
5371
5372 static guint
5373 add_ff_ft_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
5374 {
5375   proto_tree_add_item(tree, hf_ieee80211_ff_ft_action_code, tvb, offset, 1,
5376                       ENC_BIG_ENDIAN);
5377   return 1;
5378 }
5379
5380 static guint
5381 add_ff_sta_address(proto_tree *tree, tvbuff_t *tvb, int offset)
5382 {
5383   proto_tree_add_item(tree, hf_ieee80211_ff_sta_address, tvb, offset, 6,
5384                       ENC_NA);
5385   return 6;
5386 }
5387
5388 static guint
5389 add_ff_target_ap_address(proto_tree *tree, tvbuff_t *tvb, int offset)
5390 {
5391   proto_tree_add_item(tree, hf_ieee80211_ff_target_ap_address, tvb, offset, 6,
5392                       ENC_NA);
5393   return 6;
5394 }
5395
5396 static guint
5397 add_ff_gas_comeback_delay(proto_tree *tree, tvbuff_t *tvb, int offset)
5398 {
5399   proto_tree_add_item(tree, hf_ieee80211_ff_gas_comeback_delay, tvb, offset, 2,
5400                       ENC_LITTLE_ENDIAN);
5401   return 2;
5402 }
5403
5404 static guint
5405 add_ff_gas_fragment_id(proto_tree *tree, tvbuff_t *tvb, int offset)
5406 {
5407   proto_tree_add_item(tree, hf_ieee80211_ff_gas_fragment_id, tvb, offset, 1,
5408                       ENC_BIG_ENDIAN);
5409   proto_tree_add_item(tree, hf_ieee80211_ff_more_gas_fragments, tvb, offset, 1,
5410                       ENC_BIG_ENDIAN);
5411   return 1;
5412 }
5413
5414 static guint
5415 add_ff_sa_query_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
5416 {
5417   proto_tree_add_item(tree, hf_ieee80211_ff_sa_query_action_code, tvb, offset,
5418                       1, ENC_BIG_ENDIAN);
5419   return 1;
5420 }
5421
5422 static guint
5423 add_ff_transaction_id(proto_tree *tree, tvbuff_t *tvb, int offset)
5424 {
5425   proto_tree_add_item(tree, hf_ieee80211_ff_transaction_id, tvb, offset, 2,
5426                       ENC_LITTLE_ENDIAN);
5427   return 2;
5428 }
5429
5430 static guint
5431 add_ff_tdls_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
5432 {
5433   guint8 code;
5434   code = tvb_get_guint8(tvb, offset);
5435   col_set_str(g_pinfo->cinfo, COL_INFO,
5436               val_to_str_const(code, tdls_action_codes,
5437                                "Unknown TDLS Action"));
5438   proto_tree_add_item(tree, hf_ieee80211_ff_tdls_action_code, tvb, offset, 1,
5439                       ENC_BIG_ENDIAN);
5440   return 1;
5441 }
5442
5443 static guint
5444 add_ff_target_channel(proto_tree *tree, tvbuff_t *tvb, int offset)
5445 {
5446   proto_tree_add_item(tree, hf_ieee80211_ff_target_channel, tvb, offset, 1,
5447                       ENC_BIG_ENDIAN);
5448   return 1;
5449 }
5450
5451 static guint
5452 add_ff_regulatory_class(proto_tree *tree, tvbuff_t *tvb, int offset)
5453 {
5454   proto_tree_add_item(tree, hf_ieee80211_ff_regulatory_class, tvb, offset, 1,
5455                       ENC_BIG_ENDIAN);
5456   return 1;
5457 }
5458
5459 static guint
5460 add_ff_wnm_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
5461 {
5462   guint8 code;
5463   code = tvb_get_guint8(tvb, offset);
5464   col_set_str(g_pinfo->cinfo, COL_INFO,
5465               val_to_str_const(code, wnm_action_codes,
5466                                "Unknown WNM Action"));
5467   proto_tree_add_item(tree, hf_ieee80211_ff_wnm_action_code, tvb, offset, 1,
5468                       ENC_BIG_ENDIAN);
5469   return 1;
5470 }
5471
5472 struct ieee80211_fixed_field_dissector {
5473   enum fixed_field lfcode;
5474   guint (*dissector)(proto_tree *tree, tvbuff_t *tvb, int offset);
5475 };
5476
5477 #define FF_FIELD(f, func) { FIELD_ ## f, add_ff_ ## func }
5478
5479 static const struct ieee80211_fixed_field_dissector ff_dissectors[] = {
5480   FF_FIELD(TIMESTAMP, timestamp),
5481   FF_FIELD(BEACON_INTERVAL, beacon_interval),
5482   FF_FIELD(CAP_INFO, cap_info),
5483   FF_FIELD(AUTH_ALG, auth_alg),
5484   FF_FIELD(AUTH_TRANS_SEQ, auth_trans_seq),
5485   FF_FIELD(CURRENT_AP_ADDR, current_ap_addr),
5486   FF_FIELD(LISTEN_IVAL, listen_ival),
5487   FF_FIELD(REASON_CODE, reason_code),
5488   FF_FIELD(ASSOC_ID, assoc_id),
5489   FF_FIELD(STATUS_CODE, status_code),
5490   FF_FIELD(CATEGORY_CODE, category_code),
5491   FF_FIELD(ACTION_CODE, action_code),
5492   FF_FIELD(DIALOG_TOKEN, dialog_token),
5493   FF_FIELD(WME_ACTION_CODE, wme_action_code),
5494   FF_FIELD(WME_STATUS_CODE, wme_status_code),
5495   FF_FIELD(QOS_ACTION_CODE, qos_action_code),
5496   FF_FIELD(BLOCK_ACK_ACTION_CODE, block_ack_action_code),
5497   FF_FIELD(BLOCK_ACK_PARAM, block_ack_param),
5498   FF_FIELD(BLOCK_ACK_TIMEOUT, block_ack_timeout),
5499   FF_FIELD(BLOCK_ACK_SSC, block_ack_ssc),
5500   FF_FIELD(QOS_TS_INFO, qos_ts_info),
5501   FF_FIELD(MESH_ACTION, mesh_action),
5502   FF_FIELD(MULTIHOP_ACTION, multihop_action),
5503   FF_FIELD(MESH_CONTROL, mesh_control),
5504   FF_FIELD(SELFPROT_ACTION, selfprot_action),
5505   FF_FIELD(DLS_ACTION_CODE, dls_action_code),
5506   FF_FIELD(DST_MAC_ADDR, dst_mac_addr),
5507   FF_FIELD(SRC_MAC_ADDR, src_mac_addr),
5508   FF_FIELD(DLS_TIMEOUT, dls_timeout),
5509   FF_FIELD(DELBA_PARAM_SET, delba_param_set),
5510   FF_FIELD(MAX_REG_PWR, max_reg_pwr),
5511   FF_FIELD(MEASUREMENT_PILOT_INT, measurement_pilot_int),
5512   FF_FIELD(COUNTRY_STR, country_str),
5513   FF_FIELD(MAX_TX_PWR, max_tx_pwr),
5514   FF_FIELD(TX_PWR_USED, tx_pwr_used),
5515   FF_FIELD(TRANSCEIVER_NOISE_FLOOR, transceiver_noise_floor),
5516   FF_FIELD(CHANNEL_WIDTH, channel_width),
5517   FF_FIELD(QOS_INFO_AP, qos_info_ap),
5518   FF_FIELD(QOS_INFO_STA, qos_info_sta),
5519   FF_FIELD(SM_PWR_CNTRL, sm_pwr_cntrl),
5520   FF_FIELD(PCO_PHASE_CNTRL, pco_phase_cntrl),
5521   FF_FIELD(PSMP_PARAM_SET, psmp_param_set),
5522   FF_FIELD(MIMO_CNTRL, mimo_cntrl),
5523   FF_FIELD(ANT_SELECTION, ant_selection),
5524   FF_FIELD(EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT,
5525            extended_channel_switch_announcement),
5526   FF_FIELD(HT_INFORMATION, ht_information),
5527   FF_FIELD(HT_ACTION_CODE, ht_action_code),
5528   FF_FIELD(PSMP_STA_INFO, psmp_sta_info),
5529   FF_FIELD(SCHEDULE_INFO, schedule_info),
5530   FF_FIELD(PA_ACTION_CODE, pa_action_code),
5531   FF_FIELD(ACTION, action),
5532   FF_FIELD(FT_ACTION_CODE, ft_action_code),
5533   FF_FIELD(STA_ADDRESS, sta_address),
5534   FF_FIELD(TARGET_AP_ADDRESS, target_ap_address),
5535   FF_FIELD(GAS_COMEBACK_DELAY, gas_comeback_delay),
5536   FF_FIELD(GAS_FRAGMENT_ID, gas_fragment_id),
5537   FF_FIELD(SA_QUERY_ACTION_CODE, sa_query_action_code),
5538   FF_FIELD(TRANSACTION_ID, transaction_id),
5539   FF_FIELD(TDLS_ACTION_CODE, tdls_action_code),
5540   FF_FIELD(TARGET_CHANNEL, target_channel),
5541   FF_FIELD(REGULATORY_CLASS, regulatory_class),
5542   FF_FIELD(WNM_ACTION_CODE, wnm_action_code),
5543   { -1, NULL }
5544 };
5545
5546 #undef FF_FIELD
5547
5548 static guint
5549 add_fixed_field(proto_tree *tree, tvbuff_t *tvb, int offset,
5550                 enum fixed_field lfcode)
5551 {
5552   int i;
5553   for (i = 0; ff_dissectors[i].dissector; i++) {
5554     if (ff_dissectors[i].lfcode == lfcode) {
5555       return ff_dissectors[i].dissector(tree, tvb, offset);
5556     }
5557   }
5558   return 0;
5559 }
5560
5561 static const value_string ieee80211_rsn_cipher_vals[] =
5562 {
5563   {0, "NONE"},
5564   {1, "WEP (40-bit)"},
5565   {2, "TKIP"},
5566   {3, "AES (OCB)"},
5567   {4, "AES (CCM)"},
5568   {5, "WEP (104-bit)"},
5569   {6, "BIP"},
5570   {7, "Group addressed traffic not allowed"},
5571   {0, NULL}
5572 };
5573
5574 static const value_string ieee80211_rsn_keymgmt_vals[] =
5575 {
5576   {0, "NONE"},
5577   {1, "WPA"},
5578   {2, "PSK"},
5579   {3, "FT over IEEE 802.1X"},
5580   {4, "FT using PSK"},
5581   {5, "WPA (SHA256)"},
5582   {6, "PSK (SHA256)"},
5583   {7, "TDLS / TPK Handshake"},
5584   {0, NULL}
5585 };
5586
5587 static void
5588 oui_base_custom(gchar *result, guint32 oui)
5589 {
5590   guint8 p_oui[3];
5591   const gchar *manuf_name;
5592   p_oui[0] = oui >> 16 & 0xFF;
5593   p_oui[1] = oui >> 8 & 0xFF;
5594   p_oui[2] = oui & 0xFF;
5595
5596   /* Attempt an OUI lookup. */
5597   manuf_name = get_manuf_name_if_known(p_oui);
5598   if (manuf_name == NULL) {
5599       /* Could not find an OUI. */
5600       g_snprintf(result, ITEM_LABEL_LENGTH, "%.2x-%.2x-%.2x", p_oui[0], p_oui[1], p_oui[2] );
5601   }
5602   else {
5603       /* Found an address string. */
5604       g_snprintf(result, ITEM_LABEL_LENGTH, "%.2x-%.2x-%.2x (%s)", p_oui[0], p_oui[1], p_oui[2], manuf_name );
5605   }
5606 }
5607 static void
5608 rsn_gcs_base_custom(gchar *result, guint32 gcs)
5609 {
5610   gchar *oui_result=NULL;
5611   oui_result = ep_alloc(SHORT_STR);
5612   oui_result[0] = '\0';
5613   oui_base_custom(oui_result, gcs >> 8);
5614   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( gcs & 0xFF, ieee80211_rsn_cipher_vals, "Unknown %d") );
5615 }
5616
5617 static void
5618 rsn_pcs_base_custom(gchar *result, guint32 pcs)
5619 {
5620   gchar *oui_result=NULL;
5621   oui_result = ep_alloc(SHORT_STR);
5622   oui_result[0] = '\0';
5623   oui_base_custom(oui_result, pcs >> 8);
5624   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( pcs & 0xFF, ieee80211_rsn_cipher_vals, "Unknown %d") );
5625
5626 }
5627 static void
5628 rsn_akms_base_custom(gchar *result, guint32 akms)
5629 {
5630   gchar *oui_result=NULL;
5631   oui_result = ep_alloc(SHORT_STR);
5632   oui_result[0] = '\0';
5633   oui_base_custom(oui_result, akms >> 8);
5634   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( akms & 0xFF, ieee80211_rsn_keymgmt_vals, "Unknown %d") );
5635 }
5636
5637 static gchar *
5638 rsn_pcs_return(guint32 pcs)
5639 {
5640   gchar *result=NULL;
5641   result = ep_alloc(SHORT_STR);
5642   result[0] = '\0';
5643   rsn_pcs_base_custom(result, pcs);
5644
5645   return result;
5646 }
5647
5648 static gchar *
5649 rsn_akms_return(guint32 akms)
5650 {
5651   gchar *result=NULL;
5652   result = ep_alloc(SHORT_STR);
5653   result[0] = '\0';
5654   rsn_akms_base_custom(result, akms);
5655
5656   return result;
5657 }
5658
5659 static void
5660 rsn_gmcs_base_custom(gchar *result, guint32 gmcs)
5661 {
5662   gchar *oui_result=NULL;
5663   oui_result = ep_alloc(SHORT_STR);
5664   oui_result[0] = '\0';
5665   oui_base_custom(oui_result, gmcs >> 8);
5666   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( gmcs & 0xFF, ieee80211_rsn_cipher_vals, "Unknown %d") );
5667 }
5668
5669 /* WPA / WME */
5670 static const value_string ieee802111_wfa_ie_type_vals[] =
5671 {
5672   { 1, "WPA Information Element" },
5673   { 2, "WMM/WME" },
5674   { 4, "WPS" },
5675   { 0, NULL }
5676 };
5677
5678 static const value_string ieee80211_wfa_ie_wpa_cipher_vals[] =
5679 {
5680   { 0, "NONE" },
5681   { 1, "WEP (40-bit)" },
5682   { 2, "TKIP" },
5683   { 3, "AES (OCB)" },
5684   { 4, "AES (CCM)" },
5685   { 5, "WEP (104-bit)" },
5686   { 6, "BIP" },
5687   { 7, "Group addressed traffic not allowed" },
5688   { 0, NULL }
5689 };
5690
5691 static const value_string ieee80211_wfa_ie_wpa_keymgmt_vals[] =
5692 {
5693   { 0, "NONE" },
5694   { 1, "WPA" },
5695   { 2, "PSK" },
5696   { 3, "FT over IEEE 802.1X" },
5697   { 4, "FT using PSK" },
5698   { 5, "WPA (SHA256)" },
5699   { 6, "PSK (SHA256)" },
5700   { 7, "TDLS / TPK Handshake" },
5701   { 0, NULL }
5702 };
5703
5704 static const value_string ieee80211_wfa_ie_wme_acs_vals[] = {
5705   { 0, "Best Effort" },
5706   { 1, "Background" },
5707   { 2, "Video" },
5708   { 3, "Voice" },
5709   { 0, NULL }
5710 };
5711
5712 static const value_string ieee80211_wfa_ie_wme_tspec_tsinfo_direction_vals[] = {
5713   { 0, "Uplink" },
5714   { 1, "Downlink" },
5715   { 2, "Direct link" },
5716   { 3, "Bidirectional link" },
5717   { 0, NULL }
5718 };
5719
5720 static const value_string ieee80211_wfa_ie_wme_tspec_tsinfo_psb_vals[] = {
5721   { 0, "Legacy" },
5722   { 1, "U-APSD" },
5723   { 0, NULL }
5724 };
5725
5726 static const value_string ieee80211_wfa_ie_wme_tspec_tsinfo_up_vals[] = {
5727   { 0, "Best Effort" },
5728   { 1, "Background" },
5729   { 2, "Spare" },
5730   { 3, "Excellent Effort" },
5731   { 4, "Controlled Load" },
5732   { 5, "Video" },
5733   { 6, "Voice" },
5734   { 7, "Network Control" },
5735   { 0, NULL }
5736 };
5737
5738 static const value_string ieee802111_wfa_ie_wme_qos_info_sta_max_sp_length_vals[] = {
5739   { 0, "WMM AP may deliver all buffered frames (MSDUs and MMPDUs)" },
5740   { 1, "WMM AP may deliver a maximum of 2 buffered frames (MSDUs and MMPDUs) per USP" },
5741   { 2, "WMM AP may deliver a maximum of 4 buffered frames (MSDUs and MMPDUs) per USP" },
5742   { 3, "WMM AP may deliver a maximum of 6 buffered frames (MSDUs and MMPDUs) per USP" },
5743   { 0, NULL}
5744 };
5745 static const true_false_string ieee802111_wfa_ie_wme_qos_info_sta_ac_tfs = { "WMM delivery and trigger enabled", "non-WMM PS" };
5746
5747 static void
5748 wpa_mcs_base_custom(gchar *result, guint32 mcs)
5749 {
5750   gchar *oui_result=NULL;
5751   oui_result = ep_alloc(SHORT_STR);
5752   oui_result[0] = '\0';
5753   oui_base_custom(oui_result, mcs >> 8);
5754   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( mcs & 0xFF, ieee80211_wfa_ie_wpa_cipher_vals, "Unknown %d") );
5755 }
5756
5757 static void
5758 wpa_ucs_base_custom(gchar *result, guint32 ucs)
5759 {
5760   gchar *oui_result=NULL;
5761   oui_result = ep_alloc(SHORT_STR);
5762   oui_result[0] = '\0';
5763   oui_base_custom(oui_result, ucs >> 8);
5764   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( ucs & 0xFF, ieee80211_wfa_ie_wpa_cipher_vals, "Unknown %d") );
5765
5766 }
5767 static void
5768 wpa_akms_base_custom(gchar *result, guint32 akms)
5769 {
5770   gchar *oui_result=NULL;
5771   oui_result = ep_alloc(SHORT_STR);
5772   oui_result[0] = '\0';
5773   oui_base_custom(oui_result, akms >> 8);
5774   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( akms & 0xFF, ieee80211_wfa_ie_wpa_keymgmt_vals, "Unknown %d") );
5775 }
5776
5777 static gchar *
5778 wpa_ucs_return(guint32 ucs)
5779 {
5780   gchar *result=NULL;
5781   result = ep_alloc(SHORT_STR);
5782   result[0] = '\0';
5783   wpa_ucs_base_custom(result, ucs);
5784
5785   return result;
5786 }
5787
5788 static gchar *
5789 wpa_akms_return(guint32 akms)
5790 {
5791   gchar *result=NULL;
5792   result = ep_alloc(SHORT_STR);
5793   result[0] = '\0';
5794   wpa_akms_base_custom(result, akms);
5795
5796   return result;
5797 }
5798
5799 static const value_string ieee802111_wfa_ie_wme_type[] =
5800 {
5801   { 0, "Information Element" },
5802   { 1, "Parameter Element" },
5803   { 2, "TSPEC Element" },
5804   { 0, NULL}
5805 };
5806
5807 static const value_string ft_subelem_id_vals[] =
5808 {
5809   {0, "Reserved"},
5810   {1, "PMK-R1 key holder identifier (R1KH-ID)"},
5811   {2, "GTK subelement"},
5812   {3, "PMK-R0 key holder identifier (R0KH-ID)"},
5813   {4, "IGTK"},
5814   {0, NULL}
5815 };
5816
5817 static int dissect_qos_info(proto_tree * tree, tvbuff_t *tvb, int offset, int ftype)
5818 {
5819   proto_tree *qos_info_tree;
5820   proto_item *qos_info_item;
5821   qos_info_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_qos_info, tvb, offset, 1, ENC_NA);
5822   qos_info_tree = proto_item_add_subtree(qos_info_item, ett_wme_qos_info);
5823
5824   switch(ftype){
5825     case MGT_ASSOC_REQ:
5826     case MGT_PROBE_REQ:
5827     case MGT_REASSOC_REQ:
5828     {
5829       /* To AP so decode as per WMM standard Figure 7 QoS Info field when sent from WMM STA*/
5830       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_max_sp_length, tvb, offset, 1, ENC_NA);
5831       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_be, tvb, offset, 1, ENC_NA);
5832       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_bk, tvb, offset, 1, ENC_NA);
5833       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vi, tvb, offset, 1, ENC_NA);
5834       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vo, tvb, offset, 1, ENC_NA);
5835       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_reserved, tvb, offset, 1, ENC_NA);
5836       break;
5837     }
5838     case MGT_BEACON:
5839     case MGT_PROBE_RESP:
5840     case MGT_ASSOC_RESP:
5841     case MGT_REASSOC_RESP:
5842     {
5843       /* From AP so decode as per WMM standard Figure 6 QoS Info field when sent from WMM AP */
5844       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_ap_u_apsd, tvb, offset, 1, ENC_NA);
5845       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_ap_parameter_set_count, tvb, offset, 1, ENC_NA);
5846       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_ap_reserved, tvb, offset, 1, ENC_NA);
5847       break;
5848     }
5849     default:
5850         expert_add_info_format(g_pinfo, qos_info_item, PI_UNDECODED, PI_WARN, "Could not deduce direction to decode correctly, ftype %u", ftype);
5851       break;
5852     }
5853
5854   offset += 1;
5855   return offset;
5856 }
5857
5858 static int
5859 dissect_vendor_ie_wpawme(proto_tree * tree, tvbuff_t * tvb, int offset, guint32 tag_len, int ftype)
5860 {
5861   guint8 type;
5862
5863   proto_tree_add_item(tree, hf_ieee80211_wfa_ie_type, tvb, offset, 1, ENC_NA);
5864   type = tvb_get_guint8(tvb, offset);
5865   proto_item_append_text(tree, ": %s", val_to_str(type, ieee802111_wfa_ie_type_vals, "Unknown %d" ));
5866   offset += 1;
5867
5868   switch(type){
5869     case 1:   /* Wi-Fi Protected Access (WPA) */
5870     {
5871       proto_item *wpa_mcs_item, *wpa_ucs_item, *wpa_akms_item;
5872       proto_item *wpa_sub_ucs_item, *wpa_sub_akms_item;
5873       proto_tree *wpa_mcs_tree, *wpa_ucs_tree, *wpa_akms_tree;
5874       proto_tree *wpa_sub_ucs_tree, *wpa_sub_akms_tree;
5875       guint16 i, ucs_count, akms_count;
5876
5877       proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_version, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5878       offset += 2;
5879
5880       /* Multicast Cipher Suite */
5881       wpa_mcs_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_mcs, tvb, offset, 4, ENC_BIG_ENDIAN);
5882       wpa_mcs_tree = proto_item_add_subtree(wpa_mcs_item, ett_wpa_mcs_tree);
5883       proto_tree_add_item(wpa_mcs_tree, hf_ieee80211_wfa_ie_wpa_mcs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
5884
5885       /* Check if OUI is 00:50:F2 (WFA) */
5886       if(tvb_get_ntoh24(tvb, offset) == 0x0050F2)
5887       {
5888         proto_tree_add_item(wpa_mcs_tree, hf_ieee80211_wfa_ie_wpa_mcs_wfa_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5889       } else {
5890         proto_tree_add_item(wpa_mcs_tree, hf_ieee80211_wfa_ie_wpa_mcs_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5891       }
5892       offset += 4;
5893
5894       /* Unicast Cipher Suites */
5895       proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_ucs_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5896       ucs_count = tvb_get_letohs(tvb, offset);
5897       offset += 2;
5898
5899       wpa_ucs_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_ucs_list, tvb, offset, ucs_count * 4, ENC_NA);
5900       wpa_ucs_tree = proto_item_add_subtree(wpa_ucs_item, ett_wpa_ucs_tree);
5901       for(i=1; i <= ucs_count; i++)
5902       {
5903         wpa_sub_ucs_item = proto_tree_add_item(wpa_ucs_tree, hf_ieee80211_wfa_ie_wpa_ucs, tvb, offset, 4, ENC_BIG_ENDIAN);
5904         wpa_sub_ucs_tree = proto_item_add_subtree(wpa_sub_ucs_item, ett_wpa_sub_ucs_tree);
5905         proto_tree_add_item(wpa_sub_ucs_tree, hf_ieee80211_wfa_ie_wpa_ucs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
5906
5907         /* Check if OUI is 00:50:F2 (WFA) */
5908         if(tvb_get_ntoh24(tvb, offset) == 0x0050F2)
5909         {
5910           proto_tree_add_item(wpa_sub_ucs_tree, hf_ieee80211_wfa_ie_wpa_ucs_wfa_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5911           proto_item_append_text(wpa_ucs_item, " %s", wpa_ucs_return(tvb_get_ntohl(tvb, offset)));
5912         } else {
5913           proto_tree_add_item(wpa_sub_ucs_tree, hf_ieee80211_wfa_ie_wpa_ucs_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5914         }
5915         offset += 4;
5916       }
5917
5918       /* Authenticated Key Management Suites */
5919       proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_akms_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5920       akms_count = tvb_get_letohs(tvb, offset);
5921       offset += 2;
5922
5923       wpa_akms_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_akms_list, tvb, offset, akms_count * 4, ENC_NA);
5924       wpa_akms_tree = proto_item_add_subtree(wpa_akms_item, ett_wpa_akms_tree);
5925       for(i=1; i <= akms_count; i++)
5926       {
5927         wpa_sub_akms_item = proto_tree_add_item(wpa_akms_tree, hf_ieee80211_wfa_ie_wpa_akms, tvb, offset, 4, ENC_BIG_ENDIAN);
5928         wpa_sub_akms_tree = proto_item_add_subtree(wpa_sub_akms_item, ett_wpa_sub_akms_tree);
5929         proto_tree_add_item(wpa_sub_akms_tree, hf_ieee80211_wfa_ie_wpa_akms_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
5930
5931         /* Check if OUI is 00:50:F2 (WFA) */
5932         if(tvb_get_ntoh24(tvb, offset) == 0x0050F2)
5933         {
5934           proto_tree_add_item(wpa_sub_akms_tree, hf_ieee80211_wfa_ie_wpa_akms_wfa_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5935           proto_item_append_text(wpa_akms_item, " %s", wpa_akms_return(tvb_get_ntohl(tvb, offset)));
5936         } else {
5937           proto_tree_add_item(wpa_sub_akms_tree, hf_ieee80211_wfa_ie_wpa_akms_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5938         }
5939         offset += 4;
5940       }
5941       break;
5942     }
5943     case 2:   /* Wireless Multimedia Enhancements (WME) */
5944     {
5945       guint8 subtype;
5946
5947       proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_subtype, tvb, offset, 1, ENC_NA);
5948       subtype = tvb_get_guint8(tvb, offset);
5949       proto_item_append_text(tree, ": %s", val_to_str(subtype, ieee802111_wfa_ie_wme_type, "Unknown %d" ));
5950       offset += 1;
5951       switch(subtype){
5952         case 0: /* WME Information Element */
5953         {
5954           proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_version, tvb, offset, 1, ENC_NA);
5955           offset += 1;
5956           /* WME QoS Info Field */
5957           offset = dissect_qos_info(tree, tvb, offset, ftype);
5958           break;
5959         }
5960         case 1: /* WME Parameter Element */
5961         {
5962           int i;
5963           proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_version, tvb, offset, 1, ENC_NA);
5964           offset += 1;
5965           /* WME QoS Info Field */
5966           offset = dissect_qos_info(tree, tvb, offset, ftype);
5967           proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_reserved, tvb, offset, 1, ENC_NA);
5968           offset += 1;
5969           /* AC Parameters */
5970           for(i = 0; i < 4; i++)
5971           {
5972             proto_item *ac_item, *aci_aifsn_item, *ecw_item;
5973             proto_tree *ac_tree, *aci_aifsn_tree, *ecw_tree;
5974             guint8 aci_aifsn, ecw;
5975
5976             ac_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_ac_parameters, tvb, offset, 4, ENC_NA);
5977             ac_tree = proto_item_add_subtree(ac_item, ett_wme_ac);
5978
5979             /* ACI/AIFSN Field */
5980             aci_aifsn_item = proto_tree_add_item(ac_tree, hf_ieee80211_wfa_ie_wme_acp_aci_aifsn, tvb, offset, 1, ENC_NA);
5981             aci_aifsn_tree = proto_item_add_subtree(aci_aifsn_item, ett_wme_aci_aifsn);
5982             proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_aci, tvb, offset, 1, ENC_NA);
5983             proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_acm, tvb, offset, 1, ENC_NA);
5984             proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_aifsn, tvb, offset, 1, ENC_NA);
5985             proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_reserved, tvb, offset, 1, ENC_NA);
5986             aci_aifsn = tvb_get_guint8(tvb, offset);
5987             proto_item_append_text(ac_item, " ACI %u (%s), ACM %s, AIFSN %u",
5988             (aci_aifsn & 0x60) >> 5, match_strval((aci_aifsn & 0x60) >> 5, ieee80211_wfa_ie_wme_acs_vals),
5989             (aci_aifsn & 0x10) ? "yes" : "no ", aci_aifsn & 0x0f);
5990             offset += 1;
5991
5992             /* ECWmin/ECWmax field */
5993             ecw_item = proto_tree_add_item(ac_tree, hf_ieee80211_wfa_ie_wme_acp_ecw, tvb, offset, 1, ENC_NA);
5994             ecw_tree = proto_item_add_subtree(ecw_item, ett_wme_ecw);
5995             proto_tree_add_item(ecw_tree, hf_ieee80211_wfa_ie_wme_acp_ecw_max, tvb, offset, 1, ENC_NA);
5996             proto_tree_add_item(ecw_tree, hf_ieee80211_wfa_ie_wme_acp_ecw_min, tvb, offset, 1, ENC_NA);
5997             ecw = tvb_get_guint8(tvb, offset);
5998             proto_item_append_text(ac_item, ", ECWmin %u ,ECWmax %u", ecw & 0x0f, (ecw & 0xf0) >> 4 );
5999             offset += 1;
6000
6001             /* TXOP Limit */
6002             proto_tree_add_item(ac_tree, hf_ieee80211_wfa_ie_wme_acp_txop_limit, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6003             proto_item_append_text(ac_item, ", TXOP %u", tvb_get_letohs(tvb, offset));
6004             offset += 2;
6005           }
6006           break;
6007         }
6008         case 3:   /* WME TSPEC Element */
6009         {
6010
6011             proto_item *tsinfo_item;
6012             proto_tree *tsinfo_tree;
6013
6014             tsinfo_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6015             tsinfo_tree = proto_item_add_subtree(tsinfo_item, ett_tsinfo_tree);
6016
6017             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_tid, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6018             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_direction, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6019             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_psb, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6020             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_up, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6021             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_reserved, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6022             offset += 3;
6023
6024             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_nor_msdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6025             offset += 2;
6026
6027             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_max_msdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6028             offset += 2;
6029
6030             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_min_srv, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6031             offset += 4;
6032
6033             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_max_srv, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6034             offset += 4;
6035
6036             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_inact_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6037             offset += 4;
6038
6039             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_susp_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6040             offset += 4;
6041
6042             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_srv_start, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6043             offset += 4;
6044
6045             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_min_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6046             offset += 4;
6047
6048             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_mean_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6049             offset += 4;
6050
6051             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_peak_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6052             offset += 4;
6053
6054             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_burst_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6055             offset += 4;
6056
6057             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_delay_bound, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6058             offset += 4;
6059
6060             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_min_phy, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6061             offset += 4;
6062
6063             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_surplus, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6064             offset += 2;
6065
6066             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_medium, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6067             offset += 2;
6068
6069           break;
6070         }
6071         default:
6072           /* No default Action */
6073         break;
6074       } /* End switch(subtype) */
6075       break;
6076     }
6077     case 4: /* WPS: Wifi Protected Setup */
6078     {
6079       dissect_wps_tlvs(tree, tvb, offset, tag_len-4, NULL);
6080     }
6081     break;
6082     default:
6083       /* No default Action...*/
6084     break;
6085   } /* End switch(type) */
6086
6087   return offset;
6088 }
6089
6090 static void
6091 dissect_vendor_ie_wfa(packet_info *pinfo, proto_item *item, tvbuff_t *tag_tvb)
6092 {
6093   gint tag_len = tvb_length(tag_tvb);
6094
6095   if (tag_len < 4)
6096     return;
6097
6098   switch (tvb_get_guint8(tag_tvb, 3)) {
6099   case WFA_SUBTYPE_P2P:
6100     dissect_wifi_p2p_ie(pinfo, item, tag_tvb, 4, tag_len - 4);
6101     proto_item_append_text(item, ": P2P");
6102     break;
6103   }
6104 }
6105
6106 static void
6107 dissect_vendor_ie_rsn(proto_item * item, proto_tree * tree, tvbuff_t * tag_tvb)
6108 {
6109   guint tag_off = 0;
6110   guint tag_len = tvb_length(tag_tvb);
6111   guint pmkid_len = tag_len - 4;
6112   char out_buff[SHORT_STR], valid_str[SHORT_STR] = "";
6113
6114   if (tag_len >= 4 && !tvb_memeql(tag_tvb, tag_off, RSN_OUI"\x04", 4)) {
6115     /* IEEE 802.11i / Key Data Encapsulation / Data Type=4 - PMKID.
6116      * This is only used within EAPOL-Key frame Key Data. */
6117     if (pmkid_len != PMKID_LEN) {
6118       g_snprintf(valid_str, SHORT_STR,
6119         "(invalid PMKID len=%d, expected 16) ", pmkid_len);
6120     }
6121     g_snprintf(out_buff, SHORT_STR, "RSN PMKID: %s%s", valid_str,
6122       tvb_bytes_to_str(tag_tvb, 4, pmkid_len));
6123     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 0,
6124       tag_len, out_buff);
6125   }
6126   proto_item_append_text(item, ": RSN");
6127 }
6128
6129 typedef enum {
6130   MARVELL_IE_MESH = 4
6131 } marvell_ie_type_t;
6132
6133 static void
6134 dissect_vendor_ie_marvell(proto_item * item _U_, proto_tree * ietree,
6135                           tvbuff_t * tvb, int offset, guint32 tag_len)
6136 {
6137   guint8 type;
6138
6139   type = tvb_get_guint8(tvb, offset);
6140   proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6141   offset += 1;
6142
6143   switch (type) {
6144   case MARVELL_IE_MESH:
6145     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_subtype, tvb,
6146                          offset++, 1, ENC_LITTLE_ENDIAN );
6147     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_version, tvb,
6148                          offset++, 1, ENC_LITTLE_ENDIAN );
6149     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_active_proto_id, tvb,
6150                          offset++, 1, ENC_LITTLE_ENDIAN );
6151     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_active_metric_id, tvb,
6152                          offset++, 1, ENC_LITTLE_ENDIAN );
6153     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_cap, tvb,
6154                          offset++, 1, ENC_LITTLE_ENDIAN );
6155     break;
6156
6157   default:
6158     proto_tree_add_item(ietree, hf_ieee80211_marvell_ie_data, tvb, offset,
6159       tag_len - 1, ENC_NA);
6160     break;
6161   }
6162 }
6163
6164 typedef enum {
6165   ATHEROS_IE_ADVCAP = 1,
6166   ATHEROS_IE_XR = 3
6167 } atheros_ie_type_t;
6168
6169 typedef enum {
6170   ATHEROS_IE_ADVCAP_S = 1
6171 } atheros_ie_advcap_subtype_t;
6172
6173 typedef enum {
6174   ATHEROS_IE_XR_S = 1
6175 } atheros_ie_xr_subtype_t;
6176
6177 typedef enum {
6178   ATHEROS_IE_CAP_TURBOP = 0x01,
6179   ATHEROS_IE_CAP_COMP = 0x02,
6180   ATHEROS_IE_CAP_FF = 0x04,
6181   ATHEROS_IE_CAP_XR = 0x08,
6182   ATHEROS_IE_CAP_AR = 0x10,
6183   ATHEROS_IE_CAP_BURST = 0x20,
6184   ATHEROS_IE_CAP_WME = 0x40,
6185   ATHEROS_IE_CAP_BOOST = 0x80
6186 } atheros_ie_cap_t;
6187
6188 static const value_string atheros_ie_type_vals[] = {
6189   { ATHEROS_IE_ADVCAP, "Advanced Capability"},
6190   { ATHEROS_IE_XR,     "eXtended Range"},
6191   { 0,                 NULL }
6192 };
6193
6194 static void
6195 dissect_vendor_ie_atheros_cap(proto_item * item _U_, tvbuff_t *tvb, int offset)
6196 {
6197   proto_tree *cap_tree;
6198
6199   cap_tree = proto_item_add_subtree(item, ett_ath_cap_tree);
6200
6201   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_turbop, tvb, offset, 1, ENC_NA);
6202   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_comp, tvb, offset, 1, ENC_NA);
6203   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_ff, tvb, offset, 1, ENC_NA);
6204   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_xr, tvb, offset, 1, ENC_NA);
6205   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_ar, tvb, offset, 1, ENC_NA);
6206   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_burst, tvb, offset, 1, ENC_NA);
6207   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_wme, tvb, offset, 1, ENC_NA);
6208   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_boost, tvb, offset, 1, ENC_NA);
6209
6210 }
6211
6212 static void
6213 dissect_vendor_ie_atheros(proto_item * item _U_, proto_tree * ietree,
6214                           tvbuff_t * tvb, int offset, guint tag_len,
6215                           packet_info * pinfo, int tag_end, proto_item *ti_len)
6216 {
6217   guint8 type;
6218   guint8 subtype;
6219   guint8 version;
6220   proto_item *cap_item;
6221   proto_item *ti;
6222
6223   if (tag_len <= 6) {
6224         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 6", tag_len);
6225         return;
6226   }
6227   proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_type, tvb, offset, 1, ENC_NA);
6228   type = tvb_get_guint8(tvb, offset);
6229   proto_item_append_text(item, ": %s", val_to_str(type, atheros_ie_type_vals, "Unknown"));
6230   offset += 1;
6231
6232   proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_subtype, tvb, offset, 1, ENC_NA);
6233   subtype = tvb_get_guint8(tvb, offset);
6234   offset += 1;
6235
6236   proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_version, tvb, offset, 1, ENC_NA);
6237   version = tvb_get_guint8(tvb, offset);
6238   offset += 1;
6239
6240   if(version == 0)
6241   {
6242     switch(type){
6243       case ATHEROS_IE_ADVCAP:
6244       {
6245         switch(subtype){
6246           case ATHEROS_IE_ADVCAP_S:
6247           {
6248             cap_item = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_advcap_cap, tvb, offset, 1, ENC_NA);
6249             dissect_vendor_ie_atheros_cap(cap_item, tvb, offset);
6250             offset += 1;
6251
6252             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_advcap_defkey, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6253             offset += 2;
6254             break;
6255           }
6256           default:
6257           /* No default Action */
6258           break;
6259         } /* End switch(subtype) */
6260         break;
6261       }
6262       case ATHEROS_IE_XR:
6263       {
6264         switch(subtype){
6265           case ATHEROS_IE_XR_S:
6266           {
6267             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_info, tvb, offset, 1, ENC_NA);
6268             offset += 1;
6269
6270             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_base_bssid, tvb, offset, 6, ENC_NA);
6271             offset += 6;
6272
6273             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_xr_bssid, tvb, offset, 6, ENC_NA);
6274             offset += 6;
6275
6276             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_xr_beacon, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6277             offset += 2;
6278
6279             cap_item = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_base_cap, tvb, offset, 1, ENC_NA);
6280             dissect_vendor_ie_atheros_cap(cap_item, tvb, offset);
6281             offset += 1;
6282
6283             cap_item = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_xr_cap, tvb, offset, 1, ENC_NA);
6284             dissect_vendor_ie_atheros_cap(cap_item, tvb, offset);
6285             offset += 1;
6286             break;
6287           }
6288           default:
6289           /* No default Action */
6290           break;
6291         break;
6292         } /* End switch(subtype) */
6293         default:
6294         /* No default Action */
6295         break;
6296       } /* End switch(type) */
6297
6298     }
6299   }
6300   if(offset < tag_end){
6301    ti = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_data, tvb, offset, tag_end - offset, ENC_NA);
6302    expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown Data (not interpreted)");
6303   }
6304
6305
6306 }
6307
6308 typedef enum {
6309   AIRONET_IE_VERSION = 3,
6310   AIRONET_IE_QOS,
6311   AIRONET_IE_QBSS_V2 = 14
6312 } aironet_ie_type_t;
6313
6314 static const value_string aironet_ie_type_vals[] = {
6315   { AIRONET_IE_VERSION,   "CCX version"},
6316   { AIRONET_IE_QOS,       "Qos"},
6317   { AIRONET_IE_QBSS_V2,   "QBSS V2 - CCA"},
6318   { 0,                    NULL }
6319 };
6320
6321 static void
6322 dissect_vendor_ie_aironet(proto_item * aironet_item, proto_tree * ietree,
6323   tvbuff_t * tvb, int offset, guint32 tag_len)
6324 {
6325   guint8  type;
6326   int i;
6327   gboolean dont_change = FALSE; /* Don't change the IE item text to default */
6328
6329   type = tvb_get_guint8(tvb, offset);
6330   proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6331   offset += 1;
6332
6333   switch (type) {
6334   case AIRONET_IE_VERSION:
6335     proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_version, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6336     proto_item_append_text(aironet_item, ": Aironet CCX version = %d",
6337     tvb_get_guint8(tvb, offset));
6338     dont_change = TRUE;
6339     break;
6340   case AIRONET_IE_QOS:
6341     proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_qos_unk1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6342     offset += 1;
6343     proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_qos_paramset, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6344     offset += 1;
6345
6346     /* XXX: just copied over from WME. Maybe "Best Effort" and "Background"
6347      *  need to be swapped. Also, the "TXOP" may be TXOP - or not.
6348      */
6349     for (i = 0; i < 4; i++) {
6350       guint8 byte1, byte2;
6351       guint16 txop;
6352       byte1 = tvb_get_guint8(tvb, offset);
6353       byte2 = tvb_get_guint8(tvb, offset + 1);
6354       txop = tvb_get_letohs(tvb, offset + 2);
6355       proto_tree_add_bytes_format(ietree, hf_ieee80211_aironet_ie_qos_val, tvb, offset, 4, NULL,
6356           "CCX QoS Parameters??: ACI %u (%s), Admission Control %sMandatory, AIFSN %u, ECWmin %u, ECWmax %u, TXOP %u",
6357         (byte1 & 0x60) >> 5, val_to_str((byte1 & 0x60) >> 5, wme_acs, "(Unknown: %d)"),
6358         (byte1 & 0x10) ? "" : "not ", byte1 & 0x0f,
6359         byte2 & 0x0f, (byte2 & 0xf0) >> 4,
6360         txop);
6361       offset += 4;
6362     }
6363     break;
6364   case AIRONET_IE_QBSS_V2:
6365     /* Extract Values */
6366     proto_tree_add_item (ietree, hf_ieee80211_qbss2_scount, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6367     proto_tree_add_item (ietree, hf_ieee80211_qbss2_cu, tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6368     proto_tree_add_item (ietree, hf_ieee80211_qbss2_cal, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6369     proto_tree_add_item (ietree, hf_ieee80211_qbss2_gl, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6370     break;
6371   default:
6372     proto_tree_add_item(ietree, hf_ieee80211_aironet_ie_data, tvb, offset,
6373       tag_len - 1, ENC_NA);
6374     break;
6375   }
6376   if (!dont_change) {
6377     proto_item_append_text(aironet_item, ": Aironet %s",
6378       val_to_str(type, aironet_ie_type_vals, "Unknown"));
6379   }
6380 }
6381
6382 /* 802.11e 7.3.2.33 QoS Capability element */
6383 static int dissect_qos_capability(proto_tree * tree, tvbuff_t * tvb, int offset, int ftype)
6384 {
6385   proto_item *cap_info_item;
6386   proto_tree *cap_info_tree;
6387
6388   cap_info_item = proto_tree_add_item(tree, hf_ieee80211_tag_qos_cap_qos_info, tvb, offset, 1, ENC_NA);
6389   cap_info_tree = proto_item_add_subtree(cap_info_item, ett_qos_info_field_tree);
6390   switch(ftype){
6391     case MGT_ASSOC_REQ:
6392     case MGT_PROBE_REQ:
6393     case MGT_REASSOC_REQ:
6394     {
6395       /* To AP so decode as STA: Figure 33h-QoS Info field when set by a non-AP QSTA */
6396       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_vo_uapsd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6397       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_vi_uapsd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6398       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_bk_uapsd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6399       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_be_uapsd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6400       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_qack, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6401       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_max_sp_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6402       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_more_data_ack, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6403       break;
6404     }
6405     case MGT_BEACON:
6406     case MGT_PROBE_RESP:
6407     case MGT_ASSOC_RESP:
6408     case MGT_REASSOC_RESP:
6409     {
6410       /* From AP so decode as AP: Figure 33g-QoS Info field when sent by a QAP */
6411       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_edca_upd_cnt, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6412       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_qack, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6413       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_queue_req, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6414       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_txop_req, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6415       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_reserved, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6416       break;
6417     }
6418     default:
6419         expert_add_info_format(g_pinfo, cap_info_item, PI_UNDECODED, PI_WARN, "Could not deduce direction to decode correctly, ftype %u", ftype);
6420       break;
6421   }
6422
6423   return offset + 1;
6424 }
6425
6426 /* 7.3.2.25 RSN information element */
6427 static int
6428 dissect_rsn_ie(proto_tree * tree, tvbuff_t * tvb, int offset, guint32 tag_len)
6429 {
6430   proto_item *rsn_gcs_item, *rsn_pcs_item, *rsn_akms_item, *rsn_cap_item, *rsn_pmkid_item, *rsn_gmcs_item;
6431   proto_item *rsn_sub_pcs_item, *rsn_sub_akms_item;
6432   proto_tree *rsn_gcs_tree, *rsn_pcs_tree, *rsn_akms_tree, *rsn_cap_tree, *rsn_pmkid_tree, *rsn_gmcs_tree;
6433   proto_tree *rsn_sub_pcs_tree, *rsn_sub_akms_tree;
6434   guint16 i, pcs_count, akms_count, pmkid_count;
6435   int tag_end = offset + tag_len;
6436
6437   proto_tree_add_item(tree, hf_ieee80211_rsn_version, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6438   offset += 2;
6439
6440   /* 7.3.2.25.1 Group Cipher suites */
6441   rsn_gcs_item = proto_tree_add_item(tree, hf_ieee80211_rsn_gcs, tvb, offset, 4, ENC_BIG_ENDIAN);
6442   rsn_gcs_tree = proto_item_add_subtree(rsn_gcs_item, ett_rsn_gcs_tree);
6443   proto_tree_add_item(rsn_gcs_tree, hf_ieee80211_rsn_gcs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
6444
6445     /* Check if OUI is 00:0F:AC (ieee80211) */
6446   if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
6447   {
6448     proto_tree_add_item(rsn_gcs_tree, hf_ieee80211_rsn_gcs_80211_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6449   } else {
6450     proto_tree_add_item(rsn_gcs_tree, hf_ieee80211_rsn_gcs_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6451   }
6452   offset += 4;
6453
6454   /* 7.3.2.25.2 Pairwise Cipher suites */
6455   proto_tree_add_item(tree, hf_ieee80211_rsn_pcs_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6456   pcs_count = tvb_get_letohs(tvb, offset);
6457   offset += 2;
6458
6459
6460   rsn_pcs_item = proto_tree_add_item(tree, hf_ieee80211_rsn_pcs_list, tvb, offset, pcs_count * 4, ENC_NA);
6461   rsn_pcs_tree = proto_item_add_subtree(rsn_pcs_item, ett_rsn_pcs_tree);
6462   for(i=1; i <= pcs_count; i++)
6463   {
6464     rsn_sub_pcs_item = proto_tree_add_item(rsn_pcs_tree, hf_ieee80211_rsn_pcs, tvb, offset, 4, ENC_BIG_ENDIAN);
6465     rsn_sub_pcs_tree = proto_item_add_subtree(rsn_sub_pcs_item, ett_rsn_sub_pcs_tree);
6466     proto_tree_add_item(rsn_sub_pcs_tree, hf_ieee80211_rsn_pcs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
6467
6468     /* Check if OUI is 00:0F:AC (ieee80211) */
6469     if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
6470     {
6471       proto_tree_add_item(rsn_sub_pcs_tree, hf_ieee80211_rsn_pcs_80211_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
6472       proto_item_append_text(rsn_pcs_item, " %s", rsn_pcs_return(tvb_get_ntohl(tvb, offset)));
6473     } else {
6474       proto_tree_add_item(rsn_sub_pcs_tree, hf_ieee80211_rsn_pcs_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
6475     }
6476     offset += 4;
6477   }
6478
6479   /* 7.3.2.25.2 AKM suites */
6480   proto_tree_add_item(tree, hf_ieee80211_rsn_akms_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6481   akms_count = tvb_get_letohs(tvb, offset);
6482   offset += 2;
6483
6484   rsn_akms_item = proto_tree_add_item(tree, hf_ieee80211_rsn_akms_list, tvb, offset, akms_count * 4, ENC_NA);
6485   rsn_akms_tree = proto_item_add_subtree(rsn_akms_item, ett_rsn_akms_tree);
6486   for(i=1; i <= akms_count; i++)
6487   {
6488     rsn_sub_akms_item = proto_tree_add_item(rsn_akms_tree, hf_ieee80211_rsn_akms, tvb, offset, 4, ENC_BIG_ENDIAN);
6489     rsn_sub_akms_tree = proto_item_add_subtree(rsn_sub_akms_item, ett_rsn_sub_akms_tree);
6490     proto_tree_add_item(rsn_sub_akms_tree, hf_ieee80211_rsn_akms_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
6491
6492     /* Check if OUI is 00:0F:AC (ieee80211) */
6493     if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
6494     {
6495       proto_tree_add_item(rsn_sub_akms_tree, hf_ieee80211_rsn_akms_80211_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
6496       proto_item_append_text(rsn_akms_item, " %s", rsn_akms_return(tvb_get_ntohl(tvb, offset)));
6497     } else {
6498       proto_tree_add_item(rsn_sub_akms_tree, hf_ieee80211_rsn_akms_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
6499     }
6500     offset += 4;
6501   }
6502
6503   /* 7.3.2.25.3 RSN capabilities */
6504   rsn_cap_item = proto_tree_add_item(tree, hf_ieee80211_rsn_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6505   rsn_cap_tree = proto_item_add_subtree(rsn_cap_item, ett_rsn_cap_tree);
6506
6507   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_preauth, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6508   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_no_pairwise, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6509   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_ptksa_replay_counter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6510   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_gtksa_replay_counter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6511   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_mfpr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6512   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_mfpc, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6513   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_peerkey, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6514   offset += 2;
6515   if(offset >= tag_end)
6516   {
6517     return offset;
6518   }
6519   /* 7.3.2.25.4 PMKID */
6520   proto_tree_add_item(tree, hf_ieee80211_rsn_pmkid_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6521   pmkid_count = tvb_get_letohs(tvb, offset);
6522   offset += 2;
6523
6524   rsn_pmkid_item = proto_tree_add_item(tree, hf_ieee80211_rsn_pmkid_list, tvb, offset, pmkid_count * 16, ENC_NA);
6525   rsn_pmkid_tree = proto_item_add_subtree(rsn_pmkid_item, ett_rsn_pmkid_tree);
6526   for(i=1; i <= pmkid_count; i++)
6527   {
6528     proto_tree_add_item(rsn_pmkid_tree, hf_ieee80211_rsn_pmkid, tvb, offset, 16, ENC_NA);
6529     offset +=16;
6530   }
6531
6532   if(offset >= tag_end)
6533   {
6534     return offset;
6535   }
6536   /* Group Management Cipher Suite (802.11w)*/
6537   rsn_gmcs_item = proto_tree_add_item(tree, hf_ieee80211_rsn_gmcs, tvb, offset, 4, ENC_BIG_ENDIAN);
6538   rsn_gmcs_tree = proto_item_add_subtree(rsn_gmcs_item, ett_rsn_gmcs_tree);
6539   proto_tree_add_item(rsn_gmcs_tree, hf_ieee80211_rsn_gmcs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
6540   /* Check if OUI is 00:0F:AC (ieee80211) */
6541   if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
6542   {
6543     proto_tree_add_item(rsn_gmcs_tree, hf_ieee80211_rsn_gmcs_80211_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6544   } else {
6545     proto_tree_add_item(rsn_gmcs_tree, hf_ieee80211_rsn_gmcs_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6546   }
6547   offset += 4;
6548
6549   return offset;
6550 }
6551
6552 static void
6553 dissect_mobility_domain(proto_tree *tree, tvbuff_t *tvb, int offset,
6554                         guint32 tag_len)
6555 {
6556   if (tag_len < 3) {
6557     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6558                           "MDIE content length must be at least 3 bytes");
6559     return;
6560   }
6561
6562   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_mdid,
6563                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6564   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_ft_capab,
6565                       tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6566   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_ft_capab_ft_over_ds,
6567                       tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6568   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_ft_capab_resource_req,
6569                       tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6570 }
6571
6572 static void
6573 dissect_fast_bss_transition(proto_tree *tree, tvbuff_t *tvb, int offset,
6574                             guint32 tag_len)
6575 {
6576   int end = offset + tag_len;
6577   if (tag_len < 82) {
6578     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6579                           "FTIE content length must be at least 82 bytes");
6580     return;
6581   }
6582
6583   proto_tree_add_item(tree, hf_ieee80211_tag_ft_mic_control,
6584                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6585   proto_tree_add_item(tree, hf_ieee80211_tag_ft_element_count,
6586                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6587   offset += 2;
6588   proto_tree_add_item(tree, hf_ieee80211_tag_ft_mic,
6589                       tvb, offset, 16, ENC_NA);
6590   offset += 16;
6591   proto_tree_add_item(tree, hf_ieee80211_tag_ft_anonce,
6592                       tvb, offset, 32, ENC_NA);
6593   offset += 32;
6594   proto_tree_add_item(tree, hf_ieee80211_tag_ft_snonce,
6595                       tvb, offset, 32, ENC_NA);
6596   offset += 32;
6597
6598   while (offset + 2 <= end) {
6599     guint8 id, len;
6600     int s_end;
6601     proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_id,
6602                         tvb, offset, 1, ENC_BIG_ENDIAN);
6603     id = tvb_get_guint8(tvb, offset);
6604     offset++;
6605
6606     proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_len,
6607                         tvb, offset, 1, ENC_BIG_ENDIAN);
6608     len = tvb_get_guint8(tvb, offset);
6609     offset++;
6610
6611     if (offset + len > end) {
6612       proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset,
6613                             end - offset, "Invalid FTIE subelement");
6614       return;
6615     }
6616
6617     s_end = offset + len;
6618     switch (id) {
6619     case 1:
6620       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_r1kh_id,
6621                           tvb, offset, len, ENC_NA);
6622       break;
6623     case 2:
6624       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key_info,
6625                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
6626       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key_id,
6627                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
6628       offset += 2;
6629       if (offset > s_end)
6630         break;
6631       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key_length,
6632                           tvb, offset, 1, ENC_BIG_ENDIAN);
6633       offset++;
6634       if (offset > s_end)
6635         break;
6636       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_rsc,
6637                           tvb, offset, 8, ENC_NA);
6638       offset += 8;
6639       if (offset > s_end)
6640         break;
6641       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key,
6642                           tvb, offset, s_end - offset, ENC_NA);
6643       break;
6644     case 3:
6645       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_r0kh_id,
6646                           tvb, offset, len, ENC_ASCII|ENC_NA);
6647       break;
6648     case 4:
6649       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_key_id,
6650                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
6651       offset += 2;
6652       if (offset > s_end)
6653         break;
6654       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_ipn,
6655                           tvb, offset, 6, ENC_NA);
6656       offset += 6;
6657       if (offset > s_end)
6658         break;
6659       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_key_length,
6660                           tvb, offset, 1, ENC_BIG_ENDIAN);
6661       offset++;
6662       if (offset > s_end)
6663         break;
6664       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_key,
6665                           tvb, offset, 24, ENC_NA);
6666       break;
6667     default:
6668       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_data,
6669                           tvb, offset, len, ENC_NA);
6670       break;
6671     }
6672     offset = s_end;
6673   }
6674 }
6675
6676 static void
6677 dissect_mmie(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 tag_len)
6678 {
6679   if (tag_len < 16) {
6680     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6681                           "MMIE content length must be at least 16 bytes");
6682     return;
6683   }
6684
6685   proto_tree_add_item(tree, hf_ieee80211_tag_mmie_keyid, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6686   proto_tree_add_item(tree, hf_ieee80211_tag_mmie_ipn, tvb, offset + 2, 6,
6687                       ENC_NA);
6688   proto_tree_add_item(tree, hf_ieee80211_tag_mmie_mic, tvb, offset + 8, 8,
6689                       ENC_NA);
6690 }
6691
6692 static void
6693 dissect_link_identifier(proto_tree *tree, tvbuff_t *tvb, int offset,
6694                         guint32 tag_len)
6695 {
6696   if (tag_len < 18) {
6697     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6698                           "Link Identifier content length must be at least "
6699                           "18 bytes");
6700     return;
6701   }
6702
6703   proto_tree_add_item(tree, hf_ieee80211_tag_link_id_bssid, tvb,
6704                       offset, 6, ENC_NA);
6705   proto_tree_add_item(tree, hf_ieee80211_tag_link_id_init_sta, tvb,
6706                       offset + 6, 6, ENC_NA);
6707   proto_tree_add_item(tree, hf_ieee80211_tag_link_id_resp_sta, tvb,
6708                       offset + 12, 6, ENC_NA);
6709 }
6710
6711 static void
6712 dissect_wakeup_schedule(proto_tree *tree, tvbuff_t *tvb, int offset,
6713                         guint32 tag_len)
6714 {
6715   if (tag_len < 18) {
6716     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6717                           "Wakeup Schedule content length must be at least "
6718                           "18 bytes");
6719     return;
6720   }
6721
6722   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_offset, tvb,
6723                       offset, 4, ENC_LITTLE_ENDIAN);
6724   offset += 4;
6725
6726   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_interval, tvb,
6727                       offset, 4, ENC_LITTLE_ENDIAN);
6728   offset += 4;
6729
6730   proto_tree_add_item(tree,
6731                       hf_ieee80211_tag_wakeup_schedule_awake_window_slots, tvb,
6732                       offset, 4, ENC_LITTLE_ENDIAN);
6733   offset += 4;
6734
6735   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_max_awake_dur,
6736                       tvb, offset, 4, ENC_LITTLE_ENDIAN);
6737   offset += 4;
6738
6739   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_idle_count, tvb,
6740                       offset, 2, ENC_LITTLE_ENDIAN);
6741 }
6742
6743 static void
6744 dissect_channel_switch_timing(proto_tree *tree, tvbuff_t *tvb, int offset,
6745                               guint32 tag_len)
6746 {
6747   if (tag_len < 4) {
6748     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6749                           "Channel Switch Timing content length must be at "
6750                           "least 4 bytes");
6751     return;
6752   }
6753
6754   proto_tree_add_item(tree, hf_ieee80211_tag_channel_switch_timing_switch_time,
6755                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6756   offset += 2;
6757
6758   proto_tree_add_item(tree,
6759                       hf_ieee80211_tag_channel_switch_timing_switch_timeout,
6760                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6761 }
6762
6763 static void
6764 dissect_pti_control(proto_tree *tree, tvbuff_t *tvb, int offset,
6765                     guint32 tag_len)
6766 {
6767   if (tag_len < 3) {
6768     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6769                           "PTI Control content length must be at least "
6770                           "3 bytes");
6771     return;
6772   }
6773
6774   proto_tree_add_item(tree, hf_ieee80211_tag_pti_control_tid, tvb,
6775                       offset, 1, ENC_BIG_ENDIAN);
6776   offset++;
6777
6778   proto_tree_add_item(tree, hf_ieee80211_tag_pti_control_sequence_control, tvb,
6779                       offset, 2, ENC_LITTLE_ENDIAN);
6780 }
6781
6782 static void
6783 dissect_pu_buffer_status(proto_tree *tree, tvbuff_t *tvb, int offset,
6784                          guint32 tag_len)
6785 {
6786   if (tag_len < 1) {
6787     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6788                           "PU Buffer Status content length must be at least "
6789                           "1 byte");
6790     return;
6791   }
6792
6793   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_bk, tvb,
6794                       offset, 1, ENC_BIG_ENDIAN);
6795   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_be, tvb,
6796                       offset, 1, ENC_BIG_ENDIAN);
6797   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_vi, tvb,
6798                       offset, 1, ENC_BIG_ENDIAN);
6799   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_vo, tvb,
6800                       offset, 1, ENC_BIG_ENDIAN);
6801 }
6802
6803 static void
6804 dissect_timeout_interval(proto_tree *tree, tvbuff_t *tvb, int offset,
6805                          guint32 tag_len)
6806 {
6807   proto_item *pi;
6808
6809   pi = proto_tree_add_item(tree, hf_ieee80211_tag_timeout_int_type, tvb,
6810                            offset, 1, ENC_BIG_ENDIAN);
6811   if (tag_len < 5) {
6812     expert_add_info_format(g_pinfo, pi, PI_MALFORMED, PI_ERROR,
6813                            "Timeout Interval content length must be at least "
6814                           "5 bytes");
6815     return;
6816   }
6817
6818   proto_tree_add_item(tree, hf_ieee80211_tag_timeout_int_value, tvb,
6819                       offset + 1, 4, ENC_LITTLE_ENDIAN);
6820 }
6821
6822 static void
6823 dissect_mcs_set(proto_tree *tree, tvbuff_t *tvb, int offset, gboolean basic, gboolean vs) {
6824   proto_item *ti;
6825   proto_tree *mcs_tree, *bit_tree;
6826   guint16 capability;
6827
6828   /* 16 byte Supported MCS set */
6829   if(vs)
6830   {
6831     ti = proto_tree_add_string(tree, hf_ieee80211_mcsset_vs, tvb, offset, 16,
6832       basic ? "Basic MCS Set" : "MCS Set");
6833   }else
6834   {
6835     ti = proto_tree_add_string(tree, hf_ieee80211_mcsset, tvb, offset, 16,
6836       basic ? "Basic MCS Set" : "MCS Set");
6837   }
6838   mcs_tree = proto_item_add_subtree(ti, ett_mcsset_tree);
6839
6840   /* Rx MCS Bitmask */
6841   ti = proto_tree_add_string(mcs_tree, hf_ieee80211_tag_interpretation, tvb, offset,
6842       10, "Rx Modulation and Coding Scheme (One bit per modulation)");
6843   bit_tree = proto_item_add_subtree(ti, ett_mcsbit_tree);
6844
6845   /* Bits 0 - 31 */
6846   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_0to7, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6847   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_8to15, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6848   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_16to23, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6849   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_24to31, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6850
6851   /* Bits 32 - 52 */
6852   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_32, tvb, offset + 4, 4, ENC_LITTLE_ENDIAN);
6853   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_33to38, tvb, offset + 4, 4, ENC_LITTLE_ENDIAN);
6854   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_39to52, tvb, offset + 4, 4, ENC_LITTLE_ENDIAN);
6855
6856   /* Bits 53 - 76 */
6857   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_53to76, tvb, offset + 6, 4, ENC_LITTLE_ENDIAN);
6858
6859   capability = tvb_get_letohs (tvb, offset+10);
6860   proto_tree_add_uint_format(mcs_tree, hf_ieee80211_mcsset_highest_data_rate, tvb, offset + 10, 2,
6861       capability, "Highest Supported Data Rate: 0x%04X", capability);
6862   capability = tvb_get_letohs (tvb, offset+12);
6863   proto_tree_add_boolean(mcs_tree, hf_ieee80211_mcsset_tx_mcs_set_defined, tvb, offset + 12, 1,
6864       capability);
6865   proto_tree_add_boolean(mcs_tree, hf_ieee80211_mcsset_tx_rx_mcs_set_not_equal, tvb, offset + 12, 1,
6866       capability);
6867   proto_tree_add_uint(mcs_tree, hf_ieee80211_mcsset_tx_max_spatial_streams, tvb, offset + 12, 1,
6868       capability);
6869   proto_tree_add_boolean(mcs_tree, hf_ieee80211_mcsset_tx_unequal_modulation, tvb, offset + 12, 1,
6870       capability);
6871 }
6872
6873 /*  802.11n D1.10 - HT Information IE  */
6874 static void
6875 dissect_ht_info_ie_1_1(proto_tree * tree, tvbuff_t * tvb, int offset,
6876          guint32 tag_len)
6877 {
6878   proto_item *cap_item;
6879   proto_tree *cap_tree;
6880   guint32 tag_val_init_off = 0;
6881   guint16 info = 0;
6882
6883   tag_val_init_off = offset;
6884   cap_tree = tree;
6885
6886   if (tag_len < 22) {
6887     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6888               "HT Information IE content length must be at least 22 bytes");
6889     return;
6890   }
6891
6892
6893   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_primary_channel, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6894
6895   info = tvb_get_guint8 (tvb, ++offset);
6896   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_ht_info_delimiter1, tvb,
6897                     offset, 1, info,
6898                     "HT Information Subset (1 of 3): 0x%02X", info);
6899   cap_tree = proto_item_add_subtree(cap_item, ett_ht_info_delimiter1_tree);
6900   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_secondary_channel_offset, tvb, offset, 1,
6901              info);
6902   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_channel_width, tvb, offset, 1,
6903              info);
6904   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_rifs_mode, tvb, offset, 1,
6905              info);
6906   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_psmp_stas_only, tvb, offset, 1,
6907              info);
6908   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_service_interval_granularity, tvb, offset, 1,
6909              info);
6910
6911   info = tvb_get_letohs (tvb, ++offset);
6912   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_ht_info_delimiter2, tvb,
6913                     offset, 2, info,
6914                     "HT Information Subset (2 of 3): 0x%04X", info);
6915   cap_tree = proto_item_add_subtree(cap_item, ett_ht_info_delimiter2_tree);
6916   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_operating_mode, tvb, offset, 1,
6917              info);
6918   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_non_greenfield_sta_present, tvb, offset, 1,
6919              info);
6920   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_transmit_burst_limit, tvb, offset, 1,
6921              info);
6922   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_obss_non_ht_stas_present, tvb, offset, 1,
6923              info);
6924   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_reserved_1, tvb, offset, 2,
6925              info);
6926
6927   offset += 2;
6928   info = tvb_get_letohs (tvb, offset);
6929   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_ht_info_delimiter3, tvb,
6930                     offset, 2, info,
6931                     "HT Information Subset (3 of 3): 0x%04X", info);
6932   cap_tree = proto_item_add_subtree(cap_item, ett_ht_info_delimiter3_tree);
6933   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_reserved_2, tvb, offset, 1,
6934              info);
6935   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_dual_beacon, tvb, offset, 1,
6936              info);
6937   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_dual_cts_protection, tvb, offset, 1,
6938              info);
6939   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_secondary_beacon, tvb, offset+1, 1,
6940              info);
6941   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_lsig_txop_protection_full_support, tvb, offset+1, 1,
6942              info);
6943   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_pco_active, tvb, offset+1, 1,
6944              info);
6945   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_info_pco_phase, tvb, offset+1, 1,
6946              info);
6947   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_info_reserved_3, tvb, offset+1, 1,
6948              info);
6949
6950   offset += 2;
6951   cap_tree = tree;
6952
6953   dissect_mcs_set(cap_tree, tvb, offset, TRUE, FALSE);
6954   offset += 16;
6955
6956   if (tag_val_init_off - offset < tag_len){
6957     proto_tree_add_string(cap_tree, hf_ieee80211_tag_interpretation, tvb, offset,
6958        tag_len + tag_val_init_off - offset, "Unparsed Extra Data");
6959   }
6960 }
6961
6962 static const value_string time_adv_timing_capab_vals[] = {
6963   { 0, "No standardized external time source" },
6964   { 1, "Timestamp offset based on UTC" },
6965   { 2, "UTC time at which the TSF timer is 0" },
6966   { 0, NULL }
6967 };
6968
6969 static int dissect_time_adv(proto_tree *tree, tvbuff_t *tvb, int offset)
6970 {
6971   guint8 capab;
6972   proto_item *item;
6973   proto_tree *subtree;
6974   struct tm tm, *now;
6975   time_t t;
6976
6977   capab = tvb_get_guint8(tvb, offset);
6978   proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_timing_capab,
6979                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
6980   offset++;
6981
6982   switch (capab) {
6983   case 1:
6984     proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_value,
6985                         tvb, offset, 10, ENC_NA);
6986     offset += 10;
6987
6988     proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_error,
6989                         tvb, offset, 5, ENC_NA);
6990     offset += 5;
6991     break;
6992   case 2:
6993     item = proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_value,
6994                                tvb, offset, 10, ENC_NA);
6995     subtree = proto_item_add_subtree(item, ett_tag_time_adv_tree);
6996     memset(&tm, 0, sizeof(tm));
6997     tm.tm_year = tvb_get_letohs(tvb, offset) - 1900;
6998     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_year,
6999                         tvb, offset, 2, ENC_LITTLE_ENDIAN);
7000     offset += 2;
7001     tm.tm_mon = tvb_get_guint8(tvb, offset) - 1;
7002     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_month,
7003                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7004     offset++;
7005     tm.tm_mday = tvb_get_guint8(tvb, offset);
7006     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_day,
7007                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7008     offset++;
7009     tm.tm_hour = tvb_get_guint8(tvb, offset);
7010     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_hours,
7011                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7012     offset++;
7013     tm.tm_min = tvb_get_guint8(tvb, offset);
7014     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_minutes,
7015                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7016     offset++;
7017     tm.tm_sec = tvb_get_guint8(tvb, offset);
7018     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_seconds,
7019                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7020     offset++;
7021     proto_tree_add_item(subtree,
7022                         hf_ieee80211_tag_time_adv_time_value_milliseconds,
7023                         tvb, offset, 2, ENC_LITTLE_ENDIAN);
7024     offset += 2;
7025     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_reserved,
7026                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7027     offset++;
7028
7029     tm.tm_isdst = -1;
7030     t = mktime(&tm);
7031     if (t != -1) {
7032       t += last_timestamp / 1000000;
7033       now = localtime(&t);
7034       if (now)
7035         proto_item_append_text(item,
7036                                ": current time=%u-%02u-%02u %02u:%02u:%02u",
7037                                now->tm_year + 1900, now->tm_mon + 1,
7038                                now->tm_mday, now->tm_hour, now->tm_min,
7039                                now->tm_sec);
7040     }
7041
7042     proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_error,
7043                         tvb, offset, 5, ENC_NA);
7044     offset += 5;
7045
7046     proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_update_counter,
7047                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7048     offset++;
7049     break;
7050   }
7051
7052   return offset;
7053 }
7054
7055 static int dissect_time_zone(proto_tree *tree, tvbuff_t *tvb, int offset,
7056                              guint32 tag_len)
7057 {
7058   proto_tree_add_item(tree, hf_ieee80211_tag_time_zone, tvb, offset, tag_len,
7059                       ENC_ASCII|ENC_NA);
7060   return offset + tag_len;
7061 }
7062
7063 static void secondary_channel_offset_ie(proto_tree * tree, tvbuff_t * tvb, int offset, guint32 tag_len)
7064 {
7065   int tag_offset;
7066
7067   if (tag_len != 1)
7068   {
7069     proto_tree_add_text (tree, tvb, offset, tag_len, "Secondary Channel Offset: Error: Tag length must be at least 1 byte long");
7070     return;
7071   }
7072
7073   tag_offset = offset;
7074   proto_tree_add_uint(tree, hf_ieee80211_tag_secondary_channel_offset, tvb, offset, 1, tvb_get_guint8 (tvb, offset));
7075
7076   offset++;
7077   if ((tag_len - (offset-tag_offset)) > 0)
7078   {
7079     proto_tree_add_text (tree, tvb, offset, tag_len - (offset-tag_offset), "Unknown Data");
7080     return;
7081   }
7082 }
7083
7084 static void
7085 dissect_ht_capability_ie(proto_tree * tree, tvbuff_t * tvb, int offset,
7086          guint32 tag_len, gboolean vs)
7087 {
7088   proto_item *cap_item;
7089   proto_tree *cap_tree;
7090   guint16 capability;
7091   guint32 txbfcap;
7092   guint32 tag_val_off = 0;
7093
7094   if (tag_val_off + 2 > tag_len) {
7095     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
7096         "Not interpreted");
7097     return;
7098   }
7099
7100   if (tag_len != 26) {
7101     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
7102               "HT Capabilities IE content length must be exactly 26 bytes");
7103     return;
7104   }
7105
7106   if (wlan_ignore_draft_ht && vs)
7107     return;
7108
7109   /* 2 byte HT Capabilities  Info*/
7110   capability = tvb_get_letohs (tvb, offset);
7111   if(vs)
7112   {
7113     cap_item = proto_tree_add_item(tree, hf_ieee80211_ht_vs_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7114   }
7115   else
7116   {
7117     cap_item = proto_tree_add_item(tree, hf_ieee80211_ht_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7118   }
7119   cap_tree = proto_item_add_subtree(cap_item, ett_ht_cap_tree);
7120   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_ldpc_coding, tvb, offset, 1,
7121              capability);
7122   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_chan_width, tvb, offset, 1,
7123              capability);
7124   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_sm_pwsave, tvb, offset, 1,
7125              capability);
7126   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_green, tvb, offset, 1,
7127              capability);
7128   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_short20, tvb, offset, 1,
7129              capability);
7130   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_short40, tvb, offset, 1,
7131              capability);
7132   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_tx_stbc, tvb, offset, 1,
7133              capability);
7134   proto_tree_add_uint(cap_tree, hf_ieee80211_ht_rx_stbc, tvb, offset+1, 1,
7135              capability);
7136   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_delayed_block_ack, tvb, offset+1, 1,
7137              capability);
7138   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_max_amsdu, tvb, offset+1, 1,
7139              capability);
7140   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_dss_cck_40, tvb, offset+1, 1,
7141              capability);
7142   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_psmp, tvb, offset+1, 1,
7143              capability);
7144   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_40_mhz_intolerant, tvb, offset+1, 1,
7145              capability);
7146   proto_tree_add_boolean(cap_tree, hf_ieee80211_ht_l_sig, tvb, offset+1, 1,
7147              capability);
7148
7149   offset += 2;
7150   tag_val_off += 2;
7151
7152   /* 1 byte A-MPDU Parameters */
7153   capability = tvb_get_guint8 (tvb, offset);
7154   if(vs)
7155   {
7156     cap_item = proto_tree_add_item(tree, hf_ieee80211_ampduparam_vs, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7157   }else
7158   {
7159     cap_item = proto_tree_add_item(tree, hf_ieee80211_ampduparam, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7160   }
7161   cap_tree = proto_item_add_subtree(cap_item, ett_ampduparam_tree);
7162   proto_tree_add_uint_format(cap_tree, hf_ieee80211_ampduparam_mpdu, tvb, offset, 1, capability,
7163                              "%sMaximum Rx A-MPDU Length: %04.0f [Bytes]",
7164                              decode_numeric_bitfield(capability, 0x03, 8, ""),
7165                              pow(2,13+(capability & 0x3))-1);
7166   proto_tree_add_uint(cap_tree, hf_ieee80211_ampduparam_mpdu_start_spacing, tvb, offset, 1, capability);
7167   proto_tree_add_uint(cap_tree, hf_ieee80211_ampduparam_reserved, tvb, offset, 1, capability);
7168   offset += 1;
7169   tag_val_off += 1;
7170
7171   /* 16 byte MCS set */
7172   dissect_mcs_set(tree, tvb, offset, FALSE, vs);
7173   offset += 16;
7174   tag_val_off += 16;
7175
7176   /* 2 byte HT Extended Capabilities */
7177   capability = tvb_get_letohs (tvb, offset);
7178   if(vs)
7179   {
7180     cap_item = proto_tree_add_item(tree, hf_ieee80211_htex_vs_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7181   } else {
7182     cap_item = proto_tree_add_item(tree, hf_ieee80211_htex_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7183   }
7184   cap_tree = proto_item_add_subtree(cap_item, ett_htex_cap_tree);
7185   proto_tree_add_boolean(cap_tree, hf_ieee80211_htex_pco, tvb, offset, 1,
7186              capability);
7187   proto_tree_add_uint(cap_tree, hf_ieee80211_htex_transtime, tvb, offset, 1,
7188              capability);
7189   proto_tree_add_uint(cap_tree, hf_ieee80211_htex_mcs, tvb, offset+1, 1,
7190              capability);
7191   proto_tree_add_boolean(cap_tree, hf_ieee80211_htex_htc_support, tvb, offset+1, 1,
7192              capability);
7193   proto_tree_add_boolean(cap_tree, hf_ieee80211_htex_rd_responder, tvb, offset+1, 1,
7194              capability);
7195
7196   offset += 2;
7197   tag_val_off += 2;
7198
7199   /* 4 byte TxBF capabilities */
7200   txbfcap = tvb_get_letohl (tvb, offset);
7201   if(vs)
7202   {
7203     cap_item = proto_tree_add_item(tree, hf_ieee80211_txbf_vs, tvb, offset, 4, ENC_LITTLE_ENDIAN);
7204   } else {
7205     cap_item = proto_tree_add_item(tree, hf_ieee80211_txbf, tvb, offset, 4, ENC_LITTLE_ENDIAN);
7206   }
7207   cap_tree = proto_item_add_subtree(cap_item, ett_txbf_tree);
7208   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_cap, tvb, offset, 1,
7209              txbfcap);
7210   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_rcv_ssc, tvb, offset, 1,
7211              txbfcap);
7212   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_tx_ssc, tvb, offset, 1,
7213              txbfcap);
7214   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_rcv_ndp, tvb, offset, 1,
7215              txbfcap);
7216   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_tx_ndp, tvb, offset, 1,
7217              txbfcap);
7218   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_impl_txbf, tvb, offset, 1,
7219              txbfcap);
7220   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_calib, tvb, offset, 1,
7221              txbfcap);
7222   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_expl_csi, tvb, offset+1, 1,
7223              txbfcap);
7224   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_expl_uncomp_fm, tvb, offset+1, 1,
7225              txbfcap);
7226   proto_tree_add_boolean(cap_tree, hf_ieee80211_txbf_expl_comp_fm, tvb, offset+1, 1,
7227              txbfcap);
7228   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_expl_bf_csi, tvb, offset+1, 1,
7229              txbfcap);
7230   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_expl_uncomp_fm_feed, tvb, offset+1, 1,
7231              txbfcap);
7232   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_expl_comp_fm_feed, tvb, offset+1, 2,
7233              txbfcap);
7234   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_min_group, tvb, offset+2, 1,
7235              txbfcap);
7236   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_csi_num_bf_ant, tvb, offset+2, 1,
7237              txbfcap);
7238   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_uncomp_sm_bf_ant, tvb, offset+2, 1,
7239              txbfcap);
7240   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_comp_sm_bf_ant, tvb, offset+2, 2,
7241              txbfcap);
7242   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_csi_max_rows_bf, tvb, offset+3, 1,
7243              txbfcap);
7244   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_chan_est, tvb, offset+3, 1,
7245              txbfcap);
7246   proto_tree_add_uint(cap_tree, hf_ieee80211_txbf_resrv, tvb, offset+3, 1,
7247              txbfcap);
7248
7249   offset += 4;
7250   tag_val_off += 4;
7251
7252   /* 1 byte Antenna Selection (ASEL) capabilities */
7253   capability = tvb_get_guint8 (tvb, offset);
7254   if(vs)
7255   {
7256     cap_item = proto_tree_add_item(tree, hf_ieee80211_antsel_vs, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7257   }
7258   else
7259   {
7260     cap_item = proto_tree_add_item(tree, hf_ieee80211_antsel, tvb,  offset, 1, ENC_LITTLE_ENDIAN);
7261   }
7262   cap_tree = proto_item_add_subtree(cap_item, ett_antsel_tree);
7263   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b0, tvb, offset, 1,
7264              capability);
7265   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b1, tvb, offset, 1,
7266              capability);
7267   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b2, tvb, offset, 1,
7268              capability);
7269   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b3, tvb, offset, 1,
7270              capability);
7271   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b4, tvb, offset, 1,
7272              capability);
7273   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b5, tvb, offset, 1,
7274              capability);
7275   proto_tree_add_boolean(cap_tree, hf_ieee80211_antsel_b6, tvb, offset, 1,
7276              capability);
7277   proto_tree_add_uint(cap_tree, hf_ieee80211_antsel_b7, tvb, offset, 1,
7278              capability);
7279
7280   offset += 1;
7281   tag_val_off += 1;
7282 }
7283
7284 static void
7285 dissect_ht_info_ie_1_0(proto_tree * tree, tvbuff_t * tvb, int offset,
7286          guint32 tag_len)
7287 {
7288   proto_item *cap_item;
7289   proto_tree *cap_tree;
7290   guint16 capability;
7291   guint32 tag_val_off = 0;
7292   gchar out_buff[SHORT_STR];
7293
7294   if (tag_val_off + 2 > tag_len) {
7295     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
7296         "Not interpreted");
7297     return;
7298   }
7299
7300   if (tag_len < 22) {
7301     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
7302               "HT Additional Capabilities IE content length must be 22");
7303     return;
7304   }
7305
7306   if (wlan_ignore_draft_ht)
7307     return;
7308
7309   g_snprintf(out_buff, SHORT_STR, "Control Channel %d",
7310              tvb_get_guint8(tvb, offset));
7311   proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, 1, out_buff);
7312   offset += 1;
7313   tag_val_off += 1;
7314
7315   /* 1 byte HT additional capabilities */
7316   capability = tvb_get_guint8 (tvb, offset);
7317   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_hta_cap, tvb,
7318                     offset, 1, capability,
7319                     "HT Additional Capabilities: 0x%04X", capability);
7320   cap_tree = proto_item_add_subtree(cap_item, ett_hta_cap_tree);
7321   proto_tree_add_uint(cap_tree, hf_ieee80211_hta_ext_chan_offset, tvb, offset, 1,
7322              capability);
7323   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_rec_tx_width, tvb, offset, 1,
7324              capability);
7325   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_rifs_mode, tvb, offset, 1,
7326              capability);
7327   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_controlled_access, tvb, offset, 1,
7328              capability);
7329   proto_tree_add_uint(cap_tree, hf_ieee80211_hta_service_interval, tvb, offset, 1,
7330              capability);
7331   offset += 1;
7332   tag_val_off += 1;
7333
7334   /* 2 byte HT additional capabilities */
7335   capability = tvb_get_letohs (tvb, offset);
7336   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_hta_cap, tvb,
7337                     offset, 2, capability,
7338                     "HT Additional Capabilities: 0x%04X", capability);
7339   cap_tree = proto_item_add_subtree(cap_item, ett_hta_cap1_tree);
7340   proto_tree_add_uint(cap_tree, hf_ieee80211_hta_operating_mode, tvb, offset, 2,
7341              capability);
7342   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_non_gf_devices, tvb, offset, 2,
7343              capability);
7344
7345   offset += 2;
7346   tag_val_off += 2;
7347
7348   /* 2 byte HT additional capabilities */
7349   capability = tvb_get_letohs (tvb, offset);
7350   cap_item = proto_tree_add_uint_format(tree, hf_ieee80211_hta_cap, tvb,
7351                     offset, 2, capability,
7352                     "HT Additional Capabilities: 0x%04X", capability);
7353   cap_tree = proto_item_add_subtree(cap_item, ett_hta_cap2_tree);
7354   proto_tree_add_uint(cap_tree, hf_ieee80211_hta_basic_stbc_mcs, tvb, offset, 2,
7355              capability);
7356   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_dual_stbc_protection, tvb, offset, 2,
7357              capability);
7358   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_secondary_beacon, tvb, offset, 2,
7359              capability);
7360   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_lsig_txop_protection, tvb, offset, 2,
7361              capability);
7362   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_pco_active, tvb, offset, 2,
7363              capability);
7364   proto_tree_add_boolean(cap_tree, hf_ieee80211_hta_pco_phase, tvb, offset, 2,
7365              capability);
7366   offset += 2;
7367   tag_val_off += 2;
7368
7369   /* 16 byte Supported MCS set */
7370   dissect_mcs_set(tree, tvb, offset, FALSE, TRUE);
7371   offset += 16;
7372   tag_val_off += 16;
7373
7374    if (tag_val_off < tag_len)
7375      proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset,
7376                tag_len - tag_val_off, "Not interpreted");
7377 }
7378
7379 /* 802.11n-D1.10 and 802.11n-D2.0, 7.1.3.5a */
7380
7381 /*
7382  * 7.1.3.1.10 says:
7383  * "The Order field is 1 bit in length and is set to 1 in any non-QoS Data
7384  * frame that contains an MSDU, or fragment thereof, which is being
7385  * transferred using the StrictlyOrdered service class. The presence of the
7386  * HT Control field in frames is indicated by setting the Order field to 1
7387  * in any Data type or Management type frame that  is transmitted with a
7388  * value of HT_GF or HT_MM for the FORMAT parameter of the TXVECTOR except
7389  * a non-QoS Data frame or a Control Wrapper frame. The Order field is set
7390  * to 0 in all other frames. All non-HT QoS STAs set the Order field to 0."
7391  *
7392  * ...so does this mean that we can check for the presence of +HTC by
7393  * looking for QoS frames with the Order bit set, or do we need extra
7394  * information from the PHY (which would be monumentally silly)?
7395  *
7396  * At any rate, it doesn't look like any equipment we have produces
7397  * +HTC frames, so the code is completely untested.
7398  */
7399
7400 static void
7401 dissect_ht_control(proto_tree *tree, tvbuff_t * tvb, int offset)
7402 {
7403   proto_item *ti;
7404   proto_tree *htc_tree, *lac_subtree;
7405   guint16 htc;
7406
7407   htc = tvb_get_letohs(tvb, offset);
7408
7409   ti = proto_tree_add_item(tree, hf_ieee80211_htc, tvb, offset, 4, ENC_LITTLE_ENDIAN);
7410   htc_tree = proto_item_add_subtree(ti, ett_htc_tree);
7411
7412   /* Start: Link Adaptation Control */
7413   ti = proto_tree_add_item(htc_tree, hf_ieee80211_htc_lac, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7414   lac_subtree = proto_item_add_subtree(ti, ett_htc_tree);
7415   proto_tree_add_boolean(lac_subtree, hf_ieee80211_htc_lac_reserved, tvb, offset, 1, htc);
7416   proto_tree_add_boolean(lac_subtree, hf_ieee80211_htc_lac_trq, tvb, offset, 1, htc);
7417
7418   if (HTC_IS_ASELI(htc)) {
7419     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mai_aseli, tvb, offset, 1, htc);
7420   } else {
7421     proto_tree_add_boolean(lac_subtree, hf_ieee80211_htc_lac_mai_mrq, tvb, offset, 1, htc);
7422     if (HTC_LAC_MAI_MRQ(htc)){
7423       proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mai_msi, tvb, offset, 1, htc);
7424     } else {
7425       proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mai_reserved, tvb, offset, 1, htc);
7426     }
7427   }
7428
7429   proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mfsi, tvb, offset, 2, htc);
7430   offset++;
7431
7432   if (HTC_IS_ASELI(htc)) {
7433     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_asel_command, tvb, offset, 1, htc);
7434     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_asel_data, tvb, offset, 1, htc);
7435   } else {
7436     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mfb, tvb, offset, 1, htc);
7437   }
7438   /* End: Link Adaptation Control */
7439
7440   offset++;
7441   htc = tvb_get_letohs(tvb, offset);
7442
7443   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_cal_pos, tvb, offset, 1, htc);
7444   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_cal_seq, tvb, offset, 1, htc);
7445   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_reserved1, tvb, offset, 1, htc);
7446   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_csi_steering, tvb, offset, 1, htc);
7447
7448   offset++;
7449   proto_tree_add_boolean(htc_tree, hf_ieee80211_htc_ndp_announcement, tvb, offset, 1, htc);
7450   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_reserved2, tvb, offset, 1, htc);
7451   proto_tree_add_boolean(htc_tree, hf_ieee80211_htc_ac_constraint, tvb, offset, 1, htc);
7452   proto_tree_add_boolean(htc_tree, hf_ieee80211_htc_rdg_more_ppdu, tvb, offset, 1, htc);
7453 }
7454
7455 static void
7456 dissect_frame_control(proto_tree * tree, tvbuff_t * tvb, gboolean wlan_broken_fc,
7457                       guint32 offset)
7458 {
7459   guint16 fcf, flags, frame_type_subtype;
7460   proto_tree *fc_tree, *flag_tree;
7461   proto_item *fc_item, *flag_item, *hidden_item;
7462
7463   fcf = FETCH_FCF(offset);
7464
7465   flags = FCF_FLAGS(fcf);
7466   frame_type_subtype = COMPOSE_FRAME_TYPE(fcf);
7467
7468   proto_tree_add_uint (tree, hf_ieee80211_fc_frame_type_subtype,
7469     tvb, wlan_broken_fc?offset+1:offset, 1,
7470     frame_type_subtype);
7471
7472   fc_item = proto_tree_add_uint_format (tree, hf_ieee80211_fc_field, tvb,
7473     offset, 2, fcf, "Frame Control: 0x%04X (%s)",
7474     fcf, wlan_broken_fc?"Swapped":"Normal");
7475
7476   fc_tree = proto_item_add_subtree (fc_item, ett_fc_tree);
7477
7478   proto_tree_add_uint (fc_tree, hf_ieee80211_fc_proto_version, tvb, wlan_broken_fc?offset+1:offset, 1,
7479     FCF_PROT_VERSION (fcf));
7480
7481   proto_tree_add_uint (fc_tree, hf_ieee80211_fc_frame_type, tvb, wlan_broken_fc?offset+1:offset, 1,
7482     FCF_FRAME_TYPE (fcf));
7483
7484   proto_tree_add_uint (fc_tree, hf_ieee80211_fc_frame_subtype, tvb, wlan_broken_fc?offset+1:offset, 1,
7485     FCF_FRAME_SUBTYPE (fcf));
7486
7487   flag_item = proto_tree_add_uint_format (fc_tree, hf_ieee80211_fc_flags, tvb,
7488     wlan_broken_fc?offset:offset+1, 1,
7489     flags, "Flags: 0x%X", flags);
7490
7491   flag_tree = proto_item_add_subtree (flag_item, ett_proto_flags);
7492   proto_tree_add_uint (flag_tree, hf_ieee80211_fc_data_ds, tvb, wlan_broken_fc?offset:offset+1, 1,
7493     FLAGS_DS_STATUS (flags));
7494   hidden_item = proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_to_ds, tvb, offset+1, 1, flags);
7495   PROTO_ITEM_SET_HIDDEN(hidden_item);
7496   hidden_item = proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_from_ds, tvb, offset+1, 1, flags);
7497   PROTO_ITEM_SET_HIDDEN(hidden_item);
7498   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_more_frag, tvb, wlan_broken_fc?offset:offset+1, 1,
7499     flags);
7500   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_retry, tvb, wlan_broken_fc?offset:offset+1, 1,
7501     flags);
7502   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_pwr_mgt, tvb, wlan_broken_fc?offset:offset+1, 1,
7503     flags);
7504   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_more_data, tvb, wlan_broken_fc?offset:offset+1, 1,
7505     flags);
7506   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_protected, tvb, wlan_broken_fc?offset:offset+1, 1,
7507     flags);
7508   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_order, tvb, wlan_broken_fc?offset:offset+1, 1,
7509     flags);
7510 }
7511
7512 static void
7513 dissect_vendor_ie_ht(proto_item * item, proto_tree * tree, tvbuff_t * tag_tvb)
7514 {
7515   gint tag_len = tvb_length(tag_tvb);
7516
7517   proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 0, 3, "802.11n (Pre) OUI");
7518   /* 802.11n OUI  Information Element */
7519   if (4 <= tag_len && !tvb_memeql(tag_tvb, 0, PRE_11N_OUI"\x33", 4)) {
7520     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 3, 1,"802.11n (Pre) HT information" );
7521
7522     dissect_ht_capability_ie(tree, tag_tvb, 4, tag_len - 4, TRUE);
7523     proto_item_append_text(item, ": HT Capabilities (802.11n D1.10)");
7524   }
7525   else {
7526     if (4 <= tag_len && !tvb_memeql(tag_tvb, 0, PRE_11N_OUI"\x34", 4)) {
7527       proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 3, 1, "HT additional information (802.11n D1.00)");
7528
7529       dissect_ht_info_ie_1_0(tree, tag_tvb, 4, tag_len - 4);
7530       proto_item_append_text(item, ": HT Additional Capabilities (802.11n D1.00)");
7531     }
7532     else {
7533         proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 3, 1, "Unknown type");
7534         proto_item_append_text(item, ": 802.11n (pre) Unknown type");
7535         proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 4,
7536                   tag_len - 4, "Not interpreted");
7537     }
7538   }
7539 }
7540
7541 static guint
7542 dissect_interworking(packet_info *pinfo, proto_tree *tree, proto_item *item,
7543                      tvbuff_t *tvb, int offset)
7544 {
7545   guint8 len;
7546
7547   offset++;
7548   len = tvb_get_guint8(tvb, offset);
7549   offset++;
7550
7551   if (tvb_reported_length_remaining(tvb, offset) < len || len == 0) {
7552     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7553                            "Truncated Interworking element");
7554     return offset;
7555   }
7556
7557   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_access_network_type,
7558                       tvb, offset, 1, ENC_BIG_ENDIAN);
7559   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_internet,
7560                       tvb, offset, 1, ENC_BIG_ENDIAN);
7561   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_asra,
7562                       tvb, offset, 1, ENC_BIG_ENDIAN);
7563   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_esr,
7564                       tvb, offset, 1, ENC_BIG_ENDIAN);
7565   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_uesa,
7566                       tvb, offset, 1, ENC_BIG_ENDIAN);
7567   offset++;
7568
7569   if (len == 1 + 2 || len == 1 + 2 + 6) {
7570     dissect_venue_info(tree, tvb, offset);
7571     offset += 2;
7572   }
7573
7574   if (len == 1 + 6 || len == 1 + 2 + 6) {
7575     proto_tree_add_item(tree, hf_ieee80211_tag_interworking_hessid,
7576                         tvb, offset, 6, ENC_NA);
7577     offset += 6;
7578   }
7579
7580   if (len != 1 && len != 1 + 2 && len != 1 + 6 && len != 1 + 2 + 6) {
7581     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7582                            "Invalid Interworking element length");
7583   }
7584
7585   return offset;
7586 }
7587
7588 static guint
7589 dissect_roaming_consortium(packet_info *pinfo, proto_tree *tree,
7590                            proto_item *item, tvbuff_t *tvb, int offset)
7591 {
7592   guint8 len, oi_lens, oi1_len, oi2_len;
7593   int end;
7594
7595   offset++;
7596   len = tvb_get_guint8(tvb, offset);
7597   offset++;
7598   end = offset + len;
7599
7600   if (tvb_reported_length_remaining(tvb, offset) < len || len < 2) {
7601     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7602                            "Truncated Roaming Consortium element");
7603     return 2 + len;
7604   }
7605
7606   proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_num_anqp_oi,
7607                       tvb, offset, 1, ENC_BIG_ENDIAN);
7608   offset++;
7609
7610   oi_lens = tvb_get_guint8(tvb, offset);
7611   oi1_len = oi_lens & 0x0f;
7612   oi2_len = (oi_lens & 0xf0) >> 4;
7613   proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi1_len,
7614                       tvb, offset, 1, ENC_BIG_ENDIAN);
7615   proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi2_len,
7616                       tvb, offset, 1, ENC_BIG_ENDIAN);
7617   offset++;
7618
7619   if (offset + oi1_len > end) {
7620     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7621                            "Truncated Roaming Consortium element");
7622     return 2 + len;
7623   }
7624
7625   item = proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi1,
7626                              tvb, offset, oi1_len, ENC_NA);
7627   add_manuf(item, tvb, offset);
7628   offset += oi1_len;
7629
7630   if (offset + oi2_len > end) {
7631     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7632                            "Truncated Roaming Consortium element");
7633     return 2 + len;
7634   }
7635
7636   if (oi2_len > 0) {
7637     proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi2,
7638                         tvb, offset, oi2_len, ENC_NA);
7639     offset += oi2_len;
7640   }
7641
7642   if (end > offset) {
7643     proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi3,
7644                         tvb, offset, end - offset, ENC_NA);
7645   }
7646
7647   return 2 + len;
7648 }
7649
7650
7651 /* ************************************************************************* */
7652 /*           Dissect and add tagged (optional) fields to proto tree          */
7653 /* ************************************************************************* */
7654
7655
7656 static int beacon_padding = 0; /* beacon padding bug */
7657
7658 static int ieee80211_tag_ssid(packet_info *pinfo, proto_tree *tree,
7659                               proto_item *ti, proto_item *ti_len,
7660                               guint32 tag_len, tvbuff_t *tvb, int offset)
7661 {
7662   /* 7.3.2.1 SSID element (0) */
7663   guint8 *ssid; /* The SSID may consist of arbitrary bytes */
7664
7665   if (beacon_padding != 0) /* padding bug */
7666     return offset;
7667
7668   if(tag_len > MAX_SSID_LEN) {
7669     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7670                            "SSID length (%u) greater than maximum (%u)",
7671                            tag_len, MAX_SSID_LEN);
7672   }
7673
7674   ssid = tvb_get_ephemeral_string(tvb, offset + 2, tag_len);
7675   AirPDcapSetLastSSID(&airpdcap_ctx, (CHAR *) ssid, tag_len);
7676   proto_tree_add_item(tree, hf_ieee80211_tag_ssid, tvb, offset + 2, tag_len,
7677                       ENC_ASCII|ENC_NA);
7678   if (tag_len > 0) {
7679     proto_item_append_text(ti, ": %s", ssid);
7680
7681     col_append_fstr(pinfo->cinfo, COL_INFO, ", SSID=%s", ssid);
7682
7683     /* Wlan Stats */
7684     memcpy(wlan_stats.ssid, ssid, MIN(tag_len, MAX_SSID_LEN));
7685     wlan_stats.ssid_len = tag_len;
7686   } else {
7687     proto_item_append_text(ti, ": Broadcast");
7688
7689     col_append_str(pinfo->cinfo, COL_INFO, ", SSID=Broadcast");
7690   }
7691
7692   beacon_padding++; /* padding bug */
7693
7694   return offset + 2 + tag_len;
7695 }
7696
7697 static int ieee80211_tag_supp_rates(packet_info *pinfo, proto_tree *tree,
7698                                     proto_item *ti, proto_item *ti_len,
7699                                     guint32 tag_len, tvbuff_t *tvb,
7700                                     int offset, int tag_end)
7701 {
7702   /* 7.3.2.2 Supported Rates element (1) */
7703   if (tag_len < 1) {
7704     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7705                            "Tag length %u too short, must be greater than 0",
7706                            tag_len);
7707     return offset;
7708   }
7709
7710   offset += 2;
7711
7712   while (offset < tag_end) {
7713     proto_tree_add_item(tree, hf_ieee80211_tag_supp_rates, tvb, offset, 1,
7714                         ENC_BIG_ENDIAN);
7715     proto_item_append_text(ti, " %s,",
7716                            val_to_str(tvb_get_guint8(tvb, offset),
7717                                       ieee80211_supported_rates_vals,
7718                                       "Unknown Rate") );
7719     offset++;
7720   }
7721
7722   proto_item_append_text(ti, " [Mbit/sec]");
7723
7724   return offset;
7725 }
7726
7727 static int ieee80211_tag_fh_parameter(packet_info *pinfo, proto_tree *tree,
7728                                       proto_item *ti_len, guint32 tag_len,
7729                                       tvbuff_t *tvb, int offset)
7730 {
7731   /* 7.3.2.3 FH Parameter Set element (2) */
7732   if (tag_len < 5) {
7733     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7734                            "Tag length %u too short, must be >= 5", tag_len);
7735     return offset;
7736   }
7737
7738   offset += 2;
7739
7740   proto_tree_add_item(tree, hf_ieee80211_tag_fh_dwell_time,
7741                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
7742   offset += 2;
7743
7744   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hop_set,
7745                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7746   offset++;
7747
7748   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hop_pattern,
7749                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7750   offset++;
7751
7752   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hop_index,
7753                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7754   offset++;
7755
7756   return offset;
7757 }
7758
7759 static int ieee80211_tag_ds_parameter(packet_info *pinfo, proto_tree *tree,
7760                                       proto_item *ti, proto_item *ti_len,
7761                                       guint32 tag_len, tvbuff_t *tvb,
7762                                       int offset)
7763 {
7764   /* 7.3.2.4 DS Parameter Set element (3) */
7765   if (tag_len != 1) {
7766     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7767                            "Tag length %u wrong, must be = 1", tag_len);
7768     return offset;
7769   }
7770
7771   offset += 2;
7772
7773   proto_tree_add_item(tree, hf_ieee80211_tag_ds_param_channel,
7774                       tvb, offset, 1, ENC_BIG_ENDIAN);
7775
7776   proto_item_append_text(ti, " : Current Channel: %u",
7777                          tvb_get_guint8(tvb, offset));
7778
7779   wlan_stats.channel = tvb_get_guint8(tvb, offset);
7780   offset++;
7781
7782   return offset;
7783 }
7784
7785 static int ieee80211_tag_cf_parameter(packet_info *pinfo, proto_tree *tree,
7786                                       proto_item *ti, proto_item *ti_len,
7787                                       guint32 tag_len, tvbuff_t *tvb,
7788                                       int offset)
7789 {
7790   /* 7.3.2.5 CF Parameter Set element (4) */
7791   if (tag_len != 6) {
7792     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7793                            "Tag length %u wrong, must be = 6", tag_len);
7794     return offset;
7795   }
7796
7797   offset += 2;
7798
7799   proto_tree_add_item(tree, hf_ieee80211_tag_cfp_count,
7800                       tvb, offset, 1, ENC_BIG_ENDIAN);
7801   proto_item_append_text(ti, ": CFP count %u", tvb_get_guint8(tvb, offset));
7802   offset++;
7803
7804   proto_tree_add_item(tree, hf_ieee80211_tag_cfp_period,
7805                       tvb, offset, 1, ENC_BIG_ENDIAN);
7806   proto_item_append_text(ti, ": CFP Period %u", tvb_get_guint8(tvb, offset));
7807   offset++;
7808
7809   proto_tree_add_item(tree, hf_ieee80211_tag_cfp_max_duration,
7810                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
7811   proto_item_append_text(ti, ": CFP Max Duration %u",
7812                          tvb_get_letohs(tvb, offset));
7813   offset += 2;
7814
7815   proto_tree_add_item(tree, hf_ieee80211_tag_cfp_dur_remaining,
7816                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
7817   proto_item_append_text(ti, ": CFP Dur Remaining %u",
7818                          tvb_get_letohs(tvb, offset));
7819   offset++;
7820
7821   return offset;
7822 }
7823
7824 static int ieee80211_tag_tim(packet_info *pinfo, proto_tree *tree,
7825                              proto_item *ti, proto_item *ti_len,
7826                              guint32 tag_len, tvbuff_t *tvb, int offset)
7827 {
7828   proto_tree *bmapctl_tree;
7829   proto_item *bmapctl_item;
7830
7831   /* 7.3.2.6 TIM (5) */
7832   if (tag_len < 4) {
7833     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7834                            "Tag length %u too short, must be >= 4", tag_len);
7835     return offset;
7836   }
7837
7838   offset += 2;
7839
7840   proto_tree_add_item(tree, hf_ieee80211_tim_dtim_count,
7841                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7842   proto_item_append_text(ti, ": DTIM %u of", tvb_get_guint8(tvb, offset));
7843   offset++;
7844
7845   proto_tree_add_item(tree, hf_ieee80211_tim_dtim_period,
7846                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7847   proto_item_append_text(ti, " %u bitmap", tvb_get_guint8(tvb, offset + 1));
7848   offset++;
7849
7850   bmapctl_item = proto_tree_add_item(tree, hf_ieee80211_tim_bmapctl,
7851                                      tvb, offset, 1, ENC_LITTLE_ENDIAN);
7852   bmapctl_tree = proto_item_add_subtree(bmapctl_item, ett_tag_bmapctl_tree);
7853   proto_tree_add_item(bmapctl_tree, hf_ieee80211_tim_bmapctl_mcast,
7854                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7855   proto_tree_add_item(bmapctl_tree, hf_ieee80211_tim_bmapctl_offset,
7856                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7857   offset++;
7858
7859   proto_tree_add_item(tree, hf_ieee80211_tim_partial_virtual_bitmap,
7860                       tvb, offset, tag_len - 3, ENC_NA);
7861   offset += tag_len - 3;
7862
7863   return offset;
7864 }
7865
7866 static int ieee80211_tag_ibss_parameter(packet_info *pinfo, proto_tree *tree,
7867                                         proto_item *ti, proto_item *ti_len,
7868                                         guint32 tag_len, tvbuff_t *tvb,
7869                                         int offset)
7870 {
7871   /* 7.3.2.7 IBSS Parameter Set element (6) */
7872
7873   if (tag_len != 2) {
7874     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7875                            "Tag length %u wrong, must be = 2", tag_len);
7876     return offset;
7877   }
7878
7879   offset += 2;
7880
7881   proto_tree_add_item(tree, hf_ieee80211_tag_ibss_atim_window,
7882                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
7883   proto_item_append_text(ti, ": ATIM window 0x%x",
7884                          tvb_get_letohs(tvb, offset));
7885   offset += 2;
7886
7887   return offset;
7888 }
7889
7890 static const value_string environment_vals[] = {
7891   { 0x20, "Any" },
7892   { 0x4f, "Outdoor" },
7893   { 0x49, "Indoor" },
7894   { 0,    NULL }
7895 };
7896
7897 static int ieee80211_tag_country_info(packet_info *pinfo, proto_tree *tree,
7898                                       proto_item *ti, proto_item *ti_len,
7899                                       guint32 tag_len, tvbuff_t *tvb,
7900                                       int offset, int tag_end)
7901 {
7902   /* 7.3.2.9 Country information element (7) */
7903   proto_tree *sub_tree;
7904   proto_item *sub_item;
7905
7906   if (tag_len < 6) {
7907     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7908                            "Tag length %u too short, must be >= 6", tag_len);
7909     return offset;
7910   }
7911
7912   offset += 2;
7913
7914   proto_tree_add_item(tree, hf_ieee80211_tag_country_info_code,
7915                       tvb, offset, 2, ENC_ASCII|ENC_NA);
7916   proto_item_append_text(ti, ": Country Code %s",
7917                          tvb_get_ephemeral_string(tvb, offset, 2));
7918   offset += 2;
7919
7920   proto_tree_add_item(tree, hf_ieee80211_tag_country_info_env,
7921                       tvb, offset, 1, ENC_BIG_ENDIAN);
7922   proto_item_append_text(ti, ", Environment %s",
7923                          val_to_str(tvb_get_guint8(tvb, offset),
7924                                     environment_vals,"Unknown (0x%02x)"));
7925   offset++;
7926
7927   while (offset < tag_end) {
7928     /* Padding ? */
7929     if ((tag_end - offset) < 3) {
7930       proto_tree_add_item(tree, hf_ieee80211_tag_country_info_pad,
7931                           tvb, offset, 1, ENC_NA);
7932       offset++;
7933       continue;
7934     }
7935     if (tvb_get_guint8(tvb, offset) <= 200) { /* 802.11d */
7936       sub_item = proto_tree_add_item(tree, hf_ieee80211_tag_country_info_fnm,
7937                                      tvb, offset, 3, ENC_NA);
7938       sub_tree = proto_item_add_subtree(sub_item, ett_tag_country_fnm_tree);
7939
7940       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_fnm_fcn,
7941                           tvb, offset, 1, ENC_BIG_ENDIAN);
7942       proto_item_append_text(sub_item, ": First Channel Number: %d",
7943                              tvb_get_guint8(tvb, offset));
7944       offset++;
7945       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_fnm_nc,
7946                           tvb, offset, 1, ENC_BIG_ENDIAN);
7947       proto_item_append_text(sub_item, ", Number of Channels: %d",
7948                              tvb_get_guint8(tvb, offset));
7949       offset++;
7950       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_fnm_mtpl,
7951                           tvb, offset, 1, ENC_BIG_ENDIAN);
7952       proto_item_append_text(sub_item,
7953                              ", Maximum Transmit Power Level: %d dBm",
7954                              tvb_get_guint8(tvb, offset));
7955       offset++;
7956     } else { /* 802.11j */
7957       sub_item = proto_tree_add_item(tree, hf_ieee80211_tag_country_info_rrc,
7958                                      tvb, offset, 3, ENC_NA);
7959       sub_tree = proto_item_add_subtree(sub_item, ett_tag_country_rcc_tree);
7960
7961       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_rrc_rei,
7962                           tvb, offset, 1, ENC_BIG_ENDIAN);
7963       proto_item_append_text(sub_item,
7964                              ": Regulatory Extension Identifier: %d",
7965                              tvb_get_guint8(tvb, offset));
7966       offset++;
7967       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_rrc_rc,
7968                           tvb, offset, 1, ENC_BIG_ENDIAN);
7969       proto_item_append_text(sub_item, ", Regulatory Class: %d",
7970                              tvb_get_guint8(tvb, offset));
7971       offset++;
7972       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_rrc_cc,
7973                           tvb, offset, 1, ENC_BIG_ENDIAN);
7974       proto_item_append_text(sub_item, ", Coverage Class: %d",
7975                              tvb_get_guint8(tvb, offset));
7976       offset++;
7977     }
7978   }
7979
7980   return offset;
7981 }
7982
7983 static int ieee80211_tag_fh_hopping_parameter(packet_info *pinfo,
7984                                               proto_tree *tree,
7985                                               proto_item *ti,
7986                                               proto_item *ti_len,
7987                                               guint32 tag_len, tvbuff_t *tvb,
7988                                               int offset)
7989 {
7990   /* 7.3.2.10 Hopping Pattern Parameters information element (8) */
7991   if (tag_len < 2) {
7992     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7993                            "Tag length %u too short, must be >= 2", tag_len);
7994     return offset;
7995   }
7996
7997   offset += 2;
7998
7999   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_parameter_prime_radix,
8000                       tvb, offset, 1, ENC_BIG_ENDIAN);
8001   proto_item_append_text(ti, ": Prime Radix: %u", tvb_get_guint8(tvb, offset));
8002   offset++;
8003
8004   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_parameter_nb_channels,
8005                       tvb, offset, 1, ENC_BIG_ENDIAN);
8006   proto_item_append_text(ti, ", Number of Channels: %u",
8007                          tvb_get_guint8(tvb, offset));
8008   offset++;
8009
8010   return offset;
8011 }
8012
8013 static int ieee80211_tag_fh_hopping_table(packet_info *pinfo, proto_tree *tree,
8014                                           proto_item *ti_len,
8015                                           guint32 tag_len, tvbuff_t *tvb,
8016                                           int offset, int tag_end)
8017 {
8018   /* 7.3.2.11 Hopping Pattern Table information element (9) */
8019   if (tag_len < 4) {
8020     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
8021                            "Tag length %u too short, must be >= 4", tag_len);
8022     return offset;
8023   }
8024
8025   offset += 2;
8026
8027   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_flag,
8028                       tvb, offset, 1, ENC_BIG_ENDIAN);
8029   offset++;
8030
8031   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_number_of_sets,
8032                       tvb, offset, 1, ENC_BIG_ENDIAN);
8033   offset++;
8034
8035   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_modulus,
8036                       tvb, offset, 1, ENC_BIG_ENDIAN);
8037   offset++;
8038
8039   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_offset,
8040                       tvb, offset, 1, ENC_BIG_ENDIAN);
8041   offset++;
8042
8043   while (offset < tag_end) {
8044     proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_random_table,
8045                         tvb, offset, 2, ENC_BIG_ENDIAN);
8046     offset += 2;
8047   }
8048
8049   return offset;
8050 }
8051
8052 static int
8053 add_tagged_field(packet_info * pinfo, proto_tree * tree, tvbuff_t * tvb, int offset, int ftype)
8054 {
8055   guint32 oui;
8056   tvbuff_t *tag_tvb;
8057   const guint8 *tag_data_ptr;
8058   guint32 tag_no, tag_len;
8059   int n, ret;
8060   char print_buff[SHORT_STR];
8061   proto_tree * orig_tree=tree;
8062   proto_item *ti = NULL, *ti_len = NULL;
8063   int tag_end;
8064
8065   tag_no = tvb_get_guint8(tvb, offset);
8066   tag_len = tvb_get_guint8(tvb, offset + 1);
8067   tag_end = offset + 2 + tag_len;
8068   if (tree) {
8069     ti = proto_tree_add_item(orig_tree, hf_ieee80211_tag, tvb, offset, 2 + tag_len , ENC_NA);
8070     proto_item_append_text(ti, ": %s", val_to_str(tag_no, tag_num_vals, "Reserved (%d)"));
8071
8072     tree = proto_item_add_subtree(ti, ett_80211_mgt_ie);
8073
8074     proto_tree_add_item(tree, hf_ieee80211_tag_number, tvb, offset, 1, ENC_BIG_ENDIAN);
8075
8076   }
8077   ti_len = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, 1, tag_len);
8078
8079   switch (tag_no) {
8080   case TAG_SSID:
8081     offset += ieee80211_tag_ssid(pinfo, tree, ti, ti_len, tag_len, tvb,
8082                                  offset);
8083     break;
8084   case TAG_SUPP_RATES:
8085     offset += ieee80211_tag_supp_rates(pinfo, tree, ti, ti_len, tag_len, tvb,
8086                                        offset, tag_end);
8087     break;
8088   case TAG_FH_PARAMETER:
8089     offset += ieee80211_tag_fh_parameter(pinfo, tree, ti_len, tag_len, tvb,
8090                                          offset);
8091     break;
8092   case TAG_DS_PARAMETER:
8093     offset += ieee80211_tag_ds_parameter(pinfo, tree, ti, ti_len, tag_len, tvb,
8094                                          offset);
8095     break;
8096   case TAG_CF_PARAMETER:
8097     offset += ieee80211_tag_cf_parameter(pinfo, tree, ti, ti_len, tag_len, tvb,
8098                                          offset);
8099     break;
8100   case TAG_TIM:
8101     offset += ieee80211_tag_tim(pinfo, tree, ti, ti_len, tag_len, tvb, offset);
8102     break;
8103   case TAG_IBSS_PARAMETER:
8104     offset += ieee80211_tag_ibss_parameter(pinfo, tree, ti, ti_len, tag_len,
8105                                            tvb, offset);
8106     break;
8107   case TAG_COUNTRY_INFO:
8108     offset += ieee80211_tag_country_info(pinfo, tree, ti, ti_len, tag_len, tvb,
8109                                          offset, tag_end);
8110     break;
8111   case TAG_FH_HOPPING_PARAMETER:
8112     offset += ieee80211_tag_fh_hopping_parameter(pinfo, tree, ti, ti_len,
8113                                                  tag_len, tvb, offset);
8114     break;
8115   case TAG_FH_HOPPING_TABLE:
8116     offset += ieee80211_tag_fh_hopping_table(pinfo, tree, ti_len, tag_len,
8117                                              tvb, offset, tag_end);
8118     break;
8119
8120     case TAG_REQUEST: /* 7.3.2.12 Request information element (10) */
8121       while(offset < tag_end )
8122       {
8123         proto_tree_add_item(tree, hf_ieee80211_tag_request, tvb, offset, 1, ENC_BIG_ENDIAN);
8124         offset += 1;
8125       }
8126       break;
8127
8128     case TAG_QBSS_LOAD: /* 7.3.2.28 BSS Load element (11) */
8129       if (tag_len < 4 || tag_len >5)
8130       {
8131         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 4 or 5", tag_len);
8132         break;
8133       }
8134
8135       if (tag_len == 4)
8136       {
8137         /* QBSS Version 1 */
8138         proto_item_append_text(ti, " Cisco QBSS Version 1 - non CCA");
8139
8140         /* Extract Values */
8141         proto_tree_add_uint(tree, hf_ieee80211_qbss_version, tvb, offset + 2, tag_len, 1);
8142         proto_tree_add_item(tree, hf_ieee80211_qbss_scount, tvb, offset + 2, 2, ENC_LITTLE_ENDIAN);
8143         proto_tree_add_item(tree, hf_ieee80211_qbss_cu, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
8144         proto_tree_add_item(tree, hf_ieee80211_qbss_adc, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
8145       }
8146       else if (tag_len == 5)
8147       {
8148          /* QBSS Version 2 */
8149          proto_item_append_text(ti, " 802.11e CCA Version");
8150
8151          /* Extract Values */
8152          proto_tree_add_uint(tree, hf_ieee80211_qbss_version, tvb, offset + 2, tag_len, 2);
8153          proto_tree_add_item(tree, hf_ieee80211_qbss_scount, tvb, offset + 2, 2, ENC_LITTLE_ENDIAN);
8154          proto_tree_add_item(tree, hf_ieee80211_qbss_cu, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
8155          proto_tree_add_item(tree, hf_ieee80211_qbss_adc, tvb, offset + 5, 2, ENC_LITTLE_ENDIAN);
8156       }
8157       break;
8158
8159     case TAG_TSPEC: /* 7.3.2.30 TSPEC element (13) */
8160       if (tag_len != 55)
8161       {
8162         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 55", tag_len);
8163         break;
8164       }
8165       offset += 2;
8166
8167       add_fixed_field(tree, tvb, offset, FIELD_QOS_TS_INFO);
8168       offset += 3;
8169
8170       proto_tree_add_item(tree, hf_ieee80211_tspec_nor_msdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8171       offset += 2;
8172
8173       proto_tree_add_item(tree, hf_ieee80211_tspec_max_msdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8174       offset += 2;
8175
8176       proto_tree_add_item(tree, hf_ieee80211_tspec_min_srv, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8177       offset += 4;
8178
8179       proto_tree_add_item(tree, hf_ieee80211_tspec_max_srv, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8180       offset += 4;
8181
8182       proto_tree_add_item(tree, hf_ieee80211_tspec_inact_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8183       offset += 4;
8184
8185       proto_tree_add_item(tree, hf_ieee80211_tspec_susp_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8186       offset += 4;
8187
8188       proto_tree_add_item(tree, hf_ieee80211_tspec_srv_start, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8189       offset += 4;
8190
8191       proto_tree_add_item(tree, hf_ieee80211_tspec_min_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8192       offset += 4;
8193
8194       proto_tree_add_item(tree, hf_ieee80211_tspec_mean_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8195       offset += 4;
8196
8197       proto_tree_add_item(tree, hf_ieee80211_tspec_peak_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8198       offset += 4;
8199
8200       proto_tree_add_item(tree, hf_ieee80211_tspec_burst_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8201       offset += 4;
8202
8203       proto_tree_add_item(tree, hf_ieee80211_tspec_delay_bound, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8204       offset += 4;
8205
8206       proto_tree_add_item(tree, hf_ieee80211_tspec_min_phy, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8207       offset += 4;
8208
8209       proto_tree_add_item(tree, hf_ieee80211_tspec_surplus, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8210       offset += 2;
8211
8212       proto_tree_add_item(tree, hf_ieee80211_tspec_medium, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8213       offset += 2;
8214
8215       break;
8216
8217     case TAG_TCLAS: /* 7.3.2.31 TCLAS element (14) */
8218       if (tag_len < 6)
8219       {
8220         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 6", tag_len);
8221         break;
8222       }
8223       {
8224       guint8 type;
8225       guint8 version;
8226
8227       offset += 2;
8228       proto_tree_add_item(tree, hf_ieee80211_tclas_up, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8229       type = tvb_get_guint8(tvb, offset);
8230       offset += 1;
8231
8232       proto_tree_add_item(tree, hf_ieee80211_tclas_class_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8233       offset += 1;
8234
8235       proto_tree_add_item(tree, hf_ieee80211_tclas_class_mask, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8236       offset += 1;
8237
8238       switch (type)
8239         {
8240           case 0:
8241             proto_tree_add_item(tree, hf_ieee80211_tclas_src_mac_addr, tvb, offset, 6, ENC_NA);
8242             offset += 6;
8243
8244             proto_tree_add_item(tree, hf_ieee80211_tclas_dst_mac_addr, tvb, offset, 6, ENC_NA);
8245             offset += 6;
8246
8247             proto_tree_add_item(tree, hf_ieee80211_tclas_ether_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8248             offset += 2;
8249             break;
8250
8251           case 1:
8252             version = tvb_get_guint8(tvb, offset + 5);
8253             proto_tree_add_item(tree, hf_ieee80211_tclas_version, tvb, offset + 5, 1, ENC_LITTLE_ENDIAN);
8254             offset += 1;
8255             if (version == 4)
8256             {
8257               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv4_src, tvb, offset, 4, ENC_BIG_ENDIAN);
8258               offset += 4;
8259               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv4_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
8260               offset += 4;
8261               proto_tree_add_item(tree, hf_ieee80211_tclas_src_port, tvb, offset, 2, ENC_BIG_ENDIAN);
8262               offset += 2;
8263               proto_tree_add_item(tree, hf_ieee80211_tclas_dst_port, tvb, offset, 2, ENC_BIG_ENDIAN);
8264               offset += 2;
8265               proto_tree_add_item(tree, hf_ieee80211_tclas_dscp, tvb, offset, 1, ENC_BIG_ENDIAN);
8266               offset += 1;
8267               proto_tree_add_item(tree, hf_ieee80211_tclas_protocol, tvb, offset, 1, ENC_BIG_ENDIAN);
8268               offset += 1;
8269             }
8270             else if (version == 6)
8271             {
8272               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv6_src, tvb, offset, 16, ENC_NA);
8273               offset += 16;
8274               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv6_dst, tvb, offset, 16, ENC_NA);
8275               offset += 16;
8276               proto_tree_add_item(tree, hf_ieee80211_tclas_src_port, tvb, offset, 2, ENC_BIG_ENDIAN);
8277               offset += 2;
8278               proto_tree_add_item(tree, hf_ieee80211_tclas_dst_port, tvb, offset, 2, ENC_BIG_ENDIAN);
8279               offset += 2;
8280               proto_tree_add_item(tree, hf_ieee80211_tclas_flow, tvb, offset, 3, ENC_BIG_ENDIAN);
8281               offset += 3;
8282             }
8283             break;
8284
8285           case 2:
8286             proto_tree_add_item(tree, hf_ieee80211_tclas_tag_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8287             offset += 2;
8288             break;
8289
8290           default:
8291             break;
8292         }
8293       }
8294       break;
8295
8296     case TAG_SCHEDULE: /* 7.3.2.34 Schedule element (15) */
8297       if (tag_len != 14)
8298       {
8299         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 14", tag_len);
8300         break;
8301       }
8302       offset += 2;
8303
8304       add_fixed_field(tree, tvb, offset, FIELD_SCHEDULE_INFO);
8305       offset += 2;
8306
8307       proto_tree_add_item(tree, hf_ieee80211_sched_srv_start, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8308       offset += 4;
8309
8310       proto_tree_add_item(tree, hf_ieee80211_sched_srv_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8311       offset += 4;
8312
8313       proto_tree_add_item(tree, hf_ieee80211_sched_spec_int, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8314       offset += 2;
8315       break;
8316
8317     case TAG_CHALLENGE_TEXT: /* 7.3.2.8 Challenge Text element (16) */
8318       offset += 2;
8319       proto_tree_add_item(tree, hf_ieee80211_tag_challenge_text, tvb, offset, tag_len, ENC_NA);
8320       break;
8321
8322     case TAG_POWER_CONSTRAINT: /* 7.3.2.15 Power Constraint element (32) */
8323     {
8324       if (tag_len != 1)
8325       {
8326         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
8327         break;
8328       }
8329       offset += 2;
8330
8331       proto_tree_add_item(tree, hf_ieee80211_tag_power_constraint_local, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8332       proto_item_append_text(ti, " :%d", tvb_get_guint8(tvb, offset));
8333       offset += 1;
8334
8335       break;
8336     }
8337
8338     case TAG_POWER_CAPABILITY: /* 7.3.2.16 Power Capability element (33) */
8339     {
8340       if (tag_len != 2)
8341       {
8342         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 2", tag_len);
8343         break;
8344       }
8345       offset += 2;
8346
8347       proto_tree_add_item(tree, hf_ieee80211_tag_power_capability_min, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8348       proto_item_append_text(ti, " Min: %d", tvb_get_guint8(tvb, offset));
8349       offset += 1;
8350
8351       proto_tree_add_item(tree, hf_ieee80211_tag_power_capability_max, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8352       proto_item_append_text(ti, ", Max :%d", tvb_get_guint8(tvb, offset));
8353       offset += 1;
8354       break;
8355     }
8356
8357     case TAG_TPC_REQUEST: /* 7.3.2.18 TPC Request element (34) */
8358     {
8359       if (tag_len != 0)
8360       {
8361         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 0", tag_len);
8362         break;
8363       }
8364       offset += 2;
8365
8366       /* No Data */
8367       break;
8368     }
8369
8370     case TAG_TPC_REPORT: /* 7.3.2.18 TPC Report element (35) */
8371     {
8372       if (tag_len != 2)
8373       {
8374         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 2", tag_len);
8375         break;
8376       }
8377       offset += 2;
8378
8379       proto_tree_add_item(tree, hf_ieee80211_tag_tpc_report_trsmt_pow, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8380       proto_item_append_text(ti, " Transmit Power :%d", tvb_get_guint8(tvb, offset));
8381       offset += 1;
8382
8383       proto_tree_add_item(tree, hf_ieee80211_tag_tpc_report_link_mrg, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8384       proto_item_append_text(ti, ", Link Margin :%d", tvb_get_guint8(tvb, offset));
8385       offset += 1;
8386
8387       break;
8388     }
8389
8390     case TAG_SUPPORTED_CHANNELS: /* 7.3.2.19 Supported Channels element (36) */
8391       {
8392         proto_item *chan_item;
8393         proto_tree *chan_tree;
8394         guint i=1;
8395
8396         offset += 2;
8397         if (tag_len % 2 == 1) {
8398            expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u must be even",tag_len);
8399            break;
8400         }
8401         while(offset < tag_end)
8402         {
8403           chan_item = proto_tree_add_item(tree, hf_ieee80211_tag_supported_channels, tvb, offset, 2, ENC_NA);
8404           proto_item_append_text(chan_item, " #%d", i);
8405           i++;
8406
8407           chan_tree = proto_item_add_subtree(chan_item , ett_tag_supported_channels);
8408
8409           proto_tree_add_item(chan_tree, hf_ieee80211_tag_supported_channels_first, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8410           proto_item_append_text(chan_item, " First: %d", tvb_get_guint8(tvb, offset));
8411           offset += 1;
8412
8413           proto_tree_add_item(chan_tree, hf_ieee80211_tag_supported_channels_range, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8414           proto_item_append_text(chan_item, ", Range: %d ", tvb_get_guint8(tvb, offset));
8415           offset += 1;
8416
8417         }
8418         break;
8419       }
8420     case TAG_CHANNEL_SWITCH_ANN: /* 7.3.2.20 Channel Switch Announcement element (37) */
8421     {
8422       if (tag_len != 3)
8423       {
8424         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 3", tag_len);
8425         break;
8426       }
8427       offset += 2;
8428
8429       proto_tree_add_item(tree, hf_ieee80211_csa_channel_switch_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8430       proto_item_append_text(ti, " Mode: %d", tvb_get_guint8(tvb, offset));
8431       offset += 1;
8432
8433       proto_tree_add_item(tree, hf_ieee80211_csa_new_channel_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8434       proto_item_append_text(ti, ", Number: %d ", tvb_get_guint8(tvb, offset));
8435       offset += 1;
8436
8437       proto_tree_add_item(tree, hf_ieee80211_csa_channel_switch_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8438       proto_item_append_text(ti, ", Count: %d ", tvb_get_guint8(tvb, offset));
8439       offset += 1;
8440     }
8441
8442     case TAG_MEASURE_REQ: /* 7.3.2.21 Measurement Request element (38) with update from 802.11k-2008 */
8443       if (tag_len < 3)
8444       {
8445         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 3", tag_len);
8446         break;
8447       }
8448       {
8449         guint8 request_type;
8450         proto_item *parent_item;
8451         proto_tree *sub_tree;
8452
8453         offset += 2;
8454
8455         proto_tree_add_item(tree, hf_ieee80211_tag_measure_request_token, tvb, offset, 1, ENC_NA);
8456         offset += 1;
8457
8458         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_request_mode, tvb, offset, 1, ENC_NA);
8459         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_request_mode_tree);
8460         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_parallel, tvb, offset, 1, ENC_NA);
8461         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_enable, tvb, offset, 1, ENC_NA);
8462         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_request, tvb, offset, 1, ENC_NA);
8463         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_report, tvb, offset, 1, ENC_NA);
8464         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_duration_mandatory, tvb, offset, 1, ENC_NA);
8465         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_reserved, tvb, offset, 1, ENC_NA);
8466         offset += 1;
8467
8468
8469         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_request_type, tvb, offset, 1, ENC_NA);
8470         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_request_type_tree);
8471         request_type = tvb_get_guint8 (tvb, offset);
8472         offset += 1;
8473
8474         switch(request_type) {
8475           case 0: /* Basic Request */
8476           case 1: /* Clear channel assessment (CCA) request */
8477           case 2: /* Receive power indication (RPI) histogram request */
8478           {
8479
8480             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
8481             offset += 1;
8482
8483             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8484             offset += 8;
8485
8486             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8487             offset += 2;
8488             break;
8489           }
8490           case 3: /* Channel Load Request */
8491           case 4: /* Noise Histogram Request */
8492           {
8493             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_regulatory_class, tvb, offset, 1, ENC_NA);
8494             offset += 1;
8495
8496             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
8497             offset += 1;
8498
8499             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8500             offset += 2;
8501
8502             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8503             offset += 2;
8504             /* TODO Add Optionnal Subelements */
8505             break;
8506           }
8507           case 5: /* Beacon Request */
8508           {
8509             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_regulatory_class, tvb, offset, 1, ENC_NA);
8510             offset += 1;
8511
8512             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
8513             offset += 1;
8514
8515             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8516             offset += 2;
8517
8518             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8519             offset += 2;
8520
8521             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_measurement_mode, tvb, offset, 1, ENC_NA);
8522             offset += 1;
8523
8524             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_bssid, tvb, offset, 6, ENC_NA);
8525             offset += 6;
8526
8527             while(offset < tag_end)
8528             {
8529               guint8 sub_id, sub_length, sub_tag_end;
8530               proto_item *ti;
8531               proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_id, tvb, offset, 1, ENC_NA);
8532               sub_id = tvb_get_guint8(tvb, offset);
8533               offset += 1;
8534
8535               proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_subelement_length, tvb, offset, 1, ENC_NA);
8536               sub_length = tvb_get_guint8(tvb, offset);
8537               offset += 1;
8538               sub_tag_end = offset + sub_length;
8539
8540               switch(sub_id){
8541                 case MEASURE_REQ_BEACON_SUB_SSID: /* SSID (0) */
8542                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_ssid, tvb, offset, sub_length, ENC_ASCII|ENC_NA);
8543                   offset += sub_length;
8544                   break;
8545                 case MEASURE_REQ_BEACON_SUB_BRI: /* Beacon Reporting Information (1) */
8546                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition, tvb, offset, 1, ENC_BIG_ENDIAN);
8547                   offset += 1;
8548                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_bri_threshold_offset, tvb, offset, 1, ENC_BIG_ENDIAN);
8549                   offset += 1;
8550                   break;
8551                 case MEASURE_REQ_BEACON_SUB_RD: /* Reporting Detail (2) */
8552                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_reporting_detail, tvb, offset, 1, ENC_BIG_ENDIAN);
8553                   offset += 1;
8554                   break;
8555                 case MEASURE_REQ_BEACON_SUB_REQUEST: /* Request (10) */
8556                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_request, tvb, offset, 1, ENC_BIG_ENDIAN);
8557                   offset += 1;
8558                   break;
8559                 case MEASURE_REQ_BEACON_SUB_APCP: /* Request (51) */
8560                   /* TODO */
8561                   break;
8562                 default:
8563                   /* no default action */
8564                   break;
8565              }
8566              if(offset < sub_tag_end)
8567              {
8568                ti = proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_unknown, tvb, offset, sub_tag_end - offset, ENC_NA);
8569                expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, " Unknown Data (not interpreted)");
8570                offset = sub_tag_end;
8571              }
8572             }
8573
8574             break;
8575           }
8576           case 6: /* Frame Request */
8577           {
8578             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_regulatory_class, tvb, offset, 1, ENC_NA);
8579             offset += 1;
8580
8581             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
8582             offset += 1;
8583
8584             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8585             offset += 2;
8586
8587             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8588             offset += 2;
8589
8590             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_frame_request_type, tvb, offset, 1, ENC_NA);
8591             offset += 1;
8592
8593             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mac_address, tvb, offset, 6, ENC_NA);
8594             offset += 6;
8595
8596             /* TODO Add Optionnal Subelements */
8597             break;
8598           }
8599           case 7: /* BSTA Statistics Request */
8600           {
8601             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_peer_mac_address, tvb, offset, 6, ENC_NA);
8602             offset += 6;
8603
8604             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8605             offset += 2;
8606
8607             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8608             offset += 2;
8609
8610             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_group_id, tvb, offset, 1, ENC_NA);
8611             offset += 1;
8612
8613             /* TODO Add Optionnal Subelements */
8614             break;
8615           }
8616           case 8: /* Location Configuration Indication (LCI) Request */
8617             /* TODO */
8618           case 9: /* Transmit Stream Measurement Request */
8619             /* TODO */
8620           case 255: /* Measurement Pause Request*/
8621             /* TODO */
8622           default: /* unknown */
8623             break;
8624         }
8625       }
8626
8627       break;
8628     case TAG_MEASURE_REP: /* 7.3.2.22 Measurement Report element (39) with update from 802.11k-2008 */
8629       if (tag_len < 3)
8630       {
8631         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 3", tag_len);
8632         break;
8633       }
8634       {
8635         proto_item *parent_item;
8636         proto_tree *sub_tree;
8637         guint8 report_type;
8638
8639         offset += 2;
8640         proto_tree_add_item(tree, hf_ieee80211_tag_measure_report_measurement_token, tvb, offset, 1, ENC_NA);
8641         offset += 1;
8642
8643         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_report_mode, tvb, offset, 1, ENC_NA);
8644         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_report_mode_tree);
8645         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_late, tvb, offset, 1, ENC_NA);
8646         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_incapable, tvb, offset, 1, ENC_NA);
8647         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_refused, tvb, offset, 1, ENC_NA);
8648         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_reserved, tvb, offset, 1, ENC_NA);
8649         offset += 1;
8650
8651         report_type = tvb_get_guint8(tvb, offset);
8652         parent_item = proto_tree_add_uint(tree, hf_ieee80211_tag_measure_report_type, tvb, offset, 1, ENC_NA);
8653         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_report_type_tree);
8654         offset += 1;
8655
8656         if (tag_len == 3)
8657             break;
8658         switch (report_type) {
8659           case 0: /* Basic Report */
8660           {
8661             proto_tree *sub_tree_map_field;
8662
8663             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8664             offset += 1;
8665
8666             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8667             offset += 8;
8668
8669             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8670             offset += 2;
8671
8672
8673             parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_basic_map_field, tvb, offset, 1, ENC_NA);
8674             sub_tree_map_field = proto_item_add_subtree(parent_item, ett_tag_measure_report_basic_map_tree);
8675             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_bss, tvb, offset, 1, ENC_NA);
8676             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_odfm, tvb, offset, 1, ENC_NA);
8677             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_unident_signal, tvb, offset, 1, ENC_NA);
8678             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_radar, tvb, offset, 1, ENC_NA);
8679             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_unmeasured, tvb, offset, 1, ENC_NA);
8680             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_reserved, tvb, offset, 1, ENC_NA);
8681             break;
8682           }
8683           case 1: /* Clear channel assessment (CCA) report */
8684             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8685             offset += 1;
8686
8687             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8688             offset += 8;
8689
8690             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8691             offset += 2;
8692
8693             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_cca_busy_fraction, tvb, offset, 1, ENC_NA);
8694             offset += 1;
8695             break;
8696           case 2: /* Receive power indication (RPI) histogram report */
8697             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8698             offset += 1;
8699
8700             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8701             offset += 8;
8702
8703             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8704             offset += 2;
8705
8706             parent_item = proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report, tvb, offset, 8, ENC_NA);
8707             sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_report_rpi_tree);
8708
8709             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_0, tvb, offset, 1, ENC_NA);
8710             offset += 1;
8711
8712             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_1, tvb, offset, 1, ENC_NA);
8713             offset += 1;
8714
8715             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_2, tvb, offset, 1, ENC_NA);
8716             offset += 1;
8717
8718             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_3, tvb, offset, 1, ENC_NA);
8719             offset += 1;
8720
8721             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_4, tvb, offset, 1, ENC_NA);
8722             offset += 1;
8723
8724             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_5, tvb, offset, 1, ENC_NA);
8725             offset += 1;
8726
8727             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_6, tvb, offset, 1, ENC_NA);
8728             offset += 1;
8729
8730             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_7, tvb, offset, 1, ENC_NA);
8731             offset += 1;
8732             break;
8733           case 3: /* Channel Load Report */
8734           {
8735             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
8736             offset += 1;
8737
8738             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8739             offset += 1;
8740
8741             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8742             offset += 8;
8743
8744             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8745             offset += 2;
8746
8747             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_load, tvb, offset, 1, ENC_NA);
8748             offset += 1;
8749
8750             /* TODO Add Optionnal Subelements */
8751             break;
8752           }
8753           case 4: /* Noise Histogram Report */
8754             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
8755             offset += 1;
8756
8757             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8758             offset += 1;
8759
8760             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8761             offset += 8;
8762
8763             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8764             offset += 2;
8765
8766             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ant_id, tvb, offset, 1, ENC_NA);
8767             offset += 1;
8768
8769             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_anpi, tvb, offset, 1, ENC_NA);
8770             offset += 1;
8771
8772             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_0, tvb, offset, 1, ENC_NA);
8773             offset += 1;
8774
8775             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_1, tvb, offset, 1, ENC_NA);
8776             offset += 1;
8777
8778             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_2, tvb, offset, 1, ENC_NA);
8779             offset += 1;
8780
8781             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_3, tvb, offset, 1, ENC_NA);
8782             offset += 1;
8783
8784             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_4, tvb, offset, 1, ENC_NA);
8785             offset += 1;
8786
8787             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_5, tvb, offset, 1, ENC_NA);
8788             offset += 1;
8789
8790             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_6, tvb, offset, 1, ENC_NA);
8791             offset += 1;
8792
8793             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_7, tvb, offset, 1, ENC_NA);
8794             offset += 1;
8795
8796             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_8, tvb, offset, 1, ENC_NA);
8797             offset += 1;
8798
8799             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_9, tvb, offset, 1, ENC_NA);
8800             offset += 1;
8801
8802             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_10, tvb, offset, 1, ENC_NA);
8803             offset += 1;
8804
8805             /* TODO Add Optionnal Subelements */
8806             break;
8807           case 5: /* Beacon Report */
8808           {
8809             proto_tree *sub_tree_frame_info;
8810
8811             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
8812             offset += 1;
8813
8814             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8815             offset += 1;
8816
8817             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8818             offset += 8;
8819
8820             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8821             offset += 2;
8822
8823             parent_item = proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_frame_info, tvb, offset, 1, ENC_NA);
8824             sub_tree_frame_info = proto_item_add_subtree(parent_item, ett_tag_measure_report_frame_tree);
8825             proto_tree_add_item(sub_tree_frame_info, hf_ieee80211_tag_measure_report_frame_info_phy_type, tvb, offset, 1, ENC_NA);
8826             proto_tree_add_item(sub_tree_frame_info, hf_ieee80211_tag_measure_report_frame_info_frame_type, tvb, offset, 1, ENC_NA);
8827             offset += 1;
8828
8829             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_rcpi, tvb, offset, 1, ENC_NA);
8830             offset += 1;
8831
8832             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_rsni, tvb, offset, 1, ENC_NA);
8833             offset += 1;
8834
8835             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_bssid, tvb, offset, 6, ENC_NA);
8836             offset += 6;
8837
8838             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ant_id, tvb, offset, 1, ENC_NA);
8839             offset += 1;
8840
8841             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_parent_tsf, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8842             offset += 4;
8843             /* TODO Add Optionnal Subelements */
8844             break;
8845           }
8846           case 6: /* Frame Report */
8847             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
8848             offset += 1;
8849
8850             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8851             offset += 1;
8852
8853             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8854             offset += 8;
8855
8856             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8857             offset += 2;
8858
8859             /* TODO Add Optionnal Subelements */
8860             break;
8861           case 7: /* BSTA Statistics Report */
8862             /* TODO */
8863           case 8: /* Location Configuration Information Report element */
8864             /* TODO */
8865           case 9: /* Transmit Stream Measurement Report */
8866             /* TODO */
8867           default: /* unknown */
8868             break;
8869         }
8870       }
8871
8872     case TAG_QUIET: /* 7.3.2.23 Quiet element (40) */
8873       if (tag_len != 6)
8874       {
8875         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 6", tag_len);
8876         break;
8877       }
8878       offset += 2;
8879
8880       proto_tree_add_item(tree, hf_ieee80211_tag_quiet_count, tvb, offset, 1, ENC_NA);
8881       proto_item_append_text(ti, " Count: %d", tvb_get_guint8(tvb, offset));
8882       offset += 1;
8883
8884       proto_tree_add_item(tree, hf_ieee80211_tag_quiet_period, tvb, offset, 1, ENC_NA);
8885       proto_item_append_text(ti, " Period: %d", tvb_get_guint8(tvb, offset));
8886       offset += 1;
8887
8888       proto_tree_add_item(tree, hf_ieee80211_tag_quiet_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8889       proto_item_append_text(ti, " Duration: %d", tvb_get_letohs(tvb, offset));
8890       offset += 2;
8891
8892       proto_tree_add_item(tree, hf_ieee80211_tag_quiet_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8893       proto_item_append_text(ti, " Offset: %d", tvb_get_letohs(tvb, offset));
8894       offset += 2;
8895       break;
8896
8897
8898     case TAG_IBSS_DFS: /* 7.3.2.24 IBSS DFS element (41) */
8899       if (tag_len < 7)
8900       {
8901         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be >= 7", tag_len);
8902         break;
8903       }
8904       {
8905         proto_item *ti_sup_map;
8906         proto_tree *sub_map_tree;
8907         offset += 2;
8908
8909         proto_tree_add_item(tree, hf_ieee80211_tag_dfs_owner, tvb, offset, 6, ENC_NA);
8910         proto_item_append_text(ti, " Owner: %s", tvb_ether_to_str(tvb, offset));
8911         offset += 6;
8912
8913         proto_tree_add_item(tree, hf_ieee80211_tag_dfs_recovery_interval, tvb, offset, 1, ENC_NA);
8914         offset += 1;
8915
8916         while(offset < tag_end)
8917         {
8918           ti_sup_map = proto_tree_add_item(tree, hf_ieee80211_tag_dfs_channel_map, tvb, offset, 2, ENC_NA);
8919           sub_map_tree = proto_item_add_subtree(ti_sup_map, ett_tag_dfs_map_tree);
8920           proto_tree_add_item(sub_map_tree, hf_ieee80211_tag_dfs_channel_number, tvb, offset, 1, ENC_NA);
8921           proto_tree_add_item(sub_map_tree, hf_ieee80211_tag_dfs_map, tvb, offset, 1, ENC_NA);
8922           offset += 2;
8923         }
8924         break;
8925       }
8926     case TAG_ERP_INFO: /* 7.3.2.13 ERP Information element (42) */
8927     case TAG_ERP_INFO_OLD:
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       {
8934         proto_item *ti_erp;
8935         proto_tree *erp_tree;
8936
8937         offset += 2;
8938
8939         ti_erp = proto_tree_add_item(tree, hf_ieee80211_tag_erp_info, tvb, offset, 1, ENC_NA);
8940         erp_tree = proto_item_add_subtree(ti_erp, ett_tag_erp_info_tree);
8941         proto_tree_add_item(erp_tree, hf_ieee80211_tag_erp_info_erp_present, tvb, offset, 1, ENC_NA);
8942         proto_tree_add_item(erp_tree, hf_ieee80211_tag_erp_info_use_protection, tvb, offset, 1, ENC_NA);
8943         proto_tree_add_item(erp_tree, hf_ieee80211_tag_erp_info_barker_preamble_mode, tvb, offset, 1, ENC_NA);
8944         proto_tree_add_item(erp_tree, hf_ieee80211_tag_erp_info_reserved, tvb, offset, 1, ENC_NA);
8945         offset += 1;
8946         break;
8947       }
8948
8949     case TAG_TS_DELAY: /* 7.3.2.32 TS Delay element (43) */
8950       if (tag_len != 4)
8951       {
8952         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 4", tag_len);
8953         break;
8954       }
8955       offset += 2;
8956
8957       proto_tree_add_item(tree, hf_ieee80211_ts_delay, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8958       proto_item_append_text(ti, " : %d", tvb_get_ntohl(tvb, offset) );
8959       offset += 4;
8960       break;
8961
8962     case TAG_TCLAS_PROCESS: /* 7.3.2.33 TCLAS Processing element (44) */
8963       if (tag_len != 1)
8964       {
8965         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
8966         break;
8967       }
8968       offset += 2;
8969
8970       proto_tree_add_item(tree, hf_ieee80211_tclas_process, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8971       proto_item_append_text(ti, " : %s", val_to_str(tvb_get_guint8(tvb, offset), ieee80211_tclas_process_flag, "Unknown %d"));
8972       offset += 1;
8973       break;
8974
8975     case TAG_QOS_CAPABILITY: /* 7.3.2.35 QoS Capability element (46) */
8976       if (tag_len != 1)
8977       {
8978         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
8979         break;
8980       }
8981       {
8982         /* proto_item *ti_cap;
8983         proto_tree *cap_tree; */
8984         offset += 2;
8985         offset = dissect_qos_capability(tree, tvb, offset, ftype);
8986       }
8987       break;
8988
8989     case TAG_RSN_IE: /* 7.3.2.25 RSN information element (48) */
8990       if (tag_len < 20)
8991       {
8992         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be >= 20", tag_len);
8993         break;
8994       }
8995       offset += 2;
8996
8997       offset = dissect_rsn_ie(tree, tvb, offset, tag_len);
8998       break;
8999
9000     case TAG_EXT_SUPP_RATES: /* 7.3.2.14 Extended Supported Rates element (50) */
9001       if(tag_len < 1)
9002       {
9003         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be greater than 0", tag_len);
9004         break;
9005       }
9006       offset += 2;
9007
9008       while(offset < tag_end)
9009       {
9010         proto_tree_add_item(tree, hf_ieee80211_tag_ext_supp_rates, tvb, offset, 1, ENC_NA);
9011         proto_item_append_text(ti, " %s,", val_to_str(tvb_get_guint8(tvb, offset), ieee80211_supported_rates_vals, "Unknown Rate") );
9012         offset += 1;
9013       }
9014       proto_item_append_text(ti, " [Mbit/sec]");
9015       break;
9016
9017     case TAG_EXTENDED_CAPABILITIES: /* 7.3.2.27 Extended Capabilities information element (127) */
9018     {
9019       proto_item *ti_ex_cap;
9020       proto_tree *ex_cap_tree;
9021
9022       if (tag_len < 1)
9023       {
9024         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be greater than 0", tag_len);
9025         break;
9026       }
9027       offset += 2;
9028
9029       /* Extended Capability octet 0 */
9030       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9031       proto_item_append_text(ti_ex_cap, " (octet 0)");
9032       ex_cap_tree = proto_item_add_subtree (ti_ex_cap, ett_tag_ex_cap);
9033       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b0, tvb, offset, 1, ENC_NA);
9034       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b1, tvb, offset, 1, ENC_NA);
9035       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b2, tvb, offset, 1, ENC_NA);
9036       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b3, tvb, offset, 1, ENC_NA);
9037       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b4, tvb, offset, 1, ENC_NA);
9038       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b6, tvb, offset, 1, ENC_NA);
9039       offset += 1;
9040
9041       /* Extended Capability octet 1 */
9042       if (offset >= tag_end) {
9043         break;
9044       }
9045       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9046       proto_item_append_text(ti_ex_cap, " (octet 1)");
9047       offset += 1;
9048
9049       /* Extended Capability octet 2 */
9050       if (offset >= tag_end) {
9051         break;
9052       }
9053       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9054       proto_item_append_text(ti_ex_cap, " (octet 2)");
9055       offset += 1;
9056
9057       /* Extended Capability octet 3 */
9058       if (offset >= tag_end) {
9059         break;
9060       }
9061       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9062       proto_item_append_text(ti_ex_cap, " (octet 3)");
9063       ex_cap_tree = proto_item_add_subtree(ti_ex_cap, ett_tag_ex_cap);
9064       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b27, tvb, offset, 1, ENC_NA);
9065       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b28, tvb, offset, 1, ENC_NA);
9066       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b29, tvb, offset, 1, ENC_NA);
9067       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b30, tvb, offset, 1, ENC_NA);
9068       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b31, tvb, offset, 1, ENC_NA);
9069       offset += 1;
9070
9071       /* Extended Capability octet 4 */
9072       if (offset >= tag_end) {
9073         break;
9074       }
9075       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9076       proto_item_append_text(ti_ex_cap, " (octet 4)");
9077       ex_cap_tree = proto_item_add_subtree(ti_ex_cap, ett_tag_ex_cap);
9078       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b32, tvb, offset, 1, ENC_NA);
9079       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b33, tvb, offset, 1, ENC_NA);
9080       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b34, tvb, offset, 1, ENC_NA);
9081       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b36, tvb, offset, 1, ENC_NA);
9082       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b37, tvb, offset, 1, ENC_NA);
9083       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b38, tvb, offset, 1, ENC_NA);
9084       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b39, tvb, offset, 1, ENC_NA);
9085       offset += 1;
9086
9087       /* Extended Capability octet 5 */
9088       if (offset >= tag_end) {
9089         break;
9090       }
9091       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9092       proto_item_append_text(ti_ex_cap, " (octet 5)");
9093       ex_cap_tree = proto_item_add_subtree(ti_ex_cap, ett_tag_ex_cap);
9094       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b40, tvb, offset, 1, ENC_NA);
9095       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_serv_int_granularity, tvb, offset, 1, ENC_NA);
9096       offset += 1;
9097
9098       break;
9099
9100     case TAG_CISCO_CCX1_CKIP: /* Cisco CCX1 CKIP + Device Name (133) */
9101       /* From WCS manual:
9102        * If Aironet IE support is enabled, the access point sends an Aironet
9103        * IE 0x85 (which contains the access point name, load, number of
9104        * associated clients, and so on) in the beacon and probe responses of
9105        * this WLAN, and the controller sends Aironet IEs 0x85 and 0x95
9106        * (which contains the management IP address of the controller and
9107        * the IP address of the access point) in the reassociation response
9108        * if it receives Aironet IE 0x85 in the reassociation request.
9109        */
9110
9111       if (tag_len < 26)
9112       {
9113         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u too short, must be >= 26", tag_len);
9114         break;
9115       }
9116       offset += 2;
9117       proto_tree_add_item(tree, hf_ieee80211_tag_cisco_ccx1_unknown, tvb, offset, 10, ENC_NA);
9118       offset += 10;
9119
9120       /* The Name of the sending device starts at offset 10 and is up to
9121          15 or 16 bytes in length, \0 padded */
9122       proto_tree_add_item(tree, hf_ieee80211_tag_cisco_ccx1_name, tvb, offset, 16, ENC_ASCII|ENC_NA);
9123       offset += 16;
9124
9125       /* Total number off associated clients and repeater access points */
9126       proto_tree_add_item(tree, hf_ieee80211_tag_cisco_ccx1_clients, tvb, offset, 1, ENC_NA);
9127       offset += 1;
9128       break;
9129
9130     case TAG_VENDOR_SPECIFIC_IE: /* 7.3.2.26 Vendor Specific information element (221) */
9131       if (tag_len < 3)
9132       {
9133         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be >= 3", tag_len);
9134         break;
9135       }
9136       {
9137
9138         offset += 2;
9139         oui = tvb_get_ntoh24(tvb, offset);
9140         tag_tvb = tvb_new_subset(tvb, offset, tag_len, tag_len);
9141         proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
9142         proto_item_append_text(ti, ": %s", tvb_get_manuf_name(tvb, offset));
9143
9144         if (tag_len > 3) {
9145           proto_tree_add_item(ti, hf_ieee80211_tag_vendor_oui_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
9146         }
9147
9148 #define WPAWME_OUI  0x0050F2
9149 #define RSNOUI_VAL  0x000FAC
9150 #define PRE11N_OUI  0x00904c
9151
9152       switch (oui) {
9153         case WPAWME_OUI:
9154           offset = dissect_vendor_ie_wpawme(tree, tvb, offset + 3, tag_len, ftype);
9155           break;
9156         case RSNOUI_VAL:
9157           dissect_vendor_ie_rsn(ti, tree, tag_tvb);
9158           break;
9159         case OUI_CISCOWL:  /* Cisco Wireless (Aironet) */
9160           dissect_vendor_ie_aironet(ti, tree, tvb, offset + 3, tag_len - 3);
9161           break;
9162         case PRE11N_OUI:
9163           dissect_vendor_ie_ht(ti, tree, tag_tvb);
9164           break;
9165         case OUI_MARVELL:
9166           dissect_vendor_ie_marvell(ti, tree, tvb, offset + 3, tag_len - 3);
9167           break;
9168         case OUI_WFA:
9169           dissect_vendor_ie_wfa(pinfo, ti, tag_tvb);
9170           break;
9171         case OUI_ATHEROS:
9172           dissect_vendor_ie_atheros(ti, tree, tvb, offset + 3, tag_len, pinfo, tag_end, ti_len);
9173           break;
9174         default:
9175           proto_tree_add_string (tree, hf_ieee80211_tag_interpretation, tvb, offset + 3,
9176             tag_len - 3, "Not interpreted");
9177           break;
9178         }
9179
9180       }
9181       break;
9182
9183
9184
9185     case TAG_MOBILITY_DOMAIN:
9186       dissect_mobility_domain(tree, tvb, offset + 2, tag_len);
9187       break;
9188
9189     case TAG_FAST_BSS_TRANSITION:
9190       dissect_fast_bss_transition(tree, tvb, offset + 2, tag_len);
9191       break;
9192
9193     case TAG_MMIE:
9194       dissect_mmie(tree, tvb, offset + 2, tag_len);
9195       break;
9196
9197     case TAG_TIME_ZONE:
9198       dissect_time_zone(tree, tvb, offset + 2, tag_len);
9199       break;
9200
9201     case TAG_TIMEOUT_INTERVAL:
9202       dissect_timeout_interval(tree, tvb, offset + 2, tag_len);
9203       break;
9204
9205     case TAG_LINK_IDENTIFIER:
9206       dissect_link_identifier(tree, tvb, offset + 2, tag_len);
9207       break;
9208
9209     case TAG_WAKEUP_SCHEDULE:
9210       dissect_wakeup_schedule(tree, tvb, offset + 2, tag_len);
9211       break;
9212
9213     case TAG_CHANNEL_SWITCH_TIMING:
9214       dissect_channel_switch_timing(tree, tvb, offset + 2, tag_len);
9215       break;
9216
9217     case TAG_PTI_CONTROL:
9218       dissect_pti_control(tree, tvb, offset + 2, tag_len);
9219       break;
9220
9221     case TAG_PU_BUFFER_STATUS:
9222       dissect_pu_buffer_status(tree, tvb, offset + 2, tag_len);
9223       break;
9224
9225     case TAG_HT_CAPABILITY:
9226       dissect_ht_capability_ie(tree, tvb, offset + 2, tag_len, FALSE);
9227       break;
9228
9229     case TAG_HT_INFO:
9230       dissect_ht_info_ie_1_1(tree, tvb, offset + 2, tag_len);
9231       break;
9232     case TAG_SECONDARY_CHANNEL_OFFSET:
9233       secondary_channel_offset_ie(tree, tvb, offset + 2, tag_len);
9234       break;
9235
9236     case TAG_TIME_ADV:
9237       dissect_time_adv(tree, tvb, offset + 2);
9238       break;
9239
9240     case TAG_MESH_PEERING_MGMT:
9241       {
9242         guint start = offset + 2;
9243         offset += 2;
9244         proto_tree_add_item (tree, hf_ieee80211_mesh_peering_proto, tvb, offset, 2, ENC_LITTLE_ENDIAN);
9245         offset += 2;
9246         proto_tree_add_item (tree, hf_ieee80211_mesh_peering_local_link_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
9247         offset += 2;
9248         switch (tvb_get_guint8(tvb, 1))
9249           {                                         /* Self-protected action field */
9250           case SELFPROT_ACTION_MESH_PEERING_OPEN:
9251             break;
9252
9253           case SELFPROT_ACTION_MESH_PEERING_CONFIRM:
9254             proto_tree_add_item (tree, hf_ieee80211_mesh_peering_peer_link_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
9255             offset += 2;
9256             break;
9257
9258           case SELFPROT_ACTION_MESH_PEERING_CLOSE:
9259             if (tag_len == 8 || tag_len == 24)
9260               {
9261                 proto_tree_add_item (tree, hf_ieee80211_mesh_peering_peer_link_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
9262                 offset += 2;
9263               }
9264             offset += add_fixed_field(tree, tvb, offset, FIELD_REASON_CODE);
9265             break;
9266
9267           /* unexpected values */
9268           default:
9269             proto_tree_add_text (tree, tvb, offset, tag_len, "Unexpected Self-protected action");
9270             offset += tag_len;
9271             break;
9272           }
9273         if (tag_len - (offset - start) == 16)
9274           {
9275             proto_tree_add_item(tree, hf_ieee80211_rsn_pmkid, tvb, offset, 16, ENC_NA);
9276             offset +=16;
9277           }
9278         break;
9279       }
9280
9281     case TAG_MESH_CONFIGURATION:
9282       {
9283         offset += 2;
9284         proto_tree_add_item (tree, hf_ieee80211_mesh_config_path_sel_protocol, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9285         proto_tree_add_item (tree, hf_ieee80211_mesh_config_path_sel_metric, tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
9286         proto_tree_add_item (tree, hf_ieee80211_mesh_config_congestion_control, tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
9287         proto_tree_add_item (tree, hf_ieee80211_mesh_config_sync_method, tvb, offset + 3, 1, ENC_LITTLE_ENDIAN);
9288         proto_tree_add_item (tree, hf_ieee80211_mesh_config_auth_protocol, tvb, offset + 4, 1, ENC_LITTLE_ENDIAN);
9289         proto_tree_add_item (tree, hf_ieee80211_mesh_config_formation_info, tvb, offset + 5, 1, ENC_LITTLE_ENDIAN);
9290         proto_tree_add_item (tree, hf_ieee80211_mesh_config_capability, tvb, offset + 6, 1, ENC_LITTLE_ENDIAN);
9291         break;
9292       }
9293
9294     case TAG_MESH_ID:
9295       {
9296         offset += 2;
9297
9298         proto_tree_add_item(tree, hf_ieee80211_mesh_id, tvb, offset, tag_len, ENC_ASCII|ENC_NA);
9299         if (tag_len > 0) {
9300             col_append_fstr(pinfo->cinfo, COL_INFO, ", MESHID=%s", tvb_get_ephemeral_string(tvb, offset, tag_len));
9301             proto_item_append_text(ti, ": %s", tvb_get_ephemeral_string(tvb, offset, tag_len));
9302         }
9303
9304       break;
9305       }
9306
9307     case TAG_MESH_PREQ:
9308       {
9309         guint8 flags = tvb_get_guint8(tvb, offset + 2);
9310         guint8 targs, i;
9311         proto_item *item;
9312         proto_tree *subtree;
9313
9314         offset += 2;
9315         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9316         offset += 1;
9317         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_hopcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9318         offset += 1;
9319         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_ttl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9320         offset += 1;
9321         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_pdid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9322         offset += 4;
9323         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_sta, tvb, offset, 6, ENC_NA);
9324         offset += 6;
9325         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9326         offset += 4;
9327
9328         if (flags & (1<<6)) {
9329           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_ext, tvb, offset, 6, ENC_NA);
9330           offset += 6;
9331         }
9332         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_lifetime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9333         offset += 4;
9334         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9335         offset += 4;
9336         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9337         targs = tvb_get_guint8 (tvb, offset);
9338         offset += 1;
9339         for (i = 0; i < targs; i++) {
9340           item = proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9341           subtree = proto_item_add_subtree(item, ett_hwmp_targ_flags_tree);
9342           proto_tree_add_boolean(subtree, hf_ieee80211_ff_hwmp_targ_to_flags, tvb, offset, 1, flags);
9343           proto_tree_add_boolean(subtree, hf_ieee80211_ff_hwmp_targ_usn_flags, tvb, offset, 1, flags);
9344           offset += 1;
9345           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sta, tvb, offset, 6, ENC_NA);
9346           offset += 6;
9347           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9348           offset += 4;
9349         }
9350         break;
9351       }
9352
9353     case TAG_MESH_PREP:
9354       {
9355         guint8 flags = tvb_get_guint8(tvb, offset + 2);
9356         offset += 2;
9357         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9358         offset += 1;
9359         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_hopcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9360         offset += 1;
9361         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_ttl, 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         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_lifetime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9372         offset += 4;
9373         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9374         offset += 4;
9375         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_sta, tvb, offset, 6, ENC_NA);
9376         offset += 6;
9377         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9378         offset += 4;
9379         break;
9380       }
9381
9382     case TAG_MESH_PERR:
9383       {
9384         guint8 targs, i;
9385
9386         offset += 2;
9387         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_ttl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9388         offset += 1;
9389         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_count, tvb, offset, 1, ENC_BIG_ENDIAN);
9390         targs = tvb_get_guint8 (tvb, offset);
9391         offset += 1;
9392         for (i = 0; i < targs; i++) {
9393           guint8 flags = tvb_get_guint8(tvb, offset);
9394
9395           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9396           offset += 1;
9397           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sta, tvb, offset, 6, ENC_NA);
9398           offset += 6;
9399           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9400           offset += 4;
9401           if (flags & (1<<6)) {
9402             proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_ext, tvb, offset, 6, ENC_NA);
9403             offset += 6;
9404           }
9405           offset += add_fixed_field(tree, tvb, offset, FIELD_REASON_CODE);
9406         }
9407         break;
9408       }
9409
9410     case TAG_RANN:
9411       {
9412         offset += 2;
9413         proto_tree_add_item (tree, hf_ieee80211_rann_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
9414         offset += 1;
9415         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_hopcount, tvb, offset, 1, ENC_BIG_ENDIAN);
9416         offset += 1;
9417         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_ttl, tvb, offset, 1, ENC_BIG_ENDIAN);
9418         offset += 1;
9419         proto_tree_add_item (tree, hf_ieee80211_rann_root_sta, tvb, offset, 6, ENC_NA);
9420         offset += 6;
9421         proto_tree_add_item (tree, hf_ieee80211_rann_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9422         offset += 4;
9423         proto_tree_add_item (tree, hf_ieee80211_rann_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9424         offset += 4;
9425         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9426         offset += 4;
9427         break;
9428       }
9429       break;
9430     }
9431
9432     case TAG_INTERWORKING:
9433       dissect_interworking(pinfo, tree, ti, tvb, offset);
9434       break;
9435     case TAG_ADVERTISEMENT_PROTOCOL:
9436     {
9437       dissect_advertisement_protocol(pinfo, tree, tvb, offset, NULL);
9438       break;
9439     }
9440     case TAG_ROAMING_CONSORTIUM:
9441       dissect_roaming_consortium(pinfo, tree, ti, tvb, offset);
9442       break;
9443
9444     case TAG_NEIGHBOR_REPORT:
9445     {
9446       #define SUB_TAG_TSF_INFO                 0x01
9447       #define SUB_TAG_MEASUREMENT_PILOT_INFO   0x02
9448       #define SUB_TAG_HT_CAPABILITIES          0x03
9449       #define SUB_TAG_HT_INFO                  0x04
9450       #define SUB_TAG_SEC_CHANNEL_OFFSET       0x05
9451       #define SUB_TAG_VENDOR_SPECIFIC          0xDD
9452
9453
9454       guint tag_offset;
9455       guint8 sub_tag_id;
9456       guint32 bssid_info, info, sub_tag_length;
9457       proto_item *parent_item;
9458       proto_tree *bssid_info_subtree, *sub_tag_tree;
9459       tvbuff_t *volatile sub_tag_tvb = NULL;
9460
9461       if (tag_len < 13)
9462       {
9463         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
9464             "Neighbor Report: Error: Tag length must be at least 13 bytes long");
9465         break;
9466       }
9467       offset+=2;
9468       tag_offset = offset;
9469
9470       proto_tree_add_item(tree, hf_ieee80211_tag_neighbor_report_bssid, tvb, offset, 6, ENC_NA);
9471
9472       /*** Begin: BSSID Information ***/
9473       offset+=6;
9474       bssid_info = tvb_get_letohl (tvb, offset);
9475       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);
9476       bssid_info_subtree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_bssid_info_tree);
9477
9478       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_reachability, tvb, offset, 1, bssid_info);
9479       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_security, tvb, offset, 1, bssid_info);
9480       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_key_scope, tvb, offset, 1, bssid_info);
9481       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_spec_mng, tvb, offset, 1, bssid_info);
9482       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_qos, tvb, offset, 1, bssid_info);
9483       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_apsd, tvb, offset, 1, bssid_info);
9484       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_radio_msnt, tvb, offset, 1, bssid_info);
9485       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_dback, tvb, offset+1, 1, bssid_info);
9486       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_iback, tvb, offset+1, 1, bssid_info);
9487       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_mobility_domain, tvb, offset+1, 1, bssid_info);
9488       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_high_throughput, tvb, offset+1, 1, bssid_info);
9489       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_reserved, tvb, offset+1, 3, (bssid_info & 0xfffff000) >> 12);
9490       /*** End: BSSID Information ***/
9491
9492       offset+=4;
9493       info = tvb_get_guint8 (tvb, offset);
9494       proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_reg_class, tvb, offset, 1, info, "Regulatory Class: 0x%02X", info);
9495
9496       offset++;
9497       info = tvb_get_guint8 (tvb, offset);
9498       proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_channel_number, tvb, offset, 1, info, "Channel Number: 0x%02X", info);
9499
9500       offset++;
9501       info = tvb_get_guint8 (tvb, offset);
9502       proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_phy_type, tvb, offset, 1, info, "PHY Type: 0x%02X", info);
9503
9504       offset++;
9505       sub_tag_id = tvb_get_guint8 (tvb, offset);
9506       offset++;
9507       sub_tag_length = tvb_get_guint8 (tvb, offset);
9508
9509       offset++;
9510       sub_tag_tvb = tvb_new_subset(tvb, offset, sub_tag_length, -1);
9511
9512       switch (sub_tag_id) {
9513         case SUB_TAG_TSF_INFO:
9514           /* TODO */
9515           break;
9516         case SUB_TAG_MEASUREMENT_PILOT_INFO:
9517           /* TODO */
9518           break;
9519         case SUB_TAG_HT_CAPABILITIES:
9520           parent_item = proto_tree_add_text (tree, tvb, offset, sub_tag_length, "HT Capabilities");
9521           sub_tag_tree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_sub_tag_tree);
9522           dissect_ht_capability_ie(sub_tag_tree, sub_tag_tvb, 0, sub_tag_length, FALSE);
9523           break;
9524         case SUB_TAG_HT_INFO:
9525           parent_item = proto_tree_add_text (tree, tvb, offset, sub_tag_length, "HT Information");
9526           sub_tag_tree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_sub_tag_tree);
9527           dissect_ht_info_ie_1_1(sub_tag_tree, sub_tag_tvb, 0, sub_tag_length);
9528           break;
9529         case SUB_TAG_SEC_CHANNEL_OFFSET:
9530           parent_item = proto_tree_add_text (tree, tvb, offset, sub_tag_length, "Secondary Channel Offset");
9531           sub_tag_tree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_sub_tag_tree);
9532           secondary_channel_offset_ie(sub_tag_tree, sub_tag_tvb, 0, sub_tag_length);
9533           break;
9534         case SUB_TAG_VENDOR_SPECIFIC:
9535         default:
9536           break;
9537       }
9538
9539       offset += sub_tag_length;
9540
9541       if (tag_len > (offset - tag_offset))
9542       {
9543         proto_tree_add_text (tree, tvb, offset, tag_len - (offset - tag_offset), "Unknown Data");
9544         break;
9545       }
9546       break;
9547     }
9548
9549     case TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT:
9550     {
9551       guint tag_offset;
9552
9553       if (tag_len != 4)
9554       {
9555         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
9556             "Extended Channel Switch Announcement: Error: Tag length must be exactly 4 bytes long");
9557         break;
9558       }
9559
9560       offset+=2;
9561       tag_offset = offset;
9562
9563       offset+= add_fixed_field(tree, tvb, offset, FIELD_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT);
9564
9565       if (tag_len > (offset - tag_offset))
9566       {
9567         proto_tree_add_text (tree, tvb, offset, tag_len - (offset - tag_offset), "Unknown Data");
9568         break;
9569       }
9570       break;
9571     }
9572     case TAG_SUPPORTED_REGULATORY_CLASSES:
9573     {
9574       guint8 current_field;
9575       guint i;
9576
9577       if (tag_len < 2) {
9578         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
9579             "Supported Regulatory Classes: Error: Tag length must be at least 2 bytes long");
9580         break;
9581       } else if (tag_len > 32) {
9582         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
9583             "Supported Regulatory Classes: Error: Tag length must be no more than 32 bytes long");
9584         break;
9585       }
9586
9587       offset+=2;
9588
9589       current_field = tvb_get_guint8 (tvb, offset);
9590       proto_tree_add_uint(tree, hf_ieee80211_tag_supported_reg_classes_current, tvb, offset, 1, current_field);
9591
9592       offset++;
9593       /* Partially taken from the ssid section */
9594       tag_data_ptr = tvb_get_ptr (tvb, offset, tag_len);
9595       for (i = 0, n = 0; i < tag_len && n < SHORT_STR; i++) {
9596         ret = g_snprintf (print_buff + n, SHORT_STR - n, (i == tag_len-1)?"%d":"%d, ", tag_data_ptr[i]);
9597         if (ret >= SHORT_STR - n) {
9598           /* ret >= <buf_size> means buffer truncated  */
9599           break;
9600         }
9601         n += ret;
9602       }
9603       proto_tree_add_string (tree, hf_ieee80211_tag_supported_reg_classes_alternate, tvb, offset, tag_len, print_buff);
9604
9605       break;
9606     }
9607     default:
9608       tvb_ensure_bytes_exist (tvb, offset + 2, tag_len);
9609       proto_tree_add_string (tree, hf_ieee80211_tag_interpretation, tvb, offset + 1 + 1,
9610           tag_len, "Not interpreted");
9611       proto_item_append_text(ti, ": Tag %u Len %u", tag_no, tag_len);
9612       break;
9613   }
9614   if(offset < tag_end){
9615     /* TODO: add Expert info to indicate there is unknown data ! but all tagged option don't yet return offset.
9616       For the moment, this code only remove Clang Warnings about not used offset... */
9617   }
9618   return tag_len + 1 + 1;
9619 }
9620
9621 void
9622 ieee_80211_add_tagged_parameters (tvbuff_t * tvb, int offset, packet_info * pinfo,
9623   proto_tree * tree, int tagged_parameters_len, int ftype)
9624 {
9625   int next_len;
9626
9627   beacon_padding = 0; /* this is for the beacon padding confused with ssid fix */
9628   while (tagged_parameters_len > 0) {
9629     if ((next_len=add_tagged_field (pinfo, tree, tvb, offset, ftype))==0)
9630       break;
9631     if (next_len > tagged_parameters_len) {
9632       /* XXX - flag this as an error? */
9633       next_len = tagged_parameters_len;
9634     }
9635     offset += next_len;
9636     tagged_parameters_len -= next_len;
9637   }
9638 }
9639
9640 /* ************************************************************************* */
9641 /*                     Dissect 802.11 management frame                       */
9642 /* ************************************************************************* */
9643 static void
9644 dissect_ieee80211_mgt (guint16 fcf, tvbuff_t * tvb, packet_info * pinfo,
9645     proto_tree * tree)
9646 {
9647   proto_item *ti = NULL;
9648   proto_tree *mgt_tree;
9649   proto_tree *fixed_tree;
9650   proto_tree *tagged_tree;
9651   int offset = 0;
9652   int tagged_parameter_tree_len;
9653
9654   g_pinfo = pinfo;
9655   ieee80211_tvb_invalid = FALSE;
9656
9657   CHECK_DISPLAY_AS_X(data_handle,proto_wlan_mgt, tvb, pinfo, tree);
9658
9659   ti = proto_tree_add_item (tree, proto_wlan_mgt, tvb, 0, -1, ENC_NA);
9660   mgt_tree = proto_item_add_subtree (ti, ett_80211_mgt);
9661
9662   switch (COMPOSE_FRAME_TYPE(fcf))
9663   {
9664
9665     case MGT_ASSOC_REQ:
9666       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 4);
9667       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
9668       add_fixed_field(fixed_tree, tvb, 2, FIELD_LISTEN_IVAL);
9669       offset = 4;  /* Size of fixed fields */
9670
9671       tagged_parameter_tree_len =
9672           tvb_reported_length_remaining(tvb, offset);
9673       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9674                  tagged_parameter_tree_len);
9675       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9676           tagged_parameter_tree_len, MGT_ASSOC_REQ);
9677       break;
9678
9679
9680     case MGT_ASSOC_RESP:
9681       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 6);
9682       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
9683       add_fixed_field(fixed_tree, tvb, 2, FIELD_STATUS_CODE);
9684       add_fixed_field(fixed_tree, tvb, 4, FIELD_ASSOC_ID);
9685       offset = 6;  /* Size of fixed fields */
9686
9687       tagged_parameter_tree_len =
9688           tvb_reported_length_remaining(tvb, offset);
9689       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9690                  tagged_parameter_tree_len);
9691       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9692           tagged_parameter_tree_len, MGT_ASSOC_RESP);
9693       break;
9694
9695
9696     case MGT_REASSOC_REQ:
9697       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 10);
9698       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
9699       add_fixed_field(fixed_tree, tvb, 2, FIELD_LISTEN_IVAL);
9700       add_fixed_field(fixed_tree, tvb, 4, FIELD_CURRENT_AP_ADDR);
9701       offset = 10;  /* Size of fixed fields */
9702
9703       tagged_parameter_tree_len =
9704           tvb_reported_length_remaining(tvb, offset);
9705       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9706                  tagged_parameter_tree_len);
9707       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9708           tagged_parameter_tree_len, MGT_REASSOC_REQ);
9709       break;
9710
9711     case MGT_REASSOC_RESP:
9712       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 6);
9713       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
9714       add_fixed_field(fixed_tree, tvb, 2, FIELD_STATUS_CODE);
9715       add_fixed_field(fixed_tree, tvb, 4, FIELD_ASSOC_ID);
9716       offset = 6;  /* Size of fixed fields */
9717
9718       tagged_parameter_tree_len =
9719           tvb_reported_length_remaining(tvb, offset);
9720       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9721                  tagged_parameter_tree_len);
9722       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9723           tagged_parameter_tree_len, MGT_REASSOC_RESP);
9724       break;
9725
9726
9727     case MGT_PROBE_REQ:
9728       offset = 0;
9729       tagged_parameter_tree_len =
9730           tvb_reported_length_remaining(tvb, offset);
9731       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9732                  tagged_parameter_tree_len);
9733       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9734           tagged_parameter_tree_len, MGT_PROBE_REQ);
9735       break;
9736
9737     case MGT_PROBE_RESP:
9738     {
9739       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 12);
9740       add_fixed_field(fixed_tree, tvb, 0, FIELD_TIMESTAMP);
9741       add_fixed_field(fixed_tree, tvb, 8, FIELD_BEACON_INTERVAL);
9742       add_fixed_field(fixed_tree, tvb, 10, FIELD_CAP_INFO);
9743       offset = 12;  /* Size of fixed fields */
9744
9745       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9746       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset, tagged_parameter_tree_len);
9747       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree, tagged_parameter_tree_len, MGT_PROBE_RESP);
9748       break;
9749     }
9750     case MGT_MEASUREMENT_PILOT:
9751     {
9752       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 12);
9753       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_TIMESTAMP);
9754       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_MEASUREMENT_PILOT_INT);
9755       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_BEACON_INTERVAL);
9756       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_CAP_INFO);
9757       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_COUNTRY_STR);
9758       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_MAX_REG_PWR);
9759       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_MAX_TX_PWR);
9760       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_TX_PWR_USED);
9761       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_TRANSCEIVER_NOISE_FLOOR);
9762       /* TODO DS Parameter Set ??? */
9763
9764       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9765       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset, tagged_parameter_tree_len);
9766       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree, tagged_parameter_tree_len, MGT_MEASUREMENT_PILOT);
9767       break;
9768     }
9769     case MGT_BEACON:    /* Dissect protocol payload fields  */
9770       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 12);
9771       add_fixed_field(fixed_tree, tvb, 0, FIELD_TIMESTAMP);
9772       add_fixed_field(fixed_tree, tvb, 8, FIELD_BEACON_INTERVAL);
9773       add_fixed_field(fixed_tree, tvb, 10, FIELD_CAP_INFO);
9774       offset = 12;  /* Size of fixed fields */
9775
9776       tagged_parameter_tree_len =
9777           tvb_reported_length_remaining(tvb, offset);
9778       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9779       tagged_parameter_tree_len);
9780       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9781       tagged_parameter_tree_len, MGT_BEACON);
9782       break;
9783
9784     case MGT_ATIM:
9785       break;
9786
9787     case MGT_DISASS:
9788       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 2);
9789       add_fixed_field(fixed_tree, tvb, 0, FIELD_REASON_CODE);
9790       offset = 2; /* Size of fixed fields */
9791       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9792       if (tagged_parameter_tree_len > 0) {
9793         tagged_tree = get_tagged_parameter_tree(mgt_tree, tvb, offset,
9794                                                 tagged_parameter_tree_len);
9795         ieee_80211_add_tagged_parameters(tvb, offset, pinfo, tagged_tree,
9796                                          tagged_parameter_tree_len, MGT_DISASS);
9797       }
9798       break;
9799
9800     case MGT_AUTHENTICATION:
9801       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 6);
9802       add_fixed_field(fixed_tree, tvb, 0, FIELD_AUTH_ALG);
9803       add_fixed_field(fixed_tree, tvb, 2, FIELD_AUTH_TRANS_SEQ);
9804       add_fixed_field(fixed_tree, tvb, 4, FIELD_STATUS_CODE);
9805       offset = 6;  /* Size of fixed fields */
9806
9807       tagged_parameter_tree_len =
9808         tvb_reported_length_remaining(tvb, offset);
9809       if (tagged_parameter_tree_len > 0)
9810       {
9811         tagged_tree = get_tagged_parameter_tree (mgt_tree,
9812             tvb,
9813             offset,
9814             tagged_parameter_tree_len);
9815         ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9816         tagged_parameter_tree_len, MGT_AUTHENTICATION);
9817       }
9818       break;
9819
9820     case MGT_DEAUTHENTICATION:
9821       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 2);
9822       add_fixed_field(fixed_tree, tvb, 0, FIELD_REASON_CODE);
9823       offset = 2; /* Size of fixed fields */
9824       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9825       if (tagged_parameter_tree_len > 0) {
9826         tagged_tree = get_tagged_parameter_tree(mgt_tree, tvb, offset,
9827                                                 tagged_parameter_tree_len);
9828         ieee_80211_add_tagged_parameters(tvb, offset, pinfo, tagged_tree,
9829                                          tagged_parameter_tree_len, MGT_DEAUTHENTICATION);
9830       }
9831       break;
9832
9833     case MGT_ACTION:
9834     {
9835       proto_item *lcl_fixed_hdr;
9836       proto_tree *lcl_fixed_tree;
9837       lcl_fixed_hdr = proto_tree_add_text(mgt_tree, tvb, 0, 0, "Fixed parameters");
9838       lcl_fixed_tree = proto_item_add_subtree (lcl_fixed_hdr, ett_fixed_parameters);
9839
9840       offset += add_fixed_field(lcl_fixed_tree, tvb, 0, FIELD_ACTION);
9841
9842       proto_item_set_len(lcl_fixed_hdr, offset);
9843       if (ieee80211_tvb_invalid)
9844         break; /* Buffer not available for further processing */
9845       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9846       if (tagged_parameter_tree_len > 0)
9847       {
9848         tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9849           tagged_parameter_tree_len);
9850         ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9851           tagged_parameter_tree_len, MGT_ACTION);
9852       }
9853       break;
9854     }
9855     case MGT_ACTION_NO_ACK:
9856     {
9857       proto_item *lcl_fixed_hdr;
9858       proto_tree *lcl_fixed_tree;
9859       lcl_fixed_hdr = proto_tree_add_text(mgt_tree, tvb, 0, 0, "Fixed parameters");
9860       lcl_fixed_tree = proto_item_add_subtree (lcl_fixed_hdr, ett_fixed_parameters);
9861
9862       offset += add_fixed_field(lcl_fixed_tree, tvb, 0, FIELD_ACTION);
9863
9864       proto_item_set_len(lcl_fixed_hdr, offset);
9865       if (ieee80211_tvb_invalid)
9866         break; /* Buffer not available for further processing */
9867       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9868       if (tagged_parameter_tree_len > 0)
9869       {
9870         tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9871           tagged_parameter_tree_len);
9872         ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9873           tagged_parameter_tree_len, MGT_ACTION_NO_ACK);
9874       }
9875       break;
9876     }
9877     case MGT_ARUBA_WLAN:
9878     {
9879       proto_item *aruba_hdr;
9880       proto_tree *aruba_tree;
9881       guint16 type;
9882       type = tvb_get_ntohs(tvb, offset);
9883
9884       aruba_hdr = proto_tree_add_text(mgt_tree, tvb, 0, 0, "Aruba Management");
9885       aruba_tree = proto_item_add_subtree(aruba_hdr, ett_fixed_parameters);
9886
9887       proto_tree_add_item(aruba_tree, hf_ieee80211_aruba, tvb, offset, 2, ENC_BIG_ENDIAN);
9888       offset += 2;
9889       /* HeartBeat Sequence */
9890       if ( type == 0x0005 )
9891       {
9892         proto_tree_add_item(aruba_tree, hf_ieee80211_aruba_hb_seq, tvb, offset, 8, ENC_BIG_ENDIAN);
9893       }
9894       /* MTU Size */
9895       if ( type == 0x0003 )
9896       {
9897         proto_tree_add_item(aruba_tree, hf_ieee80211_aruba_mtu, tvb, offset, 2, ENC_BIG_ENDIAN);
9898       }
9899       break;
9900     }
9901   }
9902 }
9903
9904 static void
9905 set_src_addr_cols(packet_info *pinfo, const guint8 *addr, const char *type)
9906 {
9907   col_add_fstr(pinfo->cinfo, COL_RES_DL_SRC, "%s (%s)",
9908         get_ether_name(addr), type);
9909   col_add_str(pinfo->cinfo, COL_UNRES_DL_SRC, ether_to_str(addr));
9910 }
9911
9912 static void
9913 set_dst_addr_cols(packet_info *pinfo, const guint8 *addr, const char *type)
9914 {
9915   col_add_fstr(pinfo->cinfo, COL_RES_DL_DST, "%s (%s)",
9916         get_ether_name(addr), type);
9917   col_add_str(pinfo->cinfo, COL_UNRES_DL_DST, ether_to_str(addr));
9918 }
9919
9920 static guint32
9921 crc32_802_tvb_padded(tvbuff_t *tvb, guint hdr_len, guint hdr_size, guint len)
9922 {
9923   guint32 c_crc;
9924
9925   c_crc = crc32_ccitt_tvb(tvb, hdr_len);
9926   c_crc = crc32_ccitt_seed(tvb_get_ptr(tvb, hdr_size, len), len, ~c_crc);
9927
9928   /* Byte reverse. */
9929   c_crc = ((unsigned char)(c_crc>>0)<<24) |
9930     ((unsigned char)(c_crc>>8)<<16) |
9931     ((unsigned char)(c_crc>>16)<<8) |
9932     ((unsigned char)(c_crc>>24)<<0);
9933
9934   return ( c_crc );
9935 }
9936
9937 typedef enum {
9938     ENCAP_802_2,
9939     ENCAP_IPX,
9940     ENCAP_ETHERNET
9941 } encap_t;
9942
9943
9944 /* ************************************************************************* */
9945 /*                          Dissect 802.11 frame                             */
9946 /* ************************************************************************* */
9947
9948 /*
9949  * The 802.11n specification makes some fairly significant changes to the
9950  * layout of the MAC header.  The first two bits of the MAC header are the
9951  * protocol version.  You'd think that the 802.11 committee would have
9952  * bumped the version to indicate a different MAC layout, but NOOOO -- we
9953  * have to go digging for bits in various locations instead.
9954  */
9955
9956 static void
9957 dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo,
9958         proto_tree * tree, gboolean fixed_length_header, gint fcs_len,
9959         gboolean wlan_broken_fc, gboolean datapad,
9960         gboolean is_ht)
9961 {
9962   guint16 fcf, flags, frame_type_subtype, ctrl_fcf, ctrl_type_subtype;
9963   guint16 seq_control;
9964   guint32 seq_number, frag_number;
9965   gboolean more_frags;
9966   const guint8 *src = NULL;
9967   const guint8 *dst = NULL;
9968   const guint8 *bssid = NULL;
9969   proto_item *ti = NULL;
9970   proto_item *fcs_item = NULL;
9971   proto_item *cw_item = NULL;
9972   proto_item *hidden_item;
9973   proto_tree *volatile hdr_tree = NULL;
9974   proto_tree *fcs_tree = NULL;
9975   proto_tree *cw_tree = NULL;
9976   guint16 hdr_len, ohdr_len, htc_len = 0;
9977   gboolean has_fcs, fcs_good, fcs_bad;
9978   gint len, reported_len, ivlen;
9979   gboolean is_amsdu = 0;
9980   gboolean save_fragmented;
9981   tvbuff_t *volatile next_tvb = NULL;
9982   guint32 addr_type;
9983   volatile encap_t encap_type;
9984   guint8 octet1, octet2;
9985   char out_buff[SHORT_STR];
9986   gint is_iv_bad;
9987   guchar iv_buff[4];
9988   const char *addr1_str = NULL;
9989   int addr1_hf = -1;
9990   guint offset;
9991   const gchar *fts_str;
9992   gchar flag_str[] = "opmPRMFTC";
9993   gint ii;
9994   guint16 qosoff = 0, qos_control = 0;
9995   gint meshctl_len = 0;
9996   guint8 mesh_flags;
9997   guint16 meshoff = 0;
9998
9999   wlan_hdr *volatile whdr;
10000   static wlan_hdr whdrs[4];
10001   gboolean retransmitted;
10002
10003   whdr= &whdrs[0];
10004
10005   col_set_str (pinfo->cinfo, COL_PROTOCOL, "802.11");
10006   col_clear(pinfo->cinfo, COL_INFO);
10007
10008   fcf = FETCH_FCF(0);
10009   frame_type_subtype = COMPOSE_FRAME_TYPE(fcf);
10010   if (frame_type_subtype == CTRL_CONTROL_WRAPPER)
10011     ctrl_fcf = FETCH_FCF(10);
10012   else
10013     ctrl_fcf = 0;
10014
10015   if (fixed_length_header)
10016     hdr_len = DATA_LONG_HDR_LEN;
10017   else
10018     hdr_len = find_header_length (fcf, ctrl_fcf, is_ht);
10019
10020   fts_str = val_to_str_const(frame_type_subtype, frame_type_subtype_vals,
10021               "Unrecognized (Reserved frame)");
10022   col_set_str (pinfo->cinfo, COL_INFO, fts_str);
10023
10024
10025   flags = FCF_FLAGS (fcf);
10026   more_frags = HAVE_FRAGMENTS (flags);
10027
10028   for (ii = 0; ii < 8; ii++) {
10029     if (! (flags & 0x80 >> ii)) {
10030       flag_str[ii] = '.';
10031     }
10032   }
10033
10034   if (is_ht && IS_STRICTLY_ORDERED(flags) &&
10035     ((FCF_FRAME_TYPE(fcf) == MGT_FRAME) || (FCF_FRAME_TYPE(fcf) == DATA_FRAME &&
10036       DATA_FRAME_IS_QOS(frame_type_subtype)))) {
10037     htc_len = 4;
10038   }
10039
10040   /* adjust the header length depending on the Mesh Control field */
10041   if (FCF_FRAME_TYPE(fcf) == DATA_FRAME &&
10042       DATA_FRAME_IS_QOS(frame_type_subtype)) {
10043         qosoff = hdr_len - htc_len - 2;
10044         qos_control = tvb_get_letohs(tvb, qosoff);
10045         if (tvb_length(tvb) > hdr_len) {
10046             meshoff = hdr_len;
10047             mesh_flags = tvb_get_guint8 (tvb, hdr_len);
10048             if (has_mesh_control(fcf, qos_control, mesh_flags)) {
10049               meshctl_len = find_mesh_control_length(mesh_flags);
10050               hdr_len += meshctl_len;
10051             }
10052         }
10053   }
10054
10055   /*
10056    * Some portions of this code calculate offsets relative to the end of the
10057    * header.  But when the header has been padded to align the data this must
10058    * be done relative to true header size, not the padded/aligned value.  To
10059    * simplify this work we stash the original header size in ohdr_len instead
10060    * of recalculating it every time we need it.
10061    */
10062   ohdr_len = hdr_len;
10063   if (datapad)
10064     hdr_len = roundup2(hdr_len, 4);
10065
10066   /* Add the FC to the current tree */
10067   if (tree)
10068     {
10069       ti = proto_tree_add_protocol_format (tree, proto_wlan, tvb, 0, hdr_len,
10070           "IEEE 802.11 %s", fts_str);
10071       hdr_tree = proto_item_add_subtree (ti, ett_80211);
10072
10073       dissect_frame_control(hdr_tree, tvb, wlan_broken_fc, 0);
10074
10075       if (frame_type_subtype == CTRL_PS_POLL)
10076         proto_tree_add_uint(hdr_tree, hf_ieee80211_assoc_id, tvb, 2, 2, ENC_LITTLE_ENDIAN); //Need check this line....
10077
10078       else
10079         proto_tree_add_uint (hdr_tree, hf_ieee80211_did_duration, tvb, 2, 2,
10080             tvb_get_letohs (tvb, 2));
10081     }
10082
10083   /*
10084    * Decode the part of the frame header that isn't the same for all
10085    * frame types.
10086    */
10087   seq_control = 0;
10088   frag_number = 0;
10089   seq_number = 0;
10090
10091   switch (FCF_FRAME_TYPE (fcf))
10092   {
10093
10094     case MGT_FRAME:
10095       /*
10096        * All management frame types have the same header.
10097        */
10098       src = tvb_get_ptr (tvb, 10, 6);
10099       dst = tvb_get_ptr (tvb, 4, 6);
10100
10101       SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src);
10102       SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src);
10103       SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst);
10104       SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, dst);
10105
10106       /* for tap */
10107       SET_ADDRESS(&whdr->bssid, AT_ETHER, 6, tvb_get_ptr(tvb, 16,6));
10108       SET_ADDRESS(&whdr->src, AT_ETHER, 6, src);
10109       SET_ADDRESS(&whdr->dst, AT_ETHER, 6, dst);
10110       whdr->type = frame_type_subtype;
10111
10112       seq_control = tvb_get_letohs(tvb, 22);
10113       frag_number = SEQCTL_FRAGMENT_NUMBER(seq_control);
10114       seq_number = SEQCTL_SEQUENCE_NUMBER(seq_control);
10115
10116       col_append_fstr(pinfo->cinfo, COL_INFO,
10117             ", SN=%d", seq_number);
10118
10119       col_append_fstr(pinfo->cinfo, COL_INFO,
10120             ", FN=%d",frag_number);
10121
10122       if (tree)
10123       {
10124         proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 4, 6, dst);
10125
10126         proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 10, 6, src);
10127
10128         /* add items for wlan.addr filter */
10129         hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, dst);
10130         PROTO_ITEM_SET_HIDDEN(hidden_item);
10131         hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, src);
10132         PROTO_ITEM_SET_HIDDEN(hidden_item);
10133
10134         proto_tree_add_item (hdr_tree, hf_ieee80211_addr_bssid, tvb, 16, 6, ENC_NA);
10135
10136         proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10137             frag_number);
10138
10139         proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10140             seq_number);
10141       }
10142       break;
10143
10144     case CONTROL_FRAME:
10145     {
10146       /*
10147        * Control Wrapper frames insert themselves between address 1
10148        * and address 2 in a normal control frame.  Process address 1
10149        * first, then handle the rest of the frame in dissect_control.
10150        */
10151       if (frame_type_subtype == CTRL_CONTROL_WRAPPER) {
10152         offset = 10; /* FC + D/ID + Address 1 + CFC + HTC */
10153         ctrl_fcf = FETCH_FCF(10);
10154         ctrl_type_subtype = COMPOSE_FRAME_TYPE(ctrl_fcf);
10155       } else {
10156         offset = 10; /* FC + D/ID + Address 1 */
10157         ctrl_type_subtype = frame_type_subtype;
10158       }
10159
10160       switch (ctrl_type_subtype)
10161       {
10162         case CTRL_PS_POLL:
10163           addr1_str = "BSSID";
10164           addr1_hf = hf_ieee80211_addr_bssid;
10165           break;
10166         case CTRL_RTS:
10167         case CTRL_CTS:
10168         case CTRL_ACKNOWLEDGEMENT:
10169         case CTRL_CFP_END:
10170         case CTRL_CFP_ENDACK:
10171         case CTRL_BLOCK_ACK_REQ:
10172         case CTRL_BLOCK_ACK:
10173           addr1_str = "RA";
10174           addr1_hf = hf_ieee80211_addr_ra;
10175           break;
10176         default:
10177           break;
10178       }
10179
10180       if (!addr1_str) /* XXX - Should we throw some sort of error? */
10181         break;
10182
10183       /* Add address 1 */
10184       dst = tvb_get_ptr(tvb, 4, 6);
10185       set_dst_addr_cols(pinfo, dst, addr1_str);
10186       if (tree) {
10187         proto_tree_add_item(hdr_tree, addr1_hf, tvb, 4, 6, ENC_BIG_ENDIAN);
10188       }
10189
10190       /*
10191        * Start shoving in other fields if needed.
10192        * XXX - Should we look for is_ht as well?
10193        */
10194       if (frame_type_subtype == CTRL_CONTROL_WRAPPER && tree) {
10195         cw_item = proto_tree_add_text(hdr_tree, tvb, offset, 2,
10196           "Contained Frame Control");
10197         cw_tree = proto_item_add_subtree (cw_item, ett_cntrl_wrapper_fc);
10198         dissect_frame_control(cw_tree, tvb, FALSE, offset);
10199         dissect_ht_control(hdr_tree, tvb, offset + 2);
10200         offset+=6;
10201         cw_item = proto_tree_add_text(hdr_tree, tvb, offset, 2,
10202           "Carried Frame");
10203         hdr_tree = proto_item_add_subtree (cw_item, ett_cntrl_wrapper_fc);
10204       }
10205
10206       switch (ctrl_type_subtype)
10207       {
10208         case CTRL_PS_POLL:
10209         case CTRL_CFP_END:
10210         case CTRL_CFP_ENDACK:
10211         {
10212           src = tvb_get_ptr (tvb, offset, 6);
10213           set_src_addr_cols(pinfo, src, "BSSID");
10214           if (tree) {
10215             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, ENC_NA);
10216           }
10217           break;
10218         }
10219
10220         case CTRL_RTS:
10221         {
10222           src = tvb_get_ptr (tvb, offset, 6);
10223           set_src_addr_cols(pinfo, src, "TA");
10224           if (tree) {
10225             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, ENC_NA);
10226           }
10227           break;
10228         }
10229
10230         case CTRL_CONTROL_WRAPPER:
10231         {
10232           /* XXX - We shouldn't see this.  Should we throw an error? */
10233           break;
10234         }
10235
10236         case CTRL_BLOCK_ACK_REQ:
10237         {
10238           src = tvb_get_ptr (tvb, offset, 6);
10239           set_src_addr_cols(pinfo, src, "TA");
10240
10241           if (tree)
10242           {
10243             guint16 bar_control;
10244             guint8 block_ack_type;
10245             proto_item *bar_parent_item;
10246             proto_tree *bar_sub_tree;
10247
10248             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, ENC_NA);
10249             offset += 6;
10250
10251             bar_control = tvb_get_letohs(tvb, offset);
10252             block_ack_type = (bar_control & 0x0006) >> 1;
10253             proto_tree_add_uint(hdr_tree, hf_ieee80211_block_ack_request_type, tvb,
10254               offset, 1, block_ack_type);
10255             bar_parent_item = proto_tree_add_uint_format(hdr_tree,
10256               hf_ieee80211_block_ack_request_control, tvb, offset, 2, bar_control,
10257               "Block Ack Request (BAR) Control: 0x%04X", bar_control);
10258             bar_sub_tree = proto_item_add_subtree(bar_parent_item,
10259               ett_block_ack);
10260             proto_tree_add_boolean(bar_sub_tree,
10261               hf_ieee80211_block_ack_control_ack_policy, tvb, offset, 1, bar_control);
10262             proto_tree_add_boolean(bar_sub_tree, hf_ieee80211_block_ack_control_multi_tid,
10263               tvb, offset, 1, bar_control);
10264             proto_tree_add_boolean(bar_sub_tree,
10265               hf_ieee80211_block_ack_control_compressed_bitmap, tvb, offset, 1,
10266               bar_control);
10267             proto_tree_add_uint(bar_sub_tree, hf_ieee80211_block_ack_control_reserved,
10268               tvb, offset, 2, bar_control);
10269
10270             switch (block_ack_type)
10271             {
10272               case 0: /*Basic BlockAckReq */
10273               {
10274                 proto_tree_add_uint(bar_sub_tree,
10275                 hf_ieee80211_block_ack_control_basic_tid_info, tvb, offset+1, 1,
10276                   bar_control);
10277                 offset += 2;
10278
10279                 /*offset +=*/ add_fixed_field(hdr_tree, tvb, offset,
10280                   FIELD_BLOCK_ACK_SSC);
10281                 break;
10282               }
10283               case 2: /* Compressed BlockAckReq */
10284               {
10285                 proto_tree_add_uint(bar_sub_tree,
10286                 hf_ieee80211_block_ack_control_compressed_tid_info, tvb, offset+1, 1,
10287                   bar_control);
10288                 offset += 2;
10289
10290                 /*offset +=*/ add_fixed_field(hdr_tree, tvb, offset,
10291                   FIELD_BLOCK_ACK_SSC);
10292                 break;
10293               }
10294               case 3: /* Multi-TID BlockAckReq */
10295               {
10296                 guint8 tid_count, i;
10297                 proto_tree *bar_mtid_tree, *bar_mtid_sub_tree;
10298
10299                 tid_count = ((bar_control & 0xF000) >> 12) + 1;
10300                 proto_tree_add_uint_format(bar_sub_tree, hf_ieee80211_block_ack_control_multi_tid_info, tvb, offset+1, 1, bar_control,
10301                 decode_numeric_bitfield(bar_control, 0xF000, 16,"Number of TIDs Present: 0x%%X"), tid_count);
10302                 offset += 2;
10303
10304                 bar_parent_item = proto_tree_add_text (hdr_tree, tvb, offset, tid_count*4, "Per TID Info");
10305                 bar_mtid_tree = proto_item_add_subtree(bar_parent_item, ett_block_ack);
10306                 for (i = 1; i <= tid_count; i++) {
10307                   bar_parent_item = proto_tree_add_uint(bar_mtid_tree, hf_ieee80211_block_ack_multi_tid_info, tvb, offset, 4, i);
10308                   bar_mtid_sub_tree = proto_item_add_subtree(bar_parent_item, ett_block_ack);
10309
10310                   bar_control = tvb_get_letohs(tvb, offset);
10311                   proto_tree_add_uint(bar_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_reserved, tvb, offset, 2, bar_control);
10312                   proto_tree_add_uint(bar_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_value, tvb, offset+1, 1, bar_control);
10313                   offset += 2;
10314
10315                   offset += add_fixed_field(bar_mtid_sub_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
10316                 }
10317                 break;
10318               }
10319             }
10320           }
10321           break;
10322         }
10323
10324         case CTRL_BLOCK_ACK:
10325         {
10326           src = tvb_get_ptr (tvb, offset, 6);
10327           set_src_addr_cols(pinfo, src, "TA");
10328
10329           if (tree)
10330           {
10331             guint16 ba_control;
10332             guint8 block_ack_type;
10333             proto_item *ba_parent_item;
10334             proto_tree *ba_sub_tree;
10335
10336             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, ENC_NA);
10337             offset += 6;
10338
10339             ba_control = tvb_get_letohs(tvb, offset);
10340             block_ack_type = (ba_control & 0x0006) >> 1;
10341             proto_tree_add_uint(hdr_tree, hf_ieee80211_block_ack_type, tvb, offset, 1, block_ack_type);
10342             ba_parent_item = proto_tree_add_uint_format(hdr_tree,
10343               hf_ieee80211_block_ack_control, tvb, offset, 2, ba_control,
10344               "Block Ack (BA) Control: 0x%04X", ba_control);
10345             ba_sub_tree = proto_item_add_subtree(ba_parent_item, ett_block_ack);
10346             proto_tree_add_boolean(ba_sub_tree, hf_ieee80211_block_ack_control_ack_policy,
10347               tvb, offset, 1, ba_control);
10348             proto_tree_add_boolean(ba_sub_tree, hf_ieee80211_block_ack_control_multi_tid,
10349               tvb, offset, 1, ba_control);
10350             proto_tree_add_boolean(ba_sub_tree,
10351               hf_ieee80211_block_ack_control_compressed_bitmap, tvb, offset, 1,
10352               ba_control);
10353             proto_tree_add_uint(ba_sub_tree, hf_ieee80211_block_ack_control_reserved, tvb,
10354               offset, 2, ba_control);
10355
10356             switch (block_ack_type)
10357             {
10358               case 0: /*Basic BlockAck */
10359               {
10360                 proto_tree_add_uint(ba_sub_tree,
10361                 hf_ieee80211_block_ack_control_basic_tid_info, tvb, offset+1, 1,
10362                   ba_control);
10363                 offset += 2;
10364
10365                 offset += add_fixed_field(hdr_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
10366                 proto_tree_add_item(hdr_tree, hf_ieee80211_block_ack_bitmap, tvb, offset, 128, ENC_NA);
10367                 /*offset += 128;*/
10368                 break;
10369               }
10370               case 2: /* Compressed BlockAck */
10371               {
10372                 guint16 ssn;
10373                 guint64 bmap;
10374                 int f;
10375                 proto_item *ba_bitmap_item;
10376                 proto_tree *ba_bitmap_tree;
10377
10378                 proto_tree_add_uint(ba_sub_tree, hf_ieee80211_block_ack_control_basic_tid_info, tvb, offset+1, 1, ba_control);
10379                 offset += 2;
10380
10381                 ssn = tvb_get_letohs(tvb, offset);
10382                 ssn >>= 4;
10383                 offset += add_fixed_field(hdr_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
10384                 bmap = tvb_get_letoh64(tvb, offset);
10385                 ba_bitmap_item = proto_tree_add_item(hdr_tree, hf_ieee80211_block_ack_bitmap, tvb, offset, 8, ENC_NA);
10386                 ba_bitmap_tree = proto_item_add_subtree(ba_bitmap_item, ett_block_ack_bitmap);
10387                 for (f = 0; f < 64; f++) {
10388                   if (bmap & (G_GINT64_CONSTANT(1) << f))
10389                     continue;
10390                   proto_tree_add_uint_format_value(ba_bitmap_tree, hf_ieee80211_block_ack_bitmap_missing_frame,
10391                                                    tvb, offset + (f/8), 1, ssn + f, "%u", ssn + f);
10392                 }
10393                 /*offset += 8;*/
10394                 break;
10395               }
10396               case 3:  /* Multi-TID BlockAck */
10397               {
10398                 guint8 tid_count, i;
10399                 proto_tree *ba_mtid_tree, *ba_mtid_sub_tree;
10400
10401                 tid_count = ((ba_control & 0xF000) >> 12) + 1;
10402                 proto_tree_add_uint_format(ba_sub_tree,
10403                 hf_ieee80211_block_ack_control_compressed_tid_info, tvb, offset+1, 1,
10404                   ba_control, decode_numeric_bitfield(ba_control, 0xF000,
10405                   16,"Number of TIDs Present: 0x%%X"), tid_count);
10406                 offset += 2;
10407
10408                 ba_parent_item = proto_tree_add_text (hdr_tree, tvb, offset, tid_count*4, "Per TID Info");
10409                 ba_mtid_tree = proto_item_add_subtree(ba_parent_item, ett_block_ack);
10410                 for (i=1; i<=tid_count; i++) {
10411                   ba_parent_item = proto_tree_add_uint(ba_mtid_tree, hf_ieee80211_block_ack_multi_tid_info, tvb, offset, 4, i);
10412                   ba_mtid_sub_tree = proto_item_add_subtree(ba_parent_item, ett_block_ack);
10413
10414                   ba_control = tvb_get_letohs(tvb, offset);
10415                   proto_tree_add_uint(ba_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_reserved, tvb, offset, 2, ba_control);
10416                   proto_tree_add_uint(ba_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_value, tvb, offset+1, 1, ba_control);
10417                   offset += 2;
10418
10419                   offset += add_fixed_field(ba_mtid_sub_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
10420                   proto_tree_add_item(ba_mtid_sub_tree, hf_ieee80211_block_ack_bitmap, tvb, offset, 8, ENC_NA);
10421                   offset += 8;
10422                 }
10423                 break;
10424               }
10425             }
10426           }
10427           break;
10428         }
10429       }
10430       break;
10431     }
10432
10433     case DATA_FRAME:
10434       addr_type = FCF_ADDR_SELECTOR (fcf);
10435
10436       /* In order to show src/dst address we must always do the following */
10437       switch (addr_type)
10438       {
10439
10440         case DATA_ADDR_T1:
10441           src = tvb_get_ptr (tvb, 10, 6);
10442           dst = tvb_get_ptr (tvb, 4, 6);
10443           bssid = tvb_get_ptr (tvb, 16, 6);
10444           break;
10445
10446         case DATA_ADDR_T2:
10447           src = tvb_get_ptr (tvb, 16, 6);
10448           dst = tvb_get_ptr (tvb, 4, 6);
10449           bssid = tvb_get_ptr (tvb, 10, 6);
10450           break;
10451
10452         case DATA_ADDR_T3:
10453           src = tvb_get_ptr (tvb, 10, 6);
10454           dst = tvb_get_ptr (tvb, 16, 6);
10455           bssid = tvb_get_ptr (tvb, 4, 6);
10456           break;
10457
10458         case DATA_ADDR_T4:
10459           src = tvb_get_ptr (tvb, 24, 6);
10460           dst = tvb_get_ptr (tvb, 16, 6);
10461           bssid = tvb_get_ptr (tvb, 16, 6);
10462           break;
10463       }
10464
10465       SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src);
10466       SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src);
10467       SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst);
10468       SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, dst);
10469
10470       /* for tap */
10471
10472       SET_ADDRESS(&whdr->bssid, AT_ETHER, 6, bssid);
10473       SET_ADDRESS(&whdr->src, AT_ETHER, 6, src);
10474       SET_ADDRESS(&whdr->dst, AT_ETHER, 6, dst);
10475       whdr->type = frame_type_subtype;
10476
10477       seq_control = tvb_get_letohs(tvb, 22);
10478       frag_number = SEQCTL_FRAGMENT_NUMBER(seq_control);
10479       seq_number = SEQCTL_SEQUENCE_NUMBER(seq_control);
10480
10481       col_append_fstr(pinfo->cinfo, COL_INFO,
10482             ", SN=%d, FN=%d", seq_number,frag_number);
10483
10484       /* Now if we have a tree we start adding stuff */
10485       if (tree)
10486       {
10487
10488         switch (addr_type)
10489         {
10490
10491           case DATA_ADDR_T1:
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_sa, tvb, 10, 6, src);
10494             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_bssid, tvb, 16, 6, bssid);
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_ether (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, src);
10504             PROTO_ITEM_SET_HIDDEN(hidden_item);
10505             break;
10506
10507           case DATA_ADDR_T2:
10508             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 4, 6, dst);
10509             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_bssid, tvb, 10, 6, bssid);
10510             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 16, 6, src);
10511             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10512                frag_number);
10513             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10514                seq_number);
10515
10516             /* add items for wlan.addr filter */
10517             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, dst);
10518             PROTO_ITEM_SET_HIDDEN(hidden_item);
10519             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, src);
10520             PROTO_ITEM_SET_HIDDEN(hidden_item);
10521             break;
10522
10523           case DATA_ADDR_T3:
10524             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_bssid, tvb, 4, 6, bssid);
10525             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 10, 6, src);
10526             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 16, 6, dst);
10527
10528             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10529                frag_number);
10530             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10531                seq_number);
10532
10533             /* add items for wlan.addr filter */
10534             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, src);
10535             PROTO_ITEM_SET_HIDDEN(hidden_item);
10536             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, dst);
10537             PROTO_ITEM_SET_HIDDEN(hidden_item);
10538             break;
10539
10540           case DATA_ADDR_T4:
10541             proto_tree_add_item (hdr_tree, hf_ieee80211_addr_ra, tvb, 4, 6, ENC_NA);
10542             proto_tree_add_item (hdr_tree, hf_ieee80211_addr_ta, tvb, 10, 6, ENC_NA);
10543             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 16, 6, dst);
10544             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10545                frag_number);
10546             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10547                seq_number);
10548             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 24, 6, src);
10549
10550             /* add items for wlan.addr filter */
10551             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, dst);
10552             PROTO_ITEM_SET_HIDDEN(hidden_item);
10553             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 24, 6, src);
10554             PROTO_ITEM_SET_HIDDEN(hidden_item);
10555             break;
10556         }
10557
10558       }
10559       break;
10560   }
10561
10562   len = tvb_length_remaining(tvb, hdr_len);
10563   reported_len = tvb_reported_length_remaining(tvb, hdr_len);
10564
10565   switch (fcs_len)
10566     {
10567       case 0: /* Definitely has no FCS */
10568         has_fcs = FALSE;
10569         break;
10570
10571       case 4: /* Definitely has an FCS */
10572         has_fcs = TRUE;
10573         break;
10574
10575       case -2: /* Data frames have no FCS, other frames have an FCS */
10576         if (FCF_FRAME_TYPE (fcf) == DATA_FRAME)
10577           has_fcs = FALSE;
10578         else
10579           has_fcs = TRUE;
10580         break;
10581
10582       default: /* Don't know - use "wlan_check_fcs" */
10583         has_fcs = wlan_check_fcs;
10584         break;
10585     }
10586   if (has_fcs)
10587     {
10588       /*
10589        * Well, this packet should, in theory, have an FCS.
10590        * Do we have the entire packet, and does it have enough data for
10591        * the FCS?
10592        */
10593       if (reported_len < 4)
10594       {
10595         /*
10596          * The packet is claimed not to even have enough data for a 4-byte
10597          * FCS.
10598          * Pretend it doesn't have an FCS.
10599          */
10600         ;
10601       }
10602       else if (len < reported_len)
10603       {
10604         /*
10605          * The packet is claimed to have enough data for a 4-byte FCS, but
10606          * we didn't capture all of the packet.
10607          * Slice off the 4-byte FCS from the reported length, and trim the
10608          * captured length so it's no more than the reported length; that
10609          * will slice off what of the FCS, if any, is in the captured
10610          * length.
10611          */
10612         reported_len -= 4;
10613         if (len > reported_len)
10614             len = reported_len;
10615       }
10616       else
10617       {
10618         /*
10619          * We have the entire packet, and it includes a 4-byte FCS.
10620          * Slice it off, and put it into the tree.
10621          */
10622         len -= 4;
10623         reported_len -= 4;
10624         if (tree)
10625         {
10626           guint32 sent_fcs = tvb_get_ntohl(tvb, hdr_len + len);
10627           guint32 fcs;
10628
10629           if (datapad)
10630             fcs = crc32_802_tvb_padded(tvb, ohdr_len, hdr_len, len);
10631           else
10632             fcs = crc32_802_tvb(tvb, hdr_len + len);
10633           if (fcs == sent_fcs) {
10634             fcs_good = TRUE;
10635             fcs_bad = FALSE;
10636           } else {
10637             fcs_good = FALSE;
10638             fcs_bad = TRUE;
10639           }
10640
10641           if(fcs_good) {
10642             fcs_item = proto_tree_add_uint_format(hdr_tree, hf_ieee80211_fcs, tvb,
10643                 hdr_len + len, 4, sent_fcs,
10644                 "Frame check sequence: 0x%08x [correct]", sent_fcs);
10645           } else {
10646             fcs_item = proto_tree_add_uint_format(hdr_tree, hf_ieee80211_fcs, tvb,
10647                 hdr_len + len, 4, sent_fcs,
10648                 "Frame check sequence: 0x%08x [incorrect, should be 0x%08x]",
10649                 sent_fcs, fcs);
10650             flag_str[8] = '.';
10651           }
10652
10653           proto_tree_set_appendix(hdr_tree, tvb, hdr_len + len, 4);
10654
10655           fcs_tree = proto_item_add_subtree(fcs_item, ett_fcs);
10656
10657           fcs_item = proto_tree_add_boolean(fcs_tree,
10658               hf_ieee80211_fcs_good, tvb,
10659               hdr_len + len, 4,
10660               fcs_good);
10661           PROTO_ITEM_SET_GENERATED(fcs_item);
10662
10663           fcs_item = proto_tree_add_boolean(fcs_tree,
10664               hf_ieee80211_fcs_bad, tvb,
10665               hdr_len + len, 4,
10666               fcs_bad);
10667           PROTO_ITEM_SET_GENERATED(fcs_item);
10668         }
10669       }
10670     } else {
10671       flag_str[8] = '\0';
10672     }
10673
10674     proto_item_append_text(ti, ", Flags: %s", flag_str);
10675     col_append_fstr (pinfo->cinfo, COL_INFO, ", Flags=%s", flag_str);
10676
10677
10678   /*
10679    * Only management and data frames have a body, so we don't have
10680    * anything more to do for other types of frames.
10681    */
10682   switch (FCF_FRAME_TYPE (fcf))
10683     {
10684
10685     case MGT_FRAME:
10686       if (htc_len == 4) {
10687         dissect_ht_control(hdr_tree, tvb, ohdr_len - 4);
10688       }
10689       break;
10690
10691     case DATA_FRAME:
10692       if (tree && DATA_FRAME_IS_QOS(frame_type_subtype))
10693       {
10694         proto_item *qos_fields;
10695         proto_tree *qos_tree;
10696
10697         guint16 qos_tid;
10698         guint16 qos_priority;
10699         guint16 qos_ack_policy;
10700         guint16 qos_amsdu_present;
10701         guint16 qos_eosp;
10702         guint16 qos_field_content;
10703
10704         qos_fields = proto_tree_add_text(hdr_tree, tvb, qosoff, 2,
10705             "QoS Control");
10706         qos_tree = proto_item_add_subtree (qos_fields, ett_qos_parameters);
10707
10708         qos_tid = QOS_TID(qos_control);
10709         qos_priority = QOS_PRIORITY(qos_control);
10710         qos_ack_policy = QOS_ACK_POLICY(qos_control);
10711         qos_amsdu_present = QOS_AMSDU_PRESENT(qos_control);
10712         qos_eosp = QOS_EOSP(qos_control);
10713         qos_field_content = QOS_FIELD_CONTENT(qos_control);
10714
10715         proto_tree_add_uint (qos_tree, hf_ieee80211_qos_tid, tvb,
10716             qosoff, 1, qos_tid);
10717
10718         proto_tree_add_uint_format (qos_tree, hf_ieee80211_qos_priority, tvb,
10719             qosoff, 1, qos_priority,
10720             "Priority: %d (%s) (%s)",
10721             qos_priority, qos_tags[qos_priority], qos_acs[qos_priority]);
10722
10723         if (flags & FLAG_FROM_DS) {
10724           proto_tree_add_boolean (qos_tree, hf_ieee80211_qos_eosp, tvb,
10725               qosoff, 1, qos_control);
10726         } else {
10727           proto_tree_add_boolean (qos_tree, hf_ieee80211_qos_bit4, tvb,
10728               qosoff, 1, qos_control);
10729         }
10730
10731         proto_tree_add_uint (qos_tree, hf_ieee80211_qos_ack_policy, tvb, qosoff, 1,
10732             qos_ack_policy);
10733
10734         if (flags & FLAG_FROM_DS) {
10735           if (!DATA_FRAME_IS_NULL(frame_type_subtype)) {
10736             proto_tree_add_boolean(qos_tree, hf_ieee80211_qos_amsdu_present, tvb,
10737                 qosoff, 1, qos_amsdu_present);
10738             is_amsdu = qos_amsdu_present;
10739           }
10740           if (DATA_FRAME_IS_CF_POLL(frame_type_subtype)) {
10741             /* txop limit */
10742             if (qos_field_content == 0) {
10743               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_txop_limit, tvb,
10744                   qosoff + 1, 1, qos_field_content,
10745                                                 "transmit one frame immediately (0)");
10746             } else {
10747               proto_tree_add_uint (qos_tree, hf_ieee80211_qos_txop_limit, tvb,
10748                                    qosoff + 1, 1, qos_field_content);
10749             }
10750           } else {
10751             /* qap ps buffer state */
10752             proto_item *qos_ps_buf_state_fields;
10753             proto_tree *qos_ps_buf_state_tree;
10754             guint8 qap_buf_load;
10755
10756             qos_ps_buf_state_fields = proto_tree_add_text(qos_tree, tvb, qosoff + 1, 1,
10757                 "QAP PS Buffer State: 0x%x", qos_field_content);
10758             qos_ps_buf_state_tree = proto_item_add_subtree (qos_ps_buf_state_fields, ett_qos_ps_buf_state);
10759
10760             proto_tree_add_boolean (qos_ps_buf_state_tree, hf_ieee80211_qos_buf_state_indicated,
10761                                     tvb, qosoff + 1, 1, qos_field_content);
10762
10763             if (QOS_PS_BUF_STATE_INDICATED(qos_field_content)) {
10764               proto_tree_add_uint (qos_ps_buf_state_tree, hf_ieee80211_qos_highest_pri_buf_ac, tvb,
10765                   qosoff + 1, 1, qos_field_content);
10766
10767               qap_buf_load = QOS_PS_QAP_BUF_LOAD(qos_field_content);
10768               switch (qap_buf_load) {
10769
10770               case 0:
10771                 proto_tree_add_uint_format_value (qos_ps_buf_state_tree, hf_ieee80211_qos_qap_buf_load, tvb,
10772                     qosoff + 1, 1, qos_field_content,
10773                     "no buffered traffic (0)");
10774                 break;
10775
10776               default:
10777                 proto_tree_add_uint_format_value (qos_ps_buf_state_tree, hf_ieee80211_qos_qap_buf_load, tvb,
10778                     qosoff + 1, 1, qos_field_content,
10779                     "%d octets (%d)", qap_buf_load*4096, qap_buf_load);
10780                 break;
10781
10782               case 15:
10783                 proto_tree_add_uint_format_value (qos_ps_buf_state_tree, hf_ieee80211_qos_qap_buf_load, tvb,
10784                     qosoff + 1, 1, qos_field_content,
10785                     "greater than 57344 octets (15)");
10786                 break;
10787               }
10788             }
10789           }
10790         } else {
10791           if (!DATA_FRAME_IS_NULL(frame_type_subtype)) {
10792             proto_tree_add_boolean(qos_tree, hf_ieee80211_qos_amsdu_present, tvb,
10793                 qosoff, 1, qos_amsdu_present);
10794             is_amsdu = qos_amsdu_present;
10795           }
10796           if (qos_eosp) {
10797             /* queue size */
10798             switch (qos_field_content) {
10799
10800             case 0:
10801               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
10802                                                 tvb, qosoff + 1, 1, qos_field_content,
10803                   "no buffered traffic in the queue (0)");
10804               break;
10805
10806             default:
10807               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
10808                                                 tvb, qosoff + 1, 1, qos_field_content,
10809                                                 "%u bytes (%u)", qos_field_content*256, qos_field_content);
10810               break;
10811
10812             case 254:
10813               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
10814                                                 tvb, qosoff + 1, 1, qos_field_content,
10815                   "more than 64768 octets (254)");
10816               break;
10817
10818             case 255:
10819               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
10820                                                 tvb, qosoff + 1, 1, qos_field_content,
10821                   "unspecified or unknown (256)");
10822               break;
10823             }
10824           } else {
10825             /* txop duration requested */
10826             if (qos_field_content == 0) {
10827               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_txop_dur_req,
10828                                                 tvb, qosoff + 1, 1, qos_field_content,
10829                                                 "no TXOP requested (0)");
10830             } else {
10831               proto_tree_add_uint (qos_tree, hf_ieee80211_qos_txop_dur_req,
10832                                    tvb, qosoff + 1, 1, qos_field_content);
10833             }
10834           }
10835         }
10836
10837         /* Do we have +HTC? */
10838         if (htc_len == 4) {
10839           dissect_ht_control(hdr_tree, tvb, ohdr_len - 4);
10840         }
10841
10842         if (meshctl_len != 0) {
10843           proto_item *msh_fields;
10844           proto_tree *msh_tree;
10845
10846           msh_fields = proto_tree_add_text(hdr_tree, tvb, meshoff, meshctl_len, "Mesh Control field");
10847           msh_tree = proto_item_add_subtree (msh_fields, ett_msh_control);
10848           add_fixed_field(msh_tree, tvb, meshoff, FIELD_MESH_CONTROL);
10849         }
10850
10851       } /* end of qos control field */
10852       /* Davide Schiera (2006-11-21): process handshake packet with AirPDcap    */
10853       /* the processing will take care of 4-way handshake sessions for WPA    */
10854       /* and WPA2 decryption                                  */
10855       if (enable_decryption && !pinfo->fd->flags.visited) {
10856         const guint8 *enc_data = tvb_get_ptr(tvb, 0, hdr_len+reported_len);
10857         AirPDcapPacketProcess(&airpdcap_ctx, enc_data, hdr_len, hdr_len+reported_len, NULL, 0, NULL, TRUE, FALSE);
10858       }
10859       /* Davide Schiera --------------------------------------------------------  */
10860
10861       /*
10862        * No-data frames don't have a body.
10863        */
10864       if (DATA_FRAME_IS_NULL(frame_type_subtype))
10865         return;
10866
10867       if (!wlan_subdissector) {
10868         guint fnum = 0;
10869
10870         /* key: bssid:src
10871          * data: last seq_control seen and frame number
10872          */
10873         retransmitted = FALSE;
10874         if(!pinfo->fd->flags.visited){
10875           retransmit_key key;
10876           retransmit_key *result;
10877
10878           memcpy(key.bssid, bssid, 6);
10879           memcpy(key.src, src, 6);
10880           key.seq_control = 0;
10881           result = (retransmit_key *)g_hash_table_lookup(fc_analyse_retransmit_table, &key);
10882           if (result && result->seq_control == seq_control) {
10883                /* keep a pointer to the first seen frame, could be done with proto data? */
10884                fnum = result->fnum;
10885                g_hash_table_insert(fc_first_frame_table, GINT_TO_POINTER( pinfo->fd->num),
10886                   GINT_TO_POINTER(fnum));
10887                retransmitted = TRUE;
10888           } else {
10889                /* first time or new seq*/
10890                if (!result) {
10891                   result = se_alloc(sizeof(retransmit_key));
10892                   *result = key;
10893                   g_hash_table_insert(fc_analyse_retransmit_table, result, result);
10894                }
10895                result->seq_control = seq_control;
10896                result->fnum =  pinfo->fd->num;
10897            }
10898         }
10899         else if ((fnum = GPOINTER_TO_UINT(g_hash_table_lookup(fc_first_frame_table, GINT_TO_POINTER( pinfo->fd->num))))) {
10900            retransmitted = TRUE;
10901         }
10902
10903         if (retransmitted) {
10904             col_append_str(pinfo->cinfo, COL_INFO, " [retransmitted]");
10905             if (tree) {
10906                 proto_item *item;
10907
10908                 item=proto_tree_add_none_format(hdr_tree, hf_ieee80211_fc_analysis_retransmission, tvb, 0, 0, "Retransmitted frame");
10909                 PROTO_ITEM_SET_GENERATED(item);
10910                 item=proto_tree_add_uint(hdr_tree, hf_ieee80211_fc_analysis_retransmission_frame,tvb, 0, 0, fnum);
10911                 PROTO_ITEM_SET_GENERATED(item);
10912             }
10913             next_tvb = tvb_new_subset (tvb, hdr_len, len, reported_len);
10914             call_dissector(data_handle, next_tvb, pinfo, tree);
10915             goto end_of_wlan;
10916         }
10917       }
10918
10919       break;
10920
10921     case CONTROL_FRAME:
10922       return;
10923
10924     default:
10925       return;
10926     }
10927
10928   if (IS_PROTECTED(FCF_FLAGS(fcf)) && wlan_ignore_wep != WLAN_IGNORE_WEP_WO_IV) {
10929     /*
10930      * It's a WEP or WPA encrypted frame; dissect the protections parameters
10931      * and decrypt the data, if we have a matching key. Otherwise display it as data.
10932      */
10933
10934     gboolean can_decrypt = FALSE;
10935     proto_tree *wep_tree = NULL;
10936     guint32 iv;
10937     guint8 key, keybyte;
10938
10939     /* Davide Schiera (2006-11-27): define algorithms constants and macros  */
10940 #define PROTECTION_ALG_WEP  AIRPDCAP_KEY_TYPE_WEP
10941 #define PROTECTION_ALG_TKIP  AIRPDCAP_KEY_TYPE_TKIP
10942 #define PROTECTION_ALG_CCMP  AIRPDCAP_KEY_TYPE_CCMP
10943 #define PROTECTION_ALG_RSNA  PROTECTION_ALG_CCMP | PROTECTION_ALG_TKIP
10944     guint8 algorithm=G_MAXUINT8;
10945     /* Davide Schiera (2006-11-27): added macros to check the algorithm    */
10946     /* used could be TKIP or CCMP                            */
10947 #define IS_TKIP(tvb, hdr_len)  (tvb_get_guint8(tvb, hdr_len + 1) & 0x20)
10948 #define IS_CCMP(tvb, hdr_len)  (tvb_get_guint8(tvb, hdr_len + 2) == 0)
10949     /* Davide Schiera -----------------------------------------------------  */
10950
10951     /* Davide Schiera (2006-11-21): recorded original lengths to pass them  */
10952     /* to the packets process function                        */
10953     guint32 sec_header=0;
10954     guint32 sec_trailer=0;
10955
10956     next_tvb = try_decrypt(tvb, hdr_len, reported_len, &algorithm, &sec_header, &sec_trailer);
10957     /* Davide Schiera -----------------------------------------------------  */
10958
10959     keybyte = tvb_get_guint8(tvb, hdr_len + 3);
10960     key = KEY_OCTET_WEP_KEY(keybyte);
10961     if ((keybyte & KEY_EXTIV) && (len >= EXTIV_LEN)) {
10962       /* Extended IV; this frame is likely encrypted with TKIP or CCMP */
10963
10964
10965       if (tree) {
10966         proto_item *extiv_fields;
10967
10968         /* Davide Schiera (2006-11-27): differentiated CCMP and TKIP if  */
10969         /* it's possible                                */
10970         if (algorithm==PROTECTION_ALG_TKIP)
10971           extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10972               "TKIP parameters");
10973         else if (algorithm==PROTECTION_ALG_CCMP)
10974           extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10975             "CCMP parameters");
10976         else {
10977           /* Davide Schiera --------------------------------------------  */
10978           /* Davide Schiera (2006-11-27): differentiated CCMP and TKIP if*/
10979           /* it's possible                              */
10980           if (IS_TKIP(tvb, hdr_len)) {
10981             algorithm=PROTECTION_ALG_TKIP;
10982             extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10983                 "TKIP parameters");
10984           } else if (IS_CCMP(tvb, hdr_len)) {
10985             algorithm=PROTECTION_ALG_CCMP;
10986             extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10987                 "CCMP parameters");
10988           } else
10989             extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10990                 "TKIP/CCMP parameters");
10991         }
10992         proto_item_set_len (ti, hdr_len + 8);
10993
10994         wep_tree = proto_item_add_subtree (extiv_fields, ett_wep_parameters);
10995
10996         if (algorithm==PROTECTION_ALG_TKIP) {
10997           g_snprintf(out_buff, SHORT_STR, "0x%08X%02X%02X",
10998               tvb_get_letohl(tvb, hdr_len + 4),
10999               tvb_get_guint8(tvb, hdr_len),
11000               tvb_get_guint8(tvb, hdr_len + 2));
11001           proto_tree_add_string(wep_tree, hf_ieee80211_tkip_extiv, tvb, hdr_len,
11002               EXTIV_LEN, out_buff);
11003         } else if (algorithm==PROTECTION_ALG_CCMP) {
11004           g_snprintf(out_buff, SHORT_STR, "0x%08X%02X%02X",
11005               tvb_get_letohl(tvb, hdr_len + 4),
11006               tvb_get_guint8(tvb, hdr_len + 1),
11007               tvb_get_guint8(tvb, hdr_len));
11008           proto_tree_add_string(wep_tree, hf_ieee80211_ccmp_extiv, tvb, hdr_len,
11009               EXTIV_LEN, out_buff);
11010         }
11011
11012         proto_tree_add_uint(wep_tree, hf_ieee80211_wep_key, tvb, hdr_len + 3, 1, key);
11013       }
11014
11015       /* Subtract out the length of the IV. */
11016       len -= EXTIV_LEN;
11017       reported_len -= EXTIV_LEN;
11018       ivlen = EXTIV_LEN;
11019       /* It is unknown whether this is TKIP or CCMP, so let's not even try to
11020        * parse TKIP Michael MIC+ICV or CCMP MIC. */
11021
11022       /* Davide Schiera (2006-11-21): enable TKIP and CCMP decryption      */
11023       /* checking for the trailer                            */
11024       if (next_tvb!=NULL) {
11025         if (reported_len < (gint) sec_trailer) {
11026           /* There is no space for a trailer, ignore it and don't decrypt  */
11027           ;
11028         } else if (len < reported_len) {
11029           /* There is space for a trailer, but we haven't capture all the  */
11030           /* packet. Slice off the trailer, but don't try to decrypt      */
11031           reported_len -= sec_trailer;
11032           if (len > reported_len)
11033             len = reported_len;
11034         } else {
11035           /* Ok, we have a trailer and the whole packet. Decrypt it!      */
11036           /* TODO: At the moment we won't add the trailer to the tree,    */
11037           /* so don't remove the trailer from the packet              */
11038           len -= sec_trailer;
11039           reported_len -= sec_trailer;
11040           can_decrypt = TRUE;
11041         }
11042       }
11043       /* Davide Schiera --------------------------------------------------  */
11044     } else {
11045       /* No Ext. IV - WEP packet */
11046       /*
11047        * XXX - pass the IV and key to "try_decrypt_wep()", and have it pass
11048        * them to "wep_decrypt()", rather than having "wep_decrypt()" extract
11049        * them itself.
11050        *
11051        * Also, just pass the data *following* the WEP parameters as the
11052        * buffer to decrypt.
11053        */
11054       iv = tvb_get_ntoh24(tvb, hdr_len);
11055       if (tree) {
11056         proto_item *wep_fields;
11057
11058         wep_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 4,
11059             "WEP parameters");
11060
11061         wep_tree = proto_item_add_subtree (wep_fields, ett_wep_parameters);
11062         proto_tree_add_uint (wep_tree, hf_ieee80211_wep_iv, tvb, hdr_len, 3, iv);
11063         tvb_memcpy(tvb, iv_buff, hdr_len, 3);
11064         is_iv_bad = weak_iv(iv_buff);
11065         if (is_iv_bad != -1) {
11066           proto_tree_add_boolean_format (wep_tree, hf_ieee80211_wep_iv_weak,
11067               tvb, 0, 0, TRUE,
11068               "Weak IV for key byte %d",
11069               is_iv_bad);
11070         }
11071       }
11072       if (tree)
11073         proto_tree_add_uint (wep_tree, hf_ieee80211_wep_key, tvb, hdr_len + 3, 1, key);
11074
11075       /* Subtract out the length of the IV. */
11076       len -= 4;
11077       reported_len -= 4;
11078       ivlen = 4;
11079
11080       /* Davide Schiera (2006-11-27): Even if the decryption was not */
11081       /* successful, set the algorithm                               */
11082       algorithm=PROTECTION_ALG_WEP;
11083
11084       /*
11085        * Well, this packet should, in theory, have an ICV.
11086        * Do we have the entire packet, and does it have enough data for
11087        * the ICV?
11088        */
11089       if (reported_len < 4) {
11090         /*
11091          * The packet is claimed not to even have enough data for a
11092          * 4-byte ICV.
11093          * Pretend it doesn't have an ICV.
11094          */
11095         ;
11096       } else if (len < reported_len) {
11097         /*
11098          * The packet is claimed to have enough data for a 4-byte ICV,
11099          * but we didn't capture all of the packet.
11100          * Slice off the 4-byte ICV from the reported length, and trim
11101          * the captured length so it's no more than the reported length;
11102          * that will slice off what of the ICV, if any, is in the
11103          * captured length.
11104          */
11105         reported_len -= 4;
11106         if (len > reported_len)
11107           len = reported_len;
11108       } else {
11109         /*
11110          * We have the entire packet, and it includes a 4-byte ICV.
11111          * Slice it off, and put it into the tree.
11112          *
11113          * We only support decrypting if we have the the ICV.
11114          *
11115          * XXX - the ICV is encrypted; we're putting the encrypted
11116          * value, not the decrypted value, into the tree.
11117          */
11118         len -= 4;
11119         reported_len -= 4;
11120         can_decrypt = TRUE;
11121       }
11122     }
11123
11124     if (algorithm == PROTECTION_ALG_WEP) {
11125       g_strlcpy (wlan_stats.protection, "WEP", MAX_PROTECT_LEN);
11126     } else if (algorithm == PROTECTION_ALG_TKIP) {
11127       g_strlcpy (wlan_stats.protection, "TKIP", MAX_PROTECT_LEN);
11128     } else if (algorithm == PROTECTION_ALG_CCMP) {
11129       g_strlcpy (wlan_stats.protection, "CCMP", MAX_PROTECT_LEN);
11130     } else {
11131       g_strlcpy (wlan_stats.protection, "Unknown", MAX_PROTECT_LEN);
11132     }
11133
11134     /* Davide Schiera (2006-11-26): decrypted before parsing header and    */
11135     /* protection header                                  */
11136     if (!can_decrypt || next_tvb == NULL) {
11137       /*
11138        * WEP decode impossible or failed, treat payload as raw data
11139        * and don't attempt fragment reassembly or further dissection.
11140        */
11141       next_tvb = tvb_new_subset(tvb, hdr_len + ivlen, len, reported_len);
11142
11143       if (tree) {
11144         /* Davide Schiera (2006-11-21): added WEP or WPA separation      */
11145         if (algorithm==PROTECTION_ALG_WEP) {
11146           if (can_decrypt)
11147             proto_tree_add_uint_format (wep_tree, hf_ieee80211_wep_icv, tvb,
11148                 hdr_len + ivlen + len, 4,
11149                 tvb_get_ntohl(tvb, hdr_len + ivlen + len),
11150                 "WEP ICV: 0x%08x (not verified)",
11151                 tvb_get_ntohl(tvb, hdr_len + ivlen + len));
11152         } else if (algorithm==PROTECTION_ALG_CCMP) {
11153         } else if (algorithm==PROTECTION_ALG_TKIP) {
11154         }
11155       }
11156       /* Davide Schiera (2006-11-21) ----------------------------------  */
11157
11158       if (pinfo->ethertype != ETHERTYPE_CENTRINO_PROMISC && wlan_ignore_wep == WLAN_IGNORE_WEP_NO) {
11159         /* Some wireless drivers (such as Centrino) WEP payload already decrypted */
11160         call_dissector(data_handle, next_tvb, pinfo, tree);
11161         goto end_of_wlan;
11162       }
11163     } else {
11164       /* Davide Schiera (2006-11-21): added WEP or WPA separation        */
11165       if (algorithm==PROTECTION_ALG_WEP) {
11166         if (tree)
11167           proto_tree_add_uint_format (wep_tree, hf_ieee80211_wep_icv, tvb,
11168               hdr_len + ivlen + len, 4,
11169               tvb_get_ntohl(tvb, hdr_len + ivlen + len),
11170               "WEP ICV: 0x%08x (correct)",
11171               tvb_get_ntohl(tvb, hdr_len + ivlen + len));
11172
11173         add_new_data_source(pinfo, next_tvb, "Decrypted WEP data");
11174       } else if (algorithm==PROTECTION_ALG_CCMP) {
11175         add_new_data_source(pinfo, next_tvb, "Decrypted CCMP data");
11176       } else if (algorithm==PROTECTION_ALG_TKIP) {
11177         add_new_data_source(pinfo, next_tvb, "Decrypted TKIP data");
11178       }
11179       /* Davide Schiera (2006-11-21) -------------------------------------  */
11180       /* Davide Schiera (2006-11-27): undefine macros and definitions  */
11181 #undef IS_TKIP
11182 #undef IS_CCMP
11183 #undef PROTECTION_ALG_CCMP
11184 #undef PROTECTION_ALG_TKIP
11185 #undef PROTECTION_ALG_WEP
11186       /* Davide Schiera --------------------------------------------------  */
11187     }
11188
11189     /*
11190      * WEP decryption successful!
11191      *
11192      * Use the tvbuff we got back from the decryption; the data starts at
11193      * the beginning.  The lengths are already correct for the decoded WEP
11194      * payload.
11195      */
11196     hdr_len = 0;
11197
11198   } else {
11199     /*
11200      * Not a WEP-encrypted frame; just use the data from the tvbuff
11201      * handed to us.
11202      *
11203      * The payload starts at "hdr_len" (i.e., just past the 802.11
11204      * MAC header), the length of data in the tvbuff following the
11205      * 802.11 header is "len", and the length of data in the packet
11206      * following the 802.11 header is "reported_len".
11207      */
11208     next_tvb = tvb;
11209   }
11210
11211   /*
11212    * Do defragmentation if "wlan_defragment" is true, and we have more
11213    * fragments or this isn't the first fragment.
11214    *
11215    * We have to do some special handling to catch frames that
11216    * have the "More Fragments" indicator not set but that
11217    * don't show up as reassembled and don't have any other
11218    * fragments present.  Some networking interfaces appear
11219    * to do reassembly even when you're capturing raw packets
11220    * *and* show the reassembled packet without the "More
11221    * Fragments" indicator set *but* with a non-zero fragment
11222    * number.
11223    *
11224    * "fragment_add_seq_802_11()" handles that; we want to call it
11225    * even if we have a short frame, so that it does those checks - if
11226    * the frame is short, it doesn't do reassembly on it.
11227    *
11228    * (This could get some false positives if we really *did* only
11229    * capture the last fragment of a fragmented packet, but that's
11230    * life.)
11231    */
11232   save_fragmented = pinfo->fragmented;
11233   if (wlan_defragment && (more_frags || frag_number != 0)) {
11234     fragment_data *fd_head;
11235
11236     /*
11237      * If we've already seen this frame, look it up in the
11238      * table of reassembled packets, otherwise add it to
11239      * whatever reassembly is in progress, if any, and see
11240      * if it's done.
11241      */
11242     if (reported_len < 0)
11243       THROW(ReportedBoundsError);
11244     fd_head = fragment_add_seq_802_11(next_tvb, hdr_len, pinfo, seq_number,
11245         wlan_fragment_table,
11246         wlan_reassembled_table,
11247         frag_number,
11248         reported_len,
11249         more_frags);
11250     next_tvb = process_reassembled_data(tvb, hdr_len, pinfo,
11251         "Reassembled 802.11", fd_head,
11252         &frag_items, NULL, hdr_tree);
11253   } else {
11254     /*
11255      * If this is the first fragment, dissect its contents, otherwise
11256      * just show it as a fragment.
11257      */
11258     if (frag_number != 0) {
11259       /* Not the first fragment - don't dissect it. */
11260       next_tvb = NULL;
11261     } else {
11262       /* First fragment, or not fragmented.  Dissect what we have here. */
11263
11264       /* Get a tvbuff for the payload. */
11265       next_tvb = tvb_new_subset (next_tvb, hdr_len, len, reported_len);
11266
11267       /*
11268        * If this is the first fragment, but not the only fragment,
11269        * tell the next protocol that.
11270        */
11271       if (more_frags)
11272         pinfo->fragmented = TRUE;
11273       else
11274         pinfo->fragmented = FALSE;
11275     }
11276   }
11277
11278   if (next_tvb == NULL) {
11279     /* Just show this as an incomplete fragment. */
11280     col_set_str(pinfo->cinfo, COL_INFO, "Fragmented IEEE 802.11 frame");
11281     next_tvb = tvb_new_subset (tvb, hdr_len, len, reported_len);
11282     call_dissector(data_handle, next_tvb, pinfo, tree);
11283     pinfo->fragmented = save_fragmented;
11284     goto end_of_wlan;
11285   }
11286
11287   switch (FCF_FRAME_TYPE (fcf))
11288     {
11289
11290     case MGT_FRAME:
11291       dissect_ieee80211_mgt (fcf, next_tvb, pinfo, tree);
11292       break;
11293
11294     case DATA_FRAME:
11295       if (is_amsdu && tvb_reported_length_remaining(next_tvb, 0) > 4){
11296         tvbuff_t *volatile msdu_tvb = NULL;
11297         guint32 msdu_offset = 0;
11298         guint16 i = 1;
11299         const guint8 *lcl_src = NULL;
11300         const guint8 *lcl_dst = NULL;
11301         guint16 msdu_length;
11302         proto_item *parent_item;
11303         proto_tree *mpdu_tree;
11304         proto_tree *subframe_tree;
11305
11306         parent_item = proto_tree_add_protocol_format(tree, proto_aggregate, next_tvb, 0,
11307                                     tvb_reported_length_remaining(next_tvb, 0), "IEEE 802.11 Aggregate MSDU");
11308         mpdu_tree = proto_item_add_subtree(parent_item, ett_msdu_aggregation_parent_tree);
11309
11310         do {
11311           lcl_dst = tvb_get_ptr (next_tvb, msdu_offset, 6);
11312           lcl_src = tvb_get_ptr (next_tvb, msdu_offset+6, 6);
11313           msdu_length = tvb_get_ntohs (next_tvb, msdu_offset+12);
11314
11315           parent_item = proto_tree_add_uint_format(mpdu_tree, hf_ieee80211_amsdu_msdu_header_text, next_tvb,
11316                             msdu_offset, roundup2(msdu_offset+14+msdu_length, 4),
11317                             i, "A-MSDU Subframe #%u", i);
11318           subframe_tree = proto_item_add_subtree(parent_item, ett_msdu_aggregation_subframe_tree);
11319           i++;
11320
11321           proto_tree_add_ether(subframe_tree, hf_ieee80211_addr_da, next_tvb, msdu_offset, 6, lcl_dst);
11322           proto_tree_add_ether(subframe_tree, hf_ieee80211_addr_sa, next_tvb, msdu_offset+6, 6, lcl_src);
11323           proto_tree_add_uint_format(subframe_tree, hf_ieee80211_mcsset_highest_data_rate, next_tvb, msdu_offset+12, 2,
11324           msdu_length, "MSDU length: 0x%04X", msdu_length);
11325
11326           msdu_offset += 14;
11327           msdu_tvb = tvb_new_subset(next_tvb, msdu_offset, msdu_length, -1);
11328           call_dissector(llc_handle, msdu_tvb, pinfo, subframe_tree);
11329           msdu_offset = roundup2(msdu_offset+msdu_length, 4);
11330         } while (tvb_reported_length_remaining(next_tvb, msdu_offset) > 14);
11331
11332         break;
11333       }
11334       /* I guess some bridges take Netware Ethernet_802_3 frames,
11335          which are 802.3 frames (with a length field rather than
11336          a type field, but with no 802.2 header in the payload),
11337          and just stick the payload into an 802.11 frame.  I've seen
11338          captures that show frames of that sort.
11339
11340          We also handle some odd form of encapsulation in which a
11341          complete Ethernet frame is encapsulated within an 802.11
11342          data frame, with no 802.2 header.  This has been seen
11343          from some hardware.
11344
11345          On top of that, at least at some point it appeared that
11346          the OLPC XO sent out frames with two bytes of 0 between
11347          the "end" of the 802.11 header and the beginning of
11348          the payload.
11349
11350          So, if the packet doesn't start with 0xaa 0xaa:
11351
11352            we first use the same scheme that linux-wlan-ng does to detect
11353            those encapsulated Ethernet frames, namely looking to see whether
11354            the frame either starts with 6 octets that match the destination
11355            address from the 802.11 header or has 6 octets that match the
11356            source address from the 802.11 header following the first 6 octets,
11357            and, if so, treat it as an encapsulated Ethernet frame;
11358
11359            otherwise, we use the same scheme that we use in the Ethernet
11360            dissector to recognize Netware 802.3 frames, namely checking
11361            whether the packet starts with 0xff 0xff and, if so, treat it
11362            as an encapsulated IPX frame, and then check whether the
11363            packet starts with 0x00 0x00 and, if so, treat it as an OLPC
11364            frame. */
11365       encap_type = ENCAP_802_2;
11366       TRY {
11367         octet1 = tvb_get_guint8(next_tvb, 0);
11368         octet2 = tvb_get_guint8(next_tvb, 1);
11369         if (octet1 != 0xaa || octet2 != 0xaa) {
11370           if (tvb_memeql(next_tvb, 6, pinfo->dl_src.data, 6) == 0 ||
11371               tvb_memeql(next_tvb, 0, pinfo->dl_dst.data, 6) == 0)
11372             encap_type = ENCAP_ETHERNET;
11373           else if (octet1 == 0xff && octet2 == 0xff)
11374             encap_type = ENCAP_IPX;
11375           else if (octet1 == 0x00 && octet2 == 0x00) {
11376             proto_tree_add_text(tree, next_tvb, 0, 2, "Mysterious OLPC stuff");
11377             next_tvb = tvb_new_subset_remaining (next_tvb, 2);
11378           }
11379         }
11380       }
11381       CATCH2(BoundsError, ReportedBoundsError) {
11382       ; /* do nothing */
11383
11384       }
11385       ENDTRY;
11386
11387       switch (encap_type) {
11388
11389       case ENCAP_802_2:
11390         call_dissector(llc_handle, next_tvb, pinfo, tree);
11391         break;
11392
11393       case ENCAP_ETHERNET:
11394         call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
11395         break;
11396
11397       case ENCAP_IPX:
11398         call_dissector(ipx_handle, next_tvb, pinfo, tree);
11399         break;
11400       }
11401       break;
11402     }
11403   pinfo->fragmented = save_fragmented;
11404
11405   end_of_wlan:
11406   whdr->stats = wlan_stats;
11407   tap_queue_packet(wlan_tap, pinfo, whdr);
11408   memset (&wlan_stats, 0, sizeof wlan_stats);
11409 }
11410
11411 /*
11412  * Dissect 802.11 with a variable-length link-layer header.
11413  */
11414 static void
11415 dissect_ieee80211 (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11416 {
11417   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
11418       pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, FALSE);
11419 }
11420
11421 /*
11422  * Dissect 802.11 with a variable-length link-layer header and data padding.
11423  */
11424 static void
11425 dissect_ieee80211_datapad (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11426 {
11427   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
11428       pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, TRUE, FALSE);
11429 }
11430
11431 /*
11432  * Dissect 802.11 with a variable-length link-layer header and a byte-swapped
11433  * control field (some hardware sends out LWAPP-encapsulated 802.11
11434  * packets with the control field byte swapped).
11435  */
11436 static void
11437 dissect_ieee80211_bsfc (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11438 {
11439   dissect_ieee80211_common (tvb, pinfo, tree, FALSE, 0, TRUE, FALSE, FALSE);
11440 }
11441
11442 /*
11443  * Dissect 802.11 with a fixed-length link-layer header (padded to the
11444  * maximum length).
11445  */
11446 static void
11447 dissect_ieee80211_fixed (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11448 {
11449   dissect_ieee80211_common (tvb, pinfo, tree, TRUE, 0, FALSE, FALSE, FALSE);
11450 }
11451
11452 /*
11453  * Dissect an HT 802.11 frame with a variable-length link-layer header.
11454  * XXX - Can we tell if a frame is +HTC just by looking at the MAC header?
11455  * If so, we can dispense with this.
11456  */
11457 static void
11458 dissect_ieee80211_ht (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11459 {
11460   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
11461       pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, TRUE);
11462 }
11463
11464 static void
11465 wlan_defragment_init(void)
11466 {
11467   fragment_table_init(&wlan_fragment_table);
11468   reassembled_table_init(&wlan_reassembled_table);
11469 }
11470
11471 /* ------------- */
11472 static guint
11473 retransmit_hash(gconstpointer k)
11474 {
11475   const retransmit_key *key = (const retransmit_key *)k;
11476   guint hash_val;
11477   int i;
11478
11479   hash_val = 0;
11480   for (i = 0; i < 6; i++)
11481     hash_val += key->bssid[i];
11482
11483   for (i = 0; i < 6; i++)
11484     hash_val += key->src[i];
11485
11486   return hash_val;
11487 }
11488
11489 static gint
11490 retransmit_equal(gconstpointer k1, gconstpointer k2)
11491 {
11492   const retransmit_key *key1 = (const retransmit_key *)k1;
11493   const retransmit_key *key2 = (const retransmit_key *)k2;
11494
11495   return ( (!memcmp(key1->bssid, key2->bssid, 6) && !memcmp( key1->src, key2->src, 6))? TRUE:FALSE);
11496 }
11497
11498 static guint
11499 frame_hash(gconstpointer k)
11500 {
11501   guint32 frame = GPOINTER_TO_UINT(k);
11502
11503   return frame;
11504 }
11505
11506 static gint
11507 frame_equal(gconstpointer k1, gconstpointer k2)
11508 {
11509   guint32 frame1 = GPOINTER_TO_UINT(k1);
11510   guint32 frame2 = GPOINTER_TO_UINT(k2);
11511
11512   return frame1==frame2;
11513 }
11514
11515 static void
11516 wlan_retransmit_init(void)
11517 {
11518   if ( fc_analyse_retransmit_table ){
11519       g_hash_table_destroy(fc_analyse_retransmit_table);
11520       fc_analyse_retransmit_table = NULL;
11521   }
11522
11523   if( fc_first_frame_table ){
11524       g_hash_table_destroy(fc_first_frame_table);
11525       fc_first_frame_table = NULL;
11526   }
11527
11528   if (wlan_subdissector)
11529       return;
11530
11531   fc_analyse_retransmit_table= g_hash_table_new(retransmit_hash, retransmit_equal);
11532   fc_first_frame_table = g_hash_table_new( frame_hash, frame_equal);
11533
11534 }
11535
11536 void
11537 proto_register_ieee80211 (void)
11538 {
11539   static const value_string frame_type[] = {
11540     {MGT_FRAME,     "Management frame"},
11541     {CONTROL_FRAME, "Control frame"},
11542     {DATA_FRAME,    "Data frame"},
11543     {0,             NULL}
11544   };
11545
11546   static const value_string tofrom_ds[] = {
11547     {0,                       "Not leaving DS or network is operating "
11548       "in AD-HOC mode (To DS: 0 From DS: 0)"},
11549     {FLAG_TO_DS,              "Frame from STA to DS via an AP (To DS: 1 "
11550       "From DS: 0)"},
11551     {FLAG_FROM_DS,            "Frame from DS to a STA via AP(To DS: 0 "
11552       "From DS: 1)"},
11553     {FLAG_TO_DS|FLAG_FROM_DS, "WDS (AP to AP) or Mesh (MP to MP) Frame "
11554       "(To DS: 1 From DS: 1)"},
11555     {0, NULL}
11556   };
11557
11558   static const true_false_string tods_flag = {
11559     "Frame is entering DS",
11560     "Frame is not entering DS"
11561   };
11562
11563   static const true_false_string fromds_flag = {
11564     "Frame is exiting DS",
11565     "Frame is not exiting DS"
11566   };
11567
11568   static const true_false_string more_frags = {
11569     "More fragments follow",
11570     "This is the last fragment"
11571   };
11572
11573   static const true_false_string retry_flags = {
11574     "Frame is being retransmitted",
11575     "Frame is not being retransmitted"
11576   };
11577
11578   static const true_false_string pm_flags = {
11579     "STA will go to sleep",
11580     "STA will stay up"
11581   };
11582
11583   static const true_false_string md_flags = {
11584     "Data is buffered for STA at AP",
11585     "No data buffered"
11586   };
11587
11588   static const true_false_string protected_flags = {
11589     "Data is protected",
11590     "Data is not protected"
11591   };
11592
11593   static const true_false_string order_flags = {
11594     "Strictly ordered",
11595     "Not strictly ordered"
11596   };
11597
11598   static const true_false_string cf_ess_flags = {
11599     "Transmitter is an AP",
11600     "Transmitter is a STA"
11601   };
11602
11603
11604   static const true_false_string cf_privacy_flags = {
11605     "AP/STA can support WEP",
11606     "AP/STA cannot support WEP"
11607   };
11608
11609   static const true_false_string cf_preamble_flags = {
11610     "Short preamble allowed",
11611     "Short preamble not allowed"
11612   };
11613
11614   static const true_false_string cf_pbcc_flags = {
11615     "PBCC modulation allowed",
11616     "PBCC modulation not allowed"
11617   };
11618
11619   static const true_false_string cf_agility_flags = {
11620     "Channel agility in use",
11621     "Channel agility not in use"
11622   };
11623
11624   static const true_false_string short_slot_time_flags = {
11625     "Short slot time in use",
11626     "Short slot time not in use"
11627   };
11628
11629   static const true_false_string dsss_ofdm_flags = {
11630     "DSSS-OFDM modulation allowed",
11631     "DSSS-OFDM modulation not allowed"
11632   };
11633
11634   static const true_false_string cf_spec_man_flags = {
11635     "dot11SpectrumManagementRequired TRUE",
11636     "dot11SpectrumManagementRequired FALSE"
11637   };
11638
11639   static const true_false_string cf_apsd_flags = {
11640     "apsd implemented",
11641     "apsd not implemented"
11642   };
11643
11644   static const true_false_string cf_del_blk_ack_flags = {
11645     "delayed block ack implemented",
11646     "delayed block ack not implemented"
11647   };
11648
11649   static const true_false_string cf_imm_blk_ack_flags = {
11650     "immediate block ack implemented",
11651     "immediate block ack not implemented"
11652   };
11653   static const true_false_string cf_ibss_flags = {
11654     "Transmitter belongs to an IBSS",
11655     "Transmitter belongs to a BSS"
11656   };
11657
11658   static const true_false_string eosp_flag = {
11659     "End of service period",
11660     "Service period"
11661   };
11662
11663   static const true_false_string bit4_flag = {
11664     "Bits 8-15 of QoS Control field are Queue Size",
11665     "Bits 8-15 of QoS Control field are TXOP Duration Requested"
11666   };
11667
11668   static const true_false_string ieee80211_qos_amsdu_present_flag = {
11669     "A-MSDU",
11670     "MSDU"
11671   };
11672
11673   static const value_string sta_cf_pollable[] = {
11674     {0x00, "Station is not CF-Pollable"},
11675     {0x02, "Station is CF-Pollable, "
11676      "not requesting to be placed on the  CF-polling list"},
11677     {0x01, "Station is CF-Pollable, "
11678      "requesting to be placed on the CF-polling list"},
11679     {0x03, "Station is CF-Pollable, requesting never to be polled"},
11680     {0x0200, "QSTA requesting association in QBSS"},
11681     {0, NULL}
11682   };
11683
11684   static const value_string ap_cf_pollable[] = {
11685     {0x00, "No point coordinator at AP"},
11686     {0x02, "Point coordinator at AP for delivery only (no polling)"},
11687     {0x01, "Point coordinator at AP for delivery and polling"},
11688     {0x03, "Reserved"},
11689     {0x0200, "QAP (HC) does not use CFP for delivery of unicast data type frames"},
11690     {0x0202, "QAP (HC) uses CFP for delivery, but does not send CF-Polls to non-QoS STAs"},
11691     {0x0201, "QAP (HC) uses CFP for delivery, and sends CF-Polls to non-QoS STAs"},
11692     {0x0203, "Reserved"},
11693     {0, NULL}
11694   };
11695
11696
11697   static const value_string auth_alg[] = {
11698     {0x00, "Open System"},
11699     {0x01, "Shared key"},
11700     {0x02, "Fast BSS Transition"},
11701     {0x80, "Network EAP"},  /* Cisco proprietary? */
11702     {0, NULL}
11703   };
11704
11705   static const true_false_string ff_block_ack_params_amsdu_permitted_flag = {
11706     "Permitted in QoS Data MPDUs",
11707     "Not Permitted"
11708   };
11709
11710   static const true_false_string ff_block_ack_params_policy_flag = {
11711     "Immediate Block Ack",
11712     "Delayed Block Ack"
11713   };
11714
11715   static const value_string  ff_channel_width_vals[] = {
11716     {0x00, "20 MHz channel width only"},
11717     {0x01, "Any channel width in the STA's Supported Channel Width Set"},
11718     {0, NULL}
11719   };
11720
11721   static const true_false_string ff_qos_info_ap_q_ack_flag = {
11722       "Implemented",
11723       "Not Implemented"
11724   };
11725
11726   static const true_false_string ff_qos_info_ap_queue_req_flag = {
11727       "Can process a nonzero Queue Size subfield in the QoS Control field in QoS data frames",
11728       "Can NOT process a nonzero Queue Size subfield in the QoS Control field in QoS data frames"
11729   };
11730
11731   static const true_false_string ff_qos_info_ap_txop_request_flag = {
11732       "Can process a nonzero TXOP Duration Requested subfield in the QoS Control field in QoS data frames",
11733       "Can NOT process a nonzero TXOP Duration Requested subfield in the QoS Control field in QoS data frames"
11734   };
11735
11736   static const true_false_string ff_qos_info_sta_ac_flag = {
11737       "Trigger-enabled and Delivery-enabled",
11738       "Neither Trigger-enabled nor Delivery-enabled"
11739   };
11740
11741   static const true_false_string ff_qos_info_sta_q_ack_flag = {
11742       "Implemented",
11743       "Not Implemented"
11744   };
11745
11746   static const value_string ff_qos_info_sta_max_sp_len_flags[] = {
11747     {0x00, "AP may deliver all buffered MSDUs, A-MSDUs and MMPDUs"},
11748     {0x01, "AP may deliver a maximum of two MSDUs and MMPDUs per SP"},
11749     {0x02, "AP may deliver a maximum of four MSDUs and MMPDUs per SP"},
11750     {0x03, "AP may deliver a maximum of six MSDUs and MMPDUs per SP"},
11751     {0, NULL}
11752   };
11753
11754   static const true_false_string ff_qos_info_sta_more_data_ack_flag = {
11755       "Can process ACK frames with the More Data bit in the Frame Control field set to 1",
11756       "Can NOT process ACK frames with the More Data bit in the Frame Control field set to 1"
11757   };
11758
11759   static const true_false_string ff_sm_pwr_save_sm_mode_flag = {
11760       "Dynamic SM Power Save mode",
11761       "Static SM Power Save mode"
11762   };
11763
11764   static const true_false_string ff_pco_phase_cntrl_flag = {
11765       "40 MHz Phase",
11766       "20 MHz Phase"
11767   };
11768
11769   static const true_false_string ff_psmp_param_set_more_psmp_flag = {
11770       "More PSMP Sequences Follow",
11771       "No PSMP Sequences Follow"
11772   };
11773
11774   static const value_string ff_mimo_cntrl_nc_index_flags[] = {
11775     {0x00, "1 Column"},
11776     {0x01, "2 Columns"},
11777     {0x02, "3 Columns"},
11778     {0x03, "4 Columns"},
11779     {0, NULL}
11780   };
11781
11782   static const value_string ff_mimo_cntrl_nr_index_flags[] = {
11783     {0x00, "1 Row"},
11784     {0x01, "2 Rows"},
11785     {0x02, "3 Rows"},
11786     {0x03, "4 Rows"},
11787     {0, NULL}
11788   };
11789
11790   static const true_false_string ff_mimo_cntrl_channel_width_flag = {
11791       "40 MHz",
11792       "20 MHz"
11793   };
11794
11795   static const true_false_string ff_ht_info_information_request_flag = {
11796       "Requesting HT Information Exchange management action frame",
11797       "Should not send an HT Information Exchange management action frame"
11798   };
11799
11800   static const true_false_string ff_ht_info_40_mhz_intolerant_flag = {
11801       "Transmitting station is intolerant of 40 MHz operation",
11802       "Transmitting station permits 40 MHz operation"
11803   };
11804
11805   static const true_false_string ff_ht_info_sta_chan_width_flag = {
11806       "40 MHz",
11807       "20 MHz"
11808   };
11809
11810   static const value_string ff_ht_action_flags[] = {
11811     {HT_ACTION_NOTIFY_CHAN_WIDTH, "Notify Channel Width"},
11812     {HT_ACTION_SM_PWR_SAVE, "Spatial Multiplexing (SM) Power Save"},
11813     {HT_ACTION_PSMP_ACTION, "Power Save Multi-Poll (PSMP) action frame"},
11814     {HT_ACTION_SET_PCO_PHASE, "Set PCO Phase"},
11815     {HT_ACTION_MIMO_CSI, "MIMO CSI Matrices"},
11816     {HT_ACTION_MIMO_BEAMFORMING, "MIMO Non-compressed Beamforming"},
11817     {HT_ACTION_MIMO_COMPRESSED_BEAMFORMING, "MIMO Compressed Beamforming"},
11818     {HT_ACTION_ANT_SEL_FEEDBACK, "Antenna Selection Indices Feedback"},
11819     {HT_ACTION_HT_INFO_EXCHANGE, "HT Information Exchange"},
11820     {0x00, NULL}
11821   };
11822
11823   static const value_string ff_mimo_cntrl_grouping_flags[] = {
11824     {0x00, "No Grouping"},
11825     {0x01, "Carrier Groups of 2"},
11826     {0x02, "Carrier Groups of 4"},
11827     {0x03, "Reserved"},
11828     {0, NULL}
11829   };
11830
11831   static const value_string ff_mimo_cntrl_coefficient_size_flags[] = {
11832     {0x00, "4 Bits"},
11833     {0x01, "5 Bits"},
11834     {0x02, "6 Bits"},
11835     {0x03, "8 Bits"},
11836     {0, NULL}
11837   };
11838
11839   static const value_string ff_mimo_cntrl_codebook_info_flags[] = {
11840     {0x00, "1 bit for 'Capital Psi', 3 bits for 'Small Psi'"},
11841     {0x01, "2 bit for 'Capital Psi', 4 bits for 'Small Psi'"},
11842     {0x02, "3 bit for 'Capital Psi', 5 bits for 'Small Psi'"},
11843     {0x03, "4 bit for 'Capital Psi', 6 bits for 'Small Psi'"},
11844     {0, NULL}
11845   };
11846
11847
11848
11849   static const value_string ff_pa_action_codes[] = {
11850     {PA_DSE_ENABLEMENT, "DSE enablement"},
11851     {PA_DSE_DEENABLEMENT, "DSE deenablement"},
11852     {PA_DSE_REG_LOC_ANNOUNCEMENT, "DSE Registered Location Announcement"},
11853     {PA_EXT_CHANNEL_SWITCH_ANNOUNCEMENT, "Extended Channel Switch Announcement"},
11854     {PA_DSE_MEASUREMENT_REQUEST, "DSE measurement request"},
11855     {PA_DSE_MEASUREMENT_REPORT, "DSE measurement report"},
11856     {PA_MEASUREMENT_PILOT, "Measurement Pilot"},
11857     {PA_DSE_POWER_CONSTRAINT, "DSE power constraint"},
11858     {PA_VENDOR_SPECIFIC, "Vendor Specific"},
11859     {PA_GAS_INITIAL_REQUEST, "GAS Initial Request"},
11860     {PA_GAS_INITIAL_RESPONSE, "GAS Initial Response"},
11861     {PA_GAS_COMEBACK_REQUEST, "GAS Comeback Request"},
11862     {PA_GAS_COMEBACK_RESPONSE, "GAS Comeback Response"},
11863     {PA_TDLS_DISCOVERY_RESPONSE, "TDLS Discovery Response"},
11864     {0x00, NULL}
11865   };
11866
11867   static const value_string category_codes[] = {
11868     {CAT_SPECTRUM_MGMT, "Spectrum Management (SM)"},
11869     {0x80 | CAT_SPECTRUM_MGMT, "Spectrum Management (SM) (error)"},
11870     {CAT_QOS, "Quality of Service (QoS)"},
11871     {0x80 | CAT_QOS, "Quality of Service (QoS (error))"},
11872     {CAT_DLS, "Direct-Link Setup (DLS)"},
11873     {0x80 | CAT_DLS, "Direct-Link Setup (DLS) (error)"},
11874     {CAT_BLOCK_ACK, "Block Ack"},
11875     {0x80 | CAT_BLOCK_ACK, "Block Ack (error)"},
11876     {CAT_PUBLIC, "Public Action"},
11877     {0x80 | CAT_PUBLIC, "Public Action (error)"},
11878     {CAT_RADIO_MEASUREMENT, "Radio Measurement"},
11879     {0x80 | CAT_RADIO_MEASUREMENT, "Radio Measurement (error)"},
11880     {CAT_FAST_BSS_TRANSITION, "Fast BSS Transition"},
11881     {0x80 | CAT_FAST_BSS_TRANSITION, "Fast BSS Transition (error)"},
11882     {CAT_HT, "High Throughput"},
11883     {0x80 | CAT_HT, "High Throughput (error)"},
11884     {CAT_SA_QUERY, "SA Query"},
11885     {0x80 | CAT_SA_QUERY, "SA Query (error)"},
11886     {CAT_PUBLIC_PROTECTED, "Protected Dual of Public Action"},
11887     {0x80 | CAT_PUBLIC_PROTECTED, "Protected Dual of Public Action (error)"},
11888     {CAT_WNM, "WNM"},
11889     {0x80 | CAT_WNM, "WNM (error)"},
11890     {CAT_UNPROTECTED_WNM, "Unprotected WNM"},
11891     {0x80 | CAT_UNPROTECTED_WNM, "Unprotected WNM (error)"},
11892     {CAT_TDLS, "TDLS"},
11893     {0x80 | CAT_TDLS, "TDLS (error)"},
11894     {CAT_MESH, "MESH"},
11895     {0x80 | CAT_MESH, "Mesh (error)"},
11896     {CAT_MULTIHOP, "Multihop"},
11897     {0x80 | CAT_MULTIHOP, "Multihop (error)"},
11898     {CAT_SELF_PROTECTED, "Self-protected"},
11899     {0x80 | CAT_SELF_PROTECTED, "Self-protected (error)"},
11900     {CAT_MGMT_NOTIFICATION, "Management Notification"},
11901     {0x80 | CAT_MGMT_NOTIFICATION, "Management Notification (error)"},
11902     {CAT_VENDOR_SPECIFIC_PROTECTED, "Vendor-specific Protected"},
11903     {0x80 | CAT_VENDOR_SPECIFIC_PROTECTED, "Vendor-specific Protected (error)"},
11904     {CAT_VENDOR_SPECIFIC, "Vendor Specific"},
11905     {0x80 | CAT_VENDOR_SPECIFIC, "Vendor Specific (error)"},
11906     {0, NULL}
11907   };
11908
11909   static const value_string action_codes[] ={
11910     {SM_ACTION_MEASUREMENT_REQUEST, "Measurement Request"},
11911     {SM_ACTION_MEASUREMENT_REPORT, "Measurement Report"},
11912     {SM_ACTION_TPC_REQUEST, "TPC Request"},
11913     {SM_ACTION_TPC_REPORT, "TPC Report"},
11914     {SM_ACTION_CHAN_SWITCH_ANNC, "Channel Switch Announcement"},
11915     {0, NULL}
11916   };
11917
11918   static const value_string vendor_action_types_mrvl[] ={
11919     {MRVL_ACTION_MESH_MANAGEMENT, "Mesh Management"},
11920     {0, NULL}
11921   };
11922
11923   static const value_string mesh_mgt_action_codes_mrvl[] ={
11924     {MRVL_MESH_MGMT_ACTION_RREQ, "Route Request"},
11925     {MRVL_MESH_MGMT_ACTION_RREP, "Route Response"},
11926     {MRVL_MESH_MGMT_ACTION_RERR, "Route Error"},
11927     {MRVL_MESH_MGMT_ACTION_PLDM, "Peer Link Down"},
11928     {0, NULL}
11929   };
11930
11931   static const value_string mesh_path_selection_codes[] ={
11932     {0x0, "Hybrid Wireless Mesh Protocol"},
11933     {0, NULL}
11934   };
11935
11936   static const value_string mesh_metric_codes[] ={
11937     {0x0, "Airtime Link Metric"},
11938     {0, NULL}
11939   };
11940
11941   static const value_string wme_action_codes[] = {
11942     {0x00, "Setup request"},
11943     {0x01, "Setup response"},
11944     {0x02, "Teardown"},
11945     {0x00, NULL}
11946   };
11947
11948   static const value_string wme_status_codes[] = {
11949     {0x00, "Admission accepted"},
11950     {0x01, "Invalid parameters"},
11951     {0x03, "Refused"},
11952     {0x00, NULL}
11953   };
11954
11955   static const value_string mesh_action[] ={
11956     {MESH_ACTION_LINK_METRIC_REPORT, "Mesh Link Metric Report"},
11957     {MESH_ACTION_HWMP, "HWMP Mesh Path Selection"},
11958     {MESH_ACTION_GATE_ANNOUNCE, "Gate Announcement"},
11959     {MESH_ACTION_CONGESTION_CTL, "Congestion Control Notification"},
11960     {MESH_ACTION_MCCA_SETUP_REQUEST, "MCCA Setup Request"},
11961     {MESH_ACTION_MCCA_SETUP_REPLY, "MCCA Setup Reply"},
11962     {MESH_ACTION_MCCA_ADV_REQUEST, "MCCA Advertisement Request"},
11963     {MESH_ACTION_MCCA_ADV, "MCCA Advertisement"},
11964     {MESH_ACTION_MCCA_TEARDOWN, "MCCA Teardown"},
11965     {MESH_ACTION_TBTT_ADJ_REQUEST, "TBTT Adjustment Request"},
11966     {MESH_ACTION_TBTT_ADJ_RESPONSE, "TBTT Adjustment Response"},
11967     {0, NULL}
11968   };
11969
11970   static const value_string multihop_action[] ={
11971     {MULTIHOP_ACTION_PROXY_UPDATE, "Proxy Update"},
11972     {MULTIHOP_ACTION_PROXY_UPDATE_CONF, "Proxy Update Confirmation"},
11973     {0, NULL}
11974   };
11975
11976   static const value_string selfprot_action[] = {
11977     {SELFPROT_ACTION_MESH_PEERING_OPEN, "Mesh Peering Open"},
11978     {SELFPROT_ACTION_MESH_PEERING_CONFIRM, "Mesh Peering Confirm"},
11979     {SELFPROT_ACTION_MESH_PEERING_CLOSE, "Mesh Peering Close"},
11980     {SELFPROT_ACTION_MESH_GROUP_KEY_INFORM, "Mesh Group Key Inform"},
11981     {SELFPROT_ACTION_MESH_GROUP_KEY_ACK, "Mesh Group Key Ack"},
11982     {0, NULL}
11983   };
11984
11985   static const value_string mesh_peering_proto_ids[] = {
11986     {MESH_PEERING_PROTO_MGMT, "Mesh peering management protocol"},
11987     {MESH_PEERING_PROTO_AMPE, "Authenticated mesh peering exchange protocol"},
11988     {MESH_PEERING_PROTO_VENDOR, "Vendor specific"},
11989     {0, NULL}
11990   };
11991
11992   static const true_false_string hwmp_targ_usn_flags = {
11993     "[USN = 1] Target Sequence Number Unkwown at Originator",
11994     "[USN = 0] Target Sequence Number Known at Originator"
11995   };
11996
11997   static const true_false_string hwmp_targ_to_flags = {
11998     "[TO = 1] Only Target Will Respond",
11999     "[TO = 0] Intermediate Nodes May Respond"
12000   };
12001
12002   static const value_string ack_policy[] = {
12003     {0x00, "Normal Ack"},
12004     {0x01, "No Ack"},
12005     {0x02, "No explicit acknowledgment"},
12006     {0x03, "Block Ack"},
12007     {0x00, NULL}
12008   };
12009
12010   static const value_string qos_action_codes[] = {
12011     {SM_ACTION_ADDTS_REQUEST, "ADDTS Request"},
12012     {SM_ACTION_ADDTS_RESPONSE, "ADDTS Response"},
12013     {SM_ACTION_DELTS, "DELTS"},
12014     {SM_ACTION_QOS_SCHEDULE, "Schedule"},
12015     {0, NULL}
12016   };
12017
12018   static const value_string ba_action_codes[] = {
12019     {BA_ADD_BLOCK_ACK_REQUEST, "Add Block Ack Request"},
12020     {BA_ADD_BLOCK_ACK_RESPONSE, "Add Block Ack Response"},
12021     {BA_DELETE_BLOCK_ACK, "Delete Block Ack"},
12022     {0x00, NULL}
12023   };
12024
12025   static const value_string dls_action_codes[] = {
12026     {SM_ACTION_DLS_REQUEST, "DLS Request"},
12027     {SM_ACTION_DLS_RESPONSE, "DLS Response"},
12028     {SM_ACTION_DLS_TEARDOWN, "DLS Teardown"},
12029     {0, NULL}
12030   };
12031
12032   static const value_string tsinfo_type[] = {
12033     {0x0, "Aperiodic or unspecified Traffic"},
12034     {0x1, "Periodic Traffic"},
12035     {0, NULL}
12036   };
12037
12038   static const value_string tsinfo_direction[] = {
12039     {0x00, "Uplink"},
12040     {0x01, "Downlink"},
12041     {0x02, "Direct link"},
12042     {0x03, "Bidirectional link"},
12043     {0, NULL}
12044   };
12045
12046   static const value_string tsinfo_access[] = {
12047     {0x00, "Reserved"},
12048     {0x01, "EDCA"},
12049     {0x02, "HCCA"},
12050     {0x03, "HEMM"},
12051     {0, NULL}
12052   };
12053
12054   static const value_string qos_up[] = {
12055     {0x00, "Best Effort"},
12056     {0x01, "Background"},
12057     {0x02, "Spare"},
12058     {0x03, "Excellent Effort"},
12059     {0x04, "Controlled Load"},
12060     {0x05, "Video"},
12061     {0x06, "Voice"},
12062     {0x07, "Network Control"},
12063     {0, NULL}
12064   };
12065
12066   static const value_string classifier_type[] = {
12067     {0x00, "Ethernet parameters"},
12068     {0x01, "TCP/UDP IP parameters"},
12069     {0x02, "IEEE 802.1D/Q parameters"},
12070     {0, NULL}
12071   };
12072
12073   static const true_false_string ieee80211_block_ack_control_ack_policy_flag = {
12074       "Immediate Acknowledgement Required",
12075       "Sender Does Not Require Immediate Acknowledgement"
12076   };
12077
12078   static const value_string ieee80211_block_ack_request_type_flags[] = {
12079     {0x00, "Basic Block Ack Request"},
12080     {0x01, "Reserved"},
12081     {0x02, "Compressed Block Ack Request"},
12082     {0x03, "Multi-TID Block Ack Request"},
12083     {0x00, NULL}
12084   };
12085
12086   static const value_string ieee80211_block_ack_type_flags[] = {
12087     {0x00, "Basic Block Ack"},
12088     {0x01, "Reserved"},
12089     {0x02, "Compressed Block"},
12090     {0x03, "Multi-TID Block"},
12091     {0x00, NULL}
12092   };
12093
12094   static const value_string ft_action_codes[] ={
12095     {FT_ACTION_REQUEST, "FT Request"},
12096     {FT_ACTION_RESPONSE, "FT Response"},
12097     {FT_ACTION_CONFIRM, "FT Confirm"},
12098     {FT_ACTION_ACK, "FT Ack"},
12099     {0, NULL}
12100   };
12101
12102   static const value_string sa_query_action_codes[] ={
12103     {SA_QUERY_REQUEST, "SA Query Request"},
12104     {SA_QUERY_RESPONSE, "SA Query Response"},
12105     {0, NULL}
12106   };
12107
12108   static const value_string ieee80211_data_encap_payload_types[] = {
12109     {1, "Remote Request/Response"},
12110     {2, "TDLS"},
12111     {0, NULL}
12112   };
12113
12114   static hf_register_info hf[] = {
12115     {&hf_ieee80211_fc_field,
12116      {"Frame Control Field", "wlan.fc", FT_UINT16, BASE_HEX, NULL, 0,
12117       "MAC Frame control", HFILL }},
12118
12119     {&hf_ieee80211_fc_proto_version,
12120      {"Version", "wlan.fc.version", FT_UINT8, BASE_DEC, NULL, 0,
12121       "MAC Protocol version", HFILL }},  /* 0 */
12122
12123     {&hf_ieee80211_fc_frame_type,
12124      {"Type", "wlan.fc.type", FT_UINT8, BASE_DEC, VALS(frame_type), 0,
12125       "Frame type", HFILL }},
12126
12127     {&hf_ieee80211_fc_frame_subtype,
12128      {"Subtype", "wlan.fc.subtype", FT_UINT8, BASE_DEC, NULL, 0,
12129       "Frame subtype", HFILL }},  /* 2 */
12130
12131     {&hf_ieee80211_fc_frame_type_subtype,
12132      {"Type/Subtype", "wlan.fc.type_subtype", FT_UINT8, BASE_HEX, VALS(frame_type_subtype_vals), 0,
12133       "Type and subtype combined (first byte: type, second byte: subtype)", HFILL }},
12134
12135     {&hf_ieee80211_fc_flags,
12136      {"Protocol Flags", "wlan.flags", FT_UINT8, BASE_HEX, NULL, 0,
12137       NULL, HFILL }},
12138
12139     {&hf_ieee80211_fc_data_ds,
12140      {"DS status", "wlan.fc.ds", FT_UINT8, BASE_HEX, VALS (&tofrom_ds), (FLAG_FROM_DS|FLAG_TO_DS),
12141       "Data-frame DS-traversal status", HFILL }},  /* 3 */
12142
12143     {&hf_ieee80211_fc_to_ds,
12144      {"To DS", "wlan.fc.tods", FT_BOOLEAN, 8, TFS (&tods_flag), FLAG_TO_DS,
12145       "To DS flag", HFILL }},    /* 4 */
12146
12147     {&hf_ieee80211_fc_from_ds,
12148      {"From DS", "wlan.fc.fromds", FT_BOOLEAN, 8, TFS (&fromds_flag), FLAG_FROM_DS,
12149       "From DS flag", HFILL }},    /* 5 */
12150
12151     {&hf_ieee80211_fc_more_frag,
12152      {"More Fragments", "wlan.fc.frag", FT_BOOLEAN, 8, TFS (&more_frags), FLAG_MORE_FRAGMENTS,
12153       "More Fragments flag", HFILL }},  /* 6 */
12154
12155     {&hf_ieee80211_fc_retry,
12156      {"Retry", "wlan.fc.retry", FT_BOOLEAN, 8, TFS (&retry_flags), FLAG_RETRY,
12157       "Retransmission flag", HFILL }},
12158
12159     { &hf_ieee80211_fc_analysis_retransmission,
12160      {"Retransmission", "wlan.analysis.retransmission", FT_NONE, BASE_NONE,
12161       NULL, 0x0, "This frame is a suspected wireless retransmission", HFILL }},
12162
12163     { &hf_ieee80211_fc_analysis_retransmission_frame,
12164      {"Retransmission of frame", "wlan.analysis.retransmission_frame", FT_FRAMENUM, BASE_NONE,
12165       NULL, 0x0, "This is a retransmission of frame #", HFILL }},
12166
12167     {&hf_ieee80211_fc_pwr_mgt,
12168      {"PWR MGT", "wlan.fc.pwrmgt", FT_BOOLEAN, 8, TFS (&pm_flags), FLAG_POWER_MGT,
12169       "Power management status", HFILL }},
12170
12171     {&hf_ieee80211_fc_more_data,
12172      {"More Data", "wlan.fc.moredata", FT_BOOLEAN, 8, TFS (&md_flags), FLAG_MORE_DATA,
12173       "More data flag", HFILL }},
12174
12175     {&hf_ieee80211_fc_protected,
12176      {"Protected flag", "wlan.fc.protected", FT_BOOLEAN, 8, TFS (&protected_flags), FLAG_PROTECTED,
12177       NULL, HFILL }},
12178
12179     {&hf_ieee80211_fc_order,
12180      {"Order flag", "wlan.fc.order", FT_BOOLEAN, 8, TFS (&order_flags), FLAG_ORDER,
12181       "Strictly ordered flag", HFILL }},
12182
12183     {&hf_ieee80211_assoc_id,
12184      {"Association ID","wlan.aid",FT_UINT16, BASE_DEC, NULL, 0x3FFF,
12185       "Association-ID field", HFILL }},
12186
12187     {&hf_ieee80211_did_duration,
12188      {"Duration", "wlan.duration", FT_UINT16, BASE_DEC, NULL, 0,
12189       "Duration field", HFILL }},
12190
12191     {&hf_ieee80211_addr_da,
12192      {"Destination address", "wlan.da", FT_ETHER, BASE_NONE, NULL, 0,
12193       "Destination Hardware Address", HFILL }},
12194
12195     {&hf_ieee80211_addr_sa,
12196      {"Source address", "wlan.sa", FT_ETHER, BASE_NONE, NULL, 0,
12197       "Source Hardware Address", HFILL }},
12198
12199     { &hf_ieee80211_addr,
12200       {"Source or Destination address", "wlan.addr", FT_ETHER, BASE_NONE, NULL, 0,
12201        "Source or Destination Hardware Address", HFILL }},
12202
12203     {&hf_ieee80211_addr_ra,
12204      {"Receiver address", "wlan.ra", FT_ETHER, BASE_NONE, NULL, 0,
12205       "Receiving Station Hardware Address", HFILL }},
12206
12207     {&hf_ieee80211_addr_ta,
12208      {"Transmitter address", "wlan.ta", FT_ETHER, BASE_NONE, NULL, 0,
12209       "Transmitting Station Hardware Address", HFILL }},
12210
12211     {&hf_ieee80211_addr_bssid,
12212      {"BSS Id", "wlan.bssid", FT_ETHER, BASE_NONE, NULL, 0,
12213       "Basic Service Set ID", HFILL }},
12214
12215     {&hf_ieee80211_frag_number,
12216      {"Fragment number", "wlan.frag", FT_UINT16, BASE_DEC, NULL, 0,
12217       NULL, HFILL }},
12218
12219     {&hf_ieee80211_seq_number,
12220      {"Sequence number", "wlan.seq", FT_UINT16, BASE_DEC, NULL, 0,
12221       NULL, HFILL }},
12222
12223     {&hf_ieee80211_qos_tid,
12224      {"TID", "wlan.qos.tid", FT_UINT16, BASE_DEC, NULL, 0,
12225       NULL, HFILL }},
12226
12227     {&hf_ieee80211_qos_priority,
12228      {"Priority", "wlan.qos.priority", FT_UINT16, BASE_DEC, NULL, 0,
12229       "802.1D Tag", HFILL }},
12230
12231     {&hf_ieee80211_qos_eosp,
12232      {"EOSP", "wlan.qos.eosp", FT_BOOLEAN, 8, TFS (&eosp_flag), QOS_FLAG_EOSP,
12233       "EOSP Field", HFILL }},
12234
12235     {&hf_ieee80211_qos_bit4,
12236      {"QoS bit 4", "wlan.qos.bit4", FT_BOOLEAN, 8, TFS (&bit4_flag), QOS_FLAG_EOSP,
12237       NULL, HFILL }},
12238
12239     {&hf_ieee80211_qos_ack_policy,
12240      {"Ack Policy", "wlan.qos.ack", FT_UINT8, BASE_HEX,  VALS (&ack_policy), 0,
12241       NULL, HFILL }},
12242
12243     {&hf_ieee80211_qos_amsdu_present,
12244      {"Payload Type", "wlan.qos.amsdupresent", FT_BOOLEAN, BASE_NONE,
12245       TFS (&ieee80211_qos_amsdu_present_flag), 0x0, NULL, HFILL }},
12246
12247     {&hf_ieee80211_qos_txop_limit,
12248      {"TXOP Limit", "wlan.qos.txop_limit", FT_UINT16, BASE_DEC, NULL, 0,
12249       NULL, HFILL }},
12250
12251     {&hf_ieee80211_qos_buf_state_indicated,
12252      {"Buffer State Indicated", "wlan.qos.buf_state_indicated",
12253        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12254       NULL, HFILL }},
12255
12256     {&hf_ieee80211_qos_highest_pri_buf_ac,
12257      {"Highest-Priority Buffered AC", "wlan.qos.highest_pri_buf_ac",
12258        FT_UINT8, BASE_DEC, VALS(wme_acs), 0x0C,
12259       NULL, HFILL }},
12260
12261     {&hf_ieee80211_qos_qap_buf_load,
12262      {"QAP Buffered Load", "wlan.qos.qap_buf_load",
12263        FT_UINT8, BASE_DEC, NULL, 0xF0,
12264       NULL, HFILL }},
12265
12266     {&hf_ieee80211_qos_txop_dur_req,
12267      {"TXOP Duration Requested", "wlan.qos.txop_dur_req", FT_UINT16, BASE_DEC, NULL, 0,
12268       NULL, HFILL }},
12269
12270     {&hf_ieee80211_qos_queue_size,
12271      {"Queue Size", "wlan.qos.queue_size", FT_UINT16, BASE_DEC, NULL, 0,
12272       NULL, HFILL }},
12273
12274     {&hf_ieee80211_fcs,
12275      {"Frame check sequence", "wlan.fcs", FT_UINT32, BASE_HEX,
12276       NULL, 0, "Frame Check Sequence (FCS)", HFILL }},
12277
12278     {&hf_ieee80211_fcs_good,
12279      {"Good", "wlan.fcs_good", FT_BOOLEAN, BASE_NONE,
12280       NULL, 0x0, "True if the FCS is correct", HFILL }},
12281
12282     {&hf_ieee80211_fcs_bad,
12283      {"Bad", "wlan.fcs_bad", FT_BOOLEAN, BASE_NONE,
12284       NULL, 0x0, "True if the FCS is incorrect", HFILL }},
12285
12286     {&hf_ieee80211_fragment_overlap,
12287       {"Fragment overlap", "wlan.fragment.overlap", FT_BOOLEAN, BASE_NONE,
12288        NULL, 0x0, "Fragment overlaps with other fragments", HFILL }},
12289
12290     {&hf_ieee80211_fragment_overlap_conflict,
12291       {"Conflicting data in fragment overlap", "wlan.fragment.overlap.conflict",
12292        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
12293        "Overlapping fragments contained conflicting data", HFILL }},
12294
12295     {&hf_ieee80211_fragment_multiple_tails,
12296       {"Multiple tail fragments found", "wlan.fragment.multipletails",
12297        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
12298        "Several tails were found when defragmenting the packet", HFILL }},
12299
12300     {&hf_ieee80211_fragment_too_long_fragment,
12301       {"Fragment too long", "wlan.fragment.toolongfragment",
12302        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
12303        "Fragment contained data past end of packet", HFILL }},
12304
12305     {&hf_ieee80211_fragment_error,
12306       {"Defragmentation error", "wlan.fragment.error",
12307        FT_FRAMENUM, BASE_NONE, NULL, 0x0,
12308        "Defragmentation error due to illegal fragments", HFILL }},
12309
12310     {&hf_ieee80211_fragment_count,
12311       {"Fragment count", "wlan.fragment.count", FT_UINT32, BASE_DEC, NULL, 0x0,
12312        NULL, HFILL }},
12313
12314     {&hf_ieee80211_fragment,
12315       {"802.11 Fragment", "wlan.fragment", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
12316        NULL, HFILL }},
12317
12318     {&hf_ieee80211_fragments,
12319       {"802.11 Fragments", "wlan.fragments", FT_NONE, BASE_NONE, NULL, 0x0,
12320        NULL, HFILL }},
12321
12322     {&hf_ieee80211_reassembled_in,
12323       {"Reassembled 802.11 in frame", "wlan.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
12324        "This 802.11 packet is reassembled in this frame", HFILL }},
12325
12326     {&hf_ieee80211_reassembled_length,
12327       {"Reassembled 802.11 length", "wlan.reassembled.length", FT_UINT32, BASE_DEC, NULL, 0x0,
12328        "The total length of the reassembled payload", HFILL }},
12329
12330     {&hf_ieee80211_wep_iv,
12331      {"Initialization Vector", "wlan.wep.iv", FT_UINT24, BASE_HEX, NULL, 0,
12332       NULL, HFILL }},
12333
12334     {&hf_ieee80211_wep_iv_weak,
12335      {"Weak IV", "wlan.wep.weakiv", FT_BOOLEAN,BASE_NONE, NULL,0x0,
12336        NULL,HFILL}},
12337
12338     {&hf_ieee80211_tkip_extiv,
12339      {"TKIP Ext. Initialization Vector", "wlan.tkip.extiv", FT_STRING,
12340       BASE_NONE, NULL, 0, "TKIP Extended Initialization Vector", HFILL }},
12341
12342     {&hf_ieee80211_ccmp_extiv,
12343      {"CCMP Ext. Initialization Vector", "wlan.ccmp.extiv", FT_STRING,
12344       BASE_NONE, NULL, 0, "CCMP Extended Initialization Vector", HFILL }},
12345
12346     {&hf_ieee80211_wep_key,
12347      {"Key Index", "wlan.wep.key", FT_UINT8, BASE_DEC, NULL, 0,
12348       NULL, HFILL }},
12349
12350     {&hf_ieee80211_wep_icv,
12351      {"WEP ICV", "wlan.wep.icv", FT_UINT32, BASE_HEX, NULL, 0,
12352       NULL, HFILL }},
12353
12354     {&hf_ieee80211_chan_noc,
12355      {"Number of Channels", "chan.num_chans", FT_UINT8, BASE_DEC, NULL, 0,
12356       NULL, HFILL }},
12357
12358     {&hf_ieee80211_chan_length,
12359      {"Length", "chan.chan_length", FT_UINT8, BASE_DEC, NULL, 0,
12360       NULL, HFILL }},
12361
12362     {&hf_ieee80211_chan_content,
12363      {"Contents", "chan.chan_content", FT_UINT8, BASE_DEC, NULL, 0,
12364       NULL, HFILL }},
12365
12366     {&hf_ieee80211_chan_channel,
12367      {"channel", "chan.chan_channel", FT_UINT8, BASE_DEC, NULL, 0,
12368       NULL, HFILL }},
12369
12370     {&hf_ieee80211_chan_adapt,
12371      {"Adaptable", "chan.chan_adapt", FT_UINT8, BASE_DEC, NULL, 0,
12372       NULL, HFILL }},
12373
12374     {&hf_ieee80211_chan_rate,
12375      {"Rate", "chan.chan_rate", FT_UINT8, BASE_DEC, NULL, 0,
12376       NULL, HFILL }},
12377
12378     {&hf_ieee80211_chan_tx_pow,
12379      {"Tx Power", "chan.chan_tx_pow", FT_UINT8, BASE_DEC, NULL, 0,
12380       NULL, HFILL }},
12381
12382     {&hf_ieee80211_block_ack_request_control,
12383      {"Block Ack Request (BAR) Control", "wlan.bar.control",
12384       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12385
12386     {&hf_ieee80211_block_ack_control,
12387      {"Block Ack Request Control", "wlan.ba.control",
12388       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12389
12390     {&hf_ieee80211_block_ack_control_ack_policy,
12391      {"BAR Ack Policy", "wlan.ba.control.ackpolicy",
12392       FT_BOOLEAN, 16, TFS (&ieee80211_block_ack_control_ack_policy_flag), 0x01, "Block Ack Request (BAR) Ack Policy", HFILL }},
12393
12394     {&hf_ieee80211_block_ack_control_multi_tid,
12395      {"Multi-TID", "wlan.ba.control.multitid",
12396       FT_BOOLEAN, 16, 0, 0x02, "Multi-Traffic Identifier (TID)", HFILL }},
12397
12398     {&hf_ieee80211_block_ack_control_compressed_bitmap,
12399      {"Compressed Bitmap", "wlan.ba.control.cbitmap",
12400       FT_BOOLEAN, 16, 0, 0x04, NULL, HFILL }},
12401
12402     {&hf_ieee80211_block_ack_control_reserved,
12403      {"Reserved", "wlan.ba.control.cbitmap",
12404       FT_UINT16, BASE_HEX, NULL, 0x0ff8, NULL, HFILL }},
12405
12406     {&hf_ieee80211_block_ack_control_basic_tid_info,
12407      {"TID for which a Basic BlockAck frame is requested", "wlan.ba.basic.tidinfo",
12408       FT_UINT16, BASE_HEX, NULL, 0xf000, "Traffic Identifier (TID) for which a Basic BlockAck frame is requested", HFILL }},
12409
12410     {&hf_ieee80211_block_ack_control_compressed_tid_info,
12411      {"TID for which a BlockAck frame is requested", "wlan.bar.compressed.tidinfo",
12412       FT_UINT16, BASE_HEX, NULL, 0xf000, "Traffic Identifier (TID) for which a BlockAck frame is requested", HFILL }},
12413
12414     {&hf_ieee80211_block_ack_control_multi_tid_info,
12415      {"Number of TIDs Present", "wlan.ba.mtid.tidinfo",
12416       FT_UINT16, BASE_HEX, NULL, 0xf000, "Number of Traffic Identifiers (TIDs) Present", HFILL }},
12417
12418     {&hf_ieee80211_block_ack_multi_tid_info,
12419      {"Traffic Identifier (TID) Info", "wlan.ba.mtid.tid",
12420       FT_UINT8, BASE_DEC, 0, 0, NULL, HFILL }},
12421
12422     {&hf_ieee80211_block_ack_multi_tid_reserved,
12423      {"Reserved", "wlan.bar.mtid.tidinfo.reserved",
12424       FT_UINT16, BASE_HEX, 0, 0x0fff, NULL, HFILL }},
12425
12426     {&hf_ieee80211_block_ack_multi_tid_value,
12427      {"Multi-TID Value", "wlan.bar.mtid.tidinfo.value",
12428       FT_UINT16, BASE_HEX, 0, 0xf000, NULL, HFILL }},
12429
12430     {&hf_ieee80211_block_ack_request_type,
12431      {"Block Ack Request Type", "wlan.bar.type",
12432       FT_UINT8, BASE_HEX, VALS(ieee80211_block_ack_request_type_flags), 0, "Block Ack Request (BAR) Type", HFILL }},
12433
12434     {&hf_ieee80211_block_ack_type,
12435      {"Block Ack Type", "wlan.ba.type",
12436       FT_UINT8, BASE_HEX, VALS(ieee80211_block_ack_type_flags), 0, NULL, HFILL }},
12437
12438     {&hf_ieee80211_block_ack_bitmap,
12439      {"Block Ack Bitmap", "wlan.ba.bm",
12440       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
12441       
12442     {&hf_ieee80211_block_ack_bitmap_missing_frame,
12443      {"Missing frame", "wlan.ba.bm.missing_frame",
12444       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
12445
12446     {&hf_ieee80211_data_encap_payload_type,
12447      {"Payload Type", "wlan.data_encap.payload_type",
12448       FT_UINT8, BASE_DEC, VALS(ieee80211_data_encap_payload_types), 0, NULL,
12449       HFILL }},
12450
12451     {&hf_ieee80211_ff_tdls_action_code,
12452      {"Action code", "wlan_mgt.fixed.action_code",
12453       FT_UINT8, BASE_DEC, VALS(tdls_action_codes), 0,
12454       "Management action code", HFILL }},
12455
12456     {&hf_ieee80211_ff_target_channel,
12457      {"Target Channel", "wlan_mgt.fixed.target_channel",
12458       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12459
12460     {&hf_ieee80211_ff_regulatory_class,
12461      {"Regulatory Class", "wlan_mgt.fixed.regulatory_class",
12462       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12463
12464     {&hf_ieee80211_ff_wnm_action_code,
12465      {"Action code", "wlan_mgt.fixed.action_code",
12466       FT_UINT8, BASE_DEC, VALS(wnm_action_codes), 0,
12467       "Management action code", HFILL }},
12468
12469     {&hf_ieee80211_ff_request_mode_pref_cand,
12470      {"Preferred Candidate List Included",
12471       "wlan_mgt.fixed.request_mode.pref_cand",
12472       FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }},
12473     {&hf_ieee80211_ff_request_mode_abridged,
12474      {"Abridged", "wlan_mgt.fixed.request_mode.abridged",
12475       FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL }},
12476     {&hf_ieee80211_ff_request_mode_disassoc_imminent,
12477      {"Disassociation Imminent",
12478       "wlan_mgt.fixed.request_mode.disassoc_imminent",
12479       FT_UINT8, BASE_DEC, NULL, 0x04, NULL, HFILL }},
12480     {&hf_ieee80211_ff_request_mode_bss_term_included,
12481      {"BSS Termination Included",
12482       "wlan_mgt.fixed.request_mode.bss_term_included",
12483       FT_UINT8, BASE_DEC, NULL, 0x08, NULL, HFILL }},
12484     {&hf_ieee80211_ff_request_mode_ess_disassoc_imminent,
12485      {"ESS Disassociation Imminent",
12486       "wlan_mgt.fixed.request_mode.ess_disassoc_imminent",
12487       FT_UINT8, BASE_DEC, NULL, 0x10, NULL, HFILL }},
12488     {&hf_ieee80211_ff_disassoc_timer,
12489      {"Disassociation Timer", "wlan_mgt.fixed.disassoc_timer",
12490       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
12491     {&hf_ieee80211_ff_validity_interval,
12492      {"Validity Interval", "wlan_mgt.fixed.validity_interval",
12493       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12494     {&hf_ieee80211_ff_url_len,
12495      {"Session Information URL Length",
12496       "wlan_mgt.fixed.session_information.url_length",
12497       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12498     {&hf_ieee80211_ff_url,
12499      {"Session Information URL", "wlan_mgt.fixed.session_information.url",
12500       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
12501   };
12502
12503   static const true_false_string qos_info_field_qack_flags = {
12504     "STAs/APs MIB attribute dot11QAckOptionImplemented is true",
12505     "STAs/APs MIB attribute dot11QAckOptionImplemented is false"
12506   };
12507
12508   static const true_false_string qos_info_field_more_data_ack_flags = {
12509     "STA can process Ack frames with More Data bit and will remain in the awake state.",
12510     "STA cannot process Ack frames with More Data bit in Frame Controll field."
12511   };
12512
12513   static const true_false_string qos_info_field_queue_req_flags = {
12514     "AP can process a nonzero Queue Size subfield in the QoS Control field in QoS data frames",
12515     "AP cannot process Queue Size subfield in QoS data frames."
12516   };
12517
12518   /* 7.3.1.17 Table 19b-Settings of the Max SP Length subfield */
12519   static const value_string qos_info_field_max_sp_lenght_flags[] =
12520   {
12521     { 0x0, "QAP may deliver all buffered MSDUs and MMPDUs." },
12522     { 0x2, "QAP may deliver a maximum of two MSDUs and MMPDUs per SP." },
12523     { 0x1, "QAP may deliver a maximum of four MSDUs and MMPDUs per SP." },
12524     { 0x3, "QAP may deliver a maximum of six MSDUs and MMPDUs per SP." },
12525     { 0, NULL}
12526   };
12527
12528   static const true_false_string rsn_preauth_flags = {
12529     "Transmitter supports pre-authentication",
12530     "Transmitter does not support pre-authentication"
12531   };
12532
12533   static const true_false_string rsn_no_pairwise_flags = {
12534     "Transmitter cannot support WEP default key 0 simultaneously with "
12535     "Pairwise key",
12536     "Transmitter can support WEP default key 0 simultaneously with "
12537     "Pairwise key"
12538   };
12539
12540   static const value_string rsn_cap_replay_counter[] = {
12541     {0x00, "1 replay counter per PTKSA/GTKSA/STAKeySA"},
12542     {0x01, "2 replay counters per PTKSA/GTKSA/STAKeySA"},
12543     {0x02, "4 replay counters per PTKSA/GTKSA/STAKeySA"},
12544     {0x03, "16 replay counters per PTKSA/GTKSA/STAKeySA"},
12545     {0, NULL}
12546   };
12547
12548   static const true_false_string ht_ldpc_coding_flag = {
12549     "Transmitter supports receiving LDPC coded packets",
12550     "Transmitter does not support receiving LDPC coded packets"
12551   };
12552
12553   static const true_false_string ht_chan_width_flag = {
12554     "Transmitter supports 20MHz and 40MHz operation",
12555     "Transmitter only supports 20MHz operation"
12556   };
12557
12558   static const value_string ht_sm_pwsave_flag[] = {
12559     {0x00, "Static SM Power Save mode"},
12560     {0x01, "Dynamic SM Power Save mode"},
12561     {0x02, "Reserved"},
12562     {0x03, "SM Power Save disabled"},
12563     {0x00, NULL}
12564   };
12565
12566   static const true_false_string ht_green_flag = {
12567     "Transmitter is able to receive PPDUs with Green Field (GF) preamble",
12568     "Transmitter is not able to receive PPDUs with Green Field (GF) preamble"
12569   };
12570
12571   static const value_string ht_rx_stbc_flag[] = {
12572     {0x00, "No Rx STBC support"},
12573     {0x01, "Rx support of one spatial stream"},
12574     {0x02, "Rx support of one and two spatial streams"},
12575     {0x03, "Rx support of one, two, and three spatial streams"},
12576     {0x00, NULL}
12577   };
12578
12579   static const true_false_string ht_delayed_block_ack_flag = {
12580     "Transmitter supports HT-Delayed BlockAck",
12581     "Transmitter does not support HT-Delayed BlockAck"
12582   };
12583
12584   static const true_false_string ht_max_amsdu_flag = {
12585     "7935 bytes",
12586     "3839 bytes"
12587   };
12588
12589   static const true_false_string ht_dss_cck_40_flag = {
12590     "Will/Can use DSSS/CCK in 40 MHz",
12591     "Won't/Can't use of DSSS/CCK in 40 MHz"
12592   };
12593
12594   static const true_false_string ht_psmp_flag = {
12595     "Will/Can support PSMP operation",
12596     "Won't/Can't support PSMP operation"
12597   };
12598
12599   static const true_false_string ht_40_mhz_intolerant_flag = {
12600     "Use of 40 MHz transmissions restricted/disallowed",
12601     "Use of 40 MHz transmissions unrestricted/allowed"
12602   };
12603
12604   static const value_string ampduparam_mpdu_start_spacing_flags[] = {
12605     {0x00, "no restriction"},
12606     {0x01, "1/4 [usec]"},
12607     {0x02, "1/2 [usec]"},
12608     {0x03, "1 [usec]"},
12609     {0x04, "2 [usec]"},
12610     {0x05, "4 [usec]"},
12611     {0x06, "8 [usec]"},
12612     {0x07, "16 [usec]"},
12613     {0x00, NULL}
12614   };
12615
12616   static const true_false_string mcsset_tx_mcs_set_defined_flag = {
12617     "Defined",
12618     "Not Defined",
12619   };
12620
12621   static const true_false_string mcsset_tx_rx_mcs_set_not_equal_flag = {
12622     "Not Equal",
12623     "Equal",
12624   };
12625
12626   static const value_string mcsset_tx_max_spatial_streams_flags[] = {
12627     {0x00, "1 spatial stream"},
12628     {0x01, "2 spatial streams"},
12629     {0x02, "3 spatial streams"},
12630     {0x03, "4 spatial streams"},
12631     {0x00, NULL}
12632   };
12633
12634   static const value_string htex_transtime_flags[] = {
12635     {0x00, "No Transition"},
12636     {0x01, "400 usec"},
12637     {0x02, "1.5 msec"},
12638     {0x03, "5 msec"},
12639     {0x00, NULL}
12640   };
12641
12642   static const value_string htex_mcs_flags[] = {
12643     {0x00, "STA does not provide MCS feedback"},
12644     {0x01, "Reserved"},
12645     {0x02, "STA provides only unsolicited MCS feedback"},
12646     {0x03, "STA can provide MCS feedback in response to MRQ as well as unsolicited MCS feedback"},
12647     {0x00, NULL}
12648   };
12649
12650   static const value_string txbf_calib_flag[] = {
12651     {0x00, "incapable"},
12652     {0x01, "Limited involvement, cannot initiate"},
12653     {0x02, "Limited involvement, can initiate"},
12654     {0x03, "Fully capable"},
12655     {0x00, NULL}
12656   };
12657
12658   static const value_string txbf_feedback_flags[] = {
12659     {0x00, "not supported"},
12660     {0x01, "delayed feedback capable"},
12661     {0x02, "immediate feedback capable"},
12662     {0x03, "delayed and immediate feedback capable"},
12663     {0x00, NULL}
12664   };
12665
12666   static const value_string txbf_antenna_flags[] = {
12667     {0x00, "1 TX antenna sounding"},
12668     {0x01, "2 TX antenna sounding"},
12669     {0x02, "3 TX antenna sounding"},
12670     {0x03, "4 TX antenna sounding"},
12671     {0x00, NULL}
12672   };
12673
12674   static const value_string txbf_csi_max_rows_bf_flags[] = {
12675     {0x00, "1 row of CSI"},
12676     {0x01, "2 rows of CSI"},
12677     {0x02, "3 rows of CSI"},
12678     {0x03, "4 rows of CSI"},
12679     {0x00, NULL}
12680   };
12681
12682   static const value_string txbf_chan_est_flags[] = {
12683     {0x00, "1 space time stream"},
12684     {0x01, "2 space time streams"},
12685     {0x02, "3 space time streams"},
12686     {0x03, "4 space time streams"},
12687     {0x00, NULL}
12688   };
12689
12690   static const value_string txbf_min_group_flags[] = {
12691     {0x00, "No grouping supported"},
12692     {0x01, "Groups of 1,2 supported"},
12693     {0x02, "Groups of 1,4 supported"},
12694     {0x03, "Groups of 1,2,4 supported"},
12695     {0x00, NULL}
12696   };
12697
12698   static const value_string hta_ext_chan_offset_flag[] = {
12699     {0x00, "No Extension Channel"},
12700     {0x01, "Extension Channel above control channel"},
12701     {0x02, "Undefined"},
12702     {0x03, "Extension Channel below control channel"},
12703     {0x00, NULL}
12704   };
12705
12706   static const true_false_string hta_rec_tx_width_flag = {
12707     "Any channel width enabled",
12708     "Use 20MHz channel (control)"
12709   };
12710
12711   static const true_false_string hta_rifs_mode_flag = {
12712     "Use of RIFS permitted",
12713     "Use of RIFS prohibited"
12714   };
12715
12716   static const true_false_string hta_controlled_access_flag = {
12717     "Not only PSMP",
12718     "PSMP only"
12719   };
12720
12721   static const value_string hta_service_interval_flag[] = {
12722     {0x00, "5ms"},
12723     {0x01, "10ms"},
12724     {0x02, "15ms"},
12725     {0x03, "20ms"},
12726     {0x04, "25ms"},
12727     {0x05, "30ms"},
12728     {0x06, "35ms"},
12729     {0x07, "40ms"},
12730     {0x00, NULL}
12731   };
12732
12733   static const value_string hta_operating_mode_flag[] = {
12734     {0x00, "Pure HT, no protection"},
12735     {0x01, "There may be non-HT devices (control & ext channel)"},
12736     {0x02, "No non-HT is associated, but at least 1 20MHz is. protect on"},
12737     {0x03, "Mixed: no non-HT is associated, protect on"},
12738     {0x00, NULL}
12739   };
12740
12741   static const true_false_string hta_non_gf_devices_flag = {
12742     "All HT devices associated are GF capable",
12743     "One or More HT devices are not GF capable"
12744   };
12745
12746   static const true_false_string hta_dual_stbc_protection_flag = {
12747     "Dual CTS protections is used",
12748     "Regular use of RTS/CTS"
12749   };
12750
12751   static const true_false_string hta_secondary_beacon_flag = {
12752     "Secondary Beacon",
12753     "Primary Beacon"
12754   };
12755
12756   static const true_false_string hta_lsig_txop_protection_flag = {
12757     "Full Support",
12758     "Not full support"
12759   };
12760
12761   static const true_false_string hta_pco_active_flag = {
12762     "PCO is activated in the BSS",
12763     "PCO is not activated in the BSS"
12764   };
12765
12766   static const true_false_string hta_pco_phase_flag = {
12767     "Switch to 20MHz phase/keep 20MHz",
12768     "Switch to 40MHz phase/keep 40MHz"
12769   };
12770
12771   static const value_string ht_info_secondary_channel_offset_flags[] = {
12772     {0x00, "No secondary channel"},
12773     {0x01, "Secondary channel is above the primary channel"},
12774     {0x02, "Reserved"},
12775     {0x03, "Secondary channel is below the primary channel"},
12776     {0x00, NULL}
12777   };
12778
12779   static const true_false_string ht_info_channel_width_flag = {
12780     "Channel of any width supported",
12781     "20 MHz channel width only"
12782   };
12783
12784   static const true_false_string ht_info_rifs_mode_flag = {
12785     "Permitted",
12786     "Prohibited"
12787   };
12788
12789   static const true_false_string ht_info_psmp_stas_only_flag = {
12790     "Association requests are accepted from only PSMP capable STA",
12791     "Association requests are accepted regardless of PSMP capability"
12792   };
12793
12794   static const value_string ht_info_service_interval_granularity_flags[] = {
12795     {0x00, "5 ms"},
12796     {0x01, "10 ms"},
12797     {0x02, "15 ms"},
12798     {0x03, "20 ms"},
12799     {0x04, "25 ms"},
12800     {0x05, "30 ms"},
12801     {0x06, "35 ms"},
12802     {0x07, "40 ms"},
12803     {0x00, NULL}
12804   };
12805
12806   static const value_string ht_info_operating_mode_flags[] = {
12807     {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"},
12808     {0x01, "HT non-member protection mode"},
12809     {0x02, "Only HT STAs in the BSS, however, there exists at least one 20 MHz STA"},
12810     {0x03, "HT mixed mode"},
12811     {0x00, NULL}
12812   };
12813
12814   static const true_false_string ht_info_non_greenfield_sta_present_flag = {
12815     "One or more associated STAs are not greenfield capable",
12816     "All associated STAs are greenfield capable"
12817   };
12818
12819   static const true_false_string ht_info_transmit_burst_limit_flag = {
12820     "2.4 GHz - 6.16 ms | All other bands - 3.08 ms",
12821     "No limit"
12822   };
12823
12824   static const true_false_string ht_info_obss_non_ht_stas_present_flag = {
12825     "Use of protection for non-HT STAs by overlapping BSSs is needed",
12826     "Use of protection for non-HT STAs by overlapping BSSs is not needed"
12827   };
12828
12829   static const true_false_string ht_info_dual_beacon_flag = {
12830     "AP transmits a secondary beacon",
12831     "No second beacon is transmitted"
12832   };
12833
12834   static const true_false_string ht_info_dual_cts_protection_flag = {
12835     "Required",
12836     "Not required"
12837   };
12838
12839   static const true_false_string ht_info_secondary_beacon_flag = {
12840     "Secondary beacon",
12841     "Primary beacon"
12842   };
12843
12844   static const true_false_string ht_info_lsig_txop_protection_full_support_flag = {
12845     "All HT STAs in the BSS support L-SIG TXOP protection",
12846     "One or more HT STAs in the BSS do not support L-SIG TXOP protection"
12847   };
12848
12849   static const true_false_string ht_info_pco_phase_flag = {
12850     "Switch to or continue 40 MHz phase",
12851     "Switch to or continue 20 MHz phase"
12852   };
12853
12854   static const true_false_string htc_lac_trq_flag = {
12855     "Want sounding PPDU",
12856     "Don't want sounding PPDU"
12857   };
12858
12859   static const true_false_string htc_lac_mai_mrq_flag = {
12860     "MCS feedback requested",
12861     "No MCS feedback requested"
12862   };
12863
12864   static const value_string ieee80211_htc_lac_asel_command_flags[] = {
12865     {0x00, "Transmit Antenna Selection Sounding Indication (TXASSI)"},
12866     {0x01, "Transmit Antenna Selection Sounding Request (TXASSR)"},
12867     {0x02, "Receive Antenna Selection Sounding Indication (RXASSI)"},
12868     {0x03, "Receive Antenna Selection Sounding Request (RXASSR)"},
12869     {0x04, "Sounding Label"},
12870     {0x05, "No feedback, ASEL training failure"},
12871     {0x06, "Transmit Antenna Selection Sounding Indication (TXASSI) requesting feedback of explicit CSI"},
12872     {0x07, "Reserved"},
12873     {0x00, NULL}
12874   };
12875
12876   static const value_string ieee80211_htc_cal_pos_flags[] = {
12877     {0x00, "Not a calibration frame"},
12878     {0x01, "Calibration Start"},
12879     {0x02, "Sounding Response"},
12880     {0x03, "Sounding Complete"},
12881     {0x00, NULL}
12882   };
12883
12884   static const true_false_string ieee80211_htc_ndp_announcement_flag = {
12885     "NDP will follow",
12886     "No NDP will follow"
12887   };
12888
12889   static const value_string ieee80211_htc_csi_steering_flags[] = {
12890     {0x00, "No feedback required"},
12891     {0x01, "CSI"},
12892     {0x02, "Non-compressed Beamforming Feedback Matrix"},
12893     {0x03, "Compressed Beamforming Feedback Matrix"},
12894     {0x00, NULL}
12895   };
12896
12897   static const value_string ieee80211_tag_secondary_channel_offset_flags[] = {
12898     {0x00, "No Secondary Channel"},
12899     {0x01, "Above Primary Channel"},
12900     {0x02, "Reserved"},
12901     {0x03, "Below Primary Channel"},
12902     {0x00, NULL}
12903   };
12904
12905   static const value_string ieee80211_tag_ext_channel_switch_announcement_switch_mode_flags[] = {
12906     {0x00, "Frames may be transmitted before the channel switch has been completed"},
12907     {0x01, "No more frames are to be transmitted until the channel switch has been completed"},
12908     {0x00, NULL}
12909   };
12910
12911   static const value_string service_interval_granularity_vals[] = {
12912     { 0, "5 ms" },
12913     { 1, "10 ms" },
12914     { 2, "15 ms" },
12915     { 3, "20 ms" },
12916     { 4, "25 ms" },
12917     { 5, "30 ms" },
12918     { 6, "35 ms" },
12919     { 7, "40 ms" },
12920     { 0x00, NULL }
12921   };
12922
12923   static const value_string wep_type_vals[] = {
12924     { AIRPDCAP_KEY_TYPE_WEP, STRING_KEY_TYPE_WEP },
12925     { AIRPDCAP_KEY_TYPE_WPA_PWD, STRING_KEY_TYPE_WPA_PWD },
12926     { AIRPDCAP_KEY_TYPE_WPA_PSK, STRING_KEY_TYPE_WPA_PSK },
12927     { 0x00, NULL }
12928   };
12929
12930   static hf_register_info ff[] = {
12931
12932     {&hf_ieee80211_ff_timestamp,
12933      {"Timestamp", "wlan_mgt.fixed.timestamp", FT_UINT64, BASE_HEX,
12934       NULL, 0, NULL, HFILL }},
12935
12936     {&hf_ieee80211_ff_auth_alg,
12937      {"Authentication Algorithm", "wlan_mgt.fixed.auth.alg",
12938       FT_UINT16, BASE_DEC, VALS (&auth_alg), 0, NULL, HFILL }},
12939
12940     {&hf_ieee80211_ff_beacon_interval,
12941      {"Beacon Interval", "wlan_mgt.fixed.beacon", FT_UINT32, BASE_CUSTOM, beacon_interval_base_custom, 0,
12942       NULL, HFILL }},
12943
12944     {&hf_ieee80211_fixed_parameters,
12945      {"Fixed parameters", "wlan_mgt.fixed.all", FT_UINT16, BASE_DEC, NULL, 0,
12946       NULL, HFILL }},
12947
12948     {&hf_ieee80211_tagged_parameters,
12949      {"Tagged parameters", "wlan_mgt.tagged.all", FT_UINT16, BASE_DEC, NULL, 0,
12950       NULL, HFILL }},
12951
12952     {&hf_ieee80211_tag_ssid,
12953      {"SSID", "wlan_mgt.ssid", FT_STRING, BASE_NONE, NULL, 0,
12954       "Indicates the identity of an ESS or IBSS", HFILL }},
12955
12956     {&hf_ieee80211_tag_supp_rates,
12957      {"Supported Rates", "wlan_mgt.supported_rates",
12958       FT_UINT8, BASE_NONE, VALS(ieee80211_supported_rates_vals), 0x0,
12959       "In Mbit/sec, (B) for Basic Rates", HFILL }},
12960
12961     {&hf_ieee80211_tag_fh_dwell_time,
12962      {"Dwell Time", "wlan_mgt.fh.dwell_time",
12963       FT_UINT16, BASE_HEX, NULL, 0x0,
12964       "In Time Unit (TU)", HFILL }},
12965
12966     {&hf_ieee80211_tag_fh_hop_set,
12967      {"Hop Set", "wlan_mgt.fh.hop_set",
12968       FT_UINT8, BASE_DEC, NULL, 0x0,
12969       NULL, HFILL }},
12970
12971     {&hf_ieee80211_tag_fh_hop_pattern,
12972      {"Hop Pattern", "wlan_mgt.fh.hop_pattern",
12973       FT_UINT8, BASE_DEC, NULL, 0x0,
12974       NULL, HFILL }},
12975
12976     {&hf_ieee80211_tag_fh_hop_index,
12977      {"Hop Index", "wlan_mgt.fh.hop_index",
12978       FT_UINT8, BASE_DEC, NULL, 0x0,
12979       NULL, HFILL }},
12980
12981     {&hf_ieee80211_ff_block_ack_params,
12982       {"Block Ack Parameters", "wlan_mgt.fixed.baparams",
12983       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12984
12985     {&hf_ieee80211_ff_block_ack_params_amsdu_permitted,
12986       {"A-MSDUs", "wlan_mgt.fixed.baparams.amsdu",
12987       FT_BOOLEAN, 16, TFS (&ff_block_ack_params_amsdu_permitted_flag), 0x0001, "A-MSDU Permitted in QoS Data MPDUs", HFILL }},
12988
12989     {&hf_ieee80211_ff_block_ack_params_policy,
12990       {"Block Ack Policy", "wlan_mgt.fixed.baparams.policy",
12991       FT_BOOLEAN, 16, TFS (&ff_block_ack_params_policy_flag), 0x0002, NULL, HFILL }},
12992
12993     {&hf_ieee80211_ff_block_ack_params_tid,
12994       {"Traffic Identifier", "wlan_mgt.fixed.baparams.tid",
12995       FT_UINT16, BASE_HEX, NULL, 0x003C, NULL, HFILL }},
12996
12997     {&hf_ieee80211_ff_block_ack_params_buffer_size,
12998       {"Number of Buffers (1 Buffer = 2304 Bytes)", "wlan_mgt.fixed.baparams.buffersize",
12999       FT_UINT16, BASE_DEC, NULL, 0xFFC0, "Number of Buffers", HFILL }},
13000
13001     {&hf_ieee80211_ff_block_ack_timeout,
13002       {"Block Ack Timeout", "wlan_mgt.fixed.batimeout",
13003       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
13004
13005     {&hf_ieee80211_ff_block_ack_ssc,
13006      {"Block Ack Starting Sequence Control (SSC)", "wlan_mgt.fixed.ssc",
13007       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
13008
13009     {&hf_ieee80211_ff_block_ack_ssc_fragment,
13010      {"Fragment", "wlan_mgt.fixed.fragment",
13011       FT_UINT16, BASE_DEC, 0, 0x000f, NULL, HFILL }},
13012
13013     {&hf_ieee80211_ff_block_ack_ssc_sequence,
13014      {"Starting Sequence Number", "wlan_mgt.fixed.sequence",
13015       FT_UINT16, BASE_DEC, 0, 0xfff0, NULL, HFILL }},
13016
13017     {&hf_ieee80211_ff_delba_param,
13018      {"Delete Block Ack (DELBA) Parameter Set", "wlan_mgt.fixed.delba.param",
13019       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
13020
13021     {&hf_ieee80211_ff_delba_param_reserved,
13022      {"Reserved", "wlan_mgt.fixed.delba.param.reserved",
13023       FT_UINT16, BASE_HEX, 0, 0x07ff, NULL, HFILL }},
13024
13025     {&hf_ieee80211_ff_delba_param_init,
13026      {"Initiator", "wlan_mgt.fixed.delba.param.initiator",
13027       FT_BOOLEAN, 16, 0, 0x0800, NULL, HFILL }},
13028
13029     {&hf_ieee80211_ff_delba_param_tid,
13030      {"TID", "wlan_mgt.fixed.delba.param.tid",
13031       FT_UINT16, BASE_HEX, 0, 0xf000, "Traffic Identifier (TID)", HFILL }},
13032
13033     {&hf_ieee80211_ff_max_reg_pwr,
13034      {"Maximum Regulation Power", "wlan_mgt.fixed.maxregpwr",
13035       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
13036
13037     {&hf_ieee80211_ff_measurement_pilot_int,
13038      {"Measurement Pilot Interval", "wlan_mgt.fixed.msmtpilotint",
13039       FT_UINT16, BASE_HEX, 0, 0, "Measurement Pilot Interval Fixed Field", HFILL }},
13040
13041     {&hf_ieee80211_ff_country_str,
13042      {"Country String", "wlan_mgt.fixed.country",
13043       FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
13044
13045     {&hf_ieee80211_ff_max_tx_pwr,
13046      {"Maximum Transmit Power", "wlan_mgt.fixed.maxtxpwr",
13047       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
13048
13049     {&hf_ieee80211_ff_tx_pwr_used,
13050      {"Transmit Power Used", "wlan_mgt.fixed.txpwr",
13051       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
13052
13053     {&hf_ieee80211_ff_transceiver_noise_floor,
13054      {"Transceiver Noise Floor", "wlan_mgt.fixed.tnoisefloor",
13055       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
13056
13057     {&hf_ieee80211_ff_channel_width,
13058      {"Supported Channel Width", "wlan_mgt.fixed.chanwidth",
13059       FT_UINT8, BASE_HEX, VALS (ff_channel_width_vals), 0, NULL, HFILL }},
13060
13061     {&hf_ieee80211_ff_qos_info_ap,
13062      {"QoS Information (AP)", "wlan_mgt.fixed.qosinfo.ap",
13063       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13064
13065     {&hf_ieee80211_ff_qos_info_ap_edca_param_set_counter,
13066      {"EDCA Parameter Set Update Count", "wlan_mgt.fixed.qosinfo.ap.edcaupdate",
13067       FT_UINT8, BASE_HEX, NULL, 0x0F, "Enhanced Distributed Channel Access (EDCA) Parameter Set Update Count", HFILL }},
13068
13069     {&hf_ieee80211_ff_qos_info_ap_q_ack,
13070      {"Q-Ack", "wlan_mgt.fixed.qosinfo.ap.qack",
13071       FT_BOOLEAN, 8, TFS (&ff_qos_info_ap_q_ack_flag), 0x10, "QoS Ack", HFILL }},
13072
13073     {&hf_ieee80211_ff_qos_info_ap_queue_req,
13074      {"Queue Request", "wlan_mgt.fixed.qosinfo.ap",
13075       FT_BOOLEAN, 8, TFS (&ff_qos_info_ap_queue_req_flag), 0x20, NULL, HFILL }},
13076
13077     {&hf_ieee80211_ff_qos_info_ap_txop_request,
13078      {"TXOP Request", "wlan_mgt.fixed.qosinfo.ap.txopreq",
13079       FT_BOOLEAN, 8, TFS (&ff_qos_info_ap_txop_request_flag), 0x40, "Transmit Opportunity (TXOP) Request", HFILL }},
13080
13081     {&hf_ieee80211_ff_qos_info_ap_reserved,
13082      {"Reserved", "wlan_mgt.fixed.qosinfo.ap.reserved",
13083       FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
13084
13085     {&hf_ieee80211_ff_qos_info_sta,
13086      {"QoS Information (STA)", "wlan_mgt.fixed.qosinfo.sta",
13087       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13088
13089     {&hf_ieee80211_ff_qos_info_sta_ac_vo,
13090      {"AC_VO", "wlan_mgt.fixed.qosinfo.sta.ac.vo",
13091       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x01, NULL, HFILL }},
13092
13093     {&hf_ieee80211_ff_qos_info_sta_ac_vi,
13094      {"AC_VI", "wlan_mgt.fixed.qosinfo.sta.ac.vi",
13095       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x02, NULL, HFILL }},
13096
13097     {&hf_ieee80211_ff_qos_info_sta_ac_bk,
13098      {"AC_BK", "wlan_mgt.fixed.qosinfo.sta.ac.bk",
13099       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x04, NULL, HFILL }},
13100
13101     {&hf_ieee80211_ff_qos_info_sta_ac_be,
13102      {"AC_BE", "wlan_mgt.fixed.qosinfo.sta.ac.be",
13103       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x08, NULL, HFILL }},
13104
13105     {&hf_ieee80211_ff_qos_info_sta_q_ack,
13106      {"Q-Ack", "wlan_mgt.fixed.qosinfo.sta.qack",
13107       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_q_ack_flag), 0x10, "QoS Ack", HFILL }},
13108
13109     {&hf_ieee80211_ff_qos_info_sta_max_sp_len,
13110      {"Service Period (SP) Length", "wlan_mgt.fixed.qosinfo.sta.splen",
13111       FT_UINT8, BASE_HEX, VALS (&ff_qos_info_sta_max_sp_len_flags) , 0x60, NULL, HFILL }},
13112
13113     {&hf_ieee80211_ff_qos_info_sta_more_data_ack,
13114      {"More Data Ack", "wlan_mgt.fixed.qosinfo.sta.moredataack",
13115       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_more_data_ack_flag), 0x80, NULL, HFILL }},
13116
13117     {&hf_ieee80211_ff_sm_pwr_save,
13118      {"Spatial Multiplexing (SM) Power Control", "wlan_mgt.fixed.sm.powercontrol",
13119       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13120
13121     {&hf_ieee80211_ff_sm_pwr_save_enabled,
13122      {"SM Power Save", "wlan_mgt.fixed.sm.powercontrol.enabled",
13123       FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x01, "Spatial Multiplexing (SM) Power Save", HFILL }},
13124
13125     {&hf_ieee80211_ff_sm_pwr_save_sm_mode,
13126      {"SM Mode", "wlan_mgt.fixed.sm.powercontrol.mode",
13127       FT_BOOLEAN, 8, TFS (&ff_sm_pwr_save_sm_mode_flag), 0x02, "Spatial Multiplexing (SM) Mode", HFILL }},
13128
13129     {&hf_ieee80211_ff_sm_pwr_save_reserved,
13130      {"Reserved", "wlan_mgt.fixed.sm.powercontrol.reserved",
13131       FT_UINT8, BASE_HEX, NULL, 0xFC, NULL, HFILL }},
13132
13133     {&hf_ieee80211_ff_pco_phase_cntrl,
13134      {"Phased Coexistence Operation (PCO) Phase Control", "wlan_mgt.fixed.pco.phasecntrl",
13135       FT_BOOLEAN, BASE_NONE, TFS (&ff_pco_phase_cntrl_flag), 0x0, NULL, HFILL }},
13136
13137     {&hf_ieee80211_ff_psmp_param_set,
13138      {"Power Save Multi-Poll (PSMP) Parameter Set", "wlan_mgt.fixed.psmp.paramset",
13139       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
13140
13141     {&hf_ieee80211_ff_psmp_param_set_n_sta,
13142      {"Number of STA Info Fields Present", "wlan_mgt.fixed.psmp.paramset.nsta",
13143       FT_UINT16, BASE_HEX, 0, 0x000F, NULL, HFILL }},
13144
13145     {&hf_ieee80211_ff_psmp_param_set_more_psmp,
13146      {"More PSMP", "wlan_mgt.fixed.psmp.paramset.more",
13147       FT_BOOLEAN, 16, TFS(&ff_psmp_param_set_more_psmp_flag), 0x0010, "More Power Save Multi-Poll (PSMP)", HFILL }},
13148
13149     {&hf_ieee80211_ff_psmp_param_set_psmp_sequence_duration,
13150      {"PSMP Sequence Duration [us]", "wlan_mgt.fixed.psmp.paramset.seqduration",
13151       FT_UINT16, BASE_DEC, 0, 0xFFE0, "Power Save Multi-Poll (PSMP) Sequence Duration", HFILL }},
13152
13153     {&hf_ieee80211_ff_mimo_cntrl,
13154      {"MIMO Control", "wlan_mgt.fixed.mimo.control.",
13155       FT_BYTES, BASE_NONE, 0, 0x0, NULL, HFILL }},
13156
13157     {&hf_ieee80211_ff_mimo_cntrl_nc_index,
13158      {"Nc Index", "wlan_mgt.fixed.mimo.control.ncindex",
13159       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_nc_index_flags), 0x0003, "Number of Columns Less One", HFILL }},
13160
13161     {&hf_ieee80211_ff_mimo_cntrl_nr_index,
13162      {"Nr Index", "wlan_mgt.fixed.mimo.control.nrindex",
13163       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_nr_index_flags), 0x000C, "Number of Rows Less One", HFILL }},
13164
13165     {&hf_ieee80211_ff_mimo_cntrl_channel_width,
13166      {"Channel Width", "wlan_mgt.fixed.mimo.control.chanwidth",
13167       FT_BOOLEAN, 16, TFS(&ff_mimo_cntrl_channel_width_flag), 0x0010, NULL, HFILL }},
13168
13169     {&hf_ieee80211_ff_mimo_cntrl_grouping,
13170      {"Grouping (Ng)", "wlan_mgt.fixed.mimo.control.grouping",
13171       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_grouping_flags), 0x0060, NULL, HFILL }},
13172
13173     {&hf_ieee80211_ff_mimo_cntrl_coefficient_size,
13174      {"Coefficient Size (Nb)", "wlan_mgt.fixed.mimo.control.cosize",
13175       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_coefficient_size_flags), 0x0180, NULL, HFILL }},
13176
13177     {&hf_ieee80211_ff_mimo_cntrl_codebook_info,
13178      {"Codebook Information", "wlan_mgt.fixed.mimo.control.codebookinfo",
13179       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_codebook_info_flags), 0x0600, NULL, HFILL }},
13180
13181     {&hf_ieee80211_ff_mimo_cntrl_remaining_matrix_segment,
13182      {"Remaining Matrix Segment", "wlan_mgt.fixed.mimo.control.matrixseg",
13183       FT_UINT16, BASE_HEX, 0, 0x3800, NULL, HFILL }},
13184
13185     {&hf_ieee80211_ff_mimo_cntrl_reserved,
13186      {"Reserved", "wlan_mgt.fixed.mimo.control.reserved",
13187       FT_UINT16, BASE_HEX, 0, 0xC000, NULL, HFILL }},
13188
13189     {&hf_ieee80211_ff_mimo_cntrl_sounding_timestamp,
13190      {"Sounding Timestamp", "wlan_mgt.fixed.mimo.control.soundingtime",
13191       FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
13192
13193     {&hf_ieee80211_ff_psmp_sta_info,
13194      {"Power Save Multi-Poll (PSMP) Station Information", "wlan_mgt.fixed.psmp.stainfo",
13195       FT_UINT64, BASE_HEX, 0, 0, NULL, HFILL }},
13196
13197     {&hf_ieee80211_ff_psmp_sta_info_type,
13198      {"Sta Info Type", "wlan_mgt.fixed.psmp.stainfo.type",
13199       FT_UINT32, BASE_HEX, VALS(ff_psmp_sta_info_flags), PSMP_STA_INFO_FLAG_TYPE, NULL, HFILL }},
13200
13201     {&hf_ieee80211_ff_psmp_sta_info_dtt_start_offset,
13202      {"DTT Start Offset", "wlan_mgt.fixed.psmp.stainfo.dttstart",
13203       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_DTT_START, NULL, HFILL }},
13204
13205     {&hf_ieee80211_ff_psmp_sta_info_dtt_duration,
13206      {"DTT Duration", "wlan_mgt.fixed.psmp.stainfo.dttduration",
13207       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_DTT_DURATION, NULL, HFILL }},
13208
13209     {&hf_ieee80211_ff_psmp_sta_info_sta_id,
13210      {"Target Station ID", "wlan_mgt.fixed.psmp.stainfo.staid",
13211       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_STA_ID, NULL, HFILL }},
13212
13213     {&hf_ieee80211_ff_psmp_sta_info_utt_start_offset,
13214      {"UTT Start Offset", "wlan_mgt.fixed.psmp.stainfo.uttstart",
13215       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_UTT_START, NULL, HFILL }},
13216
13217     {&hf_ieee80211_ff_psmp_sta_info_utt_duration,
13218      {"UTT Duration", "wlan_mgt.fixed.psmp.stainfo.uttduration",
13219       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_UTT_DURATION, NULL, HFILL }},
13220
13221     {&hf_ieee80211_ff_psmp_sta_info_reserved_small,
13222      {"Reserved", "wlan_mgt.fixed.psmp.stainfo.reserved",
13223       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_IA_RESERVED, NULL, HFILL }},
13224
13225     {&hf_ieee80211_ff_psmp_sta_info_reserved_large,
13226      {"Reserved", "wlan_mgt.fixed.psmp.stainfo.reserved",
13227       FT_UINT64, BASE_HEX, 0, 0, NULL, HFILL }},
13228
13229     {&hf_ieee80211_ff_psmp_sta_info_psmp_multicast_id,
13230      {"Power Save Multi-Poll (PSMP) Multicast ID", "wlan_mgt.fixed.psmp.stainfo.multicastid",
13231       FT_UINT64, BASE_HEX, 0, 0, NULL, HFILL }},
13232
13233     {&hf_ieee80211_ff_ant_selection,
13234      {"Antenna Selection", "wlan_mgt.fixed.antsel",
13235       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
13236
13237     {&hf_ieee80211_ff_ant_selection_0,
13238      {"Antenna 0", "wlan_mgt.fixed.antsel.ant0",
13239       FT_UINT8, BASE_HEX, 0, 0x01, NULL, HFILL }},
13240
13241     {&hf_ieee80211_ff_ant_selection_1,
13242      {"Antenna 1", "wlan_mgt.fixed.antsel.ant1",
13243       FT_UINT8, BASE_HEX, 0, 0x02, NULL, HFILL }},
13244
13245     {&hf_ieee80211_ff_ant_selection_2,
13246      {"Antenna 2", "wlan_mgt.fixed.antsel.ant2",
13247       FT_UINT8, BASE_HEX, 0, 0x04, NULL, HFILL }},
13248
13249     {&hf_ieee80211_ff_ant_selection_3,
13250      {"Antenna 3", "wlan_mgt.fixed.antsel.ant3",
13251       FT_UINT8, BASE_HEX, 0, 0x08, NULL, HFILL }},
13252
13253     {&hf_ieee80211_ff_ant_selection_4,
13254      {"Antenna 4", "wlan_mgt.fixed.antsel.ant4",
13255       FT_UINT8, BASE_HEX, 0, 0x10, NULL, HFILL }},
13256
13257     {&hf_ieee80211_ff_ant_selection_5,
13258      {"Antenna 5", "wlan_mgt.fixed.antsel.ant5",
13259       FT_UINT8, BASE_HEX, 0, 0x20, NULL, HFILL }},
13260
13261     {&hf_ieee80211_ff_ant_selection_6,
13262      {"Antenna 6", "wlan_mgt.fixed.antsel.ant6",
13263       FT_UINT8, BASE_HEX, 0, 0x40, NULL, HFILL }},
13264
13265     {&hf_ieee80211_ff_ant_selection_7,
13266      {"Antenna 7", "wlan_mgt.fixed.antsel.ant7",
13267       FT_UINT8, BASE_HEX, 0, 0x80, NULL, HFILL }},
13268
13269     {&hf_ieee80211_ff_ext_channel_switch_announcement,
13270      {"Extended Channel Switch Announcement", "wlan_mgt.fixed.extchansw",
13271       FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
13272
13273     {&hf_ieee80211_ff_ext_channel_switch_announcement_switch_mode,
13274      {"Channel Switch Mode", "wlan_mgt.fixed.extchansw.switchmode",
13275       FT_UINT32, BASE_HEX, VALS(ieee80211_tag_ext_channel_switch_announcement_switch_mode_flags), 0x000000FF, NULL, HFILL }},
13276
13277     {&hf_ieee80211_ff_ext_channel_switch_announcement_new_reg_class,
13278      {"New Regulatory Class", "wlan_mgt.fixed.extchansw.new.regclass",
13279       FT_UINT32, BASE_HEX, NULL, 0x0000FF00, NULL, HFILL }},
13280
13281     {&hf_ieee80211_ff_ext_channel_switch_announcement_new_chan_number,
13282      {"New Channel Number", "wlan_mgt.fixed.extchansw.new.channumber",
13283       FT_UINT32, BASE_HEX, NULL, 0x00FF0000, NULL, HFILL }},
13284
13285     {&hf_ieee80211_ff_ext_channel_switch_announcement_switch_count,
13286      {"Channel Switch Count", "wlan_mgt.extchanswitch.switchcount",
13287       FT_UINT32, BASE_HEX, NULL, 0xFF000000, NULL, HFILL }},
13288
13289     {&hf_ieee80211_ff_ht_info,
13290      {"HT Information", "wlan_mgt.fixed.extchansw",
13291       FT_UINT8, BASE_HEX, 0, 0, "HT Information Fixed Field", HFILL }},
13292
13293     {&hf_ieee80211_ff_ht_info_information_request,
13294      {"Information Request", "wlan_mgt.fixed.mimo.control.chanwidth",
13295       FT_BOOLEAN, 8, TFS(&ff_ht_info_information_request_flag), 0x01, NULL, HFILL }},
13296
13297     {&hf_ieee80211_ff_ht_info_40_mhz_intolerant,
13298      {"40 MHz Intolerant", "wlan_mgt.fixed.mimo.control.chanwidth",
13299       FT_BOOLEAN, 8, TFS(&ff_ht_info_40_mhz_intolerant_flag), 0x02, NULL, HFILL }},
13300
13301     {&hf_ieee80211_ff_ht_info_sta_chan_width,
13302      {"Station Channel Width", "wlan_mgt.fixed.mimo.control.chanwidth",
13303       FT_BOOLEAN, 8, TFS(&ff_ht_info_sta_chan_width_flag), 0x04, NULL, HFILL }},
13304
13305     {&hf_ieee80211_ff_ht_info_reserved,
13306      {"Reserved", "wlan_mgt.fixed.extchansw",
13307       FT_UINT8, BASE_HEX, 0, 0xF8, "Reserved Field", HFILL }},
13308
13309     {&hf_ieee80211_ff_ht_action,
13310      {"HT Action", "wlan_mgt.fixed.htact",
13311       FT_UINT8, BASE_HEX, VALS (&ff_ht_action_flags), 0, "HT Action Code", HFILL }},
13312
13313     {&hf_ieee80211_ff_mimo_csi_snr,
13314      {"Signal to Noise Ratio (SNR)", "wlan_mgt.mimo.csimatrices.snr",
13315       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13316
13317     {&hf_ieee80211_ff_public_action,
13318      {"Public Action", "wlan_mgt.fixed.publicact",
13319       FT_UINT8, BASE_HEX, VALS(ff_pa_action_codes), 0, "Public Action Code", HFILL }},
13320
13321     {&hf_ieee80211_ff_capture,
13322      {"Capabilities Information", "wlan_mgt.fixed.capabilities", FT_UINT16, BASE_HEX, NULL, 0,
13323       "Capability information", HFILL }},
13324
13325     {&hf_ieee80211_ff_cf_ess,
13326      {"ESS capabilities", "wlan_mgt.fixed.capabilities.ess",
13327       FT_BOOLEAN, 16, TFS (&cf_ess_flags), 0x0001, NULL, HFILL }},
13328
13329     {&hf_ieee80211_ff_cf_ibss,
13330      {"IBSS status", "wlan_mgt.fixed.capabilities.ibss",
13331       FT_BOOLEAN, 16, TFS (&cf_ibss_flags), 0x0002, "IBSS participation", HFILL }},
13332
13333     {&hf_ieee80211_ff_cf_sta_poll,
13334      {"CFP participation capabilities", "wlan_mgt.fixed.capabilities.cfpoll.sta",
13335       FT_UINT16, BASE_HEX, VALS (&sta_cf_pollable), 0x020C,
13336       "CF-Poll capabilities for a STA", HFILL }},
13337
13338     {&hf_ieee80211_ff_cf_ap_poll,
13339      {"CFP participation capabilities", "wlan_mgt.fixed.capabilities.cfpoll.ap",
13340       FT_UINT16, BASE_HEX, VALS (&ap_cf_pollable), 0x020C,
13341       "CF-Poll capabilities for an AP", HFILL }},
13342
13343     {&hf_ieee80211_ff_cf_privacy,
13344      {"Privacy", "wlan_mgt.fixed.capabilities.privacy",
13345       FT_BOOLEAN, 16, TFS (&cf_privacy_flags), 0x0010, "WEP support", HFILL }},
13346
13347     {&hf_ieee80211_ff_cf_preamble,
13348      {"Short Preamble", "wlan_mgt.fixed.capabilities.preamble",
13349       FT_BOOLEAN, 16, TFS (&cf_preamble_flags), 0x0020, NULL, HFILL }},
13350
13351     {&hf_ieee80211_ff_cf_pbcc,
13352      {"PBCC", "wlan_mgt.fixed.capabilities.pbcc",
13353       FT_BOOLEAN, 16, TFS (&cf_pbcc_flags), 0x0040, "PBCC Modulation", HFILL }},
13354
13355     {&hf_ieee80211_ff_cf_agility,
13356      {"Channel Agility", "wlan_mgt.fixed.capabilities.agility",
13357       FT_BOOLEAN, 16, TFS (&cf_agility_flags), 0x0080, NULL, HFILL }},
13358
13359     {&hf_ieee80211_ff_cf_spec_man,
13360      {"Spectrum Management", "wlan_mgt.fixed.capabilities.spec_man",
13361       FT_BOOLEAN, 16, TFS (&cf_spec_man_flags), 0x0100, NULL, HFILL }},
13362
13363     {&hf_ieee80211_ff_short_slot_time,
13364      {"Short Slot Time", "wlan_mgt.fixed.capabilities.short_slot_time",
13365       FT_BOOLEAN, 16, TFS (&short_slot_time_flags), 0x0400, NULL,
13366       HFILL }},
13367
13368     {&hf_ieee80211_ff_cf_apsd,
13369      {"Automatic Power Save Delivery", "wlan_mgt.fixed.capabilities.apsd",
13370       FT_BOOLEAN, 16, TFS (&cf_apsd_flags), 0x0800, NULL, HFILL }},
13371
13372     {&hf_ieee80211_ff_dsss_ofdm,
13373      {"DSSS-OFDM", "wlan_mgt.fixed.capabilities.dsss_ofdm",
13374       FT_BOOLEAN, 16, TFS (&dsss_ofdm_flags), 0x2000, "DSSS-OFDM Modulation",
13375       HFILL }},
13376
13377     {&hf_ieee80211_ff_cf_del_blk_ack,
13378      {"Delayed Block Ack", "wlan_mgt.fixed.capabilities.del_blk_ack",
13379       FT_BOOLEAN, 16, TFS (&cf_del_blk_ack_flags), 0x4000, NULL, HFILL }},
13380
13381     {&hf_ieee80211_ff_cf_imm_blk_ack,
13382      {"Immediate Block Ack", "wlan_mgt.fixed.capabilities.imm_blk_ack",
13383       FT_BOOLEAN, 16, TFS (&cf_imm_blk_ack_flags), 0x8000, NULL, HFILL }},
13384
13385     {&hf_ieee80211_ff_auth_seq,
13386      {"Authentication SEQ", "wlan_mgt.fixed.auth_seq",
13387       FT_UINT16, BASE_HEX, NULL, 0, "Authentication Sequence Number", HFILL }},
13388
13389     {&hf_ieee80211_ff_assoc_id,
13390      {"Association ID", "wlan_mgt.fixed.aid",
13391       FT_UINT16, BASE_HEX, NULL, 0x3FFF, NULL, HFILL }},
13392
13393     {&hf_ieee80211_ff_listen_ival,
13394      {"Listen Interval", "wlan_mgt.fixed.listen_ival",
13395       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
13396
13397     {&hf_ieee80211_ff_current_ap,
13398      {"Current AP", "wlan_mgt.fixed.current_ap",
13399       FT_ETHER, BASE_NONE, NULL, 0, "MAC address of current AP", HFILL }},
13400
13401     {&hf_ieee80211_ff_reason,
13402      {"Reason code", "wlan_mgt.fixed.reason_code",
13403       FT_UINT16, BASE_HEX, VALS (&ieee80211_reason_code), 0,
13404       "Reason for unsolicited notification", HFILL }},
13405
13406     {&hf_ieee80211_ff_status_code,
13407      {"Status code", "wlan_mgt.fixed.status_code",
13408       FT_UINT16, BASE_HEX, VALS (&ieee80211_status_code), 0,
13409       "Status of requested event", HFILL }},
13410
13411     {&hf_ieee80211_ff_category_code,
13412      {"Category code", "wlan_mgt.fixed.category_code",
13413       FT_UINT16, BASE_DEC, VALS (&category_codes), 0,
13414       "Management action category", HFILL }},
13415
13416     {&hf_ieee80211_ff_action_code,
13417      {"Action code", "wlan_mgt.fixed.action_code",
13418       FT_UINT16, BASE_DEC, VALS (&action_codes), 0,
13419       "Management action code", HFILL }},
13420
13421     {&hf_ieee80211_ff_dialog_token,
13422      {"Dialog token", "wlan_mgt.fixed.dialog_token",
13423       FT_UINT8, BASE_HEX, NULL, 0, "Management action dialog token", HFILL }},
13424
13425     {&hf_ieee80211_ff_marvell_action_type,
13426      {"Marvell Action type", "wlan_mgt.fixed.mrvl_action_type",
13427       FT_UINT8, BASE_DEC, VALS (&vendor_action_types_mrvl), 0,
13428       "Vendor Specific Action Type (Marvell)", HFILL }},
13429
13430     {&hf_ieee80211_ff_marvell_mesh_mgt_action_code,
13431      {"Mesh action(Marvell)", "wlan_mgt.fixed.mrvl_mesh_action",
13432       FT_UINT8, BASE_HEX, VALS (&mesh_mgt_action_codes_mrvl), 0,
13433       "Mesh action code(Marvell)", HFILL }},
13434
13435     {&hf_ieee80211_ff_marvell_mesh_mgt_length,
13436      {"Message Length", "wlan_mgt.fixed.length",
13437       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13438
13439     {&hf_ieee80211_ff_marvell_mesh_mgt_mode,
13440      {"Message Mode", "wlan_mgt.fixed.mode",
13441       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13442
13443     {&hf_ieee80211_ff_marvell_mesh_mgt_ttl,
13444      {"Message TTL", "wlan_mgt.fixed.ttl",
13445       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13446
13447     {&hf_ieee80211_ff_marvell_mesh_mgt_dstcount,
13448      {"Destination Count", "wlan_mgt.fixed.dstcount",
13449       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13450
13451     {&hf_ieee80211_ff_marvell_mesh_mgt_hopcount,
13452      {"Hop Count", "wlan_mgt.fixed.hopcount",
13453       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13454
13455     {&hf_ieee80211_ff_marvell_mesh_mgt_rreqid,
13456      {"RREQ ID", "wlan_mgt.fixed.rreqid",
13457       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
13458
13459     {&hf_ieee80211_ff_marvell_mesh_mgt_sa,
13460      {"Source Address", "wlan_mgt.fixed.sa",
13461       FT_ETHER, BASE_NONE, NULL, 0, "Source MAC address", HFILL }},
13462
13463     {&hf_ieee80211_ff_marvell_mesh_mgt_ssn,
13464      {"SSN", "wlan_mgt.fixed.ssn",
13465       FT_UINT32, BASE_DEC, NULL, 0, "Source Sequence Number", HFILL }},
13466
13467     {&hf_ieee80211_ff_marvell_mesh_mgt_metric,
13468      {"Metric", "wlan_mgt.fixed.metric",
13469       FT_UINT32, BASE_DEC, NULL, 0, "Route Metric", HFILL }},
13470
13471     {&hf_ieee80211_ff_marvell_mesh_mgt_flags,
13472      {"RREQ Flags", "wlan_mgt.fixed.hopcount",
13473       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13474
13475     {&hf_ieee80211_ff_marvell_mesh_mgt_da,
13476      {"Destination Address", "wlan_mgt.fixed.da",
13477       FT_ETHER, BASE_NONE, NULL, 0, "Destination MAC address", HFILL }},
13478
13479     {&hf_ieee80211_ff_marvell_mesh_mgt_dsn,
13480      {"DSN", "wlan_mgt.fixed.dsn",
13481       FT_UINT32, BASE_DEC, NULL, 0, "Destination Sequence Number", HFILL }},
13482
13483     {&hf_ieee80211_ff_marvell_mesh_mgt_lifetime,
13484      {"Lifetime", "wlan_mgt.fixed.lifetime",
13485       FT_UINT32, BASE_DEC, NULL, 0, "Route Lifetime", HFILL }},
13486
13487     {&hf_ieee80211_ff_wme_action_code,
13488      {"Action code", "wlan_mgt.fixed.action_code",
13489       FT_UINT16, BASE_HEX, VALS (&wme_action_codes), 0,
13490       "Management notification action code", HFILL }},
13491
13492     {&hf_ieee80211_ff_wme_status_code,
13493      {"Status code", "wlan_mgt.fixed.status_code",
13494       FT_UINT16, BASE_HEX, VALS (&wme_status_codes), 0,
13495       "Management notification setup response status code", HFILL }},
13496
13497     {&hf_ieee80211_ff_mesh_action,
13498      {"Mesh Action code", "wlan_mgt.fixed.mesh_action",
13499       FT_UINT8, BASE_HEX, VALS (&mesh_action), 0,
13500       NULL, HFILL }},
13501
13502     {&hf_ieee80211_ff_multihop_action,
13503      {"Multihop Action code", "wlan_mgt.fixed.multihop_action",
13504       FT_UINT8, BASE_HEX, VALS (&multihop_action), 0,
13505       NULL, HFILL }},
13506
13507     {&hf_ieee80211_ff_mesh_flags,
13508      {"Mesh Flags", "wlan_mgt.fixed.mesh_flags",
13509       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13510
13511     {&hf_ieee80211_ff_mesh_ttl,
13512      {"Mesh TTL", "wlan_mgt.fixed.mesh_ttl",
13513       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13514
13515     {&hf_ieee80211_ff_mesh_sequence,
13516      {"Sequence Number", "wlan_mgt.fixed.mesh_sequence",
13517       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
13518
13519     {&hf_ieee80211_ff_mesh_addr4,
13520      {"Mesh Extended Address 4", "wlan_mgt.fixed.mesh_addr4",
13521       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13522
13523     {&hf_ieee80211_ff_mesh_addr5,
13524      {"Mesh Extended Address 5", "wlan_mgt.fixed.mesh_addr5",
13525       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13526
13527     {&hf_ieee80211_ff_mesh_addr6,
13528      {"Mesh Extended Address 6", "wlan_mgt.fixed.mesh_addr6",
13529       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13530
13531     {&hf_ieee80211_ff_selfprot_action,
13532      {"Self-protected Action code", "wlan_mgt.fixed.selfprot_action",
13533       FT_UINT8, BASE_HEX, VALS (&selfprot_action), 0,
13534       NULL, HFILL }},
13535
13536     {&hf_ieee80211_mesh_peering_proto,
13537      {"Mesh Peering Protocol ID", "wlan.peering.proto",
13538       FT_UINT16, BASE_HEX, VALS (&mesh_peering_proto_ids), 0,
13539       NULL, HFILL }},
13540
13541     {&hf_ieee80211_mesh_peering_local_link_id,
13542      {"Local Link ID", "wlan.peering.local_id",
13543       FT_UINT16, BASE_HEX, NULL, 0,
13544       "Mesh Peering Management Local Link ID", HFILL }},
13545
13546     {&hf_ieee80211_mesh_peering_peer_link_id,
13547      {"Peer Link ID", "wlan.peering.peer_id",
13548       FT_UINT16, BASE_HEX, NULL, 0,
13549       "Mesh Peering Management Peer Link ID", HFILL }},
13550
13551     {&hf_ieee80211_ff_hwmp_flags,
13552      {"HWMP Flags", "wlan.hwmp.flags", FT_UINT8, BASE_HEX, NULL, 0,
13553       NULL, HFILL }},
13554
13555     {&hf_ieee80211_ff_hwmp_hopcount,
13556      {"HWMP Hop Count", "wlan.hwmp.hopcount", FT_UINT8, BASE_DEC, NULL, 0,
13557       NULL, HFILL }},
13558
13559     {&hf_ieee80211_ff_hwmp_ttl,
13560      {"HWMP TTL", "wlan.hwmp.ttl", FT_UINT8, BASE_DEC, NULL, 0,
13561       NULL, HFILL }},
13562
13563     {&hf_ieee80211_ff_hwmp_pdid,
13564      {"HWMP Path Discovery ID", "wlan.hwmp.pdid", FT_UINT32, BASE_DEC, NULL, 0,
13565       NULL, HFILL }},
13566
13567     {&hf_ieee80211_ff_hwmp_orig_sta,
13568      {"Originator STA Address", "wlan.hwmp.orig_sta", FT_ETHER, BASE_NONE, NULL, 0,
13569       NULL, HFILL }},
13570
13571     {&hf_ieee80211_ff_hwmp_orig_sn,
13572      {"HWMP Originator Sequence Number", "wlan.hwmp.orig_sn", FT_UINT32, BASE_DEC, NULL, 0,
13573       NULL, HFILL}},
13574
13575     {&hf_ieee80211_ff_hwmp_orig_ext,
13576      {"Originator External Address", "wlan.hwmp.orig_ext", FT_ETHER, BASE_NONE, NULL, 0,
13577       NULL, HFILL }},
13578
13579     {&hf_ieee80211_ff_hwmp_lifetime,
13580      {"HWMP Lifetime", "wlan.hwmp.lifetime", FT_UINT32, BASE_DEC, NULL, 0,
13581       NULL, HFILL }},
13582
13583     {&hf_ieee80211_ff_hwmp_metric,
13584      {"HWMP Metric", "wlan.hwmp.metric", FT_UINT32, BASE_DEC, NULL, 0,
13585       NULL, HFILL }},
13586
13587     {&hf_ieee80211_ff_hwmp_targ_count,
13588      {"HWMP Target Count", "wlan.hwmp.targ_count", FT_UINT8, BASE_DEC, NULL, 0,
13589       NULL, HFILL }},
13590
13591     {&hf_ieee80211_ff_hwmp_targ_flags,
13592      {"HWMP Per-Target Flags", "wlan.hwmp.targ_flags", FT_UINT8, BASE_HEX, NULL, 0,
13593       NULL, HFILL }},
13594
13595     {&hf_ieee80211_ff_hwmp_targ_to_flags,
13596      {"TO Flag", "wlan.hwmp.to_flag",
13597       FT_BOOLEAN, 8, TFS (&hwmp_targ_to_flags), 0x01,
13598       "Target Only Flag", HFILL }},
13599
13600     {&hf_ieee80211_ff_hwmp_targ_usn_flags,
13601      {"USN Flag", "wlan.hwmp.usn_flag",
13602       FT_BOOLEAN, 8, TFS (&hwmp_targ_usn_flags), 0x04,
13603       "Unknown Target HWMP Sequence Number Flag", HFILL }},
13604
13605     {&hf_ieee80211_ff_hwmp_targ_sta,
13606      {"Target STA Address", "wlan.hwmp.targ_sta", FT_ETHER, BASE_NONE, NULL, 0,
13607       NULL, HFILL }},
13608
13609     {&hf_ieee80211_ff_hwmp_targ_ext,
13610      {"Target External Address", "wlan.hwmp.targ_ext", FT_ETHER, BASE_NONE, NULL, 0,
13611       NULL, HFILL }},
13612
13613     {&hf_ieee80211_ff_hwmp_targ_sn,
13614      {"Target HWMP Sequence Number", "wlan.hwmp.targ_sn",
13615       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
13616
13617     {&hf_ieee80211_mesh_config_path_sel_protocol,
13618      {"Path Selection Protocol", "wlan.mesh.config.ps_protocol",
13619       FT_UINT8, BASE_HEX, NULL, 0,
13620       "Mesh Configuration Path Selection Protocol", HFILL }},
13621
13622     {&hf_ieee80211_mesh_config_path_sel_metric,
13623      {"Path Selection Metric", "wlan.mesh.config.ps_metric",
13624       FT_UINT8, BASE_HEX, NULL, 0,
13625       "Mesh Configuration Path Selection Metric", HFILL }},
13626
13627     {&hf_ieee80211_mesh_config_congestion_control,
13628      {"Congestion Control", "wlan.mesh.config.cong_ctl",
13629       FT_UINT8, BASE_HEX, NULL, 0,
13630       "Mesh Configuration Congestion Control", HFILL }},
13631
13632     {&hf_ieee80211_mesh_config_sync_method,
13633      {"Synchronization Method", "wlan.mesh.config.sync_method",
13634       FT_UINT8, BASE_HEX, NULL, 0,
13635       "Mesh Configuration Synchronization Method", HFILL }},
13636
13637     {&hf_ieee80211_mesh_config_auth_protocol,
13638      {"Authentication Protocol", "wlan.mesh.config.auth_protocol",
13639       FT_UINT8, BASE_HEX, NULL, 0,
13640       "Mesh Configuration Authentication Protocol", HFILL }},
13641
13642     {&hf_ieee80211_mesh_config_formation_info,
13643      {"Formation Info", "wlan.mesh.config.formation_info",
13644       FT_UINT8, BASE_HEX, NULL, 0,
13645       "Mesh Configuration Formation Info", HFILL }},
13646
13647     {&hf_ieee80211_mesh_config_capability,
13648      {"Capability", "wlan.mesh.config.cap",
13649       FT_UINT8, BASE_HEX, NULL, 0,
13650       "Mesh Configuration Capability", HFILL }},
13651
13652     {&hf_ieee80211_mesh_id,
13653      {"Mesh ID", "wlan.mesh.id",
13654       FT_STRING, BASE_NONE, NULL, 0,
13655       NULL, HFILL }},
13656
13657     {&hf_ieee80211_rann_flags,
13658      {"RANN Flags", "wlan.rann.flags",
13659       FT_UINT8, BASE_HEX, NULL, 0,
13660       "Root Announcement Flags", HFILL }},
13661
13662     {&hf_ieee80211_rann_root_sta,
13663      {"Root STA Address", "wlan.rann.root_sta", FT_ETHER, BASE_NONE, NULL, 0,
13664       "Root Mesh STA Address", HFILL }},
13665
13666     {&hf_ieee80211_rann_sn,
13667      {"Root STA Sequence Number", "wlan.rann.rann_sn",
13668       FT_UINT32, BASE_DEC, NULL, 0, "Root Mesh STA Sequence Number", HFILL }},
13669
13670     {&hf_ieee80211_rann_interval,
13671      {"RANN Interval", "wlan.rann.interval", FT_UINT32, BASE_DEC, NULL, 0,
13672       "Root Announcement Interval", HFILL }},
13673
13674     {&hf_ieee80211_ff_qos_action_code,
13675      {"Action code", "wlan_mgt.fixed.action_code",
13676       FT_UINT16, BASE_HEX, VALS (&qos_action_codes), 0,
13677       "QoS management action code", HFILL }},
13678
13679     {&hf_ieee80211_ff_ba_action,
13680      {"Action code", "wlan_mgt.fixed.action_code",
13681       FT_UINT8, BASE_HEX, VALS (&ba_action_codes), 0,
13682       "Block Ack action code", HFILL }},
13683
13684     {&hf_ieee80211_ff_dls_action_code,
13685      {"Action code", "wlan_mgt.fixed.action_code",
13686       FT_UINT16, BASE_HEX, VALS (&dls_action_codes), 0,
13687       "DLS management action code", HFILL }},
13688
13689     {&hf_ieee80211_ff_dst_mac_addr,
13690      {"Destination address", "wlan_mgt.fixed.dst_mac_addr",
13691       FT_ETHER, BASE_NONE, NULL, 0, "Destination MAC address", HFILL }},
13692
13693     {&hf_ieee80211_ff_src_mac_addr,
13694      {"Source address", "wlan_mgt.fixed.src_mac_addr",
13695       FT_ETHER, BASE_NONE, NULL, 0, "Source MAC address", HFILL }},
13696
13697     {&hf_ieee80211_ff_ft_action_code,
13698      {"Action code", "wlan_mgt.fixed.action_code",
13699       FT_UINT8, BASE_DEC, VALS(ft_action_codes), 0,
13700       "Management action code", HFILL }},
13701
13702     {&hf_ieee80211_ff_sta_address,
13703      {"STA Address", "wlan_mgt.fixed.sta_address",
13704       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13705
13706     {&hf_ieee80211_ff_target_ap_address,
13707      {"Target AP Address", "wlan_mgt.fixed.target_ap_address",
13708       FT_ETHER, BASE_NONE, NULL, 0, "Target AP MAC address", HFILL }},
13709
13710     {&hf_ieee80211_ff_gas_comeback_delay,
13711      {"GAS Comeback Delay", "wlan_mgt.fixed.gas_comeback_delay",
13712       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13713
13714     {&hf_ieee80211_ff_gas_fragment_id,
13715      {"GAS Query Response Fragment ID", "wlan_mgt.fixed.gas_fragment_id",
13716       FT_UINT8, BASE_DEC, NULL, 0x7f, NULL, HFILL
13717      }},
13718
13719     {&hf_ieee80211_ff_more_gas_fragments,
13720      {"More GAS Fragments", "wlan_mgt.fixed.more_gas_fragments",
13721       FT_UINT8, BASE_DEC, NULL, 0x80, NULL, HFILL }},
13722
13723     {&hf_ieee80211_ff_query_request_length,
13724      {"Query Request Length", "wlan_mgt.fixed.query_request_length",
13725       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13726
13727     {&hf_ieee80211_ff_query_request,
13728      {"Query Request", "wlan_mgt.fixed.query_request",
13729       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13730
13731     {&hf_ieee80211_ff_query_response_length,
13732      {"Query Response Length", "wlan_mgt.fixed.query_response_length",
13733       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13734
13735     {&hf_ieee80211_ff_query_response,
13736      {"Query Response", "wlan_mgt.fixed.query_response",
13737       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13738
13739     {&hf_ieee80211_gas_resp_fragments,
13740      {"GAS Query Response fragments", "wlan_mgt.fixed.fragments",
13741       FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13742     {&hf_ieee80211_gas_resp_fragment,
13743      {"GAS Query Response fragment", "wlan_mgt.fixed.fragment",
13744       FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13745     {&hf_ieee80211_gas_resp_fragment_overlap,
13746      {"GAS Query Response fragment overlap", "wlan_mgt.fixed.fragment.overlap",
13747       FT_BOOLEAN, 0, NULL, 0x00, NULL, HFILL } },
13748     {&hf_ieee80211_gas_resp_fragment_overlap_conflict,
13749      {"GAS Query Response fragment overlapping with conflicting data",
13750       "wlan_mgt.fixed.fragment.overlap.conflicts",
13751       FT_BOOLEAN, 0, NULL, 0x00, NULL, HFILL } },
13752     {&hf_ieee80211_gas_resp_fragment_multiple_tails,
13753      {"GAS Query Response has multiple tail fragments",
13754       "wlan_mgt.fixed.fragment.multiple_tails",
13755       FT_BOOLEAN, 0, NULL, 0x00, NULL, HFILL } },
13756     {&hf_ieee80211_gas_resp_fragment_too_long_fragment,
13757      {"GAS Query Response fragment too long",
13758       "wlan_mgt.fixed.fragment.too_long_fragment",
13759       FT_BOOLEAN, 0, NULL, 0x00, NULL, HFILL } },
13760     {&hf_ieee80211_gas_resp_fragment_error,
13761      {"GAS Query Response reassembly error", "wlan_mgt.fixed.fragment.error",
13762       FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13763     {&hf_ieee80211_gas_resp_fragment_count,
13764      {"GAS Query Response fragment count", "wlan_mgt.fixed.fragment.count",
13765       FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
13766     {&hf_ieee80211_gas_resp_reassembled_in,
13767      {"Reassembled in", "wlan_mgt.fixed.reassembled.in",
13768       FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13769     {&hf_ieee80211_gas_resp_reassembled_length,
13770      {"Reassembled length", "wlan_mgt.fixed.reassembled.length",
13771       FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
13772
13773     {&hf_ieee80211_ff_anqp_info_id,
13774      {"Info ID", "wlan_mgt.fixed.anqp.info_id",
13775       FT_UINT16, BASE_DEC, VALS(anqp_info_id_vals), 0,
13776       "Access Network Query Protocol Info ID", HFILL }},
13777
13778     {&hf_ieee80211_ff_anqp_info_length,
13779      {"Length", "wlan_mgt.fixed.anqp.info_length",
13780       FT_UINT16, BASE_DEC, NULL, 0, "Access Network Query Protocol Length",
13781       HFILL }},
13782
13783     {&hf_ieee80211_ff_anqp_info,
13784      {"Information", "wlan_mgt.fixed.anqp.info",
13785       FT_BYTES, BASE_NONE, NULL, 0,
13786       "Access Network Query Protocol Information", HFILL }},
13787
13788     {&hf_ieee80211_ff_anqp_query_id,
13789      {"ANQP Query ID", "wlan_mgt.fixed.anqp.query_id",
13790       FT_UINT16, BASE_DEC, VALS(anqp_info_id_vals), 0,
13791       "Access Network Query Protocol Query ID", HFILL }},
13792
13793     {&hf_ieee80211_ff_anqp_capability,
13794      {"ANQP Capability", "wlan_mgt.fixed.anqp.capability",
13795       FT_UINT16, BASE_DEC, VALS(anqp_info_id_vals), 0,
13796       "Access Network Query Protocol Query ID", HFILL }},
13797     {&hf_ieee80211_ff_anqp_capability_vlen,
13798      {"Vendor-specific Capability Length",
13799       "wlan_mgt.fixed.anqp.capability_vlen",
13800       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13801     {&hf_ieee80211_ff_anqp_capability_vendor,
13802      {"Vendor-specific Capability",
13803       "wlan_mgt.fixed.anqp.capability_vendor",
13804       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13805
13806     {&hf_ieee80211_ff_venue_info_group,
13807      {"Venue Group", "wlan_mgt.fixed.venue_info.group",
13808       FT_UINT8, BASE_DEC, VALS(venue_group_vals), 0, NULL, HFILL }},
13809
13810     {&hf_ieee80211_ff_venue_info_type,
13811      {"Venue Type", "wlan_mgt.fixed.venue_info.type",
13812       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13813
13814     {&hf_ieee80211_ff_anqp_venue_length,
13815      {"Venue Name Duple Length", "wlan_mgt.fixed.anqp.venue.length",
13816       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13817
13818     {&hf_ieee80211_ff_anqp_venue_language,
13819      {"Language Code", "wlan_mgt.fixed.anqp.venue.language",
13820       FT_STRING, BASE_NONE, NULL, 0,
13821       "Venue Name Language Code", HFILL }},
13822
13823     {&hf_ieee80211_ff_anqp_venue_name,
13824      {"Venue Name", "wlan_mgt.fixed.anqp.venue.name",
13825       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13826
13827     {&hf_ieee80211_ff_anqp_nw_auth_type_indicator,
13828      {"Network Authentication Type Indicator",
13829       "wlan_mgt.fixed.anqp.nw_auth_type.indicator",
13830       FT_UINT8, BASE_DEC, VALS(nw_auth_type_vals), 0, NULL, HFILL }},
13831
13832     {&hf_ieee80211_ff_anqp_nw_auth_type_url_len,
13833      {"Re-direct URL Length",
13834       "wlan_mgt.fixed.anqp.nw_auth_type.url_len",
13835       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13836
13837     {&hf_ieee80211_ff_anqp_nw_auth_type_url,
13838      {"Re-direct URL", "wlan_mgt.fixed.anqp.nw_auth_type_url",
13839       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13840
13841     {&hf_ieee80211_ff_anqp_roaming_consortium_oi_len,
13842      {"OI Length", "wlan_mgt.fixed.anqp.roaming_consortium.oi_len",
13843       FT_UINT8, BASE_DEC, NULL, 0, "Roaming Consortium OI Length", HFILL }},
13844
13845     {&hf_ieee80211_ff_anqp_roaming_consortium_oi,
13846      {"OI", "wlan_mgt.fixed.anqp.roaming_consortium.oi",
13847       FT_BYTES, BASE_NONE, NULL, 0, "Roaming Consortium OI", HFILL }},
13848
13849     {&hf_ieee80211_ff_anqp_ip_addr_avail_ipv6,
13850      {"IPv6 Address", "wlan_mgt.fixed.anqp.ip_addr_availability.ipv6",
13851       FT_UINT8, BASE_DEC, VALS(ip_addr_avail_ipv6_vals), 0x03,
13852       "IP Address Type Availability information for IPv6", HFILL }},
13853
13854     {&hf_ieee80211_ff_anqp_ip_addr_avail_ipv4,
13855      {"IPv4 Address", "wlan_mgt.fixed.anqp.ip_addr_availability.ipv4",
13856       FT_UINT8, BASE_DEC, VALS(ip_addr_avail_ipv4_vals), 0xfc,
13857       "IP Address Type Availability information for IPv4", HFILL }},
13858
13859     {&hf_ieee80211_ff_anqp_nai_realm_count,
13860      {"NAI Realm Count", "wlan_mgt.fixed.anqp.nai_realm_list.count",
13861       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13862     {&hf_ieee80211_ff_anqp_nai_field_len,
13863      {"NAI Realm Data Field Length",
13864       "wlan_mgt.fixed.anqp.nai_realm_list.field_len",
13865       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13866     {&hf_ieee80211_ff_anqp_nai_realm_encoding,
13867      {"NAI Realm Encoding",
13868       "wlan_mgt.fixed.naqp_nai_realm_list.encoding",
13869       FT_UINT8, BASE_DEC, VALS(nai_realm_encoding_vals), 0x01, NULL, HFILL }},
13870     {&hf_ieee80211_ff_anqp_nai_realm_length,
13871      {"NAI Realm Length",
13872       "wlan_mgt.fixed.naqp_nai_realm_list.realm_length",
13873       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13874     {&hf_ieee80211_ff_anqp_nai_realm,
13875      {"NAI Realm",
13876       "wlan_mgt.fixed.naqp_nai_realm_list.realm",
13877       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13878     {&hf_ieee80211_ff_anqp_nai_realm_eap_count,
13879      {"EAP Method Count",
13880       "wlan_mgt.fixed.naqp_nai_realm_list.eap_method_count",
13881       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13882     {&hf_ieee80211_ff_anqp_nai_realm_eap_len,
13883      {"EAP Method subfield Length",
13884       "wlan_mgt.fixed.naqp_nai_realm_list.eap_method_len",
13885       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13886     {&hf_ieee80211_ff_anqp_nai_realm_eap_method,
13887      {"EAP Method",
13888       "wlan_mgt.fixed.naqp_nai_realm_list.eap_method",
13889       FT_UINT8, BASE_DEC, VALS(eap_type_vals), 0, NULL, HFILL }},
13890     {&hf_ieee80211_ff_anqp_nai_realm_auth_param_count,
13891      {"Authentication Parameter Count",
13892       "wlan_mgt.fixed.naqp_nai_realm_list.auth_param_count",
13893       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13894     {&hf_ieee80211_ff_anqp_nai_realm_auth_param_id,
13895      {"Authentication Parameter ID",
13896       "wlan_mgt.fixed.naqp_nai_realm_list.auth_param_id",
13897       FT_UINT8, BASE_DEC, VALS(nai_realm_auth_param_id_vals),
13898       0, NULL, HFILL }},
13899     {&hf_ieee80211_ff_anqp_nai_realm_auth_param_len,
13900      {"Authentication Parameter Length",
13901       "wlan_mgt.fixed.naqp_nai_realm_list.auth_param_len",
13902       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13903     {&hf_ieee80211_ff_anqp_nai_realm_auth_param_value,
13904      {"Authentication Parameter Value",
13905       "wlan_mgt.fixed.naqp_nai_realm_list.auth_param_value",
13906       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13907
13908     {&hf_ieee80211_3gpp_gc_gud,
13909      {"GUD", "wlan_mgt.fixed.anqp.3gpp_cellular_info.gud",
13910       FT_UINT8, BASE_DEC, NULL, 0,
13911       "Generic container User Data", HFILL }},
13912     {&hf_ieee80211_3gpp_gc_udhl,
13913      {"UDHL", "wlan_mgt.fixed.anqp.3gpp_cellular_info.udhl",
13914       FT_UINT8, BASE_DEC, NULL, 0,
13915       "User Data Header Length", HFILL }},
13916     {&hf_ieee80211_3gpp_gc_iei,
13917      {"IEI", "wlan_mgt.fixed.anqp.3gpp_cellular_info.iei",
13918       FT_UINT8, BASE_DEC, NULL, 0,
13919       "Information Element Identity", HFILL }},
13920     {&hf_ieee80211_3gpp_gc_plmn_len,
13921      {"PLMN Length", "wlan_mgt.fixed.anqp.3gpp_cellular_info.plmn_len",
13922       FT_UINT8, BASE_DEC, NULL, 0,
13923       "Length of PLMN List value contents", HFILL }},
13924     {&hf_ieee80211_3gpp_gc_num_plmns,
13925      {"Number of PLMNs", "wlan_mgt.fixed.anqp.3gpp_cellular_info.num_plmns",
13926       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13927     {&hf_ieee80211_3gpp_gc_plmn,
13928      {"PLMN", "wlan_mgt.fixed.anqp.3gpp_cellular_info.plmn",
13929       FT_STRING, BASE_NONE, NULL, 0,
13930       "PLMN information", HFILL }},
13931
13932     {&hf_ieee80211_ff_anqp_domain_name_len,
13933      {"Domain Name Length", "wlan_mgt.fixed.anqp.domain_name_list.len",
13934       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13935     {&hf_ieee80211_ff_anqp_domain_name,
13936      {"Domain Name", "wlan_mgt.fixed.anqp.domain_name_list.name",
13937       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13938
13939     {&hf_ieee80211_ff_dls_timeout,
13940      {"DLS timeout", "wlan_mgt.fixed.dls_timeout",
13941       FT_UINT16, BASE_HEX, NULL, 0, "DLS timeout value", HFILL }},
13942
13943     {&hf_ieee80211_ff_sa_query_action_code,
13944      {"Action code", "wlan_mgt.fixed.action_code",
13945       FT_UINT8, BASE_DEC, VALS(sa_query_action_codes), 0,
13946       "Management action code", HFILL }},
13947
13948     {&hf_ieee80211_ff_transaction_id,
13949      {"Transaction Id", "wlan_mgt.fixed.transaction_id",
13950       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
13951
13952     {&hf_ieee80211_tag,
13953      {"Tag", "wlan_mgt.tag",
13954       FT_NONE, BASE_NONE, 0x0, 0,
13955       NULL, HFILL }},
13956
13957     {&hf_ieee80211_tag_number,
13958      {"Tag Number", "wlan_mgt.tag.number",
13959       FT_UINT8, BASE_DEC, VALS(tag_num_vals), 0,
13960       "Element ID", HFILL }},
13961
13962     {&hf_ieee80211_tag_length,
13963      {"Tag length", "wlan_mgt.tag.length",
13964       FT_UINT32, BASE_DEC, NULL, 0, "Length of tag", HFILL }},
13965
13966     {&hf_ieee80211_tag_interpretation,
13967      {"Tag interpretation", "wlan_mgt.tag.interpretation",
13968       FT_STRING, BASE_NONE, NULL, 0, "Interpretation of tag", HFILL }},
13969
13970     {&hf_ieee80211_tag_oui,
13971      {"OUI", "wlan_mgt.tag.oui",
13972       FT_UINT24, BASE_CUSTOM, oui_base_custom, 0, "OUI of vendor specific IE", HFILL }},
13973
13974     {&hf_ieee80211_tag_ds_param_channel,
13975      {"Current Channel", "wlan_mgt.ds.current_channel",
13976       FT_UINT8, BASE_DEC, NULL, 0,
13977       "DS Parameter Set - Current Channel", HFILL }},
13978
13979     {&hf_ieee80211_tag_cfp_count,
13980      {"CFP Count", "wlan_mgt.cfp.count",
13981       FT_UINT8, BASE_DEC, NULL, 0,
13982       "Indicates how many delivery traffic indication messages (DTIMs)", HFILL }},
13983
13984     {&hf_ieee80211_tag_cfp_period,
13985      {"CFP Period", "wlan_mgt.cfp.period",
13986       FT_UINT8, BASE_DEC, NULL, 0,
13987       "Indicates the number of DTIM intervals between the start of CFPs", HFILL }},
13988
13989     {&hf_ieee80211_tag_cfp_max_duration,
13990      {"CFP Max Duration", "wlan_mgt.cfp.max_duration",
13991       FT_UINT16, BASE_DEC, NULL, 0,
13992       "Indicates the maximum duration (in TU) of the CFP that may be generated by this PCF", HFILL }},
13993
13994     {&hf_ieee80211_tag_cfp_dur_remaining,
13995      {"CFP Dur Remaining", "wlan_mgt.cfp.dur_remaining",
13996       FT_UINT16, BASE_DEC, NULL, 0,
13997       "Indicates the maximum time (in TU) remaining in the present CFP", HFILL }},
13998
13999     {&hf_ieee80211_tag_vendor_oui_type,
14000      {"Vendor Specific OUI Type", "wlan_mgt.tag.oui.type",
14001       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14002
14003     {&hf_ieee80211_tim_dtim_count,
14004      {"DTIM count", "wlan_mgt.tim.dtim_count",
14005       FT_UINT8, BASE_DEC, NULL, 0,
14006       "Indicates how many Beacon frames (including the current frame) appear before the next DTIM", HFILL }},
14007
14008     {&hf_ieee80211_tim_dtim_period,
14009      {"DTIM period", "wlan_mgt.tim.dtim_period",
14010       FT_UINT8, BASE_DEC, NULL, 0,
14011       "Indicates the number of beacon intervals between successive DTIMs", HFILL }},
14012
14013     {&hf_ieee80211_tim_bmapctl,
14014      {"Bitmap control", "wlan_mgt.tim.bmapctl",
14015       FT_UINT8, BASE_HEX, NULL, 0,
14016       NULL, HFILL }},
14017
14018     {&hf_ieee80211_tim_bmapctl_mcast,
14019      {"Multicast", "wlan_mgt.tim.bmapctl.multicast",
14020       FT_BOOLEAN, 8, NULL, 0x1,
14021       "Contains the Traffic Indicator bit associated with Association ID 0", HFILL }},
14022
14023     {&hf_ieee80211_tim_bmapctl_offset,
14024      {"Bitmap Offset", "wlan_mgt.tim.bmapctl.offset",
14025       FT_UINT8, BASE_HEX, NULL, 0xFE,
14026       NULL, HFILL }},
14027
14028     {&hf_ieee80211_tim_partial_virtual_bitmap,
14029      {"Partial Virtual Bitmap", "wlan_mgt.tim.partial_virtual_bitmap",
14030       FT_BYTES, BASE_NONE, NULL, 0x0,
14031       NULL, HFILL }},
14032
14033     {&hf_ieee80211_tag_ibss_atim_window,
14034      {"Atim Windows", "wlan_mgt.ibss.atim_windows",
14035       FT_UINT16, BASE_HEX, NULL, 0x0,
14036       "Contains the ATIM Window length in TU", HFILL }},
14037
14038     {&hf_ieee80211_tag_country_info_code,
14039      {"Code", "wlan_mgt.country_info.code",
14040       FT_STRING, BASE_NONE, NULL, 0x0,
14041       NULL, HFILL }},
14042
14043     {&hf_ieee80211_tag_country_info_env,
14044      {"Environment", "wlan_mgt.country_info.environment",
14045       FT_UINT8, BASE_HEX, VALS(environment_vals), 0x0,
14046       NULL, HFILL }},
14047
14048     {&hf_ieee80211_tag_country_info_pad,
14049      {"Padding", "wlan_mgt.country_info.padding",
14050       FT_BYTES, BASE_NONE, NULL, 0x0,
14051       NULL, HFILL }},
14052
14053     {&hf_ieee80211_tag_country_info_fnm,
14054      {"Country Info", "wlan_mgt.country_info.fnm",
14055       FT_NONE, BASE_NONE, NULL, 0x0,
14056       NULL, HFILL }},
14057
14058     {&hf_ieee80211_tag_country_info_fnm_fcn,
14059      {"First Channel Number", "wlan_mgt.country_info.fnm.fcn",
14060       FT_UINT8, BASE_DEC, NULL, 0x0,
14061       NULL, HFILL }},
14062
14063     {&hf_ieee80211_tag_country_info_fnm_nc,
14064      {"Number of Channels", "wlan_mgt.country_info.fnm.nc",
14065       FT_UINT8, BASE_DEC, NULL, 0x0,
14066       NULL, HFILL }},
14067
14068     {&hf_ieee80211_tag_country_info_fnm_mtpl,
14069      {"Maximum Transmit Power Level (in dBm)", "wlan_mgt.country_info.fnm.mtpl",
14070       FT_UINT8, BASE_DEC, NULL, 0x0,
14071       NULL, HFILL }},
14072
14073     {&hf_ieee80211_tag_country_info_rrc,
14074      {"Country Info", "wlan_mgt.country_info.rrc",
14075       FT_NONE, BASE_NONE, NULL, 0x0,
14076       NULL, HFILL }},
14077
14078     {&hf_ieee80211_tag_country_info_rrc_rei,
14079      {"Regulatory Extension Identifier", "wlan_mgt.country_info.rrc.rei",
14080       FT_UINT8, BASE_DEC, NULL, 0x0,
14081       NULL, HFILL }},
14082
14083     {&hf_ieee80211_tag_country_info_rrc_rc,
14084      {"Regulatory Class", "wlan_mgt.country_info.rrc.rc",
14085       FT_UINT8, BASE_DEC, NULL, 0x0,
14086       NULL, HFILL }},
14087
14088     {&hf_ieee80211_tag_country_info_rrc_cc,
14089      {"Coverage Class", "wlan_mgt.country_info.rrc.cc",
14090       FT_UINT8, BASE_DEC, NULL, 0x0,
14091       NULL, HFILL }},
14092
14093     {&hf_ieee80211_tag_fh_hopping_parameter_prime_radix,
14094      {"Prime Radix", "wlan_mgt.fh_hopping.parameter.prime_radix",
14095       FT_UINT8, BASE_DEC, NULL, 0x0,
14096       NULL, HFILL }},
14097
14098     {&hf_ieee80211_tag_fh_hopping_parameter_nb_channels,
14099      {"Number of Channels", "wlan_mgt.fh_hopping.parameter.nb_channels",
14100       FT_UINT8, BASE_DEC, NULL, 0x0,
14101       NULL, HFILL }},
14102
14103     {&hf_ieee80211_tag_fh_hopping_table_flag,
14104      {"Flag", "wlan_mgt.fh_hopping.table.flag",
14105       FT_UINT8, BASE_HEX, NULL, 0x0,
14106       "Indicates that a Random Table is present when the value is 1", HFILL }},
14107
14108     {&hf_ieee80211_tag_fh_hopping_table_number_of_sets,
14109      {"Number of Sets", "wlan_mgt.fh_hopping.table.number_of_sets",
14110       FT_UINT8, BASE_DEC, NULL, 0x0,
14111       "Indicates the total number of sets within the hopping patterns", HFILL }},
14112
14113     {&hf_ieee80211_tag_fh_hopping_table_modulus,
14114      {"Modulus", "wlan_mgt.fh_hopping.table.modulus",
14115       FT_UINT8, BASE_HEX, NULL, 0x0,
14116       "Indicate the values to be used in the equations to create a hopping sequence from the Random Table information", HFILL }},
14117
14118     {&hf_ieee80211_tag_fh_hopping_table_offset,
14119      {"Offset", "wlan_mgt.fh_hopping.table.offset",
14120       FT_UINT8, BASE_HEX, NULL, 0x0,
14121       "Indicate the values to be used in the equations to create a hopping sequence from the Random Table information", HFILL }},
14122
14123     {&hf_ieee80211_tag_fh_hopping_random_table,
14124      {"Random Table", "wlan_mgt.fh_hopping.table.random_table",
14125       FT_UINT16, BASE_HEX, NULL, 0x0,
14126       "It is a vector of single octet values that indicate the random sequence to be followed during a hopping sequence", HFILL }},
14127
14128     {&hf_ieee80211_tag_request,
14129      {"Requested Element ID", "wlan_mgt.tag.request",
14130       FT_UINT8, BASE_DEC, VALS(tag_num_vals), 0,
14131       "The list of elements that are to be included in the responding STA Probe Response frame", HFILL }},
14132
14133     {&hf_ieee80211_tclas_up,
14134      {"User Priority", "wlan_mgt.tclas.user_priority",
14135       FT_UINT8, BASE_DEC, NULL, 0,
14136       "Contains the value of the UP of the associated MSDUs", HFILL }},
14137
14138     {&hf_ieee80211_tclas_class_type,
14139      {"Classifier Type", "wlan_mgt.tclas.class_type",
14140       FT_UINT8, BASE_DEC, VALS (classifier_type), 0,
14141       "Specifies the type of classifier parameters", HFILL }},
14142
14143     {&hf_ieee80211_tclas_class_mask,
14144      {"Classifier Mask", "wlan_mgt.tclas.class_mask",
14145       FT_UINT8, BASE_HEX,  NULL, 0,
14146       "Specifies a bitmap where bits that are set to 1 identify a subset of the classifier parameters", HFILL }},
14147
14148     {&hf_ieee80211_tclas_src_mac_addr,
14149      {"Source address", "wlan_mgt.tclas.type",
14150       FT_ETHER, BASE_NONE, NULL, 0,
14151       "Classifier Parameters Ethernet Type", HFILL }},
14152
14153     {&hf_ieee80211_tclas_dst_mac_addr,
14154      {"Destination address", "wlan_mgt.tclas.type",
14155       FT_ETHER, BASE_NONE, NULL, 0,
14156       NULL, HFILL }},
14157
14158     {&hf_ieee80211_tclas_ether_type,
14159      {"Ethernet Type", "wlan_mgt.tclas.type",
14160       FT_UINT8, BASE_DEC, NULL, 0,
14161       NULL, HFILL }},
14162
14163     {&hf_ieee80211_tclas_version,
14164      {"IP Version", "wlan_mgt.tclas.version",
14165       FT_UINT8, BASE_DEC, NULL, 0,
14166       NULL, HFILL }},
14167
14168     {&hf_ieee80211_tclas_ipv4_src,
14169      {"IPv4 Src Addr", "wlan_mgt.tclas.ipv4_src",
14170       FT_IPv4, BASE_NONE, NULL, 0,
14171       NULL, HFILL }},
14172
14173     {&hf_ieee80211_tclas_ipv4_dst,
14174      {"IPv4 Dst Addr", "wlan_mgt.tclas.ipv4_dst",
14175       FT_IPv4, BASE_NONE, NULL, 0,
14176       NULL, HFILL }},
14177
14178     {&hf_ieee80211_tclas_src_port,
14179      {"Source Port", "wlan_mgt.tclas.src_port",
14180       FT_UINT16, BASE_DEC, NULL, 0,
14181       NULL, HFILL }},
14182
14183     {&hf_ieee80211_tclas_dst_port,
14184      {"Destination Port", "wlan_mgt.tclas.dst_port",
14185       FT_UINT16, BASE_DEC, NULL, 0,
14186       NULL, HFILL }},
14187
14188     {&hf_ieee80211_tclas_dscp,
14189      {"IPv4 DSCP", "wlan_mgt.tclas.dscp",
14190       FT_UINT8, BASE_HEX, NULL, 0,
14191     "IPv4 Differentiated Services Code Point (DSCP) Field", HFILL }},
14192
14193     {&hf_ieee80211_tclas_protocol,
14194      {"Protocol", "wlan_mgt.tclas.protocol",
14195       FT_UINT8, BASE_HEX, NULL, 0, "IPv4 Protocol", HFILL }},
14196
14197     {&hf_ieee80211_tclas_ipv6_src,
14198      {"IPv6 Src Addr", "wlan_mgt.tclas.ipv6_src",
14199       FT_IPv6, BASE_NONE,
14200       NULL, 0, NULL, HFILL }},
14201
14202     {&hf_ieee80211_tclas_ipv6_dst,
14203      {"IPv6 Dst Addr", "wlan_mgt.tclas.ipv6_dst",
14204       FT_IPv6, BASE_NONE, NULL, 0,
14205       NULL, HFILL }},
14206
14207     {&hf_ieee80211_tclas_flow,
14208      {"Flow Label", "wlan_mgt.tclas.flow",
14209       FT_UINT24, BASE_HEX, NULL, 0,
14210       "IPv6 Flow Label", HFILL }},
14211
14212     {&hf_ieee80211_tclas_tag_type,
14213      {"802.1Q Tag Type", "wlan_mgt.tclas.tag_type",
14214       FT_UINT16, BASE_HEX, NULL, 0,
14215       NULL, HFILL }},
14216
14217     {&hf_ieee80211_tag_challenge_text,
14218      {"Challenge Text", "wlan_mgt.tag.challenge_text",
14219       FT_BYTES, BASE_NONE, NULL, 0,
14220       NULL, HFILL }},
14221
14222     {&hf_ieee80211_rsn_version,
14223      {"RSN Version", "wlan_mgt.rsn.version", FT_UINT16, BASE_DEC,
14224       NULL, 0, "Indicates the version number of the RSNA protocol", HFILL }},
14225
14226     {&hf_ieee80211_rsn_gcs,
14227      {"Group Cipher Suite", "wlan_mgt.rsn.gcs", FT_UINT32, BASE_CUSTOM,
14228       rsn_gcs_base_custom, 0, "Contains the cipher suite selector used by the BSS to protect broadcast/multicast traffic", HFILL }},
14229
14230     {&hf_ieee80211_rsn_gcs_oui,
14231      {"Group Cipher Suite OUI", "wlan_mgt.rsn.gcs.oui", FT_UINT24, BASE_CUSTOM,
14232       oui_base_custom, 0, NULL, HFILL }},
14233
14234     {&hf_ieee80211_rsn_gcs_type,
14235      {"Group Cipher Suite type", "wlan_mgt.rsn.gcs.type", FT_UINT8, BASE_DEC,
14236       NULL, 0, NULL, HFILL }},
14237
14238     {&hf_ieee80211_rsn_gcs_80211_type,
14239      {"Group Cipher Suite type", "wlan_mgt.rsn.gcs.type", FT_UINT8, BASE_DEC,
14240       VALS(ieee80211_rsn_cipher_vals), 0, NULL, HFILL }},
14241
14242     {&hf_ieee80211_rsn_pcs_count,
14243      {"Pairwise Cipher Suite Count", "wlan_mgt.rsn.pcs.count", FT_UINT16, BASE_DEC,
14244       NULL, 0, "Indicates the number of pairwise cipher suite selectors that are contained in the Pairwise Cipher Suite List", HFILL }},
14245
14246     {&hf_ieee80211_rsn_pcs_list,
14247      {"Pairwise Cipher Suite List", "wlan_mgt.rsn.pcs.list", FT_NONE, BASE_NONE,
14248       NULL, 0, "Contains a series of cipher suite selectors that indicate the pairwisecipher suites", HFILL }},
14249
14250     {&hf_ieee80211_rsn_pcs,
14251      {"Pairwise Cipher Suite", "wlan_mgt.rsn.pcs", FT_UINT32, BASE_CUSTOM,
14252       rsn_pcs_base_custom, 0, NULL, HFILL }},
14253
14254     {&hf_ieee80211_rsn_pcs_oui,
14255      {"Pairwise Cipher Suite OUI", "wlan_mgt.rsn.pcs.oui", FT_UINT24, BASE_CUSTOM,
14256       oui_base_custom, 0, NULL, HFILL }},
14257
14258     {&hf_ieee80211_rsn_pcs_type,
14259      {"Pairwise Cipher Suite type", "wlan_mgt.rsn.pcs.type", FT_UINT8, BASE_DEC,
14260       NULL, 0, NULL, HFILL }},
14261
14262     {&hf_ieee80211_rsn_pcs_80211_type,
14263      {"Pairwise Cipher Suite type", "wlan_mgt.rsn.pcs.type", FT_UINT8, BASE_DEC,
14264       VALS(ieee80211_rsn_cipher_vals), 0, NULL, HFILL }},
14265
14266     {&hf_ieee80211_rsn_akms_count,
14267      {"Auth Key Management (AKM) Suite Count", "wlan_mgt.rsn.akms.count", FT_UINT16, BASE_DEC,
14268       NULL, 0, "Indicates the number of Auth Key Management suite selectors that are contained in the Auth Key Management Suite List", HFILL }},
14269
14270     {&hf_ieee80211_rsn_akms_list,
14271      {"Auth Key Management (AKM) List", "wlan_mgt.rsn.akms.list", FT_NONE, BASE_NONE,
14272       NULL, 0, "Contains a series of cipher suite selectors that indicate the AKM suites", HFILL }},
14273
14274     {&hf_ieee80211_rsn_akms,
14275      {"Auth Key Management (AKM) Suite", "wlan_mgt.rsn.akms", FT_UINT32, BASE_CUSTOM,
14276       rsn_akms_base_custom, 0, NULL, HFILL }},
14277
14278     {&hf_ieee80211_rsn_akms_oui,
14279      {"Auth Key Management (AKM) OUI", "wlan_mgt.rsn.akms.oui", FT_UINT24, BASE_CUSTOM,
14280       oui_base_custom, 0, NULL, HFILL }},
14281
14282     {&hf_ieee80211_rsn_akms_type,
14283      {"Auth Key Management (AKM) type", "wlan_mgt.rsn.akms.type", FT_UINT8, BASE_DEC,
14284       NULL, 0, NULL, HFILL }},
14285
14286     {&hf_ieee80211_rsn_akms_80211_type,
14287      {"Auth Key Management (AKM) type", "wlan_mgt.rsn.akms.type", FT_UINT8, BASE_DEC,
14288       VALS(ieee80211_rsn_keymgmt_vals), 0, NULL, HFILL }},
14289
14290     {&hf_ieee80211_rsn_cap,
14291      {"RSN Capabilities", "wlan_mgt.rsn.capabilities", FT_UINT16, BASE_HEX,
14292       NULL, 0, "RSN Capability information", HFILL }},
14293
14294     {&hf_ieee80211_rsn_cap_preauth,
14295      {"RSN Pre-Auth capabilities", "wlan_mgt.rsn.capabilities.preauth",
14296       FT_BOOLEAN, 16, TFS(&rsn_preauth_flags), 0x0001,
14297       NULL, HFILL }},
14298
14299     {&hf_ieee80211_rsn_cap_no_pairwise,
14300      {"RSN No Pairwise capabilities", "wlan_mgt.rsn.capabilities.no_pairwise",
14301       FT_BOOLEAN, 16, TFS(&rsn_no_pairwise_flags), 0x0002,
14302       NULL, HFILL }},
14303
14304     {&hf_ieee80211_rsn_cap_ptksa_replay_counter,
14305      {"RSN PTKSA Replay Counter capabilities",
14306       "wlan_mgt.rsn.capabilities.ptksa_replay_counter",
14307       FT_UINT16, BASE_HEX, VALS(rsn_cap_replay_counter), 0x000C,
14308       NULL, HFILL }},
14309
14310     {&hf_ieee80211_rsn_cap_gtksa_replay_counter,
14311      {"RSN GTKSA Replay Counter capabilities",
14312       "wlan_mgt.rsn.capabilities.gtksa_replay_counter",
14313       FT_UINT16, BASE_HEX, VALS(rsn_cap_replay_counter), 0x0030,
14314       NULL, HFILL }},
14315
14316     {&hf_ieee80211_rsn_cap_mfpr,
14317      {"Management Frame Protection Required",
14318       "wlan_mgt.rsn.capabilities.mfpr",
14319       FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }},
14320
14321     {&hf_ieee80211_rsn_cap_mfpc,
14322      {"Management Frame Protection Capable",
14323       "wlan_mgt.rsn.capabilities.mfpc",
14324       FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL }},
14325
14326     {&hf_ieee80211_rsn_cap_peerkey,
14327      {"PeerKey Enabled",
14328       "wlan_mgt.rsn.capabilities.peerkey",
14329       FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL }},
14330
14331     {&hf_ieee80211_rsn_pmkid_count,
14332      {"PMKID Count", "wlan_mgt.rsn.pmkid.count", FT_UINT16, BASE_DEC,
14333       NULL, 0, "Indicates the number of PMKID  selectors that are contained in the PMKID Suite List", HFILL }},
14334
14335     {&hf_ieee80211_rsn_pmkid_list,
14336      {"PMKID List", "wlan_mgt.rsn.pmkid.list", FT_NONE, BASE_NONE,
14337       NULL, 0, "Contains a series of cipher suite selectors that indicate the AKM suites", HFILL }},
14338
14339     {&hf_ieee80211_rsn_pmkid,
14340      {"PMKID", "wlan_mgt.pmkid.akms", FT_BYTES, BASE_NONE,
14341       NULL, 0, NULL, HFILL }},
14342
14343     {&hf_ieee80211_rsn_gmcs,
14344      {"Group Managemement Cipher Suite", "wlan_mgt.rsn.gmcs", FT_UINT32, BASE_CUSTOM,
14345       rsn_gmcs_base_custom, 0, "Contains the cipher suite selector used by the BSS to protect broadcast/multicast traffic", HFILL }},
14346
14347     {&hf_ieee80211_rsn_gmcs_oui,
14348      {"Group Managemement Cipher Suite OUI", "wlan_mgt.rsn.gmcs.oui", FT_UINT24, BASE_CUSTOM,
14349       oui_base_custom, 0, NULL, HFILL }},
14350
14351     {&hf_ieee80211_rsn_gmcs_type,
14352      {"Group Managemement Cipher Suite type", "wlan_mgt.rsn.gmcs.type", FT_UINT8, BASE_DEC,
14353       NULL, 0, NULL, HFILL }},
14354
14355     {&hf_ieee80211_rsn_gmcs_80211_type,
14356      {"Group Managemement Cipher Suite type", "wlan_mgt.rsn.gmcs.type", FT_UINT8, BASE_DEC,
14357       VALS(ieee80211_rsn_cipher_vals), 0, NULL, HFILL }},
14358
14359
14360     {&hf_ieee80211_ht_cap,
14361      {"HT Capabilities Info", "wlan_mgt.ht.capabilities", FT_UINT16, BASE_HEX,
14362       NULL, 0, "HT Capability information", HFILL }},
14363
14364     {&hf_ieee80211_ht_vs_cap,
14365      {"HT Capabilities Info (VS)", "wlan_mgt.vs.ht.capabilities", FT_UINT16, BASE_HEX,
14366       NULL, 0, "Vendor Specific HT Capability information", HFILL }},
14367
14368     {&hf_ieee80211_ht_ldpc_coding,
14369      {"HT LDPC coding capability", "wlan_mgt.ht.capabilities.ldpccoding",
14370       FT_BOOLEAN, 16, TFS (&ht_ldpc_coding_flag), 0x0001,
14371       NULL, HFILL }},
14372
14373     {&hf_ieee80211_ht_chan_width,
14374      {"HT Support channel width", "wlan_mgt.ht.capabilities.width",
14375       FT_BOOLEAN, 16, TFS (&ht_chan_width_flag), 0x0002,
14376       NULL, HFILL }},
14377
14378     {&hf_ieee80211_ht_sm_pwsave,
14379      {"HT SM Power Save", "wlan_mgt.ht.capabilities.sm",
14380       FT_UINT16, BASE_HEX, VALS (&ht_sm_pwsave_flag), 0x000c,
14381       NULL, HFILL }},
14382
14383     {&hf_ieee80211_ht_green,
14384      {"HT Green Field", "wlan_mgt.ht.capabilities.green",
14385       FT_BOOLEAN, 16, TFS (&ht_green_flag), 0x0010,
14386       NULL, HFILL }},
14387
14388     {&hf_ieee80211_ht_short20,
14389      {"HT Short GI for 20MHz", "wlan_mgt.ht.capabilities.short20",
14390       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0020,
14391       NULL, HFILL }},
14392
14393     {&hf_ieee80211_ht_short40,
14394      {"HT Short GI for 40MHz", "wlan_mgt.ht.capabilities.short40",
14395       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0040,
14396       NULL, HFILL }},
14397
14398     {&hf_ieee80211_ht_tx_stbc,
14399      {"HT Tx STBC", "wlan_mgt.ht.capabilities.txstbc",
14400       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0080,
14401       NULL, HFILL }},
14402
14403     {&hf_ieee80211_ht_rx_stbc,
14404      {"HT Rx STBC", "wlan_mgt.ht.capabilities.rxstbc",
14405       FT_UINT16, BASE_HEX, VALS (&ht_rx_stbc_flag), 0x0300,
14406       "HT Tx STBC", HFILL }},
14407
14408     {&hf_ieee80211_ht_delayed_block_ack,
14409      {"HT Delayed Block ACK", "wlan_mgt.ht.capabilities.delayedblockack",
14410       FT_BOOLEAN, 16, TFS (&ht_delayed_block_ack_flag), 0x0400,
14411       NULL, HFILL }},
14412
14413     {&hf_ieee80211_ht_max_amsdu,
14414      {"HT Max A-MSDU length", "wlan_mgt.ht.capabilities.amsdu",
14415       FT_BOOLEAN, 16, TFS (&ht_max_amsdu_flag), 0x0800,
14416       NULL, HFILL }},
14417
14418     {&hf_ieee80211_ht_dss_cck_40,
14419      {"HT DSSS/CCK mode in 40MHz", "wlan_mgt.ht.capabilities.dsscck",
14420       FT_BOOLEAN, 16, TFS (&ht_dss_cck_40_flag), 0x1000,
14421       "HT DSS/CCK mode in 40MHz", HFILL }},
14422
14423     {&hf_ieee80211_ht_psmp,
14424      {"HT PSMP Support", "wlan_mgt.ht.capabilities.psmp",
14425       FT_BOOLEAN, 16, TFS (&ht_psmp_flag), 0x2000,
14426       NULL, HFILL }},
14427
14428     {&hf_ieee80211_ht_40_mhz_intolerant,
14429      {"HT Forty MHz Intolerant", "wlan_mgt.ht.capabilities.40mhzintolerant",
14430       FT_BOOLEAN, 16, TFS (&ht_40_mhz_intolerant_flag), 0x4000,
14431       NULL, HFILL }},
14432
14433     {&hf_ieee80211_ht_l_sig,
14434      {"HT L-SIG TXOP Protection support", "wlan_mgt.ht.capabilities.lsig",
14435       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x8000,
14436       NULL, HFILL }},
14437
14438     {&hf_ieee80211_ampduparam,
14439      {"A-MPDU Parameters", "wlan_mgt.ht.ampduparam", FT_UINT16, BASE_HEX,
14440       NULL, 0, NULL, HFILL }},
14441
14442     {&hf_ieee80211_ampduparam_vs,
14443      {"A-MPDU Parameters (VS)", "wlan_mgt.vs.ht.ampduparam", FT_UINT16, BASE_HEX,
14444       NULL, 0, "Vendor Specific A-MPDU Parameters", HFILL }},
14445
14446     {&hf_ieee80211_ampduparam_mpdu,
14447      {"Maximum Rx A-MPDU Length", "wlan_mgt.ht.ampduparam.maxlength",
14448       FT_UINT8, BASE_HEX, 0 , 0x03,
14449       NULL, HFILL }},
14450
14451     {&hf_ieee80211_ampduparam_mpdu_start_spacing,
14452      {"MPDU Density", "wlan_mgt.ht.ampduparam.mpdudensity",
14453       FT_UINT8, BASE_HEX, VALS (&ampduparam_mpdu_start_spacing_flags) , 0x1c,
14454       NULL, HFILL }},
14455
14456     {&hf_ieee80211_ampduparam_reserved,
14457      {"Reserved", "wlan_mgt.ht.ampduparam.reserved",
14458       FT_UINT8, BASE_HEX, NULL, 0xE0,
14459       NULL, HFILL }},
14460
14461     {&hf_ieee80211_mcsset,
14462      {"Rx Supported Modulation and Coding Scheme Set", "wlan_mgt.ht.mcsset",
14463       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
14464
14465     {&hf_ieee80211_mcsset_vs,
14466      {"Rx Supported Modulation and Coding Scheme Set (VS)", "wlan_mgt.vs.ht.mcsset",
14467       FT_STRING, BASE_NONE, NULL, 0, "Vendor Specific Rx Supported Modulation and Coding Scheme Set", HFILL }},
14468
14469     {&hf_ieee80211_mcsset_rx_bitmask_0to7,
14470      {"Rx Bitmask Bits 0-7", "wlan_mgt.ht.mcsset.rxbitmask.0to7",
14471       FT_UINT32, BASE_HEX, 0, 0x000000ff, NULL, HFILL }},
14472
14473     {&hf_ieee80211_mcsset_rx_bitmask_8to15,
14474      {"Rx Bitmask Bits 8-15", "wlan_mgt.ht.mcsset.rxbitmask.8to15",
14475       FT_UINT32, BASE_HEX, 0, 0x0000ff00, NULL, HFILL }},
14476
14477     {&hf_ieee80211_mcsset_rx_bitmask_16to23,
14478      {"Rx Bitmask Bits 16-23", "wlan_mgt.ht.mcsset.rxbitmask.16to23",
14479       FT_UINT32, BASE_HEX, 0, 0x00ff0000, NULL, HFILL }},
14480
14481     {&hf_ieee80211_mcsset_rx_bitmask_24to31,
14482      {"Rx Bitmask Bits 24-31", "wlan_mgt.ht.mcsset.rxbitmask.24to31",
14483       FT_UINT32, BASE_HEX, 0, 0xff000000, NULL, HFILL }},
14484
14485     {&hf_ieee80211_mcsset_rx_bitmask_32,
14486      {"Rx Bitmask Bit 32", "wlan_mgt.ht.mcsset.rxbitmask.32",
14487       FT_UINT32, BASE_HEX, 0, 0x000001, NULL, HFILL }},
14488
14489     {&hf_ieee80211_mcsset_rx_bitmask_33to38,
14490      {"Rx Bitmask Bits 33-38", "wlan_mgt.ht.mcsset.rxbitmask.33to38",
14491       FT_UINT32, BASE_HEX, 0, 0x00007e, NULL, HFILL }},
14492
14493     {&hf_ieee80211_mcsset_rx_bitmask_39to52,
14494      {"Rx Bitmask Bits 39-52", "wlan_mgt.ht.mcsset.rxbitmask.39to52",
14495       FT_UINT32, BASE_HEX, 0, 0x1fff80, NULL, HFILL }},
14496
14497     {&hf_ieee80211_mcsset_rx_bitmask_53to76,
14498      {"Rx Bitmask Bits 53-76", "wlan_mgt.ht.mcsset.rxbitmask.53to76",
14499       FT_UINT32, BASE_HEX, 0, 0x1fffffe0, NULL, HFILL }},
14500
14501     {&hf_ieee80211_mcsset_highest_data_rate,
14502      {"Highest Supported Data Rate", "wlan_mgt.ht.mcsset.highestdatarate",
14503       FT_UINT16, BASE_HEX, 0, 0x03ff, NULL, HFILL }},
14504
14505     {&hf_ieee80211_mcsset_tx_mcs_set_defined,
14506      {"Tx Supported MCS Set", "wlan_mgt.ht.mcsset.txsetdefined",
14507       FT_BOOLEAN, 16, TFS (&mcsset_tx_mcs_set_defined_flag), 0x0001,
14508       NULL, HFILL }},
14509
14510     {&hf_ieee80211_mcsset_tx_rx_mcs_set_not_equal,
14511      {"Tx and Rx MCS Set", "wlan_mgt.ht.mcsset.txrxmcsnotequal",
14512       FT_BOOLEAN, 16, TFS (&mcsset_tx_rx_mcs_set_not_equal_flag), 0x0002,
14513       NULL, HFILL }},
14514
14515     {&hf_ieee80211_mcsset_tx_max_spatial_streams,
14516      {"Tx Maximum Number of Spatial Streams Supported", "wlan_mgt.ht.mcsset.txmaxss",
14517       FT_UINT16, BASE_HEX, VALS (&mcsset_tx_max_spatial_streams_flags) , 0x000c,
14518       NULL, HFILL }},
14519
14520     {&hf_ieee80211_mcsset_tx_unequal_modulation,
14521      {"Unequal Modulation", "wlan_mgt.ht.mcsset.txunequalmod",
14522       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0010,
14523       NULL, HFILL }},
14524
14525     {&hf_ieee80211_htex_cap,
14526      {"HT Extended Capabilities", "wlan_mgt.htex.capabilities", FT_UINT16, BASE_HEX,
14527       NULL, 0, "HT Extended Capability information", HFILL }},
14528
14529     {&hf_ieee80211_htex_vs_cap,
14530      {"HT Extended Capabilities (VS)", "wlan_mgt.vs.htex.capabilities", FT_UINT16, BASE_HEX,
14531       NULL, 0, "Vendor Specific HT Extended Capability information", HFILL }},
14532
14533     {&hf_ieee80211_htex_pco,
14534      {"Transmitter supports PCO", "wlan_mgt.htex.capabilities.pco",
14535       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0001,
14536       NULL, HFILL }},
14537
14538     {&hf_ieee80211_htex_transtime,
14539      {"Time needed to transition between 20MHz and 40MHz", "wlan_mgt.htex.capabilities.transtime",
14540       FT_UINT16, BASE_HEX, VALS (&htex_transtime_flags), 0x0006,
14541       NULL, HFILL }},
14542
14543     {&hf_ieee80211_htex_mcs,
14544      {"MCS Feedback capability", "wlan_mgt.htex.capabilities.mcs",
14545       FT_UINT16, BASE_HEX, VALS (&htex_mcs_flags), 0x0300,
14546       NULL, HFILL }},
14547
14548     {&hf_ieee80211_htex_htc_support,
14549      {"High Throughput", "wlan_mgt.htex.capabilities.htc",
14550       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0400,
14551       NULL, HFILL }},
14552
14553     {&hf_ieee80211_htex_rd_responder,
14554      {"Reverse Direction Responder", "wlan_mgt.htex.capabilities.rdresponder",
14555       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0800,
14556       NULL, HFILL }},
14557
14558     {&hf_ieee80211_txbf,
14559      {"Transmit Beam Forming (TxBF) Capabilities", "wlan_mgt.txbf", FT_UINT16, BASE_HEX,
14560       NULL, 0, NULL, HFILL }},
14561
14562     {&hf_ieee80211_txbf_vs,
14563      {"Transmit Beam Forming (TxBF) Capabilities (VS)", "wlan_mgt.vs.txbf", FT_UINT16, BASE_HEX,
14564       NULL, 0, "Vendor Specific Transmit Beam Forming (TxBF) Capabilities", HFILL }},
14565
14566     {&hf_ieee80211_txbf_cap,
14567      {"Transmit Beamforming", "wlan_mgt.txbf.txbf",
14568       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000001,
14569       NULL, HFILL }},
14570
14571     {&hf_ieee80211_txbf_rcv_ssc,
14572      {"Receive Staggered Sounding", "wlan_mgt.txbf.rxss",
14573       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000002,
14574       NULL, HFILL }},
14575
14576     {&hf_ieee80211_txbf_tx_ssc,
14577      {"Transmit Staggered Sounding", "wlan_mgt.txbf.txss",
14578       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000004,
14579       NULL, HFILL }},
14580
14581     {&hf_ieee80211_txbf_rcv_ndp,
14582      {"Receive Null Data packet (NDP)", "wlan_mgt.txbf.rxndp",
14583       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000008,
14584       NULL, HFILL }},
14585
14586     {&hf_ieee80211_txbf_tx_ndp,
14587      {"Transmit Null Data packet (NDP)", "wlan_mgt.txbf.txndp",
14588       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000010,
14589       NULL, HFILL }},
14590
14591     {&hf_ieee80211_txbf_impl_txbf,
14592      {"Implicit TxBF capable", "wlan_mgt.txbf.impltxbf",
14593       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000020,
14594       "Implicit Transmit Beamforming (TxBF) capable", HFILL }},
14595
14596     {&hf_ieee80211_txbf_calib,
14597      {"Calibration", "wlan_mgt.txbf.calibration",
14598       FT_UINT32, BASE_HEX, VALS (&txbf_calib_flag), 0x000000c0,
14599       NULL, HFILL }},
14600
14601     {&hf_ieee80211_txbf_expl_csi,
14602      {"STA can apply TxBF using CSI explicit feedback", "wlan_mgt.txbf.csi",
14603       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000100,
14604       "Station can apply TxBF using CSI explicit feedback", HFILL }},
14605
14606     {&hf_ieee80211_txbf_expl_uncomp_fm,
14607      {"STA can apply TxBF using uncompressed beamforming feedback matrix", "wlan_mgt.txbf.fm.uncompressed.tbf",
14608       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000200,
14609       "Station can apply TxBF using uncompressed beamforming feedback matrix", HFILL }},
14610
14611     {&hf_ieee80211_txbf_expl_comp_fm,
14612      {"STA can apply TxBF using compressed beamforming feedback matrix", "wlan_mgt.txbf.fm.compressed.tbf",
14613       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000400,
14614       "Station can apply TxBF using compressed beamforming feedback matrix", HFILL }},
14615
14616     {&hf_ieee80211_txbf_expl_bf_csi,
14617      {"Receiver can return explicit CSI feedback", "wlan_mgt.txbf.rcsi",
14618       FT_UINT32, BASE_HEX, VALS (&txbf_feedback_flags), 0x00001800,
14619       NULL, HFILL }},
14620
14621     {&hf_ieee80211_txbf_expl_uncomp_fm_feed,
14622      {"Receiver can return explicit uncompressed Beamforming Feedback Matrix", "wlan_mgt.txbf.fm.uncompressed.rbf",
14623       FT_UINT32, BASE_HEX, VALS (&txbf_feedback_flags), 0x00006000,
14624       NULL, HFILL }},
14625
14626     {&hf_ieee80211_txbf_expl_comp_fm_feed,
14627      {"STA can compress and use compressed Beamforming Feedback Matrix", "wlan_mgt.txbf.fm.compressed.bf",
14628       FT_UINT32, BASE_HEX, VALS (&txbf_feedback_flags), 0x00018000,
14629       "Station can compress and use compressed Beamforming Feedback Matrix", HFILL }},
14630
14631     {&hf_ieee80211_txbf_min_group,
14632      {"Minimal grouping used for explicit feedback reports", "wlan_mgt.txbf.mingroup",
14633       FT_UINT32, BASE_HEX, VALS (&txbf_min_group_flags), 0x00060000,
14634       NULL, HFILL }},
14635
14636     {&hf_ieee80211_txbf_csi_num_bf_ant,
14637      {"Max antennae STA can support when CSI feedback required", "wlan_mgt.txbf.csinumant",
14638       FT_UINT32, BASE_HEX, VALS (&txbf_antenna_flags), 0x00180000,
14639       "Max antennae station can support when CSI feedback required", HFILL }},
14640
14641     {&hf_ieee80211_txbf_uncomp_sm_bf_ant,
14642      {"Max antennae STA can support when uncompressed Beamforming feedback required", "wlan_mgt.txbf.fm.uncompressed.maxant",
14643       FT_UINT32, BASE_HEX, VALS (&txbf_antenna_flags), 0x00600000,
14644       "Max antennae station can support when uncompressed Beamforming feedback required", HFILL }},
14645
14646     {&hf_ieee80211_txbf_comp_sm_bf_ant,
14647      {"Max antennae STA can support when compressed Beamforming feedback required", "wlan_mgt.txbf.fm.compressed.maxant",
14648       FT_UINT32, BASE_HEX, VALS (&txbf_antenna_flags), 0x01800000,
14649       "Max antennae station can support when compressed Beamforming feedback required", HFILL }},
14650
14651     {&hf_ieee80211_txbf_csi_max_rows_bf,
14652      {"Maximum number of rows of CSI explicit feedback", "wlan_mgt.txbf.csi.maxrows",
14653       FT_UINT32, BASE_HEX, VALS (&txbf_csi_max_rows_bf_flags), 0x06000000,
14654       NULL, HFILL }},
14655
14656     {&hf_ieee80211_txbf_chan_est,
14657      {"Maximum number of space time streams for which channel dimensions can be simultaneously estimated", "wlan_mgt.txbf.channelest",
14658       FT_UINT32, BASE_HEX, VALS (&txbf_chan_est_flags), 0x18000000,
14659       NULL, HFILL }},
14660
14661     {&hf_ieee80211_txbf_resrv,
14662      {"Reserved", "wlan_mgt.txbf.reserved",
14663       FT_UINT32, BASE_HEX, NULL, 0xe0000000,
14664       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_UINT8, BASE_HEX, 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_UINT8, BASE_DEC, 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, BASE_NONE, 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, BASE_NONE, 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  */