ieee80211_node.h revision 191746
1709Swollman/*-
215568Sasami * Copyright (c) 2001 Atsushi Onoe
3709Swollman * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
437Srgrimes * All rights reserved.
537Srgrimes *
637Srgrimes * Redistribution and use in source and binary forms, with or without
737Srgrimes * modification, are permitted provided that the following conditions
837Srgrimes * are met:
937Srgrimes * 1. Redistributions of source code must retain the above copyright
108460Sjkh *    notice, this list of conditions and the following disclaimer.
118460Sjkh * 2. Redistributions in binary form must reproduce the above copyright
128460Sjkh *    notice, this list of conditions and the following disclaimer in the
138460Sjkh *    documentation and/or other materials provided with the distribution.
1437Srgrimes *
1537Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1637Srgrimes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1737Srgrimes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1837Srgrimes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1937Srgrimes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2037Srgrimes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2137Srgrimes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2237Srgrimes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2337Srgrimes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2437Srgrimes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2515568Sasami *
2615568Sasami * $FreeBSD: head/sys/net80211/ieee80211_node.h 191746 2009-05-02 15:14:18Z thompsa $
2715568Sasami */
2815568Sasami#ifndef _NET80211_IEEE80211_NODE_H_
2915568Sasami#define _NET80211_IEEE80211_NODE_H_
3015568Sasami
313843Sdg#include <net80211/ieee80211_ioctl.h>		/* for ieee80211_nodestats */
323843Sdg#include <net80211/ieee80211_ht.h>		/* for aggregation state */
332164Sdg
3437Srgrimes/*
3537Srgrimes * Each ieee80211com instance has a single timer that fires every
3637Srgrimes * IEEE80211_INACT_WAIT seconds to handle "inactivity processing".
3737Srgrimes * This is used to do node inactivity processing when operating
3837Srgrimes * as an AP or in adhoc mode.  For inactivity processing each node
3937Srgrimes * has a timeout set in it's ni_inact field that is decremented
4037Srgrimes * on each timeout and the node is reclaimed when the counter goes
4137Srgrimes * to zero.  We use different inactivity timeout values depending
4237Srgrimes * on whether the node is associated and authorized (either by
4337Srgrimes * 802.1x or open/shared key authentication) or associated but yet
4437Srgrimes * to be authorized.  The latter timeout is shorter to more aggressively
4537Srgrimes * reclaim nodes that leave part way through the 802.1x exchange.
4637Srgrimes */
4737Srgrimes#define	IEEE80211_INACT_WAIT	15		/* inactivity interval (secs) */
4837Srgrimes#define	IEEE80211_INACT_INIT	(30/IEEE80211_INACT_WAIT)	/* initial */
4937Srgrimes#define	IEEE80211_INACT_AUTH	(180/IEEE80211_INACT_WAIT)	/* associated but not authorized */
5037Srgrimes#define	IEEE80211_INACT_RUN	(300/IEEE80211_INACT_WAIT)	/* authorized */
5137Srgrimes#define	IEEE80211_INACT_PROBE	(30/IEEE80211_INACT_WAIT)	/* probe */
5237Srgrimes#define	IEEE80211_INACT_SCAN	(300/IEEE80211_INACT_WAIT)	/* scanned */
5337Srgrimes
5437Srgrimes#define	IEEE80211_TRANS_WAIT 	2		/* mgt frame tx timer (secs) */
5537Srgrimes
5637Srgrimes/* threshold for aging overlapping non-ERP bss */
5737Srgrimes#define	IEEE80211_NONERP_PRESENT_AGE	msecs_to_ticks(60*1000)
5837Srgrimes
5937Srgrimes#define	IEEE80211_NODE_HASHSIZE	32
6037Srgrimes/* simple hash is enough for variation of macaddr */
6137Srgrimes#define	IEEE80211_NODE_HASH(addr)	\
6237Srgrimes	(((const uint8_t *)(addr))[IEEE80211_ADDR_LEN - 1] % \
6337Srgrimes		IEEE80211_NODE_HASHSIZE)
6437Srgrimes
652164Sdgstruct ieee80211_node_table;
662164Sdgstruct ieee80211com;
6737Srgrimesstruct ieee80211vap;
6837Srgrimes
6937Srgrimes/*
7037Srgrimes * Information element ``blob''.  We use this structure
713036Sdg * to capture management frame payloads that need to be
723036Sdg * retained.  Information elements within the payload that
733036Sdg * we need to consult have references recorded.
748530Sdg */
758530Sdgstruct ieee80211_ies {
768530Sdg	/* the following are either NULL or point within data */
778530Sdg	uint8_t	*wpa_ie;	/* captured WPA ie */
781692Sphk	uint8_t	*rsn_ie;	/* captured RSN ie */
7937Srgrimes	uint8_t	*wme_ie;	/* captured WME ie */
808530Sdg	uint8_t	*ath_ie;	/* captured Atheros ie */
8137Srgrimes	uint8_t	*htcap_ie;	/* captured HTCAP ie */
828530Sdg	uint8_t	*htinfo_ie;	/* captured HTINFO ie */
838530Sdg	uint8_t	*tdma_ie;	/* captured TDMA ie */
848530Sdg	/* NB: these must be the last members of this structure */
858530Sdg	uint8_t	*data;		/* frame data > 802.11 header */
8637Srgrimes	int	len;		/* data size in bytes */
87872Sache};
88872Sache
89872Sache/*
90872Sache * Node specific information.  Note that drivers are expected
914091Sache * to derive from this structure to add device-specific per-node
92872Sache * state.  This is done by overriding the ic_node_* methods in
937219Sjkh * the ieee80211com structure.
947219Sjkh */
957219Sjkhstruct ieee80211_node {
967219Sjkh	struct ieee80211vap	*ni_vap;	/* associated vap */
977219Sjkh	struct ieee80211com	*ni_ic;		/* copy from vap to save deref*/
981675Sache	struct ieee80211_node_table *ni_table;	/* NB: may be NULL */
997219Sjkh	TAILQ_ENTRY(ieee80211_node) ni_list;	/* list of all nodes */
1007293Sjkh	LIST_ENTRY(ieee80211_node) ni_hash;	/* hash collision list */
1011675Sache	u_int			ni_refcnt;	/* count of held references */
1021675Sache	u_int			ni_scangen;	/* gen# for timeout scan */
10314596Snate	u_int			ni_flags;
10414624Snate#define	IEEE80211_NODE_AUTH	0x000001	/* authorized for data */
10514624Snate#define	IEEE80211_NODE_QOS	0x000002	/* QoS enabled */
10614596Snate#define	IEEE80211_NODE_ERP	0x000004	/* ERP enabled */
10714596Snate/* NB: this must have the same value as IEEE80211_FC1_PWR_MGT */
1087487Srgrimes#define	IEEE80211_NODE_PWR_MGT	0x000010	/* power save mode enabled */
1097460Sjkh#define	IEEE80211_NODE_AREF	0x000020	/* authentication ref held */
1107750Srgrimes#define	IEEE80211_NODE_HT	0x000040	/* HT enabled */
1117460Sjkh#define	IEEE80211_NODE_HTCOMPAT	0x000080	/* HT setup w/ vendor OUI's */
1127460Sjkh#define	IEEE80211_NODE_WPS	0x000100	/* WPS association */
1138540Srgrimes#define	IEEE80211_NODE_TSN	0x000200	/* TSN association */
1147487Srgrimes#define	IEEE80211_NODE_AMPDU_RX	0x000400	/* AMPDU rx enabled */
1157487Srgrimes#define	IEEE80211_NODE_AMPDU_TX	0x000800	/* AMPDU tx enabled */
1167487Srgrimes#define	IEEE80211_NODE_MIMO_PS	0x001000	/* MIMO power save enabled */
1177487Srgrimes#define	IEEE80211_NODE_MIMO_RTS	0x002000	/* send RTS in MIMO PS */
1187487Srgrimes#define	IEEE80211_NODE_RIFS	0x004000	/* RIFS enabled */
1197487Srgrimes#define	IEEE80211_NODE_SGI20	0x008000	/* Short GI in HT20 enabled */
1207487Srgrimes#define	IEEE80211_NODE_SGI40	0x010000	/* Short GI in HT40 enabled */
1217761Sache#define	IEEE80211_NODE_ASSOCID	0x020000	/* xmit requires associd */
1227487Srgrimes	uint16_t		ni_associd;	/* association ID */
1237487Srgrimes	uint16_t		ni_vlan;	/* vlan tag */
1247487Srgrimes	uint16_t		ni_txpower;	/* current transmit power */
1257487Srgrimes	uint8_t			ni_authmode;	/* authentication algorithm */
1267487Srgrimes	uint8_t			ni_ath_flags;	/* Atheros feature flags */
1277487Srgrimes	/* NB: These must have the same values as IEEE80211_ATHC_* */
1287487Srgrimes#define IEEE80211_NODE_TURBOP	0x0001		/* Turbo prime enable */
1297487Srgrimes#define IEEE80211_NODE_COMP	0x0002		/* Compresssion enable */
1307487Srgrimes#define IEEE80211_NODE_FF	0x0004          /* Fast Frame capable */
1317487Srgrimes#define IEEE80211_NODE_XR	0x0008		/* Atheros WME enable */
1329305Sbde#define IEEE80211_NODE_AR	0x0010		/* AR capable */
1339305Sbde#define IEEE80211_NODE_BOOST	0x0080		/* Dynamic Turbo boosted */
1349305Sbde	uint16_t		ni_ath_defkeyix;/* Atheros def key index */
1359305Sbde	const struct ieee80211_txparam *ni_txparms;
1369305Sbde	uint32_t		ni_jointime;	/* time of join (secs) */
1377487Srgrimes	uint32_t		*ni_challenge;	/* shared-key challenge */
1387487Srgrimes	struct ieee80211_ies	ni_ies;		/* captured ie's */
1397487Srgrimes						/* tx seq per-tid */
1407487Srgrimes	uint16_t		ni_txseqs[IEEE80211_TID_SIZE];
1417487Srgrimes						/* rx seq previous per-tid*/
1427487Srgrimes	uint16_t		ni_rxseqs[IEEE80211_TID_SIZE];
1437487Srgrimes	uint32_t		ni_rxfragstamp;	/* time stamp of last rx frag */
1447487Srgrimes	struct mbuf		*ni_rxfrag[3];	/* rx frag reassembly */
1457487Srgrimes	struct ieee80211_key	ni_ucastkey;	/* unicast key */
1467487Srgrimes
1477487Srgrimes	/* hardware */
1487487Srgrimes	uint32_t		ni_rstamp;	/* recv timestamp */
1497487Srgrimes	uint32_t		ni_avgrssi;	/* recv ssi state */
1507487Srgrimes	int8_t			ni_noise;	/* noise floor */
1517487Srgrimes
1527487Srgrimes	/* header */
1537487Srgrimes	uint8_t			ni_macaddr[IEEE80211_ADDR_LEN];
1547487Srgrimes	uint8_t			ni_bssid[IEEE80211_ADDR_LEN];
1557487Srgrimes
1567487Srgrimes	/* beacon, probe response */
1577487Srgrimes	union {
1587259Sjkh		uint8_t		data[8];
1597487Srgrimes		u_int64_t	tsf;
1607487Srgrimes	} ni_tstamp;				/* from last rcv'd beacon */
1617708Srgrimes	uint16_t		ni_intval;	/* beacon interval */
1627487Srgrimes	uint16_t		ni_capinfo;	/* capabilities */
1637487Srgrimes	uint8_t			ni_esslen;
1647487Srgrimes	uint8_t			ni_essid[IEEE80211_NWID_LEN];
1657487Srgrimes	struct ieee80211_rateset ni_rates;	/* negotiated rate set */
1667487Srgrimes	struct ieee80211_channel *ni_chan;
1677708Srgrimes	uint16_t		ni_fhdwell;	/* FH only */
168857Sdg	uint8_t			ni_fhindex;	/* FH only */
16937Srgrimes	uint16_t		ni_erp;		/* ERP from beacon/probe resp */
1707487Srgrimes	uint16_t		ni_timoff;	/* byte offset to TIM ie */
1717487Srgrimes	uint8_t			ni_dtim_period;	/* DTIM period */
1727487Srgrimes	uint8_t			ni_dtim_count;	/* DTIM count for last bcn */
1737487Srgrimes
1747487Srgrimes	/* 11n state */
1757487Srgrimes	uint16_t		ni_htcap;	/* HT capabilities */
1767487Srgrimes	uint8_t			ni_htparam;	/* HT params */
177958Sache	uint8_t			ni_htctlchan;	/* HT control channel */
1787487Srgrimes	uint8_t			ni_ht2ndchan;	/* HT 2nd channel */
1797487Srgrimes	uint8_t			ni_htopmode;	/* HT operating mode */
1807487Srgrimes	uint8_t			ni_htstbc;	/* HT */
1817487Srgrimes	uint8_t			ni_chw;		/* negotiated channel width */
1827487Srgrimes	struct ieee80211_htrateset ni_htrates;	/* negotiated ht rate set */
1837487Srgrimes	struct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_AC];
1847487Srgrimes	struct ieee80211_rx_ampdu ni_rx_ampdu[WME_NUM_TID];
1851186Srgrimes
1861186Srgrimes	/* others */
1877487Srgrimes	short			ni_inact;	/* inactivity mark count */
1887487Srgrimes	short			ni_inact_reload;/* inactivity reload value */
1897487Srgrimes	int			ni_txrate;	/* legacy rate/MCS */
1907487Srgrimes	struct ieee80211_psq	ni_psq;		/* power save queue */
1917487Srgrimes	struct ieee80211_nodestats ni_stats;	/* per-node statistics */
1927219Sjkh
1937487Srgrimes	struct ieee80211vap	*ni_wdsvap;	/* associated WDS vap */
1947487Srgrimes	/* XXX move to vap? */
1957487Srgrimes	struct ifqueue		ni_wdsq;	/* wds pending queue */
1967487Srgrimes};
1977238SacheMALLOC_DECLARE(M_80211_NODE);
1987487SrgrimesMALLOC_DECLARE(M_80211_NODE_IE);
1997487Srgrimes
2007487Srgrimes#define	IEEE80211_NODE_ATH	(IEEE80211_NODE_FF | IEEE80211_NODE_TURBOP)
2017708Srgrimes#define	IEEE80211_NODE_AMPDU \
2027238Sache	(IEEE80211_NODE_AMPDU_RX | IEEE80211_NODE_AMPDU_TX)
2037487Srgrimes#define	IEEE80211_NODE_HT_ALL \
20414202Sadam	(IEEE80211_NODE_HT | IEEE80211_NODE_HTCOMPAT | \
2057487Srgrimes	 IEEE80211_NODE_AMPDU | IEEE80211_NODE_MIMO_PS | \
2067487Srgrimes	 IEEE80211_NODE_MIMO_RTS | IEEE80211_NODE_RIFS | \
2077238Sache	 IEEE80211_NODE_SGI20 | IEEE80211_NODE_SGI40)
2087487Srgrimes
2097487Srgrimes#define	IEEE80211_NODE_BITS \
2107708Srgrimes	"\20\1AUTH\2QOS\3ERP\5PWR_MGT\6AREF\7HT\10HTCOMPAT\11WPS\12TSN" \
2119593Swollman	"\13AMPDU_RX\14AMPDU_TX\15MIMO_PS\16MIMO_RTS\17RIFS\20SGI20\21SGI40" \
2129593Swollman	"\22ASSOCID"
2139593Swollman
2147219Sjkh#define	IEEE80211_NODE_AID(ni)	IEEE80211_AID(ni->ni_associd)
2157219Sjkh
2167487Srgrimes#define	IEEE80211_NODE_STAT(ni,stat)	(ni->ni_stats.ns_##stat++)
2177487Srgrimes#define	IEEE80211_NODE_STAT_ADD(ni,stat,v)	(ni->ni_stats.ns_##stat += v)
2187487Srgrimes#define	IEEE80211_NODE_STAT_SET(ni,stat,v)	(ni->ni_stats.ns_##stat = v)
2197487Srgrimes
2207238Sache/*
2217238Sache * Filtered rssi calculation support.  The receive rssi is maintained
2227487Srgrimes * as an average over the last 10 frames received using a low pass filter
22310716Sjkh * (all frames for now, possibly need to be more selective).  Calculations
22413071Sjkh * are designed such that a good compiler can optimize them.  The avg
22510716Sjkh * rssi state should be initialized to IEEE80211_RSSI_DUMMY_MARKER and
22610716Sjkh * each sample incorporated with IEEE80211_RSSI_LPF.  Use IEEE80211_RSSI_GET
22710716Sjkh * to extract the current value.
22810716Sjkh *
2297487Srgrimes * Note that we assume rssi data are in the range [-127..127] and we
2307477Sache * discard values <-20.  This is consistent with assumptions throughout
2317477Sache * net80211 that signal strength data are in .5 dBm units relative to
2327487Srgrimes * the current noise floor (linear, not log).
2337487Srgrimes */
2347487Srgrimes#define IEEE80211_RSSI_LPF_LEN		10
2357238Sache#define	IEEE80211_RSSI_DUMMY_MARKER	127
2367487Srgrimes/* NB: pow2 to optimize out * and / */
23713455Sgraichen#define	IEEE80211_RSSI_EP_MULTIPLIER	(1<<7)
23813996Sjkh#define IEEE80211_RSSI_IN(x)		((x) * IEEE80211_RSSI_EP_MULTIPLIER)
2397238Sache#define _IEEE80211_RSSI_LPF(x, y, len) \
2407238Sache    (((x) != IEEE80211_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y))
2417487Srgrimes#define IEEE80211_RSSI_LPF(x, y) do {					\
2427487Srgrimes    if ((y) >= -20) {							\
2437487Srgrimes    	x = _IEEE80211_RSSI_LPF((x), IEEE80211_RSSI_IN((y)), 		\
2447487Srgrimes		IEEE80211_RSSI_LPF_LEN);				\
24512053Spst    }									\
2467238Sache} while (0)
2477238Sache#define	IEEE80211_RSSI_EP_RND(x, mul) \
24813701Sgpalmer	((((x) % (mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
24913701Sgpalmer#define	IEEE80211_RSSI_GET(x) \
25013701Sgpalmer	IEEE80211_RSSI_EP_RND(x, IEEE80211_RSSI_EP_MULTIPLIER)
25113701Sgpalmer
25213701Sgpalmerstatic __inline struct ieee80211_node *
2537487Srgrimesieee80211_ref_node(struct ieee80211_node *ni)
2547487Srgrimes{
2557487Srgrimes	ieee80211_node_incref(ni);
2567487Srgrimes	return ni;
2577487Srgrimes}
2587487Srgrimes
2597487Srgrimesstatic __inline void
2607487Srgrimesieee80211_unref_node(struct ieee80211_node **ni)
2617487Srgrimes{
2627487Srgrimes	ieee80211_node_decref(*ni);
2637487Srgrimes	*ni = NULL;			/* guard against use */
2647487Srgrimes}
2657238Sache
2667238Sachestruct ieee80211com;
2677487Srgrimes
26811920Sachevoid	ieee80211_node_attach(struct ieee80211com *);
26911899Spstvoid	ieee80211_node_lateattach(struct ieee80211com *);
2707487Srgrimesvoid	ieee80211_node_detach(struct ieee80211com *);
2717487Srgrimesvoid	ieee80211_node_vattach(struct ieee80211vap *);
2727487Srgrimesvoid	ieee80211_node_latevattach(struct ieee80211vap *);
2737487Srgrimesvoid	ieee80211_node_vdetach(struct ieee80211vap *);
2747238Sache
2757238Sachestatic __inline int
2767487Srgrimesieee80211_node_is_authorized(const struct ieee80211_node *ni)
27711992Sache{
27811992Sache	return (ni->ni_flags & IEEE80211_NODE_AUTH);
27911992Sache}
28011992Sache
28111992Sachevoid	ieee80211_node_authorize(struct ieee80211_node *);
2827238Sachevoid	ieee80211_node_unauthorize(struct ieee80211_node *);
2837238Sache
2847487Srgrimesvoid	ieee80211_node_set_chan(struct ieee80211_node *,
2857487Srgrimes		struct ieee80211_channel *);
2867487Srgrimesvoid	ieee80211_create_ibss(struct ieee80211vap*, struct ieee80211_channel *);
2877487Srgrimesvoid	ieee80211_reset_bss(struct ieee80211vap *);
2887238Sachevoid	ieee80211_sync_curchan(struct ieee80211com *);
28913659Sgpalmervoid	ieee80211_setupcurchan(struct ieee80211com *,
29013659Sgpalmer	    struct ieee80211_channel *);
29113659Sgpalmervoid	ieee80211_setcurchan(struct ieee80211com *, struct ieee80211_channel *);
29213659Sgpalmerint	ieee80211_ibss_merge(struct ieee80211_node *);
2937487Srgrimesstruct ieee80211_scan_entry;
2947487Srgrimesint	ieee80211_sta_join(struct ieee80211vap *, struct ieee80211_channel *,
2957487Srgrimes		const struct ieee80211_scan_entry *);
29612699Sachevoid	ieee80211_sta_leave(struct ieee80211_node *);
2977238Sachevoid	ieee80211_node_deauth(struct ieee80211_node *, int);
2987238Sache
2997487Srgrimesint	ieee80211_ies_init(struct ieee80211_ies *, const uint8_t *, int);
3007238Sachevoid	ieee80211_ies_cleanup(struct ieee80211_ies *);
3017487Srgrimesvoid	ieee80211_ies_expand(struct ieee80211_ies *);
3027487Srgrimes#define	ieee80211_ies_setie(_ies, _ie, _off) do {		\
3037487Srgrimes	(_ies)._ie = (_ies).data + (_off);			\
3047487Srgrimes} while (0)
3057487Srgrimes
3067487Srgrimes/*
3077487Srgrimes * Table of ieee80211_node instances.  Each ieee80211com
3087487Srgrimes * has one that holds association stations (when operating
3097487Srgrimes * as an ap) or neighbors (in ibss mode).
3107296Sjkh *
3117296Sjkh * XXX embed this in ieee80211com instead of indirect?
3127487Srgrimes */
3137487Srgrimesstruct ieee80211_node_table {
31410895Sjkh	struct ieee80211com	*nt_ic;		/* back reference */
31510895Sjkh	ieee80211_node_lock_t	nt_nodelock;	/* on node table */
3167487Srgrimes	TAILQ_HEAD(, ieee80211_node) nt_node;	/* information of all nodes */
3177487Srgrimes	LIST_HEAD(, ieee80211_node) nt_hash[IEEE80211_NODE_HASHSIZE];
31813071Sjkh	struct ieee80211_node	**nt_keyixmap;	/* key ix -> node map */
31913071Sjkh	int			nt_keyixmax;	/* keyixmap size */
32013071Sjkh	const char		*nt_name;	/* table name for debug msgs */
32113071Sjkh	ieee80211_scan_lock_t	nt_scanlock;	/* on nt_scangen */
32213071Sjkh	u_int			nt_scangen;	/* gen# for iterators */
32313071Sjkh	int			nt_inact_init;	/* initial node inact setting */
32410873Sjkh};
3257259Sjkh
32637Srgrimesstruct ieee80211_node *ieee80211_alloc_node(struct ieee80211_node_table *,
32710873Sjkh		struct ieee80211vap *,
32810898Sjkh		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
32910873Sjkhstruct ieee80211_node *ieee80211_tmp_node(struct ieee80211vap *,
33037Srgrimes		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
33137Srgrimesstruct ieee80211_node *ieee80211_dup_bss(struct ieee80211vap *,
332		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
333struct ieee80211_node *ieee80211_node_create_wds(struct ieee80211vap *,
334		const uint8_t bssid[IEEE80211_ADDR_LEN],
335		struct ieee80211_channel *);
336#ifdef IEEE80211_DEBUG_REFCNT
337void	ieee80211_free_node_debug(struct ieee80211_node *,
338		const char *func, int line);
339struct ieee80211_node *ieee80211_find_node_locked_debug(
340		struct ieee80211_node_table *,
341		const uint8_t macaddr[IEEE80211_ADDR_LEN],
342		const char *func, int line);
343struct ieee80211_node *ieee80211_find_node_debug(struct ieee80211_node_table *,
344		const uint8_t macaddr[IEEE80211_ADDR_LEN],
345		const char *func, int line);
346struct ieee80211_node *ieee80211_find_vap_node_locked_debug(
347		struct ieee80211_node_table *,
348		const struct ieee80211vap *vap,
349		const uint8_t macaddr[IEEE80211_ADDR_LEN],
350		const char *func, int line);
351struct ieee80211_node *ieee80211_find_vap_node_debug(
352		struct ieee80211_node_table *,
353		const struct ieee80211vap *vap,
354		const uint8_t macaddr[IEEE80211_ADDR_LEN],
355		const char *func, int line);
356struct ieee80211_node * ieee80211_find_rxnode_debug(struct ieee80211com *,
357		const struct ieee80211_frame_min *,
358		const char *func, int line);
359struct ieee80211_node * ieee80211_find_rxnode_withkey_debug(
360		struct ieee80211com *,
361		const struct ieee80211_frame_min *, uint16_t keyix,
362		const char *func, int line);
363struct ieee80211_node *ieee80211_find_txnode_debug(struct ieee80211vap *,
364		const uint8_t *,
365		const char *func, int line);
366#define	ieee80211_free_node(ni) \
367	ieee80211_free_node_debug(ni, __func__, __LINE__)
368#define	ieee80211_find_node_locked(nt, mac) \
369	ieee80211_find_node_locked_debug(nt, mac, __func__, __LINE__)
370#define	ieee80211_find_node(nt, mac) \
371	ieee80211_find_node_debug(nt, mac, __func__, __LINE__)
372#define	ieee80211_find_vap_node_locked(nt, vap, mac) \
373	ieee80211_find_vap_node_locked_debug(nt, vap, mac, __func__, __LINE__)
374#define	ieee80211_find_vap_node(nt, vap, mac) \
375	ieee80211_find_vap_node_debug(nt, vap, mac, __func__, __LINE__)
376#define	ieee80211_find_rxnode(ic, wh) \
377	ieee80211_find_rxnode_debug(ic, wh, __func__, __LINE__)
378#define	ieee80211_find_rxnode_withkey(ic, wh, keyix) \
379	ieee80211_find_rxnode_withkey_debug(ic, wh, keyix, __func__, __LINE__)
380#define	ieee80211_find_txnode(vap, mac) \
381	ieee80211_find_txnode_debug(vap, mac, __func__, __LINE__)
382#else
383void	ieee80211_free_node(struct ieee80211_node *);
384struct ieee80211_node *ieee80211_find_node_locked(struct ieee80211_node_table *,
385		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
386struct ieee80211_node *ieee80211_find_node(struct ieee80211_node_table *,
387		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
388struct ieee80211_node *ieee80211_find_vap_node_locked(
389		struct ieee80211_node_table *, const struct ieee80211vap *,
390		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
391struct ieee80211_node *ieee80211_find_vap_node(
392		struct ieee80211_node_table *, const struct ieee80211vap *,
393		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
394struct ieee80211_node * ieee80211_find_rxnode(struct ieee80211com *,
395		const struct ieee80211_frame_min *);
396struct ieee80211_node * ieee80211_find_rxnode_withkey(struct ieee80211com *,
397		const struct ieee80211_frame_min *, uint16_t keyix);
398struct ieee80211_node *ieee80211_find_txnode(struct ieee80211vap *,
399		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
400#endif
401int	ieee80211_node_delucastkey(struct ieee80211_node *);
402void	ieee80211_node_timeout(void *arg);
403
404typedef void ieee80211_iter_func(void *, struct ieee80211_node *);
405void	ieee80211_iterate_nodes(struct ieee80211_node_table *,
406		ieee80211_iter_func *, void *);
407
408void	ieee80211_notify_erp(struct ieee80211com *);
409void	ieee80211_dump_node(struct ieee80211_node_table *,
410		struct ieee80211_node *);
411void	ieee80211_dump_nodes(struct ieee80211_node_table *);
412
413struct ieee80211_node *ieee80211_fakeup_adhoc_node(struct ieee80211vap *,
414		const uint8_t macaddr[IEEE80211_ADDR_LEN]);
415struct ieee80211_scanparams;
416void	ieee80211_init_neighbor(struct ieee80211_node *,
417		const struct ieee80211_frame *,
418		const struct ieee80211_scanparams *);
419struct ieee80211_node *ieee80211_add_neighbor(struct ieee80211vap *,
420		const struct ieee80211_frame *,
421		const struct ieee80211_scanparams *);
422void	ieee80211_node_join(struct ieee80211_node *,int);
423void	ieee80211_node_leave(struct ieee80211_node *);
424int8_t	ieee80211_getrssi(struct ieee80211vap *);
425void	ieee80211_getsignal(struct ieee80211vap *, int8_t *, int8_t *);
426#endif /* _NET80211_IEEE80211_NODE_H_ */
427