13147Sxc151355 /* 2*7663SSowmini.Varadhan@Sun.COM * 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_IMPL_H 393147Sxc151355 #define _SYS_NET80211_IMPL_H 403147Sxc151355 413147Sxc151355 #include <sys/sysmacros.h> 423147Sxc151355 #include <sys/list.h> 433147Sxc151355 #include <sys/note.h> 443147Sxc151355 #include <sys/net80211_proto.h> 453147Sxc151355 #include <sys/net80211.h> 463147Sxc151355 #include <sys/mac_wifi.h> 473147Sxc151355 483147Sxc151355 /* 493147Sxc151355 * IEEE802.11 kernel support module 503147Sxc151355 */ 513147Sxc151355 523147Sxc151355 #ifdef __cplusplus 533147Sxc151355 extern "C" { 543147Sxc151355 #endif 553147Sxc151355 563147Sxc151355 #define IEEE80211_TXPOWER_MAX 100 /* .5 dbM */ 573147Sxc151355 #define IEEE80211_TXPOWER_MIN 0 /* kill radio */ 583147Sxc151355 593147Sxc151355 #define IEEE80211_DTIM_MAX 15 /* max DTIM period */ 603147Sxc151355 #define IEEE80211_DTIM_MIN 1 /* min DTIM period */ 613147Sxc151355 #define IEEE80211_DTIM_DEFAULT 1 /* default DTIM period */ 623147Sxc151355 633147Sxc151355 /* NB: min+max come from WiFi requirements */ 643147Sxc151355 #define IEEE80211_BINTVAL_MAX 1000 /* max beacon interval (TU's) */ 653147Sxc151355 #define IEEE80211_BINTVAL_MIN 25 /* min beacon interval (TU's) */ 663147Sxc151355 #define IEEE80211_BINTVAL_DEFAULT 100 /* default beacon interval (TU's) */ 673147Sxc151355 683147Sxc151355 #define IEEE80211_BMISS_MAX 2 /* maximum consecutive bmiss allowed */ 693147Sxc151355 #define IEEE80211_SWBMISS_THRESHOLD 50 /* s/w bmiss threshold (TU's) */ 703147Sxc151355 #define IEEE80211_HWBMISS_DEFAULT 7 /* h/w bmiss threshold (beacons) */ 713147Sxc151355 723147Sxc151355 #define IEEE80211_PS_SLEEP 0x1 /* STA is in power saving mode */ 733147Sxc151355 #define IEEE80211_PS_MAX_QUEUE 50 /* maximum saved packets */ 743147Sxc151355 753147Sxc151355 #define IEEE80211_RTS_DEFAULT IEEE80211_RTS_MAX 763147Sxc151355 #define IEEE80211_FRAG_DEFAULT IEEE80211_FRAG_MAX 773147Sxc151355 783147Sxc151355 /* 793147Sxc151355 * The RSSI values of two node are taken as almost the same when 803147Sxc151355 * the difference between these two node's RSSI values is within 813147Sxc151355 * IEEE80211_RSSI_CMP_THRESHOLD 823147Sxc151355 */ 833147Sxc151355 #define IEEE80211_RSSI_CMP_THRESHOLD 5 843147Sxc151355 853147Sxc151355 /* 863147Sxc151355 * Each ieee80211com instance has a single timer that fires once a 873147Sxc151355 * second. This is used to initiate various work depending on the 883147Sxc151355 * state of the instance: scanning (passive or active), ``transition'' 893147Sxc151355 * (waiting for a response to a management frame when operating 903147Sxc151355 * as a station), and node inactivity processing (when operating 913147Sxc151355 * as an AP). For inactivity processing each node has a timeout 923147Sxc151355 * set in it's in_inact field that is decremented on each timeout 933147Sxc151355 * and the node is reclaimed when the counter goes to zero. We 943147Sxc151355 * use different inactivity timeout values depending on whether 953147Sxc151355 * the node is associated and authorized (either by 802.1x or 963147Sxc151355 * open/shared key authentication) or associated but yet to be 973147Sxc151355 * authorized. The latter timeout is shorter to more aggressively 983147Sxc151355 * reclaim nodes that leave part way through the 802.1x exchange. 993147Sxc151355 * 1003147Sxc151355 * IEEE80211_INACT_WAIT defines node table's inactivity interval in 1013147Sxc151355 * seconds. On timeout, node table's registered nt_timeout callback 1023147Sxc151355 * function is executed. Each node in the node table has a timeout 1033147Sxc151355 * set in its in_inact field with IEEE80211_INACT_<state>. In 1043147Sxc151355 * nt_timeout function, node table is iterated and each node's 1053147Sxc151355 * in_inact is decremented. So IEEE80211_INACT_<state> is defined in 1063147Sxc151355 * the form [inact_sec]/IEEE80211_INACT_WAIT. 1073147Sxc151355 * 1083147Sxc151355 */ 1093147Sxc151355 #define IEEE80211_INACT_WAIT 15 /* inactivity interval (secs) */ 1103147Sxc151355 #define IEEE80211_INACT_INIT (30/IEEE80211_INACT_WAIT) /* initial */ 1113147Sxc151355 #define IEEE80211_INACT_ASSOC (180/IEEE80211_INACT_WAIT) 1123147Sxc151355 /* associated but not authorized */ 1133147Sxc151355 #define IEEE80211_INACT_RUN (300/IEEE80211_INACT_WAIT) /* authorized */ 1143147Sxc151355 #define IEEE80211_INACT_PROBE (30/IEEE80211_INACT_WAIT) /* probe */ 1153147Sxc151355 #define IEEE80211_INACT_SCAN (300/IEEE80211_INACT_WAIT) /* scanned */ 1163147Sxc151355 1173147Sxc151355 #define IEEE80211_TRANS_WAIT 5 /* mgt frame tx timer (secs) */ 1183147Sxc151355 1193147Sxc151355 /* 1203147Sxc151355 * Useful combinations of channel characteristics. 1213147Sxc151355 */ 1223147Sxc151355 #define IEEE80211_CHAN_FHSS \ 1233147Sxc151355 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK) 1243147Sxc151355 #define IEEE80211_CHAN_A \ 1253147Sxc151355 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM) 1263147Sxc151355 #define IEEE80211_CHAN_B \ 1273147Sxc151355 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK) 1283147Sxc151355 #define IEEE80211_CHAN_PUREG \ 1293147Sxc151355 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM) 1303147Sxc151355 #define IEEE80211_CHAN_G \ 1313147Sxc151355 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN) 1323147Sxc151355 #define IEEE80211_CHAN_T \ 1333147Sxc151355 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO) 1343147Sxc151355 #define IEEE80211_CHAN_108G \ 1353147Sxc151355 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO) 1363147Sxc151355 1373147Sxc151355 #define IEEE80211_CHAN_ALL \ 1383147Sxc151355 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \ 1393147Sxc151355 IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN) 1403147Sxc151355 #define IEEE80211_CHAN_ALLTURBO \ 1413147Sxc151355 (IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO) 1423147Sxc151355 1433147Sxc151355 #define IEEE80211_IS_CHAN_FHSS(_c) \ 1443147Sxc151355 (((_c)->ich_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS) 1453147Sxc151355 #define IEEE80211_IS_CHAN_A(_c) \ 1463147Sxc151355 (((_c)->ich_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A) 1473147Sxc151355 #define IEEE80211_IS_CHAN_B(_c) \ 1483147Sxc151355 (((_c)->ich_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B) 1493147Sxc151355 #define IEEE80211_IS_CHAN_PUREG(_c) \ 1503147Sxc151355 (((_c)->ich_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG) 1513147Sxc151355 #define IEEE80211_IS_CHAN_G(_c) \ 1523147Sxc151355 (((_c)->ich_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G) 1533147Sxc151355 #define IEEE80211_IS_CHAN_ANYG(_c) \ 1543147Sxc151355 (IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c)) 1553147Sxc151355 #define IEEE80211_IS_CHAN_T(_c) \ 1563147Sxc151355 (((_c)->ich_flags & IEEE80211_CHAN_T) == IEEE80211_CHAN_T) 1573147Sxc151355 #define IEEE80211_IS_CHAN_108G(_c) \ 1583147Sxc151355 (((_c)->ich_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G) 1593147Sxc151355 1603147Sxc151355 #define IEEE80211_IS_CHAN_OFDM(_c) \ 1613147Sxc151355 ((_c)->ich_flags & IEEE80211_CHAN_OFDM) 1623147Sxc151355 #define IEEE80211_IS_CHAN_CCK(_c) \ 1633147Sxc151355 ((_c)->ich_flags & IEEE80211_CHAN_CCK) 1643147Sxc151355 #define IEEE80211_IS_CHAN_GFSK(_c) \ 1653147Sxc151355 ((_c)->ich_flags & IEEE80211_CHAN_GFSK) 1663147Sxc151355 #define IEEE80211_IS_CHAN_PASSIVE(_c) \ 1673147Sxc151355 ((_c)->ich_flags & IEEE80211_CHAN_PASSIVE) 1683147Sxc151355 1693147Sxc151355 /* ni_chan encoding for FH phy */ 1703147Sxc151355 #define IEEE80211_FH_CHANMOD 80 1713147Sxc151355 #define IEEE80211_FH_CHAN(set, pat) \ 1723147Sxc151355 (((set) - 1) * IEEE80211_FH_CHANMOD + (pat)) 1733147Sxc151355 #define IEEE80211_FH_CHANSET(chan) \ 1743147Sxc151355 ((chan) / IEEE80211_FH_CHANMOD + 1) 1753147Sxc151355 #define IEEE80211_FH_CHANPAT(chan) \ 1763147Sxc151355 ((chan) % IEEE80211_FH_CHANMOD) 1773147Sxc151355 1783147Sxc151355 #define IEEE80211_NODE_AUTH 0x0001 /* authorized for data */ 1793147Sxc151355 #define IEEE80211_NODE_QOS 0x0002 /* QoS enabled */ 1803147Sxc151355 #define IEEE80211_NODE_ERP 0x0004 /* ERP enabled */ 1813147Sxc151355 #define IEEE80211_NODE_PWR_MGT 0x0010 /* power save mode enabled */ 1823147Sxc151355 #define IEEE80211_NODE_AREF 0x0020 /* authentication ref held */ 1833147Sxc151355 1843147Sxc151355 #define IEEE80211_MAXRSSI 127 1853147Sxc151355 1863147Sxc151355 /* Debug Flags */ 187*7663SSowmini.Varadhan@Sun.COM #define IEEE80211_MSG_BRUSSELS 0x80000000 /* BRUSSELS */ 1883147Sxc151355 #define IEEE80211_MSG_DEBUG 0x40000000 /* IFF_DEBUG equivalent */ 1893147Sxc151355 #define IEEE80211_MSG_DUMPPKTS 0x20000000 /* IFF_LINK2 equivalant */ 1903147Sxc151355 #define IEEE80211_MSG_CRYPTO 0x10000000 /* crypto work */ 1913147Sxc151355 #define IEEE80211_MSG_INPUT 0x08000000 /* input handling */ 1923147Sxc151355 #define IEEE80211_MSG_XRATE 0x04000000 /* rate set handling */ 1933147Sxc151355 #define IEEE80211_MSG_ELEMID 0x02000000 /* element id parsing */ 1943147Sxc151355 #define IEEE80211_MSG_NODE 0x01000000 /* node handling */ 1953147Sxc151355 #define IEEE80211_MSG_ASSOC 0x00800000 /* association handling */ 1963147Sxc151355 #define IEEE80211_MSG_AUTH 0x00400000 /* authentication handling */ 1973147Sxc151355 #define IEEE80211_MSG_SCAN 0x00200000 /* scanning */ 1983147Sxc151355 #define IEEE80211_MSG_OUTPUT 0x00100000 /* output handling */ 1993147Sxc151355 #define IEEE80211_MSG_STATE 0x00080000 /* state machine */ 2003147Sxc151355 #define IEEE80211_MSG_POWER 0x00040000 /* power save handling */ 2013147Sxc151355 #define IEEE80211_MSG_DOT1X 0x00020000 /* 802.1x authenticator */ 2023147Sxc151355 #define IEEE80211_MSG_DOT1XSM 0x00010000 /* 802.1x state machine */ 2033147Sxc151355 #define IEEE80211_MSG_RADIUS 0x00008000 /* 802.1x radius client */ 2043147Sxc151355 #define IEEE80211_MSG_RADDUMP 0x00004000 /* dump 802.1x radius packets */ 2053147Sxc151355 #define IEEE80211_MSG_RADKEYS 0x00002000 /* dump 802.1x keys */ 2063147Sxc151355 #define IEEE80211_MSG_WPA 0x00001000 /* WPA/RSN protocol */ 2073147Sxc151355 #define IEEE80211_MSG_ACL 0x00000800 /* ACL handling */ 2083147Sxc151355 #define IEEE80211_MSG_WME 0x00000400 /* WME protocol */ 2093147Sxc151355 #define IEEE80211_MSG_SUPERG 0x00000200 /* Atheros SuperG protocol */ 2103147Sxc151355 #define IEEE80211_MSG_DOTH 0x00000100 /* 802.11h support */ 2113147Sxc151355 #define IEEE80211_MSG_INACT 0x00000080 /* inactivity handling */ 2123147Sxc151355 #define IEEE80211_MSG_ROAM 0x00000040 /* sta-mode roaming */ 2133147Sxc151355 #define IEEE80211_MSG_CONFIG 0x00000020 /* wificonfig/dladm */ 2143147Sxc151355 #define IEEE80211_MSG_ANY 0xffffffff /* anything */ 2153147Sxc151355 2163147Sxc151355 /* Error flags returned by ieee80211_match_bss */ 2173147Sxc151355 #define IEEE80211_BADCHAN 0x01 2183147Sxc151355 #define IEEE80211_BADOPMODE 0x02 2193147Sxc151355 #define IEEE80211_BADPRIVACY 0x04 2203147Sxc151355 #define IEEE80211_BADRATE 0x08 2213147Sxc151355 #define IEEE80211_BADESSID 0x10 2223147Sxc151355 #define IEEE80211_BADBSSID 0x20 2233147Sxc151355 #define IEEE80211_NODEFAIL 0x40 2243147Sxc151355 2253147Sxc151355 typedef struct ieee80211_impl { 2263147Sxc151355 struct ieee80211com *ic; 2273147Sxc151355 uint8_t im_chan_avail[IEEE80211_CHAN_BYTES]; 2283147Sxc151355 uint8_t im_chan_scan[IEEE80211_CHAN_BYTES]; 2293147Sxc151355 2303147Sxc151355 uint8_t im_bmiss_count; /* current beacon miss count */ 2313147Sxc151355 int32_t im_bmiss_max; /* max bmiss before scan */ 2323147Sxc151355 timeout_id_t im_swbmiss; 2333147Sxc151355 uint16_t im_swbmiss_count; /* beacons in last period */ 2343147Sxc151355 uint16_t im_swbmiss_period; /* s/w bmiss period */ 2353147Sxc151355 2363147Sxc151355 int32_t im_mgt_timer; /* mgmt timeout, secs */ 2373147Sxc151355 int32_t im_inact_timer; /* inactivity timer wait, sec */ 2383147Sxc151355 int32_t im_inact_init; /* initial setting */ 2393147Sxc151355 int32_t im_inact_assoc; /* assoc but not authorized */ 2403147Sxc151355 int32_t im_inact_run; /* authorized setting */ 2413147Sxc151355 int32_t im_inact_probe; /* inactive probe time */ 2423147Sxc151355 2433147Sxc151355 kcondvar_t im_scan_cv; /* wait scan complete */ 2443147Sxc151355 } ieee80211_impl_t; 2453147Sxc151355 2463147Sxc151355 /* 2473147Sxc151355 * Parameters supplied when adding/updating an entry in a 2483147Sxc151355 * scan cache. Pointer variables should be set to NULL 2493147Sxc151355 * if no data is available. Pointer references can be to 2503147Sxc151355 * local data; any information that is saved will be copied. 2513147Sxc151355 * All multi-byte values must be in host byte order. 2523147Sxc151355 */ 2533147Sxc151355 struct ieee80211_scanparams { 2543147Sxc151355 uint16_t capinfo; /* 802.11 capabilities */ 2553147Sxc151355 enum ieee80211_phytype phytype; 2563147Sxc151355 uint16_t fhdwell; /* FHSS dwell interval */ 2573147Sxc151355 uint8_t chan; 2583147Sxc151355 uint8_t bchan; 2593147Sxc151355 uint8_t fhindex; 2603147Sxc151355 uint8_t erp; 2613147Sxc151355 uint16_t bintval; 2623147Sxc151355 uint8_t timoff; 2633147Sxc151355 uint8_t *tim; 2643147Sxc151355 uint8_t *tstamp; 2653147Sxc151355 uint8_t *country; 2663147Sxc151355 uint8_t *ssid; 2673147Sxc151355 uint8_t *rates; 2683147Sxc151355 uint8_t *xrates; 2693147Sxc151355 uint8_t *wpa; 2703147Sxc151355 uint8_t *wme; 2713147Sxc151355 }; 2723147Sxc151355 2733147Sxc151355 #define IEEE80211_SEND_MGMT(_ic, _in, _type, _arg) \ 2743147Sxc151355 ((*(_ic)->ic_send_mgmt)((_ic), (_in), (_type), (_arg))) 2753147Sxc151355 2763147Sxc151355 /* Verify the existence and length of __elem or get out. */ 2773147Sxc151355 #define IEEE80211_VERIFY_ELEMENT(__elem, __maxlen, __func) do { \ 2783147Sxc151355 _NOTE(CONSTCOND) \ 2793147Sxc151355 if ((__elem) == NULL) { \ 2803147Sxc151355 ieee80211_err("ieee80211: no #__elem \n"); \ 2813147Sxc151355 __func; \ 2823147Sxc151355 } \ 2833147Sxc151355 if ((__elem)[1] > (__maxlen)) { \ 2843147Sxc151355 ieee80211_err("ieee80211: bad "#__elem " len %d\n", \ 2853147Sxc151355 (__elem)[1]); \ 2863147Sxc151355 __func; \ 2873147Sxc151355 } \ 2883147Sxc151355 _NOTE(CONSTCOND) \ 2893147Sxc151355 } while (0) 2903147Sxc151355 2913147Sxc151355 #define IEEE80211_VERIFY_LENGTH(_len, _minlen, _func) do { \ 2923147Sxc151355 _NOTE(CONSTCOND) \ 2933147Sxc151355 if ((_len) < (_minlen)) { \ 2943147Sxc151355 ieee80211_dbg(IEEE80211_MSG_ELEMID, \ 2953147Sxc151355 "ie of type %s too short", \ 2963147Sxc151355 ieee80211_mgt_subtype_name[subtype >> \ 2973147Sxc151355 IEEE80211_FC0_SUBTYPE_SHIFT]); \ 2983147Sxc151355 _func; \ 2993147Sxc151355 } \ 3003147Sxc151355 _NOTE(CONSTCOND) \ 3013147Sxc151355 } while (0) 3023147Sxc151355 3033147Sxc151355 #define IEEE80211_VERIFY_SSID(_in, _ssid, _func) do { \ 3043147Sxc151355 _NOTE(CONSTCOND) \ 3053147Sxc151355 ASSERT((_in) != NULL); \ 3063147Sxc151355 if ((_ssid)[1] != 0 && \ 3073147Sxc151355 ((_ssid)[1] != (_in)->in_esslen || \ 3083147Sxc151355 bcmp((_ssid) + 2, (_in)->in_essid, (_ssid)[1]) != 0)) { \ 3093147Sxc151355 _func; \ 3103147Sxc151355 } \ 3113147Sxc151355 _NOTE(CONSTCOND) \ 3123147Sxc151355 } while (0) 3133147Sxc151355 3143147Sxc151355 #define ieee80211_setbit(a, i) ((a)[(i)/NBBY] |= (1 << ((i)%NBBY))) 3153147Sxc151355 #define ieee80211_clrbit(a, i) ((a)[(i)/NBBY] &= ~(1 << ((i)%NBBY))) 3163147Sxc151355 #define ieee80211_isset(a, i) ((a)[(i)/NBBY] & (1 << ((i)%NBBY))) 3173147Sxc151355 #define ieee80211_isclr(a, i) (!((a)[(i)/NBBY] & (1 << ((i)%NBBY)))) 3183147Sxc151355 3193147Sxc151355 #define IEEE80211_N(a) (sizeof (a) / sizeof (a[0])) 3203147Sxc151355 3213147Sxc151355 #define IEEE80211_LOCK(_ic) \ 3223147Sxc151355 mutex_enter(&(_ic)->ic_genlock) 3233147Sxc151355 #define IEEE80211_UNLOCK(_ic) \ 3243147Sxc151355 mutex_exit(&(_ic)->ic_genlock) 3253147Sxc151355 #define IEEE80211_IS_LOCKED(_ic) \ 3263147Sxc151355 mutex_owned(&(_ic)->ic_genlock) 3273147Sxc151355 #define IEEE80211_LOCK_ASSERT(_ic) \ 3283147Sxc151355 ASSERT(mutex_owned(&(_ic)->ic_genlock)) 3293147Sxc151355 3303147Sxc151355 #define IEEE80211_NODE_LOCK(_nt) \ 3313147Sxc151355 mutex_enter(&(_nt)->nt_nodelock) 3323147Sxc151355 #define IEEE80211_NODE_UNLOCK(_nt) \ 3333147Sxc151355 mutex_exit(&(_nt)->nt_nodelock) 3343147Sxc151355 #define IEEE80211_NODE_IS_LOCKED(_nt) \ 3353147Sxc151355 mutex_owned(&(_nt)->nt_nodelock) 3363147Sxc151355 #define IEEE80211_NODE_LOCK_ASSERT(_nt) \ 3373147Sxc151355 ASSERT(mutex_owned(&(_nt)->nt_nodelock)) 3383147Sxc151355 #define ieee80211_node_hash(addr) \ 3393147Sxc151355 (((uint8_t *)(addr))[IEEE80211_ADDR_LEN - 1] % IEEE80211_NODE_HASHSIZE) 3403147Sxc151355 3413147Sxc151355 #define IEEE80211_SCAN_LOCK(_nt) mutex_enter(&(_nt)->nt_scanlock) 3423147Sxc151355 #define IEEE80211_SCAN_UNLOCK(_nt) mutex_exit(&(_nt)->nt_scanlock) 3433147Sxc151355 3443147Sxc151355 #define IEEE80211_RV(v) ((v) & IEEE80211_RATE_VAL) 3453147Sxc151355 3463147Sxc151355 #define IEEE80211_SUBTYPE_NAME(subtype) \ 3473147Sxc151355 ieee80211_mgt_subtype_name[(subtype) >> IEEE80211_FC0_SUBTYPE_SHIFT] 3483147Sxc151355 3493147Sxc151355 extern const char *ieee80211_mgt_subtype_name[]; 3503147Sxc151355 extern const char *ieee80211_phymode_name[]; 3513147Sxc151355 3523147Sxc151355 void ieee80211_err(const int8_t *, ...); 3533147Sxc151355 void ieee80211_dbg(uint32_t, const int8_t *, ...); 3543147Sxc151355 int ieee80211_hdrspace(const void *); 3553147Sxc151355 3564126Szf162725 void ieee80211_notify(ieee80211com_t *, wpa_event_type); 3574126Szf162725 void ieee80211_mac_update(ieee80211com_t *); 3584126Szf162725 3594126Szf162725 uint64_t ieee80211_read_6(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t); 3604126Szf162725 3613147Sxc151355 /* node */ 3623147Sxc151355 void ieee80211_node_attach(ieee80211com_t *); 3633147Sxc151355 void ieee80211_node_lateattach(ieee80211com_t *); 3643147Sxc151355 void ieee80211_node_detach(ieee80211com_t *); 3653147Sxc151355 void ieee80211_reset_bss(ieee80211com_t *); 3663147Sxc151355 void ieee80211_cancel_scan(ieee80211com_t *); 3673147Sxc151355 void ieee80211_add_scan(ieee80211com_t *, const struct ieee80211_scanparams *, 3683147Sxc151355 const struct ieee80211_frame *, int, int, int); 3693147Sxc151355 void ieee80211_init_neighbor(ieee80211_node_t *, const struct ieee80211_frame *, 3703147Sxc151355 const struct ieee80211_scanparams *); 3713147Sxc151355 ieee80211_node_t *ieee80211_add_neighbor(ieee80211com_t *, 3723147Sxc151355 const struct ieee80211_frame *, const struct ieee80211_scanparams *); 3733147Sxc151355 void ieee80211_create_ibss(ieee80211com_t *, struct ieee80211_channel *); 3743147Sxc151355 ieee80211_node_t *ieee80211_fakeup_adhoc_node(ieee80211_node_table_t *, 3753147Sxc151355 const uint8_t *); 3763147Sxc151355 ieee80211_node_t *ieee80211_tmp_node(ieee80211com_t *, const uint8_t *); 3773147Sxc151355 3783147Sxc151355 /* proto */ 3793147Sxc151355 void ieee80211_proto_attach(ieee80211com_t *); 3803147Sxc151355 int ieee80211_fix_rate(ieee80211_node_t *, int); 3813147Sxc151355 void ieee80211_setbasicrates(struct ieee80211_rateset *, 3823147Sxc151355 enum ieee80211_phymode); 3833147Sxc151355 void ieee80211_reset_erp(ieee80211com_t *); 3843147Sxc151355 void ieee80211_set_shortslottime(ieee80211com_t *, boolean_t); 3853147Sxc151355 3863147Sxc151355 /* input */ 3873147Sxc151355 int ieee80211_setup_rates(ieee80211_node_t *, const uint8_t *, 3883147Sxc151355 const uint8_t *, int); 3893147Sxc151355 void ieee80211_recv_mgmt(ieee80211com_t *, mblk_t *, ieee80211_node_t *, 3903147Sxc151355 int, int, uint32_t); 3913147Sxc151355 3923147Sxc151355 /* output */ 3933147Sxc151355 int ieee80211_send_probereq(ieee80211_node_t *, const uint8_t *, 3943147Sxc151355 const uint8_t *, const uint8_t *, const uint8_t *, size_t, const void *, 3953147Sxc151355 size_t); 3963147Sxc151355 int ieee80211_send_mgmt(ieee80211com_t *, ieee80211_node_t *, int, int); 3973147Sxc151355 int ieee80211_send_nulldata(ieee80211_node_t *); 3983147Sxc151355 3993147Sxc151355 /* crypto */ 4003147Sxc151355 struct ieee80211_key *ieee80211_crypto_getkey(ieee80211com_t *); 4013147Sxc151355 uint8_t ieee80211_crypto_getciphertype(ieee80211com_t *); 4023147Sxc151355 4033147Sxc151355 /* generic */ 4043147Sxc151355 mblk_t *ieee80211_getmgtframe(uint8_t **, int); 4053147Sxc151355 void ieee80211_notify_node_join(ieee80211com_t *, ieee80211_node_t *); 4063147Sxc151355 void ieee80211_notify_node_leave(ieee80211com_t *, ieee80211_node_t *); 4073147Sxc151355 4083147Sxc151355 #ifdef __cplusplus 4093147Sxc151355 } 4103147Sxc151355 #endif 4113147Sxc151355 4123147Sxc151355 #endif /* _SYS_NET80211_IMPL_H */ 413