| Commit | Line | Data |
|---|---|---|
| 32176cfd | 1 | /*- |
| f186073c | 2 | * Copyright (c) 2001 Atsushi Onoe |
| 32176cfd | 3 | * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting |
| f186073c JS |
4 | * All rights reserved. |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| f186073c JS |
14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 25 | * | |
| 4028af95 | 26 | * $FreeBSD: head/sys/net80211/ieee80211_node.h 206358 2010-04-07 15:29:13Z rpaulo $ |
| 32176cfd | 27 | * $DragonFly$ |
| f186073c | 28 | */ |
| 841ab66c SZ |
29 | #ifndef _NET80211_IEEE80211_NODE_H_ |
| 30 | #define _NET80211_IEEE80211_NODE_H_ | |
| f186073c | 31 | |
| 4028af95 RP |
32 | #include <netproto/802_11/ieee80211_ioctl.h> /* for ieee80211_nodestats */ |
| 33 | #include <netproto/802_11/ieee80211_ht.h> /* for aggregation state */ | |
| f186073c | 34 | |
| 841ab66c | 35 | /* |
| 32176cfd RP |
36 | * Each ieee80211com instance has a single timer that fires every |
| 37 | * IEEE80211_INACT_WAIT seconds to handle "inactivity processing". | |
| 38 | * This is used to do node inactivity processing when operating | |
| 39 | * as an AP, adhoc or mesh mode. For inactivity processing each node | |
| 40 | * has a timeout set in it's ni_inact field that is decremented | |
| 41 | * on each timeout and the node is reclaimed when the counter goes | |
| 42 | * to zero. We use different inactivity timeout values depending | |
| 43 | * on whether the node is associated and authorized (either by | |
| 44 | * 802.1x or open/shared key authentication) or associated but yet | |
| 45 | * to be authorized. The latter timeout is shorter to more aggressively | |
| 841ab66c SZ |
46 | * reclaim nodes that leave part way through the 802.1x exchange. |
| 47 | */ | |
| 48 | #define IEEE80211_INACT_WAIT 15 /* inactivity interval (secs) */ | |
| 49 | #define IEEE80211_INACT_INIT (30/IEEE80211_INACT_WAIT) /* initial */ | |
| 50 | #define IEEE80211_INACT_AUTH (180/IEEE80211_INACT_WAIT) /* associated but not authorized */ | |
| 51 | #define IEEE80211_INACT_RUN (300/IEEE80211_INACT_WAIT) /* authorized */ | |
| 52 | #define IEEE80211_INACT_PROBE (30/IEEE80211_INACT_WAIT) /* probe */ | |
| 53 | #define IEEE80211_INACT_SCAN (300/IEEE80211_INACT_WAIT) /* scanned */ | |
| 54 | ||
| 32176cfd RP |
55 | #define IEEE80211_TRANS_WAIT 2 /* mgt frame tx timer (secs) */ |
| 56 | ||
| 57 | /* threshold for aging overlapping non-ERP bss */ | |
| 58 | #define IEEE80211_NONERP_PRESENT_AGE msecs_to_ticks(60*1000) | |
| f186073c | 59 | |
| 32176cfd | 60 | #define IEEE80211_NODE_HASHSIZE 32 /* NB: hash size must be pow2 */ |
| f186073c | 61 | /* simple hash is enough for variation of macaddr */ |
| 32176cfd | 62 | #define IEEE80211_NODE_HASH(ic, addr) \ |
| 841ab66c SZ |
63 | (((const uint8_t *)(addr))[IEEE80211_ADDR_LEN - 1] % \ |
| 64 | IEEE80211_NODE_HASHSIZE) | |
| f186073c | 65 | |
| 841ab66c SZ |
66 | struct ieee80211_node_table; |
| 67 | struct ieee80211com; | |
| 32176cfd RP |
68 | struct ieee80211vap; |
| 69 | ||
| 70 | /* | |
| 71 | * Information element ``blob''. We use this structure | |
| 72 | * to capture management frame payloads that need to be | |
| 73 | * retained. Information elements within the payload that | |
| 74 | * we need to consult have references recorded. | |
| 75 | */ | |
| 76 | struct ieee80211_ies { | |
| 77 | /* the following are either NULL or point within data */ | |
| 78 | uint8_t *wpa_ie; /* captured WPA ie */ | |
| 79 | uint8_t *rsn_ie; /* captured RSN ie */ | |
| 80 | uint8_t *wme_ie; /* captured WME ie */ | |
| 81 | uint8_t *ath_ie; /* captured Atheros ie */ | |
| 82 | uint8_t *htcap_ie; /* captured HTCAP ie */ | |
| 83 | uint8_t *htinfo_ie; /* captured HTINFO ie */ | |
| 84 | uint8_t *tdma_ie; /* captured TDMA ie */ | |
| 85 | uint8_t *meshid_ie; /* captured MESH ID ie */ | |
| 86 | uint8_t *spare[4]; | |
| 87 | /* NB: these must be the last members of this structure */ | |
| 88 | uint8_t *data; /* frame data > 802.11 header */ | |
| 89 | int len; /* data size in bytes */ | |
| 90 | }; | |
| 91 | ||
| 92 | /* | |
| 93 | * 802.11s (Mesh) Peer Link FSM state. | |
| 94 | */ | |
| 95 | enum ieee80211_mesh_mlstate { | |
| 96 | IEEE80211_NODE_MESH_IDLE = 0, | |
| 97 | IEEE80211_NODE_MESH_OPENSNT = 1, /* open frame sent */ | |
| 98 | IEEE80211_NODE_MESH_OPENRCV = 2, /* open frame received */ | |
| 99 | IEEE80211_NODE_MESH_CONFIRMRCV = 3, /* confirm frame received */ | |
| 100 | IEEE80211_NODE_MESH_ESTABLISHED = 4, /* link established */ | |
| 101 | IEEE80211_NODE_MESH_HOLDING = 5, /* link closing */ | |
| 102 | }; | |
| 103 | #define IEEE80211_MESH_MLSTATE_BITS \ | |
| 104 | "\20\1IDLE\2OPENSNT\2OPENRCV\3CONFIRMRCV\4ESTABLISHED\5HOLDING" | |
| 841ab66c | 105 | |
| f186073c JS |
106 | /* |
| 107 | * Node specific information. Note that drivers are expected | |
| 108 | * to derive from this structure to add device-specific per-node | |
| 109 | * state. This is done by overriding the ic_node_* methods in | |
| 110 | * the ieee80211com structure. | |
| 111 | */ | |
| 112 | struct ieee80211_node { | |
| 32176cfd RP |
113 | struct ieee80211vap *ni_vap; /* associated vap */ |
| 114 | struct ieee80211com *ni_ic; /* copy from vap to save deref*/ | |
| 115 | struct ieee80211_node_table *ni_table; /* NB: may be NULL */ | |
| 116 | TAILQ_ENTRY(ieee80211_node) ni_list; /* list of all nodes */ | |
| 117 | LIST_ENTRY(ieee80211_node) ni_hash; /* hash collision list */ | |
| 118 | u_int ni_refcnt; /* count of held references */ | |
| 119 | u_int ni_scangen; /* gen# for timeout scan */ | |
| 120 | u_int ni_flags; | |
| 121 | #define IEEE80211_NODE_AUTH 0x000001 /* authorized for data */ | |
| 122 | #define IEEE80211_NODE_QOS 0x000002 /* QoS enabled */ | |
| 123 | #define IEEE80211_NODE_ERP 0x000004 /* ERP enabled */ | |
| 841ab66c | 124 | /* NB: this must have the same value as IEEE80211_FC1_PWR_MGT */ |
| 32176cfd RP |
125 | #define IEEE80211_NODE_PWR_MGT 0x000010 /* power save mode enabled */ |
| 126 | #define IEEE80211_NODE_AREF 0x000020 /* authentication ref held */ | |
| 127 | #define IEEE80211_NODE_HT 0x000040 /* HT enabled */ | |
| 128 | #define IEEE80211_NODE_HTCOMPAT 0x000080 /* HT setup w/ vendor OUI's */ | |
| 129 | #define IEEE80211_NODE_WPS 0x000100 /* WPS association */ | |
| 130 | #define IEEE80211_NODE_TSN 0x000200 /* TSN association */ | |
| 131 | #define IEEE80211_NODE_AMPDU_RX 0x000400 /* AMPDU rx enabled */ | |
| 132 | #define IEEE80211_NODE_AMPDU_TX 0x000800 /* AMPDU tx enabled */ | |
| 133 | #define IEEE80211_NODE_MIMO_PS 0x001000 /* MIMO power save enabled */ | |
| 134 | #define IEEE80211_NODE_MIMO_RTS 0x002000 /* send RTS in MIMO PS */ | |
| 135 | #define IEEE80211_NODE_RIFS 0x004000 /* RIFS enabled */ | |
| 136 | #define IEEE80211_NODE_SGI20 0x008000 /* Short GI in HT20 enabled */ | |
| 137 | #define IEEE80211_NODE_SGI40 0x010000 /* Short GI in HT40 enabled */ | |
| 138 | #define IEEE80211_NODE_ASSOCID 0x020000 /* xmit requires associd */ | |
| 139 | #define IEEE80211_NODE_AMSDU_RX 0x040000 /* AMSDU rx enabled */ | |
| 140 | #define IEEE80211_NODE_AMSDU_TX 0x080000 /* AMSDU tx enabled */ | |
| 141 | uint16_t ni_associd; /* association ID */ | |
| 841ab66c | 142 | uint16_t ni_vlan; /* vlan tag */ |
| 32176cfd RP |
143 | uint16_t ni_txpower; /* current transmit power */ |
| 144 | uint8_t ni_authmode; /* authentication algorithm */ | |
| 145 | uint8_t ni_ath_flags; /* Atheros feature flags */ | |
| 146 | /* NB: These must have the same values as IEEE80211_ATHC_* */ | |
| 147 | #define IEEE80211_NODE_TURBOP 0x0001 /* Turbo prime enable */ | |
| 148 | #define IEEE80211_NODE_COMP 0x0002 /* Compresssion enable */ | |
| 149 | #define IEEE80211_NODE_FF 0x0004 /* Fast Frame capable */ | |
| 150 | #define IEEE80211_NODE_XR 0x0008 /* Atheros WME enable */ | |
| 151 | #define IEEE80211_NODE_AR 0x0010 /* AR capable */ | |
| 152 | #define IEEE80211_NODE_BOOST 0x0080 /* Dynamic Turbo boosted */ | |
| 153 | uint16_t ni_ath_defkeyix;/* Atheros def key index */ | |
| 154 | const struct ieee80211_txparam *ni_txparms; | |
| 155 | uint32_t ni_jointime; /* time of join (secs) */ | |
| 841ab66c | 156 | uint32_t *ni_challenge; /* shared-key challenge */ |
| 32176cfd RP |
157 | struct ieee80211_ies ni_ies; /* captured ie's */ |
| 158 | /* tx seq per-tid */ | |
| 159 | ieee80211_seq ni_txseqs[IEEE80211_TID_SIZE]; | |
| 160 | /* rx seq previous per-tid*/ | |
| 161 | ieee80211_seq ni_rxseqs[IEEE80211_TID_SIZE]; | |
| 841ab66c SZ |
162 | uint32_t ni_rxfragstamp; /* time stamp of last rx frag */ |
| 163 | struct mbuf *ni_rxfrag[3]; /* rx frag reassembly */ | |
| 841ab66c | 164 | struct ieee80211_key ni_ucastkey; /* unicast key */ |
| f186073c JS |
165 | |
| 166 | /* hardware */ | |
| 32176cfd RP |
167 | uint32_t ni_avgrssi; /* recv ssi state */ |
| 168 | int8_t ni_noise; /* noise floor */ | |
| f186073c JS |
169 | |
| 170 | /* header */ | |
| 171 | uint8_t ni_macaddr[IEEE80211_ADDR_LEN]; | |
| 172 | uint8_t ni_bssid[IEEE80211_ADDR_LEN]; | |
| 173 | ||
| 174 | /* beacon, probe response */ | |
| 841ab66c SZ |
175 | union { |
| 176 | uint8_t data[8]; | |
| 32176cfd | 177 | u_int64_t tsf; |
| 841ab66c | 178 | } ni_tstamp; /* from last rcv'd beacon */ |
| f186073c JS |
179 | uint16_t ni_intval; /* beacon interval */ |
| 180 | uint16_t ni_capinfo; /* capabilities */ | |
| 181 | uint8_t ni_esslen; | |
| 182 | uint8_t ni_essid[IEEE80211_NWID_LEN]; | |
| 183 | struct ieee80211_rateset ni_rates; /* negotiated rate set */ | |
| 32176cfd | 184 | struct ieee80211_channel *ni_chan; |
| f186073c JS |
185 | uint16_t ni_fhdwell; /* FH only */ |
| 186 | uint8_t ni_fhindex; /* FH only */ | |
| 32176cfd | 187 | uint16_t ni_erp; /* ERP from beacon/probe resp */ |
| 841ab66c SZ |
188 | uint16_t ni_timoff; /* byte offset to TIM ie */ |
| 189 | uint8_t ni_dtim_period; /* DTIM period */ | |
| 190 | uint8_t ni_dtim_count; /* DTIM count for last bcn */ | |
| f186073c | 191 | |
| 32176cfd RP |
192 | /* 11s state */ |
| 193 | uint8_t ni_meshidlen; | |
| 194 | uint8_t ni_meshid[IEEE80211_MESHID_LEN]; | |
| 195 | enum ieee80211_mesh_mlstate ni_mlstate; /* peering management state */ | |
| 196 | uint16_t ni_mllid; /* link local ID */ | |
| 197 | uint16_t ni_mlpid; /* link peer ID */ | |
| 198 | struct callout ni_mltimer; /* link mesh timer */ | |
| 199 | uint8_t ni_mlrcnt; /* link mesh retry counter */ | |
| 200 | uint8_t ni_mltval; /* link mesh timer value */ | |
| 201 | ||
| 202 | /* 11n state */ | |
| 203 | uint16_t ni_htcap; /* HT capabilities */ | |
| 204 | uint8_t ni_htparam; /* HT params */ | |
| 205 | uint8_t ni_htctlchan; /* HT control channel */ | |
| 206 | uint8_t ni_ht2ndchan; /* HT 2nd channel */ | |
| 207 | uint8_t ni_htopmode; /* HT operating mode */ | |
| 208 | uint8_t ni_htstbc; /* HT */ | |
| 209 | uint8_t ni_chw; /* negotiated channel width */ | |
| 210 | struct ieee80211_htrateset ni_htrates; /* negotiated ht rate set */ | |
| 211 | struct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_AC]; | |
| 212 | struct ieee80211_rx_ampdu ni_rx_ampdu[WME_NUM_TID]; | |
| 213 | ||
| f186073c | 214 | /* others */ |
| 841ab66c SZ |
215 | short ni_inact; /* inactivity mark count */ |
| 216 | short ni_inact_reload;/* inactivity reload value */ | |
| 32176cfd RP |
217 | int ni_txrate; /* legacy rate/MCS */ |
| 218 | struct ieee80211_psq ni_psq; /* power save queue */ | |
| 841ab66c | 219 | struct ieee80211_nodestats ni_stats; /* per-node statistics */ |
| 32176cfd RP |
220 | |
| 221 | struct ieee80211vap *ni_wdsvap; /* associated WDS vap */ | |
| 4028af95 RP |
222 | void *ni_rctls; /* private ratectl state */ |
| 223 | uint64_t ni_spare[3]; | |
| f186073c | 224 | }; |
| 841ab66c | 225 | MALLOC_DECLARE(M_80211_NODE); |
| 32176cfd RP |
226 | MALLOC_DECLARE(M_80211_NODE_IE); |
| 227 | ||
| 228 | #define IEEE80211_NODE_ATH (IEEE80211_NODE_FF | IEEE80211_NODE_TURBOP) | |
| 229 | #define IEEE80211_NODE_AMPDU \ | |
| 230 | (IEEE80211_NODE_AMPDU_RX | IEEE80211_NODE_AMPDU_TX) | |
| 231 | #define IEEE80211_NODE_AMSDU \ | |
| 232 | (IEEE80211_NODE_AMSDU_RX | IEEE80211_NODE_AMSDU_TX) | |
| 233 | #define IEEE80211_NODE_HT_ALL \ | |
| 234 | (IEEE80211_NODE_HT | IEEE80211_NODE_HTCOMPAT | \ | |
| 235 | IEEE80211_NODE_AMPDU | IEEE80211_NODE_AMSDU | \ | |
| 236 | IEEE80211_NODE_MIMO_PS | IEEE80211_NODE_MIMO_RTS | \ | |
| 237 | IEEE80211_NODE_RIFS | IEEE80211_NODE_SGI20 | IEEE80211_NODE_SGI40) | |
| 238 | ||
| 239 | #define IEEE80211_NODE_BITS \ | |
| 240 | "\20\1AUTH\2QOS\3ERP\5PWR_MGT\6AREF\7HT\10HTCOMPAT\11WPS\12TSN" \ | |
| 241 | "\13AMPDU_RX\14AMPDU_TX\15MIMO_PS\16MIMO_RTS\17RIFS\20SGI20\21SGI40" \ | |
| 242 | "\22ASSOCID" | |
| 841ab66c SZ |
243 | |
| 244 | #define IEEE80211_NODE_AID(ni) IEEE80211_AID(ni->ni_associd) | |
| 245 | ||
| 246 | #define IEEE80211_NODE_STAT(ni,stat) (ni->ni_stats.ns_##stat++) | |
| 247 | #define IEEE80211_NODE_STAT_ADD(ni,stat,v) (ni->ni_stats.ns_##stat += v) | |
| 248 | #define IEEE80211_NODE_STAT_SET(ni,stat,v) (ni->ni_stats.ns_##stat = v) | |
| f186073c | 249 | |
| 32176cfd RP |
250 | /* |
| 251 | * Filtered rssi calculation support. The receive rssi is maintained | |
| 252 | * as an average over the last 10 frames received using a low pass filter | |
| 253 | * (all frames for now, possibly need to be more selective). Calculations | |
| 254 | * are designed such that a good compiler can optimize them. The avg | |
| 255 | * rssi state should be initialized to IEEE80211_RSSI_DUMMY_MARKER and | |
| 256 | * each sample incorporated with IEEE80211_RSSI_LPF. Use IEEE80211_RSSI_GET | |
| 257 | * to extract the current value. | |
| 258 | * | |
| 259 | * Note that we assume rssi data are in the range [-127..127] and we | |
| 260 | * discard values <-20. This is consistent with assumptions throughout | |
| 261 | * net80211 that signal strength data are in .5 dBm units relative to | |
| 262 | * the current noise floor (linear, not log). | |
| 263 | */ | |
| 264 | #define IEEE80211_RSSI_LPF_LEN 10 | |
| 265 | #define IEEE80211_RSSI_DUMMY_MARKER 127 | |
| 266 | /* NB: pow2 to optimize out * and / */ | |
| 267 | #define IEEE80211_RSSI_EP_MULTIPLIER (1<<7) | |
| 268 | #define IEEE80211_RSSI_IN(x) ((x) * IEEE80211_RSSI_EP_MULTIPLIER) | |
| 269 | #define _IEEE80211_RSSI_LPF(x, y, len) \ | |
| 270 | (((x) != IEEE80211_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y)) | |
| 271 | #define IEEE80211_RSSI_LPF(x, y) do { \ | |
| 272 | if ((y) >= -20) { \ | |
| 273 | x = _IEEE80211_RSSI_LPF((x), IEEE80211_RSSI_IN((y)), \ | |
| 274 | IEEE80211_RSSI_LPF_LEN); \ | |
| 275 | } \ | |
| 276 | } while (0) | |
| 277 | #define IEEE80211_RSSI_EP_RND(x, mul) \ | |
| 278 | ((((x) % (mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) | |
| 279 | #define IEEE80211_RSSI_GET(x) \ | |
| 280 | IEEE80211_RSSI_EP_RND(x, IEEE80211_RSSI_EP_MULTIPLIER) | |
| 281 | ||
| f186073c JS |
282 | static __inline struct ieee80211_node * |
| 283 | ieee80211_ref_node(struct ieee80211_node *ni) | |
| 284 | { | |
| 841ab66c | 285 | ieee80211_node_incref(ni); |
| f186073c JS |
286 | return ni; |
| 287 | } | |
| 288 | ||
| 289 | static __inline void | |
| 290 | ieee80211_unref_node(struct ieee80211_node **ni) | |
| 291 | { | |
| 841ab66c | 292 | ieee80211_node_decref(*ni); |
| f186073c JS |
293 | *ni = NULL; /* guard against use */ |
| 294 | } | |
| 295 | ||
| 296 | struct ieee80211com; | |
| 297 | ||
| 841ab66c SZ |
298 | void ieee80211_node_attach(struct ieee80211com *); |
| 299 | void ieee80211_node_lateattach(struct ieee80211com *); | |
| 300 | void ieee80211_node_detach(struct ieee80211com *); | |
| 32176cfd RP |
301 | void ieee80211_node_vattach(struct ieee80211vap *); |
| 302 | void ieee80211_node_latevattach(struct ieee80211vap *); | |
| 303 | void ieee80211_node_vdetach(struct ieee80211vap *); | |
| 841ab66c SZ |
304 | |
| 305 | static __inline int | |
| 306 | ieee80211_node_is_authorized(const struct ieee80211_node *ni) | |
| 307 | { | |
| 308 | return (ni->ni_flags & IEEE80211_NODE_AUTH); | |
| 309 | } | |
| 310 | ||
| 311 | void ieee80211_node_authorize(struct ieee80211_node *); | |
| 312 | void ieee80211_node_unauthorize(struct ieee80211_node *); | |
| 313 | ||
| 32176cfd RP |
314 | void ieee80211_node_setuptxparms(struct ieee80211_node *); |
| 315 | void ieee80211_node_set_chan(struct ieee80211_node *, | |
| f39a365a | 316 | struct ieee80211_channel *); |
| 32176cfd RP |
317 | void ieee80211_create_ibss(struct ieee80211vap*, struct ieee80211_channel *); |
| 318 | void ieee80211_reset_bss(struct ieee80211vap *); | |
| 319 | void ieee80211_sync_curchan(struct ieee80211com *); | |
| 320 | void ieee80211_setupcurchan(struct ieee80211com *, | |
| 321 | struct ieee80211_channel *); | |
| 322 | void ieee80211_setcurchan(struct ieee80211com *, struct ieee80211_channel *); | |
| 841ab66c | 323 | int ieee80211_ibss_merge(struct ieee80211_node *); |
| 32176cfd RP |
324 | struct ieee80211_scan_entry; |
| 325 | int ieee80211_sta_join(struct ieee80211vap *, struct ieee80211_channel *, | |
| 326 | const struct ieee80211_scan_entry *); | |
| 327 | void ieee80211_sta_leave(struct ieee80211_node *); | |
| 328 | void ieee80211_node_deauth(struct ieee80211_node *, int); | |
| 329 | ||
| 330 | int ieee80211_ies_init(struct ieee80211_ies *, const uint8_t *, int); | |
| 331 | void ieee80211_ies_cleanup(struct ieee80211_ies *); | |
| 332 | void ieee80211_ies_expand(struct ieee80211_ies *); | |
| 333 | #define ieee80211_ies_setie(_ies, _ie, _off) do { \ | |
| 334 | (_ies)._ie = (_ies).data + (_off); \ | |
| 335 | } while (0) | |
| 841ab66c SZ |
336 | |
| 337 | /* | |
| 338 | * Table of ieee80211_node instances. Each ieee80211com | |
| 32176cfd RP |
339 | * has one that holds association stations (when operating |
| 340 | * as an ap) or neighbors (in ibss mode). | |
| 341 | * | |
| 342 | * XXX embed this in ieee80211com instead of indirect? | |
| 841ab66c SZ |
343 | */ |
| 344 | struct ieee80211_node_table { | |
| 345 | struct ieee80211com *nt_ic; /* back reference */ | |
| 346 | TAILQ_HEAD(, ieee80211_node) nt_node; /* information of all nodes */ | |
| 347 | LIST_HEAD(, ieee80211_node) nt_hash[IEEE80211_NODE_HASHSIZE]; | |
| 841ab66c SZ |
348 | struct ieee80211_node **nt_keyixmap; /* key ix -> node map */ |
| 349 | int nt_keyixmax; /* keyixmap size */ | |
| 32176cfd | 350 | const char *nt_name; /* table name for debug msgs */ |
| 32176cfd RP |
351 | u_int nt_scangen; /* gen# for iterators */ |
| 352 | int nt_inact_init; /* initial node inact setting */ | |
| 841ab66c | 353 | }; |
| 32176cfd RP |
354 | |
| 355 | struct ieee80211_node *ieee80211_alloc_node(struct ieee80211_node_table *, | |
| 356 | struct ieee80211vap *, | |
| 357 | const uint8_t macaddr[IEEE80211_ADDR_LEN]); | |
| 358 | struct ieee80211_node *ieee80211_tmp_node(struct ieee80211vap *, | |
| 359 | const uint8_t macaddr[IEEE80211_ADDR_LEN]); | |
| 360 | struct ieee80211_node *ieee80211_dup_bss(struct ieee80211vap *, | |
| 361 | const uint8_t macaddr[IEEE80211_ADDR_LEN]); | |
| 362 | struct ieee80211_node *ieee80211_node_create_wds(struct ieee80211vap *, | |
| 363 | const uint8_t bssid[IEEE80211_ADDR_LEN], | |
| 364 | struct ieee80211_channel *); | |
| 841ab66c SZ |
365 | #ifdef IEEE80211_DEBUG_REFCNT |
| 366 | void ieee80211_free_node_debug(struct ieee80211_node *, | |
| 367 | const char *func, int line); | |
| 32176cfd RP |
368 | struct ieee80211_node *ieee80211_find_node_locked_debug( |
| 369 | struct ieee80211_node_table *, | |
| 370 | const uint8_t macaddr[IEEE80211_ADDR_LEN], | |
| 841ab66c | 371 | const char *func, int line); |
| 32176cfd RP |
372 | struct ieee80211_node *ieee80211_find_node_debug(struct ieee80211_node_table *, |
| 373 | const uint8_t macaddr[IEEE80211_ADDR_LEN], | |
| 374 | const char *func, int line); | |
| 375 | struct ieee80211_node *ieee80211_find_vap_node_locked_debug( | |
| 376 | struct ieee80211_node_table *, | |
| 377 | const struct ieee80211vap *vap, | |
| 378 | const uint8_t macaddr[IEEE80211_ADDR_LEN], | |
| 379 | const char *func, int line); | |
| 380 | struct ieee80211_node *ieee80211_find_vap_node_debug( | |
| 381 | struct ieee80211_node_table *, | |
| 382 | const struct ieee80211vap *vap, | |
| 383 | const uint8_t macaddr[IEEE80211_ADDR_LEN], | |
| 384 | const char *func, int line); | |
| 385 | struct ieee80211_node * ieee80211_find_rxnode_debug(struct ieee80211com *, | |
| 386 | const struct ieee80211_frame_min *, | |
| 841ab66c SZ |
387 | const char *func, int line); |
| 388 | struct ieee80211_node * ieee80211_find_rxnode_withkey_debug( | |
| 389 | struct ieee80211com *, | |
| 390 | const struct ieee80211_frame_min *, uint16_t keyix, | |
| 391 | const char *func, int line); | |
| 32176cfd RP |
392 | struct ieee80211_node *ieee80211_find_txnode_debug(struct ieee80211vap *, |
| 393 | const uint8_t *, | |
| 841ab66c SZ |
394 | const char *func, int line); |
| 395 | #define ieee80211_free_node(ni) \ | |
| 396 | ieee80211_free_node_debug(ni, __func__, __LINE__) | |
| 32176cfd RP |
397 | #define ieee80211_find_node_locked(nt, mac) \ |
| 398 | ieee80211_find_node_locked_debug(nt, mac, __func__, __LINE__) | |
| 841ab66c SZ |
399 | #define ieee80211_find_node(nt, mac) \ |
| 400 | ieee80211_find_node_debug(nt, mac, __func__, __LINE__) | |
| 32176cfd RP |
401 | #define ieee80211_find_vap_node_locked(nt, vap, mac) \ |
| 402 | ieee80211_find_vap_node_locked_debug(nt, vap, mac, __func__, __LINE__) | |
| 403 | #define ieee80211_find_vap_node(nt, vap, mac) \ | |
| 404 | ieee80211_find_vap_node_debug(nt, vap, mac, __func__, __LINE__) | |
| 405 | #define ieee80211_find_rxnode(ic, wh) \ | |
| 406 | ieee80211_find_rxnode_debug(ic, wh, __func__, __LINE__) | |
| 407 | #define ieee80211_find_rxnode_withkey(ic, wh, keyix) \ | |
| 408 | ieee80211_find_rxnode_withkey_debug(ic, wh, keyix, __func__, __LINE__) | |
| 409 | #define ieee80211_find_txnode(vap, mac) \ | |
| 410 | ieee80211_find_txnode_debug(vap, mac, __func__, __LINE__) | |
| 841ab66c SZ |
411 | #else |
| 412 | void ieee80211_free_node(struct ieee80211_node *); | |
| 32176cfd RP |
413 | struct ieee80211_node *ieee80211_find_node_locked(struct ieee80211_node_table *, |
| 414 | const uint8_t macaddr[IEEE80211_ADDR_LEN]); | |
| 415 | struct ieee80211_node *ieee80211_find_node(struct ieee80211_node_table *, | |
| 416 | const uint8_t macaddr[IEEE80211_ADDR_LEN]); | |
| 417 | struct ieee80211_node *ieee80211_find_vap_node_locked( | |
| 418 | struct ieee80211_node_table *, const struct ieee80211vap *, | |
| 419 | const uint8_t macaddr[IEEE80211_ADDR_LEN]); | |
| 420 | struct ieee80211_node *ieee80211_find_vap_node( | |
| 421 | struct ieee80211_node_table *, const struct ieee80211vap *, | |
| 422 | const uint8_t macaddr[IEEE80211_ADDR_LEN]); | |
| 423 | struct ieee80211_node * ieee80211_find_rxnode(struct ieee80211com *, | |
| 424 | const struct ieee80211_frame_min *); | |
| 841ab66c SZ |
425 | struct ieee80211_node * ieee80211_find_rxnode_withkey(struct ieee80211com *, |
| 426 | const struct ieee80211_frame_min *, uint16_t keyix); | |
| 32176cfd RP |
427 | struct ieee80211_node *ieee80211_find_txnode(struct ieee80211vap *, |
| 428 | const uint8_t macaddr[IEEE80211_ADDR_LEN]); | |
| f186073c | 429 | #endif |
| 841ab66c | 430 | int ieee80211_node_delucastkey(struct ieee80211_node *); |
| 32176cfd | 431 | void ieee80211_node_timeout(void *arg); |
| f186073c | 432 | |
| f186073c | 433 | typedef void ieee80211_iter_func(void *, struct ieee80211_node *); |
| 841ab66c | 434 | void ieee80211_iterate_nodes(struct ieee80211_node_table *, |
| f186073c | 435 | ieee80211_iter_func *, void *); |
| f186073c | 436 | |
| 32176cfd | 437 | void ieee80211_notify_erp(struct ieee80211com *); |
| 841ab66c SZ |
438 | void ieee80211_dump_node(struct ieee80211_node_table *, |
| 439 | struct ieee80211_node *); | |
| 440 | void ieee80211_dump_nodes(struct ieee80211_node_table *); | |
| 441 | ||
| 32176cfd RP |
442 | struct ieee80211_node *ieee80211_fakeup_adhoc_node(struct ieee80211vap *, |
| 443 | const uint8_t macaddr[IEEE80211_ADDR_LEN]); | |
| 444 | struct ieee80211_scanparams; | |
| 841ab66c SZ |
445 | void ieee80211_init_neighbor(struct ieee80211_node *, |
| 446 | const struct ieee80211_frame *, | |
| 447 | const struct ieee80211_scanparams *); | |
| 32176cfd | 448 | struct ieee80211_node *ieee80211_add_neighbor(struct ieee80211vap *, |
| 841ab66c SZ |
449 | const struct ieee80211_frame *, |
| 450 | const struct ieee80211_scanparams *); | |
| 32176cfd RP |
451 | void ieee80211_node_join(struct ieee80211_node *,int); |
| 452 | void ieee80211_node_leave(struct ieee80211_node *); | |
| 453 | int8_t ieee80211_getrssi(struct ieee80211vap *); | |
| 454 | void ieee80211_getsignal(struct ieee80211vap *, int8_t *, int8_t *); | |
| 841ab66c | 455 | #endif /* _NET80211_IEEE80211_NODE_H_ */ |