Main Page | Data Structures | Directories | File List | Data Fields | Globals

if_ieee80211.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2004 Massachusetts Institute of Technology
00003  * John Bicket
00004  */
00005 
00006 /*
00007  * Originally derived from the following.
00008  */
00009 /*-
00010  * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
00011  * All rights reserved.
00012  *
00013  * Redistribution and use in source and binary forms, with or without
00014  * modification, are permitted provided that the following conditions
00015  * are met:
00016  * 1. Redistributions of source code must retain the above copyright
00017  *    notice, this list of conditions and the following disclaimer,
00018  *    without modification.
00019  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
00020  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
00021  *    redistribution must be conditioned upon including a substantially
00022  *    similar Disclaimer requirement for further binary redistribution.
00023  * 3. Neither the names of the above-listed copyright holders nor the names
00024  *    of any contributors may be used to endorse or promote products derived
00025  *    from this software without specific prior written permission.
00026  *
00027  * Alternatively, this software may be distributed under the terms of the
00028  * GNU General Public License ("GPL") version 2 as published by the Free
00029  * Software Foundation.
00030  *
00031  * NO WARRANTY
00032  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00033  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00034  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
00035  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
00036  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
00037  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00038  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00039  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
00040  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00041  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
00042  * THE POSSIBILITY OF SUCH DAMAGES.
00043  *
00044  *      $Id: if_ieee80211.h,v 1.3 2005/01/20 01:06:27 jbicket Exp $
00045  *      $NetBSD: if_ieee80211.h,v 1.23 2002/10/15 08:51:50 onoe Exp $
00046  *      $FreeBSD: src/sys/net/if_ieee80211.h,v 1.8 2003/01/15 20:01:50 sam Exp $
00047  */
00048 
00049 /*
00050  * IEEE 802.11 generic handler definitions.
00051  *
00052  * This code is derived from NetBSD code; their copyright notice follows.
00053  */
00054 
00055 /*-
00056  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
00057  * All rights reserved.
00058  *
00059  * Redistribution and use in source and binary forms, with or without
00060  * modification, are permitted provided that the following conditions
00061  * are met:
00062  * 1. Redistributions of source code must retain the above copyright
00063  *    notice, this list of conditions and the following disclaimer.
00064  * 2. Redistributions in binary form must reproduce the above copyright
00065  *    notice, this list of conditions and the following disclaimer in the
00066  *    documentation and/or other materials provided with the distribution.
00067  * 3. All advertising materials mentioning features or use of this software
00068  *    must display the following acknowledgement:
00069  *        This product includes software developed by the NetBSD
00070  *        Foundation, Inc. and its contributors.
00071  * 4. Neither the name of The NetBSD Foundation nor the names of its
00072  *    contributors may be used to endorse or promote products derived
00073  *    from this software without specific prior written permission.
00074  *
00075  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
00076  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00077  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00078  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
00079  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00080  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00081  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00082  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00083  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00084  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00085  * POSSIBILITY OF SUCH DAMAGE.
00086  */
00087 
00088 #ifndef _NET_IF_IEEE80211_H_
00089 #define _NET_IF_IEEE80211_H_
00090 
00091 #include <sys/queue.h>
00092 #ifdef CONFIG_NET_WIRELESS
00093 #include <linux/wireless.h>
00094 #endif
00095 
00096 #define IEEE80211_ADDR_LEN      6               /* size of 802.11 address */
00097 
00098 /* IEEE 802.11 PLCP header */
00099 struct ieee80211_plcp_hdr {
00100         u_int16_t       i_sfd;
00101         u_int8_t        i_signal;
00102         u_int8_t        i_service;
00103         u_int16_t       i_length;
00104         u_int16_t       i_crc;
00105 } __attribute__((__packed__));
00106 
00107 /*
00108  * generic definitions for IEEE 802.11 frames
00109  */
00110 struct ieee80211_frame {
00111         u_int8_t        i_fc[2];
00112         u_int8_t        i_dur[2];
00113         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
00114         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
00115         u_int8_t        i_addr3[IEEE80211_ADDR_LEN];
00116         u_int8_t        i_seq[2];
00117         /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
00118         /* see below */
00119 } __attribute__((__packed__));
00120 
00121 
00122 struct ieee80211_qosframe {
00123         u_int8_t        i_fc[2];
00124         u_int8_t        i_dur[2];
00125         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
00126         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
00127         u_int8_t        i_addr3[IEEE80211_ADDR_LEN];
00128         u_int8_t        i_seq[2];
00129         u_int8_t        i_qos[2];
00130         /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
00131         /* see below */
00132 } __attribute__((__packed__));
00133 
00134 struct ieee80211_qoscntl {
00135         u_int8_t        i_qos[2];
00136 };
00137 
00138 struct ieee80211_frame_addr4 {
00139         u_int8_t        i_fc[2];
00140         u_int8_t        i_dur[2];
00141         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
00142         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
00143         u_int8_t        i_addr3[IEEE80211_ADDR_LEN];
00144         u_int8_t        i_seq[2];
00145         u_int8_t        i_addr4[IEEE80211_ADDR_LEN];
00146 } __attribute__((__packed__));
00147 
00148 
00149 struct ieee80211_qosframe_addr4 {
00150         u_int8_t        i_fc[2];
00151         u_int8_t        i_dur[2];
00152         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
00153         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
00154         u_int8_t        i_addr3[IEEE80211_ADDR_LEN];
00155         u_int8_t        i_seq[2];
00156         u_int8_t        i_addr4[IEEE80211_ADDR_LEN];
00157         u_int8_t        i_qos[2];
00158 } __attribute__((__packed__));
00159 
00160 /*
00161  * Management Notification Frame
00162  */
00163 struct ieee80211_mnf {
00164         u_int8_t        mnf_category;
00165         u_int8_t        mnf_action;
00166         u_int8_t        mnf_dialog;
00167         u_int8_t        mnf_status;
00168 } __attribute__((__packed__));
00169 #define MNF_SETUP_REQ   0
00170 #define MNF_SETUP_RESP  1
00171 #define MNF_TEARDOWN    2
00172 
00173 /*
00174  * WME/802.11e Tspec Element
00175  */
00176 struct ieee80211_wme_tspec {
00177         u_int8_t        ts_id;
00178         u_int8_t        ts_len;
00179         u_int8_t        ts_oui[3];
00180         u_int8_t        ts_oui_type;
00181         u_int8_t        ts_oui_subtype;
00182         u_int8_t        ts_version;
00183         u_int8_t        ts_tsinfo[3];
00184         u_int8_t        ts_nom_msdu[2];
00185         u_int8_t        ts_max_msdu[2];
00186         u_int8_t        ts_min_svc[4];
00187         u_int8_t        ts_max_svc[4];
00188         u_int8_t        ts_inactv_intv[4];
00189         u_int8_t        ts_susp_intv[4];
00190         u_int8_t        ts_start_svc[4];
00191         u_int8_t        ts_min_rate[4];
00192         u_int8_t        ts_mean_rate[4];
00193         u_int8_t        ts_max_burst[4];
00194         u_int8_t        ts_min_phy[4];
00195         u_int8_t        ts_peak_rate[4];
00196         u_int8_t        ts_delay[4];
00197         u_int8_t        ts_surplus[2];
00198         u_int8_t        ts_medium_time[2];
00199 } __attribute__((__packed__));
00200 
00201 #define IEEE80211_FC0_VERSION_MASK              0x03
00202 #define IEEE80211_FC0_VERSION_SHIFT             0
00203 #define IEEE80211_FC0_VERSION_0                 0x00
00204 #define IEEE80211_FC0_TYPE_MASK                 0x0c
00205 #define IEEE80211_FC0_TYPE_SHIFT                2
00206 #define IEEE80211_FC0_TYPE_MGT                  0x00
00207 #define IEEE80211_FC0_TYPE_CTL                  0x04
00208 #define IEEE80211_FC0_TYPE_DATA                 0x08
00209 
00210 #define IEEE80211_FC0_SUBTYPE_MASK              0xf0
00211 #define IEEE80211_FC0_SUBTYPE_SHIFT             4
00212 /* for TYPE_MGT */
00213 #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ         0x00
00214 #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP        0x10
00215 #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ       0x20
00216 #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP      0x30
00217 #define IEEE80211_FC0_SUBTYPE_PROBE_REQ         0x40
00218 #define IEEE80211_FC0_SUBTYPE_PROBE_RESP        0x50
00219 #define IEEE80211_FC0_SUBTYPE_BEACON            0x80
00220 #define IEEE80211_FC0_SUBTYPE_ATIM              0x90
00221 #define IEEE80211_FC0_SUBTYPE_DISASSOC          0xa0
00222 #define IEEE80211_FC0_SUBTYPE_AUTH              0xb0
00223 #define IEEE80211_FC0_SUBTYPE_DEAUTH            0xc0
00224 #define IEEE80211_FC0_SUBTYPE_ACTION            0xd0
00225 /* for TYPE_CTL */
00226 #define IEEE80211_FC0_SUBTYPE_PS_POLL           0xa0
00227 #define IEEE80211_FC0_SUBTYPE_RTS               0xb0
00228 #define IEEE80211_FC0_SUBTYPE_CTS               0xc0
00229 #define IEEE80211_FC0_SUBTYPE_ACK               0xd0
00230 #define IEEE80211_FC0_SUBTYPE_CF_END            0xe0
00231 #define IEEE80211_FC0_SUBTYPE_CF_END_ACK        0xf0
00232 /* for TYPE_DATA (bit combination) */
00233 #define IEEE80211_FC0_SUBTYPE_DATA              0x00
00234 #define IEEE80211_FC0_SUBTYPE_CF_ACK            0x10
00235 #define IEEE80211_FC0_SUBTYPE_CF_POLL           0x20
00236 #define IEEE80211_FC0_SUBTYPE_CF_ACPL           0x30
00237 #define IEEE80211_FC0_SUBTYPE_NODATA            0x40
00238 #define IEEE80211_FC0_SUBTYPE_CFACK             0x50
00239 #define IEEE80211_FC0_SUBTYPE_CFPOLL            0x60
00240 #define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK     0x70
00241 #define IEEE80211_FC0_SUBTYPE_QOS               0x80
00242 
00243 #define IEEE80211_FC1_DIR_MASK                  0x03
00244 #define IEEE80211_FC1_DIR_NODS                  0x00    /* STA->STA */
00245 #define IEEE80211_FC1_DIR_TODS                  0x01    /* STA->AP  */
00246 #define IEEE80211_FC1_DIR_FROMDS                0x02    /* AP ->STA */
00247 #define IEEE80211_FC1_DIR_DSTODS                0x03    /* AP ->AP  */
00248 
00249 #define IEEE80211_FC1_MORE_FRAG                 0x04
00250 #define IEEE80211_FC1_RETRY                     0x08
00251 #define IEEE80211_FC1_PWR_MGT                   0x10
00252 #define IEEE80211_FC1_MORE_DATA                 0x20
00253 #define IEEE80211_FC1_WEP                       0x40
00254 #define IEEE80211_FC1_ORDER                     0x80
00255 
00256 #define IEEE80211_SEQ_FRAG_MASK                 0x000f
00257 #define IEEE80211_SEQ_FRAG_SHIFT                0
00258 #define IEEE80211_SEQ_SEQ_MASK                  0xfff0
00259 #define IEEE80211_SEQ_SEQ_SHIFT                 4
00260 
00261 #define IEEE80211_NWID_LEN                      32
00262 
00263 /*
00264  * BEACON management packets
00265  *
00266  *      octet timestamp[8]
00267  *      octet beacon interval[2]
00268  *      octet capability information[2]
00269  *      information element
00270  *              octet elemid
00271  *              octet length
00272  *              octet information[length]
00273  */
00274 
00275 typedef u_int8_t *ieee80211_mgt_beacon_t;
00276 
00277 #define IEEE80211_BEACON_INTERVAL(beacon) \
00278         ((beacon)[8] | ((beacon)[9] << 8))
00279 #define IEEE80211_BEACON_CAPABILITY(beacon) \
00280         ((beacon)[10] | ((beacon)[11] << 8))
00281 
00282 #define IEEE80211_CAPINFO_ESS                   0x0001
00283 #define IEEE80211_CAPINFO_IBSS                  0x0002
00284 #define IEEE80211_CAPINFO_CF_POLLABLE           0x0004
00285 #define IEEE80211_CAPINFO_CF_POLLREQ            0x0008
00286 #define IEEE80211_CAPINFO_PRIVACY               0x0010
00287 #define IEEE80211_CAPINFO_SHORT_PREAMBLE        0x0020
00288 #define IEEE80211_CAPINFO_PBCC                  0x0040
00289 #define IEEE80211_CAPINFO_CHNL_AGILITY          0x0080
00290 /* bits 8-9 are reserved */
00291 #define IEEE80211_CAPINFO_SHORT_SLOTTIME        0x0400
00292 /* bits 11-12 are reserved */
00293 #define IEEE80211_CAPINFO_DSSSOFDM              0x2000
00294 /* bits 14-15 are reserved */
00295 
00296 /*
00297  * Management information elements
00298  */
00299 
00300 struct ieee80211_information {
00301         char    ssid[IEEE80211_NWID_LEN+1];
00302         struct rates {
00303                 u_int8_t        *p;
00304         } rates;
00305         struct fh {
00306                 u_int16_t       dwell;
00307                 u_int8_t        set;
00308                 u_int8_t        pattern;
00309                 u_int8_t        index;
00310         } fh;
00311         struct ds {
00312                 u_int8_t        channel;
00313         } ds;
00314         struct cf {
00315                 u_int8_t        count;
00316                 u_int8_t        period;
00317                 u_int8_t        maxdur[2];
00318                 u_int8_t        dur[2];
00319         } cf;
00320         struct tim {
00321                 u_int8_t        count;
00322                 u_int8_t        period;
00323                 u_int8_t        bitctl;
00324                 /* u_int8_t     pvt[251]; The driver needs to use this. */
00325         } tim;
00326         struct ibss {
00327                 u_int16_t       atim;
00328         } ibss;
00329         struct challenge {
00330                 u_int8_t        *p;
00331                 u_int8_t        len;
00332         } challenge;
00333         struct erp {
00334                 u_int8_t        flags;
00335         } erp;
00336 };
00337 
00338 #define IEEE80211_ELEMID_SSID                   0
00339 #define IEEE80211_ELEMID_RATES                  1
00340 #define IEEE80211_ELEMID_FHPARMS                2
00341 #define IEEE80211_ELEMID_DSPARMS                3
00342 #define IEEE80211_ELEMID_CFPARMS                4
00343 #define IEEE80211_ELEMID_TIM                    5
00344 #define IEEE80211_ELEMID_IBSSPARMS              6
00345 #define IEEE80211_ELEMID_COUNTRY                7
00346 #define IEEE80211_ELEMID_CHALLENGE              16
00347 #define IEEE80211_ELEMID_ERP                    42
00348 #define IEEE80211_ELEMID_XRATES                 50
00349 #define IEEE80211_ELEMID_VENDOR                 221
00350 #define OUI_WME                                 0x0050f2
00351 #define OUI_TYPE                                0x02
00352 #define WME_PARAM_OUI_SUBTYPE                   0x01
00353 
00354 /* Classes for WME streams */
00355 #define WME_AC_BE 0
00356 #define WME_AC_BK 1
00357 #define WME_AC_VI 2
00358 #define WME_AC_VO 3
00359 
00360 
00361 #define IEEE80211_RATE_BASIC                    0x80
00362 #define IEEE80211_RATE_VAL                      0x7f
00363 
00364 /* EPR information element flags */
00365 #define IEEE80211_ERP_NON_ERP_PRESENT           0x01
00366 #define IEEE80211_ERP_USE_PROTECTION            0x02
00367 #define IEEE80211_ERP_BARKER_MODE               0x04
00368 
00369 /*
00370  * AUTH management packets
00371  *
00372  *      octet algo[2]
00373  *      octet seq[2]
00374  *      octet status[2]
00375  *      octet chal.id
00376  *      octet chal.length
00377  *      octet chal.text[253]
00378  */
00379 
00380 typedef u_int8_t *ieee80211_mgt_auth_t;
00381 
00382 #define IEEE80211_AUTH_ALGORITHM(auth) \
00383         ((auth)[0] | ((auth)[1] << 8))
00384 #define IEEE80211_AUTH_TRANSACTION(auth) \
00385         ((auth)[2] | ((auth)[3] << 8))
00386 #define IEEE80211_AUTH_STATUS(auth) \
00387         ((auth)[4] | ((auth)[5] << 8))
00388 
00389 #define IEEE80211_AUTH_ALG_OPEN                 0x0000
00390 #define IEEE80211_AUTH_ALG_SHARED               0x0001
00391 
00392 #define IEEE80211_AUTH_OPEN_REQUEST             1
00393 #define IEEE80211_AUTH_OPEN_RESPONSE            2
00394 
00395 #define IEEE80211_AUTH_SHARED_REQUEST           1
00396 #define IEEE80211_AUTH_SHARED_CHALLENGE         2
00397 #define IEEE80211_AUTH_SHARED_RESPONSE          3
00398 #define IEEE80211_AUTH_SHARED_PASS              4
00399 
00400 /*
00401  * Reason codes
00402  *
00403  * Unlisted codes are reserved
00404  */
00405 
00406 #define IEEE80211_REASON_UNSPECIFIED            1
00407 #define IEEE80211_REASON_AUTH_EXPIRE            2
00408 #define IEEE80211_REASON_AUTH_LEAVE             3
00409 #define IEEE80211_REASON_ASSOC_EXPIRE           4
00410 #define IEEE80211_REASON_ASSOC_TOOMANY          5
00411 #define IEEE80211_REASON_NOT_AUTHED             6  
00412 #define IEEE80211_REASON_NOT_ASSOCED            7
00413 #define IEEE80211_REASON_ASSOC_LEAVE            8
00414 #define IEEE80211_REASON_ASSOC_NOT_AUTHED       9
00415 
00416 #define IEEE80211_STATUS_SUCCESS                0
00417 #define IEEE80211_STATUS_UNSPECIFIED            1
00418 #define IEEE80211_STATUS_CAPINFO                10
00419 #define IEEE80211_STATUS_NOT_ASSOCED            11
00420 #define IEEE80211_STATUS_OTHER                  12
00421 #define IEEE80211_STATUS_ALG                    13
00422 #define IEEE80211_STATUS_SEQUENCE               14
00423 #define IEEE80211_STATUS_CHALLENGE              15
00424 #define IEEE80211_STATUS_TIMEOUT                16
00425 #define IEEE80211_STATUS_TOOMANY                17
00426 #define IEEE80211_STATUS_BASIC_RATE             18
00427 #define IEEE80211_STATUS_SP_REQUIRED            19
00428 #define IEEE80211_STATUS_PBCC_REQUIRED          20
00429 #define IEEE80211_STATUS_CA_REQUIRED            21
00430 #define IEEE80211_STATUS_TOO_MANY_STATIONS      22
00431 #define IEEE80211_STATUS_RATES                  23
00432 #define IEEE80211_STATUS_SHORTSLOT_REQUIRED     25
00433 #define IEEE80211_STATUS_DSSSOFDM_REQUIRED      26
00434 
00435 #define IEEE80211_WEP_KEYLEN                    5       /* 40bit */
00436 #define IEEE80211_WEP_IVLEN                     3       /* 24bit */
00437 #define IEEE80211_WEP_KIDLEN                    1       /* 1 octet */
00438 #define IEEE80211_WEP_CRCLEN                    4       /* CRC-32 */
00439 #define IEEE80211_WEP_NKID                      4       /* number of key ids */
00440 
00441 #define IEEE80211_CRC_LEN                       4
00442 
00443 #define IEEE80211_MTU                           1500
00444 #define IEEE80211_MAX_LEN                       (2300 + IEEE80211_CRC_LEN + \
00445     (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
00446 
00447 /* 
00448  * RTS frame length parameters.  The default is specified in
00449  * the 802.11 spec.  The max may be wrong for jumbo frames.
00450  */
00451 #define IEEE80211_RTS_DEFAULT                   512
00452 #define IEEE80211_RTS_MIN                       1
00453 #define IEEE80211_RTS_MAX                       IEEE80211_MAX_LEN
00454 
00455 #define IEEE80211_CHAN_ANY      0xffff          /* token for ``any channel'' */
00456 
00457 #define IEEE80211_TXPOWER_MAX   100     /* .5 dbM (XXX units?) */
00458 #define IEEE80211_TXPOWER_MIN   0       /* kill radio */
00459 
00460 #define IEEE80211_AUTH_NONE     0
00461 #define IEEE80211_AUTH_OPEN     1
00462 #define IEEE80211_AUTH_SHARED   2
00463 
00464 #ifdef __KERNEL__
00465 
00466 #define IEEE80211_PSCAN_WAIT    5               /* passive scan wait */
00467 #define IEEE80211_TRANS_WAIT    5               /* transition wait */
00468 #define IEEE80211_INACT_WAIT    5               /* inactivity timer interval */
00469 #define IEEE80211_INACT_MAX     (300/IEEE80211_INACT_WAIT)
00470 
00471 /*
00472  * Structure for IEEE 802.11 drivers.
00473  */
00474 
00475 #define IEEE80211_CHAN_MAX      255
00476 #define IEEE80211_CHAN_ANYC \
00477         ((struct ieee80211channel *) IEEE80211_CHAN_ANY)
00478 
00479 #define IEEE80211_RATE_SIZE     8               /* 802.11 standard */
00480 #define IEEE80211_RATE_MAXSIZE  15              /* max rates we'll handle */
00481 #define IEEE80211_KEYBUF_SIZE   16
00482 #define IEEE80211_NODE_HASHSIZE 32
00483 /* simple hash is enough for variation of macaddr */
00484 #define IEEE80211_NODE_HASH(addr)       \
00485         (((u_int8_t *)(addr))[IEEE80211_ADDR_LEN - 1] % IEEE80211_NODE_HASHSIZE)
00486 
00487 typedef TAILQ_HEAD(, ieee80211_node) IEEE80211_NODE_LIST;
00488 
00489 enum ieee80211_phytype {
00490         IEEE80211_T_DS,                 /* direct sequence spread spectrum */
00491         IEEE80211_T_FH,                 /* frequency hopping */
00492         IEEE80211_T_OFDM,               /* frequency division multiplexing */
00493         IEEE80211_T_TURBO,              /* high rate OFDM, aka turbo mode */
00494 };
00495 #define IEEE80211_T_CCK IEEE80211_T_DS  /* more common nomenclature */
00496 
00497 /* XXX not really a mode; there are really multiple PHY's */
00498 enum ieee80211_phymode {
00499         IEEE80211_MODE_AUTO     = 0,    /* autoselect */
00500         IEEE80211_MODE_11A      = 1,    /* 5GHz, OFDM */
00501         IEEE80211_MODE_11B      = 2,    /* 2GHz, CCK */
00502         IEEE80211_MODE_11G      = 3,    /* 2GHz, OFDM */
00503         IEEE80211_MODE_TURBO    = 4,    /* 5GHz, OFDM, 2x clock */
00504 };
00505 #define IEEE80211_MODE_MAX      (IEEE80211_MODE_TURBO+1)
00506 
00507 enum ieee80211_opmode {
00508         IEEE80211_M_STA         = 1,    /* infrastructure station */
00509         IEEE80211_M_IBSS        = 0,    /* IBSS (adhoc) station */
00510         IEEE80211_M_AHDEMO      = 3,    /* Old lucent compatible adhoc demo */
00511         IEEE80211_M_HOSTAP      = 6,    /* Software Access Point */
00512         IEEE80211_M_MONITOR     = 8     /* Receive-only monitor mode */
00513 };
00514 
00515 enum ieee80211_state {
00516         IEEE80211_S_INIT,               /* default state */
00517         IEEE80211_S_SCAN,               /* scanning */
00518         IEEE80211_S_AUTH,               /* try to authenticate */
00519         IEEE80211_S_ASSOC,              /* try to assoc */
00520         IEEE80211_S_RUN                 /* associated */
00521 };
00522 
00523 /*
00524  * WME information element
00525  */
00526 struct wme_ie {
00527         u_int8_t        wme_oui[3];
00528         u_int8_t        wme_oui_type;
00529         u_int8_t        wme_oui_subtype;
00530         u_int8_t        wme_version;
00531         u_int8_t        wme_info;
00532 } __attribute__((__packed__));
00533 
00534 /*
00535  * WME parameters
00536  */
00537 struct wme_param_element {
00538         u_int8_t        aifsn;
00539         u_int8_t        cwminmax;
00540         u_int8_t txoplimit;
00541 };
00542 
00543 /*
00544  * Channels are specified by frequency and attributes.
00545  */
00546 /* XXX should be ieee80211_channel but NetBSD took that for an ioctl param */
00547 struct ieee80211channel {
00548         u_int16_t       ic_freq;        /* setting in Mhz */
00549         u_int16_t       ic_flags;       /* see below */
00550 };
00551 
00552 /* bits 0-3 are for private use by drivers */
00553 /* channel attributes */
00554 #define IEEE80211_CHAN_TURBO    0x0010  /* Turbo channel */
00555 #define IEEE80211_CHAN_CCK      0x0020  /* CCK channel */
00556 #define IEEE80211_CHAN_OFDM     0x0040  /* OFDM channel */
00557 #define IEEE80211_CHAN_2GHZ     0x0080  /* 2 GHz spectrum channel. */
00558 #define IEEE80211_CHAN_5GHZ     0x0100  /* 5 GHz spectrum channel */
00559 #define IEEE80211_CHAN_PASSIVE  0x0200  /* Only passive scan allowed */
00560 #define IEEE80211_CHAN_DYN      0x0400  /* Dynamic CCK-OFDM channel */
00561 #define IEEE80211_CHAN_XR      0x0800  /* XR channel */
00562 /*
00563  * Useful combinations of channel characteristics.
00564  */
00565 #define IEEE80211_CHAN_A \
00566         (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
00567 #define IEEE80211_CHAN_B \
00568         (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
00569 #define IEEE80211_CHAN_PUREG \
00570         (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
00571 #define IEEE80211_CHAN_G \
00572         (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
00573 #define IEEE80211_CHAN_T \
00574         (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
00575 #define IEEE80211_CHAN_X \
00576         (IEEE80211_CHAN_5GHZ|IEEE80211_CHAN_OFDM|IEEE80211_CHAN_XR)
00577 
00578 #define IEEE80211_IS_CHAN_A(_c) \
00579         (((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
00580 #define IEEE80211_IS_CHAN_B(_c) \
00581         (((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
00582 #define IEEE80211_IS_CHAN_PUREG(_c) \
00583         (((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
00584 #define IEEE80211_IS_CHAN_G(_c) \
00585         (((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
00586 #define IEEE80211_IS_CHAN_T(_c) \
00587         (((_c)->ic_flags & IEEE80211_CHAN_T) == IEEE80211_CHAN_T)
00588 #define IEEE80211_IS_CHAN_X(_c) \
00589         (((_c)->ic_flags & IEEE80211_CHAN_T) == IEEE80211_CHAN_X)
00590 
00591 #define IEEE80211_IS_CHAN_2GHZ(_c) \
00592         (((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0)
00593 #define IEEE80211_IS_CHAN_5GHZ(_c) \
00594         (((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0)
00595 #define IEEE80211_IS_CHAN_OFDM(_c) \
00596         (((_c)->ic_flags & IEEE80211_CHAN_OFDM) != 0)
00597 #define IEEE80211_IS_CHAN_CCK(_c) \
00598         (((_c)->ic_flags & IEEE80211_CHAN_CCK) != 0)
00599 
00600 struct ieee80211_rateset {
00601         u_int8_t                rs_nrates;
00602         u_int8_t                rs_rates[IEEE80211_RATE_MAXSIZE];
00603 };
00604 
00605 /* Number of history entries to keep (per node) */
00606 #define IEEE80211_RECV_HIST_LEN         16
00607 #define IEEE80211_JIFFIES_NONE          ((ulong)(~0))
00608 
00609 struct ieee80211_recv_hist {
00610         ulong           hi_jiffies;     /* kernel timestamp */
00611         u_int8_t        hi_rssi;        /* recv ssi */
00612         u_int32_t       hi_rstamp;      /* recv timestamp */
00613         u_int8_t        hi_rantenna;    /* recv antenna */
00614 };
00615 
00616 
00617 /* ni_flags */
00618 #define IEEE80211_N_QOSDATA     0x00000001      /* STATUS: qos data frames enabled */
00619 
00620 /* ni_chan encoding for FH phy */
00621 #define IEEE80211_FH_CHANMOD    80
00622 #define IEEE80211_FH_CHAN(set,pat)      (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
00623 #define IEEE80211_FH_CHANSET(chan)      ((chan)/IEEE80211_FH_CHANMOD+1)
00624 #define IEEE80211_FH_CHANPAT(chan)      ((chan)%IEEE80211_FH_CHANMOD)
00625 
00626 struct ieee80211_wepkey {
00627         int                     wk_len;
00628         u_int8_t                wk_key[IEEE80211_KEYBUF_SIZE];
00629 };
00630 
00631 struct proc_dir_entry;
00632 
00633 #define IEEE80211_ADDR_EQ(a1,a2)        (memcmp(a1,a2,IEEE80211_ADDR_LEN) == 0)
00634 #define IEEE80211_ADDR_COPY(dst,src)    memcpy(dst,src,IEEE80211_ADDR_LEN)
00635 
00636 #define IEEE80211_IS_MULTICAST(a)       ETHER_IS_MULTICAST(a)
00637 
00638 /* ic_flags */
00639 #define IEEE80211_F_ASCAN       0x00000001      /* STATUS: active scan */
00640 #define IEEE80211_F_SIBSS       0x00000002      /* STATUS: start IBSS */
00641 #define IEEE80211_F_WEPON       0x00000100      /* CONF: WEP enabled */
00642 #define IEEE80211_F_IBSSON      0x00000200      /* CONF: IBSS creation enable */
00643 #define IEEE80211_F_PMGTON      0x00000400      /* CONF: Power mgmt enable */
00644 #define IEEE80211_F_DESBSSID    0x00000800      /* CONF: des_bssid is set */
00645 #define IEEE80211_F_SCANAP      0x00001000      /* CONF: Scanning AP */
00646 #define IEEE80211_F_ROAMING     0x00002000      /* CONF: roaming enabled */
00647 #define IEEE80211_F_SWRETRY     0x00004000      /* CONF: sw tx retry enabled */
00648 #define IEEE80211_F_TXPMGT      0x00018000      /* STATUS: tx power */
00649 #define IEEE80211_F_TXPOW_OFF   0x00000000      /* TX Power: radio disabled */
00650 #define IEEE80211_F_TXPOW_FIXED 0x00008000      /* TX Power: fixed rate */
00651 #define IEEE80211_F_TXPOW_AUTO  0x00010000      /* TX Power: undefined */
00652 #define IEEE80211_F_SHSLOT      0x00020000      /* CONF: short slot time */
00653 #define IEEE80211_F_SHPREAMBLE  0x00040000      /* CONF: short preamble */
00654 #define IEEE80211_F_DATAPAD     0x00080000      /* CONF: needs data alignment pad */
00655 
00656 /* ic_capabilities */
00657 #define IEEE80211_C_WEP         0x00000001      /* CAPABILITY: WEP available */
00658 #define IEEE80211_C_IBSS        0x00000002      /* CAPABILITY: IBSS available */
00659 #define IEEE80211_C_PMGT        0x00000004      /* CAPABILITY: Power mgmt */
00660 #define IEEE80211_C_HOSTAP      0x00000008      /* CAPABILITY: HOSTAP avail */
00661 #define IEEE80211_C_AHDEMO      0x00000010      /* CAPABILITY: Old Adhoc Demo */
00662 #define IEEE80211_C_SWRETRY     0x00000020      /* CAPABILITY: sw tx retry */
00663 #define IEEE80211_C_TXPMGT      0x00000040      /* CAPABILITY: tx power mgmt */
00664 #define IEEE80211_C_SHSLOT      0x00000080      /* CAPABILITY: short slottime */
00665 #define IEEE80211_C_SHPREAMBLE  0x00000100      /* CAPABILITY: short preamble */
00666 #define IEEE80211_C_MONITOR     0x00000200      /* CAPABILITY: Monitor Mode   */
00667 #ifdef SOFTLED
00668 #define IEEE80211_C_SOFTLED     0x00100000      /* CAPABILITY: Software LED */
00669 #endif
00670 
00671 /* flags for ieee80211_fix_rate() */
00672 #define IEEE80211_F_DOSORT      0x00000001      /* sort rate list */
00673 #define IEEE80211_F_DOFRATE     0x00000002      /* use fixed rate */
00674 #define IEEE80211_F_DONEGO      0x00000004      /* calc negotiated rate */
00675 #define IEEE80211_F_DODEL       0x00000008      /* delete ignore rate */
00676 
00677 /* private extensions to netdevice.h's netif_msg* mechanism */
00678 #define NETIF_MSG_DEBUG         0x80000000      /* IFF_DEBUG equivalent */
00679 #define NETIF_MSG_LINK2         0x40000000      /* IFF_LINK2 equivalant */
00680 #define netif_msg_debug(p)      ((p)->msg_enable & NETIF_MSG_DEBUG)
00681 #define netif_msg_dumppkts(p) \
00682         (((p)->msg_enable & (NETIF_MSG_DEBUG|NETIF_MSG_LINK2)) == \
00683                 (NETIF_MSG_DEBUG|NETIF_MSG_LINK2))
00684 
00685 #ifdef SOFTLED
00686 #define POLL_EVENT 1                            /* Poll event for LED update */
00687 #define TRANSMIT_EVENT 2                        /* xmit event for LED update */
00688 #define RECEIVE_EVENT 3                         /* rcv event for LED update */
00689 #endif
00690 
00691 #endif /* __KERNEL__ */
00692 
00693 #endif /* _NET_IF_IEEE80211_H_ */

Generated on Mon Nov 21 15:58:10 2005 for openwifi by  doxygen 1.4.1