xref: /freebsd/sys/net80211/ieee80211_node.h (revision cc349066556bcdeed0d6cc72aad340d0f383e35c)
1 /*-
2  * Copyright (c) 2001 Atsushi Onoe
3  * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
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.
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  *
26  * $FreeBSD$
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 ``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  * Node specific information.  Note that drivers are expected
113  * to derive from this structure to add device-specific per-node
114  * state.  This is done by overriding the ic_node_* methods in
115  * the ieee80211com structure.
116  */
117 struct ieee80211_node {
118 	struct ieee80211vap	*ni_vap;	/* associated vap */
119 	struct ieee80211com	*ni_ic;		/* copy from vap to save deref*/
120 	struct ieee80211_node_table *ni_table;	/* NB: may be NULL */
121 	TAILQ_ENTRY(ieee80211_node) ni_list;	/* list of all nodes */
122 	LIST_ENTRY(ieee80211_node) ni_hash;	/* hash collision list */
123 	u_int			ni_refcnt;	/* count of held references */
124 	u_int			ni_flags;
125 #define	IEEE80211_NODE_AUTH	0x000001	/* authorized for data */
126 #define	IEEE80211_NODE_QOS	0x000002	/* QoS enabled */
127 #define	IEEE80211_NODE_ERP	0x000004	/* ERP enabled */
128 /* NB: this must have the same value as IEEE80211_FC1_PWR_MGT */
129 #define	IEEE80211_NODE_PWR_MGT	0x000010	/* power save mode enabled */
130 #define	IEEE80211_NODE_AREF	0x000020	/* authentication ref held */
131 #define	IEEE80211_NODE_HT	0x000040	/* HT enabled */
132 #define	IEEE80211_NODE_HTCOMPAT	0x000080	/* HT setup w/ vendor OUI's */
133 #define	IEEE80211_NODE_WPS	0x000100	/* WPS association */
134 #define	IEEE80211_NODE_TSN	0x000200	/* TSN association */
135 #define	IEEE80211_NODE_AMPDU_RX	0x000400	/* AMPDU rx enabled */
136 #define	IEEE80211_NODE_AMPDU_TX	0x000800	/* AMPDU tx enabled */
137 #define	IEEE80211_NODE_MIMO_PS	0x001000	/* MIMO power save enabled */
138 #define	IEEE80211_NODE_MIMO_RTS	0x002000	/* send RTS in MIMO PS */
139 #define	IEEE80211_NODE_RIFS	0x004000	/* RIFS enabled */
140 #define	IEEE80211_NODE_SGI20	0x008000	/* Short GI in HT20 enabled */
141 #define	IEEE80211_NODE_SGI40	0x010000	/* Short GI in HT40 enabled */
142 #define	IEEE80211_NODE_ASSOCID	0x020000	/* xmit requires associd */
143 #define	IEEE80211_NODE_AMSDU_RX	0x040000	/* AMSDU rx enabled */
144 #define	IEEE80211_NODE_AMSDU_TX	0x080000	/* AMSDU tx enabled */
145 	uint16_t		ni_associd;	/* association ID */
146 	uint16_t		ni_vlan;	/* vlan tag */
147 	uint16_t		ni_txpower;	/* current transmit power */
148 	uint8_t			ni_authmode;	/* authentication algorithm */
149 	uint8_t			ni_ath_flags;	/* Atheros feature flags */
150 	/* NB: These must have the same values as IEEE80211_ATHC_* */
151 #define IEEE80211_NODE_TURBOP	0x0001		/* Turbo prime enable */
152 #define IEEE80211_NODE_COMP	0x0002		/* Compresssion enable */
153 #define IEEE80211_NODE_FF	0x0004          /* Fast Frame capable */
154 #define IEEE80211_NODE_XR	0x0008		/* Atheros WME enable */
155 #define IEEE80211_NODE_AR	0x0010		/* AR capable */
156 #define IEEE80211_NODE_BOOST	0x0080		/* Dynamic Turbo boosted */
157 	uint16_t		ni_ath_defkeyix;/* Atheros def key index */
158 	const struct ieee80211_txparam *ni_txparms;
159 	uint32_t		ni_jointime;	/* time of join (secs) */
160 	uint32_t		*ni_challenge;	/* shared-key challenge */
161 	struct ieee80211_ies	ni_ies;		/* captured ie's */
162 						/* tx seq per-tid */
163 	ieee80211_seq		ni_txseqs[IEEE80211_TID_SIZE];
164 						/* rx seq previous per-tid*/
165 	ieee80211_seq		ni_rxseqs[IEEE80211_TID_SIZE];
166 	uint32_t		ni_rxfragstamp;	/* time stamp of last rx frag */
167 	struct mbuf		*ni_rxfrag[3];	/* rx frag reassembly */
168 	struct ieee80211_key	ni_ucastkey;	/* unicast key */
169 
170 	/* hardware */
171 	uint32_t		ni_avgrssi;	/* recv ssi state */
172 	int8_t			ni_noise;	/* noise floor */
173 
174 	/* mimo statistics */
175 	uint32_t		ni_mimo_rssi_ctl[IEEE80211_MAX_CHAINS];
176 	uint32_t		ni_mimo_rssi_ext[IEEE80211_MAX_CHAINS];
177 	uint8_t			ni_mimo_noise_ctl[IEEE80211_MAX_CHAINS];
178 	uint8_t			ni_mimo_noise_ext[IEEE80211_MAX_CHAINS];
179 	uint8_t			ni_mimo_chains;
180 
181 	/* header */
182 	uint8_t			ni_macaddr[IEEE80211_ADDR_LEN];
183 	uint8_t			ni_bssid[IEEE80211_ADDR_LEN];
184 
185 	/* beacon, probe response */
186 	union {
187 		uint8_t		data[8];
188 		u_int64_t	tsf;
189 	} ni_tstamp;				/* from last rcv'd beacon */
190 	uint16_t		ni_intval;	/* beacon interval */
191 	uint16_t		ni_capinfo;	/* capabilities */
192 	uint8_t			ni_esslen;
193 	uint8_t			ni_essid[IEEE80211_NWID_LEN];
194 	struct ieee80211_rateset ni_rates;	/* negotiated rate set */
195 	struct ieee80211_channel *ni_chan;
196 	uint16_t		ni_fhdwell;	/* FH only */
197 	uint8_t			ni_fhindex;	/* FH only */
198 	uint16_t		ni_erp;		/* ERP from beacon/probe resp */
199 	uint16_t		ni_timoff;	/* byte offset to TIM ie */
200 	uint8_t			ni_dtim_period;	/* DTIM period */
201 	uint8_t			ni_dtim_count;	/* DTIM count for last bcn */
202 
203 	/* 11s state */
204 	uint8_t			ni_meshidlen;
205 	uint8_t			ni_meshid[IEEE80211_MESHID_LEN];
206 	enum ieee80211_mesh_mlstate ni_mlstate;	/* peering management state */
207 	uint16_t		ni_mllid;	/* link local ID */
208 	uint16_t		ni_mlpid;	/* link peer ID */
209 	struct callout		ni_mltimer;	/* link mesh timer */
210 	uint8_t			ni_mlrcnt;	/* link mesh retry counter */
211 	uint8_t			ni_mltval;	/* link mesh timer value */
212 	struct callout		ni_mlhtimer;	/* link mesh backoff timer */
213 	uint8_t			ni_mlhcnt;	/* link mesh holding counter */
214 
215 	/* 11n state */
216 	uint16_t		ni_htcap;	/* HT capabilities */
217 	uint8_t			ni_htparam;	/* HT params */
218 	uint8_t			ni_htctlchan;	/* HT control channel */
219 	uint8_t			ni_ht2ndchan;	/* HT 2nd channel */
220 	uint8_t			ni_htopmode;	/* HT operating mode */
221 	uint8_t			ni_htstbc;	/* HT */
222 	uint8_t			ni_chw;		/* negotiated channel width */
223 	struct ieee80211_htrateset ni_htrates;	/* negotiated ht rate set */
224 	struct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_TID];
225 	struct ieee80211_rx_ampdu ni_rx_ampdu[WME_NUM_TID];
226 
227 	/* VHT state */
228 	uint32_t		ni_vhtcap;
229 	uint32_t		ni_vhtinfo;
230 	struct ieee80211_vht_mcs_info	ni_vht_mcsinfo;
231 	uint8_t			ni_vht_chan1;	/* 20/40/80/160 - VHT chan1 */
232 	uint8_t			ni_vht_chan2;	/* 80+80 - VHT chan2 */
233 	uint16_t		ni_vht_pad1;
234 	uint32_t		ni_vht_spare[8];
235 
236 	/* fast-frames state */
237 	struct mbuf *		ni_tx_superg[WME_NUM_TID];
238 
239 	/* others */
240 	short			ni_inact;	/* inactivity mark count */
241 	short			ni_inact_reload;/* inactivity reload value */
242 	int			ni_txrate;	/* legacy rate/MCS */
243 	struct ieee80211_psq	ni_psq;		/* power save queue */
244 	struct ieee80211_nodestats ni_stats;	/* per-node statistics */
245 
246 	struct ieee80211vap	*ni_wdsvap;	/* associated WDS vap */
247 	void			*ni_rctls;	/* private ratectl state */
248 	uint64_t		ni_spare[3];
249 };
250 MALLOC_DECLARE(M_80211_NODE);
251 MALLOC_DECLARE(M_80211_NODE_IE);
252 
253 #define	IEEE80211_NODE_ATH	(IEEE80211_NODE_FF | IEEE80211_NODE_TURBOP)
254 #define	IEEE80211_NODE_AMPDU \
255 	(IEEE80211_NODE_AMPDU_RX | IEEE80211_NODE_AMPDU_TX)
256 #define	IEEE80211_NODE_AMSDU \
257 	(IEEE80211_NODE_AMSDU_RX | IEEE80211_NODE_AMSDU_TX)
258 #define	IEEE80211_NODE_HT_ALL \
259 	(IEEE80211_NODE_HT | IEEE80211_NODE_HTCOMPAT | \
260 	 IEEE80211_NODE_AMPDU | IEEE80211_NODE_AMSDU | \
261 	 IEEE80211_NODE_MIMO_PS | IEEE80211_NODE_MIMO_RTS | \
262 	 IEEE80211_NODE_RIFS | IEEE80211_NODE_SGI20 | IEEE80211_NODE_SGI40)
263 
264 #define	IEEE80211_NODE_BITS \
265 	"\20\1AUTH\2QOS\3ERP\5PWR_MGT\6AREF\7HT\10HTCOMPAT\11WPS\12TSN" \
266 	"\13AMPDU_RX\14AMPDU_TX\15MIMO_PS\16MIMO_RTS\17RIFS\20SGI20\21SGI40" \
267 	"\22ASSOCID"
268 
269 #define	IEEE80211_NODE_AID(ni)	IEEE80211_AID(ni->ni_associd)
270 
271 #define	IEEE80211_NODE_STAT(ni,stat)	(ni->ni_stats.ns_##stat++)
272 #define	IEEE80211_NODE_STAT_ADD(ni,stat,v)	(ni->ni_stats.ns_##stat += v)
273 #define	IEEE80211_NODE_STAT_SET(ni,stat,v)	(ni->ni_stats.ns_##stat = v)
274 
275 /*
276  * Filtered rssi calculation support.  The receive rssi is maintained
277  * as an average over the last 10 frames received using a low pass filter
278  * (all frames for now, possibly need to be more selective).  Calculations
279  * are designed such that a good compiler can optimize them.  The avg
280  * rssi state should be initialized to IEEE80211_RSSI_DUMMY_MARKER and
281  * each sample incorporated with IEEE80211_RSSI_LPF.  Use IEEE80211_RSSI_GET
282  * to extract the current value.
283  *
284  * Note that we assume rssi data are in the range [-127..127] and we
285  * discard values <-20.  This is consistent with assumptions throughout
286  * net80211 that signal strength data are in .5 dBm units relative to
287  * the current noise floor (linear, not log).
288  */
289 #define IEEE80211_RSSI_LPF_LEN		10
290 #define	IEEE80211_RSSI_DUMMY_MARKER	127
291 /* NB: pow2 to optimize out * and / */
292 #define	IEEE80211_RSSI_EP_MULTIPLIER	(1<<7)
293 #define IEEE80211_RSSI_IN(x)		((x) * IEEE80211_RSSI_EP_MULTIPLIER)
294 #define _IEEE80211_RSSI_LPF(x, y, len) \
295     (((x) != IEEE80211_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y))
296 #define IEEE80211_RSSI_LPF(x, y) do {					\
297     if ((y) >= -20) {							\
298     	x = _IEEE80211_RSSI_LPF((x), IEEE80211_RSSI_IN((y)), 		\
299 		IEEE80211_RSSI_LPF_LEN);				\
300     }									\
301 } while (0)
302 #define	IEEE80211_RSSI_EP_RND(x, mul) \
303 	((((x) % (mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
304 #define	IEEE80211_RSSI_GET(x) \
305 	IEEE80211_RSSI_EP_RND(x, IEEE80211_RSSI_EP_MULTIPLIER)
306 
307 static __inline struct ieee80211_node *
308 ieee80211_ref_node(struct ieee80211_node *ni)
309 {
310 	ieee80211_node_incref(ni);
311 	return ni;
312 }
313 
314 static __inline void
315 ieee80211_unref_node(struct ieee80211_node **ni)
316 {
317 	ieee80211_node_decref(*ni);
318 	*ni = NULL;			/* guard against use */
319 }
320 
321 void	ieee80211_node_attach(struct ieee80211com *);
322 void	ieee80211_node_lateattach(struct ieee80211com *);
323 void	ieee80211_node_detach(struct ieee80211com *);
324 void	ieee80211_node_vattach(struct ieee80211vap *);
325 void	ieee80211_node_latevattach(struct ieee80211vap *);
326 void	ieee80211_node_vdetach(struct ieee80211vap *);
327 
328 static __inline int
329 ieee80211_node_is_authorized(const struct ieee80211_node *ni)
330 {
331 	return (ni->ni_flags & IEEE80211_NODE_AUTH);
332 }
333 
334 void	ieee80211_node_authorize(struct ieee80211_node *);
335 void	ieee80211_node_unauthorize(struct ieee80211_node *);
336 
337 void	ieee80211_node_setuptxparms(struct ieee80211_node *);
338 void	ieee80211_node_set_chan(struct ieee80211_node *,
339 		struct ieee80211_channel *);
340 void	ieee80211_create_ibss(struct ieee80211vap*, struct ieee80211_channel *);
341 void	ieee80211_reset_bss(struct ieee80211vap *);
342 void	ieee80211_sync_curchan(struct ieee80211com *);
343 void	ieee80211_setupcurchan(struct ieee80211com *,
344 	    struct ieee80211_channel *);
345 void	ieee80211_setcurchan(struct ieee80211com *, struct ieee80211_channel *);
346 void	ieee80211_update_chw(struct ieee80211com *);
347 int	ieee80211_ibss_merge_check(struct ieee80211_node *);
348 int	ieee80211_ibss_node_check_new(struct ieee80211_node *ni,
349 	    const struct ieee80211_scanparams *);
350 int	ieee80211_ibss_merge(struct ieee80211_node *);
351 struct ieee80211_scan_entry;
352 int	ieee80211_sta_join(struct ieee80211vap *, struct ieee80211_channel *,
353 		const struct ieee80211_scan_entry *);
354 void	ieee80211_sta_leave(struct ieee80211_node *);
355 void	ieee80211_node_deauth(struct ieee80211_node *, int);
356 
357 int	ieee80211_ies_init(struct ieee80211_ies *, const uint8_t *, int);
358 void	ieee80211_ies_cleanup(struct ieee80211_ies *);
359 void	ieee80211_ies_expand(struct ieee80211_ies *);
360 #define	ieee80211_ies_setie(_ies, _ie, _off) do {		\
361 	(_ies)._ie = (_ies).data + (_off);			\
362 } while (0)
363 
364 /*
365  * Table of ieee80211_node instances.  Each ieee80211com
366  * has one that holds association stations (when operating
367  * as an ap) or neighbors (in ibss mode).
368  *
369  * XXX embed this in ieee80211com instead of indirect?
370  */
371 struct ieee80211_node_table {
372 	struct ieee80211com	*nt_ic;		/* back reference */
373 	ieee80211_node_lock_t	nt_nodelock;	/* on node table */
374 	TAILQ_HEAD(, ieee80211_node) nt_node;	/* information of all nodes */
375 	LIST_HEAD(, ieee80211_node) nt_hash[IEEE80211_NODE_HASHSIZE];
376 	int			nt_count;	/* number of nodes */
377 	struct ieee80211_node	**nt_keyixmap;	/* key ix -> node map */
378 	int			nt_keyixmax;	/* keyixmap size */
379 	const char		*nt_name;	/* table name for debug msgs */
380 	int			nt_inact_init;	/* initial node inact setting */
381 };
382 
383 struct ieee80211_node *ieee80211_alloc_node(struct ieee80211_node_table *,
384 		struct ieee80211vap *,
385 		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
386 struct ieee80211_node *ieee80211_tmp_node(struct ieee80211vap *,
387 		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
388 struct ieee80211_node *ieee80211_dup_bss(struct ieee80211vap *,
389 		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
390 struct ieee80211_node *ieee80211_node_create_wds(struct ieee80211vap *,
391 		const uint8_t bssid[IEEE80211_ADDR_LEN],
392 		struct ieee80211_channel *);
393 #ifdef IEEE80211_DEBUG_REFCNT
394 void	ieee80211_free_node_debug(struct ieee80211_node *,
395 		const char *func, int line);
396 struct ieee80211_node *ieee80211_find_node_locked_debug(
397 		struct ieee80211_node_table *,
398 		const uint8_t macaddr[IEEE80211_ADDR_LEN],
399 		const char *func, int line);
400 struct ieee80211_node *ieee80211_find_node_debug(struct ieee80211_node_table *,
401 		const uint8_t macaddr[IEEE80211_ADDR_LEN],
402 		const char *func, int line);
403 struct ieee80211_node *ieee80211_find_vap_node_locked_debug(
404 		struct ieee80211_node_table *,
405 		const struct ieee80211vap *vap,
406 		const uint8_t macaddr[IEEE80211_ADDR_LEN],
407 		const char *func, int line);
408 struct ieee80211_node *ieee80211_find_vap_node_debug(
409 		struct ieee80211_node_table *,
410 		const struct ieee80211vap *vap,
411 		const uint8_t macaddr[IEEE80211_ADDR_LEN],
412 		const char *func, int line);
413 struct ieee80211_node * ieee80211_find_rxnode_debug(struct ieee80211com *,
414 		const struct ieee80211_frame_min *,
415 		const char *func, int line);
416 struct ieee80211_node * ieee80211_find_rxnode_withkey_debug(
417 		struct ieee80211com *,
418 		const struct ieee80211_frame_min *, uint16_t keyix,
419 		const char *func, int line);
420 struct ieee80211_node *ieee80211_find_txnode_debug(struct ieee80211vap *,
421 		const uint8_t *,
422 		const char *func, int line);
423 #define	ieee80211_free_node(ni) \
424 	ieee80211_free_node_debug(ni, __func__, __LINE__)
425 #define	ieee80211_find_node_locked(nt, mac) \
426 	ieee80211_find_node_locked_debug(nt, mac, __func__, __LINE__)
427 #define	ieee80211_find_node(nt, mac) \
428 	ieee80211_find_node_debug(nt, mac, __func__, __LINE__)
429 #define	ieee80211_find_vap_node_locked(nt, vap, mac) \
430 	ieee80211_find_vap_node_locked_debug(nt, vap, mac, __func__, __LINE__)
431 #define	ieee80211_find_vap_node(nt, vap, mac) \
432 	ieee80211_find_vap_node_debug(nt, vap, mac, __func__, __LINE__)
433 #define	ieee80211_find_rxnode(ic, wh) \
434 	ieee80211_find_rxnode_debug(ic, wh, __func__, __LINE__)
435 #define	ieee80211_find_rxnode_withkey(ic, wh, keyix) \
436 	ieee80211_find_rxnode_withkey_debug(ic, wh, keyix, __func__, __LINE__)
437 #define	ieee80211_find_txnode(vap, mac) \
438 	ieee80211_find_txnode_debug(vap, mac, __func__, __LINE__)
439 #else
440 void	ieee80211_free_node(struct ieee80211_node *);
441 struct ieee80211_node *ieee80211_find_node_locked(struct ieee80211_node_table *,
442 		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
443 struct ieee80211_node *ieee80211_find_node(struct ieee80211_node_table *,
444 		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
445 struct ieee80211_node *ieee80211_find_vap_node_locked(
446 		struct ieee80211_node_table *, const struct ieee80211vap *,
447 		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
448 struct ieee80211_node *ieee80211_find_vap_node(
449 		struct ieee80211_node_table *, const struct ieee80211vap *,
450 		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
451 struct ieee80211_node * ieee80211_find_rxnode(struct ieee80211com *,
452 		const struct ieee80211_frame_min *);
453 struct ieee80211_node * ieee80211_find_rxnode_withkey(struct ieee80211com *,
454 		const struct ieee80211_frame_min *, uint16_t keyix);
455 struct ieee80211_node *ieee80211_find_txnode(struct ieee80211vap *,
456 		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
457 #endif
458 int	ieee80211_node_delucastkey(struct ieee80211_node *);
459 void	ieee80211_node_timeout(void *arg);
460 
461 typedef void ieee80211_iter_func(void *, struct ieee80211_node *);
462 int	ieee80211_iterate_nodes_vap(struct ieee80211_node_table *,
463 		struct ieee80211vap *, ieee80211_iter_func *, void *);
464 void	ieee80211_iterate_nodes(struct ieee80211_node_table *,
465 		ieee80211_iter_func *, void *);
466 
467 void	ieee80211_notify_erp(struct ieee80211com *);
468 void	ieee80211_dump_node(struct ieee80211_node_table *,
469 		struct ieee80211_node *);
470 void	ieee80211_dump_nodes(struct ieee80211_node_table *);
471 
472 struct ieee80211_node *ieee80211_fakeup_adhoc_node(struct ieee80211vap *,
473 		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
474 struct ieee80211_scanparams;
475 void	ieee80211_init_neighbor(struct ieee80211_node *,
476 		const struct ieee80211_frame *,
477 		const struct ieee80211_scanparams *);
478 struct ieee80211_node *ieee80211_add_neighbor(struct ieee80211vap *,
479 		const struct ieee80211_frame *,
480 		const struct ieee80211_scanparams *);
481 void	ieee80211_node_join(struct ieee80211_node *,int);
482 void	ieee80211_node_leave(struct ieee80211_node *);
483 int8_t	ieee80211_getrssi(struct ieee80211vap *);
484 void	ieee80211_getsignal(struct ieee80211vap *, int8_t *, int8_t *);
485 #endif /* _NET80211_IEEE80211_NODE_H_ */
486