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