more ephemeral memory cleanup
[metze/wireshark/wip.git] / epan / dissectors / packet-ieee80211.c
1 /* packet-ieee80211.c
2  * Routines for Wireless LAN (IEEE 802.11) dissection
3  * Copyright 2000, Axis Communications AB
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * Credits:
26  *
27  * The following people helped me by pointing out bugs etc. Thank you!
28  *
29  * Marco Molteni
30  * Lena-Marie Nilsson
31  * Magnus Hultman-Persson
32  */
33
34 /*
35  * 09/12/2003 - Added dissection of country information tag
36  *
37  * Ritchie<at>tipsybottle.com
38  *
39  * 03/22/2004 - Added dissection of RSN IE
40  * Jouni Malinen <jkmaline@cc.hut.fi>
41  *
42  * 10/24/2005 - Add dissection for 802.11e
43  * Zhu Yi <yi.zhu@intel.com>
44  *
45  * Dutin Johnson - 802.11n and portions of 802.11k and 802.11ma
46  * dustin@dustinj.us & dustin.johnson@cacetech.com
47  *
48  * 01/31/2008 - Added dissection of 802.11s
49  * Javier Cardona <javier@cozybit.com>
50  *
51  * 04/21/2008 - Added dissection for 802.11p
52  * Arada Systems <http://www.aradasystems.com>
53  *
54  * 05/29/2011 - UATification of decryption keys
55  * Michael Mann <mmann78@netscape.net>
56  *
57  * 07/30/2011 - Update 802.11s packet dissecting to the ratified standard (v12.0)
58  * Brian Cavagnolo <brian@cozybit.com>
59  *
60  * Enhance 802.11 dissector by Alexis La Goutte
61  */
62
63 /*
64  * Reference :
65  * The 802.11 standard is "free", 6 month after the publication.
66  *
67  * IEEE Std 802.11-2007: Revision of IEEE Std 802.11-199
68  * include 8 amendments (802.11a,b,d,e,g,h,i,j)
69  * http://standards.ieee.org/getieee802/download/802.11-2007.pdf
70  *
71  * IEEE Std 802.11k-2008: Radio Resource Measurement of Wireless LANs
72  * http://standards.ieee.org/getieee802/download/802.11k-2008.pdf
73  *
74  * IEEE Std 802.11r-2008: Fast Basic Service Set (BSS) Transition
75  * http://standards.ieee.org/getieee802/download/802.11r-2008.pdf
76  *
77  * IEEE Std 802.11y-2008: 3650-3700 MHz Operation in USA
78  * http://standards.ieee.org/getieee802/download/802.11y-2008.pdf
79  *
80  * IEEE Std 802.11w-2009: Protected Management Frames
81  * http://standards.ieee.org/getieee802/download/802.11w-2009.pdf
82  *
83  * IEEE Std 802.11n-2009: Enhancements for Higher Throughput
84  * http://standards.ieee.org/getieee802/download/802.11n-2009.pdf
85  *
86  * IEEE Std 802.11p-2010: Wireless Access in Vehicular Environments
87  * http://standards.ieee.org/getieee802/download/802.11p-2010.pdf
88  *
89  * IEEE Std 802.11z-2010: Extensions to Direct-Link Setup (DLS)
90  * http://standards.ieee.org/getieee802/download/802.11z-2010.pdf
91  */
92
93
94 #ifdef HAVE_CONFIG_H
95 # include "config.h"
96 #endif
97
98 #include <string.h>
99 #include <math.h>
100
101 #include <glib.h>
102
103 #include <epan/packet.h>
104 #include <epan/bitswap.h>
105 #include <epan/addr_resolv.h>
106 #include <epan/strutil.h>
107 #include <epan/prefs.h>
108 #include <epan/reassemble.h>
109 #include "packet-ipx.h"
110 #include "packet-llc.h"
111 #include "packet-ieee80211.h"
112 #include <epan/etypes.h>
113 #include <epan/greproto.h>
114 #include <epan/oui.h>
115 #include <wsutil/crc32.h>
116 #include <epan/crc32-tvb.h>
117 #include <epan/tap.h>
118 #include <epan/emem.h>
119 #include <epan/crypt/wep-wpadefs.h>
120 #include <epan/expert.h>
121 #include <epan/uat.h>
122
123 #include "packet-wps.h"
124 #include "packet-wifi-p2p.h"
125
126 /*     Davide Schiera (2006-11-22): including AirPDcap project                */
127 #include <epan/crypt/airpdcap_ws.h>
128 /* Davide Schiera (2006-11-22) ---------------------------------------------- */
129
130 extern const value_string eap_type_vals[]; /* from packet-eap.c */
131
132 #ifndef roundup2
133 #define roundup2(x, y)  (((x)+((y)-1))&(~((y)-1)))  /* if y is powers of two */
134 #endif
135
136 /* Defragment fragmented 802.11 datagrams */
137 static gboolean wlan_defragment = TRUE;
138
139 /* call subdissector for retransmitted frames */
140 static gboolean wlan_subdissector = TRUE;
141
142 /* Check for the presence of the 802.11 FCS */
143 static gboolean wlan_check_fcs = FALSE;
144
145 /* Ignore vendor-specific HT elements */
146 static gboolean wlan_ignore_draft_ht = FALSE;
147
148 /* Ignore the WEP bit; assume packet is decrypted */
149 #define WLAN_IGNORE_WEP_NO     0
150 #define WLAN_IGNORE_WEP_WO_IV  1
151 #define WLAN_IGNORE_WEP_W_IV   2
152 static gint wlan_ignore_wep = WLAN_IGNORE_WEP_NO;
153
154 /* Tables for reassembly of fragments. */
155 static GHashTable *wlan_fragment_table = NULL;
156 static GHashTable *wlan_reassembled_table = NULL;
157
158 /* Statistical data */
159 static struct _wlan_stats wlan_stats;
160
161 /*-------------------------------------
162  * UAT for WEP decoder
163  *-------------------------------------
164  */
165 /* UAT entry structure. */
166 typedef struct {
167     guint8    key;
168     gchar    *string;
169 } uat_wep_key_record_t;
170
171 static uat_wep_key_record_t *uat_wep_key_records = NULL;
172 static uat_t * wep_uat = NULL;
173 static guint num_wepkeys_uat = 0;
174
175 static void* uat_wep_key_record_copy_cb(void* n, const void* o, size_t siz _U_) {
176     uat_wep_key_record_t* new_key = (uat_wep_key_record_t *)n;
177     const uat_wep_key_record_t* old_key = (const uat_wep_key_record_t *)o;
178
179     if (old_key->string) {
180         new_key->string = g_strdup(old_key->string);
181     } else {
182         new_key->string = NULL;
183     }
184
185     return new_key;
186 }
187
188 static void uat_wep_key_record_update_cb(void* r, const char** err) {
189     uat_wep_key_record_t* rec = (uat_wep_key_record_t *)r;
190     decryption_key_t* dk;
191
192     if (rec->string == NULL) {
193          *err = ep_strdup_printf("Key can't be blank");
194     } else {
195         g_strstrip(rec->string);
196         dk = parse_key_string(rec->string, rec->key);
197
198         if(dk != NULL) {
199            switch(dk->type) {
200               case AIRPDCAP_KEY_TYPE_WEP:
201               case AIRPDCAP_KEY_TYPE_WEP_40:
202               case AIRPDCAP_KEY_TYPE_WEP_104:
203                  if (rec->key != AIRPDCAP_KEY_TYPE_WEP) {
204                     *err = ep_strdup_printf("Invalid key format");
205                  }
206                  break;
207               case AIRPDCAP_KEY_TYPE_WPA_PWD:
208                  if (rec->key != AIRPDCAP_KEY_TYPE_WPA_PWD) {
209                     *err = ep_strdup_printf("Invalid key format");
210                  }
211                  break;
212               case AIRPDCAP_KEY_TYPE_WPA_PSK:
213                  if (rec->key != AIRPDCAP_KEY_TYPE_WPA_PSK) {
214                     *err = ep_strdup_printf("Invalid key format");
215                  }
216                  break;
217               default:
218                  *err = ep_strdup_printf("Invalid key format");
219                  break;
220            }
221         } else {
222            *err = ep_strdup_printf("Invalid key format");
223         }
224     }
225 }
226
227 static void uat_wep_key_record_free_cb(void*r) {
228     uat_wep_key_record_t* key = (uat_wep_key_record_t *)r;
229
230     if (key->string) g_free(key->string);
231 }
232
233 UAT_VS_DEF(uat_wep_key_records, key, uat_wep_key_record_t, 0, STRING_KEY_TYPE_WEP)
234 UAT_CSTRING_CB_DEF(uat_wep_key_records, string, uat_wep_key_record_t)
235
236 /* Stuff for the WEP decoder */
237 static gboolean enable_decryption = FALSE;
238 static void init_wepkeys(void);
239
240 /* Davide Schiera (2006-11-26): created function to decrypt WEP and WPA/WPA2  */
241 static tvbuff_t *try_decrypt(tvbuff_t *tvb, guint32 offset, guint32 len, guint8 *algorithm, guint32 *sec_header, guint32 *sec_trailer);
242
243 static int weak_iv(guchar *iv);
244 #define SSWAP(a,b) {guint8 tmp = s[a]; s[a] = s[b]; s[b] = tmp;}
245
246 typedef struct mimo_control
247   {
248     guint8 nc;
249     guint8 nr;
250     gboolean chan_width;
251     guint8 grouping;
252     guint8 coefficient_size;
253     guint8 codebook_info;
254     guint8 remaining_matrix_segment;
255   } mimo_control_t;
256
257 mimo_control_t get_mimo_control (tvbuff_t *tvb, int offset);
258 int add_mimo_csi_matrices_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl);
259 int add_mimo_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl);
260 int add_mimo_compressed_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl);
261
262 /* ************************************************************************* */
263 /*                          Miscellaneous Constants                          */
264 /* ************************************************************************* */
265 #define SHORT_STR 256
266
267 /* ************************************************************************* */
268 /*  Define some very useful macros that are used to analyze frame types etc. */
269 /* ************************************************************************* */
270
271 /*
272  * Fetch the frame control field and swap it if needed.  "fcf" and "tvb"
273  * must be valid variables.
274  */
275 #define FETCH_FCF(off) (wlan_broken_fc ? \
276   BSWAP16(tvb_get_letohs(tvb, off)) : \
277   tvb_get_letohs(tvb, off))
278
279 /*
280  * Extract the protocol version from the frame control field
281  */
282 #define FCF_PROT_VERSION(x)  ((x) & 0x3)
283
284 /*
285  * Extract the frame type from the frame control field.
286  */
287 #define FCF_FRAME_TYPE(x)    (((x) & 0xC) >> 2)
288
289 /*
290  * Extract the frame subtype from the frame control field.
291  */
292 #define FCF_FRAME_SUBTYPE(x) (((x) & 0xF0) >> 4)
293
294 /*
295  * Convert the frame type and subtype from the frame control field into
296  * one of the MGT_, CTRL_, or DATA_ values.
297  */
298 #define COMPOSE_FRAME_TYPE(x) (((x & 0x0C)<< 2)+FCF_FRAME_SUBTYPE(x))  /* Create key to (sub)type */
299
300 /*
301  * The subtype field of a data frame is, in effect, composed of 4 flag
302  * bits - CF-Ack, CF-Poll, Null (means the frame doesn't actually have
303  * any data), and QoS.
304  */
305 #define DATA_FRAME_IS_CF_ACK(x)  ((x) & 0x01)
306 #define DATA_FRAME_IS_CF_POLL(x) ((x) & 0x02)
307 #define DATA_FRAME_IS_NULL(x)    ((x) & 0x04)
308 #define DATA_FRAME_IS_QOS(x)     ((x) & 0x08)
309
310 /*
311  * Extract the flags from the frame control field.
312  */
313 #define FCF_FLAGS(x)           (((x) & 0xFF00) >> 8)
314
315 /*
316  * Bits from the flags field.
317  */
318 #define FLAG_TO_DS            0x01
319 #define FLAG_FROM_DS          0x02
320 #define FLAG_MORE_FRAGMENTS   0x04
321 #define FLAG_RETRY            0x08
322 #define FLAG_POWER_MGT        0x10
323 #define FLAG_MORE_DATA        0x20
324 #define FLAG_PROTECTED        0x40
325 #define FLAG_ORDER            0x80
326
327 /*
328  * Test bits in the flags field.
329  */
330 /*
331  * XXX - Only HAVE_FRAGMENTS, IS_PROTECTED, and IS_STRICTLY_ORDERED
332  * are in use.  Should the rest be removed?
333  */
334 #define IS_TO_DS(x)            ((x) & FLAG_TO_DS)
335 #define IS_FROM_DS(x)          ((x) & FLAG_FROM_DS)
336 #define HAVE_FRAGMENTS(x)      ((x) & FLAG_MORE_FRAGMENTS)
337 #define IS_RETRY(x)            ((x) & FLAG_RETRY)
338 #define POWER_MGT_STATUS(x)    ((x) & FLAG_POWER_MGT)
339 #define HAS_MORE_DATA(x)       ((x) & FLAG_MORE_DATA)
340 #define IS_PROTECTED(x)        ((x) & FLAG_PROTECTED)
341 #define IS_STRICTLY_ORDERED(x) ((x) & FLAG_ORDER)
342
343 /*
344  * Extract subfields from the flags field.
345  */
346 #define FLAGS_DS_STATUS(x)          ((x) & (FLAG_FROM_DS|FLAG_TO_DS))
347
348 /*
349  * Extract an indication of the types of addresses in a data frame from
350  * the frame control field.
351  */
352 #define FCF_ADDR_SELECTOR(x) ((x) & ((FLAG_TO_DS|FLAG_FROM_DS) << 8))
353
354 #define DATA_ADDR_T1         0
355 #define DATA_ADDR_T2         (FLAG_FROM_DS << 8)
356 #define DATA_ADDR_T3         (FLAG_TO_DS << 8)
357 #define DATA_ADDR_T4         ((FLAG_TO_DS|FLAG_FROM_DS) << 8)
358
359 /*
360  * Extract the fragment number and sequence number from the sequence
361  * control field.
362  */
363 #define SEQCTL_FRAGMENT_NUMBER(x) ((x) & 0x000F)
364 #define SEQCTL_SEQUENCE_NUMBER(x) (((x) & 0xFFF0) >> 4)
365
366 /*
367  * Extract subfields from the QoS control field.
368  */
369 #define QOS_TID(x)            ((x) & 0x000F)
370 #define QOS_PRIORITY(x)       ((x) & 0x0007)
371 #define QOS_EOSP(x)           (((x) & 0x0010) >> 4) /* end of service period */
372 #define QOS_ACK_POLICY(x)     (((x) & 0x0060) >> 5)
373 #define QOS_AMSDU_PRESENT(x)  (((x) & 0x0080) >> 6)
374 #define QOS_FIELD_CONTENT(x)  (((x) & 0xFF00) >> 8)
375 #define QOS_MESH_CONTROL_PRESENT(x) (((x) & 0x0100) >> 8)
376
377 #define QOS_FLAG_EOSP    0x10
378
379 /*
380  * Extract subfields from the result of QOS_FIELD_CONTENT().
381  */
382 #define QOS_PS_BUF_STATE_INDICATED(x)  (((x) & 0x02) >> 1)
383 #define QOS_PS_HIGHEST_PRI_BUF_AC(x)   (((x) & 0x0C) >> 2)
384 #define QOS_PS_QAP_BUF_LOAD(x)         (((x) & 0xF0) >> 4)
385
386 /*
387  * Extract subfields from the HT Control field.
388  * .11n D-1.10 & D-2.0, 7.1.3.5a, 32 bits.
389  */
390 #define HTC_LAC(htc)           ((htc) & 0xFF)
391 #define HTC_LAC_MAI(htc)       (((htc) >> 2) & 0xF)
392 #define HTC_IS_ASELI(htc)      (HTC_LAC_MAI(htc) == 0xE)
393 #define HTC_LAC_MAI_MRQ(htc)   ((HTC_LAC_MAI(htc))  & 0x1)
394 #define HTC_LAC_MAI_MSI(htc)   ((HTC_LAC_MAI(htc) >> 1) & 0x7)
395 #define HTC_LAC_MFSI(htc)      (((htc) >> 4) & 0x7)
396 #define HTC_LAC_ASEL_CMD(htc)  (((htc) >> 9) & 0x7)
397 #define HTC_LAC_ASEL_DATA(htc) (((htc) >> 12) & 0xF)
398 #define HTC_LAC_MFB(htc)       (((htc) >> 9) & 0x7F)
399 #define HTC_CAL_POS(htc)       (((htc) >> 16) & 0x3)
400 #define HTC_CAL_SEQ(htc)       (((htc) >> 18) & 0x3)
401 #define HTC_CSI_STEERING(htc)  (((htc) >> 22) & 0x3)
402 #define HTC_NDP_ANN(htc)       (((htc) >> 24) & 0x1)
403 #define HTC_AC_CONSTRAINT(htc) (((htc) >> 30) & 0x1)
404 #define HTC_RDG_MORE_PPDU(htc) (((htc) >> 31) & 0x1)
405
406 /*
407  * Extract subfields from the key octet in WEP-encrypted frames.
408  */
409 #define KEY_OCTET_WEP_KEY(x)   (((x) & 0xC0) >> 6)
410
411 #define KEY_EXTIV    0x20
412 #define EXTIV_LEN    8
413
414 /*
415  * Bits from the Mesh Flags field
416  */
417 #define MESH_FLAGS_ADDRESS_EXTENSION  0x3
418
419 /* ************************************************************************* */
420 /*              Constants used to identify cooked frame types                */
421 /* ************************************************************************* */
422 #define MGT_FRAME            0x00  /* Frame type is management */
423 #define CONTROL_FRAME        0x01  /* Frame type is control */
424 #define DATA_FRAME           0x02  /* Frame type is Data */
425
426 #define DATA_SHORT_HDR_LEN     24
427 #define DATA_LONG_HDR_LEN      30
428 #define MGT_FRAME_HDR_LEN      24  /* Length of Management frame-headers */
429
430 /*
431  * COMPOSE_FRAME_TYPE() values for management frames.
432  */
433 #define MGT_ASSOC_REQ          0x00  /* association request        */
434 #define MGT_ASSOC_RESP         0x01  /* association response       */
435 #define MGT_REASSOC_REQ        0x02  /* reassociation request      */
436 #define MGT_REASSOC_RESP       0x03  /* reassociation response     */
437 #define MGT_PROBE_REQ          0x04  /* Probe request              */
438 #define MGT_PROBE_RESP         0x05  /* Probe response             */
439 #define MGT_MEASUREMENT_PILOT  0x06  /* Measurement Pilot          */
440 #define MGT_BEACON             0x08  /* Beacon frame               */
441 #define MGT_ATIM               0x09  /* ATIM                       */
442 #define MGT_DISASS             0x0A  /* Disassociation             */
443 #define MGT_AUTHENTICATION     0x0B  /* Authentication             */
444 #define MGT_DEAUTHENTICATION   0x0C  /* Deauthentication           */
445 #define MGT_ACTION             0x0D  /* Action                     */
446 #define MGT_ACTION_NO_ACK      0x0E  /* Action No Ack              */
447 #define MGT_ARUBA_WLAN         0x0F  /* Aruba WLAN Specific        */
448
449 /*
450  * COMPOSE_FRAME_TYPE() values for control frames.
451  */
452 #define CTRL_CONTROL_WRAPPER 0x17  /* Control Wrapper        */
453 #define CTRL_BLOCK_ACK_REQ   0x18  /* Block ack Request        */
454 #define CTRL_BLOCK_ACK       0x19  /* Block ack          */
455 #define CTRL_PS_POLL         0x1A  /* power-save poll               */
456 #define CTRL_RTS             0x1B  /* request to send               */
457 #define CTRL_CTS             0x1C  /* clear to send                 */
458 #define CTRL_ACKNOWLEDGEMENT 0x1D  /* acknowledgement               */
459 #define CTRL_CFP_END         0x1E  /* contention-free period end    */
460 #define CTRL_CFP_ENDACK      0x1F  /* contention-free period end/ack */
461
462 /*
463  * COMPOSE_FRAME_TYPE() values for data frames.
464  */
465 #define DATA                        0x20  /* Data                       */
466 #define DATA_CF_ACK                 0x21  /* Data + CF-Ack              */
467 #define DATA_CF_POLL                0x22  /* Data + CF-Poll             */
468 #define DATA_CF_ACK_POLL            0x23  /* Data + CF-Ack + CF-Poll    */
469 #define DATA_NULL_FUNCTION          0x24  /* Null function (no data)    */
470 #define DATA_CF_ACK_NOD             0x25  /* CF-Ack (no data)           */
471 #define DATA_CF_POLL_NOD            0x26  /* CF-Poll (No data)          */
472 #define DATA_CF_ACK_POLL_NOD        0x27  /* CF-Ack + CF-Poll (no data) */
473
474 #define DATA_QOS_DATA               0x28  /* QoS Data                   */
475 #define DATA_QOS_DATA_CF_ACK        0x29  /* QoS Data + CF-Ack        */
476 #define DATA_QOS_DATA_CF_POLL       0x2A  /* QoS Data + CF-Poll      */
477 #define DATA_QOS_DATA_CF_ACK_POLL   0x2B  /* QoS Data + CF-Ack + CF-Poll    */
478 #define DATA_QOS_NULL               0x2C  /* QoS Null        */
479 #define DATA_QOS_CF_POLL_NOD        0x2E  /* QoS CF-Poll (No Data)      */
480 #define DATA_QOS_CF_ACK_POLL_NOD    0x2F  /* QoS CF-Ack + CF-Poll (No Data) */
481
482
483 /* ************************************************************************* */
484 /*        Logical field codes (dissector's encoding of fixed fields)         */
485 /* ************************************************************************* */
486 enum fixed_field {
487   FIELD_TIMESTAMP, /* 64-bit timestamp */
488   FIELD_BEACON_INTERVAL, /* 16-bit beacon interval */
489   FIELD_CAP_INFO, /* Add capability information tree */
490   FIELD_AUTH_ALG, /* Authentication algorithm used */
491   FIELD_AUTH_TRANS_SEQ, /* Authentication sequence number */
492   FIELD_CURRENT_AP_ADDR,
493   FIELD_LISTEN_IVAL,
494   FIELD_REASON_CODE,
495   FIELD_ASSOC_ID,
496   FIELD_STATUS_CODE,
497   FIELD_CATEGORY_CODE, /* Management action category */
498   FIELD_ACTION_CODE, /* Management action code */
499   FIELD_DIALOG_TOKEN, /* Management action dialog token */
500   FIELD_WME_ACTION_CODE, /* Management notification action code */
501   FIELD_WME_DIALOG_TOKEN, /* Management notification dialog token */
502   FIELD_WME_STATUS_CODE, /* Management notification setup response status code
503                           */
504   FIELD_QOS_ACTION_CODE,
505   FIELD_QOS_TS_INFO,
506   FIELD_DLS_ACTION_CODE,
507   FIELD_DST_MAC_ADDR, /* DLS destination MAC address */
508   FIELD_SRC_MAC_ADDR, /* DLS source MAC address */
509   FIELD_DLS_TIMEOUT, /* DLS timeout value */
510   FIELD_SCHEDULE_INFO, /* Schedule Info field */
511   FIELD_ACTION, /* Action field */
512   FIELD_BLOCK_ACK_ACTION_CODE,
513   FIELD_QOS_INFO_AP,
514   FIELD_QOS_INFO_STA,
515   FIELD_BLOCK_ACK_PARAM,
516   FIELD_BLOCK_ACK_TIMEOUT,
517   FIELD_BLOCK_ACK_SSC,
518   FIELD_DELBA_PARAM_SET,
519   FIELD_MAX_REG_PWR,
520   FIELD_MEASUREMENT_PILOT_INT,
521   FIELD_COUNTRY_STR,
522   FIELD_MAX_TX_PWR,
523   FIELD_TX_PWR_USED,
524   FIELD_TRANSCEIVER_NOISE_FLOOR,
525   FIELD_DS_PARAM_SET,
526   FIELD_CHANNEL_WIDTH,
527   FIELD_SM_PWR_CNTRL,
528   FIELD_PCO_PHASE_CNTRL,
529   FIELD_PSMP_PARAM_SET,
530   FIELD_PSMP_STA_INFO,
531   FIELD_MIMO_CNTRL,
532   FIELD_ANT_SELECTION,
533   FIELD_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT,
534   FIELD_HT_INFORMATION,
535   FIELD_HT_ACTION_CODE,
536   FIELD_PA_ACTION_CODE,
537   FIELD_FT_ACTION_CODE,
538   FIELD_STA_ADDRESS,
539   FIELD_TARGET_AP_ADDRESS,
540   FIELD_GAS_COMEBACK_DELAY,
541   FIELD_GAS_FRAGMENT_ID,
542   FIELD_SA_QUERY_ACTION_CODE,
543   FIELD_TRANSACTION_ID,
544   FIELD_TDLS_ACTION_CODE,
545   FIELD_TARGET_CHANNEL,
546   FIELD_REGULATORY_CLASS,
547   FIELD_MESH_ACTION,
548   FIELD_MULTIHOP_ACTION,
549   FIELD_MESH_CONTROL,
550   FIELD_SELFPROT_ACTION,
551   FIELD_WNM_ACTION_CODE,
552   /* add any new fixed field value above this line */
553   MAX_FIELD_NUM
554 };
555
556 /* ************************************************************************* */
557 /*        Logical field codes (IEEE 802.11 encoding of tags)                 */
558 /* ************************************************************************* */
559 #define TAG_SSID                     0
560 #define TAG_SUPP_RATES               1
561 #define TAG_FH_PARAMETER             2
562 #define TAG_DS_PARAMETER             3
563 #define TAG_CF_PARAMETER             4
564 #define TAG_TIM                      5
565 #define TAG_IBSS_PARAMETER           6
566 #define TAG_COUNTRY_INFO             7
567 #define TAG_FH_HOPPING_PARAMETER     8
568 #define TAG_FH_HOPPING_TABLE         9
569 #define TAG_REQUEST                  10
570 #define TAG_QBSS_LOAD                11
571 #define TAG_EDCA_PARAM_SET           12
572 #define TAG_TSPEC                    13
573 #define TAG_TCLAS                    14
574 #define TAG_SCHEDULE                 15
575 #define TAG_CHALLENGE_TEXT           16
576
577 #define TAG_POWER_CONSTRAINT         32
578 #define TAG_POWER_CAPABILITY         33
579 #define TAG_TPC_REQUEST              34
580 #define TAG_TPC_REPORT               35
581 #define TAG_SUPPORTED_CHANNELS       36
582 #define TAG_CHANNEL_SWITCH_ANN       37
583 #define TAG_MEASURE_REQ              38
584 #define TAG_MEASURE_REP              39
585 #define TAG_QUIET                    40
586 #define TAG_IBSS_DFS                 41
587 #define TAG_ERP_INFO                 42
588 #define TAG_TS_DELAY                 43
589 #define TAG_TCLAS_PROCESS            44
590 #define TAG_HT_CAPABILITY            45  /* IEEE Stc 802.11n/D2.0 */
591 #define TAG_QOS_CAPABILITY           46
592 #define TAG_ERP_INFO_OLD             47  /* IEEE Std 802.11g/D4.0 */
593 #define TAG_RSN_IE                   48
594 /* Reserved 49 */
595 #define TAG_EXT_SUPP_RATES           50
596 #define TAG_AP_CHANNEL_REPORT        51
597 #define TAG_NEIGHBOR_REPORT          52
598 #define TAG_RCPI                     53
599 #define TAG_MOBILITY_DOMAIN          54   /* IEEE Std 802.11r-2008 */
600 #define TAG_FAST_BSS_TRANSITION      55   /* IEEE Std 802.11r-2008 */
601 #define TAG_TIMEOUT_INTERVAL         56   /* IEEE Std 802.11r-2008 */
602 #define TAG_RIC_DATA                 57   /* IEEE Std 802.11r-2008 */
603 /* 58 ??? */
604 #define TAG_SUPPORTED_REGULATORY_CLASSES            59 /* IEEE Std 802.11w-2009 */
605 #define TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT    60 /* IEEE Std 802.11w-2009 */
606 #define TAG_HT_INFO                  61   /* IEEE Stc 802.11n/D2.0 */
607 #define TAG_SECONDARY_CHANNEL_OFFSET 62   /* IEEE Stc 802.11n/D1.10/D2.0 */
608 #define TAG_TIME_ADV                 69   /* IEEE Std 802.11p-2010 */
609 #define TAG_20_40_BSS_CO_EX          72   /* IEEE P802.11n/D6.0 */
610 #define TAG_20_40_BSS_INTOL_CH_REP   73   /* IEEE P802.11n/D6.0 */
611 #define TAG_OVERLAP_BSS_SCAN_PAR     74   /* IEEE P802.11n/D6.0 */
612 #define TAG_RIC_DESCRIPTOR           75   /* IEEE Std 802.11r-2008 */
613 #define TAG_MMIE                     76   /* IEEE Std 802.11w-2009 */
614 #define TAG_TIME_ZONE                98   /* IEEE STd 802.11v-2011 */
615 #define TAG_LINK_IDENTIFIER          101  /* IEEE Std 802.11z-2010 */
616 #define TAG_WAKEUP_SCHEDULE          102  /* IEEE Std 802.11z-2010 */
617 #define TAG_CHANNEL_SWITCH_TIMING    104  /* IEEE Std 802.11z-2010 */
618 #define TAG_PTI_CONTROL              105  /* IEEE Std 802.11z-2010 */
619 #define TAG_PU_BUFFER_STATUS         106  /* IEEE Std 802.11z-2010 */
620 #define TAG_INTERWORKING             107  /* IEEE Std 802.11u-2011 */
621 #define TAG_ADVERTISEMENT_PROTOCOL   108  /* IEEE Std 802.11u-2011 */
622 #define TAG_EXPIDITED_BANDWIDTH_REQ  109  /* IEEE Std 802.11u-2011 */
623 #define TAG_QOS_MAP_SET              110  /* IEEE Std 802.11u-2011 */
624 #define TAG_ROAMING_CONSORTIUM       111  /* IEEE Std 802.11u-2011 */
625 #define TAG_EMERGENCY_ALERT_ID       112  /* IEEE Std 802.11u-2011 */
626 #define TAG_MESH_CONFIGURATION       113  /* IEEE Std 802.11s-2011 */
627 #define TAG_MESH_ID                  114  /* IEEE Std 802.11s-2011 */
628 #define TAG_MESH_PEERING_MGMT        117  /* IEEE Std 802.11s-2011 */
629 #define TAG_RANN                     126  /* IEEE Std 802.11s-2011 */
630 #define TAG_EXTENDED_CAPABILITIES    127  /* IEEE Stc 802.11n/D1.10/D2.0 */
631 #define TAG_AGERE_PROPRIETARY        128
632 #define TAG_MESH_PREQ                130  /* IEEE Std 802.11s-2011 */
633 #define TAG_MESH_PREP                131  /* IEEE Std 802.11s-2011 */
634 #define TAG_MESH_PERR                132  /* IEEE Std 802.11s-2011 */
635 #define TAG_CISCO_CCX1_CKIP          133  /* Cisco Compatible eXtensions */
636 #define TAG_CISCO_UNKNOWN_88         136  /* Cisco Compatible eXtensions? */
637 #define TAG_CISCO_UNKNOWN_95         149  /* Cisco Compatible eXtensions */
638 #define TAG_CISCO_UNKNOWN_96         150  /* Cisco Compatible eXtensions */
639 #define TAG_SYMBOL_PROPRIETARY       173
640 #define TAG_VENDOR_SPECIFIC_IE       221
641
642 static const value_string tag_num_vals[] = {
643   { TAG_SSID, "SSID parameter set" },
644   { TAG_SUPP_RATES, "Supported Rates" },
645   { TAG_FH_PARAMETER, "FH Parameter set" },
646   { TAG_DS_PARAMETER, "DS Parameter set" },
647   { TAG_CF_PARAMETER, "CF Parameter set" },
648   { TAG_TIM, "Traffic Indication Map (TIM)" },
649   { TAG_IBSS_PARAMETER, "IBSS Parameter set" },
650   { TAG_COUNTRY_INFO, "Country Information" },
651   { TAG_FH_HOPPING_PARAMETER, "Hopping Pattern Parameters" },
652   { TAG_FH_HOPPING_TABLE, "Hopping Pattern Table" },
653   { TAG_REQUEST, "Request" },
654   { TAG_QBSS_LOAD, "QBSS Load Element" },
655   { TAG_EDCA_PARAM_SET, "EDCA Parameter Set" },
656   { TAG_TSPEC, "Traffic Specification" },
657   { TAG_TCLAS, "Traffic Classification" },
658   { TAG_SCHEDULE, "Schedule" },
659   { TAG_CHALLENGE_TEXT, "Challenge text" },
660   { TAG_POWER_CONSTRAINT, "Power Constraint" },
661   { TAG_POWER_CAPABILITY, "Power Capability" },
662   { TAG_TPC_REQUEST, "TPC Request" },
663   { TAG_TPC_REPORT, "TPC Report" },
664   { TAG_SUPPORTED_CHANNELS, "Supported Channels" },
665   { TAG_CHANNEL_SWITCH_ANN, "Channel Switch Announcement" },
666   { TAG_MEASURE_REQ, "Measurement Request" },
667   { TAG_MEASURE_REP, "Measurement Report" },
668   { TAG_QUIET, "Quiet" },
669   { TAG_IBSS_DFS, "IBSS DFS" },
670   { TAG_ERP_INFO, "ERP Information" },
671   { TAG_TS_DELAY, "TS Delay" },
672   { TAG_TCLAS_PROCESS, "TCLAS Processing" },
673   { TAG_HT_CAPABILITY, "HT Capabilities (802.11n D1.10)" },
674   { TAG_QOS_CAPABILITY, "QoS Capability" },
675   { TAG_ERP_INFO_OLD, "ERP Information" }, /* Reserved... */
676   { TAG_RSN_IE, "RSN Information" },
677   { TAG_EXT_SUPP_RATES, "Extended Supported Rates" },
678   { TAG_AP_CHANNEL_REPORT, "AP Channel Report" },
679   { TAG_NEIGHBOR_REPORT, "Neighbor Report" },
680   { TAG_RCPI, "RCPI" },
681   { TAG_MOBILITY_DOMAIN, "Mobility Domain" },
682   { TAG_FAST_BSS_TRANSITION, "Fast BSS Transition" },
683   { TAG_TIMEOUT_INTERVAL, "Timeout Interval" },
684   { TAG_RIC_DATA, "RIC Data" },
685   { TAG_SUPPORTED_REGULATORY_CLASSES, "Supported Regulatory Classes" },
686   { TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT, "Extended Channel Switch Announcement" },
687   { TAG_HT_INFO, "HT Information (802.11n D1.10)" },
688   { TAG_SECONDARY_CHANNEL_OFFSET, "Secondary Channel Offset (802.11n D1.10)" },
689   { TAG_TIME_ADV, "Time Advertisement" },
690   { TAG_20_40_BSS_CO_EX, "20/40 BSS Coexistence" },
691   { TAG_20_40_BSS_INTOL_CH_REP, "20/40 BSS Intolerant Channel Report" },   /* IEEE P802.11n/D6.0 */
692   { TAG_OVERLAP_BSS_SCAN_PAR, "Overlapping BSS Scan Parameters" },       /* IEEE P802.11n/D6.0 */
693   { TAG_RIC_DESCRIPTOR, "RIC Descriptor" },
694   { TAG_MMIE, "Management MIC" },
695   { TAG_TIME_ZONE, "Time Zone" },
696   { TAG_LINK_IDENTIFIER, "Link Identifier" },
697   { TAG_WAKEUP_SCHEDULE, "Wakeup Schedule" },
698   { TAG_CHANNEL_SWITCH_TIMING, "Channel Switch Timing" },
699   { TAG_PTI_CONTROL, "PTI Control" },
700   { TAG_PU_BUFFER_STATUS, "PU Buffer Status" },
701   { TAG_INTERWORKING, "Interworking" },
702   { TAG_ADVERTISEMENT_PROTOCOL, "Advertisement Protocol"},
703   { TAG_EXPIDITED_BANDWIDTH_REQ, "Expedited Bandwidth Request" },
704   { TAG_QOS_MAP_SET, "QoS Map Set" },
705   { TAG_ROAMING_CONSORTIUM, "Roaming Consortium" },
706   { TAG_EMERGENCY_ALERT_ID, "Emergency Alert Identifier" },
707   { TAG_MESH_ID, "Mesh ID" },
708   { TAG_MESH_CONFIGURATION, "Mesh Configuration" },
709   { TAG_MESH_PEERING_MGMT, "Mesh Peering Management" },
710   { TAG_RANN, "Root Announcement" },
711   { TAG_EXTENDED_CAPABILITIES, "Extended Capabilities" },
712   { TAG_AGERE_PROPRIETARY, "Agere Proprietary" },
713   { TAG_MESH_PREQ, "Path Request" },
714   { TAG_MESH_PREP, "Path Reply" },
715   { TAG_MESH_PERR, "Path Error" },
716   { TAG_CISCO_CCX1_CKIP, "Cisco CCX1 CKIP + Device Name" },
717   { TAG_CISCO_UNKNOWN_88, "Cisco Unknown 88" },
718   { TAG_CISCO_UNKNOWN_95, "Cisco Unknown 95" },
719   { TAG_CISCO_UNKNOWN_96, "Cisco Unknown 96" },
720   { TAG_SYMBOL_PROPRIETARY, "Symbol Proprietary" },
721   { TAG_VENDOR_SPECIFIC_IE, "Vendor Specific" },
722   { 0, NULL }
723 };
724
725 #define WPA_OUI     (const guint8 *) "\x00\x50\xF2"
726 #define RSN_OUI     (const guint8 *) "\x00\x0F\xAC"
727 #define WME_OUI     (const guint8 *) "\x00\x50\xF2"
728 #define PRE_11N_OUI (const guint8 *) "\x00\x90\x4c" /* 802.11n pre 1 oui */
729 #define WFA_OUI     (const guint8 *) "\x50\x6f\x9a"
730
731 /* WFA vendor specific subtypes */
732 #define WFA_SUBTYPE_P2P 9
733
734 #define PMKID_LEN 16
735
736 /* ************************************************************************* */
737 /*              Supported Rates (7.3.2.2)                                    */
738 /* ************************************************************************* */
739
740 static const value_string ieee80211_supported_rates_vals[] = {
741   { 0x02, "1" },
742   { 0x03, "1.5" },
743   { 0x04, "2" },
744   { 0x05, "2.5" },
745   { 0x06, "3" },
746   { 0x09, "4.5" },
747   { 0x0B, "5.5" },
748   { 0x0C, "6" },
749   { 0x12, "9" },
750   { 0x16, "11" },
751   { 0x18, "12" },
752   { 0x1B, "13.5" },
753   { 0x24, "18" },
754   { 0x2C, "22" },
755   { 0x30, "24" },
756   { 0x36, "27" },
757   { 0x42, "33" },
758   { 0x48, "36" },
759   { 0x60, "48" },
760   { 0x6C, "54" },
761   { 0x82, "1(B)" },
762   { 0x83, "1.5(B)" },
763   { 0x84, "2(B)" },
764   { 0x85, "2.5(B)" },
765   { 0x86, "3(B)" },
766   { 0x89, "4.5(B)" },
767   { 0x8B, "5.5(B)" },
768   { 0x8C, "6(B)" },
769   { 0x92, "9(B)" },
770   { 0x96, "11(B)" },
771   { 0x98, "12(B)" },
772   { 0x9B, "13.5(B)" },
773   { 0xA4, "18(B)" },
774   { 0xAC, "22(B)" },
775   { 0xB0, "24(B)" },
776   { 0xB6, "27(B)" },
777   { 0xC2, "33(B)" },
778   { 0xC8, "36(B)" },
779   { 0xE0, "48(B)" },
780   { 0xEC, "54(B)" },
781   { 0xFF, "BSS requires support for mandatory features of HT PHY (IEEE 802.11 - Clause 20)" },
782   { 0,    NULL}
783 };
784 /* ************************************************************************* */
785 /*                         7.3.1.7 Reason Code field                         */
786 /* ************************************************************************* */
787 static const value_string ieee80211_reason_code[] = {
788   { 1, "Unspecified reason" },
789   { 2, "Previous authentication no longer valid" },
790   { 3, "Deauthenticated because sending STA is leaving (or has left) IBSS or ESS" },
791   { 4, "Disassociated due to inactivity" },
792   { 5, "Disassociated because AP is unable to handle all currently associated STAs" },
793   { 6, "Class 2 frame received from nonauthenticated STA" },
794   { 7, "Class 3 frame received from nonassociated STA" },
795   { 8, "Disassociated because sending STA is leaving (or has left) BSS" },
796   { 9, "STA requesting (re)association is not authenticated with responding STA" },
797   { 10, "Disassociated because the information in the Power Capability element is unacceptable" },
798   { 11, "Disassociated because the information in the Supported Channels element is unacceptable" },
799   { 12, "Reserved" },
800   { 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" },
801   { 14, "Message integrity code (MIC) failure" },
802   { 15, "4-Way Handshake timeout" },
803   { 16, "Group Key Handshake timeout" },
804   { 17, "Information element in 4-Way Handshake different from (Re)Association Request/Probe Response/Beacon frame" },
805   { 18, "Invalid group cipher" },
806   { 19, "Invalid pairwise cipher" },
807   { 20, "Invalid AKMP" },
808   { 21, "Unsupported RSN information element version" },
809   { 22, "Invalid RSN information element capabilities" },
810   { 23, "IEEE 802.1X authentication failed" },
811   { 24, "Cipher suite rejected because of the security policy" },
812   { 27, "Disassociated because session terminated by SSP request" },
813   { 28, "Disassociated because of lack of SSP roaming agreement" },
814   { 29, "Requested service rejected because of SSP cipher suite or AKM requirement " },
815   { 30, "Requested service not authorized in this location" },
816   { 31, "TS deleted because QoS AP lacks sufficient bandwidth for this QoS STA due to a change in BSS service characteristics or operational mode" },
817   { 32, "Disassociated for unspecified, QoS-related reason" },
818   { 33, "Disassociated because QoS AP lacks sufficient bandwidth for this QoS STA" },
819   { 34, "Disassociated because excessive number of frames need to be acknowledged, but are not acknowledged due to AP transmissions and/or poor channel conditions" },
820   { 35, "Disassociated because STA is transmitting outside the limits of its TXOPs" },
821   { 36, "Requested from peer STA as the STA is leaving the BSS (or resetting)" },
822   { 37, "Requested from peer STA as it does not want to use the mechanism" },
823   { 38, "Requested from peer STA as the STA received frames using the mechanism for which a setup is required" },
824   { 39, "Requested from peer STA due to timeout" },
825   { 45, "Peer STA does not support the requested cipher suite" },
826   { 46, "Disassociated because authorized access limit reached" },
827   { 47, "Disassociated due to external service requirements" },
828   { 52, "SME cancels the mesh peering instance with the reason other than reaching the maximum number of peer mesh STAs" },
829   { 53, "The mesh STA has reached the supported maximum number of peer mesh STAs" },
830   { 54, "The received information violates the Mesh Configuration policy configured in the mesh STA profile" },
831   { 55, "The mesh STA has received a Mesh Peering Close message requesting to close the mesh peering" },
832   { 56, "The mesh STA has re-sent dot11MeshMaxRetries Mesh Peering Open messages, without receiving a Mesh Peering Confirm message" },
833   { 57, "The confirmTimer for the mesh peering instance times out" },
834   { 58, "The mesh STA fails to unwrap the GTK or the values in the wrapped contents do not match" },
835   { 59, "The mesh STA receives inconsistent information about the mesh parameters between Mesh Peering Management frames" },
836   { 60, "The mesh STA fails the authenticated mesh peering exchange because due to failure in selecting either the pairwise ciphersuite or group ciphersuite" },
837   { 61, "The mesh STA does not have proxy information for this external destination" },
838   { 62, "The mesh STA does not have forwarding information for this destination" },
839   { 63, "The mesh STA determines that the link to the next hop of an active path in its forwarding information is no longer usable" },
840   { 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)" },
841   { 65, "The mesh STA performs channel switch to meet regulatory requirements" },
842   { 66, "The mesh STA performs channel switch with unspecified reason" },
843   { 0,    NULL}
844 };
845
846 /* ************************************************************************* */
847 /*                         7.3.1.9 Status Code field                         */
848 /* ************************************************************************* */
849 static const value_string ieee80211_status_code[] = {
850   { 0, "Successful" },
851   { 1, "Unspecified failure" },
852   { 2, "TDLS wakeup schedule rejected but alternative schedule provided" },
853   { 3, "TDLS wakeup schedule rejected" },
854   { 5, "Security disabled" },
855   { 6, "Unacceptable lifetime" },
856   { 7, "Not in same BSS" },
857   { 10, "Cannot support all requested capabilities in the Capability Information field" },
858   { 11, "Reassociation denied due to inability to confirm that association exists" },
859   { 12, "Association denied due to reason outside the scope of this standard" },
860   { 13, "Responding STA does not support the specified authentication algorithm" },
861   { 14, "Received an Authentication frame with authentication transaction sequence number out of expected sequence" },
862   { 15, "Authentication rejected because of challenge failure" },
863   { 16, "Authentication rejected due to timeout waiting for next frame in sequence" },
864   { 17, "Association denied because AP is unable to handle additional associated STAs" },
865   { 18, "Association denied due to requesting STA not supporting all of the data rates in the BSSBasicRateSet parameter" },
866   { 19, "Association denied due to requesting STA not supporting the short preamble option" },
867   { 20, "Association denied due to requesting STA not supporting the PBCC modulation option" },
868   { 21, "Association denied due to requesting STA not supporting the Channel Agility option" },
869   { 22, "Association request rejected because Spectrum Management capability is required" },
870   { 23, "Association request rejected because the information in the Power Capability element is unacceptable" },
871   { 24, "Association request rejected because the information in the Supported Channels element is unacceptable" },
872   { 25, "Association denied due to requesting STA not supporting the Short Slot Time option" },
873   { 26, "Association denied due to requesting STA not supporting the DSSS-OFDM option" },
874   { 27, "Reserved Association denied because the requesting STA does not support HT features" },
875   { 28, "R0KH unreachable" },
876   { 29, "Association denied because the requesting STA does not support the phased coexistence operation (PCO) transition time required by the AP" },
877   { 30, "Association request rejected temporarily; try again later" },
878   { 31, "Robust Management frame policy violation" },
879   { 32, "Unspecified, QoS-related failure" },
880   { 33, "Association denied because QoS AP has insufficient bandwidth to handle another QoS STA" },
881   { 34, "Association denied due to excessive frame loss rates and/or poor conditions on current operating channel" },
882   { 35, "Association (with QoS BSS) denied because the requesting STA does not support the QoS facility" },
883   { 36, "Reserved" },
884   { 37, "The request has been declined" },
885   { 38, "The request has not been successful as one or more parameters have invalid values" },
886   { 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" },
887   { 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" },
888   { 41, "Invalid group cipher" },
889   { 42, "Invalid pairwise cipher" },
890   { 43, "Invalid AKMP" },
891   { 44, "Unsupported RSN information element version" },
892   { 45, "Invalid RSN information element capabilities" },
893   { 46, "Cipher suite rejected because of security policy" },
894   { 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" },
895   { 48, "Direct link is not allowed in the BSS by policy" },
896   { 49, "The Destination STA is not present within this BSS" },
897   { 50, "The Destination STA is not a QoS STA" },
898   { 51, "Association denied because the ListenInterval is too large" },
899   { 52, "Invalid FT Action frame count" },
900   { 53, "Invalid pairwise master key identifier (PMKID)" },
901   { 54, "Invalid MDIE" },
902   { 55, "Invalid FTIE" },
903   { 59, "GAS Advertisement Protocol not supported" },
904   { 60, "No outstanding GAS request" },
905   { 61, "GAS Response not received from the Advertisement Server" },
906   { 62, "STA timed out waiting for GAS Query Response" },
907   { 63, "GAS Response is larger than query response length limit" },
908   { 64, "Request refused because home network does not support request" },
909   { 65, "Advertisement Server in the network is not currently reachable" },
910   { 67, "Request refused due to permissions received via SSPN interface" },
911   { 68, "Request refused because AP does not support unauthenticated access" },
912   { 72, "Invalid contents of RSNIE" },
913   { 76, "Authentication is rejected because an Anti-Clogging Token is required" },
914   { 77, "Authentication is rejected because the offered finite cyclic group is not supported" },
915   { 78, "The TBTT adjustment request has not been successful because the STA could not find an alternative TBTT" },
916   { 79, "Transmission failure" },
917   { 0,    NULL}
918 };
919
920 /* ************************************************************************* */
921 /*                         Frame types, and their names                      */
922 /* ************************************************************************* */
923 static const value_string frame_type_subtype_vals[] = {
924   {MGT_ASSOC_REQ,             "Association Request"},
925   {MGT_ASSOC_RESP,            "Association Response"},
926   {MGT_REASSOC_REQ,           "Reassociation Request"},
927   {MGT_REASSOC_RESP,          "Reassociation Response"},
928   {MGT_PROBE_REQ,             "Probe Request"},
929   {MGT_PROBE_RESP,            "Probe Response"},
930   {MGT_MEASUREMENT_PILOT,     "Measurement Pilot"},
931   {MGT_BEACON,                "Beacon frame"},
932   {MGT_ATIM,                  "ATIM"},
933   {MGT_DISASS,                "Disassociate"},
934   {MGT_AUTHENTICATION,        "Authentication"},
935   {MGT_DEAUTHENTICATION,      "Deauthentication"},
936   {MGT_ACTION,                "Action"},
937   {MGT_ACTION_NO_ACK,         "Action No Ack"},
938   {MGT_ARUBA_WLAN,            "Aruba Management"},
939
940   {CTRL_CONTROL_WRAPPER,      "Control Wrapper"},
941   {CTRL_BLOCK_ACK_REQ,        "802.11 Block Ack Req"},
942   {CTRL_BLOCK_ACK,            "802.11 Block Ack"},
943   {CTRL_PS_POLL,              "Power-Save poll"},
944   {CTRL_RTS,                  "Request-to-send"},
945   {CTRL_CTS,                  "Clear-to-send"},
946   {CTRL_ACKNOWLEDGEMENT,      "Acknowledgement"},
947   {CTRL_CFP_END,              "CF-End (Control-frame)"},
948   {CTRL_CFP_ENDACK,           "CF-End + CF-Ack (Control-frame)"},
949
950   {DATA,                      "Data"},
951   {DATA_CF_ACK,               "Data + CF-Ack"},
952   {DATA_CF_POLL,              "Data + CF-Poll"},
953   {DATA_CF_ACK_POLL,          "Data + CF-Ack + CF-Poll"},
954   {DATA_NULL_FUNCTION,        "Null function (No data)"},
955   {DATA_CF_ACK_NOD,           "Acknowledgement (No data)"},
956   {DATA_CF_POLL_NOD,          "CF-Poll (No data)"},
957   {DATA_CF_ACK_POLL_NOD,      "CF-Ack/Poll (No data)"},
958   {DATA_QOS_DATA,             "QoS Data"},
959   {DATA_QOS_DATA_CF_ACK,      "QoS Data + CF-Acknowledgment"},
960   {DATA_QOS_DATA_CF_POLL,     "QoS Data + CF-Poll"},
961   {DATA_QOS_DATA_CF_ACK_POLL, "QoS Data + CF-Ack + CF-Poll"},
962   {DATA_QOS_NULL,             "QoS Null function (No data)"},
963   {DATA_QOS_CF_POLL_NOD,      "QoS CF-Poll (No Data)"},
964   {DATA_QOS_CF_ACK_POLL_NOD,  "QoS CF-Ack + CF-Poll (No data)"},
965   {0,                         NULL}
966 };
967
968 /* ************************************************************************* */
969 /*                             802.1D Tag Names                              */
970 /* ************************************************************************* */
971 static const char *qos_tags[8] = {
972   "Best Effort",
973   "Background",
974   "Spare",
975   "Excellent Effort",
976   "Controlled Load",
977   "Video",
978   "Voice",
979   "Network Control"
980 };
981
982 /* ************************************************************************* */
983 /*                 WME Access Category Names (by 802.1D Tag)                 */
984 /* ************************************************************************* */
985 static const char *qos_acs[8] = {
986   "Best Effort",
987   "Background",
988   "Background",
989   "Video",
990   "Video",
991   "Video",
992   "Voice",
993   "Voice"
994 };
995
996 /* ************************************************************************* */
997 /*                   WME Access Category Names (by WME ACI)                  */
998 /* ************************************************************************* */
999 static const value_string wme_acs[] = {
1000   { 0, "Best Effort" },
1001   { 1, "Background" },
1002   { 2, "Video" },
1003   { 3, "Voice" },
1004   { 0, NULL }
1005 };
1006
1007 /* ************************************************************************* */
1008 /*                  Aruba Management Type                                    */
1009 /* ************************************************************************* */
1010 static const value_string aruba_mgt_typevals[] = {
1011   { 0x0001,       "Hello" },
1012   { 0x0002,       "Probe" },
1013   { 0x0003,       "MTU" },
1014   { 0x0004,       "Ageout" },
1015   { 0x0005,       "Heartbeat" },
1016   { 0x0006,       "Deauth" },
1017   { 0x0007,       "Disassoc" },
1018   { 0x0008,       "Probe response" },
1019   { 0x0009,       "Tunnel update" },
1020   { 0x000A,       "Laser beam active" },
1021   { 0x000B,       "Client IP" },
1022   { 0x000C,       "Laser beam active v2" },
1023   { 0x000D,       "AP statistics" },
1024   { 0,            NULL }
1025 };
1026
1027 /*** Begin: Action Fixed Parameter ***/
1028 #define CAT_SPECTRUM_MGMT      0
1029 #define CAT_QOS                1
1030 #define CAT_DLS                2
1031 #define CAT_BLOCK_ACK          3
1032 #define CAT_PUBLIC             4
1033
1034 #define CAT_RADIO_MEASUREMENT   5
1035 #define CAT_FAST_BSS_TRANSITION 6
1036 #define CAT_HT                  7
1037 #define CAT_SA_QUERY            8
1038 #define CAT_PUBLIC_PROTECTED    9
1039 #define CAT_WNM                 10
1040 #define CAT_UNPROTECTED_WNM     11
1041 #define CAT_TDLS                12
1042
1043 /* per 11s draft 12.0 */
1044 #define CAT_MESH                13
1045 #define CAT_MULTIHOP            14
1046 #define CAT_SELF_PROTECTED      15
1047
1048 #define CAT_MGMT_NOTIFICATION   17
1049 #define CAT_VENDOR_SPECIFIC_PROTECTED 126
1050 #define CAT_VENDOR_SPECIFIC     127
1051
1052 #define CAT_MESH_LINK_METRIC               31
1053 #define CAT_MESH_PATH_SELECTION            32
1054 #define CAT_MESH_INTERWORKING              33
1055 #define CAT_MESH_RESOURCE_COORDINATION     34
1056 #define CAT_MESH_SECURITY_ARCHITECTURE     35
1057
1058 #define SM_ACTION_MEASUREMENT_REQUEST   0
1059 #define SM_ACTION_MEASUREMENT_REPORT    1
1060 #define SM_ACTION_TPC_REQUEST           2
1061 #define SM_ACTION_TPC_REPORT            3
1062 #define SM_ACTION_CHAN_SWITCH_ANNC      4
1063 #define SM_ACTION_EXT_CHAN_SWITCH_ANNC  5
1064
1065 #define SM_ACTION_ADDTS_REQUEST     0
1066 #define SM_ACTION_ADDTS_RESPONSE    1
1067 #define SM_ACTION_DELTS             2
1068 #define SM_ACTION_QOS_SCHEDULE      3
1069
1070 #define SM_ACTION_DLS_REQUEST       0
1071 #define SM_ACTION_DLS_RESPONSE      1
1072 #define SM_ACTION_DLS_TEARDOWN      2
1073
1074 #define BA_ADD_BLOCK_ACK_REQUEST    0
1075 #define BA_ADD_BLOCK_ACK_RESPONSE   1
1076 #define BA_DELETE_BLOCK_ACK         2
1077
1078 #define PA_DSE_ENABLEMENT                  1
1079 #define PA_DSE_DEENABLEMENT                2
1080 #define PA_DSE_REG_LOC_ANNOUNCEMENT        3
1081 #define PA_EXT_CHANNEL_SWITCH_ANNOUNCEMENT 4
1082 #define PA_DSE_MEASUREMENT_REQUEST         5
1083 #define PA_DSE_MEASUREMENT_REPORT          6
1084 #define PA_MEASUREMENT_PILOT               7
1085 #define PA_DSE_POWER_CONSTRAINT            8
1086 #define PA_VENDOR_SPECIFIC                 9
1087 #define PA_GAS_INITIAL_REQUEST             10
1088 #define PA_GAS_INITIAL_RESPONSE            11
1089 #define PA_GAS_COMEBACK_REQUEST            12
1090 #define PA_GAS_COMEBACK_RESPONSE           13
1091 #define PA_TDLS_DISCOVERY_RESPONSE         14
1092
1093 #define HT_ACTION_NOTIFY_CHAN_WIDTH           0
1094 #define HT_ACTION_SM_PWR_SAVE                 1
1095 #define HT_ACTION_PSMP_ACTION                 2
1096 #define HT_ACTION_SET_PCO_PHASE               3
1097 #define HT_ACTION_MIMO_CSI                    4
1098 #define HT_ACTION_MIMO_BEAMFORMING            5
1099 #define HT_ACTION_MIMO_COMPRESSED_BEAMFORMING 6
1100 #define HT_ACTION_ANT_SEL_FEEDBACK            7
1101 #define HT_ACTION_HT_INFO_EXCHANGE            8
1102
1103 /* IEEE Std 802.11r-2008, 7.4.8, Table 7-57g */
1104 #define FT_ACTION_REQUEST               1
1105 #define FT_ACTION_RESPONSE              2
1106 #define FT_ACTION_CONFIRM               3
1107 #define FT_ACTION_ACK                   4
1108
1109 /* SA Query Action frame codes (IEEE 802.11w-2009, 7.4.9) */
1110 #define SA_QUERY_REQUEST                0
1111 #define SA_QUERY_RESPONSE               1
1112
1113 /* IEEE Std 802.11z-2010, 7.4.11, Table 7-57v1 */
1114 #define TDLS_SETUP_REQUEST              0
1115 #define TDLS_SETUP_RESPONSE             1
1116 #define TDLS_SETUP_CONFIRM              2
1117 #define TDLS_TEARDOWN                   3
1118 #define TDLS_PEER_TRAFFIC_INDICATION    4
1119 #define TDLS_CHANNEL_SWITCH_REQUEST     5
1120 #define TDLS_CHANNEL_SWITCH_RESPONSE    6
1121 #define TDLS_PEER_PSM_REQUEST           7
1122 #define TDLS_PEER_PSM_RESPONSE          8
1123 #define TDLS_PEER_TRAFFIC_RESPONSE      9
1124 #define TDLS_DISCOVERY_REQUEST          10
1125
1126 /* 11s draft 12.0, table 7-57v30 */
1127 #define MESH_ACTION_LINK_METRIC_REPORT              0
1128 #define MESH_ACTION_HWMP                            1
1129 #define MESH_ACTION_GATE_ANNOUNCE                   2
1130 #define MESH_ACTION_CONGESTION_CTL                  3
1131 #define MESH_ACTION_MCCA_SETUP_REQUEST              4
1132 #define MESH_ACTION_MCCA_SETUP_REPLY                5
1133 #define MESH_ACTION_MCCA_ADV_REQUEST                6
1134 #define MESH_ACTION_MCCA_ADV                        7
1135 #define MESH_ACTION_MCCA_TEARDOWN                   8
1136 #define MESH_ACTION_TBTT_ADJ_REQUEST                9
1137 #define MESH_ACTION_TBTT_ADJ_RESPONSE              10
1138
1139 /* 11s draft 12.0, table 7-57v42: Multihop Action field values */
1140 #define MULTIHOP_ACTION_PROXY_UPDATE                0
1141 #define MULTIHOP_ACTION_PROXY_UPDATE_CONF           1
1142
1143 /* 11s draft 12.0, table 7-57v24: Self-protected Action field values */
1144 #define SELFPROT_ACTION_MESH_PEERING_OPEN           1
1145 #define SELFPROT_ACTION_MESH_PEERING_CONFIRM        2
1146 #define SELFPROT_ACTION_MESH_PEERING_CLOSE          3
1147 #define SELFPROT_ACTION_MESH_GROUP_KEY_INFORM       4
1148 #define SELFPROT_ACTION_MESH_GROUP_KEY_ACK          5
1149
1150 /* 11s draft 12.0, table 7-43bj6: Mesh Peering Protocol Identifier field values */
1151 #define MESH_PEERING_PROTO_MGMT                     0
1152 #define MESH_PEERING_PROTO_AMPE                     1
1153 #define MESH_PEERING_PROTO_VENDOR                 255
1154
1155 /* Vendor actions */
1156 /* MARVELL */
1157 #define MRVL_ACTION_MESH_MANAGEMENT     1
1158
1159 #define MRVL_MESH_MGMT_ACTION_RREQ      0
1160 #define MRVL_MESH_MGMT_ACTION_RREP      1
1161 #define MRVL_MESH_MGMT_ACTION_RERR      2
1162 #define MRVL_MESH_MGMT_ACTION_PLDM      3
1163
1164 #define ANQP_INFO_ANQP_QUERY_LIST 256
1165 #define ANQP_INFO_ANQP_CAPAB_LIST 257
1166 #define ANQP_INFO_VENUE_NAME_INFO 258
1167 #define ANQP_INFO_EMERGENCY_CALL_NUMBER_INFO 259
1168 #define ANQP_INFO_NETWORK_AUTH_TYPE_INFO 260
1169 #define ANQP_INFO_ROAMING_CONSORTIUM_LIST 261
1170 #define ANQP_INFO_IP_ADDR_TYPE_AVAILABILITY_INFO 262
1171 #define ANQP_INFO_NAI_REALM_LIST 263
1172 #define ANQP_INFO_3GPP_CELLULAR_NETWORK_INFO 264
1173 #define ANQP_INFO_AP_GEOSPATIAL_LOCATION 265
1174 #define ANQP_INFO_AP_CIVIC_LOCATION 266
1175 #define ANQP_INFO_AP_LOCATION_PUBLIC_ID_URI 267
1176 #define ANQP_INFO_DOMAIN_NAME_LIST 268
1177 #define ANQP_INFO_EMERGENCY_ALERT_ID_URI 269
1178 #define ANQP_INFO_TDLS_CAPAB_INFO 270
1179 #define ANQP_INFO_EMERGENCY_NAI 271
1180 #define ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST 56797
1181
1182 /* ANQP information ID - IEEE Std 802.11u-2011 - Table 7-43bk */
1183 static const value_string anqp_info_id_vals[] =
1184 {
1185   {ANQP_INFO_ANQP_QUERY_LIST, "ANQP Query list"},
1186   {ANQP_INFO_ANQP_CAPAB_LIST, "ANQP Capability list"},
1187   {ANQP_INFO_VENUE_NAME_INFO, "Venue Name information"},
1188   {ANQP_INFO_EMERGENCY_CALL_NUMBER_INFO, "Emergency Call Number information"},
1189   {ANQP_INFO_NETWORK_AUTH_TYPE_INFO,
1190    "Network Authentication Type information"},
1191   {ANQP_INFO_ROAMING_CONSORTIUM_LIST, "Roaming Consortium list"},
1192   {ANQP_INFO_IP_ADDR_TYPE_AVAILABILITY_INFO,
1193    "IP Address Type Availability information"},
1194   {ANQP_INFO_NAI_REALM_LIST, "NAI Realm list"},
1195   {ANQP_INFO_3GPP_CELLULAR_NETWORK_INFO, "3GPP Cellular Network information"},
1196   {ANQP_INFO_AP_GEOSPATIAL_LOCATION, "AP Geospatial Location"},
1197   {ANQP_INFO_AP_CIVIC_LOCATION, "AP Civic Location"},
1198   {ANQP_INFO_AP_LOCATION_PUBLIC_ID_URI, "AP Location Public Identifier URI"},
1199   {ANQP_INFO_DOMAIN_NAME_LIST, "Domain Name list"},
1200   {ANQP_INFO_EMERGENCY_ALERT_ID_URI, "Emergency Alert Identifier URI"},
1201   {ANQP_INFO_TDLS_CAPAB_INFO, "TDLS Capability information"},
1202   {ANQP_INFO_EMERGENCY_NAI, "Emergency NAI"},
1203   {ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST, "ANQP vendor-specific list"},
1204   {0, NULL}
1205 };
1206
1207 /* IEEE 802.11v - WNM Action field values */
1208 enum wnm_action {
1209   WNM_EVENT_REQ = 0,
1210   WNM_EVENT_REPORT = 1,
1211   WNM_DIAGNOSTIC_REQ = 2,
1212   WNM_DIAGNOSTIC_REPORT = 3,
1213   WNM_LOCATION_CFG_REQ = 4,
1214   WNM_LOCATION_CFG_RESP = 5,
1215   WNM_BSS_TRANS_MGMT_QUERY = 6,
1216   WNM_BSS_TRANS_MGMT_REQ = 7,
1217   WNM_BSS_TRANS_MGMT_RESP = 8,
1218   WNM_FMS_REQ = 9,
1219   WNM_FMS_RESP = 10,
1220   WNM_COLLOCATED_INTERFERENCE_REQ = 11,
1221   WNM_COLLOCATED_INTERFERENCE_REPORT = 12,
1222   WNM_TFS_REQ = 13,
1223   WNM_TFS_RESP = 14,
1224   WNM_TFS_NOTIFY = 15,
1225   WNM_SLEEP_MODE_REQ = 16,
1226   WNM_SLEEP_MODE_RESP = 17,
1227   WNM_TIM_BROADCAST_REQ = 18,
1228   WNM_TIM_BROADCAST_RESP = 19,
1229   WNM_QOS_TRAFFIC_CAPAB_UPDATE = 20,
1230   WNM_CHANNEL_USAGE_REQ = 21,
1231   WNM_CHANNEL_USAGE_RESP = 22,
1232   WNM_DMS_REQ = 23,
1233   WNM_DMS_RESP = 24,
1234   WNM_TIMING_MEASUREMENT_REQ = 25,
1235   WNM_NOTIFICATION_REQ = 26,
1236   WNM_NOTIFICATION_RESP = 27
1237 };
1238
1239 static const value_string wnm_action_codes[] =
1240 {
1241   { WNM_EVENT_REQ, "Event Request" },
1242   { WNM_EVENT_REPORT, "Event Report" },
1243   { WNM_DIAGNOSTIC_REQ, "Diagnostic Request" },
1244   { WNM_DIAGNOSTIC_REPORT, "Diagnostic Report" },
1245   { WNM_LOCATION_CFG_REQ, "Location Configuration Request" },
1246   { WNM_LOCATION_CFG_RESP, "Location Configuration Response" },
1247   { WNM_BSS_TRANS_MGMT_QUERY, "BSS Transition Management Query" },
1248   { WNM_BSS_TRANS_MGMT_REQ, "BSS Transition Management Request" },
1249   { WNM_BSS_TRANS_MGMT_RESP, "BSS Transition Management Response" },
1250   { WNM_FMS_REQ, "FMS Request" },
1251   { WNM_FMS_RESP, "FMS Response" },
1252   { WNM_COLLOCATED_INTERFERENCE_REQ, "Collocated Interference Request" },
1253   { WNM_COLLOCATED_INTERFERENCE_REPORT, "Collocated Interference Report" },
1254   { WNM_TFS_REQ, "TFS Request" },
1255   { WNM_TFS_RESP, "TFS Response" },
1256   { WNM_TFS_NOTIFY, "TFS Notify" },
1257   { WNM_SLEEP_MODE_REQ, "WNM-Sleep Mode Request" },
1258   { WNM_SLEEP_MODE_RESP, "WNM-Sleep Mode Response" },
1259   { WNM_TIM_BROADCAST_REQ, "TIM Broadcast Request" },
1260   { WNM_TIM_BROADCAST_RESP, "TIM Broadcast Response" },
1261   { WNM_QOS_TRAFFIC_CAPAB_UPDATE, "QoS Traffic Capability Update" },
1262   { WNM_CHANNEL_USAGE_REQ, "Channel Usage Request" },
1263   { WNM_CHANNEL_USAGE_RESP, "Channel Usage Response" },
1264   { WNM_DMS_REQ, "DMS Request" },
1265   { WNM_DMS_RESP, "DMS Response" },
1266   { WNM_TIMING_MEASUREMENT_REQ, "Timing Measurement Request" },
1267   { WNM_NOTIFICATION_REQ, "WNM-Notification Request" },
1268   { WNM_NOTIFICATION_RESP, "WNM-Notification Response" },
1269   { 0, NULL }
1270 };
1271
1272 /*** End: Action Fixed Parameter ***/
1273
1274 static const value_string ieee80211_tag_measure_request_type_flags[] = {
1275   {0x00, "Basic Request"},
1276   {0x01, "Clear Channel Assessment (CCA) Request"},
1277   {0x02, "Receive Power Indication (RPI) Histogram Request"},
1278   {0x03, "Channel Load Request"},
1279   {0x04, "Noise Histogram Request"},
1280   {0x05, "Beacon Request"},
1281   {0x06, "Frame Request"},
1282   {0x07, "STA Statistics Request"},
1283   {0x08, "Location Configuration Indication (LCI) Request"},
1284   {0x09, "Transmit Stream Measurement Request"},
1285   {0x0A, "Measurement Pause Request"},
1286   {0x00, NULL}
1287 };
1288
1289 static const value_string ieee80211_tag_measure_report_type_flags[] = {
1290   { 0x00, "Basic Report" },
1291   { 0x01, "Clear Channel Assessment (CCA) Report" },
1292   { 0x02, "Receive Power Indication (RPI) Histogram Report" },
1293   { 0x03, "Channel Load Report" },
1294   { 0x04, "Noise Histogram Report" },
1295   { 0x05, "Beacon Report" },
1296   { 0x06, "Frame Report" },
1297   { 0x07, "STA Statistics Report" },
1298   { 0x08, "Location Configuration Information (LCI) Report" },
1299   { 0x09, "Transmit Stream Measurement Report" },
1300   { 0x00, NULL }
1301 };
1302
1303 static const true_false_string ieee80211_tag_measure_report_frame_info_frame_type_flag = {
1304   "Measurement Pilot Frame",
1305   "Beacon/Probe Response Frame"
1306 };
1307
1308 static const true_false_string ieee80211_tag_measure_map_field_bss_flag = {
1309   "At least one MPDU was received by another BSS or IBSS in the measurement period.",
1310   "No MPDUs were received from another BSS or IBSS in the measurement period."
1311 };
1312
1313 static const value_string ieee80211_tag_measure_request_measurement_mode_flags[] = {
1314   { 0x00, "Passive" },
1315   { 0x01, "Active" },
1316   { 0x02, "Beacon Table" },
1317   { 0x00, NULL }
1318 };
1319
1320 #define MEASURE_REQ_BEACON_SUB_SSID 0
1321 #define MEASURE_REQ_BEACON_SUB_BRI 1
1322 #define MEASURE_REQ_BEACON_SUB_RD 2
1323 #define MEASURE_REQ_BEACON_SUB_REQUEST 10
1324 #define MEASURE_REQ_BEACON_SUB_APCP 51
1325 #define MEASURE_REQ_BEACON_SUB_VS 221
1326
1327 static const value_string ieee80211_tag_measure_request_beacon_sub_id_flags[] = {
1328   { MEASURE_REQ_BEACON_SUB_SSID, "SSID" },
1329   { MEASURE_REQ_BEACON_SUB_BRI, "Beacon Reporting Information" },
1330   { MEASURE_REQ_BEACON_SUB_RD, "Reporting Detail" },
1331   { MEASURE_REQ_BEACON_SUB_REQUEST, "Request" },
1332   { MEASURE_REQ_BEACON_SUB_APCP, "AP Channel Report" },
1333   { MEASURE_REQ_BEACON_SUB_VS, "Vendor Specific" },
1334   { 0x00, NULL}
1335 };
1336
1337 static const value_string ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition_flags[] = {
1338   { 0x00, "Report to be issued after each measurement." },
1339   { 0x01, "The measured RCPI level is greater than an absolute threshold." },
1340   { 0x02, "The measured RCPI level is less than an absolute threshold." },
1341   { 0x03, "The measured RSNI level is greater than an absolute threshold." },
1342   { 0x04, "The measured RSNI level is less than an absolute threshold." },
1343   { 0x05, "The measured RCPI level is greater than a threshold defined by an offset from the serving AP's reference RCPI." },
1344   { 0x06, "The measured RCPI level is less than a threshold defined by an offset from the serving AP's reference RCPI." },
1345   { 0x07, "The measured RSNI level is greater than a threshold defined by an offset from the serving AP's reference RSNI." },
1346   { 0x08, "The measured RSNI level is less than a threshold defined by an offset from the serving AP's reference RSNI." },
1347   { 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." },
1348   { 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." },
1349   { 0xfe, "Report not required to be issued" },
1350   { 0x00, NULL }
1351 };
1352
1353 static const value_string ieee80211_tag_measure_request_beacon_sub_reporting_detail_flags[] = {
1354   { 0, "No fixed length fields or elements" },
1355   { 1, "All fixed length fields and any requested elements in the Request information element if present" },
1356   { 2, "All fixed length fields and elements (default, used when Reporting Detail subelement is not included in Beacon Request" },
1357   { 0x00, NULL }
1358 };
1359
1360 static const value_string ieee80211_tag_measure_request_group_id_flags[] = {
1361   { 0x00, "STA Counters from dot11CountersTable" },
1362   { 0x01, "STA Counters from dot11MacStatistics group" },
1363   { 0x02, "QoS STA Counters for UP0 from dot11QosCountersTable" },
1364   { 0x03, "QoS STA Counters for UP1 from dot11QosCountersTable" },
1365   { 0x04, "QoS STA Counters for UP2 from dot11QosCountersTable" },
1366   { 0x05, "QoS STA Counters for UP3 from dot11QosCountersTable" },
1367   { 0x06, "QoS STA Counters for UP4 from dot11QosCountersTable" },
1368   { 0x07, "QoS STA Counters for UP5 from dot11QosCountersTable" },
1369   { 0x08, "QoS STA Counters for UP6 from dot11QosCountersTable" },
1370   { 0x09, "QoS STA Counters for UP7 from dot11QosCountersTable" },
1371   { 0x0a, "BSS Average Access Delays" },
1372   { 0x0b, "STA Counters from dot11A-MSDU Group" },
1373   { 0x0c, "STA Counters from dot11A-MPDU Group" },
1374   { 0x0d, "STA Counters from dot11 BAR, Channel Width, PSMP Group" },
1375   { 0x0e, "STA Counters from dot11Protection Group" },
1376   { 0x0f, "STBC Group" },
1377   { 0x00, NULL }
1378 };
1379
1380 static const value_string ieee80211_tclas_process_flag[] = {
1381   {0x00, "Incoming MSDU's higher layer parameters have to match to the parameters in all associated TCLAS elements."},
1382   {0x01, "Incoming MSDU's higher layer parameters have to match to at least one of the associated TCLAS elements."},
1383   {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."},
1384   {0, NULL}
1385 };
1386
1387 static int proto_wlan = -1;
1388 static int proto_aggregate = -1;
1389 static packet_info * g_pinfo;
1390 static gboolean ieee80211_tvb_invalid = FALSE;
1391
1392 /* ************************************************************************* */
1393 /*                Header field info values for FC-field                      */
1394 /* ************************************************************************* */
1395 static int hf_ieee80211_fc_field = -1;
1396 static int hf_ieee80211_fc_proto_version = -1;
1397 static int hf_ieee80211_fc_frame_type = -1;
1398 static int hf_ieee80211_fc_frame_subtype = -1;
1399 static int hf_ieee80211_fc_frame_type_subtype = -1;
1400
1401 static int hf_ieee80211_fc_flags = -1;
1402 static int hf_ieee80211_fc_to_ds = -1;
1403 static int hf_ieee80211_fc_from_ds = -1;
1404 static int hf_ieee80211_fc_data_ds = -1;
1405
1406 static int hf_ieee80211_fc_more_frag = -1;
1407 static int hf_ieee80211_fc_retry = -1;
1408 static int hf_ieee80211_fc_pwr_mgt = -1;
1409 static int hf_ieee80211_fc_more_data = -1;
1410 static int hf_ieee80211_fc_protected = -1;
1411 static int hf_ieee80211_fc_order = -1;
1412
1413 typedef struct retransmit_key {
1414   guint8  bssid[6];
1415   guint8  src[6];
1416   guint16 seq_control;
1417   guint   fnum;
1418 } retransmit_key;
1419
1420 static GHashTable *fc_analyse_retransmit_table = NULL;
1421 static GHashTable *fc_first_frame_table = NULL;
1422
1423 static int hf_ieee80211_fc_analysis_retransmission = -1;
1424 static int hf_ieee80211_fc_analysis_retransmission_frame = -1;
1425
1426 /* ************************************************************************* */
1427 /*                   Header values for Duration/ID field                     */
1428 /* ************************************************************************* */
1429 static int hf_ieee80211_did_duration = -1;
1430 static int hf_ieee80211_assoc_id = -1;
1431
1432 /* ************************************************************************* */
1433 /*         Header values for different address-fields (all 4 of them)        */
1434 /* ************************************************************************* */
1435 static int hf_ieee80211_addr_da = -1;  /* Destination address subfield */
1436 static int hf_ieee80211_addr_sa = -1;  /* Source address subfield */
1437 static int hf_ieee80211_addr_ra = -1;  /* Receiver address subfield */
1438 static int hf_ieee80211_addr_ta = -1;  /* Transmitter address subfield */
1439 static int hf_ieee80211_addr_bssid = -1;  /* address is bssid */
1440
1441 static int hf_ieee80211_addr = -1;  /* Source or destination address subfield */
1442
1443
1444 /* ************************************************************************* */
1445 /*                Header values for QoS control field                        */
1446 /* ************************************************************************* */
1447 static int hf_ieee80211_qos_tid = -1;
1448 static int hf_ieee80211_qos_priority = -1;
1449 static int hf_ieee80211_qos_ack_policy = -1;
1450 static int hf_ieee80211_qos_amsdu_present = -1;
1451 static int hf_ieee80211_qos_eosp = -1;
1452 static int hf_ieee80211_qos_bit4 = -1;
1453 static int hf_ieee80211_qos_txop_limit = -1;
1454 static int hf_ieee80211_qos_buf_state_indicated = -1;
1455 static int hf_ieee80211_qos_highest_pri_buf_ac = -1;
1456 static int hf_ieee80211_qos_qap_buf_load = -1;
1457 static int hf_ieee80211_qos_txop_dur_req = -1;
1458 static int hf_ieee80211_qos_queue_size = -1;
1459
1460 /* ************************************************************************* */
1461 /*                Header values for HT control field (+HTC)                  */
1462 /* ************************************************************************* */
1463 /* 802.11nD-1.10 & 802.11nD-2.0 7.1.3.5a */
1464 static int hf_ieee80211_htc = -1;
1465 static int hf_ieee80211_htc_lac = -1;
1466 static int hf_ieee80211_htc_lac_reserved = -1;
1467 static int hf_ieee80211_htc_lac_trq = -1;
1468 static int hf_ieee80211_htc_lac_mai_aseli = -1;
1469 static int hf_ieee80211_htc_lac_mai_mrq = -1;
1470 static int hf_ieee80211_htc_lac_mai_msi = -1;
1471 static int hf_ieee80211_htc_lac_mai_reserved = -1;
1472 static int hf_ieee80211_htc_lac_mfsi = -1;
1473 static int hf_ieee80211_htc_lac_mfb = -1;
1474 static int hf_ieee80211_htc_lac_asel_command = -1;
1475 static int hf_ieee80211_htc_lac_asel_data = -1;
1476 static int hf_ieee80211_htc_cal_pos = -1;
1477 static int hf_ieee80211_htc_cal_seq = -1;
1478 static int hf_ieee80211_htc_reserved1 = -1;
1479 static int hf_ieee80211_htc_csi_steering = -1;
1480 static int hf_ieee80211_htc_ndp_announcement = -1;
1481 static int hf_ieee80211_htc_reserved2 = -1;
1482 static int hf_ieee80211_htc_ac_constraint = -1;
1483 static int hf_ieee80211_htc_rdg_more_ppdu = -1;
1484
1485 /* ************************************************************************* */
1486 /*                Header values for sequence number field                    */
1487 /* ************************************************************************* */
1488 static int hf_ieee80211_frag_number = -1;
1489 static int hf_ieee80211_seq_number = -1;
1490
1491 /* ************************************************************************* */
1492 /*                   Header values for Frame Check field                     */
1493 /* ************************************************************************* */
1494 static int hf_ieee80211_fcs = -1;
1495 static int hf_ieee80211_fcs_good = -1;
1496 static int hf_ieee80211_fcs_bad = -1;
1497
1498 /* ************************************************************************* */
1499 /*                   Header values for reassembly                            */
1500 /* ************************************************************************* */
1501 static int hf_ieee80211_fragments = -1;
1502 static int hf_ieee80211_fragment = -1;
1503 static int hf_ieee80211_fragment_overlap = -1;
1504 static int hf_ieee80211_fragment_overlap_conflict = -1;
1505 static int hf_ieee80211_fragment_multiple_tails = -1;
1506 static int hf_ieee80211_fragment_too_long_fragment = -1;
1507 static int hf_ieee80211_fragment_error = -1;
1508 static int hf_ieee80211_fragment_count = -1;
1509 static int hf_ieee80211_reassembled_in = -1;
1510 static int hf_ieee80211_reassembled_length = -1;
1511
1512 static int proto_wlan_mgt = -1;
1513
1514 /* ************************************************************************* */
1515 /*                      Fixed fields found in mgt frames                     */
1516 /* ************************************************************************* */
1517 static int hf_ieee80211_fixed_parameters = -1;  /* Protocol payload for management frames */
1518
1519 static int hf_ieee80211_ff_auth_alg = -1;            /* Authentication algorithm field            */
1520 static int hf_ieee80211_ff_auth_seq = -1;            /* Authentication transaction sequence       */
1521 static int hf_ieee80211_ff_current_ap = -1;          /* Current AP MAC address                    */
1522 static int hf_ieee80211_ff_listen_ival = -1;         /* Listen interval fixed field               */
1523 static int hf_ieee80211_ff_timestamp = -1;           /* 64 bit timestamp                          */
1524 static int hf_ieee80211_ff_beacon_interval = -1;     /* 16 bit Beacon interval                    */
1525 static int hf_ieee80211_ff_assoc_id = -1;            /* 16 bit AID field                          */
1526 static int hf_ieee80211_ff_reason = -1;              /* 16 bit reason code                        */
1527 static int hf_ieee80211_ff_status_code = -1;         /* Status code                               */
1528 static int hf_ieee80211_ff_category_code = -1;       /* 8 bit Category code */
1529 static int hf_ieee80211_ff_action_code = -1;         /* 8 bit Action code */
1530 static int hf_ieee80211_ff_dialog_token = -1;        /* 8 bit Dialog token */
1531 static int hf_ieee80211_ff_wme_action_code = -1;     /* Management notification action code */
1532 static int hf_ieee80211_ff_wme_status_code = -1;     /* Management notification setup response status code */
1533 static int hf_ieee80211_ff_qos_action_code = -1;
1534 static int hf_ieee80211_ff_dls_action_code = -1;
1535 static int hf_ieee80211_ff_dst_mac_addr = -1;        /* DLS destination MAC addressi */
1536 static int hf_ieee80211_ff_src_mac_addr = -1;        /* DLS source MAC addressi */
1537 static int hf_ieee80211_ff_dls_timeout = -1;         /* DLS timeout value */
1538 static int hf_ieee80211_ff_ft_action_code = -1; /* 8 bit FT Action code */
1539 static int hf_ieee80211_ff_sta_address = -1;
1540 static int hf_ieee80211_ff_target_ap_address = -1;
1541 static int hf_ieee80211_ff_gas_comeback_delay = -1;
1542 static int hf_ieee80211_ff_gas_fragment_id = -1;
1543 static int hf_ieee80211_ff_more_gas_fragments = -1;
1544 static int hf_ieee80211_ff_query_request_length = -1;
1545 static int hf_ieee80211_ff_query_request = -1;
1546 static int hf_ieee80211_ff_query_response_length = -1;
1547 static int hf_ieee80211_ff_query_response = -1;
1548 static int hf_ieee80211_ff_anqp_info_id = -1;
1549 static int hf_ieee80211_ff_anqp_info_length = -1;
1550 static int hf_ieee80211_ff_anqp_info = -1;
1551 static int hf_ieee80211_ff_anqp_query_id = -1;
1552 static int hf_ieee80211_ff_anqp_capability = -1;
1553 static int hf_ieee80211_ff_anqp_capability_vlen = -1;
1554 static int hf_ieee80211_ff_anqp_capability_vendor = -1;
1555 static int hf_ieee80211_ff_venue_info_group = -1;
1556 static int hf_ieee80211_ff_venue_info_type = -1;
1557 static int hf_ieee80211_ff_anqp_venue_length = -1;
1558 static int hf_ieee80211_ff_anqp_venue_language = -1;
1559 static int hf_ieee80211_ff_anqp_venue_name = -1;
1560 static int hf_ieee80211_ff_anqp_nw_auth_type_indicator = -1;
1561 static int hf_ieee80211_ff_anqp_nw_auth_type_url_len = -1;
1562 static int hf_ieee80211_ff_anqp_nw_auth_type_url = -1;
1563 static int hf_ieee80211_ff_anqp_roaming_consortium_oi_len = -1;
1564 static int hf_ieee80211_ff_anqp_roaming_consortium_oi = -1;
1565 static int hf_ieee80211_ff_anqp_ip_addr_avail_ipv6 = -1;
1566 static int hf_ieee80211_ff_anqp_ip_addr_avail_ipv4 = -1;
1567 static int hf_ieee80211_ff_anqp_nai_realm_count = -1;
1568 static int hf_ieee80211_ff_anqp_nai_field_len = -1;
1569 static int hf_ieee80211_ff_anqp_nai_realm_encoding = -1;
1570 static int hf_ieee80211_ff_anqp_nai_realm_length = -1;
1571 static int hf_ieee80211_ff_anqp_nai_realm = -1;
1572 static int hf_ieee80211_ff_anqp_nai_realm_eap_count = -1;
1573 static int hf_ieee80211_ff_anqp_nai_realm_eap_len = -1;
1574 static int hf_ieee80211_ff_anqp_nai_realm_eap_method = -1;
1575 static int hf_ieee80211_ff_anqp_nai_realm_auth_param_count = -1;
1576 static int hf_ieee80211_ff_anqp_nai_realm_auth_param_id = -1;
1577 static int hf_ieee80211_ff_anqp_nai_realm_auth_param_len = -1;
1578 static int hf_ieee80211_ff_anqp_nai_realm_auth_param_value = -1;
1579 static int hf_ieee80211_3gpp_gc_gud = -1;
1580 static int hf_ieee80211_3gpp_gc_udhl = -1;
1581 static int hf_ieee80211_3gpp_gc_iei = -1;
1582 static int hf_ieee80211_3gpp_gc_plmn_len = -1;
1583 static int hf_ieee80211_3gpp_gc_num_plmns = -1;
1584 static int hf_ieee80211_3gpp_gc_plmn = -1;
1585 static int hf_ieee80211_ff_anqp_domain_name_len = -1;
1586 static int hf_ieee80211_ff_anqp_domain_name = -1;
1587 static int hf_ieee80211_ff_tdls_action_code = -1;
1588 static int hf_ieee80211_ff_target_channel = -1;
1589 static int hf_ieee80211_ff_regulatory_class = -1;
1590 static int hf_ieee80211_ff_wnm_action_code = -1;
1591 static int hf_ieee80211_ff_request_mode_pref_cand = -1;
1592 static int hf_ieee80211_ff_request_mode_abridged = -1;
1593 static int hf_ieee80211_ff_request_mode_disassoc_imminent = -1;
1594 static int hf_ieee80211_ff_request_mode_bss_term_included = -1;
1595 static int hf_ieee80211_ff_request_mode_ess_disassoc_imminent = -1;
1596 static int hf_ieee80211_ff_disassoc_timer = -1;
1597 static int hf_ieee80211_ff_validity_interval = -1;
1598 static int hf_ieee80211_ff_url_len = -1;
1599 static int hf_ieee80211_ff_url = -1;
1600
1601 static int hf_ieee80211_ff_sa_query_action_code = -1;
1602 static int hf_ieee80211_ff_transaction_id = -1;
1603
1604 /* Vendor specific */
1605 static int hf_ieee80211_ff_marvell_action_type = -1;
1606 static int hf_ieee80211_ff_marvell_mesh_mgt_action_code = -1;
1607 static int hf_ieee80211_ff_marvell_mesh_mgt_length = -1;     /* Mesh Management length */
1608 static int hf_ieee80211_ff_marvell_mesh_mgt_mode = -1;       /* Mesh Management mode */
1609 static int hf_ieee80211_ff_marvell_mesh_mgt_ttl = -1;        /* Mesh Management TTL */
1610 static int hf_ieee80211_ff_marvell_mesh_mgt_dstcount = -1;   /* Mesh Management dst count */
1611 static int hf_ieee80211_ff_marvell_mesh_mgt_hopcount = -1;   /* Mesh Management hop count */
1612 static int hf_ieee80211_ff_marvell_mesh_mgt_rreqid = -1;     /* Mesh Management RREQ ID */
1613 static int hf_ieee80211_ff_marvell_mesh_mgt_sa = -1;         /* Mesh Management src addr */
1614 static int hf_ieee80211_ff_marvell_mesh_mgt_ssn = -1;        /* Mesh Management src sequence number */
1615 static int hf_ieee80211_ff_marvell_mesh_mgt_metric = -1;     /* Mesh Management metric */
1616 static int hf_ieee80211_ff_marvell_mesh_mgt_flags = -1;      /* Mesh Management RREQ flags */
1617 static int hf_ieee80211_ff_marvell_mesh_mgt_da = -1;         /* Mesh Management dst addr */
1618 static int hf_ieee80211_ff_marvell_mesh_mgt_dsn = -1;        /* Mesh Management dst sequence number */
1619 static int hf_ieee80211_ff_marvell_mesh_mgt_lifetime = -1;   /* Mesh Management lifetime */
1620
1621
1622 static int hf_ieee80211_ff_ba_action = -1;
1623
1624 static int hf_ieee80211_ff_block_ack_params = -1;
1625 static int hf_ieee80211_ff_block_ack_params_amsdu_permitted = -1;
1626 static int hf_ieee80211_ff_block_ack_params_policy = -1;
1627 static int hf_ieee80211_ff_block_ack_params_tid = -1;
1628 static int hf_ieee80211_ff_block_ack_params_buffer_size = -1;
1629
1630 static const int *ieee80211_ff_block_ack_params_fields[] = {
1631   &hf_ieee80211_ff_block_ack_params_amsdu_permitted,
1632   &hf_ieee80211_ff_block_ack_params_policy,
1633   &hf_ieee80211_ff_block_ack_params_tid,
1634   &hf_ieee80211_ff_block_ack_params_buffer_size,
1635   NULL
1636 };
1637
1638 static int hf_ieee80211_ff_block_ack_timeout = -1;
1639
1640 static int hf_ieee80211_ff_block_ack_ssc = -1;
1641 static int hf_ieee80211_ff_block_ack_ssc_fragment = -1;
1642 static int hf_ieee80211_ff_block_ack_ssc_sequence = -1;
1643
1644 static const int *ieee80211_ff_block_ack_ssc_fields[] = {
1645   &hf_ieee80211_ff_block_ack_ssc_fragment,
1646   &hf_ieee80211_ff_block_ack_ssc_sequence,
1647   NULL
1648 };
1649
1650 static int hf_ieee80211_ff_delba_param = -1;
1651 static int hf_ieee80211_ff_delba_param_reserved = -1;
1652 static int hf_ieee80211_ff_delba_param_init = -1;
1653 static int hf_ieee80211_ff_delba_param_tid = -1;
1654
1655 static const int *ieee80211_ff_delba_param_fields[] = {
1656   &hf_ieee80211_ff_delba_param_reserved,
1657   &hf_ieee80211_ff_delba_param_init,
1658   &hf_ieee80211_ff_delba_param_tid,
1659   NULL
1660 };
1661
1662 static int hf_ieee80211_ff_max_reg_pwr = -1;
1663 static int hf_ieee80211_ff_measurement_pilot_int = -1;
1664 static int hf_ieee80211_ff_country_str = -1;
1665 static int hf_ieee80211_ff_max_tx_pwr = -1;
1666 static int hf_ieee80211_ff_tx_pwr_used = -1;
1667 static int hf_ieee80211_ff_transceiver_noise_floor = -1;
1668 static int hf_ieee80211_ff_channel_width = -1;
1669
1670 static int hf_ieee80211_ff_qos_info_ap = -1;
1671 static int hf_ieee80211_ff_qos_info_ap_edca_param_set_counter = -1;
1672 static int hf_ieee80211_ff_qos_info_ap_q_ack = -1;
1673 static int hf_ieee80211_ff_qos_info_ap_queue_req = -1;
1674 static int hf_ieee80211_ff_qos_info_ap_txop_request = -1;
1675 static int hf_ieee80211_ff_qos_info_ap_reserved = -1;
1676
1677 static const int *ieee80211_ff_qos_info_ap_fields[] = {
1678   &hf_ieee80211_ff_qos_info_ap_edca_param_set_counter,
1679   &hf_ieee80211_ff_qos_info_ap_q_ack,
1680   &hf_ieee80211_ff_qos_info_ap_queue_req,
1681   &hf_ieee80211_ff_qos_info_ap_txop_request,
1682   &hf_ieee80211_ff_qos_info_ap_reserved,
1683   NULL
1684 };
1685
1686 static int hf_ieee80211_ff_qos_info_sta = -1;
1687 static int hf_ieee80211_ff_qos_info_sta_ac_vo = -1;
1688 static int hf_ieee80211_ff_qos_info_sta_ac_vi = -1;
1689 static int hf_ieee80211_ff_qos_info_sta_ac_bk = -1;
1690 static int hf_ieee80211_ff_qos_info_sta_ac_be = -1;
1691 static int hf_ieee80211_ff_qos_info_sta_q_ack = -1;
1692 static int hf_ieee80211_ff_qos_info_sta_max_sp_len = -1;
1693 static int hf_ieee80211_ff_qos_info_sta_more_data_ack = -1;
1694
1695 static const int *ieee80211_ff_qos_info_sta_fields[] = {
1696   &hf_ieee80211_ff_qos_info_sta_ac_vo,
1697   &hf_ieee80211_ff_qos_info_sta_ac_vi,
1698   &hf_ieee80211_ff_qos_info_sta_ac_bk,
1699   &hf_ieee80211_ff_qos_info_sta_ac_be,
1700   &hf_ieee80211_ff_qos_info_sta_q_ack,
1701   &hf_ieee80211_ff_qos_info_sta_max_sp_len,
1702   &hf_ieee80211_ff_qos_info_sta_more_data_ack,
1703   NULL
1704 };
1705
1706 static int hf_ieee80211_ff_sm_pwr_save = -1;
1707 static int hf_ieee80211_ff_sm_pwr_save_enabled = -1;
1708 static int hf_ieee80211_ff_sm_pwr_save_sm_mode = -1;
1709 static int hf_ieee80211_ff_sm_pwr_save_reserved = -1;
1710
1711 static const int *ieee80211_ff_sw_pwr_save_fields[] = {
1712   &hf_ieee80211_ff_sm_pwr_save_enabled,
1713   &hf_ieee80211_ff_sm_pwr_save_sm_mode,
1714   &hf_ieee80211_ff_sm_pwr_save_reserved,
1715   NULL
1716 };
1717
1718 static int hf_ieee80211_ff_pco_phase_cntrl = -1;
1719
1720 static int hf_ieee80211_ff_psmp_param_set = -1;
1721 static int hf_ieee80211_ff_psmp_param_set_n_sta = -1;
1722 static int hf_ieee80211_ff_psmp_param_set_more_psmp = -1;
1723 static int hf_ieee80211_ff_psmp_param_set_psmp_sequence_duration = -1;
1724
1725 static const int *ieee80211_ff_psmp_param_set_fields[] = {
1726   &hf_ieee80211_ff_psmp_param_set_n_sta,
1727   &hf_ieee80211_ff_psmp_param_set_more_psmp,
1728   &hf_ieee80211_ff_psmp_param_set_psmp_sequence_duration,
1729   NULL
1730 };
1731
1732 static int hf_ieee80211_ff_mimo_cntrl = -1;
1733 static int hf_ieee80211_ff_mimo_cntrl_nc_index = -1;
1734 static int hf_ieee80211_ff_mimo_cntrl_nr_index = -1;
1735 static int hf_ieee80211_ff_mimo_cntrl_channel_width = -1;
1736 static int hf_ieee80211_ff_mimo_cntrl_grouping = -1;
1737 static int hf_ieee80211_ff_mimo_cntrl_coefficient_size = -1;
1738 static int hf_ieee80211_ff_mimo_cntrl_codebook_info = -1;
1739 static int hf_ieee80211_ff_mimo_cntrl_remaining_matrix_segment = -1;
1740 static int hf_ieee80211_ff_mimo_cntrl_reserved = -1;
1741 static int hf_ieee80211_ff_mimo_cntrl_sounding_timestamp = -1;
1742
1743 static int hf_ieee80211_ff_ant_selection = -1;
1744 static int hf_ieee80211_ff_ant_selection_0 = -1;
1745 static int hf_ieee80211_ff_ant_selection_1 = -1;
1746 static int hf_ieee80211_ff_ant_selection_2 = -1;
1747 static int hf_ieee80211_ff_ant_selection_3 = -1;
1748 static int hf_ieee80211_ff_ant_selection_4 = -1;
1749 static int hf_ieee80211_ff_ant_selection_5 = -1;
1750 static int hf_ieee80211_ff_ant_selection_6 = -1;
1751 static int hf_ieee80211_ff_ant_selection_7 = -1;
1752
1753 static const int *ieee80211_ff_ant_selection_fields[] = {
1754   &hf_ieee80211_ff_ant_selection_0,
1755   &hf_ieee80211_ff_ant_selection_1,
1756   &hf_ieee80211_ff_ant_selection_2,
1757   &hf_ieee80211_ff_ant_selection_3,
1758   &hf_ieee80211_ff_ant_selection_4,
1759   &hf_ieee80211_ff_ant_selection_5,
1760   &hf_ieee80211_ff_ant_selection_6,
1761   &hf_ieee80211_ff_ant_selection_7,
1762   NULL
1763 };
1764
1765 static int hf_ieee80211_ff_ext_channel_switch_announcement = -1;
1766 static int hf_ieee80211_ff_ext_channel_switch_announcement_switch_mode = -1;
1767 static int hf_ieee80211_ff_ext_channel_switch_announcement_new_reg_class = -1;
1768 static int hf_ieee80211_ff_ext_channel_switch_announcement_new_chan_number = -1;
1769 static int hf_ieee80211_ff_ext_channel_switch_announcement_switch_count = -1;
1770
1771 static const int *ieee80211_ff_ext_channel_switch_announcement_fields[] = {
1772   &hf_ieee80211_ff_ext_channel_switch_announcement_switch_mode,
1773   &hf_ieee80211_ff_ext_channel_switch_announcement_new_reg_class,
1774   &hf_ieee80211_ff_ext_channel_switch_announcement_new_chan_number,
1775   &hf_ieee80211_ff_ext_channel_switch_announcement_switch_count,
1776   NULL
1777 };
1778
1779 static int hf_ieee80211_ff_ht_info = -1;
1780 static int hf_ieee80211_ff_ht_info_information_request = -1;
1781 static int hf_ieee80211_ff_ht_info_40_mhz_intolerant = -1;
1782 static int hf_ieee80211_ff_ht_info_sta_chan_width = -1;
1783 static int hf_ieee80211_ff_ht_info_reserved = -1;
1784
1785 static const int *ieee80211_ff_ht_info_fields[] = {
1786   &hf_ieee80211_ff_ht_info_information_request,
1787   &hf_ieee80211_ff_ht_info_40_mhz_intolerant,
1788   &hf_ieee80211_ff_ht_info_sta_chan_width,
1789   &hf_ieee80211_ff_ht_info_reserved,
1790   NULL
1791 };
1792
1793 static int hf_ieee80211_ff_ht_action = -1;
1794
1795 static int hf_ieee80211_ff_psmp_sta_info = -1;
1796 static int hf_ieee80211_ff_psmp_sta_info_type = -1;
1797 static int hf_ieee80211_ff_psmp_sta_info_dtt_start_offset = -1;
1798 static int hf_ieee80211_ff_psmp_sta_info_dtt_duration = -1;
1799 static int hf_ieee80211_ff_psmp_sta_info_sta_id = -1;
1800 static int hf_ieee80211_ff_psmp_sta_info_utt_start_offset = -1;
1801 static int hf_ieee80211_ff_psmp_sta_info_utt_duration = -1;
1802 static int hf_ieee80211_ff_psmp_sta_info_reserved_small= -1;
1803 static int hf_ieee80211_ff_psmp_sta_info_reserved_large = -1;
1804 static int hf_ieee80211_ff_psmp_sta_info_psmp_multicast_id = -1;
1805
1806 static int hf_ieee80211_ff_mimo_csi_snr = -1;
1807
1808 /*** Begin: 802.11s additions ***/
1809 static int hf_ieee80211_ff_mesh_action = -1;
1810 static int hf_ieee80211_ff_multihop_action = -1;
1811 static int hf_ieee80211_ff_mesh_flags = -1;
1812 static int hf_ieee80211_ff_mesh_ttl = -1;
1813 static int hf_ieee80211_ff_mesh_sequence = -1;
1814 static int hf_ieee80211_ff_mesh_addr4 = -1;
1815 static int hf_ieee80211_ff_mesh_addr5 = -1;
1816 static int hf_ieee80211_ff_mesh_addr6 = -1;
1817 static int hf_ieee80211_ff_selfprot_action = -1;
1818
1819 static int hf_ieee80211_mesh_peering_proto = -1;
1820 static int hf_ieee80211_mesh_peering_local_link_id = -1;
1821 static int hf_ieee80211_mesh_peering_peer_link_id = -1;
1822
1823 static int hf_ieee80211_ff_hwmp_flags = -1;
1824 static int hf_ieee80211_ff_hwmp_hopcount = -1;
1825 static int hf_ieee80211_ff_hwmp_ttl = -1;
1826 static int hf_ieee80211_ff_hwmp_pdid = -1;
1827 static int hf_ieee80211_ff_hwmp_orig_sta = -1;
1828 static int hf_ieee80211_ff_hwmp_orig_sn = -1;
1829 static int hf_ieee80211_ff_hwmp_orig_ext = -1;
1830 static int hf_ieee80211_ff_hwmp_lifetime = -1;
1831 static int hf_ieee80211_ff_hwmp_metric = -1;
1832 static int hf_ieee80211_ff_hwmp_targ_count = -1;
1833 static int hf_ieee80211_ff_hwmp_targ_flags = -1;
1834 static int hf_ieee80211_ff_hwmp_targ_to_flags = -1;
1835 static int hf_ieee80211_ff_hwmp_targ_usn_flags = -1;
1836 static int hf_ieee80211_ff_hwmp_targ_sta = -1;
1837 static int hf_ieee80211_ff_hwmp_targ_sn = -1;
1838 static int hf_ieee80211_ff_hwmp_targ_ext = -1;
1839 static int hf_ieee80211_rann_flags = -1;
1840 static int hf_ieee80211_rann_root_sta = -1;
1841 static int hf_ieee80211_rann_sn = -1;
1842 static int hf_ieee80211_rann_interval = -1;
1843
1844 static int hf_ieee80211_mesh_config_path_sel_protocol = -1;
1845 static int hf_ieee80211_mesh_config_path_sel_metric = -1;
1846 static int hf_ieee80211_mesh_config_congestion_control = -1;
1847 static int hf_ieee80211_mesh_config_sync_method = -1;
1848 static int hf_ieee80211_mesh_config_auth_protocol = -1;
1849 static int hf_ieee80211_mesh_config_formation_info = -1;
1850 static int hf_ieee80211_mesh_config_capability = -1;
1851 static int hf_ieee80211_mesh_id = -1;
1852
1853 static int hf_ieee80211_ff_public_action = -1;
1854
1855 /* ************************************************************************* */
1856 /*            Flags found in the capability field (fixed field)              */
1857 /* ************************************************************************* */
1858 static int hf_ieee80211_ff_capture = -1;
1859 static int hf_ieee80211_ff_cf_ess = -1;
1860 static int hf_ieee80211_ff_cf_ibss = -1;
1861 static int hf_ieee80211_ff_cf_sta_poll = -1; /* CF pollable status for a STA            */
1862 static int hf_ieee80211_ff_cf_ap_poll = -1;  /* CF pollable status for an AP            */
1863 static int hf_ieee80211_ff_cf_privacy = -1;
1864 static int hf_ieee80211_ff_cf_preamble = -1;
1865 static int hf_ieee80211_ff_cf_pbcc = -1;
1866 static int hf_ieee80211_ff_cf_agility = -1;
1867 static int hf_ieee80211_ff_short_slot_time = -1;
1868 static int hf_ieee80211_ff_dsss_ofdm = -1;
1869 static int hf_ieee80211_ff_cf_spec_man = -1;
1870 static int hf_ieee80211_ff_cf_apsd = -1;
1871 static int hf_ieee80211_ff_cf_del_blk_ack = -1;
1872 static int hf_ieee80211_ff_cf_imm_blk_ack = -1;
1873
1874 /* ************************************************************************* */
1875 /*                       A-MSDU fields                                             */
1876 /* ************************************************************************* */
1877 static int hf_ieee80211_amsdu_msdu_header_text = -1;
1878
1879
1880 /* ************************************************************************* */
1881 /*                       Tagged value format fields                          */
1882 /* ************************************************************************* */
1883 static int hf_ieee80211_tagged_parameters = -1;  /* Fixed payload item */
1884 static int hf_ieee80211_tag = -1;
1885 static int hf_ieee80211_tag_number = -1;
1886 static int hf_ieee80211_tag_length = -1;
1887 static int hf_ieee80211_tag_interpretation = -1;
1888 static int hf_ieee80211_tag_oui = -1;
1889 static int hf_ieee80211_tag_ssid = -1;
1890 static int hf_ieee80211_tag_supp_rates = -1;
1891 static int hf_ieee80211_tag_fh_dwell_time = -1;
1892 static int hf_ieee80211_tag_fh_hop_set = -1;
1893 static int hf_ieee80211_tag_fh_hop_pattern = -1;
1894 static int hf_ieee80211_tag_fh_hop_index = -1;
1895 static int hf_ieee80211_tag_ds_param_channel = -1;
1896 static int hf_ieee80211_tag_cfp_count = -1;
1897 static int hf_ieee80211_tag_cfp_period = -1;
1898 static int hf_ieee80211_tag_cfp_max_duration = -1;
1899 static int hf_ieee80211_tag_cfp_dur_remaining = -1;
1900 static int hf_ieee80211_tim_dtim_count = -1;
1901 static int hf_ieee80211_tim_dtim_period = -1;
1902 static int hf_ieee80211_tim_bmapctl = -1;
1903 static int hf_ieee80211_tim_bmapctl_mcast = -1;
1904 static int hf_ieee80211_tim_bmapctl_offset = -1;
1905 static int hf_ieee80211_tim_partial_virtual_bitmap = -1;
1906 static int hf_ieee80211_tag_ibss_atim_window = -1;
1907 static int hf_ieee80211_tag_country_info_code = -1;
1908 static int hf_ieee80211_tag_country_info_env = -1;
1909 static int hf_ieee80211_tag_country_info_pad = -1;
1910 static int hf_ieee80211_tag_country_info_fnm = -1;
1911 static int hf_ieee80211_tag_country_info_fnm_fcn = -1;
1912 static int hf_ieee80211_tag_country_info_fnm_nc = -1;
1913 static int hf_ieee80211_tag_country_info_fnm_mtpl = -1;
1914 static int hf_ieee80211_tag_country_info_rrc = -1;
1915 static int hf_ieee80211_tag_country_info_rrc_rei = -1;
1916 static int hf_ieee80211_tag_country_info_rrc_rc = -1;
1917 static int hf_ieee80211_tag_country_info_rrc_cc = -1;
1918 static int hf_ieee80211_tag_fh_hopping_parameter_prime_radix = -1;
1919 static int hf_ieee80211_tag_fh_hopping_parameter_nb_channels = -1;
1920 static int hf_ieee80211_tag_fh_hopping_table_flag = -1;
1921 static int hf_ieee80211_tag_fh_hopping_table_number_of_sets = -1;
1922 static int hf_ieee80211_tag_fh_hopping_table_modulus = -1;
1923 static int hf_ieee80211_tag_fh_hopping_table_offset = -1;
1924 static int hf_ieee80211_tag_fh_hopping_random_table = -1;
1925 static int hf_ieee80211_tag_request = -1;
1926 static int hf_ieee80211_tag_challenge_text = -1;
1927
1928 static int hf_ieee80211_wep_iv = -1;
1929 static int hf_ieee80211_wep_iv_weak = -1;
1930 static int hf_ieee80211_tkip_extiv = -1;
1931 static int hf_ieee80211_ccmp_extiv = -1;
1932 static int hf_ieee80211_wep_key = -1;
1933 static int hf_ieee80211_wep_icv = -1;
1934
1935 static int hf_ieee80211_block_ack_request_control = -1;
1936 static int hf_ieee80211_block_ack_control = -1;
1937 static int hf_ieee80211_block_ack_control_ack_policy = -1;
1938 static int hf_ieee80211_block_ack_control_multi_tid = -1;
1939 static int hf_ieee80211_block_ack_control_compressed_bitmap = -1;
1940 static int hf_ieee80211_block_ack_control_reserved = -1;
1941
1942 static int hf_ieee80211_block_ack_control_basic_tid_info = -1;
1943 static int hf_ieee80211_block_ack_control_compressed_tid_info = -1;
1944 static int hf_ieee80211_block_ack_control_multi_tid_info = -1;
1945
1946 static int hf_ieee80211_block_ack_multi_tid_info = -1;
1947 static int hf_ieee80211_block_ack_request_type = -1;
1948 static int hf_ieee80211_block_ack_multi_tid_reserved = -1;
1949 static int hf_ieee80211_block_ack_multi_tid_value = -1;
1950 static int hf_ieee80211_block_ack_type = -1;
1951 static int hf_ieee80211_block_ack_bitmap = -1;
1952 static int hf_ieee80211_block_ack_bitmap_missing_frame = -1;
1953
1954 static int hf_ieee80211_tag_measure_request_measurement_mode = -1;
1955 static int hf_ieee80211_tag_measure_request_bssid = -1;
1956
1957 static int hf_ieee80211_tag_measure_request_subelement_length = -1;
1958 static int hf_ieee80211_tag_measure_request_beacon_sub_id = -1;
1959 static int hf_ieee80211_tag_measure_request_beacon_sub_ssid = -1;
1960 static int hf_ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition = -1;
1961 static int hf_ieee80211_tag_measure_request_beacon_sub_bri_threshold_offset = -1;
1962 static int hf_ieee80211_tag_measure_request_beacon_sub_reporting_detail = -1;
1963 static int hf_ieee80211_tag_measure_request_beacon_sub_request = -1;
1964 static int hf_ieee80211_tag_measure_request_beacon_unknown = -1;
1965
1966 static int hf_ieee80211_tag_measure_request_frame_request_type = -1;
1967 static int hf_ieee80211_tag_measure_request_mac_address  = -1;
1968 static int hf_ieee80211_tag_measure_request_peer_mac_address = -1;
1969 static int hf_ieee80211_tag_measure_request_group_id = -1;
1970
1971 static int hf_ieee80211_ht_cap = -1;
1972 static int hf_ieee80211_ht_vs_cap = -1;
1973 static int hf_ieee80211_ht_ldpc_coding = -1;
1974 static int hf_ieee80211_ht_chan_width = -1;
1975 static int hf_ieee80211_ht_sm_pwsave = -1;
1976 static int hf_ieee80211_ht_green = -1;
1977 static int hf_ieee80211_ht_short20 = -1;
1978 static int hf_ieee80211_ht_short40 = -1;
1979 static int hf_ieee80211_ht_tx_stbc = -1;
1980 static int hf_ieee80211_ht_rx_stbc = -1;
1981 static int hf_ieee80211_ht_delayed_block_ack = -1;
1982 static int hf_ieee80211_ht_max_amsdu = -1;
1983 static int hf_ieee80211_ht_dss_cck_40 = -1;
1984 static int hf_ieee80211_ht_psmp = -1;
1985 static int hf_ieee80211_ht_40_mhz_intolerant = -1;
1986 static int hf_ieee80211_ht_l_sig = -1;
1987
1988 static int hf_ieee80211_ampduparam = -1;
1989 static int hf_ieee80211_ampduparam_vs = -1;
1990 static int hf_ieee80211_ampduparam_mpdu = -1;
1991 static int hf_ieee80211_ampduparam_mpdu_start_spacing = -1;
1992 static int hf_ieee80211_ampduparam_reserved = -1;
1993
1994 static int hf_ieee80211_mcsset = -1;
1995 static int hf_ieee80211_mcsset_vs = -1;
1996 static int hf_ieee80211_mcsset_rx_bitmask = -1;
1997 static int hf_ieee80211_mcsset_rx_bitmask_0to7 = -1;
1998 static int hf_ieee80211_mcsset_rx_bitmask_8to15 = -1;
1999 static int hf_ieee80211_mcsset_rx_bitmask_16to23 = -1;
2000 static int hf_ieee80211_mcsset_rx_bitmask_24to31 = -1;
2001 static int hf_ieee80211_mcsset_rx_bitmask_32 = -1;
2002 static int hf_ieee80211_mcsset_rx_bitmask_33to38 = -1;
2003 static int hf_ieee80211_mcsset_rx_bitmask_39to52 = -1;
2004 static int hf_ieee80211_mcsset_rx_bitmask_53to76 = -1;
2005 static int hf_ieee80211_mcsset_highest_data_rate = -1;
2006 static int hf_ieee80211_mcsset_tx_mcs_set_defined = -1;
2007 static int hf_ieee80211_mcsset_tx_rx_mcs_set_not_equal = -1;
2008 static int hf_ieee80211_mcsset_tx_max_spatial_streams = -1;
2009 static int hf_ieee80211_mcsset_tx_unequal_modulation = -1;
2010
2011 static int hf_ieee80211_htex_cap = -1;
2012 static int hf_ieee80211_htex_vs_cap = -1;
2013 static int hf_ieee80211_htex_pco = -1;
2014 static int hf_ieee80211_htex_transtime = -1;
2015 static int hf_ieee80211_htex_mcs = -1;
2016 static int hf_ieee80211_htex_htc_support = -1;
2017 static int hf_ieee80211_htex_rd_responder = -1;
2018
2019 static int hf_ieee80211_txbf = -1;
2020 static int hf_ieee80211_txbf_vs = -1;
2021 static int hf_ieee80211_txbf_cap = -1;
2022 static int hf_ieee80211_txbf_rcv_ssc = -1;
2023 static int hf_ieee80211_txbf_tx_ssc = -1;
2024 static int hf_ieee80211_txbf_rcv_ndp = -1;
2025 static int hf_ieee80211_txbf_tx_ndp = -1;
2026 static int hf_ieee80211_txbf_impl_txbf = -1;
2027 static int hf_ieee80211_txbf_calib = -1;
2028 static int hf_ieee80211_txbf_expl_csi = -1;
2029 static int hf_ieee80211_txbf_expl_uncomp_fm = -1;
2030 static int hf_ieee80211_txbf_expl_comp_fm = -1;
2031 static int hf_ieee80211_txbf_expl_bf_csi = -1;
2032 static int hf_ieee80211_txbf_expl_uncomp_fm_feed = -1;
2033 static int hf_ieee80211_txbf_expl_comp_fm_feed = -1;
2034 static int hf_ieee80211_txbf_csi_num_bf_ant = -1;
2035 static int hf_ieee80211_txbf_min_group = -1;
2036 static int hf_ieee80211_txbf_uncomp_sm_bf_ant = -1;
2037 static int hf_ieee80211_txbf_comp_sm_bf_ant = -1;
2038 static int hf_ieee80211_txbf_csi_max_rows_bf = -1;
2039 static int hf_ieee80211_txbf_chan_est = -1;
2040 static int hf_ieee80211_txbf_resrv = -1;
2041
2042 /*** Begin: 802.11n D1.10 - HT Information IE  ***/
2043 static int hf_ieee80211_ht_info_primary_channel = -1;
2044
2045 static int hf_ieee80211_ht_info_delimiter1 = -1;
2046 static int hf_ieee80211_ht_info_secondary_channel_offset = -1;
2047 static int hf_ieee80211_ht_info_channel_width = -1;
2048 static int hf_ieee80211_ht_info_rifs_mode = -1;
2049 static int hf_ieee80211_ht_info_psmp_stas_only = -1;
2050 static int hf_ieee80211_ht_info_service_interval_granularity = -1;
2051
2052 static int hf_ieee80211_ht_info_delimiter2 = -1;
2053 static int hf_ieee80211_ht_info_operating_mode = -1;
2054 static int hf_ieee80211_ht_info_non_greenfield_sta_present = -1;
2055 static int hf_ieee80211_ht_info_transmit_burst_limit = -1;
2056 static int hf_ieee80211_ht_info_obss_non_ht_stas_present = -1;
2057 static int hf_ieee80211_ht_info_reserved_1 = -1;
2058
2059 static int hf_ieee80211_ht_info_delimiter3 = -1;
2060 static int hf_ieee80211_ht_info_reserved_2 = -1;
2061 static int hf_ieee80211_ht_info_dual_beacon = -1;
2062 static int hf_ieee80211_ht_info_dual_cts_protection = -1;
2063 static int hf_ieee80211_ht_info_secondary_beacon = -1;
2064 static int hf_ieee80211_ht_info_lsig_txop_protection_full_support = -1;
2065 static int hf_ieee80211_ht_info_pco_active = -1;
2066 static int hf_ieee80211_ht_info_pco_phase = -1;
2067 static int hf_ieee80211_ht_info_reserved_3 = -1;
2068 /*** End: 802.11n D1.10 - HT Information IE  ***/
2069
2070 static int hf_ieee80211_tag_ap_channel_report_regulatory_class = -1;
2071 static int hf_ieee80211_tag_ap_channel_report_channel_list = -1;
2072
2073 static int hf_ieee80211_tag_secondary_channel_offset = -1;
2074
2075 static int hf_ieee80211_tag_power_constraint_local = -1;
2076
2077 static int hf_ieee80211_tag_power_capability_min = -1;
2078 static int hf_ieee80211_tag_power_capability_max = -1;
2079
2080 static int hf_ieee80211_tag_tpc_report_trsmt_pow = -1;
2081 static int hf_ieee80211_tag_tpc_report_link_mrg = -1;
2082
2083 static int hf_ieee80211_tag_supported_channels = -1;
2084 static int hf_ieee80211_tag_supported_channels_first = -1;
2085 static int hf_ieee80211_tag_supported_channels_range = -1;
2086
2087 static int hf_ieee80211_csa_channel_switch_mode = -1;
2088 static int hf_ieee80211_csa_new_channel_number = -1;
2089 static int hf_ieee80211_csa_channel_switch_count = -1;
2090
2091 static int hf_ieee80211_tag_measure_request_token = -1;
2092 static int hf_ieee80211_tag_measure_request_mode = -1;
2093 static int hf_ieee80211_tag_measure_request_mode_parallel = -1;
2094 static int hf_ieee80211_tag_measure_request_mode_enable = -1;
2095 static int hf_ieee80211_tag_measure_request_mode_request = -1;
2096 static int hf_ieee80211_tag_measure_request_mode_report = -1;
2097 static int hf_ieee80211_tag_measure_request_mode_duration_mandatory = -1;
2098 static int hf_ieee80211_tag_measure_request_mode_reserved = -1;
2099 static int hf_ieee80211_tag_measure_request_type = -1;
2100
2101 static int hf_ieee80211_tag_measure_request_channel_number = -1;
2102 static int hf_ieee80211_tag_measure_request_start_time = -1;
2103 static int hf_ieee80211_tag_measure_request_duration = -1;
2104
2105 static int hf_ieee80211_tag_measure_request_regulatory_class = -1;
2106 static int hf_ieee80211_tag_measure_request_randomization_interval = -1;
2107
2108 static int hf_ieee80211_tag_measure_report_measurement_token = -1;
2109 static int hf_ieee80211_tag_measure_report_mode = -1;
2110 static int hf_ieee80211_tag_measure_report_mode_late = -1;
2111 static int hf_ieee80211_tag_measure_report_mode_incapable = -1;
2112 static int hf_ieee80211_tag_measure_report_mode_refused = -1;
2113 static int hf_ieee80211_tag_measure_report_mode_reserved = -1;
2114 static int hf_ieee80211_tag_measure_report_type = -1;
2115 static int hf_ieee80211_tag_measure_report_channel_number = -1;
2116 static int hf_ieee80211_tag_measure_report_start_time = -1;
2117 static int hf_ieee80211_tag_measure_report_duration = -1;
2118
2119 static int hf_ieee80211_tag_measure_basic_map_field = -1;
2120 static int hf_ieee80211_tag_measure_map_field_bss = -1;
2121 static int hf_ieee80211_tag_measure_map_field_odfm = -1;
2122 static int hf_ieee80211_tag_measure_map_field_unident_signal = -1;
2123 static int hf_ieee80211_tag_measure_map_field_radar = -1;
2124 static int hf_ieee80211_tag_measure_map_field_unmeasured = -1;
2125 static int hf_ieee80211_tag_measure_map_field_reserved = -1;
2126
2127 static int hf_ieee80211_tag_measure_cca_busy_fraction = -1;
2128
2129 static int hf_ieee80211_tag_measure_rpi_histogram_report = -1;
2130 static int hf_ieee80211_tag_measure_rpi_histogram_report_0 = -1;
2131 static int hf_ieee80211_tag_measure_rpi_histogram_report_1 = -1;
2132 static int hf_ieee80211_tag_measure_rpi_histogram_report_2 = -1;
2133 static int hf_ieee80211_tag_measure_rpi_histogram_report_3 = -1;
2134 static int hf_ieee80211_tag_measure_rpi_histogram_report_4 = -1;
2135 static int hf_ieee80211_tag_measure_rpi_histogram_report_5 = -1;
2136 static int hf_ieee80211_tag_measure_rpi_histogram_report_6 = -1;
2137 static int hf_ieee80211_tag_measure_rpi_histogram_report_7 = -1;
2138
2139 static int hf_ieee80211_tag_measure_report_regulatory_class = -1;
2140 static int hf_ieee80211_tag_measure_report_channel_load = -1;
2141 static int hf_ieee80211_tag_measure_report_frame_info = -1;
2142 static int hf_ieee80211_tag_measure_report_frame_info_phy_type = -1;
2143 static int hf_ieee80211_tag_measure_report_frame_info_frame_type = -1;
2144 static int hf_ieee80211_tag_measure_report_rcpi = -1;
2145 static int hf_ieee80211_tag_measure_report_rsni = -1;
2146 static int hf_ieee80211_tag_measure_report_bssid = -1;
2147 static int hf_ieee80211_tag_measure_report_ant_id = -1;
2148 static int hf_ieee80211_tag_measure_report_anpi = -1;
2149 static int hf_ieee80211_tag_measure_report_ipi_density_0 = -1;
2150 static int hf_ieee80211_tag_measure_report_ipi_density_1 = -1;
2151 static int hf_ieee80211_tag_measure_report_ipi_density_2 = -1;
2152 static int hf_ieee80211_tag_measure_report_ipi_density_3 = -1;
2153 static int hf_ieee80211_tag_measure_report_ipi_density_4 = -1;
2154 static int hf_ieee80211_tag_measure_report_ipi_density_5 = -1;
2155 static int hf_ieee80211_tag_measure_report_ipi_density_6 = -1;
2156 static int hf_ieee80211_tag_measure_report_ipi_density_7 = -1;
2157 static int hf_ieee80211_tag_measure_report_ipi_density_8 = -1;
2158 static int hf_ieee80211_tag_measure_report_ipi_density_9 = -1;
2159 static int hf_ieee80211_tag_measure_report_ipi_density_10 = -1;
2160 static int hf_ieee80211_tag_measure_report_parent_tsf = -1;
2161
2162 static int hf_ieee80211_tag_quiet_count = -1;
2163 static int hf_ieee80211_tag_quiet_period = -1;
2164 static int hf_ieee80211_tag_quiet_duration = -1;
2165 static int hf_ieee80211_tag_quiet_offset = -1;
2166
2167 static int hf_ieee80211_tag_dfs_owner = -1;
2168 static int hf_ieee80211_tag_dfs_recovery_interval = -1;
2169 static int hf_ieee80211_tag_dfs_channel_map = -1;
2170 static int hf_ieee80211_tag_dfs_channel_number = -1;
2171 static int hf_ieee80211_tag_dfs_map = -1;
2172
2173 static int hf_ieee80211_tag_erp_info = -1;
2174 static int hf_ieee80211_tag_erp_info_erp_present = -1;
2175 static int hf_ieee80211_tag_erp_info_use_protection = -1;
2176 static int hf_ieee80211_tag_erp_info_barker_preamble_mode = -1;
2177 static int hf_ieee80211_tag_erp_info_reserved = -1;
2178
2179 static int hf_ieee80211_tag_extended_capabilities = -1;
2180 static int hf_ieee80211_tag_extended_capabilities_b0 = -1;
2181 static int hf_ieee80211_tag_extended_capabilities_b1 = -1;
2182 static int hf_ieee80211_tag_extended_capabilities_b2 = -1;
2183 static int hf_ieee80211_tag_extended_capabilities_b3 = -1;
2184 static int hf_ieee80211_tag_extended_capabilities_b4 = -1;
2185 static int hf_ieee80211_tag_extended_capabilities_b6 = -1;
2186 static int hf_ieee80211_tag_extended_capabilities_b27 = -1;
2187 static int hf_ieee80211_tag_extended_capabilities_b28 = -1;
2188 static int hf_ieee80211_tag_extended_capabilities_b29 = -1;
2189 static int hf_ieee80211_tag_extended_capabilities_b30 = -1;
2190 static int hf_ieee80211_tag_extended_capabilities_b31 = -1;
2191 static int hf_ieee80211_tag_extended_capabilities_b32 = -1;
2192 static int hf_ieee80211_tag_extended_capabilities_b33 = -1;
2193 static int hf_ieee80211_tag_extended_capabilities_b34 = -1;
2194 static int hf_ieee80211_tag_extended_capabilities_b36 = -1;
2195 static int hf_ieee80211_tag_extended_capabilities_b37 = -1;
2196 static int hf_ieee80211_tag_extended_capabilities_b38 = -1;
2197 static int hf_ieee80211_tag_extended_capabilities_b39 = -1;
2198 static int hf_ieee80211_tag_extended_capabilities_b40 = -1;
2199 static int hf_ieee80211_tag_extended_capabilities_serv_int_granularity = -1;
2200
2201 static int hf_ieee80211_tag_cisco_ccx1_unknown = -1;
2202 static int hf_ieee80211_tag_cisco_ccx1_name = -1;
2203 static int hf_ieee80211_tag_cisco_ccx1_clients = -1;
2204
2205 static int hf_ieee80211_tag_neighbor_report_bssid = -1;
2206 static int hf_ieee80211_tag_neighbor_report_bssid_info = -1;
2207 static int hf_ieee80211_tag_neighbor_report_bssid_info_reachability = -1;
2208 static int hf_ieee80211_tag_neighbor_report_bssid_info_security = -1;
2209 static int hf_ieee80211_tag_neighbor_report_bssid_info_key_scope = -1;
2210 /*static int hf_ieee80211_tag_neighbor_report_bssid_info_capability = -1; */ /* TODO Make this the parent tree item */
2211 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_spec_mng = -1;
2212 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_qos = -1;
2213 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_apsd = -1;
2214 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_radio_msnt = -1;
2215 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_dback = -1;
2216 static int hf_ieee80211_tag_neighbor_report_bssid_info_capability_iback = -1;
2217 static int hf_ieee80211_tag_neighbor_report_bssid_info_mobility_domain = -1;
2218 static int hf_ieee80211_tag_neighbor_report_bssid_info_high_throughput = -1;
2219 static int hf_ieee80211_tag_neighbor_report_bssid_info_reserved = -1;
2220 static int hf_ieee80211_tag_neighbor_report_reg_class = -1;
2221 static int hf_ieee80211_tag_neighbor_report_channel_number = -1;
2222 static int hf_ieee80211_tag_neighbor_report_phy_type = -1;
2223
2224 static int hf_ieee80211_tag_supported_reg_classes_current = -1;
2225 static int hf_ieee80211_tag_supported_reg_classes_alternate = -1;
2226
2227 /* IEEE Std 802.11r-2008 7.3.2.47 */
2228 static int hf_ieee80211_tag_mobility_domain_mdid = -1;
2229 static int hf_ieee80211_tag_mobility_domain_ft_capab = -1;
2230 static int hf_ieee80211_tag_mobility_domain_ft_capab_ft_over_ds = -1;
2231 static int hf_ieee80211_tag_mobility_domain_ft_capab_resource_req = -1;
2232
2233 /* IEEE Std 802.11r-2008 7.3.2.48 */
2234 static int hf_ieee80211_tag_ft_mic_control = -1;
2235 static int hf_ieee80211_tag_ft_element_count = -1;
2236 static int hf_ieee80211_tag_ft_mic = -1;
2237 static int hf_ieee80211_tag_ft_anonce = -1;
2238 static int hf_ieee80211_tag_ft_snonce = -1;
2239 static int hf_ieee80211_tag_ft_subelem_id = -1;
2240 static int hf_ieee80211_tag_ft_subelem_len = -1;
2241 static int hf_ieee80211_tag_ft_subelem_data = -1;
2242 static int hf_ieee80211_tag_ft_subelem_r1kh_id = -1;
2243 static int hf_ieee80211_tag_ft_subelem_gtk_key_info = -1;
2244 static int hf_ieee80211_tag_ft_subelem_gtk_key_id = -1;
2245 static int hf_ieee80211_tag_ft_subelem_gtk_key_length = -1;
2246 static int hf_ieee80211_tag_ft_subelem_gtk_rsc = -1;
2247 static int hf_ieee80211_tag_ft_subelem_gtk_key = -1;
2248 static int hf_ieee80211_tag_ft_subelem_r0kh_id = -1;
2249 static int hf_ieee80211_tag_ft_subelem_igtk_key_id = -1;
2250 static int hf_ieee80211_tag_ft_subelem_igtk_ipn = -1;
2251 static int hf_ieee80211_tag_ft_subelem_igtk_key_length = -1;
2252 static int hf_ieee80211_tag_ft_subelem_igtk_key = -1;
2253
2254 /* IEEE Std 802.11w-2009 7.3.2.55 */
2255 static int hf_ieee80211_tag_mmie_keyid = -1;
2256 static int hf_ieee80211_tag_mmie_ipn = -1;
2257 static int hf_ieee80211_tag_mmie_mic = -1;
2258
2259 /* IEEE Std 802.11v-2011 7.3.2.61 */
2260 static int hf_ieee80211_tag_time_adv_timing_capab = -1;
2261 static int hf_ieee80211_tag_time_adv_time_value = -1;
2262 static int hf_ieee80211_tag_time_adv_time_value_year = -1;
2263 static int hf_ieee80211_tag_time_adv_time_value_month = -1;
2264 static int hf_ieee80211_tag_time_adv_time_value_day = -1;
2265 static int hf_ieee80211_tag_time_adv_time_value_hours = -1;
2266 static int hf_ieee80211_tag_time_adv_time_value_minutes = -1;
2267 static int hf_ieee80211_tag_time_adv_time_value_seconds = -1;
2268 static int hf_ieee80211_tag_time_adv_time_value_milliseconds = -1;
2269 static int hf_ieee80211_tag_time_adv_time_value_reserved = -1;
2270 static int hf_ieee80211_tag_time_adv_time_error = -1;
2271 static int hf_ieee80211_tag_time_adv_time_update_counter = -1;
2272
2273 /* IEEE Std 802.11v-2011 7.3.2.87 */
2274 static int hf_ieee80211_tag_time_zone = -1;
2275
2276 /* IEEE Std 802.11u-2011 7.3.2.92 */
2277 static int hf_ieee80211_tag_interworking_access_network_type = -1;
2278 static int hf_ieee80211_tag_interworking_internet = -1;
2279 static int hf_ieee80211_tag_interworking_asra = -1;
2280 static int hf_ieee80211_tag_interworking_esr = -1;
2281 static int hf_ieee80211_tag_interworking_uesa = -1;
2282 static int hf_ieee80211_tag_interworking_hessid = -1;
2283
2284 /* IEEE Std 802.11u-2011 7.3.2.93 */
2285 static int hf_ieee80211_tag_adv_proto_resp_len_limit = -1;
2286 static int hf_ieee80211_tag_adv_proto_pame_bi = -1;
2287 static int hf_ieee80211_tag_adv_proto_id = -1;
2288
2289 /* IEEE Std 802.11u-2011 7.3.2.96 */
2290 static int hf_ieee80211_tag_roaming_consortium_num_anqp_oi = -1;
2291 static int hf_ieee80211_tag_roaming_consortium_oi1_len = -1;
2292 static int hf_ieee80211_tag_roaming_consortium_oi2_len = -1;
2293 static int hf_ieee80211_tag_roaming_consortium_oi1 = -1;
2294 static int hf_ieee80211_tag_roaming_consortium_oi2 = -1;
2295 static int hf_ieee80211_tag_roaming_consortium_oi3 = -1;
2296
2297 /* 802.11n 7.3.2.48 */
2298 static int hf_ieee80211_hta_cc = -1;
2299 static int hf_ieee80211_hta_cap = -1;
2300 static int hf_ieee80211_hta_ext_chan_offset = -1;
2301 static int hf_ieee80211_hta_rec_tx_width = -1;
2302 static int hf_ieee80211_hta_rifs_mode = -1;
2303 static int hf_ieee80211_hta_controlled_access = -1;
2304 static int hf_ieee80211_hta_service_interval = -1;
2305 static int hf_ieee80211_hta_operating_mode = -1;
2306 static int hf_ieee80211_hta_non_gf_devices = -1;
2307 static int hf_ieee80211_hta_basic_stbc_mcs = -1;
2308 static int hf_ieee80211_hta_dual_stbc_protection = -1;
2309 static int hf_ieee80211_hta_secondary_beacon = -1;
2310 static int hf_ieee80211_hta_lsig_txop_protection = -1;
2311 static int hf_ieee80211_hta_pco_active = -1;
2312 static int hf_ieee80211_hta_pco_phase = -1;
2313
2314 static int hf_ieee80211_antsel = -1;
2315 static int hf_ieee80211_antsel_vs = -1;
2316 static int hf_ieee80211_antsel_b0 = -1;
2317 static int hf_ieee80211_antsel_b1 = -1;
2318 static int hf_ieee80211_antsel_b2 = -1;
2319 static int hf_ieee80211_antsel_b3 = -1;
2320 static int hf_ieee80211_antsel_b4 = -1;
2321 static int hf_ieee80211_antsel_b5 = -1;
2322 static int hf_ieee80211_antsel_b6 = -1;
2323 static int hf_ieee80211_antsel_b7 = -1;
2324
2325 static int hf_ieee80211_rsn_version = -1;
2326 static int hf_ieee80211_rsn_gcs = -1;
2327 static int hf_ieee80211_rsn_gcs_oui = -1;
2328 static int hf_ieee80211_rsn_gcs_type = -1;
2329 static int hf_ieee80211_rsn_gcs_80211_type = -1;
2330 static int hf_ieee80211_rsn_pcs_count = -1;
2331 static int hf_ieee80211_rsn_pcs_list = -1;
2332 static int hf_ieee80211_rsn_pcs = -1;
2333 static int hf_ieee80211_rsn_pcs_oui = -1;
2334 static int hf_ieee80211_rsn_pcs_80211_type = -1;
2335 static int hf_ieee80211_rsn_pcs_type = -1;
2336 static int hf_ieee80211_rsn_akms_count = -1;
2337 static int hf_ieee80211_rsn_akms_list = -1;
2338 static int hf_ieee80211_rsn_akms = -1;
2339 static int hf_ieee80211_rsn_akms_oui = -1;
2340 static int hf_ieee80211_rsn_akms_80211_type = -1;
2341 static int hf_ieee80211_rsn_akms_type = -1;
2342 static int hf_ieee80211_rsn_cap = -1;
2343 static int hf_ieee80211_rsn_cap_preauth = -1;
2344 static int hf_ieee80211_rsn_cap_no_pairwise = -1;
2345 static int hf_ieee80211_rsn_cap_ptksa_replay_counter = -1;
2346 static int hf_ieee80211_rsn_cap_gtksa_replay_counter = -1;
2347 static int hf_ieee80211_rsn_cap_mfpr = -1;
2348 static int hf_ieee80211_rsn_cap_mfpc = -1;
2349 static int hf_ieee80211_rsn_cap_peerkey = -1;
2350 static int hf_ieee80211_rsn_pmkid_count = -1;
2351 static int hf_ieee80211_rsn_pmkid_list = -1;
2352 static int hf_ieee80211_rsn_pmkid = -1;
2353 static int hf_ieee80211_rsn_gmcs = -1;
2354 static int hf_ieee80211_rsn_gmcs_oui = -1;
2355 static int hf_ieee80211_rsn_gmcs_type = -1;
2356 static int hf_ieee80211_rsn_gmcs_80211_type = -1;
2357
2358 static int hf_ieee80211_wfa_ie_type = -1;
2359 static int hf_ieee80211_wfa_ie_wpa_version = -1;
2360 static int hf_ieee80211_wfa_ie_wpa_mcs = -1;
2361 static int hf_ieee80211_wfa_ie_wpa_mcs_oui = -1;
2362 static int hf_ieee80211_wfa_ie_wpa_mcs_type = -1;
2363 static int hf_ieee80211_wfa_ie_wpa_mcs_wfa_type = -1;
2364 static int hf_ieee80211_wfa_ie_wpa_ucs_count = -1;
2365 static int hf_ieee80211_wfa_ie_wpa_ucs_list = -1;
2366 static int hf_ieee80211_wfa_ie_wpa_ucs = -1;
2367 static int hf_ieee80211_wfa_ie_wpa_ucs_oui = -1;
2368 static int hf_ieee80211_wfa_ie_wpa_ucs_wfa_type = -1;
2369 static int hf_ieee80211_wfa_ie_wpa_ucs_type = -1;
2370 static int hf_ieee80211_wfa_ie_wpa_akms_count = -1;
2371 static int hf_ieee80211_wfa_ie_wpa_akms_list = -1;
2372 static int hf_ieee80211_wfa_ie_wpa_akms = -1;
2373 static int hf_ieee80211_wfa_ie_wpa_akms_oui = -1;
2374 static int hf_ieee80211_wfa_ie_wpa_akms_wfa_type = -1;
2375 static int hf_ieee80211_wfa_ie_wpa_akms_type = -1;
2376 static int hf_ieee80211_wfa_ie_wme_subtype = -1;
2377 static int hf_ieee80211_wfa_ie_wme_version = -1;
2378 static int hf_ieee80211_wfa_ie_wme_qos_info = -1;
2379 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_max_sp_length = -1;
2380 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_be = -1;
2381 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_bk = -1;
2382 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vi = -1;
2383 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vo = -1;
2384 static int hf_ieee80211_wfa_ie_wme_qos_info_sta_reserved = -1;
2385 static int hf_ieee80211_wfa_ie_wme_qos_info_ap_u_apsd = -1;
2386 static int hf_ieee80211_wfa_ie_wme_qos_info_ap_parameter_set_count = -1;
2387 static int hf_ieee80211_wfa_ie_wme_qos_info_ap_reserved = -1;
2388 static int hf_ieee80211_wfa_ie_wme_reserved = -1;
2389 static int hf_ieee80211_wfa_ie_wme_ac_parameters = -1;
2390 static int hf_ieee80211_wfa_ie_wme_acp_aci_aifsn = -1;
2391 static int hf_ieee80211_wfa_ie_wme_acp_aci = -1;
2392 static int hf_ieee80211_wfa_ie_wme_acp_acm = -1;
2393 static int hf_ieee80211_wfa_ie_wme_acp_aifsn = -1;
2394 static int hf_ieee80211_wfa_ie_wme_acp_reserved = -1;
2395 static int hf_ieee80211_wfa_ie_wme_acp_ecw = -1;
2396 static int hf_ieee80211_wfa_ie_wme_acp_ecw_max = -1;
2397 static int hf_ieee80211_wfa_ie_wme_acp_ecw_min = -1;
2398 static int hf_ieee80211_wfa_ie_wme_acp_txop_limit = -1;
2399 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo = -1;
2400 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_tid = -1;
2401 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_direction = -1;
2402 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_psb = -1;
2403 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_up = -1;
2404 static int hf_ieee80211_wfa_ie_wme_tspec_tsinfo_reserved = -1;
2405 static int hf_ieee80211_wfa_ie_wme_tspec_nor_msdu = -1;
2406 static int hf_ieee80211_wfa_ie_wme_tspec_max_msdu = -1;
2407 static int hf_ieee80211_wfa_ie_wme_tspec_min_srv = -1;
2408 static int hf_ieee80211_wfa_ie_wme_tspec_max_srv = -1;
2409 static int hf_ieee80211_wfa_ie_wme_tspec_inact_int = -1;
2410 static int hf_ieee80211_wfa_ie_wme_tspec_susp_int = -1;
2411 static int hf_ieee80211_wfa_ie_wme_tspec_srv_start = -1;
2412 static int hf_ieee80211_wfa_ie_wme_tspec_min_data = -1;
2413 static int hf_ieee80211_wfa_ie_wme_tspec_mean_data = -1;
2414 static int hf_ieee80211_wfa_ie_wme_tspec_peak_data = -1;
2415 static int hf_ieee80211_wfa_ie_wme_tspec_burst_size = -1;
2416 static int hf_ieee80211_wfa_ie_wme_tspec_delay_bound = -1;
2417 static int hf_ieee80211_wfa_ie_wme_tspec_min_phy = -1;
2418 static int hf_ieee80211_wfa_ie_wme_tspec_surplus = -1;
2419 static int hf_ieee80211_wfa_ie_wme_tspec_medium = -1;
2420
2421 static int hf_ieee80211_aironet_ie_type = -1;
2422 static int hf_ieee80211_aironet_ie_version = -1;
2423 static int hf_ieee80211_aironet_ie_data = -1;
2424 static int hf_ieee80211_aironet_ie_qos_unk1 = -1;
2425 static int hf_ieee80211_aironet_ie_qos_paramset = -1;
2426 static int hf_ieee80211_aironet_ie_qos_val = -1;
2427
2428 static int hf_ieee80211_marvell_ie_type = -1;
2429 static int hf_ieee80211_marvell_ie_mesh_subtype = -1;
2430 static int hf_ieee80211_marvell_ie_mesh_version = -1;
2431 static int hf_ieee80211_marvell_ie_mesh_active_proto_id = -1;
2432 static int hf_ieee80211_marvell_ie_mesh_active_metric_id = -1;
2433 static int hf_ieee80211_marvell_ie_mesh_cap = -1;
2434 static int hf_ieee80211_marvell_ie_data = -1;
2435
2436 static int hf_ieee80211_atheros_ie_type = -1;
2437 static int hf_ieee80211_atheros_ie_subtype = -1;
2438 static int hf_ieee80211_atheros_ie_version = -1;
2439 static int hf_ieee80211_atheros_ie_cap_f_turbop = -1;
2440 static int hf_ieee80211_atheros_ie_cap_f_comp = -1;
2441 static int hf_ieee80211_atheros_ie_cap_f_ff = -1;
2442 static int hf_ieee80211_atheros_ie_cap_f_xr = -1;
2443 static int hf_ieee80211_atheros_ie_cap_f_ar = -1;
2444 static int hf_ieee80211_atheros_ie_cap_f_burst = -1;
2445 static int hf_ieee80211_atheros_ie_cap_f_wme = -1;
2446 static int hf_ieee80211_atheros_ie_cap_f_boost = -1;
2447 static int hf_ieee80211_atheros_ie_advcap_cap = -1;
2448 static int hf_ieee80211_atheros_ie_advcap_defkey = -1;
2449 static int hf_ieee80211_atheros_ie_xr_info = -1;
2450 static int hf_ieee80211_atheros_ie_xr_base_bssid = -1;
2451 static int hf_ieee80211_atheros_ie_xr_xr_bssid = -1;
2452 static int hf_ieee80211_atheros_ie_xr_xr_beacon = -1;
2453 static int hf_ieee80211_atheros_ie_xr_base_cap = -1;
2454 static int hf_ieee80211_atheros_ie_xr_xr_cap = -1;
2455 static int hf_ieee80211_atheros_ie_data = -1;
2456
2457 /*QBSS - Version 1,2,802.11e*/
2458
2459 static int hf_ieee80211_qbss2_cal = -1;
2460 static int hf_ieee80211_qbss2_gl = -1;
2461 static int hf_ieee80211_qbss_cu = -1;
2462 static int hf_ieee80211_qbss2_cu = -1;
2463 static int hf_ieee80211_qbss_scount = -1;
2464 static int hf_ieee80211_qbss2_scount = -1;
2465 static int hf_ieee80211_qbss_version = -1;
2466 static int hf_ieee80211_qbss_adc = -1;
2467
2468 static int hf_ieee80211_tsinfo = -1;
2469 static int hf_ieee80211_tsinfo_type = -1;
2470 static int hf_ieee80211_tsinfo_tsid = -1;
2471 static int hf_ieee80211_tsinfo_dir = -1;
2472 static int hf_ieee80211_tsinfo_access = -1;
2473 static int hf_ieee80211_tsinfo_agg = -1;
2474 static int hf_ieee80211_tsinfo_apsd = -1;
2475 static int hf_ieee80211_tsinfo_up = -1;
2476 static int hf_ieee80211_tsinfo_ack = -1;
2477 static int hf_ieee80211_tsinfo_sched = -1;
2478 static int hf_ieee80211_tsinfo_rsv = -1;
2479
2480 static const int *ieee80211_tsinfo_fields[] = {
2481   &hf_ieee80211_tsinfo_type,
2482   &hf_ieee80211_tsinfo_tsid,
2483   &hf_ieee80211_tsinfo_dir,
2484   &hf_ieee80211_tsinfo_access,
2485   &hf_ieee80211_tsinfo_agg,
2486   &hf_ieee80211_tsinfo_apsd,
2487   &hf_ieee80211_tsinfo_up,
2488   &hf_ieee80211_tsinfo_ack,
2489   &hf_ieee80211_tsinfo_sched,
2490   &hf_ieee80211_tsinfo_rsv,
2491   NULL
2492 };
2493
2494 static int hf_ieee80211_tspec_nor_msdu = -1;
2495 static int hf_ieee80211_tspec_max_msdu = -1;
2496 static int hf_ieee80211_tspec_min_srv = -1;
2497 static int hf_ieee80211_tspec_max_srv = -1;
2498 static int hf_ieee80211_tspec_inact_int = -1;
2499 static int hf_ieee80211_tspec_susp_int = -1;
2500 static int hf_ieee80211_tspec_srv_start = -1;
2501 static int hf_ieee80211_tspec_min_data = -1;
2502 static int hf_ieee80211_tspec_mean_data = -1;
2503 static int hf_ieee80211_tspec_peak_data = -1;
2504 static int hf_ieee80211_tspec_burst_size = -1;
2505 static int hf_ieee80211_tspec_delay_bound = -1;
2506 static int hf_ieee80211_tspec_min_phy = -1;
2507 static int hf_ieee80211_tspec_surplus = -1;
2508 static int hf_ieee80211_tspec_medium = -1;
2509 static int hf_ieee80211_ts_delay = -1;
2510 static int hf_ieee80211_tclas_process = -1;
2511 static int hf_ieee80211_tag_qos_cap_qos_info = -1;
2512 static int hf_ieee80211_qos_info_field_vo_uapsd = -1;
2513 static int hf_ieee80211_qos_info_field_vi_uapsd = -1;
2514 static int hf_ieee80211_qos_info_field_bk_uapsd = -1;
2515 static int hf_ieee80211_qos_info_field_be_uapsd = -1;
2516 static int hf_ieee80211_qos_info_field_qack = -1;
2517 static int hf_ieee80211_qos_info_field_max_sp_length = -1;
2518 static int hf_ieee80211_qos_info_field_more_data_ack = -1;
2519 static int hf_ieee80211_qos_info_field_edca_upd_cnt = -1;
2520 static int hf_ieee80211_qos_info_field_queue_req = -1;
2521 static int hf_ieee80211_qos_info_field_txop_req = -1;
2522 static int hf_ieee80211_qos_info_field_reserved = -1;
2523 static int hf_ieee80211_tag_ext_supp_rates = -1;
2524 static int hf_ieee80211_sched_info = -1;
2525 static int hf_ieee80211_sched_info_agg = -1;
2526 static int hf_ieee80211_sched_info_tsid = -1;
2527 static int hf_ieee80211_sched_info_dir = -1;
2528 static int hf_ieee80211_sched_srv_start = -1;
2529 static int hf_ieee80211_sched_srv_int = -1;
2530 static int hf_ieee80211_sched_spec_int = -1;
2531 static int hf_ieee80211_tclas_up = -1;
2532 static int hf_ieee80211_tclas_class_type = -1;
2533 static int hf_ieee80211_tclas_class_mask = -1;
2534 static int hf_ieee80211_tclas_src_mac_addr = -1;
2535 static int hf_ieee80211_tclas_dst_mac_addr = -1;
2536 static int hf_ieee80211_tclas_ether_type = -1;
2537 static int hf_ieee80211_tclas_version = -1;
2538 static int hf_ieee80211_tclas_ipv4_src = -1;
2539 static int hf_ieee80211_tclas_ipv4_dst = -1;
2540 static int hf_ieee80211_tclas_src_port = -1;
2541 static int hf_ieee80211_tclas_dst_port = -1;
2542 static int hf_ieee80211_tclas_dscp = -1;
2543 static int hf_ieee80211_tclas_protocol = -1;
2544 static int hf_ieee80211_tclas_ipv6_src = -1;
2545 static int hf_ieee80211_tclas_ipv6_dst = -1;
2546 static int hf_ieee80211_tclas_flow = -1;
2547 static int hf_ieee80211_tclas_tag_type = -1;
2548
2549 static int hf_ieee80211_aruba = -1;
2550 static int hf_ieee80211_aruba_hb_seq = -1;
2551 static int hf_ieee80211_aruba_mtu = -1;
2552
2553 static int hf_ieee80211_tag_vendor_oui_type = -1;
2554
2555 /* IEEE Std 802.11z-2010 7.3.2.62 */
2556 static int hf_ieee80211_tag_link_id_bssid = -1;
2557 static int hf_ieee80211_tag_link_id_init_sta = -1;
2558 static int hf_ieee80211_tag_link_id_resp_sta = -1;
2559
2560 /* IEEE Std 802.11z-2010 7.3.2.63 */
2561 static int hf_ieee80211_tag_wakeup_schedule_offset = -1;
2562 static int hf_ieee80211_tag_wakeup_schedule_interval = -1;
2563 static int hf_ieee80211_tag_wakeup_schedule_awake_window_slots = -1;
2564 static int hf_ieee80211_tag_wakeup_schedule_max_awake_dur = -1;
2565 static int hf_ieee80211_tag_wakeup_schedule_idle_count = -1;
2566
2567 /* IEEE Std 802.11z-2010 7.3.2.64 */
2568 static int hf_ieee80211_tag_channel_switch_timing_switch_time = -1;
2569 static int hf_ieee80211_tag_channel_switch_timing_switch_timeout = -1;
2570
2571 /* IEEE Std 802.11z-2010 7.3.2.65 */
2572 static int hf_ieee80211_tag_pti_control_tid = -1;
2573 static int hf_ieee80211_tag_pti_control_sequence_control = -1;
2574
2575 /* IEEE Std 802.11z-2010 7.3.2.66 */
2576 static int hf_ieee80211_tag_pu_buffer_status_ac_bk = -1;
2577 static int hf_ieee80211_tag_pu_buffer_status_ac_be = -1;
2578 static int hf_ieee80211_tag_pu_buffer_status_ac_vi = -1;
2579 static int hf_ieee80211_tag_pu_buffer_status_ac_vo = -1;
2580
2581 /* IEEE Std 802.11r-2008 7.3.2.49 */
2582 static int hf_ieee80211_tag_timeout_int_type = -1;
2583 static int hf_ieee80211_tag_timeout_int_value = -1;
2584
2585 /* Ethertype 89-0d */
2586 static int hf_ieee80211_data_encap_payload_type = -1;
2587
2588 /* ************************************************************************* */
2589 /*                               Protocol trees                              */
2590 /* ************************************************************************* */
2591 static gint ett_80211 = -1;
2592 static gint ett_proto_flags = -1;
2593 static gint ett_cap_tree = -1;
2594 static gint ett_fc_tree = -1;
2595 static gint ett_cntrl_wrapper_fc = -1;
2596 static gint ett_cntrl_wrapper_payload = -1;
2597 static gint ett_fragments = -1;
2598 static gint ett_fragment = -1;
2599 static gint ett_block_ack = -1;
2600 static gint ett_block_ack_bitmap = -1;
2601 static gint ett_ath_cap_tree = -1;
2602
2603
2604 static gint ett_80211_mgt = -1;
2605 static gint ett_fixed_parameters = -1;
2606 static gint ett_tagged_parameters = -1;
2607 static gint ett_tag_bmapctl_tree = -1;
2608 static gint ett_tag_country_fnm_tree = -1;
2609 static gint ett_tag_country_rcc_tree = -1;
2610 static gint ett_qos_parameters = -1;
2611 static gint ett_qos_ps_buf_state = -1;
2612 static gint ett_qos_info_field_tree = -1;
2613 static gint ett_wep_parameters = -1;
2614 static gint ett_msh_control = -1;
2615 static gint ett_hwmp_targ_flags_tree = -1;
2616
2617 static gint ett_rsn_gcs_tree = -1;
2618 static gint ett_rsn_pcs_tree = -1;
2619 static gint ett_rsn_sub_pcs_tree = -1;
2620 static gint ett_rsn_akms_tree = -1;
2621 static gint ett_rsn_sub_akms_tree = -1;
2622 static gint ett_rsn_cap_tree = -1;
2623 static gint ett_rsn_pmkid_tree = -1;
2624 static gint ett_rsn_gmcs_tree = -1;
2625
2626 static gint ett_wpa_mcs_tree = -1;
2627 static gint ett_wpa_ucs_tree = -1;
2628 static gint ett_wpa_sub_ucs_tree = -1;
2629 static gint ett_wpa_akms_tree = -1;
2630 static gint ett_wpa_sub_akms_tree = -1;
2631 static gint ett_wme_ac = -1;
2632 static gint ett_wme_aci_aifsn = -1;
2633 static gint ett_wme_ecw = -1;
2634 static gint ett_wme_qos_info = -1;
2635
2636 static gint ett_ht_cap_tree = -1;
2637 static gint ett_ampduparam_tree = -1;
2638 static gint ett_mcsset_tree = -1;
2639 static gint ett_mcsbit_tree = -1;
2640 static gint ett_htex_cap_tree = -1;
2641 static gint ett_txbf_tree = -1;
2642 static gint ett_antsel_tree = -1;
2643 static gint ett_hta_cap_tree = -1;
2644 static gint ett_hta_cap1_tree = -1;
2645 static gint ett_hta_cap2_tree = -1;
2646 static gint ett_htc_tree = -1;
2647
2648 static gint ett_ht_info_delimiter1_tree = -1;
2649 static gint ett_ht_info_delimiter2_tree = -1;
2650 static gint ett_ht_info_delimiter3_tree = -1;
2651
2652 static gint ett_tag_measure_request_mode_tree = -1;
2653 static gint ett_tag_measure_request_type_tree = -1;
2654 static gint ett_tag_measure_report_mode_tree = -1;
2655 static gint ett_tag_measure_report_type_tree = -1;
2656 static gint ett_tag_measure_report_basic_map_tree = -1;
2657 static gint ett_tag_measure_report_rpi_tree = -1;
2658 static gint ett_tag_measure_report_frame_tree = -1;
2659 static gint ett_tag_dfs_map_tree = -1;
2660 static gint ett_tag_erp_info_tree = -1;
2661 static gint ett_tag_ex_cap = -1;
2662
2663 static gint ett_tag_supported_channels = -1;
2664
2665 static gint ett_tag_neighbor_report_bssid_info_tree = -1;
2666 static gint ett_tag_neighbor_report_bssid_info_capability_tree = -1;
2667 static gint ett_tag_neighbor_report_sub_tag_tree = -1;
2668
2669 static gint ett_tag_time_adv_tree = -1;
2670
2671 static gint ett_ff_ba_param_tree = -1;
2672 static gint ett_ff_ba_ssc_tree = -1;
2673 static gint ett_ff_delba_param_tree = -1;
2674 static gint ett_ff_qos_info = -1;
2675 static gint ett_ff_sm_pwr_save = -1;
2676 static gint ett_ff_psmp_param_set = -1;
2677 static gint ett_ff_mimo_cntrl = -1;
2678 static gint ett_ff_ant_sel = -1;
2679 static gint ett_mimo_report = -1;
2680 static gint ett_ff_chan_switch_announce = -1;
2681 static gint ett_ff_ht_info = -1;
2682 static gint ett_ff_psmp_sta_info = -1;
2683
2684 static gint ett_msdu_aggregation_parent_tree = -1;
2685 static gint ett_msdu_aggregation_subframe_tree = -1;
2686
2687 static gint ett_80211_mgt_ie = -1;
2688 static gint ett_tsinfo_tree = -1;
2689 static gint ett_sched_tree = -1;
2690
2691 static gint ett_fcs = -1;
2692
2693 static gint ett_adv_proto = -1;
2694 static gint ett_adv_proto_tuple = -1;
2695 static gint ett_gas_query = -1;
2696 static gint ett_gas_anqp = -1;
2697 static gint ett_nai_realm = -1;
2698 static gint ett_nai_realm_eap = -1;
2699 static gint ett_anqp_vendor_capab = -1;
2700
2701 static const fragment_items frag_items = {
2702   &ett_fragment,
2703   &ett_fragments,
2704   &hf_ieee80211_fragments,
2705   &hf_ieee80211_fragment,
2706   &hf_ieee80211_fragment_overlap,
2707   &hf_ieee80211_fragment_overlap_conflict,
2708   &hf_ieee80211_fragment_multiple_tails,
2709   &hf_ieee80211_fragment_too_long_fragment,
2710   &hf_ieee80211_fragment_error,
2711   &hf_ieee80211_fragment_count,
2712   &hf_ieee80211_reassembled_in,
2713   &hf_ieee80211_reassembled_length,
2714   "fragments"
2715 };
2716
2717 static enum_val_t wlan_ignore_wep_options[] = {
2718   { "no",         "No",               WLAN_IGNORE_WEP_NO    },
2719   { "without_iv", "Yes - without IV", WLAN_IGNORE_WEP_WO_IV },
2720   { "with_iv",    "Yes - with IV",    WLAN_IGNORE_WEP_W_IV  },
2721   { NULL,         NULL,               0                     }
2722 };
2723
2724 static dissector_handle_t ieee80211_handle;
2725 static dissector_handle_t llc_handle;
2726 static dissector_handle_t ipx_handle;
2727 static dissector_handle_t eth_withoutfcs_handle;
2728 static dissector_handle_t data_handle;
2729
2730 static int wlan_tap = -1;
2731
2732 static const value_string access_network_type_vals[] =
2733 {
2734   { 0, "Private network" },
2735   { 1, "Private network with guest access" },
2736   { 2, "Chargeable public network" },
2737   { 3, "Free public network" },
2738   { 4, "Personal device network" },
2739   { 5, "Emergency services only network" },
2740   { 14, "Test or experimental" },
2741   { 15, "Wildcard" },
2742   { 0, NULL }
2743 };
2744
2745 static const value_string adv_proto_id_vals[] =
2746 {
2747   {0, "Access Network Query Protocol"},
2748   {1, "MIH Information Service"},
2749   {2, "MIH Command and Event Services Capability Discovery"},
2750   {3, "Emergency Alert System (EAS)"},
2751   {4, "Location-to-Service Translation Protocol"},
2752   {221, "Vendor Specific"},
2753   {0, NULL}
2754 };
2755
2756 static const value_string timeout_int_types[] =
2757 {
2758   {1, "Reassociation deadline interval (TUs)"},
2759   {2, "Key lifetime interval (seconds)"},
2760   {3, "Association Comeback time (TUs)"},
2761   {0, NULL}
2762 };
2763
2764 static const value_string tdls_action_codes[] ={
2765   {TDLS_SETUP_REQUEST, "TDLS Setup Request"},
2766   {TDLS_SETUP_RESPONSE, "TDLS Setup Response"},
2767   {TDLS_SETUP_CONFIRM, "TDLS Setup Confirm"},
2768   {TDLS_TEARDOWN, "TDLS Teardown"},
2769   {TDLS_PEER_TRAFFIC_INDICATION, "TDLS Peer Traffic Indication"},
2770   {TDLS_CHANNEL_SWITCH_REQUEST, "TDLS Channel Switch Request"},
2771   {TDLS_CHANNEL_SWITCH_RESPONSE, "TDLS Channel Switch Response"},
2772   {TDLS_PEER_PSM_REQUEST, "TDLS Peer PSM Request"},
2773   {TDLS_PEER_PSM_RESPONSE, "TDLS Peer PSM Response"},
2774   {TDLS_PEER_TRAFFIC_RESPONSE, "TDLS Peer Traffic Response"},
2775   {TDLS_DISCOVERY_REQUEST, "TDLS Discovery Request"},
2776   {0, NULL}
2777 };
2778
2779 AIRPDCAP_CONTEXT airpdcap_ctx;
2780
2781 #define PSMP_STA_INFO_BROADCAST 0
2782 #define PSMP_STA_INFO_MULTICAST 1
2783 #define PSMP_STA_INFO_INDIVIDUALLY_ADDRESSED 2
2784
2785 #define PSMP_STA_INFO_FLAG_TYPE         0x00000003
2786 #define PSMP_STA_INFO_FLAG_DTT_START    0x00001FFC
2787 #define PSMP_STA_INFO_FLAG_DTT_DURATION 0x001FE000
2788
2789 #define PSMP_STA_INFO_FLAG_STA_ID       0x001FFFE0
2790
2791 #define PSMP_STA_INFO_FLAG_UTT_START    0x0000FFE0
2792 #define PSMP_STA_INFO_FLAG_UTT_DURATION 0x03FF0000
2793
2794 #define PSMP_STA_INFO_FLAG_IA_RESERVED  0xFC000000
2795
2796 static const value_string ff_psmp_sta_info_flags[] = {
2797   { PSMP_STA_INFO_BROADCAST, "Broadcast"},
2798   { PSMP_STA_INFO_MULTICAST, "Multicast"},
2799   { PSMP_STA_INFO_INDIVIDUALLY_ADDRESSED, "Individually Addressed"},
2800   {0, NULL}
2801 };
2802
2803 static void
2804 beacon_interval_base_custom(gchar *result, guint32 beacon_interval)
2805 {
2806    double temp_double;
2807    temp_double = (double)beacon_interval;
2808    g_snprintf(result, ITEM_LABEL_LENGTH, "%f [Seconds]", (temp_double * 1024 / 1000000) );
2809 }
2810
2811 /* ************************************************************************* */
2812 /*            Return the length of the current header (in bytes)             */
2813 /* ************************************************************************* */
2814 static int
2815 find_header_length (guint16 fcf, guint16 ctrl_fcf, gboolean is_ht)
2816 {
2817   int len;
2818   guint16 cw_fcf;
2819
2820   switch (FCF_FRAME_TYPE (fcf)) {
2821
2822   case MGT_FRAME:
2823     if (is_ht && IS_STRICTLY_ORDERED(FCF_FLAGS(fcf)))
2824       return MGT_FRAME_HDR_LEN + 4;
2825
2826     return MGT_FRAME_HDR_LEN;
2827
2828   case CONTROL_FRAME:
2829     if (COMPOSE_FRAME_TYPE(fcf) == CTRL_CONTROL_WRAPPER) {
2830       len = 6;
2831       cw_fcf = ctrl_fcf;
2832     } else {
2833       len = 0;
2834       cw_fcf = fcf;
2835     }
2836     switch (COMPOSE_FRAME_TYPE (cw_fcf)) {
2837
2838     case CTRL_CTS:
2839     case CTRL_ACKNOWLEDGEMENT:
2840       return len + 10;
2841
2842     case CTRL_RTS:
2843     case CTRL_PS_POLL:
2844     case CTRL_CFP_END:
2845     case CTRL_CFP_ENDACK:
2846     case CTRL_BLOCK_ACK_REQ:
2847     case CTRL_BLOCK_ACK:
2848       return len + 16;
2849     }
2850     return len + 4;  /* XXX */
2851
2852   case DATA_FRAME:
2853     len = (FCF_ADDR_SELECTOR(fcf) ==
2854       DATA_ADDR_T4) ? DATA_LONG_HDR_LEN : DATA_SHORT_HDR_LEN;
2855
2856     if (DATA_FRAME_IS_QOS(COMPOSE_FRAME_TYPE(fcf))) {
2857       len += 2;
2858       if (is_ht && IS_STRICTLY_ORDERED(FCF_FLAGS(fcf))) {
2859         len += 4;
2860       }
2861     }
2862
2863     return len;
2864
2865   default:
2866     return 4;  /* XXX */
2867   }
2868 }
2869
2870 /* ************************************************************************* */
2871 /* Mesh Control field helper functions
2872  *
2873  * Per IEEE 802.11s Draft 12.0 section 7.2.2.1:
2874  *
2875  * The frame body consists of either:
2876  * The MSDU (or a fragment thereof), the Mesh Control field (if and only if the
2877  * frame is transmitted by a mesh STA and the Mesh Control Present subfield of
2878  * the QoS Control field is 1)...
2879  *
2880  * We need a stateful sniffer for that.  For now, use heuristics.
2881  *
2882  * Notably, only mesh data frames contain the Mesh Control field in the header.
2883  * Other frames that contain mesh control (i.e., multihop action frames) have
2884  * it deeper in the frame body where it can be definitively identified.
2885  * Further, mesh data frames always have to-ds and from-ds either 11 or 01.  We
2886  * use these facts to make our heuristics more reliable.
2887  * ************************************************************************* */
2888 static int
2889 has_mesh_control(guint16 fcf, guint16 qos_ctl, guint8 mesh_flags)
2890 {
2891   /* assume mesh control present if the QOS field's Mesh Control Present bit is
2892    * set, all reserved bits in the mesh_flags field are zero, and the address
2893    * extension mode is not a reserved value.
2894    */
2895   return ((FCF_ADDR_SELECTOR(fcf) == DATA_ADDR_T4 || FCF_ADDR_SELECTOR(fcf) == DATA_ADDR_T2) &&
2896           (QOS_MESH_CONTROL_PRESENT(qos_ctl)) &&
2897           (mesh_flags & ~MESH_FLAGS_ADDRESS_EXTENSION) == 0 &&
2898           (mesh_flags & MESH_FLAGS_ADDRESS_EXTENSION) != MESH_FLAGS_ADDRESS_EXTENSION);
2899 }
2900
2901 static int
2902 find_mesh_control_length(guint8 mesh_flags)
2903 {
2904   return 6 + 6*(mesh_flags & MESH_FLAGS_ADDRESS_EXTENSION);
2905 }
2906
2907 mimo_control_t get_mimo_control (tvbuff_t *tvb, int offset)
2908 {
2909   guint16 mimo;
2910   mimo_control_t output;
2911
2912   mimo = tvb_get_letohs (tvb, offset);
2913
2914   output.nc = (mimo & 0x0003) + 1;
2915   output.nr = ((mimo & 0x000C) >> 2) + 1;
2916   output.chan_width = (mimo & 0x0010) >> 4;
2917   output.coefficient_size = 4; /* XXX - Is this a good default? */
2918
2919   switch ((mimo & 0x0060) >> 5)
2920     {
2921       case 0:
2922         output.grouping = 1;
2923         break;
2924
2925       case 1:
2926         output.grouping = 2;
2927         break;
2928
2929       case 2:
2930         output.grouping = 4;
2931         break;
2932
2933       default:
2934         output.grouping = 1;
2935         break;
2936     }
2937
2938   switch ((mimo & 0x0180) >> 7)
2939     {
2940       case 0:
2941         output.coefficient_size = 4;
2942         break;
2943
2944       case 1:
2945         output.coefficient_size = 5;
2946         break;
2947
2948       case 2:
2949         output.coefficient_size = 6;
2950         break;
2951
2952       case 3:
2953         output.coefficient_size = 8;
2954         break;
2955     }
2956
2957   output.codebook_info = (mimo & 0x0600) >> 9;
2958   output.remaining_matrix_segment = (mimo & 0x3800) >> 11;
2959
2960   return output;
2961 }
2962
2963 int get_mimo_na (guint8 nr, guint8 nc)
2964 {
2965   if (nr == 2 && nc == 1){
2966     return 2;
2967   }else if (nr == 2 && nc == 2){
2968     return 2;
2969   }else if (nr == 3 && nc == 1){
2970     return 4;
2971   }else if (nr == 3 && nc == 2){
2972     return 6;
2973   }else if (nr == 3 && nc == 3){
2974     return 6;
2975   }else if (nr == 4 && nc == 1){
2976     return 6;
2977   }else if (nr == 4 && nc == 2){
2978     return 10;
2979   }else if (nr == 4 && nc == 3){
2980     return 12;
2981   }else if (nr == 4 && nc == 4){
2982     return 12;
2983   }else{
2984     return 0;
2985   }
2986 }
2987
2988 int get_mimo_ns (gboolean chan_width, guint8 output_grouping)
2989 {
2990   int ns = 0;
2991
2992   if (chan_width)
2993   {
2994     switch (output_grouping)
2995       {
2996         case 1:
2997           ns = 114;
2998           break;
2999
3000           case 2:
3001             ns = 58;
3002             break;
3003
3004           case 4:
3005             ns = 30;
3006             break;
3007
3008           default:
3009             ns = 0;
3010       }
3011   } else {
3012     switch (output_grouping)
3013       {
3014         case 1:
3015           ns = 56;
3016           break;
3017
3018         case 2:
3019           ns = 30;
3020           break;
3021
3022         case 4:
3023           ns = 16;
3024           break;
3025
3026         default:
3027           ns = 0;
3028       }
3029   }
3030
3031   return ns;
3032 }
3033
3034 int add_mimo_csi_matrices_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl)
3035 {
3036   proto_item *snr_item;
3037   proto_tree *snr_tree;
3038   int csi_matrix_size, start_offset;
3039   int ns, i;
3040
3041   start_offset = offset;
3042   snr_item = proto_tree_add_text(tree, tvb, offset, mimo_cntrl.nc, "Signal to Noise Ratio");
3043   snr_tree = proto_item_add_subtree (snr_item, ett_mimo_report);
3044
3045   for (i = 1; i <= mimo_cntrl.nr; i++)
3046   {
3047     guint8 snr;
3048
3049     snr = tvb_get_guint8(tvb, offset);
3050     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);
3051     offset++;
3052   }
3053
3054   ns = get_mimo_ns(mimo_cntrl.chan_width, mimo_cntrl.grouping);
3055   csi_matrix_size = ns*(3+(2*mimo_cntrl.nc*mimo_cntrl.nr*mimo_cntrl.coefficient_size));
3056   csi_matrix_size = roundup2(csi_matrix_size, 8) / 8;
3057   proto_tree_add_text(tree, tvb, offset, csi_matrix_size, "CSI Matrices");
3058   offset += csi_matrix_size;
3059   return offset - start_offset;
3060 }
3061
3062 int add_mimo_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl)
3063 {
3064   proto_item *snr_item;
3065   proto_tree *snr_tree;
3066   int csi_matrix_size, start_offset;
3067   int ns, i;
3068
3069   start_offset = offset;
3070   snr_item = proto_tree_add_text(tree, tvb, offset, mimo_cntrl.nc, "Signal to Noise Ratio");
3071   snr_tree = proto_item_add_subtree (snr_item, ett_mimo_report);
3072
3073   for (i = 1; i <= mimo_cntrl.nc; i++)
3074   {
3075     guint8 snr;
3076
3077     snr = tvb_get_guint8(tvb, offset);
3078     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);
3079     offset++;
3080   }
3081
3082   ns = get_mimo_ns(mimo_cntrl.chan_width, mimo_cntrl.grouping);
3083   csi_matrix_size = ns*(2*mimo_cntrl.nc*mimo_cntrl.nr*mimo_cntrl.coefficient_size);
3084   csi_matrix_size = roundup2(csi_matrix_size, 8) / 8;
3085   proto_tree_add_text(tree, tvb, offset, csi_matrix_size, "Beamforming Feedback Matrices");
3086   offset += csi_matrix_size;
3087   return offset - start_offset;
3088 }
3089
3090 int add_mimo_compressed_beamforming_feedback_report (proto_tree *tree, tvbuff_t *tvb, int offset, mimo_control_t mimo_cntrl)
3091 {
3092   proto_item *snr_item;
3093   proto_tree *snr_tree;
3094   int csi_matrix_size, start_offset;
3095   int ns, na, i;
3096
3097   start_offset = offset;
3098   snr_item = proto_tree_add_text(tree, tvb, offset, mimo_cntrl.nc, "Signal to Noise Ratio");
3099   snr_tree = proto_item_add_subtree (snr_item, ett_mimo_report);
3100
3101   for (i = 1; i <= mimo_cntrl.nc; i++)
3102   {
3103     guint8 snr;
3104
3105     snr = tvb_get_guint8(tvb, offset);
3106     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);
3107     offset++;
3108   }
3109
3110   na = get_mimo_na(mimo_cntrl.nr, mimo_cntrl.nc);
3111   ns = get_mimo_ns(mimo_cntrl.chan_width, mimo_cntrl.grouping);
3112   csi_matrix_size = ns*(na*((mimo_cntrl.codebook_info+1)*2 + 2)/2);
3113   csi_matrix_size = roundup2(csi_matrix_size, 8) / 8;
3114   proto_tree_add_text(tree, tvb, offset, csi_matrix_size, "Compressed Beamforming Feedback Matrices");
3115   offset += csi_matrix_size;
3116   return offset - start_offset;
3117 }
3118
3119 /* ************************************************************************* */
3120 /*          This is the capture function used to update packet counts        */
3121 /* ************************************************************************* */
3122 static void
3123 capture_ieee80211_common (const guchar * pd, int offset, int len,
3124         packet_counts * ld, gboolean fixed_length_header,
3125         gboolean datapad, gboolean is_ht)
3126 {
3127   guint16 fcf, hdr_length;
3128
3129   if (!BYTES_ARE_IN_FRAME(offset, len, 2)) {
3130     ld->other++;
3131     return;
3132   }
3133
3134   fcf = pletohs (&pd[offset]);
3135
3136   if (IS_PROTECTED(FCF_FLAGS(fcf)) && wlan_ignore_wep == WLAN_IGNORE_WEP_NO) {
3137     ld->other++;
3138     return;
3139   }
3140
3141   switch (COMPOSE_FRAME_TYPE (fcf)) {
3142
3143     case DATA:          /* We got a data frame */
3144     case DATA_CF_ACK:   /* Data with ACK */
3145     case DATA_CF_POLL:
3146     case DATA_CF_ACK_POLL:
3147     case DATA_QOS_DATA:
3148     {
3149       if (fixed_length_header) {
3150         hdr_length = DATA_LONG_HDR_LEN;
3151       } else {
3152         hdr_length = find_header_length (fcf, 0, is_ht);
3153         /* adjust the header length depending on the Mesh Control field */
3154         if (FCF_FRAME_TYPE(fcf) == DATA_FRAME &&
3155             DATA_FRAME_IS_QOS(COMPOSE_FRAME_TYPE(fcf))) {
3156
3157           guint8 mesh_flags = pd[hdr_length];
3158           guint16 qosoff = hdr_length - 2;
3159           qosoff -= is_ht ? 4 : 0;
3160           if (has_mesh_control(fcf, pletohs(&pd[qosoff]), mesh_flags)) {
3161             hdr_length += find_mesh_control_length(mesh_flags);
3162           }
3163         }
3164         if (datapad)
3165           hdr_length = roundup2(hdr_length, 4);
3166       }
3167       /* I guess some bridges take Netware Ethernet_802_3 frames,
3168          which are 802.3 frames (with a length field rather than
3169          a type field, but with no 802.2 header in the payload),
3170          and just stick the payload into an 802.11 frame.  I've seen
3171          captures that show frames of that sort.
3172
3173          We also handle some odd form of encapsulation in which a
3174          complete Ethernet frame is encapsulated within an 802.11
3175          data frame, with no 802.2 header.  This has been seen
3176          from some hardware.
3177
3178          On top of that, at least at some point it appeared that
3179          the OLPC XO sent out frames with two bytes of 0 between
3180          the "end" of the 802.11 header and the beginning of
3181          the payload.
3182
3183          So, if the packet doesn't start with 0xaa 0xaa:
3184
3185            we first use the same scheme that linux-wlan-ng does to detect
3186            those encapsulated Ethernet frames, namely looking to see whether
3187            the frame either starts with 6 octets that match the destination
3188            address from the 802.11 header or has 6 octets that match the
3189            source address from the 802.11 header following the first 6 octets,
3190            and, if so, treat it as an encapsulated Ethernet frame;
3191
3192            otherwise, we use the same scheme that we use in the Ethernet
3193            dissector to recognize Netware 802.3 frames, namely checking
3194            whether the packet starts with 0xff 0xff and, if so, treat it
3195            as an encapsulated IPX frame, and then check whether the
3196            packet starts with 0x00 0x00 and, if so, treat it as an OLPC
3197            frame. */
3198       if (!BYTES_ARE_IN_FRAME(offset+hdr_length, len, 2)) {
3199         ld->other++;
3200         return;
3201       }
3202       if (pd[offset+hdr_length] != 0xaa && pd[offset+hdr_length+1] != 0xaa) {
3203 #if 0
3204         /* XXX - this requires us to parse the header to find the source
3205            and destination addresses. */
3206         if (BYTES_ARE_IN_FRAME(offset+hdr_length, len, 12) {
3207           /* We have two MAC addresses after the header. */
3208           if (memcmp(&pd[offset+hdr_length+6], pinfo->dl_src.data, 6) == 0 ||
3209               memcmp(&pd[offset+hdr_length+6], pinfo->dl_dst.data, 6) == 0) {
3210             capture_eth (pd, offset + hdr_length, len, ld);
3211             return;
3212           }
3213         }
3214 #endif
3215         if (pd[offset+hdr_length] == 0xff && pd[offset+hdr_length+1] == 0xff)
3216           capture_ipx (ld);
3217         else if (pd[offset+hdr_length] == 0x00 && pd[offset+hdr_length+1] == 0x00)
3218           capture_llc (pd, offset + hdr_length + 2, len, ld);
3219       }
3220       else {
3221         capture_llc (pd, offset + hdr_length, len, ld);
3222       }
3223       break;
3224     }
3225
3226     default:
3227       ld->other++;
3228       break;
3229   }
3230 }
3231
3232 /*
3233  * Handle 802.11 with a variable-length link-layer header.
3234  */
3235 void
3236 capture_ieee80211 (const guchar * pd, int offset, int len, packet_counts * ld)
3237 {
3238   capture_ieee80211_common (pd, offset, len, ld, FALSE, FALSE, FALSE);
3239 }
3240
3241 /*
3242  * Handle 802.11 with a variable-length link-layer header and data padding.
3243  */
3244 void
3245 capture_ieee80211_datapad (const guchar * pd, int offset, int len,
3246                            packet_counts * ld)
3247 {
3248   capture_ieee80211_common (pd, offset, len, ld, FALSE, TRUE, FALSE);
3249 }
3250
3251 /*
3252  * Handle 802.11 with a fixed-length link-layer header (padded to the
3253  * maximum length).
3254  */
3255 void
3256 capture_ieee80211_fixed (const guchar * pd, int offset, int len, packet_counts * ld)
3257 {
3258   capture_ieee80211_common (pd, offset, len, ld, TRUE, FALSE, FALSE);
3259 }
3260
3261 /*
3262  * Handle an HT 802.11 with a variable-length link-layer header.
3263  */
3264 void
3265 capture_ieee80211_ht (const guchar * pd, int offset, int len, packet_counts * ld)
3266 {
3267   capture_ieee80211_common (pd, offset, len, ld, FALSE, FALSE, TRUE);
3268 }
3269
3270
3271 /* ************************************************************************* */
3272 /*          Add the subtree used to store the fixed parameters               */
3273 /* ************************************************************************* */
3274 static proto_tree *
3275 get_fixed_parameter_tree (proto_tree * tree, tvbuff_t *tvb, int start, int size)
3276 {
3277   proto_item *fixed_fields;
3278   fixed_fields =
3279     proto_tree_add_uint_format (tree, hf_ieee80211_fixed_parameters, tvb, start,
3280         size, size, "Fixed parameters (%d bytes)",
3281         size);
3282
3283   return proto_item_add_subtree (fixed_fields, ett_fixed_parameters);
3284 }
3285
3286
3287 /* ************************************************************************* */
3288 /*            Add the subtree used to store tagged parameters                */
3289 /* ************************************************************************* */
3290 static proto_tree *
3291 get_tagged_parameter_tree (proto_tree * tree, tvbuff_t *tvb, int start, int size)
3292 {
3293   proto_item *tagged_fields;
3294
3295   tagged_fields = proto_tree_add_uint_format (tree, hf_ieee80211_tagged_parameters,
3296     tvb,
3297     start,
3298     2,
3299     size,
3300     "Tagged parameters (%d bytes)",
3301     size);
3302   proto_item_set_len(tagged_fields, size);
3303
3304   return proto_item_add_subtree (tagged_fields, ett_tagged_parameters);
3305 }
3306
3307
3308 static int
3309 dissect_vendor_action_marvell(proto_tree *tree, tvbuff_t *tvb, int offset)
3310 {
3311   guint8 octet;
3312
3313   octet = tvb_get_guint8(tvb, offset);
3314   proto_tree_add_item (tree, hf_ieee80211_ff_marvell_action_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3315   offset++;
3316   switch (octet)
3317     {
3318       case MRVL_ACTION_MESH_MANAGEMENT:
3319         octet = tvb_get_guint8(tvb, offset);
3320         proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_action_code, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3321         offset++;
3322         switch (octet)
3323           {
3324             case MRVL_MESH_MGMT_ACTION_RREQ:
3325               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3326               offset++;
3327               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3328               offset++;
3329               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_hopcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3330               offset++;
3331               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_ttl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3332               offset++;
3333               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_rreqid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3334               offset+= 4;
3335               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_sa, tvb, offset, 6, ENC_NA);
3336               offset+= 6;
3337               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_ssn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3338               offset+= 4;
3339               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_lifetime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3340               offset+= 4;
3341               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3342               offset+= 4;
3343               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dstcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3344               offset++;
3345               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3346               offset++;
3347               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_da, tvb, offset, 6, ENC_NA);
3348               offset+= 6;
3349               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dsn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3350               offset+= 4;
3351               break;
3352             case MRVL_MESH_MGMT_ACTION_RREP:
3353               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3354               offset++;
3355               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3356               offset++;
3357               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_hopcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3358               offset++;
3359               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_ttl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3360               offset++;
3361               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_da, tvb, offset, 6, ENC_NA);
3362               offset+= 6;
3363               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dsn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3364               offset+= 4;
3365               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_lifetime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3366               offset+= 4;
3367               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3368               offset+= 4;
3369               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_sa, tvb, offset, 6, ENC_NA);
3370               offset+= 6;
3371               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_ssn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3372               offset+= 4;
3373               break;
3374             case MRVL_MESH_MGMT_ACTION_RERR:
3375               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3376               offset++;
3377               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3378               offset++;
3379               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dstcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3380               offset++;
3381               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_da, tvb, offset, 6, ENC_NA);
3382               offset+= 6;
3383               proto_tree_add_item (tree, hf_ieee80211_ff_marvell_mesh_mgt_dsn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
3384               offset+= 4;
3385               break;
3386             default:
3387               break;
3388           }
3389         break;
3390       default:
3391         break;
3392     }
3393
3394   return offset;
3395 }
3396
3397 static guint
3398 dissect_advertisement_protocol(packet_info *pinfo, proto_tree *tree,
3399                                tvbuff_t *tvb, int offset, gboolean *anqp)
3400 {
3401   guint8 tag_no, tag_len, left;
3402   proto_item *item = NULL, *adv_item;
3403   proto_tree *adv_tree, *adv_tuple_tree;
3404
3405   if (anqp)
3406     *anqp = FALSE;
3407   tag_no = tvb_get_guint8(tvb, offset);
3408   if (anqp)
3409     item = proto_tree_add_item(tree, hf_ieee80211_tag_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3410
3411   tag_len = tvb_get_guint8(tvb, offset + 1);
3412   if (tag_no != TAG_ADVERTISEMENT_PROTOCOL) {
3413     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3414                            "Unexpected IE %d (expected Advertisement "
3415                            "Protocol)", tag_no);
3416     return 2 + tag_len;
3417   }
3418   if (anqp)
3419     item = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, 1, tag_len);
3420   if (tag_len < 2) {
3421     if (!anqp)
3422       item = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, 1, tag_len);
3423     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3424                            "Advertisement Protocol: IE must be at least 2 "
3425                            "octets long");
3426     return 2 + tag_len;
3427   }
3428
3429   left = tag_len;
3430   offset += 2;
3431   adv_item = proto_tree_add_text(tree, tvb, offset, left,
3432                                  "Advertisement Protocol element");
3433   adv_tree = proto_item_add_subtree(adv_item, ett_adv_proto);
3434
3435   while (left >= 2) {
3436     guint8 id;
3437
3438     id = tvb_get_guint8(tvb, offset + 1);
3439     if (id == 0)
3440       proto_item_append_text(adv_item, ": ANQP");
3441     item = proto_tree_add_text(adv_tree, tvb, offset, 2,
3442                                "Advertisement Protocol Tuple: %s",
3443                                val_to_str(id, adv_proto_id_vals,
3444                                           "Unknown (%d)"));
3445     adv_tuple_tree = proto_item_add_subtree(item, ett_adv_proto_tuple);
3446
3447     proto_tree_add_item(adv_tuple_tree,
3448                         hf_ieee80211_tag_adv_proto_resp_len_limit, tvb,
3449                         offset, 1, ENC_BIG_ENDIAN);
3450     proto_tree_add_item(adv_tuple_tree,
3451                         hf_ieee80211_tag_adv_proto_pame_bi, tvb,
3452                         offset, 1, ENC_BIG_ENDIAN);
3453     offset++;
3454     left--;
3455     proto_tree_add_item(adv_tuple_tree, hf_ieee80211_tag_adv_proto_id, tvb,
3456                         offset, 1, ENC_BIG_ENDIAN);
3457     offset++;
3458     left--;
3459
3460     if (id == 0 && anqp)
3461       *anqp = TRUE;
3462
3463     if (id == 221) {
3464       /* Vendor specific */
3465       guint8 len = tvb_get_guint8(tvb, offset);
3466       offset++;
3467       left--;
3468       if (len > left) {
3469         expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3470                                "Vendor specific info length error");
3471         return 2 + tag_len;
3472       }
3473       proto_tree_add_text(adv_tuple_tree, tvb, offset, len,
3474                           "Vendor Specific Advertisement Protocol info");
3475       offset += len;
3476       left -= len;
3477     }
3478   }
3479
3480   if (left) {
3481     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
3482                            "Unexpected extra data in the end");
3483   }
3484
3485   return 2 + tag_len;
3486 }
3487
3488 static void
3489 dissect_anqp_query_list(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3490 {
3491     while (offset + 2 <= end) {
3492       proto_tree_add_item(tree, hf_ieee80211_ff_anqp_query_id,
3493                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
3494       offset += 2;
3495     }
3496     if (offset != end) {
3497       expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3498                              "Unexpected ANQP Query list format");
3499     }
3500 }
3501
3502 static void
3503 dissect_anqp_capab_list(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3504 {
3505   guint16 id, len;
3506   proto_item *item;
3507   proto_tree *vtree;
3508   guint32 oui;
3509
3510   while (offset + 2 <= end) {
3511     id = tvb_get_letohs(tvb, offset);
3512     item = proto_tree_add_item(tree, hf_ieee80211_ff_anqp_capability,
3513                                tvb, offset, 2, ENC_LITTLE_ENDIAN);
3514     offset += 2;
3515     if (id == ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST) {
3516       vtree = proto_item_add_subtree(item, ett_anqp_vendor_capab);
3517       len = tvb_get_letohs(tvb, offset);
3518       proto_tree_add_item(vtree, hf_ieee80211_ff_anqp_capability_vlen,
3519                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
3520       offset += 2;
3521       if (len < 3 || offset + len > end) {
3522         expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3523                                "Invalid vendor-specific ANQP capability");
3524         return;
3525       }
3526       oui = tvb_get_ntoh24(tvb, offset);
3527       proto_tree_add_item(vtree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
3528       offset += 3;
3529       len -= 3;
3530
3531       switch (oui) {
3532       default:
3533         proto_tree_add_item(vtree, hf_ieee80211_ff_anqp_capability_vendor,
3534                             tvb, offset, len, ENC_NA);
3535         break;
3536       }
3537
3538       offset += len;
3539     }
3540   }
3541   if (offset != end) {
3542     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3543                            "Unexpected ANQP Capability list format");
3544   }
3545 }
3546
3547 static const value_string venue_group_vals[] = {
3548   { 0, "Unspecified" },
3549   { 1, "Assembly" },
3550   { 2, "Business" },
3551   { 3, "Educational" },
3552   { 4, "Factory and Industrial" },
3553   { 5, "Institutional" },
3554   { 6, "Mercantile" },
3555   { 7, "Residential" },
3556   { 8, "Storage" },
3557   { 9, "Utility and Miscellaneous" },
3558   { 10, "Vehicular" },
3559   { 11, "Outdoor" },
3560   { 0, NULL }
3561 };
3562
3563 static void dissect_venue_info(proto_tree *tree, tvbuff_t *tvb, int offset)
3564 {
3565   proto_tree_add_item(tree, hf_ieee80211_ff_venue_info_group,
3566                       tvb, offset, 1, ENC_BIG_ENDIAN);
3567   proto_tree_add_item(tree, hf_ieee80211_ff_venue_info_type,
3568                       tvb, offset + 1, 1, ENC_BIG_ENDIAN);
3569 }
3570
3571 static void
3572 dissect_venue_name_info(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3573 {
3574   proto_item *item;
3575
3576   dissect_venue_info(tree, tvb, offset);
3577   offset += 2;
3578   while (offset + 4 <= end) {
3579     guint8 vlen = tvb_get_guint8(tvb, offset);
3580     item = proto_tree_add_item(tree, hf_ieee80211_ff_anqp_venue_length,
3581                                tvb, offset, 1, ENC_BIG_ENDIAN);
3582     offset++;
3583     if (vlen > end - offset || vlen < 3) {
3584       expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3585                              "Invalid Venue Name Duple length");
3586       break;
3587     }
3588     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_venue_language,
3589                         tvb, offset, 3, ENC_ASCII|ENC_NA);
3590     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_venue_name,
3591                         tvb, offset + 3, vlen - 3, ENC_ASCII|ENC_NA);
3592     offset += vlen;
3593   }
3594 }
3595
3596 static const value_string nw_auth_type_vals[] = {
3597   { 0, "Acceptance of terms and conditions" },
3598   { 1, "On-line enrollment supported" },
3599   { 2, "http/https redirection" },
3600   { 3, "DNS redirection" },
3601   { 0, NULL }
3602 };
3603
3604 static void
3605 dissect_network_auth_type(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3606 {
3607   while (offset + 3 <= end) {
3608     guint16 len;
3609     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_nw_auth_type_indicator,
3610                         tvb, offset, 1, ENC_BIG_ENDIAN);
3611     offset++;
3612     len = tvb_get_letohs(tvb, offset);
3613     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_nw_auth_type_url_len,
3614                         tvb, offset, 2, ENC_LITTLE_ENDIAN);
3615     offset += 2;
3616     if (len)
3617       proto_tree_add_item(tree, hf_ieee80211_ff_anqp_nw_auth_type_url,
3618                           tvb, offset, len, ENC_ASCII|ENC_NA);
3619     offset += len;
3620   }
3621 }
3622
3623 static void add_manuf(proto_item *item, tvbuff_t *tvb, int offset)
3624 {
3625   const gchar *manuf_name;
3626   manuf_name = tvb_get_manuf_name_if_known(tvb, offset);
3627   if (manuf_name == NULL)
3628     return;
3629   proto_item_append_text(item, " - %s", manuf_name);
3630 }
3631
3632 static void
3633 dissect_roaming_consortium_list(proto_tree *tree, tvbuff_t *tvb, int offset,
3634                                 int end)
3635 {
3636   proto_item *item;
3637   guint8 len;
3638
3639   while (offset < end) {
3640     len = tvb_get_guint8(tvb, offset);
3641     item = proto_tree_add_item(tree,
3642                                hf_ieee80211_ff_anqp_roaming_consortium_oi_len,
3643                                tvb, offset, 1, ENC_BIG_ENDIAN);
3644     offset++;
3645     if (len > end - offset || len < 3) {
3646       expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3647                              "Invalid Roaming Consortium OI");
3648       break;
3649     }
3650     item = proto_tree_add_item(tree,
3651                                hf_ieee80211_ff_anqp_roaming_consortium_oi,
3652                                tvb, offset, len, ENC_NA);
3653     add_manuf(item, tvb, offset);
3654     offset += len;
3655   }
3656 }
3657
3658 static const value_string ip_addr_avail_ipv6_vals[] = {
3659   { 0, "Address type not available" },
3660   { 1, "Address type available" },
3661   { 2, "Availability of the address type not known" },
3662   { 0, NULL }
3663 };
3664
3665 static const value_string ip_addr_avail_ipv4_vals[] = {
3666   { 0, "Address type not available" },
3667   { 1, "Public IPv4 address available" },
3668   { 2, "Port-restricted IPv4 address available" },
3669   { 3, "Single NATed private IPv4 address available" },
3670   { 4, "Double NATed private IPv4 address available" },
3671   { 5, "Port-restricted IPv4 address and single NATed IPv4 address available" },
3672   { 6, "Port-restricted IPv4 address and double NATed IPv4 address available" },
3673   { 7, "Availability of the address type is not known" },
3674   { 0, NULL }
3675 };
3676
3677 static void
3678 dissect_ip_addr_type_availability_info(proto_tree *tree, tvbuff_t *tvb,
3679                                        int offset)
3680 {
3681   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_ip_addr_avail_ipv6,
3682                       tvb, offset, 1, ENC_BIG_ENDIAN);
3683   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_ip_addr_avail_ipv4,
3684                       tvb, offset, 1, ENC_BIG_ENDIAN);
3685 }
3686
3687 static const value_string nai_realm_encoding_vals[] = {
3688   { 0, "Formatted in accordance with RFC 4282" },
3689   { 1, "UTF-8 formatted that is not formatted in accordance with RFC 4282" },
3690   { 0, NULL }
3691 };
3692
3693 static const value_string nai_realm_auth_param_id_vals[] = {
3694   { 1, "Expanded EAP Method" },
3695   { 2, "Non-EAP Inner Authentication Type" },
3696   { 3, "Inner Authentication EAP Method Type" },
3697   { 4, "Expanded Inner EAP Method" },
3698   { 5, "Credential Type" },
3699   { 6, "Tunneled EAP Method Credential Type" },
3700   { 221, "Vendor Specific" },
3701   { 0, NULL }
3702 };
3703
3704 static void
3705 dissect_nai_realm_list(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3706 {
3707   guint16 count, len;
3708   proto_item *item, *r_item;
3709   int f_end, eap_end;
3710   guint8 nai_len, eap_count, eap_len, auth_param_count, auth_param_len;
3711   guint8 auth_param_id;
3712   proto_tree *realm_tree, *eap_tree;
3713   guint8 *realm;
3714
3715   count = tvb_get_letohs(tvb, offset);
3716   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_nai_realm_count,
3717                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
3718   offset += 2;
3719   while (count > 0) {
3720     len = tvb_get_letohs(tvb, offset);
3721     r_item = proto_tree_add_text(tree, tvb, offset, 2 + len, "NAI Realm Data");
3722     realm_tree = proto_item_add_subtree(r_item, ett_nai_realm);
3723
3724     item = proto_tree_add_item(realm_tree, hf_ieee80211_ff_anqp_nai_field_len,
3725                                tvb, offset, 2, ENC_LITTLE_ENDIAN);
3726     offset += 2;
3727     if (offset + len > end) {
3728       expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3729                              "Invalid NAI Realm List");
3730       break;
3731     }
3732     f_end = offset + len;
3733     proto_tree_add_item(realm_tree, hf_ieee80211_ff_anqp_nai_realm_encoding,
3734                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
3735     offset++;
3736     nai_len = tvb_get_guint8(tvb, offset);
3737     item = proto_tree_add_item(realm_tree,
3738                                hf_ieee80211_ff_anqp_nai_realm_length,
3739                                tvb, offset, 1, ENC_LITTLE_ENDIAN);
3740     offset++;
3741     if (offset + nai_len > f_end) {
3742       expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3743                              "Invalid NAI Realm Data");
3744       break;
3745     }
3746     proto_tree_add_item(realm_tree, hf_ieee80211_ff_anqp_nai_realm,
3747                         tvb, offset, nai_len, ENC_ASCII|ENC_NA);
3748     realm = tvb_get_ephemeral_string(tvb, offset, nai_len);
3749     if (realm) {
3750       proto_item_append_text(r_item, " (%s)", realm);
3751     }
3752     offset += nai_len;
3753     eap_count = tvb_get_guint8(tvb, offset);
3754     proto_tree_add_item(realm_tree, hf_ieee80211_ff_anqp_nai_realm_eap_count,
3755                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
3756     offset++;
3757
3758     while (eap_count > 0) {
3759       eap_len = tvb_get_guint8(tvb, offset);
3760       eap_end = offset + 1 + eap_len;
3761       item = proto_tree_add_text(realm_tree, tvb, offset, 1 + eap_len,
3762                                  "EAP Method");
3763       eap_tree = proto_item_add_subtree(item, ett_nai_realm_eap);
3764
3765       item = proto_tree_add_item(eap_tree,
3766                                  hf_ieee80211_ff_anqp_nai_realm_eap_len,
3767                                  tvb, offset, 1, ENC_LITTLE_ENDIAN);
3768       offset++;
3769       if (offset + eap_len > f_end) {
3770         expert_add_info_format(g_pinfo, item, PI_MALFORMED, PI_ERROR,
3771                                "Invalid EAP Method subfield");
3772         break;
3773       }
3774
3775       proto_item_append_text(eap_tree, ": %s",
3776                              val_to_str(tvb_get_guint8(tvb, offset),
3777                                         eap_type_vals, "Unknown (%d)"));
3778       proto_tree_add_item(eap_tree, hf_ieee80211_ff_anqp_nai_realm_eap_method,
3779                           tvb, offset, 1, ENC_LITTLE_ENDIAN);
3780       offset++;
3781       auth_param_count = tvb_get_guint8(tvb, offset);
3782       proto_tree_add_item(eap_tree,
3783                           hf_ieee80211_ff_anqp_nai_realm_auth_param_count,
3784                           tvb, offset, 1, ENC_LITTLE_ENDIAN);
3785       offset++;
3786
3787       while (auth_param_count > 0) {
3788         auth_param_id = tvb_get_guint8(tvb, offset);
3789         proto_tree_add_item(eap_tree,
3790                             hf_ieee80211_ff_anqp_nai_realm_auth_param_id,
3791                             tvb, offset, 1, ENC_LITTLE_ENDIAN);
3792         offset++;
3793         auth_param_len = tvb_get_guint8(tvb, offset);
3794         proto_tree_add_item(eap_tree,
3795                             hf_ieee80211_ff_anqp_nai_realm_auth_param_len,
3796                             tvb, offset, 1, ENC_LITTLE_ENDIAN);
3797         offset++;
3798         item = proto_tree_add_item(
3799           eap_tree, hf_ieee80211_ff_anqp_nai_realm_auth_param_value,
3800           tvb, offset, auth_param_len, ENC_NA);
3801         if (auth_param_id == 3 && auth_param_len == 1) {
3802           guint8 inner_method = tvb_get_guint8(tvb, offset);
3803           const char *str;
3804           str = val_to_str(inner_method, eap_type_vals, "Unknown (%d)");
3805
3806           proto_item_append_text(eap_tree, " / %s", str);
3807           proto_item_append_text(item, " - %s", str);
3808         }
3809         offset += auth_param_len;
3810
3811         auth_param_count--;
3812       }
3813
3814       offset = eap_end;
3815       eap_count--;
3816     }
3817
3818     offset = f_end;
3819     count--;
3820   }
3821 }
3822
3823 static void
3824 dissect_3gpp_cellular_network_info(proto_tree *tree, tvbuff_t *tvb, int offset)
3825 {
3826   guint8 iei, num;
3827   proto_item *item;
3828
3829   /* See Annex A of 3GPP TS 24.234 v8.1.0 for description */
3830   proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_gud, tvb, offset, 1, ENC_BIG_ENDIAN);
3831   offset++;
3832   proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_udhl, tvb, offset, 1, ENC_BIG_ENDIAN);
3833   offset++;
3834   iei = tvb_get_guint8(tvb, offset);
3835   item = proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_iei, tvb, offset, 1, ENC_BIG_ENDIAN);
3836   if (iei == 0)
3837     proto_item_append_text(item, " (PLMN List)");
3838   else
3839     return;
3840   offset++;
3841   proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_plmn_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3842   offset++;
3843   num = tvb_get_guint8(tvb, offset);
3844   proto_tree_add_item(tree, hf_ieee80211_3gpp_gc_num_plmns, tvb, offset, 1, ENC_BIG_ENDIAN);
3845   offset++;
3846   while (num > 0) {
3847     guint8 o1, o2, o3;
3848     if (tvb_reported_length_remaining(tvb, offset) < 3)
3849       break;
3850     num--;
3851     o1 = tvb_get_guint8(tvb, offset);
3852     o2 = tvb_get_guint8(tvb, offset + 1);
3853     o3 = tvb_get_guint8(tvb, offset + 2);
3854     proto_tree_add_string_format_value(tree, hf_ieee80211_3gpp_gc_plmn, tvb, offset, 3,
3855                                        "", "MCC %d%d%d MNC %d%d%c",
3856                                        o1 & 0x0f, (o1 & 0xf0) >> 4, o2 & 0x0f,
3857                                        o3 & 0x0f, (o3 & 0xf0) >> 4,
3858                                        ((o2 & 0xf0) == 0xf0) ? ' ' :
3859                                        ('0' + ((o2 & 0xf0) >> 4)));
3860     offset += 3;
3861   }
3862 }
3863
3864 static void
3865 dissect_domain_name_list(proto_tree *tree, tvbuff_t *tvb, int offset, int end)
3866 {
3867   guint8 len;
3868
3869   while (offset < end) {
3870     len = tvb_get_guint8(tvb, offset);
3871     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_domain_name_len,
3872                         tvb, offset, 1, ENC_BIG_ENDIAN);
3873     offset++;
3874     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_domain_name,
3875                         tvb, offset, len, ENC_ASCII|ENC_NA);
3876     offset += len;
3877   }
3878 }
3879
3880 static int
3881 dissect_anqp_info(proto_tree *tree, tvbuff_t *tvb, int offset,
3882                   gboolean request, int idx)
3883 {
3884   guint16 id, len;
3885   guint32 oui;
3886   guint8 subtype;
3887   proto_item *item;
3888
3889   item = proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info_id,
3890                              tvb, offset, 2, ENC_LITTLE_ENDIAN);
3891   id = tvb_get_letohs(tvb, offset);
3892   if (id != ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST) {
3893     if (idx == 0) {
3894       proto_item_append_text(tree, " - %s",
3895                              val_to_str(id, anqp_info_id_vals,
3896                                         "Unknown (%u)"));
3897       col_append_fstr(g_pinfo->cinfo, COL_INFO, " %s",
3898                       val_to_str(id, anqp_info_id_vals, "Unknown (%u)"));
3899     } else if (idx == 1) {
3900       proto_item_append_text(tree, ", ..");
3901       col_append_fstr(g_pinfo->cinfo, COL_INFO, ", ..");
3902     }
3903   }
3904   tree = proto_item_add_subtree(item, ett_gas_anqp);
3905   offset += 2;
3906   proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info_length,
3907                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
3908   len = tvb_get_letohs(tvb, offset);
3909   offset += 2;
3910   if (tvb_reported_length_remaining(tvb, offset) < len) {
3911     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3912                            "Invalid ANQP Info length");
3913     return 4 + len;
3914   }
3915   switch (id)
3916   {
3917   case ANQP_INFO_ANQP_QUERY_LIST:
3918     dissect_anqp_query_list(tree, tvb, offset, offset + len);
3919     break;
3920   case ANQP_INFO_ANQP_CAPAB_LIST:
3921     dissect_anqp_capab_list(tree, tvb, offset, offset + len);
3922     break;
3923   case ANQP_INFO_VENUE_NAME_INFO:
3924     dissect_venue_name_info(tree, tvb, offset, offset + len);
3925     break;
3926   case ANQP_INFO_NETWORK_AUTH_TYPE_INFO:
3927     dissect_network_auth_type(tree, tvb, offset, offset + len);
3928     break;
3929   case ANQP_INFO_ROAMING_CONSORTIUM_LIST:
3930     dissect_roaming_consortium_list(tree, tvb, offset, offset + len);
3931     break;
3932   case ANQP_INFO_IP_ADDR_TYPE_AVAILABILITY_INFO:
3933     dissect_ip_addr_type_availability_info(tree, tvb, offset);
3934     break;
3935   case ANQP_INFO_NAI_REALM_LIST:
3936     dissect_nai_realm_list(tree, tvb, offset, offset + len);
3937     break;
3938   case ANQP_INFO_3GPP_CELLULAR_NETWORK_INFO:
3939     dissect_3gpp_cellular_network_info(tree, tvb, offset);
3940     break;
3941   case ANQP_INFO_DOMAIN_NAME_LIST:
3942     dissect_domain_name_list(tree, tvb, offset, offset + len);
3943     break;
3944   case ANQP_INFO_ANQP_VENDOR_SPECIFIC_LIST:
3945     oui = tvb_get_ntoh24(tvb, offset);
3946     proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
3947     offset += 3;
3948
3949     switch (oui) {
3950     case OUI_WFA:
3951       subtype = tvb_get_guint8(tvb, offset);
3952       if (subtype == WFA_SUBTYPE_P2P) {
3953         proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u: P2P ANQP",
3954                             subtype);
3955         dissect_wifi_p2p_anqp(g_pinfo, tree, tvb, offset + 1, request);
3956       } else {
3957         proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u", subtype);
3958       }
3959       break;
3960     default:
3961       proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info,
3962                           tvb, offset, len, ENC_NA);
3963       break;
3964     }
3965     break;
3966   default:
3967     proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info,
3968                         tvb, offset, len, ENC_NA);
3969     break;
3970   }
3971
3972   return 4 + len;
3973 }
3974
3975 static void
3976 dissect_anqp(proto_tree *tree, tvbuff_t *tvb, int offset, gboolean request)
3977 {
3978   int idx = 0;
3979
3980   proto_item_append_text(tree, ": ANQP ");
3981   proto_item_append_text(tree, request ? "Request" : "Response");
3982   if (tvb_reported_length_remaining(tvb, offset) < 4) {
3983     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
3984                            "Not enough room for ANQP header");
3985     return;
3986   }
3987   col_append_fstr(g_pinfo->cinfo, COL_INFO, ", ANQP %s",
3988                   request ? "Req" : "Resp");
3989   while (tvb_reported_length_remaining(tvb, offset) > 0) {
3990     offset += dissect_anqp_info(tree, tvb, offset, request, idx);
3991     idx++;
3992   }
3993 }
3994
3995 static guint
3996 dissect_gas_initial_request(proto_tree *tree, tvbuff_t *tvb, int offset,
3997                             gboolean anqp)
3998 {
3999   guint16 req_len;
4000   int start = offset;
4001   proto_item *item;
4002   proto_tree *query;
4003
4004   /* Query Request Length (2 octets) */
4005   req_len = tvb_get_letohs(tvb, offset);
4006
4007   item = proto_tree_add_text(tree, tvb, offset, 2 + req_len, "Query Request");
4008   if (tvb_reported_length_remaining(tvb, offset) < 2 + req_len) {
4009     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
4010                            "Invalid Query Request Length");
4011     return tvb_reported_length_remaining(tvb, offset);
4012   }
4013   query = proto_item_add_subtree(item, ett_gas_query);
4014
4015   proto_tree_add_item(query, hf_ieee80211_ff_query_request_length,
4016                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
4017   offset += 2;
4018   /*
4019    * Query Request (GAS query; formatted per protocol specified in the
4020    * Advertisement Protocol IE)
4021    */
4022   if (anqp)
4023     dissect_anqp(query, tvb, offset, TRUE);
4024   else
4025     proto_tree_add_item(query, hf_ieee80211_ff_query_request,
4026                         tvb, offset, req_len, ENC_NA);
4027   offset += req_len;
4028
4029   return offset - start;
4030 }
4031
4032 static guint
4033 dissect_gas_initial_response(proto_tree *tree, tvbuff_t *tvb, int offset,
4034                              gboolean anqp)
4035 {
4036   guint16 resp_len;
4037   int start = offset;
4038   proto_item *item;
4039   proto_tree *query;
4040
4041   /* Query Response Length (2 octets) */
4042   resp_len = tvb_get_letohs(tvb, offset);
4043
4044   item = proto_tree_add_text(tree, tvb, offset, 2 + resp_len,
4045                              "Query Response");
4046   if (tvb_reported_length_remaining(tvb, offset) < 2 + resp_len) {
4047     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
4048                            "Invalid Query Response Length");
4049     return tvb_reported_length_remaining(tvb, offset);
4050   }
4051   query = proto_item_add_subtree(item, ett_gas_query);
4052
4053   proto_tree_add_item(query, hf_ieee80211_ff_query_response_length,
4054                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
4055   offset += 2;
4056   /* Query Response (optional) */
4057   if (resp_len) {
4058     if (anqp)
4059       dissect_anqp(query, tvb, offset, FALSE);
4060     else
4061       proto_tree_add_item(query, hf_ieee80211_ff_query_response,
4062                           tvb, offset, resp_len, ENC_NA);
4063     offset += resp_len;
4064   }
4065
4066   return offset - start;
4067 }
4068
4069 static GHashTable *gas_fragment_table = NULL;
4070 static GHashTable *gas_reassembled_table = NULL;
4071
4072 static void ieee80211_gas_reassembly_init(void)
4073 {
4074   fragment_table_init(&gas_fragment_table);
4075   reassembled_table_init(&gas_reassembled_table);
4076 }
4077
4078 static gint ett_gas_resp_fragment = -1;
4079 static gint ett_gas_resp_fragments = -1;
4080
4081 static int hf_ieee80211_gas_resp_fragments = -1;
4082 static int hf_ieee80211_gas_resp_fragment = -1;
4083 static int hf_ieee80211_gas_resp_fragment_overlap = -1;
4084 static int hf_ieee80211_gas_resp_fragment_overlap_conflict = -1;
4085 static int hf_ieee80211_gas_resp_fragment_multiple_tails = -1;
4086 static int hf_ieee80211_gas_resp_fragment_too_long_fragment = -1;
4087 static int hf_ieee80211_gas_resp_fragment_error = -1;
4088 static int hf_ieee80211_gas_resp_fragment_count = -1;
4089 static int hf_ieee80211_gas_resp_reassembled_in = -1;
4090 static int hf_ieee80211_gas_resp_reassembled_length = -1;
4091
4092 static const fragment_items gas_resp_frag_items = {
4093   &ett_gas_resp_fragment,
4094   &ett_gas_resp_fragments,
4095   &hf_ieee80211_gas_resp_fragments,
4096   &hf_ieee80211_gas_resp_fragment,
4097   &hf_ieee80211_gas_resp_fragment_overlap,
4098   &hf_ieee80211_gas_resp_fragment_overlap_conflict,
4099   &hf_ieee80211_gas_resp_fragment_multiple_tails,
4100   &hf_ieee80211_gas_resp_fragment_too_long_fragment,
4101   &hf_ieee80211_gas_resp_fragment_error,
4102   &hf_ieee80211_gas_resp_fragment_count,
4103   &hf_ieee80211_gas_resp_reassembled_in,
4104   &hf_ieee80211_gas_resp_reassembled_length,
4105   "GAS Response fragments"
4106 };
4107
4108 static guint
4109 dissect_gas_comeback_response(proto_tree *tree, tvbuff_t *tvb, int offset,
4110                               gboolean anqp, guint8 frag, gboolean more,
4111                               guint8 dialog_token)
4112 {
4113   guint16 resp_len;
4114   int start = offset;
4115   proto_item *item;
4116   proto_tree *query;
4117
4118   /* Query Response Length (2 octets) */
4119   resp_len = tvb_get_letohs(tvb, offset);
4120
4121   item = proto_tree_add_text(tree, tvb, offset, 2 + resp_len,
4122                              "Query Response");
4123   if (tvb_reported_length_remaining(tvb, offset) < 2 + resp_len) {
4124     expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
4125                            "Invalid Query Response Length");
4126     return tvb_reported_length_remaining(tvb, offset);
4127   }
4128   query = proto_item_add_subtree(item, ett_gas_query);
4129
4130   proto_tree_add_item(query, hf_ieee80211_ff_query_response_length,
4131                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
4132   offset += 2;
4133   /* Query Response (optional) */
4134   if (resp_len) {
4135     if (anqp && frag == 0 && !more)
4136       dissect_anqp(query, tvb, offset, FALSE);
4137     else {
4138       fragment_data *frag_msg;
4139       gboolean save_fragmented;
4140       tvbuff_t *new_tvb;
4141
4142       save_fragmented = g_pinfo->fragmented;
4143       g_pinfo->fragmented = TRUE;
4144       frag_msg = fragment_add_seq_check(tvb, offset, g_pinfo, dialog_token,
4145                                         gas_fragment_table,
4146                                         gas_reassembled_table, frag, resp_len,
4147                                         more);
4148       new_tvb = process_reassembled_data(tvb, offset, g_pinfo,
4149                                          "Reassembled GAS Query Response",
4150                                          frag_msg, &gas_resp_frag_items,
4151                                          NULL, tree);
4152       if (new_tvb) {
4153         if (anqp)
4154           dissect_anqp(query, new_tvb, 0, FALSE);
4155         else
4156           proto_tree_add_item(query, hf_ieee80211_ff_query_response,
4157                               new_tvb, 0,
4158                               tvb_reported_length_remaining(new_tvb, 0),
4159                               ENC_NA);
4160       }
4161
4162       /* The old tvb cannot be used anymore */
4163       ieee80211_tvb_invalid = TRUE;
4164
4165       g_pinfo->fragmented = save_fragmented;
4166     }
4167     offset += resp_len;
4168   }
4169
4170   return offset - start;
4171 }
4172
4173 /* ************************************************************************* */
4174 /*              Dissect and add fixed mgmt fields to protocol tree           */
4175 /* ************************************************************************* */
4176
4177 static guint
4178 add_fixed_field(proto_tree *tree, tvbuff_t *tvb, int offset,
4179                 enum fixed_field lfcode);
4180
4181 static guint64 last_timestamp;
4182
4183 static guint
4184 add_ff_timestamp(proto_tree *tree, tvbuff_t *tvb, int offset)
4185 {
4186   last_timestamp = tvb_get_letoh64(tvb, offset);
4187   proto_tree_add_item(tree, hf_ieee80211_ff_timestamp, tvb, offset, 8,
4188                       ENC_LITTLE_ENDIAN);
4189   return 8;
4190 }
4191
4192 static guint
4193 add_ff_beacon_interval(proto_tree *tree, tvbuff_t *tvb, int offset)
4194 {
4195   proto_tree_add_item(tree, hf_ieee80211_ff_beacon_interval, tvb, offset, 2,
4196                       ENC_LITTLE_ENDIAN);
4197   col_append_fstr(g_pinfo->cinfo, COL_INFO, ", BI=%d",
4198                   tvb_get_letohs(tvb, offset));
4199   return 2;
4200 }
4201
4202 static guint
4203 add_ff_cap_info(proto_tree *tree, tvbuff_t *tvb, int offset)
4204 {
4205   proto_item *cap_item;
4206   proto_tree *cap_tree;
4207
4208   cap_item = proto_tree_add_item(tree, hf_ieee80211_ff_capture, tvb, offset, 2,
4209                                  ENC_LITTLE_ENDIAN);
4210   cap_tree = proto_item_add_subtree(cap_item, ett_cap_tree);
4211
4212   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_ess, tvb, offset, 2,
4213                       ENC_LITTLE_ENDIAN);
4214   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_ibss, tvb, offset, 2,
4215                       ENC_LITTLE_ENDIAN);
4216   if ((tvb_get_letohs(tvb, offset) & 0x0001) != 0) {
4217     /* This is an AP */
4218     proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_ap_poll, tvb, offset, 2,
4219                         ENC_LITTLE_ENDIAN);
4220   } else {
4221     /* This is a STA */
4222     proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_sta_poll, tvb, offset, 2,
4223                         ENC_LITTLE_ENDIAN);
4224   }
4225
4226   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_privacy, tvb, offset, 2,
4227                       ENC_LITTLE_ENDIAN);
4228   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_preamble, tvb, offset, 2,
4229                       ENC_LITTLE_ENDIAN);
4230   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_pbcc, tvb, offset, 2,
4231                       ENC_LITTLE_ENDIAN);
4232   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_agility, tvb, offset, 2,
4233                       ENC_LITTLE_ENDIAN);
4234   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_spec_man, tvb, offset, 2,
4235                       ENC_LITTLE_ENDIAN);
4236   proto_tree_add_item(cap_tree, hf_ieee80211_ff_short_slot_time, tvb, offset,
4237                       2, ENC_LITTLE_ENDIAN);
4238   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_apsd, tvb, offset, 2,
4239                       ENC_LITTLE_ENDIAN);
4240   proto_tree_add_item(cap_tree, hf_ieee80211_ff_dsss_ofdm, tvb, offset, 2,
4241                       ENC_LITTLE_ENDIAN);
4242   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_del_blk_ack, tvb, offset, 2,
4243                       ENC_LITTLE_ENDIAN);
4244   proto_tree_add_item(cap_tree, hf_ieee80211_ff_cf_imm_blk_ack, tvb, offset, 2,
4245                       ENC_LITTLE_ENDIAN);
4246   return 2;
4247 }
4248
4249 static guint
4250 add_ff_auth_alg(proto_tree *tree, tvbuff_t *tvb, int offset)
4251 {
4252   proto_tree_add_item(tree, hf_ieee80211_ff_auth_alg, tvb, offset, 2,
4253                       ENC_LITTLE_ENDIAN);
4254   return 2;
4255 }
4256
4257 static guint
4258 add_ff_auth_trans_seq(proto_tree *tree, tvbuff_t *tvb, int offset)
4259 {
4260   proto_tree_add_item(tree, hf_ieee80211_ff_auth_seq, tvb, offset, 2,
4261                       ENC_LITTLE_ENDIAN);
4262   return 2;
4263 }
4264
4265 static guint
4266 add_ff_current_ap_addr(proto_tree *tree, tvbuff_t *tvb, int offset)
4267 {
4268   proto_tree_add_item(tree, hf_ieee80211_ff_current_ap, tvb, offset, 6,
4269                       ENC_NA);
4270   return 6;
4271 }
4272
4273 static guint
4274 add_ff_listen_ival(proto_tree *tree, tvbuff_t *tvb, int offset)
4275 {
4276   proto_tree_add_item(tree, hf_ieee80211_ff_listen_ival, tvb, offset, 2,
4277                       ENC_LITTLE_ENDIAN);
4278   return 2;
4279 }
4280
4281 static guint
4282 add_ff_reason_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4283 {
4284   proto_tree_add_item(tree, hf_ieee80211_ff_reason, tvb, offset, 2,
4285                       ENC_LITTLE_ENDIAN);
4286   return 2;
4287 }
4288
4289 static guint
4290 add_ff_assoc_id(proto_tree *tree, tvbuff_t *tvb, int offset)
4291 {
4292   proto_tree_add_item(tree, hf_ieee80211_ff_assoc_id, tvb, offset, 2,
4293                       ENC_LITTLE_ENDIAN);
4294   return 2;
4295 }
4296
4297 static guint
4298 add_ff_status_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4299 {
4300   proto_tree_add_item(tree, hf_ieee80211_ff_status_code, tvb, offset, 2,
4301                       ENC_LITTLE_ENDIAN);
4302   return 2;
4303 }
4304
4305 static guint
4306 add_ff_category_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4307 {
4308   proto_tree_add_item(tree, hf_ieee80211_ff_category_code, tvb, offset, 1,
4309                       ENC_LITTLE_ENDIAN);
4310   return 1;
4311 }
4312
4313 static guint
4314 add_ff_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4315 {
4316   proto_tree_add_item(tree, hf_ieee80211_ff_action_code, tvb, offset, 1,
4317                       ENC_LITTLE_ENDIAN);
4318   return 1;
4319 }
4320
4321 static guint
4322 add_ff_dialog_token(proto_tree *tree, tvbuff_t *tvb, int offset)
4323 {
4324   proto_tree_add_item(tree, hf_ieee80211_ff_dialog_token, tvb, offset, 1,
4325                       ENC_LITTLE_ENDIAN);
4326   return 1;
4327 }
4328
4329 static guint
4330 add_ff_wme_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4331 {
4332   proto_tree_add_item(tree, hf_ieee80211_ff_wme_action_code, tvb, offset, 1,
4333                       ENC_LITTLE_ENDIAN);
4334   return 1;
4335 }
4336
4337 static guint
4338 add_ff_wme_status_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4339 {
4340   proto_tree_add_item(tree, hf_ieee80211_ff_wme_status_code, tvb, offset, 1,
4341                       ENC_LITTLE_ENDIAN);
4342   return 1;
4343 }
4344
4345 static guint
4346 add_ff_qos_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4347 {
4348   proto_tree_add_item(tree, hf_ieee80211_ff_qos_action_code, tvb, offset, 1,
4349                       ENC_LITTLE_ENDIAN);
4350   return 1;
4351 }
4352
4353 static guint
4354 add_ff_block_ack_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4355 {
4356   proto_tree_add_item(tree, hf_ieee80211_ff_ba_action, tvb, offset, 1,
4357                       ENC_LITTLE_ENDIAN);
4358   return 1;
4359 }
4360
4361 static guint
4362 add_ff_block_ack_param(proto_tree *tree, tvbuff_t *tvb, int offset)
4363 {
4364   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_block_ack_params,
4365                          ett_ff_ba_param_tree,
4366                          ieee80211_ff_block_ack_params_fields,
4367                          ENC_LITTLE_ENDIAN);
4368   return 2;
4369 }
4370
4371 static guint
4372 add_ff_block_ack_timeout(proto_tree *tree, tvbuff_t *tvb, int offset)
4373 {
4374   proto_tree_add_item(tree, hf_ieee80211_ff_block_ack_timeout, tvb, offset, 2,
4375                       ENC_LITTLE_ENDIAN);
4376   return 2;
4377 }
4378
4379 static guint
4380 add_ff_block_ack_ssc(proto_tree *tree, tvbuff_t *tvb, int offset)
4381 {
4382   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_block_ack_ssc,
4383                          ett_ff_ba_ssc_tree, ieee80211_ff_block_ack_ssc_fields,
4384                          ENC_LITTLE_ENDIAN);
4385   return 2;
4386 }
4387
4388 static guint
4389 add_ff_qos_ts_info(proto_tree *tree, tvbuff_t *tvb, int offset)
4390 {
4391   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_tsinfo,
4392                          ett_tsinfo_tree, ieee80211_tsinfo_fields,
4393                          ENC_LITTLE_ENDIAN);
4394   return 3;
4395 }
4396
4397 static guint
4398 add_ff_mesh_action(proto_tree *tree, tvbuff_t *tvb, int offset)
4399 {
4400   proto_tree_add_item(tree, hf_ieee80211_ff_mesh_action, tvb, offset, 1,
4401                       ENC_LITTLE_ENDIAN);
4402   return 1;
4403 }
4404
4405 static guint
4406 add_ff_multihop_action(proto_tree *tree, tvbuff_t *tvb, int offset)
4407 {
4408   proto_tree_add_item(tree, hf_ieee80211_ff_multihop_action, tvb, offset, 1,
4409                       ENC_LITTLE_ENDIAN);
4410   return 1;
4411 }
4412
4413 static guint
4414 add_ff_mesh_control(proto_tree *tree, tvbuff_t *tvb, int offset)
4415 {
4416   int start = offset;
4417   guint8 flags;
4418
4419   proto_tree_add_item(tree, hf_ieee80211_ff_mesh_flags, tvb, offset, 1,
4420                       ENC_LITTLE_ENDIAN);
4421   flags = tvb_get_guint8(tvb, offset);
4422   offset++;
4423   proto_tree_add_item(tree, hf_ieee80211_ff_mesh_ttl, tvb, offset, 1,
4424                       ENC_LITTLE_ENDIAN);
4425   offset++;
4426   proto_tree_add_item(tree, hf_ieee80211_ff_mesh_sequence, tvb, offset, 4,
4427                       ENC_LITTLE_ENDIAN);
4428   offset += 4;
4429
4430   switch (flags & 0x03) {
4431   case 1:
4432     proto_tree_add_item(tree, hf_ieee80211_ff_mesh_addr4, tvb, offset, 6,
4433                         ENC_NA);
4434     offset += 6;
4435     break;
4436   case 2:
4437     proto_tree_add_item(tree, hf_ieee80211_ff_mesh_addr5, tvb, offset, 6,
4438                         ENC_NA);
4439     offset += 6;
4440     proto_tree_add_item(tree, hf_ieee80211_ff_mesh_addr6, tvb, offset, 6,
4441                         ENC_NA);
4442     offset += 6;
4443     break;
4444   case 3:
4445     proto_item_append_text(tree, "Unknown Address Extension Mode");
4446     break;
4447   default:
4448     /* no default action */
4449     break;
4450   }
4451
4452   return offset - start;
4453 }
4454
4455 static guint
4456 add_ff_selfprot_action(proto_tree *tree, tvbuff_t *tvb, int offset)
4457 {
4458   proto_tree_add_item(tree, hf_ieee80211_ff_selfprot_action, tvb, offset, 1,
4459                       ENC_LITTLE_ENDIAN);
4460   return 1;
4461 }
4462
4463 static guint
4464 add_ff_dls_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4465 {
4466   proto_tree_add_item(tree, hf_ieee80211_ff_dls_action_code, tvb, offset, 1,
4467                       ENC_LITTLE_ENDIAN);
4468   return 1;
4469 }
4470
4471 static guint
4472 add_ff_dst_mac_addr(proto_tree *tree, tvbuff_t *tvb, int offset)
4473 {
4474   proto_tree_add_item(tree, hf_ieee80211_ff_dst_mac_addr, tvb, offset, 6,
4475                       ENC_NA);
4476   return 6;
4477 }
4478
4479 static guint
4480 add_ff_src_mac_addr(proto_tree *tree, tvbuff_t *tvb, int offset)
4481 {
4482   proto_tree_add_item(tree, hf_ieee80211_ff_src_mac_addr, tvb, offset, 6,
4483                       ENC_NA);
4484   return 6;
4485 }
4486
4487 static guint
4488 add_ff_dls_timeout(proto_tree *tree, tvbuff_t *tvb, int offset)
4489 {
4490   proto_tree_add_item(tree, hf_ieee80211_ff_dls_timeout, tvb, offset, 2,
4491                       ENC_LITTLE_ENDIAN);
4492   return 2;
4493 }
4494
4495 static guint
4496 add_ff_delba_param_set(proto_tree *tree, tvbuff_t *tvb, int offset)
4497 {
4498   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_delba_param,
4499                          ett_ff_ba_param_tree, ieee80211_ff_delba_param_fields,
4500                          ENC_LITTLE_ENDIAN);
4501   return 2;
4502 }
4503
4504 static guint
4505 add_ff_max_reg_pwr(proto_tree *tree, tvbuff_t *tvb, int offset)
4506 {
4507   proto_tree_add_item(tree, hf_ieee80211_ff_max_reg_pwr, tvb, offset, 2,
4508                       ENC_LITTLE_ENDIAN);
4509   return 2;
4510 }
4511
4512 static guint
4513 add_ff_measurement_pilot_int(proto_tree *tree, tvbuff_t *tvb, int offset)
4514 {
4515   proto_tree_add_item(tree, hf_ieee80211_ff_measurement_pilot_int, tvb, offset,
4516                       2, ENC_LITTLE_ENDIAN);
4517   return 2;
4518 }
4519
4520 static guint
4521 add_ff_country_str(proto_tree *tree, tvbuff_t *tvb, int offset)
4522 {
4523   proto_tree_add_item(tree, hf_ieee80211_ff_country_str, tvb, offset, 3,
4524                       ENC_ASCII);
4525   return 3;
4526 }
4527
4528 static guint
4529 add_ff_max_tx_pwr(proto_tree *tree, tvbuff_t *tvb, int offset)
4530 {
4531   proto_tree_add_item(tree, hf_ieee80211_ff_max_tx_pwr, tvb, offset, 1,
4532                       ENC_LITTLE_ENDIAN);
4533   return 1;
4534 }
4535
4536 static guint
4537 add_ff_tx_pwr_used(proto_tree *tree, tvbuff_t *tvb, int offset)
4538 {
4539   proto_tree_add_item(tree, hf_ieee80211_ff_tx_pwr_used, tvb, offset, 1,
4540                       ENC_LITTLE_ENDIAN);
4541   return 1;
4542 }
4543
4544 static guint
4545 add_ff_transceiver_noise_floor(proto_tree *tree, tvbuff_t *tvb, int offset)
4546 {
4547   proto_tree_add_item(tree, hf_ieee80211_ff_transceiver_noise_floor, tvb,
4548                       offset, 1, ENC_LITTLE_ENDIAN);
4549   return 1;
4550 }
4551
4552 static guint
4553 add_ff_channel_width(proto_tree *tree, tvbuff_t *tvb, int offset)
4554 {
4555   proto_tree_add_item(tree, hf_ieee80211_ff_channel_width, tvb, offset, 1,
4556                       ENC_LITTLE_ENDIAN);
4557   return 1;
4558 }
4559
4560 static guint
4561 add_ff_qos_info_ap(proto_tree *tree, tvbuff_t *tvb, int offset)
4562 {
4563   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_qos_info_ap,
4564                          ett_ff_qos_info, ieee80211_ff_qos_info_ap_fields,
4565                          ENC_LITTLE_ENDIAN);
4566   return 1;
4567 }
4568
4569 static guint
4570 add_ff_qos_info_sta(proto_tree *tree, tvbuff_t *tvb, int offset)
4571 {
4572   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_qos_info_sta,
4573                          ett_ff_qos_info, ieee80211_ff_qos_info_sta_fields,
4574                          ENC_LITTLE_ENDIAN);
4575   return 1;
4576 }
4577
4578 static guint
4579 add_ff_sm_pwr_cntrl(proto_tree *tree, tvbuff_t *tvb, int offset)
4580 {
4581   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_sm_pwr_save,
4582                          ett_ff_sm_pwr_save, ieee80211_ff_sw_pwr_save_fields,
4583                          ENC_LITTLE_ENDIAN);
4584   return 1;
4585 }
4586
4587 static guint
4588 add_ff_pco_phase_cntrl(proto_tree *tree, tvbuff_t *tvb, int offset)
4589 {
4590   proto_tree_add_item(tree, hf_ieee80211_ff_pco_phase_cntrl, tvb, offset, 1,
4591                       ENC_LITTLE_ENDIAN);
4592   return 1;
4593 }
4594
4595 static guint
4596 add_ff_psmp_param_set(proto_tree *tree, tvbuff_t *tvb, int offset)
4597 {
4598   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_psmp_param_set,
4599                          ett_ff_psmp_param_set,
4600                          ieee80211_ff_psmp_param_set_fields,
4601                          ENC_LITTLE_ENDIAN);
4602   return 2;
4603 }
4604
4605 static guint
4606 add_ff_mimo_cntrl(proto_tree *tree, tvbuff_t *tvb, int offset)
4607 {
4608   proto_item *mimo_item;
4609   proto_tree *mimo_tree;
4610
4611   mimo_item = proto_tree_add_item(tree, hf_ieee80211_ff_mimo_cntrl, tvb,
4612                                   offset, 6, ENC_NA);
4613   mimo_tree = proto_item_add_subtree(mimo_item, ett_ff_mimo_cntrl);
4614
4615   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_nc_index, tvb,
4616                       offset, 1, ENC_LITTLE_ENDIAN);
4617   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_nr_index, tvb,
4618                       offset, 1, ENC_LITTLE_ENDIAN);
4619   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_channel_width, tvb,
4620                       offset, 1, ENC_LITTLE_ENDIAN);
4621   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_grouping, tvb,
4622                       offset, 1, ENC_LITTLE_ENDIAN);
4623   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_coefficient_size,
4624                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
4625   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_codebook_info, tvb,
4626                       offset, 1, ENC_LITTLE_ENDIAN);
4627   proto_tree_add_item(mimo_tree,
4628                       hf_ieee80211_ff_mimo_cntrl_remaining_matrix_segment, tvb,
4629                       offset, 1, ENC_LITTLE_ENDIAN);
4630   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_reserved, tvb,
4631                       offset, 1, ENC_LITTLE_ENDIAN);
4632
4633   offset += 2;
4634   proto_tree_add_item(mimo_tree, hf_ieee80211_ff_mimo_cntrl_sounding_timestamp,
4635                       tvb, offset, 4, ENC_LITTLE_ENDIAN);
4636
4637   return 6;
4638 }
4639
4640 static guint
4641 add_ff_ant_selection(proto_tree *tree, tvbuff_t *tvb, int offset)
4642 {
4643   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_ant_selection,
4644                          ett_ff_ant_sel, ieee80211_ff_ant_selection_fields,
4645                          ENC_LITTLE_ENDIAN);
4646   return 1;
4647 }
4648
4649 static guint
4650 add_ff_extended_channel_switch_announcement(proto_tree *tree, tvbuff_t *tvb,
4651                                             int offset)
4652 {
4653   proto_tree_add_bitmask(tree, tvb, offset,
4654                          hf_ieee80211_ff_ext_channel_switch_announcement,
4655                          ett_ff_chan_switch_announce,
4656                          ieee80211_ff_ext_channel_switch_announcement_fields,
4657                          ENC_LITTLE_ENDIAN);
4658   return 4;
4659 }
4660
4661 static guint
4662 add_ff_ht_information(proto_tree *tree, tvbuff_t *tvb, int offset)
4663 {
4664   proto_tree_add_bitmask(tree, tvb, offset, hf_ieee80211_ff_ht_info,
4665                          ett_ff_ht_info, ieee80211_ff_ht_info_fields,
4666                          ENC_LITTLE_ENDIAN);
4667   return 1;
4668 }
4669
4670 static guint
4671 add_ff_ht_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4672 {
4673   proto_tree_add_item(tree, hf_ieee80211_ff_ht_action, tvb, offset, 1,
4674                       ENC_LITTLE_ENDIAN);
4675   return 1;
4676 }
4677
4678 static guint
4679 add_ff_psmp_sta_info(proto_tree *tree, tvbuff_t *tvb, int offset)
4680 {
4681   proto_item *psmp_item;
4682   proto_tree *psmp_tree;
4683
4684   psmp_item = proto_tree_add_item(tree, hf_ieee80211_ff_psmp_sta_info, tvb,
4685                                   offset, 8, ENC_LITTLE_ENDIAN);
4686   psmp_tree = proto_item_add_subtree(psmp_item, ett_ff_psmp_sta_info);
4687
4688   proto_tree_add_item(psmp_item, hf_ieee80211_ff_psmp_sta_info_type, tvb,
4689                       offset, 4, ENC_LITTLE_ENDIAN);
4690
4691   switch (tvb_get_letohl(tvb, offset) & PSMP_STA_INFO_FLAG_TYPE) {
4692   case PSMP_STA_INFO_BROADCAST:
4693     proto_tree_add_item(psmp_tree,
4694                         hf_ieee80211_ff_psmp_sta_info_dtt_start_offset, tvb,
4695                         offset, 4, ENC_LITTLE_ENDIAN);
4696     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_duration,
4697                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4698     /* Missing 64 bit bitmask... */
4699     proto_tree_add_uint64(psmp_tree,
4700                           hf_ieee80211_ff_psmp_sta_info_reserved_large,
4701                           tvb, offset, 8,
4702                           (tvb_get_letoh64(tvb, offset) &
4703                            G_GINT64_CONSTANT(0xFFFFFFFFFFE00000)) >> 21);
4704     break;
4705   case PSMP_STA_INFO_MULTICAST:
4706     proto_tree_add_item(psmp_tree,
4707                         hf_ieee80211_ff_psmp_sta_info_dtt_start_offset, tvb,
4708                         offset, 4, ENC_LITTLE_ENDIAN);
4709     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_duration,
4710                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4711     /* Missing 64 bit bitmask... */
4712     proto_tree_add_uint64(psmp_tree,
4713                           hf_ieee80211_ff_psmp_sta_info_psmp_multicast_id,
4714                           tvb, offset, 6,
4715                           (tvb_get_letoh64(tvb, offset) &
4716                            G_GINT64_CONSTANT(0xFFFFFFFFFFE00000)) >> 21);
4717     break;
4718   case PSMP_STA_INFO_INDIVIDUALLY_ADDRESSED:
4719     proto_tree_add_item(psmp_tree,
4720                         hf_ieee80211_ff_psmp_sta_info_dtt_start_offset, tvb,
4721                         offset, 4, ENC_LITTLE_ENDIAN);
4722     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_dtt_duration,
4723                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4724     offset += 2;
4725     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_sta_id, tvb,
4726                         offset, 4, ENC_LITTLE_ENDIAN);
4727     offset += 2;
4728
4729     proto_tree_add_item(psmp_tree,
4730                         hf_ieee80211_ff_psmp_sta_info_utt_start_offset,
4731                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4732     proto_tree_add_item(psmp_tree, hf_ieee80211_ff_psmp_sta_info_utt_duration,
4733                         tvb, offset, 4, ENC_LITTLE_ENDIAN);
4734     proto_tree_add_item(psmp_tree,
4735                         hf_ieee80211_ff_psmp_sta_info_reserved_small, tvb,
4736                         offset, 4, ENC_LITTLE_ENDIAN);
4737     break;
4738   }
4739
4740   return 8;
4741 }
4742
4743 static guint
4744 add_ff_schedule_info(proto_tree *tree, tvbuff_t *tvb, int offset)
4745 {
4746   proto_item *sched_item;
4747   proto_tree *sched_tree;
4748
4749   sched_item = proto_tree_add_item(tree, hf_ieee80211_sched_info, tvb, offset,
4750                                    2, ENC_LITTLE_ENDIAN);
4751   sched_tree = proto_item_add_subtree(sched_item, ett_sched_tree);
4752
4753   proto_tree_add_item(sched_tree, hf_ieee80211_sched_info_agg, tvb, offset, 2,
4754                       ENC_LITTLE_ENDIAN);
4755   if (tvb_get_letohs(tvb, offset) & 0x0001) {
4756     proto_tree_add_item(sched_tree, hf_ieee80211_sched_info_tsid, tvb, offset,
4757                         2, ENC_LITTLE_ENDIAN);
4758     proto_tree_add_item(sched_tree, hf_ieee80211_sched_info_dir, tvb, offset,
4759                         2, ENC_LITTLE_ENDIAN);
4760   }
4761
4762   return 2;
4763 }
4764
4765 static guint
4766 add_ff_pa_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
4767 {
4768   proto_tree_add_item(tree, hf_ieee80211_ff_public_action, tvb, offset, 1,
4769                       ENC_BIG_ENDIAN);
4770   return 1;
4771 }
4772
4773 static guint
4774 add_ff_action_spectrum_mgmt(proto_tree *tree, tvbuff_t *tvb, int offset)
4775 {
4776     switch (tvb_get_guint8(tvb, offset + 1)) {
4777     case SM_ACTION_MEASUREMENT_REQUEST:
4778     case SM_ACTION_MEASUREMENT_REPORT:
4779     case SM_ACTION_TPC_REQUEST:
4780     case SM_ACTION_TPC_REPORT:
4781       add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4782       add_fixed_field(tree, tvb, offset + 1, FIELD_ACTION_CODE);
4783       add_fixed_field(tree, tvb, offset + 2, FIELD_DIALOG_TOKEN);
4784       return 3;
4785     case SM_ACTION_CHAN_SWITCH_ANNC:
4786     case SM_ACTION_EXT_CHAN_SWITCH_ANNC:
4787       add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4788       add_fixed_field(tree, tvb, offset + 1, FIELD_ACTION_CODE);
4789       return 2;
4790     default:
4791       add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4792       add_fixed_field(tree, tvb, offset + 1, FIELD_ACTION_CODE);
4793       return 2;
4794     }
4795 }
4796
4797 static guint
4798 add_ff_action_qos(proto_tree *tree, tvbuff_t *tvb, int offset)
4799 {
4800   switch (tvb_get_guint8(tvb, offset + 1)) {
4801   case SM_ACTION_ADDTS_REQUEST:
4802     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4803     add_fixed_field(tree, tvb, offset + 1, FIELD_QOS_ACTION_CODE);
4804     add_fixed_field(tree, tvb, offset + 2, FIELD_DIALOG_TOKEN);
4805     return 3;
4806   case SM_ACTION_ADDTS_RESPONSE:
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     add_fixed_field(tree, tvb, offset + 3, FIELD_STATUS_CODE);
4811     return 5;
4812   case SM_ACTION_DELTS:
4813     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4814     add_fixed_field(tree, tvb, offset + 1, FIELD_QOS_ACTION_CODE);
4815     add_fixed_field(tree, tvb, offset + 2, FIELD_QOS_TS_INFO);
4816     add_fixed_field(tree, tvb, offset + 5, FIELD_REASON_CODE);
4817     return 7;
4818   case SM_ACTION_QOS_SCHEDULE:
4819     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4820     add_fixed_field(tree, tvb, offset + 1, FIELD_QOS_ACTION_CODE);
4821     return 2;
4822   default:
4823     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4824     return 2;
4825   }
4826 }
4827
4828 static guint
4829 add_ff_action_dls(proto_tree *tree, tvbuff_t *tvb, int offset)
4830 {
4831   switch (tvb_get_guint8(tvb, offset + 1)) {
4832   case SM_ACTION_DLS_REQUEST:
4833     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4834     add_fixed_field(tree, tvb, offset + 1, FIELD_DLS_ACTION_CODE);
4835     add_fixed_field(tree, tvb, offset + 2, FIELD_DST_MAC_ADDR);
4836     add_fixed_field(tree, tvb, offset + 8, FIELD_SRC_MAC_ADDR);
4837     add_fixed_field(tree, tvb, offset + 14, FIELD_CAP_INFO);
4838     add_fixed_field(tree, tvb, offset + 16, FIELD_DLS_TIMEOUT);
4839     return 18;
4840   case SM_ACTION_DLS_RESPONSE:
4841     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4842     add_fixed_field(tree, tvb, offset + 1, FIELD_DLS_ACTION_CODE);
4843     add_fixed_field(tree, tvb, offset + 2, FIELD_STATUS_CODE);
4844     add_fixed_field(tree, tvb, offset + 4, FIELD_DST_MAC_ADDR);
4845     add_fixed_field(tree, tvb, offset + 10, FIELD_SRC_MAC_ADDR);
4846     if (!hf_ieee80211_ff_status_code) {
4847       add_fixed_field(tree, tvb, offset + 16, FIELD_CAP_INFO);
4848     }
4849     return 16;
4850   case SM_ACTION_DLS_TEARDOWN:
4851     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4852     add_fixed_field(tree, tvb, offset + 1, FIELD_DLS_ACTION_CODE);
4853     add_fixed_field(tree, tvb, offset + 2, FIELD_DST_MAC_ADDR);
4854     add_fixed_field(tree, tvb, offset + 8, FIELD_SRC_MAC_ADDR);
4855     add_fixed_field(tree, tvb, offset + 14, FIELD_REASON_CODE);
4856     return 16;
4857   default:
4858     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4859     return 2;
4860   }
4861 }
4862
4863 static guint
4864 add_ff_action_block_ack(proto_tree *tree, tvbuff_t *tvb, int offset)
4865 {
4866   guint start = offset;
4867
4868   switch (tvb_get_guint8(tvb, offset + 1)) {
4869   case BA_ADD_BLOCK_ACK_REQUEST:
4870     offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4871     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_ACTION_CODE);
4872     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4873     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_PARAM);
4874     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_TIMEOUT);
4875     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
4876     break;
4877   case BA_ADD_BLOCK_ACK_RESPONSE:
4878     offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4879     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_ACTION_CODE);
4880     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4881     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
4882     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_PARAM);
4883     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_TIMEOUT);
4884     break;
4885   case BA_DELETE_BLOCK_ACK:
4886     offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4887     offset += add_fixed_field(tree, tvb, offset, FIELD_BLOCK_ACK_ACTION_CODE);
4888     offset += add_fixed_field(tree, tvb, offset, FIELD_DELBA_PARAM_SET);
4889     offset += add_fixed_field(tree, tvb, offset, FIELD_REASON_CODE);
4890     break;
4891   }
4892
4893   return offset - start;  /* Size of fixed fields */
4894 }
4895
4896 static guint
4897 add_ff_action_public(proto_tree *tree, tvbuff_t *tvb, int offset)
4898 {
4899   guint start = offset;
4900   guint32 oui;
4901   guint8 code;
4902   guint8 subtype;
4903   gboolean anqp;
4904   guint8 dialog_token;
4905   guint8 frag;
4906   gboolean more;
4907
4908   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4909   code = tvb_get_guint8(tvb, offset);
4910   offset += add_fixed_field(tree, tvb, offset, FIELD_PA_ACTION_CODE);
4911
4912   switch (code) {
4913   case PA_VENDOR_SPECIFIC:
4914     oui = tvb_get_ntoh24(tvb, offset);
4915     proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
4916     offset += 3;
4917     switch (oui) {
4918     case OUI_WFA:
4919       subtype = tvb_get_guint8(tvb, offset);
4920       proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u", subtype);
4921       offset++;
4922       if (subtype == WFA_SUBTYPE_P2P) {
4923         offset = dissect_wifi_p2p_public_action(g_pinfo, tree, tvb, offset);
4924       }
4925       break;
4926     default:
4927       /* Don't know how to handle this vendor */
4928       break;
4929     }
4930     break;
4931   case PA_GAS_INITIAL_REQUEST:
4932     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4933     offset += dissect_advertisement_protocol(g_pinfo, tree, tvb, offset,
4934                                              &anqp);
4935     offset += dissect_gas_initial_request(tree, tvb, offset, anqp);
4936     break;
4937   case PA_GAS_INITIAL_RESPONSE:
4938     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4939     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
4940     offset += add_fixed_field(tree, tvb, offset, FIELD_GAS_COMEBACK_DELAY);
4941     offset += dissect_advertisement_protocol(g_pinfo, tree, tvb, offset,
4942                                              &anqp);
4943     offset += dissect_gas_initial_response(tree, tvb, offset, anqp);
4944     break;
4945   case PA_GAS_COMEBACK_REQUEST:
4946     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4947     break;
4948   case PA_GAS_COMEBACK_RESPONSE:
4949     dialog_token = tvb_get_guint8(tvb, offset);
4950     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4951     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
4952     frag = tvb_get_guint8(tvb, offset) & 0x7f;
4953     more = (tvb_get_guint8(tvb, offset) & 0x80) != 0;
4954     offset += add_fixed_field(tree, tvb, offset, FIELD_GAS_FRAGMENT_ID);
4955     offset += add_fixed_field(tree, tvb, offset, FIELD_GAS_COMEBACK_DELAY);
4956     offset += dissect_advertisement_protocol(g_pinfo, tree, tvb, offset,
4957                                              &anqp);
4958     offset += dissect_gas_comeback_response(tree, tvb, offset, anqp, frag,
4959                                             more, dialog_token);
4960     break;
4961   case PA_TDLS_DISCOVERY_RESPONSE:
4962     col_set_str(g_pinfo->cinfo, COL_PROTOCOL, "TDLS");
4963     col_set_str(g_pinfo->cinfo, COL_INFO, "TDLS Discovery Response");
4964     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
4965     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
4966     break;
4967   }
4968
4969   return offset - start;  /* Size of fixed fields */
4970 }
4971
4972 static guint
4973 add_ff_action_fast_bss_transition(proto_tree *tree, tvbuff_t *tvb, int offset)
4974 {
4975   guint start = offset;
4976   guint8 code;
4977
4978   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
4979   code = tvb_get_guint8(tvb, offset);
4980   offset += add_fixed_field(tree, tvb, offset, FIELD_FT_ACTION_CODE);
4981
4982   switch (code) {
4983   case FT_ACTION_REQUEST:
4984     offset += add_fixed_field(tree, tvb, offset, FIELD_STA_ADDRESS);
4985     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
4986     /* Followed by FT Request frame body (IEs) */
4987     break;
4988   case FT_ACTION_RESPONSE:
4989     offset += add_fixed_field(tree, tvb, offset, FIELD_STA_ADDRESS);
4990     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
4991     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
4992     /* Followed by FT Response frame body (IEs) */
4993     break;
4994   case FT_ACTION_CONFIRM:
4995     offset += add_fixed_field(tree, tvb, offset, FIELD_STA_ADDRESS);
4996     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
4997     /* Followed by FT Confirm frame body (IEs) */
4998     break;
4999   case FT_ACTION_ACK:
5000     offset += add_fixed_field(tree, tvb, offset, FIELD_STA_ADDRESS);
5001     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_AP_ADDRESS);
5002     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5003     /* Followed by FT Ack frame body (IEs) */
5004     break;
5005   }
5006
5007   return offset - start;  /* Size of fixed fields */
5008 }
5009
5010 static guint
5011 add_ff_action_sa_query(proto_tree *tree, tvbuff_t *tvb, int offset)
5012 {
5013   guint start = offset;
5014   guint8 code;
5015
5016   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5017   code = tvb_get_guint8(tvb, offset);
5018   offset += add_fixed_field(tree, tvb, offset, FIELD_SA_QUERY_ACTION_CODE);
5019
5020   switch (code) {
5021   case SA_QUERY_REQUEST:
5022     offset += add_fixed_field(tree, tvb, offset, FIELD_TRANSACTION_ID);
5023     break;
5024   case SA_QUERY_RESPONSE:
5025     offset += add_fixed_field(tree, tvb, offset, FIELD_TRANSACTION_ID);
5026     break;
5027   }
5028
5029   return offset - start;  /* Size of fixed fields */
5030 }
5031
5032 static guint
5033 add_ff_action_mesh(proto_tree *tree, tvbuff_t *tvb, int offset)
5034 {
5035   guint length;
5036   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5037   offset += add_fixed_field(tree, tvb, offset, FIELD_MESH_ACTION);
5038   /* The only fixed fields are the category and mesh action.  The rest are IEs.
5039    */
5040   length = 2;
5041   if (tvb_get_guint8(tvb, 1) == MESH_ACTION_TBTT_ADJ_RESPONSE) {
5042     /* ..except for the TBTT Adjustment Response, which has a status code field
5043      */
5044     length += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5045   }
5046   return length;
5047 }
5048
5049 static guint
5050 add_ff_action_multihop(proto_tree *tree, tvbuff_t *tvb, int offset)
5051 {
5052   guint start = offset;
5053   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5054   offset += add_fixed_field(tree, tvb, offset, FIELD_MULTIHOP_ACTION);
5055   offset += add_fixed_field(tree, tvb, offset, FIELD_MESH_CONTROL);
5056   return offset - start;
5057 }
5058
5059 static guint
5060 add_ff_action_self_protected(proto_tree *tree, tvbuff_t *tvb, int offset)
5061 {
5062   guint start = offset;
5063
5064   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5065   offset += add_fixed_field(tree, tvb, offset, FIELD_SELFPROT_ACTION);
5066
5067   switch (tvb_get_guint8(tvb, start + 1)) {
5068   case SELFPROT_ACTION_MESH_PEERING_OPEN:
5069     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
5070     break;
5071   case SELFPROT_ACTION_MESH_PEERING_CONFIRM:
5072     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
5073     offset += add_fixed_field(tree, tvb, offset, FIELD_ASSOC_ID);
5074     break;
5075   }
5076
5077   return offset - start;
5078 }
5079
5080 static guint
5081 wnm_bss_trans_mgmt_req(proto_tree *tree, tvbuff_t *tvb, int offset)
5082 {
5083   int start = offset;
5084   guint8 mode;
5085   gint left;
5086
5087   offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5088
5089   mode = tvb_get_guint8(tvb, offset);
5090   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_pref_cand,
5091                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5092   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_abridged,
5093                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5094   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_disassoc_imminent,
5095                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5096   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_bss_term_included,
5097                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5098   proto_tree_add_item(tree, hf_ieee80211_ff_request_mode_ess_disassoc_imminent,
5099                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
5100   offset++;
5101
5102   proto_tree_add_item(tree, hf_ieee80211_ff_disassoc_timer, tvb, offset, 2,
5103                       ENC_LITTLE_ENDIAN);
5104   offset += 2;
5105
5106   proto_tree_add_item(tree, hf_ieee80211_ff_validity_interval, tvb, offset, 1,
5107                       ENC_LITTLE_ENDIAN);
5108   offset++;
5109
5110   if (mode & 0x08) {
5111     proto_tree_add_text(tree, tvb, offset, 8, "BSS Termination Duration");
5112     offset += 8;
5113   }
5114
5115   if (mode & 0x10) {
5116     guint8 url_len;
5117     url_len = tvb_get_guint8(tvb, offset);
5118     proto_tree_add_item(tree, hf_ieee80211_ff_url_len, tvb, offset, 1,
5119                         ENC_LITTLE_ENDIAN);
5120     offset++;
5121     proto_tree_add_item(tree, hf_ieee80211_ff_url, tvb, offset, url_len,
5122                         ENC_ASCII|ENC_NA);
5123     offset += url_len;
5124   }
5125
5126   left = tvb_reported_length_remaining(tvb, offset);
5127   if (left > 0) {
5128     proto_tree_add_text(tree, tvb, offset, left,
5129                         "BSS Transition Candidate List Entries");
5130     offset += left;
5131   }
5132
5133   return offset - start;
5134 }
5135
5136 static guint
5137 add_ff_action_wnm(proto_tree *tree, tvbuff_t *tvb, int offset)
5138 {
5139   guint8 code;
5140   guint start = offset;
5141
5142   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5143   code = tvb_get_guint8(tvb, offset);
5144   offset += add_fixed_field(tree, tvb, offset, FIELD_WNM_ACTION_CODE);
5145   switch (code) {
5146   case WNM_BSS_TRANS_MGMT_REQ:
5147     offset += wnm_bss_trans_mgmt_req(tree, tvb, offset);
5148     break;
5149   }
5150
5151   return offset - start;  /* Size of fixed fields */
5152 }
5153
5154 static guint
5155 add_ff_action_tdls(proto_tree *tree, tvbuff_t *tvb, int offset)
5156 {
5157   guint8 code;
5158   guint16 status;
5159   guint start = offset;
5160
5161   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5162   code = tvb_get_guint8(tvb, offset);
5163   offset += add_fixed_field(tree, tvb, offset, FIELD_TDLS_ACTION_CODE);
5164   switch (code) {
5165   case TDLS_SETUP_REQUEST:
5166     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5167     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
5168     break;
5169   case TDLS_SETUP_RESPONSE:
5170     status = tvb_get_letohs(tvb, offset);
5171     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5172     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5173     if (tvb_reported_length_remaining(tvb, offset) < 2) {
5174       if (status == 0) {
5175         expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
5176                                "TDLS Setup Response (success) does not "
5177                                "include mandatory fields");
5178       }
5179       break;
5180     }
5181     offset += add_fixed_field(tree, tvb, offset, FIELD_CAP_INFO);
5182     break;
5183   case TDLS_SETUP_CONFIRM:
5184     status = tvb_get_letohs(tvb, offset);
5185     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5186     if (tvb_reported_length_remaining(tvb, offset) < 1) {
5187       if (status == 0) {
5188         expert_add_info_format(g_pinfo, tree, PI_MALFORMED, PI_ERROR,
5189                                "TDLS Setup Confirm (success) does not include "
5190                                "mandatory fields");
5191       }
5192       break;
5193     }
5194     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5195     break;
5196   case TDLS_TEARDOWN:
5197     offset += add_fixed_field(tree, tvb, offset, FIELD_REASON_CODE);
5198     break;
5199   case TDLS_PEER_TRAFFIC_INDICATION:
5200     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5201     break;
5202   case TDLS_CHANNEL_SWITCH_REQUEST:
5203     offset += add_fixed_field(tree, tvb, offset, FIELD_TARGET_CHANNEL);
5204     offset += add_fixed_field(tree, tvb, offset, FIELD_REGULATORY_CLASS);
5205     break;
5206   case TDLS_CHANNEL_SWITCH_RESPONSE:
5207     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5208     break;
5209   case TDLS_PEER_PSM_REQUEST:
5210     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5211     break;
5212   case TDLS_PEER_PSM_RESPONSE:
5213     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5214     offset += add_fixed_field(tree, tvb, offset, FIELD_STATUS_CODE);
5215     break;
5216   case TDLS_PEER_TRAFFIC_RESPONSE:
5217     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5218     break;
5219   case TDLS_DISCOVERY_REQUEST:
5220     offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5221     break;
5222   }
5223
5224   return offset - start;  /* Size of fixed fields */
5225 }
5226
5227 static guint
5228 add_ff_action_mgmt_notification(proto_tree *tree, tvbuff_t *tvb, int offset)
5229 {
5230   guint start = offset;
5231
5232   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5233   offset += add_fixed_field(tree, tvb, offset, FIELD_WME_ACTION_CODE);
5234   offset += add_fixed_field(tree, tvb, offset, FIELD_DIALOG_TOKEN);
5235   offset += add_fixed_field(tree, tvb, offset, FIELD_WME_STATUS_CODE);
5236
5237   return offset - start;  /* Size of fixed fields */
5238 }
5239
5240 static guint
5241 add_ff_action_vendor_specific(proto_tree *tree, tvbuff_t *tvb, int offset)
5242 {
5243   guint start = offset;
5244   guint32 oui;
5245   guint8 subtype;
5246
5247   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5248   oui = tvb_get_ntoh24(tvb, offset);
5249   proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
5250   offset +=3;
5251   switch (oui) {
5252   case OUI_MARVELL:
5253     offset = dissect_vendor_action_marvell(tree, tvb, offset);
5254     break;
5255   case OUI_WFA:
5256     subtype = tvb_get_guint8(tvb, offset);
5257     proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u", subtype);
5258     offset++;
5259     if (subtype == WFA_SUBTYPE_P2P) {
5260       offset = dissect_wifi_p2p_action(tree, tvb, offset);
5261     }
5262     break;
5263   default:
5264     /* Don't know how to handle this vendor */
5265     break;
5266   }
5267
5268   return offset - start;  /* Size of fixed fields */
5269 }
5270
5271 static guint
5272 add_ff_action_ht(proto_tree *tree, tvbuff_t *tvb, int offset)
5273 {
5274   guint start = offset;
5275   guint8 n_sta, i;
5276   mimo_control_t mimo_cntrl;
5277
5278   offset += add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5279   offset += add_fixed_field(tree, tvb, offset, FIELD_HT_ACTION_CODE);
5280
5281   switch (tvb_get_guint8(tvb, offset - 1)) {
5282   case HT_ACTION_NOTIFY_CHAN_WIDTH:
5283     offset += add_fixed_field(tree, tvb, offset, FIELD_CHANNEL_WIDTH);
5284     break;
5285   case HT_ACTION_SM_PWR_SAVE:
5286     offset += add_fixed_field(tree, tvb, offset, FIELD_SM_PWR_CNTRL);
5287     break;
5288   case HT_ACTION_PSMP_ACTION:
5289     n_sta = tvb_get_guint8(tvb, offset);
5290     offset += add_fixed_field(tree, tvb, offset, FIELD_PSMP_PARAM_SET);
5291     for (i = 0; i < (n_sta & 0x0F); i++) {
5292       offset += add_fixed_field(tree, tvb, offset, FIELD_PSMP_STA_INFO);
5293     }
5294     break;
5295   case HT_ACTION_SET_PCO_PHASE:
5296     offset += add_fixed_field(tree, tvb, offset, FIELD_PCO_PHASE_CNTRL);
5297     break;
5298   case HT_ACTION_MIMO_CSI:
5299     mimo_cntrl = get_mimo_control(tvb, offset);
5300     offset += add_fixed_field(tree, tvb, offset, FIELD_MIMO_CNTRL);
5301     offset += add_mimo_csi_matrices_report(tree, tvb, offset, mimo_cntrl);
5302     break;
5303   case HT_ACTION_MIMO_BEAMFORMING:
5304     mimo_cntrl = get_mimo_control(tvb, offset);
5305     offset += add_fixed_field(tree, tvb, offset, FIELD_MIMO_CNTRL);
5306     offset += add_mimo_beamforming_feedback_report(tree, tvb, offset,
5307                                                    mimo_cntrl);
5308     break;
5309   case HT_ACTION_MIMO_COMPRESSED_BEAMFORMING:
5310     mimo_cntrl = get_mimo_control(tvb, offset);
5311     offset += add_fixed_field(tree, tvb, offset, FIELD_MIMO_CNTRL);
5312     offset += add_mimo_compressed_beamforming_feedback_report(tree, tvb,
5313                                                               offset,
5314                                                               mimo_cntrl);
5315     break;
5316   case HT_ACTION_ANT_SEL_FEEDBACK:
5317     offset += add_fixed_field(tree, tvb, offset, FIELD_ANT_SELECTION);
5318     break;
5319   case HT_ACTION_HT_INFO_EXCHANGE:
5320     offset += add_fixed_field(tree, tvb, offset, FIELD_HT_INFORMATION);
5321     break;
5322   }
5323
5324   return offset - start;
5325 }
5326
5327 static guint
5328 add_ff_action(proto_tree *tree, tvbuff_t *tvb, int offset)
5329 {
5330   switch (tvb_get_guint8(tvb, offset) & 0x7f) {
5331   case CAT_SPECTRUM_MGMT:
5332     return add_ff_action_spectrum_mgmt(tree, tvb, offset);
5333   case CAT_QOS:
5334     return add_ff_action_qos(tree, tvb, offset);
5335   case CAT_DLS:
5336     return add_ff_action_dls(tree, tvb, offset);
5337   case CAT_BLOCK_ACK:
5338     return add_ff_action_block_ack(tree, tvb, offset);
5339   case CAT_PUBLIC:
5340     return add_ff_action_public(tree, tvb, offset);
5341   case CAT_FAST_BSS_TRANSITION:
5342     return add_ff_action_fast_bss_transition(tree, tvb, offset);
5343   case CAT_SA_QUERY:
5344     return add_ff_action_sa_query(tree, tvb, offset);
5345   case CAT_MESH:
5346     return add_ff_action_mesh(tree, tvb, offset);
5347   case CAT_MULTIHOP:
5348     return add_ff_action_multihop(tree, tvb, offset);
5349   case CAT_SELF_PROTECTED:
5350     return add_ff_action_self_protected(tree, tvb, offset);
5351   case CAT_WNM:
5352     return add_ff_action_wnm(tree, tvb, offset);
5353   case CAT_TDLS:
5354     return add_ff_action_tdls(tree, tvb, offset);
5355   case CAT_MGMT_NOTIFICATION:  /* Management notification frame */
5356     return add_ff_action_mgmt_notification(tree, tvb, offset);
5357   case CAT_VENDOR_SPECIFIC:  /* Vendor Specific Category */
5358     return add_ff_action_vendor_specific(tree, tvb, offset);
5359   case CAT_HT:
5360     return add_ff_action_ht(tree, tvb, offset);
5361   default:
5362     add_fixed_field(tree, tvb, offset, FIELD_CATEGORY_CODE);
5363     return 1;
5364   }
5365 }
5366
5367 static guint
5368 add_ff_ft_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
5369 {
5370   proto_tree_add_item(tree, hf_ieee80211_ff_ft_action_code, tvb, offset, 1,
5371                       ENC_BIG_ENDIAN);
5372   return 1;
5373 }
5374
5375 static guint
5376 add_ff_sta_address(proto_tree *tree, tvbuff_t *tvb, int offset)
5377 {
5378   proto_tree_add_item(tree, hf_ieee80211_ff_sta_address, tvb, offset, 6,
5379                       ENC_NA);
5380   return 6;
5381 }
5382
5383 static guint
5384 add_ff_target_ap_address(proto_tree *tree, tvbuff_t *tvb, int offset)
5385 {
5386   proto_tree_add_item(tree, hf_ieee80211_ff_target_ap_address, tvb, offset, 6,
5387                       ENC_NA);
5388   return 6;
5389 }
5390
5391 static guint
5392 add_ff_gas_comeback_delay(proto_tree *tree, tvbuff_t *tvb, int offset)
5393 {
5394   proto_tree_add_item(tree, hf_ieee80211_ff_gas_comeback_delay, tvb, offset, 2,
5395                       ENC_LITTLE_ENDIAN);
5396   return 2;
5397 }
5398
5399 static guint
5400 add_ff_gas_fragment_id(proto_tree *tree, tvbuff_t *tvb, int offset)
5401 {
5402   proto_tree_add_item(tree, hf_ieee80211_ff_gas_fragment_id, tvb, offset, 1,
5403                       ENC_BIG_ENDIAN);
5404   proto_tree_add_item(tree, hf_ieee80211_ff_more_gas_fragments, tvb, offset, 1,
5405                       ENC_BIG_ENDIAN);
5406   return 1;
5407 }
5408
5409 static guint
5410 add_ff_sa_query_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
5411 {
5412   proto_tree_add_item(tree, hf_ieee80211_ff_sa_query_action_code, tvb, offset,
5413                       1, ENC_BIG_ENDIAN);
5414   return 1;
5415 }
5416
5417 static guint
5418 add_ff_transaction_id(proto_tree *tree, tvbuff_t *tvb, int offset)
5419 {
5420   proto_tree_add_item(tree, hf_ieee80211_ff_transaction_id, tvb, offset, 2,
5421                       ENC_LITTLE_ENDIAN);
5422   return 2;
5423 }
5424
5425 static guint
5426 add_ff_tdls_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
5427 {
5428   guint8 code;
5429   code = tvb_get_guint8(tvb, offset);
5430   col_set_str(g_pinfo->cinfo, COL_INFO,
5431               val_to_str_const(code, tdls_action_codes,
5432                                "Unknown TDLS Action"));
5433   proto_tree_add_item(tree, hf_ieee80211_ff_tdls_action_code, tvb, offset, 1,
5434                       ENC_BIG_ENDIAN);
5435   return 1;
5436 }
5437
5438 static guint
5439 add_ff_target_channel(proto_tree *tree, tvbuff_t *tvb, int offset)
5440 {
5441   proto_tree_add_item(tree, hf_ieee80211_ff_target_channel, tvb, offset, 1,
5442                       ENC_BIG_ENDIAN);
5443   return 1;
5444 }
5445
5446 static guint
5447 add_ff_regulatory_class(proto_tree *tree, tvbuff_t *tvb, int offset)
5448 {
5449   proto_tree_add_item(tree, hf_ieee80211_ff_regulatory_class, tvb, offset, 1,
5450                       ENC_BIG_ENDIAN);
5451   return 1;
5452 }
5453
5454 static guint
5455 add_ff_wnm_action_code(proto_tree *tree, tvbuff_t *tvb, int offset)
5456 {
5457   guint8 code;
5458   code = tvb_get_guint8(tvb, offset);
5459   col_set_str(g_pinfo->cinfo, COL_INFO,
5460               val_to_str_const(code, wnm_action_codes,
5461                                "Unknown WNM Action"));
5462   proto_tree_add_item(tree, hf_ieee80211_ff_wnm_action_code, tvb, offset, 1,
5463                       ENC_BIG_ENDIAN);
5464   return 1;
5465 }
5466
5467 struct ieee80211_fixed_field_dissector {
5468   enum fixed_field lfcode;
5469   guint (*dissector)(proto_tree *tree, tvbuff_t *tvb, int offset);
5470 };
5471
5472 #define FF_FIELD(f, func) { FIELD_ ## f, add_ff_ ## func }
5473
5474 static const struct ieee80211_fixed_field_dissector ff_dissectors[] = {
5475   FF_FIELD(TIMESTAMP, timestamp),
5476   FF_FIELD(BEACON_INTERVAL, beacon_interval),
5477   FF_FIELD(CAP_INFO, cap_info),
5478   FF_FIELD(AUTH_ALG, auth_alg),
5479   FF_FIELD(AUTH_TRANS_SEQ, auth_trans_seq),
5480   FF_FIELD(CURRENT_AP_ADDR, current_ap_addr),
5481   FF_FIELD(LISTEN_IVAL, listen_ival),
5482   FF_FIELD(REASON_CODE, reason_code),
5483   FF_FIELD(ASSOC_ID, assoc_id),
5484   FF_FIELD(STATUS_CODE, status_code),
5485   FF_FIELD(CATEGORY_CODE, category_code),
5486   FF_FIELD(ACTION_CODE, action_code),
5487   FF_FIELD(DIALOG_TOKEN, dialog_token),
5488   FF_FIELD(WME_ACTION_CODE, wme_action_code),
5489   FF_FIELD(WME_STATUS_CODE, wme_status_code),
5490   FF_FIELD(QOS_ACTION_CODE, qos_action_code),
5491   FF_FIELD(BLOCK_ACK_ACTION_CODE, block_ack_action_code),
5492   FF_FIELD(BLOCK_ACK_PARAM, block_ack_param),
5493   FF_FIELD(BLOCK_ACK_TIMEOUT, block_ack_timeout),
5494   FF_FIELD(BLOCK_ACK_SSC, block_ack_ssc),
5495   FF_FIELD(QOS_TS_INFO, qos_ts_info),
5496   FF_FIELD(MESH_ACTION, mesh_action),
5497   FF_FIELD(MULTIHOP_ACTION, multihop_action),
5498   FF_FIELD(MESH_CONTROL, mesh_control),
5499   FF_FIELD(SELFPROT_ACTION, selfprot_action),
5500   FF_FIELD(DLS_ACTION_CODE, dls_action_code),
5501   FF_FIELD(DST_MAC_ADDR, dst_mac_addr),
5502   FF_FIELD(SRC_MAC_ADDR, src_mac_addr),
5503   FF_FIELD(DLS_TIMEOUT, dls_timeout),
5504   FF_FIELD(DELBA_PARAM_SET, delba_param_set),
5505   FF_FIELD(MAX_REG_PWR, max_reg_pwr),
5506   FF_FIELD(MEASUREMENT_PILOT_INT, measurement_pilot_int),
5507   FF_FIELD(COUNTRY_STR, country_str),
5508   FF_FIELD(MAX_TX_PWR, max_tx_pwr),
5509   FF_FIELD(TX_PWR_USED, tx_pwr_used),
5510   FF_FIELD(TRANSCEIVER_NOISE_FLOOR, transceiver_noise_floor),
5511   FF_FIELD(CHANNEL_WIDTH, channel_width),
5512   FF_FIELD(QOS_INFO_AP, qos_info_ap),
5513   FF_FIELD(QOS_INFO_STA, qos_info_sta),
5514   FF_FIELD(SM_PWR_CNTRL, sm_pwr_cntrl),
5515   FF_FIELD(PCO_PHASE_CNTRL, pco_phase_cntrl),
5516   FF_FIELD(PSMP_PARAM_SET, psmp_param_set),
5517   FF_FIELD(MIMO_CNTRL, mimo_cntrl),
5518   FF_FIELD(ANT_SELECTION, ant_selection),
5519   FF_FIELD(EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT,
5520            extended_channel_switch_announcement),
5521   FF_FIELD(HT_INFORMATION, ht_information),
5522   FF_FIELD(HT_ACTION_CODE, ht_action_code),
5523   FF_FIELD(PSMP_STA_INFO, psmp_sta_info),
5524   FF_FIELD(SCHEDULE_INFO, schedule_info),
5525   FF_FIELD(PA_ACTION_CODE, pa_action_code),
5526   FF_FIELD(ACTION, action),
5527   FF_FIELD(FT_ACTION_CODE, ft_action_code),
5528   FF_FIELD(STA_ADDRESS, sta_address),
5529   FF_FIELD(TARGET_AP_ADDRESS, target_ap_address),
5530   FF_FIELD(GAS_COMEBACK_DELAY, gas_comeback_delay),
5531   FF_FIELD(GAS_FRAGMENT_ID, gas_fragment_id),
5532   FF_FIELD(SA_QUERY_ACTION_CODE, sa_query_action_code),
5533   FF_FIELD(TRANSACTION_ID, transaction_id),
5534   FF_FIELD(TDLS_ACTION_CODE, tdls_action_code),
5535   FF_FIELD(TARGET_CHANNEL, target_channel),
5536   FF_FIELD(REGULATORY_CLASS, regulatory_class),
5537   FF_FIELD(WNM_ACTION_CODE, wnm_action_code),
5538   { -1, NULL }
5539 };
5540
5541 #undef FF_FIELD
5542
5543 static guint
5544 add_fixed_field(proto_tree *tree, tvbuff_t *tvb, int offset,
5545                 enum fixed_field lfcode)
5546 {
5547   int i;
5548   for (i = 0; ff_dissectors[i].dissector; i++) {
5549     if (ff_dissectors[i].lfcode == lfcode) {
5550       return ff_dissectors[i].dissector(tree, tvb, offset);
5551     }
5552   }
5553   return 0;
5554 }
5555
5556 static const value_string ieee80211_rsn_cipher_vals[] =
5557 {
5558   {0, "NONE"},
5559   {1, "WEP (40-bit)"},
5560   {2, "TKIP"},
5561   {3, "AES (OCB)"},
5562   {4, "AES (CCM)"},
5563   {5, "WEP (104-bit)"},
5564   {6, "BIP"},
5565   {7, "Group addressed traffic not allowed"},
5566   {0, NULL}
5567 };
5568
5569 static const value_string ieee80211_rsn_keymgmt_vals[] =
5570 {
5571   {0, "NONE"},
5572   {1, "WPA"},
5573   {2, "PSK"},
5574   {3, "FT over IEEE 802.1X"},
5575   {4, "FT using PSK"},
5576   {5, "WPA (SHA256)"},
5577   {6, "PSK (SHA256)"},
5578   {7, "TDLS / TPK Handshake"},
5579   {0, NULL}
5580 };
5581
5582 static void
5583 oui_base_custom(gchar *result, guint32 oui)
5584 {
5585   guint8 p_oui[3];
5586   const gchar *manuf_name;
5587   p_oui[0] = oui >> 16 & 0xFF;
5588   p_oui[1] = oui >> 8 & 0xFF;
5589   p_oui[2] = oui & 0xFF;
5590
5591   /* Attempt an OUI lookup. */
5592   manuf_name = get_manuf_name_if_known(p_oui);
5593   if (manuf_name == NULL) {
5594       /* Could not find an OUI. */
5595       g_snprintf(result, ITEM_LABEL_LENGTH, "%.2x-%.2x-%.2x", p_oui[0], p_oui[1], p_oui[2] );
5596   }
5597   else {
5598       /* Found an address string. */
5599       g_snprintf(result, ITEM_LABEL_LENGTH, "%.2x-%.2x-%.2x (%s)", p_oui[0], p_oui[1], p_oui[2], manuf_name );
5600   }
5601 }
5602 static void
5603 rsn_gcs_base_custom(gchar *result, guint32 gcs)
5604 {
5605   gchar *oui_result=NULL;
5606   oui_result = ep_alloc(SHORT_STR);
5607   oui_result[0] = '\0';
5608   oui_base_custom(oui_result, gcs >> 8);
5609   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( gcs & 0xFF, ieee80211_rsn_cipher_vals, "Unknown %d") );
5610 }
5611
5612 static void
5613 rsn_pcs_base_custom(gchar *result, guint32 pcs)
5614 {
5615   gchar *oui_result=NULL;
5616   oui_result = ep_alloc(SHORT_STR);
5617   oui_result[0] = '\0';
5618   oui_base_custom(oui_result, pcs >> 8);
5619   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( pcs & 0xFF, ieee80211_rsn_cipher_vals, "Unknown %d") );
5620
5621 }
5622 static void
5623 rsn_akms_base_custom(gchar *result, guint32 akms)
5624 {
5625   gchar *oui_result=NULL;
5626   oui_result = ep_alloc(SHORT_STR);
5627   oui_result[0] = '\0';
5628   oui_base_custom(oui_result, akms >> 8);
5629   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( akms & 0xFF, ieee80211_rsn_keymgmt_vals, "Unknown %d") );
5630 }
5631
5632 static gchar *
5633 rsn_pcs_return(guint32 pcs)
5634 {
5635   gchar *result=NULL;
5636   result = ep_alloc(SHORT_STR);
5637   result[0] = '\0';
5638   rsn_pcs_base_custom(result, pcs);
5639
5640   return result;
5641 }
5642
5643 static gchar *
5644 rsn_akms_return(guint32 akms)
5645 {
5646   gchar *result=NULL;
5647   result = ep_alloc(SHORT_STR);
5648   result[0] = '\0';
5649   rsn_akms_base_custom(result, akms);
5650
5651   return result;
5652 }
5653
5654 static void
5655 rsn_gmcs_base_custom(gchar *result, guint32 gmcs)
5656 {
5657   gchar *oui_result=NULL;
5658   oui_result = ep_alloc(SHORT_STR);
5659   oui_result[0] = '\0';
5660   oui_base_custom(oui_result, gmcs >> 8);
5661   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( gmcs & 0xFF, ieee80211_rsn_cipher_vals, "Unknown %d") );
5662 }
5663
5664 /* WPA / WME */
5665 static const value_string ieee802111_wfa_ie_type_vals[] =
5666 {
5667   { 1, "WPA Information Element" },
5668   { 2, "WMM/WME" },
5669   { 4, "WPS" },
5670   { 0, NULL }
5671 };
5672
5673 static const value_string ieee80211_wfa_ie_wpa_cipher_vals[] =
5674 {
5675   { 0, "NONE" },
5676   { 1, "WEP (40-bit)" },
5677   { 2, "TKIP" },
5678   { 3, "AES (OCB)" },
5679   { 4, "AES (CCM)" },
5680   { 5, "WEP (104-bit)" },
5681   { 6, "BIP" },
5682   { 7, "Group addressed traffic not allowed" },
5683   { 0, NULL }
5684 };
5685
5686 static const value_string ieee80211_wfa_ie_wpa_keymgmt_vals[] =
5687 {
5688   { 0, "NONE" },
5689   { 1, "WPA" },
5690   { 2, "PSK" },
5691   { 3, "FT over IEEE 802.1X" },
5692   { 4, "FT using PSK" },
5693   { 5, "WPA (SHA256)" },
5694   { 6, "PSK (SHA256)" },
5695   { 7, "TDLS / TPK Handshake" },
5696   { 0, NULL }
5697 };
5698
5699 static const value_string ieee80211_wfa_ie_wme_acs_vals[] = {
5700   { 0, "Best Effort" },
5701   { 1, "Background" },
5702   { 2, "Video" },
5703   { 3, "Voice" },
5704   { 0, NULL }
5705 };
5706
5707 static const value_string ieee80211_wfa_ie_wme_tspec_tsinfo_direction_vals[] = {
5708   { 0, "Uplink" },
5709   { 1, "Downlink" },
5710   { 2, "Direct link" },
5711   { 3, "Bidirectional link" },
5712   { 0, NULL }
5713 };
5714
5715 static const value_string ieee80211_wfa_ie_wme_tspec_tsinfo_psb_vals[] = {
5716   { 0, "Legacy" },
5717   { 1, "U-APSD" },
5718   { 0, NULL }
5719 };
5720
5721 static const value_string ieee80211_wfa_ie_wme_tspec_tsinfo_up_vals[] = {
5722   { 0, "Best Effort" },
5723   { 1, "Background" },
5724   { 2, "Spare" },
5725   { 3, "Excellent Effort" },
5726   { 4, "Controlled Load" },
5727   { 5, "Video" },
5728   { 6, "Voice" },
5729   { 7, "Network Control" },
5730   { 0, NULL }
5731 };
5732
5733 static const value_string ieee802111_wfa_ie_wme_qos_info_sta_max_sp_length_vals[] = {
5734   { 0, "WMM AP may deliver all buffered frames (MSDUs and MMPDUs)" },
5735   { 1, "WMM AP may deliver a maximum of 2 buffered frames (MSDUs and MMPDUs) per USP" },
5736   { 2, "WMM AP may deliver a maximum of 4 buffered frames (MSDUs and MMPDUs) per USP" },
5737   { 3, "WMM AP may deliver a maximum of 6 buffered frames (MSDUs and MMPDUs) per USP" },
5738   { 0, NULL}
5739 };
5740 static const true_false_string ieee802111_wfa_ie_wme_qos_info_sta_ac_tfs = { "WMM delivery and trigger enabled", "non-WMM PS" };
5741
5742 static void
5743 wpa_mcs_base_custom(gchar *result, guint32 mcs)
5744 {
5745   gchar *oui_result=NULL;
5746   oui_result = ep_alloc(SHORT_STR);
5747   oui_result[0] = '\0';
5748   oui_base_custom(oui_result, mcs >> 8);
5749   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( mcs & 0xFF, ieee80211_wfa_ie_wpa_cipher_vals, "Unknown %d") );
5750 }
5751
5752 static void
5753 wpa_ucs_base_custom(gchar *result, guint32 ucs)
5754 {
5755   gchar *oui_result=NULL;
5756   oui_result = ep_alloc(SHORT_STR);
5757   oui_result[0] = '\0';
5758   oui_base_custom(oui_result, ucs >> 8);
5759   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( ucs & 0xFF, ieee80211_wfa_ie_wpa_cipher_vals, "Unknown %d") );
5760
5761 }
5762 static void
5763 wpa_akms_base_custom(gchar *result, guint32 akms)
5764 {
5765   gchar *oui_result=NULL;
5766   oui_result = ep_alloc(SHORT_STR);
5767   oui_result[0] = '\0';
5768   oui_base_custom(oui_result, akms >> 8);
5769   g_snprintf(result, ITEM_LABEL_LENGTH, "%s %s", oui_result, val_to_str( akms & 0xFF, ieee80211_wfa_ie_wpa_keymgmt_vals, "Unknown %d") );
5770 }
5771
5772 static gchar *
5773 wpa_ucs_return(guint32 ucs)
5774 {
5775   gchar *result=NULL;
5776   result = ep_alloc(SHORT_STR);
5777   result[0] = '\0';
5778   wpa_ucs_base_custom(result, ucs);
5779
5780   return result;
5781 }
5782
5783 static gchar *
5784 wpa_akms_return(guint32 akms)
5785 {
5786   gchar *result=NULL;
5787   result = ep_alloc(SHORT_STR);
5788   result[0] = '\0';
5789   wpa_akms_base_custom(result, akms);
5790
5791   return result;
5792 }
5793
5794 static const value_string ieee802111_wfa_ie_wme_type[] =
5795 {
5796   { 0, "Information Element" },
5797   { 1, "Parameter Element" },
5798   { 2, "TSPEC Element" },
5799   { 0, NULL}
5800 };
5801
5802 static const value_string ft_subelem_id_vals[] =
5803 {
5804   {0, "Reserved"},
5805   {1, "PMK-R1 key holder identifier (R1KH-ID)"},
5806   {2, "GTK subelement"},
5807   {3, "PMK-R0 key holder identifier (R0KH-ID)"},
5808   {4, "IGTK"},
5809   {0, NULL}
5810 };
5811
5812 static int dissect_qos_info(proto_tree * tree, tvbuff_t *tvb, int offset, int ftype)
5813 {
5814   proto_tree *qos_info_tree;
5815   proto_item *qos_info_item;
5816   qos_info_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_qos_info, tvb, offset, 1, ENC_NA);
5817   qos_info_tree = proto_item_add_subtree(qos_info_item, ett_wme_qos_info);
5818
5819   switch(ftype){
5820     case MGT_ASSOC_REQ:
5821     case MGT_PROBE_REQ:
5822     case MGT_REASSOC_REQ:
5823     {
5824       /* To AP so decode as per WMM standard Figure 7 QoS Info field when sent from WMM STA*/
5825       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_max_sp_length, tvb, offset, 1, ENC_NA);
5826       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_be, tvb, offset, 1, ENC_NA);
5827       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_bk, tvb, offset, 1, ENC_NA);
5828       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vi, tvb, offset, 1, ENC_NA);
5829       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vo, tvb, offset, 1, ENC_NA);
5830       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_sta_reserved, tvb, offset, 1, ENC_NA);
5831       break;
5832     }
5833     case MGT_BEACON:
5834     case MGT_PROBE_RESP:
5835     case MGT_ASSOC_RESP:
5836     case MGT_REASSOC_RESP:
5837     {
5838       /* From AP so decode as per WMM standard Figure 6 QoS Info field when sent from WMM AP */
5839       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_ap_u_apsd, tvb, offset, 1, ENC_NA);
5840       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_ap_parameter_set_count, tvb, offset, 1, ENC_NA);
5841       proto_tree_add_item(qos_info_tree, hf_ieee80211_wfa_ie_wme_qos_info_ap_reserved, tvb, offset, 1, ENC_NA);
5842       break;
5843     }
5844     default:
5845         expert_add_info_format(g_pinfo, qos_info_item, PI_UNDECODED, PI_WARN, "Could not deduce direction to decode correctly, ftype %u", ftype);
5846       break;
5847     }
5848
5849   offset += 1;
5850   return offset;
5851 }
5852
5853 static int
5854 dissect_vendor_ie_wpawme(proto_tree * tree, tvbuff_t * tvb, int offset, guint32 tag_len, int ftype)
5855 {
5856   guint8 type;
5857
5858   proto_tree_add_item(tree, hf_ieee80211_wfa_ie_type, tvb, offset, 1, ENC_NA);
5859   type = tvb_get_guint8(tvb, offset);
5860   proto_item_append_text(tree, ": %s", val_to_str(type, ieee802111_wfa_ie_type_vals, "Unknown %d" ));
5861   offset += 1;
5862
5863   switch(type){
5864     case 1:   /* Wi-Fi Protected Access (WPA) */
5865     {
5866       proto_item *wpa_mcs_item, *wpa_ucs_item, *wpa_akms_item;
5867       proto_item *wpa_sub_ucs_item, *wpa_sub_akms_item;
5868       proto_tree *wpa_mcs_tree, *wpa_ucs_tree, *wpa_akms_tree;
5869       proto_tree *wpa_sub_ucs_tree, *wpa_sub_akms_tree;
5870       guint16 ucs_count, akms_count;
5871       guint i;
5872
5873       proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_version, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5874       offset += 2;
5875
5876       /* Multicast Cipher Suite */
5877       wpa_mcs_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_mcs, tvb, offset, 4, ENC_BIG_ENDIAN);
5878       wpa_mcs_tree = proto_item_add_subtree(wpa_mcs_item, ett_wpa_mcs_tree);
5879       proto_tree_add_item(wpa_mcs_tree, hf_ieee80211_wfa_ie_wpa_mcs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
5880
5881       /* Check if OUI is 00:50:F2 (WFA) */
5882       if(tvb_get_ntoh24(tvb, offset) == 0x0050F2)
5883       {
5884         proto_tree_add_item(wpa_mcs_tree, hf_ieee80211_wfa_ie_wpa_mcs_wfa_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5885       } else {
5886         proto_tree_add_item(wpa_mcs_tree, hf_ieee80211_wfa_ie_wpa_mcs_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5887       }
5888       offset += 4;
5889
5890       /* Unicast Cipher Suites */
5891       proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_ucs_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5892       ucs_count = tvb_get_letohs(tvb, offset);
5893       offset += 2;
5894
5895       wpa_ucs_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_ucs_list, tvb, offset, ucs_count * 4, ENC_NA);
5896       wpa_ucs_tree = proto_item_add_subtree(wpa_ucs_item, ett_wpa_ucs_tree);
5897       for(i = 1; i <= ucs_count; i++)
5898       {
5899         wpa_sub_ucs_item = proto_tree_add_item(wpa_ucs_tree, hf_ieee80211_wfa_ie_wpa_ucs, tvb, offset, 4, ENC_BIG_ENDIAN);
5900         wpa_sub_ucs_tree = proto_item_add_subtree(wpa_sub_ucs_item, ett_wpa_sub_ucs_tree);
5901         proto_tree_add_item(wpa_sub_ucs_tree, hf_ieee80211_wfa_ie_wpa_ucs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
5902
5903         /* Check if OUI is 00:50:F2 (WFA) */
5904         if(tvb_get_ntoh24(tvb, offset) == 0x0050F2)
5905         {
5906           proto_tree_add_item(wpa_sub_ucs_tree, hf_ieee80211_wfa_ie_wpa_ucs_wfa_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5907           proto_item_append_text(wpa_ucs_item, " %s", wpa_ucs_return(tvb_get_ntohl(tvb, offset)));
5908         } else {
5909           proto_tree_add_item(wpa_sub_ucs_tree, hf_ieee80211_wfa_ie_wpa_ucs_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5910         }
5911         offset += 4;
5912       }
5913
5914       /* Authenticated Key Management Suites */
5915       proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_akms_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5916       akms_count = tvb_get_letohs(tvb, offset);
5917       offset += 2;
5918
5919       wpa_akms_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wpa_akms_list, tvb, offset, akms_count * 4, ENC_NA);
5920       wpa_akms_tree = proto_item_add_subtree(wpa_akms_item, ett_wpa_akms_tree);
5921       for(i = 1; i <= akms_count; i++)
5922       {
5923         wpa_sub_akms_item = proto_tree_add_item(wpa_akms_tree, hf_ieee80211_wfa_ie_wpa_akms, tvb, offset, 4, ENC_BIG_ENDIAN);
5924         wpa_sub_akms_tree = proto_item_add_subtree(wpa_sub_akms_item, ett_wpa_sub_akms_tree);
5925         proto_tree_add_item(wpa_sub_akms_tree, hf_ieee80211_wfa_ie_wpa_akms_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
5926
5927         /* Check if OUI is 00:50:F2 (WFA) */
5928         if(tvb_get_ntoh24(tvb, offset) == 0x0050F2)
5929         {
5930           proto_tree_add_item(wpa_sub_akms_tree, hf_ieee80211_wfa_ie_wpa_akms_wfa_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5931           proto_item_append_text(wpa_akms_item, " %s", wpa_akms_return(tvb_get_ntohl(tvb, offset)));
5932         } else {
5933           proto_tree_add_item(wpa_sub_akms_tree, hf_ieee80211_wfa_ie_wpa_akms_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
5934         }
5935         offset += 4;
5936       }
5937       break;
5938     }
5939     case 2:   /* Wireless Multimedia Enhancements (WME) */
5940     {
5941       guint8 subtype;
5942
5943       proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_subtype, tvb, offset, 1, ENC_NA);
5944       subtype = tvb_get_guint8(tvb, offset);
5945       proto_item_append_text(tree, ": %s", val_to_str(subtype, ieee802111_wfa_ie_wme_type, "Unknown %d" ));
5946       offset += 1;
5947       switch(subtype){
5948         case 0: /* WME Information Element */
5949         {
5950           proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_version, tvb, offset, 1, ENC_NA);
5951           offset += 1;
5952           /* WME QoS Info Field */
5953           offset = dissect_qos_info(tree, tvb, offset, ftype);
5954           break;
5955         }
5956         case 1: /* WME Parameter Element */
5957         {
5958           int i;
5959           proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_version, tvb, offset, 1, ENC_NA);
5960           offset += 1;
5961           /* WME QoS Info Field */
5962           offset = dissect_qos_info(tree, tvb, offset, ftype);
5963           proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_reserved, tvb, offset, 1, ENC_NA);
5964           offset += 1;
5965           /* AC Parameters */
5966           for(i = 0; i < 4; i++)
5967           {
5968             proto_item *ac_item, *aci_aifsn_item, *ecw_item;
5969             proto_tree *ac_tree, *aci_aifsn_tree, *ecw_tree;
5970             guint8 aci_aifsn, ecw;
5971
5972             ac_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_ac_parameters, tvb, offset, 4, ENC_NA);
5973             ac_tree = proto_item_add_subtree(ac_item, ett_wme_ac);
5974
5975             /* ACI/AIFSN Field */
5976             aci_aifsn_item = proto_tree_add_item(ac_tree, hf_ieee80211_wfa_ie_wme_acp_aci_aifsn, tvb, offset, 1, ENC_NA);
5977             aci_aifsn_tree = proto_item_add_subtree(aci_aifsn_item, ett_wme_aci_aifsn);
5978             proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_aci, tvb, offset, 1, ENC_NA);
5979             proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_acm, tvb, offset, 1, ENC_NA);
5980             proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_aifsn, tvb, offset, 1, ENC_NA);
5981             proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_reserved, tvb, offset, 1, ENC_NA);
5982             aci_aifsn = tvb_get_guint8(tvb, offset);
5983             proto_item_append_text(ac_item, " ACI %u (%s), ACM %s, AIFSN %u",
5984             (aci_aifsn & 0x60) >> 5, match_strval((aci_aifsn & 0x60) >> 5, ieee80211_wfa_ie_wme_acs_vals),
5985             (aci_aifsn & 0x10) ? "yes" : "no ", aci_aifsn & 0x0f);
5986             offset += 1;
5987
5988             /* ECWmin/ECWmax field */
5989             ecw_item = proto_tree_add_item(ac_tree, hf_ieee80211_wfa_ie_wme_acp_ecw, tvb, offset, 1, ENC_NA);
5990             ecw_tree = proto_item_add_subtree(ecw_item, ett_wme_ecw);
5991             proto_tree_add_item(ecw_tree, hf_ieee80211_wfa_ie_wme_acp_ecw_max, tvb, offset, 1, ENC_NA);
5992             proto_tree_add_item(ecw_tree, hf_ieee80211_wfa_ie_wme_acp_ecw_min, tvb, offset, 1, ENC_NA);
5993             ecw = tvb_get_guint8(tvb, offset);
5994             proto_item_append_text(ac_item, ", ECWmin %u ,ECWmax %u", ecw & 0x0f, (ecw & 0xf0) >> 4 );
5995             offset += 1;
5996
5997             /* TXOP Limit */
5998             proto_tree_add_item(ac_tree, hf_ieee80211_wfa_ie_wme_acp_txop_limit, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5999             proto_item_append_text(ac_item, ", TXOP %u", tvb_get_letohs(tvb, offset));
6000             offset += 2;
6001           }
6002           break;
6003         }
6004         case 3:   /* WME TSPEC Element */
6005         {
6006
6007             proto_item *tsinfo_item;
6008             proto_tree *tsinfo_tree;
6009
6010             tsinfo_item = proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6011             tsinfo_tree = proto_item_add_subtree(tsinfo_item, ett_tsinfo_tree);
6012
6013             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_tid, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6014             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_direction, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6015             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_psb, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6016             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_up, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6017             proto_tree_add_item(tsinfo_tree, hf_ieee80211_wfa_ie_wme_tspec_tsinfo_reserved, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6018             offset += 3;
6019
6020             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_nor_msdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6021             offset += 2;
6022
6023             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_max_msdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6024             offset += 2;
6025
6026             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_min_srv, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6027             offset += 4;
6028
6029             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_max_srv, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6030             offset += 4;
6031
6032             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_inact_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6033             offset += 4;
6034
6035             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_susp_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6036             offset += 4;
6037
6038             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_srv_start, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6039             offset += 4;
6040
6041             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_min_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6042             offset += 4;
6043
6044             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_mean_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6045             offset += 4;
6046
6047             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_peak_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6048             offset += 4;
6049
6050             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_burst_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6051             offset += 4;
6052
6053             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_delay_bound, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6054             offset += 4;
6055
6056             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_min_phy, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6057             offset += 4;
6058
6059             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_surplus, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6060             offset += 2;
6061
6062             proto_tree_add_item(tree, hf_ieee80211_wfa_ie_wme_tspec_medium, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6063             offset += 2;
6064
6065           break;
6066         }
6067         default:
6068           /* No default Action */
6069         break;
6070       } /* End switch(subtype) */
6071       break;
6072     }
6073     case 4: /* WPS: Wifi Protected Setup */
6074     {
6075       dissect_wps_tlvs(tree, tvb, offset, tag_len-4, NULL);
6076     }
6077     break;
6078     default:
6079       /* No default Action...*/
6080     break;
6081   } /* End switch(type) */
6082
6083   return offset;
6084 }
6085
6086 static void
6087 dissect_vendor_ie_wfa(packet_info *pinfo, proto_item *item, tvbuff_t *tag_tvb)
6088 {
6089   gint tag_len = tvb_length(tag_tvb);
6090
6091   if (tag_len < 4)
6092     return;
6093
6094   switch (tvb_get_guint8(tag_tvb, 3)) {
6095   case WFA_SUBTYPE_P2P:
6096     dissect_wifi_p2p_ie(pinfo, item, tag_tvb, 4, tag_len - 4);
6097     proto_item_append_text(item, ": P2P");
6098     break;
6099   }
6100 }
6101
6102 static void
6103 dissect_vendor_ie_rsn(proto_item * item, proto_tree * tree, tvbuff_t * tag_tvb)
6104 {
6105   guint tag_off = 0;
6106   guint tag_len = tvb_length(tag_tvb);
6107   guint pmkid_len = tag_len - 4;
6108   char out_buff[SHORT_STR], valid_str[SHORT_STR] = "";
6109
6110   if (tag_len >= 4 && !tvb_memeql(tag_tvb, tag_off, RSN_OUI"\x04", 4)) {
6111     /* IEEE 802.11i / Key Data Encapsulation / Data Type=4 - PMKID.
6112      * This is only used within EAPOL-Key frame Key Data. */
6113     if (pmkid_len != PMKID_LEN) {
6114       g_snprintf(valid_str, SHORT_STR,
6115         "(invalid PMKID len=%d, expected 16) ", pmkid_len);
6116     }
6117     g_snprintf(out_buff, SHORT_STR, "RSN PMKID: %s%s", valid_str,
6118       tvb_bytes_to_str(tag_tvb, 4, pmkid_len));
6119     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tag_tvb, 0,
6120       tag_len, out_buff);
6121   }
6122   proto_item_append_text(item, ": RSN");
6123 }
6124
6125 typedef enum {
6126   MARVELL_IE_MESH = 4
6127 } marvell_ie_type_t;
6128
6129 static void
6130 dissect_vendor_ie_marvell(proto_item * item _U_, proto_tree * ietree,
6131                           tvbuff_t * tvb, int offset, guint32 tag_len)
6132 {
6133   guint8 type;
6134
6135   type = tvb_get_guint8(tvb, offset);
6136   proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6137   offset += 1;
6138
6139   switch (type) {
6140   case MARVELL_IE_MESH:
6141     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_subtype, tvb,
6142                          offset++, 1, ENC_LITTLE_ENDIAN );
6143     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_version, tvb,
6144                          offset++, 1, ENC_LITTLE_ENDIAN );
6145     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_active_proto_id, tvb,
6146                          offset++, 1, ENC_LITTLE_ENDIAN );
6147     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_active_metric_id, tvb,
6148                          offset++, 1, ENC_LITTLE_ENDIAN );
6149     proto_tree_add_item (ietree, hf_ieee80211_marvell_ie_mesh_cap, tvb,
6150                          offset++, 1, ENC_LITTLE_ENDIAN );
6151     break;
6152
6153   default:
6154     proto_tree_add_item(ietree, hf_ieee80211_marvell_ie_data, tvb, offset,
6155       tag_len - 1, ENC_NA);
6156     break;
6157   }
6158 }
6159
6160 typedef enum {
6161   ATHEROS_IE_ADVCAP = 1,
6162   ATHEROS_IE_XR = 3
6163 } atheros_ie_type_t;
6164
6165 typedef enum {
6166   ATHEROS_IE_ADVCAP_S = 1
6167 } atheros_ie_advcap_subtype_t;
6168
6169 typedef enum {
6170   ATHEROS_IE_XR_S = 1
6171 } atheros_ie_xr_subtype_t;
6172
6173 typedef enum {
6174   ATHEROS_IE_CAP_TURBOP = 0x01,
6175   ATHEROS_IE_CAP_COMP = 0x02,
6176   ATHEROS_IE_CAP_FF = 0x04,
6177   ATHEROS_IE_CAP_XR = 0x08,
6178   ATHEROS_IE_CAP_AR = 0x10,
6179   ATHEROS_IE_CAP_BURST = 0x20,
6180   ATHEROS_IE_CAP_WME = 0x40,
6181   ATHEROS_IE_CAP_BOOST = 0x80
6182 } atheros_ie_cap_t;
6183
6184 static const value_string atheros_ie_type_vals[] = {
6185   { ATHEROS_IE_ADVCAP, "Advanced Capability"},
6186   { ATHEROS_IE_XR,     "eXtended Range"},
6187   { 0,                 NULL }
6188 };
6189
6190 static void
6191 dissect_vendor_ie_atheros_cap(proto_item * item _U_, tvbuff_t *tvb, int offset)
6192 {
6193   proto_tree *cap_tree;
6194
6195   cap_tree = proto_item_add_subtree(item, ett_ath_cap_tree);
6196
6197   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_turbop, tvb, offset, 1, ENC_NA);
6198   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_comp, tvb, offset, 1, ENC_NA);
6199   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_ff, tvb, offset, 1, ENC_NA);
6200   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_xr, tvb, offset, 1, ENC_NA);
6201   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_ar, tvb, offset, 1, ENC_NA);
6202   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_burst, tvb, offset, 1, ENC_NA);
6203   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_wme, tvb, offset, 1, ENC_NA);
6204   proto_tree_add_item(cap_tree, hf_ieee80211_atheros_ie_cap_f_boost, tvb, offset, 1, ENC_NA);
6205
6206 }
6207
6208 static void
6209 dissect_vendor_ie_atheros(proto_item * item _U_, proto_tree * ietree,
6210                           tvbuff_t * tvb, int offset, guint tag_len,
6211                           packet_info * pinfo, proto_item *ti_len)
6212 {
6213   guint8 type;
6214   guint8 subtype;
6215   guint8 version;
6216   proto_item *cap_item;
6217   proto_item *ti;
6218
6219   if (tag_len <= 3) {
6220         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 6", tag_len+3); /* Add length of OUI to tag_length */
6221         return;
6222   }
6223   proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_type, tvb, offset, 1, ENC_NA);
6224   type = tvb_get_guint8(tvb, offset);
6225   proto_item_append_text(item, ": %s", val_to_str_const(type, atheros_ie_type_vals, "Unknown"));
6226   offset += 1;
6227   tag_len -= 1;
6228
6229   proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_subtype, tvb, offset, 1, ENC_NA);
6230   subtype = tvb_get_guint8(tvb, offset);
6231   offset += 1;
6232   tag_len -= 1;
6233
6234   proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_version, tvb, offset, 1, ENC_NA);
6235   version = tvb_get_guint8(tvb, offset);
6236   offset += 1;
6237   tag_len -= 1;
6238
6239   if(version == 0)
6240   {
6241     switch(type){
6242       case ATHEROS_IE_ADVCAP:
6243       {
6244         switch(subtype){
6245           case ATHEROS_IE_ADVCAP_S:
6246           {
6247             cap_item = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_advcap_cap, tvb, offset, 1, ENC_NA);
6248             dissect_vendor_ie_atheros_cap(cap_item, tvb, offset);
6249             offset += 1;
6250             tag_len -= 1;
6251
6252             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_advcap_defkey, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6253             offset += 2;
6254             tag_len -= 2;
6255             break;
6256           }
6257           default:
6258           /* No default Action */
6259           break;
6260         } /* End switch(subtype) */
6261         break;
6262       }
6263       case ATHEROS_IE_XR:
6264       {
6265         switch(subtype){
6266           case ATHEROS_IE_XR_S:
6267           {
6268             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_info, tvb, offset, 1, ENC_NA);
6269             offset += 1;
6270             tag_len -= 1;
6271
6272             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_base_bssid, tvb, offset, 6, ENC_NA);
6273             offset += 6;
6274             tag_len -= 6;
6275
6276             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_xr_bssid, tvb, offset, 6, ENC_NA);
6277             offset += 6;
6278             tag_len -= 6;
6279
6280             proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_xr_beacon, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6281             offset += 2;
6282             tag_len -= 2;
6283
6284             cap_item = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_base_cap, tvb, offset, 1, ENC_NA);
6285             dissect_vendor_ie_atheros_cap(cap_item, tvb, offset);
6286             offset += 1;
6287             tag_len -= 1;
6288
6289             cap_item = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_xr_xr_cap, tvb, offset, 1, ENC_NA);
6290             dissect_vendor_ie_atheros_cap(cap_item, tvb, offset);
6291             offset += 1;
6292             tag_len -= 1;
6293             break;
6294           }
6295           default:
6296           /* No default Action */
6297           break;
6298         } /* End switch(subtype) */
6299         break;
6300         default:
6301         /* No default Action */
6302         break;
6303       } /* End switch(type) */
6304
6305     }
6306   }
6307   if(tag_len > 0 ){
6308    ti = proto_tree_add_item(ietree, hf_ieee80211_atheros_ie_data, tvb, offset, tag_len, ENC_NA);
6309    expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown Data (not interpreted)");
6310   }
6311 }
6312
6313 typedef enum {
6314   AIRONET_IE_VERSION = 3,
6315   AIRONET_IE_QOS,
6316   AIRONET_IE_QBSS_V2 = 14
6317 } aironet_ie_type_t;
6318
6319 static const value_string aironet_ie_type_vals[] = {
6320   { AIRONET_IE_VERSION,   "CCX version"},
6321   { AIRONET_IE_QOS,       "Qos"},
6322   { AIRONET_IE_QBSS_V2,   "QBSS V2 - CCA"},
6323   { 0,                    NULL }
6324 };
6325
6326 static void
6327 dissect_vendor_ie_aironet(proto_item * aironet_item, proto_tree * ietree,
6328   tvbuff_t * tvb, int offset, guint32 tag_len)
6329 {
6330   guint8  type;
6331   int i;
6332   gboolean dont_change = FALSE; /* Don't change the IE item text to default */
6333
6334   type = tvb_get_guint8(tvb, offset);
6335   proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6336   offset += 1;
6337
6338   switch (type) {
6339   case AIRONET_IE_VERSION:
6340     proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_version, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6341     proto_item_append_text(aironet_item, ": Aironet CCX version = %d",
6342     tvb_get_guint8(tvb, offset));
6343     dont_change = TRUE;
6344     break;
6345   case AIRONET_IE_QOS:
6346     proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_qos_unk1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6347     offset += 1;
6348     proto_tree_add_item (ietree, hf_ieee80211_aironet_ie_qos_paramset, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6349     offset += 1;
6350
6351     /* XXX: just copied over from WME. Maybe "Best Effort" and "Background"
6352      *  need to be swapped. Also, the "TXOP" may be TXOP - or not.
6353      */
6354     for (i = 0; i < 4; i++) {
6355       guint8 byte1, byte2;
6356       guint16 txop;
6357       byte1 = tvb_get_guint8(tvb, offset);
6358       byte2 = tvb_get_guint8(tvb, offset + 1);
6359       txop = tvb_get_letohs(tvb, offset + 2);
6360       proto_tree_add_bytes_format(ietree, hf_ieee80211_aironet_ie_qos_val, tvb, offset, 4, NULL,
6361           "CCX QoS Parameters??: ACI %u (%s), Admission Control %sMandatory, AIFSN %u, ECWmin %u, ECWmax %u, TXOP %u",
6362         (byte1 & 0x60) >> 5, val_to_str((byte1 & 0x60) >> 5, wme_acs, "(Unknown: %d)"),
6363         (byte1 & 0x10) ? "" : "not ", byte1 & 0x0f,
6364         byte2 & 0x0f, (byte2 & 0xf0) >> 4,
6365         txop);
6366       offset += 4;
6367     }
6368     break;
6369   case AIRONET_IE_QBSS_V2:
6370     /* Extract Values */
6371     proto_tree_add_item (ietree, hf_ieee80211_qbss2_scount, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6372     proto_tree_add_item (ietree, hf_ieee80211_qbss2_cu, tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6373     proto_tree_add_item (ietree, hf_ieee80211_qbss2_cal, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6374     proto_tree_add_item (ietree, hf_ieee80211_qbss2_gl, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6375     break;
6376   default:
6377     proto_tree_add_item(ietree, hf_ieee80211_aironet_ie_data, tvb, offset,
6378       tag_len - 1, ENC_NA);
6379     break;
6380   }
6381   if (!dont_change) {
6382     proto_item_append_text(aironet_item, ": Aironet %s",
6383       val_to_str_const(type, aironet_ie_type_vals, "Unknown"));
6384   }
6385 }
6386
6387 /* 802.11e 7.3.2.33 QoS Capability element */
6388 static int dissect_qos_capability(proto_tree * tree, tvbuff_t * tvb, int offset, int ftype)
6389 {
6390   proto_item *cap_info_item;
6391   proto_tree *cap_info_tree;
6392
6393   cap_info_item = proto_tree_add_item(tree, hf_ieee80211_tag_qos_cap_qos_info, tvb, offset, 1, ENC_NA);
6394   cap_info_tree = proto_item_add_subtree(cap_info_item, ett_qos_info_field_tree);
6395   switch(ftype){
6396     case MGT_ASSOC_REQ:
6397     case MGT_PROBE_REQ:
6398     case MGT_REASSOC_REQ:
6399     {
6400       /* To AP so decode as STA: Figure 33h-QoS Info field when set by a non-AP QSTA */
6401       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_vo_uapsd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6402       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_vi_uapsd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6403       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_bk_uapsd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6404       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_be_uapsd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6405       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_qack, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6406       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_max_sp_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6407       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_more_data_ack, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6408       break;
6409     }
6410     case MGT_BEACON:
6411     case MGT_PROBE_RESP:
6412     case MGT_ASSOC_RESP:
6413     case MGT_REASSOC_RESP:
6414     {
6415       /* From AP so decode as AP: Figure 33g-QoS Info field when sent by a QAP */
6416       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_edca_upd_cnt, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6417       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_qack, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6418       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_queue_req, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6419       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_txop_req, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6420       proto_tree_add_item(cap_info_tree, hf_ieee80211_qos_info_field_reserved, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6421       break;
6422     }
6423     default:
6424         expert_add_info_format(g_pinfo, cap_info_item, PI_UNDECODED, PI_WARN, "Could not deduce direction to decode correctly, ftype %u", ftype);
6425       break;
6426   }
6427
6428   return offset + 1;
6429 }
6430
6431 /* 7.3.2.25 RSN information element */
6432 static int
6433 dissect_rsn_ie(packet_info * pinfo, proto_tree * tree, tvbuff_t * tvb,
6434     int offset, guint32 tag_len)
6435 {
6436   proto_item *rsn_gcs_item, *rsn_pcs_item, *rsn_akms_item, *rsn_cap_item, *rsn_pmkid_item, *rsn_gmcs_item;
6437   proto_item *rsn_sub_pcs_item, *rsn_sub_akms_item;
6438   proto_item *rsn_pcs_count, *rsn_akms_count, *rsn_pmkid_count;
6439   proto_tree *rsn_gcs_tree, *rsn_pcs_tree, *rsn_akms_tree, *rsn_cap_tree, *rsn_pmkid_tree, *rsn_gmcs_tree;
6440   proto_tree *rsn_sub_pcs_tree, *rsn_sub_akms_tree;
6441   guint16 pcs_count, akms_count, pmkid_count;
6442   guint i;
6443   int tag_end = offset + tag_len;
6444
6445   proto_tree_add_item(tree, hf_ieee80211_rsn_version, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6446   offset += 2;
6447
6448   /* 7.3.2.25.1 Group Cipher suites */
6449   rsn_gcs_item = proto_tree_add_item(tree, hf_ieee80211_rsn_gcs, tvb, offset, 4, ENC_BIG_ENDIAN);
6450   rsn_gcs_tree = proto_item_add_subtree(rsn_gcs_item, ett_rsn_gcs_tree);
6451   proto_tree_add_item(rsn_gcs_tree, hf_ieee80211_rsn_gcs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
6452
6453     /* Check if OUI is 00:0F:AC (ieee80211) */
6454   if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
6455   {
6456     proto_tree_add_item(rsn_gcs_tree, hf_ieee80211_rsn_gcs_80211_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6457   } else {
6458     proto_tree_add_item(rsn_gcs_tree, hf_ieee80211_rsn_gcs_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6459   }
6460   offset += 4;
6461
6462   /* 7.3.2.25.2 Pairwise Cipher suites */
6463   rsn_pcs_count = proto_tree_add_item(tree, hf_ieee80211_rsn_pcs_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6464   pcs_count = tvb_get_letohs(tvb, offset);
6465   offset += 2;
6466
6467   if (offset + (pcs_count * 4) > tag_end)
6468   {
6469     expert_add_info_format(pinfo, rsn_pcs_count, PI_MALFORMED, PI_ERROR,
6470         "Pairwise Cipher Suite Count too large, 4*%u > %d", pcs_count, tag_end - offset);
6471     pcs_count = (tag_end - offset) / 4;
6472   }
6473
6474   rsn_pcs_item = proto_tree_add_item(tree, hf_ieee80211_rsn_pcs_list, tvb, offset, pcs_count * 4, ENC_NA);
6475   rsn_pcs_tree = proto_item_add_subtree(rsn_pcs_item, ett_rsn_pcs_tree);
6476   for(i = 1; i <= pcs_count; i++)
6477   {
6478     rsn_sub_pcs_item = proto_tree_add_item(rsn_pcs_tree, hf_ieee80211_rsn_pcs, tvb, offset, 4, ENC_BIG_ENDIAN);
6479     rsn_sub_pcs_tree = proto_item_add_subtree(rsn_sub_pcs_item, ett_rsn_sub_pcs_tree);
6480     proto_tree_add_item(rsn_sub_pcs_tree, hf_ieee80211_rsn_pcs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
6481
6482     /* Check if OUI is 00:0F:AC (ieee80211) */
6483     if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
6484     {
6485       proto_tree_add_item(rsn_sub_pcs_tree, hf_ieee80211_rsn_pcs_80211_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
6486       proto_item_append_text(rsn_pcs_item, " %s", rsn_pcs_return(tvb_get_ntohl(tvb, offset)));
6487     } else {
6488       proto_tree_add_item(rsn_sub_pcs_tree, hf_ieee80211_rsn_pcs_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
6489     }
6490     offset += 4;
6491   }
6492
6493   if(offset >= tag_end)
6494   {
6495     return offset;
6496   }
6497
6498   /* 7.3.2.25.2 AKM suites */
6499   rsn_akms_count = proto_tree_add_item(tree, hf_ieee80211_rsn_akms_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6500   akms_count = tvb_get_letohs(tvb, offset);
6501   offset += 2;
6502
6503   if (offset + (akms_count * 4) > tag_end)
6504   {
6505     expert_add_info_format(pinfo, rsn_akms_count, PI_MALFORMED, PI_ERROR,
6506         "Auth Key Management (AKM) Suite Count too large, 4*%u > %d", akms_count, tag_end - offset);
6507     akms_count = (tag_end - offset) / 4;
6508   }
6509
6510   rsn_akms_item = proto_tree_add_item(tree, hf_ieee80211_rsn_akms_list, tvb, offset, akms_count * 4, ENC_NA);
6511   rsn_akms_tree = proto_item_add_subtree(rsn_akms_item, ett_rsn_akms_tree);
6512   for(i = 1; i <= akms_count; i++)
6513   {
6514     rsn_sub_akms_item = proto_tree_add_item(rsn_akms_tree, hf_ieee80211_rsn_akms, tvb, offset, 4, ENC_BIG_ENDIAN);
6515     rsn_sub_akms_tree = proto_item_add_subtree(rsn_sub_akms_item, ett_rsn_sub_akms_tree);
6516     proto_tree_add_item(rsn_sub_akms_tree, hf_ieee80211_rsn_akms_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
6517
6518     /* Check if OUI is 00:0F:AC (ieee80211) */
6519     if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
6520     {
6521       proto_tree_add_item(rsn_sub_akms_tree, hf_ieee80211_rsn_akms_80211_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
6522       proto_item_append_text(rsn_akms_item, " %s", rsn_akms_return(tvb_get_ntohl(tvb, offset)));
6523     } else {
6524       proto_tree_add_item(rsn_sub_akms_tree, hf_ieee80211_rsn_akms_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
6525     }
6526     offset += 4;
6527   }
6528
6529   /* 7.3.2.25.3 RSN capabilities */
6530   rsn_cap_item = proto_tree_add_item(tree, hf_ieee80211_rsn_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6531   rsn_cap_tree = proto_item_add_subtree(rsn_cap_item, ett_rsn_cap_tree);
6532
6533   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_preauth, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6534   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_no_pairwise, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6535   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_ptksa_replay_counter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6536   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_gtksa_replay_counter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6537   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_mfpr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6538   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_mfpc, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6539   proto_tree_add_item(rsn_cap_tree, hf_ieee80211_rsn_cap_peerkey, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6540   offset += 2;
6541   if(offset >= tag_end)
6542   {
6543     return offset;
6544   }
6545   /* 7.3.2.25.4 PMKID */
6546   rsn_pmkid_count = proto_tree_add_item(tree, hf_ieee80211_rsn_pmkid_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6547   pmkid_count = tvb_get_letohs(tvb, offset);
6548   offset += 2;
6549
6550   if (offset + (pmkid_count * 16) > tag_end)
6551   {
6552     expert_add_info_format(pinfo, rsn_pmkid_count, PI_MALFORMED, PI_ERROR,
6553         "PMKID Count too large, 16*%u > %d", pmkid_count, tag_end - offset);
6554     pmkid_count = (tag_end - offset) / 16;
6555   }
6556
6557   rsn_pmkid_item = proto_tree_add_item(tree, hf_ieee80211_rsn_pmkid_list, tvb, offset, pmkid_count * 16, ENC_NA);
6558   rsn_pmkid_tree = proto_item_add_subtree(rsn_pmkid_item, ett_rsn_pmkid_tree);
6559   for(i = 1; i <= pmkid_count; i++)
6560   {
6561     proto_tree_add_item(rsn_pmkid_tree, hf_ieee80211_rsn_pmkid, tvb, offset, 16, ENC_NA);
6562     offset +=16;
6563   }
6564
6565   if(offset >= tag_end)
6566   {
6567     return offset;
6568   }
6569   /* Group Management Cipher Suite (802.11w)*/
6570   rsn_gmcs_item = proto_tree_add_item(tree, hf_ieee80211_rsn_gmcs, tvb, offset, 4, ENC_BIG_ENDIAN);
6571   rsn_gmcs_tree = proto_item_add_subtree(rsn_gmcs_item, ett_rsn_gmcs_tree);
6572   proto_tree_add_item(rsn_gmcs_tree, hf_ieee80211_rsn_gmcs_oui, tvb, offset, 3, ENC_BIG_ENDIAN);
6573   /* Check if OUI is 00:0F:AC (ieee80211) */
6574   if(tvb_get_ntoh24(tvb, offset) == 0x000FAC)
6575   {
6576     proto_tree_add_item(rsn_gmcs_tree, hf_ieee80211_rsn_gmcs_80211_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6577   } else {
6578     proto_tree_add_item(rsn_gmcs_tree, hf_ieee80211_rsn_gmcs_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6579   }
6580   offset += 4;
6581
6582   return offset;
6583 }
6584
6585 static void
6586 dissect_mobility_domain(proto_tree *tree, tvbuff_t *tvb, int offset,
6587                         guint32 tag_len)
6588 {
6589   if (tag_len < 3) {
6590     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6591                           "MDIE content length must be at least 3 bytes");
6592     return;
6593   }
6594
6595   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_mdid,
6596                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6597   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_ft_capab,
6598                       tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6599   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_ft_capab_ft_over_ds,
6600                       tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6601   proto_tree_add_item(tree, hf_ieee80211_tag_mobility_domain_ft_capab_resource_req,
6602                       tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6603 }
6604
6605 static void
6606 dissect_fast_bss_transition(proto_tree *tree, tvbuff_t *tvb, int offset,
6607                             guint32 tag_len)
6608 {
6609   int end = offset + tag_len;
6610   if (tag_len < 82) {
6611     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6612                           "FTIE content length must be at least 82 bytes");
6613     return;
6614   }
6615
6616   proto_tree_add_item(tree, hf_ieee80211_tag_ft_mic_control,
6617                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6618   proto_tree_add_item(tree, hf_ieee80211_tag_ft_element_count,
6619                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6620   offset += 2;
6621   proto_tree_add_item(tree, hf_ieee80211_tag_ft_mic,
6622                       tvb, offset, 16, ENC_NA);
6623   offset += 16;
6624   proto_tree_add_item(tree, hf_ieee80211_tag_ft_anonce,
6625                       tvb, offset, 32, ENC_NA);
6626   offset += 32;
6627   proto_tree_add_item(tree, hf_ieee80211_tag_ft_snonce,
6628                       tvb, offset, 32, ENC_NA);
6629   offset += 32;
6630
6631   while (offset + 2 <= end) {
6632     guint8 id, len;
6633     int s_end;
6634     proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_id,
6635                         tvb, offset, 1, ENC_BIG_ENDIAN);
6636     id = tvb_get_guint8(tvb, offset);
6637     offset++;
6638
6639     proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_len,
6640                         tvb, offset, 1, ENC_BIG_ENDIAN);
6641     len = tvb_get_guint8(tvb, offset);
6642     offset++;
6643
6644     if (offset + len > end) {
6645       proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset,
6646                             end - offset, "Invalid FTIE subelement");
6647       return;
6648     }
6649
6650     s_end = offset + len;
6651     switch (id) {
6652     case 1:
6653       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_r1kh_id,
6654                           tvb, offset, len, ENC_NA);
6655       break;
6656     case 2:
6657       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key_info,
6658                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
6659       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key_id,
6660                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
6661       offset += 2;
6662       if (offset > s_end)
6663         break;
6664       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key_length,
6665                           tvb, offset, 1, ENC_BIG_ENDIAN);
6666       offset++;
6667       if (offset > s_end)
6668         break;
6669       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_rsc,
6670                           tvb, offset, 8, ENC_NA);
6671       offset += 8;
6672       if (offset > s_end)
6673         break;
6674       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_gtk_key,
6675                           tvb, offset, s_end - offset, ENC_NA);
6676       break;
6677     case 3:
6678       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_r0kh_id,
6679                           tvb, offset, len, ENC_ASCII|ENC_NA);
6680       break;
6681     case 4:
6682       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_key_id,
6683                           tvb, offset, 2, ENC_LITTLE_ENDIAN);
6684       offset += 2;
6685       if (offset > s_end)
6686         break;
6687       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_ipn,
6688                           tvb, offset, 6, ENC_NA);
6689       offset += 6;
6690       if (offset > s_end)
6691         break;
6692       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_key_length,
6693                           tvb, offset, 1, ENC_BIG_ENDIAN);
6694       offset++;
6695       if (offset > s_end)
6696         break;
6697       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_igtk_key,
6698                           tvb, offset, 24, ENC_NA);
6699       break;
6700     default:
6701       proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_data,
6702                           tvb, offset, len, ENC_NA);
6703       break;
6704     }
6705     offset = s_end;
6706   }
6707 }
6708
6709 static void
6710 dissect_mmie(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 tag_len)
6711 {
6712   if (tag_len < 16) {
6713     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6714                           "MMIE content length must be at least 16 bytes");
6715     return;
6716   }
6717
6718   proto_tree_add_item(tree, hf_ieee80211_tag_mmie_keyid, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6719   proto_tree_add_item(tree, hf_ieee80211_tag_mmie_ipn, tvb, offset + 2, 6,
6720                       ENC_NA);
6721   proto_tree_add_item(tree, hf_ieee80211_tag_mmie_mic, tvb, offset + 8, 8,
6722                       ENC_NA);
6723 }
6724
6725 static void
6726 dissect_link_identifier(proto_tree *tree, tvbuff_t *tvb, int offset,
6727                         guint32 tag_len)
6728 {
6729   if (tag_len < 18) {
6730     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6731                           "Link Identifier content length must be at least "
6732                           "18 bytes");
6733     return;
6734   }
6735
6736   proto_tree_add_item(tree, hf_ieee80211_tag_link_id_bssid, tvb,
6737                       offset, 6, ENC_NA);
6738   proto_tree_add_item(tree, hf_ieee80211_tag_link_id_init_sta, tvb,
6739                       offset + 6, 6, ENC_NA);
6740   proto_tree_add_item(tree, hf_ieee80211_tag_link_id_resp_sta, tvb,
6741                       offset + 12, 6, ENC_NA);
6742 }
6743
6744 static void
6745 dissect_wakeup_schedule(proto_tree *tree, tvbuff_t *tvb, int offset,
6746                         guint32 tag_len)
6747 {
6748   if (tag_len < 18) {
6749     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6750                           "Wakeup Schedule content length must be at least "
6751                           "18 bytes");
6752     return;
6753   }
6754
6755   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_offset, tvb,
6756                       offset, 4, ENC_LITTLE_ENDIAN);
6757   offset += 4;
6758
6759   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_interval, tvb,
6760                       offset, 4, ENC_LITTLE_ENDIAN);
6761   offset += 4;
6762
6763   proto_tree_add_item(tree,
6764                       hf_ieee80211_tag_wakeup_schedule_awake_window_slots, tvb,
6765                       offset, 4, ENC_LITTLE_ENDIAN);
6766   offset += 4;
6767
6768   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_max_awake_dur,
6769                       tvb, offset, 4, ENC_LITTLE_ENDIAN);
6770   offset += 4;
6771
6772   proto_tree_add_item(tree, hf_ieee80211_tag_wakeup_schedule_idle_count, tvb,
6773                       offset, 2, ENC_LITTLE_ENDIAN);
6774 }
6775
6776 static void
6777 dissect_channel_switch_timing(proto_tree *tree, tvbuff_t *tvb, int offset,
6778                               guint32 tag_len)
6779 {
6780   if (tag_len < 4) {
6781     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6782                           "Channel Switch Timing content length must be at "
6783                           "least 4 bytes");
6784     return;
6785   }
6786
6787   proto_tree_add_item(tree, hf_ieee80211_tag_channel_switch_timing_switch_time,
6788                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6789   offset += 2;
6790
6791   proto_tree_add_item(tree,
6792                       hf_ieee80211_tag_channel_switch_timing_switch_timeout,
6793                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
6794 }
6795
6796 static void
6797 dissect_pti_control(proto_tree *tree, tvbuff_t *tvb, int offset,
6798                     guint32 tag_len)
6799 {
6800   if (tag_len < 3) {
6801     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6802                           "PTI Control content length must be at least "
6803                           "3 bytes");
6804     return;
6805   }
6806
6807   proto_tree_add_item(tree, hf_ieee80211_tag_pti_control_tid, tvb,
6808                       offset, 1, ENC_BIG_ENDIAN);
6809   offset++;
6810
6811   proto_tree_add_item(tree, hf_ieee80211_tag_pti_control_sequence_control, tvb,
6812                       offset, 2, ENC_LITTLE_ENDIAN);
6813 }
6814
6815 static void
6816 dissect_pu_buffer_status(proto_tree *tree, tvbuff_t *tvb, int offset,
6817                          guint32 tag_len)
6818 {
6819   if (tag_len < 1) {
6820     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, tag_len,
6821                           "PU Buffer Status content length must be at least "
6822                           "1 byte");
6823     return;
6824   }
6825
6826   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_bk, tvb,
6827                       offset, 1, ENC_BIG_ENDIAN);
6828   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_be, tvb,
6829                       offset, 1, ENC_BIG_ENDIAN);
6830   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_vi, tvb,
6831                       offset, 1, ENC_BIG_ENDIAN);
6832   proto_tree_add_item(tree, hf_ieee80211_tag_pu_buffer_status_ac_vo, tvb,
6833                       offset, 1, ENC_BIG_ENDIAN);
6834 }
6835
6836 static void
6837 dissect_timeout_interval(proto_tree *tree, tvbuff_t *tvb, int offset,
6838                          guint32 tag_len)
6839 {
6840   proto_item *pi;
6841
6842   pi = proto_tree_add_item(tree, hf_ieee80211_tag_timeout_int_type, tvb,
6843                            offset, 1, ENC_BIG_ENDIAN);
6844   if (tag_len < 5) {
6845     expert_add_info_format(g_pinfo, pi, PI_MALFORMED, PI_ERROR,
6846                            "Timeout Interval content length must be at least "
6847                           "5 bytes");
6848     return;
6849   }
6850
6851   proto_tree_add_item(tree, hf_ieee80211_tag_timeout_int_value, tvb,
6852                       offset + 1, 4, ENC_LITTLE_ENDIAN);
6853 }
6854
6855 static int
6856 dissect_mcs_set(proto_tree *tree, tvbuff_t *tvb, int offset, gboolean basic, gboolean vs) {
6857   proto_item *ti;
6858   proto_tree *mcs_tree, *bit_tree;
6859
6860   /* 16 byte Supported MCS set */
6861   if(vs)
6862   {
6863     ti = proto_tree_add_string(tree, hf_ieee80211_mcsset_vs, tvb, offset, 16,
6864       basic ? "Basic MCS Set" : "MCS Set");
6865   }else
6866   {
6867     ti = proto_tree_add_string(tree, hf_ieee80211_mcsset, tvb, offset, 16,
6868       basic ? "Basic MCS Set" : "MCS Set");
6869   }
6870   mcs_tree = proto_item_add_subtree(ti, ett_mcsset_tree);
6871
6872   /* Rx MCS Bitmask */
6873   ti = proto_tree_add_item(mcs_tree, hf_ieee80211_mcsset_rx_bitmask, tvb, offset, 10, ENC_NA);
6874   bit_tree = proto_item_add_subtree(ti, ett_mcsbit_tree);
6875
6876   /* Bits 0 - 31 */
6877   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_0to7, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6878   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_8to15, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6879   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_16to23, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6880   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_24to31, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6881   offset += 4;
6882
6883   /* Bits 32 - 52 */
6884   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_32, tvb, offset , 4, ENC_LITTLE_ENDIAN);
6885   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_33to38, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6886   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_39to52, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6887   offset += 2;
6888
6889   /* Bits 53 - 76 */
6890   proto_tree_add_item(bit_tree, hf_ieee80211_mcsset_rx_bitmask_53to76, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6891   offset += 4;
6892
6893   proto_tree_add_item(mcs_tree, hf_ieee80211_mcsset_highest_data_rate, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6894   offset += 2;
6895
6896   proto_tree_add_item(mcs_tree, hf_ieee80211_mcsset_tx_mcs_set_defined, tvb, offset, 1,
6897       ENC_LITTLE_ENDIAN);
6898   proto_tree_add_item(mcs_tree, hf_ieee80211_mcsset_tx_rx_mcs_set_not_equal, tvb, offset, 1,
6899       ENC_LITTLE_ENDIAN);
6900   proto_tree_add_item(mcs_tree, hf_ieee80211_mcsset_tx_max_spatial_streams, tvb, offset, 1,
6901       ENC_LITTLE_ENDIAN);
6902   proto_tree_add_item(mcs_tree, hf_ieee80211_mcsset_tx_unequal_modulation, tvb, offset, 1,
6903       ENC_LITTLE_ENDIAN);
6904   offset += 1;
6905
6906   offset += 3;
6907   return offset;
6908 }
6909
6910 /*  802.11n D1.10 - HT Information IE  */
6911 static int
6912 dissect_ht_info_ie_1_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
6913          guint32 tag_len, proto_item *ti_len)
6914 {
6915   proto_item *cap_item;
6916   proto_tree *cap_tree;
6917
6918   cap_tree = tree;
6919
6920   if (tag_len < 22) {
6921     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
6922                            "HT Information IE content length %u wrong, must be at least 22 bytes", tag_len);
6923     return offset;
6924   }
6925
6926
6927   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_primary_channel, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6928   offset += 1;
6929
6930   cap_item = proto_tree_add_item(tree, hf_ieee80211_ht_info_delimiter1, tvb,
6931                     offset, 1, ENC_LITTLE_ENDIAN);
6932   cap_tree = proto_item_add_subtree(cap_item, ett_ht_info_delimiter1_tree);
6933   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_secondary_channel_offset, tvb,
6934                     offset, 1, ENC_LITTLE_ENDIAN);
6935   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_channel_width, tvb,
6936                     offset, 1, ENC_LITTLE_ENDIAN);
6937   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_rifs_mode, tvb,
6938                     offset, 1, ENC_LITTLE_ENDIAN);
6939   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_psmp_stas_only, tvb,
6940                     offset, 1, ENC_LITTLE_ENDIAN);
6941   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_service_interval_granularity, tvb,
6942                     offset, 1, ENC_LITTLE_ENDIAN);
6943   offset += 1;
6944
6945   cap_item = proto_tree_add_item(tree, hf_ieee80211_ht_info_delimiter2, tvb,
6946                     offset, 2, ENC_LITTLE_ENDIAN);
6947   cap_tree = proto_item_add_subtree(cap_item, ett_ht_info_delimiter2_tree);
6948   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_operating_mode, tvb,
6949                     offset, 1, ENC_LITTLE_ENDIAN);
6950   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_non_greenfield_sta_present, tvb,
6951                     offset, 1, ENC_LITTLE_ENDIAN);
6952   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_transmit_burst_limit, tvb,
6953                     offset, 1, ENC_LITTLE_ENDIAN);
6954   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_obss_non_ht_stas_present, tvb,
6955                     offset, 1, ENC_LITTLE_ENDIAN);
6956   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_reserved_1, tvb,
6957                     offset, 2, ENC_LITTLE_ENDIAN);
6958   offset += 2;
6959
6960   cap_item = proto_tree_add_item(tree, hf_ieee80211_ht_info_delimiter3, tvb,
6961                     offset, 2, ENC_LITTLE_ENDIAN);
6962   cap_tree = proto_item_add_subtree(cap_item, ett_ht_info_delimiter3_tree);
6963   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_reserved_2, tvb,
6964                     offset, 1, ENC_LITTLE_ENDIAN);
6965   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_dual_beacon, tvb,
6966                     offset, 1, ENC_LITTLE_ENDIAN);
6967   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_dual_cts_protection, tvb,
6968                     offset, 1, ENC_LITTLE_ENDIAN);
6969   offset += 1;
6970   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_secondary_beacon, tvb,
6971                     offset, 1, ENC_LITTLE_ENDIAN);
6972   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_lsig_txop_protection_full_support, tvb,
6973                     offset, 1, ENC_LITTLE_ENDIAN);
6974   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_pco_active, tvb,
6975                     offset, 1, ENC_LITTLE_ENDIAN);
6976   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_pco_phase, tvb,
6977                     offset, 1, ENC_LITTLE_ENDIAN);
6978   proto_tree_add_item(cap_tree, hf_ieee80211_ht_info_reserved_3, tvb,
6979                     offset, 1, ENC_LITTLE_ENDIAN);
6980   offset += 1;
6981
6982   offset = dissect_mcs_set(tree, tvb, offset, TRUE, FALSE);
6983
6984   return offset;
6985 }
6986
6987 static const value_string time_adv_timing_capab_vals[] = {
6988   { 0, "No standardized external time source" },
6989   { 1, "Timestamp offset based on UTC" },
6990   { 2, "UTC time at which the TSF timer is 0" },
6991   { 0, NULL }
6992 };
6993
6994 static int dissect_time_adv(proto_tree *tree, tvbuff_t *tvb, int offset)
6995 {
6996   guint8 capab;
6997   proto_item *item;
6998   proto_tree *subtree;
6999   struct tm tm, *now;
7000   time_t t;
7001
7002   capab = tvb_get_guint8(tvb, offset);
7003   proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_timing_capab,
7004                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7005   offset++;
7006
7007   switch (capab) {
7008   case 1:
7009     proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_value,
7010                         tvb, offset, 10, ENC_NA);
7011     offset += 10;
7012
7013     proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_error,
7014                         tvb, offset, 5, ENC_NA);
7015     offset += 5;
7016     break;
7017   case 2:
7018     item = proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_value,
7019                                tvb, offset, 10, ENC_NA);
7020     subtree = proto_item_add_subtree(item, ett_tag_time_adv_tree);
7021     memset(&tm, 0, sizeof(tm));
7022     tm.tm_year = tvb_get_letohs(tvb, offset) - 1900;
7023     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_year,
7024                         tvb, offset, 2, ENC_LITTLE_ENDIAN);
7025     offset += 2;
7026     tm.tm_mon = tvb_get_guint8(tvb, offset) - 1;
7027     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_month,
7028                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7029     offset++;
7030     tm.tm_mday = tvb_get_guint8(tvb, offset);
7031     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_day,
7032                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7033     offset++;
7034     tm.tm_hour = tvb_get_guint8(tvb, offset);
7035     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_hours,
7036                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7037     offset++;
7038     tm.tm_min = tvb_get_guint8(tvb, offset);
7039     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_minutes,
7040                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7041     offset++;
7042     tm.tm_sec = tvb_get_guint8(tvb, offset);
7043     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_seconds,
7044                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7045     offset++;
7046     proto_tree_add_item(subtree,
7047                         hf_ieee80211_tag_time_adv_time_value_milliseconds,
7048                         tvb, offset, 2, ENC_LITTLE_ENDIAN);
7049     offset += 2;
7050     proto_tree_add_item(subtree, hf_ieee80211_tag_time_adv_time_value_reserved,
7051                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7052     offset++;
7053
7054     tm.tm_isdst = -1;
7055     t = mktime(&tm);
7056     if (t != -1) {
7057       t += last_timestamp / 1000000;
7058       now = localtime(&t);
7059       if (now)
7060         proto_item_append_text(item,
7061                                ": current time=%u-%02u-%02u %02u:%02u:%02u",
7062                                now->tm_year + 1900, now->tm_mon + 1,
7063                                now->tm_mday, now->tm_hour, now->tm_min,
7064                                now->tm_sec);
7065     }
7066
7067     proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_error,
7068                         tvb, offset, 5, ENC_NA);
7069     offset += 5;
7070
7071     proto_tree_add_item(tree, hf_ieee80211_tag_time_adv_time_update_counter,
7072                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
7073     offset++;
7074     break;
7075   }
7076
7077   return offset;
7078 }
7079
7080 static int dissect_time_zone(proto_tree *tree, tvbuff_t *tvb, int offset,
7081                              guint32 tag_len)
7082 {
7083   proto_tree_add_item(tree, hf_ieee80211_tag_time_zone, tvb, offset, tag_len,
7084                       ENC_ASCII|ENC_NA);
7085   return offset + tag_len;
7086 }
7087
7088 static int
7089 dissect_ap_channel_report(tvbuff_t *tvb, packet_info *pinfo,
7090          proto_tree *tree, int offset, guint32 tag_len, proto_item *ti_len, int tag_end, proto_item *ti)
7091 {
7092   if (tag_len < 1) {
7093     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7094                            "AP Channel Report length %u wrong, must be > 1", tag_len);
7095     return offset;
7096   }
7097
7098   proto_tree_add_item(tree, hf_ieee80211_tag_ap_channel_report_regulatory_class, tvb,
7099                       offset, 1, ENC_LITTLE_ENDIAN);
7100   proto_item_append_text(ti, ": Regulatory Class %u, Channel List :", tvb_get_guint8(tvb, offset) );
7101   offset += 1;
7102
7103   while(offset < tag_end)
7104   {
7105     proto_tree_add_item(tree, hf_ieee80211_tag_ap_channel_report_channel_list, tvb, offset, 1, ENC_NA);
7106     proto_item_append_text(ti, " %u,", tvb_get_guint8(tvb, offset) );
7107     offset += 1;
7108   }
7109   return offset;
7110 }
7111 static int
7112 dissect_secondary_channel_offset_ie(tvbuff_t *tvb, packet_info *pinfo,
7113          proto_tree *tree, int offset, guint32 tag_len, proto_item *ti_len)
7114 {
7115
7116   if (tag_len != 1) {
7117     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7118                            "Secondary Channel Offset length %u wrong, must be = 1", tag_len);
7119     return offset;
7120   }
7121
7122   proto_tree_add_item(tree, hf_ieee80211_tag_secondary_channel_offset, tvb,
7123                       offset, 1, ENC_LITTLE_ENDIAN);
7124
7125   offset += 1;
7126
7127   return offset;
7128 }
7129
7130 static int
7131 dissect_ht_capability_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
7132          guint32 tag_len, proto_item *ti_len, gboolean vs )
7133 {
7134   proto_item *cap_item, *ti;
7135   proto_tree *cap_tree;
7136
7137   if (tag_len != 26) {
7138     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7139                            "HT Capability IE length %u wrong, must be = 26", tag_len);
7140     return offset;
7141   }
7142
7143   if (wlan_ignore_draft_ht && vs)
7144     return offset;
7145
7146   /* 2 byte HT Capabilities  Info*/
7147   if(vs)
7148   {
7149     cap_item = proto_tree_add_item(tree, hf_ieee80211_ht_vs_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7150   }
7151   else
7152   {
7153     cap_item = proto_tree_add_item(tree, hf_ieee80211_ht_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7154   }
7155   cap_tree = proto_item_add_subtree(cap_item, ett_ht_cap_tree);
7156   proto_tree_add_item(cap_tree, hf_ieee80211_ht_ldpc_coding, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7157   proto_tree_add_item(cap_tree, hf_ieee80211_ht_chan_width, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7158   proto_tree_add_item(cap_tree, hf_ieee80211_ht_sm_pwsave, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7159   proto_tree_add_item(cap_tree, hf_ieee80211_ht_green, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7160   proto_tree_add_item(cap_tree, hf_ieee80211_ht_short20, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7161   proto_tree_add_item(cap_tree, hf_ieee80211_ht_short40, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7162   proto_tree_add_item(cap_tree, hf_ieee80211_ht_tx_stbc, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7163   offset += 1;
7164
7165   proto_tree_add_item(cap_tree, hf_ieee80211_ht_rx_stbc, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7166   proto_tree_add_item(cap_tree, hf_ieee80211_ht_delayed_block_ack, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7167   proto_tree_add_item(cap_tree, hf_ieee80211_ht_max_amsdu, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7168   proto_tree_add_item(cap_tree, hf_ieee80211_ht_dss_cck_40, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7169   proto_tree_add_item(cap_tree, hf_ieee80211_ht_psmp, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7170   proto_tree_add_item(cap_tree, hf_ieee80211_ht_40_mhz_intolerant, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7171   proto_tree_add_item(cap_tree, hf_ieee80211_ht_l_sig, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7172   offset += 1;
7173
7174   /* 1 byte A-MPDU Parameters */
7175   if(vs)
7176   {
7177     cap_item = proto_tree_add_item(tree, hf_ieee80211_ampduparam_vs, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7178   }else
7179   {
7180     cap_item = proto_tree_add_item(tree, hf_ieee80211_ampduparam, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7181   }
7182   cap_tree = proto_item_add_subtree(cap_item, ett_ampduparam_tree);
7183   ti = proto_tree_add_item(cap_tree, hf_ieee80211_ampduparam_mpdu, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7184   proto_item_append_text(ti, " (%04.0f[Bytes])",pow(2,13+(tvb_get_guint8(tvb, offset) & 0x3))-1);
7185   proto_tree_add_item(cap_tree, hf_ieee80211_ampduparam_mpdu_start_spacing, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7186   proto_tree_add_item(cap_tree, hf_ieee80211_ampduparam_reserved, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7187   offset += 1;
7188
7189   /* 16 byte MCS set */
7190   offset = dissect_mcs_set(tree, tvb, offset, FALSE, vs);
7191
7192
7193   /* 2 byte HT Extended Capabilities */
7194   if(vs)
7195   {
7196     cap_item = proto_tree_add_item(tree, hf_ieee80211_htex_vs_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7197   } else {
7198     cap_item = proto_tree_add_item(tree, hf_ieee80211_htex_cap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7199   }
7200   cap_tree = proto_item_add_subtree(cap_item, ett_htex_cap_tree);
7201   proto_tree_add_item(cap_tree, hf_ieee80211_htex_pco, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7202   proto_tree_add_item(cap_tree, hf_ieee80211_htex_transtime, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7203   offset += 1;
7204   proto_tree_add_item(cap_tree, hf_ieee80211_htex_mcs, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7205   proto_tree_add_item(cap_tree, hf_ieee80211_htex_htc_support, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7206   proto_tree_add_item(cap_tree, hf_ieee80211_htex_rd_responder, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7207   offset += 1;
7208
7209
7210   /* 4 byte TxBF capabilities */
7211   if(vs)
7212   {
7213     cap_item = proto_tree_add_item(tree, hf_ieee80211_txbf_vs, tvb, offset, 4, ENC_LITTLE_ENDIAN);
7214   } else {
7215     cap_item = proto_tree_add_item(tree, hf_ieee80211_txbf, tvb, offset, 4, ENC_LITTLE_ENDIAN);
7216   }
7217   cap_tree = proto_item_add_subtree(cap_item, ett_txbf_tree);
7218   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_cap, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7219   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_rcv_ssc, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7220   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_tx_ssc, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7221   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_rcv_ndp, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7222   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_tx_ndp, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7223   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_impl_txbf, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7224   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_calib, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7225   offset +=1;
7226
7227   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_expl_csi, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7228   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_expl_uncomp_fm, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7229   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_expl_comp_fm, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7230   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_expl_bf_csi, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7231   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_expl_uncomp_fm_feed, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7232   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_expl_comp_fm_feed, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7233   offset +=1;
7234
7235   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_min_group, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7236   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_csi_num_bf_ant, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7237   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_uncomp_sm_bf_ant, tvb, offset, 1,  ENC_LITTLE_ENDIAN);
7238   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_comp_sm_bf_ant, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7239   offset += 1;
7240
7241   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_csi_max_rows_bf, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7242   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_chan_est, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7243   proto_tree_add_item(cap_tree, hf_ieee80211_txbf_resrv, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7244   offset += 1;
7245
7246   /* 1 byte Antenna Selection (ASEL) capabilities */
7247   if(vs)
7248   {
7249     cap_item = proto_tree_add_item(tree, hf_ieee80211_antsel_vs, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7250   }
7251   else
7252   {
7253     cap_item = proto_tree_add_item(tree, hf_ieee80211_antsel, tvb,  offset, 1, ENC_LITTLE_ENDIAN);
7254   }
7255   cap_tree = proto_item_add_subtree(cap_item, ett_antsel_tree);
7256   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b0, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7257   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7258   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b2, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7259   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b3, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7260   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b4, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7261   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b5, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7262   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b6, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7263   proto_tree_add_item(cap_tree, hf_ieee80211_antsel_b7, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7264
7265   offset += 1;
7266
7267   return offset;
7268 }
7269
7270 static int
7271 dissect_ht_info_ie_1_0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
7272          guint32 tag_len, proto_item *ti_len)
7273 {
7274   proto_item *cap_item;
7275   proto_tree *cap_tree;
7276
7277   if (tag_len != 22) {
7278     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7279                            "Tag length %u wrong, must be = 22", tag_len);
7280     return offset;
7281   }
7282
7283   if (wlan_ignore_draft_ht)
7284     return offset;
7285
7286   /* 1 HT Control Channel */
7287   proto_tree_add_item(tree, hf_ieee80211_hta_cc, tvb, offset, 1, ENC_LITTLE_ENDIAN);
7288   offset += 1;
7289
7290   /* 1 byte HT additional capabilities */
7291   cap_item = proto_tree_add_item(tree, hf_ieee80211_hta_cap, tvb, offset, 1,
7292              ENC_LITTLE_ENDIAN);
7293   cap_tree = proto_item_add_subtree(cap_item, ett_hta_cap_tree);
7294
7295   proto_tree_add_item(cap_tree, hf_ieee80211_hta_ext_chan_offset, tvb, offset, 1,
7296              ENC_LITTLE_ENDIAN);
7297   proto_tree_add_item(cap_tree, hf_ieee80211_hta_rec_tx_width, tvb, offset, 1,
7298              ENC_LITTLE_ENDIAN);
7299   proto_tree_add_item(cap_tree, hf_ieee80211_hta_rifs_mode, tvb, offset, 1,
7300              ENC_LITTLE_ENDIAN);
7301   proto_tree_add_item(cap_tree, hf_ieee80211_hta_controlled_access, tvb, offset, 1,
7302              ENC_LITTLE_ENDIAN);
7303   proto_tree_add_item(cap_tree, hf_ieee80211_hta_service_interval, tvb, offset, 1,
7304              ENC_LITTLE_ENDIAN);
7305   offset += 1;
7306
7307   /* 2 byte HT additional capabilities */
7308   cap_item = proto_tree_add_item(tree, hf_ieee80211_hta_cap, tvb, offset, 2,
7309              ENC_LITTLE_ENDIAN);
7310   cap_tree = proto_item_add_subtree(cap_item, ett_hta_cap1_tree);
7311
7312   proto_tree_add_item(cap_tree, hf_ieee80211_hta_operating_mode, tvb, offset, 2,
7313              ENC_LITTLE_ENDIAN);
7314   proto_tree_add_item(cap_tree, hf_ieee80211_hta_non_gf_devices, tvb, offset, 2,
7315              ENC_LITTLE_ENDIAN);
7316
7317   offset += 2;
7318
7319   /* 2 byte HT additional capabilities */
7320   cap_item = proto_tree_add_item(tree, hf_ieee80211_hta_cap, tvb, offset, 2,
7321              ENC_LITTLE_ENDIAN);
7322   cap_tree = proto_item_add_subtree(cap_item, ett_hta_cap2_tree);
7323
7324   proto_tree_add_item(cap_tree, hf_ieee80211_hta_basic_stbc_mcs, tvb, offset, 2,
7325              ENC_LITTLE_ENDIAN);
7326   proto_tree_add_item(cap_tree, hf_ieee80211_hta_dual_stbc_protection, tvb, offset, 2,
7327              ENC_LITTLE_ENDIAN);
7328   proto_tree_add_item(cap_tree, hf_ieee80211_hta_secondary_beacon, tvb, offset, 2,
7329              ENC_LITTLE_ENDIAN);
7330   proto_tree_add_item(cap_tree, hf_ieee80211_hta_lsig_txop_protection, tvb, offset, 2,
7331              ENC_LITTLE_ENDIAN);
7332   proto_tree_add_item(cap_tree, hf_ieee80211_hta_pco_active, tvb, offset, 2,
7333              ENC_LITTLE_ENDIAN);
7334   proto_tree_add_item(cap_tree, hf_ieee80211_hta_pco_phase, tvb, offset, 2,
7335              ENC_LITTLE_ENDIAN);
7336   offset += 2;
7337
7338   /* 16 byte Supported MCS set */
7339   offset = dissect_mcs_set(tree, tvb, offset, FALSE, TRUE);
7340
7341   return offset;
7342 }
7343
7344 /* 802.11n-D1.10 and 802.11n-D2.0, 7.1.3.5a */
7345
7346 /*
7347  * 7.1.3.1.10 says:
7348  * "The Order field is 1 bit in length and is set to 1 in any non-QoS Data
7349  * frame that contains an MSDU, or fragment thereof, which is being
7350  * transferred using the StrictlyOrdered service class. The presence of the
7351  * HT Control field in frames is indicated by setting the Order field to 1
7352  * in any Data type or Management type frame that  is transmitted with a
7353  * value of HT_GF or HT_MM for the FORMAT parameter of the TXVECTOR except
7354  * a non-QoS Data frame or a Control Wrapper frame. The Order field is set
7355  * to 0 in all other frames. All non-HT QoS STAs set the Order field to 0."
7356  *
7357  * ...so does this mean that we can check for the presence of +HTC by
7358  * looking for QoS frames with the Order bit set, or do we need extra
7359  * information from the PHY (which would be monumentally silly)?
7360  *
7361  * At any rate, it doesn't look like any equipment we have produces
7362  * +HTC frames, so the code is completely untested.
7363  */
7364
7365 static void
7366 dissect_ht_control(proto_tree *tree, tvbuff_t * tvb, int offset)
7367 {
7368   proto_item *ti;
7369   proto_tree *htc_tree, *lac_subtree;
7370   guint16 htc;
7371
7372   htc = tvb_get_letohs(tvb, offset);
7373
7374   ti = proto_tree_add_item(tree, hf_ieee80211_htc, tvb, offset, 4, ENC_LITTLE_ENDIAN);
7375   htc_tree = proto_item_add_subtree(ti, ett_htc_tree);
7376
7377   /* Start: Link Adaptation Control */
7378   ti = proto_tree_add_item(htc_tree, hf_ieee80211_htc_lac, tvb, offset, 2, ENC_LITTLE_ENDIAN);
7379   lac_subtree = proto_item_add_subtree(ti, ett_htc_tree);
7380   proto_tree_add_boolean(lac_subtree, hf_ieee80211_htc_lac_reserved, tvb, offset, 1, htc);
7381   proto_tree_add_boolean(lac_subtree, hf_ieee80211_htc_lac_trq, tvb, offset, 1, htc);
7382
7383   if (HTC_IS_ASELI(htc)) {
7384     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mai_aseli, tvb, offset, 1, htc);
7385   } else {
7386     proto_tree_add_boolean(lac_subtree, hf_ieee80211_htc_lac_mai_mrq, tvb, offset, 1, htc);
7387     if (HTC_LAC_MAI_MRQ(htc)){
7388       proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mai_msi, tvb, offset, 1, htc);
7389     } else {
7390       proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mai_reserved, tvb, offset, 1, htc);
7391     }
7392   }
7393
7394   proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mfsi, tvb, offset, 2, htc);
7395   offset++;
7396
7397   if (HTC_IS_ASELI(htc)) {
7398     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_asel_command, tvb, offset, 1, htc);
7399     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_asel_data, tvb, offset, 1, htc);
7400   } else {
7401     proto_tree_add_uint(lac_subtree, hf_ieee80211_htc_lac_mfb, tvb, offset, 1, htc);
7402   }
7403   /* End: Link Adaptation Control */
7404
7405   offset++;
7406   htc = tvb_get_letohs(tvb, offset);
7407
7408   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_cal_pos, tvb, offset, 1, htc);
7409   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_cal_seq, tvb, offset, 1, htc);
7410   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_reserved1, tvb, offset, 1, htc);
7411   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_csi_steering, tvb, offset, 1, htc);
7412
7413   offset++;
7414   proto_tree_add_boolean(htc_tree, hf_ieee80211_htc_ndp_announcement, tvb, offset, 1, htc);
7415   proto_tree_add_uint(htc_tree, hf_ieee80211_htc_reserved2, tvb, offset, 1, htc);
7416   proto_tree_add_boolean(htc_tree, hf_ieee80211_htc_ac_constraint, tvb, offset, 1, htc);
7417   proto_tree_add_boolean(htc_tree, hf_ieee80211_htc_rdg_more_ppdu, tvb, offset, 1, htc);
7418 }
7419
7420 static void
7421 dissect_frame_control(proto_tree * tree, tvbuff_t * tvb, gboolean wlan_broken_fc,
7422                       guint32 offset)
7423 {
7424   guint16 fcf, flags, frame_type_subtype;
7425   proto_tree *fc_tree, *flag_tree;
7426   proto_item *fc_item, *flag_item, *hidden_item;
7427
7428   fcf = FETCH_FCF(offset);
7429
7430   flags = FCF_FLAGS(fcf);
7431   frame_type_subtype = COMPOSE_FRAME_TYPE(fcf);
7432
7433   proto_tree_add_uint (tree, hf_ieee80211_fc_frame_type_subtype,
7434     tvb, wlan_broken_fc?offset+1:offset, 1,
7435     frame_type_subtype);
7436
7437   fc_item = proto_tree_add_uint_format (tree, hf_ieee80211_fc_field, tvb,
7438     offset, 2, fcf, "Frame Control: 0x%04X (%s)",
7439     fcf, wlan_broken_fc?"Swapped":"Normal");
7440
7441   fc_tree = proto_item_add_subtree (fc_item, ett_fc_tree);
7442
7443   proto_tree_add_uint (fc_tree, hf_ieee80211_fc_proto_version, tvb, wlan_broken_fc?offset+1:offset, 1,
7444     FCF_PROT_VERSION (fcf));
7445
7446   proto_tree_add_uint (fc_tree, hf_ieee80211_fc_frame_type, tvb, wlan_broken_fc?offset+1:offset, 1,
7447     FCF_FRAME_TYPE (fcf));
7448
7449   proto_tree_add_uint (fc_tree, hf_ieee80211_fc_frame_subtype, tvb, wlan_broken_fc?offset+1:offset, 1,
7450     FCF_FRAME_SUBTYPE (fcf));
7451
7452   flag_item = proto_tree_add_uint_format (fc_tree, hf_ieee80211_fc_flags, tvb,
7453     wlan_broken_fc?offset:offset+1, 1,
7454     flags, "Flags: 0x%X", flags);
7455
7456   flag_tree = proto_item_add_subtree (flag_item, ett_proto_flags);
7457   proto_tree_add_uint (flag_tree, hf_ieee80211_fc_data_ds, tvb, wlan_broken_fc?offset:offset+1, 1,
7458     FLAGS_DS_STATUS (flags));
7459   hidden_item = proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_to_ds, tvb, offset+1, 1, flags);
7460   PROTO_ITEM_SET_HIDDEN(hidden_item);
7461   hidden_item = proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_from_ds, tvb, offset+1, 1, flags);
7462   PROTO_ITEM_SET_HIDDEN(hidden_item);
7463   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_more_frag, tvb, wlan_broken_fc?offset:offset+1, 1,
7464     flags);
7465   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_retry, tvb, wlan_broken_fc?offset:offset+1, 1,
7466     flags);
7467   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_pwr_mgt, tvb, wlan_broken_fc?offset:offset+1, 1,
7468     flags);
7469   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_more_data, tvb, wlan_broken_fc?offset:offset+1, 1,
7470     flags);
7471   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_protected, tvb, wlan_broken_fc?offset:offset+1, 1,
7472     flags);
7473   proto_tree_add_boolean (flag_tree, hf_ieee80211_fc_order, tvb, wlan_broken_fc?offset:offset+1, 1,
7474     flags);
7475 }
7476
7477 static void
7478 dissect_vendor_ie_ht(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, 
7479                     guint offset, proto_item *item, proto_item *ti_len, gint tag_len)
7480 {
7481
7482   proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, 3, "802.11n (Pre) OUI");
7483   /* 802.11n OUI  Information Element */
7484   if (4 <= tag_len && !tvb_memeql(tvb, offset, PRE_11N_OUI"\x33", 4)) {
7485     proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, 3, 1,"802.11n (Pre) HT information" );
7486
7487     dissect_ht_capability_ie(tvb, pinfo, tree, offset+4, tag_len - 4, ti_len, TRUE);
7488     proto_item_append_text(item, ": HT Capabilities (802.11n D1.10)");
7489   }
7490   else {
7491     if (4 <= tag_len && !tvb_memeql(tvb, offset, PRE_11N_OUI"\x34", 4)) {
7492       proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, 3, 1, "HT additional information (802.11n D1.00)");
7493
7494       dissect_ht_info_ie_1_0(tvb, pinfo, tree, offset+4, tag_len - 4, ti_len);
7495       proto_item_append_text(item, ": HT Additional Capabilities (802.11n D1.00)");
7496     }
7497     else {
7498         proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, 3, 1, "Unknown type");
7499         proto_item_append_text(item, ": 802.11n (pre) Unknown type");
7500         proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, 4,
7501                   tag_len - 4, "Not interpreted");
7502     }
7503   }
7504 }
7505
7506 static guint
7507 dissect_interworking(packet_info *pinfo, proto_tree *tree, proto_item *item,
7508                      tvbuff_t *tvb, int offset)
7509 {
7510   guint8 len;
7511
7512   offset++;
7513   len = tvb_get_guint8(tvb, offset);
7514   offset++;
7515
7516   if (tvb_reported_length_remaining(tvb, offset) < len || len == 0) {
7517     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7518                            "Truncated Interworking element");
7519     return offset;
7520   }
7521
7522   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_access_network_type,
7523                       tvb, offset, 1, ENC_BIG_ENDIAN);
7524   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_internet,
7525                       tvb, offset, 1, ENC_BIG_ENDIAN);
7526   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_asra,
7527                       tvb, offset, 1, ENC_BIG_ENDIAN);
7528   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_esr,
7529                       tvb, offset, 1, ENC_BIG_ENDIAN);
7530   proto_tree_add_item(tree, hf_ieee80211_tag_interworking_uesa,
7531                       tvb, offset, 1, ENC_BIG_ENDIAN);
7532   offset++;
7533
7534   if (len == 1 + 2 || len == 1 + 2 + 6) {
7535     dissect_venue_info(tree, tvb, offset);
7536     offset += 2;
7537   }
7538
7539   if (len == 1 + 6 || len == 1 + 2 + 6) {
7540     proto_tree_add_item(tree, hf_ieee80211_tag_interworking_hessid,
7541                         tvb, offset, 6, ENC_NA);
7542     offset += 6;
7543   }
7544
7545   if (len != 1 && len != 1 + 2 && len != 1 + 6 && len != 1 + 2 + 6) {
7546     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7547                            "Invalid Interworking element length");
7548   }
7549
7550   return offset;
7551 }
7552
7553 static guint
7554 dissect_roaming_consortium(packet_info *pinfo, proto_tree *tree,
7555                            proto_item *item, tvbuff_t *tvb, int offset)
7556 {
7557   guint8 len, oi_lens, oi1_len, oi2_len;
7558   int end;
7559
7560   offset++;
7561   len = tvb_get_guint8(tvb, offset);
7562   offset++;
7563   end = offset + len;
7564
7565   if (tvb_reported_length_remaining(tvb, offset) < len || len < 2) {
7566     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7567                            "Truncated Roaming Consortium element");
7568     return 2 + len;
7569   }
7570
7571   proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_num_anqp_oi,
7572                       tvb, offset, 1, ENC_BIG_ENDIAN);
7573   offset++;
7574
7575   oi_lens = tvb_get_guint8(tvb, offset);
7576   oi1_len = oi_lens & 0x0f;
7577   oi2_len = (oi_lens & 0xf0) >> 4;
7578   proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi1_len,
7579                       tvb, offset, 1, ENC_BIG_ENDIAN);
7580   proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi2_len,
7581                       tvb, offset, 1, ENC_BIG_ENDIAN);
7582   offset++;
7583
7584   if (offset + oi1_len > end) {
7585     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7586                            "Truncated Roaming Consortium element");
7587     return 2 + len;
7588   }
7589
7590   item = proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi1,
7591                              tvb, offset, oi1_len, ENC_NA);
7592   add_manuf(item, tvb, offset);
7593   offset += oi1_len;
7594
7595   if (offset + oi2_len > end) {
7596     expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
7597                            "Truncated Roaming Consortium element");
7598     return 2 + len;
7599   }
7600
7601   if (oi2_len > 0) {
7602     proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi2,
7603                         tvb, offset, oi2_len, ENC_NA);
7604     offset += oi2_len;
7605   }
7606
7607   if (end > offset) {
7608     proto_tree_add_item(tree, hf_ieee80211_tag_roaming_consortium_oi3,
7609                         tvb, offset, end - offset, ENC_NA);
7610   }
7611
7612   return 2 + len;
7613 }
7614
7615
7616 /* ************************************************************************* */
7617 /*           Dissect and add tagged (optional) fields to proto tree          */
7618 /* ************************************************************************* */
7619
7620
7621 static int beacon_padding = 0; /* beacon padding bug */
7622
7623 static int ieee80211_tag_ssid(packet_info *pinfo, proto_tree *tree,
7624                               proto_item *ti, proto_item *ti_len,
7625                               guint32 tag_len, tvbuff_t *tvb, int offset)
7626 {
7627   /* 7.3.2.1 SSID element (0) */
7628   guint8 *ssid; /* The SSID may consist of arbitrary bytes */
7629
7630   if (beacon_padding != 0) /* padding bug */
7631     return offset;
7632
7633   if(tag_len > MAX_SSID_LEN) {
7634     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7635                            "SSID length (%u) greater than maximum (%u)",
7636                            tag_len, MAX_SSID_LEN);
7637   }
7638
7639   ssid = tvb_get_ephemeral_string(tvb, offset + 2, tag_len);
7640   AirPDcapSetLastSSID(&airpdcap_ctx, (CHAR *) ssid, tag_len);
7641   proto_tree_add_item(tree, hf_ieee80211_tag_ssid, tvb, offset + 2, tag_len,
7642                       ENC_ASCII|ENC_NA);
7643   if (tag_len > 0) {
7644     proto_item_append_text(ti, ": %s", ssid);
7645
7646     col_append_fstr(pinfo->cinfo, COL_INFO, ", SSID=%s", ssid);
7647
7648     /* Wlan Stats */
7649     memcpy(wlan_stats.ssid, ssid, MIN(tag_len, MAX_SSID_LEN));
7650     wlan_stats.ssid_len = tag_len;
7651   } else {
7652     proto_item_append_text(ti, ": Broadcast");
7653
7654     col_append_str(pinfo->cinfo, COL_INFO, ", SSID=Broadcast");
7655   }
7656
7657   beacon_padding++; /* padding bug */
7658
7659   return offset + 2 + tag_len;
7660 }
7661
7662 static int ieee80211_tag_supp_rates(packet_info *pinfo, proto_tree *tree,
7663                                     proto_item *ti, proto_item *ti_len,
7664                                     guint32 tag_len, tvbuff_t *tvb,
7665                                     int offset, int tag_end)
7666 {
7667   /* 7.3.2.2 Supported Rates element (1) */
7668   if (tag_len < 1) {
7669     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7670                            "Tag length %u too short, must be greater than 0",
7671                            tag_len);
7672     return offset;
7673   }
7674
7675   offset += 2;
7676
7677   while (offset < tag_end) {
7678     proto_tree_add_item(tree, hf_ieee80211_tag_supp_rates, tvb, offset, 1,
7679                         ENC_BIG_ENDIAN);
7680     proto_item_append_text(ti, " %s,",
7681                            val_to_str_const(tvb_get_guint8(tvb, offset),
7682                                             ieee80211_supported_rates_vals,
7683                                             "Unknown Rate") );
7684     offset++;
7685   }
7686
7687   proto_item_append_text(ti, " [Mbit/sec]");
7688
7689   return offset;
7690 }
7691
7692 static int ieee80211_tag_fh_parameter(packet_info *pinfo, proto_tree *tree,
7693                                       proto_item *ti_len, guint32 tag_len,
7694                                       tvbuff_t *tvb, int offset)
7695 {
7696   /* 7.3.2.3 FH Parameter Set element (2) */
7697   if (tag_len < 5) {
7698     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7699                            "Tag length %u too short, must be >= 5", tag_len);
7700     return offset;
7701   }
7702
7703   offset += 2;
7704
7705   proto_tree_add_item(tree, hf_ieee80211_tag_fh_dwell_time,
7706                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
7707   offset += 2;
7708
7709   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hop_set,
7710                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7711   offset++;
7712
7713   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hop_pattern,
7714                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7715   offset++;
7716
7717   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hop_index,
7718                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7719   offset++;
7720
7721   return offset;
7722 }
7723
7724 static int ieee80211_tag_ds_parameter(packet_info *pinfo, proto_tree *tree,
7725                                       proto_item *ti, proto_item *ti_len,
7726                                       guint32 tag_len, tvbuff_t *tvb,
7727                                       int offset)
7728 {
7729   /* 7.3.2.4 DS Parameter Set element (3) */
7730   if (tag_len != 1) {
7731     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7732                            "Tag length %u wrong, must be = 1", tag_len);
7733     return offset;
7734   }
7735
7736   offset += 2;
7737
7738   proto_tree_add_item(tree, hf_ieee80211_tag_ds_param_channel,
7739                       tvb, offset, 1, ENC_BIG_ENDIAN);
7740
7741   proto_item_append_text(ti, ": Current Channel: %u",
7742                          tvb_get_guint8(tvb, offset));
7743
7744   wlan_stats.channel = tvb_get_guint8(tvb, offset);
7745   offset++;
7746
7747   return offset;
7748 }
7749
7750 static int ieee80211_tag_cf_parameter(packet_info *pinfo, proto_tree *tree,
7751                                       proto_item *ti, proto_item *ti_len,
7752                                       guint32 tag_len, tvbuff_t *tvb,
7753                                       int offset)
7754 {
7755   /* 7.3.2.5 CF Parameter Set element (4) */
7756   if (tag_len != 6) {
7757     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7758                            "Tag length %u wrong, must be = 6", tag_len);
7759     return offset;
7760   }
7761
7762   offset += 2;
7763
7764   proto_tree_add_item(tree, hf_ieee80211_tag_cfp_count,
7765                       tvb, offset, 1, ENC_BIG_ENDIAN);
7766   proto_item_append_text(ti, ": CFP count %u", tvb_get_guint8(tvb, offset));
7767   offset++;
7768
7769   proto_tree_add_item(tree, hf_ieee80211_tag_cfp_period,
7770                       tvb, offset, 1, ENC_BIG_ENDIAN);
7771   proto_item_append_text(ti, ": CFP Period %u", tvb_get_guint8(tvb, offset));
7772   offset++;
7773
7774   proto_tree_add_item(tree, hf_ieee80211_tag_cfp_max_duration,
7775                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
7776   proto_item_append_text(ti, ": CFP Max Duration %u",
7777                          tvb_get_letohs(tvb, offset));
7778   offset += 2;
7779
7780   proto_tree_add_item(tree, hf_ieee80211_tag_cfp_dur_remaining,
7781                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
7782   proto_item_append_text(ti, ": CFP Dur Remaining %u",
7783                          tvb_get_letohs(tvb, offset));
7784   offset++;
7785
7786   return offset;
7787 }
7788
7789 static int ieee80211_tag_tim(packet_info *pinfo, proto_tree *tree,
7790                              proto_item *ti, proto_item *ti_len,
7791                              guint32 tag_len, tvbuff_t *tvb, int offset)
7792 {
7793   proto_tree *bmapctl_tree;
7794   proto_item *bmapctl_item;
7795
7796   /* 7.3.2.6 TIM (5) */
7797   if (tag_len < 4) {
7798     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7799                            "Tag length %u too short, must be >= 4", tag_len);
7800     return offset;
7801   }
7802
7803   offset += 2;
7804
7805   proto_tree_add_item(tree, hf_ieee80211_tim_dtim_count,
7806                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7807   proto_item_append_text(ti, ": DTIM %u of", tvb_get_guint8(tvb, offset));
7808   offset++;
7809
7810   proto_tree_add_item(tree, hf_ieee80211_tim_dtim_period,
7811                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7812   proto_item_append_text(ti, " %u bitmap", tvb_get_guint8(tvb, offset + 1));
7813   offset++;
7814
7815   bmapctl_item = proto_tree_add_item(tree, hf_ieee80211_tim_bmapctl,
7816                                      tvb, offset, 1, ENC_LITTLE_ENDIAN);
7817   bmapctl_tree = proto_item_add_subtree(bmapctl_item, ett_tag_bmapctl_tree);
7818   proto_tree_add_item(bmapctl_tree, hf_ieee80211_tim_bmapctl_mcast,
7819                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7820   proto_tree_add_item(bmapctl_tree, hf_ieee80211_tim_bmapctl_offset,
7821                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
7822   offset++;
7823
7824   proto_tree_add_item(tree, hf_ieee80211_tim_partial_virtual_bitmap,
7825                       tvb, offset, tag_len - 3, ENC_NA);
7826   offset += tag_len - 3;
7827
7828   return offset;
7829 }
7830
7831 static int ieee80211_tag_ibss_parameter(packet_info *pinfo, proto_tree *tree,
7832                                         proto_item *ti, proto_item *ti_len,
7833                                         guint32 tag_len, tvbuff_t *tvb,
7834                                         int offset)
7835 {
7836   /* 7.3.2.7 IBSS Parameter Set element (6) */
7837
7838   if (tag_len != 2) {
7839     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7840                            "Tag length %u wrong, must be = 2", tag_len);
7841     return offset;
7842   }
7843
7844   offset += 2;
7845
7846   proto_tree_add_item(tree, hf_ieee80211_tag_ibss_atim_window,
7847                       tvb, offset, 2, ENC_LITTLE_ENDIAN);
7848   proto_item_append_text(ti, ": ATIM window 0x%x",
7849                          tvb_get_letohs(tvb, offset));
7850   offset += 2;
7851
7852   return offset;
7853 }
7854
7855 static const value_string environment_vals[] = {
7856   { 0x20, "Any" },
7857   { 0x4f, "Outdoor" },
7858   { 0x49, "Indoor" },
7859   { 0,    NULL }
7860 };
7861
7862 static int ieee80211_tag_country_info(packet_info *pinfo, proto_tree *tree,
7863                                       proto_item *ti, proto_item *ti_len,
7864                                       guint32 tag_len, tvbuff_t *tvb,
7865                                       int offset, int tag_end)
7866 {
7867   /* 7.3.2.9 Country information element (7) */
7868   proto_tree *sub_tree;
7869   proto_item *sub_item;
7870
7871   if (tag_len < 6) {
7872     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7873                            "Tag length %u too short, must be >= 6", tag_len);
7874     return offset;
7875   }
7876
7877   offset += 2;
7878
7879   proto_tree_add_item(tree, hf_ieee80211_tag_country_info_code,
7880                       tvb, offset, 2, ENC_ASCII|ENC_NA);
7881   proto_item_append_text(ti, ": Country Code %s",
7882                          tvb_get_ephemeral_string(tvb, offset, 2));
7883   offset += 2;
7884
7885   proto_tree_add_item(tree, hf_ieee80211_tag_country_info_env,
7886                       tvb, offset, 1, ENC_BIG_ENDIAN);
7887   proto_item_append_text(ti, ", Environment %s",
7888                          val_to_str(tvb_get_guint8(tvb, offset),
7889                                     environment_vals,"Unknown (0x%02x)"));
7890   offset++;
7891
7892   while (offset < tag_end) {
7893     /* Padding ? */
7894     if ((tag_end - offset) < 3) {
7895       proto_tree_add_item(tree, hf_ieee80211_tag_country_info_pad,
7896                           tvb, offset, 1, ENC_NA);
7897       offset++;
7898       continue;
7899     }
7900     if (tvb_get_guint8(tvb, offset) <= 200) { /* 802.11d */
7901       sub_item = proto_tree_add_item(tree, hf_ieee80211_tag_country_info_fnm,
7902                                      tvb, offset, 3, ENC_NA);
7903       sub_tree = proto_item_add_subtree(sub_item, ett_tag_country_fnm_tree);
7904
7905       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_fnm_fcn,
7906                           tvb, offset, 1, ENC_BIG_ENDIAN);
7907       proto_item_append_text(sub_item, ": First Channel Number: %d",
7908                              tvb_get_guint8(tvb, offset));
7909       offset++;
7910       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_fnm_nc,
7911                           tvb, offset, 1, ENC_BIG_ENDIAN);
7912       proto_item_append_text(sub_item, ", Number of Channels: %d",
7913                              tvb_get_guint8(tvb, offset));
7914       offset++;
7915       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_fnm_mtpl,
7916                           tvb, offset, 1, ENC_BIG_ENDIAN);
7917       proto_item_append_text(sub_item,
7918                              ", Maximum Transmit Power Level: %d dBm",
7919                              tvb_get_guint8(tvb, offset));
7920       offset++;
7921     } else { /* 802.11j */
7922       sub_item = proto_tree_add_item(tree, hf_ieee80211_tag_country_info_rrc,
7923                                      tvb, offset, 3, ENC_NA);
7924       sub_tree = proto_item_add_subtree(sub_item, ett_tag_country_rcc_tree);
7925
7926       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_rrc_rei,
7927                           tvb, offset, 1, ENC_BIG_ENDIAN);
7928       proto_item_append_text(sub_item,
7929                              ": Regulatory Extension Identifier: %d",
7930                              tvb_get_guint8(tvb, offset));
7931       offset++;
7932       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_rrc_rc,
7933                           tvb, offset, 1, ENC_BIG_ENDIAN);
7934       proto_item_append_text(sub_item, ", Regulatory Class: %d",
7935                              tvb_get_guint8(tvb, offset));
7936       offset++;
7937       proto_tree_add_item(sub_tree, hf_ieee80211_tag_country_info_rrc_cc,
7938                           tvb, offset, 1, ENC_BIG_ENDIAN);
7939       proto_item_append_text(sub_item, ", Coverage Class: %d",
7940                              tvb_get_guint8(tvb, offset));
7941       offset++;
7942     }
7943   }
7944
7945   return offset;
7946 }
7947
7948 static int ieee80211_tag_fh_hopping_parameter(packet_info *pinfo,
7949                                               proto_tree *tree,
7950                                               proto_item *ti,
7951                                               proto_item *ti_len,
7952                                               guint32 tag_len, tvbuff_t *tvb,
7953                                               int offset)
7954 {
7955   /* 7.3.2.10 Hopping Pattern Parameters information element (8) */
7956   if (tag_len < 2) {
7957     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7958                            "Tag length %u too short, must be >= 2", tag_len);
7959     return offset;
7960   }
7961
7962   offset += 2;
7963
7964   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_parameter_prime_radix,
7965                       tvb, offset, 1, ENC_BIG_ENDIAN);
7966   proto_item_append_text(ti, ": Prime Radix: %u", tvb_get_guint8(tvb, offset));
7967   offset++;
7968
7969   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_parameter_nb_channels,
7970                       tvb, offset, 1, ENC_BIG_ENDIAN);
7971   proto_item_append_text(ti, ", Number of Channels: %u",
7972                          tvb_get_guint8(tvb, offset));
7973   offset++;
7974
7975   return offset;
7976 }
7977
7978 static int ieee80211_tag_fh_hopping_table(packet_info *pinfo, proto_tree *tree,
7979                                           proto_item *ti_len,
7980                                           guint32 tag_len, tvbuff_t *tvb,
7981                                           int offset, int tag_end)
7982 {
7983   /* 7.3.2.11 Hopping Pattern Table information element (9) */
7984   if (tag_len < 4) {
7985     expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR,
7986                            "Tag length %u too short, must be >= 4", tag_len);
7987     return offset;
7988   }
7989
7990   offset += 2;
7991
7992   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_flag,
7993                       tvb, offset, 1, ENC_BIG_ENDIAN);
7994   offset++;
7995
7996   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_number_of_sets,
7997                       tvb, offset, 1, ENC_BIG_ENDIAN);
7998   offset++;
7999
8000   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_modulus,
8001                       tvb, offset, 1, ENC_BIG_ENDIAN);
8002   offset++;
8003
8004   proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_table_offset,
8005                       tvb, offset, 1, ENC_BIG_ENDIAN);
8006   offset++;
8007
8008   while (offset < tag_end) {
8009     proto_tree_add_item(tree, hf_ieee80211_tag_fh_hopping_random_table,
8010                         tvb, offset, 2, ENC_BIG_ENDIAN);
8011     offset += 2;
8012   }
8013
8014   return offset;
8015 }
8016
8017 static int
8018 add_tagged_field(packet_info * pinfo, proto_tree * tree, tvbuff_t * tvb, int offset, int ftype)
8019 {
8020   guint32 oui;
8021   tvbuff_t *tag_tvb;
8022   const guint8 *tag_data_ptr;
8023   guint32 tag_no, tag_len;
8024   int n, ret;
8025   char print_buff[SHORT_STR];
8026   proto_tree * orig_tree=tree;
8027   proto_item *ti = NULL, *ti_len = NULL;
8028   int tag_end;
8029
8030   tag_no = tvb_get_guint8(tvb, offset);
8031   tag_len = tvb_get_guint8(tvb, offset + 1);
8032   tag_end = offset + 2 + tag_len;
8033   if (tree) {
8034     ti = proto_tree_add_item(orig_tree, hf_ieee80211_tag, tvb, offset, 2 + tag_len , ENC_NA);
8035     proto_item_append_text(ti, ": %s", val_to_str(tag_no, tag_num_vals, "Reserved (%d)"));
8036
8037     tree = proto_item_add_subtree(ti, ett_80211_mgt_ie);
8038
8039     proto_tree_add_item(tree, hf_ieee80211_tag_number, tvb, offset, 1, ENC_BIG_ENDIAN);
8040
8041   }
8042   ti_len = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, 1, tag_len);
8043
8044   switch (tag_no) {
8045   case TAG_SSID:
8046     offset += ieee80211_tag_ssid(pinfo, tree, ti, ti_len, tag_len, tvb,
8047                                  offset);
8048     break;
8049   case TAG_SUPP_RATES:
8050     offset += ieee80211_tag_supp_rates(pinfo, tree, ti, ti_len, tag_len, tvb,
8051                                        offset, tag_end);
8052     break;
8053   case TAG_FH_PARAMETER:
8054     offset += ieee80211_tag_fh_parameter(pinfo, tree, ti_len, tag_len, tvb,
8055                                          offset);
8056     break;
8057   case TAG_DS_PARAMETER:
8058     offset += ieee80211_tag_ds_parameter(pinfo, tree, ti, ti_len, tag_len, tvb,
8059                                          offset);
8060     break;
8061   case TAG_CF_PARAMETER:
8062     offset += ieee80211_tag_cf_parameter(pinfo, tree, ti, ti_len, tag_len, tvb,
8063                                          offset);
8064     break;
8065   case TAG_TIM:
8066     offset += ieee80211_tag_tim(pinfo, tree, ti, ti_len, tag_len, tvb, offset);
8067     break;
8068   case TAG_IBSS_PARAMETER:
8069     offset += ieee80211_tag_ibss_parameter(pinfo, tree, ti, ti_len, tag_len,
8070                                            tvb, offset);
8071     break;
8072   case TAG_COUNTRY_INFO:
8073     offset += ieee80211_tag_country_info(pinfo, tree, ti, ti_len, tag_len, tvb,
8074                                          offset, tag_end);
8075     break;
8076   case TAG_FH_HOPPING_PARAMETER:
8077     offset += ieee80211_tag_fh_hopping_parameter(pinfo, tree, ti, ti_len,
8078                                                  tag_len, tvb, offset);
8079     break;
8080   case TAG_FH_HOPPING_TABLE:
8081     offset += ieee80211_tag_fh_hopping_table(pinfo, tree, ti_len, tag_len,
8082                                              tvb, offset, tag_end);
8083     break;
8084
8085     case TAG_REQUEST: /* 7.3.2.12 Request information element (10) */
8086       while(offset < tag_end )
8087       {
8088         proto_tree_add_item(tree, hf_ieee80211_tag_request, tvb, offset, 1, ENC_BIG_ENDIAN);
8089         offset += 1;
8090       }
8091       break;
8092
8093     case TAG_QBSS_LOAD: /* 7.3.2.28 BSS Load element (11) */
8094       if (tag_len < 4 || tag_len >5)
8095       {
8096         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 4 or 5", tag_len);
8097         break;
8098       }
8099
8100       if (tag_len == 4)
8101       {
8102         /* QBSS Version 1 */
8103         proto_item_append_text(ti, " Cisco QBSS Version 1 - non CCA");
8104
8105         /* Extract Values */
8106         proto_tree_add_uint(tree, hf_ieee80211_qbss_version, tvb, offset + 2, tag_len, 1);
8107         proto_tree_add_item(tree, hf_ieee80211_qbss_scount, tvb, offset + 2, 2, ENC_LITTLE_ENDIAN);
8108         proto_tree_add_item(tree, hf_ieee80211_qbss_cu, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
8109         proto_tree_add_item(tree, hf_ieee80211_qbss_adc, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
8110       }
8111       else if (tag_len == 5)
8112       {
8113          /* QBSS Version 2 */
8114          proto_item_append_text(ti, " 802.11e CCA Version");
8115
8116          /* Extract Values */
8117          proto_tree_add_uint(tree, hf_ieee80211_qbss_version, tvb, offset + 2, tag_len, 2);
8118          proto_tree_add_item(tree, hf_ieee80211_qbss_scount, tvb, offset + 2, 2, ENC_LITTLE_ENDIAN);
8119          proto_tree_add_item(tree, hf_ieee80211_qbss_cu, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
8120          proto_tree_add_item(tree, hf_ieee80211_qbss_adc, tvb, offset + 5, 2, ENC_LITTLE_ENDIAN);
8121       }
8122       break;
8123
8124     case TAG_TSPEC: /* 7.3.2.30 TSPEC element (13) */
8125       if (tag_len != 55)
8126       {
8127         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 55", tag_len);
8128         break;
8129       }
8130       offset += 2;
8131
8132       add_fixed_field(tree, tvb, offset, FIELD_QOS_TS_INFO);
8133       offset += 3;
8134
8135       proto_tree_add_item(tree, hf_ieee80211_tspec_nor_msdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8136       offset += 2;
8137
8138       proto_tree_add_item(tree, hf_ieee80211_tspec_max_msdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8139       offset += 2;
8140
8141       proto_tree_add_item(tree, hf_ieee80211_tspec_min_srv, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8142       offset += 4;
8143
8144       proto_tree_add_item(tree, hf_ieee80211_tspec_max_srv, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8145       offset += 4;
8146
8147       proto_tree_add_item(tree, hf_ieee80211_tspec_inact_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8148       offset += 4;
8149
8150       proto_tree_add_item(tree, hf_ieee80211_tspec_susp_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8151       offset += 4;
8152
8153       proto_tree_add_item(tree, hf_ieee80211_tspec_srv_start, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8154       offset += 4;
8155
8156       proto_tree_add_item(tree, hf_ieee80211_tspec_min_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8157       offset += 4;
8158
8159       proto_tree_add_item(tree, hf_ieee80211_tspec_mean_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8160       offset += 4;
8161
8162       proto_tree_add_item(tree, hf_ieee80211_tspec_peak_data, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8163       offset += 4;
8164
8165       proto_tree_add_item(tree, hf_ieee80211_tspec_burst_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8166       offset += 4;
8167
8168       proto_tree_add_item(tree, hf_ieee80211_tspec_delay_bound, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8169       offset += 4;
8170
8171       proto_tree_add_item(tree, hf_ieee80211_tspec_min_phy, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8172       offset += 4;
8173
8174       proto_tree_add_item(tree, hf_ieee80211_tspec_surplus, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8175       offset += 2;
8176
8177       proto_tree_add_item(tree, hf_ieee80211_tspec_medium, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8178       offset += 2;
8179
8180       break;
8181
8182     case TAG_TCLAS: /* 7.3.2.31 TCLAS element (14) */
8183       if (tag_len < 6)
8184       {
8185         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 6", tag_len);
8186         break;
8187       }
8188       {
8189       guint8 type;
8190       guint8 version;
8191
8192       offset += 2;
8193       proto_tree_add_item(tree, hf_ieee80211_tclas_up, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8194       type = tvb_get_guint8(tvb, offset);
8195       offset += 1;
8196
8197       proto_tree_add_item(tree, hf_ieee80211_tclas_class_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8198       offset += 1;
8199
8200       proto_tree_add_item(tree, hf_ieee80211_tclas_class_mask, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8201       offset += 1;
8202
8203       switch (type)
8204         {
8205           case 0:
8206             proto_tree_add_item(tree, hf_ieee80211_tclas_src_mac_addr, tvb, offset, 6, ENC_NA);
8207             offset += 6;
8208
8209             proto_tree_add_item(tree, hf_ieee80211_tclas_dst_mac_addr, tvb, offset, 6, ENC_NA);
8210             offset += 6;
8211
8212             proto_tree_add_item(tree, hf_ieee80211_tclas_ether_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8213             offset += 2;
8214             break;
8215
8216           case 1:
8217             version = tvb_get_guint8(tvb, offset + 5);
8218             proto_tree_add_item(tree, hf_ieee80211_tclas_version, tvb, offset + 5, 1, ENC_LITTLE_ENDIAN);
8219             offset += 1;
8220             if (version == 4)
8221             {
8222               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv4_src, tvb, offset, 4, ENC_BIG_ENDIAN);
8223               offset += 4;
8224               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv4_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
8225               offset += 4;
8226               proto_tree_add_item(tree, hf_ieee80211_tclas_src_port, tvb, offset, 2, ENC_BIG_ENDIAN);
8227               offset += 2;
8228               proto_tree_add_item(tree, hf_ieee80211_tclas_dst_port, tvb, offset, 2, ENC_BIG_ENDIAN);
8229               offset += 2;
8230               proto_tree_add_item(tree, hf_ieee80211_tclas_dscp, tvb, offset, 1, ENC_BIG_ENDIAN);
8231               offset += 1;
8232               proto_tree_add_item(tree, hf_ieee80211_tclas_protocol, tvb, offset, 1, ENC_BIG_ENDIAN);
8233               offset += 1;
8234             }
8235             else if (version == 6)
8236             {
8237               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv6_src, tvb, offset, 16, ENC_NA);
8238               offset += 16;
8239               proto_tree_add_item(tree, hf_ieee80211_tclas_ipv6_dst, tvb, offset, 16, ENC_NA);
8240               offset += 16;
8241               proto_tree_add_item(tree, hf_ieee80211_tclas_src_port, tvb, offset, 2, ENC_BIG_ENDIAN);
8242               offset += 2;
8243               proto_tree_add_item(tree, hf_ieee80211_tclas_dst_port, tvb, offset, 2, ENC_BIG_ENDIAN);
8244               offset += 2;
8245               proto_tree_add_item(tree, hf_ieee80211_tclas_flow, tvb, offset, 3, ENC_BIG_ENDIAN);
8246               offset += 3;
8247             }
8248             break;
8249
8250           case 2:
8251             proto_tree_add_item(tree, hf_ieee80211_tclas_tag_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8252             offset += 2;
8253             break;
8254
8255           default:
8256             break;
8257         }
8258       }
8259       break;
8260
8261     case TAG_SCHEDULE: /* 7.3.2.34 Schedule element (15) */
8262       if (tag_len != 14)
8263       {
8264         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 14", tag_len);
8265         break;
8266       }
8267       offset += 2;
8268
8269       add_fixed_field(tree, tvb, offset, FIELD_SCHEDULE_INFO);
8270       offset += 2;
8271
8272       proto_tree_add_item(tree, hf_ieee80211_sched_srv_start, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8273       offset += 4;
8274
8275       proto_tree_add_item(tree, hf_ieee80211_sched_srv_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8276       offset += 4;
8277
8278       proto_tree_add_item(tree, hf_ieee80211_sched_spec_int, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8279       offset += 2;
8280       break;
8281
8282     case TAG_CHALLENGE_TEXT: /* 7.3.2.8 Challenge Text element (16) */
8283       offset += 2;
8284       proto_tree_add_item(tree, hf_ieee80211_tag_challenge_text, tvb, offset, tag_len, ENC_NA);
8285       break;
8286
8287     case TAG_POWER_CONSTRAINT: /* 7.3.2.15 Power Constraint element (32) */
8288     {
8289       if (tag_len != 1)
8290       {
8291         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
8292         break;
8293       }
8294       offset += 2;
8295
8296       proto_tree_add_item(tree, hf_ieee80211_tag_power_constraint_local, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8297       proto_item_append_text(ti, " :%d", tvb_get_guint8(tvb, offset));
8298       offset += 1;
8299
8300       break;
8301     }
8302
8303     case TAG_POWER_CAPABILITY: /* 7.3.2.16 Power Capability element (33) */
8304     {
8305       if (tag_len != 2)
8306       {
8307         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 2", tag_len);
8308         break;
8309       }
8310       offset += 2;
8311
8312       proto_tree_add_item(tree, hf_ieee80211_tag_power_capability_min, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8313       proto_item_append_text(ti, " Min: %d", tvb_get_guint8(tvb, offset));
8314       offset += 1;
8315
8316       proto_tree_add_item(tree, hf_ieee80211_tag_power_capability_max, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8317       proto_item_append_text(ti, ", Max :%d", tvb_get_guint8(tvb, offset));
8318       offset += 1;
8319       break;
8320     }
8321
8322     case TAG_TPC_REQUEST: /* 7.3.2.18 TPC Request element (34) */
8323     {
8324       if (tag_len != 0)
8325       {
8326         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 0", tag_len);
8327         break;
8328       }
8329       offset += 2;
8330
8331       /* No Data */
8332       break;
8333     }
8334
8335     case TAG_TPC_REPORT: /* 7.3.2.18 TPC Report element (35) */
8336     {
8337       if (tag_len != 2)
8338       {
8339         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 2", tag_len);
8340         break;
8341       }
8342       offset += 2;
8343
8344       proto_tree_add_item(tree, hf_ieee80211_tag_tpc_report_trsmt_pow, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8345       proto_item_append_text(ti, " Transmit Power :%d", tvb_get_guint8(tvb, offset));
8346       offset += 1;
8347
8348       proto_tree_add_item(tree, hf_ieee80211_tag_tpc_report_link_mrg, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8349       proto_item_append_text(ti, ", Link Margin :%d", tvb_get_guint8(tvb, offset));
8350       offset += 1;
8351
8352       break;
8353     }
8354
8355     case TAG_SUPPORTED_CHANNELS: /* 7.3.2.19 Supported Channels element (36) */
8356       {
8357         proto_item *chan_item;
8358         proto_tree *chan_tree;
8359         guint i = 1;
8360
8361         offset += 2;
8362         if (tag_len % 2 == 1) {
8363            expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u must be even",tag_len);
8364            break;
8365         }
8366         while(offset < tag_end)
8367         {
8368           chan_item = proto_tree_add_item(tree, hf_ieee80211_tag_supported_channels, tvb, offset, 2, ENC_NA);
8369           proto_item_append_text(chan_item, " #%d", i);
8370           i++;
8371
8372           chan_tree = proto_item_add_subtree(chan_item , ett_tag_supported_channels);
8373
8374           proto_tree_add_item(chan_tree, hf_ieee80211_tag_supported_channels_first, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8375           proto_item_append_text(chan_item, " First: %d", tvb_get_guint8(tvb, offset));
8376           offset += 1;
8377
8378           proto_tree_add_item(chan_tree, hf_ieee80211_tag_supported_channels_range, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8379           proto_item_append_text(chan_item, ", Range: %d ", tvb_get_guint8(tvb, offset));
8380           offset += 1;
8381
8382         }
8383         break;
8384       }
8385     case TAG_CHANNEL_SWITCH_ANN: /* 7.3.2.20 Channel Switch Announcement element (37) */
8386     {
8387       if (tag_len != 3)
8388       {
8389         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 3", tag_len);
8390         break;
8391       }
8392       offset += 2;
8393
8394       proto_tree_add_item(tree, hf_ieee80211_csa_channel_switch_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8395       proto_item_append_text(ti, " Mode: %d", tvb_get_guint8(tvb, offset));
8396       offset += 1;
8397
8398       proto_tree_add_item(tree, hf_ieee80211_csa_new_channel_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8399       proto_item_append_text(ti, ", Number: %d ", tvb_get_guint8(tvb, offset));
8400       offset += 1;
8401
8402       proto_tree_add_item(tree, hf_ieee80211_csa_channel_switch_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8403       proto_item_append_text(ti, ", Count: %d ", tvb_get_guint8(tvb, offset));
8404       offset += 1;
8405     }
8406
8407     case TAG_MEASURE_REQ: /* 7.3.2.21 Measurement Request element (38) with update from 802.11k-2008 */
8408       if (tag_len < 3)
8409       {
8410         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 3", tag_len);
8411         break;
8412       }
8413       {
8414         guint8 request_type;
8415         proto_item *parent_item;
8416         proto_tree *sub_tree;
8417
8418         offset += 2;
8419
8420         proto_tree_add_item(tree, hf_ieee80211_tag_measure_request_token, tvb, offset, 1, ENC_NA);
8421         offset += 1;
8422
8423         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_request_mode, tvb, offset, 1, ENC_NA);
8424         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_request_mode_tree);
8425         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_parallel, tvb, offset, 1, ENC_NA);
8426         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_enable, tvb, offset, 1, ENC_NA);
8427         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_request, tvb, offset, 1, ENC_NA);
8428         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_report, tvb, offset, 1, ENC_NA);
8429         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_duration_mandatory, tvb, offset, 1, ENC_NA);
8430         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mode_reserved, tvb, offset, 1, ENC_NA);
8431         offset += 1;
8432
8433
8434         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_request_type, tvb, offset, 1, ENC_NA);
8435         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_request_type_tree);
8436         request_type = tvb_get_guint8 (tvb, offset);
8437         offset += 1;
8438
8439         switch(request_type) {
8440           case 0: /* Basic Request */
8441           case 1: /* Clear channel assessment (CCA) request */
8442           case 2: /* Receive power indication (RPI) histogram request */
8443           {
8444
8445             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
8446             offset += 1;
8447
8448             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8449             offset += 8;
8450
8451             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8452             offset += 2;
8453             break;
8454           }
8455           case 3: /* Channel Load Request */
8456           case 4: /* Noise Histogram Request */
8457           {
8458             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_regulatory_class, tvb, offset, 1, ENC_NA);
8459             offset += 1;
8460
8461             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
8462             offset += 1;
8463
8464             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8465             offset += 2;
8466
8467             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8468             offset += 2;
8469             /* TODO Add Optional Subelements */
8470             break;
8471           }
8472           case 5: /* Beacon Request */
8473           {
8474             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_regulatory_class, tvb, offset, 1, ENC_NA);
8475             offset += 1;
8476
8477             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
8478             offset += 1;
8479
8480             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8481             offset += 2;
8482
8483             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8484             offset += 2;
8485
8486             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_measurement_mode, tvb, offset, 1, ENC_NA);
8487             offset += 1;
8488
8489             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_bssid, tvb, offset, 6, ENC_NA);
8490             offset += 6;
8491
8492             while(offset < tag_end)
8493             {
8494               guint8 sub_id, sub_length, sub_tag_end;
8495               proto_item *ti;
8496               proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_id, tvb, offset, 1, ENC_NA);
8497               sub_id = tvb_get_guint8(tvb, offset);
8498               offset += 1;
8499
8500               proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_subelement_length, tvb, offset, 1, ENC_NA);
8501               sub_length = tvb_get_guint8(tvb, offset);
8502               offset += 1;
8503               sub_tag_end = offset + sub_length;
8504
8505               switch(sub_id){
8506                 case MEASURE_REQ_BEACON_SUB_SSID: /* SSID (0) */
8507                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_ssid, tvb, offset, sub_length, ENC_ASCII|ENC_NA);
8508                   offset += sub_length;
8509                   break;
8510                 case MEASURE_REQ_BEACON_SUB_BRI: /* Beacon Reporting Information (1) */
8511                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition, tvb, offset, 1, ENC_BIG_ENDIAN);
8512                   offset += 1;
8513                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_bri_threshold_offset, tvb, offset, 1, ENC_BIG_ENDIAN);
8514                   offset += 1;
8515                   break;
8516                 case MEASURE_REQ_BEACON_SUB_RD: /* Reporting Detail (2) */
8517                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_reporting_detail, tvb, offset, 1, ENC_BIG_ENDIAN);
8518                   offset += 1;
8519                   break;
8520                 case MEASURE_REQ_BEACON_SUB_REQUEST: /* Request (10) */
8521                   proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_sub_request, tvb, offset, 1, ENC_BIG_ENDIAN);
8522                   offset += 1;
8523                   break;
8524                 case MEASURE_REQ_BEACON_SUB_APCP: /* Request (51) */
8525                   /* TODO */
8526                   break;
8527                 default:
8528                   /* no default action */
8529                   break;
8530              }
8531              if(offset < sub_tag_end)
8532              {
8533                ti = proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_beacon_unknown, tvb, offset, sub_tag_end - offset, ENC_NA);
8534                expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, " Unknown Data (not interpreted)");
8535                offset = sub_tag_end;
8536              }
8537             }
8538
8539             break;
8540           }
8541           case 6: /* Frame Request */
8542           {
8543             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_regulatory_class, tvb, offset, 1, ENC_NA);
8544             offset += 1;
8545
8546             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_channel_number, tvb, offset, 1, ENC_NA);
8547             offset += 1;
8548
8549             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8550             offset += 2;
8551
8552             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8553             offset += 2;
8554
8555             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_frame_request_type, tvb, offset, 1, ENC_NA);
8556             offset += 1;
8557
8558             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_mac_address, tvb, offset, 6, ENC_NA);
8559             offset += 6;
8560
8561             /* TODO Add Optional Subelements */
8562             break;
8563           }
8564           case 7: /* BSTA Statistics Request */
8565           {
8566             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_peer_mac_address, tvb, offset, 6, ENC_NA);
8567             offset += 6;
8568
8569             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_randomization_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8570             offset += 2;
8571
8572             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8573             offset += 2;
8574
8575             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_request_group_id, tvb, offset, 1, ENC_NA);
8576             offset += 1;
8577
8578             /* TODO Add Optional Subelements */
8579             break;
8580           }
8581           case 8: /* Location Configuration Indication (LCI) Request */
8582             /* TODO */
8583           case 9: /* Transmit Stream Measurement Request */
8584             /* TODO */
8585           case 255: /* Measurement Pause Request*/
8586             /* TODO */
8587           default: /* unknown */
8588             break;
8589         }
8590       }
8591
8592       break;
8593     case TAG_MEASURE_REP: /* 7.3.2.22 Measurement Report element (39) with update from 802.11k-2008 */
8594       if (tag_len < 3)
8595       {
8596         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be >= 3", tag_len);
8597         break;
8598       }
8599       {
8600         proto_item *parent_item;
8601         proto_tree *sub_tree;
8602         guint8 report_type;
8603
8604         offset += 2;
8605         proto_tree_add_item(tree, hf_ieee80211_tag_measure_report_measurement_token, tvb, offset, 1, ENC_NA);
8606         offset += 1;
8607
8608         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_report_mode, tvb, offset, 1, ENC_NA);
8609         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_report_mode_tree);
8610         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_late, tvb, offset, 1, ENC_NA);
8611         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_incapable, tvb, offset, 1, ENC_NA);
8612         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_refused, tvb, offset, 1, ENC_NA);
8613         proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_mode_reserved, tvb, offset, 1, ENC_NA);
8614         offset += 1;
8615
8616         report_type = tvb_get_guint8(tvb, offset);
8617         parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_report_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8618         sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_report_type_tree);
8619         offset += 1;
8620
8621         if (tag_len == 3)
8622             break;
8623         switch (report_type) {
8624           case 0: /* Basic Report */
8625           {
8626             proto_tree *sub_tree_map_field;
8627
8628             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8629             offset += 1;
8630
8631             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8632             offset += 8;
8633
8634             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8635             offset += 2;
8636
8637
8638             parent_item = proto_tree_add_item(tree, hf_ieee80211_tag_measure_basic_map_field, tvb, offset, 1, ENC_NA);
8639             sub_tree_map_field = proto_item_add_subtree(parent_item, ett_tag_measure_report_basic_map_tree);
8640             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_bss, tvb, offset, 1, ENC_NA);
8641             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_odfm, tvb, offset, 1, ENC_NA);
8642             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_unident_signal, tvb, offset, 1, ENC_NA);
8643             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_radar, tvb, offset, 1, ENC_NA);
8644             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_unmeasured, tvb, offset, 1, ENC_NA);
8645             proto_tree_add_item(sub_tree_map_field, hf_ieee80211_tag_measure_map_field_reserved, tvb, offset, 1, ENC_NA);
8646             break;
8647           }
8648           case 1: /* Clear channel assessment (CCA) report */
8649             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8650             offset += 1;
8651
8652             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8653             offset += 8;
8654
8655             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8656             offset += 2;
8657
8658             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_cca_busy_fraction, tvb, offset, 1, ENC_NA);
8659             offset += 1;
8660             break;
8661           case 2: /* Receive power indication (RPI) histogram report */
8662             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8663             offset += 1;
8664
8665             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8666             offset += 8;
8667
8668             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8669             offset += 2;
8670
8671             parent_item = proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report, tvb, offset, 8, ENC_NA);
8672             sub_tree = proto_item_add_subtree(parent_item, ett_tag_measure_report_rpi_tree);
8673
8674             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_0, tvb, offset, 1, ENC_NA);
8675             offset += 1;
8676
8677             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_1, tvb, offset, 1, ENC_NA);
8678             offset += 1;
8679
8680             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_2, tvb, offset, 1, ENC_NA);
8681             offset += 1;
8682
8683             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_3, tvb, offset, 1, ENC_NA);
8684             offset += 1;
8685
8686             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_4, tvb, offset, 1, ENC_NA);
8687             offset += 1;
8688
8689             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_5, tvb, offset, 1, ENC_NA);
8690             offset += 1;
8691
8692             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_6, tvb, offset, 1, ENC_NA);
8693             offset += 1;
8694
8695             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_rpi_histogram_report_7, tvb, offset, 1, ENC_NA);
8696             offset += 1;
8697             break;
8698           case 3: /* Channel Load Report */
8699           {
8700             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
8701             offset += 1;
8702
8703             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8704             offset += 1;
8705
8706             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8707             offset += 8;
8708
8709             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8710             offset += 2;
8711
8712             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_load, tvb, offset, 1, ENC_NA);
8713             offset += 1;
8714
8715             /* TODO Add Optional Subelements */
8716             break;
8717           }
8718           case 4: /* Noise Histogram Report */
8719             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
8720             offset += 1;
8721
8722             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8723             offset += 1;
8724
8725             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8726             offset += 8;
8727
8728             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8729             offset += 2;
8730
8731             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ant_id, tvb, offset, 1, ENC_NA);
8732             offset += 1;
8733
8734             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_anpi, tvb, offset, 1, ENC_NA);
8735             offset += 1;
8736
8737             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_0, tvb, offset, 1, ENC_NA);
8738             offset += 1;
8739
8740             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_1, tvb, offset, 1, ENC_NA);
8741             offset += 1;
8742
8743             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_2, tvb, offset, 1, ENC_NA);
8744             offset += 1;
8745
8746             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_3, tvb, offset, 1, ENC_NA);
8747             offset += 1;
8748
8749             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_4, tvb, offset, 1, ENC_NA);
8750             offset += 1;
8751
8752             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_5, tvb, offset, 1, ENC_NA);
8753             offset += 1;
8754
8755             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_6, tvb, offset, 1, ENC_NA);
8756             offset += 1;
8757
8758             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_7, tvb, offset, 1, ENC_NA);
8759             offset += 1;
8760
8761             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_8, tvb, offset, 1, ENC_NA);
8762             offset += 1;
8763
8764             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_9, tvb, offset, 1, ENC_NA);
8765             offset += 1;
8766
8767             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ipi_density_10, tvb, offset, 1, ENC_NA);
8768             offset += 1;
8769
8770             /* TODO Add Optional Subelements */
8771             break;
8772           case 5: /* Beacon Report */
8773           {
8774             proto_tree *sub_tree_frame_info;
8775
8776             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
8777             offset += 1;
8778
8779             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8780             offset += 1;
8781
8782             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8783             offset += 8;
8784
8785             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8786             offset += 2;
8787
8788             parent_item = proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_frame_info, tvb, offset, 1, ENC_NA);
8789             sub_tree_frame_info = proto_item_add_subtree(parent_item, ett_tag_measure_report_frame_tree);
8790             proto_tree_add_item(sub_tree_frame_info, hf_ieee80211_tag_measure_report_frame_info_phy_type, tvb, offset, 1, ENC_NA);
8791             proto_tree_add_item(sub_tree_frame_info, hf_ieee80211_tag_measure_report_frame_info_frame_type, tvb, offset, 1, ENC_NA);
8792             offset += 1;
8793
8794             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_rcpi, tvb, offset, 1, ENC_NA);
8795             offset += 1;
8796
8797             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_rsni, tvb, offset, 1, ENC_NA);
8798             offset += 1;
8799
8800             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_bssid, tvb, offset, 6, ENC_NA);
8801             offset += 6;
8802
8803             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_ant_id, tvb, offset, 1, ENC_NA);
8804             offset += 1;
8805
8806             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_parent_tsf, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8807             offset += 4;
8808             /* TODO Add Optional Subelements */
8809             break;
8810           }
8811           case 6: /* Frame Report */
8812             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_regulatory_class, tvb, offset, 1, ENC_NA);
8813             offset += 1;
8814
8815             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_channel_number, tvb, offset, 1, ENC_NA);
8816             offset += 1;
8817
8818             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_start_time, tvb, offset, 8, ENC_LITTLE_ENDIAN);
8819             offset += 8;
8820
8821             proto_tree_add_item(sub_tree, hf_ieee80211_tag_measure_report_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8822             offset += 2;
8823
8824             /* TODO Add Optional Subelements */
8825             break;
8826           case 7: /* BSTA Statistics Report */
8827             /* TODO */
8828           case 8: /* Location Configuration Information Report element */
8829             /* TODO */
8830           case 9: /* Transmit Stream Measurement Report */
8831             /* TODO */
8832           default: /* unknown */
8833             break;
8834         }
8835       }
8836
8837     case TAG_QUIET: /* 7.3.2.23 Quiet element (40) */
8838       if (tag_len != 6)
8839       {
8840         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 6", tag_len);
8841         break;
8842       }
8843       offset += 2;
8844
8845       proto_tree_add_item(tree, hf_ieee80211_tag_quiet_count, tvb, offset, 1, ENC_NA);
8846       proto_item_append_text(ti, " Count: %d", tvb_get_guint8(tvb, offset));
8847       offset += 1;
8848
8849       proto_tree_add_item(tree, hf_ieee80211_tag_quiet_period, tvb, offset, 1, ENC_NA);
8850       proto_item_append_text(ti, " Period: %d", tvb_get_guint8(tvb, offset));
8851       offset += 1;
8852
8853       proto_tree_add_item(tree, hf_ieee80211_tag_quiet_duration, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8854       proto_item_append_text(ti, " Duration: %d", tvb_get_letohs(tvb, offset));
8855       offset += 2;
8856
8857       proto_tree_add_item(tree, hf_ieee80211_tag_quiet_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
8858       proto_item_append_text(ti, " Offset: %d", tvb_get_letohs(tvb, offset));
8859       offset += 2;
8860       break;
8861
8862
8863     case TAG_IBSS_DFS: /* 7.3.2.24 IBSS DFS element (41) */
8864       if (tag_len < 7)
8865       {
8866         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be >= 7", tag_len);
8867         break;
8868       }
8869       {
8870         proto_item *ti_sup_map;
8871         proto_tree *sub_map_tree;
8872         offset += 2;
8873
8874         proto_tree_add_item(tree, hf_ieee80211_tag_dfs_owner, tvb, offset, 6, ENC_NA);
8875         proto_item_append_text(ti, " Owner: %s", tvb_ether_to_str(tvb, offset));
8876         offset += 6;
8877
8878         proto_tree_add_item(tree, hf_ieee80211_tag_dfs_recovery_interval, tvb, offset, 1, ENC_NA);
8879         offset += 1;
8880
8881         while(offset < tag_end)
8882         {
8883           ti_sup_map = proto_tree_add_item(tree, hf_ieee80211_tag_dfs_channel_map, tvb, offset, 2, ENC_NA);
8884           sub_map_tree = proto_item_add_subtree(ti_sup_map, ett_tag_dfs_map_tree);
8885           proto_tree_add_item(sub_map_tree, hf_ieee80211_tag_dfs_channel_number, tvb, offset, 1, ENC_NA);
8886           proto_tree_add_item(sub_map_tree, hf_ieee80211_tag_dfs_map, tvb, offset, 1, ENC_NA);
8887           offset += 2;
8888         }
8889         break;
8890       }
8891     case TAG_ERP_INFO: /* 7.3.2.13 ERP Information element (42) */
8892     case TAG_ERP_INFO_OLD:
8893       if (tag_len != 1)
8894       {
8895         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
8896         break;
8897       }
8898       {
8899         proto_item *ti_erp;
8900         proto_tree *erp_tree;
8901
8902         offset += 2;
8903
8904         ti_erp = proto_tree_add_item(tree, hf_ieee80211_tag_erp_info, tvb, offset, 1, ENC_NA);
8905         erp_tree = proto_item_add_subtree(ti_erp, ett_tag_erp_info_tree);
8906         proto_tree_add_item(erp_tree, hf_ieee80211_tag_erp_info_erp_present, tvb, offset, 1, ENC_NA);
8907         proto_tree_add_item(erp_tree, hf_ieee80211_tag_erp_info_use_protection, tvb, offset, 1, ENC_NA);
8908         proto_tree_add_item(erp_tree, hf_ieee80211_tag_erp_info_barker_preamble_mode, tvb, offset, 1, ENC_NA);
8909         proto_tree_add_item(erp_tree, hf_ieee80211_tag_erp_info_reserved, tvb, offset, 1, ENC_NA);
8910         offset += 1;
8911         break;
8912       }
8913
8914     case TAG_TS_DELAY: /* 7.3.2.32 TS Delay element (43) */
8915       if (tag_len != 4)
8916       {
8917         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 4", tag_len);
8918         break;
8919       }
8920       offset += 2;
8921
8922       proto_tree_add_item(tree, hf_ieee80211_ts_delay, tvb, offset, 4, ENC_LITTLE_ENDIAN);
8923       proto_item_append_text(ti, " : %d", tvb_get_ntohl(tvb, offset) );
8924       offset += 4;
8925       break;
8926
8927     case TAG_TCLAS_PROCESS: /* 7.3.2.33 TCLAS Processing element (44) */
8928       if (tag_len != 1)
8929       {
8930         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
8931         break;
8932       }
8933       offset += 2;
8934
8935       proto_tree_add_item(tree, hf_ieee80211_tclas_process, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8936       proto_item_append_text(ti, " : %s", val_to_str(tvb_get_guint8(tvb, offset), ieee80211_tclas_process_flag, "Unknown %d"));
8937       offset += 1;
8938       break;
8939
8940     case TAG_QOS_CAPABILITY: /* 7.3.2.35 QoS Capability element (46) */
8941       if (tag_len != 1)
8942       {
8943         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
8944         break;
8945       }
8946       {
8947         /* proto_item *ti_cap;
8948         proto_tree *cap_tree; */
8949         offset += 2;
8950         offset = dissect_qos_capability(tree, tvb, offset, ftype);
8951       }
8952       break;
8953
8954     case TAG_RSN_IE: /* 7.3.2.25 RSN information element (48) */
8955       if (tag_len < 20)
8956       {
8957         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be >= 20", tag_len);
8958         break;
8959       }
8960       offset += 2;
8961
8962       offset = dissect_rsn_ie(pinfo, tree, tvb, offset, tag_len);
8963       break;
8964
8965     case TAG_EXT_SUPP_RATES: /* 7.3.2.14 Extended Supported Rates element (50) */
8966       if(tag_len < 1)
8967       {
8968         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be greater than 0", tag_len);
8969         break;
8970       }
8971       offset += 2;
8972
8973       while(offset < tag_end)
8974       {
8975         proto_tree_add_item(tree, hf_ieee80211_tag_ext_supp_rates, tvb, offset, 1, ENC_NA);
8976         proto_item_append_text(ti, " %s,", val_to_str_const(tvb_get_guint8(tvb, offset), ieee80211_supported_rates_vals, "Unknown Rate") );
8977         offset += 1;
8978       }
8979       proto_item_append_text(ti, " [Mbit/sec]");
8980       break;
8981
8982     case TAG_EXTENDED_CAPABILITIES: /* 7.3.2.27 Extended Capabilities information element (127) */
8983     {
8984       proto_item *ti_ex_cap;
8985       proto_tree *ex_cap_tree;
8986
8987       if (tag_len < 1)
8988       {
8989         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag length %u too short, must be greater than 0", tag_len);
8990         break;
8991       }
8992       offset += 2;
8993
8994       /* Extended Capability octet 0 */
8995       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
8996       proto_item_append_text(ti_ex_cap, " (octet 0)");
8997       ex_cap_tree = proto_item_add_subtree (ti_ex_cap, ett_tag_ex_cap);
8998       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b0, tvb, offset, 1, ENC_NA);
8999       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b1, tvb, offset, 1, ENC_NA);
9000       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b2, tvb, offset, 1, ENC_NA);
9001       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b3, tvb, offset, 1, ENC_NA);
9002       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b4, tvb, offset, 1, ENC_NA);
9003       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b6, tvb, offset, 1, ENC_NA);
9004       offset += 1;
9005
9006       /* Extended Capability octet 1 */
9007       if (offset >= tag_end) {
9008         break;
9009       }
9010       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9011       proto_item_append_text(ti_ex_cap, " (octet 1)");
9012       offset += 1;
9013
9014       /* Extended Capability octet 2 */
9015       if (offset >= tag_end) {
9016         break;
9017       }
9018       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9019       proto_item_append_text(ti_ex_cap, " (octet 2)");
9020       offset += 1;
9021
9022       /* Extended Capability octet 3 */
9023       if (offset >= tag_end) {
9024         break;
9025       }
9026       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9027       proto_item_append_text(ti_ex_cap, " (octet 3)");
9028       ex_cap_tree = proto_item_add_subtree(ti_ex_cap, ett_tag_ex_cap);
9029       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b27, tvb, offset, 1, ENC_NA);
9030       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b28, tvb, offset, 1, ENC_NA);
9031       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b29, tvb, offset, 1, ENC_NA);
9032       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b30, tvb, offset, 1, ENC_NA);
9033       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b31, tvb, offset, 1, ENC_NA);
9034       offset += 1;
9035
9036       /* Extended Capability octet 4 */
9037       if (offset >= tag_end) {
9038         break;
9039       }
9040       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9041       proto_item_append_text(ti_ex_cap, " (octet 4)");
9042       ex_cap_tree = proto_item_add_subtree(ti_ex_cap, ett_tag_ex_cap);
9043       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b32, tvb, offset, 1, ENC_NA);
9044       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b33, tvb, offset, 1, ENC_NA);
9045       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b34, tvb, offset, 1, ENC_NA);
9046       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b36, tvb, offset, 1, ENC_NA);
9047       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b37, tvb, offset, 1, ENC_NA);
9048       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b38, tvb, offset, 1, ENC_NA);
9049       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b39, tvb, offset, 1, ENC_NA);
9050       offset += 1;
9051
9052       /* Extended Capability octet 5 */
9053       if (offset >= tag_end) {
9054         break;
9055       }
9056       ti_ex_cap = proto_tree_add_item(tree, hf_ieee80211_tag_extended_capabilities, tvb, offset, 1, ENC_NA);
9057       proto_item_append_text(ti_ex_cap, " (octet 5)");
9058       ex_cap_tree = proto_item_add_subtree(ti_ex_cap, ett_tag_ex_cap);
9059       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_b40, tvb, offset, 1, ENC_NA);
9060       proto_tree_add_item(ex_cap_tree, hf_ieee80211_tag_extended_capabilities_serv_int_granularity, tvb, offset, 1, ENC_NA);
9061       offset += 1;
9062
9063       break;
9064
9065     case TAG_CISCO_CCX1_CKIP: /* Cisco CCX1 CKIP + Device Name (133) */
9066       /* From WCS manual:
9067        * If Aironet IE support is enabled, the access point sends an Aironet
9068        * IE 0x85 (which contains the access point name, load, number of
9069        * associated clients, and so on) in the beacon and probe responses of
9070        * this WLAN, and the controller sends Aironet IEs 0x85 and 0x95
9071        * (which contains the management IP address of the controller and
9072        * the IP address of the access point) in the reassociation response
9073        * if it receives Aironet IE 0x85 in the reassociation request.
9074        */
9075
9076       if (tag_len < 26)
9077       {
9078         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u too short, must be >= 26", tag_len);
9079         break;
9080       }
9081       offset += 2;
9082       proto_tree_add_item(tree, hf_ieee80211_tag_cisco_ccx1_unknown, tvb, offset, 10, ENC_NA);
9083       offset += 10;
9084
9085       /* The Name of the sending device starts at offset 10 and is up to
9086          15 or 16 bytes in length, \0 padded */
9087       proto_tree_add_item(tree, hf_ieee80211_tag_cisco_ccx1_name, tvb, offset, 16, ENC_ASCII|ENC_NA);
9088       offset += 16;
9089
9090       /* Total number off associated clients and repeater access points */
9091       proto_tree_add_item(tree, hf_ieee80211_tag_cisco_ccx1_clients, tvb, offset, 1, ENC_NA);
9092       offset += 1;
9093       break;
9094
9095     case TAG_VENDOR_SPECIFIC_IE: /* 7.3.2.26 Vendor Specific information element (221) */
9096       if (tag_len < 3)
9097       {
9098         expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be >= 3", tag_len);
9099         break;
9100       }
9101       {
9102
9103         offset += 2;
9104         oui = tvb_get_ntoh24(tvb, offset);
9105         tag_tvb = tvb_new_subset(tvb, offset, tag_len, tag_len);
9106         proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
9107         proto_item_append_text(ti, ": %s", uint_get_manuf_name(oui));
9108
9109         if (tag_len > 3) {
9110           proto_tree_add_item(ti, hf_ieee80211_tag_vendor_oui_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
9111         }
9112
9113       switch (oui) {
9114         /* 802.11 specific vendor ids */
9115 #       define WPAWME_OUI  0x0050F2
9116 #       define RSNOUI_VAL  0x000FAC
9117 #       define PRE11N_OUI  0x00904c
9118         case WPAWME_OUI:
9119           offset = dissect_vendor_ie_wpawme(tree, tvb, offset + 3, tag_len, ftype);
9120           break;
9121         case RSNOUI_VAL:
9122           dissect_vendor_ie_rsn(ti, tree, tag_tvb);
9123           break;
9124         case PRE11N_OUI:
9125           dissect_vendor_ie_ht(tvb, pinfo, tree, offset, ti, ti_len, tag_len);
9126           break;
9127         case OUI_WFA:
9128           dissect_vendor_ie_wfa(pinfo, ti, tag_tvb);
9129           break;
9130
9131         /* Normal IEEE vendor ids (from oui.h) */
9132         case OUI_CISCOWL:  /* Cisco Wireless (Aironet) */
9133           dissect_vendor_ie_aironet(ti, tree, tvb, offset + 3, tag_len - 3);
9134           break;
9135         case OUI_MARVELL:
9136           dissect_vendor_ie_marvell(ti, tree, tvb, offset + 3, tag_len - 3);
9137           break;
9138         case OUI_ATHEROS:
9139           dissect_vendor_ie_atheros(ti, tree, tvb, offset + 3, tag_len - 3, pinfo, ti_len);
9140           break;
9141         default:
9142           proto_tree_add_string (tree, hf_ieee80211_tag_interpretation, tvb, offset + 3,
9143             tag_len - 3, "Not interpreted");
9144           break;
9145         }
9146
9147       }
9148       break;
9149
9150     case TAG_MOBILITY_DOMAIN:
9151       dissect_mobility_domain(tree, tvb, offset + 2, tag_len);
9152       break;
9153
9154     case TAG_FAST_BSS_TRANSITION:
9155       dissect_fast_bss_transition(tree, tvb, offset + 2, tag_len);
9156       break;
9157
9158     case TAG_MMIE:
9159       dissect_mmie(tree, tvb, offset + 2, tag_len);
9160       break;
9161
9162     case TAG_TIME_ZONE:
9163       dissect_time_zone(tree, tvb, offset + 2, tag_len);
9164       break;
9165
9166     case TAG_TIMEOUT_INTERVAL:
9167       dissect_timeout_interval(tree, tvb, offset + 2, tag_len);
9168       break;
9169
9170     case TAG_LINK_IDENTIFIER:
9171       dissect_link_identifier(tree, tvb, offset + 2, tag_len);
9172       break;
9173
9174     case TAG_WAKEUP_SCHEDULE:
9175       dissect_wakeup_schedule(tree, tvb, offset + 2, tag_len);
9176       break;
9177
9178     case TAG_CHANNEL_SWITCH_TIMING:
9179       dissect_channel_switch_timing(tree, tvb, offset + 2, tag_len);
9180       break;
9181
9182     case TAG_PTI_CONTROL:
9183       dissect_pti_control(tree, tvb, offset + 2, tag_len);
9184       break;
9185
9186     case TAG_PU_BUFFER_STATUS:
9187       dissect_pu_buffer_status(tree, tvb, offset + 2, tag_len);
9188       break;
9189
9190     case TAG_HT_CAPABILITY:
9191       dissect_ht_capability_ie(tvb, pinfo, tree, offset+2, tag_len, ti_len, FALSE);
9192       break;
9193
9194     case TAG_HT_INFO:
9195       dissect_ht_info_ie_1_1(tvb, pinfo, tree, offset + 2, tag_len, ti_len);
9196       break;
9197
9198     case TAG_SECONDARY_CHANNEL_OFFSET:
9199       dissect_secondary_channel_offset_ie(tvb, pinfo, tree, offset + 2, tag_len, ti_len);
9200       break;
9201
9202     case TAG_TIME_ADV:
9203       dissect_time_adv(tree, tvb, offset + 2);
9204       break;
9205
9206     case TAG_MESH_PEERING_MGMT:
9207       {
9208         guint start = offset + 2;
9209         offset += 2;
9210         proto_tree_add_item (tree, hf_ieee80211_mesh_peering_proto, tvb, offset, 2, ENC_LITTLE_ENDIAN);
9211         offset += 2;
9212         proto_tree_add_item (tree, hf_ieee80211_mesh_peering_local_link_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
9213         offset += 2;
9214         switch (tvb_get_guint8(tvb, 1))
9215           {                                         /* Self-protected action field */
9216           case SELFPROT_ACTION_MESH_PEERING_OPEN:
9217             break;
9218
9219           case SELFPROT_ACTION_MESH_PEERING_CONFIRM:
9220             proto_tree_add_item (tree, hf_ieee80211_mesh_peering_peer_link_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
9221             offset += 2;
9222             break;
9223
9224           case SELFPROT_ACTION_MESH_PEERING_CLOSE:
9225             if (tag_len == 8 || tag_len == 24)
9226               {
9227                 proto_tree_add_item (tree, hf_ieee80211_mesh_peering_peer_link_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
9228                 offset += 2;
9229               }
9230             offset += add_fixed_field(tree, tvb, offset, FIELD_REASON_CODE);
9231             break;
9232
9233           /* unexpected values */
9234           default:
9235             proto_tree_add_text (tree, tvb, offset, tag_len, "Unexpected Self-protected action");
9236             offset += tag_len;
9237             break;
9238           }
9239         if (tag_len - (offset - start) == 16)
9240           {
9241             proto_tree_add_item(tree, hf_ieee80211_rsn_pmkid, tvb, offset, 16, ENC_NA);
9242             offset +=16;
9243           }
9244         break;
9245       }
9246
9247     case TAG_MESH_CONFIGURATION:
9248       {
9249         offset += 2;
9250         proto_tree_add_item (tree, hf_ieee80211_mesh_config_path_sel_protocol, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9251         proto_tree_add_item (tree, hf_ieee80211_mesh_config_path_sel_metric, tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
9252         proto_tree_add_item (tree, hf_ieee80211_mesh_config_congestion_control, tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
9253         proto_tree_add_item (tree, hf_ieee80211_mesh_config_sync_method, tvb, offset + 3, 1, ENC_LITTLE_ENDIAN);
9254         proto_tree_add_item (tree, hf_ieee80211_mesh_config_auth_protocol, tvb, offset + 4, 1, ENC_LITTLE_ENDIAN);
9255         proto_tree_add_item (tree, hf_ieee80211_mesh_config_formation_info, tvb, offset + 5, 1, ENC_LITTLE_ENDIAN);
9256         proto_tree_add_item (tree, hf_ieee80211_mesh_config_capability, tvb, offset + 6, 1, ENC_LITTLE_ENDIAN);
9257         break;
9258       }
9259
9260     case TAG_MESH_ID:
9261       {
9262         offset += 2;
9263
9264         proto_tree_add_item(tree, hf_ieee80211_mesh_id, tvb, offset, tag_len, ENC_ASCII|ENC_NA);
9265         if (tag_len > 0) {
9266             col_append_fstr(pinfo->cinfo, COL_INFO, ", MESHID=%s", tvb_get_ephemeral_string(tvb, offset, tag_len));
9267             proto_item_append_text(ti, ": %s", tvb_get_ephemeral_string(tvb, offset, tag_len));
9268         }
9269
9270       break;
9271       }
9272
9273     case TAG_MESH_PREQ:
9274       {
9275         guint8 flags = tvb_get_guint8(tvb, offset + 2);
9276         guint8 targs, i;
9277         proto_item *item;
9278         proto_tree *subtree;
9279
9280         offset += 2;
9281         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9282         offset += 1;
9283         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_hopcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9284         offset += 1;
9285         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_ttl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9286         offset += 1;
9287         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_pdid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9288         offset += 4;
9289         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_sta, tvb, offset, 6, ENC_NA);
9290         offset += 6;
9291         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9292         offset += 4;
9293
9294         if (flags & (1<<6)) {
9295           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_ext, tvb, offset, 6, ENC_NA);
9296           offset += 6;
9297         }
9298         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_lifetime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9299         offset += 4;
9300         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9301         offset += 4;
9302         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_count, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9303         targs = tvb_get_guint8 (tvb, offset);
9304         offset += 1;
9305         for (i = 0; i < targs; i++) {
9306           item = proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9307           subtree = proto_item_add_subtree(item, ett_hwmp_targ_flags_tree);
9308           proto_tree_add_boolean(subtree, hf_ieee80211_ff_hwmp_targ_to_flags, tvb, offset, 1, flags);
9309           proto_tree_add_boolean(subtree, hf_ieee80211_ff_hwmp_targ_usn_flags, tvb, offset, 1, flags);
9310           offset += 1;
9311           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sta, tvb, offset, 6, ENC_NA);
9312           offset += 6;
9313           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9314           offset += 4;
9315         }
9316         break;
9317       }
9318
9319     case TAG_MESH_PREP:
9320       {
9321         guint8 flags = tvb_get_guint8(tvb, offset + 2);
9322         offset += 2;
9323         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9324         offset += 1;
9325         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_hopcount, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9326         offset += 1;
9327         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_ttl, tvb, offset , 1, ENC_LITTLE_ENDIAN);
9328         offset += 1;
9329         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sta, tvb, offset, 6, ENC_NA);
9330         offset += 6;
9331         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9332         offset += 4;
9333         if (flags & (1<<6)) {
9334           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_ext, tvb, offset, 6, ENC_NA);
9335           offset += 6;
9336         }
9337         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_lifetime, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9338         offset += 4;
9339         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9340         offset += 4;
9341         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_sta, tvb, offset, 6, ENC_NA);
9342         offset += 6;
9343         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_orig_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9344         offset += 4;
9345         break;
9346       }
9347
9348     case TAG_MESH_PERR:
9349       {
9350         guint8 targs, i;
9351
9352         offset += 2;
9353         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_ttl, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9354         offset += 1;
9355         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_count, tvb, offset, 1, ENC_BIG_ENDIAN);
9356         targs = tvb_get_guint8 (tvb, offset);
9357         offset += 1;
9358         for (i = 0; i < targs; i++) {
9359           guint8 flags = tvb_get_guint8(tvb, offset);
9360
9361           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9362           offset += 1;
9363           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sta, tvb, offset, 6, ENC_NA);
9364           offset += 6;
9365           proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9366           offset += 4;
9367           if (flags & (1<<6)) {
9368             proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_targ_ext, tvb, offset, 6, ENC_NA);
9369             offset += 6;
9370           }
9371           offset += add_fixed_field(tree, tvb, offset, FIELD_REASON_CODE);
9372         }
9373         break;
9374       }
9375
9376     case TAG_RANN:
9377       {
9378         offset += 2;
9379         proto_tree_add_item (tree, hf_ieee80211_rann_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
9380         offset += 1;
9381         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_hopcount, tvb, offset, 1, ENC_BIG_ENDIAN);
9382         offset += 1;
9383         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_ttl, tvb, offset, 1, ENC_BIG_ENDIAN);
9384         offset += 1;
9385         proto_tree_add_item (tree, hf_ieee80211_rann_root_sta, tvb, offset, 6, ENC_NA);
9386         offset += 6;
9387         proto_tree_add_item (tree, hf_ieee80211_rann_sn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9388         offset += 4;
9389         proto_tree_add_item (tree, hf_ieee80211_rann_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9390         offset += 4;
9391         proto_tree_add_item (tree, hf_ieee80211_ff_hwmp_metric, tvb, offset, 4, ENC_LITTLE_ENDIAN);
9392         offset += 4;
9393         break;
9394       }
9395       break;
9396     }
9397
9398     case TAG_INTERWORKING:
9399       dissect_interworking(pinfo, tree, ti, tvb, offset);
9400       break;
9401     case TAG_ADVERTISEMENT_PROTOCOL:
9402     {
9403       dissect_advertisement_protocol(pinfo, tree, tvb, offset, NULL);
9404       break;
9405     }
9406     case TAG_ROAMING_CONSORTIUM:
9407       dissect_roaming_consortium(pinfo, tree, ti, tvb, offset);
9408       break;
9409     case TAG_AP_CHANNEL_REPORT: /* 7.3.2.36 AP Channel Report element */
9410       dissect_ap_channel_report(tvb, pinfo, tree, offset + 2, tag_len, ti_len, tag_end, ti);
9411       break;
9412     case TAG_NEIGHBOR_REPORT:
9413     {
9414       #define SUB_TAG_TSF_INFO                 0x01
9415       #define SUB_TAG_MEASUREMENT_PILOT_INFO   0x02
9416       #define SUB_TAG_HT_CAPABILITIES          0x03
9417       #define SUB_TAG_HT_INFO                  0x04
9418       #define SUB_TAG_SEC_CHANNEL_OFFSET       0x05
9419       #define SUB_TAG_VENDOR_SPECIFIC          0xDD
9420
9421
9422       guint tag_offset;
9423       guint8 sub_tag_id;
9424       guint32 bssid_info, info, sub_tag_length;
9425       proto_item *parent_item;
9426       proto_tree *bssid_info_subtree, *sub_tag_tree;
9427       tvbuff_t *volatile sub_tag_tvb = NULL;
9428
9429       if (tag_len < 13)
9430       {
9431         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
9432             "Neighbor Report: Error: Tag length must be at least 13 bytes long");
9433         break;
9434       }
9435       offset+=2;
9436       tag_offset = offset;
9437
9438       proto_tree_add_item(tree, hf_ieee80211_tag_neighbor_report_bssid, tvb, offset, 6, ENC_NA);
9439
9440       /*** Begin: BSSID Information ***/
9441       offset+=6;
9442       bssid_info = tvb_get_letohl (tvb, offset);
9443       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);
9444       bssid_info_subtree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_bssid_info_tree);
9445
9446       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_reachability, tvb, offset, 1, bssid_info);
9447       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_security, tvb, offset, 1, bssid_info);
9448       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_key_scope, tvb, offset, 1, bssid_info);
9449       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_spec_mng, tvb, offset, 1, bssid_info);
9450       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_qos, tvb, offset, 1, bssid_info);
9451       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_apsd, tvb, offset, 1, bssid_info);
9452       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_radio_msnt, tvb, offset, 1, bssid_info);
9453       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_dback, tvb, offset+1, 1, bssid_info);
9454       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_capability_iback, tvb, offset+1, 1, bssid_info);
9455       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_mobility_domain, tvb, offset+1, 1, bssid_info);
9456       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_high_throughput, tvb, offset+1, 1, bssid_info);
9457       proto_tree_add_uint(bssid_info_subtree, hf_ieee80211_tag_neighbor_report_bssid_info_reserved, tvb, offset+1, 3, (bssid_info & 0xfffff000) >> 12);
9458       /*** End: BSSID Information ***/
9459
9460       offset+=4;
9461       info = tvb_get_guint8 (tvb, offset);
9462       proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_reg_class, tvb, offset, 1, info, "Regulatory Class: 0x%02X", info);
9463
9464       offset++;
9465       info = tvb_get_guint8 (tvb, offset);
9466       proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_channel_number, tvb, offset, 1, info, "Channel Number: 0x%02X", info);
9467
9468       offset++;
9469       info = tvb_get_guint8 (tvb, offset);
9470       proto_tree_add_uint_format(tree, hf_ieee80211_tag_neighbor_report_phy_type, tvb, offset, 1, info, "PHY Type: 0x%02X", info);
9471
9472       offset++;
9473       sub_tag_id = tvb_get_guint8 (tvb, offset);
9474       offset++;
9475       sub_tag_length = tvb_get_guint8 (tvb, offset);
9476
9477       offset++;
9478       sub_tag_tvb = tvb_new_subset(tvb, offset, sub_tag_length, -1);
9479
9480       switch (sub_tag_id) {
9481         case SUB_TAG_TSF_INFO:
9482           /* TODO */
9483           break;
9484         case SUB_TAG_MEASUREMENT_PILOT_INFO:
9485           /* TODO */
9486           break;
9487         case SUB_TAG_HT_CAPABILITIES:
9488           parent_item = proto_tree_add_text (tree, tvb, offset, sub_tag_length, "HT Capabilities");
9489           sub_tag_tree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_sub_tag_tree);
9490           dissect_ht_capability_ie(sub_tag_tvb, pinfo, sub_tag_tree, 0, sub_tag_length, ti_len, FALSE);
9491           break;
9492         case SUB_TAG_HT_INFO:
9493           parent_item = proto_tree_add_text (tree, tvb, offset, sub_tag_length, "HT Information");
9494           sub_tag_tree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_sub_tag_tree);
9495           dissect_ht_info_ie_1_1(sub_tag_tvb, pinfo, sub_tag_tree, 0, sub_tag_length, ti_len);
9496           break;
9497         case SUB_TAG_SEC_CHANNEL_OFFSET:
9498           parent_item = proto_tree_add_text (tree, tvb, offset, sub_tag_length, "Secondary Channel Offset");
9499           sub_tag_tree = proto_item_add_subtree(parent_item, ett_tag_neighbor_report_sub_tag_tree);
9500           dissect_secondary_channel_offset_ie(sub_tag_tvb, pinfo, sub_tag_tree, 0, sub_tag_length, ti_len);
9501           break;
9502         case SUB_TAG_VENDOR_SPECIFIC:
9503         default:
9504           break;
9505       }
9506
9507       offset += sub_tag_length;
9508
9509       if (tag_len > (offset - tag_offset))
9510       {
9511         proto_tree_add_text (tree, tvb, offset, tag_len - (offset - tag_offset), "Unknown Data");
9512         break;
9513       }
9514       break;
9515     }
9516
9517     case TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT:
9518     {
9519       guint tag_offset;
9520
9521       if (tag_len != 4)
9522       {
9523         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
9524             "Extended Channel Switch Announcement: Error: Tag length must be exactly 4 bytes long");
9525         break;
9526       }
9527
9528       offset+=2;
9529       tag_offset = offset;
9530
9531       offset+= add_fixed_field(tree, tvb, offset, FIELD_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT);
9532
9533       if (tag_len > (offset - tag_offset))
9534       {
9535         proto_tree_add_text (tree, tvb, offset, tag_len - (offset - tag_offset), "Unknown Data");
9536         break;
9537       }
9538       break;
9539     }
9540     case TAG_SUPPORTED_REGULATORY_CLASSES:
9541     {
9542       guint8 current_field;
9543       guint i;
9544
9545       if (tag_len < 2) {
9546         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
9547             "Supported Regulatory Classes: Error: Tag length must be at least 2 bytes long");
9548         break;
9549       } else if (tag_len > 32) {
9550         proto_tree_add_text (tree, tvb, offset + 2, tag_len,
9551             "Supported Regulatory Classes: Error: Tag length must be no more than 32 bytes long");
9552         break;
9553       }
9554
9555       offset+=2;
9556
9557       current_field = tvb_get_guint8 (tvb, offset);
9558       proto_tree_add_uint(tree, hf_ieee80211_tag_supported_reg_classes_current, tvb, offset, 1, current_field);
9559
9560       offset++;
9561       /* Partially taken from the ssid section */
9562       tag_data_ptr = tvb_get_ptr (tvb, offset, tag_len);
9563       for (i = 0, n = 0; i < tag_len && n < SHORT_STR; i++) {
9564         ret = g_snprintf (print_buff + n, SHORT_STR - n, (i == tag_len-1)?"%d":"%d, ", tag_data_ptr[i]);
9565         if (ret >= SHORT_STR - n) {
9566           /* ret >= <buf_size> means buffer truncated  */
9567           break;
9568         }
9569         n += ret;
9570       }
9571       proto_tree_add_string (tree, hf_ieee80211_tag_supported_reg_classes_alternate, tvb, offset, tag_len, print_buff);
9572
9573       break;
9574     }
9575     default:
9576       tvb_ensure_bytes_exist (tvb, offset + 2, tag_len);
9577       proto_tree_add_string (tree, hf_ieee80211_tag_interpretation, tvb, offset + 1 + 1,
9578           tag_len, "Not interpreted");
9579       proto_item_append_text(ti, ": Tag %u Len %u", tag_no, tag_len);
9580       break;
9581   }
9582   if(offset < tag_end){
9583     /* TODO: add Expert info to indicate there is unknown data ! but all tagged option don't yet return offset.
9584       For the moment, this code only remove Clang Warnings about not used offset... */
9585   }
9586   return tag_len + 1 + 1;
9587 }
9588
9589 void
9590 ieee_80211_add_tagged_parameters (tvbuff_t * tvb, int offset, packet_info * pinfo,
9591   proto_tree * tree, int tagged_parameters_len, int ftype)
9592 {
9593   int next_len;
9594
9595   beacon_padding = 0; /* this is for the beacon padding confused with ssid fix */
9596   while (tagged_parameters_len > 0) {
9597     if ((next_len=add_tagged_field (pinfo, tree, tvb, offset, ftype))==0)
9598       break;
9599     if (next_len > tagged_parameters_len) {
9600       /* XXX - flag this as an error? */
9601       next_len = tagged_parameters_len;
9602     }
9603     offset += next_len;
9604     tagged_parameters_len -= next_len;
9605   }
9606 }
9607
9608 /* ************************************************************************* */
9609 /*                     Dissect 802.11 management frame                       */
9610 /* ************************************************************************* */
9611 static void
9612 dissect_ieee80211_mgt (guint16 fcf, tvbuff_t * tvb, packet_info * pinfo,
9613     proto_tree * tree)
9614 {
9615   proto_item *ti = NULL;
9616   proto_tree *mgt_tree;
9617   proto_tree *fixed_tree;
9618   proto_tree *tagged_tree;
9619   int offset = 0;
9620   int tagged_parameter_tree_len;
9621
9622   g_pinfo = pinfo;
9623   ieee80211_tvb_invalid = FALSE;
9624
9625   CHECK_DISPLAY_AS_X(data_handle,proto_wlan_mgt, tvb, pinfo, tree);
9626
9627   ti = proto_tree_add_item (tree, proto_wlan_mgt, tvb, 0, -1, ENC_NA);
9628   mgt_tree = proto_item_add_subtree (ti, ett_80211_mgt);
9629
9630   switch (COMPOSE_FRAME_TYPE(fcf))
9631   {
9632
9633     case MGT_ASSOC_REQ:
9634       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 4);
9635       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
9636       add_fixed_field(fixed_tree, tvb, 2, FIELD_LISTEN_IVAL);
9637       offset = 4;  /* Size of fixed fields */
9638
9639       tagged_parameter_tree_len =
9640           tvb_reported_length_remaining(tvb, offset);
9641       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9642                  tagged_parameter_tree_len);
9643       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9644           tagged_parameter_tree_len, MGT_ASSOC_REQ);
9645       break;
9646
9647
9648     case MGT_ASSOC_RESP:
9649       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 6);
9650       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
9651       add_fixed_field(fixed_tree, tvb, 2, FIELD_STATUS_CODE);
9652       add_fixed_field(fixed_tree, tvb, 4, FIELD_ASSOC_ID);
9653       offset = 6;  /* Size of fixed fields */
9654
9655       tagged_parameter_tree_len =
9656           tvb_reported_length_remaining(tvb, offset);
9657       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9658                  tagged_parameter_tree_len);
9659       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9660           tagged_parameter_tree_len, MGT_ASSOC_RESP);
9661       break;
9662
9663
9664     case MGT_REASSOC_REQ:
9665       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 10);
9666       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
9667       add_fixed_field(fixed_tree, tvb, 2, FIELD_LISTEN_IVAL);
9668       add_fixed_field(fixed_tree, tvb, 4, FIELD_CURRENT_AP_ADDR);
9669       offset = 10;  /* 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_REASSOC_REQ);
9677       break;
9678
9679     case MGT_REASSOC_RESP:
9680       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 6);
9681       add_fixed_field(fixed_tree, tvb, 0, FIELD_CAP_INFO);
9682       add_fixed_field(fixed_tree, tvb, 2, FIELD_STATUS_CODE);
9683       add_fixed_field(fixed_tree, tvb, 4, FIELD_ASSOC_ID);
9684       offset = 6;  /* Size of fixed fields */
9685
9686       tagged_parameter_tree_len =
9687           tvb_reported_length_remaining(tvb, offset);
9688       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9689                  tagged_parameter_tree_len);
9690       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9691           tagged_parameter_tree_len, MGT_REASSOC_RESP);
9692       break;
9693
9694
9695     case MGT_PROBE_REQ:
9696       offset = 0;
9697       tagged_parameter_tree_len =
9698           tvb_reported_length_remaining(tvb, offset);
9699       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9700                  tagged_parameter_tree_len);
9701       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9702           tagged_parameter_tree_len, MGT_PROBE_REQ);
9703       break;
9704
9705     case MGT_PROBE_RESP:
9706     {
9707       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 12);
9708       add_fixed_field(fixed_tree, tvb, 0, FIELD_TIMESTAMP);
9709       add_fixed_field(fixed_tree, tvb, 8, FIELD_BEACON_INTERVAL);
9710       add_fixed_field(fixed_tree, tvb, 10, FIELD_CAP_INFO);
9711       offset = 12;  /* Size of fixed fields */
9712
9713       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9714       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset, tagged_parameter_tree_len);
9715       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree, tagged_parameter_tree_len, MGT_PROBE_RESP);
9716       break;
9717     }
9718     case MGT_MEASUREMENT_PILOT:
9719     {
9720       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 12);
9721       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_TIMESTAMP);
9722       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_MEASUREMENT_PILOT_INT);
9723       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_BEACON_INTERVAL);
9724       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_CAP_INFO);
9725       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_COUNTRY_STR);
9726       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_MAX_REG_PWR);
9727       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_MAX_TX_PWR);
9728       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_TX_PWR_USED);
9729       offset += add_fixed_field(fixed_tree, tvb, offset, FIELD_TRANSCEIVER_NOISE_FLOOR);
9730       /* TODO DS Parameter Set ??? */
9731
9732       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9733       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset, tagged_parameter_tree_len);
9734       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree, tagged_parameter_tree_len, MGT_MEASUREMENT_PILOT);
9735       break;
9736     }
9737     case MGT_BEACON:    /* Dissect protocol payload fields  */
9738       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 12);
9739       add_fixed_field(fixed_tree, tvb, 0, FIELD_TIMESTAMP);
9740       add_fixed_field(fixed_tree, tvb, 8, FIELD_BEACON_INTERVAL);
9741       add_fixed_field(fixed_tree, tvb, 10, FIELD_CAP_INFO);
9742       offset = 12;  /* Size of fixed fields */
9743
9744       tagged_parameter_tree_len =
9745           tvb_reported_length_remaining(tvb, offset);
9746       tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9747       tagged_parameter_tree_len);
9748       ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9749       tagged_parameter_tree_len, MGT_BEACON);
9750       break;
9751
9752     case MGT_ATIM:
9753       break;
9754
9755     case MGT_DISASS:
9756       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 2);
9757       add_fixed_field(fixed_tree, tvb, 0, FIELD_REASON_CODE);
9758       offset = 2; /* Size of fixed fields */
9759       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9760       if (tagged_parameter_tree_len > 0) {
9761         tagged_tree = get_tagged_parameter_tree(mgt_tree, tvb, offset,
9762                                                 tagged_parameter_tree_len);
9763         ieee_80211_add_tagged_parameters(tvb, offset, pinfo, tagged_tree,
9764                                          tagged_parameter_tree_len, MGT_DISASS);
9765       }
9766       break;
9767
9768     case MGT_AUTHENTICATION:
9769       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 6);
9770       add_fixed_field(fixed_tree, tvb, 0, FIELD_AUTH_ALG);
9771       add_fixed_field(fixed_tree, tvb, 2, FIELD_AUTH_TRANS_SEQ);
9772       add_fixed_field(fixed_tree, tvb, 4, FIELD_STATUS_CODE);
9773       offset = 6;  /* Size of fixed fields */
9774
9775       tagged_parameter_tree_len =
9776         tvb_reported_length_remaining(tvb, offset);
9777       if (tagged_parameter_tree_len > 0)
9778       {
9779         tagged_tree = get_tagged_parameter_tree (mgt_tree,
9780             tvb,
9781             offset,
9782             tagged_parameter_tree_len);
9783         ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9784         tagged_parameter_tree_len, MGT_AUTHENTICATION);
9785       }
9786       break;
9787
9788     case MGT_DEAUTHENTICATION:
9789       fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 2);
9790       add_fixed_field(fixed_tree, tvb, 0, FIELD_REASON_CODE);
9791       offset = 2; /* Size of fixed fields */
9792       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9793       if (tagged_parameter_tree_len > 0) {
9794         tagged_tree = get_tagged_parameter_tree(mgt_tree, tvb, offset,
9795                                                 tagged_parameter_tree_len);
9796         ieee_80211_add_tagged_parameters(tvb, offset, pinfo, tagged_tree,
9797                                          tagged_parameter_tree_len, MGT_DEAUTHENTICATION);
9798       }
9799       break;
9800
9801     case MGT_ACTION:
9802     {
9803       proto_item *lcl_fixed_hdr;
9804       proto_tree *lcl_fixed_tree;
9805       lcl_fixed_hdr = proto_tree_add_text(mgt_tree, tvb, 0, 0, "Fixed parameters");
9806       lcl_fixed_tree = proto_item_add_subtree (lcl_fixed_hdr, ett_fixed_parameters);
9807
9808       offset += add_fixed_field(lcl_fixed_tree, tvb, 0, FIELD_ACTION);
9809
9810       proto_item_set_len(lcl_fixed_hdr, offset);
9811       if (ieee80211_tvb_invalid)
9812         break; /* Buffer not available for further processing */
9813       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9814       if (tagged_parameter_tree_len > 0)
9815       {
9816         tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9817           tagged_parameter_tree_len);
9818         ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9819           tagged_parameter_tree_len, MGT_ACTION);
9820       }
9821       break;
9822     }
9823     case MGT_ACTION_NO_ACK:
9824     {
9825       proto_item *lcl_fixed_hdr;
9826       proto_tree *lcl_fixed_tree;
9827       lcl_fixed_hdr = proto_tree_add_text(mgt_tree, tvb, 0, 0, "Fixed parameters");
9828       lcl_fixed_tree = proto_item_add_subtree (lcl_fixed_hdr, ett_fixed_parameters);
9829
9830       offset += add_fixed_field(lcl_fixed_tree, tvb, 0, FIELD_ACTION);
9831
9832       proto_item_set_len(lcl_fixed_hdr, offset);
9833       if (ieee80211_tvb_invalid)
9834         break; /* Buffer not available for further processing */
9835       tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
9836       if (tagged_parameter_tree_len > 0)
9837       {
9838         tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
9839           tagged_parameter_tree_len);
9840         ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
9841           tagged_parameter_tree_len, MGT_ACTION_NO_ACK);
9842       }
9843       break;
9844     }
9845     case MGT_ARUBA_WLAN:
9846     {
9847       proto_item *aruba_hdr;
9848       proto_tree *aruba_tree;
9849       guint16 type;
9850       type = tvb_get_ntohs(tvb, offset);
9851
9852       aruba_hdr = proto_tree_add_text(mgt_tree, tvb, 0, 0, "Aruba Management");
9853       aruba_tree = proto_item_add_subtree(aruba_hdr, ett_fixed_parameters);
9854
9855       proto_tree_add_item(aruba_tree, hf_ieee80211_aruba, tvb, offset, 2, ENC_BIG_ENDIAN);
9856       offset += 2;
9857       /* HeartBeat Sequence */
9858       if ( type == 0x0005 )
9859       {
9860         proto_tree_add_item(aruba_tree, hf_ieee80211_aruba_hb_seq, tvb, offset, 8, ENC_BIG_ENDIAN);
9861       }
9862       /* MTU Size */
9863       if ( type == 0x0003 )
9864       {
9865         proto_tree_add_item(aruba_tree, hf_ieee80211_aruba_mtu, tvb, offset, 2, ENC_BIG_ENDIAN);
9866       }
9867       break;
9868     }
9869   }
9870 }
9871
9872 static void
9873 set_src_addr_cols(packet_info *pinfo, const guint8 *addr, const char *type)
9874 {
9875   col_add_fstr(pinfo->cinfo, COL_RES_DL_SRC, "%s (%s)",
9876         get_ether_name(addr), type);
9877   col_add_str(pinfo->cinfo, COL_UNRES_DL_SRC, ether_to_str(addr));
9878 }
9879
9880 static void
9881 set_dst_addr_cols(packet_info *pinfo, const guint8 *addr, const char *type)
9882 {
9883   col_add_fstr(pinfo->cinfo, COL_RES_DL_DST, "%s (%s)",
9884         get_ether_name(addr), type);
9885   col_add_str(pinfo->cinfo, COL_UNRES_DL_DST, ether_to_str(addr));
9886 }
9887
9888 static guint32
9889 crc32_802_tvb_padded(tvbuff_t *tvb, guint hdr_len, guint hdr_size, guint len)
9890 {
9891   guint32 c_crc;
9892
9893   c_crc = crc32_ccitt_tvb(tvb, hdr_len);
9894   c_crc = crc32_ccitt_seed(tvb_get_ptr(tvb, hdr_size, len), len, ~c_crc);
9895
9896   /* Byte reverse. */
9897   c_crc = ((unsigned char)(c_crc>>0)<<24) |
9898     ((unsigned char)(c_crc>>8)<<16) |
9899     ((unsigned char)(c_crc>>16)<<8) |
9900     ((unsigned char)(c_crc>>24)<<0);
9901
9902   return ( c_crc );
9903 }
9904
9905 typedef enum {
9906     ENCAP_802_2,
9907     ENCAP_IPX,
9908     ENCAP_ETHERNET
9909 } encap_t;
9910
9911
9912 /* ************************************************************************* */
9913 /*                          Dissect 802.11 frame                             */
9914 /* ************************************************************************* */
9915
9916 /*
9917  * The 802.11n specification makes some fairly significant changes to the
9918  * layout of the MAC header.  The first two bits of the MAC header are the
9919  * protocol version.  You'd think that the 802.11 committee would have
9920  * bumped the version to indicate a different MAC layout, but NOOOO -- we
9921  * have to go digging for bits in various locations instead.
9922  */
9923
9924 static void
9925 dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo,
9926         proto_tree * tree, gboolean fixed_length_header, gint fcs_len,
9927         gboolean wlan_broken_fc, gboolean datapad,
9928         gboolean is_ht)
9929 {
9930   guint16 fcf, flags, frame_type_subtype, ctrl_fcf, ctrl_type_subtype;
9931   guint16 seq_control;
9932   guint32 seq_number, frag_number;
9933   gboolean more_frags;
9934   const guint8 *src = NULL;
9935   const guint8 *dst = NULL;
9936   const guint8 *bssid = NULL;
9937   proto_item *ti = NULL;
9938   proto_item *fcs_item = NULL;
9939   proto_item *cw_item = NULL;
9940   proto_item *hidden_item;
9941   proto_tree *volatile hdr_tree = NULL;
9942   proto_tree *fcs_tree = NULL;
9943   proto_tree *cw_tree = NULL;
9944   guint16 hdr_len, ohdr_len, htc_len = 0;
9945   gboolean has_fcs, fcs_good, fcs_bad;
9946   gint len, reported_len, ivlen;
9947   gboolean is_amsdu = 0;
9948   gboolean save_fragmented;
9949   tvbuff_t *volatile next_tvb = NULL;
9950   guint32 addr_type;
9951   volatile encap_t encap_type;
9952   guint8 octet1, octet2;
9953   char out_buff[SHORT_STR];
9954   gint is_iv_bad;
9955   guchar iv_buff[4];
9956   const char *addr1_str = NULL;
9957   int addr1_hf = -1;
9958   guint offset;
9959   const gchar *fts_str;
9960   gchar flag_str[] = "opmPRMFTC";
9961   gint ii;
9962   guint16 qosoff = 0, qos_control = 0;
9963   gint meshctl_len = 0;
9964   guint8 mesh_flags;
9965   guint16 meshoff = 0;
9966
9967   wlan_hdr *volatile whdr;
9968   static wlan_hdr whdrs[4];
9969   gboolean retransmitted;
9970
9971   whdr= &whdrs[0];
9972
9973   col_set_str (pinfo->cinfo, COL_PROTOCOL, "802.11");
9974   col_clear(pinfo->cinfo, COL_INFO);
9975
9976   fcf = FETCH_FCF(0);
9977   frame_type_subtype = COMPOSE_FRAME_TYPE(fcf);
9978   if (frame_type_subtype == CTRL_CONTROL_WRAPPER)
9979     ctrl_fcf = FETCH_FCF(10);
9980   else
9981     ctrl_fcf = 0;
9982
9983   if (fixed_length_header)
9984     hdr_len = DATA_LONG_HDR_LEN;
9985   else
9986     hdr_len = find_header_length (fcf, ctrl_fcf, is_ht);
9987
9988   fts_str = val_to_str_const(frame_type_subtype, frame_type_subtype_vals,
9989               "Unrecognized (Reserved frame)");
9990   col_set_str (pinfo->cinfo, COL_INFO, fts_str);
9991
9992
9993   flags = FCF_FLAGS (fcf);
9994   more_frags = HAVE_FRAGMENTS (flags);
9995
9996   for (ii = 0; ii < 8; ii++) {
9997     if (! (flags & 0x80 >> ii)) {
9998       flag_str[ii] = '.';
9999     }
10000   }
10001
10002   if (is_ht && IS_STRICTLY_ORDERED(flags) &&
10003     ((FCF_FRAME_TYPE(fcf) == MGT_FRAME) || (FCF_FRAME_TYPE(fcf) == DATA_FRAME &&
10004       DATA_FRAME_IS_QOS(frame_type_subtype)))) {
10005     htc_len = 4;
10006   }
10007
10008   /* adjust the header length depending on the Mesh Control field */
10009   if (FCF_FRAME_TYPE(fcf) == DATA_FRAME &&
10010       DATA_FRAME_IS_QOS(frame_type_subtype)) {
10011         qosoff = hdr_len - htc_len - 2;
10012         qos_control = tvb_get_letohs(tvb, qosoff);
10013         if (tvb_length(tvb) > hdr_len) {
10014             meshoff = hdr_len;
10015             mesh_flags = tvb_get_guint8 (tvb, hdr_len);
10016             if (has_mesh_control(fcf, qos_control, mesh_flags)) {
10017               meshctl_len = find_mesh_control_length(mesh_flags);
10018               hdr_len += meshctl_len;
10019             }
10020         }
10021   }
10022
10023   /*
10024    * Some portions of this code calculate offsets relative to the end of the
10025    * header.  But when the header has been padded to align the data this must
10026    * be done relative to true header size, not the padded/aligned value.  To
10027    * simplify this work we stash the original header size in ohdr_len instead
10028    * of recalculating it every time we need it.
10029    */
10030   ohdr_len = hdr_len;
10031   if (datapad)
10032     hdr_len = roundup2(hdr_len, 4);
10033
10034   /* Add the FC to the current tree */
10035   if (tree)
10036     {
10037       ti = proto_tree_add_protocol_format (tree, proto_wlan, tvb, 0, hdr_len,
10038           "IEEE 802.11 %s", fts_str);
10039       hdr_tree = proto_item_add_subtree (ti, ett_80211);
10040
10041       dissect_frame_control(hdr_tree, tvb, wlan_broken_fc, 0);
10042
10043       if (frame_type_subtype == CTRL_PS_POLL)
10044         proto_tree_add_item(hdr_tree, hf_ieee80211_assoc_id, tvb, 2, 2, ENC_LITTLE_ENDIAN);
10045       else
10046         proto_tree_add_uint (hdr_tree, hf_ieee80211_did_duration, tvb, 2, 2,
10047             tvb_get_letohs (tvb, 2));
10048     }
10049
10050   /*
10051    * Decode the part of the frame header that isn't the same for all
10052    * frame types.
10053    */
10054   seq_control = 0;
10055   frag_number = 0;
10056   seq_number = 0;
10057
10058   switch (FCF_FRAME_TYPE (fcf))
10059   {
10060
10061     case MGT_FRAME:
10062       /*
10063        * All management frame types have the same header.
10064        */
10065       src = tvb_get_ptr (tvb, 10, 6);
10066       dst = tvb_get_ptr (tvb, 4, 6);
10067
10068       SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src);
10069       SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src);
10070       SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst);
10071       SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, dst);
10072
10073       /* for tap */
10074       SET_ADDRESS(&whdr->bssid, AT_ETHER, 6, tvb_get_ptr(tvb, 16,6));
10075       SET_ADDRESS(&whdr->src, AT_ETHER, 6, src);
10076       SET_ADDRESS(&whdr->dst, AT_ETHER, 6, dst);
10077       whdr->type = frame_type_subtype;
10078
10079       seq_control = tvb_get_letohs(tvb, 22);
10080       frag_number = SEQCTL_FRAGMENT_NUMBER(seq_control);
10081       seq_number = SEQCTL_SEQUENCE_NUMBER(seq_control);
10082
10083       col_append_fstr(pinfo->cinfo, COL_INFO,
10084             ", SN=%d", seq_number);
10085
10086       col_append_fstr(pinfo->cinfo, COL_INFO,
10087             ", FN=%d",frag_number);
10088
10089       if (tree)
10090       {
10091         proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 4, 6, dst);
10092
10093         proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 10, 6, src);
10094
10095         proto_tree_add_item (hdr_tree, hf_ieee80211_addr_bssid, tvb, 16, 6, ENC_NA);
10096
10097         /* add items for wlan.addr filter */
10098         hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, dst);
10099         PROTO_ITEM_SET_HIDDEN(hidden_item);
10100         hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, src);
10101         PROTO_ITEM_SET_HIDDEN(hidden_item);
10102
10103         hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, ENC_NA);
10104         PROTO_ITEM_SET_HIDDEN(hidden_item);
10105
10106
10107         proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10108             frag_number);
10109
10110         proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10111             seq_number);
10112       }
10113       break;
10114
10115     case CONTROL_FRAME:
10116     {
10117       /*
10118        * Control Wrapper frames insert themselves between address 1
10119        * and address 2 in a normal control frame.  Process address 1
10120        * first, then handle the rest of the frame in dissect_control.
10121        */
10122       if (frame_type_subtype == CTRL_CONTROL_WRAPPER) {
10123         offset = 10; /* FC + D/ID + Address 1 + CFC + HTC */
10124         ctrl_fcf = FETCH_FCF(10);
10125         ctrl_type_subtype = COMPOSE_FRAME_TYPE(ctrl_fcf);
10126       } else {
10127         offset = 10; /* FC + D/ID + Address 1 */
10128         ctrl_type_subtype = frame_type_subtype;
10129       }
10130
10131       switch (ctrl_type_subtype)
10132       {
10133         case CTRL_PS_POLL:
10134           addr1_str = "BSSID";
10135           addr1_hf = hf_ieee80211_addr_bssid;
10136           break;
10137         case CTRL_RTS:
10138         case CTRL_CTS:
10139         case CTRL_ACKNOWLEDGEMENT:
10140         case CTRL_CFP_END:
10141         case CTRL_CFP_ENDACK:
10142         case CTRL_BLOCK_ACK_REQ:
10143         case CTRL_BLOCK_ACK:
10144           addr1_str = "RA";
10145           addr1_hf = hf_ieee80211_addr_ra;
10146           break;
10147         default:
10148           break;
10149       }
10150
10151       if (!addr1_str) /* XXX - Should we throw some sort of error? */
10152         break;
10153
10154       /* Add address 1 */
10155       dst = tvb_get_ptr(tvb, 4, 6);
10156       set_dst_addr_cols(pinfo, dst, addr1_str);
10157       if (tree) {
10158         proto_tree_add_item(hdr_tree, addr1_hf, tvb, 4, 6, ENC_BIG_ENDIAN);
10159         hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, ENC_NA);
10160         PROTO_ITEM_SET_HIDDEN(hidden_item);
10161       }
10162
10163       /*
10164        * Start shoving in other fields if needed.
10165        * XXX - Should we look for is_ht as well?
10166        */
10167       if (frame_type_subtype == CTRL_CONTROL_WRAPPER && tree) {
10168         cw_item = proto_tree_add_text(hdr_tree, tvb, offset, 2,
10169           "Contained Frame Control");
10170         cw_tree = proto_item_add_subtree (cw_item, ett_cntrl_wrapper_fc);
10171         dissect_frame_control(cw_tree, tvb, FALSE, offset);
10172         dissect_ht_control(hdr_tree, tvb, offset + 2);
10173         offset+=6;
10174         cw_item = proto_tree_add_text(hdr_tree, tvb, offset, 2,
10175           "Carried Frame");
10176         hdr_tree = proto_item_add_subtree (cw_item, ett_cntrl_wrapper_fc);
10177       }
10178
10179       switch (ctrl_type_subtype)
10180       {
10181         case CTRL_PS_POLL:
10182         case CTRL_CFP_END:
10183         case CTRL_CFP_ENDACK:
10184         {
10185           src = tvb_get_ptr (tvb, offset, 6);
10186           set_src_addr_cols(pinfo, src, "BSSID");
10187           if (tree) {
10188             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, ENC_NA);
10189             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, offset, 6, ENC_NA);
10190             PROTO_ITEM_SET_HIDDEN(hidden_item);
10191           }
10192           break;
10193         }
10194
10195         case CTRL_RTS:
10196         {
10197           src = tvb_get_ptr (tvb, offset, 6);
10198           set_src_addr_cols(pinfo, src, "TA");
10199           if (tree) {
10200             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, ENC_NA);
10201             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, offset, 6, ENC_NA);
10202             PROTO_ITEM_SET_HIDDEN(hidden_item);
10203           }
10204           break;
10205         }
10206
10207         case CTRL_CONTROL_WRAPPER:
10208         {
10209           /* XXX - We shouldn't see this.  Should we throw an error? */
10210           break;
10211         }
10212
10213         case CTRL_BLOCK_ACK_REQ:
10214         {
10215           src = tvb_get_ptr (tvb, offset, 6);
10216           set_src_addr_cols(pinfo, src, "TA");
10217
10218           if (tree)
10219           {
10220             guint16 bar_control;
10221             guint8 block_ack_type;
10222             proto_item *bar_parent_item;
10223             proto_tree *bar_sub_tree;
10224
10225             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, ENC_NA);
10226             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, offset, 6, ENC_NA);
10227             PROTO_ITEM_SET_HIDDEN(hidden_item);
10228             offset += 6;
10229
10230             bar_control = tvb_get_letohs(tvb, offset);
10231             block_ack_type = (bar_control & 0x0006) >> 1;
10232             proto_tree_add_uint(hdr_tree, hf_ieee80211_block_ack_request_type, tvb,
10233               offset, 1, block_ack_type);
10234             bar_parent_item = proto_tree_add_uint_format(hdr_tree,
10235               hf_ieee80211_block_ack_request_control, tvb, offset, 2, bar_control,
10236               "Block Ack Request (BAR) Control: 0x%04X", bar_control);
10237             bar_sub_tree = proto_item_add_subtree(bar_parent_item,
10238               ett_block_ack);
10239             proto_tree_add_boolean(bar_sub_tree,
10240               hf_ieee80211_block_ack_control_ack_policy, tvb, offset, 1, bar_control);
10241             proto_tree_add_boolean(bar_sub_tree, hf_ieee80211_block_ack_control_multi_tid,
10242               tvb, offset, 1, bar_control);
10243             proto_tree_add_boolean(bar_sub_tree,
10244               hf_ieee80211_block_ack_control_compressed_bitmap, tvb, offset, 1,
10245               bar_control);
10246             proto_tree_add_uint(bar_sub_tree, hf_ieee80211_block_ack_control_reserved,
10247               tvb, offset, 2, bar_control);
10248
10249             switch (block_ack_type)
10250             {
10251               case 0: /*Basic BlockAckReq */
10252               {
10253                 proto_tree_add_uint(bar_sub_tree,
10254                 hf_ieee80211_block_ack_control_basic_tid_info, tvb, offset+1, 1,
10255                   bar_control);
10256                 offset += 2;
10257
10258                 /*offset +=*/ add_fixed_field(hdr_tree, tvb, offset,
10259                   FIELD_BLOCK_ACK_SSC);
10260                 break;
10261               }
10262               case 2: /* Compressed BlockAckReq */
10263               {
10264                 proto_tree_add_uint(bar_sub_tree,
10265                 hf_ieee80211_block_ack_control_compressed_tid_info, tvb, offset+1, 1,
10266                   bar_control);
10267                 offset += 2;
10268
10269                 /*offset +=*/ add_fixed_field(hdr_tree, tvb, offset,
10270                   FIELD_BLOCK_ACK_SSC);
10271                 break;
10272               }
10273               case 3: /* Multi-TID BlockAckReq */
10274               {
10275                 guint8 tid_count;
10276                 guint i;
10277                 proto_tree *bar_mtid_tree, *bar_mtid_sub_tree;
10278
10279                 tid_count = ((bar_control & 0xF000) >> 12) + 1;
10280                 proto_tree_add_uint_format(bar_sub_tree, hf_ieee80211_block_ack_control_multi_tid_info, tvb, offset+1, 1, bar_control,
10281                 decode_numeric_bitfield(bar_control, 0xF000, 16,"Number of TIDs Present: 0x%%X"), tid_count);
10282                 offset += 2;
10283
10284                 bar_parent_item = proto_tree_add_text (hdr_tree, tvb, offset, tid_count*4, "Per TID Info");
10285                 bar_mtid_tree = proto_item_add_subtree(bar_parent_item, ett_block_ack);
10286                 for (i = 1; i <= tid_count; i++) {
10287                   bar_parent_item = proto_tree_add_uint(bar_mtid_tree, hf_ieee80211_block_ack_multi_tid_info, tvb, offset, 4, i);
10288                   bar_mtid_sub_tree = proto_item_add_subtree(bar_parent_item, ett_block_ack);
10289
10290                   bar_control = tvb_get_letohs(tvb, offset);
10291                   proto_tree_add_uint(bar_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_reserved, tvb, offset, 2, bar_control);
10292                   proto_tree_add_uint(bar_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_value, tvb, offset+1, 1, bar_control);
10293                   offset += 2;
10294
10295                   offset += add_fixed_field(bar_mtid_sub_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
10296                 }
10297                 break;
10298               }
10299             }
10300           }
10301           break;
10302         }
10303
10304         case CTRL_BLOCK_ACK:
10305         {
10306           src = tvb_get_ptr (tvb, offset, 6);
10307           set_src_addr_cols(pinfo, src, "TA");
10308
10309           if (tree)
10310           {
10311             guint16 ba_control;
10312             guint8 block_ack_type;
10313             proto_item *ba_parent_item;
10314             proto_tree *ba_sub_tree;
10315
10316             proto_tree_add_item(hdr_tree, hf_ieee80211_addr_ta, tvb, offset, 6, ENC_NA);
10317             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, offset, 6, ENC_NA);
10318             PROTO_ITEM_SET_HIDDEN(hidden_item);
10319             offset += 6;
10320
10321             ba_control = tvb_get_letohs(tvb, offset);
10322             block_ack_type = (ba_control & 0x0006) >> 1;
10323             proto_tree_add_uint(hdr_tree, hf_ieee80211_block_ack_type, tvb, offset, 1, block_ack_type);
10324             ba_parent_item = proto_tree_add_uint_format(hdr_tree,
10325               hf_ieee80211_block_ack_control, tvb, offset, 2, ba_control,
10326               "Block Ack (BA) Control: 0x%04X", ba_control);
10327             ba_sub_tree = proto_item_add_subtree(ba_parent_item, ett_block_ack);
10328             proto_tree_add_boolean(ba_sub_tree, hf_ieee80211_block_ack_control_ack_policy,
10329               tvb, offset, 1, ba_control);
10330             proto_tree_add_boolean(ba_sub_tree, hf_ieee80211_block_ack_control_multi_tid,
10331               tvb, offset, 1, ba_control);
10332             proto_tree_add_boolean(ba_sub_tree,
10333               hf_ieee80211_block_ack_control_compressed_bitmap, tvb, offset, 1,
10334               ba_control);
10335             proto_tree_add_uint(ba_sub_tree, hf_ieee80211_block_ack_control_reserved, tvb,
10336               offset, 2, ba_control);
10337
10338             switch (block_ack_type)
10339             {
10340               case 0: /*Basic BlockAck */
10341               {
10342                 proto_tree_add_uint(ba_sub_tree,
10343                 hf_ieee80211_block_ack_control_basic_tid_info, tvb, offset+1, 1,
10344                   ba_control);
10345                 offset += 2;
10346
10347                 offset += add_fixed_field(hdr_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
10348                 proto_tree_add_item(hdr_tree, hf_ieee80211_block_ack_bitmap, tvb, offset, 128, ENC_NA);
10349                 /*offset += 128;*/
10350                 break;
10351               }
10352               case 2: /* Compressed BlockAck */
10353               {
10354                 guint16 ssn;
10355                 guint64 bmap;
10356                 int f;
10357                 proto_item *ba_bitmap_item;
10358                 proto_tree *ba_bitmap_tree;
10359
10360                 proto_tree_add_uint(ba_sub_tree, hf_ieee80211_block_ack_control_basic_tid_info, tvb, offset+1, 1, ba_control);
10361                 offset += 2;
10362
10363                 ssn = tvb_get_letohs(tvb, offset);
10364                 ssn >>= 4;
10365                 offset += add_fixed_field(hdr_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
10366                 bmap = tvb_get_letoh64(tvb, offset);
10367                 ba_bitmap_item = proto_tree_add_item(hdr_tree, hf_ieee80211_block_ack_bitmap, tvb, offset, 8, ENC_NA);
10368                 ba_bitmap_tree = proto_item_add_subtree(ba_bitmap_item, ett_block_ack_bitmap);
10369                 for (f = 0; f < 64; f++) {
10370                   if (bmap & (G_GINT64_CONSTANT(1) << f))
10371                     continue;
10372                   proto_tree_add_uint_format_value(ba_bitmap_tree, hf_ieee80211_block_ack_bitmap_missing_frame,
10373                                                    tvb, offset + (f/8), 1, ssn + f, "%u", ssn + f);
10374                 }
10375                 /*offset += 8;*/
10376                 break;
10377               }
10378               case 3:  /* Multi-TID BlockAck */
10379               {
10380                 guint8 tid_count;
10381                 guint i;
10382                 proto_tree *ba_mtid_tree, *ba_mtid_sub_tree;
10383
10384                 tid_count = ((ba_control & 0xF000) >> 12) + 1;
10385                 proto_tree_add_uint_format(ba_sub_tree,
10386                 hf_ieee80211_block_ack_control_compressed_tid_info, tvb, offset+1, 1,
10387                   ba_control, decode_numeric_bitfield(ba_control, 0xF000,
10388                   16,"Number of TIDs Present: 0x%%X"), tid_count);
10389                 offset += 2;
10390
10391                 ba_parent_item = proto_tree_add_text (hdr_tree, tvb, offset, tid_count*4, "Per TID Info");
10392                 ba_mtid_tree = proto_item_add_subtree(ba_parent_item, ett_block_ack);
10393                 for (i = 1; i <= tid_count; i++) {
10394                   ba_parent_item = proto_tree_add_uint(ba_mtid_tree, hf_ieee80211_block_ack_multi_tid_info, tvb, offset, 4, i);
10395                   ba_mtid_sub_tree = proto_item_add_subtree(ba_parent_item, ett_block_ack);
10396
10397                   ba_control = tvb_get_letohs(tvb, offset);
10398                   proto_tree_add_uint(ba_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_reserved, tvb, offset, 2, ba_control);
10399                   proto_tree_add_uint(ba_mtid_sub_tree, hf_ieee80211_block_ack_multi_tid_value, tvb, offset+1, 1, ba_control);
10400                   offset += 2;
10401
10402                   offset += add_fixed_field(ba_mtid_sub_tree, tvb, offset, FIELD_BLOCK_ACK_SSC);
10403                   proto_tree_add_item(ba_mtid_sub_tree, hf_ieee80211_block_ack_bitmap, tvb, offset, 8, ENC_NA);
10404                   offset += 8;
10405                 }
10406                 break;
10407               }
10408             }
10409           }
10410           break;
10411         }
10412       }
10413       break;
10414     }
10415
10416     case DATA_FRAME:
10417       addr_type = FCF_ADDR_SELECTOR (fcf);
10418
10419       /* In order to show src/dst address we must always do the following */
10420       switch (addr_type)
10421       {
10422
10423         case DATA_ADDR_T1:
10424           src = tvb_get_ptr (tvb, 10, 6);
10425           dst = tvb_get_ptr (tvb, 4, 6);
10426           bssid = tvb_get_ptr (tvb, 16, 6);
10427           break;
10428
10429         case DATA_ADDR_T2:
10430           src = tvb_get_ptr (tvb, 16, 6);
10431           dst = tvb_get_ptr (tvb, 4, 6);
10432           bssid = tvb_get_ptr (tvb, 10, 6);
10433           break;
10434
10435         case DATA_ADDR_T3:
10436           src = tvb_get_ptr (tvb, 10, 6);
10437           dst = tvb_get_ptr (tvb, 16, 6);
10438           bssid = tvb_get_ptr (tvb, 4, 6);
10439           break;
10440
10441         case DATA_ADDR_T4:
10442           src = tvb_get_ptr (tvb, 24, 6);
10443           dst = tvb_get_ptr (tvb, 16, 6);
10444           bssid = tvb_get_ptr (tvb, 16, 6);
10445           break;
10446       }
10447
10448       SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src);
10449       SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src);
10450       SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst);
10451       SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, dst);
10452
10453       /* for tap */
10454
10455       SET_ADDRESS(&whdr->bssid, AT_ETHER, 6, bssid);
10456       SET_ADDRESS(&whdr->src, AT_ETHER, 6, src);
10457       SET_ADDRESS(&whdr->dst, AT_ETHER, 6, dst);
10458       whdr->type = frame_type_subtype;
10459
10460       seq_control = tvb_get_letohs(tvb, 22);
10461       frag_number = SEQCTL_FRAGMENT_NUMBER(seq_control);
10462       seq_number = SEQCTL_SEQUENCE_NUMBER(seq_control);
10463
10464       col_append_fstr(pinfo->cinfo, COL_INFO,
10465             ", SN=%d, FN=%d", seq_number,frag_number);
10466
10467       /* Now if we have a tree we start adding stuff */
10468       if (tree)
10469       {
10470
10471         switch (addr_type)
10472         {
10473
10474           case DATA_ADDR_T1:
10475             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 4, 6, dst);
10476             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 10, 6, src);
10477             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_bssid, tvb, 16, 6, bssid);
10478             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10479                frag_number);
10480             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10481                seq_number);
10482
10483             /* add items for wlan.addr filter */
10484             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, dst);
10485             PROTO_ITEM_SET_HIDDEN(hidden_item);
10486             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, src);
10487             PROTO_ITEM_SET_HIDDEN(hidden_item);
10488             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, ENC_NA);
10489             PROTO_ITEM_SET_HIDDEN(hidden_item);
10490             break;
10491
10492           case DATA_ADDR_T2:
10493             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 4, 6, dst);
10494             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_bssid, tvb, 10, 6, bssid);
10495             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 16, 6, src);
10496             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10497                frag_number);
10498             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10499                seq_number);
10500
10501             /* add items for wlan.addr filter */
10502             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, dst);
10503             PROTO_ITEM_SET_HIDDEN(hidden_item);
10504             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, ENC_NA);
10505             PROTO_ITEM_SET_HIDDEN(hidden_item);
10506             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, src);
10507             PROTO_ITEM_SET_HIDDEN(hidden_item);
10508             break;
10509
10510           case DATA_ADDR_T3:
10511             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_bssid, tvb, 4, 6, bssid);
10512             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 10, 6, src);
10513             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 16, 6, dst);
10514
10515             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10516                frag_number);
10517             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10518                seq_number);
10519
10520             /* add items for wlan.addr filter */
10521             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, ENC_NA);
10522             PROTO_ITEM_SET_HIDDEN(hidden_item);
10523             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, src);
10524             PROTO_ITEM_SET_HIDDEN(hidden_item);
10525             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, dst);
10526             PROTO_ITEM_SET_HIDDEN(hidden_item);
10527             break;
10528
10529           case DATA_ADDR_T4:
10530             proto_tree_add_item (hdr_tree, hf_ieee80211_addr_ra, tvb, 4, 6, ENC_NA);
10531             proto_tree_add_item (hdr_tree, hf_ieee80211_addr_ta, tvb, 10, 6, ENC_NA);
10532             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_da, tvb, 16, 6, dst);
10533             proto_tree_add_uint (hdr_tree, hf_ieee80211_frag_number, tvb, 22, 2,
10534                frag_number);
10535             proto_tree_add_uint (hdr_tree, hf_ieee80211_seq_number, tvb, 22, 2,
10536                seq_number);
10537             proto_tree_add_ether (hdr_tree, hf_ieee80211_addr_sa, tvb, 24, 6, src);
10538
10539             /* add items for wlan.addr filter */
10540             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 4, 6, ENC_NA);
10541             PROTO_ITEM_SET_HIDDEN(hidden_item);
10542             hidden_item = proto_tree_add_item (hdr_tree, hf_ieee80211_addr, tvb, 10, 6, ENC_NA);
10543             PROTO_ITEM_SET_HIDDEN(hidden_item);
10544             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 16, 6, dst);
10545             PROTO_ITEM_SET_HIDDEN(hidden_item);
10546             hidden_item = proto_tree_add_ether (hdr_tree, hf_ieee80211_addr, tvb, 24, 6, src);
10547             PROTO_ITEM_SET_HIDDEN(hidden_item);
10548             break;
10549         }
10550
10551       }
10552       break;
10553   }
10554
10555   len = tvb_length_remaining(tvb, hdr_len);
10556   reported_len = tvb_reported_length_remaining(tvb, hdr_len);
10557
10558   switch (fcs_len)
10559     {
10560       case 0: /* Definitely has no FCS */
10561         has_fcs = FALSE;
10562         break;
10563
10564       case 4: /* Definitely has an FCS */
10565         has_fcs = TRUE;
10566         break;
10567
10568       case -2: /* Data frames have no FCS, other frames have an FCS */
10569         if (FCF_FRAME_TYPE (fcf) == DATA_FRAME)
10570           has_fcs = FALSE;
10571         else
10572           has_fcs = TRUE;
10573         break;
10574
10575       default: /* Don't know - use "wlan_check_fcs" */
10576         has_fcs = wlan_check_fcs;
10577         break;
10578     }
10579   if (has_fcs)
10580     {
10581       /*
10582        * Well, this packet should, in theory, have an FCS.
10583        * Do we have the entire packet, and does it have enough data for
10584        * the FCS?
10585        */
10586       if (reported_len < 4)
10587       {
10588         /*
10589          * The packet is claimed not to even have enough data for a 4-byte
10590          * FCS.
10591          * Pretend it doesn't have an FCS.
10592          */
10593         ;
10594       }
10595       else if (len < reported_len)
10596       {
10597         /*
10598          * The packet is claimed to have enough data for a 4-byte FCS, but
10599          * we didn't capture all of the packet.
10600          * Slice off the 4-byte FCS from the reported length, and trim the
10601          * captured length so it's no more than the reported length; that
10602          * will slice off what of the FCS, if any, is in the captured
10603          * length.
10604          */
10605         reported_len -= 4;
10606         if (len > reported_len)
10607             len = reported_len;
10608       }
10609       else
10610       {
10611         /*
10612          * We have the entire packet, and it includes a 4-byte FCS.
10613          * Slice it off, and put it into the tree.
10614          */
10615         len -= 4;
10616         reported_len -= 4;
10617         if (tree)
10618         {
10619           guint32 sent_fcs = tvb_get_ntohl(tvb, hdr_len + len);
10620           guint32 fcs;
10621
10622           if (datapad)
10623             fcs = crc32_802_tvb_padded(tvb, ohdr_len, hdr_len, len);
10624           else
10625             fcs = crc32_802_tvb(tvb, hdr_len + len);
10626           if (fcs == sent_fcs) {
10627             fcs_good = TRUE;
10628             fcs_bad = FALSE;
10629           } else {
10630             fcs_good = FALSE;
10631             fcs_bad = TRUE;
10632           }
10633
10634           if(fcs_good) {
10635             fcs_item = proto_tree_add_uint_format(hdr_tree, hf_ieee80211_fcs, tvb,
10636                 hdr_len + len, 4, sent_fcs,
10637                 "Frame check sequence: 0x%08x [correct]", sent_fcs);
10638           } else {
10639             fcs_item = proto_tree_add_uint_format(hdr_tree, hf_ieee80211_fcs, tvb,
10640                 hdr_len + len, 4, sent_fcs,
10641                 "Frame check sequence: 0x%08x [incorrect, should be 0x%08x]",
10642                 sent_fcs, fcs);
10643             flag_str[8] = '.';
10644           }
10645
10646           proto_tree_set_appendix(hdr_tree, tvb, hdr_len + len, 4);
10647
10648           fcs_tree = proto_item_add_subtree(fcs_item, ett_fcs);
10649
10650           fcs_item = proto_tree_add_boolean(fcs_tree,
10651               hf_ieee80211_fcs_good, tvb,
10652               hdr_len + len, 4,
10653               fcs_good);
10654           PROTO_ITEM_SET_GENERATED(fcs_item);
10655
10656           fcs_item = proto_tree_add_boolean(fcs_tree,
10657               hf_ieee80211_fcs_bad, tvb,
10658               hdr_len + len, 4,
10659               fcs_bad);
10660           PROTO_ITEM_SET_GENERATED(fcs_item);
10661         }
10662       }
10663     } else {
10664       flag_str[8] = '\0';
10665     }
10666
10667     proto_item_append_text(ti, ", Flags: %s", flag_str);
10668     col_append_fstr (pinfo->cinfo, COL_INFO, ", Flags=%s", flag_str);
10669
10670
10671   /*
10672    * Only management and data frames have a body, so we don't have
10673    * anything more to do for other types of frames.
10674    */
10675   switch (FCF_FRAME_TYPE (fcf))
10676     {
10677
10678     case MGT_FRAME:
10679       if (htc_len == 4) {
10680         dissect_ht_control(hdr_tree, tvb, ohdr_len - 4);
10681       }
10682       break;
10683
10684     case DATA_FRAME:
10685       if (tree && DATA_FRAME_IS_QOS(frame_type_subtype))
10686       {
10687         proto_item *qos_fields;
10688         proto_tree *qos_tree;
10689
10690         guint16 qos_tid;
10691         guint16 qos_priority;
10692         guint16 qos_ack_policy;
10693         guint16 qos_amsdu_present;
10694         guint16 qos_eosp;
10695         guint16 qos_field_content;
10696
10697         qos_fields = proto_tree_add_text(hdr_tree, tvb, qosoff, 2,
10698             "QoS Control");
10699         qos_tree = proto_item_add_subtree (qos_fields, ett_qos_parameters);
10700
10701         qos_tid = QOS_TID(qos_control);
10702         qos_priority = QOS_PRIORITY(qos_control);
10703         qos_ack_policy = QOS_ACK_POLICY(qos_control);
10704         qos_amsdu_present = QOS_AMSDU_PRESENT(qos_control);
10705         qos_eosp = QOS_EOSP(qos_control);
10706         qos_field_content = QOS_FIELD_CONTENT(qos_control);
10707
10708         proto_tree_add_uint (qos_tree, hf_ieee80211_qos_tid, tvb,
10709             qosoff, 1, qos_tid);
10710
10711         proto_tree_add_uint_format (qos_tree, hf_ieee80211_qos_priority, tvb,
10712             qosoff, 1, qos_priority,
10713             "Priority: %d (%s) (%s)",
10714             qos_priority, qos_tags[qos_priority], qos_acs[qos_priority]);
10715
10716         if (flags & FLAG_FROM_DS) {
10717           proto_tree_add_boolean (qos_tree, hf_ieee80211_qos_eosp, tvb,
10718               qosoff, 1, qos_control);
10719         } else {
10720           proto_tree_add_boolean (qos_tree, hf_ieee80211_qos_bit4, tvb,
10721               qosoff, 1, qos_control);
10722         }
10723
10724         proto_tree_add_uint (qos_tree, hf_ieee80211_qos_ack_policy, tvb, qosoff, 1,
10725             qos_ack_policy);
10726
10727         if (flags & FLAG_FROM_DS) {
10728           if (!DATA_FRAME_IS_NULL(frame_type_subtype)) {
10729             proto_tree_add_boolean(qos_tree, hf_ieee80211_qos_amsdu_present, tvb,
10730                 qosoff, 1, qos_amsdu_present);
10731             is_amsdu = qos_amsdu_present;
10732           }
10733           if (DATA_FRAME_IS_CF_POLL(frame_type_subtype)) {
10734             /* txop limit */
10735             if (qos_field_content == 0) {
10736               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_txop_limit, tvb,
10737                   qosoff + 1, 1, qos_field_content,
10738                                                 "transmit one frame immediately (0)");
10739             } else {
10740               proto_tree_add_uint (qos_tree, hf_ieee80211_qos_txop_limit, tvb,
10741                                    qosoff + 1, 1, qos_field_content);
10742             }
10743           } else {
10744             /* qap ps buffer state */
10745             proto_item *qos_ps_buf_state_fields;
10746             proto_tree *qos_ps_buf_state_tree;
10747             guint8 qap_buf_load;
10748
10749             qos_ps_buf_state_fields = proto_tree_add_text(qos_tree, tvb, qosoff + 1, 1,
10750                 "QAP PS Buffer State: 0x%x", qos_field_content);
10751             qos_ps_buf_state_tree = proto_item_add_subtree (qos_ps_buf_state_fields, ett_qos_ps_buf_state);
10752
10753             proto_tree_add_boolean (qos_ps_buf_state_tree, hf_ieee80211_qos_buf_state_indicated,
10754                                     tvb, qosoff + 1, 1, qos_field_content);
10755
10756             if (QOS_PS_BUF_STATE_INDICATED(qos_field_content)) {
10757               proto_tree_add_uint (qos_ps_buf_state_tree, hf_ieee80211_qos_highest_pri_buf_ac, tvb,
10758                   qosoff + 1, 1, qos_field_content);
10759
10760               qap_buf_load = QOS_PS_QAP_BUF_LOAD(qos_field_content);
10761               switch (qap_buf_load) {
10762
10763               case 0:
10764                 proto_tree_add_uint_format_value (qos_ps_buf_state_tree, hf_ieee80211_qos_qap_buf_load, tvb,
10765                     qosoff + 1, 1, qos_field_content,
10766                     "no buffered traffic (0)");
10767                 break;
10768
10769               default:
10770                 proto_tree_add_uint_format_value (qos_ps_buf_state_tree, hf_ieee80211_qos_qap_buf_load, tvb,
10771                     qosoff + 1, 1, qos_field_content,
10772                     "%d octets (%d)", qap_buf_load*4096, qap_buf_load);
10773                 break;
10774
10775               case 15:
10776                 proto_tree_add_uint_format_value (qos_ps_buf_state_tree, hf_ieee80211_qos_qap_buf_load, tvb,
10777                     qosoff + 1, 1, qos_field_content,
10778                     "greater than 57344 octets (15)");
10779                 break;
10780               }
10781             }
10782           }
10783         } else {
10784           if (!DATA_FRAME_IS_NULL(frame_type_subtype)) {
10785             proto_tree_add_boolean(qos_tree, hf_ieee80211_qos_amsdu_present, tvb,
10786                 qosoff, 1, qos_amsdu_present);
10787             is_amsdu = qos_amsdu_present;
10788           }
10789           if (qos_eosp) {
10790             /* queue size */
10791             switch (qos_field_content) {
10792
10793             case 0:
10794               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
10795                                                 tvb, qosoff + 1, 1, qos_field_content,
10796                   "no buffered traffic in the queue (0)");
10797               break;
10798
10799             default:
10800               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
10801                                                 tvb, qosoff + 1, 1, qos_field_content,
10802                                                 "%u bytes (%u)", qos_field_content*256, qos_field_content);
10803               break;
10804
10805             case 254:
10806               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
10807                                                 tvb, qosoff + 1, 1, qos_field_content,
10808                   "more than 64768 octets (254)");
10809               break;
10810
10811             case 255:
10812               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_queue_size,
10813                                                 tvb, qosoff + 1, 1, qos_field_content,
10814                   "unspecified or unknown (256)");
10815               break;
10816             }
10817           } else {
10818             /* txop duration requested */
10819             if (qos_field_content == 0) {
10820               proto_tree_add_uint_format_value (qos_tree, hf_ieee80211_qos_txop_dur_req,
10821                                                 tvb, qosoff + 1, 1, qos_field_content,
10822                                                 "no TXOP requested (0)");
10823             } else {
10824               proto_tree_add_uint (qos_tree, hf_ieee80211_qos_txop_dur_req,
10825                                    tvb, qosoff + 1, 1, qos_field_content);
10826             }
10827           }
10828         }
10829
10830         /* Do we have +HTC? */
10831         if (htc_len == 4) {
10832           dissect_ht_control(hdr_tree, tvb, ohdr_len - 4);
10833         }
10834
10835         if (meshctl_len != 0) {
10836           proto_item *msh_fields;
10837           proto_tree *msh_tree;
10838
10839           msh_fields = proto_tree_add_text(hdr_tree, tvb, meshoff, meshctl_len, "Mesh Control field");
10840           msh_tree = proto_item_add_subtree (msh_fields, ett_msh_control);
10841           add_fixed_field(msh_tree, tvb, meshoff, FIELD_MESH_CONTROL);
10842         }
10843
10844       } /* end of qos control field */
10845       /* Davide Schiera (2006-11-21): process handshake packet with AirPDcap    */
10846       /* the processing will take care of 4-way handshake sessions for WPA    */
10847       /* and WPA2 decryption                                  */
10848       if (enable_decryption && !pinfo->fd->flags.visited) {
10849         const guint8 *enc_data = tvb_get_ptr(tvb, 0, hdr_len+reported_len);
10850         AirPDcapPacketProcess(&airpdcap_ctx, enc_data, hdr_len, hdr_len+reported_len, NULL, 0, NULL, TRUE, FALSE);
10851       }
10852       /* Davide Schiera --------------------------------------------------------  */
10853
10854       /*
10855        * No-data frames don't have a body.
10856        */
10857       if (DATA_FRAME_IS_NULL(frame_type_subtype))
10858         return;
10859
10860       if (!wlan_subdissector) {
10861         guint fnum = 0;
10862
10863         /* key: bssid:src
10864          * data: last seq_control seen and frame number
10865          */
10866         retransmitted = FALSE;
10867         if(!pinfo->fd->flags.visited){
10868           retransmit_key key;
10869           retransmit_key *result;
10870
10871           memcpy(key.bssid, bssid, 6);
10872           memcpy(key.src, src, 6);
10873           key.seq_control = 0;
10874           result = (retransmit_key *)g_hash_table_lookup(fc_analyse_retransmit_table, &key);
10875           if (result && result->seq_control == seq_control) {
10876                /* keep a pointer to the first seen frame, could be done with proto data? */
10877                fnum = result->fnum;
10878                g_hash_table_insert(fc_first_frame_table, GINT_TO_POINTER( pinfo->fd->num),
10879                   GINT_TO_POINTER(fnum));
10880                retransmitted = TRUE;
10881           } else {
10882                /* first time or new seq*/
10883                if (!result) {
10884                   result = se_alloc(sizeof(retransmit_key));
10885                   *result = key;
10886                   g_hash_table_insert(fc_analyse_retransmit_table, result, result);
10887                }
10888                result->seq_control = seq_control;
10889                result->fnum =  pinfo->fd->num;
10890            }
10891         }
10892         else if ((fnum = GPOINTER_TO_UINT(g_hash_table_lookup(fc_first_frame_table, GINT_TO_POINTER( pinfo->fd->num))))) {
10893            retransmitted = TRUE;
10894         }
10895
10896         if (retransmitted) {
10897             col_append_str(pinfo->cinfo, COL_INFO, " [retransmitted]");
10898             if (tree) {
10899                 proto_item *item;
10900
10901                 item=proto_tree_add_none_format(hdr_tree, hf_ieee80211_fc_analysis_retransmission, tvb, 0, 0, "Retransmitted frame");
10902                 PROTO_ITEM_SET_GENERATED(item);
10903                 item=proto_tree_add_uint(hdr_tree, hf_ieee80211_fc_analysis_retransmission_frame,tvb, 0, 0, fnum);
10904                 PROTO_ITEM_SET_GENERATED(item);
10905             }
10906             next_tvb = tvb_new_subset (tvb, hdr_len, len, reported_len);
10907             call_dissector(data_handle, next_tvb, pinfo, tree);
10908             goto end_of_wlan;
10909         }
10910       }
10911
10912       break;
10913
10914     case CONTROL_FRAME:
10915       return;
10916
10917     default:
10918       return;
10919     }
10920
10921   if (IS_PROTECTED(FCF_FLAGS(fcf))
10922       && !pinfo->pseudo_header->ieee_802_11.decrypted
10923       && wlan_ignore_wep != WLAN_IGNORE_WEP_WO_IV) {
10924     /*
10925      * It's a WEP or WPA encrypted frame, and it hasn't already been
10926      * decrypted; dissect the protections parameters and decrypt the data,
10927      * if we have a matching key. Otherwise display it as data.
10928      */
10929
10930     gboolean can_decrypt = FALSE;
10931     proto_tree *wep_tree = NULL;
10932     guint32 iv;
10933     guint8 key, keybyte;
10934
10935     /* Davide Schiera (2006-11-27): define algorithms constants and macros  */
10936 #define PROTECTION_ALG_WEP  AIRPDCAP_KEY_TYPE_WEP
10937 #define PROTECTION_ALG_TKIP  AIRPDCAP_KEY_TYPE_TKIP
10938 #define PROTECTION_ALG_CCMP  AIRPDCAP_KEY_TYPE_CCMP
10939 #define PROTECTION_ALG_RSNA  PROTECTION_ALG_CCMP | PROTECTION_ALG_TKIP
10940     guint8 algorithm=G_MAXUINT8;
10941     /* Davide Schiera (2006-11-27): added macros to check the algorithm    */
10942     /* used could be TKIP or CCMP                            */
10943 #define IS_TKIP(tvb, hdr_len)  (tvb_get_guint8(tvb, hdr_len + 1) & 0x20)
10944 #define IS_CCMP(tvb, hdr_len)  (tvb_get_guint8(tvb, hdr_len + 2) == 0)
10945     /* Davide Schiera -----------------------------------------------------  */
10946
10947     /* Davide Schiera (2006-11-21): recorded original lengths to pass them  */
10948     /* to the packets process function                        */
10949     guint32 sec_header=0;
10950     guint32 sec_trailer=0;
10951
10952     next_tvb = try_decrypt(tvb, hdr_len, reported_len, &algorithm, &sec_header, &sec_trailer);
10953     /* Davide Schiera -----------------------------------------------------  */
10954
10955     keybyte = tvb_get_guint8(tvb, hdr_len + 3);
10956     key = KEY_OCTET_WEP_KEY(keybyte);
10957     if ((keybyte & KEY_EXTIV) && (len >= EXTIV_LEN)) {
10958       /* Extended IV; this frame is likely encrypted with TKIP or CCMP */
10959
10960
10961       if (tree) {
10962         proto_item *extiv_fields;
10963
10964         /* Davide Schiera (2006-11-27): differentiated CCMP and TKIP if  */
10965         /* it's possible                                */
10966         if (algorithm==PROTECTION_ALG_TKIP)
10967           extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10968               "TKIP parameters");
10969         else if (algorithm==PROTECTION_ALG_CCMP)
10970           extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10971             "CCMP parameters");
10972         else {
10973           /* Davide Schiera --------------------------------------------  */
10974           /* Davide Schiera (2006-11-27): differentiated CCMP and TKIP if*/
10975           /* it's possible                              */
10976           if (IS_TKIP(tvb, hdr_len)) {
10977             algorithm=PROTECTION_ALG_TKIP;
10978             extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10979                 "TKIP parameters");
10980           } else if (IS_CCMP(tvb, hdr_len)) {
10981             algorithm=PROTECTION_ALG_CCMP;
10982             extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10983                 "CCMP parameters");
10984           } else
10985             extiv_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 8,
10986                 "TKIP/CCMP parameters");
10987         }
10988         proto_item_set_len (ti, hdr_len + 8);
10989
10990         wep_tree = proto_item_add_subtree (extiv_fields, ett_wep_parameters);
10991
10992         if (algorithm==PROTECTION_ALG_TKIP) {
10993           g_snprintf(out_buff, SHORT_STR, "0x%08X%02X%02X",
10994               tvb_get_letohl(tvb, hdr_len + 4),
10995               tvb_get_guint8(tvb, hdr_len),
10996               tvb_get_guint8(tvb, hdr_len + 2));
10997           proto_tree_add_string(wep_tree, hf_ieee80211_tkip_extiv, tvb, hdr_len,
10998               EXTIV_LEN, out_buff);
10999         } else if (algorithm==PROTECTION_ALG_CCMP) {
11000           g_snprintf(out_buff, SHORT_STR, "0x%08X%02X%02X",
11001               tvb_get_letohl(tvb, hdr_len + 4),
11002               tvb_get_guint8(tvb, hdr_len + 1),
11003               tvb_get_guint8(tvb, hdr_len));
11004           proto_tree_add_string(wep_tree, hf_ieee80211_ccmp_extiv, tvb, hdr_len,
11005               EXTIV_LEN, out_buff);
11006         }
11007
11008         proto_tree_add_uint(wep_tree, hf_ieee80211_wep_key, tvb, hdr_len + 3, 1, key);
11009       }
11010
11011       /* Subtract out the length of the IV. */
11012       len -= EXTIV_LEN;
11013       reported_len -= EXTIV_LEN;
11014       ivlen = EXTIV_LEN;
11015       /* It is unknown whether this is TKIP or CCMP, so let's not even try to
11016        * parse TKIP Michael MIC+ICV or CCMP MIC. */
11017
11018       /* Davide Schiera (2006-11-21): enable TKIP and CCMP decryption      */
11019       /* checking for the trailer                            */
11020       if (next_tvb!=NULL) {
11021         if (reported_len < (gint) sec_trailer) {
11022           /* There is no space for a trailer, ignore it and don't decrypt  */
11023           ;
11024         } else if (len < reported_len) {
11025           /* There is space for a trailer, but we haven't capture all the  */
11026           /* packet. Slice off the trailer, but don't try to decrypt      */
11027           reported_len -= sec_trailer;
11028           if (len > reported_len)
11029             len = reported_len;
11030         } else {
11031           /* Ok, we have a trailer and the whole packet. Decrypt it!      */
11032           /* TODO: At the moment we won't add the trailer to the tree,    */
11033           /* so don't remove the trailer from the packet              */
11034           len -= sec_trailer;
11035           reported_len -= sec_trailer;
11036           can_decrypt = TRUE;
11037         }
11038       }
11039       /* Davide Schiera --------------------------------------------------  */
11040     } else {
11041       /* No Ext. IV - WEP packet */
11042       /*
11043        * XXX - pass the IV and key to "try_decrypt_wep()", and have it pass
11044        * them to "wep_decrypt()", rather than having "wep_decrypt()" extract
11045        * them itself.
11046        *
11047        * Also, just pass the data *following* the WEP parameters as the
11048        * buffer to decrypt.
11049        */
11050       iv = tvb_get_ntoh24(tvb, hdr_len);
11051       if (tree) {
11052         proto_item *wep_fields;
11053
11054         wep_fields = proto_tree_add_text(hdr_tree, tvb, hdr_len, 4,
11055             "WEP parameters");
11056
11057         wep_tree = proto_item_add_subtree (wep_fields, ett_wep_parameters);
11058         proto_tree_add_uint (wep_tree, hf_ieee80211_wep_iv, tvb, hdr_len, 3, iv);
11059         tvb_memcpy(tvb, iv_buff, hdr_len, 3);
11060         is_iv_bad = weak_iv(iv_buff);
11061         if (is_iv_bad != -1) {
11062           proto_tree_add_boolean_format (wep_tree, hf_ieee80211_wep_iv_weak,
11063               tvb, 0, 0, TRUE,
11064               "Weak IV for key byte %d",
11065               is_iv_bad);
11066         }
11067       }
11068       if (tree)
11069         proto_tree_add_uint (wep_tree, hf_ieee80211_wep_key, tvb, hdr_len + 3, 1, key);
11070
11071       /* Subtract out the length of the IV. */
11072       len -= 4;
11073       reported_len -= 4;
11074       ivlen = 4;
11075
11076       /* Davide Schiera (2006-11-27): Even if the decryption was not */
11077       /* successful, set the algorithm                               */
11078       algorithm=PROTECTION_ALG_WEP;
11079
11080       /*
11081        * Well, this packet should, in theory, have an ICV.
11082        * Do we have the entire packet, and does it have enough data for
11083        * the ICV?
11084        */
11085       if (reported_len < 4) {
11086         /*
11087          * The packet is claimed not to even have enough data for a
11088          * 4-byte ICV.
11089          * Pretend it doesn't have an ICV.
11090          */
11091         ;
11092       } else if (len < reported_len) {
11093         /*
11094          * The packet is claimed to have enough data for a 4-byte ICV,
11095          * but we didn't capture all of the packet.
11096          * Slice off the 4-byte ICV from the reported length, and trim
11097          * the captured length so it's no more than the reported length;
11098          * that will slice off what of the ICV, if any, is in the
11099          * captured length.
11100          */
11101         reported_len -= 4;
11102         if (len > reported_len)
11103           len = reported_len;
11104       } else {
11105         /*
11106          * We have the entire packet, and it includes a 4-byte ICV.
11107          * Slice it off, and put it into the tree.
11108          *
11109          * We only support decrypting if we have the the ICV.
11110          *
11111          * XXX - the ICV is encrypted; we're putting the encrypted
11112          * value, not the decrypted value, into the tree.
11113          */
11114         len -= 4;
11115         reported_len -= 4;
11116         can_decrypt = TRUE;
11117       }
11118     }
11119
11120     if (algorithm == PROTECTION_ALG_WEP) {
11121       g_strlcpy (wlan_stats.protection, "WEP", MAX_PROTECT_LEN);
11122     } else if (algorithm == PROTECTION_ALG_TKIP) {
11123       g_strlcpy (wlan_stats.protection, "TKIP", MAX_PROTECT_LEN);
11124     } else if (algorithm == PROTECTION_ALG_CCMP) {
11125       g_strlcpy (wlan_stats.protection, "CCMP", MAX_PROTECT_LEN);
11126     } else {
11127       g_strlcpy (wlan_stats.protection, "Unknown", MAX_PROTECT_LEN);
11128     }
11129
11130     /* Davide Schiera (2006-11-26): decrypted before parsing header and    */
11131     /* protection header                                  */
11132     if (!can_decrypt || next_tvb == NULL) {
11133       /*
11134        * WEP decode impossible or failed, treat payload as raw data
11135        * and don't attempt fragment reassembly or further dissection.
11136        */
11137       next_tvb = tvb_new_subset(tvb, hdr_len + ivlen, len, reported_len);
11138
11139       if (tree) {
11140         /* Davide Schiera (2006-11-21): added WEP or WPA separation      */
11141         if (algorithm==PROTECTION_ALG_WEP) {
11142           if (can_decrypt)
11143             proto_tree_add_uint_format (wep_tree, hf_ieee80211_wep_icv, tvb,
11144                 hdr_len + ivlen + len, 4,
11145                 tvb_get_ntohl(tvb, hdr_len + ivlen + len),
11146                 "WEP ICV: 0x%08x (not verified)",
11147                 tvb_get_ntohl(tvb, hdr_len + ivlen + len));
11148         } else if (algorithm==PROTECTION_ALG_CCMP) {
11149         } else if (algorithm==PROTECTION_ALG_TKIP) {
11150         }
11151       }
11152       /* Davide Schiera (2006-11-21) ----------------------------------  */
11153
11154       if (pinfo->ethertype != ETHERTYPE_CENTRINO_PROMISC && wlan_ignore_wep == WLAN_IGNORE_WEP_NO) {
11155         /* Some wireless drivers (such as Centrino) WEP payload already decrypted */
11156         call_dissector(data_handle, next_tvb, pinfo, tree);
11157         goto end_of_wlan;
11158       }
11159     } else {
11160       /* Davide Schiera (2006-11-21): added WEP or WPA separation        */
11161       if (algorithm==PROTECTION_ALG_WEP) {
11162         if (tree)
11163           proto_tree_add_uint_format (wep_tree, hf_ieee80211_wep_icv, tvb,
11164               hdr_len + ivlen + len, 4,
11165               tvb_get_ntohl(tvb, hdr_len + ivlen + len),
11166               "WEP ICV: 0x%08x (correct)",
11167               tvb_get_ntohl(tvb, hdr_len + ivlen + len));
11168
11169         add_new_data_source(pinfo, next_tvb, "Decrypted WEP data");
11170       } else if (algorithm==PROTECTION_ALG_CCMP) {
11171         add_new_data_source(pinfo, next_tvb, "Decrypted CCMP data");
11172       } else if (algorithm==PROTECTION_ALG_TKIP) {
11173         add_new_data_source(pinfo, next_tvb, "Decrypted TKIP data");
11174       }
11175       /* Davide Schiera (2006-11-21) -------------------------------------  */
11176       /* Davide Schiera (2006-11-27): undefine macros and definitions  */
11177 #undef IS_TKIP
11178 #undef IS_CCMP
11179 #undef PROTECTION_ALG_CCMP
11180 #undef PROTECTION_ALG_TKIP
11181 #undef PROTECTION_ALG_WEP
11182       /* Davide Schiera --------------------------------------------------  */
11183     }
11184
11185     /*
11186      * WEP decryption successful!
11187      *
11188      * Use the tvbuff we got back from the decryption; the data starts at
11189      * the beginning.  The lengths are already correct for the decoded WEP
11190      * payload.
11191      */
11192     hdr_len = 0;
11193
11194   } else {
11195     /*
11196      * Not a WEP-encrypted frame; just use the data from the tvbuff
11197      * handed to us.
11198      *
11199      * The payload starts at "hdr_len" (i.e., just past the 802.11
11200      * MAC header), the length of data in the tvbuff following the
11201      * 802.11 header is "len", and the length of data in the packet
11202      * following the 802.11 header is "reported_len".
11203      */
11204     next_tvb = tvb;
11205   }
11206
11207   /*
11208    * Do defragmentation if "wlan_defragment" is true, and we have more
11209    * fragments or this isn't the first fragment.
11210    *
11211    * We have to do some special handling to catch frames that
11212    * have the "More Fragments" indicator not set but that
11213    * don't show up as reassembled and don't have any other
11214    * fragments present.  Some networking interfaces appear
11215    * to do reassembly even when you're capturing raw packets
11216    * *and* show the reassembled packet without the "More
11217    * Fragments" indicator set *but* with a non-zero fragment
11218    * number.
11219    *
11220    * "fragment_add_seq_802_11()" handles that; we want to call it
11221    * even if we have a short frame, so that it does those checks - if
11222    * the frame is short, it doesn't do reassembly on it.
11223    *
11224    * (This could get some false positives if we really *did* only
11225    * capture the last fragment of a fragmented packet, but that's
11226    * life.)
11227    */
11228   save_fragmented = pinfo->fragmented;
11229   if (wlan_defragment && (more_frags || frag_number != 0)) {
11230     fragment_data *fd_head;
11231
11232     /*
11233      * If we've already seen this frame, look it up in the
11234      * table of reassembled packets, otherwise add it to
11235      * whatever reassembly is in progress, if any, and see
11236      * if it's done.
11237      */
11238     if (reported_len < 0)
11239       THROW(ReportedBoundsError);
11240     fd_head = fragment_add_seq_802_11(next_tvb, hdr_len, pinfo, seq_number,
11241         wlan_fragment_table,
11242         wlan_reassembled_table,
11243         frag_number,
11244         reported_len,
11245         more_frags);
11246     next_tvb = process_reassembled_data(tvb, hdr_len, pinfo,
11247         "Reassembled 802.11", fd_head,
11248         &frag_items, NULL, hdr_tree);
11249   } else {
11250     /*
11251      * If this is the first fragment, dissect its contents, otherwise
11252      * just show it as a fragment.
11253      */
11254     if (frag_number != 0) {
11255       /* Not the first fragment - don't dissect it. */
11256       next_tvb = NULL;
11257     } else {
11258       /* First fragment, or not fragmented.  Dissect what we have here. */
11259
11260       /* Get a tvbuff for the payload. */
11261       next_tvb = tvb_new_subset (next_tvb, hdr_len, len, reported_len);
11262
11263       /*
11264        * If this is the first fragment, but not the only fragment,
11265        * tell the next protocol that.
11266        */
11267       if (more_frags)
11268         pinfo->fragmented = TRUE;
11269       else
11270         pinfo->fragmented = FALSE;
11271     }
11272   }
11273
11274   if (next_tvb == NULL) {
11275     /* Just show this as an incomplete fragment. */
11276     col_set_str(pinfo->cinfo, COL_INFO, "Fragmented IEEE 802.11 frame");
11277     next_tvb = tvb_new_subset (tvb, hdr_len, len, reported_len);
11278     call_dissector(data_handle, next_tvb, pinfo, tree);
11279     pinfo->fragmented = save_fragmented;
11280     goto end_of_wlan;
11281   }
11282
11283   switch (FCF_FRAME_TYPE (fcf))
11284     {
11285
11286     case MGT_FRAME:
11287       dissect_ieee80211_mgt (fcf, next_tvb, pinfo, tree);
11288       break;
11289
11290     case DATA_FRAME:
11291       if (is_amsdu && tvb_reported_length_remaining(next_tvb, 0) > 4){
11292         tvbuff_t *volatile msdu_tvb = NULL;
11293         guint32 msdu_offset = 0;
11294         guint i = 1;
11295         const guint8 *lcl_src = NULL;
11296         const guint8 *lcl_dst = NULL;
11297         guint16 msdu_length;
11298         proto_item *parent_item;
11299         proto_tree *mpdu_tree;
11300         proto_tree *subframe_tree;
11301
11302         parent_item = proto_tree_add_protocol_format(tree, proto_aggregate, next_tvb, 0,
11303                                     tvb_reported_length_remaining(next_tvb, 0), "IEEE 802.11 Aggregate MSDU");
11304         mpdu_tree = proto_item_add_subtree(parent_item, ett_msdu_aggregation_parent_tree);
11305
11306         do {
11307           lcl_dst = tvb_get_ptr (next_tvb, msdu_offset, 6);
11308           lcl_src = tvb_get_ptr (next_tvb, msdu_offset+6, 6);
11309           msdu_length = tvb_get_ntohs (next_tvb, msdu_offset+12);
11310
11311           parent_item = proto_tree_add_uint_format(mpdu_tree, hf_ieee80211_amsdu_msdu_header_text, next_tvb,
11312                             msdu_offset, roundup2(msdu_offset+14+msdu_length, 4),
11313                             i, "A-MSDU Subframe #%u", i);
11314           subframe_tree = proto_item_add_subtree(parent_item, ett_msdu_aggregation_subframe_tree);
11315           i++;
11316
11317           proto_tree_add_ether(subframe_tree, hf_ieee80211_addr_da, next_tvb, msdu_offset, 6, lcl_dst);
11318           proto_tree_add_ether(subframe_tree, hf_ieee80211_addr_sa, next_tvb, msdu_offset+6, 6, lcl_src);
11319           proto_tree_add_uint_format(subframe_tree, hf_ieee80211_mcsset_highest_data_rate, next_tvb, msdu_offset+12, 2,
11320           msdu_length, "MSDU length: 0x%04X", msdu_length);
11321
11322           msdu_offset += 14;
11323           msdu_tvb = tvb_new_subset(next_tvb, msdu_offset, msdu_length, -1);
11324           call_dissector(llc_handle, msdu_tvb, pinfo, subframe_tree);
11325           msdu_offset = roundup2(msdu_offset+msdu_length, 4);
11326         } while (tvb_reported_length_remaining(next_tvb, msdu_offset) > 14);
11327
11328         break;
11329       }
11330       /* I guess some bridges take Netware Ethernet_802_3 frames,
11331          which are 802.3 frames (with a length field rather than
11332          a type field, but with no 802.2 header in the payload),
11333          and just stick the payload into an 802.11 frame.  I've seen
11334          captures that show frames of that sort.
11335
11336          We also handle some odd form of encapsulation in which a
11337          complete Ethernet frame is encapsulated within an 802.11
11338          data frame, with no 802.2 header.  This has been seen
11339          from some hardware.
11340
11341          On top of that, at least at some point it appeared that
11342          the OLPC XO sent out frames with two bytes of 0 between
11343          the "end" of the 802.11 header and the beginning of
11344          the payload.
11345
11346          So, if the packet doesn't start with 0xaa 0xaa:
11347
11348            we first use the same scheme that linux-wlan-ng does to detect
11349            those encapsulated Ethernet frames, namely looking to see whether
11350            the frame either starts with 6 octets that match the destination
11351            address from the 802.11 header or has 6 octets that match the
11352            source address from the 802.11 header following the first 6 octets,
11353            and, if so, treat it as an encapsulated Ethernet frame;
11354
11355            otherwise, we use the same scheme that we use in the Ethernet
11356            dissector to recognize Netware 802.3 frames, namely checking
11357            whether the packet starts with 0xff 0xff and, if so, treat it
11358            as an encapsulated IPX frame, and then check whether the
11359            packet starts with 0x00 0x00 and, if so, treat it as an OLPC
11360            frame. */
11361       encap_type = ENCAP_802_2;
11362       TRY {
11363         octet1 = tvb_get_guint8(next_tvb, 0);
11364         octet2 = tvb_get_guint8(next_tvb, 1);
11365         if (octet1 != 0xaa || octet2 != 0xaa) {
11366           if (tvb_memeql(next_tvb, 6, pinfo->dl_src.data, 6) == 0 ||
11367               tvb_memeql(next_tvb, 0, pinfo->dl_dst.data, 6) == 0)
11368             encap_type = ENCAP_ETHERNET;
11369           else if (octet1 == 0xff && octet2 == 0xff)
11370             encap_type = ENCAP_IPX;
11371           else if (octet1 == 0x00 && octet2 == 0x00) {
11372             proto_tree_add_text(tree, next_tvb, 0, 2, "Mysterious OLPC stuff");
11373             next_tvb = tvb_new_subset_remaining (next_tvb, 2);
11374           }
11375         }
11376       }
11377       CATCH2(BoundsError, ReportedBoundsError) {
11378       ; /* do nothing */
11379
11380       }
11381       ENDTRY;
11382
11383       switch (encap_type) {
11384
11385       case ENCAP_802_2:
11386         call_dissector(llc_handle, next_tvb, pinfo, tree);
11387         break;
11388
11389       case ENCAP_ETHERNET:
11390         call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
11391         break;
11392
11393       case ENCAP_IPX:
11394         call_dissector(ipx_handle, next_tvb, pinfo, tree);
11395         break;
11396       }
11397       break;
11398     }
11399   pinfo->fragmented = save_fragmented;
11400
11401   end_of_wlan:
11402   whdr->stats = wlan_stats;
11403   tap_queue_packet(wlan_tap, pinfo, whdr);
11404   memset (&wlan_stats, 0, sizeof wlan_stats);
11405 }
11406
11407 /*
11408  * Dissect 802.11 with a variable-length link-layer header.
11409  */
11410 static void
11411 dissect_ieee80211 (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11412 {
11413   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
11414       pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, FALSE);
11415 }
11416
11417 /*
11418  * Dissect 802.11 with a variable-length link-layer header and data padding.
11419  */
11420 static void
11421 dissect_ieee80211_datapad (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11422 {
11423   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
11424       pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, TRUE, FALSE);
11425 }
11426
11427 /*
11428  * Dissect 802.11 with a variable-length link-layer header and a byte-swapped
11429  * control field (some hardware sends out LWAPP-encapsulated 802.11
11430  * packets with the control field byte swapped).
11431  */
11432 static void
11433 dissect_ieee80211_bsfc (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11434 {
11435   dissect_ieee80211_common (tvb, pinfo, tree, FALSE, 0, TRUE, FALSE, FALSE);
11436 }
11437
11438 /*
11439  * Dissect 802.11 with a fixed-length link-layer header (padded to the
11440  * maximum length).
11441  */
11442 static void
11443 dissect_ieee80211_fixed (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11444 {
11445   dissect_ieee80211_common (tvb, pinfo, tree, TRUE, 0, FALSE, FALSE, FALSE);
11446 }
11447
11448 /*
11449  * Dissect an HT 802.11 frame with a variable-length link-layer header.
11450  * XXX - Can we tell if a frame is +HTC just by looking at the MAC header?
11451  * If so, we can dispense with this.
11452  */
11453 static void
11454 dissect_ieee80211_ht (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
11455 {
11456   dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
11457       pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, TRUE);
11458 }
11459
11460 static void
11461 wlan_defragment_init(void)
11462 {
11463   fragment_table_init(&wlan_fragment_table);
11464   reassembled_table_init(&wlan_reassembled_table);
11465 }
11466
11467 /* ------------- */
11468 static guint
11469 retransmit_hash(gconstpointer k)
11470 {
11471   const retransmit_key *key = (const retransmit_key *)k;
11472   guint hash_val;
11473   int i;
11474
11475   hash_val = 0;
11476   for (i = 0; i < 6; i++)
11477     hash_val += key->bssid[i];
11478
11479   for (i = 0; i < 6; i++)
11480     hash_val += key->src[i];
11481
11482   return hash_val;
11483 }
11484
11485 static gint
11486 retransmit_equal(gconstpointer k1, gconstpointer k2)
11487 {
11488   const retransmit_key *key1 = (const retransmit_key *)k1;
11489   const retransmit_key *key2 = (const retransmit_key *)k2;
11490
11491   return ( (!memcmp(key1->bssid, key2->bssid, 6) && !memcmp( key1->src, key2->src, 6))? TRUE:FALSE);
11492 }
11493
11494 static guint
11495 frame_hash(gconstpointer k)
11496 {
11497   guint32 frame = GPOINTER_TO_UINT(k);
11498
11499   return frame;
11500 }
11501
11502 static gint
11503 frame_equal(gconstpointer k1, gconstpointer k2)
11504 {
11505   guint32 frame1 = GPOINTER_TO_UINT(k1);
11506   guint32 frame2 = GPOINTER_TO_UINT(k2);
11507
11508   return frame1==frame2;
11509 }
11510
11511 static void
11512 wlan_retransmit_init(void)
11513 {
11514   if ( fc_analyse_retransmit_table ){
11515       g_hash_table_destroy(fc_analyse_retransmit_table);
11516       fc_analyse_retransmit_table = NULL;
11517   }
11518
11519   if( fc_first_frame_table ){
11520       g_hash_table_destroy(fc_first_frame_table);
11521       fc_first_frame_table = NULL;
11522   }
11523
11524   if (wlan_subdissector)
11525       return;
11526
11527   fc_analyse_retransmit_table= g_hash_table_new(retransmit_hash, retransmit_equal);
11528   fc_first_frame_table = g_hash_table_new( frame_hash, frame_equal);
11529
11530 }
11531
11532 void
11533 proto_register_ieee80211 (void)
11534 {
11535   static const value_string frame_type[] = {
11536     {MGT_FRAME,     "Management frame"},
11537     {CONTROL_FRAME, "Control frame"},
11538     {DATA_FRAME,    "Data frame"},
11539     {0,             NULL}
11540   };
11541
11542   static const value_string tofrom_ds[] = {
11543     {0,                       "Not leaving DS or network is operating "
11544       "in AD-HOC mode (To DS: 0 From DS: 0)"},
11545     {FLAG_TO_DS,              "Frame from STA to DS via an AP (To DS: 1 "
11546       "From DS: 0)"},
11547     {FLAG_FROM_DS,            "Frame from DS to a STA via AP(To DS: 0 "
11548       "From DS: 1)"},
11549     {FLAG_TO_DS|FLAG_FROM_DS, "WDS (AP to AP) or Mesh (MP to MP) Frame "
11550       "(To DS: 1 From DS: 1)"},
11551     {0, NULL}
11552   };
11553
11554   static const true_false_string tods_flag = {
11555     "Frame is entering DS",
11556     "Frame is not entering DS"
11557   };
11558
11559   static const true_false_string fromds_flag = {
11560     "Frame is exiting DS",
11561     "Frame is not exiting DS"
11562   };
11563
11564   static const true_false_string more_frags = {
11565     "More fragments follow",
11566     "This is the last fragment"
11567   };
11568
11569   static const true_false_string retry_flags = {
11570     "Frame is being retransmitted",
11571     "Frame is not being retransmitted"
11572   };
11573
11574   static const true_false_string pm_flags = {
11575     "STA will go to sleep",
11576     "STA will stay up"
11577   };
11578
11579   static const true_false_string md_flags = {
11580     "Data is buffered for STA at AP",
11581     "No data buffered"
11582   };
11583
11584   static const true_false_string protected_flags = {
11585     "Data is protected",
11586     "Data is not protected"
11587   };
11588
11589   static const true_false_string order_flags = {
11590     "Strictly ordered",
11591     "Not strictly ordered"
11592   };
11593
11594   static const true_false_string cf_ess_flags = {
11595     "Transmitter is an AP",
11596     "Transmitter is a STA"
11597   };
11598
11599
11600   static const true_false_string cf_privacy_flags = {
11601     "AP/STA can support WEP",
11602     "AP/STA cannot support WEP"
11603   };
11604
11605   static const true_false_string cf_preamble_flags = {
11606     "Short preamble allowed",
11607     "Short preamble not allowed"
11608   };
11609
11610   static const true_false_string cf_pbcc_flags = {
11611     "PBCC modulation allowed",
11612     "PBCC modulation not allowed"
11613   };
11614
11615   static const true_false_string cf_agility_flags = {
11616     "Channel agility in use",
11617     "Channel agility not in use"
11618   };
11619
11620   static const true_false_string short_slot_time_flags = {
11621     "Short slot time in use",
11622     "Short slot time not in use"
11623   };
11624
11625   static const true_false_string dsss_ofdm_flags = {
11626     "DSSS-OFDM modulation allowed",
11627     "DSSS-OFDM modulation not allowed"
11628   };
11629
11630   static const true_false_string cf_spec_man_flags = {
11631     "dot11SpectrumManagementRequired TRUE",
11632     "dot11SpectrumManagementRequired FALSE"
11633   };
11634
11635   static const true_false_string cf_apsd_flags = {
11636     "apsd implemented",
11637     "apsd not implemented"
11638   };
11639
11640   static const true_false_string cf_del_blk_ack_flags = {
11641     "delayed block ack implemented",
11642     "delayed block ack not implemented"
11643   };
11644
11645   static const true_false_string cf_imm_blk_ack_flags = {
11646     "immediate block ack implemented",
11647     "immediate block ack not implemented"
11648   };
11649   static const true_false_string cf_ibss_flags = {
11650     "Transmitter belongs to an IBSS",
11651     "Transmitter belongs to a BSS"
11652   };
11653
11654   static const true_false_string eosp_flag = {
11655     "End of service period",
11656     "Service period"
11657   };
11658
11659   static const true_false_string bit4_flag = {
11660     "Bits 8-15 of QoS Control field are Queue Size",
11661     "Bits 8-15 of QoS Control field are TXOP Duration Requested"
11662   };
11663
11664   static const true_false_string ieee80211_qos_amsdu_present_flag = {
11665     "A-MSDU",
11666     "MSDU"
11667   };
11668
11669   static const value_string sta_cf_pollable[] = {
11670     {0x00, "Station is not CF-Pollable"},
11671     {0x02, "Station is CF-Pollable, "
11672      "not requesting to be placed on the  CF-polling list"},
11673     {0x01, "Station is CF-Pollable, "
11674      "requesting to be placed on the CF-polling list"},
11675     {0x03, "Station is CF-Pollable, requesting never to be polled"},
11676     {0x0200, "QSTA requesting association in QBSS"},
11677     {0, NULL}
11678   };
11679
11680   static const value_string ap_cf_pollable[] = {
11681     {0x00, "No point coordinator at AP"},
11682     {0x02, "Point coordinator at AP for delivery only (no polling)"},
11683     {0x01, "Point coordinator at AP for delivery and polling"},
11684     {0x03, "Reserved"},
11685     {0x0200, "QAP (HC) does not use CFP for delivery of unicast data type frames"},
11686     {0x0202, "QAP (HC) uses CFP for delivery, but does not send CF-Polls to non-QoS STAs"},
11687     {0x0201, "QAP (HC) uses CFP for delivery, and sends CF-Polls to non-QoS STAs"},
11688     {0x0203, "Reserved"},
11689     {0, NULL}
11690   };
11691
11692
11693   static const value_string auth_alg[] = {
11694     {0x00, "Open System"},
11695     {0x01, "Shared key"},
11696     {0x02, "Fast BSS Transition"},
11697     {0x80, "Network EAP"},  /* Cisco proprietary? */
11698     {0, NULL}
11699   };
11700
11701   static const true_false_string ff_block_ack_params_amsdu_permitted_flag = {
11702     "Permitted in QoS Data MPDUs",
11703     "Not Permitted"
11704   };
11705
11706   static const true_false_string ff_block_ack_params_policy_flag = {
11707     "Immediate Block Ack",
11708     "Delayed Block Ack"
11709   };
11710
11711   static const value_string  ff_channel_width_vals[] = {
11712     {0x00, "20 MHz channel width only"},
11713     {0x01, "Any channel width in the STA's Supported Channel Width Set"},
11714     {0, NULL}
11715   };
11716
11717   static const true_false_string ff_qos_info_ap_q_ack_flag = {
11718       "Implemented",
11719       "Not Implemented"
11720   };
11721
11722   static const true_false_string ff_qos_info_ap_queue_req_flag = {
11723       "Can process a nonzero Queue Size subfield in the QoS Control field in QoS data frames",
11724       "Can NOT process a nonzero Queue Size subfield in the QoS Control field in QoS data frames"
11725   };
11726
11727   static const true_false_string ff_qos_info_ap_txop_request_flag = {
11728       "Can process a nonzero TXOP Duration Requested subfield in the QoS Control field in QoS data frames",
11729       "Can NOT process a nonzero TXOP Duration Requested subfield in the QoS Control field in QoS data frames"
11730   };
11731
11732   static const true_false_string ff_qos_info_sta_ac_flag = {
11733       "Trigger-enabled and Delivery-enabled",
11734       "Neither Trigger-enabled nor Delivery-enabled"
11735   };
11736
11737   static const true_false_string ff_qos_info_sta_q_ack_flag = {
11738       "Implemented",
11739       "Not Implemented"
11740   };
11741
11742   static const value_string ff_qos_info_sta_max_sp_len_flags[] = {
11743     {0x00, "AP may deliver all buffered MSDUs, A-MSDUs and MMPDUs"},
11744     {0x01, "AP may deliver a maximum of two MSDUs and MMPDUs per SP"},
11745     {0x02, "AP may deliver a maximum of four MSDUs and MMPDUs per SP"},
11746     {0x03, "AP may deliver a maximum of six MSDUs and MMPDUs per SP"},
11747     {0, NULL}
11748   };
11749
11750   static const true_false_string ff_qos_info_sta_more_data_ack_flag = {
11751       "Can process ACK frames with the More Data bit in the Frame Control field set to 1",
11752       "Can NOT process ACK frames with the More Data bit in the Frame Control field set to 1"
11753   };
11754
11755   static const true_false_string ff_sm_pwr_save_sm_mode_flag = {
11756       "Dynamic SM Power Save mode",
11757       "Static SM Power Save mode"
11758   };
11759
11760   static const true_false_string ff_pco_phase_cntrl_flag = {
11761       "40 MHz Phase",
11762       "20 MHz Phase"
11763   };
11764
11765   static const true_false_string ff_psmp_param_set_more_psmp_flag = {
11766       "More PSMP Sequences Follow",
11767       "No PSMP Sequences Follow"
11768   };
11769
11770   static const value_string ff_mimo_cntrl_nc_index_flags[] = {
11771     {0x00, "1 Column"},
11772     {0x01, "2 Columns"},
11773     {0x02, "3 Columns"},
11774     {0x03, "4 Columns"},
11775     {0, NULL}
11776   };
11777
11778   static const value_string ff_mimo_cntrl_nr_index_flags[] = {
11779     {0x00, "1 Row"},
11780     {0x01, "2 Rows"},
11781     {0x02, "3 Rows"},
11782     {0x03, "4 Rows"},
11783     {0, NULL}
11784   };
11785
11786   static const true_false_string ff_mimo_cntrl_channel_width_flag = {
11787       "40 MHz",
11788       "20 MHz"
11789   };
11790
11791   static const true_false_string ff_ht_info_information_request_flag = {
11792       "Requesting HT Information Exchange management action frame",
11793       "Should not send an HT Information Exchange management action frame"
11794   };
11795
11796   static const true_false_string ff_ht_info_40_mhz_intolerant_flag = {
11797       "Transmitting station is intolerant of 40 MHz operation",
11798       "Transmitting station permits 40 MHz operation"
11799   };
11800
11801   static const true_false_string ff_ht_info_sta_chan_width_flag = {
11802       "40 MHz",
11803       "20 MHz"
11804   };
11805
11806   static const value_string ff_ht_action_flags[] = {
11807     {HT_ACTION_NOTIFY_CHAN_WIDTH, "Notify Channel Width"},
11808     {HT_ACTION_SM_PWR_SAVE, "Spatial Multiplexing (SM) Power Save"},
11809     {HT_ACTION_PSMP_ACTION, "Power Save Multi-Poll (PSMP) action frame"},
11810     {HT_ACTION_SET_PCO_PHASE, "Set PCO Phase"},
11811     {HT_ACTION_MIMO_CSI, "MIMO CSI Matrices"},
11812     {HT_ACTION_MIMO_BEAMFORMING, "MIMO Non-compressed Beamforming"},
11813     {HT_ACTION_MIMO_COMPRESSED_BEAMFORMING, "MIMO Compressed Beamforming"},
11814     {HT_ACTION_ANT_SEL_FEEDBACK, "Antenna Selection Indices Feedback"},
11815     {HT_ACTION_HT_INFO_EXCHANGE, "HT Information Exchange"},
11816     {0x00, NULL}
11817   };
11818
11819   static const value_string ff_mimo_cntrl_grouping_flags[] = {
11820     {0x00, "No Grouping"},
11821     {0x01, "Carrier Groups of 2"},
11822     {0x02, "Carrier Groups of 4"},
11823     {0x03, "Reserved"},
11824     {0, NULL}
11825   };
11826
11827   static const value_string ff_mimo_cntrl_coefficient_size_flags[] = {
11828     {0x00, "4 Bits"},
11829     {0x01, "5 Bits"},
11830     {0x02, "6 Bits"},
11831     {0x03, "8 Bits"},
11832     {0, NULL}
11833   };
11834
11835   static const value_string ff_mimo_cntrl_codebook_info_flags[] = {
11836     {0x00, "1 bit for 'Capital Psi', 3 bits for 'Small Psi'"},
11837     {0x01, "2 bit for 'Capital Psi', 4 bits for 'Small Psi'"},
11838     {0x02, "3 bit for 'Capital Psi', 5 bits for 'Small Psi'"},
11839     {0x03, "4 bit for 'Capital Psi', 6 bits for 'Small Psi'"},
11840     {0, NULL}
11841   };
11842
11843
11844
11845   static const value_string ff_pa_action_codes[] = {
11846     {PA_DSE_ENABLEMENT, "DSE enablement"},
11847     {PA_DSE_DEENABLEMENT, "DSE deenablement"},
11848     {PA_DSE_REG_LOC_ANNOUNCEMENT, "DSE Registered Location Announcement"},
11849     {PA_EXT_CHANNEL_SWITCH_ANNOUNCEMENT, "Extended Channel Switch Announcement"},
11850     {PA_DSE_MEASUREMENT_REQUEST, "DSE measurement request"},
11851     {PA_DSE_MEASUREMENT_REPORT, "DSE measurement report"},
11852     {PA_MEASUREMENT_PILOT, "Measurement Pilot"},
11853     {PA_DSE_POWER_CONSTRAINT, "DSE power constraint"},
11854     {PA_VENDOR_SPECIFIC, "Vendor Specific"},
11855     {PA_GAS_INITIAL_REQUEST, "GAS Initial Request"},
11856     {PA_GAS_INITIAL_RESPONSE, "GAS Initial Response"},
11857     {PA_GAS_COMEBACK_REQUEST, "GAS Comeback Request"},
11858     {PA_GAS_COMEBACK_RESPONSE, "GAS Comeback Response"},
11859     {PA_TDLS_DISCOVERY_RESPONSE, "TDLS Discovery Response"},
11860     {0x00, NULL}
11861   };
11862
11863   static const value_string category_codes[] = {
11864     {CAT_SPECTRUM_MGMT, "Spectrum Management (SM)"},
11865     {0x80 | CAT_SPECTRUM_MGMT, "Spectrum Management (SM) (error)"},
11866     {CAT_QOS, "Quality of Service (QoS)"},
11867     {0x80 | CAT_QOS, "Quality of Service (QoS (error))"},
11868     {CAT_DLS, "Direct-Link Setup (DLS)"},
11869     {0x80 | CAT_DLS, "Direct-Link Setup (DLS) (error)"},
11870     {CAT_BLOCK_ACK, "Block Ack"},
11871     {0x80 | CAT_BLOCK_ACK, "Block Ack (error)"},
11872     {CAT_PUBLIC, "Public Action"},
11873     {0x80 | CAT_PUBLIC, "Public Action (error)"},
11874     {CAT_RADIO_MEASUREMENT, "Radio Measurement"},
11875     {0x80 | CAT_RADIO_MEASUREMENT, "Radio Measurement (error)"},
11876     {CAT_FAST_BSS_TRANSITION, "Fast BSS Transition"},
11877     {0x80 | CAT_FAST_BSS_TRANSITION, "Fast BSS Transition (error)"},
11878     {CAT_HT, "High Throughput"},
11879     {0x80 | CAT_HT, "High Throughput (error)"},
11880     {CAT_SA_QUERY, "SA Query"},
11881     {0x80 | CAT_SA_QUERY, "SA Query (error)"},
11882     {CAT_PUBLIC_PROTECTED, "Protected Dual of Public Action"},
11883     {0x80 | CAT_PUBLIC_PROTECTED, "Protected Dual of Public Action (error)"},
11884     {CAT_WNM, "WNM"},
11885     {0x80 | CAT_WNM, "WNM (error)"},
11886     {CAT_UNPROTECTED_WNM, "Unprotected WNM"},
11887     {0x80 | CAT_UNPROTECTED_WNM, "Unprotected WNM (error)"},
11888     {CAT_TDLS, "TDLS"},
11889     {0x80 | CAT_TDLS, "TDLS (error)"},
11890     {CAT_MESH, "MESH"},
11891     {0x80 | CAT_MESH, "Mesh (error)"},
11892     {CAT_MULTIHOP, "Multihop"},
11893     {0x80 | CAT_MULTIHOP, "Multihop (error)"},
11894     {CAT_SELF_PROTECTED, "Self-protected"},
11895     {0x80 | CAT_SELF_PROTECTED, "Self-protected (error)"},
11896     {CAT_MGMT_NOTIFICATION, "Management Notification"},
11897     {0x80 | CAT_MGMT_NOTIFICATION, "Management Notification (error)"},
11898     {CAT_VENDOR_SPECIFIC_PROTECTED, "Vendor-specific Protected"},
11899     {0x80 | CAT_VENDOR_SPECIFIC_PROTECTED, "Vendor-specific Protected (error)"},
11900     {CAT_VENDOR_SPECIFIC, "Vendor Specific"},
11901     {0x80 | CAT_VENDOR_SPECIFIC, "Vendor Specific (error)"},
11902     {0, NULL}
11903   };
11904
11905   static const value_string action_codes[] ={
11906     {SM_ACTION_MEASUREMENT_REQUEST, "Measurement Request"},
11907     {SM_ACTION_MEASUREMENT_REPORT, "Measurement Report"},
11908     {SM_ACTION_TPC_REQUEST, "TPC Request"},
11909     {SM_ACTION_TPC_REPORT, "TPC Report"},
11910     {SM_ACTION_CHAN_SWITCH_ANNC, "Channel Switch Announcement"},
11911     {0, NULL}
11912   };
11913
11914   static const value_string vendor_action_types_mrvl[] ={
11915     {MRVL_ACTION_MESH_MANAGEMENT, "Mesh Management"},
11916     {0, NULL}
11917   };
11918
11919   static const value_string mesh_mgt_action_codes_mrvl[] ={
11920     {MRVL_MESH_MGMT_ACTION_RREQ, "Route Request"},
11921     {MRVL_MESH_MGMT_ACTION_RREP, "Route Response"},
11922     {MRVL_MESH_MGMT_ACTION_RERR, "Route Error"},
11923     {MRVL_MESH_MGMT_ACTION_PLDM, "Peer Link Down"},
11924     {0, NULL}
11925   };
11926
11927   static const value_string mesh_path_selection_codes[] ={
11928     {0x0, "Hybrid Wireless Mesh Protocol"},
11929     {0, NULL}
11930   };
11931
11932   static const value_string mesh_metric_codes[] ={
11933     {0x0, "Airtime Link Metric"},
11934     {0, NULL}
11935   };
11936
11937   static const value_string wme_action_codes[] = {
11938     {0x00, "Setup request"},
11939     {0x01, "Setup response"},
11940     {0x02, "Teardown"},
11941     {0x00, NULL}
11942   };
11943
11944   static const value_string wme_status_codes[] = {
11945     {0x00, "Admission accepted"},
11946     {0x01, "Invalid parameters"},
11947     {0x03, "Refused"},
11948     {0x00, NULL}
11949   };
11950
11951   static const value_string mesh_action[] ={
11952     {MESH_ACTION_LINK_METRIC_REPORT, "Mesh Link Metric Report"},
11953     {MESH_ACTION_HWMP, "HWMP Mesh Path Selection"},
11954     {MESH_ACTION_GATE_ANNOUNCE, "Gate Announcement"},
11955     {MESH_ACTION_CONGESTION_CTL, "Congestion Control Notification"},
11956     {MESH_ACTION_MCCA_SETUP_REQUEST, "MCCA Setup Request"},
11957     {MESH_ACTION_MCCA_SETUP_REPLY, "MCCA Setup Reply"},
11958     {MESH_ACTION_MCCA_ADV_REQUEST, "MCCA Advertisement Request"},
11959     {MESH_ACTION_MCCA_ADV, "MCCA Advertisement"},
11960     {MESH_ACTION_MCCA_TEARDOWN, "MCCA Teardown"},
11961     {MESH_ACTION_TBTT_ADJ_REQUEST, "TBTT Adjustment Request"},
11962     {MESH_ACTION_TBTT_ADJ_RESPONSE, "TBTT Adjustment Response"},
11963     {0, NULL}
11964   };
11965
11966   static const value_string multihop_action[] ={
11967     {MULTIHOP_ACTION_PROXY_UPDATE, "Proxy Update"},
11968     {MULTIHOP_ACTION_PROXY_UPDATE_CONF, "Proxy Update Confirmation"},
11969     {0, NULL}
11970   };
11971
11972   static const value_string selfprot_action[] = {
11973     {SELFPROT_ACTION_MESH_PEERING_OPEN, "Mesh Peering Open"},
11974     {SELFPROT_ACTION_MESH_PEERING_CONFIRM, "Mesh Peering Confirm"},
11975     {SELFPROT_ACTION_MESH_PEERING_CLOSE, "Mesh Peering Close"},
11976     {SELFPROT_ACTION_MESH_GROUP_KEY_INFORM, "Mesh Group Key Inform"},
11977     {SELFPROT_ACTION_MESH_GROUP_KEY_ACK, "Mesh Group Key Ack"},
11978     {0, NULL}
11979   };
11980
11981   static const value_string mesh_peering_proto_ids[] = {
11982     {MESH_PEERING_PROTO_MGMT, "Mesh peering management protocol"},
11983     {MESH_PEERING_PROTO_AMPE, "Authenticated mesh peering exchange protocol"},
11984     {MESH_PEERING_PROTO_VENDOR, "Vendor specific"},
11985     {0, NULL}
11986   };
11987
11988   static const true_false_string hwmp_targ_usn_flags = {
11989     "[USN = 1] Target Sequence Number Unknown at Originator",
11990     "[USN = 0] Target Sequence Number Known at Originator"
11991   };
11992
11993   static const true_false_string hwmp_targ_to_flags = {
11994     "[TO = 1] Only Target Will Respond",
11995     "[TO = 0] Intermediate Nodes May Respond"
11996   };
11997
11998   static const value_string ack_policy[] = {
11999     {0x00, "Normal Ack"},
12000     {0x01, "No Ack"},
12001     {0x02, "No explicit acknowledgment"},
12002     {0x03, "Block Ack"},
12003     {0x00, NULL}
12004   };
12005
12006   static const value_string qos_action_codes[] = {
12007     {SM_ACTION_ADDTS_REQUEST, "ADDTS Request"},
12008     {SM_ACTION_ADDTS_RESPONSE, "ADDTS Response"},
12009     {SM_ACTION_DELTS, "DELTS"},
12010     {SM_ACTION_QOS_SCHEDULE, "Schedule"},
12011     {0, NULL}
12012   };
12013
12014   static const value_string ba_action_codes[] = {
12015     {BA_ADD_BLOCK_ACK_REQUEST, "Add Block Ack Request"},
12016     {BA_ADD_BLOCK_ACK_RESPONSE, "Add Block Ack Response"},
12017     {BA_DELETE_BLOCK_ACK, "Delete Block Ack"},
12018     {0x00, NULL}
12019   };
12020
12021   static const value_string dls_action_codes[] = {
12022     {SM_ACTION_DLS_REQUEST, "DLS Request"},
12023     {SM_ACTION_DLS_RESPONSE, "DLS Response"},
12024     {SM_ACTION_DLS_TEARDOWN, "DLS Teardown"},
12025     {0, NULL}
12026   };
12027
12028   static const value_string tsinfo_type[] = {
12029     {0x0, "Aperiodic or unspecified Traffic"},
12030     {0x1, "Periodic Traffic"},
12031     {0, NULL}
12032   };
12033
12034   static const value_string tsinfo_direction[] = {
12035     {0x00, "Uplink"},
12036     {0x01, "Downlink"},
12037     {0x02, "Direct link"},
12038     {0x03, "Bidirectional link"},
12039     {0, NULL}
12040   };
12041
12042   static const value_string tsinfo_access[] = {
12043     {0x00, "Reserved"},
12044     {0x01, "EDCA"},
12045     {0x02, "HCCA"},
12046     {0x03, "HEMM"},
12047     {0, NULL}
12048   };
12049
12050   static const value_string qos_up[] = {
12051     {0x00, "Best Effort"},
12052     {0x01, "Background"},
12053     {0x02, "Spare"},
12054     {0x03, "Excellent Effort"},
12055     {0x04, "Controlled Load"},
12056     {0x05, "Video"},
12057     {0x06, "Voice"},
12058     {0x07, "Network Control"},
12059     {0, NULL}
12060   };
12061
12062   static const value_string classifier_type[] = {
12063     {0x00, "Ethernet parameters"},
12064     {0x01, "TCP/UDP IP parameters"},
12065     {0x02, "IEEE 802.1D/Q parameters"},
12066     {0, NULL}
12067   };
12068
12069   static const true_false_string ieee80211_block_ack_control_ack_policy_flag = {
12070       "Immediate Acknowledgement Required",
12071       "Sender Does Not Require Immediate Acknowledgement"
12072   };
12073
12074   static const value_string ieee80211_block_ack_request_type_flags[] = {
12075     {0x00, "Basic Block Ack Request"},
12076     {0x01, "Reserved"},
12077     {0x02, "Compressed Block Ack Request"},
12078     {0x03, "Multi-TID Block Ack Request"},
12079     {0x00, NULL}
12080   };
12081
12082   static const value_string ieee80211_block_ack_type_flags[] = {
12083     {0x00, "Basic Block Ack"},
12084     {0x01, "Reserved"},
12085     {0x02, "Compressed Block"},
12086     {0x03, "Multi-TID Block"},
12087     {0x00, NULL}
12088   };
12089
12090   static const value_string ft_action_codes[] ={
12091     {FT_ACTION_REQUEST, "FT Request"},
12092     {FT_ACTION_RESPONSE, "FT Response"},
12093     {FT_ACTION_CONFIRM, "FT Confirm"},
12094     {FT_ACTION_ACK, "FT Ack"},
12095     {0, NULL}
12096   };
12097
12098   static const value_string sa_query_action_codes[] ={
12099     {SA_QUERY_REQUEST, "SA Query Request"},
12100     {SA_QUERY_RESPONSE, "SA Query Response"},
12101     {0, NULL}
12102   };
12103
12104   static const value_string ieee80211_data_encap_payload_types[] = {
12105     {1, "Remote Request/Response"},
12106     {2, "TDLS"},
12107     {0, NULL}
12108   };
12109
12110   static hf_register_info hf[] = {
12111     {&hf_ieee80211_fc_field,
12112      {"Frame Control Field", "wlan.fc", FT_UINT16, BASE_HEX, NULL, 0,
12113       "MAC Frame control", HFILL }},
12114
12115     {&hf_ieee80211_fc_proto_version,
12116      {"Version", "wlan.fc.version", FT_UINT8, BASE_DEC, NULL, 0,
12117       "MAC Protocol version", HFILL }},  /* 0 */
12118
12119     {&hf_ieee80211_fc_frame_type,
12120      {"Type", "wlan.fc.type", FT_UINT8, BASE_DEC, VALS(frame_type), 0,
12121       "Frame type", HFILL }},
12122
12123     {&hf_ieee80211_fc_frame_subtype,
12124      {"Subtype", "wlan.fc.subtype", FT_UINT8, BASE_DEC, NULL, 0,
12125       "Frame subtype", HFILL }},  /* 2 */
12126
12127     {&hf_ieee80211_fc_frame_type_subtype,
12128      {"Type/Subtype", "wlan.fc.type_subtype", FT_UINT8, BASE_HEX, VALS(frame_type_subtype_vals), 0,
12129       "Type and subtype combined (first byte: type, second byte: subtype)", HFILL }},
12130
12131     {&hf_ieee80211_fc_flags,
12132      {"Protocol Flags", "wlan.flags", FT_UINT8, BASE_HEX, NULL, 0,
12133       NULL, HFILL }},
12134
12135     {&hf_ieee80211_fc_data_ds,
12136      {"DS status", "wlan.fc.ds", FT_UINT8, BASE_HEX, VALS (&tofrom_ds), (FLAG_FROM_DS|FLAG_TO_DS),
12137       "Data-frame DS-traversal status", HFILL }},  /* 3 */
12138
12139     {&hf_ieee80211_fc_to_ds,
12140      {"To DS", "wlan.fc.tods", FT_BOOLEAN, 8, TFS (&tods_flag), FLAG_TO_DS,
12141       "To DS flag", HFILL }},    /* 4 */
12142
12143     {&hf_ieee80211_fc_from_ds,
12144      {"From DS", "wlan.fc.fromds", FT_BOOLEAN, 8, TFS (&fromds_flag), FLAG_FROM_DS,
12145       "From DS flag", HFILL }},    /* 5 */
12146
12147     {&hf_ieee80211_fc_more_frag,
12148      {"More Fragments", "wlan.fc.frag", FT_BOOLEAN, 8, TFS (&more_frags), FLAG_MORE_FRAGMENTS,
12149       "More Fragments flag", HFILL }},  /* 6 */
12150
12151     {&hf_ieee80211_fc_retry,
12152      {"Retry", "wlan.fc.retry", FT_BOOLEAN, 8, TFS (&retry_flags), FLAG_RETRY,
12153       "Retransmission flag", HFILL }},
12154
12155     { &hf_ieee80211_fc_analysis_retransmission,
12156      {"Retransmission", "wlan.analysis.retransmission", FT_NONE, BASE_NONE,
12157       NULL, 0x0, "This frame is a suspected wireless retransmission", HFILL }},
12158
12159     { &hf_ieee80211_fc_analysis_retransmission_frame,
12160      {"Retransmission of frame", "wlan.analysis.retransmission_frame", FT_FRAMENUM, BASE_NONE,
12161       NULL, 0x0, "This is a retransmission of frame #", HFILL }},
12162
12163     {&hf_ieee80211_fc_pwr_mgt,
12164      {"PWR MGT", "wlan.fc.pwrmgt", FT_BOOLEAN, 8, TFS (&pm_flags), FLAG_POWER_MGT,
12165       "Power management status", HFILL }},
12166
12167     {&hf_ieee80211_fc_more_data,
12168      {"More Data", "wlan.fc.moredata", FT_BOOLEAN, 8, TFS (&md_flags), FLAG_MORE_DATA,
12169       "More data flag", HFILL }},
12170
12171     {&hf_ieee80211_fc_protected,
12172      {"Protected flag", "wlan.fc.protected", FT_BOOLEAN, 8, TFS (&protected_flags), FLAG_PROTECTED,
12173       NULL, HFILL }},
12174
12175     {&hf_ieee80211_fc_order,
12176      {"Order flag", "wlan.fc.order", FT_BOOLEAN, 8, TFS (&order_flags), FLAG_ORDER,
12177       "Strictly ordered flag", HFILL }},
12178
12179     {&hf_ieee80211_assoc_id,
12180      {"Association ID","wlan.aid",FT_UINT16, BASE_DEC, NULL, 0x3FFF,
12181       "Association-ID field", HFILL }},
12182
12183     {&hf_ieee80211_did_duration,
12184      {"Duration", "wlan.duration", FT_UINT16, BASE_DEC, NULL, 0,
12185       "Duration field", HFILL }},
12186
12187     {&hf_ieee80211_addr_da,
12188      {"Destination address", "wlan.da", FT_ETHER, BASE_NONE, NULL, 0,
12189       "Destination Hardware Address", HFILL }},
12190
12191     {&hf_ieee80211_addr_sa,
12192      {"Source address", "wlan.sa", FT_ETHER, BASE_NONE, NULL, 0,
12193       "Source Hardware Address", HFILL }},
12194
12195     { &hf_ieee80211_addr,
12196       {"Hardware address", "wlan.addr", FT_ETHER, BASE_NONE, NULL, 0,
12197        "SA, DA, BSSID, RA or TA Hardware Address", HFILL }},
12198
12199     {&hf_ieee80211_addr_ra,
12200      {"Receiver address", "wlan.ra", FT_ETHER, BASE_NONE, NULL, 0,
12201       "Receiving Station Hardware Address", HFILL }},
12202
12203     {&hf_ieee80211_addr_ta,
12204      {"Transmitter address", "wlan.ta", FT_ETHER, BASE_NONE, NULL, 0,
12205       "Transmitting Station Hardware Address", HFILL }},
12206
12207     {&hf_ieee80211_addr_bssid,
12208      {"BSS Id", "wlan.bssid", FT_ETHER, BASE_NONE, NULL, 0,
12209       "Basic Service Set ID", HFILL }},
12210
12211     {&hf_ieee80211_frag_number,
12212      {"Fragment number", "wlan.frag", FT_UINT16, BASE_DEC, NULL, 0,
12213       NULL, HFILL }},
12214
12215     {&hf_ieee80211_seq_number,
12216      {"Sequence number", "wlan.seq", FT_UINT16, BASE_DEC, NULL, 0,
12217       NULL, HFILL }},
12218
12219     {&hf_ieee80211_qos_tid,
12220      {"TID", "wlan.qos.tid", FT_UINT16, BASE_DEC, NULL, 0,
12221       NULL, HFILL }},
12222
12223     {&hf_ieee80211_qos_priority,
12224      {"Priority", "wlan.qos.priority", FT_UINT16, BASE_DEC, NULL, 0,
12225       "802.1D Tag", HFILL }},
12226
12227     {&hf_ieee80211_qos_eosp,
12228      {"EOSP", "wlan.qos.eosp", FT_BOOLEAN, 8, TFS (&eosp_flag), QOS_FLAG_EOSP,
12229       "EOSP Field", HFILL }},
12230
12231     {&hf_ieee80211_qos_bit4,
12232      {"QoS bit 4", "wlan.qos.bit4", FT_BOOLEAN, 8, TFS (&bit4_flag), QOS_FLAG_EOSP,
12233       NULL, HFILL }},
12234
12235     {&hf_ieee80211_qos_ack_policy,
12236      {"Ack Policy", "wlan.qos.ack", FT_UINT8, BASE_HEX,  VALS (&ack_policy), 0,
12237       NULL, HFILL }},
12238
12239     {&hf_ieee80211_qos_amsdu_present,
12240      {"Payload Type", "wlan.qos.amsdupresent", FT_BOOLEAN, BASE_NONE,
12241       TFS(&ieee80211_qos_amsdu_present_flag), 0x0, NULL, HFILL }},
12242
12243     {&hf_ieee80211_qos_txop_limit,
12244      {"TXOP Limit", "wlan.qos.txop_limit", FT_UINT16, BASE_DEC, NULL, 0,
12245       NULL, HFILL }},
12246
12247     {&hf_ieee80211_qos_buf_state_indicated,
12248      {"Buffer State Indicated", "wlan.qos.buf_state_indicated",
12249        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12250       NULL, HFILL }},
12251
12252     {&hf_ieee80211_qos_highest_pri_buf_ac,
12253      {"Highest-Priority Buffered AC", "wlan.qos.highest_pri_buf_ac",
12254        FT_UINT8, BASE_DEC, VALS(wme_acs), 0x0C,
12255       NULL, HFILL }},
12256
12257     {&hf_ieee80211_qos_qap_buf_load,
12258      {"QAP Buffered Load", "wlan.qos.qap_buf_load",
12259        FT_UINT8, BASE_DEC, NULL, 0xF0,
12260       NULL, HFILL }},
12261
12262     {&hf_ieee80211_qos_txop_dur_req,
12263      {"TXOP Duration Requested", "wlan.qos.txop_dur_req", FT_UINT16, BASE_DEC, NULL, 0,
12264       NULL, HFILL }},
12265
12266     {&hf_ieee80211_qos_queue_size,
12267      {"Queue Size", "wlan.qos.queue_size", FT_UINT16, BASE_DEC, NULL, 0,
12268       NULL, HFILL }},
12269
12270     {&hf_ieee80211_fcs,
12271      {"Frame check sequence", "wlan.fcs", FT_UINT32, BASE_HEX,
12272       NULL, 0, "Frame Check Sequence (FCS)", HFILL }},
12273
12274     {&hf_ieee80211_fcs_good,
12275      {"Good", "wlan.fcs_good", FT_BOOLEAN, BASE_NONE,
12276       NULL, 0x0, "True if the FCS is correct", HFILL }},
12277
12278     {&hf_ieee80211_fcs_bad,
12279      {"Bad", "wlan.fcs_bad", FT_BOOLEAN, BASE_NONE,
12280       NULL, 0x0, "True if the FCS is incorrect", HFILL }},
12281
12282     {&hf_ieee80211_fragment_overlap,
12283       {"Fragment overlap", "wlan.fragment.overlap", FT_BOOLEAN, BASE_NONE,
12284        NULL, 0x0, "Fragment overlaps with other fragments", HFILL }},
12285
12286     {&hf_ieee80211_fragment_overlap_conflict,
12287       {"Conflicting data in fragment overlap", "wlan.fragment.overlap.conflict",
12288        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
12289        "Overlapping fragments contained conflicting data", HFILL }},
12290
12291     {&hf_ieee80211_fragment_multiple_tails,
12292       {"Multiple tail fragments found", "wlan.fragment.multipletails",
12293        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
12294        "Several tails were found when defragmenting the packet", HFILL }},
12295
12296     {&hf_ieee80211_fragment_too_long_fragment,
12297       {"Fragment too long", "wlan.fragment.toolongfragment",
12298        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
12299        "Fragment contained data past end of packet", HFILL }},
12300
12301     {&hf_ieee80211_fragment_error,
12302       {"Defragmentation error", "wlan.fragment.error",
12303        FT_FRAMENUM, BASE_NONE, NULL, 0x0,
12304        "Defragmentation error due to illegal fragments", HFILL }},
12305
12306     {&hf_ieee80211_fragment_count,
12307       {"Fragment count", "wlan.fragment.count", FT_UINT32, BASE_DEC, NULL, 0x0,
12308        NULL, HFILL }},
12309
12310     {&hf_ieee80211_fragment,
12311       {"802.11 Fragment", "wlan.fragment", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
12312        NULL, HFILL }},
12313
12314     {&hf_ieee80211_fragments,
12315       {"802.11 Fragments", "wlan.fragments", FT_NONE, BASE_NONE, NULL, 0x0,
12316        NULL, HFILL }},
12317
12318     {&hf_ieee80211_reassembled_in,
12319       {"Reassembled 802.11 in frame", "wlan.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
12320        "This 802.11 packet is reassembled in this frame", HFILL }},
12321
12322     {&hf_ieee80211_reassembled_length,
12323       {"Reassembled 802.11 length", "wlan.reassembled.length", FT_UINT32, BASE_DEC, NULL, 0x0,
12324        "The total length of the reassembled payload", HFILL }},
12325
12326     {&hf_ieee80211_wep_iv,
12327      {"Initialization Vector", "wlan.wep.iv", FT_UINT24, BASE_HEX, NULL, 0,
12328       NULL, HFILL }},
12329
12330     {&hf_ieee80211_wep_iv_weak,
12331      {"Weak IV", "wlan.wep.weakiv", FT_BOOLEAN, BASE_NONE, NULL,0x0,
12332        NULL,HFILL}},
12333
12334     {&hf_ieee80211_tkip_extiv,
12335      {"TKIP Ext. Initialization Vector", "wlan.tkip.extiv", FT_STRING,
12336       BASE_NONE, NULL, 0, "TKIP Extended Initialization Vector", HFILL }},
12337
12338     {&hf_ieee80211_ccmp_extiv,
12339      {"CCMP Ext. Initialization Vector", "wlan.ccmp.extiv", FT_STRING,
12340       BASE_NONE, NULL, 0, "CCMP Extended Initialization Vector", HFILL }},
12341
12342     {&hf_ieee80211_wep_key,
12343      {"Key Index", "wlan.wep.key", FT_UINT8, BASE_DEC, NULL, 0,
12344       NULL, HFILL }},
12345
12346     {&hf_ieee80211_wep_icv,
12347      {"WEP ICV", "wlan.wep.icv", FT_UINT32, BASE_HEX, NULL, 0,
12348       NULL, HFILL }},
12349
12350     {&hf_ieee80211_block_ack_request_control,
12351      {"Block Ack Request (BAR) Control", "wlan.bar.control",
12352       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12353
12354     {&hf_ieee80211_block_ack_control,
12355      {"Block Ack Request Control", "wlan.ba.control",
12356       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12357
12358     {&hf_ieee80211_block_ack_control_ack_policy,
12359      {"BAR Ack Policy", "wlan.ba.control.ackpolicy",
12360       FT_BOOLEAN, 16, TFS (&ieee80211_block_ack_control_ack_policy_flag), 0x01, "Block Ack Request (BAR) Ack Policy", HFILL }},
12361
12362     {&hf_ieee80211_block_ack_control_multi_tid,
12363      {"Multi-TID", "wlan.ba.control.multitid",
12364       FT_BOOLEAN, 16, 0, 0x02, "Multi-Traffic Identifier (TID)", HFILL }},
12365
12366     {&hf_ieee80211_block_ack_control_compressed_bitmap,
12367      {"Compressed Bitmap", "wlan.ba.control.cbitmap",
12368       FT_BOOLEAN, 16, 0, 0x04, NULL, HFILL }},
12369
12370     {&hf_ieee80211_block_ack_control_reserved,
12371      {"Reserved", "wlan.ba.control.cbitmap",
12372       FT_UINT16, BASE_HEX, NULL, 0x0ff8, NULL, HFILL }},
12373
12374     {&hf_ieee80211_block_ack_control_basic_tid_info,
12375      {"TID for which a Basic BlockAck frame is requested", "wlan.ba.basic.tidinfo",
12376       FT_UINT16, BASE_HEX, NULL, 0xf000, "Traffic Identifier (TID) for which a Basic BlockAck frame is requested", HFILL }},
12377
12378     {&hf_ieee80211_block_ack_control_compressed_tid_info,
12379      {"TID for which a BlockAck frame is requested", "wlan.bar.compressed.tidinfo",
12380       FT_UINT16, BASE_HEX, NULL, 0xf000, "Traffic Identifier (TID) for which a BlockAck frame is requested", HFILL }},
12381
12382     {&hf_ieee80211_block_ack_control_multi_tid_info,
12383      {"Number of TIDs Present", "wlan.ba.mtid.tidinfo",
12384       FT_UINT16, BASE_HEX, NULL, 0xf000, "Number of Traffic Identifiers (TIDs) Present", HFILL }},
12385
12386     {&hf_ieee80211_block_ack_multi_tid_info,
12387      {"Traffic Identifier (TID) Info", "wlan.ba.mtid.tid",
12388       FT_UINT8, BASE_DEC, 0, 0, NULL, HFILL }},
12389
12390     {&hf_ieee80211_block_ack_multi_tid_reserved,
12391      {"Reserved", "wlan.bar.mtid.tidinfo.reserved",
12392       FT_UINT16, BASE_HEX, 0, 0x0fff, NULL, HFILL }},
12393
12394     {&hf_ieee80211_block_ack_multi_tid_value,
12395      {"Multi-TID Value", "wlan.bar.mtid.tidinfo.value",
12396       FT_UINT16, BASE_HEX, 0, 0xf000, NULL, HFILL }},
12397
12398     {&hf_ieee80211_block_ack_request_type,
12399      {"Block Ack Request Type", "wlan.bar.type",
12400       FT_UINT8, BASE_HEX, VALS(ieee80211_block_ack_request_type_flags), 0, "Block Ack Request (BAR) Type", HFILL }},
12401
12402     {&hf_ieee80211_block_ack_type,
12403      {"Block Ack Type", "wlan.ba.type",
12404       FT_UINT8, BASE_HEX, VALS(ieee80211_block_ack_type_flags), 0, NULL, HFILL }},
12405
12406     {&hf_ieee80211_block_ack_bitmap,
12407      {"Block Ack Bitmap", "wlan.ba.bm",
12408       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
12409
12410     {&hf_ieee80211_block_ack_bitmap_missing_frame,
12411      {"Missing frame", "wlan.ba.bm.missing_frame",
12412       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
12413
12414     {&hf_ieee80211_data_encap_payload_type,
12415      {"Payload Type", "wlan.data_encap.payload_type",
12416       FT_UINT8, BASE_DEC, VALS(ieee80211_data_encap_payload_types), 0, NULL,
12417       HFILL }},
12418
12419     {&hf_ieee80211_ff_tdls_action_code,
12420      {"Action code", "wlan_mgt.fixed.action_code",
12421       FT_UINT8, BASE_DEC, VALS(tdls_action_codes), 0,
12422       "Management action code", HFILL }},
12423
12424     {&hf_ieee80211_ff_target_channel,
12425      {"Target Channel", "wlan_mgt.fixed.target_channel",
12426       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12427
12428     {&hf_ieee80211_ff_regulatory_class,
12429      {"Regulatory Class", "wlan_mgt.fixed.regulatory_class",
12430       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12431
12432     {&hf_ieee80211_ff_wnm_action_code,
12433      {"Action code", "wlan_mgt.fixed.action_code",
12434       FT_UINT8, BASE_DEC, VALS(wnm_action_codes), 0,
12435       "Management action code", HFILL }},
12436
12437     {&hf_ieee80211_ff_request_mode_pref_cand,
12438      {"Preferred Candidate List Included",
12439       "wlan_mgt.fixed.request_mode.pref_cand",
12440       FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }},
12441     {&hf_ieee80211_ff_request_mode_abridged,
12442      {"Abridged", "wlan_mgt.fixed.request_mode.abridged",
12443       FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL }},
12444     {&hf_ieee80211_ff_request_mode_disassoc_imminent,
12445      {"Disassociation Imminent",
12446       "wlan_mgt.fixed.request_mode.disassoc_imminent",
12447       FT_UINT8, BASE_DEC, NULL, 0x04, NULL, HFILL }},
12448     {&hf_ieee80211_ff_request_mode_bss_term_included,
12449      {"BSS Termination Included",
12450       "wlan_mgt.fixed.request_mode.bss_term_included",
12451       FT_UINT8, BASE_DEC, NULL, 0x08, NULL, HFILL }},
12452     {&hf_ieee80211_ff_request_mode_ess_disassoc_imminent,
12453      {"ESS Disassociation Imminent",
12454       "wlan_mgt.fixed.request_mode.ess_disassoc_imminent",
12455       FT_UINT8, BASE_DEC, NULL, 0x10, NULL, HFILL }},
12456     {&hf_ieee80211_ff_disassoc_timer,
12457      {"Disassociation Timer", "wlan_mgt.fixed.disassoc_timer",
12458       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
12459     {&hf_ieee80211_ff_validity_interval,
12460      {"Validity Interval", "wlan_mgt.fixed.validity_interval",
12461       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12462     {&hf_ieee80211_ff_url_len,
12463      {"Session Information URL Length",
12464       "wlan_mgt.fixed.session_information.url_length",
12465       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
12466     {&hf_ieee80211_ff_url,
12467      {"Session Information URL", "wlan_mgt.fixed.session_information.url",
12468       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
12469   };
12470
12471   static const true_false_string qos_info_field_qack_flags = {
12472     "STAs/APs MIB attribute dot11QAckOptionImplemented is true",
12473     "STAs/APs MIB attribute dot11QAckOptionImplemented is false"
12474   };
12475
12476   static const true_false_string qos_info_field_more_data_ack_flags = {
12477     "STA can process Ack frames with More Data bit and will remain in the awake state.",
12478     "STA cannot process Ack frames with More Data bit in Frame Control field."
12479   };
12480
12481   static const true_false_string qos_info_field_queue_req_flags = {
12482     "AP can process a nonzero Queue Size subfield in the QoS Control field in QoS data frames",
12483     "AP cannot process Queue Size subfield in QoS data frames."
12484   };
12485
12486   /* 7.3.1.17 Table 19b-Settings of the Max SP Length subfield */
12487   static const value_string qos_info_field_max_sp_length_flags[] =
12488   {
12489     { 0x0, "QAP may deliver all buffered MSDUs and MMPDUs." },
12490     { 0x2, "QAP may deliver a maximum of two MSDUs and MMPDUs per SP." },
12491     { 0x1, "QAP may deliver a maximum of four MSDUs and MMPDUs per SP." },
12492     { 0x3, "QAP may deliver a maximum of six MSDUs and MMPDUs per SP." },
12493     { 0, NULL}
12494   };
12495
12496   static const true_false_string rsn_preauth_flags = {
12497     "Transmitter supports pre-authentication",
12498     "Transmitter does not support pre-authentication"
12499   };
12500
12501   static const true_false_string rsn_no_pairwise_flags = {
12502     "Transmitter cannot support WEP default key 0 simultaneously with "
12503     "Pairwise key",
12504     "Transmitter can support WEP default key 0 simultaneously with "
12505     "Pairwise key"
12506   };
12507
12508   static const value_string rsn_cap_replay_counter[] = {
12509     {0x00, "1 replay counter per PTKSA/GTKSA/STAKeySA"},
12510     {0x01, "2 replay counters per PTKSA/GTKSA/STAKeySA"},
12511     {0x02, "4 replay counters per PTKSA/GTKSA/STAKeySA"},
12512     {0x03, "16 replay counters per PTKSA/GTKSA/STAKeySA"},
12513     {0, NULL}
12514   };
12515
12516   static const true_false_string ht_ldpc_coding_flag = {
12517     "Transmitter supports receiving LDPC coded packets",
12518     "Transmitter does not support receiving LDPC coded packets"
12519   };
12520
12521   static const true_false_string ht_chan_width_flag = {
12522     "Transmitter supports 20MHz and 40MHz operation",
12523     "Transmitter only supports 20MHz operation"
12524   };
12525
12526   static const value_string ht_sm_pwsave_flag[] = {
12527     {0x00, "Static SM Power Save mode"},
12528     {0x01, "Dynamic SM Power Save mode"},
12529     {0x02, "Reserved"},
12530     {0x03, "SM Power Save disabled"},
12531     {0x00, NULL}
12532   };
12533
12534   static const true_false_string ht_green_flag = {
12535     "Transmitter is able to receive PPDUs with Green Field (GF) preamble",
12536     "Transmitter is not able to receive PPDUs with Green Field (GF) preamble"
12537   };
12538
12539   static const value_string ht_rx_stbc_flag[] = {
12540     {0x00, "No Rx STBC support"},
12541     {0x01, "Rx support of one spatial stream"},
12542     {0x02, "Rx support of one and two spatial streams"},
12543     {0x03, "Rx support of one, two, and three spatial streams"},
12544     {0x00, NULL}
12545   };
12546
12547   static const true_false_string ht_delayed_block_ack_flag = {
12548     "Transmitter supports HT-Delayed BlockAck",
12549     "Transmitter does not support HT-Delayed BlockAck"
12550   };
12551
12552   static const true_false_string ht_max_amsdu_flag = {
12553     "7935 bytes",
12554     "3839 bytes"
12555   };
12556
12557   static const true_false_string ht_dss_cck_40_flag = {
12558     "Will/Can use DSSS/CCK in 40 MHz",
12559     "Won't/Can't use of DSSS/CCK in 40 MHz"
12560   };
12561
12562   static const true_false_string ht_psmp_flag = {
12563     "Will/Can support PSMP operation",
12564     "Won't/Can't support PSMP operation"
12565   };
12566
12567   static const true_false_string ht_40_mhz_intolerant_flag = {
12568     "Use of 40 MHz transmissions restricted/disallowed",
12569     "Use of 40 MHz transmissions unrestricted/allowed"
12570   };
12571
12572   static const value_string ampduparam_mpdu_start_spacing_flags[] = {
12573     {0x00, "no restriction"},
12574     {0x01, "1/4 [usec]"},
12575     {0x02, "1/2 [usec]"},
12576     {0x03, "1 [usec]"},
12577     {0x04, "2 [usec]"},
12578     {0x05, "4 [usec]"},
12579     {0x06, "8 [usec]"},
12580     {0x07, "16 [usec]"},
12581     {0x00, NULL}
12582   };
12583
12584   static const true_false_string mcsset_tx_mcs_set_defined_flag = {
12585     "Defined",
12586     "Not Defined",
12587   };
12588
12589   static const true_false_string mcsset_tx_rx_mcs_set_not_equal_flag = {
12590     "Not Equal",
12591     "Equal",
12592   };
12593
12594   static const value_string mcsset_tx_max_spatial_streams_flags[] = {
12595     {0x00, "1 spatial stream"},
12596     {0x01, "2 spatial streams"},
12597     {0x02, "3 spatial streams"},
12598     {0x03, "4 spatial streams"},
12599     {0x00, NULL}
12600   };
12601
12602   static const value_string htex_transtime_flags[] = {
12603     {0x00, "No Transition"},
12604     {0x01, "400 usec"},
12605     {0x02, "1.5 msec"},
12606     {0x03, "5 msec"},
12607     {0x00, NULL}
12608   };
12609
12610   static const value_string htex_mcs_flags[] = {
12611     {0x00, "STA does not provide MCS feedback"},
12612     {0x01, "Reserved"},
12613     {0x02, "STA provides only unsolicited MCS feedback"},
12614     {0x03, "STA can provide MCS feedback in response to MRQ as well as unsolicited MCS feedback"},
12615     {0x00, NULL}
12616   };
12617
12618   static const value_string txbf_calib_flag[] = {
12619     {0x00, "incapable"},
12620     {0x01, "Limited involvement, cannot initiate"},
12621     {0x02, "Limited involvement, can initiate"},
12622     {0x03, "Fully capable"},
12623     {0x00, NULL}
12624   };
12625
12626   static const value_string txbf_feedback_flags[] = {
12627     {0x00, "not supported"},
12628     {0x01, "delayed feedback capable"},
12629     {0x02, "immediate feedback capable"},
12630     {0x03, "delayed and immediate feedback capable"},
12631     {0x00, NULL}
12632   };
12633
12634   static const value_string txbf_antenna_flags[] = {
12635     {0x00, "1 TX antenna sounding"},
12636     {0x01, "2 TX antenna sounding"},
12637     {0x02, "3 TX antenna sounding"},
12638     {0x03, "4 TX antenna sounding"},
12639     {0x00, NULL}
12640   };
12641
12642   static const value_string txbf_csi_max_rows_bf_flags[] = {
12643     {0x00, "1 row of CSI"},
12644     {0x01, "2 rows of CSI"},
12645     {0x02, "3 rows of CSI"},
12646     {0x03, "4 rows of CSI"},
12647     {0x00, NULL}
12648   };
12649
12650   static const value_string txbf_chan_est_flags[] = {
12651     {0x00, "1 space time stream"},
12652     {0x01, "2 space time streams"},
12653     {0x02, "3 space time streams"},
12654     {0x03, "4 space time streams"},
12655     {0x00, NULL}
12656   };
12657
12658   static const value_string txbf_min_group_flags[] = {
12659     {0x00, "No grouping supported"},
12660     {0x01, "Groups of 1,2 supported"},
12661     {0x02, "Groups of 1,4 supported"},
12662     {0x03, "Groups of 1,2,4 supported"},
12663     {0x00, NULL}
12664   };
12665
12666   static const value_string hta_ext_chan_offset_flag[] = {
12667     {0x00, "No Extension Channel"},
12668     {0x01, "Extension Channel above control channel"},
12669     {0x02, "Undefined"},
12670     {0x03, "Extension Channel below control channel"},
12671     {0x00, NULL}
12672   };
12673
12674   static const true_false_string hta_rec_tx_width_flag = {
12675     "Any channel width enabled",
12676     "Use 20MHz channel (control)"
12677   };
12678
12679   static const true_false_string hta_rifs_mode_flag = {
12680     "Use of RIFS permitted",
12681     "Use of RIFS prohibited"
12682   };
12683
12684   static const true_false_string hta_controlled_access_flag = {
12685     "Not only PSMP",
12686     "PSMP only"
12687   };
12688
12689   static const value_string hta_service_interval_flag[] = {
12690     {0x00, "5ms"},
12691     {0x01, "10ms"},
12692     {0x02, "15ms"},
12693     {0x03, "20ms"},
12694     {0x04, "25ms"},
12695     {0x05, "30ms"},
12696     {0x06, "35ms"},
12697     {0x07, "40ms"},
12698     {0x00, NULL}
12699   };
12700
12701   static const value_string hta_operating_mode_flag[] = {
12702     {0x00, "Pure HT, no protection"},
12703     {0x01, "There may be non-HT devices (control & ext channel)"},
12704     {0x02, "No non-HT is associated, but at least 1 20MHz is. protect on"},
12705     {0x03, "Mixed: no non-HT is associated, protect on"},
12706     {0x00, NULL}
12707   };
12708
12709   static const true_false_string hta_non_gf_devices_flag = {
12710     "All HT devices associated are GF capable",
12711     "One or More HT devices are not GF capable"
12712   };
12713
12714   static const true_false_string hta_dual_stbc_protection_flag = {
12715     "Dual CTS protections is used",
12716     "Regular use of RTS/CTS"
12717   };
12718
12719   static const true_false_string hta_secondary_beacon_flag = {
12720     "Secondary Beacon",
12721     "Primary Beacon"
12722   };
12723
12724   static const true_false_string hta_lsig_txop_protection_flag = {
12725     "Full Support",
12726     "Not full support"
12727   };
12728
12729   static const true_false_string hta_pco_active_flag = {
12730     "PCO is activated in the BSS",
12731     "PCO is not activated in the BSS"
12732   };
12733
12734   static const true_false_string hta_pco_phase_flag = {
12735     "Switch to 20MHz phase/keep 20MHz",
12736     "Switch to 40MHz phase/keep 40MHz"
12737   };
12738
12739   static const value_string ht_info_secondary_channel_offset_flags[] = {
12740     {0x00, "No secondary channel"},
12741     {0x01, "Secondary channel is above the primary channel"},
12742     {0x02, "Reserved"},
12743     {0x03, "Secondary channel is below the primary channel"},
12744     {0x00, NULL}
12745   };
12746
12747   static const true_false_string ht_info_channel_width_flag = {
12748     "Channel of any width supported",
12749     "20 MHz channel width only"
12750   };
12751
12752   static const true_false_string ht_info_rifs_mode_flag = {
12753     "Permitted",
12754     "Prohibited"
12755   };
12756
12757   static const true_false_string ht_info_psmp_stas_only_flag = {
12758     "Association requests are accepted from only PSMP capable STA",
12759     "Association requests are accepted regardless of PSMP capability"
12760   };
12761
12762   static const value_string ht_info_service_interval_granularity_flags[] = {
12763     {0x00, "5 ms"},
12764     {0x01, "10 ms"},
12765     {0x02, "15 ms"},
12766     {0x03, "20 ms"},
12767     {0x04, "25 ms"},
12768     {0x05, "30 ms"},
12769     {0x06, "35 ms"},
12770     {0x07, "40 ms"},
12771     {0x00, NULL}
12772   };
12773
12774   static const value_string ht_info_operating_mode_flags[] = {
12775     {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"},
12776     {0x01, "HT non-member protection mode"},
12777     {0x02, "Only HT STAs in the BSS, however, there exists at least one 20 MHz STA"},
12778     {0x03, "HT mixed mode"},
12779     {0x00, NULL}
12780   };
12781
12782   static const true_false_string ht_info_non_greenfield_sta_present_flag = {
12783     "One or more associated STAs are not greenfield capable",
12784     "All associated STAs are greenfield capable"
12785   };
12786
12787   static const true_false_string ht_info_transmit_burst_limit_flag = {
12788     "2.4 GHz - 6.16 ms | All other bands - 3.08 ms",
12789     "No limit"
12790   };
12791
12792   static const true_false_string ht_info_obss_non_ht_stas_present_flag = {
12793     "Use of protection for non-HT STAs by overlapping BSSs is needed",
12794     "Use of protection for non-HT STAs by overlapping BSSs is not needed"
12795   };
12796
12797   static const true_false_string ht_info_dual_beacon_flag = {
12798     "AP transmits a secondary beacon",
12799     "No second beacon is transmitted"
12800   };
12801
12802   static const true_false_string ht_info_dual_cts_protection_flag = {
12803     "Required",
12804     "Not required"
12805   };
12806
12807   static const true_false_string ht_info_secondary_beacon_flag = {
12808     "Secondary beacon",
12809     "Primary beacon"
12810   };
12811
12812   static const true_false_string ht_info_lsig_txop_protection_full_support_flag = {
12813     "All HT STAs in the BSS support L-SIG TXOP protection",
12814     "One or more HT STAs in the BSS do not support L-SIG TXOP protection"
12815   };
12816
12817   static const true_false_string ht_info_pco_phase_flag = {
12818     "Switch to or continue 40 MHz phase",
12819     "Switch to or continue 20 MHz phase"
12820   };
12821
12822   static const true_false_string htc_lac_trq_flag = {
12823     "Want sounding PPDU",
12824     "Don't want sounding PPDU"
12825   };
12826
12827   static const true_false_string htc_lac_mai_mrq_flag = {
12828     "MCS feedback requested",
12829     "No MCS feedback requested"
12830   };
12831
12832   static const value_string ieee80211_htc_lac_asel_command_flags[] = {
12833     {0x00, "Transmit Antenna Selection Sounding Indication (TXASSI)"},
12834     {0x01, "Transmit Antenna Selection Sounding Request (TXASSR)"},
12835     {0x02, "Receive Antenna Selection Sounding Indication (RXASSI)"},
12836     {0x03, "Receive Antenna Selection Sounding Request (RXASSR)"},
12837     {0x04, "Sounding Label"},
12838     {0x05, "No feedback, ASEL training failure"},
12839     {0x06, "Transmit Antenna Selection Sounding Indication (TXASSI) requesting feedback of explicit CSI"},
12840     {0x07, "Reserved"},
12841     {0x00, NULL}
12842   };
12843
12844   static const value_string ieee80211_htc_cal_pos_flags[] = {
12845     {0x00, "Not a calibration frame"},
12846     {0x01, "Calibration Start"},
12847     {0x02, "Sounding Response"},
12848     {0x03, "Sounding Complete"},
12849     {0x00, NULL}
12850   };
12851
12852   static const true_false_string ieee80211_htc_ndp_announcement_flag = {
12853     "NDP will follow",
12854     "No NDP will follow"
12855   };
12856
12857   static const value_string ieee80211_htc_csi_steering_flags[] = {
12858     {0x00, "No feedback required"},
12859     {0x01, "CSI"},
12860     {0x02, "Non-compressed Beamforming Feedback Matrix"},
12861     {0x03, "Compressed Beamforming Feedback Matrix"},
12862     {0x00, NULL}
12863   };
12864
12865   static const value_string ieee80211_tag_secondary_channel_offset_flags[] = {
12866     {0x00, "No Secondary Channel"},
12867     {0x01, "Above Primary Channel"},
12868     {0x02, "Reserved"},
12869     {0x03, "Below Primary Channel"},
12870     {0x00, NULL}
12871   };
12872
12873   static const value_string ieee80211_tag_ext_channel_switch_announcement_switch_mode_flags[] = {
12874     {0x00, "Frames may be transmitted before the channel switch has been completed"},
12875     {0x01, "No more frames are to be transmitted until the channel switch has been completed"},
12876     {0x00, NULL}
12877   };
12878
12879   static const value_string service_interval_granularity_vals[] = {
12880     { 0, "5 ms" },
12881     { 1, "10 ms" },
12882     { 2, "15 ms" },
12883     { 3, "20 ms" },
12884     { 4, "25 ms" },
12885     { 5, "30 ms" },
12886     { 6, "35 ms" },
12887     { 7, "40 ms" },
12888     { 0x00, NULL }
12889   };
12890
12891   static const value_string wep_type_vals[] = {
12892     { AIRPDCAP_KEY_TYPE_WEP, STRING_KEY_TYPE_WEP },
12893     { AIRPDCAP_KEY_TYPE_WPA_PWD, STRING_KEY_TYPE_WPA_PWD },
12894     { AIRPDCAP_KEY_TYPE_WPA_PSK, STRING_KEY_TYPE_WPA_PSK },
12895     { 0x00, NULL }
12896   };
12897
12898   static hf_register_info ff[] = {
12899
12900     {&hf_ieee80211_ff_timestamp,
12901      {"Timestamp", "wlan_mgt.fixed.timestamp", FT_UINT64, BASE_HEX,
12902       NULL, 0, NULL, HFILL }},
12903
12904     {&hf_ieee80211_ff_auth_alg,
12905      {"Authentication Algorithm", "wlan_mgt.fixed.auth.alg",
12906       FT_UINT16, BASE_DEC, VALS (&auth_alg), 0, NULL, HFILL }},
12907
12908     {&hf_ieee80211_ff_beacon_interval,
12909      {"Beacon Interval", "wlan_mgt.fixed.beacon", FT_UINT32, BASE_CUSTOM, beacon_interval_base_custom, 0,
12910       NULL, HFILL }},
12911
12912     {&hf_ieee80211_fixed_parameters,
12913      {"Fixed parameters", "wlan_mgt.fixed.all", FT_UINT16, BASE_DEC, NULL, 0,
12914       NULL, HFILL }},
12915
12916     {&hf_ieee80211_tagged_parameters,
12917      {"Tagged parameters", "wlan_mgt.tagged.all", FT_UINT16, BASE_DEC, NULL, 0,
12918       NULL, HFILL }},
12919
12920     {&hf_ieee80211_tag_ssid,
12921      {"SSID", "wlan_mgt.ssid", FT_STRING, BASE_NONE, NULL, 0,
12922       "Indicates the identity of an ESS or IBSS", HFILL }},
12923
12924     {&hf_ieee80211_tag_supp_rates,
12925      {"Supported Rates", "wlan_mgt.supported_rates",
12926       FT_UINT8, BASE_HEX, VALS(ieee80211_supported_rates_vals), 0x0,
12927       "In Mbit/sec, (B) for Basic Rates", HFILL }},
12928
12929     {&hf_ieee80211_tag_fh_dwell_time,
12930      {"Dwell Time", "wlan_mgt.fh.dwell_time",
12931       FT_UINT16, BASE_HEX, NULL, 0x0,
12932       "In Time Unit (TU)", HFILL }},
12933
12934     {&hf_ieee80211_tag_fh_hop_set,
12935      {"Hop Set", "wlan_mgt.fh.hop_set",
12936       FT_UINT8, BASE_DEC, NULL, 0x0,
12937       NULL, HFILL }},
12938
12939     {&hf_ieee80211_tag_fh_hop_pattern,
12940      {"Hop Pattern", "wlan_mgt.fh.hop_pattern",
12941       FT_UINT8, BASE_DEC, NULL, 0x0,
12942       NULL, HFILL }},
12943
12944     {&hf_ieee80211_tag_fh_hop_index,
12945      {"Hop Index", "wlan_mgt.fh.hop_index",
12946       FT_UINT8, BASE_DEC, NULL, 0x0,
12947       NULL, HFILL }},
12948
12949     {&hf_ieee80211_ff_block_ack_params,
12950       {"Block Ack Parameters", "wlan_mgt.fixed.baparams",
12951       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12952
12953     {&hf_ieee80211_ff_block_ack_params_amsdu_permitted,
12954       {"A-MSDUs", "wlan_mgt.fixed.baparams.amsdu",
12955       FT_BOOLEAN, 16, TFS (&ff_block_ack_params_amsdu_permitted_flag), 0x0001, "A-MSDU Permitted in QoS Data MPDUs", HFILL }},
12956
12957     {&hf_ieee80211_ff_block_ack_params_policy,
12958       {"Block Ack Policy", "wlan_mgt.fixed.baparams.policy",
12959       FT_BOOLEAN, 16, TFS (&ff_block_ack_params_policy_flag), 0x0002, NULL, HFILL }},
12960
12961     {&hf_ieee80211_ff_block_ack_params_tid,
12962       {"Traffic Identifier", "wlan_mgt.fixed.baparams.tid",
12963       FT_UINT16, BASE_HEX, NULL, 0x003C, NULL, HFILL }},
12964
12965     {&hf_ieee80211_ff_block_ack_params_buffer_size,
12966       {"Number of Buffers (1 Buffer = 2304 Bytes)", "wlan_mgt.fixed.baparams.buffersize",
12967       FT_UINT16, BASE_DEC, NULL, 0xFFC0, "Number of Buffers", HFILL }},
12968
12969     {&hf_ieee80211_ff_block_ack_timeout,
12970       {"Block Ack Timeout", "wlan_mgt.fixed.batimeout",
12971       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
12972
12973     {&hf_ieee80211_ff_block_ack_ssc,
12974      {"Block Ack Starting Sequence Control (SSC)", "wlan_mgt.fixed.ssc",
12975       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
12976
12977     {&hf_ieee80211_ff_block_ack_ssc_fragment,
12978      {"Fragment", "wlan_mgt.fixed.fragment",
12979       FT_UINT16, BASE_DEC, 0, 0x000f, NULL, HFILL }},
12980
12981     {&hf_ieee80211_ff_block_ack_ssc_sequence,
12982      {"Starting Sequence Number", "wlan_mgt.fixed.sequence",
12983       FT_UINT16, BASE_DEC, 0, 0xfff0, NULL, HFILL }},
12984
12985     {&hf_ieee80211_ff_delba_param,
12986      {"Delete Block Ack (DELBA) Parameter Set", "wlan_mgt.fixed.delba.param",
12987       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
12988
12989     {&hf_ieee80211_ff_delba_param_reserved,
12990      {"Reserved", "wlan_mgt.fixed.delba.param.reserved",
12991       FT_UINT16, BASE_HEX, 0, 0x07ff, NULL, HFILL }},
12992
12993     {&hf_ieee80211_ff_delba_param_init,
12994      {"Initiator", "wlan_mgt.fixed.delba.param.initiator",
12995       FT_BOOLEAN, 16, 0, 0x0800, NULL, HFILL }},
12996
12997     {&hf_ieee80211_ff_delba_param_tid,
12998      {"TID", "wlan_mgt.fixed.delba.param.tid",
12999       FT_UINT16, BASE_HEX, 0, 0xf000, "Traffic Identifier (TID)", HFILL }},
13000
13001     {&hf_ieee80211_ff_max_reg_pwr,
13002      {"Maximum Regulation Power", "wlan_mgt.fixed.maxregpwr",
13003       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
13004
13005     {&hf_ieee80211_ff_measurement_pilot_int,
13006      {"Measurement Pilot Interval", "wlan_mgt.fixed.msmtpilotint",
13007       FT_UINT16, BASE_HEX, 0, 0, "Measurement Pilot Interval Fixed Field", HFILL }},
13008
13009     {&hf_ieee80211_ff_country_str,
13010      {"Country String", "wlan_mgt.fixed.country",
13011       FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
13012
13013     {&hf_ieee80211_ff_max_tx_pwr,
13014      {"Maximum Transmit Power", "wlan_mgt.fixed.maxtxpwr",
13015       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
13016
13017     {&hf_ieee80211_ff_tx_pwr_used,
13018      {"Transmit Power Used", "wlan_mgt.fixed.txpwr",
13019       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
13020
13021     {&hf_ieee80211_ff_transceiver_noise_floor,
13022      {"Transceiver Noise Floor", "wlan_mgt.fixed.tnoisefloor",
13023       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
13024
13025     {&hf_ieee80211_ff_channel_width,
13026      {"Supported Channel Width", "wlan_mgt.fixed.chanwidth",
13027       FT_UINT8, BASE_HEX, VALS (ff_channel_width_vals), 0, NULL, HFILL }},
13028
13029     {&hf_ieee80211_ff_qos_info_ap,
13030      {"QoS Information (AP)", "wlan_mgt.fixed.qosinfo.ap",
13031       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13032
13033     {&hf_ieee80211_ff_qos_info_ap_edca_param_set_counter,
13034      {"EDCA Parameter Set Update Count", "wlan_mgt.fixed.qosinfo.ap.edcaupdate",
13035       FT_UINT8, BASE_HEX, NULL, 0x0F, "Enhanced Distributed Channel Access (EDCA) Parameter Set Update Count", HFILL }},
13036
13037     {&hf_ieee80211_ff_qos_info_ap_q_ack,
13038      {"Q-Ack", "wlan_mgt.fixed.qosinfo.ap.qack",
13039       FT_BOOLEAN, 8, TFS (&ff_qos_info_ap_q_ack_flag), 0x10, "QoS Ack", HFILL }},
13040
13041     {&hf_ieee80211_ff_qos_info_ap_queue_req,
13042      {"Queue Request", "wlan_mgt.fixed.qosinfo.ap",
13043       FT_BOOLEAN, 8, TFS (&ff_qos_info_ap_queue_req_flag), 0x20, NULL, HFILL }},
13044
13045     {&hf_ieee80211_ff_qos_info_ap_txop_request,
13046      {"TXOP Request", "wlan_mgt.fixed.qosinfo.ap.txopreq",
13047       FT_BOOLEAN, 8, TFS (&ff_qos_info_ap_txop_request_flag), 0x40, "Transmit Opportunity (TXOP) Request", HFILL }},
13048
13049     {&hf_ieee80211_ff_qos_info_ap_reserved,
13050      {"Reserved", "wlan_mgt.fixed.qosinfo.ap.reserved",
13051       FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
13052
13053     {&hf_ieee80211_ff_qos_info_sta,
13054      {"QoS Information (STA)", "wlan_mgt.fixed.qosinfo.sta",
13055       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13056
13057     {&hf_ieee80211_ff_qos_info_sta_ac_vo,
13058      {"AC_VO", "wlan_mgt.fixed.qosinfo.sta.ac.vo",
13059       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x01, NULL, HFILL }},
13060
13061     {&hf_ieee80211_ff_qos_info_sta_ac_vi,
13062      {"AC_VI", "wlan_mgt.fixed.qosinfo.sta.ac.vi",
13063       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x02, NULL, HFILL }},
13064
13065     {&hf_ieee80211_ff_qos_info_sta_ac_bk,
13066      {"AC_BK", "wlan_mgt.fixed.qosinfo.sta.ac.bk",
13067       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x04, NULL, HFILL }},
13068
13069     {&hf_ieee80211_ff_qos_info_sta_ac_be,
13070      {"AC_BE", "wlan_mgt.fixed.qosinfo.sta.ac.be",
13071       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_ac_flag), 0x08, NULL, HFILL }},
13072
13073     {&hf_ieee80211_ff_qos_info_sta_q_ack,
13074      {"Q-Ack", "wlan_mgt.fixed.qosinfo.sta.qack",
13075       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_q_ack_flag), 0x10, "QoS Ack", HFILL }},
13076
13077     {&hf_ieee80211_ff_qos_info_sta_max_sp_len,
13078      {"Service Period (SP) Length", "wlan_mgt.fixed.qosinfo.sta.splen",
13079       FT_UINT8, BASE_HEX, VALS (&ff_qos_info_sta_max_sp_len_flags) , 0x60, NULL, HFILL }},
13080
13081     {&hf_ieee80211_ff_qos_info_sta_more_data_ack,
13082      {"More Data Ack", "wlan_mgt.fixed.qosinfo.sta.moredataack",
13083       FT_BOOLEAN, 8, TFS (&ff_qos_info_sta_more_data_ack_flag), 0x80, NULL, HFILL }},
13084
13085     {&hf_ieee80211_ff_sm_pwr_save,
13086      {"Spatial Multiplexing (SM) Power Control", "wlan_mgt.fixed.sm.powercontrol",
13087       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13088
13089     {&hf_ieee80211_ff_sm_pwr_save_enabled,
13090      {"SM Power Save", "wlan_mgt.fixed.sm.powercontrol.enabled",
13091       FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x01, "Spatial Multiplexing (SM) Power Save", HFILL }},
13092
13093     {&hf_ieee80211_ff_sm_pwr_save_sm_mode,
13094      {"SM Mode", "wlan_mgt.fixed.sm.powercontrol.mode",
13095       FT_BOOLEAN, 8, TFS (&ff_sm_pwr_save_sm_mode_flag), 0x02, "Spatial Multiplexing (SM) Mode", HFILL }},
13096
13097     {&hf_ieee80211_ff_sm_pwr_save_reserved,
13098      {"Reserved", "wlan_mgt.fixed.sm.powercontrol.reserved",
13099       FT_UINT8, BASE_HEX, NULL, 0xFC, NULL, HFILL }},
13100
13101     {&hf_ieee80211_ff_pco_phase_cntrl,
13102      {"Phased Coexistence Operation (PCO) Phase Control", "wlan_mgt.fixed.pco.phasecntrl",
13103       FT_BOOLEAN, BASE_NONE, TFS (&ff_pco_phase_cntrl_flag), 0x0, NULL, HFILL }},
13104
13105     {&hf_ieee80211_ff_psmp_param_set,
13106      {"Power Save Multi-Poll (PSMP) Parameter Set", "wlan_mgt.fixed.psmp.paramset",
13107       FT_UINT16, BASE_HEX, 0, 0, NULL, HFILL }},
13108
13109     {&hf_ieee80211_ff_psmp_param_set_n_sta,
13110      {"Number of STA Info Fields Present", "wlan_mgt.fixed.psmp.paramset.nsta",
13111       FT_UINT16, BASE_HEX, 0, 0x000F, NULL, HFILL }},
13112
13113     {&hf_ieee80211_ff_psmp_param_set_more_psmp,
13114      {"More PSMP", "wlan_mgt.fixed.psmp.paramset.more",
13115       FT_BOOLEAN, 16, TFS(&ff_psmp_param_set_more_psmp_flag), 0x0010, "More Power Save Multi-Poll (PSMP)", HFILL }},
13116
13117     {&hf_ieee80211_ff_psmp_param_set_psmp_sequence_duration,
13118      {"PSMP Sequence Duration [us]", "wlan_mgt.fixed.psmp.paramset.seqduration",
13119       FT_UINT16, BASE_DEC, 0, 0xFFE0, "Power Save Multi-Poll (PSMP) Sequence Duration", HFILL }},
13120
13121     {&hf_ieee80211_ff_mimo_cntrl,
13122      {"MIMO Control", "wlan_mgt.fixed.mimo.control.",
13123       FT_BYTES, BASE_NONE, 0, 0x0, NULL, HFILL }},
13124
13125     {&hf_ieee80211_ff_mimo_cntrl_nc_index,
13126      {"Nc Index", "wlan_mgt.fixed.mimo.control.ncindex",
13127       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_nc_index_flags), 0x0003, "Number of Columns Less One", HFILL }},
13128
13129     {&hf_ieee80211_ff_mimo_cntrl_nr_index,
13130      {"Nr Index", "wlan_mgt.fixed.mimo.control.nrindex",
13131       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_nr_index_flags), 0x000C, "Number of Rows Less One", HFILL }},
13132
13133     {&hf_ieee80211_ff_mimo_cntrl_channel_width,
13134      {"Channel Width", "wlan_mgt.fixed.mimo.control.chanwidth",
13135       FT_BOOLEAN, 16, TFS(&ff_mimo_cntrl_channel_width_flag), 0x0010, NULL, HFILL }},
13136
13137     {&hf_ieee80211_ff_mimo_cntrl_grouping,
13138      {"Grouping (Ng)", "wlan_mgt.fixed.mimo.control.grouping",
13139       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_grouping_flags), 0x0060, NULL, HFILL }},
13140
13141     {&hf_ieee80211_ff_mimo_cntrl_coefficient_size,
13142      {"Coefficient Size (Nb)", "wlan_mgt.fixed.mimo.control.cosize",
13143       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_coefficient_size_flags), 0x0180, NULL, HFILL }},
13144
13145     {&hf_ieee80211_ff_mimo_cntrl_codebook_info,
13146      {"Codebook Information", "wlan_mgt.fixed.mimo.control.codebookinfo",
13147       FT_UINT16, BASE_HEX, VALS(ff_mimo_cntrl_codebook_info_flags), 0x0600, NULL, HFILL }},
13148
13149     {&hf_ieee80211_ff_mimo_cntrl_remaining_matrix_segment,
13150      {"Remaining Matrix Segment", "wlan_mgt.fixed.mimo.control.matrixseg",
13151       FT_UINT16, BASE_HEX, 0, 0x3800, NULL, HFILL }},
13152
13153     {&hf_ieee80211_ff_mimo_cntrl_reserved,
13154      {"Reserved", "wlan_mgt.fixed.mimo.control.reserved",
13155       FT_UINT16, BASE_HEX, 0, 0xC000, NULL, HFILL }},
13156
13157     {&hf_ieee80211_ff_mimo_cntrl_sounding_timestamp,
13158      {"Sounding Timestamp", "wlan_mgt.fixed.mimo.control.soundingtime",
13159       FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
13160
13161     {&hf_ieee80211_ff_psmp_sta_info,
13162      {"Power Save Multi-Poll (PSMP) Station Information", "wlan_mgt.fixed.psmp.stainfo",
13163       FT_UINT64, BASE_HEX, 0, 0, NULL, HFILL }},
13164
13165     {&hf_ieee80211_ff_psmp_sta_info_type,
13166      {"Sta Info Type", "wlan_mgt.fixed.psmp.stainfo.type",
13167       FT_UINT32, BASE_HEX, VALS(ff_psmp_sta_info_flags), PSMP_STA_INFO_FLAG_TYPE, NULL, HFILL }},
13168
13169     {&hf_ieee80211_ff_psmp_sta_info_dtt_start_offset,
13170      {"DTT Start Offset", "wlan_mgt.fixed.psmp.stainfo.dttstart",
13171       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_DTT_START, NULL, HFILL }},
13172
13173     {&hf_ieee80211_ff_psmp_sta_info_dtt_duration,
13174      {"DTT Duration", "wlan_mgt.fixed.psmp.stainfo.dttduration",
13175       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_DTT_DURATION, NULL, HFILL }},
13176
13177     {&hf_ieee80211_ff_psmp_sta_info_sta_id,
13178      {"Target Station ID", "wlan_mgt.fixed.psmp.stainfo.staid",
13179       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_STA_ID, NULL, HFILL }},
13180
13181     {&hf_ieee80211_ff_psmp_sta_info_utt_start_offset,
13182      {"UTT Start Offset", "wlan_mgt.fixed.psmp.stainfo.uttstart",
13183       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_UTT_START, NULL, HFILL }},
13184
13185     {&hf_ieee80211_ff_psmp_sta_info_utt_duration,
13186      {"UTT Duration", "wlan_mgt.fixed.psmp.stainfo.uttduration",
13187       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_UTT_DURATION, NULL, HFILL }},
13188
13189     {&hf_ieee80211_ff_psmp_sta_info_reserved_small,
13190      {"Reserved", "wlan_mgt.fixed.psmp.stainfo.reserved",
13191       FT_UINT32, BASE_HEX, 0, PSMP_STA_INFO_FLAG_IA_RESERVED, NULL, HFILL }},
13192
13193     {&hf_ieee80211_ff_psmp_sta_info_reserved_large,
13194      {"Reserved", "wlan_mgt.fixed.psmp.stainfo.reserved",
13195       FT_UINT64, BASE_HEX, 0, 0, NULL, HFILL }},
13196
13197     {&hf_ieee80211_ff_psmp_sta_info_psmp_multicast_id,
13198      {"Power Save Multi-Poll (PSMP) Multicast ID", "wlan_mgt.fixed.psmp.stainfo.multicastid",
13199       FT_UINT64, BASE_HEX, 0, 0, NULL, HFILL }},
13200
13201     {&hf_ieee80211_ff_ant_selection,
13202      {"Antenna Selection", "wlan_mgt.fixed.antsel",
13203       FT_UINT8, BASE_HEX, 0, 0, NULL, HFILL }},
13204
13205     {&hf_ieee80211_ff_ant_selection_0,
13206      {"Antenna 0", "wlan_mgt.fixed.antsel.ant0",
13207       FT_UINT8, BASE_HEX, 0, 0x01, NULL, HFILL }},
13208
13209     {&hf_ieee80211_ff_ant_selection_1,
13210      {"Antenna 1", "wlan_mgt.fixed.antsel.ant1",
13211       FT_UINT8, BASE_HEX, 0, 0x02, NULL, HFILL }},
13212
13213     {&hf_ieee80211_ff_ant_selection_2,
13214      {"Antenna 2", "wlan_mgt.fixed.antsel.ant2",
13215       FT_UINT8, BASE_HEX, 0, 0x04, NULL, HFILL }},
13216
13217     {&hf_ieee80211_ff_ant_selection_3,
13218      {"Antenna 3", "wlan_mgt.fixed.antsel.ant3",
13219       FT_UINT8, BASE_HEX, 0, 0x08, NULL, HFILL }},
13220
13221     {&hf_ieee80211_ff_ant_selection_4,
13222      {"Antenna 4", "wlan_mgt.fixed.antsel.ant4",
13223       FT_UINT8, BASE_HEX, 0, 0x10, NULL, HFILL }},
13224
13225     {&hf_ieee80211_ff_ant_selection_5,
13226      {"Antenna 5", "wlan_mgt.fixed.antsel.ant5",
13227       FT_UINT8, BASE_HEX, 0, 0x20, NULL, HFILL }},
13228
13229     {&hf_ieee80211_ff_ant_selection_6,
13230      {"Antenna 6", "wlan_mgt.fixed.antsel.ant6",
13231       FT_UINT8, BASE_HEX, 0, 0x40, NULL, HFILL }},
13232
13233     {&hf_ieee80211_ff_ant_selection_7,
13234      {"Antenna 7", "wlan_mgt.fixed.antsel.ant7",
13235       FT_UINT8, BASE_HEX, 0, 0x80, NULL, HFILL }},
13236
13237     {&hf_ieee80211_ff_ext_channel_switch_announcement,
13238      {"Extended Channel Switch Announcement", "wlan_mgt.fixed.extchansw",
13239       FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
13240
13241     {&hf_ieee80211_ff_ext_channel_switch_announcement_switch_mode,
13242      {"Channel Switch Mode", "wlan_mgt.fixed.extchansw.switchmode",
13243       FT_UINT32, BASE_HEX, VALS(ieee80211_tag_ext_channel_switch_announcement_switch_mode_flags), 0x000000FF, NULL, HFILL }},
13244
13245     {&hf_ieee80211_ff_ext_channel_switch_announcement_new_reg_class,
13246      {"New Regulatory Class", "wlan_mgt.fixed.extchansw.new.regclass",
13247       FT_UINT32, BASE_HEX, NULL, 0x0000FF00, NULL, HFILL }},
13248
13249     {&hf_ieee80211_ff_ext_channel_switch_announcement_new_chan_number,
13250      {"New Channel Number", "wlan_mgt.fixed.extchansw.new.channumber",
13251       FT_UINT32, BASE_HEX, NULL, 0x00FF0000, NULL, HFILL }},
13252
13253     {&hf_ieee80211_ff_ext_channel_switch_announcement_switch_count,
13254      {"Channel Switch Count", "wlan_mgt.extchanswitch.switchcount",
13255       FT_UINT32, BASE_HEX, NULL, 0xFF000000, NULL, HFILL }},
13256
13257     {&hf_ieee80211_ff_ht_info,
13258      {"HT Information", "wlan_mgt.fixed.extchansw",
13259       FT_UINT8, BASE_HEX, 0, 0, "HT Information Fixed Field", HFILL }},
13260
13261     {&hf_ieee80211_ff_ht_info_information_request,
13262      {"Information Request", "wlan_mgt.fixed.mimo.control.chanwidth",
13263       FT_BOOLEAN, 8, TFS(&ff_ht_info_information_request_flag), 0x01, NULL, HFILL }},
13264
13265     {&hf_ieee80211_ff_ht_info_40_mhz_intolerant,
13266      {"40 MHz Intolerant", "wlan_mgt.fixed.mimo.control.chanwidth",
13267       FT_BOOLEAN, 8, TFS(&ff_ht_info_40_mhz_intolerant_flag), 0x02, NULL, HFILL }},
13268
13269     {&hf_ieee80211_ff_ht_info_sta_chan_width,
13270      {"Station Channel Width", "wlan_mgt.fixed.mimo.control.chanwidth",
13271       FT_BOOLEAN, 8, TFS(&ff_ht_info_sta_chan_width_flag), 0x04, NULL, HFILL }},
13272
13273     {&hf_ieee80211_ff_ht_info_reserved,
13274      {"Reserved", "wlan_mgt.fixed.extchansw",
13275       FT_UINT8, BASE_HEX, 0, 0xF8, "Reserved Field", HFILL }},
13276
13277     {&hf_ieee80211_ff_ht_action,
13278      {"HT Action", "wlan_mgt.fixed.htact",
13279       FT_UINT8, BASE_HEX, VALS (&ff_ht_action_flags), 0, "HT Action Code", HFILL }},
13280
13281     {&hf_ieee80211_ff_mimo_csi_snr,
13282      {"Signal to Noise Ratio (SNR)", "wlan_mgt.mimo.csimatrices.snr",
13283       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13284
13285     {&hf_ieee80211_ff_public_action,
13286      {"Public Action", "wlan_mgt.fixed.publicact",
13287       FT_UINT8, BASE_HEX, VALS(ff_pa_action_codes), 0, "Public Action Code", HFILL }},
13288
13289     {&hf_ieee80211_ff_capture,
13290      {"Capabilities Information", "wlan_mgt.fixed.capabilities", FT_UINT16, BASE_HEX, NULL, 0,
13291       "Capability information", HFILL }},
13292
13293     {&hf_ieee80211_ff_cf_ess,
13294      {"ESS capabilities", "wlan_mgt.fixed.capabilities.ess",
13295       FT_BOOLEAN, 16, TFS (&cf_ess_flags), 0x0001, NULL, HFILL }},
13296
13297     {&hf_ieee80211_ff_cf_ibss,
13298      {"IBSS status", "wlan_mgt.fixed.capabilities.ibss",
13299       FT_BOOLEAN, 16, TFS (&cf_ibss_flags), 0x0002, "IBSS participation", HFILL }},
13300
13301     {&hf_ieee80211_ff_cf_sta_poll,
13302      {"CFP participation capabilities", "wlan_mgt.fixed.capabilities.cfpoll.sta",
13303       FT_UINT16, BASE_HEX, VALS (&sta_cf_pollable), 0x020C,
13304       "CF-Poll capabilities for a STA", HFILL }},
13305
13306     {&hf_ieee80211_ff_cf_ap_poll,
13307      {"CFP participation capabilities", "wlan_mgt.fixed.capabilities.cfpoll.ap",
13308       FT_UINT16, BASE_HEX, VALS (&ap_cf_pollable), 0x020C,
13309       "CF-Poll capabilities for an AP", HFILL }},
13310
13311     {&hf_ieee80211_ff_cf_privacy,
13312      {"Privacy", "wlan_mgt.fixed.capabilities.privacy",
13313       FT_BOOLEAN, 16, TFS (&cf_privacy_flags), 0x0010, "WEP support", HFILL }},
13314
13315     {&hf_ieee80211_ff_cf_preamble,
13316      {"Short Preamble", "wlan_mgt.fixed.capabilities.preamble",
13317       FT_BOOLEAN, 16, TFS (&cf_preamble_flags), 0x0020, NULL, HFILL }},
13318
13319     {&hf_ieee80211_ff_cf_pbcc,
13320      {"PBCC", "wlan_mgt.fixed.capabilities.pbcc",
13321       FT_BOOLEAN, 16, TFS (&cf_pbcc_flags), 0x0040, "PBCC Modulation", HFILL }},
13322
13323     {&hf_ieee80211_ff_cf_agility,
13324      {"Channel Agility", "wlan_mgt.fixed.capabilities.agility",
13325       FT_BOOLEAN, 16, TFS (&cf_agility_flags), 0x0080, NULL, HFILL }},
13326
13327     {&hf_ieee80211_ff_cf_spec_man,
13328      {"Spectrum Management", "wlan_mgt.fixed.capabilities.spec_man",
13329       FT_BOOLEAN, 16, TFS (&cf_spec_man_flags), 0x0100, NULL, HFILL }},
13330
13331     {&hf_ieee80211_ff_short_slot_time,
13332      {"Short Slot Time", "wlan_mgt.fixed.capabilities.short_slot_time",
13333       FT_BOOLEAN, 16, TFS (&short_slot_time_flags), 0x0400, NULL,
13334       HFILL }},
13335
13336     {&hf_ieee80211_ff_cf_apsd,
13337      {"Automatic Power Save Delivery", "wlan_mgt.fixed.capabilities.apsd",
13338       FT_BOOLEAN, 16, TFS (&cf_apsd_flags), 0x0800, NULL, HFILL }},
13339
13340     {&hf_ieee80211_ff_dsss_ofdm,
13341      {"DSSS-OFDM", "wlan_mgt.fixed.capabilities.dsss_ofdm",
13342       FT_BOOLEAN, 16, TFS (&dsss_ofdm_flags), 0x2000, "DSSS-OFDM Modulation",
13343       HFILL }},
13344
13345     {&hf_ieee80211_ff_cf_del_blk_ack,
13346      {"Delayed Block Ack", "wlan_mgt.fixed.capabilities.del_blk_ack",
13347       FT_BOOLEAN, 16, TFS (&cf_del_blk_ack_flags), 0x4000, NULL, HFILL }},
13348
13349     {&hf_ieee80211_ff_cf_imm_blk_ack,
13350      {"Immediate Block Ack", "wlan_mgt.fixed.capabilities.imm_blk_ack",
13351       FT_BOOLEAN, 16, TFS (&cf_imm_blk_ack_flags), 0x8000, NULL, HFILL }},
13352
13353     {&hf_ieee80211_ff_auth_seq,
13354      {"Authentication SEQ", "wlan_mgt.fixed.auth_seq",
13355       FT_UINT16, BASE_HEX, NULL, 0, "Authentication Sequence Number", HFILL }},
13356
13357     {&hf_ieee80211_ff_assoc_id,
13358      {"Association ID", "wlan_mgt.fixed.aid",
13359       FT_UINT16, BASE_HEX, NULL, 0x3FFF, NULL, HFILL }},
13360
13361     {&hf_ieee80211_ff_listen_ival,
13362      {"Listen Interval", "wlan_mgt.fixed.listen_ival",
13363       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
13364
13365     {&hf_ieee80211_ff_current_ap,
13366      {"Current AP", "wlan_mgt.fixed.current_ap",
13367       FT_ETHER, BASE_NONE, NULL, 0, "MAC address of current AP", HFILL }},
13368
13369     {&hf_ieee80211_ff_reason,
13370      {"Reason code", "wlan_mgt.fixed.reason_code",
13371       FT_UINT16, BASE_HEX, VALS (&ieee80211_reason_code), 0,
13372       "Reason for unsolicited notification", HFILL }},
13373
13374     {&hf_ieee80211_ff_status_code,
13375      {"Status code", "wlan_mgt.fixed.status_code",
13376       FT_UINT16, BASE_HEX, VALS (&ieee80211_status_code), 0,
13377       "Status of requested event", HFILL }},
13378
13379     {&hf_ieee80211_ff_category_code,
13380      {"Category code", "wlan_mgt.fixed.category_code",
13381       FT_UINT16, BASE_DEC, VALS (&category_codes), 0,
13382       "Management action category", HFILL }},
13383
13384     {&hf_ieee80211_ff_action_code,
13385      {"Action code", "wlan_mgt.fixed.action_code",
13386       FT_UINT16, BASE_DEC, VALS (&action_codes), 0,
13387       "Management action code", HFILL }},
13388
13389     {&hf_ieee80211_ff_dialog_token,
13390      {"Dialog token", "wlan_mgt.fixed.dialog_token",
13391       FT_UINT8, BASE_HEX, NULL, 0, "Management action dialog token", HFILL }},
13392
13393     {&hf_ieee80211_ff_marvell_action_type,
13394      {"Marvell Action type", "wlan_mgt.fixed.mrvl_action_type",
13395       FT_UINT8, BASE_DEC, VALS (&vendor_action_types_mrvl), 0,
13396       "Vendor Specific Action Type (Marvell)", HFILL }},
13397
13398     {&hf_ieee80211_ff_marvell_mesh_mgt_action_code,
13399      {"Mesh action(Marvell)", "wlan_mgt.fixed.mrvl_mesh_action",
13400       FT_UINT8, BASE_HEX, VALS (&mesh_mgt_action_codes_mrvl), 0,
13401       "Mesh action code(Marvell)", HFILL }},
13402
13403     {&hf_ieee80211_ff_marvell_mesh_mgt_length,
13404      {"Message Length", "wlan_mgt.fixed.length",
13405       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13406
13407     {&hf_ieee80211_ff_marvell_mesh_mgt_mode,
13408      {"Message Mode", "wlan_mgt.fixed.mode",
13409       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13410
13411     {&hf_ieee80211_ff_marvell_mesh_mgt_ttl,
13412      {"Message TTL", "wlan_mgt.fixed.ttl",
13413       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13414
13415     {&hf_ieee80211_ff_marvell_mesh_mgt_dstcount,
13416      {"Destination Count", "wlan_mgt.fixed.dstcount",
13417       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13418
13419     {&hf_ieee80211_ff_marvell_mesh_mgt_hopcount,
13420      {"Hop Count", "wlan_mgt.fixed.hopcount",
13421       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13422
13423     {&hf_ieee80211_ff_marvell_mesh_mgt_rreqid,
13424      {"RREQ ID", "wlan_mgt.fixed.rreqid",
13425       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
13426
13427     {&hf_ieee80211_ff_marvell_mesh_mgt_sa,
13428      {"Source Address", "wlan_mgt.fixed.sa",
13429       FT_ETHER, BASE_NONE, NULL, 0, "Source MAC address", HFILL }},
13430
13431     {&hf_ieee80211_ff_marvell_mesh_mgt_ssn,
13432      {"SSN", "wlan_mgt.fixed.ssn",
13433       FT_UINT32, BASE_DEC, NULL, 0, "Source Sequence Number", HFILL }},
13434
13435     {&hf_ieee80211_ff_marvell_mesh_mgt_metric,
13436      {"Metric", "wlan_mgt.fixed.metric",
13437       FT_UINT32, BASE_DEC, NULL, 0, "Route Metric", HFILL }},
13438
13439     {&hf_ieee80211_ff_marvell_mesh_mgt_flags,
13440      {"RREQ Flags", "wlan_mgt.fixed.hopcount",
13441       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13442
13443     {&hf_ieee80211_ff_marvell_mesh_mgt_da,
13444      {"Destination Address", "wlan_mgt.fixed.da",
13445       FT_ETHER, BASE_NONE, NULL, 0, "Destination MAC address", HFILL }},
13446
13447     {&hf_ieee80211_ff_marvell_mesh_mgt_dsn,
13448      {"DSN", "wlan_mgt.fixed.dsn",
13449       FT_UINT32, BASE_DEC, NULL, 0, "Destination Sequence Number", HFILL }},
13450
13451     {&hf_ieee80211_ff_marvell_mesh_mgt_lifetime,
13452      {"Lifetime", "wlan_mgt.fixed.lifetime",
13453       FT_UINT32, BASE_DEC, NULL, 0, "Route Lifetime", HFILL }},
13454
13455     {&hf_ieee80211_ff_wme_action_code,
13456      {"Action code", "wlan_mgt.fixed.action_code",
13457       FT_UINT16, BASE_HEX, VALS (&wme_action_codes), 0,
13458       "Management notification action code", HFILL }},
13459
13460     {&hf_ieee80211_ff_wme_status_code,
13461      {"Status code", "wlan_mgt.fixed.status_code",
13462       FT_UINT16, BASE_HEX, VALS (&wme_status_codes), 0,
13463       "Management notification setup response status code", HFILL }},
13464
13465     {&hf_ieee80211_ff_mesh_action,
13466      {"Mesh Action code", "wlan_mgt.fixed.mesh_action",
13467       FT_UINT8, BASE_HEX, VALS (&mesh_action), 0,
13468       NULL, HFILL }},
13469
13470     {&hf_ieee80211_ff_multihop_action,
13471      {"Multihop Action code", "wlan_mgt.fixed.multihop_action",
13472       FT_UINT8, BASE_HEX, VALS (&multihop_action), 0,
13473       NULL, HFILL }},
13474
13475     {&hf_ieee80211_ff_mesh_flags,
13476      {"Mesh Flags", "wlan_mgt.fixed.mesh_flags",
13477       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13478
13479     {&hf_ieee80211_ff_mesh_ttl,
13480      {"Mesh TTL", "wlan_mgt.fixed.mesh_ttl",
13481       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
13482
13483     {&hf_ieee80211_ff_mesh_sequence,
13484      {"Sequence Number", "wlan_mgt.fixed.mesh_sequence",
13485       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
13486
13487     {&hf_ieee80211_ff_mesh_addr4,
13488      {"Mesh Extended Address 4", "wlan_mgt.fixed.mesh_addr4",
13489       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13490
13491     {&hf_ieee80211_ff_mesh_addr5,
13492      {"Mesh Extended Address 5", "wlan_mgt.fixed.mesh_addr5",
13493       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13494
13495     {&hf_ieee80211_ff_mesh_addr6,
13496      {"Mesh Extended Address 6", "wlan_mgt.fixed.mesh_addr6",
13497       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13498
13499     {&hf_ieee80211_ff_selfprot_action,
13500      {"Self-protected Action code", "wlan_mgt.fixed.selfprot_action",
13501       FT_UINT8, BASE_HEX, VALS (&selfprot_action), 0,
13502       NULL, HFILL }},
13503
13504     {&hf_ieee80211_mesh_peering_proto,
13505      {"Mesh Peering Protocol ID", "wlan.peering.proto",
13506       FT_UINT16, BASE_HEX, VALS (&mesh_peering_proto_ids), 0,
13507       NULL, HFILL }},
13508
13509     {&hf_ieee80211_mesh_peering_local_link_id,
13510      {"Local Link ID", "wlan.peering.local_id",
13511       FT_UINT16, BASE_HEX, NULL, 0,
13512       "Mesh Peering Management Local Link ID", HFILL }},
13513
13514     {&hf_ieee80211_mesh_peering_peer_link_id,
13515      {"Peer Link ID", "wlan.peering.peer_id",
13516       FT_UINT16, BASE_HEX, NULL, 0,
13517       "Mesh Peering Management Peer Link ID", HFILL }},
13518
13519     {&hf_ieee80211_ff_hwmp_flags,
13520      {"HWMP Flags", "wlan.hwmp.flags", FT_UINT8, BASE_HEX, NULL, 0,
13521       NULL, HFILL }},
13522
13523     {&hf_ieee80211_ff_hwmp_hopcount,
13524      {"HWMP Hop Count", "wlan.hwmp.hopcount", FT_UINT8, BASE_DEC, NULL, 0,
13525       NULL, HFILL }},
13526
13527     {&hf_ieee80211_ff_hwmp_ttl,
13528      {"HWMP TTL", "wlan.hwmp.ttl", FT_UINT8, BASE_DEC, NULL, 0,
13529       NULL, HFILL }},
13530
13531     {&hf_ieee80211_ff_hwmp_pdid,
13532      {"HWMP Path Discovery ID", "wlan.hwmp.pdid", FT_UINT32, BASE_DEC, NULL, 0,
13533       NULL, HFILL }},
13534
13535     {&hf_ieee80211_ff_hwmp_orig_sta,
13536      {"Originator STA Address", "wlan.hwmp.orig_sta", FT_ETHER, BASE_NONE, NULL, 0,
13537       NULL, HFILL }},
13538
13539     {&hf_ieee80211_ff_hwmp_orig_sn,
13540      {"HWMP Originator Sequence Number", "wlan.hwmp.orig_sn", FT_UINT32, BASE_DEC, NULL, 0,
13541       NULL, HFILL}},
13542
13543     {&hf_ieee80211_ff_hwmp_orig_ext,
13544      {"Originator External Address", "wlan.hwmp.orig_ext", FT_ETHER, BASE_NONE, NULL, 0,
13545       NULL, HFILL }},
13546
13547     {&hf_ieee80211_ff_hwmp_lifetime,
13548      {"HWMP Lifetime", "wlan.hwmp.lifetime", FT_UINT32, BASE_DEC, NULL, 0,
13549       NULL, HFILL }},
13550
13551     {&hf_ieee80211_ff_hwmp_metric,
13552      {"HWMP Metric", "wlan.hwmp.metric", FT_UINT32, BASE_DEC, NULL, 0,
13553       NULL, HFILL }},
13554
13555     {&hf_ieee80211_ff_hwmp_targ_count,
13556      {"HWMP Target Count", "wlan.hwmp.targ_count", FT_UINT8, BASE_DEC, NULL, 0,
13557       NULL, HFILL }},
13558
13559     {&hf_ieee80211_ff_hwmp_targ_flags,
13560      {"HWMP Per-Target Flags", "wlan.hwmp.targ_flags", FT_UINT8, BASE_HEX, NULL, 0,
13561       NULL, HFILL }},
13562
13563     {&hf_ieee80211_ff_hwmp_targ_to_flags,
13564      {"TO Flag", "wlan.hwmp.to_flag",
13565       FT_BOOLEAN, 8, TFS (&hwmp_targ_to_flags), 0x01,
13566       "Target Only Flag", HFILL }},
13567
13568     {&hf_ieee80211_ff_hwmp_targ_usn_flags,
13569      {"USN Flag", "wlan.hwmp.usn_flag",
13570       FT_BOOLEAN, 8, TFS (&hwmp_targ_usn_flags), 0x04,
13571       "Unknown Target HWMP Sequence Number Flag", HFILL }},
13572
13573     {&hf_ieee80211_ff_hwmp_targ_sta,
13574      {"Target STA Address", "wlan.hwmp.targ_sta", FT_ETHER, BASE_NONE, NULL, 0,
13575       NULL, HFILL }},
13576
13577     {&hf_ieee80211_ff_hwmp_targ_ext,
13578      {"Target External Address", "wlan.hwmp.targ_ext", FT_ETHER, BASE_NONE, NULL, 0,
13579       NULL, HFILL }},
13580
13581     {&hf_ieee80211_ff_hwmp_targ_sn,
13582      {"Target HWMP Sequence Number", "wlan.hwmp.targ_sn",
13583       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
13584
13585     {&hf_ieee80211_mesh_config_path_sel_protocol,
13586      {"Path Selection Protocol", "wlan.mesh.config.ps_protocol",
13587       FT_UINT8, BASE_HEX, NULL, 0,
13588       "Mesh Configuration Path Selection Protocol", HFILL }},
13589
13590     {&hf_ieee80211_mesh_config_path_sel_metric,
13591      {"Path Selection Metric", "wlan.mesh.config.ps_metric",
13592       FT_UINT8, BASE_HEX, NULL, 0,
13593       "Mesh Configuration Path Selection Metric", HFILL }},
13594
13595     {&hf_ieee80211_mesh_config_congestion_control,
13596      {"Congestion Control", "wlan.mesh.config.cong_ctl",
13597       FT_UINT8, BASE_HEX, NULL, 0,
13598       "Mesh Configuration Congestion Control", HFILL }},
13599
13600     {&hf_ieee80211_mesh_config_sync_method,
13601      {"Synchronization Method", "wlan.mesh.config.sync_method",
13602       FT_UINT8, BASE_HEX, NULL, 0,
13603       "Mesh Configuration Synchronization Method", HFILL }},
13604
13605     {&hf_ieee80211_mesh_config_auth_protocol,
13606      {"Authentication Protocol", "wlan.mesh.config.auth_protocol",
13607       FT_UINT8, BASE_HEX, NULL, 0,
13608       "Mesh Configuration Authentication Protocol", HFILL }},
13609
13610     {&hf_ieee80211_mesh_config_formation_info,
13611      {"Formation Info", "wlan.mesh.config.formation_info",
13612       FT_UINT8, BASE_HEX, NULL, 0,
13613       "Mesh Configuration Formation Info", HFILL }},
13614
13615     {&hf_ieee80211_mesh_config_capability,
13616      {"Capability", "wlan.mesh.config.cap",
13617       FT_UINT8, BASE_HEX, NULL, 0,
13618       "Mesh Configuration Capability", HFILL }},
13619
13620     {&hf_ieee80211_mesh_id,
13621      {"Mesh ID", "wlan.mesh.id",
13622       FT_STRING, BASE_NONE, NULL, 0,
13623       NULL, HFILL }},
13624
13625     {&hf_ieee80211_rann_flags,
13626      {"RANN Flags", "wlan.rann.flags",
13627       FT_UINT8, BASE_HEX, NULL, 0,
13628       "Root Announcement Flags", HFILL }},
13629
13630     {&hf_ieee80211_rann_root_sta,
13631      {"Root STA Address", "wlan.rann.root_sta", FT_ETHER, BASE_NONE, NULL, 0,
13632       "Root Mesh STA Address", HFILL }},
13633
13634     {&hf_ieee80211_rann_sn,
13635      {"Root STA Sequence Number", "wlan.rann.rann_sn",
13636       FT_UINT32, BASE_DEC, NULL, 0, "Root Mesh STA Sequence Number", HFILL }},
13637
13638     {&hf_ieee80211_rann_interval,
13639      {"RANN Interval", "wlan.rann.interval", FT_UINT32, BASE_DEC, NULL, 0,
13640       "Root Announcement Interval", HFILL }},
13641
13642     {&hf_ieee80211_ff_qos_action_code,
13643      {"Action code", "wlan_mgt.fixed.action_code",
13644       FT_UINT16, BASE_HEX, VALS (&qos_action_codes), 0,
13645       "QoS management action code", HFILL }},
13646
13647     {&hf_ieee80211_ff_ba_action,
13648      {"Action code", "wlan_mgt.fixed.action_code",
13649       FT_UINT8, BASE_HEX, VALS (&ba_action_codes), 0,
13650       "Block Ack action code", HFILL }},
13651
13652     {&hf_ieee80211_ff_dls_action_code,
13653      {"Action code", "wlan_mgt.fixed.action_code",
13654       FT_UINT16, BASE_HEX, VALS (&dls_action_codes), 0,
13655       "DLS management action code", HFILL }},
13656
13657     {&hf_ieee80211_ff_dst_mac_addr,
13658      {"Destination address", "wlan_mgt.fixed.dst_mac_addr",
13659       FT_ETHER, BASE_NONE, NULL, 0, "Destination MAC address", HFILL }},
13660
13661     {&hf_ieee80211_ff_src_mac_addr,
13662      {"Source address", "wlan_mgt.fixed.src_mac_addr",
13663       FT_ETHER, BASE_NONE, NULL, 0, "Source MAC address", HFILL }},
13664
13665     {&hf_ieee80211_ff_ft_action_code,
13666      {"Action code", "wlan_mgt.fixed.action_code",
13667       FT_UINT8, BASE_DEC, VALS(ft_action_codes), 0,
13668       "Management action code", HFILL }},
13669
13670     {&hf_ieee80211_ff_sta_address,
13671      {"STA Address", "wlan_mgt.fixed.sta_address",
13672       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
13673
13674     {&hf_ieee80211_ff_target_ap_address,
13675      {"Target AP Address", "wlan_mgt.fixed.target_ap_address",
13676       FT_ETHER, BASE_NONE, NULL, 0, "Target AP MAC address", HFILL }},
13677
13678     {&hf_ieee80211_ff_gas_comeback_delay,
13679      {"GAS Comeback Delay", "wlan_mgt.fixed.gas_comeback_delay",
13680       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13681
13682     {&hf_ieee80211_ff_gas_fragment_id,
13683      {"GAS Query Response Fragment ID", "wlan_mgt.fixed.gas_fragment_id",
13684       FT_UINT8, BASE_DEC, NULL, 0x7f, NULL, HFILL
13685      }},
13686
13687     {&hf_ieee80211_ff_more_gas_fragments,
13688      {"More GAS Fragments", "wlan_mgt.fixed.more_gas_fragments",
13689       FT_UINT8, BASE_DEC, NULL, 0x80, NULL, HFILL }},
13690
13691     {&hf_ieee80211_ff_query_request_length,
13692      {"Query Request Length", "wlan_mgt.fixed.query_request_length",
13693       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13694
13695     {&hf_ieee80211_ff_query_request,
13696      {"Query Request", "wlan_mgt.fixed.query_request",
13697       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13698
13699     {&hf_ieee80211_ff_query_response_length,
13700      {"Query Response Length", "wlan_mgt.fixed.query_response_length",
13701       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13702
13703     {&hf_ieee80211_ff_query_response,
13704      {"Query Response", "wlan_mgt.fixed.query_response",
13705       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13706
13707     {&hf_ieee80211_gas_resp_fragments,
13708      {"GAS Query Response fragments", "wlan_mgt.fixed.fragments",
13709       FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13710     {&hf_ieee80211_gas_resp_fragment,
13711      {"GAS Query Response fragment", "wlan_mgt.fixed.fragment",
13712       FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13713     {&hf_ieee80211_gas_resp_fragment_overlap,
13714      {"GAS Query Response fragment overlap", "wlan_mgt.fixed.fragment.overlap",
13715       FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13716     {&hf_ieee80211_gas_resp_fragment_overlap_conflict,
13717      {"GAS Query Response fragment overlapping with conflicting data",
13718       "wlan_mgt.fixed.fragment.overlap.conflicts",
13719       FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13720     {&hf_ieee80211_gas_resp_fragment_multiple_tails,
13721      {"GAS Query Response has multiple tail fragments",
13722       "wlan_mgt.fixed.fragment.multiple_tails",
13723       FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13724     {&hf_ieee80211_gas_resp_fragment_too_long_fragment,
13725      {"GAS Query Response fragment too long",
13726       "wlan_mgt.fixed.fragment.too_long_fragment",
13727       FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13728     {&hf_ieee80211_gas_resp_fragment_error,
13729      {"GAS Query Response reassembly error", "wlan_mgt.fixed.fragment.error",
13730       FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13731     {&hf_ieee80211_gas_resp_fragment_count,
13732      {"GAS Query Response fragment count", "wlan_mgt.fixed.fragment.count",
13733       FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
13734     {&hf_ieee80211_gas_resp_reassembled_in,
13735      {"Reassembled in", "wlan_mgt.fixed.reassembled.in",
13736       FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
13737     {&hf_ieee80211_gas_resp_reassembled_length,
13738      {"Reassembled length", "wlan_mgt.fixed.reassembled.length",
13739       FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
13740
13741     {&hf_ieee80211_ff_anqp_info_id,
13742      {"Info ID", "wlan_mgt.fixed.anqp.info_id",
13743       FT_UINT16, BASE_DEC, VALS(anqp_info_id_vals), 0,
13744       "Access Network Query Protocol Info ID", HFILL }},
13745
13746     {&hf_ieee80211_ff_anqp_info_length,
13747      {"Length", "wlan_mgt.fixed.anqp.info_length",
13748       FT_UINT16, BASE_DEC, NULL, 0, "Access Network Query Protocol Length",
13749       HFILL }},
13750
13751     {&hf_ieee80211_ff_anqp_info,
13752      {"Information", "wlan_mgt.fixed.anqp.info",
13753       FT_BYTES, BASE_NONE, NULL, 0,
13754       "Access Network Query Protocol Information", HFILL }},
13755
13756     {&hf_ieee80211_ff_anqp_query_id,
13757      {"ANQP Query ID", "wlan_mgt.fixed.anqp.query_id",
13758       FT_UINT16, BASE_DEC, VALS(anqp_info_id_vals), 0,
13759       "Access Network Query Protocol Query ID", HFILL }},
13760
13761     {&hf_ieee80211_ff_anqp_capability,
13762      {"ANQP Capability", "wlan_mgt.fixed.anqp.capability",
13763       FT_UINT16, BASE_DEC, VALS(anqp_info_id_vals), 0,
13764       "Access Network Query Protocol Query ID", HFILL }},
13765     {&hf_ieee80211_ff_anqp_capability_vlen,
13766      {"Vendor-specific Capability Length",
13767       "wlan_mgt.fixed.anqp.capability_vlen",
13768       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13769     {&hf_ieee80211_ff_anqp_capability_vendor,
13770      {"Vendor-specific Capability",
13771       "wlan_mgt.fixed.anqp.capability_vendor",
13772       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13773
13774     {&hf_ieee80211_ff_venue_info_group,
13775      {"Venue Group", "wlan_mgt.fixed.venue_info.group",
13776       FT_UINT8, BASE_DEC, VALS(venue_group_vals), 0, NULL, HFILL }},
13777
13778     {&hf_ieee80211_ff_venue_info_type,
13779      {"Venue Type", "wlan_mgt.fixed.venue_info.type",
13780       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13781
13782     {&hf_ieee80211_ff_anqp_venue_length,
13783      {"Venue Name Duple Length", "wlan_mgt.fixed.anqp.venue.length",
13784       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13785
13786     {&hf_ieee80211_ff_anqp_venue_language,
13787      {"Language Code", "wlan_mgt.fixed.anqp.venue.language",
13788       FT_STRING, BASE_NONE, NULL, 0,
13789       "Venue Name Language Code", HFILL }},
13790
13791     {&hf_ieee80211_ff_anqp_venue_name,
13792      {"Venue Name", "wlan_mgt.fixed.anqp.venue.name",
13793       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13794
13795     {&hf_ieee80211_ff_anqp_nw_auth_type_indicator,
13796      {"Network Authentication Type Indicator",
13797       "wlan_mgt.fixed.anqp.nw_auth_type.indicator",
13798       FT_UINT8, BASE_DEC, VALS(nw_auth_type_vals), 0, NULL, HFILL }},
13799
13800     {&hf_ieee80211_ff_anqp_nw_auth_type_url_len,
13801      {"Re-direct URL Length",
13802       "wlan_mgt.fixed.anqp.nw_auth_type.url_len",
13803       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13804
13805     {&hf_ieee80211_ff_anqp_nw_auth_type_url,
13806      {"Re-direct URL", "wlan_mgt.fixed.anqp.nw_auth_type_url",
13807       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13808
13809     {&hf_ieee80211_ff_anqp_roaming_consortium_oi_len,
13810      {"OI Length", "wlan_mgt.fixed.anqp.roaming_consortium.oi_len",
13811       FT_UINT8, BASE_DEC, NULL, 0, "Roaming Consortium OI Length", HFILL }},
13812
13813     {&hf_ieee80211_ff_anqp_roaming_consortium_oi,
13814      {"OI", "wlan_mgt.fixed.anqp.roaming_consortium.oi",
13815       FT_BYTES, BASE_NONE, NULL, 0, "Roaming Consortium OI", HFILL }},
13816
13817     {&hf_ieee80211_ff_anqp_ip_addr_avail_ipv6,
13818      {"IPv6 Address", "wlan_mgt.fixed.anqp.ip_addr_availability.ipv6",
13819       FT_UINT8, BASE_DEC, VALS(ip_addr_avail_ipv6_vals), 0x03,
13820       "IP Address Type Availability information for IPv6", HFILL }},
13821
13822     {&hf_ieee80211_ff_anqp_ip_addr_avail_ipv4,
13823      {"IPv4 Address", "wlan_mgt.fixed.anqp.ip_addr_availability.ipv4",
13824       FT_UINT8, BASE_DEC, VALS(ip_addr_avail_ipv4_vals), 0xfc,
13825       "IP Address Type Availability information for IPv4", HFILL }},
13826
13827     {&hf_ieee80211_ff_anqp_nai_realm_count,
13828      {"NAI Realm Count", "wlan_mgt.fixed.anqp.nai_realm_list.count",
13829       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13830     {&hf_ieee80211_ff_anqp_nai_field_len,
13831      {"NAI Realm Data Field Length",
13832       "wlan_mgt.fixed.anqp.nai_realm_list.field_len",
13833       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
13834     {&hf_ieee80211_ff_anqp_nai_realm_encoding,
13835      {"NAI Realm Encoding",
13836       "wlan_mgt.fixed.naqp_nai_realm_list.encoding",
13837       FT_UINT8, BASE_DEC, VALS(nai_realm_encoding_vals), 0x01, NULL, HFILL }},
13838     {&hf_ieee80211_ff_anqp_nai_realm_length,
13839      {"NAI Realm Length",
13840       "wlan_mgt.fixed.naqp_nai_realm_list.realm_length",
13841       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13842     {&hf_ieee80211_ff_anqp_nai_realm,
13843      {"NAI Realm",
13844       "wlan_mgt.fixed.naqp_nai_realm_list.realm",
13845       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13846     {&hf_ieee80211_ff_anqp_nai_realm_eap_count,
13847      {"EAP Method Count",
13848       "wlan_mgt.fixed.naqp_nai_realm_list.eap_method_count",
13849       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13850     {&hf_ieee80211_ff_anqp_nai_realm_eap_len,
13851      {"EAP Method subfield Length",
13852       "wlan_mgt.fixed.naqp_nai_realm_list.eap_method_len",
13853       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13854     {&hf_ieee80211_ff_anqp_nai_realm_eap_method,
13855      {"EAP Method",
13856       "wlan_mgt.fixed.naqp_nai_realm_list.eap_method",
13857       FT_UINT8, BASE_DEC, VALS(eap_type_vals), 0, NULL, HFILL }},
13858     {&hf_ieee80211_ff_anqp_nai_realm_auth_param_count,
13859      {"Authentication Parameter Count",
13860       "wlan_mgt.fixed.naqp_nai_realm_list.auth_param_count",
13861       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13862     {&hf_ieee80211_ff_anqp_nai_realm_auth_param_id,
13863      {"Authentication Parameter ID",
13864       "wlan_mgt.fixed.naqp_nai_realm_list.auth_param_id",
13865       FT_UINT8, BASE_DEC, VALS(nai_realm_auth_param_id_vals),
13866       0, NULL, HFILL }},
13867     {&hf_ieee80211_ff_anqp_nai_realm_auth_param_len,
13868      {"Authentication Parameter Length",
13869       "wlan_mgt.fixed.naqp_nai_realm_list.auth_param_len",
13870       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13871     {&hf_ieee80211_ff_anqp_nai_realm_auth_param_value,
13872      {"Authentication Parameter Value",
13873       "wlan_mgt.fixed.naqp_nai_realm_list.auth_param_value",
13874       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
13875
13876     {&hf_ieee80211_3gpp_gc_gud,
13877      {"GUD", "wlan_mgt.fixed.anqp.3gpp_cellular_info.gud",
13878       FT_UINT8, BASE_DEC, NULL, 0,
13879       "Generic container User Data", HFILL }},
13880     {&hf_ieee80211_3gpp_gc_udhl,
13881      {"UDHL", "wlan_mgt.fixed.anqp.3gpp_cellular_info.udhl",
13882       FT_UINT8, BASE_DEC, NULL, 0,
13883       "User Data Header Length", HFILL }},
13884     {&hf_ieee80211_3gpp_gc_iei,
13885      {"IEI", "wlan_mgt.fixed.anqp.3gpp_cellular_info.iei",
13886       FT_UINT8, BASE_DEC, NULL, 0,
13887       "Information Element Identity", HFILL }},
13888     {&hf_ieee80211_3gpp_gc_plmn_len,
13889      {"PLMN Length", "wlan_mgt.fixed.anqp.3gpp_cellular_info.plmn_len",
13890       FT_UINT8, BASE_DEC, NULL, 0,
13891       "Length of PLMN List value contents", HFILL }},
13892     {&hf_ieee80211_3gpp_gc_num_plmns,
13893      {"Number of PLMNs", "wlan_mgt.fixed.anqp.3gpp_cellular_info.num_plmns",
13894       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13895     {&hf_ieee80211_3gpp_gc_plmn,
13896      {"PLMN", "wlan_mgt.fixed.anqp.3gpp_cellular_info.plmn",
13897       FT_STRING, BASE_NONE, NULL, 0,
13898       "PLMN information", HFILL }},
13899
13900     {&hf_ieee80211_ff_anqp_domain_name_len,
13901      {"Domain Name Length", "wlan_mgt.fixed.anqp.domain_name_list.len",
13902       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13903     {&hf_ieee80211_ff_anqp_domain_name,
13904      {"Domain Name", "wlan_mgt.fixed.anqp.domain_name_list.name",
13905       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
13906
13907     {&hf_ieee80211_ff_dls_timeout,
13908      {"DLS timeout", "wlan_mgt.fixed.dls_timeout",
13909       FT_UINT16, BASE_HEX, NULL, 0, "DLS timeout value", HFILL }},
13910
13911     {&hf_ieee80211_ff_sa_query_action_code,
13912      {"Action code", "wlan_mgt.fixed.action_code",
13913       FT_UINT8, BASE_DEC, VALS(sa_query_action_codes), 0,
13914       "Management action code", HFILL }},
13915
13916     {&hf_ieee80211_ff_transaction_id,
13917      {"Transaction Id", "wlan_mgt.fixed.transaction_id",
13918       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
13919
13920     {&hf_ieee80211_tag,
13921      {"Tag", "wlan_mgt.tag",
13922       FT_NONE, BASE_NONE, 0x0, 0,
13923       NULL, HFILL }},
13924
13925     {&hf_ieee80211_tag_number,
13926      {"Tag Number", "wlan_mgt.tag.number",
13927       FT_UINT8, BASE_DEC, VALS(tag_num_vals), 0,
13928       "Element ID", HFILL }},
13929
13930     {&hf_ieee80211_tag_length,
13931      {"Tag length", "wlan_mgt.tag.length",
13932       FT_UINT32, BASE_DEC, NULL, 0, "Length of tag", HFILL }},
13933
13934     {&hf_ieee80211_tag_interpretation,
13935      {"Tag interpretation", "wlan_mgt.tag.interpretation",
13936       FT_STRING, BASE_NONE, NULL, 0, "Interpretation of tag", HFILL }},
13937
13938     {&hf_ieee80211_tag_oui,
13939      {"OUI", "wlan_mgt.tag.oui",
13940       FT_UINT24, BASE_CUSTOM, oui_base_custom, 0, "OUI of vendor specific IE", HFILL }},
13941
13942     {&hf_ieee80211_tag_ds_param_channel,
13943      {"Current Channel", "wlan_mgt.ds.current_channel",
13944       FT_UINT8, BASE_DEC, NULL, 0,
13945       "DS Parameter Set - Current Channel", HFILL }},
13946
13947     {&hf_ieee80211_tag_cfp_count,
13948      {"CFP Count", "wlan_mgt.cfp.count",
13949       FT_UINT8, BASE_DEC, NULL, 0,
13950       "Indicates how many delivery traffic indication messages (DTIMs)", HFILL }},
13951
13952     {&hf_ieee80211_tag_cfp_period,
13953      {"CFP Period", "wlan_mgt.cfp.period",
13954       FT_UINT8, BASE_DEC, NULL, 0,
13955       "Indicates the number of DTIM intervals between the start of CFPs", HFILL }},
13956
13957     {&hf_ieee80211_tag_cfp_max_duration,
13958      {"CFP Max Duration", "wlan_mgt.cfp.max_duration",
13959       FT_UINT16, BASE_DEC, NULL, 0,
13960       "Indicates the maximum duration (in TU) of the CFP that may be generated by this PCF", HFILL }},
13961
13962     {&hf_ieee80211_tag_cfp_dur_remaining,
13963      {"CFP Dur Remaining", "wlan_mgt.cfp.dur_remaining",
13964       FT_UINT16, BASE_DEC, NULL, 0,
13965       "Indicates the maximum time (in TU) remaining in the present CFP", HFILL }},
13966
13967     {&hf_ieee80211_tag_vendor_oui_type,
13968      {"Vendor Specific OUI Type", "wlan_mgt.tag.oui.type",
13969       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
13970
13971     {&hf_ieee80211_tim_dtim_count,
13972      {"DTIM count", "wlan_mgt.tim.dtim_count",
13973       FT_UINT8, BASE_DEC, NULL, 0,
13974       "Indicates how many Beacon frames (including the current frame) appear before the next DTIM", HFILL }},
13975
13976     {&hf_ieee80211_tim_dtim_period,
13977      {"DTIM period", "wlan_mgt.tim.dtim_period",
13978       FT_UINT8, BASE_DEC, NULL, 0,
13979       "Indicates the number of beacon intervals between successive DTIMs", HFILL }},
13980
13981     {&hf_ieee80211_tim_bmapctl,
13982      {"Bitmap control", "wlan_mgt.tim.bmapctl",
13983       FT_UINT8, BASE_HEX, NULL, 0,
13984       NULL, HFILL }},
13985
13986     {&hf_ieee80211_tim_bmapctl_mcast,
13987      {"Multicast", "wlan_mgt.tim.bmapctl.multicast",
13988       FT_BOOLEAN, 8, NULL, 0x1,
13989       "Contains the Traffic Indicator bit associated with Association ID 0", HFILL }},
13990
13991     {&hf_ieee80211_tim_bmapctl_offset,
13992      {"Bitmap Offset", "wlan_mgt.tim.bmapctl.offset",
13993       FT_UINT8, BASE_HEX, NULL, 0xFE,
13994       NULL, HFILL }},
13995
13996     {&hf_ieee80211_tim_partial_virtual_bitmap,
13997      {"Partial Virtual Bitmap", "wlan_mgt.tim.partial_virtual_bitmap",
13998       FT_BYTES, BASE_NONE, NULL, 0x0,
13999       NULL, HFILL }},
14000
14001     {&hf_ieee80211_tag_ibss_atim_window,
14002      {"Atim Windows", "wlan_mgt.ibss.atim_windows",
14003       FT_UINT16, BASE_HEX, NULL, 0x0,
14004       "Contains the ATIM Window length in TU", HFILL }},
14005
14006     {&hf_ieee80211_tag_country_info_code,
14007      {"Code", "wlan_mgt.country_info.code",
14008       FT_STRING, BASE_NONE, NULL, 0x0,
14009       NULL, HFILL }},
14010
14011     {&hf_ieee80211_tag_country_info_env,
14012      {"Environment", "wlan_mgt.country_info.environment",
14013       FT_UINT8, BASE_HEX, VALS(environment_vals), 0x0,
14014       NULL, HFILL }},
14015
14016     {&hf_ieee80211_tag_country_info_pad,
14017      {"Padding", "wlan_mgt.country_info.padding",
14018       FT_BYTES, BASE_NONE, NULL, 0x0,
14019       NULL, HFILL }},
14020
14021     {&hf_ieee80211_tag_country_info_fnm,
14022      {"Country Info", "wlan_mgt.country_info.fnm",
14023       FT_NONE, BASE_NONE, NULL, 0x0,
14024       NULL, HFILL }},
14025
14026     {&hf_ieee80211_tag_country_info_fnm_fcn,
14027      {"First Channel Number", "wlan_mgt.country_info.fnm.fcn",
14028       FT_UINT8, BASE_DEC, NULL, 0x0,
14029       NULL, HFILL }},
14030
14031     {&hf_ieee80211_tag_country_info_fnm_nc,
14032      {"Number of Channels", "wlan_mgt.country_info.fnm.nc",
14033       FT_UINT8, BASE_DEC, NULL, 0x0,
14034       NULL, HFILL }},
14035
14036     {&hf_ieee80211_tag_country_info_fnm_mtpl,
14037      {"Maximum Transmit Power Level (in dBm)", "wlan_mgt.country_info.fnm.mtpl",
14038       FT_UINT8, BASE_DEC, NULL, 0x0,
14039       NULL, HFILL }},
14040
14041     {&hf_ieee80211_tag_country_info_rrc,
14042      {"Country Info", "wlan_mgt.country_info.rrc",
14043       FT_NONE, BASE_NONE, NULL, 0x0,
14044       NULL, HFILL }},
14045
14046     {&hf_ieee80211_tag_country_info_rrc_rei,
14047      {"Regulatory Extension Identifier", "wlan_mgt.country_info.rrc.rei",
14048       FT_UINT8, BASE_DEC, NULL, 0x0,
14049       NULL, HFILL }},
14050
14051     {&hf_ieee80211_tag_country_info_rrc_rc,
14052      {"Regulatory Class", "wlan_mgt.country_info.rrc.rc",
14053       FT_UINT8, BASE_DEC, NULL, 0x0,
14054       NULL, HFILL }},
14055
14056     {&hf_ieee80211_tag_country_info_rrc_cc,
14057      {"Coverage Class", "wlan_mgt.country_info.rrc.cc",
14058       FT_UINT8, BASE_DEC, NULL, 0x0,
14059       NULL, HFILL }},
14060
14061     {&hf_ieee80211_tag_fh_hopping_parameter_prime_radix,
14062      {"Prime Radix", "wlan_mgt.fh_hopping.parameter.prime_radix",
14063       FT_UINT8, BASE_DEC, NULL, 0x0,
14064       NULL, HFILL }},
14065
14066     {&hf_ieee80211_tag_fh_hopping_parameter_nb_channels,
14067      {"Number of Channels", "wlan_mgt.fh_hopping.parameter.nb_channels",
14068       FT_UINT8, BASE_DEC, NULL, 0x0,
14069       NULL, HFILL }},
14070
14071     {&hf_ieee80211_tag_fh_hopping_table_flag,
14072      {"Flag", "wlan_mgt.fh_hopping.table.flag",
14073       FT_UINT8, BASE_HEX, NULL, 0x0,
14074       "Indicates that a Random Table is present when the value is 1", HFILL }},
14075
14076     {&hf_ieee80211_tag_fh_hopping_table_number_of_sets,
14077      {"Number of Sets", "wlan_mgt.fh_hopping.table.number_of_sets",
14078       FT_UINT8, BASE_DEC, NULL, 0x0,
14079       "Indicates the total number of sets within the hopping patterns", HFILL }},
14080
14081     {&hf_ieee80211_tag_fh_hopping_table_modulus,
14082      {"Modulus", "wlan_mgt.fh_hopping.table.modulus",
14083       FT_UINT8, BASE_HEX, NULL, 0x0,
14084       "Indicate the values to be used in the equations to create a hopping sequence from the Random Table information", HFILL }},
14085
14086     {&hf_ieee80211_tag_fh_hopping_table_offset,
14087      {"Offset", "wlan_mgt.fh_hopping.table.offset",
14088       FT_UINT8, BASE_HEX, NULL, 0x0,
14089       "Indicate the values to be used in the equations to create a hopping sequence from the Random Table information", HFILL }},
14090
14091     {&hf_ieee80211_tag_fh_hopping_random_table,
14092      {"Random Table", "wlan_mgt.fh_hopping.table.random_table",
14093       FT_UINT16, BASE_HEX, NULL, 0x0,
14094       "It is a vector of single octet values that indicate the random sequence to be followed during a hopping sequence", HFILL }},
14095
14096     {&hf_ieee80211_tag_request,
14097      {"Requested Element ID", "wlan_mgt.tag.request",
14098       FT_UINT8, BASE_DEC, VALS(tag_num_vals), 0,
14099       "The list of elements that are to be included in the responding STA Probe Response frame", HFILL }},
14100
14101     {&hf_ieee80211_tclas_up,
14102      {"User Priority", "wlan_mgt.tclas.user_priority",
14103       FT_UINT8, BASE_DEC, NULL, 0,
14104       "Contains the value of the UP of the associated MSDUs", HFILL }},
14105
14106     {&hf_ieee80211_tclas_class_type,
14107      {"Classifier Type", "wlan_mgt.tclas.class_type",
14108       FT_UINT8, BASE_DEC, VALS (classifier_type), 0,
14109       "Specifies the type of classifier parameters", HFILL }},
14110
14111     {&hf_ieee80211_tclas_class_mask,
14112      {"Classifier Mask", "wlan_mgt.tclas.class_mask",
14113       FT_UINT8, BASE_HEX,  NULL, 0,
14114       "Specifies a bitmap where bits that are set to 1 identify a subset of the classifier parameters", HFILL }},
14115
14116     {&hf_ieee80211_tclas_src_mac_addr,
14117      {"Source address", "wlan_mgt.tclas.type",
14118       FT_ETHER, BASE_NONE, NULL, 0,
14119       "Classifier Parameters Ethernet Type", HFILL }},
14120
14121     {&hf_ieee80211_tclas_dst_mac_addr,
14122      {"Destination address", "wlan_mgt.tclas.type",
14123       FT_ETHER, BASE_NONE, NULL, 0,
14124       NULL, HFILL }},
14125
14126     {&hf_ieee80211_tclas_ether_type,
14127      {"Ethernet Type", "wlan_mgt.tclas.type",
14128       FT_UINT8, BASE_DEC, NULL, 0,
14129       NULL, HFILL }},
14130
14131     {&hf_ieee80211_tclas_version,
14132      {"IP Version", "wlan_mgt.tclas.version",
14133       FT_UINT8, BASE_DEC, NULL, 0,
14134       NULL, HFILL }},
14135
14136     {&hf_ieee80211_tclas_ipv4_src,
14137      {"IPv4 Src Addr", "wlan_mgt.tclas.ipv4_src",
14138       FT_IPv4, BASE_NONE, NULL, 0,
14139       NULL, HFILL }},
14140
14141     {&hf_ieee80211_tclas_ipv4_dst,
14142      {"IPv4 Dst Addr", "wlan_mgt.tclas.ipv4_dst",
14143       FT_IPv4, BASE_NONE, NULL, 0,
14144       NULL, HFILL }},
14145
14146     {&hf_ieee80211_tclas_src_port,
14147      {"Source Port", "wlan_mgt.tclas.src_port",
14148       FT_UINT16, BASE_DEC, NULL, 0,
14149       NULL, HFILL }},
14150
14151     {&hf_ieee80211_tclas_dst_port,
14152      {"Destination Port", "wlan_mgt.tclas.dst_port",
14153       FT_UINT16, BASE_DEC, NULL, 0,
14154       NULL, HFILL }},
14155
14156     {&hf_ieee80211_tclas_dscp,
14157      {"IPv4 DSCP", "wlan_mgt.tclas.dscp",
14158       FT_UINT8, BASE_HEX, NULL, 0,
14159     "IPv4 Differentiated Services Code Point (DSCP) Field", HFILL }},
14160
14161     {&hf_ieee80211_tclas_protocol,
14162      {"Protocol", "wlan_mgt.tclas.protocol",
14163       FT_UINT8, BASE_HEX, NULL, 0, "IPv4 Protocol", HFILL }},
14164
14165     {&hf_ieee80211_tclas_ipv6_src,
14166      {"IPv6 Src Addr", "wlan_mgt.tclas.ipv6_src",
14167       FT_IPv6, BASE_NONE,
14168       NULL, 0, NULL, HFILL }},
14169
14170     {&hf_ieee80211_tclas_ipv6_dst,
14171      {"IPv6 Dst Addr", "wlan_mgt.tclas.ipv6_dst",
14172       FT_IPv6, BASE_NONE, NULL, 0,
14173       NULL, HFILL }},
14174
14175     {&hf_ieee80211_tclas_flow,
14176      {"Flow Label", "wlan_mgt.tclas.flow",
14177       FT_UINT24, BASE_HEX, NULL, 0,
14178       "IPv6 Flow Label", HFILL }},
14179
14180     {&hf_ieee80211_tclas_tag_type,
14181      {"802.1Q Tag Type", "wlan_mgt.tclas.tag_type",
14182       FT_UINT16, BASE_HEX, NULL, 0,
14183       NULL, HFILL }},
14184
14185     {&hf_ieee80211_tag_challenge_text,
14186      {"Challenge Text", "wlan_mgt.tag.challenge_text",
14187       FT_BYTES, BASE_NONE, NULL, 0,
14188       NULL, HFILL }},
14189
14190     {&hf_ieee80211_rsn_version,
14191      {"RSN Version", "wlan_mgt.rsn.version", FT_UINT16, BASE_DEC,
14192       NULL, 0, "Indicates the version number of the RSNA protocol", HFILL }},
14193
14194     {&hf_ieee80211_rsn_gcs,
14195      {"Group Cipher Suite", "wlan_mgt.rsn.gcs", FT_UINT32, BASE_CUSTOM,
14196       rsn_gcs_base_custom, 0, "Contains the cipher suite selector used by the BSS to protect broadcast/multicast traffic", HFILL }},
14197
14198     {&hf_ieee80211_rsn_gcs_oui,
14199      {"Group Cipher Suite OUI", "wlan_mgt.rsn.gcs.oui", FT_UINT24, BASE_CUSTOM,
14200       oui_base_custom, 0, NULL, HFILL }},
14201
14202     {&hf_ieee80211_rsn_gcs_type,
14203      {"Group Cipher Suite type", "wlan_mgt.rsn.gcs.type", FT_UINT8, BASE_DEC,
14204       NULL, 0, NULL, HFILL }},
14205
14206     {&hf_ieee80211_rsn_gcs_80211_type,
14207      {"Group Cipher Suite type", "wlan_mgt.rsn.gcs.type", FT_UINT8, BASE_DEC,
14208       VALS(ieee80211_rsn_cipher_vals), 0, NULL, HFILL }},
14209
14210     {&hf_ieee80211_rsn_pcs_count,
14211      {"Pairwise Cipher Suite Count", "wlan_mgt.rsn.pcs.count", FT_UINT16, BASE_DEC,
14212       NULL, 0, "Indicates the number of pairwise cipher suite selectors that are contained in the Pairwise Cipher Suite List", HFILL }},
14213
14214     {&hf_ieee80211_rsn_pcs_list,
14215      {"Pairwise Cipher Suite List", "wlan_mgt.rsn.pcs.list", FT_NONE, BASE_NONE,
14216       NULL, 0, "Contains a series of cipher suite selectors that indicate the pairwisecipher suites", HFILL }},
14217
14218     {&hf_ieee80211_rsn_pcs,
14219      {"Pairwise Cipher Suite", "wlan_mgt.rsn.pcs", FT_UINT32, BASE_CUSTOM,
14220       rsn_pcs_base_custom, 0, NULL, HFILL }},
14221
14222     {&hf_ieee80211_rsn_pcs_oui,
14223      {"Pairwise Cipher Suite OUI", "wlan_mgt.rsn.pcs.oui", FT_UINT24, BASE_CUSTOM,
14224       oui_base_custom, 0, NULL, HFILL }},
14225
14226     {&hf_ieee80211_rsn_pcs_type,
14227      {"Pairwise Cipher Suite type", "wlan_mgt.rsn.pcs.type", FT_UINT8, BASE_DEC,
14228       NULL, 0, NULL, HFILL }},
14229
14230     {&hf_ieee80211_rsn_pcs_80211_type,
14231      {"Pairwise Cipher Suite type", "wlan_mgt.rsn.pcs.type", FT_UINT8, BASE_DEC,
14232       VALS(ieee80211_rsn_cipher_vals), 0, NULL, HFILL }},
14233
14234     {&hf_ieee80211_rsn_akms_count,
14235      {"Auth Key Management (AKM) Suite Count", "wlan_mgt.rsn.akms.count", FT_UINT16, BASE_DEC,
14236       NULL, 0, "Indicates the number of Auth Key Management suite selectors that are contained in the Auth Key Management Suite List", HFILL }},
14237
14238     {&hf_ieee80211_rsn_akms_list,
14239      {"Auth Key Management (AKM) List", "wlan_mgt.rsn.akms.list", FT_NONE, BASE_NONE,
14240       NULL, 0, "Contains a series of cipher suite selectors that indicate the AKM suites", HFILL }},
14241
14242     {&hf_ieee80211_rsn_akms,
14243      {"Auth Key Management (AKM) Suite", "wlan_mgt.rsn.akms", FT_UINT32, BASE_CUSTOM,
14244       rsn_akms_base_custom, 0, NULL, HFILL }},
14245
14246     {&hf_ieee80211_rsn_akms_oui,
14247      {"Auth Key Management (AKM) OUI", "wlan_mgt.rsn.akms.oui", FT_UINT24, BASE_CUSTOM,
14248       oui_base_custom, 0, NULL, HFILL }},
14249
14250     {&hf_ieee80211_rsn_akms_type,
14251      {"Auth Key Management (AKM) type", "wlan_mgt.rsn.akms.type", FT_UINT8, BASE_DEC,
14252       NULL, 0, NULL, HFILL }},
14253
14254     {&hf_ieee80211_rsn_akms_80211_type,
14255      {"Auth Key Management (AKM) type", "wlan_mgt.rsn.akms.type", FT_UINT8, BASE_DEC,
14256       VALS(ieee80211_rsn_keymgmt_vals), 0, NULL, HFILL }},
14257
14258     {&hf_ieee80211_rsn_cap,
14259      {"RSN Capabilities", "wlan_mgt.rsn.capabilities", FT_UINT16, BASE_HEX,
14260       NULL, 0, "RSN Capability information", HFILL }},
14261
14262     {&hf_ieee80211_rsn_cap_preauth,
14263      {"RSN Pre-Auth capabilities", "wlan_mgt.rsn.capabilities.preauth",
14264       FT_BOOLEAN, 16, TFS(&rsn_preauth_flags), 0x0001,
14265       NULL, HFILL }},
14266
14267     {&hf_ieee80211_rsn_cap_no_pairwise,
14268      {"RSN No Pairwise capabilities", "wlan_mgt.rsn.capabilities.no_pairwise",
14269       FT_BOOLEAN, 16, TFS(&rsn_no_pairwise_flags), 0x0002,
14270       NULL, HFILL }},
14271
14272     {&hf_ieee80211_rsn_cap_ptksa_replay_counter,
14273      {"RSN PTKSA Replay Counter capabilities",
14274       "wlan_mgt.rsn.capabilities.ptksa_replay_counter",
14275       FT_UINT16, BASE_HEX, VALS(rsn_cap_replay_counter), 0x000C,
14276       NULL, HFILL }},
14277
14278     {&hf_ieee80211_rsn_cap_gtksa_replay_counter,
14279      {"RSN GTKSA Replay Counter capabilities",
14280       "wlan_mgt.rsn.capabilities.gtksa_replay_counter",
14281       FT_UINT16, BASE_HEX, VALS(rsn_cap_replay_counter), 0x0030,
14282       NULL, HFILL }},
14283
14284     {&hf_ieee80211_rsn_cap_mfpr,
14285      {"Management Frame Protection Required",
14286       "wlan_mgt.rsn.capabilities.mfpr",
14287       FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }},
14288
14289     {&hf_ieee80211_rsn_cap_mfpc,
14290      {"Management Frame Protection Capable",
14291       "wlan_mgt.rsn.capabilities.mfpc",
14292       FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL }},
14293
14294     {&hf_ieee80211_rsn_cap_peerkey,
14295      {"PeerKey Enabled",
14296       "wlan_mgt.rsn.capabilities.peerkey",
14297       FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL }},
14298
14299     {&hf_ieee80211_rsn_pmkid_count,
14300      {"PMKID Count", "wlan_mgt.rsn.pmkid.count", FT_UINT16, BASE_DEC,
14301       NULL, 0, "Indicates the number of PMKID  selectors that are contained in the PMKID Suite List", HFILL }},
14302
14303     {&hf_ieee80211_rsn_pmkid_list,
14304      {"PMKID List", "wlan_mgt.rsn.pmkid.list", FT_NONE, BASE_NONE,
14305       NULL, 0, "Contains a series of cipher suite selectors that indicate the AKM suites", HFILL }},
14306
14307     {&hf_ieee80211_rsn_pmkid,
14308      {"PMKID", "wlan_mgt.pmkid.akms", FT_BYTES, BASE_NONE,
14309       NULL, 0, NULL, HFILL }},
14310
14311     {&hf_ieee80211_rsn_gmcs,
14312      {"Group Management Cipher Suite", "wlan_mgt.rsn.gmcs", FT_UINT32, BASE_CUSTOM,
14313       rsn_gmcs_base_custom, 0, "Contains the cipher suite selector used by the BSS to protect broadcast/multicast traffic", HFILL }},
14314
14315     {&hf_ieee80211_rsn_gmcs_oui,
14316      {"Group Management Cipher Suite OUI", "wlan_mgt.rsn.gmcs.oui", FT_UINT24, BASE_CUSTOM,
14317       oui_base_custom, 0, NULL, HFILL }},
14318
14319     {&hf_ieee80211_rsn_gmcs_type,
14320      {"Group Management Cipher Suite type", "wlan_mgt.rsn.gmcs.type", FT_UINT8, BASE_DEC,
14321       NULL, 0, NULL, HFILL }},
14322
14323     {&hf_ieee80211_rsn_gmcs_80211_type,
14324      {"Group Management Cipher Suite type", "wlan_mgt.rsn.gmcs.type", FT_UINT8, BASE_DEC,
14325       VALS(ieee80211_rsn_cipher_vals), 0, NULL, HFILL }},
14326
14327
14328     {&hf_ieee80211_ht_cap,
14329      {"HT Capabilities Info", "wlan_mgt.ht.capabilities", FT_UINT16, BASE_HEX,
14330       NULL, 0, "HT Capability information", HFILL }},
14331
14332     {&hf_ieee80211_ht_vs_cap,
14333      {"HT Capabilities Info (VS)", "wlan_mgt.vs.ht.capabilities", FT_UINT16, BASE_HEX,
14334       NULL, 0, "Vendor Specific HT Capability information", HFILL }},
14335
14336     {&hf_ieee80211_ht_ldpc_coding,
14337      {"HT LDPC coding capability", "wlan_mgt.ht.capabilities.ldpccoding",
14338       FT_BOOLEAN, 16, TFS (&ht_ldpc_coding_flag), 0x0001,
14339       NULL, HFILL }},
14340
14341     {&hf_ieee80211_ht_chan_width,
14342      {"HT Support channel width", "wlan_mgt.ht.capabilities.width",
14343       FT_BOOLEAN, 16, TFS (&ht_chan_width_flag), 0x0002,
14344       NULL, HFILL }},
14345
14346     {&hf_ieee80211_ht_sm_pwsave,
14347      {"HT SM Power Save", "wlan_mgt.ht.capabilities.sm",
14348       FT_UINT16, BASE_HEX, VALS (&ht_sm_pwsave_flag), 0x000c,
14349       NULL, HFILL }},
14350
14351     {&hf_ieee80211_ht_green,
14352      {"HT Green Field", "wlan_mgt.ht.capabilities.green",
14353       FT_BOOLEAN, 16, TFS (&ht_green_flag), 0x0010,
14354       NULL, HFILL }},
14355
14356     {&hf_ieee80211_ht_short20,
14357      {"HT Short GI for 20MHz", "wlan_mgt.ht.capabilities.short20",
14358       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0020,
14359       NULL, HFILL }},
14360
14361     {&hf_ieee80211_ht_short40,
14362      {"HT Short GI for 40MHz", "wlan_mgt.ht.capabilities.short40",
14363       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0040,
14364       NULL, HFILL }},
14365
14366     {&hf_ieee80211_ht_tx_stbc,
14367      {"HT Tx STBC", "wlan_mgt.ht.capabilities.txstbc",
14368       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0080,
14369       NULL, HFILL }},
14370
14371     {&hf_ieee80211_ht_rx_stbc,
14372      {"HT Rx STBC", "wlan_mgt.ht.capabilities.rxstbc",
14373       FT_UINT16, BASE_HEX, VALS (&ht_rx_stbc_flag), 0x0300,
14374       "HT Tx STBC", HFILL }},
14375
14376     {&hf_ieee80211_ht_delayed_block_ack,
14377      {"HT Delayed Block ACK", "wlan_mgt.ht.capabilities.delayedblockack",
14378       FT_BOOLEAN, 16, TFS (&ht_delayed_block_ack_flag), 0x0400,
14379       NULL, HFILL }},
14380
14381     {&hf_ieee80211_ht_max_amsdu,
14382      {"HT Max A-MSDU length", "wlan_mgt.ht.capabilities.amsdu",
14383       FT_BOOLEAN, 16, TFS (&ht_max_amsdu_flag), 0x0800,
14384       NULL, HFILL }},
14385
14386     {&hf_ieee80211_ht_dss_cck_40,
14387      {"HT DSSS/CCK mode in 40MHz", "wlan_mgt.ht.capabilities.dsscck",
14388       FT_BOOLEAN, 16, TFS (&ht_dss_cck_40_flag), 0x1000,
14389       "HT DSS/CCK mode in 40MHz", HFILL }},
14390
14391     {&hf_ieee80211_ht_psmp,
14392      {"HT PSMP Support", "wlan_mgt.ht.capabilities.psmp",
14393       FT_BOOLEAN, 16, TFS (&ht_psmp_flag), 0x2000,
14394       NULL, HFILL }},
14395
14396     {&hf_ieee80211_ht_40_mhz_intolerant,
14397      {"HT Forty MHz Intolerant", "wlan_mgt.ht.capabilities.40mhzintolerant",
14398       FT_BOOLEAN, 16, TFS (&ht_40_mhz_intolerant_flag), 0x4000,
14399       NULL, HFILL }},
14400
14401     {&hf_ieee80211_ht_l_sig,
14402      {"HT L-SIG TXOP Protection support", "wlan_mgt.ht.capabilities.lsig",
14403       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x8000,
14404       NULL, HFILL }},
14405
14406     {&hf_ieee80211_ampduparam,
14407      {"A-MPDU Parameters", "wlan_mgt.ht.ampduparam", FT_UINT16, BASE_HEX,
14408       NULL, 0, NULL, HFILL }},
14409
14410     {&hf_ieee80211_ampduparam_vs,
14411      {"A-MPDU Parameters (VS)", "wlan_mgt.vs.ht.ampduparam", FT_UINT16, BASE_HEX,
14412       NULL, 0, "Vendor Specific A-MPDU Parameters", HFILL }},
14413
14414     {&hf_ieee80211_ampduparam_mpdu,
14415      {"Maximum Rx A-MPDU Length", "wlan_mgt.ht.ampduparam.maxlength",
14416       FT_UINT8, BASE_HEX, 0, 0x03,
14417       NULL, HFILL }},
14418
14419     {&hf_ieee80211_ampduparam_mpdu_start_spacing,
14420      {"MPDU Density", "wlan_mgt.ht.ampduparam.mpdudensity",
14421       FT_UINT8, BASE_HEX, VALS(&ampduparam_mpdu_start_spacing_flags), 0x1c,
14422       NULL, HFILL }},
14423
14424     {&hf_ieee80211_ampduparam_reserved,
14425      {"Reserved", "wlan_mgt.ht.ampduparam.reserved",
14426       FT_UINT8, BASE_HEX, NULL, 0xE0,
14427       NULL, HFILL }},
14428
14429     {&hf_ieee80211_mcsset,
14430      {"Rx Supported Modulation and Coding Scheme Set", "wlan_mgt.ht.mcsset",
14431       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
14432
14433     {&hf_ieee80211_mcsset_vs,
14434      {"Rx Supported Modulation and Coding Scheme Set (VS)", "wlan_mgt.vs.ht.mcsset",
14435       FT_STRING, BASE_NONE, NULL, 0, "Vendor Specific Rx Supported Modulation and Coding Scheme Set", HFILL }},
14436
14437     {&hf_ieee80211_mcsset_rx_bitmask,
14438      {"Rx Modulation and Coding Scheme (One bit per modulation)", "wlan_mgt.ht.mcsset.rxbitmask",
14439       FT_NONE, BASE_NONE, NULL, 0, "One bit per modulation", HFILL }},
14440
14441     {&hf_ieee80211_mcsset_rx_bitmask_0to7,
14442      {"Rx Bitmask Bits 0-7", "wlan_mgt.ht.mcsset.rxbitmask.0to7",
14443       FT_UINT32, BASE_HEX, 0, 0x000000ff, NULL, HFILL }},
14444
14445     {&hf_ieee80211_mcsset_rx_bitmask_8to15,
14446      {"Rx Bitmask Bits 8-15", "wlan_mgt.ht.mcsset.rxbitmask.8to15",
14447       FT_UINT32, BASE_HEX, 0, 0x0000ff00, NULL, HFILL }},
14448
14449     {&hf_ieee80211_mcsset_rx_bitmask_16to23,
14450      {"Rx Bitmask Bits 16-23", "wlan_mgt.ht.mcsset.rxbitmask.16to23",
14451       FT_UINT32, BASE_HEX, 0, 0x00ff0000, NULL, HFILL }},
14452
14453     {&hf_ieee80211_mcsset_rx_bitmask_24to31,
14454      {"Rx Bitmask Bits 24-31", "wlan_mgt.ht.mcsset.rxbitmask.24to31",
14455       FT_UINT32, BASE_HEX, 0, 0xff000000, NULL, HFILL }},
14456
14457     {&hf_ieee80211_mcsset_rx_bitmask_32,
14458      {"Rx Bitmask Bit 32", "wlan_mgt.ht.mcsset.rxbitmask.32",
14459       FT_UINT32, BASE_HEX, 0, 0x000001, NULL, HFILL }},
14460
14461     {&hf_ieee80211_mcsset_rx_bitmask_33to38,
14462      {"Rx Bitmask Bits 33-38", "wlan_mgt.ht.mcsset.rxbitmask.33to38",
14463       FT_UINT32, BASE_HEX, 0, 0x00007e, NULL, HFILL }},
14464
14465     {&hf_ieee80211_mcsset_rx_bitmask_39to52,
14466      {"Rx Bitmask Bits 39-52", "wlan_mgt.ht.mcsset.rxbitmask.39to52",
14467       FT_UINT32, BASE_HEX, 0, 0x1fff80, NULL, HFILL }},
14468
14469     {&hf_ieee80211_mcsset_rx_bitmask_53to76,
14470      {"Rx Bitmask Bits 53-76", "wlan_mgt.ht.mcsset.rxbitmask.53to76",
14471       FT_UINT32, BASE_HEX, 0, 0x1fffffe0, NULL, HFILL }},
14472
14473     {&hf_ieee80211_mcsset_highest_data_rate,
14474      {"Highest Supported Data Rate", "wlan_mgt.ht.mcsset.highestdatarate",
14475       FT_UINT16, BASE_HEX, 0, 0x03ff, NULL, HFILL }},
14476
14477     {&hf_ieee80211_mcsset_tx_mcs_set_defined,
14478      {"Tx Supported MCS Set", "wlan_mgt.ht.mcsset.txsetdefined",
14479       FT_BOOLEAN, 16, TFS (&mcsset_tx_mcs_set_defined_flag), 0x0001,
14480       NULL, HFILL }},
14481
14482     {&hf_ieee80211_mcsset_tx_rx_mcs_set_not_equal,
14483      {"Tx and Rx MCS Set", "wlan_mgt.ht.mcsset.txrxmcsnotequal",
14484       FT_BOOLEAN, 16, TFS (&mcsset_tx_rx_mcs_set_not_equal_flag), 0x0002,
14485       NULL, HFILL }},
14486
14487     {&hf_ieee80211_mcsset_tx_max_spatial_streams,
14488      {"Tx Maximum Number of Spatial Streams Supported", "wlan_mgt.ht.mcsset.txmaxss",
14489       FT_UINT16, BASE_HEX, VALS (&mcsset_tx_max_spatial_streams_flags) , 0x000c,
14490       NULL, HFILL }},
14491
14492     {&hf_ieee80211_mcsset_tx_unequal_modulation,
14493      {"Unequal Modulation", "wlan_mgt.ht.mcsset.txunequalmod",
14494       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0010,
14495       NULL, HFILL }},
14496
14497     {&hf_ieee80211_htex_cap,
14498      {"HT Extended Capabilities", "wlan_mgt.htex.capabilities", FT_UINT16, BASE_HEX,
14499       NULL, 0, "HT Extended Capability information", HFILL }},
14500
14501     {&hf_ieee80211_htex_vs_cap,
14502      {"HT Extended Capabilities (VS)", "wlan_mgt.vs.htex.capabilities", FT_UINT16, BASE_HEX,
14503       NULL, 0, "Vendor Specific HT Extended Capability information", HFILL }},
14504
14505     {&hf_ieee80211_htex_pco,
14506      {"Transmitter supports PCO", "wlan_mgt.htex.capabilities.pco",
14507       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0001,
14508       NULL, HFILL }},
14509
14510     {&hf_ieee80211_htex_transtime,
14511      {"Time needed to transition between 20MHz and 40MHz", "wlan_mgt.htex.capabilities.transtime",
14512       FT_UINT16, BASE_HEX, VALS (&htex_transtime_flags), 0x0006,
14513       NULL, HFILL }},
14514
14515     {&hf_ieee80211_htex_mcs,
14516      {"MCS Feedback capability", "wlan_mgt.htex.capabilities.mcs",
14517       FT_UINT16, BASE_HEX, VALS (&htex_mcs_flags), 0x0300,
14518       NULL, HFILL }},
14519
14520     {&hf_ieee80211_htex_htc_support,
14521      {"High Throughput", "wlan_mgt.htex.capabilities.htc",
14522       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0400,
14523       NULL, HFILL }},
14524
14525     {&hf_ieee80211_htex_rd_responder,
14526      {"Reverse Direction Responder", "wlan_mgt.htex.capabilities.rdresponder",
14527       FT_BOOLEAN, 16, TFS (&tfs_supported_not_supported), 0x0800,
14528       NULL, HFILL }},
14529
14530     {&hf_ieee80211_txbf,
14531      {"Transmit Beam Forming (TxBF) Capabilities", "wlan_mgt.txbf", FT_UINT16, BASE_HEX,
14532       NULL, 0, NULL, HFILL }},
14533
14534     {&hf_ieee80211_txbf_vs,
14535      {"Transmit Beam Forming (TxBF) Capabilities (VS)", "wlan_mgt.vs.txbf", FT_UINT16, BASE_HEX,
14536       NULL, 0, "Vendor Specific Transmit Beam Forming (TxBF) Capabilities", HFILL }},
14537
14538     {&hf_ieee80211_txbf_cap,
14539      {"Transmit Beamforming", "wlan_mgt.txbf.txbf",
14540       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000001,
14541       NULL, HFILL }},
14542
14543     {&hf_ieee80211_txbf_rcv_ssc,
14544      {"Receive Staggered Sounding", "wlan_mgt.txbf.rxss",
14545       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000002,
14546       NULL, HFILL }},
14547
14548     {&hf_ieee80211_txbf_tx_ssc,
14549      {"Transmit Staggered Sounding", "wlan_mgt.txbf.txss",
14550       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000004,
14551       NULL, HFILL }},
14552
14553     {&hf_ieee80211_txbf_rcv_ndp,
14554      {"Receive Null Data packet (NDP)", "wlan_mgt.txbf.rxndp",
14555       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000008,
14556       NULL, HFILL }},
14557
14558     {&hf_ieee80211_txbf_tx_ndp,
14559      {"Transmit Null Data packet (NDP)", "wlan_mgt.txbf.txndp",
14560       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000010,
14561       NULL, HFILL }},
14562
14563     {&hf_ieee80211_txbf_impl_txbf,
14564      {"Implicit TxBF capable", "wlan_mgt.txbf.impltxbf",
14565       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000020,
14566       "Implicit Transmit Beamforming (TxBF) capable", HFILL }},
14567
14568     {&hf_ieee80211_txbf_calib,
14569      {"Calibration", "wlan_mgt.txbf.calibration",
14570       FT_UINT32, BASE_HEX, VALS (&txbf_calib_flag), 0x000000c0,
14571       NULL, HFILL }},
14572
14573     {&hf_ieee80211_txbf_expl_csi,
14574      {"STA can apply TxBF using CSI explicit feedback", "wlan_mgt.txbf.csi",
14575       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000100,
14576       "Station can apply TxBF using CSI explicit feedback", HFILL }},
14577
14578     {&hf_ieee80211_txbf_expl_uncomp_fm,
14579      {"STA can apply TxBF using uncompressed beamforming feedback matrix", "wlan_mgt.txbf.fm.uncompressed.tbf",
14580       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000200,
14581       "Station can apply TxBF using uncompressed beamforming feedback matrix", HFILL }},
14582
14583     {&hf_ieee80211_txbf_expl_comp_fm,
14584      {"STA can apply TxBF using compressed beamforming feedback matrix", "wlan_mgt.txbf.fm.compressed.tbf",
14585       FT_BOOLEAN, 32, TFS (&tfs_supported_not_supported), 0x00000400,
14586       "Station can apply TxBF using compressed beamforming feedback matrix", HFILL }},
14587
14588     {&hf_ieee80211_txbf_expl_bf_csi,
14589      {"Receiver can return explicit CSI feedback", "wlan_mgt.txbf.rcsi",
14590       FT_UINT32, BASE_HEX, VALS (&txbf_feedback_flags), 0x00001800,
14591       NULL, HFILL }},
14592
14593     {&hf_ieee80211_txbf_expl_uncomp_fm_feed,
14594      {"Receiver can return explicit uncompressed Beamforming Feedback Matrix", "wlan_mgt.txbf.fm.uncompressed.rbf",
14595       FT_UINT32, BASE_HEX, VALS (&txbf_feedback_flags), 0x00006000,
14596       NULL, HFILL }},
14597
14598     {&hf_ieee80211_txbf_expl_comp_fm_feed,
14599      {"STA can compress and use compressed Beamforming Feedback Matrix", "wlan_mgt.txbf.fm.compressed.bf",
14600       FT_UINT32, BASE_HEX, VALS (&txbf_feedback_flags), 0x00018000,
14601       "Station can compress and use compressed Beamforming Feedback Matrix", HFILL }},
14602
14603     {&hf_ieee80211_txbf_min_group,
14604      {"Minimal grouping used for explicit feedback reports", "wlan_mgt.txbf.mingroup",
14605       FT_UINT32, BASE_HEX, VALS (&txbf_min_group_flags), 0x00060000,
14606       NULL, HFILL }},
14607
14608     {&hf_ieee80211_txbf_csi_num_bf_ant,
14609      {"Max antennae STA can support when CSI feedback required", "wlan_mgt.txbf.csinumant",
14610       FT_UINT32, BASE_HEX, VALS (&txbf_antenna_flags), 0x00180000,
14611       "Max antennae station can support when CSI feedback required", HFILL }},
14612
14613     {&hf_ieee80211_txbf_uncomp_sm_bf_ant,
14614      {"Max antennae STA can support when uncompressed Beamforming feedback required", "wlan_mgt.txbf.fm.uncompressed.maxant",
14615       FT_UINT32, BASE_HEX, VALS (&txbf_antenna_flags), 0x00600000,
14616       "Max antennae station can support when uncompressed Beamforming feedback required", HFILL }},
14617
14618     {&hf_ieee80211_txbf_comp_sm_bf_ant,
14619      {"Max antennae STA can support when compressed Beamforming feedback required", "wlan_mgt.txbf.fm.compressed.maxant",
14620       FT_UINT32, BASE_HEX, VALS (&txbf_antenna_flags), 0x01800000,
14621       "Max antennae station can support when compressed Beamforming feedback required", HFILL }},
14622
14623     {&hf_ieee80211_txbf_csi_max_rows_bf,
14624      {"Maximum number of rows of CSI explicit feedback", "wlan_mgt.txbf.csi.maxrows",
14625       FT_UINT32, BASE_HEX, VALS (&txbf_csi_max_rows_bf_flags), 0x06000000,
14626       NULL, HFILL }},
14627
14628     {&hf_ieee80211_txbf_chan_est,
14629      {"Maximum number of space time streams for which channel dimensions can be simultaneously estimated", "wlan_mgt.txbf.channelest",
14630       FT_UINT32, BASE_HEX, VALS (&txbf_chan_est_flags), 0x18000000,
14631       NULL, HFILL }},
14632
14633     {&hf_ieee80211_txbf_resrv,
14634      {"Reserved", "wlan_mgt.txbf.reserved",
14635       FT_UINT32, BASE_HEX, NULL, 0xe0000000,
14636       NULL, HFILL }},
14637
14638     {&hf_ieee80211_hta_cc,
14639      {"HT Control Channel", "wlan_mgt.hta.control_channel", FT_UINT8, BASE_DEC,
14640       NULL, 0, NULL, HFILL }},
14641
14642     {&hf_ieee80211_hta_cap,
14643      {"HT Additional Capabilities", "wlan_mgt.hta.capabilities", FT_UINT16, BASE_HEX,
14644       NULL, 0, "HT Additional Capability information", HFILL }},
14645
14646     {&hf_ieee80211_hta_ext_chan_offset,
14647      {"Extension Channel Offset", "wlan_mgt.hta.capabilities.extchan",
14648       FT_UINT16, BASE_HEX, VALS (&hta_ext_chan_offset_flag), 0x0003,
14649       NULL, HFILL }},
14650
14651     {&hf_ieee80211_hta_rec_tx_width,
14652      {"Recommended Tx Channel Width", "wlan_mgt.hta.capabilities.rectxwidth",
14653       FT_BOOLEAN, 16, TFS (&hta_rec_tx_width_flag), 0x0004,
14654       "Recommended Transmit Channel Width", HFILL }},
14655
14656     {&hf_ieee80211_hta_rifs_mode,
14657      {"Reduced Interframe Spacing (RIFS) Mode", "wlan_mgt.hta.capabilities.rifsmode",
14658       FT_BOOLEAN, 16, TFS (&hta_rifs_mode_flag), 0x0008,
14659       NULL, HFILL }},
14660
14661     {&hf_ieee80211_hta_controlled_access,
14662      {"Controlled Access Only", "wlan_mgt.hta.capabilities.controlledaccess",
14663       FT_BOOLEAN, 16, TFS (&hta_controlled_access_flag), 0x0010,
14664       NULL, HFILL }},
14665
14666     {&hf_ieee80211_hta_service_interval,
14667      {"Service Interval Granularity", "wlan_mgt.hta.capabilities.serviceinterval",
14668       FT_UINT16, BASE_HEX, VALS (&hta_service_interval_flag), 0x00E0,
14669       NULL, HFILL }},
14670
14671     {&hf_ieee80211_hta_operating_mode,
14672      {"Operating Mode", "wlan_mgt.hta.capabilities.operatingmode",
14673       FT_UINT16, BASE_HEX, VALS (&hta_operating_mode_flag), 0x0003,
14674       NULL, HFILL }},
14675
14676     {&hf_ieee80211_hta_non_gf_devices,
14677      {"Non Greenfield (GF) devices Present", "wlan_mgt.hta.capabilities.nongfdevices",
14678       FT_BOOLEAN, 16, TFS (&hta_non_gf_devices_flag), 0x0004,
14679       "on Greenfield (GF) devices Present", HFILL }},
14680
14681     {&hf_ieee80211_hta_basic_stbc_mcs,
14682      {"Basic STB Modulation and Coding Scheme (MCS)", "wlan_mgt.hta.capabilities.",
14683       FT_UINT16, BASE_HEX, NULL , 0x007f,
14684       NULL, HFILL }},
14685
14686     {&hf_ieee80211_hta_dual_stbc_protection,
14687      {"Dual Clear To Send (CTS) Protection", "wlan_mgt.hta.capabilities.",
14688       FT_BOOLEAN, 16, TFS (&hta_dual_stbc_protection_flag), 0x0080,
14689       NULL, HFILL }},
14690
14691     {&hf_ieee80211_hta_secondary_beacon,
14692      {"Secondary Beacon", "wlan_mgt.hta.capabilities.",
14693       FT_BOOLEAN, 16, TFS (&hta_secondary_beacon_flag), 0x0100,
14694       NULL, HFILL }},
14695
14696     {&hf_ieee80211_hta_lsig_txop_protection,
14697      {"L-SIG TXOP Protection Support", "wlan_mgt.hta.capabilities.",
14698       FT_BOOLEAN, 16, TFS (&hta_lsig_txop_protection_flag), 0x0200,
14699       NULL, HFILL }},
14700
14701     {&hf_ieee80211_hta_pco_active,
14702      {"Phased Coexistence Operation (PCO) Active", "wlan_mgt.hta.capabilities.",
14703       FT_BOOLEAN, 16, TFS (&hta_pco_active_flag), 0x0400,
14704       NULL, HFILL }},
14705
14706     {&hf_ieee80211_hta_pco_phase,
14707      {"Phased Coexistence Operation (PCO) Phase", "wlan_mgt.hta.capabilities.",
14708       FT_BOOLEAN, 16, TFS (&hta_pco_phase_flag), 0x0800,
14709       NULL, HFILL }},
14710
14711     {&hf_ieee80211_antsel,
14712      {"Antenna Selection (ASEL) Capabilities", "wlan_mgt.asel",
14713       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14714
14715     {&hf_ieee80211_antsel_vs,
14716      {"Antenna Selection (ASEL) Capabilities (VS)", "wlan_mgt.vs.asel",
14717       FT_UINT8, BASE_HEX, NULL, 0, "Vendor Specific Antenna Selection (ASEL) Capabilities", HFILL }},
14718
14719     {&hf_ieee80211_antsel_b0,
14720      {"Antenna Selection Capable", "wlan_mgt.asel.capable",
14721       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x01, NULL, HFILL }},
14722
14723     {&hf_ieee80211_antsel_b1,
14724      {"Explicit CSI Feedback Based Tx ASEL", "wlan_mgt.asel.txcsi",
14725       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x02, NULL, HFILL }},
14726
14727     {&hf_ieee80211_antsel_b2,
14728      {"Antenna Indices Feedback Based Tx ASEL", "wlan_mgt.asel.txif",
14729       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x04, NULL, HFILL }},
14730
14731     {&hf_ieee80211_antsel_b3,
14732      {"Explicit CSI Feedback", "wlan_mgt.asel.csi",
14733       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x08, NULL, HFILL }},
14734
14735     {&hf_ieee80211_antsel_b4,
14736      {"Antenna Indices Feedback", "wlan_mgt.asel.if",
14737       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x10, NULL, HFILL }},
14738
14739     {&hf_ieee80211_antsel_b5,
14740      {"Rx ASEL", "wlan_mgt.asel.rx",
14741       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x20, NULL, HFILL }},
14742
14743     {&hf_ieee80211_antsel_b6,
14744      {"Tx Sounding PPDUs", "wlan_mgt.asel.sppdu",
14745       FT_BOOLEAN, 8, TFS (&tfs_supported_not_supported), 0x40, NULL, HFILL }},
14746
14747     {&hf_ieee80211_antsel_b7,
14748      {"Reserved", "wlan_mgt.asel.reserved",
14749       FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL }},
14750
14751     {&hf_ieee80211_ht_info_delimiter1,
14752      {"HT Information Subset (1 of 3)", "wlan_mgt.ht.info.delim1",
14753       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14754
14755     {&hf_ieee80211_ht_info_primary_channel,
14756      {"Primary Channel", "wlan_mgt.ht.info.primarychannel",
14757       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14758
14759     {&hf_ieee80211_ht_info_secondary_channel_offset,
14760      {"Secondary channel offset", "wlan_mgt.ht.info.secchanoffset",
14761       FT_UINT8, BASE_HEX, VALS (&ht_info_secondary_channel_offset_flags), 0x03, NULL, HFILL }},
14762
14763     {&hf_ieee80211_ht_info_channel_width,
14764      {"Supported channel width", "wlan_mgt.ht.info.chanwidth",
14765       FT_BOOLEAN, 8, TFS (&ht_info_channel_width_flag), 0x04, NULL, HFILL }},
14766
14767     {&hf_ieee80211_ht_info_rifs_mode,
14768      {"Reduced Interframe Spacing (RIFS)", "wlan_mgt.ht.info.rifs",
14769       FT_BOOLEAN, 8, TFS (&ht_info_rifs_mode_flag), 0x08, NULL, HFILL }},
14770
14771     {&hf_ieee80211_ht_info_psmp_stas_only,
14772      {"Power Save Multi-Poll (PSMP) stations only", "wlan_mgt.ht.info.psmponly",
14773       FT_BOOLEAN, 8, TFS (&ht_info_psmp_stas_only_flag), 0x10, NULL, HFILL }},
14774
14775     {&hf_ieee80211_ht_info_service_interval_granularity,
14776      {"Shortest service interval", "wlan_mgt.ht.info.",
14777       FT_UINT8, BASE_HEX, VALS (&ht_info_service_interval_granularity_flags), 0xe0, NULL, HFILL }},
14778
14779     {&hf_ieee80211_ht_info_delimiter2,
14780      {"HT Information Subset (2 of 3)", "wlan_mgt.ht.info.delim2",
14781       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
14782
14783     {&hf_ieee80211_ht_info_operating_mode,
14784      {"Operating mode of BSS", "wlan_mgt.ht.info.operatingmode",
14785       FT_UINT16, BASE_HEX, VALS (&ht_info_operating_mode_flags), 0x0003, NULL, HFILL }},
14786
14787     {&hf_ieee80211_ht_info_non_greenfield_sta_present,
14788      {"Non-greenfield STAs present", "wlan_mgt.ht.info.greenfield",
14789       FT_BOOLEAN, 16, TFS (&ht_info_non_greenfield_sta_present_flag), 0x0004, NULL, HFILL }},
14790
14791     {&hf_ieee80211_ht_info_transmit_burst_limit,
14792      {"Transmit burst limit", "wlan_mgt.ht.info.burstlim",
14793       FT_BOOLEAN, 16, TFS (&ht_info_transmit_burst_limit_flag), 0x0008, NULL, HFILL }},
14794
14795     {&hf_ieee80211_ht_info_obss_non_ht_stas_present,
14796      {"OBSS non-HT STAs present", "wlan_mgt.ht.info.obssnonht",
14797       FT_BOOLEAN, 16, TFS (&ht_info_obss_non_ht_stas_present_flag), 0x0010, NULL, HFILL }},
14798
14799     {&hf_ieee80211_ht_info_reserved_1,
14800      {"Reserved", "wlan_mgt.ht.info.reserved1",
14801       FT_UINT16, BASE_HEX, NULL, 0xffe0, NULL, HFILL }},
14802
14803     {&hf_ieee80211_ht_info_delimiter3,
14804      {"HT Information Subset (3 of 3)", "wlan_mgt.ht.info.delim3",
14805       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
14806
14807     {&hf_ieee80211_ht_info_reserved_2,
14808      {"Reserved", "wlan_mgt.ht.info.reserved2",
14809       FT_UINT16, BASE_HEX, NULL, 0x003f, NULL, HFILL }},
14810
14811     {&hf_ieee80211_ht_info_dual_beacon,
14812      {"Dual beacon", "wlan_mgt.ht.info.dualbeacon",
14813       FT_BOOLEAN, 16, TFS (&ht_info_dual_beacon_flag), 0x0040, NULL, HFILL }},
14814
14815     {&hf_ieee80211_ht_info_dual_cts_protection,
14816      {"Dual Clear To Send (CTS) protection", "wlan_mgt.ht.info.dualcts",
14817       FT_BOOLEAN, 16, TFS (&ht_info_dual_cts_protection_flag), 0x0080, NULL, HFILL }},
14818
14819     {&hf_ieee80211_ht_info_secondary_beacon,
14820      {"Beacon ID", "wlan_mgt.ht.info.secondarybeacon",
14821       FT_BOOLEAN, 16, TFS (&ht_info_secondary_beacon_flag), 0x0100, NULL, HFILL }},
14822
14823     {&hf_ieee80211_ht_info_lsig_txop_protection_full_support,
14824      {"L-SIG TXOP Protection Full Support", "wlan_mgt.ht.info.lsigprotsupport",
14825       FT_BOOLEAN, 16, TFS (&ht_info_lsig_txop_protection_full_support_flag), 0x0200, NULL, HFILL }},
14826
14827     {&hf_ieee80211_ht_info_pco_active,
14828      {"Phased Coexistence Operation (PCO)", "wlan_mgt.ht.info.pco.active",
14829       FT_BOOLEAN, 16, TFS (&tfs_active_inactive), 0x0400, NULL, HFILL }},
14830
14831     {&hf_ieee80211_ht_info_pco_phase,
14832      {"Phased Coexistence Operation (PCO) Phase", "wlan_mgt.ht.info.pco.phase",
14833       FT_BOOLEAN, 16, TFS (&ht_info_pco_phase_flag), 0x0800, NULL, HFILL }},
14834
14835     {&hf_ieee80211_ht_info_reserved_3,
14836      {"Reserved", "wlan_mgt.ht.info.reserved3",
14837       FT_UINT16, BASE_HEX, NULL, 0xf000, NULL, HFILL }},
14838
14839     {&hf_ieee80211_tag_ap_channel_report_regulatory_class,
14840      {"Regulatory Class", "wlan_mgt.ap_channel_report.regulatory_class",
14841       FT_UINT8, BASE_DEC, NULL, 0,
14842       NULL, HFILL }},
14843
14844     {&hf_ieee80211_tag_ap_channel_report_channel_list,
14845      {"Channel List", "wlan_mgt.ap_channel_report.channel_list",
14846       FT_UINT8, BASE_DEC, NULL, 0,
14847       NULL, HFILL }},
14848
14849     {&hf_ieee80211_tag_secondary_channel_offset,
14850      {"Secondary Channel Offset", "wlan_mgt.secchanoffset",
14851       FT_UINT8, BASE_HEX, VALS (&ieee80211_tag_secondary_channel_offset_flags), 0,
14852       NULL, HFILL }},
14853
14854     {&hf_ieee80211_tag_power_constraint_local,
14855      {"Local Power Constraint", "wlan_mgt.powercon.local",
14856       FT_UINT8, BASE_HEX, NULL, 0,
14857       "Value that allows the mitigation requirements to be satisfied in the current channel", HFILL }},
14858
14859     {&hf_ieee80211_tag_power_capability_min,
14860      {"Minimum Transmit Power", "wlan_mgt.powercap.min",
14861       FT_UINT8, BASE_HEX, NULL, 0,
14862       "The nominal minimum transmit power with which the STA is capable of transmitting in the current channel", HFILL }},
14863
14864     {&hf_ieee80211_tag_power_capability_max,
14865      {"Maximum Transmit Power", "wlan_mgt.powercap.max",
14866       FT_UINT8, BASE_HEX, NULL, 0,
14867       "The nominal maximum transmit power with which the STA is capable of transmitting in the current channel", HFILL }},
14868
14869     {&hf_ieee80211_tag_tpc_report_trsmt_pow,
14870      {"Transmit Power", "wlan_mgt.tcprep.trsmt_pow",
14871       FT_INT8, BASE_DEC, NULL, 0,
14872       NULL, HFILL }},
14873
14874     {&hf_ieee80211_tag_tpc_report_link_mrg,
14875      {"Link Margin", "wlan_mgt.tcprep.link_mrg",
14876       FT_INT8, BASE_DEC, NULL, 0,
14877       NULL, HFILL }},
14878
14879     {&hf_ieee80211_tag_supported_channels,
14880      {"Supported Channels Set", "wlan_mgt.supchan",
14881       FT_NONE, BASE_NONE, NULL, 0,
14882       NULL, HFILL }},
14883
14884     {&hf_ieee80211_tag_supported_channels_first,
14885      {"First Supported Channel", "wlan_mgt.supchan.first",
14886       FT_UINT8, BASE_DEC, NULL, 0,
14887       NULL, HFILL }},
14888
14889     {&hf_ieee80211_tag_supported_channels_range,
14890      {"Supported Channel Range", "wlan_mgt.supchan.range",
14891       FT_UINT8, BASE_DEC, NULL, 0,
14892       NULL, HFILL }},
14893
14894     {&hf_ieee80211_csa_channel_switch_mode,
14895      {"Channel Switch Mode", "wlan_mgt.csa.channel_switch_mode",
14896       FT_UINT8, BASE_HEX, NULL, 0,
14897       "Indicates any restrictions on transmission until a channel switch", HFILL }},
14898
14899     {&hf_ieee80211_csa_new_channel_number,
14900      {"New Channel Number", "wlan_mgt.csa.new_channel_number",
14901       FT_UINT8, BASE_HEX, NULL, 0,
14902       "Set to the number of the channel to which the STA is moving", HFILL }},
14903
14904     {&hf_ieee80211_csa_channel_switch_count,
14905      {"Channel Switch Count", "wlan_mgt.csa.channel_switch_count",
14906       FT_UINT8, BASE_DEC, NULL, 0,
14907       "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 }},
14908
14909     {&hf_ieee80211_tag_measure_request_token,
14910      {"Measurement Token", "wlan_mgt.measure.req.token",
14911       FT_UINT8, BASE_HEX, NULL, 0xff, NULL, HFILL }},
14912
14913     {&hf_ieee80211_tag_measure_request_mode,
14914      {"Measurement Request Mode", "wlan_mgt.measure.req.mode",
14915       FT_UINT8, BASE_HEX, NULL, 0xff, NULL, HFILL }},
14916
14917     {&hf_ieee80211_tag_measure_request_mode_parallel,
14918      {"Parallel", "wlan_mgt.measure.req.reqmode.parallel",
14919       FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
14920
14921     {&hf_ieee80211_tag_measure_request_mode_enable,
14922      {"Measurement Request Mode Field", "wlan_mgt.measure.req.reqmode.enable",
14923       FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x02, NULL, HFILL }},
14924
14925     {&hf_ieee80211_tag_measure_request_mode_request,
14926      {"Measurement Reports", "wlan_mgt.measure.req.reqmode.request",
14927       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x04, NULL, HFILL }},
14928
14929     {&hf_ieee80211_tag_measure_request_mode_report,
14930      {"Autonomous Measurement Reports", "wlan_mgt.measure.req.reqmode.report",
14931       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x08, NULL, HFILL }},
14932
14933     {&hf_ieee80211_tag_measure_request_mode_duration_mandatory,
14934      {"Duration Mandatory", "wlan_mgt.measure.req.reqmode.duration_mandatory",
14935       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x10, NULL, HFILL }},
14936
14937     {&hf_ieee80211_tag_measure_request_mode_reserved,
14938      {"Reserved", "wlan_mgt.measure.req.reqmode.reserved",
14939       FT_UINT8, BASE_HEX, NULL, 0xE0, NULL, HFILL }},
14940
14941     {&hf_ieee80211_tag_measure_request_type,
14942      {"Measurement Request Type", "wlan_mgt.measure.req.reqtype",
14943       FT_UINT8, BASE_HEX, VALS (&ieee80211_tag_measure_request_type_flags), 0x00, NULL, HFILL }},
14944
14945     {&hf_ieee80211_tag_measure_request_channel_number,
14946      {"Measurement Channel Number", "wlan_mgt.measure.req.channelnumber",
14947       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14948
14949     {&hf_ieee80211_tag_measure_request_start_time,
14950      {"Measurement Start Time", "wlan_mgt.measure.req.starttime",
14951       FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL }},
14952
14953     {&hf_ieee80211_tag_measure_request_duration,
14954      {"Measurement Duration", "wlan_mgt.measure.req.channelnumber",
14955       FT_UINT16, BASE_HEX, NULL, 0, "in TU (1 TU = 1024 us)", HFILL }},
14956
14957     {&hf_ieee80211_tag_measure_request_regulatory_class,
14958      {"Measurement Channel Number", "wlan_mgt.measure.req.regclass",
14959       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14960
14961     {&hf_ieee80211_tag_measure_request_randomization_interval,
14962      {"Randomization Interval", "wlan_mgt.measure.req.randint",
14963       FT_UINT16, BASE_HEX, NULL, 0, "in TU (1 TU = 1024 us)", HFILL }},
14964
14965     {&hf_ieee80211_tag_measure_request_measurement_mode,
14966      {"Measurement Mode", "wlan_mgt.measure.req.measurementmode",
14967       FT_UINT8, BASE_HEX, VALS(ieee80211_tag_measure_request_measurement_mode_flags), 0, NULL, HFILL }},
14968
14969     {&hf_ieee80211_tag_measure_request_bssid,
14970      {"BSSID", "wlan_mgt.measure.req.bssid",
14971       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
14972
14973     {&hf_ieee80211_tag_measure_request_subelement_length,
14974      {"Length", "wlan_mgt.measure.req.sub.length",
14975       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
14976
14977     {&hf_ieee80211_tag_measure_request_beacon_sub_id,
14978      {"SubElement ID", "wlan_mgt.measure.req.beacon.sub.id",
14979       FT_UINT8, BASE_DEC, VALS(ieee80211_tag_measure_request_beacon_sub_id_flags), 0, NULL, HFILL }},
14980
14981     {&hf_ieee80211_tag_measure_request_beacon_sub_ssid,
14982      {"SSID", "wlan_mgt.measure.req.beacon.sub.ssid",
14983       FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
14984
14985     {&hf_ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition,
14986      {"Reporting Condition", "wlan_mgt.measure.req.beacon.sub.bri.repcond",
14987       FT_UINT8, BASE_HEX, VALS(ieee80211_tag_measure_request_beacon_sub_bri_reporting_condition_flags), 0, NULL, HFILL }},
14988
14989     {&hf_ieee80211_tag_measure_request_beacon_sub_bri_threshold_offset,
14990      {"Threshold/Offset", "wlan_mgt.measure.req.beacon.sub.bri.threshold_offset",
14991       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
14992
14993     {&hf_ieee80211_tag_measure_request_beacon_sub_reporting_detail,
14994      {"Reporting Detail", "wlan_mgt.measure.req.beacon.sub.bri.reporting_detail",
14995       FT_UINT8, BASE_HEX, VALS(ieee80211_tag_measure_request_beacon_sub_reporting_detail_flags), 0, NULL, HFILL }},
14996
14997     {&hf_ieee80211_tag_measure_request_beacon_sub_request,
14998      {"Request", "wlan_mgt.measure.req.beacon.sub.request",
14999       FT_UINT8, BASE_DEC, 0, 0, NULL, HFILL }},
15000
15001     {&hf_ieee80211_tag_measure_request_beacon_unknown,
15002      {"Unknown Data", "wlan_mgt.measure.req.beacon.unknown",
15003       FT_BYTES, BASE_NONE, NULL, 0, "(not interpreted)", HFILL }},
15004
15005     {&hf_ieee80211_tag_measure_request_frame_request_type,
15006      {"Frame Request Type", "wlan_mgt.measure.req.frame_request_type",
15007       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15008
15009     {&hf_ieee80211_tag_measure_request_mac_address,
15010      {"MAC Address", "wlan_mgt.measure.req.mac_address",
15011       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
15012
15013     {&hf_ieee80211_tag_measure_request_peer_mac_address,
15014      {"Peer MAC Address", "wlan_mgt.measure.req.peer_mac_address",
15015       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
15016
15017     {&hf_ieee80211_tag_measure_request_group_id,
15018      {"Group ID", "wlan_mgt.measure.req.groupid",
15019       FT_UINT8, BASE_HEX, VALS(ieee80211_tag_measure_request_group_id_flags), 0, NULL, HFILL }},
15020
15021     {&hf_ieee80211_tag_measure_report_measurement_token,
15022      {"Measurement Token", "wlan_mgt.measure.req.token",
15023       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15024
15025     {&hf_ieee80211_tag_measure_report_mode,
15026      {"Measurement Report Mode", "wlan_mgt.measure.req.mode",
15027       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15028
15029     {&hf_ieee80211_tag_measure_report_mode_late,
15030      {"Measurement Report Mode Field", "wlan_mgt.measure.rep.repmode.late",
15031       FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x01, NULL, HFILL }},
15032
15033     {&hf_ieee80211_tag_measure_report_mode_incapable,
15034      {"Measurement Reports", "wlan_mgt.measure.rep.repmode.incapable",
15035       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x02, NULL, HFILL }},
15036
15037     {&hf_ieee80211_tag_measure_report_mode_refused,
15038      {"Autonomous Measurement Reports", "wlan_mgt.measure.rep.repmode.refused",
15039       FT_BOOLEAN, 8, TFS (&tfs_accepted_not_accepted), 0x04, NULL, HFILL }},
15040
15041     {&hf_ieee80211_tag_measure_report_mode_reserved,
15042      {"Reserved", "wlan_mgt.measure.rep.repmode.reserved",
15043       FT_UINT8, BASE_HEX, NULL, 0xf8, NULL, HFILL }},
15044
15045     {&hf_ieee80211_tag_measure_report_type,
15046      {"Measurement Report Type", "wlan_mgt.measure.rep.reptype",
15047       FT_UINT8, BASE_HEX, VALS (&ieee80211_tag_measure_report_type_flags), 0x00, NULL, HFILL }},
15048
15049     {&hf_ieee80211_tag_measure_report_channel_number,
15050      {"Measurement Channel Number", "wlan_mgt.measure.rep.channelnumber",
15051       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15052
15053     {&hf_ieee80211_tag_measure_report_start_time,
15054      {"Measurement Start Time", "wlan_mgt.measure.rep.starttime",
15055       FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL }},
15056
15057     {&hf_ieee80211_tag_measure_report_duration,
15058      {"Measurement Duration", "wlan_mgt.measure.rep.channelnumber",
15059       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
15060
15061     {&hf_ieee80211_tag_measure_cca_busy_fraction,
15062      {"CCA Busy Fraction", "wlan_mgt.measure.rep.ccabusy",
15063       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15064
15065     {&hf_ieee80211_tag_measure_basic_map_field,
15066      {"Map Field", "wlan_mgt.measure.rep.mapfield",
15067       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15068
15069     {&hf_ieee80211_tag_measure_map_field_bss,
15070      {"BSS", "wlan_mgt.measure.rep.repmode.mapfield.bss",
15071       FT_BOOLEAN, 8, TFS (&ieee80211_tag_measure_map_field_bss_flag), 0x01, NULL, HFILL }},
15072
15073     {&hf_ieee80211_tag_measure_map_field_odfm,
15074      {"Orthogonal Frequency Division Multiplexing (ODFM) Preamble", "wlan_mgt.measure.rep.repmode.mapfield.bss",
15075       FT_BOOLEAN, 8, TFS (&tfs_detected_not_detected), 0x02, NULL, HFILL }},
15076
15077     {&hf_ieee80211_tag_measure_map_field_unident_signal,
15078      {"Unidentified Signal", "wlan_mgt.measure.rep.repmode.mapfield.unidentsig",
15079       FT_BOOLEAN, 8, TFS (&tfs_detected_not_detected), 0x04, NULL, HFILL }},
15080
15081     {&hf_ieee80211_tag_measure_map_field_radar,
15082      {"Radar", "wlan_mgt.measure.rep.repmode.mapfield.radar",
15083       FT_BOOLEAN, 8, TFS (&tfs_detected_not_detected), 0x08, NULL, HFILL }},
15084
15085     {&hf_ieee80211_tag_measure_map_field_unmeasured,
15086      {"Unmeasured", "wlan_mgt.measure.rep.repmode.mapfield.unmeasured",
15087       FT_BOOLEAN, 8, TFS (&tfs_true_false), 0x10, NULL, HFILL }},
15088
15089     {&hf_ieee80211_tag_measure_map_field_reserved,
15090      {"Reserved", "wlan_mgt.measure.rep.repmode.mapfield.reserved",
15091       FT_UINT8, BASE_HEX, NULL, 0xe0, NULL, HFILL }},
15092
15093     {&hf_ieee80211_tag_measure_rpi_histogram_report,
15094      {"Receive Power Indicator (RPI) Histogram Report", "wlan_mgt.measure.rep.rpi.histogram_report",
15095       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
15096
15097     {&hf_ieee80211_tag_measure_rpi_histogram_report_0,
15098      {"RPI 0 Density", "wlan_mgt.measure.rep.rpi.rpi0density",
15099       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 0 Density", HFILL }},
15100
15101     {&hf_ieee80211_tag_measure_rpi_histogram_report_1,
15102      {"RPI 1 Density", "wlan_mgt.measure.rep.rpi.rpi1density",
15103       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 1 Density", HFILL }},
15104
15105     {&hf_ieee80211_tag_measure_rpi_histogram_report_2,
15106      {"RPI 2 Density", "wlan_mgt.measure.rep.rpi.rpi2density",
15107       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 2 Density", HFILL }},
15108
15109     {&hf_ieee80211_tag_measure_rpi_histogram_report_3,
15110      {"RPI 3 Density", "wlan_mgt.measure.rep.rpi.rpi3density",
15111       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 3 Density", HFILL }},
15112
15113     {&hf_ieee80211_tag_measure_rpi_histogram_report_4,
15114      {"RPI 4 Density", "wlan_mgt.measure.rep.rpi.rpi4density",
15115       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 4 Density", HFILL }},
15116
15117     {&hf_ieee80211_tag_measure_rpi_histogram_report_5,
15118      {"RPI 5 Density", "wlan_mgt.measure.rep.rpi.rpi5density",
15119       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 5 Density", HFILL }},
15120
15121     {&hf_ieee80211_tag_measure_rpi_histogram_report_6,
15122      {"RPI 6 Density", "wlan_mgt.measure.rep.rpi.rpi6density",
15123       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 6 Density", HFILL }},
15124
15125     {&hf_ieee80211_tag_measure_rpi_histogram_report_7,
15126      {"RPI 7 Density", "wlan_mgt.measure.rep.rpi.rpi7density",
15127       FT_UINT8, BASE_HEX, NULL, 0, "Receive Power Indicator (RPI) 7 Density", HFILL }},
15128
15129     {&hf_ieee80211_tag_measure_report_regulatory_class,
15130      {"Regulatory Class", "wlan_mgt.measure.rep.regclass",
15131       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15132
15133     {&hf_ieee80211_tag_measure_report_channel_load,
15134      {"Channel Load", "wlan_mgt.measure.rep.chanload",
15135       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15136
15137     {&hf_ieee80211_tag_measure_report_frame_info,
15138      {"Reported Frame Information", "wlan_mgt.measure.rep.frameinfo",
15139       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15140
15141     {&hf_ieee80211_tag_measure_report_frame_info_phy_type,
15142      {"Condensed PHY", "wlan_mgt.measure.rep.frameinfo.phytype",
15143       FT_UINT8, BASE_HEX, NULL, 0x7F, NULL, HFILL }},
15144
15145     {&hf_ieee80211_tag_measure_report_frame_info_frame_type,
15146      {"Reported Frame Type", "wlan_mgt.measure.rep.frameinfo.frametype",
15147       FT_BOOLEAN, 8, TFS(&ieee80211_tag_measure_report_frame_info_frame_type_flag), 0x80, NULL, HFILL }},
15148
15149     {&hf_ieee80211_tag_measure_report_rcpi,
15150      {"Received Channel Power Indicator (RCPI)", "wlan_mgt.measure.rep.rcpi",
15151       FT_UINT8, BASE_HEX, NULL, 0, "in dBm", HFILL }},
15152
15153     {&hf_ieee80211_tag_measure_report_rsni,
15154      {"Received Signal to Noise Indicator (RSNI)", "wlan_mgt.measure.rep.rsni",
15155       FT_UINT8, BASE_HEX, NULL, 0, "in dB", HFILL }},
15156
15157     {&hf_ieee80211_tag_measure_report_bssid,
15158      {"BSSID Being Reported", "wlan_mgt.measure.rep.bssid",
15159       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
15160
15161     {&hf_ieee80211_tag_measure_report_ant_id,
15162      {"Antenna ID", "wlan_mgt.measure.rep.antid",
15163       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15164
15165     {&hf_ieee80211_tag_measure_report_anpi,
15166      {"ANPI", "wlan_mgt.measure.rep.anpi",
15167       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15168
15169     {&hf_ieee80211_tag_measure_report_ipi_density_0,
15170      {"IPI Density 0", "wlan_mgt.measure.rep.ipi_density0",
15171       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15172
15173     {&hf_ieee80211_tag_measure_report_ipi_density_1,
15174      {"IPI Density 1", "wlan_mgt.measure.rep.ipi_density1",
15175       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15176
15177     {&hf_ieee80211_tag_measure_report_ipi_density_2,
15178      {"IPI Density 2", "wlan_mgt.measure.rep.ipi_density2",
15179       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15180
15181     {&hf_ieee80211_tag_measure_report_ipi_density_3,
15182      {"IPI Density 3", "wlan_mgt.measure.rep.ipi_density3",
15183       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15184
15185     {&hf_ieee80211_tag_measure_report_ipi_density_4,
15186      {"IPI Density 4", "wlan_mgt.measure.rep.ipi_density4",
15187       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15188
15189     {&hf_ieee80211_tag_measure_report_ipi_density_5,
15190      {"IPI Density 5", "wlan_mgt.measure.rep.ipi_density5",
15191       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15192
15193     {&hf_ieee80211_tag_measure_report_ipi_density_6,
15194      {"IPI Density 6", "wlan_mgt.measure.rep.ipi_density6",
15195       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15196
15197     {&hf_ieee80211_tag_measure_report_ipi_density_7,
15198      {"IPI Density 7", "wlan_mgt.measure.rep.ipi_density7",
15199       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15200
15201      {&hf_ieee80211_tag_measure_report_ipi_density_8,
15202      {"IPI Density 8", "wlan_mgt.measure.rep.ipi_density8",
15203       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15204
15205     {&hf_ieee80211_tag_measure_report_ipi_density_9,
15206      {"IPI Density 9", "wlan_mgt.measure.rep.ipi_density9",
15207       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15208
15209     {&hf_ieee80211_tag_measure_report_ipi_density_10,
15210      {"IPI Density 10", "wlan_mgt.measure.rep.ipi_density10",
15211       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15212
15213     {&hf_ieee80211_tag_measure_report_parent_tsf,
15214      {"Parent Timing Synchronization Function (TSF)", "wlan_mgt.measure.rep.parenttsf",
15215       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
15216
15217     {&hf_ieee80211_tag_quiet_count,
15218      {"Count", "wlan_mgt.quiet.count",
15219       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 }},
15220
15221     {&hf_ieee80211_tag_quiet_period,
15222      {"Period", "wlan_mgt.quiet.period",
15223       FT_UINT8, BASE_DEC, NULL, 0, "Set to the number of beacon intervals between the start of regularly scheduled quiet intervals", HFILL }},
15224
15225     {&hf_ieee80211_tag_quiet_duration,
15226      {"Duration", "wlan_mgt.quiet.duration",
15227       FT_UINT16, BASE_DEC, NULL, 0, "Set to the duration of the quiet interval", HFILL }},
15228
15229     {&hf_ieee80211_tag_quiet_offset,
15230      {"Offset", "wlan_mgt.quiet.offset",
15231       FT_UINT16, BASE_DEC, NULL, 0, "Set to the offset of the start of the quiet interval from the TBTT", HFILL }},
15232
15233     {&hf_ieee80211_tag_dfs_owner,
15234      {"Owner", "wlan_mgt.dfs.owner",
15235       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  }},
15236
15237     {&hf_ieee80211_tag_dfs_recovery_interval,
15238      {"Recovery Interval", "wlan_mgt.dfs.recovery_interval",
15239       FT_UINT8, BASE_DEC, NULL, 0, "Indicates the time interval that shall be used for DFS owner recovery", HFILL  }},
15240
15241     {&hf_ieee80211_tag_dfs_channel_map,
15242      {"Channel Map", "wlan_mgt.dfs.channel_map",
15243       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL  }},
15244
15245     {&hf_ieee80211_tag_dfs_channel_number,
15246      {"Channel Number", "wlan_mgt.dfs.channel_number",
15247       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL  }},
15248
15249     {&hf_ieee80211_tag_dfs_map,
15250      {"Map", "wlan_mgt.dfs.map",
15251       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL  }},
15252
15253     {&hf_ieee80211_tag_erp_info,
15254      {"ERP Information", "wlan_mgt.erp_info",
15255       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL  }},
15256
15257     {&hf_ieee80211_tag_erp_info_erp_present,
15258      {"Non ERP Present", "wlan_mgt.erp_info.erp_present",
15259       FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01, NULL, HFILL  }},
15260
15261     {&hf_ieee80211_tag_erp_info_use_protection,
15262      {"Use Protection", "wlan_mgt.erp_info.use_protection",
15263       FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02, NULL, HFILL  }},
15264
15265     {&hf_ieee80211_tag_erp_info_barker_preamble_mode,
15266      {"Barker Preamble Mode", "wlan_mgt.erp_info.barker_preamble_mode",
15267       FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x04, NULL, HFILL  }},
15268
15269     {&hf_ieee80211_tag_erp_info_reserved,
15270      {"Reserved", "wlan_mgt.erp_info.reserved",
15271       FT_UINT8, BASE_HEX, NULL, 0xF8, NULL, HFILL  }},
15272
15273     /* Table 7-35a-Capabilities field */
15274     {&hf_ieee80211_tag_extended_capabilities,
15275      {"Extended Capabilities", "wlan_mgt.extcap",
15276       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15277
15278     /* P802.11n/D6.0 */
15279     /* Extended Capability octet 0 */
15280     {&hf_ieee80211_tag_extended_capabilities_b0,
15281      {"20/40 BSS Coexistence Management Support", "wlan_mgt.extcap.infoexchange.b0",
15282       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0001, "HT Information Exchange Support", HFILL }},
15283
15284     /* P802.11p/D4.0 */
15285     {&hf_ieee80211_tag_extended_capabilities_b1,
15286      {"On-demand beacon", "wlan_mgt.extcap.infoexchange.b1",
15287       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0002, NULL, HFILL }},
15288
15289     {&hf_ieee80211_tag_extended_capabilities_b2,
15290      {"Extended Channel Switching", "wlan_mgt.extcap.infoexchange.b2",
15291       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0004, NULL, HFILL }},
15292
15293     {&hf_ieee80211_tag_extended_capabilities_b3,
15294      {"WAVE indication", "wlan_mgt.extcap.infoexchange.b3",
15295       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0008, NULL, HFILL }},
15296     /*End: P802.11p/D4.0 */
15297
15298     {&hf_ieee80211_tag_extended_capabilities_b4,
15299      {"PSMP Capability", "wlan_mgt.extcap.infoexchange.b4",
15300       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0010, NULL, HFILL }},
15301
15302     {&hf_ieee80211_tag_extended_capabilities_b6,
15303      {"S-PSMP Support", "wlan_mgt.extcap.infoexchange.b6",
15304       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0040, NULL, HFILL }},
15305
15306     /* Extended Capability octet 3 */
15307     {&hf_ieee80211_tag_extended_capabilities_b27,
15308      {"UTC TSF Offset", "wlan_mgt.extcap.infoexchange.b27",
15309       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0008, NULL, HFILL }},
15310
15311     {&hf_ieee80211_tag_extended_capabilities_b28,
15312      {"Peer U-APSD Buffer STA Support", "wlan_mgt.extcap.infoexchange.b28",
15313       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0010, NULL, HFILL }},
15314
15315     {&hf_ieee80211_tag_extended_capabilities_b29,
15316      {"TDLS Peer PSM Support", "wlan_mgt.extcap.infoexchange.b29",
15317       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0020, NULL, HFILL }},
15318
15319     {&hf_ieee80211_tag_extended_capabilities_b30,
15320      {"TDLS channel switching", "wlan_mgt.extcap.infoexchange.b30",
15321       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0040, NULL, HFILL }},
15322
15323     {&hf_ieee80211_tag_extended_capabilities_b31,
15324      {"Interworking", "wlan_mgt.extcap.infoexchange.b31",
15325       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0080, NULL, HFILL }},
15326
15327     /* Extended Capability octet 4 */
15328     {&hf_ieee80211_tag_extended_capabilities_b32,
15329      {"QoS Map", "wlan_mgt.extcap.infoexchange.b32",
15330       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0001, NULL, HFILL }},
15331
15332     {&hf_ieee80211_tag_extended_capabilities_b33,
15333      {"EBR", "wlan_mgt.extcap.infoexchange.b33",
15334       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0002, NULL, HFILL }},
15335
15336     {&hf_ieee80211_tag_extended_capabilities_b34,
15337      {"SSPN Interface", "wlan_mgt.extcap.infoexchange.b34",
15338       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0004, NULL, HFILL }},
15339
15340     {&hf_ieee80211_tag_extended_capabilities_b36,
15341      {"MSGCF Capability", "wlan_mgt.extcap.infoexchange.b36",
15342       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0010, NULL, HFILL }},
15343
15344     {&hf_ieee80211_tag_extended_capabilities_b37,
15345      {"TDLS support", "wlan_mgt.extcap.infoexchange.b37",
15346       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0020, NULL, HFILL }},
15347
15348     {&hf_ieee80211_tag_extended_capabilities_b38,
15349      {"TDLS Prohibited", "wlan_mgt.extcap.infoexchange.b38",
15350       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0040, NULL, HFILL }},
15351
15352     {&hf_ieee80211_tag_extended_capabilities_b39,
15353      {"TDLS Channel Switching Prohibited", "wlan_mgt.extcap.infoexchange.b39",
15354       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0080, NULL, HFILL }},
15355
15356     /* Extended Capability octet 5 */
15357     {&hf_ieee80211_tag_extended_capabilities_b40,
15358      {"Reject Unadmitted Frame", "wlan_mgt.extcap.infoexchange.b40",
15359       FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0001, NULL, HFILL }},
15360
15361     {&hf_ieee80211_tag_extended_capabilities_serv_int_granularity,
15362      {"Service Interval Granularity",
15363       "wlan_mgt.extcap.infoexchange.serv_int_granularity",
15364       FT_UINT8, BASE_DEC, VALS(service_interval_granularity_vals), 0x000e,
15365       NULL, HFILL }},
15366
15367     {&hf_ieee80211_tag_cisco_ccx1_unknown,
15368      {"Unknown", "wlan_mgt.cisco.ccx1.unknown",
15369       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
15370
15371     {&hf_ieee80211_tag_cisco_ccx1_name,
15372      {"Name", "wlan_mgt.cisco.ccx1.name",
15373       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
15374
15375     {&hf_ieee80211_tag_cisco_ccx1_clients,
15376      {"Clients", "wlan_mgt.cisco.ccx1.clients",
15377       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15378
15379     {&hf_ieee80211_tag_neighbor_report_bssid,
15380      {"BSSID", "wlan_mgt.nreport.bssid",
15381       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
15382
15383     {&hf_ieee80211_tag_neighbor_report_bssid_info,
15384      {"BSSID Information", "wlan_mgt.nreport.bssid.info",
15385       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
15386
15387     {&hf_ieee80211_tag_neighbor_report_bssid_info_reachability,
15388      {"AP Reachability", "wlan_mgt.nreport.bssid.info.reachability",
15389       FT_UINT16, BASE_HEX, NULL, 0x0003, NULL, HFILL }},
15390
15391     {&hf_ieee80211_tag_neighbor_report_bssid_info_security,
15392      {"Security", "wlan_mgt.nreport.bssid.info.security",
15393       FT_UINT16, BASE_HEX, NULL, 0x0004, NULL, HFILL }},
15394
15395     {&hf_ieee80211_tag_neighbor_report_bssid_info_key_scope,
15396      {"Key Scope", "wlan_mgt.nreport.bssid.info.keyscope",
15397       FT_UINT16, BASE_HEX, NULL, 0x0008, NULL, HFILL }},
15398
15399     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_spec_mng,
15400      {"Capability: Spectrum Management", "wlan_mgt.nreport.bssid.info.capability.specmngt",
15401       FT_UINT16, BASE_HEX, NULL, 0x0010, NULL, HFILL }},
15402
15403     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_qos,
15404      {"Capability: QoS", "wlan_mgt.nreport.bssid.info.capability.qos",
15405       FT_UINT16, BASE_HEX, NULL, 0x0020, NULL, HFILL }},
15406
15407     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_apsd,
15408      {"Capability: APSD", "wlan_mgt.nreport.bssid.info.capability.apsd",
15409       FT_UINT16, BASE_HEX, NULL, 0x0040, NULL, HFILL }},
15410
15411     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_radio_msnt,
15412      {"Capability: Radio Measurement", "wlan_mgt.nreport.bssid.info.capability.radiomsnt",
15413       FT_UINT16, BASE_HEX, NULL, 0x0080, NULL, HFILL }},
15414
15415     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_dback,
15416      {"Capability: Delayed Block Ack", "wlan_mgt.nreport.bssid.info.capability.dback",
15417       FT_UINT16, BASE_HEX, NULL, 0x0100, NULL, HFILL }},
15418
15419     {&hf_ieee80211_tag_neighbor_report_bssid_info_capability_iback,
15420      {"Capability: Immediate Block Ack", "wlan_mgt.nreport.bssid.info.capability.iback",
15421       FT_UINT16, BASE_HEX, NULL, 0x0200, NULL, HFILL }},
15422
15423     {&hf_ieee80211_tag_neighbor_report_bssid_info_mobility_domain,
15424      {"Mobility Domain", "wlan_mgt.nreport.bssid.info.mobilitydomain",
15425       FT_UINT16, BASE_HEX, NULL, 0x0400, NULL, HFILL }},
15426
15427     {&hf_ieee80211_tag_neighbor_report_bssid_info_high_throughput,
15428      {"High Throughput", "wlan_mgt.nreport.bssid.info.hthoughput",
15429       FT_UINT16, BASE_HEX, NULL, 0x0800, NULL, HFILL }},
15430
15431     {&hf_ieee80211_tag_neighbor_report_bssid_info_reserved,
15432      {"Reserved", "wlan_mgt.nreport.bssid.info.reserved",
15433       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
15434
15435     {&hf_ieee80211_tag_neighbor_report_reg_class,
15436      {"Regulatory Class", "wlan_mgt.nreport.regclass",
15437       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15438
15439     {&hf_ieee80211_tag_neighbor_report_channel_number,
15440      {"Channel Number", "wlan_mgt.nreport.channumber",
15441       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15442
15443     {&hf_ieee80211_tag_neighbor_report_phy_type,
15444      {"PHY Type", "wlan_mgt.nreport.phytype",
15445       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15446
15447     {&hf_ieee80211_tag_supported_reg_classes_current,
15448      {"Current Regulatory Class", "wlan_mgt.supregclass.current",
15449       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15450
15451     {&hf_ieee80211_tag_supported_reg_classes_alternate,
15452      {"Alternate Regulatory Classes", "wlan_mgt.supregclass.alt",
15453       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
15454
15455     {&hf_ieee80211_wfa_ie_type,
15456      {"Type", "wlan_mgt.wfa.ie.type",
15457       FT_UINT8, BASE_HEX, VALS(ieee802111_wfa_ie_type_vals), 0, NULL, HFILL }},
15458
15459     {&hf_ieee80211_wfa_ie_wpa_version,
15460      {"WPA Version", "wlan_mgt.wfa.ie.wpa.version",
15461       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15462
15463     {&hf_ieee80211_wfa_ie_wpa_mcs,
15464      {"Multicast Cipher Suite", "wlan_mgt.wfa.ie.wpa.mcs", FT_UINT32, BASE_CUSTOM,
15465       wpa_mcs_base_custom, 0, "Contains the cipher suite selector used by the BSS to protect broadcast/multicast traffic", HFILL }},
15466
15467     {&hf_ieee80211_wfa_ie_wpa_mcs_oui,
15468      {"Multicast Cipher Suite OUI", "wlan_mgt.wfa.ie.wpa.mcs.oui", FT_UINT24, BASE_CUSTOM,
15469       oui_base_custom, 0, NULL, HFILL }},
15470
15471     {&hf_ieee80211_wfa_ie_wpa_mcs_type,
15472      {"Multicast Cipher Suite type", "wlan_mgt.wfa.ie.wpa.mcs.type", FT_UINT8, BASE_DEC,
15473       NULL, 0, NULL, HFILL }},
15474
15475     {&hf_ieee80211_wfa_ie_wpa_mcs_wfa_type,
15476      {"Multicast Cipher Suite type", "wlan_mgt.wfa.ie.wpa.mcs.type", FT_UINT8, BASE_DEC,
15477       VALS(ieee80211_wfa_ie_wpa_cipher_vals), 0, NULL, HFILL }},
15478
15479     {&hf_ieee80211_wfa_ie_wpa_ucs_count,
15480      {"Unicast Cipher Suite Count", "wlan_mgt.wfa.ie.wpa.ucs.count", FT_UINT16, BASE_DEC,
15481       NULL, 0, "Indicates the number of pairwise cipher suite selectors that are contained in the Unicast Cipher Suite List", HFILL }},
15482
15483     {&hf_ieee80211_wfa_ie_wpa_ucs_list,
15484      {"Unicast Cipher Suite List", "wlan_mgt.wfa.ie.wpa.ucs.list", FT_NONE, BASE_NONE,
15485       NULL, 0, "Contains a series of cipher suite selectors that indicate the Unicast cipher suites", HFILL }},
15486
15487     {&hf_ieee80211_wfa_ie_wpa_ucs,
15488      {"Unicast Cipher Suite", "wlan_mgt.wfa.ie.wpa.ucs", FT_UINT32, BASE_CUSTOM,
15489       wpa_ucs_base_custom, 0, NULL, HFILL }},
15490
15491     {&hf_ieee80211_wfa_ie_wpa_ucs_oui,
15492      {"Unicast Cipher Suite OUI", "wlan_mgt.wfa.ie.wpau.cs.oui", FT_UINT24, BASE_CUSTOM,
15493       oui_base_custom, 0, NULL, HFILL }},
15494
15495     {&hf_ieee80211_wfa_ie_wpa_ucs_type,
15496      {"Unicast Cipher Suite type", "wlan_mgt.wfa.ie.wpa.ucs.type", FT_UINT8, BASE_DEC,
15497       NULL, 0, NULL, HFILL }},
15498
15499     {&hf_ieee80211_wfa_ie_wpa_ucs_wfa_type,
15500      {"Unicast Cipher Suite type", "wlan_mgt.wfa.ie.wpa.ucs.type", FT_UINT8, BASE_DEC,
15501       VALS(ieee80211_wfa_ie_wpa_cipher_vals), 0, NULL, HFILL }},
15502
15503     {&hf_ieee80211_wfa_ie_wpa_akms_count,
15504      {"Auth Key Management (AKM) Suite Count", "wlan_mgt.wfa.ie.wpa.akms.count", FT_UINT16, BASE_DEC,
15505       NULL, 0, "Indicates the number of Auth Key Management suite selectors that are contained in the Auth Key Management Suite List", HFILL }},
15506
15507     {&hf_ieee80211_wfa_ie_wpa_akms_list,
15508      {"Auth Key Management (AKM) List", "wlan_mgt.wfa.ie.wpa.akms.list", FT_NONE, BASE_NONE,
15509       NULL, 0, "Contains a series of cipher suite selectors that indicate the AKM suites", HFILL }},
15510
15511     {&hf_ieee80211_wfa_ie_wpa_akms,
15512      {"Auth Key Management (AKM) Suite", "wlan_mgt.wfa.ie.wpa.akms", FT_UINT32, BASE_CUSTOM,
15513       wpa_akms_base_custom, 0, NULL, HFILL }},
15514
15515     {&hf_ieee80211_wfa_ie_wpa_akms_oui,
15516      {"Auth Key Management (AKM) OUI", "wlan_mgt.wfa.ie.wpa.akms.oui", FT_UINT24, BASE_CUSTOM,
15517       oui_base_custom, 0, NULL, HFILL }},
15518
15519     {&hf_ieee80211_wfa_ie_wpa_akms_type,
15520      {"Auth Key Management (AKM) type", "wlan_mgt.wfa.ie.wpa.akms.type", FT_UINT8, BASE_DEC,
15521       NULL, 0, NULL, HFILL }},
15522
15523     {&hf_ieee80211_wfa_ie_wpa_akms_wfa_type,
15524      {"Auth Key Management (AKM) type", "wlan_mgt.wfa.ie.wpa.type", FT_UINT8, BASE_DEC,
15525       VALS(ieee80211_wfa_ie_wpa_keymgmt_vals), 0, NULL, HFILL }},
15526
15527     {&hf_ieee80211_wfa_ie_wme_subtype,
15528      {"WME Subtype", "wlan_mgt.wfa.ie.wme.subtype",
15529       FT_UINT8, BASE_DEC, VALS(ieee802111_wfa_ie_wme_type), 0, NULL, HFILL }},
15530
15531     {&hf_ieee80211_wfa_ie_wme_version,
15532      {"WME Version", "wlan_mgt.wfa.ie.wme.version",
15533       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15534
15535     {&hf_ieee80211_wfa_ie_wme_qos_info,
15536      {"WME QoS Info", "wlan_mgt.wfa.ie.wme.qos_info",
15537       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15538
15539     {&hf_ieee80211_wfa_ie_wme_qos_info_sta_max_sp_length,
15540      {"Max SP Length", "wlan_mgt.wfa.ie.wme.qos_info.sta.max_sp_length",
15541       FT_UINT8, BASE_HEX, VALS(ieee802111_wfa_ie_wme_qos_info_sta_max_sp_length_vals), 0x60, NULL, HFILL }},
15542
15543     {&hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_be,
15544      {"AC_BE", "wlan_mgt.wfa.ie.wme.qos_info.sta.ac_be",
15545       FT_BOOLEAN, 8, TFS(&ieee802111_wfa_ie_wme_qos_info_sta_ac_tfs), 0x08, NULL, HFILL }},
15546
15547     {&hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_bk,
15548      {"AC_BK", "wlan_mgt.wfa.ie.wme.qos_info.sta.ac_bk",
15549       FT_BOOLEAN, 8, TFS(&ieee802111_wfa_ie_wme_qos_info_sta_ac_tfs), 0x04, NULL, HFILL }},
15550
15551     {&hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vi,
15552      {"AC_VI", "wlan_mgt.wfa.ie.wme.qos_info.sta.ac_vi",
15553       FT_BOOLEAN, 8, TFS(&ieee802111_wfa_ie_wme_qos_info_sta_ac_tfs), 0x02, NULL, HFILL }},
15554
15555     {&hf_ieee80211_wfa_ie_wme_qos_info_sta_ac_vo,
15556      {"AC_VO", "wlan_mgt.wfa.ie.wme.qos_info.sta.ac_vo",
15557       FT_BOOLEAN, 8, TFS(&ieee802111_wfa_ie_wme_qos_info_sta_ac_tfs), 0x01, NULL, HFILL }},
15558
15559     {&hf_ieee80211_wfa_ie_wme_qos_info_sta_reserved,
15560      {"Reserved", "wlan_mgt.wfa.ie.wme.qos_info.sta.reserved",
15561       FT_UINT8, BASE_HEX, NULL, 0x90, "Must Be Zero", HFILL }},
15562
15563     {&hf_ieee80211_wfa_ie_wme_qos_info_ap_u_apsd,
15564      {"U-APSD", "wlan_mgt.wfa.ie.wme.qos_info.ap.u_apsd",
15565       FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x80, "Indicates the WMM AP is currently supporting unscheduled automatic power save delivery", HFILL }},
15566
15567     {&hf_ieee80211_wfa_ie_wme_qos_info_ap_parameter_set_count,
15568      {"Parameter Set Count", "wlan_mgt.wfa.ie.wme.qos_info.ap.parameter_set_count",
15569       FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL }},
15570
15571     {&hf_ieee80211_wfa_ie_wme_qos_info_ap_reserved,
15572      {"Reserved", "wlan_mgt.wfa.ie.wme.qos_info.ap.reserved",
15573       FT_UINT8, BASE_HEX, NULL, 0x70, "Must Be Zero", HFILL }},
15574
15575     {&hf_ieee80211_wfa_ie_wme_reserved,
15576      {"Reserved", "wlan_mgt.wfa.ie.wme.reserved",
15577       FT_BYTES, BASE_NONE, NULL, 0, "Must Be Zero", HFILL }},
15578
15579     {&hf_ieee80211_wfa_ie_wme_ac_parameters,
15580      {"Ac Parameters", "wlan_mgt.wfa.ie.wme.acp",
15581       FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
15582
15583     {&hf_ieee80211_wfa_ie_wme_acp_aci_aifsn,
15584      {"ACI / AIFSN Field", "wlan_mgt.wfa.ie.wme.acp.aci_aifsn",
15585       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15586
15587     {&hf_ieee80211_wfa_ie_wme_acp_aci,
15588      {"ACI", "wlan_mgt.wfa.ie.wme.acp.aci",
15589       FT_UINT8, BASE_DEC, VALS(ieee80211_wfa_ie_wme_acs_vals), 0x60, NULL, HFILL }},
15590
15591     {&hf_ieee80211_wfa_ie_wme_acp_acm,
15592      {"Admission Control Mandatory", "wlan_mgt.wfa.ie.wme.acp.aci",
15593       FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
15594
15595     {&hf_ieee80211_wfa_ie_wme_acp_aifsn,
15596      {"AIFSN", "wlan_mgt.wfa.ie.wme.acp.aifsn",
15597       FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
15598
15599     {&hf_ieee80211_wfa_ie_wme_acp_reserved,
15600      {"Reserved", "wlan_mgt.wfa.ie.wme.acp.reserved",
15601       FT_UINT8, BASE_DEC, NULL, 0x80, "Must be Zero", HFILL }},
15602
15603     {&hf_ieee80211_wfa_ie_wme_acp_ecw,
15604      {"ECW", "wlan_mgt.wfa.ie.wme.acp.ecw",
15605       FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL }},
15606
15607     {&hf_ieee80211_wfa_ie_wme_acp_ecw_max,
15608      {"ECW Max", "wlan_mgt.wfa.ie.wme.acp.ecw.max",
15609       FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL }},
15610
15611     {&hf_ieee80211_wfa_ie_wme_acp_ecw_min,
15612      {"ECW Min", "wlan_mgt.wfa.ie.wme.acp.ecw.min",
15613       FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
15614
15615     {&hf_ieee80211_wfa_ie_wme_acp_txop_limit,
15616      {"TXOP Limit", "wlan_mgt.wfa.ie.wme.acp.txop_limit",
15617       FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }},
15618
15619     {&hf_ieee80211_wfa_ie_wme_tspec_tsinfo,
15620      {"TS Info", "wlan_mgt.wfa.ie.wme.tspec.ts_info",
15621       FT_UINT24, BASE_HEX, NULL, 0, "Traffic Stream (TS) Info", HFILL }},
15622
15623     {&hf_ieee80211_wfa_ie_wme_tspec_tsinfo_tid,
15624      {"TID", "wlan_mgt.wfa.ie.wme.tspec.ts_info.tid",
15625       FT_UINT24, BASE_DEC, NULL, 0x00001E, "Traffic Stream Info ID (TID)", HFILL }},
15626
15627     {&hf_ieee80211_wfa_ie_wme_tspec_tsinfo_direction,
15628      {"Direction", "wlan_mgt.wfa.ie.wme.tspec.ts_info.dir", FT_UINT24, BASE_DEC,
15629       VALS (&ieee80211_wfa_ie_wme_tspec_tsinfo_direction_vals), 0x000060, "Traffic Stream (TS) Info Direction", HFILL }},
15630
15631     {&hf_ieee80211_wfa_ie_wme_tspec_tsinfo_psb,
15632      {"PSB", "wlan_mgt.wfa.ie.wme.tspec.ts_info.psb", FT_UINT24, BASE_DEC,
15633       VALS (&ieee80211_wfa_ie_wme_tspec_tsinfo_psb_vals), 0x000400, "Traffic Stream (TS) Info Power Save Behavior (PSB)", HFILL }},
15634
15635     {&hf_ieee80211_wfa_ie_wme_tspec_tsinfo_up,
15636      {"UP", "wlan_mgt.wfa.ie.wme.tspec.ts_info.up", FT_UINT24, BASE_DEC,
15637       VALS (&ieee80211_wfa_ie_wme_tspec_tsinfo_up_vals), 0x003800, "Traffic Stream (TS) Info User Priority (UP)", HFILL }},
15638
15639     {&hf_ieee80211_wfa_ie_wme_tspec_tsinfo_reserved,
15640      {"Reserved", "wlan_mgt.wfa.ie.wme.tspec.ts_info.reserved", FT_UINT24, BASE_HEX,
15641       NULL, 0xFFC381, "Must be Zero", HFILL }},
15642
15643     {&hf_ieee80211_wfa_ie_wme_tspec_nor_msdu,
15644      {"Normal MSDU Size", "wlan_mgt.wfa.ie.wme.tspec.nor_msdu",
15645       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15646
15647     {&hf_ieee80211_wfa_ie_wme_tspec_max_msdu,
15648      {"Maximum MSDU Size", "wlan_mgt.wfa.ie.wme.tspec.max_msdu",
15649       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15650
15651     {&hf_ieee80211_wfa_ie_wme_tspec_min_srv,
15652      {"Minimum Service Interval", "wlan_mgt.wfa.ie.wme.tspec.min_srv",
15653       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15654
15655     {&hf_ieee80211_wfa_ie_wme_tspec_max_srv,
15656      {"Maximum Service Interval", "wlan_mgt.wfa.ie.wme.tspec.max_srv",
15657       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15658
15659     {&hf_ieee80211_wfa_ie_wme_tspec_inact_int,
15660      {"Inactivity Interval", "wlan_mgt.wfa.ie.wme.tspec.inact_int",
15661       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15662
15663     {&hf_ieee80211_wfa_ie_wme_tspec_susp_int,
15664      {"Suspension Interval", "wlan_mgt.wfa.ie.wme.tspec.susp_int",
15665       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15666
15667     {&hf_ieee80211_wfa_ie_wme_tspec_srv_start,
15668      {"Service Start Time", "wlan_mgt.wfa.ie.wme.tspec.srv_start",
15669       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15670
15671     {&hf_ieee80211_wfa_ie_wme_tspec_min_data,
15672      {"Minimum Data Rate", "wlan_mgt.wfa.ie.wme.tspec.min_data",
15673       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15674
15675     {&hf_ieee80211_wfa_ie_wme_tspec_mean_data,
15676      {"Mean Data Rate", "wlan_mgt.wfa.ie.wme.tspec.mean_data",
15677       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15678
15679     {&hf_ieee80211_wfa_ie_wme_tspec_peak_data,
15680      {"Peak Data Rate", "wlan_mgt.wfa.ie.wme.tspec.peak_data",
15681       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15682
15683     {&hf_ieee80211_wfa_ie_wme_tspec_burst_size,
15684      {"Burst Size", "wlan_mgt.wfa.ie.wme.tspec.burst_size",
15685       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15686
15687     {&hf_ieee80211_wfa_ie_wme_tspec_delay_bound,
15688      {"Delay Bound", "wlan_mgt.wfa.ie.wme.tspec.delay_bound",
15689       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15690
15691     {&hf_ieee80211_wfa_ie_wme_tspec_min_phy,
15692      {"Minimum PHY Rate", "wlan_mgt.wfa.ie.wme.tspec.min_phy",
15693       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15694
15695     {&hf_ieee80211_wfa_ie_wme_tspec_surplus,
15696      {"Surplus Bandwidth Allowance", "wlan_mgt.wfa.ie.wme.tspec.surplus",
15697       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15698
15699     {&hf_ieee80211_wfa_ie_wme_tspec_medium,
15700      {"Medium Time", "wlan_mgt.wfa.ie.wme.tspec.medium",
15701       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15702
15703     {&hf_ieee80211_marvell_ie_type,
15704      {"Type", "wlan_mgt.marvell.ie.type",
15705       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15706
15707     {&hf_ieee80211_marvell_ie_mesh_subtype,
15708      {"Subtype", "wlan_mgt.marvell.ie.subtype",
15709       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15710
15711     {&hf_ieee80211_marvell_ie_mesh_version,
15712      {"Version", "wlan_mgt.marvell.ie.version",
15713       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15714
15715     {&hf_ieee80211_marvell_ie_mesh_active_proto_id,
15716      {"Path Selection Protocol", "wlan_mgt.marvell.ie.proto_id",
15717       FT_UINT8, BASE_HEX, VALS(mesh_path_selection_codes), 0, NULL, HFILL }},
15718
15719     {&hf_ieee80211_marvell_ie_mesh_active_metric_id,
15720      {"Path Selection Metric", "wlan_mgt.marvell.ie.metric_id",
15721       FT_UINT8, BASE_HEX, VALS(mesh_metric_codes), 0, NULL, HFILL }},
15722
15723     {&hf_ieee80211_marvell_ie_mesh_cap,
15724      {"Mesh Capabilities", "wlan_mgt.marvell.ie.cap",
15725       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15726
15727     {&hf_ieee80211_marvell_ie_data,
15728       { "Marvell IE data", "wlan_mgt.marvell.data",
15729         FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
15730
15731     {&hf_ieee80211_atheros_ie_type,
15732      {"Type", "wlan_mgt.atheros.ie.type",
15733       FT_UINT8, BASE_HEX, VALS(atheros_ie_type_vals), 0, NULL, HFILL }},
15734
15735     {&hf_ieee80211_atheros_ie_subtype,
15736      {"Subtype", "wlan_mgt.atheros.ie.subtype",
15737       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15738
15739     {&hf_ieee80211_atheros_ie_version,
15740      {"Version", "wlan_mgt.atheros.ie.version",
15741       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15742
15743     {&hf_ieee80211_atheros_ie_cap_f_turbop,
15744      {"Turbo Prime", "wlan_mgt.ie.atheros.capabilities.turbop",
15745       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_TURBOP, NULL, HFILL }},
15746
15747     {&hf_ieee80211_atheros_ie_cap_f_comp,
15748      {"Compression", "wlan_mgt.ie.atheros.capabilities.comp",
15749       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_COMP, NULL, HFILL }},
15750
15751     {&hf_ieee80211_atheros_ie_cap_f_ff,
15752      {"Fast Frames", "wlan_mgt.ie.atheros.capabilities.ff",
15753       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_FF, NULL, HFILL }},
15754
15755     {&hf_ieee80211_atheros_ie_cap_f_xr,
15756      {"eXtended Range", "wlan_mgt.ie.atheros.capabilities.xr",
15757       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_XR, NULL, HFILL }},
15758
15759     {&hf_ieee80211_atheros_ie_cap_f_ar,
15760      {"Advanced Radar", "wlan_mgt.ie.atheros.capabilities.ar",
15761       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_AR, NULL, HFILL }},
15762
15763     {&hf_ieee80211_atheros_ie_cap_f_burst,
15764      {"Burst", "wlan_mgt.ie.atheros.capabilities.burst",
15765       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_BURST, NULL, HFILL }},
15766
15767     {&hf_ieee80211_atheros_ie_cap_f_wme,
15768      {"CWMin tuning", "wlan_mgt.ie.atheros.capabilities.wme",
15769       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_WME, NULL, HFILL }},
15770
15771     {&hf_ieee80211_atheros_ie_cap_f_boost,
15772      {"Boost", "wlan_mgt.ie.atheros.capabilities.boost",
15773       FT_BOOLEAN, 8, NULL, ATHEROS_IE_CAP_BOOST, NULL, HFILL }},
15774
15775     {&hf_ieee80211_atheros_ie_advcap_cap,
15776      {"Capabilities", "wlan_mgt.atheros.ie.advcap.cap",
15777       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15778
15779     {&hf_ieee80211_atheros_ie_advcap_defkey,
15780      {"Default key index", "wlan_mgt.atheros.ie.advcap.defkey",
15781       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
15782
15783     {&hf_ieee80211_atheros_ie_xr_info,
15784      {"Info", "wlan_mgt.atheros.ie.xr.info",
15785       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15786
15787     {&hf_ieee80211_atheros_ie_xr_base_bssid,
15788      {"Base BSS Id", "wlan_mgt.atheros.ie.xr.base_bssid",
15789       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
15790
15791     {&hf_ieee80211_atheros_ie_xr_xr_bssid,
15792      {"XR BSS Id", "wlan_mgt.atheros.ie.xr.xr_bssid",
15793       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
15794
15795     {&hf_ieee80211_atheros_ie_xr_xr_beacon,
15796      {"XR Beacon Interval", "wlan_mgt.atheros.ie.xr.xr_beacon",
15797       FT_UINT32, BASE_CUSTOM, beacon_interval_base_custom, 0, NULL, HFILL }},
15798
15799     {&hf_ieee80211_atheros_ie_xr_base_cap,
15800      {"Base capabilities", "wlan_mgt.atheros.ie.xr.base_cap",
15801       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15802
15803     {&hf_ieee80211_atheros_ie_xr_xr_cap,
15804      {"XR capabilities", "wlan_mgt.atheros.ie.xr.xr_cap",
15805       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15806
15807     {&hf_ieee80211_atheros_ie_data,
15808      {"Atheros IE data", "wlan_mgt.atheros.data",
15809       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
15810
15811     {&hf_ieee80211_aironet_ie_type,
15812      {"Aironet IE type", "wlan_mgt.aironet.type",
15813       FT_UINT8, BASE_DEC, VALS(aironet_ie_type_vals), 0, NULL, HFILL }},
15814
15815     {&hf_ieee80211_aironet_ie_version,
15816      {"Aironet IE CCX version?", "wlan_mgt.aironet.version",
15817       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15818
15819     {&hf_ieee80211_aironet_ie_data,
15820       { "Aironet IE data", "wlan_mgt.aironet.data",
15821         FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
15822
15823     {&hf_ieee80211_qbss_version,
15824      {"QBSS Version", "wlan_mgt.qbss.version",
15825       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15826
15827     {&hf_ieee80211_qbss_scount,
15828      {"Station Count", "wlan_mgt.qbss.scount",
15829       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15830
15831     {&hf_ieee80211_qbss_cu,
15832      {"Channel Utilization", "wlan_mgt.qbss.cu",
15833        FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15834
15835     {&hf_ieee80211_qbss_adc,
15836      {"Available Admission Capabilities", "wlan_mgt.qbss.adc",
15837      FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15838
15839     {&hf_ieee80211_qbss2_cu,
15840      {"Channel Utilization", "wlan_mgt.qbss2.cu",
15841        FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15842
15843     {&hf_ieee80211_qbss2_gl,
15844      {"G.711 CU Quantum", "wlan_mgt.qbss2.glimit",
15845       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15846
15847     {&hf_ieee80211_qbss2_cal,
15848      {"Call Admission Limit", "wlan_mgt.qbss2.cal",
15849       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15850
15851     {&hf_ieee80211_qbss2_scount,
15852      {"Station Count", "wlan_mgt.qbss2.scount",
15853       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15854
15855     {&hf_ieee80211_aironet_ie_qos_unk1,
15856      {"Aironet IE QoS unknown 1", "wlan_mgt.aironet.qos.unk1",
15857       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
15858
15859     {&hf_ieee80211_aironet_ie_qos_paramset,
15860      {"Aironet IE QoS paramset", "wlan_mgt.aironet.qos.paramset",
15861       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
15862
15863     {&hf_ieee80211_aironet_ie_qos_val,
15864      {"Aironet IE QoS valueset", "wlan_mgt.aironet.qos.val",
15865       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
15866
15867     {&hf_ieee80211_tsinfo,
15868      {"Traffic Stream (TS) Info", "wlan_mgt.ts_info",
15869       FT_UINT24, BASE_HEX, NULL, 0, "Traffic Stream (TS) Info field", HFILL }},
15870
15871     {&hf_ieee80211_tsinfo_type,
15872      {"Traffic Type", "wlan_mgt.ts_info.type", FT_UINT24, BASE_DEC,
15873       VALS (&tsinfo_type), 0x000001, "Traffic Stream (TS) Info Traffic Type", HFILL }},
15874
15875     {&hf_ieee80211_tsinfo_tsid,
15876      {"Traffic Stream ID (TSID)", "wlan_mgt.ts_info.tsid",
15877       FT_UINT24, BASE_DEC, NULL, 0x00001E, "Traffic Stream ID (TSID) Info TSID", HFILL }},
15878
15879     {&hf_ieee80211_tsinfo_dir,
15880      {"Direction", "wlan_mgt.ts_info.dir", FT_UINT24, BASE_DEC,
15881       VALS (&tsinfo_direction), 0x000060, "Traffic Stream (TS) Info Direction", HFILL }},
15882
15883     {&hf_ieee80211_tsinfo_access,
15884      {"Access Policy", "wlan_mgt.ts_info.dir", FT_UINT24, BASE_DEC,
15885       VALS (&tsinfo_access), 0x000180, "Traffic Stream (TS) Info Access Policy", HFILL }},
15886
15887     {&hf_ieee80211_tsinfo_agg,
15888      {"Aggregation", "wlan_mgt.ts_info.agg", FT_UINT24, BASE_DEC,
15889       NULL, 0x000200, "Traffic Stream (TS) Info Access Policy", HFILL }},
15890
15891     {&hf_ieee80211_tsinfo_apsd,
15892      {"Automatic Power-Save Delivery (APSD)", "wlan_mgt.ts_info.apsd", FT_UINT24, BASE_DEC,
15893       NULL, 0x000400, "Traffic Stream (TS) Info Automatic Power-Save Delivery (APSD)", HFILL }},
15894
15895     {&hf_ieee80211_tsinfo_up,
15896      {"User Priority", "wlan_mgt.ts_info.up", FT_UINT24, BASE_DEC,
15897       VALS (&qos_up), 0x003800, "Traffic Stream (TS) Info User Priority", HFILL }},
15898
15899     {&hf_ieee80211_tsinfo_ack,
15900      {"Ack Policy", "wlan_mgt.ts_info.ack", FT_UINT24, BASE_DEC,
15901       VALS (&ack_policy), 0x00C000, "Traffic Stream (TS) Info Ack Policy", HFILL }},
15902
15903     {&hf_ieee80211_tsinfo_sched,
15904      {"Schedule", "wlan_mgt.ts_info.sched", FT_UINT24, BASE_DEC,
15905       NULL, 0x010000, "Traffic Stream (TS) Info Schedule", HFILL }},
15906
15907     {&hf_ieee80211_tsinfo_rsv,
15908      {"Reserved", "wlan_mgt.ts_info.rsv", FT_UINT24, BASE_HEX,
15909       NULL, 0xFE0000, "Must be Zero", HFILL }},
15910
15911     {&hf_ieee80211_tspec_nor_msdu,
15912      {"Normal MSDU Size", "wlan_mgt.tspec.nor_msdu",
15913       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15914
15915     {&hf_ieee80211_tspec_max_msdu,
15916      {"Maximum MSDU Size", "wlan_mgt.tspec.max_msdu",
15917       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15918
15919     {&hf_ieee80211_tspec_min_srv,
15920      {"Minimum Service Interval", "wlan_mgt.tspec.min_srv",
15921       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15922
15923     {&hf_ieee80211_tspec_max_srv,
15924      {"Maximum Service Interval", "wlan_mgt.tspec.max_srv",
15925       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15926
15927     {&hf_ieee80211_tspec_inact_int,
15928      {"Inactivity Interval", "wlan_mgt.tspec.inact_int",
15929       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15930
15931     {&hf_ieee80211_tspec_susp_int,
15932      {"Suspension Interval", "wlan_mgt.tspec.susp_int",
15933       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15934
15935     {&hf_ieee80211_tspec_srv_start,
15936      {"Service Start Time", "wlan_mgt.tspec.srv_start",
15937       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15938
15939     {&hf_ieee80211_tspec_min_data,
15940      {"Minimum Data Rate", "wlan_mgt.tspec.min_data",
15941       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15942
15943     {&hf_ieee80211_tspec_mean_data,
15944      {"Mean Data Rate", "wlan_mgt.tspec.mean_data",
15945       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15946
15947     {&hf_ieee80211_tspec_peak_data,
15948      {"Peak Data Rate", "wlan_mgt.tspec.peak_data",
15949       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15950
15951     {&hf_ieee80211_tspec_burst_size,
15952      {"Burst Size", "wlan_mgt.tspec.burst_size",
15953       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15954
15955     {&hf_ieee80211_tspec_delay_bound,
15956      {"Delay Bound", "wlan_mgt.tspec.delay_bound",
15957       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15958
15959     {&hf_ieee80211_tspec_min_phy,
15960      {"Minimum PHY Rate", "wlan_mgt.tspec.min_phy",
15961       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15962
15963     {&hf_ieee80211_tspec_surplus,
15964      {"Surplus Bandwidth Allowance", "wlan_mgt.tspec.surplus",
15965       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15966
15967     {&hf_ieee80211_tspec_medium,
15968      {"Medium Time", "wlan_mgt.tspec.medium",
15969       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
15970
15971     {&hf_ieee80211_ts_delay,
15972      {"Traffic Stream (TS) Delay", "wlan_mgt.ts_delay",
15973       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
15974
15975     {&hf_ieee80211_tclas_process,
15976      {"Processing", "wlan_mgt.tclas_proc.processing", FT_UINT8, BASE_DEC,
15977       VALS(ieee80211_tclas_process_flag), 0, "TCLAS Processing", HFILL }},
15978
15979     {&hf_ieee80211_tag_qos_cap_qos_info,
15980      {"QoS Info", "wlan_mgt.tag.qos_cap.qos_info", FT_UINT8, BASE_HEX,
15981       NULL, 0, "TCLAS Processing", HFILL }},
15982
15983     {&hf_ieee80211_qos_info_field_vo_uapsd,
15984      {"AC_VO U-APSD Flag", "wlan_mgt.tag.qos_cap.qos_info.vo_uapsd",
15985        FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x01, NULL, HFILL }},
15986
15987     {&hf_ieee80211_qos_info_field_vi_uapsd,
15988      {"AC_VI U-APSD Flag", "wlan_mgt.tag.qos_cap.qos_info.vi_uapsd",
15989        FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x02, NULL, HFILL }},
15990
15991     {&hf_ieee80211_qos_info_field_bk_uapsd,
15992      {"AC_BK U-APSD Flag", "wlan_mgt.tag.qos_cap.qos_info.bk_uapsd",
15993        FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x04, NULL, HFILL }},
15994
15995     {&hf_ieee80211_qos_info_field_be_uapsd,
15996      {"AC_BE U-APSD Flag", "wlan_mgt.tag.qos_cap.qos_info.be_uapsd",
15997        FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x08, NULL, HFILL }},
15998
15999     {&hf_ieee80211_qos_info_field_qack,
16000      {"Q-ACK", "wlan_mgt.tag.qos_cap.qos_info.qack",
16001        FT_BOOLEAN, 8, TFS(&qos_info_field_qack_flags), 0x10, NULL, HFILL }},
16002
16003     {&hf_ieee80211_qos_info_field_max_sp_length,
16004      {"Max SP-Length", "wlan_mgt.tag.qos_cap.qos_info.max_sp_length",
16005        FT_UINT8, BASE_HEX, VALS(qos_info_field_max_sp_length_flags),
16006        0x60, NULL , HFILL }},
16007
16008     {&hf_ieee80211_qos_info_field_more_data_ack,
16009      {"More Data Ack", "wlan_mgt.tag.qos_cap.qos_info.more_data_ack",
16010        FT_BOOLEAN, 8, TFS(&qos_info_field_more_data_ack_flags) , 0x80, NULL, HFILL }},
16011
16012     {&hf_ieee80211_qos_info_field_edca_upd_cnt,
16013       {"EDCA Parameter Set Update Count", "wlan_mgt.tag.qos_cap.qos_info.edca_upd_cnt",
16014         FT_UINT8, BASE_DEC, NULL, 0x07, NULL, HFILL}},
16015
16016     {&hf_ieee80211_qos_info_field_queue_req,
16017       {"Queue Request", "wlan_mgt.tag.qos_cap.qos_info.queue_req",
16018         FT_BOOLEAN, 8, TFS(&qos_info_field_queue_req_flags), 0x07, NULL, HFILL}},
16019
16020     {&hf_ieee80211_qos_info_field_txop_req,
16021       {"TXOP Request", "wlan_mgt.tag.qos_cap.qos_info.txop_req",
16022         FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x40, NULL, HFILL}},
16023
16024     {&hf_ieee80211_qos_info_field_reserved,
16025       {"Reserved", "wlan_mgt.tag.qos_cap.qos_info.reserved",
16026         FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}},
16027
16028     {&hf_ieee80211_tag_ext_supp_rates,
16029      {"Extended Supported Rates", "wlan_mgt.extended_supported_rates",
16030       FT_UINT8, BASE_HEX, VALS(ieee80211_supported_rates_vals), 0x0,
16031       "In Mbit/sec, (B) for Basic Rates", HFILL }},
16032
16033     {&hf_ieee80211_sched_info,
16034      {"Schedule Info", "wlan_mgt.sched.sched_info",
16035       FT_UINT16, BASE_HEX, NULL, 0, "Schedule Info field", HFILL }},
16036
16037     {&hf_ieee80211_sched_info_agg,
16038      {"Schedule Aggregation", "wlan_mgt.sched_info.agg", FT_UINT16, BASE_DEC,
16039       NULL, 0x0001, "Traffic Stream (TS) Info Access Policy", HFILL }},
16040
16041     {&hf_ieee80211_sched_info_tsid,
16042      {"Schedule Traffic Stream ID (TSID)", "wlan_mgt.sched_info.tsid",
16043       FT_UINT16, BASE_DEC, NULL, 0x001E, "Traffic Stream ID (TSID) Info TSID", HFILL }},
16044
16045     {&hf_ieee80211_sched_info_dir,
16046      {"Schedule Direction", "wlan_mgt.sched_info.dir", FT_UINT16, BASE_DEC,
16047       VALS (&tsinfo_direction), 0x0060, "Traffic Stream (TS) Info Direction", HFILL }},
16048
16049     {&hf_ieee80211_sched_srv_start,
16050      {"Service Start Time", "wlan_mgt.sched.srv_start",
16051       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
16052
16053     {&hf_ieee80211_sched_srv_int,
16054      {"Service Interval", "wlan_mgt.sched.srv_int",
16055       FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
16056
16057     {&hf_ieee80211_sched_spec_int,
16058      {"Specification Interval", "wlan_mgt.sched.spec_int",
16059       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
16060
16061     {&hf_ieee80211_aruba,
16062      {"Aruba Type", "wlan_mgt.aruba.type",
16063       FT_UINT16, BASE_DEC, VALS(aruba_mgt_typevals), 0, "Aruba Management", HFILL }},
16064
16065     {&hf_ieee80211_aruba_hb_seq,
16066      {"Aruba Heartbeat Sequence", "wlan_mgt.aruba.heartbeat_sequence",
16067       FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
16068
16069     {&hf_ieee80211_aruba_mtu,
16070      {"Aruba MTU Size", "wlan_mgt.aruba.mtu_size",
16071       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16072
16073     /* Start: HT Control (+HTC) */
16074     {&hf_ieee80211_htc,
16075      {"HT Control (+HTC)", "wlan_mgt.htc",
16076       FT_UINT32, BASE_HEX, NULL, 0, "High Throughput Control (+HTC)", HFILL }},
16077     {&hf_ieee80211_htc_lac,
16078      {"Link Adaptation Control (LAC)", "wlan_mgt.htc.lac",
16079       FT_UINT16, BASE_HEX, NULL, 0, "High Throughput Control Link Adaptation Control (LAC)", HFILL }},
16080     {&hf_ieee80211_htc_lac_reserved,
16081      {"Reserved", "wlan_mgt.htc.lac.reserved",
16082       FT_BOOLEAN, 16, NULL, 0x0001, "High Throughput Control Link Adaptation Control Reserved", HFILL }},
16083     {&hf_ieee80211_htc_lac_trq,
16084      {"Training Request (TRQ)", "wlan_mgt.htc.lac.trq",
16085       FT_BOOLEAN, 16, TFS(&htc_lac_trq_flag), 0x0002, "High Throughput Control Link Adaptation Control Training Request (TRQ)", HFILL }},
16086     {&hf_ieee80211_htc_lac_mai_aseli,
16087      {"Antenna Selection Indication (ASELI)", "wlan_mgt.htc.lac.mai.aseli",
16088       FT_UINT16, BASE_HEX, NULL, 0x003C, "High Throughput Control Link Adaptation Control MAI Antenna Selection Indication", HFILL }},
16089     {&hf_ieee80211_htc_lac_mai_mrq,
16090      {"MCS Request (MRQ)", "wlan_mgt.htc.lac.mai.mrq",
16091       FT_BOOLEAN, 16, TFS(&htc_lac_mai_mrq_flag), 0x0004, "High Throughput Control Link Adaptation Control MAI MCS Request", HFILL }},
16092     {&hf_ieee80211_htc_lac_mai_msi,
16093      {"MCS Request Sequence Identifier (MSI)", "wlan_mgt.htc.lac.mai.msi",
16094       FT_UINT16, BASE_HEX, NULL, 0x0038, "High Throughput Control Link Adaptation Control MAI MCS Request Sequence Identifier", HFILL }},
16095     {&hf_ieee80211_htc_lac_mai_reserved,
16096      {"Reserved", "wlan_mgt.htc.lac.mai.reserved",
16097       FT_UINT16, BASE_HEX, NULL, 0x0038, "High Throughput Control Link Adaptation Control MAI Reserved", HFILL }},
16098     {&hf_ieee80211_htc_lac_mfsi,
16099      {"MCS Feedback Sequence Identifier (MFSI)", "wlan_mgt.htc.lac.mfsi",
16100       FT_UINT16, BASE_DEC, NULL, 0x01C0, "High Throughput Control Link Adaptation Control MCS Feedback Sequence Identifier (MSI)", HFILL }},
16101     {&hf_ieee80211_htc_lac_asel_command,
16102      {"Antenna Selection (ASEL) Command", "wlan_mgt.htc.lac.asel.command",
16103       FT_UINT16, BASE_HEX, VALS (&ieee80211_htc_lac_asel_command_flags), 0x0E00, "High Throughput Control Link Adaptation Control Antenna Selection (ASEL) Command", HFILL }},
16104     {&hf_ieee80211_htc_lac_asel_data,
16105      {"Antenna Selection (ASEL) Data", "wlan_mgt.htc.lac.asel.data",
16106       FT_UINT16, BASE_HEX, NULL, 0xF000, "High Throughput Control Link Adaptation Control Antenna Selection (ASEL) Data", HFILL }},
16107     {&hf_ieee80211_htc_lac_mfb,
16108      {"MCS Feedback (MFB)", "wlan_mgt.htc.lac.mfb",
16109       FT_UINT16, BASE_HEX, NULL, 0xFE00, "High Throughput Control Link Adaptation Control MCS Feedback", HFILL }},
16110     {&hf_ieee80211_htc_cal_pos,
16111      {"Calibration Position", "wlan_mgt.htc.cal.pos",
16112       FT_UINT16, BASE_DEC, VALS (&ieee80211_htc_cal_pos_flags), 0x0003, "High Throughput Control Calibration Position", HFILL }},
16113     {&hf_ieee80211_htc_cal_seq,
16114      {"Calibration Sequence Identifier", "wlan_mgt.htc.cal.seq",
16115       FT_UINT16, BASE_DEC, NULL, 0x000C, "High Throughput Control Calibration Sequence Identifier", HFILL }},
16116     {&hf_ieee80211_htc_reserved1,
16117      {"Reserved", "wlan_mgt.htc.reserved1",
16118       FT_UINT16, BASE_DEC, NULL, 0x0030, "High Throughput Control Reserved", HFILL }},
16119     {&hf_ieee80211_htc_csi_steering,
16120      {"CSI/Steering", "wlan_mgt.htc.csi_steering",
16121       FT_UINT16, BASE_DEC, VALS (&ieee80211_htc_csi_steering_flags), 0x00C0, "High Throughput Control CSI/Steering", HFILL }},
16122     {&hf_ieee80211_htc_ndp_announcement,
16123      {"NDP Announcement", "wlan_mgt.htc.ndp_announcement",
16124       FT_BOOLEAN, 16, TFS(&ieee80211_htc_ndp_announcement_flag), 0x0100, "High Throughput Control NDP Announcement", HFILL }},
16125     {&hf_ieee80211_htc_reserved2,
16126      {"Reserved", "wlan_mgt.htc.reserved2",
16127       FT_UINT16, BASE_HEX, NULL, 0x3E00, "High Throughput Control Reserved", HFILL }},
16128     {&hf_ieee80211_htc_ac_constraint,
16129      {"AC Constraint", "wlan_mgt.htc.ac_constraint",
16130       FT_BOOLEAN, 16, NULL, 0x4000, "High Throughput Control AC Constraint", HFILL }},
16131     {&hf_ieee80211_htc_rdg_more_ppdu,
16132      {"RDG/More PPDU", "wlan_mgt.htc.rdg_more_ppdu",
16133       FT_BOOLEAN, 16, NULL, 0x8000, "High Throughput Control RDG/More PPDU", HFILL }},
16134     /* End: HT Control (+HTC) */
16135
16136     /* MDIE */
16137     {&hf_ieee80211_tag_mobility_domain_mdid,
16138      {"Mobility Domain Identifier", "wlan_mgt.mobility_domain.mdid",
16139       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
16140     {&hf_ieee80211_tag_mobility_domain_ft_capab,
16141      {"FT Capability and Policy", "wlan_mgt.mobility_domain.ft_capab",
16142       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
16143     {&hf_ieee80211_tag_mobility_domain_ft_capab_ft_over_ds,
16144      {"Fast BSS Transition over DS",
16145       "wlan_mgt.mobility_domain.ft_capab.ft_over_ds",
16146       FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL }},
16147     {&hf_ieee80211_tag_mobility_domain_ft_capab_resource_req,
16148      {"Resource Request Protocol Capability",
16149       "wlan_mgt.mobility_domain.ft_capab.resource_req",
16150       FT_UINT8, BASE_HEX, NULL, 0x02, NULL, HFILL }},
16151
16152     /* FTIE */
16153     {&hf_ieee80211_tag_ft_mic_control,
16154      {"MIC Control", "wlan_mgt.ft.mic_control",
16155       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
16156     {&hf_ieee80211_tag_ft_element_count,
16157      {"Element Count", "wlan_mgt.ft.element_count",
16158       FT_UINT16, BASE_DEC, NULL, 0xff00, NULL, HFILL }},
16159     {&hf_ieee80211_tag_ft_mic,
16160      {"MIC", "wlan_mgt.ft.mic",
16161       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16162     {&hf_ieee80211_tag_ft_anonce,
16163      {"ANonce", "wlan_mgt.ft.anonce",
16164       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16165     {&hf_ieee80211_tag_ft_snonce,
16166      {"SNonce", "wlan_mgt.ft.snonce",
16167       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16168     {&hf_ieee80211_tag_ft_subelem_id,
16169      {"Subelement ID", "wlan_mgt.ft.subelem.id",
16170       FT_UINT8, BASE_DEC, VALS(ft_subelem_id_vals), 0, NULL, HFILL }},
16171     {&hf_ieee80211_tag_ft_subelem_len,
16172      {"Length", "wlan_mgt.ft.subelem.len",
16173       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16174     {&hf_ieee80211_tag_ft_subelem_data,
16175      {"Data", "wlan_mgt.ft.subelem.data",
16176       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16177     {&hf_ieee80211_tag_ft_subelem_r1kh_id,
16178      {"PMK-R1 key holder identifier (R1KH-ID)", "wlan_mgt.ft.subelem.r1kh_id",
16179       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16180     {&hf_ieee80211_tag_ft_subelem_gtk_key_info,
16181      {"Key Info", "wlan_mgt.ft.subelem.gtk.key_info",
16182       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
16183     {&hf_ieee80211_tag_ft_subelem_gtk_key_id,
16184      {"Key ID", "wlan_mgt.ft.subelem.gtk.key_id",
16185       FT_UINT16, BASE_DEC, NULL, 0x0003, NULL, HFILL }},
16186     {&hf_ieee80211_tag_ft_subelem_gtk_key_length,
16187      {"Key Length", "wlan_mgt.ft.subelem.gtk.key_length",
16188       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
16189     {&hf_ieee80211_tag_ft_subelem_gtk_rsc,
16190      {"RSC", "wlan_mgt.ft.subelem.gtk.rsc",
16191       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16192     {&hf_ieee80211_tag_ft_subelem_gtk_key,
16193      {"GTK", "wlan_mgt.ft.subelem.gtk.key",
16194       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16195     {&hf_ieee80211_tag_ft_subelem_r0kh_id,
16196      {"PMK-R0 key holder identifier (R0KH-ID)", "wlan_mgt.ft.subelem.r0kh_id",
16197       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
16198     {&hf_ieee80211_tag_ft_subelem_igtk_key_id,
16199      {"Key ID", "wlan_mgt.ft.subelem.igtk.key_id",
16200       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16201     {&hf_ieee80211_tag_ft_subelem_igtk_ipn,
16202      {"IPN", "wlan_mgt.ft.subelem.igtk.ipn",
16203       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16204     {&hf_ieee80211_tag_ft_subelem_igtk_key_length,
16205      {"Key Length", "wlan_mgt.ft.subelem.igtk.key_length",
16206       FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
16207     {&hf_ieee80211_tag_ft_subelem_igtk_key,
16208      {"Wrapped Key (IGTK)", "wlan_mgt.ft.subelem.igtk.key",
16209       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16210
16211     /* MMIE */
16212     {&hf_ieee80211_tag_mmie_keyid,
16213      {"KeyID", "wlan_mgt.mmie.keyid",
16214       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16215     {&hf_ieee80211_tag_mmie_ipn,
16216      {"IPN", "wlan_mgt.mmie.ipn",
16217       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16218     {&hf_ieee80211_tag_mmie_mic,
16219      {"MIC", "wlan_mgt.mmie.mic",
16220       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16221
16222     /* Time Advertisement */
16223     {&hf_ieee80211_tag_time_adv_timing_capab,
16224      {"Timing capabilities", "wlan_mgt.time_adv.timing_capab",
16225       FT_UINT8, BASE_DEC, VALS(time_adv_timing_capab_vals), 0, NULL, HFILL }},
16226     {&hf_ieee80211_tag_time_adv_time_value,
16227      {"Time Value", "wlan_mgt.time_adv.time_value",
16228       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16229     {&hf_ieee80211_tag_time_adv_time_value_year,
16230      {"Time Value: Year", "wlan_mgt.time_adv.time_value.year",
16231       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16232     {&hf_ieee80211_tag_time_adv_time_value_month,
16233      {"Time Value: Month", "wlan_mgt.time_adv.time_value.month",
16234       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16235     {&hf_ieee80211_tag_time_adv_time_value_day,
16236      {"Time Value: Day", "wlan_mgt.time_adv.time_value.month",
16237       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16238     {&hf_ieee80211_tag_time_adv_time_value_hours,
16239      {"Time Value: Hours", "wlan_mgt.time_adv.time_value.hours",
16240       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16241     {&hf_ieee80211_tag_time_adv_time_value_minutes,
16242      {"Time Value: Minutes", "wlan_mgt.time_adv.time_value.minutes",
16243       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16244     {&hf_ieee80211_tag_time_adv_time_value_seconds,
16245      {"Time Value: Seconds", "wlan_mgt.time_adv.time_value.seconds",
16246       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16247     {&hf_ieee80211_tag_time_adv_time_value_milliseconds,
16248      {"Time Value: Milliseconds", "wlan_mgt.time_adv.time_value.milliseconds",
16249       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16250     {&hf_ieee80211_tag_time_adv_time_value_reserved,
16251      {"Time Value: Reserved", "wlan_mgt.time_adv.time_value.reserved",
16252       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16253     {&hf_ieee80211_tag_time_adv_time_error,
16254      {"Time Error", "wlan_mgt.time_adv.time_error",
16255       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16256     {&hf_ieee80211_tag_time_adv_time_update_counter,
16257      {"Time Update Counter", "wlan_mgt.time_adv.time_update_counter",
16258       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16259
16260     /* Time Zone */
16261     {&hf_ieee80211_tag_time_zone,
16262      {"Time Zone", "wlan_mgt.time_zone",
16263       FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
16264
16265     /* Interworking */
16266     {&hf_ieee80211_tag_interworking_access_network_type,
16267      {"Access Network Type", "wlan_mgt.interworking.access_network_type",
16268       FT_UINT8, BASE_DEC, VALS(access_network_type_vals), 0x0f, NULL, HFILL }},
16269     {&hf_ieee80211_tag_interworking_internet,
16270      {"Internet", "wlan_mgt.interworking.internet",
16271       FT_UINT8, BASE_DEC, NULL, 0x10, NULL, HFILL }},
16272     {&hf_ieee80211_tag_interworking_asra,
16273      {"ASRA", "wlan_mgt.interworking.asra",
16274       FT_UINT8, BASE_DEC, NULL, 0x20, "Additional Step Required for Access",
16275       HFILL }},
16276     {&hf_ieee80211_tag_interworking_esr,
16277      {"ESR", "wlan_mgt.interworking.esr",
16278       FT_UINT8, BASE_DEC, NULL, 0x40, "Emergency services reachable", HFILL }},
16279     {&hf_ieee80211_tag_interworking_uesa,
16280      {"UESA", "wlan_mgt.interworking.uesa",
16281       FT_UINT8, BASE_DEC, NULL, 0x80,
16282       "Unauthenticated emergency service accessible", HFILL }},
16283     {&hf_ieee80211_tag_interworking_hessid,
16284      {"HESSID", "wlan_mgt.interworking.hessid",
16285       FT_ETHER, BASE_NONE, NULL, 0, "Homogeneous ESS identifier", HFILL }},
16286
16287     /* Advertisement Protocol */
16288     {&hf_ieee80211_tag_adv_proto_resp_len_limit,
16289      {"Query Response Length Limit", "wlan_mgt.adv_proto.resp_len_limit",
16290       FT_UINT8, BASE_DEC, NULL, 0x7f, NULL, HFILL }},
16291     {&hf_ieee80211_tag_adv_proto_pame_bi,
16292      {"PAME-BI", "wlan_mgt.adv_proto.pame_bi",
16293       FT_UINT8, BASE_DEC, NULL, 0x80,
16294       "Pre-Association Message Xchange BSSID Independent (PAME-BI)", HFILL }},
16295     {&hf_ieee80211_tag_adv_proto_id,
16296      {"Advertisement Protocol ID", "wlan_mgt.adv_proto.id",
16297       FT_UINT8, BASE_DEC, VALS(adv_proto_id_vals), 0, NULL, HFILL }},
16298
16299     /* Roaming Consortium */
16300     {&hf_ieee80211_tag_roaming_consortium_num_anqp_oi,
16301      {"Number of ANQP OIs", "wlan_mgt.roaming_consortium.num_anqp_oi",
16302       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16303     {&hf_ieee80211_tag_roaming_consortium_oi1_len,
16304      {"OI #1 Length", "wlan_mgt.roaming_consortium.oi1_len",
16305       FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL }},
16306     {&hf_ieee80211_tag_roaming_consortium_oi2_len,
16307      {"OI #2 Length", "wlan_mgt.roaming_consortium.oi2_len",
16308       FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL }},
16309     {&hf_ieee80211_tag_roaming_consortium_oi1,
16310      {"OI #1", "wlan_mgt.roaming_consortium.oi1",
16311       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16312     {&hf_ieee80211_tag_roaming_consortium_oi2,
16313      {"OI #2", "wlan_mgt.roaming_consortium.oi2",
16314       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16315     {&hf_ieee80211_tag_roaming_consortium_oi3,
16316      {"OI #3", "wlan_mgt.roaming_consortium.oi3",
16317       FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
16318
16319     /* Timeout Interval */
16320     {&hf_ieee80211_tag_timeout_int_type,
16321      {"Timeout Interval Type", "wlan_mgt.timeout_int.type",
16322       FT_UINT8, BASE_DEC, VALS(timeout_int_types), 0, NULL, HFILL }},
16323     {&hf_ieee80211_tag_timeout_int_value,
16324      {"Timeout Interval Value", "wlan_mgt.timeout_int.value",
16325       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
16326
16327     /* Link Identifier */
16328     {&hf_ieee80211_tag_link_id_bssid,
16329      {"BSSID", "wlan_mgt.link_id.bssid",
16330       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
16331     {&hf_ieee80211_tag_link_id_init_sta,
16332      {"TDLS initiator STA Address", "wlan_mgt.link_id.init_sta",
16333       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
16334     {&hf_ieee80211_tag_link_id_resp_sta,
16335      {"TDLS responder STA Address", "wlan_mgt.link_id.resp_sta",
16336       FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }},
16337
16338     /* Wakeup Schedule */
16339     {&hf_ieee80211_tag_wakeup_schedule_offset,
16340      {"Offset", "wlan_mgt.wakeup_schedule.offset",
16341       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
16342     {&hf_ieee80211_tag_wakeup_schedule_interval,
16343      {"Interval", "wlan_mgt.wakeup_schedule.interval",
16344       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
16345     {&hf_ieee80211_tag_wakeup_schedule_awake_window_slots,
16346      {"Awake Window Slots", "wlan_mgt.wakeup_schedule.awake_window_slots",
16347       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
16348     {&hf_ieee80211_tag_wakeup_schedule_max_awake_dur,
16349      {"Maximum Awake Window Duration",
16350       "wlan_mgt.wakeup_schedule.max_awake_dur",
16351       FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
16352     {&hf_ieee80211_tag_wakeup_schedule_idle_count,
16353      {"Idle Count", "wlan_mgt.wakeup_schedule.idle_count",
16354       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16355
16356     /* Channel Switch Timing */
16357     {&hf_ieee80211_tag_channel_switch_timing_switch_time,
16358      {"Switch Time", "wlan_mgt.channel_switch_timing.switch_time",
16359       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16360     {&hf_ieee80211_tag_channel_switch_timing_switch_timeout,
16361      {"Switch Timeout", "wlan_mgt.channel_switch_timing.switch_timeout",
16362       FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
16363
16364     /* PTI Control */
16365     {&hf_ieee80211_tag_pti_control_tid,
16366      {"TID", "wlan_mgt.pti_control.tid",
16367       FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
16368     {&hf_ieee80211_tag_pti_control_sequence_control,
16369      {"Sequence Control", "wlan_mgt.pti_control.sequence_control",
16370       FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
16371
16372     /* PU Buffer Status */
16373     {&hf_ieee80211_tag_pu_buffer_status_ac_bk,
16374      {"AC_BK traffic available", "wlan_mgt.pu_buffer_status.ac_bk",
16375       FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }},
16376     {&hf_ieee80211_tag_pu_buffer_status_ac_be,
16377      {"AC_BE traffic available", "wlan_mgt.pu_buffer_status.ac_be",
16378       FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL }},
16379     {&hf_ieee80211_tag_pu_buffer_status_ac_vi,
16380      {"AC_VI traffic available", "wlan_mgt.pu_buffer_status.ac_vi",
16381       FT_UINT8, BASE_DEC, NULL, 0x04, NULL, HFILL }},
16382     {&hf_ieee80211_tag_pu_buffer_status_ac_vo,
16383      {"AC_VO traffic available", "wlan_mgt.pu_buffer_status.ac_vo",
16384       FT_UINT8, BASE_DEC, NULL, 0x08, NULL, HFILL }}
16385   };
16386
16387   static hf_register_info aggregate_fields[] = {
16388     {&hf_ieee80211_amsdu_msdu_header_text,
16389      {"MAC Service Data Unit (MSDU)", "wlan_aggregate.msduheader", FT_UINT16,
16390       BASE_DEC, 0, 0x0000, NULL, HFILL }}
16391   };
16392
16393   static uat_field_t wep_uat_flds[] = {
16394
16395       UAT_FLD_VS(uat_wep_key_records, key, "Key type", wep_type_vals,
16396                         "Decryption key type used"),
16397       UAT_FLD_CSTRING(uat_wep_key_records, string, "Key",
16398                         "wep:<wep hexadecimal key>\n"
16399                         "wpa-pwd:<passphrase>[:<ssid>]\n"
16400                         "wpa-psk:<wpa hexadecimal key>"),
16401       UAT_END_FIELDS
16402     };
16403
16404   static gint *tree_array[] = {
16405     &ett_80211,
16406     &ett_fc_tree,
16407     &ett_proto_flags,
16408     &ett_fragments,
16409     &ett_fragment,
16410     &ett_block_ack,
16411     &ett_block_ack_bitmap,
16412     &ett_80211_mgt,
16413     &ett_fixed_parameters,
16414     &ett_tagged_parameters,
16415     &ett_tag_bmapctl_tree,
16416     &ett_tag_country_fnm_tree,
16417     &ett_tag_country_rcc_tree,
16418     &ett_qos_parameters,
16419     &ett_qos_ps_buf_state,
16420     &ett_qos_info_field_tree,
16421     &ett_wep_parameters,
16422     &ett_msh_control,
16423     &ett_hwmp_targ_flags_tree,
16424     &ett_cap_tree,
16425     &ett_rsn_gcs_tree,
16426     &ett_rsn_pcs_tree,
16427     &ett_rsn_sub_pcs_tree,
16428     &ett_rsn_akms_tree,
16429     &ett_rsn_sub_akms_tree,
16430     &ett_rsn_cap_tree,
16431     &ett_rsn_pmkid_tree,
16432     &ett_rsn_gmcs_tree,
16433     &ett_wpa_mcs_tree,
16434     &ett_wpa_ucs_tree,
16435     &ett_wpa_sub_ucs_tree,
16436     &ett_wpa_akms_tree,
16437     &ett_wpa_sub_akms_tree,
16438     &ett_wme_ac,
16439     &ett_wme_aci_aifsn,
16440     &ett_wme_ecw,
16441     &ett_wme_qos_info,
16442     &ett_ht_cap_tree,
16443     &ett_ath_cap_tree,
16444     &ett_ff_ba_param_tree,
16445     &ett_ff_qos_info,
16446     &ett_ff_sm_pwr_save,
16447     &ett_ff_psmp_param_set,
16448     &ett_ff_mimo_cntrl,
16449     &ett_ff_ant_sel,
16450     &ett_ff_chan_switch_announce,
16451     &ett_ff_ht_info,
16452     &ett_ff_psmp_sta_info,
16453     &ett_ff_delba_param_tree,
16454     &ett_ff_ba_ssc_tree,
16455     &ett_mimo_report,
16456     &ett_cntrl_wrapper_fc,
16457     &ett_cntrl_wrapper_payload,
16458     &ett_ht_info_delimiter1_tree,
16459     &ett_ht_info_delimiter2_tree,
16460     &ett_ht_info_delimiter3_tree,
16461     &ett_msdu_aggregation_parent_tree,
16462     &ett_msdu_aggregation_subframe_tree,
16463     &ett_tag_measure_request_mode_tree,
16464     &ett_tag_measure_request_type_tree,
16465     &ett_tag_measure_report_mode_tree,
16466     &ett_tag_measure_report_type_tree,
16467     &ett_tag_measure_report_basic_map_tree,
16468     &ett_tag_measure_report_rpi_tree,
16469     &ett_tag_measure_report_frame_tree,
16470     &ett_tag_dfs_map_tree,
16471     &ett_tag_erp_info_tree,
16472     &ett_tag_ex_cap,
16473     &ett_tag_supported_channels,
16474     &ett_tag_neighbor_report_bssid_info_tree,
16475     &ett_tag_neighbor_report_bssid_info_capability_tree,
16476     &ett_tag_neighbor_report_sub_tag_tree,
16477     &ett_ampduparam_tree,
16478     &ett_mcsset_tree,
16479     &ett_mcsbit_tree,
16480     &ett_htex_cap_tree,
16481     &ett_txbf_tree,
16482     &ett_hta_cap_tree,
16483     &ett_hta_cap1_tree,
16484     &ett_hta_cap2_tree,
16485     &ett_htc_tree,
16486     &ett_antsel_tree,
16487     &ett_80211_mgt_ie,
16488     &ett_tsinfo_tree,
16489     &ett_sched_tree,
16490     &ett_fcs,
16491     &ett_tag_time_adv_tree,
16492     &ett_adv_proto,
16493     &ett_adv_proto_tuple,
16494     &ett_gas_query,
16495     &ett_gas_resp_fragment,
16496     &ett_gas_resp_fragments,
16497     &ett_gas_anqp,
16498     &ett_nai_realm,
16499     &ett_nai_realm_eap,
16500     &ett_anqp_vendor_capab
16501   };
16502   module_t *wlan_module;
16503
16504   memset (&wlan_stats, 0, sizeof wlan_stats);
16505
16506   proto_aggregate = proto_register_protocol("IEEE 802.11 wireless LAN aggregate frame",
16507       "IEEE 802.11 Aggregate Data", "wlan_aggregate");
16508   proto_register_field_array(proto_aggregate, aggregate_fields, array_length(aggregate_fields));
16509   proto_wlan = proto_register_protocol ("IEEE 802.11 wireless LAN",
16510       "IEEE 802.11", "wlan");
16511   proto_register_field_array (proto_wlan, hf, array_length (hf));
16512   proto_wlan_mgt = proto_register_protocol ("IEEE 802.11 wireless LAN management frame",
16513       "802.11 MGT", "wlan_mgt");
16514   proto_register_field_array (proto_wlan_mgt, ff, array_length (ff));
16515   proto_register_subtree_array (tree_array, array_length (tree_array));
16516
16517   register_dissector("wlan", dissect_ieee80211, proto_wlan);
16518   register_dissector("wlan_fixed", dissect_ieee80211_fixed, proto_wlan);
16519   register_dissector("wlan_bsfc", dissect_ieee80211_bsfc, proto_wlan);
16520   register_dissector("wlan_datapad", dissect_ieee80211_datapad, proto_wlan);
16521   register_dissector("wlan_ht", dissect_ieee80211_ht, proto_wlan);
16522   register_init_routine(wlan_defragment_init);
16523   register_init_routine(wlan_retransmit_init);
16524   register_init_routine(ieee80211_gas_reassembly_init);
16525
16526   wlan_tap = register_tap("wlan");
16527
16528   /* Register configuration options */
16529   wlan_module = prefs_register_protocol(proto_wlan, init_wepkeys);
16530   prefs_register_bool_preference(wlan_module, "defragment",
16531     "Reassemble fragmented 802.11 datagrams",
16532     "Whether fragmented 802.11 datagrams should be reassembled",
16533      &wlan_defragment);
16534
16535   prefs_register_bool_preference(wlan_module, "ignore_draft_ht",
16536     "Ignore vendor-specific HT elements",
16537     "Don't dissect 802.11n draft HT elements (which might contain duplicate information).",
16538     &wlan_ignore_draft_ht);
16539
16540   prefs_register_bool_preference(wlan_module, "retransmitted",
16541     "Call subdissector for retransmitted 802.11 frames",
16542     "Whether retransmitted 802.11 frames should be subdissected",
16543     &wlan_subdissector);
16544
16545   prefs_register_bool_preference(wlan_module, "check_fcs",
16546     "Assume packets have FCS",
16547     "Some 802.11 cards include the FCS at the end of a packet, others do not.",
16548     &wlan_check_fcs);
16549
16550   /* Davide Schiera (2006-11-26): changed "WEP bit" in "Protection bit"    */
16551   /*    (according to the document IEEE Std 802.11i-2004)              */
16552   prefs_register_enum_preference(wlan_module, "ignore_wep",
16553     "Ignore the Protection bit",
16554     "Some 802.11 cards leave the Protection bit set even though the packet is decrypted, "
16555     "and some also leave the IV (initialization vector).",
16556     &wlan_ignore_wep, wlan_ignore_wep_options, TRUE);
16557
16558   prefs_register_obsolete_preference(wlan_module, "wep_keys");
16559
16560   /* Davide Schiera (2006-11-26): added reference to WPA/WPA2 decryption    */
16561   prefs_register_bool_preference(wlan_module, "enable_decryption",
16562     "Enable decryption", "Enable WEP and WPA/WPA2 decryption",
16563     &enable_decryption);
16564
16565   prefs_register_static_text_preference(wlan_module, "info_decryption_key",
16566     "Key examples: 01:02:03:04:05 (40/64-bit WEP),\n"
16567     "010203040506070809101111213 (104/128-bit WEP),\n"
16568     "MyPassword[:MyAP] (WPA + plaintext password [+ SSID]),\n"
16569     "0102030405...6061626364 (WPA + 256-bit key).  "
16570     "Invalid keys will be ignored.",
16571     "Valid key formats");
16572
16573   wep_uat = uat_new("WEP and WPA Decryption Keys",
16574             sizeof(uat_wep_key_record_t),  /* record size */
16575             "80211_keys",               /* filename */
16576             TRUE,                       /* from_profile */
16577             (void*) &uat_wep_key_records,  /* data_ptr */
16578             &num_wepkeys_uat,           /* numitems_ptr */
16579             UAT_AFFECTS_DISSECTION,     /* affects dissection of packets, but not set of named fields */
16580             NULL,                       /* help */
16581             uat_wep_key_record_copy_cb,        /* copy callback */
16582             uat_wep_key_record_update_cb,      /* update callback */
16583             uat_wep_key_record_free_cb,        /* free callback */
16584             NULL,                       /* post update callback */
16585             wep_uat_flds);             /* UAT field definitions */
16586
16587   prefs_register_uat_preference(wlan_module,
16588                                 "wep_key_table",
16589                                 "Decryption Keys",
16590                                 "WEP and pre-shared WPA keys",
16591                                 wep_uat);
16592 }
16593
16594 static void
16595 dissect_data_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
16596 {
16597   int offset = 0;
16598   guint8 type;
16599   int tagged_parameter_tree_len;
16600   proto_tree *tagged_tree;
16601
16602   g_pinfo = pinfo;
16603
16604   type = tvb_get_guint8(tvb, offset);
16605   proto_tree_add_item(tree, hf_ieee80211_data_encap_payload_type, tvb, offset,
16606                       1, ENC_BIG_ENDIAN);
16607   offset++;
16608   switch (type) {
16609   case 1:
16610     col_set_str(pinfo->cinfo, COL_PROTOCOL, "RRB");
16611     /* TODO: IEEE 802.11r */
16612     break;
16613   case 2:
16614     col_set_str(pinfo->cinfo, COL_PROTOCOL, "TDLS");
16615     col_clear(pinfo->cinfo, COL_INFO);
16616     offset += add_fixed_field(tree, tvb, offset, FIELD_ACTION);
16617     tagged_parameter_tree_len = tvb_reported_length_remaining(tvb, offset);
16618     if (tagged_parameter_tree_len > 0) {
16619       tagged_tree = get_tagged_parameter_tree(tree, tvb, offset,
16620                                               tagged_parameter_tree_len);
16621       ieee_80211_add_tagged_parameters(tvb, offset, pinfo, tagged_tree,
16622                                        tagged_parameter_tree_len, -1);
16623     }
16624     break;
16625   }
16626 }
16627
16628 void
16629 proto_reg_handoff_ieee80211(void)
16630 {
16631   dissector_handle_t data_encap_handle;
16632
16633   /*
16634    * Get handles for the LLC, IPX and Ethernet  dissectors.
16635    */
16636   llc_handle = find_dissector("llc");
16637   ipx_handle = find_dissector("ipx");
16638   eth_withoutfcs_handle = find_dissector("eth_withoutfcs");
16639   data_handle = find_dissector("data");
16640
16641   ieee80211_handle = find_dissector("wlan");
16642   dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11, ieee80211_handle);
16643   dissector_add_uint("ethertype", ETHERTYPE_CENTRINO_PROMISC, ieee80211_handle);
16644
16645   /* Register handoff to Aruba GRE */
16646   dissector_add_uint("gre.proto", GRE_ARUBA_8200, ieee80211_handle);
16647   dissector_add_uint("gre.proto", GRE_ARUBA_8210, ieee80211_handle);
16648   dissector_add_uint("gre.proto", GRE_ARUBA_8220, ieee80211_handle);
16649   dissector_add_uint("gre.proto", GRE_ARUBA_8230, ieee80211_handle);
16650   dissector_add_uint("gre.proto", GRE_ARUBA_8240, ieee80211_handle);
16651   dissector_add_uint("gre.proto", GRE_ARUBA_8250, ieee80211_handle);
16652   dissector_add_uint("gre.proto", GRE_ARUBA_8260, ieee80211_handle);
16653   dissector_add_uint("gre.proto", GRE_ARUBA_8270, ieee80211_handle);
16654   dissector_add_uint("gre.proto", GRE_ARUBA_8280, ieee80211_handle);
16655   dissector_add_uint("gre.proto", GRE_ARUBA_8290, ieee80211_handle);
16656   dissector_add_uint("gre.proto", GRE_ARUBA_82A0, ieee80211_handle);
16657   dissector_add_uint("gre.proto", GRE_ARUBA_82B0, ieee80211_handle);
16658   dissector_add_uint("gre.proto", GRE_ARUBA_82C0, ieee80211_handle);
16659   dissector_add_uint("gre.proto", GRE_ARUBA_82D0, ieee80211_handle);
16660   dissector_add_uint("gre.proto", GRE_ARUBA_82E0, ieee80211_handle);
16661   dissector_add_uint("gre.proto", GRE_ARUBA_82F0, ieee80211_handle);
16662   dissector_add_uint("gre.proto", GRE_ARUBA_8300, ieee80211_handle);
16663   dissector_add_uint("gre.proto", GRE_ARUBA_8310, ieee80211_handle);
16664   dissector_add_uint("gre.proto", GRE_ARUBA_8320, ieee80211_handle);
16665   dissector_add_uint("gre.proto", GRE_ARUBA_8330, ieee80211_handle);
16666   dissector_add_uint("gre.proto", GRE_ARUBA_8340, ieee80211_handle);
16667   dissector_add_uint("gre.proto", GRE_ARUBA_8350, ieee80211_handle);
16668   dissector_add_uint("gre.proto", GRE_ARUBA_8360, ieee80211_handle);
16669   dissector_add_uint("gre.proto", GRE_ARUBA_8370, ieee80211_handle);
16670
16671   data_encap_handle = create_dissector_handle(dissect_data_encap, proto_wlan);
16672   dissector_add_uint("ethertype", ETHERTYPE_IEEE80211_DATA_ENCAP,
16673                 data_encap_handle);
16674 }
16675
16676 /* Davide Schiera (2006-11-26): this function will try to decrypt with WEP or  */
16677 /* WPA and return a tvb to the caller to add a new tab. It returns the    */
16678 /* algorithm used for decryption (WEP, TKIP, CCMP) and the header and    */
16679 /* trailer lengths.                                      */
16680 static tvbuff_t *
16681 try_decrypt(tvbuff_t *tvb, guint offset, guint len, guint8 *algorithm, guint32 *sec_header, guint32 *sec_trailer) {
16682   const guint8 *enc_data;
16683   guint8 *tmp = NULL;
16684   tvbuff_t *decr_tvb = NULL;
16685   guint32 dec_caplen;
16686   guchar dec_data[AIRPDCAP_MAX_CAPLEN];
16687   AIRPDCAP_KEY_ITEM used_key;
16688
16689   if (!enable_decryption)
16690     return NULL;
16691
16692   /* get the entire packet                                  */
16693   enc_data = tvb_get_ptr(tvb, 0, len+offset);
16694
16695   /*  process packet with AirPDcap                              */
16696   if (AirPDcapPacketProcess(&airpdcap_ctx, enc_data, offset, offset+len, dec_data, &dec_caplen, &used_key, FALSE, TRUE)==AIRPDCAP_RET_SUCCESS)
16697   {
16698     *algorithm=used_key.KeyType;
16699     switch (*algorithm) {
16700       case AIRPDCAP_KEY_TYPE_WEP:
16701         *sec_header=AIRPDCAP_WEP_HEADER;
16702         *sec_trailer=AIRPDCAP_WEP_TRAILER;
16703         break;
16704       case AIRPDCAP_KEY_TYPE_CCMP:
16705         *sec_header=AIRPDCAP_RSNA_HEADER;
16706         *sec_trailer=AIRPDCAP_CCMP_TRAILER;
16707         break;
16708       case AIRPDCAP_KEY_TYPE_TKIP:
16709         *sec_header=AIRPDCAP_RSNA_HEADER;
16710         *sec_trailer=AIRPDCAP_TKIP_TRAILER;
16711         break;
16712       default:
16713         return NULL;
16714     }
16715
16716     /* allocate buffer for decrypted payload                      */
16717     tmp = g_memdup(dec_data+offset, dec_caplen-offset);
16718
16719     len=dec_caplen-offset;
16720
16721     /* decrypt successful, let's set up a new data tvb.              */
16722     decr_tvb = tvb_new_child_real_data(tvb, tmp, len, len);
16723     tvb_set_free_cb(decr_tvb, g_free);
16724   }
16725
16726   return decr_tvb;
16727 }
16728 /*  Davide Schiera -----------------------------------------------------------  */
16729
16730
16731 /* Collect our WEP and WPA keys */
16732 static
16733 void set_airpdcap_keys(void)
16734 {
16735   guint i = 0;
16736   AIRPDCAP_KEY_ITEM key;
16737   PAIRPDCAP_KEYS_COLLECTION keys;
16738   decryption_key_t* dk = NULL;
16739   GByteArray *bytes = NULL;
16740   gboolean res;
16741
16742   keys=(PAIRPDCAP_KEYS_COLLECTION)se_alloc(sizeof(AIRPDCAP_KEYS_COLLECTION));
16743   keys->nKeys = 0;
16744
16745   for(i = 0; (uat_wep_key_records != NULL) && (i < num_wepkeys_uat) && (i < MAX_ENCRYPTION_KEYS); i++)
16746   {
16747     dk = parse_key_string(uat_wep_key_records[i].string, uat_wep_key_records[i].key);
16748
16749     if(dk != NULL)
16750     {
16751       if(dk->type == AIRPDCAP_KEY_TYPE_WEP)
16752       {
16753         key.KeyType = AIRPDCAP_KEY_TYPE_WEP;
16754
16755         bytes = g_byte_array_new();
16756         res = hex_str_to_bytes(dk->key->str, bytes, FALSE);
16757
16758         if (dk->key->str && res && bytes->len > 0 && bytes->len <= AIRPDCAP_WEP_KEY_MAXLEN)
16759         {
16760           /*
16761            * WEP key is correct (well, the can be even or odd, so it is not
16762            * a real check, I think... is a check performed somewhere in the
16763            * AirPDcap function??? )
16764            */
16765           memcpy(key.KeyData.Wep.WepKey, bytes->data, bytes->len);
16766           key.KeyData.Wep.WepKeyLen = bytes->len;
16767           keys->Keys[keys->nKeys] = key;
16768           keys->nKeys++;
16769         }
16770       }
16771       else if(dk->type == AIRPDCAP_KEY_TYPE_WPA_PWD)
16772       {
16773         key.KeyType = AIRPDCAP_KEY_TYPE_WPA_PWD;
16774
16775         /* XXX - This just lops the end if the key off if it's too long.
16776          *       Should we handle this more gracefully? */
16777         g_strlcpy(key.UserPwd.Passphrase, dk->key->str, AIRPDCAP_WPA_PASSPHRASE_MAX_LEN+1);
16778
16779         key.UserPwd.SsidLen = 0;
16780         if(dk->ssid != NULL && dk->ssid->len <= AIRPDCAP_WPA_SSID_MAX_LEN)
16781         {
16782           memcpy(key.UserPwd.Ssid, dk->ssid->data, dk->ssid->len);
16783           key.UserPwd.SsidLen = dk->ssid->len;
16784         }
16785
16786         keys->Keys[keys->nKeys] = key;
16787         keys->nKeys++;
16788       }
16789       else if(dk->type == AIRPDCAP_KEY_TYPE_WPA_PMK)
16790       {
16791         key.KeyType = AIRPDCAP_KEY_TYPE_WPA_PMK;
16792
16793         bytes = g_byte_array_new();
16794         hex_str_to_bytes(dk->key->str, bytes, FALSE);
16795
16796         /* XXX - Pass the correct array of bytes... */
16797         if (bytes->len <= AIRPDCAP_WPA_PMK_LEN) {
16798           memcpy(key.KeyData.Wpa.Pmk, bytes->data, bytes->len);
16799
16800           keys->Keys[keys->nKeys] = key;
16801           keys->nKeys++;
16802         }
16803       }
16804     }
16805   }
16806
16807   /* Now set the keys */
16808   AirPDcapSetKeys(&airpdcap_ctx,keys->Keys,keys->nKeys);
16809   if (bytes)
16810     g_byte_array_free(bytes, TRUE);
16811
16812 }
16813
16814 static void init_wepkeys(void) {
16815
16816   /*
16817    * XXX - AirPDcap - That God sends it to us beautiful (che dio ce la mandi bona)
16818    * The next lines will add a key to the AirPDcap context. The keystring will be added
16819    * to the old WEP array too, but we don't care, because the packets will come here
16820    * already decrypted... One of these days we will fix this too
16821    */
16822   set_airpdcap_keys();
16823 }
16824 /*
16825  * This code had been taken from AirSnort crack.c function classify()
16826  * Permission granted by snax <at> shmoo dot com
16827  * weak_iv - determine which key byte an iv is useful in resolving
16828  * parm     - p, pointer to the first byte of an IV
16829  * return   -  n - this IV is weak for byte n of a WEP key
16830  *            -1 - this IV is not weak for any key bytes
16831  *
16832  * This function tests for IVs that are known to satisfy the criteria
16833  * for a weak IV as specified in FMS section 7.1
16834  *
16835  */
16836 static int
16837 weak_iv(guchar *iv)
16838 {
16839   guchar sum, k;
16840
16841   if (iv[1] == 255 && iv[0] > 2 && iv[0] < 16) {
16842     return iv[0] -3;
16843   }
16844
16845   sum = iv[0] + iv[1];
16846   if (sum == 1) {
16847     if (iv[2] <= 0x0a) {
16848       return iv[2] +2;
16849     }
16850     else if (iv[2] == 0xff){
16851       return 0;
16852     }
16853   }
16854   k = 0xfe - iv[2];
16855   if (sum == k  && (iv[2] >= 0xf2 && iv[2] <= 0xfe && iv[2] != 0xfd)){
16856     return k;
16857   }
16858   return -1;
16859 }
16860
16861 /*
16862  * Editor modelines
16863  *
16864  * Local Variables:
16865  * c-basic-offset: 2
16866  * tab-width: 8
16867  * indent-tabs-mode: nil
16868  * End:
16869  *
16870  * ex: set shiftwidth=2 tabstop=8 expandtab:
16871  * :indentSize=2:tabSize=8:noTabs=true:
16872  */