13147Sxc151355 /* 26411Szf162725 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 33147Sxc151355 * Use is subject to license terms. 43147Sxc151355 */ 53147Sxc151355 63147Sxc151355 /* 73147Sxc151355 * Copyright (c) 2001 Atsushi Onoe 83147Sxc151355 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 93147Sxc151355 * All rights reserved. 103147Sxc151355 * 113147Sxc151355 * Redistribution and use in source and binary forms, with or without 123147Sxc151355 * modification, are permitted provided that the following conditions 133147Sxc151355 * are met: 143147Sxc151355 * 1. Redistributions of source code must retain the above copyright 153147Sxc151355 * notice, this list of conditions and the following disclaimer. 163147Sxc151355 * 2. Redistributions in binary form must reproduce the above copyright 173147Sxc151355 * notice, this list of conditions and the following disclaimer in the 183147Sxc151355 * documentation and/or other materials provided with the distribution. 193147Sxc151355 * 3. The name of the author may not be used to endorse or promote products 203147Sxc151355 * derived from this software without specific prior written permission. 213147Sxc151355 * 223147Sxc151355 * Alternatively, this software may be distributed under the terms of the 233147Sxc151355 * GNU General Public License ("GPL") version 2 as published by the Free 243147Sxc151355 * Software Foundation. 253147Sxc151355 * 263147Sxc151355 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 273147Sxc151355 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 283147Sxc151355 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 293147Sxc151355 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 303147Sxc151355 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 313147Sxc151355 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 323147Sxc151355 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 333147Sxc151355 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 343147Sxc151355 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 353147Sxc151355 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 363147Sxc151355 */ 373147Sxc151355 383147Sxc151355 #ifndef _SYS_NET80211_H 393147Sxc151355 #define _SYS_NET80211_H 403147Sxc151355 413147Sxc151355 #include <sys/mac.h> 423147Sxc151355 #include <sys/ethernet.h> 433147Sxc151355 #include <sys/net80211_proto.h> 443147Sxc151355 #include <sys/net80211_crypto.h> 454126Szf162725 #include <net/wpa.h> 463147Sxc151355 473147Sxc151355 /* 483147Sxc151355 * IEEE802.11 kernel support module 493147Sxc151355 */ 503147Sxc151355 513147Sxc151355 #ifdef __cplusplus 523147Sxc151355 extern "C" { 533147Sxc151355 #endif 543147Sxc151355 553147Sxc151355 /* ic_caps */ 563147Sxc151355 #define IEEE80211_C_WEP 0x00000001 /* CAPABILITY: WEP available */ 573147Sxc151355 #define IEEE80211_C_TKIP 0x00000002 /* CAPABILITY: TKIP available */ 583147Sxc151355 #define IEEE80211_C_AES 0x00000004 /* CAPABILITY: AES OCB avail */ 593147Sxc151355 #define IEEE80211_C_AES_CCM 0x00000008 /* CAPABILITY: AES CCM avail */ 603147Sxc151355 #define IEEE80211_C_CKIP 0x00000010 /* CAPABILITY: CKIP available */ 613147Sxc151355 #define IEEE80211_C_FF 0x00000040 /* CAPABILITY: ATH FF avail */ 623147Sxc151355 #define IEEE80211_C_TURBOP 0x00000080 633147Sxc151355 /* CAPABILITY: ATH Turbo available */ 643147Sxc151355 #define IEEE80211_C_IBSS 0x00000100 /* CAPABILITY: IBSS available */ 653147Sxc151355 #define IEEE80211_C_PMGT 0x00000200 /* CAPABILITY: Power mgmt */ 663147Sxc151355 #define IEEE80211_C_HOSTAP 0x00000400 /* CAPABILITY: HOSTAP avail */ 673147Sxc151355 #define IEEE80211_C_AHDEMO 0x00000800 /* CAPABILITY: Old Adhoc Demo */ 683147Sxc151355 #define IEEE80211_C_SWRETRY 0x00001000 /* CAPABILITY: sw tx retry */ 693147Sxc151355 #define IEEE80211_C_TXPMGT 0x00002000 /* CAPABILITY: tx power mgmt */ 703147Sxc151355 #define IEEE80211_C_SHSLOT 0x00004000 /* CAPABILITY: short slottime */ 713147Sxc151355 #define IEEE80211_C_SHPREAMBLE 0x00008000 /* CAPABILITY: short preamble */ 723147Sxc151355 #define IEEE80211_C_MONITOR 0x00010000 /* CAPABILITY: monitor mode */ 733147Sxc151355 #define IEEE80211_C_TKIPMIC 0x00020000 /* CAPABILITY: TKIP MIC avail */ 743147Sxc151355 #define IEEE80211_C_WPA1 0x00800000 /* CAPABILITY: WPA1 avail */ 753147Sxc151355 #define IEEE80211_C_WPA2 0x01000000 /* CAPABILITY: WPA2 avail */ 763147Sxc151355 #define IEEE80211_C_WPA 0x01800000 773147Sxc151355 /* CAPABILITY: WPA1+WPA2 avail */ 783147Sxc151355 #define IEEE80211_C_BURST 0x02000000 /* CAPABILITY: frame bursting */ 793147Sxc151355 #define IEEE80211_C_WME 0x04000000 /* CAPABILITY: WME avail */ 803147Sxc151355 #define IEEE80211_C_WDS 0x08000000 /* CAPABILITY: 4-addr support */ 813147Sxc151355 /* 0x10000000 reserved */ 823147Sxc151355 #define IEEE80211_C_BGSCAN 0x20000000 /* CAPABILITY: bg scanning */ 833147Sxc151355 #define IEEE80211_C_TXFRAG 0x40000000 /* CAPABILITY: tx fragments */ 843147Sxc151355 /* XXX protection/barker? */ 853147Sxc151355 863147Sxc151355 #define IEEE80211_C_CRYPTO 0x0000001f /* CAPABILITY: crypto alg's */ 873147Sxc151355 883147Sxc151355 /* ic_flags */ 893147Sxc151355 /* NB: bits 0x4c available */ 903147Sxc151355 #define IEEE80211_F_FF 0x00000001 /* CONF: ATH FF enabled */ 913147Sxc151355 #define IEEE80211_F_TURBOP 0x00000002 /* CONF: ATH Turbo enabled */ 923147Sxc151355 #define IEEE80211_F_BURST 0x00000004 /* CONF: bursting enabled */ 933147Sxc151355 /* NB: this is intentionally setup to be IEEE80211_CAPINFO_PRIVACY */ 943147Sxc151355 #define IEEE80211_F_PRIVACY 0x00000010 /* CONF: privacy enabled */ 953147Sxc151355 #define IEEE80211_F_PUREG 0x00000020 /* CONF: 11g w/o 11b sta's */ 963147Sxc151355 #define IEEE80211_F_SCANONLY 0x00000040 /* CONF: scan only */ 973147Sxc151355 #define IEEE80211_F_SCAN 0x00000080 /* STATUS: scanning */ 983147Sxc151355 #define IEEE80211_F_ASCAN 0x00000100 /* STATUS: active scan */ 993147Sxc151355 #define IEEE80211_F_SIBSS 0x00000200 /* STATUS: start IBSS */ 1003147Sxc151355 /* NB: this is intentionally setup to be IEEE80211_CAPINFO_SHORT_SLOTTIME */ 1013147Sxc151355 #define IEEE80211_F_SHSLOT 0x00000400 1023147Sxc151355 /* STATUS: use short slot time */ 1033147Sxc151355 #define IEEE80211_F_PMGTON 0x00000800 /* CONF: Power mgmt enable */ 1043147Sxc151355 #define IEEE80211_F_DESBSSID 0x00001000 /* CONF: des_bssid is set */ 1053147Sxc151355 #define IEEE80211_F_WME 0x00002000 /* CONF: enable WME use */ 1063147Sxc151355 #define IEEE80211_F_BGSCAN 0x00004000 1073147Sxc151355 /* CONF: bg scan enabled (???) */ 1083147Sxc151355 #define IEEE80211_F_SWRETRY 0x00008000 /* CONF: sw tx retry enabled */ 1093147Sxc151355 #define IEEE80211_F_TXPOW_FIXED 0x00010000 /* TX Power: fixed rate */ 1103147Sxc151355 #define IEEE80211_F_IBSSON 0x00020000 /* CONF: IBSS creation enable */ 1113147Sxc151355 #define IEEE80211_F_SHPREAMBLE 0x00040000 /* STATUS: use short preamble */ 1123147Sxc151355 #define IEEE80211_F_DATAPAD 0x00080000 /* CONF: do alignment pad */ 1133147Sxc151355 #define IEEE80211_F_USEPROT 0x00100000 /* STATUS: protection enabled */ 1143147Sxc151355 #define IEEE80211_F_USEBARKER 0x00200000 1153147Sxc151355 /* STATUS: use barker preamble */ 1163147Sxc151355 #define IEEE80211_F_TIMUPDATE 0x00400000 /* STATUS: update beacon tim */ 1173147Sxc151355 #define IEEE80211_F_WPA1 0x00800000 /* CONF: WPA enabled */ 1183147Sxc151355 #define IEEE80211_F_WPA2 0x01000000 /* CONF: WPA2 enabled */ 1193147Sxc151355 #define IEEE80211_F_WPA 0x01800000 /* CONF: WPA/WPA2 enabled */ 1203147Sxc151355 #define IEEE80211_F_DROPUNENC 0x02000000 /* CONF: drop unencrypted */ 1213147Sxc151355 #define IEEE80211_F_COUNTERM 0x04000000 /* CONF: TKIP countermeasures */ 1223147Sxc151355 #define IEEE80211_F_HIDESSID 0x08000000 /* CONF: hide SSID in beacon */ 1233147Sxc151355 #define IEEE80211_F_NOBRIDGE 0x10000000 /* CONF: dis. internal bridge */ 1243147Sxc151355 #define IEEE80211_F_WMEUPDATE 0x20000000 /* STATUS: update beacon wme */ 1253147Sxc151355 1263147Sxc151355 /* ic_flags_ext */ 1273147Sxc151355 #define IEEE80211_FEXT_WDS 0x00000001 /* CONF: 4 addr allowed */ 1283147Sxc151355 /* 0x00000006 reserved */ 1293147Sxc151355 #define IEEE80211_FEXT_BGSCAN 0x00000008 1303147Sxc151355 /* STATUS: enable full bgscan completion */ 1313147Sxc151355 #define IEEE80211_FEXT_ERPUPDATE 0x00000200 /* STATUS: update ERP element */ 1323147Sxc151355 #define IEEE80211_FEXT_SWBMISS 0x00000400 /* CONF: do bmiss in s/w */ 1333147Sxc151355 1343147Sxc151355 /* 1353147Sxc151355 * Channel attributes (ich_flags) 1363147Sxc151355 * bits 0-3 are for private use by drivers 1373147Sxc151355 */ 1383147Sxc151355 #define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ 1393147Sxc151355 #define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ 1403147Sxc151355 #define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ 1413147Sxc151355 #define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ 1423147Sxc151355 #define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ 1433147Sxc151355 #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ 1443147Sxc151355 #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ 1453147Sxc151355 #define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ 1463147Sxc151355 1473147Sxc151355 #define IEEE80211_CHAN_MAX 255 1483147Sxc151355 #define IEEE80211_CHAN_BYTES 32 /* howmany(IEEE80211_CHAN_MAX, NBBY) */ 1493147Sxc151355 #define IEEE80211_CHAN_ANY 0xffff /* token for ``any channel'' */ 1503147Sxc151355 #define IEEE80211_CHAN_ANYC \ 1513147Sxc151355 ((struct ieee80211_channel *)IEEE80211_CHAN_ANY) 1523147Sxc151355 1533147Sxc151355 #define IEEE80211_IS_CHAN_2GHZ(_c) \ 1543147Sxc151355 (((_c)->ich_flags & IEEE80211_CHAN_2GHZ) != 0) 1553147Sxc151355 #define IEEE80211_IS_CHAN_5GHZ(_c) \ 1563147Sxc151355 (((_c)->ich_flags & IEEE80211_CHAN_5GHZ) != 0) 1573147Sxc151355 1583147Sxc151355 #define IEEE80211_NODE_HASHSIZE 32 1593147Sxc151355 1603147Sxc151355 #define IEEE80211_FIXED_RATE_NONE 0 1613147Sxc151355 #define IEEE80211_MCAST_RATE_DEFAULT (2*1) /* default mcast rate (1M) */ 1623147Sxc151355 1633147Sxc151355 /* WME stream classes */ 1643147Sxc151355 #define WME_AC_BE 0 /* best effort */ 1653147Sxc151355 #define WME_AC_BK 1 /* background */ 1663147Sxc151355 #define WME_AC_VI 2 /* video */ 1673147Sxc151355 #define WME_AC_VO 3 /* voice */ 1683147Sxc151355 1694126Szf162725 #define MAX_EVENT 16 1704126Szf162725 #define MAX_IEEE80211STR 256 1714126Szf162725 1723147Sxc151355 /* 1733147Sxc151355 * Authentication mode. 1743147Sxc151355 */ 1753147Sxc151355 enum ieee80211_authmode { 1763147Sxc151355 IEEE80211_AUTH_NONE = 0, 1773147Sxc151355 IEEE80211_AUTH_OPEN = 1, /* open */ 1783147Sxc151355 IEEE80211_AUTH_SHARED = 2, /* shared-key */ 1793147Sxc151355 IEEE80211_AUTH_8021X = 3, /* 802.1x */ 1803147Sxc151355 IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */ 1813147Sxc151355 /* NB: these are used only for ioctls */ 1823147Sxc151355 IEEE80211_AUTH_WPA = 5 /* WPA/RSN w/ 802.1x/PSK */ 1833147Sxc151355 }; 1843147Sxc151355 1853147Sxc151355 enum ieee80211_state { 1863147Sxc151355 IEEE80211_S_INIT = 0, /* default state */ 1873147Sxc151355 IEEE80211_S_SCAN = 1, /* scanning */ 1883147Sxc151355 IEEE80211_S_AUTH = 2, /* try to authenticate */ 1893147Sxc151355 IEEE80211_S_ASSOC = 3, /* try to assoc */ 1903147Sxc151355 IEEE80211_S_RUN = 4 /* associated */ 1913147Sxc151355 }; 1923147Sxc151355 #define IEEE80211_S_MAX (IEEE80211_S_RUN+1) 1933147Sxc151355 1943147Sxc151355 /* 1953147Sxc151355 * 802.11 rate set. 1963147Sxc151355 */ 1973147Sxc151355 #define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */ 1983147Sxc151355 #define IEEE80211_RATE_SIZE 8 /* 802.11 standard */ 1993147Sxc151355 #define IEEE80211_XRATE_SIZE (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) 2003147Sxc151355 /* size of extended supported rates */ 2013147Sxc151355 struct ieee80211_rateset { 2023147Sxc151355 uint8_t ir_nrates; 2033147Sxc151355 uint8_t ir_rates[IEEE80211_RATE_MAXSIZE]; 2043147Sxc151355 }; 2053147Sxc151355 2063147Sxc151355 /* 2073147Sxc151355 * Channels are specified by frequency and attributes. 2083147Sxc151355 */ 2093147Sxc151355 struct ieee80211_channel { 2103147Sxc151355 uint16_t ich_freq; /* setting in Mhz */ 2113147Sxc151355 uint16_t ich_flags; /* see below */ 2123147Sxc151355 }; 2133147Sxc151355 2143147Sxc151355 struct ieee80211_device_stats { 2153147Sxc151355 uint32_t is_tx_frags; 2163147Sxc151355 uint32_t is_tx_bytes; 2173147Sxc151355 uint32_t is_tx_mcast; 2183147Sxc151355 uint32_t is_tx_failed; 2193147Sxc151355 uint32_t is_tx_retries; 2203147Sxc151355 uint32_t is_rts_success; 2213147Sxc151355 uint32_t is_rts_failure; 2223147Sxc151355 uint32_t is_ack_failure; 2233147Sxc151355 uint32_t is_rx_frags; 2243147Sxc151355 uint32_t is_rx_bytes; 2253147Sxc151355 uint32_t is_rx_mcast; 2263147Sxc151355 uint32_t is_rx_dups; 2273147Sxc151355 uint32_t is_fcs_errors; 2283147Sxc151355 uint32_t is_wep_errors; 2293147Sxc151355 uint32_t is_tx_nobuf; 2303147Sxc151355 uint32_t is_tx_unknownmgt; 2313147Sxc151355 }; 2323147Sxc151355 2333147Sxc151355 struct ieee80211_crypto_state; 2343147Sxc151355 typedef struct ieee80211_node_table ieee80211_node_table_t; 2353147Sxc151355 typedef struct ieee80211_node ieee80211_node_t; 2363147Sxc151355 typedef struct ieee80211com ieee80211com_t; 2373147Sxc151355 2383147Sxc151355 struct ieee80211_node_table { 2393147Sxc151355 struct ieee80211com *nt_ic; /* back reference */ 2403147Sxc151355 2413147Sxc151355 const char *nt_name; /* for debugging */ 2423147Sxc151355 /* For node inactivity processing */ 2433147Sxc151355 int nt_inact_timer; /* inactivity timer */ 2443147Sxc151355 int nt_inact_init; /* initial node inact setting */ 2453147Sxc151355 void (*nt_timeout)(struct ieee80211_node_table *); 2463147Sxc151355 uint32_t nt_scangen; /* gen# for timeout scan */ 2473147Sxc151355 kmutex_t nt_scanlock; /* on nt_scangen */ 2483147Sxc151355 kmutex_t nt_nodelock; /* on node table */ 2493147Sxc151355 2503147Sxc151355 int nt_keyixmax; /* keyixmap size */ 2513147Sxc151355 struct ieee80211_node **nt_keyixmap; /* key ix -> node map */ 2523147Sxc151355 2533147Sxc151355 list_t nt_node; /* information of all nodes */ 2543147Sxc151355 list_t nt_hash[IEEE80211_NODE_HASHSIZE]; 2553147Sxc151355 }; 2563147Sxc151355 2573147Sxc151355 /* 2583147Sxc151355 * Node specific information. Note that drivers are expected 2593147Sxc151355 * to derive from this structure to add device-specific per-node 2603147Sxc151355 * state. This is done by overriding the ic_node_* methods in 2613147Sxc151355 * the ieee80211com structure. 2623147Sxc151355 */ 2633147Sxc151355 struct ieee80211_node { 2643147Sxc151355 struct ieee80211com *in_ic; 2653147Sxc151355 struct ieee80211_node_table *in_table; 2663147Sxc151355 2673147Sxc151355 uint8_t in_authmode; /* authentication algorithm */ 2683147Sxc151355 uint16_t in_flags; /* special purpose state */ 2693147Sxc151355 uint16_t in_associd; /* assoc response */ 2703147Sxc151355 uint16_t in_txpower; /* current transmit power */ 2713147Sxc151355 uint16_t in_vlan; /* vlan tag */ 2723147Sxc151355 /* 2733147Sxc151355 * Tx/Rx sequence number. 2743147Sxc151355 * index 0 is used when QoS is not enabled. index 1-16 is used 2753147Sxc151355 * when QoS is enabled. 1-16 corresponds to TID 0-15. 2763147Sxc151355 */ 2773147Sxc151355 uint16_t in_txseqs[17]; /* tx seq per-tid */ 2783147Sxc151355 uint16_t in_rxseqs[17]; /* rx seq previous per-tid */ 2793147Sxc151355 clock_t in_rxfragstamp; /* time stamp of last rx frag */ 2803147Sxc151355 mblk_t *in_rxfrag; /* rx frag reassembly */ 2813147Sxc151355 uint32_t in_scangen; /* gen# for timeout scan */ 2823147Sxc151355 uint32_t in_refcnt; 2833147Sxc151355 2843147Sxc151355 /* hardware */ 2853147Sxc151355 uint32_t in_rstamp; /* recv timestamp */ 2863147Sxc151355 uint8_t in_rssi; /* recv ssi */ 2873147Sxc151355 2883147Sxc151355 /* header */ 2893147Sxc151355 uint8_t in_macaddr[IEEE80211_ADDR_LEN]; 2903147Sxc151355 uint8_t in_bssid[IEEE80211_ADDR_LEN]; 2913147Sxc151355 2923147Sxc151355 /* beacon, probe response */ 2933147Sxc151355 union { 2943147Sxc151355 uint8_t data[8]; 2953147Sxc151355 uint64_t tsf; 2963147Sxc151355 } in_tstamp; /* from last rcv'd beacon */ 2973147Sxc151355 uint16_t in_intval; /* beacon interval */ 2983147Sxc151355 uint16_t in_capinfo; /* capabilities */ 2993147Sxc151355 uint8_t in_esslen; 3003147Sxc151355 uint8_t in_essid[IEEE80211_NWID_LEN]; 3013147Sxc151355 struct ieee80211_rateset in_rates; /* negotiated rate set */ 3023147Sxc151355 struct ieee80211_channel *in_chan; /* XXX multiple uses */ 3033147Sxc151355 enum ieee80211_phytype in_phytype; 3043147Sxc151355 uint16_t in_fhdwell; /* FH only */ 3053147Sxc151355 uint8_t in_fhindex; /* FH only */ 3063147Sxc151355 uint8_t in_erp; /* ERP from beacon/probe resp */ 3073147Sxc151355 uint16_t in_tim_off; /* byte offset to TIM ie */ 3083147Sxc151355 uint8_t in_dtim_period; /* DTIM period */ 3093147Sxc151355 uint8_t in_dtim_count; /* DTIM count for last bcn */ 3103147Sxc151355 3113147Sxc151355 uint32_t *in_challenge; /* shared-key challenge */ 3123147Sxc151355 struct ieee80211_key in_ucastkey; /* unicast key */ 3134126Szf162725 uint8_t *in_wpa_ie; /* captured WPA/RSN ie */ 3143147Sxc151355 3153147Sxc151355 /* others */ 3163147Sxc151355 int32_t in_fails; /* failure count to associate */ 3173147Sxc151355 int16_t in_inact; /* inactivity mark count */ 3183147Sxc151355 int16_t in_inact_reload; /* inactivity reload value */ 3193147Sxc151355 int32_t in_txrate; /* index to ni_rates[] */ 3203147Sxc151355 3213147Sxc151355 list_node_t in_node; /* element of nt->nt_node */ 3223147Sxc151355 list_node_t in_hash; /* element of nt->nt_hash */ 3233147Sxc151355 }; 3243147Sxc151355 3253147Sxc151355 struct ieee80211com { 3263147Sxc151355 mac_handle_t ic_mach; 3273147Sxc151355 3283147Sxc151355 /* Initialized by driver */ 3293147Sxc151355 uint8_t ic_macaddr[IEEE80211_ADDR_LEN]; 3303147Sxc151355 uint32_t ic_caps; /* capabilities */ 3313147Sxc151355 enum ieee80211_phytype ic_phytype; /* XXX wrong for multi-mode */ 3323147Sxc151355 enum ieee80211_opmode ic_opmode; /* current operation mode */ 3333147Sxc151355 enum ieee80211_state ic_state; /* current 802.11 state */ 3343147Sxc151355 struct ieee80211_channel ic_sup_channels[IEEE80211_CHAN_MAX+1]; 3353147Sxc151355 struct ieee80211_rateset ic_sup_rates[IEEE80211_MODE_MAX]; 3363147Sxc151355 enum ieee80211_phymode ic_curmode; /* OPT current mode */ 3373147Sxc151355 struct ieee80211_channel *ic_curchan; /* OPT current channel */ 3383147Sxc151355 struct ieee80211_channel *ic_ibss_chan; /* OPT bss channel */ 3393147Sxc151355 uint8_t ic_maxrssi; /* maximum hardware RSSI */ 3403147Sxc151355 3413147Sxc151355 /* INITIALIZED by IEEE80211, used/overridden by driver */ 3423147Sxc151355 uint16_t ic_modecaps; /* set of mode capabilities */ 3433147Sxc151355 uint8_t ic_chan_active[IEEE80211_CHAN_BYTES]; 3443147Sxc151355 enum ieee80211_protmode ic_protmode; /* 802.11g protection mode */ 3453147Sxc151355 uint16_t ic_bintval; /* beacon interval */ 3463147Sxc151355 uint16_t ic_lintval; /* listen interval */ 3473147Sxc151355 uint16_t ic_txpowlimit; /* global tx power limit */ 3483147Sxc151355 uint8_t ic_bmissthreshold; 3493147Sxc151355 uint16_t ic_rtsthreshold; 3503147Sxc151355 uint16_t ic_fragthreshold; 3513147Sxc151355 int32_t ic_mcast_rate; /* rate for mcast frames */ 3523147Sxc151355 uint8_t ic_fixed_rate; /* value of fixed rate */ 3533147Sxc151355 int32_t ic_des_esslen; /* length of desired essid */ 3543147Sxc151355 uint8_t ic_des_essid[IEEE80211_NWID_LEN]; 3553147Sxc151355 uint8_t ic_des_bssid[IEEE80211_ADDR_LEN]; 3563147Sxc151355 struct ieee80211_channel *ic_des_chan; /* desired channel */ 3573147Sxc151355 void *ic_opt_ie; /* user-specified IE's */ 3583147Sxc151355 uint16_t ic_opt_ie_len; /* length of ic_opt_ie */ 3593147Sxc151355 uint8_t ic_nickname[IEEE80211_NWID_LEN]; 3603147Sxc151355 uint16_t ic_tim_len; /* ic_tim_bitmap size (bytes) */ 3613147Sxc151355 uint8_t *ic_tim_bitmap; /* powersave stations w/ data */ 3623147Sxc151355 timeout_id_t ic_watchdog_timer; /* watchdog timer */ 3633147Sxc151355 /* Cipher state/configuration. */ 3643147Sxc151355 struct ieee80211_crypto_state ic_crypto; 3654499Shx147065 const struct ieee80211_cipher *ic_ciphers[IEEE80211_CIPHER_MAX]; 3663147Sxc151355 3674126Szf162725 kmutex_t ic_doorlock; 3684126Szf162725 char ic_wpadoor[MAX_IEEE80211STR]; 3694126Szf162725 3704126Szf162725 wpa_event_type ic_eventq[MAX_EVENT]; 3714126Szf162725 uint32_t ic_evq_head, ic_evq_tail; 3724126Szf162725 3733147Sxc151355 /* Runtime states */ 3743147Sxc151355 uint32_t ic_flags; /* state/conf flags */ 3753147Sxc151355 uint32_t ic_flags_ext; /* extended state flags */ 3763147Sxc151355 struct ieee80211_node *ic_bss; /* information for this node */ 3773147Sxc151355 struct ieee80211_device_stats ic_stats; 3783147Sxc151355 struct ieee80211_node_table ic_scan; /* STA: scan candidates */ 3793147Sxc151355 struct ieee80211_node_table ic_sta; /* AP:stations/IBSS:neighbors */ 3803147Sxc151355 3813147Sxc151355 /* callback functions */ 3823147Sxc151355 /* 3833147Sxc151355 * Functions initialized by driver before calling ieee80211_attach() 3843147Sxc151355 * Those must be initialized are marked with M(andatory) 3853147Sxc151355 * 3863147Sxc151355 * ic_xmit - [M] transmit a management or null data frame 3873147Sxc151355 * return 0 on success, non-zero on error 3883147Sxc151355 * ic_watchdog - [O] periodic run function, enabled by 3893147Sxc151355 * ieee80211_start_watchdog() 3903147Sxc151355 * ic_set_tim - [O] set/clear traffic indication map 3913147Sxc151355 * ic_set_shortslot - [O] enable/disable short slot timing 3923147Sxc151355 * ic_node_newassoc - [O] driver specific operation on a newly 3933147Sxc151355 * associated or re-assoced node 3943147Sxc151355 */ 3953147Sxc151355 int (*ic_xmit)(ieee80211com_t *, mblk_t *, uint8_t); 3963147Sxc151355 void (*ic_watchdog)(void *); 3973147Sxc151355 void (*ic_set_tim)(ieee80211com_t *, 3983147Sxc151355 ieee80211_node_t *, int); 3993147Sxc151355 void (*ic_set_shortslot)(ieee80211com_t *, int); 4003147Sxc151355 void (*ic_node_newassoc)(ieee80211_node_t *, int); 4013147Sxc151355 /* 4023147Sxc151355 * Functions initialized by ieee80211_attach(), driver could 4033147Sxc151355 * override these functions after calling ieee80211_attach() 4043147Sxc151355 * 4053147Sxc151355 * ic_reset - reset 4063147Sxc151355 * ic_recv_mgmt - handle received management frames 4073147Sxc151355 * ic_send_mgmt - construct and transmit management frames 4083147Sxc151355 * ic_newstate - handle state transition 4093147Sxc151355 * ic_node_alloc - allocate a new BSS info node 4103147Sxc151355 * ic_node_cleanup - cleanup or free memory spaces of a node 4113147Sxc151355 * ic_node_free - free a node 4123147Sxc151355 * ic_node_getrssi - get node's rssi 4133147Sxc151355 */ 4143147Sxc151355 int (*ic_reset)(ieee80211com_t *); 4153147Sxc151355 void (*ic_recv_mgmt)(ieee80211com_t *, 4163147Sxc151355 mblk_t *, ieee80211_node_t *, 4173147Sxc151355 int, int, uint32_t); 4183147Sxc151355 int (*ic_send_mgmt)(ieee80211com_t *, 4193147Sxc151355 ieee80211_node_t *, int, int); 4203147Sxc151355 int (*ic_newstate)(ieee80211com_t *, 4213147Sxc151355 enum ieee80211_state, int); 4223147Sxc151355 struct ieee80211_node *(*ic_node_alloc)(ieee80211com_t *); 4233147Sxc151355 void (*ic_node_cleanup)(ieee80211_node_t *); 4243147Sxc151355 void (*ic_node_free)(ieee80211_node_t *); 4253147Sxc151355 uint8_t (*ic_node_getrssi)(const ieee80211_node_t *); 4263147Sxc151355 4273147Sxc151355 kmutex_t ic_genlock; 4283147Sxc151355 void *ic_private; /* ieee80211 private data */ 4293147Sxc151355 }; 4303147Sxc151355 #define ic_nw_keys ic_crypto.cs_nw_keys 4313147Sxc151355 #define ic_def_txkey ic_crypto.cs_def_txkey 4323147Sxc151355 4333147Sxc151355 extern const char *ieee80211_state_name[IEEE80211_S_MAX]; 4343147Sxc151355 4353147Sxc151355 #define IEEE80211_RATE(_ix) \ 4363147Sxc151355 (in->in_rates.ir_rates[(_ix)] & IEEE80211_RATE_VAL) 4373147Sxc151355 4383147Sxc151355 #define ieee80211_new_state(_ic, _nstate, _arg) \ 4393147Sxc151355 (((_ic)->ic_newstate)((_ic), (_nstate), (_arg))) 4403147Sxc151355 4413147Sxc151355 #define ieee80211_macaddr_sprintf(_addr) \ 4423147Sxc151355 ether_sprintf((struct ether_addr *)(_addr)) 4433147Sxc151355 4443147Sxc151355 /* 4453147Sxc151355 * Node reference counting definitions. 4463147Sxc151355 * 4473147Sxc151355 * ieee80211_node_initref initialize the reference count to 1 4483147Sxc151355 * ieee80211_node_incref add a reference 4493147Sxc151355 * ieee80211_node_decref remove a reference 4503147Sxc151355 * ieee80211_node_decref_nv remove a reference and return new value 4513147Sxc151355 * ieee80211_node_refcnt reference count for printing (only) 4523147Sxc151355 */ 4533147Sxc151355 #include <sys/atomic.h> 4543147Sxc151355 #define ieee80211_node_initref(_in) \ 4553147Sxc151355 ((_in)->in_refcnt = 1) 4563147Sxc151355 #define ieee80211_node_incref(_in) \ 4573147Sxc151355 atomic_inc_uint(&(_in)->in_refcnt) 4583147Sxc151355 #define ieee80211_node_decref(_in) \ 4593147Sxc151355 atomic_dec_uint(&(_in)->in_refcnt) 4603147Sxc151355 #define ieee80211_node_decref_nv(_in) \ 4613147Sxc151355 atomic_dec_uint_nv(&(_in)->in_refcnt) 4623147Sxc151355 #define ieee80211_node_refcnt(_in) \ 4633147Sxc151355 (_in)->in_refcnt 4643147Sxc151355 4653147Sxc151355 typedef void ieee80211_iter_func(void *, ieee80211_node_t *); 4663147Sxc151355 4673147Sxc151355 /* Initialization */ 4683147Sxc151355 void ieee80211_attach(ieee80211com_t *); 4693147Sxc151355 void ieee80211_detach(ieee80211com_t *); 4703147Sxc151355 void ieee80211_media_init(ieee80211com_t *); 4713147Sxc151355 int ieee80211_ioctl(ieee80211com_t *, queue_t *, mblk_t *); 4725296Szf162725 void ieee80211_register_door(ieee80211com_t *, const char *, int); 4733147Sxc151355 4743147Sxc151355 /* Protocol Processing */ 4753147Sxc151355 int ieee80211_input(ieee80211com_t *, mblk_t *, ieee80211_node_t *, 4763147Sxc151355 int32_t, uint32_t); 4773147Sxc151355 mblk_t *ieee80211_encap(ieee80211com_t *, mblk_t *, ieee80211_node_t *); 4783147Sxc151355 4793147Sxc151355 mblk_t *ieee80211_beacon_alloc(ieee80211com_t *, ieee80211_node_t *, 4803147Sxc151355 struct ieee80211_beacon_offsets *); 4813147Sxc151355 int ieee80211_beacon_update(ieee80211com_t *, ieee80211_node_t *, 4823147Sxc151355 struct ieee80211_beacon_offsets *, mblk_t *, int); 4833147Sxc151355 void ieee80211_beacon_miss(ieee80211com_t *); 4843147Sxc151355 4853147Sxc151355 void ieee80211_begin_scan(ieee80211com_t *, boolean_t); 4863147Sxc151355 void ieee80211_next_scan(ieee80211com_t *); 4873147Sxc151355 void ieee80211_end_scan(ieee80211com_t *); 4883147Sxc151355 void ieee80211_cancel_scan(ieee80211com_t *); 4893147Sxc151355 4903147Sxc151355 void ieee80211_sta_join(ieee80211com_t *, ieee80211_node_t *); 4913147Sxc151355 void ieee80211_sta_leave(ieee80211com_t *, ieee80211_node_t *); 4923147Sxc151355 boolean_t ieee80211_ibss_merge(ieee80211_node_t *); 4933147Sxc151355 4943147Sxc151355 /* Node Operation */ 4953147Sxc151355 ieee80211_node_t *ieee80211_ref_node(ieee80211_node_t *); 4963147Sxc151355 void ieee80211_unref_node(ieee80211_node_t **); 4973147Sxc151355 void ieee80211_node_authorize(ieee80211_node_t *); 4983147Sxc151355 void ieee80211_node_unauthorize(ieee80211_node_t *); 4993147Sxc151355 ieee80211_node_t *ieee80211_alloc_node(ieee80211com_t *, 5003147Sxc151355 ieee80211_node_table_t *, const uint8_t *); 5013147Sxc151355 void ieee80211_free_node(ieee80211_node_t *); 5023147Sxc151355 void ieee80211_node_table_reset(ieee80211_node_table_t *); 5033147Sxc151355 void ieee80211_iterate_nodes(ieee80211_node_table_t *, ieee80211_iter_func *, 5043147Sxc151355 void *); 5053147Sxc151355 ieee80211_node_t *ieee80211_find_node(ieee80211_node_table_t *, 5063147Sxc151355 const uint8_t *); 5074126Szf162725 ieee80211_node_t *ieee80211_find_node_with_ssid(ieee80211_node_table_t *, 5084126Szf162725 const uint8_t *, uint32_t, const uint8_t *); 5093147Sxc151355 ieee80211_node_t *ieee80211_find_txnode(ieee80211com_t *, 5103147Sxc151355 const uint8_t daddr[IEEE80211_ADDR_LEN]); 5113147Sxc151355 ieee80211_node_t *ieee80211_find_rxnode(ieee80211com_t *, 5123147Sxc151355 const struct ieee80211_frame *); 5133147Sxc151355 5143147Sxc151355 5153147Sxc151355 /* Crypto */ 5163147Sxc151355 extern struct ieee80211_key *ieee80211_crypto_encap(ieee80211com_t *, mblk_t *); 5173147Sxc151355 extern struct ieee80211_key *ieee80211_crypto_decap(ieee80211com_t *, mblk_t *, 5183147Sxc151355 int); 5193147Sxc151355 extern int ieee80211_crypto_newkey(ieee80211com_t *, int, int, 5203147Sxc151355 struct ieee80211_key *); 5213147Sxc151355 extern int ieee80211_crypto_delkey(ieee80211com_t *, struct ieee80211_key *); 5223147Sxc151355 extern int ieee80211_crypto_setkey(ieee80211com_t *, struct ieee80211_key *, 5233147Sxc151355 const uint8_t macaddr[IEEE80211_ADDR_LEN]); 5243147Sxc151355 5253147Sxc151355 /* Helper Functions */ 5263147Sxc151355 int ieee80211_stat(ieee80211com_t *ic, uint_t stat, uint64_t *val); 5273147Sxc151355 uint32_t ieee80211_chan2ieee(ieee80211com_t *, struct ieee80211_channel *); 5283147Sxc151355 enum ieee80211_phymode ieee80211_chan2mode(ieee80211com_t *, 5293147Sxc151355 struct ieee80211_channel *); 5303147Sxc151355 uint32_t ieee80211_ieee2mhz(uint32_t, uint32_t); 5313147Sxc151355 void ieee80211_reset_chan(ieee80211com_t *); 5323147Sxc151355 void ieee80211_dump_pkt(const uint8_t *, int32_t, int32_t, int32_t); 5333147Sxc151355 void ieee80211_watchdog(void *); 5343147Sxc151355 void ieee80211_start_watchdog(ieee80211com_t *, uint32_t); 5353147Sxc151355 void ieee80211_stop_watchdog(ieee80211com_t *); 5363147Sxc151355 5374126Szf162725 void *ieee80211_malloc(size_t); 5384126Szf162725 void ieee80211_free(void *); 539*7663SSowmini.Varadhan@Sun.COM int ieee80211_setprop(void *, const char *, mac_prop_id_t, uint_t, 540*7663SSowmini.Varadhan@Sun.COM const void *); 541*7663SSowmini.Varadhan@Sun.COM int ieee80211_getprop(void *, const char *, mac_prop_id_t, uint_t, uint_t, 542*7663SSowmini.Varadhan@Sun.COM void *); 5434126Szf162725 5443147Sxc151355 #ifdef __cplusplus 5453147Sxc151355 } 5463147Sxc151355 #endif 5473147Sxc151355 5483147Sxc151355 #endif /* _SYS_NET80211_H */ 549