_ieee80211.h revision 171124
11558Srgrimes/*- 21558Srgrimes * Copyright (c) 2001 Atsushi Onoe 31558Srgrimes * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting 41558Srgrimes * All rights reserved. 51558Srgrimes * 61558Srgrimes * Redistribution and use in source and binary forms, with or without 71558Srgrimes * modification, are permitted provided that the following conditions 81558Srgrimes * are met: 91558Srgrimes * 1. Redistributions of source code must retain the above copyright 101558Srgrimes * notice, this list of conditions and the following disclaimer. 111558Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 121558Srgrimes * notice, this list of conditions and the following disclaimer in the 131558Srgrimes * documentation and/or other materials provided with the distribution. 141558Srgrimes * 151558Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 161558Srgrimes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 171558Srgrimes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 181558Srgrimes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 191558Srgrimes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 201558Srgrimes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 211558Srgrimes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 221558Srgrimes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 231558Srgrimes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 241558Srgrimes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 251558Srgrimes * 261558Srgrimes * $FreeBSD: head/sys/net80211/_ieee80211.h 171124 2007-06-30 21:23:23Z thompsa $ 271558Srgrimes */ 281558Srgrimes#ifndef _NET80211__IEEE80211_H_ 291558Srgrimes#define _NET80211__IEEE80211_H_ 301558Srgrimes 311558Srgrimesenum ieee80211_phytype { 321558Srgrimes IEEE80211_T_DS, /* direct sequence spread spectrum */ 331558Srgrimes IEEE80211_T_FH, /* frequency hopping */ 341558Srgrimes IEEE80211_T_OFDM, /* frequency division multiplexing */ 351558Srgrimes IEEE80211_T_TURBO, /* high rate OFDM, aka turbo mode */ 3637906Scharnier IEEE80211_T_HT, /* high throughput, full GI */ 3723685Speter}; 3837906Scharnier#define IEEE80211_T_CCK IEEE80211_T_DS /* more common nomenclature */ 391558Srgrimes 401558Srgrimes/* XXX not really a mode; there are really multiple PHY's */ 41146754Scharnierenum ieee80211_phymode { 42146754Scharnier IEEE80211_MODE_AUTO = 0, /* autoselect */ 43146754Scharnier IEEE80211_MODE_11A = 1, /* 5GHz, OFDM */ 441558Srgrimes IEEE80211_MODE_11B = 2, /* 2GHz, CCK */ 451558Srgrimes IEEE80211_MODE_11G = 3, /* 2GHz, OFDM */ 461558Srgrimes IEEE80211_MODE_FH = 4, /* 2GHz, GFSK */ 471558Srgrimes IEEE80211_MODE_TURBO_A = 5, /* 5GHz, OFDM, 2x clock */ 4866907Swollman IEEE80211_MODE_TURBO_G = 6, /* 2GHz, OFDM, 2x clock */ 49167011Smckusick IEEE80211_MODE_STURBO_A = 7, /* 5GHz, OFDM, 2x clock, static */ 50167011Smckusick IEEE80211_MODE_11NA = 8, /* 5GHz, w/ HT */ 511558Srgrimes IEEE80211_MODE_11NG = 9, /* 2GHz, w/ HT */ 52167259Smckusick}; 531558Srgrimes#define IEEE80211_MODE_MAX (IEEE80211_MODE_11NG+1) 541558Srgrimes 551558Srgrimesenum ieee80211_opmode { 561558Srgrimes IEEE80211_M_STA = 1, /* infrastructure station */ 57103949Smike IEEE80211_M_IBSS = 0, /* IBSS (adhoc) station */ 5873986Sobrien IEEE80211_M_AHDEMO = 3, /* Old lucent compatible adhoc demo */ 591558Srgrimes IEEE80211_M_HOSTAP = 6, /* Software Access Point */ 60164911Sdwmalone IEEE80211_M_MONITOR = 8, /* Monitor mode */ 611558Srgrimes IEEE80211_M_WDS = 2 /* WDS link */ 621558Srgrimes}; 631558Srgrimes#define IEEE80211_OPMODE_MAX (IEEE80211_M_MONITOR+1) 6466907Swollman 65129665Sstefanf/* 661558Srgrimes * 802.11g/802.11n protection mode. 671558Srgrimes */ 681558Srgrimesenum ieee80211_protmode { 691558Srgrimes IEEE80211_PROT_NONE = 0, /* no protection */ 701558Srgrimes IEEE80211_PROT_CTSONLY = 1, /* CTS to self */ 711558Srgrimes IEEE80211_PROT_RTSCTS = 2, /* RTS-CTS */ 721558Srgrimes}; 731558Srgrimes 74128175Sgreen/* 75128175Sgreen * Authentication mode. 7621174Sguido */ 771558Srgrimesenum ieee80211_authmode { 781558Srgrimes IEEE80211_AUTH_NONE = 0, 791558Srgrimes IEEE80211_AUTH_OPEN = 1, /* open */ 801558Srgrimes IEEE80211_AUTH_SHARED = 2, /* shared-key */ 81164911Sdwmalone IEEE80211_AUTH_8021X = 3, /* 802.1x */ 821558Srgrimes IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */ 8398542Smckusick /* NB: these are used only for ioctls */ 841558Srgrimes IEEE80211_AUTH_WPA = 5, /* WPA/RSN w/ 802.1x/PSK */ 851558Srgrimes}; 861558Srgrimes 871558Srgrimes/* 8898542Smckusick * Roaming mode is effectively who controls the operation 891558Srgrimes * of the 802.11 state machine when operating as a station. 901558Srgrimes * State transitions are controlled either by the driver 911558Srgrimes * (typically when management frames are processed by the 921558Srgrimes * hardware/firmware), the host (auto/normal operation of 931558Srgrimes * the 802.11 layer), or explicitly through ioctl requests 941558Srgrimes * when applications like wpa_supplicant want control. 9598542Smckusick */ 96144099Simpenum ieee80211_roamingmode { 971558Srgrimes IEEE80211_ROAMING_DEVICE= 0, /* driver/hardware control */ 981558Srgrimes IEEE80211_ROAMING_AUTO = 1, /* 802.11 layer control */ 991558Srgrimes IEEE80211_ROAMING_MANUAL= 2, /* application control */ 100167011Smckusick}; 101167011Smckusick 10292837Simp/* 10392837Simp * Channels are specified by frequency and attributes. 10492837Simp */ 10592837Simpstruct ieee80211_channel { 106167011Smckusick uint32_t ic_flags; /* see below */ 107167011Smckusick uint16_t ic_freq; /* setting in Mhz */ 108167011Smckusick uint8_t ic_ieee; /* IEEE channel number */ 109167011Smckusick int8_t ic_maxregpower; /* maximum regulatory tx power in dBm */ 11092837Simp int8_t ic_maxpower; /* maximum tx power in .5 dBm */ 11192837Simp int8_t ic_minpower; /* minimum tx power in .5 dBm */ 11292837Simp /* NB: hole, to be used for dfs */ 11392837Simp}; 11492837Simp 11592837Simp#define IEEE80211_CHAN_MAX 255 11692837Simp#define IEEE80211_CHAN_BYTES 32 /* howmany(IEEE80211_CHAN_MAX, NBBY) */ 11792837Simp#define IEEE80211_CHAN_ANY 0xffff /* token for ``any channel'' */ 11892837Simp#define IEEE80211_CHAN_ANYC \ 11992837Simp ((struct ieee80211_channel *) IEEE80211_CHAN_ANY) 12092837Simp 12192837Simp/* bits 0-3 are for private use by drivers */ 12292837Simp/* channel attributes */ 1231558Srgrimes#define IEEE80211_CHAN_TURBO 0x00010 /* Turbo channel */ 1241558Srgrimes#define IEEE80211_CHAN_CCK 0x00020 /* CCK channel */ 1251558Srgrimes#define IEEE80211_CHAN_OFDM 0x00040 /* OFDM channel */ 1261558Srgrimes#define IEEE80211_CHAN_2GHZ 0x00080 /* 2 GHz spectrum channel. */ 1271558Srgrimes#define IEEE80211_CHAN_5GHZ 0x00100 /* 5 GHz spectrum channel */ 128128175Sgreen#define IEEE80211_CHAN_PASSIVE 0x00200 /* Only passive scan allowed */ 1291558Srgrimes#define IEEE80211_CHAN_DYN 0x00400 /* Dynamic CCK-OFDM channel */ 1301558Srgrimes#define IEEE80211_CHAN_GFSK 0x00800 /* GFSK channel (FHSS PHY) */ 1311558Srgrimes#define IEEE80211_CHAN_GSM 0x01000 /* 900 MHz spectrum channel */ 1321558Srgrimes#define IEEE80211_CHAN_STURBO 0x02000 /* 11a static turbo channel only */ 1331558Srgrimes#define IEEE80211_CHAN_HALF 0x04000 /* Half rate channel */ 1341558Srgrimes#define IEEE80211_CHAN_QUARTER 0x08000 /* Quarter rate channel */ 1351558Srgrimes#define IEEE80211_CHAN_HT20 0x10000 /* HT 20 channel */ 1361558Srgrimes#define IEEE80211_CHAN_HT40U 0x20000 /* HT 40 channel w/ ext above */ 137128175Sgreen#define IEEE80211_CHAN_HT40D 0x40000 /* HT 40 channel w/ ext below */ 138128175Sgreen 139128175Sgreen#define IEEE80211_CHAN_HT40 (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D) 1401558Srgrimes#define IEEE80211_CHAN_HT (IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40) 14123685Speter 1421558Srgrimes/* 14323685Speter * Useful combinations of channel characteristics. 1441558Srgrimes */ 1451558Srgrimes#define IEEE80211_CHAN_FHSS \ 1461558Srgrimes (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK) 1471558Srgrimes#define IEEE80211_CHAN_A \ 1481558Srgrimes (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM) 1491558Srgrimes#define IEEE80211_CHAN_B \ 1501558Srgrimes (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK) 1511558Srgrimes#define IEEE80211_CHAN_PUREG \ 1521558Srgrimes (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM) 1531558Srgrimes#define IEEE80211_CHAN_G \ 1541558Srgrimes (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN) 1551558Srgrimes#define IEEE80211_CHAN_108A \ 1561558Srgrimes (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO) 1571558Srgrimes#define IEEE80211_CHAN_108G \ 1581558Srgrimes (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO) 1591558Srgrimes#define IEEE80211_CHAN_ST \ 1601558Srgrimes (IEEE80211_CHAN_108A | IEEE80211_CHAN_STURBO) 1611558Srgrimes 1621558Srgrimes#define IEEE80211_CHAN_ALL \ 1631558Srgrimes (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \ 1641558Srgrimes IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN | \ 1651558Srgrimes IEEE80211_CHAN_HT) 1661558Srgrimes#define IEEE80211_CHAN_ALLTURBO \ 167241848Seadler (IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO) 168241848Seadler 169241848Seadler#define IEEE80211_IS_CHAN_FHSS(_c) \ 170241848Seadler (((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS) 171241848Seadler#define IEEE80211_IS_CHAN_A(_c) \ 17221174Sguido (((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A) 17321174Sguido#define IEEE80211_IS_CHAN_B(_c) \ 17421174Sguido (((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B) 17521174Sguido#define IEEE80211_IS_CHAN_PUREG(_c) \ 17621174Sguido (((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG) 1771558Srgrimes#define IEEE80211_IS_CHAN_G(_c) \ 1781558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G) 1791558Srgrimes#define IEEE80211_IS_CHAN_ANYG(_c) \ 18092837Simp (IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c)) 1811558Srgrimes#define IEEE80211_IS_CHAN_ST(_c) \ 18292837Simp (((_c)->ic_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST) 1831558Srgrimes#define IEEE80211_IS_CHAN_108A(_c) \ 1841558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_108A) == IEEE80211_CHAN_108A) 1851558Srgrimes#define IEEE80211_IS_CHAN_108G(_c) \ 1861558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G) 1871558Srgrimes 188164911Sdwmalone#define IEEE80211_IS_CHAN_2GHZ(_c) \ 189164911Sdwmalone (((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0) 1901558Srgrimes#define IEEE80211_IS_CHAN_5GHZ(_c) \ 1911558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0) 1921558Srgrimes#define IEEE80211_IS_CHAN_PASSIVE(_c) \ 1931558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_PASSIVE) != 0) 194164911Sdwmalone#define IEEE80211_IS_CHAN_OFDM(_c) \ 1951558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_OFDM) != 0) 1961558Srgrimes#define IEEE80211_IS_CHAN_CCK(_c) \ 1971558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_CCK) != 0) 1981558Srgrimes#define IEEE80211_IS_CHAN_GFSK(_c) \ 1991558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0) 2001558Srgrimes#define IEEE80211_IS_CHAN_TURBO(_c) \ 2011558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_TURBO) != 0) 2021558Srgrimes#define IEEE80211_IS_CHAN_STURBO(_c) \ 20392837Simp (((_c)->ic_flags & IEEE80211_CHAN_STURBO) != 0) 2041558Srgrimes#define IEEE80211_IS_CHAN_DTURBO(_c) \ 2051558Srgrimes (((_c)->ic_flags & \ 2061558Srgrimes (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)) == IEEE80211_CHAN_TURBO) 2071558Srgrimes#define IEEE80211_IS_CHAN_HALF(_c) \ 2081558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_HALF) != 0) 209128175Sgreen#define IEEE80211_IS_CHAN_QUARTER(_c) \ 210128175Sgreen (((_c)->ic_flags & IEEE80211_CHAN_QUARTER) != 0) 211128175Sgreen#define IEEE80211_IS_CHAN_FULL(_c) \ 212128175Sgreen (((_c)->ic_flags & (IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HALF)) == 0) 213128175Sgreen#define IEEE80211_IS_CHAN_GSM(_c) \ 214128175Sgreen (((_c)->ic_flags & IEEE80211_CHAN_GSM) != 0) 215128175Sgreen#define IEEE80211_IS_CHAN_HT(_c) \ 216128175Sgreen (((_c)->ic_flags & IEEE80211_CHAN_HT) != 0) 217128175Sgreen#define IEEE80211_IS_CHAN_HT20(_c) \ 2181558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_HT20) != 0) 2191558Srgrimes#define IEEE80211_IS_CHAN_HT40(_c) \ 2201558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_HT40) != 0) 2211558Srgrimes#define IEEE80211_IS_CHAN_HT40U(_c) \ 2221558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_HT40U) != 0) 2231558Srgrimes#define IEEE80211_IS_CHAN_HT40D(_c) \ 2241558Srgrimes (((_c)->ic_flags & IEEE80211_CHAN_HT40D) != 0) 2251558Srgrimes#define IEEE80211_IS_CHAN_HTA(_c) \ 2261558Srgrimes (IEEE80211_IS_CHAN_5GHZ(_c) && \ 2271558Srgrimes ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0) 2281558Srgrimes#define IEEE80211_IS_CHAN_HTG(_c) \ 2291558Srgrimes (IEEE80211_IS_CHAN_2GHZ(_c) && \ 2301558Srgrimes ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0) 2311558Srgrimes 2321558Srgrimes#define IEEE80211_CHAN2IEEE(_c) (_c)->ic_ieee 2331558Srgrimes 234203816Sjh/* ni_chan encoding for FH phy */ 2351558Srgrimes#define IEEE80211_FH_CHANMOD 80 2361558Srgrimes#define IEEE80211_FH_CHAN(set,pat) (((set)-1)*IEEE80211_FH_CHANMOD+(pat)) 23798542Smckusick#define IEEE80211_FH_CHANSET(chan) ((chan)/IEEE80211_FH_CHANMOD+1) 23898542Smckusick#define IEEE80211_FH_CHANPAT(chan) ((chan)%IEEE80211_FH_CHANMOD) 2391558Srgrimes 2401558Srgrimes/* 24198542Smckusick * 802.11 rate set. 2421558Srgrimes */ 2431558Srgrimes#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */ 2441558Srgrimes#define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */ 2451558Srgrimes 2461558Srgrimesstruct ieee80211_rateset { 2471558Srgrimes uint8_t rs_nrates; 2481558Srgrimes uint8_t rs_rates[IEEE80211_RATE_MAXSIZE]; 2491558Srgrimes}; 2501558Srgrimes 2511558Srgrimes/* 2521558Srgrimes * 802.11n variant of ieee80211_rateset. Instead 25398542Smckusick * legacy rates the entries are MCS rates. We define 25498542Smckusick * the structure such that it can be used interchangeably 2551558Srgrimes * with an ieee80211_rateset (modulo structure size). 2561558Srgrimes */ 2571558Srgrimes#define IEEE80211_HTRATE_MAXSIZE 127 2581558Srgrimes 25934851Sjkhstruct ieee80211_htrateset { 26034851Sjkh uint8_t rs_nrates; 26134851Sjkh uint8_t rs_rates[IEEE80211_HTRATE_MAXSIZE]; 2621558Srgrimes}; 263269303Smckusick 264269303Smckusick/* 265269303Smckusick * Roaming state visible to user space. There are two 266269303Smckusick * thresholds that control whether roaming is considered; 267269303Smckusick * when either is exceeded the 802.11 layer will check 2681558Srgrimes * the scan cache for another AP. If the cache is stale 2691558Srgrimes * then a scan may be triggered. 2701558Srgrimes */ 2711558Srgrimesstruct ieee80211_roam { 2721558Srgrimes int8_t rssi11a; /* rssi thresh for 11a bss */ 2731558Srgrimes int8_t rssi11b; /* for 11g sta in 11b bss */ 27437240Sbde int8_t rssi11bOnly; /* for 11b sta */ 2751558Srgrimes uint8_t pad1; 2761558Srgrimes uint8_t rate11a; /* rate thresh for 11a bss */ 2771558Srgrimes uint8_t rate11b; /* for 11g sta in 11b bss */ 2781558Srgrimes uint8_t rate11bOnly; /* for 11b sta */ 2791558Srgrimes uint8_t pad2; 2801558Srgrimes}; 2811558Srgrimes#endif /* _NET80211__IEEE80211_H_ */ 2821558Srgrimes