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-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
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/10.2/sys/net80211/ieee80211.h 262007 2014-02-17 01:36:53Z kevlo $
   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 typedef uint16_t ieee80211_seq;
   40 
   41 /* IEEE 802.11 PLCP header */
   42 struct ieee80211_plcp_hdr {
   43         uint16_t        i_sfd;
   44         uint8_t         i_signal;
   45         uint8_t         i_service;
   46         uint16_t        i_length;
   47         uint16_t        i_crc;
   48 } __packed;
   49 
   50 #define IEEE80211_PLCP_SFD      0xF3A0 
   51 #define IEEE80211_PLCP_SERVICE  0x00
   52 #define IEEE80211_PLCP_SERVICE_LOCKED   0x04
   53 #define IEEE80211_PLCL_SERVICE_PBCC     0x08
   54 #define IEEE80211_PLCP_SERVICE_LENEXT5  0x20
   55 #define IEEE80211_PLCP_SERVICE_LENEXT6  0x40
   56 #define IEEE80211_PLCP_SERVICE_LENEXT7  0x80
   57 
   58 /*
   59  * generic definitions for IEEE 802.11 frames
   60  */
   61 struct ieee80211_frame {
   62         uint8_t         i_fc[2];
   63         uint8_t         i_dur[2];
   64         uint8_t         i_addr1[IEEE80211_ADDR_LEN];
   65         uint8_t         i_addr2[IEEE80211_ADDR_LEN];
   66         uint8_t         i_addr3[IEEE80211_ADDR_LEN];
   67         uint8_t         i_seq[2];
   68         /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
   69         /* see below */
   70 } __packed;
   71 
   72 struct ieee80211_qosframe {
   73         uint8_t         i_fc[2];
   74         uint8_t         i_dur[2];
   75         uint8_t         i_addr1[IEEE80211_ADDR_LEN];
   76         uint8_t         i_addr2[IEEE80211_ADDR_LEN];
   77         uint8_t         i_addr3[IEEE80211_ADDR_LEN];
   78         uint8_t         i_seq[2];
   79         uint8_t         i_qos[2];
   80         /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
   81         /* see below */
   82 } __packed;
   83 
   84 struct ieee80211_qoscntl {
   85         uint8_t         i_qos[2];
   86 };
   87 
   88 struct ieee80211_frame_addr4 {
   89         uint8_t         i_fc[2];
   90         uint8_t         i_dur[2];
   91         uint8_t         i_addr1[IEEE80211_ADDR_LEN];
   92         uint8_t         i_addr2[IEEE80211_ADDR_LEN];
   93         uint8_t         i_addr3[IEEE80211_ADDR_LEN];
   94         uint8_t         i_seq[2];
   95         uint8_t         i_addr4[IEEE80211_ADDR_LEN];
   96 } __packed;
   97 
   98 
   99 struct ieee80211_qosframe_addr4 {
  100         uint8_t         i_fc[2];
  101         uint8_t         i_dur[2];
  102         uint8_t         i_addr1[IEEE80211_ADDR_LEN];
  103         uint8_t         i_addr2[IEEE80211_ADDR_LEN];
  104         uint8_t         i_addr3[IEEE80211_ADDR_LEN];
  105         uint8_t         i_seq[2];
  106         uint8_t         i_addr4[IEEE80211_ADDR_LEN];
  107         uint8_t         i_qos[2];
  108 } __packed;
  109 
  110 #define IEEE80211_FC0_VERSION_MASK              0x03
  111 #define IEEE80211_FC0_VERSION_SHIFT             0
  112 #define IEEE80211_FC0_VERSION_0                 0x00
  113 #define IEEE80211_FC0_TYPE_MASK                 0x0c
  114 #define IEEE80211_FC0_TYPE_SHIFT                2
  115 #define IEEE80211_FC0_TYPE_MGT                  0x00
  116 #define IEEE80211_FC0_TYPE_CTL                  0x04
  117 #define IEEE80211_FC0_TYPE_DATA                 0x08
  118 
  119 #define IEEE80211_FC0_SUBTYPE_MASK              0xf0
  120 #define IEEE80211_FC0_SUBTYPE_SHIFT             4
  121 /* for TYPE_MGT */
  122 #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ         0x00
  123 #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP        0x10
  124 #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ       0x20
  125 #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP      0x30
  126 #define IEEE80211_FC0_SUBTYPE_PROBE_REQ         0x40
  127 #define IEEE80211_FC0_SUBTYPE_PROBE_RESP        0x50
  128 #define IEEE80211_FC0_SUBTYPE_BEACON            0x80
  129 #define IEEE80211_FC0_SUBTYPE_ATIM              0x90
  130 #define IEEE80211_FC0_SUBTYPE_DISASSOC          0xa0
  131 #define IEEE80211_FC0_SUBTYPE_AUTH              0xb0
  132 #define IEEE80211_FC0_SUBTYPE_DEAUTH            0xc0
  133 #define IEEE80211_FC0_SUBTYPE_ACTION            0xd0
  134 #define IEEE80211_FC0_SUBTYPE_ACTION_NOACK      0xe0
  135 /* for TYPE_CTL */
  136 #define IEEE80211_FC0_SUBTYPE_BAR               0x80
  137 #define IEEE80211_FC0_SUBTYPE_BA                0x90
  138 #define IEEE80211_FC0_SUBTYPE_PS_POLL           0xa0
  139 #define IEEE80211_FC0_SUBTYPE_RTS               0xb0
  140 #define IEEE80211_FC0_SUBTYPE_CTS               0xc0
  141 #define IEEE80211_FC0_SUBTYPE_ACK               0xd0
  142 #define IEEE80211_FC0_SUBTYPE_CF_END            0xe0
  143 #define IEEE80211_FC0_SUBTYPE_CF_END_ACK        0xf0
  144 /* for TYPE_DATA (bit combination) */
  145 #define IEEE80211_FC0_SUBTYPE_DATA              0x00
  146 #define IEEE80211_FC0_SUBTYPE_CF_ACK            0x10
  147 #define IEEE80211_FC0_SUBTYPE_CF_POLL           0x20
  148 #define IEEE80211_FC0_SUBTYPE_CF_ACPL           0x30
  149 #define IEEE80211_FC0_SUBTYPE_NODATA            0x40
  150 #define IEEE80211_FC0_SUBTYPE_CFACK             0x50
  151 #define IEEE80211_FC0_SUBTYPE_CFPOLL            0x60
  152 #define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK     0x70
  153 #define IEEE80211_FC0_SUBTYPE_QOS               0x80
  154 #define IEEE80211_FC0_SUBTYPE_QOS_NULL          0xc0
  155 
  156 #define IEEE80211_FC1_DIR_MASK                  0x03
  157 #define IEEE80211_FC1_DIR_NODS                  0x00    /* STA->STA */
  158 #define IEEE80211_FC1_DIR_TODS                  0x01    /* STA->AP  */
  159 #define IEEE80211_FC1_DIR_FROMDS                0x02    /* AP ->STA */
  160 #define IEEE80211_FC1_DIR_DSTODS                0x03    /* AP ->AP  */
  161 
  162 #define IEEE80211_IS_DSTODS(wh) \
  163         (((wh)->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS)
  164 
  165 #define IEEE80211_FC1_MORE_FRAG                 0x04
  166 #define IEEE80211_FC1_RETRY                     0x08
  167 #define IEEE80211_FC1_PWR_MGT                   0x10
  168 #define IEEE80211_FC1_MORE_DATA                 0x20
  169 #define IEEE80211_FC1_PROTECTED                 0x40
  170 #define IEEE80211_FC1_ORDER                     0x80
  171 
  172 #define IEEE80211_SEQ_FRAG_MASK                 0x000f
  173 #define IEEE80211_SEQ_FRAG_SHIFT                0
  174 #define IEEE80211_SEQ_SEQ_MASK                  0xfff0
  175 #define IEEE80211_SEQ_SEQ_SHIFT                 4
  176 #define IEEE80211_SEQ_RANGE                     4096
  177 
  178 #define IEEE80211_SEQ_ADD(seq, incr) \
  179         (((seq) + (incr)) & (IEEE80211_SEQ_RANGE-1))
  180 #define IEEE80211_SEQ_INC(seq)  IEEE80211_SEQ_ADD(seq,1)
  181 #define IEEE80211_SEQ_SUB(a, b) \
  182         (((a) + IEEE80211_SEQ_RANGE - (b)) & (IEEE80211_SEQ_RANGE-1))
  183 
  184 #define IEEE80211_SEQ_BA_RANGE                  2048    /* 2^11 */
  185 #define IEEE80211_SEQ_BA_BEFORE(a, b) \
  186         (IEEE80211_SEQ_SUB(b, a+1) < IEEE80211_SEQ_BA_RANGE-1)
  187 
  188 #define IEEE80211_NWID_LEN                      32
  189 #define IEEE80211_MESHID_LEN                    32
  190 
  191 #define IEEE80211_QOS_TXOP                      0x00ff
  192 /* bit 8 is reserved */
  193 #define IEEE80211_QOS_AMSDU                     0x80
  194 #define IEEE80211_QOS_AMSDU_S                   7
  195 #define IEEE80211_QOS_ACKPOLICY                 0x60
  196 #define IEEE80211_QOS_ACKPOLICY_S               5
  197 #define IEEE80211_QOS_ACKPOLICY_NOACK           0x20    /* No ACK required */
  198 #define IEEE80211_QOS_ACKPOLICY_BA              0x60    /* Block ACK */
  199 #define IEEE80211_QOS_EOSP                      0x10    /* EndOfService Period*/
  200 #define IEEE80211_QOS_EOSP_S                    4
  201 #define IEEE80211_QOS_TID                       0x0f
  202 /* qos[1] byte used for all frames sent by mesh STAs in a mesh BSS */
  203 #define IEEE80211_QOS_MC                        0x01    /* Mesh control */
  204 /* Mesh power save level*/
  205 #define IEEE80211_QOS_MESH_PSL                  0x02
  206 /* Mesh Receiver Service Period Initiated */
  207 #define IEEE80211_QOS_RSPI                      0x04
  208 /* bits 11 to 15 reserved */
  209 
  210 /* does frame have QoS sequence control data */
  211 #define IEEE80211_QOS_HAS_SEQ(wh) \
  212         (((wh)->i_fc[0] & \
  213           (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \
  214           (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
  215 
  216 /*
  217  * WME/802.11e information element.
  218  */
  219 struct ieee80211_wme_info {
  220         uint8_t         wme_id;         /* IEEE80211_ELEMID_VENDOR */
  221         uint8_t         wme_len;        /* length in bytes */
  222         uint8_t         wme_oui[3];     /* 0x00, 0x50, 0xf2 */
  223         uint8_t         wme_type;       /* OUI type */
  224         uint8_t         wme_subtype;    /* OUI subtype */
  225         uint8_t         wme_version;    /* spec revision */
  226         uint8_t         wme_info;       /* QoS info */
  227 } __packed;
  228 
  229 /*
  230  * WME/802.11e Tspec Element
  231  */
  232 struct ieee80211_wme_tspec {
  233         uint8_t         ts_id;
  234         uint8_t         ts_len;
  235         uint8_t         ts_oui[3];
  236         uint8_t         ts_oui_type;
  237         uint8_t         ts_oui_subtype;
  238         uint8_t         ts_version;
  239         uint8_t         ts_tsinfo[3];
  240         uint8_t         ts_nom_msdu[2];
  241         uint8_t         ts_max_msdu[2];
  242         uint8_t         ts_min_svc[4];
  243         uint8_t         ts_max_svc[4];
  244         uint8_t         ts_inactv_intv[4];
  245         uint8_t         ts_susp_intv[4];
  246         uint8_t         ts_start_svc[4];
  247         uint8_t         ts_min_rate[4];
  248         uint8_t         ts_mean_rate[4];
  249         uint8_t         ts_max_burst[4];
  250         uint8_t         ts_min_phy[4];
  251         uint8_t         ts_peak_rate[4];
  252         uint8_t         ts_delay[4];
  253         uint8_t         ts_surplus[2];
  254         uint8_t         ts_medium_time[2];
  255 } __packed;
  256 
  257 /*
  258  * WME AC parameter field
  259  */
  260 struct ieee80211_wme_acparams {
  261         uint8_t         acp_aci_aifsn;
  262         uint8_t         acp_logcwminmax;
  263         uint16_t        acp_txop;
  264 } __packed;
  265 
  266 #define WME_NUM_AC              4       /* 4 AC categories */
  267 #define WME_NUM_TID             16      /* 16 tids */
  268 
  269 #define WME_PARAM_ACI           0x60    /* Mask for ACI field */
  270 #define WME_PARAM_ACI_S         5       /* Shift for ACI field */
  271 #define WME_PARAM_ACM           0x10    /* Mask for ACM bit */
  272 #define WME_PARAM_ACM_S         4       /* Shift for ACM bit */
  273 #define WME_PARAM_AIFSN         0x0f    /* Mask for aifsn field */
  274 #define WME_PARAM_AIFSN_S       0       /* Shift for aifsn field */
  275 #define WME_PARAM_LOGCWMIN      0x0f    /* Mask for CwMin field (in log) */
  276 #define WME_PARAM_LOGCWMIN_S    0       /* Shift for CwMin field */
  277 #define WME_PARAM_LOGCWMAX      0xf0    /* Mask for CwMax field (in log) */
  278 #define WME_PARAM_LOGCWMAX_S    4       /* Shift for CwMax field */
  279 
  280 #define WME_AC_TO_TID(_ac) (       \
  281         ((_ac) == WME_AC_VO) ? 6 : \
  282         ((_ac) == WME_AC_VI) ? 5 : \
  283         ((_ac) == WME_AC_BK) ? 1 : \
  284         0)
  285 
  286 #define TID_TO_WME_AC(_tid) (      \
  287         ((_tid) == 0 || (_tid) == 3) ? WME_AC_BE : \
  288         ((_tid) < 3) ? WME_AC_BK : \
  289         ((_tid) < 6) ? WME_AC_VI : \
  290         WME_AC_VO)
  291 
  292 /*
  293  * WME Parameter Element
  294  */
  295 struct ieee80211_wme_param {
  296         uint8_t         param_id;
  297         uint8_t         param_len;
  298         uint8_t         param_oui[3];
  299         uint8_t         param_oui_type;
  300         uint8_t         param_oui_subtype;
  301         uint8_t         param_version;
  302         uint8_t         param_qosInfo;
  303 #define WME_QOSINFO_COUNT       0x0f    /* Mask for param count field */
  304         uint8_t         param_reserved;
  305         struct ieee80211_wme_acparams   params_acParams[WME_NUM_AC];
  306 } __packed;
  307 
  308 /*
  309  * Management Notification Frame
  310  */
  311 struct ieee80211_mnf {
  312         uint8_t         mnf_category;
  313         uint8_t         mnf_action;
  314         uint8_t         mnf_dialog;
  315         uint8_t         mnf_status;
  316 } __packed;
  317 #define MNF_SETUP_REQ   0
  318 #define MNF_SETUP_RESP  1
  319 #define MNF_TEARDOWN    2
  320 
  321 /* 
  322  * 802.11n Management Action Frames 
  323  */
  324 /* generic frame format */
  325 struct ieee80211_action {
  326         uint8_t         ia_category;
  327         uint8_t         ia_action;
  328 } __packed;
  329 
  330 #define IEEE80211_ACTION_CAT_SM         0       /* Spectrum Management */
  331 #define IEEE80211_ACTION_CAT_QOS        1       /* QoS */
  332 #define IEEE80211_ACTION_CAT_DLS        2       /* DLS */
  333 #define IEEE80211_ACTION_CAT_BA         3       /* BA */
  334 #define IEEE80211_ACTION_CAT_HT         7       /* HT */
  335 #define IEEE80211_ACTION_CAT_MESH       13      /* Mesh */
  336 #define IEEE80211_ACTION_CAT_SELF_PROT  15      /* Self-protected */
  337 /* 16 - 125 reserved */
  338 #define IEEE80211_ACTION_CAT_VENDOR     127     /* Vendor Specific */
  339 
  340 #define IEEE80211_ACTION_HT_TXCHWIDTH   0       /* recommended xmit chan width*/
  341 #define IEEE80211_ACTION_HT_MIMOPWRSAVE 1       /* MIMO power save */
  342 
  343 /* HT - recommended transmission channel width */
  344 struct ieee80211_action_ht_txchwidth {
  345         struct ieee80211_action at_header;
  346         uint8_t         at_chwidth;     
  347 } __packed;
  348 
  349 #define IEEE80211_A_HT_TXCHWIDTH_20     0
  350 #define IEEE80211_A_HT_TXCHWIDTH_2040   1
  351 
  352 /* HT - MIMO Power Save (NB: D2.04) */
  353 struct ieee80211_action_ht_mimopowersave {
  354         struct ieee80211_action am_header;
  355         uint8_t         am_control;
  356 } __packed;
  357 
  358 #define IEEE80211_A_HT_MIMOPWRSAVE_ENA          0x01    /* PS enabled */
  359 #define IEEE80211_A_HT_MIMOPWRSAVE_MODE         0x02
  360 #define IEEE80211_A_HT_MIMOPWRSAVE_MODE_S       1
  361 #define IEEE80211_A_HT_MIMOPWRSAVE_DYNAMIC      0x02    /* Dynamic Mode */
  362 #define IEEE80211_A_HT_MIMOPWRSAVE_STATIC       0x00    /* no SM packets */
  363 /* bits 2-7 reserved */
  364 
  365 /* Block Ack actions */
  366 #define IEEE80211_ACTION_BA_ADDBA_REQUEST       0   /* ADDBA request */
  367 #define IEEE80211_ACTION_BA_ADDBA_RESPONSE      1   /* ADDBA response */
  368 #define IEEE80211_ACTION_BA_DELBA               2   /* DELBA */
  369 
  370 /* Block Ack Parameter Set */
  371 #define IEEE80211_BAPS_BUFSIZ   0xffc0          /* buffer size */
  372 #define IEEE80211_BAPS_BUFSIZ_S 6
  373 #define IEEE80211_BAPS_TID      0x003c          /* TID */
  374 #define IEEE80211_BAPS_TID_S    2
  375 #define IEEE80211_BAPS_POLICY   0x0002          /* block ack policy */
  376 #define IEEE80211_BAPS_POLICY_S 1
  377 
  378 #define IEEE80211_BAPS_POLICY_DELAYED   (0<<IEEE80211_BAPS_POLICY_S)
  379 #define IEEE80211_BAPS_POLICY_IMMEDIATE (1<<IEEE80211_BAPS_POLICY_S)
  380 
  381 /* Block Ack Sequence Control */
  382 #define IEEE80211_BASEQ_START   0xfff0          /* starting seqnum */
  383 #define IEEE80211_BASEQ_START_S 4
  384 #define IEEE80211_BASEQ_FRAG    0x000f          /* fragment number */
  385 #define IEEE80211_BASEQ_FRAG_S  0
  386 
  387 /* Delayed Block Ack Parameter Set */
  388 #define IEEE80211_DELBAPS_TID   0xf000          /* TID */
  389 #define IEEE80211_DELBAPS_TID_S 12
  390 #define IEEE80211_DELBAPS_INIT  0x0800          /* initiator */
  391 #define IEEE80211_DELBAPS_INIT_S 11
  392 
  393 /* BA - ADDBA request */
  394 struct ieee80211_action_ba_addbarequest {
  395         struct ieee80211_action rq_header;
  396         uint8_t         rq_dialogtoken;
  397         uint16_t        rq_baparamset;
  398         uint16_t        rq_batimeout;           /* in TUs */
  399         uint16_t        rq_baseqctl;
  400 } __packed;
  401 
  402 /* BA - ADDBA response */
  403 struct ieee80211_action_ba_addbaresponse {
  404         struct ieee80211_action rs_header;
  405         uint8_t         rs_dialogtoken;
  406         uint16_t        rs_statuscode;
  407         uint16_t        rs_baparamset; 
  408         uint16_t        rs_batimeout;           /* in TUs */
  409 } __packed;
  410 
  411 /* BA - DELBA */
  412 struct ieee80211_action_ba_delba {
  413         struct ieee80211_action dl_header;
  414         uint16_t        dl_baparamset;
  415         uint16_t        dl_reasoncode;
  416 } __packed;
  417 
  418 /* BAR Control */
  419 #define IEEE80211_BAR_TID       0xf000          /* TID */
  420 #define IEEE80211_BAR_TID_S     12
  421 #define IEEE80211_BAR_COMP      0x0004          /* Compressed Bitmap */
  422 #define IEEE80211_BAR_MTID      0x0002          /* Multi-TID */
  423 #define IEEE80211_BAR_NOACK     0x0001          /* No-Ack policy */
  424 
  425 /* BAR Starting Sequence Control */
  426 #define IEEE80211_BAR_SEQ_START 0xfff0          /* starting seqnum */
  427 #define IEEE80211_BAR_SEQ_START_S       4
  428 
  429 struct ieee80211_ba_request {
  430         uint16_t        rq_barctl;
  431         uint16_t        rq_barseqctl;
  432 } __packed;
  433 
  434 /*
  435  * Control frames.
  436  */
  437 struct ieee80211_frame_min {
  438         uint8_t         i_fc[2];
  439         uint8_t         i_dur[2];
  440         uint8_t         i_addr1[IEEE80211_ADDR_LEN];
  441         uint8_t         i_addr2[IEEE80211_ADDR_LEN];
  442         /* FCS */
  443 } __packed;
  444 
  445 struct ieee80211_frame_rts {
  446         uint8_t         i_fc[2];
  447         uint8_t         i_dur[2];
  448         uint8_t         i_ra[IEEE80211_ADDR_LEN];
  449         uint8_t         i_ta[IEEE80211_ADDR_LEN];
  450         /* FCS */
  451 } __packed;
  452 
  453 struct ieee80211_frame_cts {
  454         uint8_t         i_fc[2];
  455         uint8_t         i_dur[2];
  456         uint8_t         i_ra[IEEE80211_ADDR_LEN];
  457         /* FCS */
  458 } __packed;
  459 
  460 struct ieee80211_frame_ack {
  461         uint8_t         i_fc[2];
  462         uint8_t         i_dur[2];
  463         uint8_t         i_ra[IEEE80211_ADDR_LEN];
  464         /* FCS */
  465 } __packed;
  466 
  467 struct ieee80211_frame_pspoll {
  468         uint8_t         i_fc[2];
  469         uint8_t         i_aid[2];
  470         uint8_t         i_bssid[IEEE80211_ADDR_LEN];
  471         uint8_t         i_ta[IEEE80211_ADDR_LEN];
  472         /* FCS */
  473 } __packed;
  474 
  475 struct ieee80211_frame_cfend {          /* NB: also CF-End+CF-Ack */
  476         uint8_t         i_fc[2];
  477         uint8_t         i_dur[2];       /* should be zero */
  478         uint8_t         i_ra[IEEE80211_ADDR_LEN];
  479         uint8_t         i_bssid[IEEE80211_ADDR_LEN];
  480         /* FCS */
  481 } __packed;
  482 
  483 struct ieee80211_frame_bar {
  484         uint8_t         i_fc[2];
  485         uint8_t         i_dur[2];
  486         uint8_t         i_ra[IEEE80211_ADDR_LEN];
  487         uint8_t         i_ta[IEEE80211_ADDR_LEN];
  488         uint16_t        i_ctl;
  489         uint16_t        i_seq;
  490         /* FCS */
  491 } __packed;
  492 
  493 /*
  494  * BEACON management packets
  495  *
  496  *      octet timestamp[8]
  497  *      octet beacon interval[2]
  498  *      octet capability information[2]
  499  *      information element
  500  *              octet elemid
  501  *              octet length
  502  *              octet information[length]
  503  */
  504 
  505 #define IEEE80211_BEACON_INTERVAL(beacon) \
  506         ((beacon)[8] | ((beacon)[9] << 8))
  507 #define IEEE80211_BEACON_CAPABILITY(beacon) \
  508         ((beacon)[10] | ((beacon)[11] << 8))
  509 
  510 #define IEEE80211_CAPINFO_ESS                   0x0001
  511 #define IEEE80211_CAPINFO_IBSS                  0x0002
  512 #define IEEE80211_CAPINFO_CF_POLLABLE           0x0004
  513 #define IEEE80211_CAPINFO_CF_POLLREQ            0x0008
  514 #define IEEE80211_CAPINFO_PRIVACY               0x0010
  515 #define IEEE80211_CAPINFO_SHORT_PREAMBLE        0x0020
  516 #define IEEE80211_CAPINFO_PBCC                  0x0040
  517 #define IEEE80211_CAPINFO_CHNL_AGILITY          0x0080
  518 #define IEEE80211_CAPINFO_SPECTRUM_MGMT         0x0100
  519 /* bit 9 is reserved */
  520 #define IEEE80211_CAPINFO_SHORT_SLOTTIME        0x0400
  521 #define IEEE80211_CAPINFO_RSN                   0x0800
  522 /* bit 12 is reserved */
  523 #define IEEE80211_CAPINFO_DSSSOFDM              0x2000
  524 /* bits 14-15 are reserved */
  525 
  526 #define IEEE80211_CAPINFO_BITS \
  527         "\2\1ESS\2IBSS\3CF_POLLABLE\4CF_POLLREQ\5PRIVACY\6SHORT_PREAMBLE" \
  528         "\7PBCC\10CHNL_AGILITY\11SPECTRUM_MGMT\13SHORT_SLOTTIME\14RSN" \
  529         "\16DSSOFDM"
  530 
  531 /*
  532  * 802.11i/WPA information element (maximally sized).
  533  */
  534 struct ieee80211_ie_wpa {
  535         uint8_t         wpa_id;         /* IEEE80211_ELEMID_VENDOR */
  536         uint8_t         wpa_len;        /* length in bytes */
  537         uint8_t         wpa_oui[3];     /* 0x00, 0x50, 0xf2 */
  538         uint8_t         wpa_type;       /* OUI type */
  539         uint16_t        wpa_version;    /* spec revision */
  540         uint32_t        wpa_mcipher[1]; /* multicast/group key cipher */
  541         uint16_t        wpa_uciphercnt; /* # pairwise key ciphers */
  542         uint32_t        wpa_uciphers[8];/* ciphers */
  543         uint16_t        wpa_authselcnt; /* authentication selector cnt*/
  544         uint32_t        wpa_authsels[8];/* selectors */
  545         uint16_t        wpa_caps;       /* 802.11i capabilities */
  546         uint16_t        wpa_pmkidcnt;   /* 802.11i pmkid count */
  547         uint16_t        wpa_pmkids[8];  /* 802.11i pmkids */
  548 } __packed;
  549 
  550 /*
  551  * 802.11n HT Capability IE
  552  * NB: these reflect D1.10 
  553  */
  554 struct ieee80211_ie_htcap {
  555         uint8_t         hc_id;                  /* element ID */
  556         uint8_t         hc_len;                 /* length in bytes */
  557         uint16_t        hc_cap;                 /* HT caps (see below) */
  558         uint8_t         hc_param;               /* HT params (see below) */
  559         uint8_t         hc_mcsset[16];          /* supported MCS set */
  560         uint16_t        hc_extcap;              /* extended HT capabilities */
  561         uint32_t        hc_txbf;                /* txbf capabilities */
  562         uint8_t         hc_antenna;             /* antenna capabilities */
  563 } __packed;
  564 
  565 /* HT capability flags (ht_cap) */
  566 #define IEEE80211_HTCAP_LDPC            0x0001  /* LDPC supported */
  567 #define IEEE80211_HTCAP_CHWIDTH40       0x0002  /* 20/40 supported */
  568 #define IEEE80211_HTCAP_SMPS            0x000c  /* SM Power Save mode */
  569 #define IEEE80211_HTCAP_SMPS_OFF        0x000c  /* disabled */
  570 #define IEEE80211_HTCAP_SMPS_DYNAMIC    0x0004  /* send RTS first */
  571 /* NB: SMPS value 2 is reserved */
  572 #define IEEE80211_HTCAP_SMPS_ENA        0x0000  /* enabled (static mode) */
  573 #define IEEE80211_HTCAP_GREENFIELD      0x0010  /* Greenfield supported */
  574 #define IEEE80211_HTCAP_SHORTGI20       0x0020  /* Short GI in 20MHz */
  575 #define IEEE80211_HTCAP_SHORTGI40       0x0040  /* Short GI in 40MHz */
  576 #define IEEE80211_HTCAP_TXSTBC          0x0080  /* STBC tx ok */
  577 #define IEEE80211_HTCAP_RXSTBC          0x0300  /* STBC rx support */
  578 #define IEEE80211_HTCAP_RXSTBC_S        8
  579 #define IEEE80211_HTCAP_RXSTBC_1STREAM  0x0100  /* 1 spatial stream */
  580 #define IEEE80211_HTCAP_RXSTBC_2STREAM  0x0200  /* 1-2 spatial streams*/
  581 #define IEEE80211_HTCAP_RXSTBC_3STREAM  0x0300  /* 1-3 spatial streams*/
  582 #define IEEE80211_HTCAP_DELBA           0x0400  /* HT DELBA supported */
  583 #define IEEE80211_HTCAP_MAXAMSDU        0x0800  /* max A-MSDU length */
  584 #define IEEE80211_HTCAP_MAXAMSDU_7935   0x0800  /* 7935 octets */
  585 #define IEEE80211_HTCAP_MAXAMSDU_3839   0x0000  /* 3839 octets */
  586 #define IEEE80211_HTCAP_DSSSCCK40       0x1000  /* DSSS/CCK in 40MHz */
  587 #define IEEE80211_HTCAP_PSMP            0x2000  /* PSMP supported */
  588 #define IEEE80211_HTCAP_40INTOLERANT    0x4000  /* 40MHz intolerant */
  589 #define IEEE80211_HTCAP_LSIGTXOPPROT    0x8000  /* L-SIG TXOP prot */
  590 
  591 #define IEEE80211_HTCAP_BITS \
  592         "\2\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \
  593         "\13DELBA\14AMSDU(7935)\15DSSSCCK40\16PSMP\1740INTOLERANT" \
  594         "\20LSIGTXOPPROT"
  595 
  596 /* HT parameters (hc_param) */
  597 #define IEEE80211_HTCAP_MAXRXAMPDU      0x03    /* max rx A-MPDU factor */
  598 #define IEEE80211_HTCAP_MAXRXAMPDU_S    0
  599 #define IEEE80211_HTCAP_MAXRXAMPDU_8K   0
  600 #define IEEE80211_HTCAP_MAXRXAMPDU_16K  1
  601 #define IEEE80211_HTCAP_MAXRXAMPDU_32K  2
  602 #define IEEE80211_HTCAP_MAXRXAMPDU_64K  3
  603 #define IEEE80211_HTCAP_MPDUDENSITY     0x1c    /* min MPDU start spacing */
  604 #define IEEE80211_HTCAP_MPDUDENSITY_S   2
  605 #define IEEE80211_HTCAP_MPDUDENSITY_NA  0       /* no time restriction */
  606 #define IEEE80211_HTCAP_MPDUDENSITY_025 1       /* 1/4 us */
  607 #define IEEE80211_HTCAP_MPDUDENSITY_05  2       /* 1/2 us */
  608 #define IEEE80211_HTCAP_MPDUDENSITY_1   3       /* 1 us */
  609 #define IEEE80211_HTCAP_MPDUDENSITY_2   4       /* 2 us */
  610 #define IEEE80211_HTCAP_MPDUDENSITY_4   5       /* 4 us */
  611 #define IEEE80211_HTCAP_MPDUDENSITY_8   6       /* 8 us */
  612 #define IEEE80211_HTCAP_MPDUDENSITY_16  7       /* 16 us */
  613 
  614 /* HT extended capabilities (hc_extcap) */
  615 #define IEEE80211_HTCAP_PCO             0x0001  /* PCO capable */
  616 #define IEEE80211_HTCAP_PCOTRANS        0x0006  /* PCO transition time */
  617 #define IEEE80211_HTCAP_PCOTRANS_S      1
  618 #define IEEE80211_HTCAP_PCOTRANS_04     0x0002  /* 400 us */
  619 #define IEEE80211_HTCAP_PCOTRANS_15     0x0004  /* 1.5 ms */
  620 #define IEEE80211_HTCAP_PCOTRANS_5      0x0006  /* 5 ms */
  621 /* bits 3-7 reserved */
  622 #define IEEE80211_HTCAP_MCSFBACK        0x0300  /* MCS feedback */
  623 #define IEEE80211_HTCAP_MCSFBACK_S      8
  624 #define IEEE80211_HTCAP_MCSFBACK_NONE   0x0000  /* nothing provided */
  625 #define IEEE80211_HTCAP_MCSFBACK_UNSOL  0x0200  /* unsolicited feedback */
  626 #define IEEE80211_HTCAP_MCSFBACK_MRQ    0x0300  /* " "+respond to MRQ */
  627 #define IEEE80211_HTCAP_HTC             0x0400  /* +HTC support */
  628 #define IEEE80211_HTCAP_RDR             0x0800  /* reverse direction responder*/
  629 /* bits 12-15 reserved */
  630 
  631 /*
  632  * 802.11n HT Information IE
  633  */
  634 struct ieee80211_ie_htinfo {
  635         uint8_t         hi_id;                  /* element ID */
  636         uint8_t         hi_len;                 /* length in bytes */
  637         uint8_t         hi_ctrlchannel;         /* primary channel */
  638         uint8_t         hi_byte1;               /* ht ie byte 1 */
  639         uint8_t         hi_byte2;               /* ht ie byte 2 */
  640         uint8_t         hi_byte3;               /* ht ie byte 3 */
  641         uint16_t        hi_byte45;              /* ht ie bytes 4+5 */
  642         uint8_t         hi_basicmcsset[16];     /* basic MCS set */
  643 } __packed;
  644 
  645 /* byte1 */
  646 #define IEEE80211_HTINFO_2NDCHAN        0x03    /* secondary/ext chan offset */
  647 #define IEEE80211_HTINFO_2NDCHAN_S      0
  648 #define IEEE80211_HTINFO_2NDCHAN_NONE   0x00    /* no secondary/ext channel */
  649 #define IEEE80211_HTINFO_2NDCHAN_ABOVE  0x01    /* above private channel */
  650 /* NB: 2 is reserved */
  651 #define IEEE80211_HTINFO_2NDCHAN_BELOW  0x03    /* below primary channel */ 
  652 #define IEEE80211_HTINFO_TXWIDTH        0x04    /* tx channel width */
  653 #define IEEE80211_HTINFO_TXWIDTH_20     0x00    /* 20MHz width */
  654 #define IEEE80211_HTINFO_TXWIDTH_2040   0x04    /* any supported width */
  655 #define IEEE80211_HTINFO_RIFSMODE       0x08    /* Reduced IFS (RIFS) use */
  656 #define IEEE80211_HTINFO_RIFSMODE_PROH  0x00    /* RIFS use prohibited */
  657 #define IEEE80211_HTINFO_RIFSMODE_PERM  0x08    /* RIFS use permitted */
  658 #define IEEE80211_HTINFO_PMSPONLY       0x10    /* PSMP required to associate */
  659 #define IEEE80211_HTINFO_SIGRAN         0xe0    /* shortest Service Interval */
  660 #define IEEE80211_HTINFO_SIGRAN_S       5
  661 #define IEEE80211_HTINFO_SIGRAN_5       0x00    /* 5 ms */
  662 /* XXX add rest */
  663 
  664 /* bytes 2+3 */
  665 #define IEEE80211_HTINFO_OPMODE         0x03    /* operating mode */
  666 #define IEEE80211_HTINFO_OPMODE_S       0
  667 #define IEEE80211_HTINFO_OPMODE_PURE    0x00    /* no protection */
  668 #define IEEE80211_HTINFO_OPMODE_PROTOPT 0x01    /* protection optional */
  669 #define IEEE80211_HTINFO_OPMODE_HT20PR  0x02    /* protection for HT20 sta's */
  670 #define IEEE80211_HTINFO_OPMODE_MIXED   0x03    /* protection for legacy sta's*/
  671 #define IEEE80211_HTINFO_NONGF_PRESENT  0x04    /* non-GF sta's present */
  672 #define IEEE80211_HTINFO_TXBL           0x08    /* transmit burst limit */
  673 #define IEEE80211_HTINFO_NONHT_PRESENT  0x10    /* non-HT sta's present */
  674 /* bits 5-15 reserved */
  675 
  676 /* bytes 4+5 */
  677 #define IEEE80211_HTINFO_2NDARYBEACON   0x01
  678 #define IEEE80211_HTINFO_LSIGTXOPPROT   0x02
  679 #define IEEE80211_HTINFO_PCO_ACTIVE     0x04
  680 #define IEEE80211_HTINFO_40MHZPHASE     0x08
  681 
  682 /* byte5 */
  683 #define IEEE80211_HTINFO_BASIC_STBCMCS  0x7f
  684 #define IEEE80211_HTINFO_BASIC_STBCMCS_S 0
  685 #define IEEE80211_HTINFO_DUALPROTECTED  0x80
  686 
  687 /*
  688  * Management information element payloads.
  689  */
  690 
  691 enum {
  692         IEEE80211_ELEMID_SSID           = 0,
  693         IEEE80211_ELEMID_RATES          = 1,
  694         IEEE80211_ELEMID_FHPARMS        = 2,
  695         IEEE80211_ELEMID_DSPARMS        = 3,
  696         IEEE80211_ELEMID_CFPARMS        = 4,
  697         IEEE80211_ELEMID_TIM            = 5,
  698         IEEE80211_ELEMID_IBSSPARMS      = 6,
  699         IEEE80211_ELEMID_COUNTRY        = 7,
  700         IEEE80211_ELEMID_CHALLENGE      = 16,
  701         /* 17-31 reserved for challenge text extension */
  702         IEEE80211_ELEMID_PWRCNSTR       = 32,
  703         IEEE80211_ELEMID_PWRCAP         = 33,
  704         IEEE80211_ELEMID_TPCREQ         = 34,
  705         IEEE80211_ELEMID_TPCREP         = 35,
  706         IEEE80211_ELEMID_SUPPCHAN       = 36,
  707         IEEE80211_ELEMID_CSA            = 37,
  708         IEEE80211_ELEMID_MEASREQ        = 38,
  709         IEEE80211_ELEMID_MEASREP        = 39,
  710         IEEE80211_ELEMID_QUIET          = 40,
  711         IEEE80211_ELEMID_IBSSDFS        = 41,
  712         IEEE80211_ELEMID_ERP            = 42,
  713         IEEE80211_ELEMID_HTCAP          = 45,
  714         IEEE80211_ELEMID_QOS            = 46,
  715         IEEE80211_ELEMID_RSN            = 48,
  716         IEEE80211_ELEMID_XRATES         = 50,
  717         IEEE80211_ELEMID_HTINFO         = 61,
  718         IEEE80211_ELEMID_TPC            = 150,
  719         IEEE80211_ELEMID_CCKM           = 156,
  720         IEEE80211_ELEMID_VENDOR         = 221,  /* vendor private */
  721 
  722         /*
  723          * 802.11s IEs
  724          * NB: On vanilla Linux still IEEE80211_ELEMID_MESHPEER = 55,
  725          * but they defined a new with id 117 called PEER_MGMT.
  726          * NB: complies with open80211
  727          */
  728         IEEE80211_ELEMID_MESHCONF       = 113,
  729         IEEE80211_ELEMID_MESHID         = 114,
  730         IEEE80211_ELEMID_MESHLINK       = 115,
  731         IEEE80211_ELEMID_MESHCNGST      = 116,
  732         IEEE80211_ELEMID_MESHPEER       = 117,
  733         IEEE80211_ELEMID_MESHCSA        = 118,
  734         IEEE80211_ELEMID_MESHTIM        = 39, /* XXX: remove */
  735         IEEE80211_ELEMID_MESHAWAKEW     = 119,
  736         IEEE80211_ELEMID_MESHBEACONT    = 120,
  737         /* 121-124 MMCAOP not implemented yet */
  738         IEEE80211_ELEMID_MESHGANN       = 125,
  739         IEEE80211_ELEMID_MESHRANN       = 126,
  740         /* 127 Extended Capabilities */
  741         /* 128-129 reserved */
  742         IEEE80211_ELEMID_MESHPREQ       = 130,
  743         IEEE80211_ELEMID_MESHPREP       = 131,
  744         IEEE80211_ELEMID_MESHPERR       = 132,
  745         /* 133-136 reserved */
  746         IEEE80211_ELEMID_MESHPXU        = 137,
  747         IEEE80211_ELEMID_MESHPXUC       = 138,
  748         IEEE80211_ELEMID_MESHAH         = 60, /* XXX: remove */
  749 };
  750 
  751 struct ieee80211_tim_ie {
  752         uint8_t         tim_ie;                 /* IEEE80211_ELEMID_TIM */
  753         uint8_t         tim_len;
  754         uint8_t         tim_count;              /* DTIM count */
  755         uint8_t         tim_period;             /* DTIM period */
  756         uint8_t         tim_bitctl;             /* bitmap control */
  757         uint8_t         tim_bitmap[1];          /* variable-length bitmap */
  758 } __packed;
  759 
  760 struct ieee80211_country_ie {
  761         uint8_t         ie;                     /* IEEE80211_ELEMID_COUNTRY */
  762         uint8_t         len;
  763         uint8_t         cc[3];                  /* ISO CC+(I)ndoor/(O)utdoor */
  764         struct {
  765                 uint8_t schan;                  /* starting channel */
  766                 uint8_t nchan;                  /* number channels */
  767                 uint8_t maxtxpwr;               /* tx power cap */
  768         } __packed band[1];                     /* sub bands (NB: var size) */
  769 } __packed;
  770 
  771 #define IEEE80211_COUNTRY_MAX_BANDS     84      /* max possible bands */
  772 #define IEEE80211_COUNTRY_MAX_SIZE \
  773         (sizeof(struct ieee80211_country_ie) + 3*(IEEE80211_COUNTRY_MAX_BANDS-1))
  774 
  775 /*
  776  * 802.11h Quiet Time Element.
  777  */
  778 struct ieee80211_quiet_ie {
  779         uint8_t         quiet_ie;               /* IEEE80211_ELEMID_QUIET */
  780         uint8_t         len;
  781         uint8_t         tbttcount;              /* quiet start */
  782         uint8_t         period;                 /* beacon intervals between quiets */
  783         uint16_t        duration;               /* TUs of each quiet*/
  784         uint16_t        offset;                 /* TUs of from TBTT of quiet start */
  785 } __packed;
  786 
  787 /*
  788  * 802.11h Channel Switch Announcement (CSA).
  789  */
  790 struct ieee80211_csa_ie {
  791         uint8_t         csa_ie;         /* IEEE80211_ELEMID_CHANSWITCHANN */
  792         uint8_t         csa_len;
  793         uint8_t         csa_mode;               /* Channel Switch Mode */
  794         uint8_t         csa_newchan;            /* New Channel Number */
  795         uint8_t         csa_count;              /* Channel Switch Count */
  796 } __packed;
  797 
  798 /*
  799  * Note the min acceptable CSA count is used to guard against
  800  * malicious CSA injection in station mode.  Defining this value
  801  * as other than 0 violates the 11h spec.
  802  */
  803 #define IEEE80211_CSA_COUNT_MIN 2
  804 #define IEEE80211_CSA_COUNT_MAX 255
  805 
  806 /* rate set entries are in .5 Mb/s units, and potentially marked as basic */
  807 #define IEEE80211_RATE_BASIC            0x80
  808 #define IEEE80211_RATE_VAL              0x7f
  809 
  810 /* EPR information element flags */
  811 #define IEEE80211_ERP_NON_ERP_PRESENT   0x01
  812 #define IEEE80211_ERP_USE_PROTECTION    0x02
  813 #define IEEE80211_ERP_LONG_PREAMBLE     0x04
  814 
  815 #define IEEE80211_ERP_BITS \
  816         "\2\1NON_ERP_PRESENT\2USE_PROTECTION\3LONG_PREAMBLE"
  817 
  818 #define ATH_OUI                 0x7f0300        /* Atheros OUI */
  819 #define ATH_OUI_TYPE            0x01            /* Atheros protocol ie */
  820 
  821 /* NB: Atheros allocated the OUI for this purpose ~2005 but beware ... */
  822 #define TDMA_OUI                ATH_OUI
  823 #define TDMA_OUI_TYPE           0x02            /* TDMA protocol ie */
  824 
  825 #define BCM_OUI                 0x4c9000        /* Broadcom OUI */
  826 #define BCM_OUI_HTCAP           51              /* pre-draft HTCAP ie */
  827 #define BCM_OUI_HTINFO          52              /* pre-draft HTINFO ie */
  828 
  829 #define WPA_OUI                 0xf25000
  830 #define WPA_OUI_TYPE            0x01
  831 #define WPA_VERSION             1               /* current supported version */
  832 
  833 #define WPA_CSE_NULL            0x00
  834 #define WPA_CSE_WEP40           0x01
  835 #define WPA_CSE_TKIP            0x02
  836 #define WPA_CSE_CCMP            0x04
  837 #define WPA_CSE_WEP104          0x05
  838 
  839 #define WPA_ASE_NONE            0x00
  840 #define WPA_ASE_8021X_UNSPEC    0x01
  841 #define WPA_ASE_8021X_PSK       0x02
  842 
  843 #define WPS_OUI_TYPE            0x04
  844 
  845 #define RSN_OUI                 0xac0f00
  846 #define RSN_VERSION             1               /* current supported version */
  847 
  848 #define RSN_CSE_NULL            0x00
  849 #define RSN_CSE_WEP40           0x01
  850 #define RSN_CSE_TKIP            0x02
  851 #define RSN_CSE_WRAP            0x03
  852 #define RSN_CSE_CCMP            0x04
  853 #define RSN_CSE_WEP104          0x05
  854 
  855 #define RSN_ASE_NONE            0x00
  856 #define RSN_ASE_8021X_UNSPEC    0x01
  857 #define RSN_ASE_8021X_PSK       0x02
  858 
  859 #define RSN_CAP_PREAUTH         0x01
  860 
  861 #define WME_OUI                 0xf25000
  862 #define WME_OUI_TYPE            0x02
  863 #define WME_INFO_OUI_SUBTYPE    0x00
  864 #define WME_PARAM_OUI_SUBTYPE   0x01
  865 #define WME_VERSION             1
  866 
  867 /* WME stream classes */
  868 #define WME_AC_BE       0               /* best effort */
  869 #define WME_AC_BK       1               /* background */
  870 #define WME_AC_VI       2               /* video */
  871 #define WME_AC_VO       3               /* voice */
  872 
  873 /*
  874  * AUTH management packets
  875  *
  876  *      octet algo[2]
  877  *      octet seq[2]
  878  *      octet status[2]
  879  *      octet chal.id
  880  *      octet chal.length
  881  *      octet chal.text[253]            NB: 1-253 bytes
  882  */
  883 
  884 /* challenge length for shared key auth */
  885 #define IEEE80211_CHALLENGE_LEN         128
  886 
  887 #define IEEE80211_AUTH_ALG_OPEN         0x0000
  888 #define IEEE80211_AUTH_ALG_SHARED       0x0001
  889 #define IEEE80211_AUTH_ALG_LEAP         0x0080
  890 
  891 enum {
  892         IEEE80211_AUTH_OPEN_REQUEST             = 1,
  893         IEEE80211_AUTH_OPEN_RESPONSE            = 2,
  894 };
  895 
  896 enum {
  897         IEEE80211_AUTH_SHARED_REQUEST           = 1,
  898         IEEE80211_AUTH_SHARED_CHALLENGE         = 2,
  899         IEEE80211_AUTH_SHARED_RESPONSE          = 3,
  900         IEEE80211_AUTH_SHARED_PASS              = 4,
  901 };
  902 
  903 /*
  904  * Reason and status codes.
  905  *
  906  * Reason codes are used in management frames to indicate why an
  907  * action took place (e.g. on disassociation).  Status codes are
  908  * used in management frames to indicate the result of an operation.
  909  *
  910  * Unlisted codes are reserved
  911  */
  912 
  913 enum {
  914         IEEE80211_REASON_UNSPECIFIED            = 1,
  915         IEEE80211_REASON_AUTH_EXPIRE            = 2,
  916         IEEE80211_REASON_AUTH_LEAVE             = 3,
  917         IEEE80211_REASON_ASSOC_EXPIRE           = 4,
  918         IEEE80211_REASON_ASSOC_TOOMANY          = 5,
  919         IEEE80211_REASON_NOT_AUTHED             = 6,
  920         IEEE80211_REASON_NOT_ASSOCED            = 7,
  921         IEEE80211_REASON_ASSOC_LEAVE            = 8,
  922         IEEE80211_REASON_ASSOC_NOT_AUTHED       = 9,
  923         IEEE80211_REASON_DISASSOC_PWRCAP_BAD    = 10,   /* 11h */
  924         IEEE80211_REASON_DISASSOC_SUPCHAN_BAD   = 11,   /* 11h */
  925         IEEE80211_REASON_IE_INVALID             = 13,   /* 11i */
  926         IEEE80211_REASON_MIC_FAILURE            = 14,   /* 11i */
  927         IEEE80211_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,   /* 11i */
  928         IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, /* 11i */
  929         IEEE80211_REASON_IE_IN_4WAY_DIFFERS     = 17,   /* 11i */
  930         IEEE80211_REASON_GROUP_CIPHER_INVALID   = 18,   /* 11i */
  931         IEEE80211_REASON_PAIRWISE_CIPHER_INVALID= 19,   /* 11i */
  932         IEEE80211_REASON_AKMP_INVALID           = 20,   /* 11i */
  933         IEEE80211_REASON_UNSUPP_RSN_IE_VERSION  = 21,   /* 11i */
  934         IEEE80211_REASON_INVALID_RSN_IE_CAP     = 22,   /* 11i */
  935         IEEE80211_REASON_802_1X_AUTH_FAILED     = 23,   /* 11i */
  936         IEEE80211_REASON_CIPHER_SUITE_REJECTED  = 24,   /* 11i */
  937         IEEE80211_REASON_UNSPECIFIED_QOS        = 32,   /* 11e */
  938         IEEE80211_REASON_INSUFFICIENT_BW        = 33,   /* 11e */
  939         IEEE80211_REASON_TOOMANY_FRAMES         = 34,   /* 11e */
  940         IEEE80211_REASON_OUTSIDE_TXOP           = 35,   /* 11e */
  941         IEEE80211_REASON_LEAVING_QBSS           = 36,   /* 11e */
  942         IEEE80211_REASON_BAD_MECHANISM          = 37,   /* 11e */
  943         IEEE80211_REASON_SETUP_NEEDED           = 38,   /* 11e */
  944         IEEE80211_REASON_TIMEOUT                = 39,   /* 11e */
  945 
  946         IEEE80211_REASON_PEER_LINK_CANCELED     = 52,   /* 11s */
  947         IEEE80211_REASON_MESH_MAX_PEERS         = 53,   /* 11s */
  948         IEEE80211_REASON_MESH_CPVIOLATION       = 54,   /* 11s */
  949         IEEE80211_REASON_MESH_CLOSE_RCVD        = 55,   /* 11s */
  950         IEEE80211_REASON_MESH_MAX_RETRIES       = 56,   /* 11s */
  951         IEEE80211_REASON_MESH_CONFIRM_TIMEOUT   = 57,   /* 11s */
  952         IEEE80211_REASON_MESH_INVALID_GTK       = 58,   /* 11s */
  953         IEEE80211_REASON_MESH_INCONS_PARAMS     = 59,   /* 11s */
  954         IEEE80211_REASON_MESH_INVALID_SECURITY  = 60,   /* 11s */
  955         IEEE80211_REASON_MESH_PERR_NO_PROXY     = 61,   /* 11s */
  956         IEEE80211_REASON_MESH_PERR_NO_FI        = 62,   /* 11s */
  957         IEEE80211_REASON_MESH_PERR_DEST_UNREACH = 63,   /* 11s */
  958         IEEE80211_REASON_MESH_MAC_ALRDY_EXISTS_MBSS = 64, /* 11s */
  959         IEEE80211_REASON_MESH_CHAN_SWITCH_REG   = 65,   /* 11s */
  960         IEEE80211_REASON_MESH_CHAN_SWITCH_UNSPEC = 66,  /* 11s */
  961 
  962         IEEE80211_STATUS_SUCCESS                = 0,
  963         IEEE80211_STATUS_UNSPECIFIED            = 1,
  964         IEEE80211_STATUS_CAPINFO                = 10,
  965         IEEE80211_STATUS_NOT_ASSOCED            = 11,
  966         IEEE80211_STATUS_OTHER                  = 12,
  967         IEEE80211_STATUS_ALG                    = 13,
  968         IEEE80211_STATUS_SEQUENCE               = 14,
  969         IEEE80211_STATUS_CHALLENGE              = 15,
  970         IEEE80211_STATUS_TIMEOUT                = 16,
  971         IEEE80211_STATUS_TOOMANY                = 17,
  972         IEEE80211_STATUS_BASIC_RATE             = 18,
  973         IEEE80211_STATUS_SP_REQUIRED            = 19,   /* 11b */
  974         IEEE80211_STATUS_PBCC_REQUIRED          = 20,   /* 11b */
  975         IEEE80211_STATUS_CA_REQUIRED            = 21,   /* 11b */
  976         IEEE80211_STATUS_SPECMGMT_REQUIRED      = 22,   /* 11h */
  977         IEEE80211_STATUS_PWRCAP_REQUIRED        = 23,   /* 11h */
  978         IEEE80211_STATUS_SUPCHAN_REQUIRED       = 24,   /* 11h */
  979         IEEE80211_STATUS_SHORTSLOT_REQUIRED     = 25,   /* 11g */
  980         IEEE80211_STATUS_DSSSOFDM_REQUIRED      = 26,   /* 11g */
  981         IEEE80211_STATUS_MISSING_HT_CAPS        = 27,   /* 11n D3.0 */
  982         IEEE80211_STATUS_INVALID_IE             = 40,   /* 11i */
  983         IEEE80211_STATUS_GROUP_CIPHER_INVALID   = 41,   /* 11i */
  984         IEEE80211_STATUS_PAIRWISE_CIPHER_INVALID = 42,  /* 11i */
  985         IEEE80211_STATUS_AKMP_INVALID           = 43,   /* 11i */
  986         IEEE80211_STATUS_UNSUPP_RSN_IE_VERSION  = 44,   /* 11i */
  987         IEEE80211_STATUS_INVALID_RSN_IE_CAP     = 45,   /* 11i */
  988         IEEE80211_STATUS_CIPHER_SUITE_REJECTED  = 46,   /* 11i */
  989 };
  990 
  991 #define IEEE80211_WEP_KEYLEN            5       /* 40bit */
  992 #define IEEE80211_WEP_IVLEN             3       /* 24bit */
  993 #define IEEE80211_WEP_KIDLEN            1       /* 1 octet */
  994 #define IEEE80211_WEP_CRCLEN            4       /* CRC-32 */
  995 #define IEEE80211_WEP_TOTLEN            (IEEE80211_WEP_IVLEN + \
  996                                          IEEE80211_WEP_KIDLEN + \
  997                                          IEEE80211_WEP_CRCLEN)
  998 #define IEEE80211_WEP_NKID              4       /* number of key ids */
  999 
 1000 /*
 1001  * 802.11i defines an extended IV for use with non-WEP ciphers.
 1002  * When the EXTIV bit is set in the key id byte an additional
 1003  * 4 bytes immediately follow the IV for TKIP.  For CCMP the
 1004  * EXTIV bit is likewise set but the 8 bytes represent the
 1005  * CCMP header rather than IV+extended-IV.
 1006  */
 1007 #define IEEE80211_WEP_EXTIV             0x20
 1008 #define IEEE80211_WEP_EXTIVLEN          4       /* extended IV length */
 1009 #define IEEE80211_WEP_MICLEN            8       /* trailing MIC */
 1010 
 1011 #define IEEE80211_CRC_LEN               4
 1012 
 1013 /*
 1014  * Maximum acceptable MTU is:
 1015  *      IEEE80211_MAX_LEN - WEP overhead - CRC -
 1016  *              QoS overhead - RSN/WPA overhead
 1017  * Min is arbitrarily chosen > IEEE80211_MIN_LEN.  The default
 1018  * mtu is Ethernet-compatible; it's set by ether_ifattach.
 1019  */
 1020 #define IEEE80211_MTU_MAX               2290
 1021 #define IEEE80211_MTU_MIN               32
 1022 
 1023 #define IEEE80211_MAX_LEN               (2300 + IEEE80211_CRC_LEN + \
 1024     (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
 1025 #define IEEE80211_ACK_LEN \
 1026         (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
 1027 #define IEEE80211_MIN_LEN \
 1028         (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
 1029 
 1030 /*
 1031  * The 802.11 spec says at most 2007 stations may be
 1032  * associated at once.  For most AP's this is way more
 1033  * than is feasible so we use a default of IEEE80211_AID_DEF.
 1034  * This number may be overridden by the driver and/or by
 1035  * user configuration but may not be less than IEEE80211_AID_MIN
 1036  * (see _ieee80211.h for implementation-specific settings).
 1037  */
 1038 #define IEEE80211_AID_MAX               2007
 1039 
 1040 #define IEEE80211_AID(b)        ((b) &~ 0xc000)
 1041 
 1042 /* 
 1043  * RTS frame length parameters.  The default is specified in
 1044  * the 802.11 spec as 512; we treat it as implementation-dependent
 1045  * so it's defined in ieee80211_var.h.  The max may be wrong
 1046  * for jumbo frames.
 1047  */
 1048 #define IEEE80211_RTS_MIN               1
 1049 #define IEEE80211_RTS_MAX               2346
 1050 
 1051 /* 
 1052  * TX fragmentation parameters.  As above for RTS, we treat
 1053  * default as implementation-dependent so define it elsewhere.
 1054  */
 1055 #define IEEE80211_FRAG_MIN              256
 1056 #define IEEE80211_FRAG_MAX              2346
 1057 
 1058 /*
 1059  * Beacon interval (TU's).  Min+max come from WiFi requirements.
 1060  * As above, we treat default as implementation-dependent so
 1061  * define it elsewhere.
 1062  */
 1063 #define IEEE80211_BINTVAL_MAX   1000    /* max beacon interval (TU's) */
 1064 #define IEEE80211_BINTVAL_MIN   25      /* min beacon interval (TU's) */
 1065 
 1066 /*
 1067  * DTIM period (beacons).  Min+max are not really defined
 1068  * by the protocol but we want them publicly visible so
 1069  * define them here.
 1070  */
 1071 #define IEEE80211_DTIM_MAX      15      /* max DTIM period */
 1072 #define IEEE80211_DTIM_MIN      1       /* min DTIM period */
 1073 
 1074 /*
 1075  * Beacon miss threshold (beacons).  As for DTIM, we define
 1076  * them here to be publicly visible.  Note the max may be
 1077  * clamped depending on device capabilities.
 1078  */
 1079 #define IEEE80211_HWBMISS_MIN   1
 1080 #define IEEE80211_HWBMISS_MAX   255
 1081 
 1082 /*
 1083  * 802.11 frame duration definitions.
 1084  */
 1085 
 1086 struct ieee80211_duration {
 1087         uint16_t        d_rts_dur;
 1088         uint16_t        d_data_dur;
 1089         uint16_t        d_plcp_len;
 1090         uint8_t         d_residue;      /* unused octets in time slot */
 1091 };
 1092 
 1093 /* One Time Unit (TU) is 1Kus = 1024 microseconds. */
 1094 #define IEEE80211_DUR_TU                1024
 1095 
 1096 /* IEEE 802.11b durations for DSSS PHY in microseconds */
 1097 #define IEEE80211_DUR_DS_LONG_PREAMBLE  144
 1098 #define IEEE80211_DUR_DS_SHORT_PREAMBLE 72
 1099 
 1100 #define IEEE80211_DUR_DS_SLOW_PLCPHDR   48
 1101 #define IEEE80211_DUR_DS_FAST_PLCPHDR   24
 1102 #define IEEE80211_DUR_DS_SLOW_ACK       112
 1103 #define IEEE80211_DUR_DS_FAST_ACK       56
 1104 #define IEEE80211_DUR_DS_SLOW_CTS       112
 1105 #define IEEE80211_DUR_DS_FAST_CTS       56
 1106 
 1107 #define IEEE80211_DUR_DS_SLOT           20
 1108 #define IEEE80211_DUR_DS_SIFS           10
 1109 #define IEEE80211_DUR_DS_PIFS   (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT)
 1110 #define IEEE80211_DUR_DS_DIFS   (IEEE80211_DUR_DS_SIFS + \
 1111                                  2 * IEEE80211_DUR_DS_SLOT)
 1112 #define IEEE80211_DUR_DS_EIFS   (IEEE80211_DUR_DS_SIFS + \
 1113                                  IEEE80211_DUR_DS_SLOW_ACK + \
 1114                                  IEEE80211_DUR_DS_LONG_PREAMBLE + \
 1115                                  IEEE80211_DUR_DS_SLOW_PLCPHDR + \
 1116                                  IEEE80211_DUR_DIFS)
 1117 
 1118 #endif /* _NET80211_IEEE80211_H_ */

Cache object: 9fd35ea1f8b96178ee294405fb05d48a


[ 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.