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