The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/net80211/ieee80211.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2001 Atsushi Onoe
    3  * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25  *
   26  * $FreeBSD: releng/11.0/sys/net80211/ieee80211.h 297404 2016-03-30 00:42:18Z adrian $
   27  */
   28 #ifndef _NET80211_IEEE80211_H_
   29 #define _NET80211_IEEE80211_H_
   30 
   31 /*
   32  * 802.11 protocol definitions.
   33  */
   34 
   35 #define IEEE80211_ADDR_LEN      6               /* size of 802.11 address */
   36 /* is 802.11 address multicast/broadcast? */
   37 #define IEEE80211_IS_MULTICAST(_a)      (*(_a) & 0x01)
   38 
   39 #ifdef _KERNEL
   40 extern const uint8_t ieee80211broadcastaddr[];
   41 #endif
   42 
   43 typedef uint16_t ieee80211_seq;
   44 
   45 /* IEEE 802.11 PLCP header */
   46 struct ieee80211_plcp_hdr {
   47         uint16_t        i_sfd;
   48         uint8_t         i_signal;
   49         uint8_t         i_service;
   50         uint16_t        i_length;
   51         uint16_t        i_crc;
   52 } __packed;
   53 
   54 #define IEEE80211_PLCP_SFD      0xF3A0 
   55 #define IEEE80211_PLCP_SERVICE  0x00
   56 #define IEEE80211_PLCP_SERVICE_LOCKED   0x04
   57 #define IEEE80211_PLCL_SERVICE_PBCC     0x08
   58 #define IEEE80211_PLCP_SERVICE_LENEXT5  0x20
   59 #define IEEE80211_PLCP_SERVICE_LENEXT6  0x40
   60 #define IEEE80211_PLCP_SERVICE_LENEXT7  0x80
   61 
   62 /*
   63  * generic definitions for IEEE 802.11 frames
   64  */
   65 struct ieee80211_frame {
   66         uint8_t         i_fc[2];
   67         uint8_t         i_dur[2];
   68         uint8_t         i_addr1[IEEE80211_ADDR_LEN];
   69         uint8_t         i_addr2[IEEE80211_ADDR_LEN];
   70         uint8_t         i_addr3[IEEE80211_ADDR_LEN];
   71         uint8_t         i_seq[2];
   72         /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
   73         /* see below */
   74 } __packed;
   75 
   76 struct ieee80211_qosframe {
   77         uint8_t         i_fc[2];
   78         uint8_t         i_dur[2];
   79         uint8_t         i_addr1[IEEE80211_ADDR_LEN];
   80         uint8_t         i_addr2[IEEE80211_ADDR_LEN];
   81         uint8_t         i_addr3[IEEE80211_ADDR_LEN];
   82         uint8_t         i_seq[2];
   83         uint8_t         i_qos[2];
   84         /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
   85         /* see below */
   86 } __packed;
   87 
   88 struct ieee80211_qoscntl {
   89         uint8_t         i_qos[2];
   90 };
   91 
   92 struct ieee80211_frame_addr4 {
   93         uint8_t         i_fc[2];
   94         uint8_t         i_dur[2];
   95         uint8_t         i_addr1[IEEE80211_ADDR_LEN];
   96         uint8_t         i_addr2[IEEE80211_ADDR_LEN];
   97         uint8_t         i_addr3[IEEE80211_ADDR_LEN];
   98         uint8_t         i_seq[2];
   99         uint8_t         i_addr4[IEEE80211_ADDR_LEN];
  100 } __packed;
  101 
  102 
  103 struct ieee80211_qosframe_addr4 {
  104         uint8_t         i_fc[2];
  105         uint8_t         i_dur[2];
  106         uint8_t         i_addr1[IEEE80211_ADDR_LEN];
  107         uint8_t         i_addr2[IEEE80211_ADDR_LEN];
  108         uint8_t         i_addr3[IEEE80211_ADDR_LEN];
  109         uint8_t         i_seq[2];
  110         uint8_t         i_addr4[IEEE80211_ADDR_LEN];
  111         uint8_t         i_qos[2];
  112 } __packed;
  113 
  114 #define IEEE80211_FC0_VERSION_MASK              0x03
  115 #define IEEE80211_FC0_VERSION_SHIFT             0
  116 #define IEEE80211_FC0_VERSION_0                 0x00
  117 #define IEEE80211_FC0_TYPE_MASK                 0x0c
  118 #define IEEE80211_FC0_TYPE_SHIFT                2
  119 #define IEEE80211_FC0_TYPE_MGT                  0x00
  120 #define IEEE80211_FC0_TYPE_CTL                  0x04
  121 #define IEEE80211_FC0_TYPE_DATA                 0x08
  122 
  123 #define IEEE80211_FC0_SUBTYPE_MASK              0xf0
  124 #define IEEE80211_FC0_SUBTYPE_SHIFT             4
  125 /* for TYPE_MGT */
  126 #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ         0x00
  127 #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP        0x10
  128 #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ       0x20
  129 #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP      0x30
  130 #define IEEE80211_FC0_SUBTYPE_PROBE_REQ         0x40
  131 #define IEEE80211_FC0_SUBTYPE_PROBE_RESP        0x50
  132 #define IEEE80211_FC0_SUBTYPE_TIMING_ADV        0x60
  133 #define IEEE80211_FC0_SUBTYPE_BEACON            0x80
  134 #define IEEE80211_FC0_SUBTYPE_ATIM              0x90
  135 #define IEEE80211_FC0_SUBTYPE_DISASSOC          0xa0
  136 #define IEEE80211_FC0_SUBTYPE_AUTH              0xb0
  137 #define IEEE80211_FC0_SUBTYPE_DEAUTH            0xc0
  138 #define IEEE80211_FC0_SUBTYPE_ACTION            0xd0
  139 #define IEEE80211_FC0_SUBTYPE_ACTION_NOACK      0xe0
  140 /* for TYPE_CTL */
  141 #define IEEE80211_FC0_SUBTYPE_CONTROL_WRAP      0x70
  142 #define IEEE80211_FC0_SUBTYPE_BAR               0x80
  143 #define IEEE80211_FC0_SUBTYPE_BA                0x90
  144 #define IEEE80211_FC0_SUBTYPE_PS_POLL           0xa0
  145 #define IEEE80211_FC0_SUBTYPE_RTS               0xb0
  146 #define IEEE80211_FC0_SUBTYPE_CTS               0xc0
  147 #define IEEE80211_FC0_SUBTYPE_ACK               0xd0
  148 #define IEEE80211_FC0_SUBTYPE_CF_END            0xe0
  149 #define IEEE80211_FC0_SUBTYPE_CF_END_ACK        0xf0
  150 /* for TYPE_DATA (bit combination) */
  151 #define IEEE80211_FC0_SUBTYPE_DATA              0x00
  152 #define IEEE80211_FC0_SUBTYPE_CF_ACK            0x10
  153 #define IEEE80211_FC0_SUBTYPE_CF_POLL           0x20
  154 #define IEEE80211_FC0_SUBTYPE_CF_ACPL           0x30
  155 #define IEEE80211_FC0_SUBTYPE_NODATA            0x40
  156 #define IEEE80211_FC0_SUBTYPE_CFACK             0x50
  157 #define IEEE80211_FC0_SUBTYPE_CFPOLL            0x60
  158 #define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK     0x70
  159 #define IEEE80211_FC0_SUBTYPE_QOS               0x80
  160 #define IEEE80211_FC0_SUBTYPE_QOS_NULL          0xc0
  161 
  162 #define IEEE80211_FC1_DIR_MASK                  0x03
  163 #define IEEE80211_FC1_DIR_NODS                  0x00    /* STA->STA */
  164 #define IEEE80211_FC1_DIR_TODS                  0x01    /* STA->AP  */
  165 #define IEEE80211_FC1_DIR_FROMDS                0x02    /* AP ->STA */
  166 #define IEEE80211_FC1_DIR_DSTODS                0x03    /* AP ->AP  */
  167 
  168 #define IEEE80211_IS_DSTODS(wh) \
  169         (((wh)->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS)
  170 
  171 #define IEEE80211_FC1_MORE_FRAG                 0x04
  172 #define IEEE80211_FC1_RETRY                     0x08
  173 #define IEEE80211_FC1_PWR_MGT                   0x10
  174 #define IEEE80211_FC1_MORE_DATA                 0x20
  175 #define IEEE80211_FC1_PROTECTED                 0x40
  176 #define IEEE80211_FC1_ORDER                     0x80
  177 
  178 #define IEEE80211_HAS_SEQ(type, subtype) \
  179         ((type) != IEEE80211_FC0_TYPE_CTL && \
  180         !((type) == IEEE80211_FC0_TYPE_DATA && \
  181          ((subtype) & IEEE80211_FC0_SUBTYPE_QOS_NULL) == \
  182                       IEEE80211_FC0_SUBTYPE_QOS_NULL))
  183 #define IEEE80211_SEQ_FRAG_MASK                 0x000f
  184 #define IEEE80211_SEQ_FRAG_SHIFT                0
  185 #define IEEE80211_SEQ_SEQ_MASK                  0xfff0
  186 #define IEEE80211_SEQ_SEQ_SHIFT                 4
  187 #define IEEE80211_SEQ_RANGE                     4096
  188 
  189 #define IEEE80211_SEQ_ADD(seq, incr) \
  190         (((seq) + (incr)) & (IEEE80211_SEQ_RANGE-1))
  191 #define IEEE80211_SEQ_INC(seq)  IEEE80211_SEQ_ADD(seq,1)
  192 #define IEEE80211_SEQ_SUB(a, b) \
  193         (((a) + IEEE80211_SEQ_RANGE - (b)) & (IEEE80211_SEQ_RANGE-1))
  194 
  195 #define IEEE80211_SEQ_BA_RANGE                  2048    /* 2^11 */
  196 #define IEEE80211_SEQ_BA_BEFORE(a, b) \
  197         (IEEE80211_SEQ_SUB(b, a+1) < IEEE80211_SEQ_BA_RANGE-1)
  198 
  199 #define IEEE80211_NWID_LEN                      32
  200 #define IEEE80211_MESHID_LEN                    32
  201 
  202 #define IEEE80211_QOS_TXOP                      0x00ff
  203 /* bit 8 is reserved */
  204 #define IEEE80211_QOS_AMSDU                     0x80
  205 #define IEEE80211_QOS_AMSDU_S                   7
  206 #define IEEE80211_QOS_ACKPOLICY                 0x60
  207 #define IEEE80211_QOS_ACKPOLICY_S               5
  208 #define IEEE80211_QOS_ACKPOLICY_NOACK           0x20    /* No ACK required */
  209 #define IEEE80211_QOS_ACKPOLICY_BA              0x60    /* Block ACK */
  210 #define IEEE80211_QOS_EOSP                      0x10    /* EndOfService Period*/
  211 #define IEEE80211_QOS_EOSP_S                    4
  212 #define IEEE80211_QOS_TID                       0x0f
  213 /* qos[1] byte used for all frames sent by mesh STAs in a mesh BSS */
  214 #define IEEE80211_QOS_MC                        0x01    /* Mesh control */
  215 /* Mesh power save level*/
  216 #define IEEE80211_QOS_MESH_PSL                  0x02
  217 /* Mesh Receiver Service Period Initiated */
  218 #define IEEE80211_QOS_RSPI                      0x04
  219 /* bits 11 to 15 reserved */
  220 
  221 /* does frame have QoS sequence control data */
  222 #define IEEE80211_QOS_HAS_SEQ(wh) \
  223         (((wh)->i_fc[0] & \
  224           (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \
  225           (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
  226 
  227 /*
  228  * WME/802.11e information element.
  229  */
  230 struct ieee80211_wme_info {
  231         uint8_t         wme_id;         /* IEEE80211_ELEMID_VENDOR */
  232         uint8_t         wme_len;        /* length in bytes */
  233         uint8_t         wme_oui[3];     /* 0x00, 0x50, 0xf2 */
  234         uint8_t         wme_type;       /* OUI type */
  235         uint8_t         wme_subtype;    /* OUI subtype */
  236         uint8_t         wme_version;    /* spec revision */
  237         uint8_t         wme_info;       /* QoS info */
  238 } __packed;
  239 
  240 /*
  241  * WME/802.11e Tspec Element
  242  */
  243 struct ieee80211_wme_tspec {
  244         uint8_t         ts_id;
  245         uint8_t         ts_len;
  246         uint8_t         ts_oui[3];
  247         uint8_t         ts_oui_type;
  248         uint8_t         ts_oui_subtype;
  249         uint8_t         ts_version;
  250         uint8_t         ts_tsinfo[3];
  251         uint8_t         ts_nom_msdu[2];
  252         uint8_t         ts_max_msdu[2];
  253         uint8_t         ts_min_svc[4];
  254         uint8_t         ts_max_svc[4];
  255         uint8_t         ts_inactv_intv[4];
  256         uint8_t         ts_susp_intv[4];
  257         uint8_t         ts_start_svc[4];
  258         uint8_t         ts_min_rate[4];
  259         uint8_t         ts_mean_rate[4];
  260         uint8_t         ts_max_burst[4];
  261         uint8_t         ts_min_phy[4];
  262         uint8_t         ts_peak_rate[4];
  263         uint8_t         ts_delay[4];
  264         uint8_t         ts_surplus[2];
  265         uint8_t         ts_medium_time[2];
  266 } __packed;
  267 
  268 /*
  269  * WME AC parameter field
  270  */
  271 struct ieee80211_wme_acparams {
  272         uint8_t         acp_aci_aifsn;
  273         uint8_t         acp_logcwminmax;
  274         uint16_t        acp_txop;
  275 } __packed;
  276 
  277 #define WME_NUM_AC              4       /* 4 AC categories */
  278 #define WME_NUM_TID             16      /* 16 tids */
  279 
  280 #define WME_PARAM_ACI           0x60    /* Mask for ACI field */
  281 #define WME_PARAM_ACI_S         5       /* Shift for ACI field */
  282 #define WME_PARAM_ACM           0x10    /* Mask for ACM bit */
  283 #define WME_PARAM_ACM_S         4       /* Shift for ACM bit */
  284 #define WME_PARAM_AIFSN         0x0f    /* Mask for aifsn field */
  285 #define WME_PARAM_AIFSN_S       0       /* Shift for aifsn field */
  286 #define WME_PARAM_LOGCWMIN      0x0f    /* Mask for CwMin field (in log) */
  287 #define WME_PARAM_LOGCWMIN_S    0       /* Shift for CwMin field */
  288 #define WME_PARAM_LOGCWMAX      0xf0    /* Mask for CwMax field (in log) */
  289 #define WME_PARAM_LOGCWMAX_S    4       /* Shift for CwMax field */
  290 
  291 #define WME_AC_TO_TID(_ac) (       \
  292         ((_ac) == WME_AC_VO) ? 6 : \
  293         ((_ac) == WME_AC_VI) ? 5 : \
  294         ((_ac) == WME_AC_BK) ? 1 : \
  295         0)
  296 
  297 #define TID_TO_WME_AC(_tid) (      \
  298         ((_tid) == 0 || (_tid) == 3) ? WME_AC_BE : \
  299         ((_tid) < 3) ? WME_AC_BK : \
  300         ((_tid) < 6) ? WME_AC_VI : \
  301         WME_AC_VO)
  302 
  303 /*
  304  * WME Parameter Element
  305  */
  306 struct ieee80211_wme_param {
  307         uint8_t         param_id;
  308         uint8_t         param_len;
  309         uint8_t         param_oui[3];
  310         uint8_t         param_oui_type;
  311         uint8_t         param_oui_subtype;
  312         uint8_t         param_version;
  313         uint8_t         param_qosInfo;
  314 #define WME_QOSINFO_COUNT       0x0f    /* Mask for param count field */
  315         uint8_t         param_reserved;
  316         struct ieee80211_wme_acparams   params_acParams[WME_NUM_AC];
  317 } __packed;
  318 
  319 /*
  320  * WME U-APSD qos info field defines
  321  */
  322 #define WME_CAPINFO_UAPSD_EN                    0x00000080
  323 #define WME_CAPINFO_UAPSD_VO                    0x00000001
  324 #define WME_CAPINFO_UAPSD_VI                    0x00000002
  325 #define WME_CAPINFO_UAPSD_BK                    0x00000004
  326 #define WME_CAPINFO_UAPSD_BE                    0x00000008
  327 #define WME_CAPINFO_UAPSD_ACFLAGS_SHIFT         0
  328 #define WME_CAPINFO_UAPSD_ACFLAGS_MASK          0xF
  329 #define WME_CAPINFO_UAPSD_MAXSP_SHIFT           5
  330 #define WME_CAPINFO_UAPSD_MAXSP_MASK            0x3
  331 #define WME_CAPINFO_IE_OFFSET                   8
  332 #define WME_UAPSD_MAXSP(_qosinfo)                               \
  333             (((_qosinfo) >> WME_CAPINFO_UAPSD_MAXSP_SHIFT) &    \
  334             WME_CAPINFO_UAPSD_MAXSP_MASK)
  335 #define WME_UAPSD_AC_ENABLED(_ac, _qosinfo)                     \
  336             ((1 << (3 - (_ac))) & (                             \
  337             ((_qosinfo) >> WME_CAPINFO_UAPSD_ACFLAGS_SHIFT) &   \
  338             WME_CAPINFO_UAPSD_ACFLAGS_MASK))
  339 
  340 /*
  341  * Management Notification Frame
  342  */
  343 struct ieee80211_mnf {
  344         uint8_t         mnf_category;
  345         uint8_t         mnf_action;
  346         uint8_t         mnf_dialog;
  347         uint8_t         mnf_status;
  348 } __packed;
  349 #define MNF_SETUP_REQ   0
  350 #define MNF_SETUP_RESP  1
  351 #define MNF_TEARDOWN    2
  352 
  353 /* 
  354  * 802.11n Management Action Frames 
  355  */
  356 /* generic frame format */
  357 struct ieee80211_action {
  358         uint8_t         ia_category;
  359         uint8_t         ia_action;
  360 } __packed;
  361 
  362 #define IEEE80211_ACTION_CAT_SM         0       /* Spectrum Management */
  363 #define IEEE80211_ACTION_CAT_QOS        1       /* QoS */
  364 #define IEEE80211_ACTION_CAT_DLS        2       /* DLS */
  365 #define IEEE80211_ACTION_CAT_BA         3       /* BA */
  366 #define IEEE80211_ACTION_CAT_HT         7       /* HT */
  367 #define IEEE80211_ACTION_CAT_MESH       13      /* Mesh */
  368 #define IEEE80211_ACTION_CAT_SELF_PROT  15      /* Self-protected */
  369 /* 16 - 125 reserved */
  370 #define IEEE80211_ACTION_VHT            21
  371 #define IEEE80211_ACTION_CAT_VENDOR     127     /* Vendor Specific */
  372 
  373 #define IEEE80211_ACTION_HT_TXCHWIDTH   0       /* recommended xmit chan width*/
  374 #define IEEE80211_ACTION_HT_MIMOPWRSAVE 1       /* MIMO power save */
  375 
  376 /* HT - recommended transmission channel width */
  377 struct ieee80211_action_ht_txchwidth {
  378         struct ieee80211_action at_header;
  379         uint8_t         at_chwidth;     
  380 } __packed;
  381 
  382 #define IEEE80211_A_HT_TXCHWIDTH_20     0
  383 #define IEEE80211_A_HT_TXCHWIDTH_2040   1
  384 
  385 /* HT - MIMO Power Save (NB: D2.04) */
  386 struct ieee80211_action_ht_mimopowersave {
  387         struct ieee80211_action am_header;
  388         uint8_t         am_control;
  389 } __packed;
  390 
  391 #define IEEE80211_A_HT_MIMOPWRSAVE_ENA          0x01    /* PS enabled */
  392 #define IEEE80211_A_HT_MIMOPWRSAVE_MODE         0x02
  393 #define IEEE80211_A_HT_MIMOPWRSAVE_MODE_S       1
  394 #define IEEE80211_A_HT_MIMOPWRSAVE_DYNAMIC      0x02    /* Dynamic Mode */
  395 #define IEEE80211_A_HT_MIMOPWRSAVE_STATIC       0x00    /* no SM packets */
  396 /* bits 2-7 reserved */
  397 
  398 /* Block Ack actions */
  399 #define IEEE80211_ACTION_BA_ADDBA_REQUEST       0   /* ADDBA request */
  400 #define IEEE80211_ACTION_BA_ADDBA_RESPONSE      1   /* ADDBA response */
  401 #define IEEE80211_ACTION_BA_DELBA               2   /* DELBA */
  402 
  403 /* Block Ack Parameter Set */
  404 #define IEEE80211_BAPS_BUFSIZ   0xffc0          /* buffer size */
  405 #define IEEE80211_BAPS_BUFSIZ_S 6
  406 #define IEEE80211_BAPS_TID      0x003c          /* TID */
  407 #define IEEE80211_BAPS_TID_S    2
  408 #define IEEE80211_BAPS_POLICY   0x0002          /* block ack policy */
  409 #define IEEE80211_BAPS_POLICY_S 1
  410 
  411 #define IEEE80211_BAPS_POLICY_DELAYED   (0<<IEEE80211_BAPS_POLICY_S)
  412 #define IEEE80211_BAPS_POLICY_IMMEDIATE (1<<IEEE80211_BAPS_POLICY_S)
  413 
  414 /* Block Ack Sequence Control */
  415 #define IEEE80211_BASEQ_START   0xfff0          /* starting seqnum */
  416 #define IEEE80211_BASEQ_START_S 4
  417 #define IEEE80211_BASEQ_FRAG    0x000f          /* fragment number */
  418 #define IEEE80211_BASEQ_FRAG_S  0
  419 
  420 /* Delayed Block Ack Parameter Set */
  421 #define IEEE80211_DELBAPS_TID   0xf000          /* TID */
  422 #define IEEE80211_DELBAPS_TID_S 12
  423 #define IEEE80211_DELBAPS_INIT  0x0800          /* initiator */
  424 #define IEEE80211_DELBAPS_INIT_S 11
  425 
  426 /* BA - ADDBA request */
  427 struct ieee80211_action_ba_addbarequest {
  428         struct ieee80211_action rq_header;
  429         uint8_t         rq_dialogtoken;
  430         uint16_t        rq_baparamset;
  431         uint16_t        rq_batimeout;           /* in TUs */
  432         uint16_t        rq_baseqctl;
  433 } __packed;
  434 
  435 /* BA - ADDBA response */
  436 struct ieee80211_action_ba_addbaresponse {
  437         struct ieee80211_action rs_header;
  438         uint8_t         rs_dialogtoken;
  439         uint16_t        rs_statuscode;
  440         uint16_t        rs_baparamset; 
  441         uint16_t        rs_batimeout;           /* in TUs */
  442 } __packed;
  443 
  444 /* BA - DELBA */
  445 struct ieee80211_action_ba_delba {
  446         struct ieee80211_action dl_header;
  447         uint16_t        dl_baparamset;
  448         uint16_t        dl_reasoncode;
  449 } __packed;
  450 
  451 /* BAR Control */
  452 #define IEEE80211_BAR_TID       0xf000          /* TID */
  453 #define IEEE80211_BAR_TID_S     12
  454 #define IEEE80211_BAR_COMP      0x0004          /* Compressed Bitmap */
  455 #define IEEE80211_BAR_MTID      0x0002          /* Multi-TID */
  456 #define IEEE80211_BAR_NOACK     0x0001          /* No-Ack policy */
  457 
  458 /* BAR Starting Sequence Control */
  459 #define IEEE80211_BAR_SEQ_START 0xfff0          /* starting seqnum */
  460 #define IEEE80211_BAR_SEQ_START_S       4
  461 
  462 struct ieee80211_ba_request {
  463         uint16_t        rq_barctl;
  464         uint16_t        rq_barseqctl;
  465 } __packed;
  466 
  467 /*
  468  * Control frames.
  469  */
  470 struct ieee80211_frame_min {
  471         uint8_t         i_fc[2];
  472         uint8_t         i_dur[2];
  473         uint8_t         i_addr1[IEEE80211_ADDR_LEN];
  474         uint8_t         i_addr2[IEEE80211_ADDR_LEN];
  475         /* FCS */
  476 } __packed;
  477 
  478 struct ieee80211_frame_rts {
  479         uint8_t         i_fc[2];
  480         uint8_t         i_dur[2];
  481         uint8_t         i_ra[IEEE80211_ADDR_LEN];
  482         uint8_t         i_ta[IEEE80211_ADDR_LEN];
  483         /* FCS */
  484 } __packed;
  485 
  486 struct ieee80211_frame_cts {
  487         uint8_t         i_fc[2];
  488         uint8_t         i_dur[2];
  489         uint8_t         i_ra[IEEE80211_ADDR_LEN];
  490         /* FCS */
  491 } __packed;
  492 
  493 struct ieee80211_frame_ack {
  494         uint8_t         i_fc[2];
  495         uint8_t         i_dur[2];
  496         uint8_t         i_ra[IEEE80211_ADDR_LEN];
  497         /* FCS */
  498 } __packed;
  499 
  500 struct ieee80211_frame_pspoll {
  501         uint8_t         i_fc[2];
  502         uint8_t         i_aid[2];
  503         uint8_t         i_bssid[IEEE80211_ADDR_LEN];
  504         uint8_t         i_ta[IEEE80211_ADDR_LEN];
  505         /* FCS */
  506 } __packed;
  507 
  508 struct ieee80211_frame_cfend {          /* NB: also CF-End+CF-Ack */
  509         uint8_t         i_fc[2];
  510         uint8_t         i_dur[2];       /* should be zero */
  511         uint8_t         i_ra[IEEE80211_ADDR_LEN];
  512         uint8_t         i_bssid[IEEE80211_ADDR_LEN];
  513         /* FCS */
  514 } __packed;
  515 
  516 struct ieee80211_frame_bar {
  517         uint8_t         i_fc[2];
  518         uint8_t         i_dur[2];
  519         uint8_t         i_ra[IEEE80211_ADDR_LEN];
  520         uint8_t         i_ta[IEEE80211_ADDR_LEN];
  521         uint16_t        i_ctl;
  522         uint16_t        i_seq;
  523         /* FCS */
  524 } __packed;
  525 
  526 /*
  527  * BEACON management packets
  528  *
  529  *      octet timestamp[8]
  530  *      octet beacon interval[2]
  531  *      octet capability information[2]
  532  *      information element
  533  *              octet elemid
  534  *              octet length
  535  *              octet information[length]
  536  */
  537 
  538 #define IEEE80211_BEACON_INTERVAL(beacon) \
  539         ((beacon)[8] | ((beacon)[9] << 8))
  540 #define IEEE80211_BEACON_CAPABILITY(beacon) \
  541         ((beacon)[10] | ((beacon)[11] << 8))
  542 
  543 #define IEEE80211_CAPINFO_ESS                   0x0001
  544 #define IEEE80211_CAPINFO_IBSS                  0x0002
  545 #define IEEE80211_CAPINFO_CF_POLLABLE           0x0004
  546 #define IEEE80211_CAPINFO_CF_POLLREQ            0x0008
  547 #define IEEE80211_CAPINFO_PRIVACY               0x0010
  548 #define IEEE80211_CAPINFO_SHORT_PREAMBLE        0x0020
  549 #define IEEE80211_CAPINFO_PBCC                  0x0040
  550 #define IEEE80211_CAPINFO_CHNL_AGILITY          0x0080
  551 #define IEEE80211_CAPINFO_SPECTRUM_MGMT         0x0100
  552 /* bit 9 is reserved */
  553 #define IEEE80211_CAPINFO_SHORT_SLOTTIME        0x0400
  554 #define IEEE80211_CAPINFO_RSN                   0x0800
  555 /* bit 12 is reserved */
  556 #define IEEE80211_CAPINFO_DSSSOFDM              0x2000
  557 /* bits 14-15 are reserved */
  558 
  559 #define IEEE80211_CAPINFO_BITS \
  560         "\2\1ESS\2IBSS\3CF_POLLABLE\4CF_POLLREQ\5PRIVACY\6SHORT_PREAMBLE" \
  561         "\7PBCC\10CHNL_AGILITY\11SPECTRUM_MGMT\13SHORT_SLOTTIME\14RSN" \
  562         "\16DSSOFDM"
  563 
  564 /*
  565  * 802.11i/WPA information element (maximally sized).
  566  */
  567 struct ieee80211_ie_wpa {
  568         uint8_t         wpa_id;         /* IEEE80211_ELEMID_VENDOR */
  569         uint8_t         wpa_len;        /* length in bytes */
  570         uint8_t         wpa_oui[3];     /* 0x00, 0x50, 0xf2 */
  571         uint8_t         wpa_type;       /* OUI type */
  572         uint16_t        wpa_version;    /* spec revision */
  573         uint32_t        wpa_mcipher[1]; /* multicast/group key cipher */
  574         uint16_t        wpa_uciphercnt; /* # pairwise key ciphers */
  575         uint32_t        wpa_uciphers[8];/* ciphers */
  576         uint16_t        wpa_authselcnt; /* authentication selector cnt*/
  577         uint32_t        wpa_authsels[8];/* selectors */
  578         uint16_t        wpa_caps;       /* 802.11i capabilities */
  579         uint16_t        wpa_pmkidcnt;   /* 802.11i pmkid count */
  580         uint16_t        wpa_pmkids[8];  /* 802.11i pmkids */
  581 } __packed;
  582 
  583 /*
  584  * 802.11n HT Capability IE
  585  * NB: these reflect D1.10 
  586  */
  587 struct ieee80211_ie_htcap {
  588         uint8_t         hc_id;                  /* element ID */
  589         uint8_t         hc_len;                 /* length in bytes */
  590         uint16_t        hc_cap;                 /* HT caps (see below) */
  591         uint8_t         hc_param;               /* HT params (see below) */
  592         uint8_t         hc_mcsset[16];          /* supported MCS set */
  593         uint16_t        hc_extcap;              /* extended HT capabilities */
  594         uint32_t        hc_txbf;                /* txbf capabilities */
  595         uint8_t         hc_antenna;             /* antenna capabilities */
  596 } __packed;
  597 
  598 /* HT capability flags (ht_cap) */
  599 #define IEEE80211_HTCAP_LDPC            0x0001  /* LDPC supported */
  600 #define IEEE80211_HTCAP_CHWIDTH40       0x0002  /* 20/40 supported */
  601 #define IEEE80211_HTCAP_SMPS            0x000c  /* SM Power Save mode */
  602 #define IEEE80211_HTCAP_SMPS_OFF        0x000c  /* disabled */
  603 #define IEEE80211_HTCAP_SMPS_DYNAMIC    0x0004  /* send RTS first */
  604 /* NB: SMPS value 2 is reserved */
  605 #define IEEE80211_HTCAP_SMPS_ENA        0x0000  /* enabled (static mode) */
  606 #define IEEE80211_HTCAP_GREENFIELD      0x0010  /* Greenfield supported */
  607 #define IEEE80211_HTCAP_SHORTGI20       0x0020  /* Short GI in 20MHz */
  608 #define IEEE80211_HTCAP_SHORTGI40       0x0040  /* Short GI in 40MHz */
  609 #define IEEE80211_HTCAP_TXSTBC          0x0080  /* STBC tx ok */
  610 #define IEEE80211_HTCAP_RXSTBC          0x0300  /* STBC rx support */
  611 #define IEEE80211_HTCAP_RXSTBC_S        8
  612 #define IEEE80211_HTCAP_RXSTBC_1STREAM  0x0100  /* 1 spatial stream */
  613 #define IEEE80211_HTCAP_RXSTBC_2STREAM  0x0200  /* 1-2 spatial streams*/
  614 #define IEEE80211_HTCAP_RXSTBC_3STREAM  0x0300  /* 1-3 spatial streams*/
  615 #define IEEE80211_HTCAP_DELBA           0x0400  /* HT DELBA supported */
  616 #define IEEE80211_HTCAP_MAXAMSDU        0x0800  /* max A-MSDU length */
  617 #define IEEE80211_HTCAP_MAXAMSDU_7935   0x0800  /* 7935 octets */
  618 #define IEEE80211_HTCAP_MAXAMSDU_3839   0x0000  /* 3839 octets */
  619 #define IEEE80211_HTCAP_DSSSCCK40       0x1000  /* DSSS/CCK in 40MHz */
  620 #define IEEE80211_HTCAP_PSMP            0x2000  /* PSMP supported */
  621 #define IEEE80211_HTCAP_40INTOLERANT    0x4000  /* 40MHz intolerant */
  622 #define IEEE80211_HTCAP_LSIGTXOPPROT    0x8000  /* L-SIG TXOP prot */
  623 
  624 #define IEEE80211_HTCAP_BITS \
  625         "\2\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \
  626         "\13DELBA\14AMSDU(7935)\15DSSSCCK40\16PSMP\1740INTOLERANT" \
  627         "\20LSIGTXOPPROT"
  628 
  629 /* HT parameters (hc_param) */
  630 #define IEEE80211_HTCAP_MAXRXAMPDU      0x03    /* max rx A-MPDU factor */
  631 #define IEEE80211_HTCAP_MAXRXAMPDU_S    0
  632 #define IEEE80211_HTCAP_MAXRXAMPDU_8K   0
  633 #define IEEE80211_HTCAP_MAXRXAMPDU_16K  1
  634 #define IEEE80211_HTCAP_MAXRXAMPDU_32K  2
  635 #define IEEE80211_HTCAP_MAXRXAMPDU_64K  3
  636 #define IEEE80211_HTCAP_MPDUDENSITY     0x1c    /* min MPDU start spacing */
  637 #define IEEE80211_HTCAP_MPDUDENSITY_S   2
  638 #define IEEE80211_HTCAP_MPDUDENSITY_NA  0       /* no time restriction */
  639 #define IEEE80211_HTCAP_MPDUDENSITY_025 1       /* 1/4 us */
  640 #define IEEE80211_HTCAP_MPDUDENSITY_05  2       /* 1/2 us */
  641 #define IEEE80211_HTCAP_MPDUDENSITY_1   3       /* 1 us */
  642 #define IEEE80211_HTCAP_MPDUDENSITY_2   4       /* 2 us */
  643 #define IEEE80211_HTCAP_MPDUDENSITY_4   5       /* 4 us */
  644 #define IEEE80211_HTCAP_MPDUDENSITY_8   6       /* 8 us */
  645 #define IEEE80211_HTCAP_MPDUDENSITY_16  7       /* 16 us */
  646 
  647 /* HT extended capabilities (hc_extcap) */
  648 #define IEEE80211_HTCAP_PCO             0x0001  /* PCO capable */
  649 #define IEEE80211_HTCAP_PCOTRANS        0x0006  /* PCO transition time */
  650 #define IEEE80211_HTCAP_PCOTRANS_S      1
  651 #define IEEE80211_HTCAP_PCOTRANS_04     0x0002  /* 400 us */
  652 #define IEEE80211_HTCAP_PCOTRANS_15     0x0004  /* 1.5 ms */
  653 #define IEEE80211_HTCAP_PCOTRANS_5      0x0006  /* 5 ms */
  654 /* bits 3-7 reserved */
  655 #define IEEE80211_HTCAP_MCSFBACK        0x0300  /* MCS feedback */
  656 #define IEEE80211_HTCAP_MCSFBACK_S      8
  657 #define IEEE80211_HTCAP_MCSFBACK_NONE   0x0000  /* nothing provided */
  658 #define IEEE80211_HTCAP_MCSFBACK_UNSOL  0x0200  /* unsolicited feedback */
  659 #define IEEE80211_HTCAP_MCSFBACK_MRQ    0x0300  /* " "+respond to MRQ */
  660 #define IEEE80211_HTCAP_HTC             0x0400  /* +HTC support */
  661 #define IEEE80211_HTCAP_RDR             0x0800  /* reverse direction responder*/
  662 /* bits 12-15 reserved */
  663 
  664 /*
  665  * 802.11n HT Information IE
  666  */
  667 struct ieee80211_ie_htinfo {
  668         uint8_t         hi_id;                  /* element ID */
  669         uint8_t         hi_len;                 /* length in bytes */
  670         uint8_t         hi_ctrlchannel;         /* primary channel */
  671         uint8_t         hi_byte1;               /* ht ie byte 1 */
  672         uint8_t         hi_byte2;               /* ht ie byte 2 */
  673         uint8_t         hi_byte3;               /* ht ie byte 3 */
  674         uint16_t        hi_byte45;              /* ht ie bytes 4+5 */
  675         uint8_t         hi_basicmcsset[16];     /* basic MCS set */
  676 } __packed;
  677 
  678 /* byte1 */
  679 #define IEEE80211_HTINFO_2NDCHAN        0x03    /* secondary/ext chan offset */
  680 #define IEEE80211_HTINFO_2NDCHAN_S      0
  681 #define IEEE80211_HTINFO_2NDCHAN_NONE   0x00    /* no secondary/ext channel */
  682 #define IEEE80211_HTINFO_2NDCHAN_ABOVE  0x01    /* above private channel */
  683 /* NB: 2 is reserved */
  684 #define IEEE80211_HTINFO_2NDCHAN_BELOW  0x03    /* below primary channel */ 
  685 #define IEEE80211_HTINFO_TXWIDTH        0x04    /* tx channel width */
  686 #define IEEE80211_HTINFO_TXWIDTH_20     0x00    /* 20MHz width */
  687 #define IEEE80211_HTINFO_TXWIDTH_2040   0x04    /* any supported width */
  688 #define IEEE80211_HTINFO_RIFSMODE       0x08    /* Reduced IFS (RIFS) use */
  689 #define IEEE80211_HTINFO_RIFSMODE_PROH  0x00    /* RIFS use prohibited */
  690 #define IEEE80211_HTINFO_RIFSMODE_PERM  0x08    /* RIFS use permitted */
  691 #define IEEE80211_HTINFO_PMSPONLY       0x10    /* PSMP required to associate */
  692 #define IEEE80211_HTINFO_SIGRAN         0xe0    /* shortest Service Interval */
  693 #define IEEE80211_HTINFO_SIGRAN_S       5
  694 #define IEEE80211_HTINFO_SIGRAN_5       0x00    /* 5 ms */
  695 /* XXX add rest */
  696 
  697 /* bytes 2+3 */
  698 #define IEEE80211_HTINFO_OPMODE         0x03    /* operating mode */
  699 #define IEEE80211_HTINFO_OPMODE_S       0
  700 #define IEEE80211_HTINFO_OPMODE_PURE    0x00    /* no protection */
  701 #define IEEE80211_HTINFO_OPMODE_PROTOPT 0x01    /* protection optional */
  702 #define IEEE80211_HTINFO_OPMODE_HT20PR  0x02    /* protection for HT20 sta's */
  703 #define IEEE80211_HTINFO_OPMODE_MIXED   0x03    /* protection for legacy sta's*/
  704 #define IEEE80211_HTINFO_NONGF_PRESENT  0x04    /* non-GF sta's present */
  705 #define IEEE80211_HTINFO_TXBL           0x08    /* transmit burst limit */
  706 #define IEEE80211_HTINFO_NONHT_PRESENT  0x10    /* non-HT sta's present */
  707 /* bits 5-15 reserved */
  708 
  709 /* bytes 4+5 */
  710 #define IEEE80211_HTINFO_2NDARYBEACON   0x01
  711 #define IEEE80211_HTINFO_LSIGTXOPPROT   0x02
  712 #define IEEE80211_HTINFO_PCO_ACTIVE     0x04
  713 #define IEEE80211_HTINFO_40MHZPHASE     0x08
  714 
  715 /* byte5 */
  716 #define IEEE80211_HTINFO_BASIC_STBCMCS  0x7f
  717 #define IEEE80211_HTINFO_BASIC_STBCMCS_S 0
  718 #define IEEE80211_HTINFO_DUALPROTECTED  0x80
  719 
  720 
  721 /*
  722  * 802.11ac definitions - 802.11ac-2013 .
  723  */
  724 
  725 /* VHT opmode bits */
  726 #define IEEE80211_VHT_OPMODE_CHANWIDTH_MASK     3
  727 #define IEEE80211_VHT_OPMODE_CHANWIDTH_20MHZ    0
  728 #define IEEE80211_VHT_OPMODE_CHANWIDTH_40MHZ    1
  729 #define IEEE80211_VHT_OPMODE_CHANWIDTH_80MHZ    2
  730 #define IEEE80211_VHT_OPMODE_CHANWIDTH_160MHZ   3
  731 #define IEEE80211_VHT_OPMODE_RX_NSS_MASK        0x70
  732 #define IEEE80211_VHT_OPMODE_RX_NSS_SHIFT       4
  733 #define IEEE80211_VHT_OPMODE_RX_NSS_TYPE_BF     0x80
  734 
  735 /*
  736  * Maximum length of A-MPDU that the STA can RX in VHT.
  737  * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
  738  */
  739 #define IEEE80211_VHTCAP_MAX_AMPDU_8K           0
  740 #define IEEE80211_VHTCAP_MAX_AMPDU_16K          1
  741 #define IEEE80211_VHTCAP_MAX_AMPDU_32K          2
  742 #define IEEE80211_VHTCAP_MAX_AMPDU_64K          3
  743 #define IEEE80211_VHTCAP_MAX_AMPDU_128K         4
  744 #define IEEE80211_VHTCAP_MAX_AMPDU_256K         5
  745 #define IEEE80211_VHTCAP_MAX_AMPDU_512K         6
  746 #define IEEE80211_VHTCAP_MAX_AMPDU_1024K        7
  747 
  748 /*
  749  * VHT MCS information.
  750  * + rx_highest/tx_highest: optional; maximum long GI VHT PPDU
  751  *    data rate.  1Mbit/sec units.
  752  * + rx_mcs_map/tx_mcs_map: bitmap of per-stream supported MCS;
  753  *    2 bits each.
  754  */
  755 #define IEEE80211_VHT_MCS_SUPPORT_0_7           0       /* MCS0-7 */
  756 #define IEEE80211_VHT_MCS_SUPPORT_0_8           1       /* MCS0-8 */
  757 #define IEEE80211_VHT_MCS_SUPPORT_0_9           2       /* MCS0-9 */
  758 #define IEEE80211_VHT_MCS_NOT_SUPPORTED         3       /* not supported */
  759 
  760 struct ieee80211_vht_mcs_info {
  761         uint16_t rx_mcs_map;
  762         uint16_t rx_highest;
  763         uint16_t tx_mcs_map;
  764         uint16_t tx_highest;
  765 } __packed;
  766 
  767 /* VHT capabilities element: 802.11ac-2013 8.4.2.160 */
  768 struct ieee80211_ie_vhtcap {
  769         uint8_t ie;
  770         uint8_t len;
  771         uint32_t vht_cap_info;
  772         struct ieee80211_vht_mcs_info supp_mcs;
  773 } __packed;
  774 
  775 #define IEEE80211_VHT_CHANWIDTH_USE_HT          0       /* Use HT IE for chw */
  776 #define IEEE80211_VHT_CHANWIDTH_80MHZ           1       /* 80MHz */
  777 #define IEEE80211_VHT_CHANWIDTH_160MHZ          2       /* 160MHz */
  778 #define IEEE80211_VHT_CHANWIDTH_80P80MHZ        3       /* 80+80MHz */
  779 
  780 /* VHT operation IE - 802.11ac-2013 8.4.2.161 */
  781 struct ieee80211_ie_vht_operation {
  782         uint8_t ie;
  783         uint8_t len;
  784         uint8_t chan_width;
  785         uint8_t center_freq_seg1_idx;
  786         uint8_t center_freq_seg2_idx;
  787         uint16_t basic_mcs_set;
  788 } __packed;
  789 
  790 /* 802.11ac VHT Capabilities */
  791 #define IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895   0x00000000
  792 #define IEEE80211_VHTCAP_MAX_MPDU_LENGTH_7991   0x00000001
  793 #define IEEE80211_VHTCAP_MAX_MPDU_LENGTH_11454  0x00000002
  794 #define IEEE80211_VHTCAP_MAX_MPDU_MASK          0x00000003
  795 #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004
  796 #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ        0x00000008
  797 #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK   0x0000000C
  798 #define IEEE80211_VHTCAP_RXLDPC         0x00000010
  799 #define IEEE80211_VHTCAP_SHORT_GI_80            0x00000020
  800 #define IEEE80211_VHTCAP_SHORT_GI_160           0x00000040
  801 #define IEEE80211_VHTCAP_TXSTBC         0x00000080
  802 #define IEEE80211_VHTCAP_RXSTBC_1               0x00000100
  803 #define IEEE80211_VHTCAP_RXSTBC_2               0x00000200
  804 #define IEEE80211_VHTCAP_RXSTBC_3               0x00000300
  805 #define IEEE80211_VHTCAP_RXSTBC_4               0x00000400
  806 #define IEEE80211_VHTCAP_RXSTBC_MASK            0x00000700
  807 #define IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE  0x00000800
  808 #define IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE  0x00001000
  809 #define IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT   13
  810 #define IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK \
  811             (7 << IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT)
  812 #define IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT      16
  813 #define IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK \
  814             (7 << IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT)
  815 #define IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE  0x00080000
  816 #define IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE  0x00100000
  817 #define IEEE80211_VHTCAP_VHT_TXOP_PS            0x00200000
  818 #define IEEE80211_VHTCAP_HTC_VHT                0x00400000
  819 #define IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT       23
  820 #define IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \
  821             (7 << IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT)
  822 #define IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB      0x08000000
  823 #define IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB        0x0c000000
  824 #define IEEE80211_VHTCAP_RX_ANTENNA_PATTERN     0x10000000
  825 #define IEEE80211_VHTCAP_TX_ANTENNA_PATTERN     0x20000000
  826 
  827 /*
  828  * VHT Transmit Power Envelope element - 802.11ac-2013 8.4.2.164
  829  *
  830  * This defines the maximum transmit power for various bandwidths.
  831  */
  832 /*
  833  * Count is how many elements follow and what they're for:
  834  *
  835  * 0 - 20 MHz
  836  * 1 - 20+40 MHz
  837  * 2 - 20+40+80 MHz
  838  * 3 - 20+40+80+(160, 80+80) MHz
  839  */
  840 #define IEEE80211_VHT_TXPWRENV_INFO_COUNT_SHIFT 0
  841 #define IEEE80211_VHT_TXPWRENV_INFO_COUNT_MASK  0x07
  842 
  843 /*
  844  * Unit is the tx power representation.  It should be EIRP for now;
  845  * other values are reserved.
  846  */
  847 #define IEEE80211_VHT_TXPWRENV_UNIT_MASK        0x38
  848 #define IEEE80211_VHT_TXPWRENV_UNIT_SHIFT       3
  849 
  850 /* This value is within the unit mask/shift above */
  851 #define IEEE80211_VHT_TXPWRENV_UNIT_EIRP        0
  852 
  853 struct ieee80211_ie_vht_txpwrenv {
  854         uint8_t ie;
  855         uint8_t len;
  856         uint8_t tx_info;
  857         int8_t tx_elem[0];      /* TX power elements, 1/2 dB, signed */
  858 };
  859 
  860 /* VHT action codes */
  861 #define WLAN_ACTION_VHT_COMPRESSED_BF           0
  862 #define WLAN_ACTION_VHT_GROUPID_MGMT            1
  863 #define WLAN_ACTION_VHT_OPMODE_NOTIF            2
  864 
  865 /*
  866  * Management information element payloads.
  867  */
  868 
  869 enum {
  870         IEEE80211_ELEMID_SSID           = 0,
  871         IEEE80211_ELEMID_RATES          = 1,
  872         IEEE80211_ELEMID_FHPARMS        = 2,
  873         IEEE80211_ELEMID_DSPARMS        = 3,
  874         IEEE80211_ELEMID_CFPARMS        = 4,
  875         IEEE80211_ELEMID_TIM            = 5,
  876         IEEE80211_ELEMID_IBSSPARMS      = 6,
  877         IEEE80211_ELEMID_COUNTRY        = 7,
  878         IEEE80211_ELEMID_BSSLOAD        = 11,
  879         IEEE80211_ELEMID_TSPEC          = 13,
  880         IEEE80211_ELEMID_TCLAS          = 14,
  881         IEEE80211_ELEMID_CHALLENGE      = 16,
  882         /* 17-31 reserved for challenge text extension */
  883         IEEE80211_ELEMID_PWRCNSTR       = 32,
  884         IEEE80211_ELEMID_PWRCAP         = 33,
  885         IEEE80211_ELEMID_TPCREQ         = 34,
  886         IEEE80211_ELEMID_TPCREP         = 35,
  887         IEEE80211_ELEMID_SUPPCHAN       = 36,
  888         IEEE80211_ELEMID_CSA            = 37,
  889         IEEE80211_ELEMID_MEASREQ        = 38,
  890         IEEE80211_ELEMID_MEASREP        = 39,
  891         IEEE80211_ELEMID_QUIET          = 40,
  892         IEEE80211_ELEMID_IBSSDFS        = 41,
  893         IEEE80211_ELEMID_ERP            = 42,
  894         IEEE80211_ELEMID_HTCAP          = 45,
  895         IEEE80211_ELEMID_QOS            = 46,
  896         IEEE80211_ELEMID_RSN            = 48,
  897         IEEE80211_ELEMID_XRATES         = 50,
  898         IEEE80211_ELEMID_APCHANREP      = 51,
  899         IEEE80211_ELEMID_HTINFO         = 61,
  900         IEEE80211_ELEMID_SECCHAN_OFFSET = 62,
  901         IEEE80211_ELEMID_RRM_ENACAPS    = 70,
  902         IEEE80211_ELEMID_MULTIBSSID     = 71,
  903         IEEE80211_ELEMID_COEX_2040      = 72,
  904         IEEE80211_ELEMID_INTOL_CHN_REPORT       = 73,
  905         IEEE80211_ELEMID_OVERLAP_BSS_SCAN_PARAM = 74,
  906         IEEE80211_ELEMID_TSF_REQ        = 91,
  907         IEEE80211_ELEMID_TSF_RESP       = 92,
  908         IEEE80211_ELEMID_WNM_SLEEP_MODE = 93,
  909         IEEE80211_ELEMID_TIM_BCAST_REQ  = 94,
  910         IEEE80211_ELEMID_TIM_BCAST_RESP = 95,
  911         IEEE80211_ELEMID_TPC            = 150,
  912         IEEE80211_ELEMID_CCKM           = 156,
  913         IEEE80211_ELEMID_VENDOR         = 221,  /* vendor private */
  914 
  915         /*
  916          * 802.11s IEs
  917          * NB: On vanilla Linux still IEEE80211_ELEMID_MESHPEER = 55,
  918          * but they defined a new with id 117 called PEER_MGMT.
  919          * NB: complies with open80211
  920          */
  921         IEEE80211_ELEMID_MESHCONF       = 113,
  922         IEEE80211_ELEMID_MESHID         = 114,
  923         IEEE80211_ELEMID_MESHLINK       = 115,
  924         IEEE80211_ELEMID_MESHCNGST      = 116,
  925         IEEE80211_ELEMID_MESHPEER       = 117,
  926         IEEE80211_ELEMID_MESHCSA        = 118,
  927         IEEE80211_ELEMID_MESHTIM        = 39, /* XXX: remove */
  928         IEEE80211_ELEMID_MESHAWAKEW     = 119,
  929         IEEE80211_ELEMID_MESHBEACONT    = 120,
  930         /* 121-124 MMCAOP not implemented yet */
  931         IEEE80211_ELEMID_MESHGANN       = 125,
  932         IEEE80211_ELEMID_MESHRANN       = 126,
  933         /* 127 Extended Capabilities */
  934         IEEE80211_ELEMID_EXTCAP         = 127,
  935         /* 128-129 reserved */
  936         IEEE80211_ELEMID_MESHPREQ       = 130,
  937         IEEE80211_ELEMID_MESHPREP       = 131,
  938         IEEE80211_ELEMID_MESHPERR       = 132,
  939         /* 133-136 reserved */
  940         IEEE80211_ELEMID_MESHPXU        = 137,
  941         IEEE80211_ELEMID_MESHPXUC       = 138,
  942         IEEE80211_ELEMID_MESHAH         = 60, /* XXX: remove */
  943 
  944         /* 802.11ac */
  945         IEEE80211_ELEMID_VHT_CAP        = 191,
  946         IEEE80211_ELEMID_VHT_OPMODE     = 192,
  947         IEEE80211_ELEMID_VHT_PWR_ENV    = 195,
  948 };
  949 
  950 struct ieee80211_tim_ie {
  951         uint8_t         tim_ie;                 /* IEEE80211_ELEMID_TIM */
  952         uint8_t         tim_len;
  953         uint8_t         tim_count;              /* DTIM count */
  954         uint8_t         tim_period;             /* DTIM period */
  955         uint8_t         tim_bitctl;             /* bitmap control */
  956         uint8_t         tim_bitmap[1];          /* variable-length bitmap */
  957 } __packed;
  958 
  959 struct ieee80211_country_ie {
  960         uint8_t         ie;                     /* IEEE80211_ELEMID_COUNTRY */
  961         uint8_t         len;
  962         uint8_t         cc[3];                  /* ISO CC+(I)ndoor/(O)utdoor */
  963         struct {
  964                 uint8_t schan;                  /* starting channel */
  965                 uint8_t nchan;                  /* number channels */
  966                 uint8_t maxtxpwr;               /* tx power cap */
  967         } __packed band[1];                     /* sub bands (NB: var size) */
  968 } __packed;
  969 
  970 #define IEEE80211_COUNTRY_MAX_BANDS     84      /* max possible bands */
  971 #define IEEE80211_COUNTRY_MAX_SIZE \
  972         (sizeof(struct ieee80211_country_ie) + 3*(IEEE80211_COUNTRY_MAX_BANDS-1))
  973 
  974 struct ieee80211_bss_load_ie {
  975         uint8_t         ie;
  976         uint8_t         len;
  977         uint16_t        sta_count;      /* station count */
  978         uint8_t         chan_load;      /* channel utilization */
  979         uint8_t         aac;            /* available admission capacity */
  980 } __packed;
  981 
  982 struct ieee80211_ap_chan_report_ie {
  983         uint8_t         ie;
  984         uint8_t         len;
  985         uint8_t         i_class; /* operating class */
  986         /* Annex E, E.1 Country information and operating classes */
  987         uint8_t         chan_list[0];
  988 } __packed;
  989 
  990 #define IEEE80211_EXTCAP_CMS                    (1ULL <<  0) /* 20/40 BSS coexistence management support */
  991 #define IEEE80211_EXTCAP_RSVD_1                 (1ULL <<  1)
  992 #define IEEE80211_EXTCAP_ECS                    (1ULL <<  2) /* extended channel switching */
  993 #define IEEE80211_EXTCAP_RSVD_3                 (1ULL <<  3)
  994 #define IEEE80211_EXTCAP_PSMP_CAP               (1ULL <<  4) /* PSMP capability */
  995 #define IEEE80211_EXTCAP_RSVD_5                 (1ULL <<  5)
  996 #define IEEE80211_EXTCAP_S_PSMP_SUPP            (1ULL <<  6)
  997 #define IEEE80211_EXTCAP_EVENT                  (1ULL <<  7)
  998 #define IEEE80211_EXTCAP_DIAGNOSTICS            (1ULL <<  8)
  999 #define IEEE80211_EXTCAP_MCAST_DIAG             (1ULL <<  9)
 1000 #define IEEE80211_EXTCAP_LOC_TRACKING           (1ULL << 10)
 1001 #define IEEE80211_EXTCAP_FMS                    (1ULL << 11)
 1002 #define IEEE80211_EXTCAP_PROXY_ARP              (1ULL << 12)
 1003 #define IEEE80211_EXTCAP_CIR                    (1ULL << 13) /* collocated interference reporting */
 1004 #define IEEE80211_EXTCAP_CIVIC_LOC              (1ULL << 14)
 1005 #define IEEE80211_EXTCAP_GEOSPATIAL_LOC         (1ULL << 15)
 1006 #define IEEE80211_EXTCAP_TFS                    (1ULL << 16)
 1007 #define IEEE80211_EXTCAP_WNM_SLEEPMODE          (1ULL << 17)
 1008 #define IEEE80211_EXTCAP_TIM_BROADCAST          (1ULL << 18)
 1009 #define IEEE80211_EXTCAP_BSS_TRANSITION         (1ULL << 19)
 1010 #define IEEE80211_EXTCAP_QOS_TRAF_CAP           (1ULL << 20)
 1011 #define IEEE80211_EXTCAP_AC_STA_COUNT           (1ULL << 21)
 1012 #define IEEE80211_EXTCAP_M_BSSID                (1ULL << 22) /* multiple BSSID field */
 1013 #define IEEE80211_EXTCAP_TIMING_MEAS            (1ULL << 23)
 1014 #define IEEE80211_EXTCAP_CHAN_USAGE             (1ULL << 24)
 1015 #define IEEE80211_EXTCAP_SSID_LIST              (1ULL << 25)
 1016 #define IEEE80211_EXTCAP_DMS                    (1ULL << 26)
 1017 #define IEEE80211_EXTCAP_UTC_TSF_OFFSET         (1ULL << 27)
 1018 #define IEEE80211_EXTCAP_TLDS_BUF_STA_SUPP      (1ULL << 28) /* TDLS peer U-APSP buffer STA support */
 1019 #define IEEE80211_EXTCAP_TLDS_PPSM_SUPP         (1ULL << 29) /* TDLS peer PSM support */
 1020 #define IEEE80211_EXTCAP_TLDS_CH_SW             (1ULL << 30) /* TDLS channel switching */
 1021 #define IEEE80211_EXTCAP_INTERWORKING           (1ULL << 31)
 1022 #define IEEE80211_EXTCAP_QOSMAP                 (1ULL << 32)
 1023 #define IEEE80211_EXTCAP_EBR                    (1ULL << 33)
 1024 #define IEEE80211_EXTCAP_SSPN_IF                (1ULL << 34)
 1025 #define IEEE80211_EXTCAP_RSVD_35                (1ULL << 35)
 1026 #define IEEE80211_EXTCAP_MSGCF_CAP              (1ULL << 36)
 1027 #define IEEE80211_EXTCAP_TLDS_SUPP              (1ULL << 37)
 1028 #define IEEE80211_EXTCAP_TLDS_PROHIB            (1ULL << 38)
 1029 #define IEEE80211_EXTCAP_TLDS_CH_SW_PROHIB      (1ULL << 39) /* TDLS channel switching prohibited */
 1030 #define IEEE80211_EXTCAP_RUF                    (1ULL << 40) /* reject unadmitted frame */
 1031 /* service interval granularity */
 1032 #define IEEE80211_EXTCAP_SIG \
 1033                                 ((1ULL << 41) | (1ULL << 42) | (1ULL << 43))
 1034 #define IEEE80211_EXTCAP_ID_LOC                 (1ULL << 44)
 1035 #define IEEE80211_EXTCAP_U_APSD_COEX            (1ULL << 45)
 1036 #define IEEE80211_EXTCAP_WNM_NOTIFICATION       (1ULL << 46)
 1037 #define IEEE80211_EXTCAP_RSVD_47                (1ULL << 47)
 1038 #define IEEE80211_EXTCAP_SSID                   (1ULL << 48) /* UTF-8 SSID */
 1039 /* bits 49-n are reserved */
 1040 
 1041 struct ieee80211_extcap_ie {
 1042         uint8_t         ie;
 1043         uint8_t         len;
 1044 } __packed;
 1045 
 1046 /*
 1047  * 802.11h Quiet Time Element.
 1048  */
 1049 struct ieee80211_quiet_ie {
 1050         uint8_t         quiet_ie;               /* IEEE80211_ELEMID_QUIET */
 1051         uint8_t         len;
 1052         uint8_t         tbttcount;              /* quiet start */
 1053         uint8_t         period;                 /* beacon intervals between quiets */
 1054         uint16_t        duration;               /* TUs of each quiet*/
 1055         uint16_t        offset;                 /* TUs of from TBTT of quiet start */
 1056 } __packed;
 1057 
 1058 /*
 1059  * 802.11h Channel Switch Announcement (CSA).
 1060  */
 1061 struct ieee80211_csa_ie {
 1062         uint8_t         csa_ie;         /* IEEE80211_ELEMID_CHANSWITCHANN */
 1063         uint8_t         csa_len;
 1064         uint8_t         csa_mode;               /* Channel Switch Mode */
 1065         uint8_t         csa_newchan;            /* New Channel Number */
 1066         uint8_t         csa_count;              /* Channel Switch Count */
 1067 } __packed;
 1068 
 1069 /*
 1070  * Note the min acceptable CSA count is used to guard against
 1071  * malicious CSA injection in station mode.  Defining this value
 1072  * as other than 0 violates the 11h spec.
 1073  */
 1074 #define IEEE80211_CSA_COUNT_MIN 2
 1075 #define IEEE80211_CSA_COUNT_MAX 255
 1076 
 1077 /* rate set entries are in .5 Mb/s units, and potentially marked as basic */
 1078 #define IEEE80211_RATE_BASIC            0x80
 1079 #define IEEE80211_RATE_VAL              0x7f
 1080 #define IEEE80211_RV(v)                 ((v) & IEEE80211_RATE_VAL)
 1081 
 1082 /* ERP information element flags */
 1083 #define IEEE80211_ERP_NON_ERP_PRESENT   0x01
 1084 #define IEEE80211_ERP_USE_PROTECTION    0x02
 1085 #define IEEE80211_ERP_LONG_PREAMBLE     0x04
 1086 
 1087 #define IEEE80211_ERP_BITS \
 1088         "\2\1NON_ERP_PRESENT\2USE_PROTECTION\3LONG_PREAMBLE"
 1089 
 1090 #define ATH_OUI                 0x7f0300        /* Atheros OUI */
 1091 #define ATH_OUI_TYPE            0x01            /* Atheros protocol ie */
 1092 
 1093 /* NB: Atheros allocated the OUI for this purpose ~2005 but beware ... */
 1094 #define TDMA_OUI                ATH_OUI
 1095 #define TDMA_OUI_TYPE           0x02            /* TDMA protocol ie */
 1096 
 1097 #define BCM_OUI                 0x4c9000        /* Broadcom OUI */
 1098 #define BCM_OUI_HTCAP           51              /* pre-draft HTCAP ie */
 1099 #define BCM_OUI_HTINFO          52              /* pre-draft HTINFO ie */
 1100 
 1101 #define WPA_OUI                 0xf25000
 1102 #define WPA_OUI_TYPE            0x01
 1103 #define WPA_VERSION             1               /* current supported version */
 1104 
 1105 #define WPA_CSE_NULL            0x00
 1106 #define WPA_CSE_WEP40           0x01
 1107 #define WPA_CSE_TKIP            0x02
 1108 #define WPA_CSE_CCMP            0x04
 1109 #define WPA_CSE_WEP104          0x05
 1110 
 1111 #define WPA_ASE_NONE            0x00
 1112 #define WPA_ASE_8021X_UNSPEC    0x01
 1113 #define WPA_ASE_8021X_PSK       0x02
 1114 
 1115 #define WPS_OUI_TYPE            0x04
 1116 
 1117 #define RSN_OUI                 0xac0f00
 1118 #define RSN_VERSION             1               /* current supported version */
 1119 
 1120 #define RSN_CSE_NULL            0x00
 1121 #define RSN_CSE_WEP40           0x01
 1122 #define RSN_CSE_TKIP            0x02
 1123 #define RSN_CSE_WRAP            0x03
 1124 #define RSN_CSE_CCMP            0x04
 1125 #define RSN_CSE_WEP104          0x05
 1126 
 1127 #define RSN_ASE_NONE            0x00
 1128 #define RSN_ASE_8021X_UNSPEC    0x01
 1129 #define RSN_ASE_8021X_PSK       0x02
 1130 
 1131 #define RSN_CAP_PREAUTH         0x01
 1132 
 1133 #define WME_OUI                 0xf25000
 1134 #define WME_OUI_TYPE            0x02
 1135 #define WME_INFO_OUI_SUBTYPE    0x00
 1136 #define WME_PARAM_OUI_SUBTYPE   0x01
 1137 #define WME_VERSION             1
 1138 
 1139 /* WME stream classes */
 1140 #define WME_AC_BE       0               /* best effort */
 1141 #define WME_AC_BK       1               /* background */
 1142 #define WME_AC_VI       2               /* video */
 1143 #define WME_AC_VO       3               /* voice */
 1144 
 1145 /*
 1146  * AUTH management packets
 1147  *
 1148  *      octet algo[2]
 1149  *      octet seq[2]
 1150  *      octet status[2]
 1151  *      octet chal.id
 1152  *      octet chal.length
 1153  *      octet chal.text[253]            NB: 1-253 bytes
 1154  */
 1155 
 1156 /* challenge length for shared key auth */
 1157 #define IEEE80211_CHALLENGE_LEN         128
 1158 
 1159 #define IEEE80211_AUTH_ALG_OPEN         0x0000
 1160 #define IEEE80211_AUTH_ALG_SHARED       0x0001
 1161 #define IEEE80211_AUTH_ALG_LEAP         0x0080
 1162 
 1163 enum {
 1164         IEEE80211_AUTH_OPEN_REQUEST             = 1,
 1165         IEEE80211_AUTH_OPEN_RESPONSE            = 2,
 1166 };
 1167 
 1168 enum {
 1169         IEEE80211_AUTH_SHARED_REQUEST           = 1,
 1170         IEEE80211_AUTH_SHARED_CHALLENGE         = 2,
 1171         IEEE80211_AUTH_SHARED_RESPONSE          = 3,
 1172         IEEE80211_AUTH_SHARED_PASS              = 4,
 1173 };
 1174 
 1175 /*
 1176  * Reason and status codes.
 1177  *
 1178  * Reason codes are used in management frames to indicate why an
 1179  * action took place (e.g. on disassociation).  Status codes are
 1180  * used in management frames to indicate the result of an operation.
 1181  *
 1182  * Unlisted codes are reserved
 1183  */
 1184 
 1185 enum {
 1186         IEEE80211_REASON_UNSPECIFIED            = 1,
 1187         IEEE80211_REASON_AUTH_EXPIRE            = 2,
 1188         IEEE80211_REASON_AUTH_LEAVE             = 3,
 1189         IEEE80211_REASON_ASSOC_EXPIRE           = 4,
 1190         IEEE80211_REASON_ASSOC_TOOMANY          = 5,
 1191         IEEE80211_REASON_NOT_AUTHED             = 6,
 1192         IEEE80211_REASON_NOT_ASSOCED            = 7,
 1193         IEEE80211_REASON_ASSOC_LEAVE            = 8,
 1194         IEEE80211_REASON_ASSOC_NOT_AUTHED       = 9,
 1195         IEEE80211_REASON_DISASSOC_PWRCAP_BAD    = 10,   /* 11h */
 1196         IEEE80211_REASON_DISASSOC_SUPCHAN_BAD   = 11,   /* 11h */
 1197         IEEE80211_REASON_IE_INVALID             = 13,   /* 11i */
 1198         IEEE80211_REASON_MIC_FAILURE            = 14,   /* 11i */
 1199         IEEE80211_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,   /* 11i */
 1200         IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, /* 11i */
 1201         IEEE80211_REASON_IE_IN_4WAY_DIFFERS     = 17,   /* 11i */
 1202         IEEE80211_REASON_GROUP_CIPHER_INVALID   = 18,   /* 11i */
 1203         IEEE80211_REASON_PAIRWISE_CIPHER_INVALID= 19,   /* 11i */
 1204         IEEE80211_REASON_AKMP_INVALID           = 20,   /* 11i */
 1205         IEEE80211_REASON_UNSUPP_RSN_IE_VERSION  = 21,   /* 11i */
 1206         IEEE80211_REASON_INVALID_RSN_IE_CAP     = 22,   /* 11i */
 1207         IEEE80211_REASON_802_1X_AUTH_FAILED     = 23,   /* 11i */
 1208         IEEE80211_REASON_CIPHER_SUITE_REJECTED  = 24,   /* 11i */
 1209         IEEE80211_REASON_UNSPECIFIED_QOS        = 32,   /* 11e */
 1210         IEEE80211_REASON_INSUFFICIENT_BW        = 33,   /* 11e */
 1211         IEEE80211_REASON_TOOMANY_FRAMES         = 34,   /* 11e */
 1212         IEEE80211_REASON_OUTSIDE_TXOP           = 35,   /* 11e */
 1213         IEEE80211_REASON_LEAVING_QBSS           = 36,   /* 11e */
 1214         IEEE80211_REASON_BAD_MECHANISM          = 37,   /* 11e */
 1215         IEEE80211_REASON_SETUP_NEEDED           = 38,   /* 11e */
 1216         IEEE80211_REASON_TIMEOUT                = 39,   /* 11e */
 1217 
 1218         IEEE80211_REASON_PEER_LINK_CANCELED     = 52,   /* 11s */
 1219         IEEE80211_REASON_MESH_MAX_PEERS         = 53,   /* 11s */
 1220         IEEE80211_REASON_MESH_CPVIOLATION       = 54,   /* 11s */
 1221         IEEE80211_REASON_MESH_CLOSE_RCVD        = 55,   /* 11s */
 1222         IEEE80211_REASON_MESH_MAX_RETRIES       = 56,   /* 11s */
 1223         IEEE80211_REASON_MESH_CONFIRM_TIMEOUT   = 57,   /* 11s */
 1224         IEEE80211_REASON_MESH_INVALID_GTK       = 58,   /* 11s */
 1225         IEEE80211_REASON_MESH_INCONS_PARAMS     = 59,   /* 11s */
 1226         IEEE80211_REASON_MESH_INVALID_SECURITY  = 60,   /* 11s */
 1227         IEEE80211_REASON_MESH_PERR_NO_PROXY     = 61,   /* 11s */
 1228         IEEE80211_REASON_MESH_PERR_NO_FI        = 62,   /* 11s */
 1229         IEEE80211_REASON_MESH_PERR_DEST_UNREACH = 63,   /* 11s */
 1230         IEEE80211_REASON_MESH_MAC_ALRDY_EXISTS_MBSS = 64, /* 11s */
 1231         IEEE80211_REASON_MESH_CHAN_SWITCH_REG   = 65,   /* 11s */
 1232         IEEE80211_REASON_MESH_CHAN_SWITCH_UNSPEC = 66,  /* 11s */
 1233 
 1234         IEEE80211_STATUS_SUCCESS                = 0,
 1235         IEEE80211_STATUS_UNSPECIFIED            = 1,
 1236         IEEE80211_STATUS_CAPINFO                = 10,
 1237         IEEE80211_STATUS_NOT_ASSOCED            = 11,
 1238         IEEE80211_STATUS_OTHER                  = 12,
 1239         IEEE80211_STATUS_ALG                    = 13,
 1240         IEEE80211_STATUS_SEQUENCE               = 14,
 1241         IEEE80211_STATUS_CHALLENGE              = 15,
 1242         IEEE80211_STATUS_TIMEOUT                = 16,
 1243         IEEE80211_STATUS_TOOMANY                = 17,
 1244         IEEE80211_STATUS_BASIC_RATE             = 18,
 1245         IEEE80211_STATUS_SP_REQUIRED            = 19,   /* 11b */
 1246         IEEE80211_STATUS_PBCC_REQUIRED          = 20,   /* 11b */
 1247         IEEE80211_STATUS_CA_REQUIRED            = 21,   /* 11b */
 1248         IEEE80211_STATUS_SPECMGMT_REQUIRED      = 22,   /* 11h */
 1249         IEEE80211_STATUS_PWRCAP_REQUIRED        = 23,   /* 11h */
 1250         IEEE80211_STATUS_SUPCHAN_REQUIRED       = 24,   /* 11h */
 1251         IEEE80211_STATUS_SHORTSLOT_REQUIRED     = 25,   /* 11g */
 1252         IEEE80211_STATUS_DSSSOFDM_REQUIRED      = 26,   /* 11g */
 1253         IEEE80211_STATUS_MISSING_HT_CAPS        = 27,   /* 11n D3.0 */
 1254         IEEE80211_STATUS_INVALID_IE             = 40,   /* 11i */
 1255         IEEE80211_STATUS_GROUP_CIPHER_INVALID   = 41,   /* 11i */
 1256         IEEE80211_STATUS_PAIRWISE_CIPHER_INVALID = 42,  /* 11i */
 1257         IEEE80211_STATUS_AKMP_INVALID           = 43,   /* 11i */
 1258         IEEE80211_STATUS_UNSUPP_RSN_IE_VERSION  = 44,   /* 11i */
 1259         IEEE80211_STATUS_INVALID_RSN_IE_CAP     = 45,   /* 11i */
 1260         IEEE80211_STATUS_CIPHER_SUITE_REJECTED  = 46,   /* 11i */
 1261 };
 1262 
 1263 #define IEEE80211_WEP_KEYLEN            5       /* 40bit */
 1264 #define IEEE80211_WEP_IVLEN             3       /* 24bit */
 1265 #define IEEE80211_WEP_KIDLEN            1       /* 1 octet */
 1266 #define IEEE80211_WEP_CRCLEN            4       /* CRC-32 */
 1267 #define IEEE80211_WEP_TOTLEN            (IEEE80211_WEP_IVLEN + \
 1268                                          IEEE80211_WEP_KIDLEN + \
 1269                                          IEEE80211_WEP_CRCLEN)
 1270 #define IEEE80211_WEP_NKID              4       /* number of key ids */
 1271 
 1272 /*
 1273  * 802.11i defines an extended IV for use with non-WEP ciphers.
 1274  * When the EXTIV bit is set in the key id byte an additional
 1275  * 4 bytes immediately follow the IV for TKIP.  For CCMP the
 1276  * EXTIV bit is likewise set but the 8 bytes represent the
 1277  * CCMP header rather than IV+extended-IV.
 1278  */
 1279 #define IEEE80211_WEP_EXTIV             0x20
 1280 #define IEEE80211_WEP_EXTIVLEN          4       /* extended IV length */
 1281 #define IEEE80211_WEP_MICLEN            8       /* trailing MIC */
 1282 
 1283 #define IEEE80211_CRC_LEN               4
 1284 
 1285 /*
 1286  * Maximum acceptable MTU is:
 1287  *      IEEE80211_MAX_LEN - WEP overhead - CRC -
 1288  *              QoS overhead - RSN/WPA overhead
 1289  * Min is arbitrarily chosen > IEEE80211_MIN_LEN.  The default
 1290  * mtu is Ethernet-compatible; it's set by ether_ifattach.
 1291  */
 1292 #define IEEE80211_MTU_MAX               2290
 1293 #define IEEE80211_MTU_MIN               32
 1294 
 1295 #define IEEE80211_MAX_LEN               (2300 + IEEE80211_CRC_LEN + \
 1296     (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
 1297 #define IEEE80211_ACK_LEN \
 1298         (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
 1299 #define IEEE80211_MIN_LEN \
 1300         (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
 1301 
 1302 /*
 1303  * The 802.11 spec says at most 2007 stations may be
 1304  * associated at once.  For most AP's this is way more
 1305  * than is feasible so we use a default of IEEE80211_AID_DEF.
 1306  * This number may be overridden by the driver and/or by
 1307  * user configuration but may not be less than IEEE80211_AID_MIN
 1308  * (see _ieee80211.h for implementation-specific settings).
 1309  */
 1310 #define IEEE80211_AID_MAX               2007
 1311 
 1312 #define IEEE80211_AID(b)        ((b) &~ 0xc000)
 1313 
 1314 /* 
 1315  * RTS frame length parameters.  The default is specified in
 1316  * the 802.11 spec as 512; we treat it as implementation-dependent
 1317  * so it's defined in ieee80211_var.h.  The max may be wrong
 1318  * for jumbo frames.
 1319  */
 1320 #define IEEE80211_RTS_MIN               1
 1321 #define IEEE80211_RTS_MAX               2346
 1322 
 1323 /* 
 1324  * TX fragmentation parameters.  As above for RTS, we treat
 1325  * default as implementation-dependent so define it elsewhere.
 1326  */
 1327 #define IEEE80211_FRAG_MIN              256
 1328 #define IEEE80211_FRAG_MAX              2346
 1329 
 1330 /*
 1331  * Beacon interval (TU's).  Min+max come from WiFi requirements.
 1332  * As above, we treat default as implementation-dependent so
 1333  * define it elsewhere.
 1334  */
 1335 #define IEEE80211_BINTVAL_MAX   1000    /* max beacon interval (TU's) */
 1336 #define IEEE80211_BINTVAL_MIN   25      /* min beacon interval (TU's) */
 1337 
 1338 /*
 1339  * DTIM period (beacons).  Min+max are not really defined
 1340  * by the protocol but we want them publicly visible so
 1341  * define them here.
 1342  */
 1343 #define IEEE80211_DTIM_MAX      15      /* max DTIM period */
 1344 #define IEEE80211_DTIM_MIN      1       /* min DTIM period */
 1345 
 1346 /*
 1347  * Beacon miss threshold (beacons).  As for DTIM, we define
 1348  * them here to be publicly visible.  Note the max may be
 1349  * clamped depending on device capabilities.
 1350  */
 1351 #define IEEE80211_HWBMISS_MIN   1
 1352 #define IEEE80211_HWBMISS_MAX   255
 1353 
 1354 /*
 1355  * 802.11 frame duration definitions.
 1356  */
 1357 
 1358 struct ieee80211_duration {
 1359         uint16_t        d_rts_dur;
 1360         uint16_t        d_data_dur;
 1361         uint16_t        d_plcp_len;
 1362         uint8_t         d_residue;      /* unused octets in time slot */
 1363 };
 1364 
 1365 /* One Time Unit (TU) is 1Kus = 1024 microseconds. */
 1366 #define IEEE80211_DUR_TU                1024
 1367 
 1368 /* IEEE 802.11b durations for DSSS PHY in microseconds */
 1369 #define IEEE80211_DUR_DS_LONG_PREAMBLE  144
 1370 #define IEEE80211_DUR_DS_SHORT_PREAMBLE 72
 1371 
 1372 #define IEEE80211_DUR_DS_SLOW_PLCPHDR   48
 1373 #define IEEE80211_DUR_DS_FAST_PLCPHDR   24
 1374 #define IEEE80211_DUR_DS_SLOW_ACK       112
 1375 #define IEEE80211_DUR_DS_FAST_ACK       56
 1376 #define IEEE80211_DUR_DS_SLOW_CTS       112
 1377 #define IEEE80211_DUR_DS_FAST_CTS       56
 1378 
 1379 #define IEEE80211_DUR_DS_SLOT           20
 1380 #define IEEE80211_DUR_DS_SIFS           10
 1381 #define IEEE80211_DUR_DS_PIFS   (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT)
 1382 #define IEEE80211_DUR_DS_DIFS   (IEEE80211_DUR_DS_SIFS + \
 1383                                  2 * IEEE80211_DUR_DS_SLOT)
 1384 #define IEEE80211_DUR_DS_EIFS   (IEEE80211_DUR_DS_SIFS + \
 1385                                  IEEE80211_DUR_DS_SLOW_ACK + \
 1386                                  IEEE80211_DUR_DS_LONG_PREAMBLE + \
 1387                                  IEEE80211_DUR_DS_SLOW_PLCPHDR + \
 1388                                  IEEE80211_DUR_DIFS)
 1389 
 1390 #endif /* _NET80211_IEEE80211_H_ */

Cache object: 6e25807716e0d3d7cebac37e88727948


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.