ieee80211_node.h revision 178354
1116742Ssam/*-
2116904Ssam * Copyright (c) 2001 Atsushi Onoe
3178354Ssam * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
4116742Ssam * All rights reserved.
5116742Ssam *
6116742Ssam * Redistribution and use in source and binary forms, with or without
7116742Ssam * modification, are permitted provided that the following conditions
8116742Ssam * are met:
9116742Ssam * 1. Redistributions of source code must retain the above copyright
10116742Ssam *    notice, this list of conditions and the following disclaimer.
11116742Ssam * 2. Redistributions in binary form must reproduce the above copyright
12116742Ssam *    notice, this list of conditions and the following disclaimer in the
13116742Ssam *    documentation and/or other materials provided with the distribution.
14116742Ssam *
15116904Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16116904Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17116904Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18116904Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19116904Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20116904Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21116904Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22116904Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23116904Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24116904Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25116904Ssam *
26116742Ssam * $FreeBSD: head/sys/net80211/ieee80211_node.h 178354 2008-04-20 20:35:46Z sam $
27116742Ssam */
28116742Ssam#ifndef _NET80211_IEEE80211_NODE_H_
29116742Ssam#define _NET80211_IEEE80211_NODE_H_
30116742Ssam
31138568Ssam#include <net80211/ieee80211_ioctl.h>		/* for ieee80211_nodestats */
32170530Ssam#include <net80211/ieee80211_ht.h>		/* for aggregation state */
33116742Ssam
34138568Ssam/*
35178354Ssam * Each ieee80211com instance has a single timer that fires every
36178354Ssam * IEEE80211_INACT_WAIT seconds to handle "inactivity processing".
37178354Ssam * This is used to do node inactivity processing when operating
38178354Ssam * as an AP or in adhoc mode.  For inactivity processing each node
39178354Ssam * has a timeout set in it's ni_inact field that is decremented
40178354Ssam * on each timeout and the node is reclaimed when the counter goes
41178354Ssam * to zero.  We use different inactivity timeout values depending
42178354Ssam * on whether the node is associated and authorized (either by
43178354Ssam * 802.1x or open/shared key authentication) or associated but yet
44178354Ssam * to be authorized.  The latter timeout is shorter to more aggressively
45138568Ssam * reclaim nodes that leave part way through the 802.1x exchange.
46138568Ssam */
47138568Ssam#define	IEEE80211_INACT_WAIT	15		/* inactivity interval (secs) */
48138568Ssam#define	IEEE80211_INACT_INIT	(30/IEEE80211_INACT_WAIT)	/* initial */
49138568Ssam#define	IEEE80211_INACT_AUTH	(180/IEEE80211_INACT_WAIT)	/* associated but not authorized */
50138568Ssam#define	IEEE80211_INACT_RUN	(300/IEEE80211_INACT_WAIT)	/* authorized */
51138568Ssam#define	IEEE80211_INACT_PROBE	(30/IEEE80211_INACT_WAIT)	/* probe */
52138568Ssam#define	IEEE80211_INACT_SCAN	(300/IEEE80211_INACT_WAIT)	/* scanned */
53138568Ssam
54170530Ssam#define	IEEE80211_TRANS_WAIT 	2		/* mgt frame tx timer (secs) */
55138568Ssam
56172211Ssam/* threshold for aging overlapping non-ERP bss */
57172211Ssam#define	IEEE80211_NONERP_PRESENT_AGE	msecs_to_ticks(60*1000)
58172211Ssam
59116742Ssam#define	IEEE80211_NODE_HASHSIZE	32
60116742Ssam/* simple hash is enough for variation of macaddr */
61116742Ssam#define	IEEE80211_NODE_HASH(addr)	\
62170530Ssam	(((const uint8_t *)(addr))[IEEE80211_ADDR_LEN - 1] % \
63138568Ssam		IEEE80211_NODE_HASHSIZE)
64116742Ssam
65138568Ssamstruct ieee80211_node_table;
66138568Ssamstruct ieee80211com;
67178354Ssamstruct ieee80211vap;
68138568Ssam
69116742Ssam/*
70178354Ssam * Information element ``blob''.  We use this structure
71178354Ssam * to capture management frame payloads that need to be
72178354Ssam * retained.  Information elemnts within the payload that
73178354Ssam * we need to consult have references recorded.
74178354Ssam */
75178354Ssamstruct ieee80211_ies {
76178354Ssam	/* the following are either NULL or point within data */
77178354Ssam	uint8_t	*wpa_ie;	/* captured WPA ie */
78178354Ssam	uint8_t	*rsn_ie;	/* captured RSN ie */
79178354Ssam	uint8_t	*wme_ie;	/* captured WME ie */
80178354Ssam	uint8_t	*ath_ie;	/* captured Atheros ie */
81178354Ssam	uint8_t	*htcap_ie;	/* captured HTCAP ie */
82178354Ssam	uint8_t	*htinfo_ie;	/* captured HTINFO ie */
83178354Ssam	/* NB: these must be the last members of this structure */
84178354Ssam	uint8_t	*data;		/* frame data > 802.11 header */
85178354Ssam	int	len;		/* data size in bytes */
86178354Ssam};
87178354Ssam
88178354Ssam/*
89116742Ssam * Node specific information.  Note that drivers are expected
90116742Ssam * to derive from this structure to add device-specific per-node
91116742Ssam * state.  This is done by overriding the ic_node_* methods in
92116742Ssam * the ieee80211com structure.
93116742Ssam */
94116742Ssamstruct ieee80211_node {
95178354Ssam	struct ieee80211vap	*ni_vap;	/* associated vap */
96178354Ssam	struct ieee80211com	*ni_ic;		/* copy from vap to save deref*/
97178354Ssam	struct ieee80211_node_table *ni_table;	/* NB: may be NULL */
98178354Ssam	TAILQ_ENTRY(ieee80211_node) ni_list;	/* list of all nodes */
99178354Ssam	LIST_ENTRY(ieee80211_node) ni_hash;	/* hash collision list */
100178354Ssam	u_int			ni_refcnt;	/* count of held references */
101120483Ssam	u_int			ni_scangen;	/* gen# for timeout scan */
102170530Ssam	uint8_t			ni_authmode;	/* authentication algorithm */
103170530Ssam	uint8_t			ni_ath_flags;	/* Atheros feature flags */
104170530Ssam	/* NB: These must have the same values as IEEE80211_ATHC_* */
105170530Ssam#define IEEE80211_NODE_TURBOP	0x0001		/* Turbo prime enable */
106170530Ssam#define IEEE80211_NODE_COMP	0x0002		/* Compresssion enable */
107170530Ssam#define IEEE80211_NODE_FF	0x0004          /* Fast Frame capable */
108170530Ssam#define IEEE80211_NODE_XR	0x0008		/* Atheros WME enable */
109170530Ssam#define IEEE80211_NODE_AR	0x0010		/* AR capable */
110178354Ssam#define IEEE80211_NODE_BOOST	0x0080
111170530Ssam#define IEEE80211_NODE_PSUPDATE	0x0200		/* power save state changed */
112170530Ssam#define	IEEE80211_NODE_CHWUPDATE 0x0400		/* 11n channel width change */
113170530Ssam	uint16_t		ni_flags;	/* special-purpose state */
114138568Ssam#define	IEEE80211_NODE_AUTH	0x0001		/* authorized for data */
115138568Ssam#define	IEEE80211_NODE_QOS	0x0002		/* QoS enabled */
116138568Ssam#define	IEEE80211_NODE_ERP	0x0004		/* ERP enabled */
117138568Ssam/* NB: this must have the same value as IEEE80211_FC1_PWR_MGT */
118138568Ssam#define	IEEE80211_NODE_PWR_MGT	0x0010		/* power save mode enabled */
119147788Ssam#define	IEEE80211_NODE_AREF	0x0020		/* authentication ref held */
120170530Ssam#define	IEEE80211_NODE_HT	0x0040		/* HT enabled */
121170530Ssam#define	IEEE80211_NODE_HTCOMPAT	0x0080		/* HT setup w/ vendor OUI's */
122178354Ssam#define	IEEE80211_NODE_WPS	0x0100		/* WPS association */
123178354Ssam#define	IEEE80211_NODE_TSN	0x0200		/* TSN association */
124173273Ssam#define	IEEE80211_NODE_AMPDU_RX	0x0400		/* AMPDU rx enabled */
125173273Ssam#define	IEEE80211_NODE_AMPDU_TX	0x0800		/* AMPDU tx enabled */
126170530Ssam	uint16_t		ni_ath_defkeyix;/* Atheros def key index */
127170530Ssam	uint16_t		ni_associd;	/* assoc response */
128170530Ssam	uint16_t		ni_txpower;	/* current transmit power */
129170530Ssam	uint16_t		ni_vlan;	/* vlan tag */
130173273Ssam	uint32_t		ni_jointime;	/* time of join (secs) */
131170530Ssam	uint32_t		*ni_challenge;	/* shared-key challenge */
132178354Ssam	struct ieee80211_ies	ni_ies;		/* captured ie's */
133172225Ssam						/* tx seq per-tid */
134172225Ssam	uint16_t		ni_txseqs[IEEE80211_TID_SIZE];
135172225Ssam						/* rx seq previous per-tid*/
136172225Ssam	uint16_t		ni_rxseqs[IEEE80211_TID_SIZE];
137170530Ssam	uint32_t		ni_rxfragstamp;	/* time stamp of last rx frag */
138138568Ssam	struct mbuf		*ni_rxfrag[3];	/* rx frag reassembly */
139138568Ssam	struct ieee80211_key	ni_ucastkey;	/* unicast key */
140116742Ssam
141116742Ssam	/* hardware */
142170530Ssam	uint32_t		ni_rstamp;	/* recv timestamp */
143178354Ssam	uint32_t		ni_avgrssi;	/* recv ssi state */
144170530Ssam	int8_t			ni_noise;	/* noise floor */
145116742Ssam
146116742Ssam	/* header */
147170530Ssam	uint8_t			ni_macaddr[IEEE80211_ADDR_LEN];
148170530Ssam	uint8_t			ni_bssid[IEEE80211_ADDR_LEN];
149116742Ssam
150116742Ssam	/* beacon, probe response */
151138568Ssam	union {
152170530Ssam		uint8_t		data[8];
153178354Ssam		u_int64_t	tsf;
154138568Ssam	} ni_tstamp;				/* from last rcv'd beacon */
155170530Ssam	uint16_t		ni_intval;	/* beacon interval */
156170530Ssam	uint16_t		ni_capinfo;	/* capabilities */
157170530Ssam	uint8_t			ni_esslen;
158170530Ssam	uint8_t			ni_essid[IEEE80211_NWID_LEN];
159116742Ssam	struct ieee80211_rateset ni_rates;	/* negotiated rate set */
160170530Ssam	struct ieee80211_channel *ni_chan;
161170530Ssam	uint16_t		ni_fhdwell;	/* FH only */
162170530Ssam	uint8_t			ni_fhindex;	/* FH only */
163178354Ssam	uint16_t		ni_erp;		/* ERP from beacon/probe resp */
164170530Ssam	uint16_t		ni_timoff;	/* byte offset to TIM ie */
165170530Ssam	uint8_t			ni_dtim_period;	/* DTIM period */
166170530Ssam	uint8_t			ni_dtim_count;	/* DTIM count for last bcn */
167116742Ssam
168170530Ssam	/* 11n state */
169170530Ssam	uint16_t		ni_htcap;	/* HT capabilities */
170170530Ssam	uint8_t			ni_htparam;	/* HT params */
171170530Ssam	uint8_t			ni_htctlchan;	/* HT control channel */
172170530Ssam	uint8_t			ni_ht2ndchan;	/* HT 2nd channel */
173170530Ssam	uint8_t			ni_htopmode;	/* HT operating mode */
174170530Ssam	uint8_t			ni_htstbc;	/* HT */
175170530Ssam	uint8_t			ni_reqcw;	/* requested tx channel width */
176170530Ssam	uint8_t			ni_chw;		/* negotiated channel width */
177170530Ssam	struct ieee80211_htrateset ni_htrates;	/* negotiated ht rate set */
178170530Ssam	struct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_AC];
179170530Ssam	struct ieee80211_rx_ampdu ni_rx_ampdu[WME_NUM_TID];
180170530Ssam
181116742Ssam	/* others */
182138568Ssam	short			ni_inact;	/* inactivity mark count */
183138568Ssam	short			ni_inact_reload;/* inactivity reload value */
184178354Ssam	int			ni_txrate;	/* legacy rate/MCS */
185178354Ssam	struct ifqueue		ni_savedq;	/* ps-poll queue */
186138568Ssam	struct ieee80211_nodestats ni_stats;	/* per-node statistics */
187178354Ssam
188178354Ssam	struct ieee80211vap	*ni_wdsvap;	/* associated WDS vap */
189178354Ssam	/* XXX move to vap? */
190178354Ssam	struct ifqueue		ni_wdsq;	/* wds pending queue */
191116742Ssam};
192138568SsamMALLOC_DECLARE(M_80211_NODE);
193178354SsamMALLOC_DECLARE(M_80211_NODE_IE);
194116742Ssam
195170530Ssam#define	IEEE80211_NODE_ATH	(IEEE80211_NODE_FF | IEEE80211_NODE_TURBOP)
196173273Ssam#define	IEEE80211_NODE_AMPDU \
197173273Ssam	(IEEE80211_NODE_AMPDU_RX | IEEE80211_NODE_AMPDU_TX)
198170530Ssam
199138568Ssam#define	IEEE80211_NODE_AID(ni)	IEEE80211_AID(ni->ni_associd)
200138568Ssam
201138568Ssam#define	IEEE80211_NODE_STAT(ni,stat)	(ni->ni_stats.ns_##stat++)
202138568Ssam#define	IEEE80211_NODE_STAT_ADD(ni,stat,v)	(ni->ni_stats.ns_##stat += v)
203138568Ssam#define	IEEE80211_NODE_STAT_SET(ni,stat,v)	(ni->ni_stats.ns_##stat = v)
204138568Ssam
205178354Ssam/*
206178354Ssam * Filtered rssi calculation support.  The receive rssi is maintained
207178354Ssam * as an average over the last 10 frames received using a low pass filter
208178354Ssam * (all frames for now, possibly need to be more selective).  Calculations
209178354Ssam * are designed such that a good compiler can optimize them.  The avg
210178354Ssam * rssi state should be initialized to IEEE80211_RSSI_DUMMY_MARKER and
211178354Ssam * each sample incorporated with IEEE80211_RSSI_LPF.  Use IEEE80211_RSSI_GET
212178354Ssam * to extract the current value.
213178354Ssam *
214178354Ssam * Note that we assume rssi data are in the range [-127..127] and we
215178354Ssam * discard values <-20.  This is consistent with assumptions throughout
216178354Ssam * net80211 that signal strength data are in .5 dBm units relative to
217178354Ssam * the current noise floor (linear, not log).
218178354Ssam */
219178354Ssam#define IEEE80211_RSSI_LPF_LEN		10
220178354Ssam#define	IEEE80211_RSSI_DUMMY_MARKER	127
221178354Ssam/* NB: pow2 to optimize out * and / */
222178354Ssam#define	IEEE80211_RSSI_EP_MULTIPLIER	(1<<7)
223178354Ssam#define IEEE80211_RSSI_IN(x)		((x) * IEEE80211_RSSI_EP_MULTIPLIER)
224178354Ssam#define _IEEE80211_RSSI_LPF(x, y, len) \
225178354Ssam    (((x) != IEEE80211_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y))
226178354Ssam#define IEEE80211_RSSI_LPF(x, y) do {					\
227178354Ssam    if ((y) >= -20) {							\
228178354Ssam    	x = _IEEE80211_RSSI_LPF((x), IEEE80211_RSSI_IN((y)), 		\
229178354Ssam		IEEE80211_RSSI_LPF_LEN);				\
230178354Ssam    }									\
231178354Ssam} while (0)
232178354Ssam#define	IEEE80211_RSSI_EP_RND(x, mul) \
233178354Ssam	((((x) % (mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
234178354Ssam#define	IEEE80211_RSSI_GET(x) \
235178354Ssam	IEEE80211_RSSI_EP_RND(x, IEEE80211_RSSI_EP_MULTIPLIER)
236178354Ssam
237116742Ssamstatic __inline struct ieee80211_node *
238116742Ssamieee80211_ref_node(struct ieee80211_node *ni)
239116742Ssam{
240138568Ssam	ieee80211_node_incref(ni);
241116742Ssam	return ni;
242116742Ssam}
243116742Ssam
244116742Ssamstatic __inline void
245116742Ssamieee80211_unref_node(struct ieee80211_node **ni)
246116742Ssam{
247138568Ssam	ieee80211_node_decref(*ni);
248116742Ssam	*ni = NULL;			/* guard against use */
249116742Ssam}
250116742Ssam
251116742Ssamstruct ieee80211com;
252116742Ssam
253144618Ssamvoid	ieee80211_node_attach(struct ieee80211com *);
254144618Ssamvoid	ieee80211_node_lateattach(struct ieee80211com *);
255144618Ssamvoid	ieee80211_node_detach(struct ieee80211com *);
256178354Ssamvoid	ieee80211_node_vattach(struct ieee80211vap *);
257178354Ssamvoid	ieee80211_node_latevattach(struct ieee80211vap *);
258178354Ssamvoid	ieee80211_node_vdetach(struct ieee80211vap *);
259127877Ssam
260138568Ssamstatic __inline int
261138568Ssamieee80211_node_is_authorized(const struct ieee80211_node *ni)
262138568Ssam{
263138568Ssam	return (ni->ni_flags & IEEE80211_NODE_AUTH);
264138568Ssam}
265116742Ssam
266148302Ssamvoid	ieee80211_node_authorize(struct ieee80211_node *);
267148302Ssamvoid	ieee80211_node_unauthorize(struct ieee80211_node *);
268138568Ssam
269178354Ssamvoid	ieee80211_node_set_chan(struct ieee80211_node *,
270178354Ssam		struct ieee80211_channel *);
271178354Ssamvoid	ieee80211_create_ibss(struct ieee80211vap*, struct ieee80211_channel *);
272178354Ssamvoid	ieee80211_reset_bss(struct ieee80211vap *);
273178354Ssamvoid	ieee80211_sync_curchan(struct ieee80211com *);
274178354Ssamvoid	ieee80211_setcurchan(struct ieee80211com *, struct ieee80211_channel *);
275148306Ssamint	ieee80211_ibss_merge(struct ieee80211_node *);
276170530Ssamstruct ieee80211_scan_entry;
277178354Ssamint	ieee80211_sta_join(struct ieee80211vap *,
278170530Ssam		const struct ieee80211_scan_entry *);
279178354Ssamvoid	ieee80211_sta_leave(struct ieee80211_node *);
280178354Ssamvoid	ieee80211_node_deauth(struct ieee80211_node *, int);
281138568Ssam
282178354Ssamint	ieee80211_ies_init(struct ieee80211_ies *, const uint8_t *, int);
283178354Ssamvoid	ieee80211_ies_cleanup(struct ieee80211_ies *);
284178354Ssamvoid	ieee80211_ies_expand(struct ieee80211_ies *);
285178354Ssam#define	ieee80211_ies_setie(_ies, _ie, _off) do {		\
286178354Ssam	(_ies)._ie = (_ies).data + (_off);			\
287178354Ssam} while (0)
288178354Ssam
289138568Ssam/*
290138568Ssam * Table of ieee80211_node instances.  Each ieee80211com
291178354Ssam * has one that holds association stations (when operating
292178354Ssam * as an ap) or neighbors (in ibss mode).
293178354Ssam *
294178354Ssam * XXX embed this in ieee80211com instead of indirect?
295138568Ssam */
296138568Ssamstruct ieee80211_node_table {
297138568Ssam	struct ieee80211com	*nt_ic;		/* back reference */
298138568Ssam	ieee80211_node_lock_t	nt_nodelock;	/* on node table */
299138568Ssam	TAILQ_HEAD(, ieee80211_node) nt_node;	/* information of all nodes */
300138568Ssam	LIST_HEAD(, ieee80211_node) nt_hash[IEEE80211_NODE_HASHSIZE];
301170530Ssam	struct ieee80211_node	**nt_keyixmap;	/* key ix -> node map */
302170530Ssam	int			nt_keyixmax;	/* keyixmap size */
303178354Ssam	const char		*nt_name;	/* table name for debug msgs */
304138568Ssam	ieee80211_scan_lock_t	nt_scanlock;	/* on nt_scangen */
305178354Ssam	u_int			nt_scangen;	/* gen# for iterators */
306138568Ssam	int			nt_inact_init;	/* initial node inact setting */
307138568Ssam};
308138568Ssam
309178354Ssamstruct ieee80211_node *ieee80211_alloc_node(struct ieee80211_node_table *,
310178354Ssam		struct ieee80211vap *,
311178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
312178354Ssamstruct ieee80211_node *ieee80211_tmp_node(struct ieee80211vap *,
313178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
314178354Ssamstruct ieee80211_node *ieee80211_dup_bss(struct ieee80211vap *,
315178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
316178354Ssamstruct ieee80211_node *ieee80211_node_create_wds(struct ieee80211vap *,
317178354Ssam		const uint8_t bssid[IEEE80211_ADDR_LEN],
318178354Ssam		struct ieee80211_channel *);
319138568Ssam#ifdef IEEE80211_DEBUG_REFCNT
320144618Ssamvoid	ieee80211_free_node_debug(struct ieee80211_node *,
321138568Ssam		const char *func, int line);
322178354Ssamstruct ieee80211_node *ieee80211_find_node_locked_debug(
323178354Ssam		struct ieee80211_node_table *,
324178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN],
325178354Ssam		const char *func, int line);
326170530Ssamstruct ieee80211_node *ieee80211_find_node_debug(struct ieee80211_node_table *,
327178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN],
328138568Ssam		const char *func, int line);
329178354Ssamstruct ieee80211_node *ieee80211_find_vap_node_locked_debug(
330178354Ssam		struct ieee80211_node_table *,
331178354Ssam		const struct ieee80211vap *vap,
332178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN],
333178354Ssam		const char *func, int line);
334178354Ssamstruct ieee80211_node *ieee80211_find_vap_node_debug(
335178354Ssam		struct ieee80211_node_table *,
336178354Ssam		const struct ieee80211vap *vap,
337178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN],
338178354Ssam		const char *func, int line);
339170530Ssamstruct ieee80211_node * ieee80211_find_rxnode_debug(struct ieee80211com *,
340170530Ssam		const struct ieee80211_frame_min *,
341138568Ssam		const char *func, int line);
342148863Ssamstruct ieee80211_node * ieee80211_find_rxnode_withkey_debug(
343148863Ssam		struct ieee80211com *,
344170530Ssam		const struct ieee80211_frame_min *, uint16_t keyix,
345148863Ssam		const char *func, int line);
346178354Ssamstruct ieee80211_node *ieee80211_find_txnode_debug(struct ieee80211vap *,
347170530Ssam		const uint8_t *,
348170530Ssam		const char *func, int line);
349138568Ssam#define	ieee80211_free_node(ni) \
350138568Ssam	ieee80211_free_node_debug(ni, __func__, __LINE__)
351178354Ssam#define	ieee80211_find_node_locked(nt, mac) \
352178354Ssam	ieee80211_find_node_locked_debug(nt, mac, __func__, __LINE__)
353138568Ssam#define	ieee80211_find_node(nt, mac) \
354138568Ssam	ieee80211_find_node_debug(nt, mac, __func__, __LINE__)
355178354Ssam#define	ieee80211_find_vap_node_locked(nt, vap, mac) \
356178354Ssam	ieee80211_find_vap_node_locked_debug(nt, vap, mac, __func__, __LINE__)
357178354Ssam#define	ieee80211_find_vap_node(nt, vap, mac) \
358178354Ssam	ieee80211_find_vap_node_debug(nt, vap, mac, __func__, __LINE__)
359178354Ssam#define	ieee80211_find_rxnode(ic, wh) \
360178354Ssam	ieee80211_find_rxnode_debug(ic, wh, __func__, __LINE__)
361178354Ssam#define	ieee80211_find_rxnode_withkey(ic, wh, keyix) \
362178354Ssam	ieee80211_find_rxnode_withkey_debug(ic, wh, keyix, __func__, __LINE__)
363178354Ssam#define	ieee80211_find_txnode(vap, mac) \
364178354Ssam	ieee80211_find_txnode_debug(vap, mac, __func__, __LINE__)
365138568Ssam#else
366144618Ssamvoid	ieee80211_free_node(struct ieee80211_node *);
367178354Ssamstruct ieee80211_node *ieee80211_find_node_locked(struct ieee80211_node_table *,
368178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
369170530Ssamstruct ieee80211_node *ieee80211_find_node(struct ieee80211_node_table *,
370178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
371178354Ssamstruct ieee80211_node *ieee80211_find_vap_node_locked(
372178354Ssam		struct ieee80211_node_table *, const struct ieee80211vap *,
373178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
374178354Ssamstruct ieee80211_node *ieee80211_find_vap_node(
375178354Ssam		struct ieee80211_node_table *, const struct ieee80211vap *,
376178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
377170530Ssamstruct ieee80211_node * ieee80211_find_rxnode(struct ieee80211com *,
378170530Ssam		const struct ieee80211_frame_min *);
379148863Ssamstruct ieee80211_node * ieee80211_find_rxnode_withkey(struct ieee80211com *,
380170530Ssam		const struct ieee80211_frame_min *, uint16_t keyix);
381178354Ssamstruct ieee80211_node *ieee80211_find_txnode(struct ieee80211vap *,
382178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
383138568Ssam#endif
384148863Ssamint	ieee80211_node_delucastkey(struct ieee80211_node *);
385170530Ssamvoid	ieee80211_node_timeout(void *arg);
386138568Ssam
387116742Ssamtypedef void ieee80211_iter_func(void *, struct ieee80211_node *);
388144618Ssamvoid	ieee80211_iterate_nodes(struct ieee80211_node_table *,
389116742Ssam		ieee80211_iter_func *, void *);
390116742Ssam
391178354Ssamvoid	ieee80211_notify_erp(struct ieee80211com *);
392144618Ssamvoid	ieee80211_dump_node(struct ieee80211_node_table *,
393138568Ssam		struct ieee80211_node *);
394144618Ssamvoid	ieee80211_dump_nodes(struct ieee80211_node_table *);
395138568Ssam
396178354Ssamstruct ieee80211_node *ieee80211_fakeup_adhoc_node(struct ieee80211vap *,
397178354Ssam		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
398170530Ssamstruct ieee80211_scanparams;
399153073Ssamvoid	ieee80211_init_neighbor(struct ieee80211_node *,
400153073Ssam		const struct ieee80211_frame *,
401153073Ssam		const struct ieee80211_scanparams *);
402178354Ssamstruct ieee80211_node *ieee80211_add_neighbor(struct ieee80211vap *,
403148936Ssam		const struct ieee80211_frame *,
404148936Ssam		const struct ieee80211_scanparams *);
405178354Ssamvoid	ieee80211_node_join(struct ieee80211_node *,int);
406178354Ssamvoid	ieee80211_node_leave(struct ieee80211_node *);
407178354Ssamint8_t	ieee80211_getrssi(struct ieee80211vap *);
408178354Ssamvoid	ieee80211_getsignal(struct ieee80211vap *, int8_t *, int8_t *);
409116742Ssam#endif /* _NET80211_IEEE80211_NODE_H_ */
410