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 /*      $NetBSD: ieee80211.h,v 1.21 2010/11/03 20:05:21 christos Exp $  */
    2 /*-
    3  * Copyright (c) 2001 Atsushi Onoe
    4  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. The name of the author may not be used to endorse or promote products
   16  *    derived from this software without specific prior written permission.
   17  *
   18  * Alternatively, this software may be distributed under the terms of the
   19  * GNU General Public License ("GPL") version 2 as published by the Free
   20  * Software Foundation.
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   32  *
   33  * $FreeBSD: src/sys/net80211/ieee80211.h,v 1.10 2005/07/22 16:55:27 sam Exp $
   34  */
   35 #ifndef _NET80211_IEEE80211_H_
   36 #define _NET80211_IEEE80211_H_
   37 
   38 /*
   39  * 802.11 protocol definitions.
   40  */
   41 
   42 #define IEEE80211_ADDR_LEN      6               /* size of 802.11 address */
   43 /* is 802.11 address multicast/broadcast? */
   44 #define IEEE80211_IS_MULTICAST(_a)      (*(_a) & 0x01)
   45 
   46 /* IEEE 802.11 PLCP header */
   47 struct ieee80211_plcp_hdr {
   48         u_int16_t       i_sfd;
   49         u_int8_t        i_signal;
   50         u_int8_t        i_service;
   51         u_int16_t       i_length;
   52         u_int16_t       i_crc;
   53 } __packed;
   54 
   55 #define IEEE80211_PLCP_SFD      0xF3A0 
   56 #define IEEE80211_PLCP_SERVICE  0x00
   57 
   58 /*
   59  * generic definitions for IEEE 802.11 frames
   60  */
   61 struct ieee80211_frame {
   62         u_int8_t        i_fc[2];
   63         u_int8_t        i_dur[2];
   64         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
   65         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
   66         u_int8_t        i_addr3[IEEE80211_ADDR_LEN];
   67         u_int8_t        i_seq[2];
   68         /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
   69         /* see below */
   70 } __packed;
   71 
   72 struct ieee80211_qosframe {
   73         u_int8_t        i_fc[2];
   74         u_int8_t        i_dur[2];
   75         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
   76         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
   77         u_int8_t        i_addr3[IEEE80211_ADDR_LEN];
   78         u_int8_t        i_seq[2];
   79         u_int8_t        i_qos[2];
   80         /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
   81         /* see below */
   82 } __packed;
   83 
   84 struct ieee80211_qoscntl {
   85         u_int8_t        i_qos[2];
   86 };
   87 
   88 struct ieee80211_frame_addr4 {
   89         u_int8_t        i_fc[2];
   90         u_int8_t        i_dur[2];
   91         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
   92         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
   93         u_int8_t        i_addr3[IEEE80211_ADDR_LEN];
   94         u_int8_t        i_seq[2];
   95         u_int8_t        i_addr4[IEEE80211_ADDR_LEN];
   96 } __packed;
   97 
   98 
   99 struct ieee80211_qosframe_addr4 {
  100         u_int8_t        i_fc[2];
  101         u_int8_t        i_dur[2];
  102         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
  103         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
  104         u_int8_t        i_addr3[IEEE80211_ADDR_LEN];
  105         u_int8_t        i_seq[2];
  106         u_int8_t        i_addr4[IEEE80211_ADDR_LEN];
  107         u_int8_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 /* for TYPE_CTL */
  134 #define IEEE80211_FC0_SUBTYPE_PS_POLL           0xa0
  135 #define IEEE80211_FC0_SUBTYPE_RTS               0xb0
  136 #define IEEE80211_FC0_SUBTYPE_CTS               0xc0
  137 #define IEEE80211_FC0_SUBTYPE_ACK               0xd0
  138 #define IEEE80211_FC0_SUBTYPE_CF_END            0xe0
  139 #define IEEE80211_FC0_SUBTYPE_CF_END_ACK        0xf0
  140 /* for TYPE_DATA (bit combination) */
  141 #define IEEE80211_FC0_SUBTYPE_DATA              0x00
  142 #define IEEE80211_FC0_SUBTYPE_CF_ACK            0x10
  143 #define IEEE80211_FC0_SUBTYPE_CF_POLL           0x20
  144 #define IEEE80211_FC0_SUBTYPE_CF_ACPL           0x30
  145 #define IEEE80211_FC0_SUBTYPE_NODATA            0x40
  146 #define IEEE80211_FC0_SUBTYPE_CFACK             0x50
  147 #define IEEE80211_FC0_SUBTYPE_CFPOLL            0x60
  148 #define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK     0x70
  149 #define IEEE80211_FC0_SUBTYPE_QOS               0x80
  150 #define IEEE80211_FC0_SUBTYPE_QOS_NULL          0xc0
  151 
  152 #define IEEE80211_FC1_DIR_MASK                  0x03
  153 #define IEEE80211_FC1_DIR_NODS                  0x00    /* STA->STA */
  154 #define IEEE80211_FC1_DIR_TODS                  0x01    /* STA->AP  */
  155 #define IEEE80211_FC1_DIR_FROMDS                0x02    /* AP ->STA */
  156 #define IEEE80211_FC1_DIR_DSTODS                0x03    /* AP ->AP  */
  157 
  158 #define IEEE80211_FC1_MORE_FRAG                 0x04
  159 #define IEEE80211_FC1_RETRY                     0x08
  160 #define IEEE80211_FC1_PWR_MGT                   0x10
  161 #define IEEE80211_FC1_MORE_DATA                 0x20
  162 #define IEEE80211_FC1_PROTECTED                 0x40
  163 #define IEEE80211_FC1_WEP                       0x40    /* pre-RSNA compat */
  164 #define IEEE80211_FC1_ORDER                     0x80
  165 
  166 #define IEEE80211_SEQ_FRAG_MASK                 0x000f
  167 #define IEEE80211_SEQ_FRAG_SHIFT                0
  168 #define IEEE80211_SEQ_SEQ_MASK                  0xfff0
  169 #define IEEE80211_SEQ_SEQ_SHIFT                 4
  170 
  171 #define IEEE80211_NWID_LEN                      32
  172 
  173 #define IEEE80211_QOS_TXOP                      0x00ff
  174 /* bit 8 is reserved */
  175 #define IEEE80211_QOS_ACKPOLICY                 0x60
  176 #define IEEE80211_QOS_ACKPOLICY_S               5
  177 #define IEEE80211_QOS_ESOP                      0x10
  178 #define IEEE80211_QOS_ESOP_S                    4
  179 #define IEEE80211_QOS_TID                       0x0f
  180 
  181 /* does frame have QoS sequence control data */
  182 #define IEEE80211_QOS_HAS_SEQ(wh) \
  183         (((wh)->i_fc[0] & \
  184           (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \
  185           (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
  186 
  187 /*
  188  * WME/802.11e information element.
  189  */
  190 struct ieee80211_wme_info {
  191         u_int8_t        wme_id;         /* IEEE80211_ELEMID_VENDOR */
  192         u_int8_t        wme_len;        /* length in bytes */
  193         u_int8_t        wme_oui[3];     /* 0x00, 0x50, 0xf2 */
  194         u_int8_t        wme_type;       /* OUI type */
  195         u_int8_t        wme_subtype;    /* OUI subtype */
  196         u_int8_t        wme_version;    /* spec revision */
  197         u_int8_t        wme_info;       /* QoS info */
  198 } __packed;
  199 
  200 /*
  201  * WME/802.11e Tspec Element
  202  */
  203 struct ieee80211_wme_tspec {
  204         u_int8_t        ts_id;
  205         u_int8_t        ts_len;
  206         u_int8_t        ts_oui[3];
  207         u_int8_t        ts_oui_type;
  208         u_int8_t        ts_oui_subtype;
  209         u_int8_t        ts_version;
  210         u_int8_t        ts_tsinfo[3];
  211         u_int8_t        ts_nom_msdu[2];
  212         u_int8_t        ts_max_msdu[2];
  213         u_int8_t        ts_min_svc[4];
  214         u_int8_t        ts_max_svc[4];
  215         u_int8_t        ts_inactv_intv[4];
  216         u_int8_t        ts_susp_intv[4];
  217         u_int8_t        ts_start_svc[4];
  218         u_int8_t        ts_min_rate[4];
  219         u_int8_t        ts_mean_rate[4];
  220         u_int8_t        ts_max_burst[4];
  221         u_int8_t        ts_min_phy[4];
  222         u_int8_t        ts_peak_rate[4];
  223         u_int8_t        ts_delay[4];
  224         u_int8_t        ts_surplus[2];
  225         u_int8_t        ts_medium_time[2];
  226 } __packed;
  227 
  228 /*
  229  * WME AC parameter field
  230  */
  231 struct ieee80211_wme_acparams {
  232         u_int8_t        acp_aci_aifsn;
  233         u_int8_t        acp_logcwminmax;
  234         u_int16_t       acp_txop;
  235 } __packed;
  236 
  237 #define WME_NUM_AC              4       /* 4 AC categories */
  238 
  239 #define WME_PARAM_ACI           0x60    /* Mask for ACI field */
  240 #define WME_PARAM_ACI_S         5       /* Shift for ACI field */
  241 #define WME_PARAM_ACM           0x10    /* Mask for ACM bit */
  242 #define WME_PARAM_ACM_S         4       /* Shift for ACM bit */
  243 #define WME_PARAM_AIFSN         0x0f    /* Mask for aifsn field */
  244 #define WME_PARAM_AIFSN_S       0       /* Shift for aifsn field */
  245 #define WME_PARAM_LOGCWMIN      0x0f    /* Mask for CwMin field (in log) */
  246 #define WME_PARAM_LOGCWMIN_S    0       /* Shift for CwMin field */
  247 #define WME_PARAM_LOGCWMAX      0xf0    /* Mask for CwMax field (in log) */
  248 #define WME_PARAM_LOGCWMAX_S    4       /* Shift for CwMax field */
  249 
  250 #define WME_AC_TO_TID(_ac) (       \
  251         ((_ac) == WME_AC_VO) ? 6 : \
  252         ((_ac) == WME_AC_VI) ? 5 : \
  253         ((_ac) == WME_AC_BK) ? 1 : \
  254         0)
  255 
  256 #define TID_TO_WME_AC(_tid) (      \
  257         ((_tid) < 1) ? WME_AC_BE : \
  258         ((_tid) < 3) ? WME_AC_BK : \
  259         ((_tid) < 6) ? WME_AC_VI : \
  260         WME_AC_VO)
  261 
  262 /*
  263  * WME Parameter Element
  264  */
  265 struct ieee80211_wme_param {
  266         u_int8_t        param_id;
  267         u_int8_t        param_len;
  268         u_int8_t        param_oui[3];
  269         u_int8_t        param_oui_type;
  270         u_int8_t        param_oui_sybtype;
  271         u_int8_t        param_version;
  272         u_int8_t        param_qosInfo;
  273 #define WME_QOSINFO_COUNT       0x0f    /* Mask for param count field */
  274         u_int8_t        param_reserved;
  275         struct ieee80211_wme_acparams   params_acParams[WME_NUM_AC];
  276 } __packed;
  277 
  278 /*
  279  * Management Notification Frame
  280  */
  281 struct ieee80211_mnf {
  282         u_int8_t        mnf_category;
  283         u_int8_t        mnf_action;
  284         u_int8_t        mnf_dialog;
  285         u_int8_t        mnf_status;
  286 } __packed;
  287 #define MNF_SETUP_REQ   0
  288 #define MNF_SETUP_RESP  1
  289 #define MNF_TEARDOWN    2
  290 
  291 /*
  292  * Control frames.
  293  */
  294 struct ieee80211_frame_min {
  295         u_int8_t        i_fc[2];
  296         u_int8_t        i_dur[2];
  297         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
  298         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
  299         /* FCS */
  300 } __packed;
  301 
  302 struct ieee80211_frame_rts {
  303         u_int8_t        i_fc[2];
  304         u_int8_t        i_dur[2];
  305         u_int8_t        i_ra[IEEE80211_ADDR_LEN];
  306         u_int8_t        i_ta[IEEE80211_ADDR_LEN];
  307         /* FCS */
  308 } __packed;
  309 
  310 struct ieee80211_frame_cts {
  311         u_int8_t        i_fc[2];
  312         u_int8_t        i_dur[2];
  313         u_int8_t        i_ra[IEEE80211_ADDR_LEN];
  314         /* FCS */
  315 } __packed;
  316 
  317 struct ieee80211_frame_ack {
  318         u_int8_t        i_fc[2];
  319         u_int8_t        i_dur[2];
  320         u_int8_t        i_ra[IEEE80211_ADDR_LEN];
  321         /* FCS */
  322 } __packed;
  323 
  324 struct ieee80211_frame_pspoll {
  325         u_int8_t        i_fc[2];
  326         u_int8_t        i_aid[2];
  327         u_int8_t        i_bssid[IEEE80211_ADDR_LEN];
  328         u_int8_t        i_ta[IEEE80211_ADDR_LEN];
  329         /* FCS */
  330 } __packed;
  331 
  332 struct ieee80211_frame_cfend {          /* NB: also CF-End+CF-Ack */
  333         u_int8_t        i_fc[2];
  334         u_int8_t        i_dur[2];       /* should be zero */
  335         u_int8_t        i_ra[IEEE80211_ADDR_LEN];
  336         u_int8_t        i_bssid[IEEE80211_ADDR_LEN];
  337         /* FCS */
  338 } __packed;
  339 
  340 /*
  341  * BEACON management packets
  342  *
  343  *      octet timestamp[8]
  344  *      octet beacon interval[2]
  345  *      octet capability information[2]
  346  *      information element
  347  *              octet elemid
  348  *              octet length
  349  *              octet information[length]
  350  */
  351 
  352 typedef u_int8_t *ieee80211_mgt_beacon_t;
  353 
  354 #define IEEE80211_BEACON_INTERVAL(beacon) \
  355         ((beacon)[8] | ((beacon)[9] << 8))
  356 #define IEEE80211_BEACON_CAPABILITY(beacon) \
  357         ((beacon)[10] | ((beacon)[11] << 8))
  358 
  359 #define IEEE80211_CAPINFO_ESS                   0x0001
  360 #define IEEE80211_CAPINFO_IBSS                  0x0002
  361 #define IEEE80211_CAPINFO_CF_POLLABLE           0x0004
  362 #define IEEE80211_CAPINFO_CF_POLLREQ            0x0008
  363 #define IEEE80211_CAPINFO_PRIVACY               0x0010
  364 #define IEEE80211_CAPINFO_SHORT_PREAMBLE        0x0020
  365 #define IEEE80211_CAPINFO_PBCC                  0x0040
  366 #define IEEE80211_CAPINFO_CHNL_AGILITY          0x0080
  367 /* bits 8-9 are reserved */
  368 #define IEEE80211_CAPINFO_SHORT_SLOTTIME        0x0400
  369 #define IEEE80211_CAPINFO_RSN                   0x0800
  370 /* bit 12 is reserved */
  371 #define IEEE80211_CAPINFO_DSSSOFDM              0x2000
  372 /* bits 14-15 are reserved */
  373 
  374 /*
  375  * 802.11i/WPA information element (maximally sized).
  376  */
  377 struct ieee80211_ie_wpa {
  378         u_int8_t        wpa_id;         /* IEEE80211_ELEMID_VENDOR */
  379         u_int8_t        wpa_len;        /* length in bytes */
  380         u_int8_t        wpa_oui[3];     /* 0x00, 0x50, 0xf2 */
  381         u_int8_t        wpa_type;       /* OUI type */
  382         u_int16_t       wpa_version;    /* spec revision */
  383         u_int32_t       wpa_mcipher[1]; /* multicast/group key cipher */
  384         u_int16_t       wpa_uciphercnt; /* # pairwise key ciphers */
  385         u_int32_t       wpa_uciphers[8];/* ciphers */
  386         u_int16_t       wpa_authselcnt; /* authentication selector cnt*/
  387         u_int32_t       wpa_authsels[8];/* selectors */
  388         u_int16_t       wpa_caps;       /* 802.11i capabilities */
  389         u_int16_t       wpa_pmkidcnt;   /* 802.11i pmkid count */
  390         u_int16_t       wpa_pmkids[8];  /* 802.11i pmkids */
  391 } __packed;
  392 
  393 /*
  394  * Management information element payloads.
  395  */
  396 
  397 enum {
  398         IEEE80211_ELEMID_SSID           = 0,
  399         IEEE80211_ELEMID_RATES          = 1,
  400         IEEE80211_ELEMID_FHPARMS        = 2,
  401         IEEE80211_ELEMID_DSPARMS        = 3,
  402         IEEE80211_ELEMID_CFPARMS        = 4,
  403         IEEE80211_ELEMID_TIM            = 5,
  404         IEEE80211_ELEMID_IBSSPARMS      = 6,
  405         IEEE80211_ELEMID_COUNTRY        = 7,
  406         IEEE80211_ELEMID_EDCAPARMS      = 12,
  407         IEEE80211_ELEMID_CHALLENGE      = 16,
  408         /* 17-31 reserved for challenge text extension */
  409         IEEE80211_ELEMID_PWRCNSTR       = 32,
  410         IEEE80211_ELEMID_PWRCAP         = 33,
  411         IEEE80211_ELEMID_TPCREQ         = 34,
  412         IEEE80211_ELEMID_TPCREP         = 35,
  413         IEEE80211_ELEMID_SUPPCHAN       = 36,
  414         IEEE80211_ELEMID_CHANSWITCHANN  = 37,
  415         IEEE80211_ELEMID_MEASREQ        = 38,
  416         IEEE80211_ELEMID_MEASREP        = 39,
  417         IEEE80211_ELEMID_QUIET          = 40,
  418         IEEE80211_ELEMID_IBSSDFS        = 41,
  419         IEEE80211_ELEMID_ERP            = 42,
  420         IEEE80211_ELEMID_HTCAP          = 45,   /* 11n */
  421         IEEE80211_ELEMID_QOS_CAP        = 46,
  422         IEEE80211_ELEMID_RSN            = 48,
  423         IEEE80211_ELEMID_XRATES         = 50,
  424         IEEE80211_ELEMID_TIE            = 56,   /* 11r */
  425         IEEE80211_ELEMID_HTINFO         = 61,   /* 11n */
  426         IEEE80211_ELEMID_MMIE           = 76,   /* 11w */
  427         IEEE80211_ELEMID_TPC            = 150,
  428         IEEE80211_ELEMID_CCKM           = 156,
  429         IEEE80211_ELEMID_VENDOR         = 221   /* vendor private */
  430 };
  431 
  432 struct ieee80211_tim_ie {
  433         u_int8_t        tim_ie;                 /* IEEE80211_ELEMID_TIM */
  434         u_int8_t        tim_len;
  435         u_int8_t        tim_count;              /* DTIM count */
  436         u_int8_t        tim_period;             /* DTIM period */
  437         u_int8_t        tim_bitctl;             /* bitmap control */
  438         u_int8_t        tim_bitmap[1];          /* variable-length bitmap */
  439 } __packed;
  440 
  441 struct ieee80211_band {
  442         u_int8_t schan;                 /* starting channel */
  443         u_int8_t nchan;                 /* number channels */
  444         u_int8_t maxtxpwr;              /* tx power cap */
  445 } __packed;
  446 
  447 struct ieee80211_country_ie {
  448         u_int8_t        ie;                     /* IEEE80211_ELEMID_COUNTRY */
  449         u_int8_t        len;
  450         u_int8_t        cc[3];                  /* ISO CC+(I)ndoor/(O)utdoor */
  451         struct ieee80211_band band[4];          /* up to 4 sub bands */
  452 } __packed;
  453 
  454 #define IEEE80211_CHALLENGE_LEN         128
  455 
  456 #define IEEE80211_RATE_BASIC            0x80
  457 #define IEEE80211_RATE_VAL              0x7f
  458 
  459 /* EPR information element flags */
  460 #define IEEE80211_ERP_NON_ERP_PRESENT   0x01
  461 #define IEEE80211_ERP_USE_PROTECTION    0x02
  462 #define IEEE80211_ERP_LONG_PREAMBLE     0x04
  463 
  464 /* Atheros private advanced capabilities info */
  465 #define ATHEROS_CAP_TURBO_PRIME         0x01
  466 #define ATHEROS_CAP_COMPRESSION         0x02
  467 #define ATHEROS_CAP_FAST_FRAME          0x04
  468 /* bits 3-6 reserved */
  469 #define ATHEROS_CAP_BOOST               0x80
  470 
  471 #define ATH_OUI                 0x7f0300                /* Atheros OUI */
  472 #define ATH_OUI_TYPE            0x01
  473 #define ATH_OUI_VERSION         0x01
  474 
  475 #define WPA_OUI                 0xf25000
  476 #define WPA_OUI_TYPE            0x01
  477 #define WPA_VERSION             1               /* current supported version */
  478 
  479 #define WPA_CSE_NULL            0x00
  480 #define WPA_CSE_WEP40           0x01
  481 #define WPA_CSE_TKIP            0x02
  482 #define WPA_CSE_CCMP            0x04
  483 #define WPA_CSE_WEP104          0x05
  484 
  485 #define WPA_ASE_NONE            0x00
  486 #define WPA_ASE_8021X_UNSPEC    0x01
  487 #define WPA_ASE_8021X_PSK       0x02
  488 
  489 #define RSN_OUI                 0xac0f00
  490 #define RSN_VERSION             1               /* current supported version */
  491 
  492 #define RSN_CSE_NULL            0x00
  493 #define RSN_CSE_WEP40           0x01
  494 #define RSN_CSE_TKIP            0x02
  495 #define RSN_CSE_WRAP            0x03
  496 #define RSN_CSE_CCMP            0x04
  497 #define RSN_CSE_WEP104          0x05
  498 
  499 #define RSN_ASE_NONE            0x00
  500 #define RSN_ASE_8021X_UNSPEC    0x01
  501 #define RSN_ASE_8021X_PSK       0x02
  502 
  503 #define RSN_CAP_PREAUTH         0x01
  504 
  505 #define WME_OUI                 0xf25000
  506 #define WME_OUI_TYPE            0x02
  507 #define WME_INFO_OUI_SUBTYPE    0x00
  508 #define WME_PARAM_OUI_SUBTYPE   0x01
  509 #define WME_VERSION             1
  510 
  511 /* WME stream classes */
  512 #define WME_AC_BE       0               /* best effort */
  513 #define WME_AC_BK       1               /* background */
  514 #define WME_AC_VI       2               /* video */
  515 #define WME_AC_VO       3               /* voice */
  516 
  517 /*
  518  * AUTH management packets
  519  *
  520  *      octet algo[2]
  521  *      octet seq[2]
  522  *      octet status[2]
  523  *      octet chal.id
  524  *      octet chal.length
  525  *      octet chal.text[253]
  526  */
  527 
  528 typedef u_int8_t *ieee80211_mgt_auth_t;
  529 
  530 #define IEEE80211_AUTH_ALGORITHM(auth) \
  531         ((auth)[0] | ((auth)[1] << 8))
  532 #define IEEE80211_AUTH_TRANSACTION(auth) \
  533         ((auth)[2] | ((auth)[3] << 8))
  534 #define IEEE80211_AUTH_STATUS(auth) \
  535         ((auth)[4] | ((auth)[5] << 8))
  536 
  537 #define IEEE80211_AUTH_ALG_OPEN         0x0000
  538 #define IEEE80211_AUTH_ALG_SHARED       0x0001
  539 #define IEEE80211_AUTH_ALG_LEAP         0x0080
  540 
  541 enum {
  542         IEEE80211_AUTH_OPEN_REQUEST             = 1,
  543         IEEE80211_AUTH_OPEN_RESPONSE            = 2
  544 };
  545 
  546 enum {
  547         IEEE80211_AUTH_SHARED_REQUEST           = 1,
  548         IEEE80211_AUTH_SHARED_CHALLENGE         = 2,
  549         IEEE80211_AUTH_SHARED_RESPONSE          = 3,
  550         IEEE80211_AUTH_SHARED_PASS              = 4
  551 };
  552 
  553 /*
  554  * Reason codes
  555  *
  556  * Unlisted codes are reserved
  557  */
  558 
  559 enum {
  560         IEEE80211_REASON_UNSPECIFIED            = 1,
  561         IEEE80211_REASON_AUTH_EXPIRE            = 2,
  562         IEEE80211_REASON_AUTH_LEAVE             = 3,
  563         IEEE80211_REASON_ASSOC_EXPIRE           = 4,
  564         IEEE80211_REASON_ASSOC_TOOMANY          = 5,
  565         IEEE80211_REASON_NOT_AUTHED             = 6,
  566         IEEE80211_REASON_NOT_ASSOCED            = 7,
  567         IEEE80211_REASON_ASSOC_LEAVE            = 8,
  568         IEEE80211_REASON_ASSOC_NOT_AUTHED       = 9,
  569 
  570         IEEE80211_REASON_RSN_REQUIRED           = 11,
  571         IEEE80211_REASON_RSN_INCONSISTENT       = 12,
  572         IEEE80211_REASON_IE_INVALID             = 13,
  573         IEEE80211_REASON_MIC_FAILURE            = 14,
  574 
  575         IEEE80211_STATUS_SUCCESS                = 0,
  576         IEEE80211_STATUS_UNSPECIFIED            = 1,
  577         IEEE80211_STATUS_CAPINFO                = 10,
  578         IEEE80211_STATUS_NOT_ASSOCED            = 11,
  579         IEEE80211_STATUS_OTHER                  = 12,
  580         IEEE80211_STATUS_ALG                    = 13,
  581         IEEE80211_STATUS_SEQUENCE               = 14,
  582         IEEE80211_STATUS_CHALLENGE              = 15,
  583         IEEE80211_STATUS_TIMEOUT                = 16,
  584         IEEE80211_STATUS_TOOMANY                = 17,
  585         IEEE80211_STATUS_BASIC_RATE             = 18,
  586         IEEE80211_STATUS_SP_REQUIRED            = 19,
  587         IEEE80211_STATUS_PBCC_REQUIRED          = 20,
  588         IEEE80211_STATUS_CA_REQUIRED            = 21,
  589         IEEE80211_STATUS_TOO_MANY_STATIONS      = 22,
  590         IEEE80211_STATUS_RATES                  = 23,
  591         IEEE80211_STATUS_SHORTSLOT_REQUIRED     = 25,
  592         IEEE80211_STATUS_DSSSOFDM_REQUIRED      = 26
  593 };
  594 
  595 #define IEEE80211_WEP_KEYLEN            5       /* 40bit */
  596 #define IEEE80211_WEP_IVLEN             3       /* 24bit */
  597 #define IEEE80211_WEP_KIDLEN            1       /* 1 octet */
  598 #define IEEE80211_WEP_CRCLEN            4       /* CRC-32 */
  599 #define IEEE80211_WEP_TOTLEN            (IEEE80211_WEP_IVLEN + \
  600                                          IEEE80211_WEP_KIDLEN + \
  601                                          IEEE80211_WEP_CRCLEN)
  602 #define IEEE80211_WEP_NKID              4       /* number of key ids */
  603 
  604 /*
  605  * 802.11i defines an extended IV for use with non-WEP ciphers.
  606  * When the EXTIV bit is set in the key id byte an additional
  607  * 4 bytes immediately follow the IV for TKIP.  For CCMP the
  608  * EXTIV bit is likewise set but the 8 bytes represent the
  609  * CCMP header rather than IV+extended-IV.
  610  */
  611 #define IEEE80211_WEP_EXTIV             0x20
  612 #define IEEE80211_WEP_EXTIVLEN          4       /* extended IV length */
  613 #define IEEE80211_WEP_MICLEN            8       /* trailing MIC */
  614 
  615 #define IEEE80211_CRC_LEN               4
  616 
  617 /*
  618  * Maximum acceptable MTU is:
  619  *      IEEE80211_MAX_LEN - WEP overhead - CRC -
  620  *              QoS overhead - RSN/WPA overhead
  621  * Min is arbitrarily chosen > IEEE80211_MIN_LEN.  The default
  622  * mtu is Ethernet-compatible; it's set by ether_ifattach.
  623  */
  624 #define IEEE80211_MTU_MAX               2290
  625 #define IEEE80211_MTU_MIN               32
  626 
  627 #define IEEE80211_MAX_LEN               (2300 + IEEE80211_CRC_LEN + \
  628     (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
  629 #define IEEE80211_ACK_LEN \
  630         (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
  631 #define IEEE80211_MIN_LEN \
  632         (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
  633 
  634 /*
  635  * The 802.11 spec says at most 2007 stations may be
  636  * associated at once.  For most AP's this is way more
  637  * than is feasible so we use a default of 128.  This
  638  * number may be overridden by the driver and/or by
  639  * user configuration.
  640  */
  641 #define IEEE80211_AID_MAX               2007
  642 #define IEEE80211_AID_DEF               128
  643 
  644 #define IEEE80211_AID(b)        ((b) &~ 0xc000)
  645 
  646 /* 
  647  * RTS frame length parameters.  The default is specified in
  648  * the 802.11 spec as 512; we treat it as implementation-dependent
  649  * so it's defined in ieee80211_var.h.  The max may be wrong
  650  * for jumbo frames.
  651  */
  652 #define IEEE80211_RTS_MIN               1
  653 #define IEEE80211_RTS_MAX               2346
  654 
  655 /* 
  656  * TX fragmentation parameters.  As above for RTS, we treat
  657  * default as implementation-dependent so define it elsewhere.
  658  */
  659 #define IEEE80211_FRAG_MIN              256
  660 #define IEEE80211_FRAG_MAX              2346
  661 
  662 /*
  663  * 802.11 frame duration definitions.
  664  */
  665 
  666 struct ieee80211_duration {
  667         uint16_t        d_rts_dur;
  668         uint16_t        d_data_dur;
  669         uint16_t        d_plcp_len;
  670         uint8_t         d_residue;      /* unused octets in time slot */
  671 };
  672 
  673 /* One Time Unit (TU) is 1Kus = 1024 microseconds. */
  674 #define IEEE80211_DUR_TU                1024
  675 
  676 /* IEEE 802.11b durations for DSSS PHY in microseconds */
  677 #define IEEE80211_DUR_DS_LONG_PREAMBLE  144
  678 #define IEEE80211_DUR_DS_SHORT_PREAMBLE 72
  679 
  680 #define IEEE80211_DUR_DS_SLOW_PLCPHDR   48
  681 #define IEEE80211_DUR_DS_FAST_PLCPHDR   24
  682 #define IEEE80211_DUR_DS_SLOW_ACK       112
  683 #define IEEE80211_DUR_DS_FAST_ACK       56
  684 #define IEEE80211_DUR_DS_SLOW_CTS       112
  685 #define IEEE80211_DUR_DS_FAST_CTS       56
  686 
  687 #define IEEE80211_DUR_DS_SLOT           20
  688 #define IEEE80211_DUR_DS_SIFS           10
  689 #define IEEE80211_DUR_DS_PIFS   (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT)
  690 #define IEEE80211_DUR_DS_DIFS   (IEEE80211_DUR_DS_SIFS + \
  691                                  2 * IEEE80211_DUR_DS_SLOT)
  692 #define IEEE80211_DUR_DS_EIFS   (IEEE80211_DUR_DS_SIFS + \
  693                                  IEEE80211_DUR_DS_SLOW_ACK + \
  694                                  IEEE80211_DUR_DS_LONG_PREAMBLE + \
  695                                  IEEE80211_DUR_DS_SLOW_PLCPHDR + \
  696                                  IEEE80211_DUR_DS_DIFS)
  697 
  698 
  699 #endif /* !_NET80211_IEEE80211_H_ */

Cache object: f82461b8929562fb60eaa2249117b0e3


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