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 /*      $NetBSD: ieee80211.h,v 1.28 2016/09/16 09:25:30 mlelstv 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_htframe {              /* 11n */
   85         u_int8_t        i_fc[2];
   86         u_int8_t        i_dur[2];
   87         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
   88         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
   89         u_int8_t        i_addr3[IEEE80211_ADDR_LEN];
   90         u_int8_t        i_seq[2];
   91         u_int8_t        i_qos[2];
   92         u_int8_t        i_ht[4];
   93 } __packed;
   94 
   95 struct ieee80211_qoscntl {
   96         u_int8_t        i_qos[2];
   97 };
   98 
   99 struct ieee80211_frame_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 } __packed;
  108 
  109 
  110 struct ieee80211_qosframe_addr4 {
  111         u_int8_t        i_fc[2];
  112         u_int8_t        i_dur[2];
  113         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
  114         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
  115         u_int8_t        i_addr3[IEEE80211_ADDR_LEN];
  116         u_int8_t        i_seq[2];
  117         u_int8_t        i_addr4[IEEE80211_ADDR_LEN];
  118         u_int8_t        i_qos[2];
  119 } __packed;
  120 
  121 #define IEEE80211_FC0_VERSION_MASK              0x03
  122 #define IEEE80211_FC0_VERSION_SHIFT             0
  123 #define IEEE80211_FC0_VERSION_0                 0x00
  124 #define IEEE80211_FC0_TYPE_MASK                 0x0c
  125 #define IEEE80211_FC0_TYPE_SHIFT                2
  126 #define IEEE80211_FC0_TYPE_MGT                  0x00
  127 #define IEEE80211_FC0_TYPE_CTL                  0x04
  128 #define IEEE80211_FC0_TYPE_DATA                 0x08
  129 
  130 #define IEEE80211_FC0_SUBTYPE_MASK              0xf0
  131 #define IEEE80211_FC0_SUBTYPE_SHIFT             4
  132 /* for TYPE_MGT */
  133 #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ         0x00
  134 #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP        0x10
  135 #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ       0x20
  136 #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP      0x30
  137 #define IEEE80211_FC0_SUBTYPE_PROBE_REQ         0x40
  138 #define IEEE80211_FC0_SUBTYPE_PROBE_RESP        0x50
  139 #define IEEE80211_FC0_SUBTYPE_BEACON            0x80
  140 #define IEEE80211_FC0_SUBTYPE_ATIM              0x90
  141 #define IEEE80211_FC0_SUBTYPE_DISASSOC          0xa0
  142 #define IEEE80211_FC0_SUBTYPE_AUTH              0xb0
  143 #define IEEE80211_FC0_SUBTYPE_DEAUTH            0xc0
  144 /* for TYPE_CTL */
  145 #define IEEE80211_FC0_SUBTYPE_PS_POLL           0xa0
  146 #define IEEE80211_FC0_SUBTYPE_RTS               0xb0
  147 #define IEEE80211_FC0_SUBTYPE_CTS               0xc0
  148 #define IEEE80211_FC0_SUBTYPE_ACK               0xd0
  149 #define IEEE80211_FC0_SUBTYPE_CF_END            0xe0
  150 #define IEEE80211_FC0_SUBTYPE_CF_END_ACK        0xf0
  151 /* for TYPE_DATA (bit combination) */
  152 #define IEEE80211_FC0_SUBTYPE_DATA              0x00
  153 #define IEEE80211_FC0_SUBTYPE_CF_ACK            0x10
  154 #define IEEE80211_FC0_SUBTYPE_CF_POLL           0x20
  155 #define IEEE80211_FC0_SUBTYPE_CF_ACPL           0x30
  156 #define IEEE80211_FC0_SUBTYPE_NODATA            0x40
  157 #define IEEE80211_FC0_SUBTYPE_CFACK             0x50
  158 #define IEEE80211_FC0_SUBTYPE_CFPOLL            0x60
  159 #define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK     0x70
  160 #define IEEE80211_FC0_SUBTYPE_QOS               0x80
  161 #define IEEE80211_FC0_SUBTYPE_QOS_NULL          0xc0
  162 
  163 /*
  164  * DS bit usage
  165  *
  166  * TA = transmitter address
  167  * RA = receiver address
  168  * DA = destination address
  169  * SA = source address
  170  *
  171  * ToDS    FromDS  A1(RA)  A2(TA)  A3      A4      Use
  172  * -----------------------------------------------------------------
  173  *  0       0       DA      SA      BSSID   -       IBSS/DLS
  174  *  0       1       DA      BSSID   SA      -       AP -> STA
  175  *  1       0       BSSID   SA      DA      -       AP <- STA
  176  *  1       1       RA      TA      DA      SA      unspecified (WDS)
  177  */
  178 #define IEEE80211_FC1_DIR_MASK                  0x03
  179 #define IEEE80211_FC1_DIR_NODS                  0x00    /* STA->STA */
  180 #define IEEE80211_FC1_DIR_TODS                  0x01    /* STA->AP  */
  181 #define IEEE80211_FC1_DIR_FROMDS                0x02    /* AP ->STA */
  182 #define IEEE80211_FC1_DIR_DSTODS                0x03    /* AP ->AP  */
  183 
  184 #define IEEE80211_IS_DSTODS(wh) \
  185         (((wh)->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS)
  186 
  187 #define IEEE80211_FC1_MORE_FRAG                 0x04
  188 #define IEEE80211_FC1_RETRY                     0x08
  189 #define IEEE80211_FC1_PWR_MGT                   0x10
  190 #define IEEE80211_FC1_MORE_DATA                 0x20
  191 #define IEEE80211_FC1_PROTECTED                 0x40
  192 #define IEEE80211_FC1_WEP                       0x40    /* pre-RSNA compat */
  193 #define IEEE80211_FC1_ORDER                     0x80
  194 
  195 #define IEEE80211_SEQ_FRAG_MASK                 0x000f
  196 #define IEEE80211_SEQ_FRAG_SHIFT                0
  197 #define IEEE80211_SEQ_SEQ_MASK                  0xfff0
  198 #define IEEE80211_SEQ_SEQ_SHIFT                 4
  199 
  200 #define IEEE80211_NWID_LEN                      32
  201 
  202 /*
  203  * QoS Control field (see 7.1.3.5).
  204  */
  205 /* bit 8 is reserved */
  206 #define IEEE80211_QOS_TXOP                      0xff00
  207 #define IEEE80211_QOS_AMSDU                     0x0080  /* 11n */
  208 #define IEEE80211_QOS_ACKPOLICY_NORMAL          0x0000
  209 #define IEEE80211_QOS_ACKPOLICY_NOACK           0x0020
  210 #define IEEE80211_QOS_ACKPOLICY_NOEXPLACK       0x0040
  211 #define IEEE80211_QOS_ACKPOLICY                 0x0060
  212 #define IEEE80211_QOS_ACKPOLICY_S               5
  213 #define IEEE80211_QOS_ACKPOLICY_MASK            0x0060
  214 #define IEEE80211_QOS_ACKPOLICY_BA              0x0060
  215 #define IEEE80211_QOS_ESOP                      0x0010
  216 #define IEEE80211_QOS_ESOP_S                    4
  217 #define IEEE80211_QOS_TID                       0x000f
  218 
  219 /* does frame have QoS sequence control data */
  220 #define IEEE80211_QOS_HAS_SEQ(wh) \
  221         (((wh)->i_fc[0] & \
  222             (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \
  223             (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
  224 
  225 /*
  226  * WME/802.11e information element.
  227  */
  228 struct ieee80211_wme_info {
  229         u_int8_t        wme_id;         /* IEEE80211_ELEMID_VENDOR */
  230         u_int8_t        wme_len;        /* length in bytes */
  231         u_int8_t        wme_oui[3];     /* 0x00, 0x50, 0xf2 */
  232         u_int8_t        wme_type;       /* OUI type */
  233         u_int8_t        wme_subtype;    /* OUI subtype */
  234         u_int8_t        wme_version;    /* spec revision */
  235         u_int8_t        wme_info;       /* QoS info */
  236 } __packed;
  237 
  238 /*
  239  * WME/802.11e Tspec Element
  240  */
  241 struct ieee80211_wme_tspec {
  242         u_int8_t        ts_id;
  243         u_int8_t        ts_len;
  244         u_int8_t        ts_oui[3];
  245         u_int8_t        ts_oui_type;
  246         u_int8_t        ts_oui_subtype;
  247         u_int8_t        ts_version;
  248         u_int8_t        ts_tsinfo[3];
  249         u_int8_t        ts_nom_msdu[2];
  250         u_int8_t        ts_max_msdu[2];
  251         u_int8_t        ts_min_svc[4];
  252         u_int8_t        ts_max_svc[4];
  253         u_int8_t        ts_inactv_intv[4];
  254         u_int8_t        ts_susp_intv[4];
  255         u_int8_t        ts_start_svc[4];
  256         u_int8_t        ts_min_rate[4];
  257         u_int8_t        ts_mean_rate[4];
  258         u_int8_t        ts_max_burst[4];
  259         u_int8_t        ts_min_phy[4];
  260         u_int8_t        ts_peak_rate[4];
  261         u_int8_t        ts_delay[4];
  262         u_int8_t        ts_surplus[2];
  263         u_int8_t        ts_medium_time[2];
  264 } __packed;
  265 
  266 /*
  267  * WME AC parameter field
  268  */
  269 struct ieee80211_wme_acparams {
  270         u_int8_t        acp_aci_aifsn;
  271         u_int8_t        acp_logcwminmax;
  272         u_int16_t       acp_txop;
  273 } __packed;
  274 
  275 /* WME stream classes */
  276 enum ieee80211_wme_ac {
  277         WME_AC_BE       = 0,            /* best effort */
  278         WME_AC_BK       = 1,            /* background */
  279         WME_AC_VI       = 2,            /* video */
  280         WME_AC_VO       = 3,            /* voice */
  281 };
  282 #define WME_NUM_AC      4               /* 4 AC categories */
  283 
  284 #define WME_PARAM_ACI           0x60    /* Mask for ACI field */
  285 #define WME_PARAM_ACI_S         5       /* Shift for ACI field */
  286 #define WME_PARAM_ACM           0x10    /* Mask for ACM bit */
  287 #define WME_PARAM_ACM_S         4       /* Shift for ACM bit */
  288 #define WME_PARAM_AIFSN         0x0f    /* Mask for aifsn field */
  289 #define WME_PARAM_AIFSN_S       0       /* Shift for aifsn field */
  290 #define WME_PARAM_LOGCWMIN      0x0f    /* Mask for CwMin field (in log) */
  291 #define WME_PARAM_LOGCWMIN_S    0       /* Shift for CwMin field */
  292 #define WME_PARAM_LOGCWMAX      0xf0    /* Mask for CwMax field (in log) */
  293 #define WME_PARAM_LOGCWMAX_S    4       /* Shift for CwMax field */
  294 
  295 #define WME_AC_TO_TID(_ac) (       \
  296         ((_ac) == WME_AC_VO) ? 6 : \
  297         ((_ac) == WME_AC_VI) ? 5 : \
  298         ((_ac) == WME_AC_BK) ? 1 : \
  299         0)
  300 
  301 #define TID_TO_WME_AC(_tid) (      \
  302         ((_tid) < 1) ? WME_AC_BE : \
  303         ((_tid) < 3) ? WME_AC_BK : \
  304         ((_tid) < 6) ? WME_AC_VI : \
  305         WME_AC_VO)
  306 
  307 /*
  308  * WME Parameter Element
  309  */
  310 struct ieee80211_wme_param {
  311         u_int8_t        param_id;
  312         u_int8_t        param_len;
  313         u_int8_t        param_oui[3];
  314         u_int8_t        param_oui_type;
  315         u_int8_t        param_oui_sybtype;
  316         u_int8_t        param_version;
  317         u_int8_t        param_qosInfo;
  318 #define WME_QOSINFO_COUNT       0x0f    /* Mask for param count field */
  319         u_int8_t        param_reserved;
  320         struct ieee80211_wme_acparams   params_acParams[WME_NUM_AC];
  321 } __packed;
  322 
  323 /*
  324  * Management Notification Frame
  325  */
  326 struct ieee80211_mnf {
  327         u_int8_t        mnf_category;
  328         u_int8_t        mnf_action;
  329         u_int8_t        mnf_dialog;
  330         u_int8_t        mnf_status;
  331 } __packed;
  332 #define MNF_SETUP_REQ   0
  333 #define MNF_SETUP_RESP  1
  334 #define MNF_TEARDOWN    2
  335 
  336 /*
  337  * Control frames.
  338  */
  339 struct ieee80211_frame_min {
  340         u_int8_t        i_fc[2];
  341         u_int8_t        i_dur[2];
  342         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
  343         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
  344         /* FCS */
  345 } __packed;
  346 
  347 struct ieee80211_frame_rts {
  348         u_int8_t        i_fc[2];
  349         u_int8_t        i_dur[2];
  350         u_int8_t        i_ra[IEEE80211_ADDR_LEN];
  351         u_int8_t        i_ta[IEEE80211_ADDR_LEN];
  352         /* FCS */
  353 } __packed;
  354 
  355 struct ieee80211_frame_cts {
  356         u_int8_t        i_fc[2];
  357         u_int8_t        i_dur[2];
  358         u_int8_t        i_ra[IEEE80211_ADDR_LEN];
  359         /* FCS */
  360 } __packed;
  361 
  362 struct ieee80211_frame_ack {
  363         u_int8_t        i_fc[2];
  364         u_int8_t        i_dur[2];
  365         u_int8_t        i_ra[IEEE80211_ADDR_LEN];
  366         /* FCS */
  367 } __packed;
  368 
  369 struct ieee80211_frame_pspoll {
  370         u_int8_t        i_fc[2];
  371         u_int8_t        i_aid[2];
  372         u_int8_t        i_bssid[IEEE80211_ADDR_LEN];
  373         u_int8_t        i_ta[IEEE80211_ADDR_LEN];
  374         /* FCS */
  375 } __packed;
  376 
  377 struct ieee80211_frame_cfend {          /* NB: also CF-End+CF-Ack */
  378         u_int8_t        i_fc[2];
  379         u_int8_t        i_dur[2];       /* should be zero */
  380         u_int8_t        i_ra[IEEE80211_ADDR_LEN];
  381         u_int8_t        i_bssid[IEEE80211_ADDR_LEN];
  382         /* FCS */
  383 } __packed;
  384 
  385 static __inline int
  386 ieee80211_has_seq(const struct ieee80211_frame *wh)
  387 {
  388         return (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) !=
  389             IEEE80211_FC0_TYPE_CTL;
  390 }
  391 
  392 static __inline int
  393 ieee80211_has_addr4(const struct ieee80211_frame *wh)
  394 {
  395         return (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) ==
  396             IEEE80211_FC1_DIR_DSTODS;
  397 }
  398 
  399 static __inline int
  400 ieee80211_has_qos(const struct ieee80211_frame *wh)
  401 {
  402         return (wh->i_fc[0] &
  403             (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) ==
  404             (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS);
  405 }
  406 
  407 static __inline int
  408 ieee80211_has_htc(const struct ieee80211_frame *wh)
  409 {
  410         return (wh->i_fc[1] & IEEE80211_FC1_ORDER) &&
  411             (ieee80211_has_qos(wh) ||
  412              (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
  413              IEEE80211_FC0_TYPE_MGT);
  414 }
  415 
  416 static __inline u_int16_t
  417 ieee80211_get_qos(const struct ieee80211_frame *wh)
  418 {
  419         const u_int8_t *frm;
  420 
  421         if (ieee80211_has_addr4(wh))
  422                 frm = ((const struct ieee80211_qosframe_addr4 *)wh)->i_qos;
  423         else
  424                 frm = ((const struct ieee80211_qosframe *)wh)->i_qos;
  425 
  426         return le16toh(*(const u_int16_t *)frm);
  427 }
  428 
  429 /*
  430  * BEACON management packets
  431  *
  432  *      octet timestamp[8]
  433  *      octet beacon interval[2]
  434  *      octet capability information[2]
  435  *      information element
  436  *              octet elemid
  437  *              octet length
  438  *              octet information[length]
  439  */
  440 
  441 typedef u_int8_t *ieee80211_mgt_beacon_t;
  442 
  443 #define IEEE80211_BEACON_INTERVAL(beacon) \
  444         ((beacon)[8] | ((beacon)[9] << 8))
  445 #define IEEE80211_BEACON_CAPABILITY(beacon) \
  446         ((beacon)[10] | ((beacon)[11] << 8))
  447 
  448 #define IEEE80211_CAPINFO_ESS                   0x0001
  449 #define IEEE80211_CAPINFO_IBSS                  0x0002
  450 #define IEEE80211_CAPINFO_CF_POLLABLE           0x0004
  451 #define IEEE80211_CAPINFO_CF_POLLREQ            0x0008
  452 #define IEEE80211_CAPINFO_PRIVACY               0x0010
  453 #define IEEE80211_CAPINFO_SHORT_PREAMBLE        0x0020
  454 #define IEEE80211_CAPINFO_PBCC                  0x0040
  455 #define IEEE80211_CAPINFO_CHNL_AGILITY          0x0080
  456 /* bits 8-9 are reserved */
  457 #define IEEE80211_CAPINFO_SHORT_SLOTTIME        0x0400
  458 #define IEEE80211_CAPINFO_RSN                   0x0800
  459 /* bit 12 is reserved */
  460 #define IEEE80211_CAPINFO_DSSSOFDM              0x2000
  461 /* bits 14-15 are reserved */
  462 
  463 /*
  464  * 802.11i/WPA information element (maximally sized).
  465  */
  466 struct ieee80211_ie_wpa {
  467         u_int8_t        wpa_id;         /* IEEE80211_ELEMID_VENDOR */
  468         u_int8_t        wpa_len;        /* length in bytes */
  469         u_int8_t        wpa_oui[3];     /* 0x00, 0x50, 0xf2 */
  470         u_int8_t        wpa_type;       /* OUI type */
  471         u_int16_t       wpa_version;    /* spec revision */
  472         u_int32_t       wpa_mcipher[1]; /* multicast/group key cipher */
  473         u_int16_t       wpa_uciphercnt; /* # pairwise key ciphers */
  474         u_int32_t       wpa_uciphers[8];/* ciphers */
  475         u_int16_t       wpa_authselcnt; /* authentication selector cnt*/
  476         u_int32_t       wpa_authsels[8];/* selectors */
  477         u_int16_t       wpa_caps;       /* 802.11i capabilities */
  478         u_int16_t       wpa_pmkidcnt;   /* 802.11i pmkid count */
  479         u_int16_t       wpa_pmkids[8];  /* 802.11i pmkids */
  480 } __packed;
  481 
  482 /*
  483  * Management information element payloads.
  484  */
  485 
  486 enum {
  487         IEEE80211_ELEMID_SSID           = 0,
  488         IEEE80211_ELEMID_RATES          = 1,
  489         IEEE80211_ELEMID_FHPARMS        = 2,
  490         IEEE80211_ELEMID_DSPARMS        = 3,
  491         IEEE80211_ELEMID_CFPARMS        = 4,
  492         IEEE80211_ELEMID_TIM            = 5,
  493         IEEE80211_ELEMID_IBSSPARMS      = 6,
  494         IEEE80211_ELEMID_COUNTRY        = 7,
  495         IEEE80211_ELEMID_EDCAPARMS      = 12,
  496         IEEE80211_ELEMID_CHALLENGE      = 16,
  497         /* 17-31 reserved for challenge text extension */
  498         IEEE80211_ELEMID_PWRCNSTR       = 32,
  499         IEEE80211_ELEMID_PWRCAP         = 33,
  500         IEEE80211_ELEMID_TPCREQ         = 34,
  501         IEEE80211_ELEMID_TPCREP         = 35,
  502         IEEE80211_ELEMID_SUPPCHAN       = 36,
  503         IEEE80211_ELEMID_CHANSWITCHANN  = 37,
  504         IEEE80211_ELEMID_MEASREQ        = 38,
  505         IEEE80211_ELEMID_MEASREP        = 39,
  506         IEEE80211_ELEMID_QUIET          = 40,
  507         IEEE80211_ELEMID_IBSSDFS        = 41,
  508         IEEE80211_ELEMID_ERP            = 42,
  509         IEEE80211_ELEMID_HTCAP          = 45,   /* 11n */
  510         IEEE80211_ELEMID_QOS_CAP        = 46,
  511         IEEE80211_ELEMID_RSN            = 48,
  512         IEEE80211_ELEMID_XRATES         = 50,
  513         IEEE80211_ELEMID_TIE            = 56,   /* 11r */
  514         IEEE80211_ELEMID_HTINFO         = 61,   /* 11n */
  515         IEEE80211_ELEMID_MMIE           = 76,   /* 11w */
  516         IEEE80211_ELEMID_TPC            = 150,
  517         IEEE80211_ELEMID_CCKM           = 156,
  518         IEEE80211_ELEMID_VENDOR         = 221   /* vendor private */
  519 };
  520 
  521 struct ieee80211_tim_ie {
  522         u_int8_t        tim_ie;                 /* IEEE80211_ELEMID_TIM */
  523         u_int8_t        tim_len;
  524         u_int8_t        tim_count;              /* DTIM count */
  525         u_int8_t        tim_period;             /* DTIM period */
  526         u_int8_t        tim_bitctl;             /* bitmap control */
  527         u_int8_t        tim_bitmap[1];          /* variable-length bitmap */
  528 } __packed;
  529 
  530 struct ieee80211_band {
  531         u_int8_t schan;                 /* starting channel */
  532         u_int8_t nchan;                 /* number channels */
  533         u_int8_t maxtxpwr;              /* tx power cap */
  534 } __packed;
  535 
  536 struct ieee80211_country_ie {
  537         u_int8_t        ie;                     /* IEEE80211_ELEMID_COUNTRY */
  538         u_int8_t        len;
  539         u_int8_t        cc[3];                  /* ISO CC+(I)ndoor/(O)utdoor */
  540         struct ieee80211_band band[4];          /* up to 4 sub bands */
  541 } __packed;
  542 
  543 #define IEEE80211_CHALLENGE_LEN         128
  544 
  545 #define IEEE80211_RATE_BASIC            0x80
  546 #define IEEE80211_RATE_VAL              0x7f
  547 
  548 /* EPR information element flags */
  549 #define IEEE80211_ERP_NON_ERP_PRESENT   0x01
  550 #define IEEE80211_ERP_USE_PROTECTION    0x02
  551 #define IEEE80211_ERP_LONG_PREAMBLE     0x04
  552 
  553 /* Atheros private advanced capabilities info */
  554 #define ATHEROS_CAP_TURBO_PRIME         0x01
  555 #define ATHEROS_CAP_COMPRESSION         0x02
  556 #define ATHEROS_CAP_FAST_FRAME          0x04
  557 /* bits 3-6 reserved */
  558 #define ATHEROS_CAP_BOOST               0x80
  559 
  560 #define ATH_OUI                 0x7f0300                /* Atheros OUI */
  561 #define ATH_OUI_TYPE            0x01
  562 #define ATH_OUI_VERSION         0x01
  563 
  564 #define WPA_OUI                 0xf25000
  565 #define WPA_OUI_TYPE            0x01
  566 #define WPA_VERSION             1               /* current supported version */
  567 
  568 #define WPA_CSE_NULL            0x00
  569 #define WPA_CSE_WEP40           0x01
  570 #define WPA_CSE_TKIP            0x02
  571 #define WPA_CSE_CCMP            0x04
  572 #define WPA_CSE_WEP104          0x05
  573 
  574 #define WPA_ASE_NONE            0x00
  575 #define WPA_ASE_8021X_UNSPEC    0x01
  576 #define WPA_ASE_8021X_PSK       0x02
  577 
  578 #define RSN_OUI                 0xac0f00
  579 #define RSN_VERSION             1               /* current supported version */
  580 
  581 #define RSN_CSE_NULL            0x00
  582 #define RSN_CSE_WEP40           0x01
  583 #define RSN_CSE_TKIP            0x02
  584 #define RSN_CSE_WRAP            0x03
  585 #define RSN_CSE_CCMP            0x04
  586 #define RSN_CSE_WEP104          0x05
  587 
  588 #define RSN_ASE_NONE            0x00
  589 #define RSN_ASE_8021X_UNSPEC    0x01
  590 #define RSN_ASE_8021X_PSK       0x02
  591 
  592 #define RSN_CAP_PREAUTH         0x01
  593 
  594 #define WME_OUI                 0xf25000
  595 #define WME_OUI_TYPE            0x02
  596 #define WME_INFO_OUI_SUBTYPE    0x00
  597 #define WME_PARAM_OUI_SUBTYPE   0x01
  598 #define WME_VERSION             1
  599 
  600 /*
  601  * AUTH management packets
  602  *
  603  *      octet algo[2]
  604  *      octet seq[2]
  605  *      octet status[2]
  606  *      octet chal.id
  607  *      octet chal.length
  608  *      octet chal.text[253]
  609  */
  610 
  611 typedef u_int8_t *ieee80211_mgt_auth_t;
  612 
  613 #define IEEE80211_AUTH_ALGORITHM(auth) \
  614         ((auth)[0] | ((auth)[1] << 8))
  615 #define IEEE80211_AUTH_TRANSACTION(auth) \
  616         ((auth)[2] | ((auth)[3] << 8))
  617 #define IEEE80211_AUTH_STATUS(auth) \
  618         ((auth)[4] | ((auth)[5] << 8))
  619 
  620 #define IEEE80211_AUTH_ALG_OPEN         0x0000
  621 #define IEEE80211_AUTH_ALG_SHARED       0x0001
  622 #define IEEE80211_AUTH_ALG_LEAP         0x0080
  623 
  624 enum {
  625         IEEE80211_AUTH_OPEN_REQUEST             = 1,
  626         IEEE80211_AUTH_OPEN_RESPONSE            = 2
  627 };
  628 
  629 enum {
  630         IEEE80211_AUTH_SHARED_REQUEST           = 1,
  631         IEEE80211_AUTH_SHARED_CHALLENGE         = 2,
  632         IEEE80211_AUTH_SHARED_RESPONSE          = 3,
  633         IEEE80211_AUTH_SHARED_PASS              = 4
  634 };
  635 
  636 /*
  637  * Reason codes
  638  *
  639  * Unlisted codes are reserved
  640  */
  641 
  642 enum {
  643         IEEE80211_REASON_UNSPECIFIED            = 1,
  644         IEEE80211_REASON_AUTH_EXPIRE            = 2,
  645         IEEE80211_REASON_AUTH_LEAVE             = 3,
  646         IEEE80211_REASON_ASSOC_EXPIRE           = 4,
  647         IEEE80211_REASON_ASSOC_TOOMANY          = 5,
  648         IEEE80211_REASON_NOT_AUTHED             = 6,
  649         IEEE80211_REASON_NOT_ASSOCED            = 7,
  650         IEEE80211_REASON_ASSOC_LEAVE            = 8,
  651         IEEE80211_REASON_ASSOC_NOT_AUTHED       = 9,
  652 
  653         IEEE80211_REASON_RSN_REQUIRED           = 11,
  654         IEEE80211_REASON_RSN_INCONSISTENT       = 12,
  655         IEEE80211_REASON_IE_INVALID             = 13,
  656         IEEE80211_REASON_MIC_FAILURE            = 14,
  657 
  658         IEEE80211_STATUS_SUCCESS                = 0,
  659         IEEE80211_STATUS_UNSPECIFIED            = 1,
  660         IEEE80211_STATUS_CAPINFO                = 10,
  661         IEEE80211_STATUS_NOT_ASSOCED            = 11,
  662         IEEE80211_STATUS_OTHER                  = 12,
  663         IEEE80211_STATUS_ALG                    = 13,
  664         IEEE80211_STATUS_SEQUENCE               = 14,
  665         IEEE80211_STATUS_CHALLENGE              = 15,
  666         IEEE80211_STATUS_TIMEOUT                = 16,
  667         IEEE80211_STATUS_TOOMANY                = 17,
  668         IEEE80211_STATUS_BASIC_RATE             = 18,
  669         IEEE80211_STATUS_SP_REQUIRED            = 19,
  670         IEEE80211_STATUS_PBCC_REQUIRED          = 20,
  671         IEEE80211_STATUS_CA_REQUIRED            = 21,
  672         IEEE80211_STATUS_TOO_MANY_STATIONS      = 22,
  673         IEEE80211_STATUS_RATES                  = 23,
  674         IEEE80211_STATUS_SHORTSLOT_REQUIRED     = 25,
  675         IEEE80211_STATUS_DSSSOFDM_REQUIRED      = 26
  676 };
  677 
  678 #define IEEE80211_WEP_KEYLEN            5       /* 40bit */
  679 #define IEEE80211_WEP_IVLEN             3       /* 24bit */
  680 #define IEEE80211_WEP_KIDLEN            1       /* 1 octet */
  681 #define IEEE80211_WEP_CRCLEN            4       /* CRC-32 */
  682 #define IEEE80211_WEP_TOTLEN            (IEEE80211_WEP_IVLEN + \
  683                                          IEEE80211_WEP_KIDLEN + \
  684                                          IEEE80211_WEP_CRCLEN)
  685 #define IEEE80211_WEP_NKID              4       /* number of key ids */
  686 
  687 /*
  688  * 802.11i defines an extended IV for use with non-WEP ciphers.
  689  * When the EXTIV bit is set in the key id byte an additional
  690  * 4 bytes immediately follow the IV for TKIP.  For CCMP the
  691  * EXTIV bit is likewise set but the 8 bytes represent the
  692  * CCMP header rather than IV+extended-IV.
  693  */
  694 #define IEEE80211_WEP_EXTIV             0x20
  695 #define IEEE80211_WEP_EXTIVLEN          4       /* extended IV length */
  696 #define IEEE80211_WEP_MICLEN            8       /* trailing MIC */
  697 
  698 #define IEEE80211_CRC_LEN               4
  699 
  700 /*
  701  * Maximum acceptable MTU is:
  702  *      IEEE80211_MAX_LEN - WEP overhead - CRC -
  703  *              QoS overhead - RSN/WPA overhead
  704  * Min is arbitrarily chosen > IEEE80211_MIN_LEN.  The default
  705  * mtu is Ethernet-compatible; it's set by ether_ifattach.
  706  */
  707 #define IEEE80211_MTU_MAX               2290
  708 #define IEEE80211_MTU_MIN               32
  709 
  710 #define IEEE80211_MAX_LEN               (2300 + IEEE80211_CRC_LEN + \
  711     (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
  712 #define IEEE80211_ACK_LEN \
  713         (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
  714 #define IEEE80211_MIN_LEN \
  715         (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
  716 
  717 /*
  718  * The 802.11 spec says at most 2007 stations may be
  719  * associated at once.  For most AP's this is way more
  720  * than is feasible so we use a default of 128.  This
  721  * number may be overridden by the driver and/or by
  722  * user configuration.
  723  */
  724 #define IEEE80211_AID_MAX               2007
  725 #define IEEE80211_AID_DEF               128
  726 
  727 #define IEEE80211_AID(b)        ((b) &~ 0xc000)
  728 
  729 /*
  730  * RTS frame length parameters.  The default is specified in
  731  * the 802.11 spec as 512; we treat it as implementation-dependent
  732  * so it's defined in ieee80211_var.h.  The max may be wrong
  733  * for jumbo frames.
  734  */
  735 #define IEEE80211_RTS_MIN               1
  736 #define IEEE80211_RTS_MAX               2346
  737 
  738 /*
  739  * TX fragmentation parameters.  As above for RTS, we treat
  740  * default as implementation-dependent so define it elsewhere.
  741  */
  742 #define IEEE80211_FRAG_MIN              256
  743 #define IEEE80211_FRAG_MAX              2346
  744 
  745 /*
  746  * 802.11 frame duration definitions.
  747  */
  748 
  749 struct ieee80211_duration {
  750         uint16_t        d_rts_dur;
  751         uint16_t        d_data_dur;
  752         uint16_t        d_plcp_len;
  753         uint8_t         d_residue;      /* unused octets in time slot */
  754 };
  755 
  756 /* One Time Unit (TU) is 1Kus = 1024 microseconds. */
  757 #define IEEE80211_DUR_TU                1024
  758 
  759 /* IEEE 802.11b durations for DSSS PHY in microseconds */
  760 #define IEEE80211_DUR_DS_LONG_PREAMBLE  144
  761 #define IEEE80211_DUR_DS_SHORT_PREAMBLE 72
  762 
  763 #define IEEE80211_DUR_DS_SLOW_PLCPHDR   48
  764 #define IEEE80211_DUR_DS_FAST_PLCPHDR   24
  765 #define IEEE80211_DUR_DS_SLOW_ACK       112
  766 #define IEEE80211_DUR_DS_FAST_ACK       56
  767 #define IEEE80211_DUR_DS_SLOW_CTS       112
  768 #define IEEE80211_DUR_DS_FAST_CTS       56
  769 
  770 #define IEEE80211_DUR_DS_SLOT           20
  771 #define IEEE80211_DUR_DS_SIFS           10
  772 #define IEEE80211_DUR_DS_PIFS   (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT)
  773 #define IEEE80211_DUR_DS_DIFS   (IEEE80211_DUR_DS_SIFS + \
  774                                  2 * IEEE80211_DUR_DS_SLOT)
  775 #define IEEE80211_DUR_DS_EIFS   (IEEE80211_DUR_DS_SIFS + \
  776                                  IEEE80211_DUR_DS_SLOW_ACK + \
  777                                  IEEE80211_DUR_DS_LONG_PREAMBLE + \
  778                                  IEEE80211_DUR_DS_SLOW_PLCPHDR + \
  779                                  IEEE80211_DUR_DS_DIFS)
  780 
  781 
  782 #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.