xref: /openbsd-src/sys/net80211/ieee80211_node.h (revision 99fd087599a8791921855f21bd7e36130f39aadc)
1 /*	$OpenBSD: ieee80211_node.h,v 1.85 2020/01/15 09:34:27 phessler Exp $	*/
2 /*	$NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $	*/
3 
4 /*-
5  * Copyright (c) 2001 Atsushi Onoe
6  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  * $FreeBSD: src/sys/net80211/ieee80211_node.h,v 1.10 2004/04/05 22:10:26 sam Exp $
32  */
33 #ifndef _NET80211_IEEE80211_NODE_H_
34 #define _NET80211_IEEE80211_NODE_H_
35 
36 #include <sys/tree.h>
37 
38 #define	IEEE80211_PSCAN_WAIT	5		/* passive scan wait */
39 #define	IEEE80211_TRANS_WAIT	5		/* transition wait */
40 #define	IEEE80211_INACT_WAIT	5		/* inactivity timer interval */
41 #define	IEEE80211_INACT_MAX	(300/IEEE80211_INACT_WAIT)
42 #define	IEEE80211_CACHE_SIZE	512
43 #define	IEEE80211_CACHE_WAIT	30
44 #define	IEEE80211_INACT_SCAN	10		/* for station mode */
45 
46 struct ieee80211_rateset {
47 	u_int8_t		rs_nrates;
48 	u_int8_t		rs_rates[IEEE80211_RATE_MAXSIZE];
49 };
50 
51 extern const struct ieee80211_rateset ieee80211_std_rateset_11a;
52 extern const struct ieee80211_rateset ieee80211_std_rateset_11b;
53 extern const struct ieee80211_rateset ieee80211_std_rateset_11g;
54 
55 /* Index into ieee80211_std_rateset_11n[] array. */
56 #define IEEE80211_HT_RATESET_SISO	0
57 #define IEEE80211_HT_RATESET_SISO_SGI	1
58 #define IEEE80211_HT_RATESET_MIMO2	2
59 #define IEEE80211_HT_RATESET_MIMO2_SGI	3
60 #define IEEE80211_HT_RATESET_MIMO3	4
61 #define IEEE80211_HT_RATESET_MIMO3_SGI	5
62 #define IEEE80211_HT_RATESET_MIMO4	6
63 #define IEEE80211_HT_RATESET_MIMO4_SGI	7
64 #define IEEE80211_HT_NUM_RATESETS	8
65 
66 /* Maximum number of rates in a HT rateset. */
67 #define IEEE80211_HT_RATESET_MAX_NRATES	8
68 
69 /* Number of MCS indices represented by struct ieee80211_ht_rateset. */
70 #define IEEE80211_HT_RATESET_NUM_MCS 32
71 
72 struct ieee80211_ht_rateset {
73 	uint32_t nrates;
74 	uint32_t rates[IEEE80211_HT_RATESET_MAX_NRATES]; /* 500 kbit/s units */
75 
76 	/*
77 	 * This bitmask can only express MCS 0 - MCS 31.
78 	 * IEEE 802.11 defined 77 HT MCS in total but common hardware
79 	 * implementations tend to support MCS index 0 through 31 only.
80 	 */
81 	uint32_t mcs_mask;
82 
83 	/* Range of MCS indices represented in this rateset. */
84 	int min_mcs;
85 	int max_mcs;
86 
87 	int sgi;
88 };
89 
90 extern const struct ieee80211_ht_rateset ieee80211_std_ratesets_11n[];
91 
92 /* Index into ieee80211_std_rateset_11ac[] array. */
93 #define IEEE80211_VHT_RATESET_SISO		0
94 #define IEEE80211_VHT_RATESET_SISO_SGI		1
95 #define IEEE80211_VHT_RATESET_MIMO2		2
96 #define IEEE80211_VHT_RATESET_MIMO2_SGI		3
97 #define IEEE80211_VHT_RATESET_SISO_40		4
98 #define IEEE80211_VHT_RATESET_SISO_40_SGI	5
99 #define IEEE80211_VHT_RATESET_MIMO2_40		6
100 #define IEEE80211_VHT_RATESET_MIMO2_40_SGI	7
101 #define IEEE80211_VHT_RATESET_SISO_80		8
102 #define IEEE80211_VHT_RATESET_SISO_80_SGI	9
103 #define IEEE80211_VHT_RATESET_MIMO2_80		10
104 #define IEEE80211_VHT_RATESET_MIMO2_80_SGI	11
105 #define IEEE80211_VHT_NUM_RATESETS		12
106 
107 /* Maximum number of rates in a HT rateset. */
108 #define IEEE80211_VHT_RATESET_MAX_NRATES	10
109 
110 struct ieee80211_vht_rateset {
111 	uint32_t nrates;
112 	uint32_t rates[IEEE80211_VHT_RATESET_MAX_NRATES]; /* 500 kbit/s units */
113 
114 	/* Number of spatial streams used by rates in this rateset. */
115 	int num_ss;
116 
117 	int sgi;
118 };
119 
120 extern const struct ieee80211_vht_rateset ieee80211_std_ratesets_11ac[];
121 
122 enum ieee80211_node_state {
123 	IEEE80211_STA_CACHE,	/* cached node */
124 	IEEE80211_STA_BSS,	/* ic->ic_bss, the network we joined */
125 	IEEE80211_STA_AUTH,	/* successfully authenticated */
126 	IEEE80211_STA_ASSOC,	/* successfully associated */
127 	IEEE80211_STA_COLLECT	/* This node remains in the cache while
128 				 * the driver sends a de-auth message;
129 				 * afterward it should be freed to make room
130 				 * for a new node.
131 				 */
132 };
133 
134 #define	ieee80211_node_newstate(__ni, __state)	\
135 	do {					\
136 		(__ni)->ni_state = (__state);	\
137 	} while (0)
138 
139 enum ieee80211_node_psstate {
140 	IEEE80211_PS_AWAKE,
141 	IEEE80211_PS_DOZE
142 };
143 
144 #define	IEEE80211_PS_MAX_QUEUE	50	/* maximum saved packets */
145 
146 /* Authenticator state machine: 4-Way Handshake (see 8.5.6.1.1) */
147 enum {
148 	RSNA_INITIALIZE,
149 	RSNA_AUTHENTICATION,
150 	RSNA_AUTHENTICATION_2,
151 	RSNA_INITPMK,
152 	RSNA_INITPSK,
153 	RSNA_PTKSTART,
154 	RSNA_PTKCALCNEGOTIATING,
155 	RSNA_PTKCALCNEGOTIATING_2,
156 	RSNA_PTKINITNEGOTIATING,
157 	RSNA_PTKINITDONE,
158 	RSNA_DISCONNECT,
159 	RSNA_DISCONNECTED
160 };
161 
162 /* Authenticator state machine: Group Key Handshake (see 8.5.6.1.2) */
163 enum {
164 	RSNA_IDLE,
165 	RSNA_REKEYNEGOTIATING,
166 	RSNA_REKEYESTABLISHED,
167 	RSNA_KEYERROR
168 };
169 
170 /* Supplicant state machine: 4-Way Handshake (not documented in standard) */
171 enum {
172 	RSNA_SUPP_INITIALIZE,		/* not expecting any messages */
173 	RSNA_SUPP_PTKSTART,		/* awaiting handshake message 1 */
174 	RSNA_SUPP_PTKNEGOTIATING,	/* got message 1 and derived PTK */
175 	RNSA_SUPP_PTKDONE		/* got message 3 and authenticated AP */
176 };
177 
178 struct ieee80211_rxinfo {
179 	u_int32_t		rxi_flags;
180 	u_int32_t		rxi_tstamp;
181 	int			rxi_rssi;
182 };
183 #define IEEE80211_RXI_HWDEC		0x00000001
184 #define IEEE80211_RXI_AMPDU_DONE	0x00000002
185 
186 /* Block Acknowledgement Record */
187 struct ieee80211_tx_ba {
188 	struct ieee80211_node	*ba_ni;	/* backpointer for callbacks */
189 	struct timeout		ba_to;
190 	int			ba_timeout_val;
191 	int			ba_state;
192 #define IEEE80211_BA_INIT	0
193 #define IEEE80211_BA_REQUESTED	1
194 #define IEEE80211_BA_AGREED	2
195 
196 	/* ADDBA parameter set field for this BA agreement. */
197 	u_int16_t		ba_params;
198 
199 	/* These values are IEEE802.11 frame sequence numbers (0x0-0xfff) */
200 	u_int16_t		ba_winstart;
201 	u_int16_t		ba_winend;
202 
203 	/* Number of A-MPDU subframes in reorder buffer. */
204 	u_int16_t		ba_winsize;
205 #define IEEE80211_BA_MAX_WINSZ	64	/* corresponds to maximum ADDBA BUFSZ */
206 
207 	u_int8_t		ba_token;
208 
209 	/* Bitmap for ACK'd frames in the current BA window. */
210 	uint64_t		ba_bitmap;
211 };
212 
213 struct ieee80211_rx_ba {
214 	struct ieee80211_node	*ba_ni;	/* backpointer for callbacks */
215 	struct {
216 		struct mbuf		*m;
217 		struct ieee80211_rxinfo	rxi;
218 	}			*ba_buf;
219 	struct timeout		ba_to;
220 	int			ba_timeout_val;
221 	int			ba_state;
222 	u_int16_t		ba_params;
223 	u_int16_t		ba_winstart;
224 	u_int16_t		ba_winend;
225 	u_int16_t		ba_winsize;
226 	u_int16_t		ba_head;
227 	struct timeout		ba_gap_to;
228 #define IEEE80211_BA_GAP_TIMEOUT	300 /* msec */
229 	/* Counter for consecutive frames which missed the BA window. */
230 	int			ba_winmiss;
231 	/* Sequence number of previous frame which missed the BA window. */
232 	uint16_t		ba_missedsn;
233 	/* Window moves forward after this many frames have missed it. */
234 #define IEEE80211_BA_MAX_WINMISS	8
235 
236 	uint8_t			ba_token;
237 };
238 
239 /*
240  * Node specific information.  Note that drivers are expected
241  * to derive from this structure to add device-specific per-node
242  * state.  This is done by overriding the ic_node_* methods in
243  * the ieee80211com structure.
244  */
245 struct ieee80211_node {
246 	RBT_ENTRY(ieee80211_node)	ni_node;
247 
248 	struct ieee80211com	*ni_ic;		/* back-pointer */
249 
250 	u_int			ni_refcnt;
251 	u_int			ni_scangen;	/* gen# for timeout scan */
252 
253 	/* hardware */
254 	u_int32_t		ni_rstamp;	/* recv timestamp */
255 	u_int8_t		ni_rssi;	/* recv ssi */
256 
257 	/* header */
258 	u_int8_t		ni_macaddr[IEEE80211_ADDR_LEN];
259 	u_int8_t		ni_bssid[IEEE80211_ADDR_LEN];
260 
261 	/* beacon, probe response */
262 	u_int8_t		ni_tstamp[8];	/* from last rcv'd beacon */
263 	u_int16_t		ni_intval;	/* beacon interval */
264 	u_int16_t		ni_capinfo;	/* capabilities */
265 	u_int8_t		ni_esslen;
266 	u_int8_t		ni_essid[IEEE80211_NWID_LEN];
267 	struct ieee80211_rateset ni_rates;	/* negotiated rate set */
268 	u_int8_t		*ni_country;	/* country information XXX */
269 	struct ieee80211_channel *ni_chan;
270 	u_int8_t		ni_erp;		/* 11g only */
271 
272 	/* DTIM and contention free period (CFP) */
273 	u_int8_t		ni_dtimcount;
274 	u_int8_t		ni_dtimperiod;
275 #ifdef notyet
276 	u_int8_t		ni_cfpperiod;	/* # of DTIMs between CFPs */
277 	u_int16_t		ni_cfpduremain;	/* remaining cfp duration */
278 	u_int16_t		ni_cfpmaxduration;/* max CFP duration in TU */
279 	u_int16_t		ni_nextdtim;	/* time to next DTIM */
280 	u_int16_t		ni_timoffset;
281 #endif
282 
283 	/* power saving mode */
284 	u_int8_t		ni_pwrsave;
285 	struct mbuf_queue	ni_savedq;	/* packets queued for pspoll */
286 
287 	/* RSN */
288 	struct timeout		ni_eapol_to;
289 	u_int			ni_rsn_state;
290 	u_int			ni_rsn_supp_state;
291 	u_int			ni_rsn_gstate;
292 	u_int			ni_rsn_retries;
293 	u_int			ni_supported_rsnprotos;
294 	u_int			ni_rsnprotos;
295 	u_int			ni_supported_rsnakms;
296 	u_int			ni_rsnakms;
297 	u_int			ni_rsnciphers;
298 	enum ieee80211_cipher	ni_rsngroupcipher;
299 	enum ieee80211_cipher	ni_rsngroupmgmtcipher;
300 	u_int16_t		ni_rsncaps;
301 	enum ieee80211_cipher	ni_rsncipher;
302 	u_int8_t		ni_nonce[EAPOL_KEY_NONCE_LEN];
303 	u_int8_t		ni_pmk[IEEE80211_PMK_LEN];
304 	u_int8_t		ni_pmkid[IEEE80211_PMKID_LEN];
305 	u_int64_t		ni_replaycnt;
306 	u_int8_t		ni_replaycnt_ok;
307 	u_int64_t		ni_reqreplaycnt;
308 	u_int8_t		ni_reqreplaycnt_ok;
309 	u_int8_t		*ni_rsnie;
310 	struct ieee80211_key	ni_pairwise_key;
311 	struct ieee80211_ptk	ni_ptk;
312 	u_int8_t		ni_key_count;
313 	int			ni_port_valid;
314 
315 	/* SA Query */
316 	u_int16_t		ni_sa_query_trid;
317 	struct timeout		ni_sa_query_to;
318 	int			ni_sa_query_count;
319 
320 	/* HT capabilities */
321 	uint16_t		ni_htcaps;
322 	uint8_t			ni_ampdu_param;
323 	uint8_t			ni_rxmcs[howmany(80,NBBY)];
324 	uint16_t		ni_max_rxrate;	/* in Mb/s, 0 <= rate <= 1023 */
325 	uint8_t			ni_tx_mcs_set;
326 	uint16_t		ni_htxcaps;
327 	uint32_t		ni_txbfcaps;
328 	uint8_t			ni_aselcaps;
329 
330 	/* HT operation */
331 	uint8_t			ni_primary_chan; /* XXX corresponds to ni_chan */
332 	uint8_t			ni_htop0;
333 	uint16_t		ni_htop1;
334 	uint16_t		ni_htop2;
335 	uint8_t			ni_basic_mcs[howmany(128,NBBY)];
336 
337 	/* Timeout handlers which trigger Tx Block Ack negotiation. */
338 	struct timeout		ni_addba_req_to[IEEE80211_NUM_TID];
339 	int			ni_addba_req_intval[IEEE80211_NUM_TID];
340 #define IEEE80211_ADDBA_REQ_INTVAL_MAX 30	/* in seconds */
341 
342 	/* Block Ack records */
343 	struct ieee80211_tx_ba	ni_tx_ba[IEEE80211_NUM_TID];
344 	struct ieee80211_rx_ba	ni_rx_ba[IEEE80211_NUM_TID];
345 
346 	int			ni_txmcs;	/* current MCS used for TX */
347 	int			ni_vht_ss;	/* VHT # spatial streams */
348 
349 	/* others */
350 	u_int16_t		ni_associd;	/* assoc response */
351 	u_int16_t		ni_txseq;	/* seq to be transmitted */
352 	u_int16_t		ni_rxseq;	/* seq previous received */
353 	u_int16_t		ni_qos_txseqs[IEEE80211_NUM_TID];
354 	u_int16_t		ni_qos_rxseqs[IEEE80211_NUM_TID];
355 	int			ni_fails;	/* failure count to associate */
356 	uint32_t		ni_assoc_fail;	/* assoc failure reasons */
357 #define IEEE80211_NODE_ASSOCFAIL_CHAN		0x01
358 #define IEEE80211_NODE_ASSOCFAIL_IBSS		0x02
359 #define IEEE80211_NODE_ASSOCFAIL_PRIVACY	0x04
360 #define IEEE80211_NODE_ASSOCFAIL_BASIC_RATE	0x08
361 #define IEEE80211_NODE_ASSOCFAIL_ESSID		0x10
362 #define IEEE80211_NODE_ASSOCFAIL_BSSID		0x20
363 #define IEEE80211_NODE_ASSOCFAIL_WPA_PROTO	0x40
364 #define IEEE80211_NODE_ASSOCFAIL_WPA_KEY	0x80
365 
366 	int			ni_inact;	/* inactivity mark count */
367 	int			ni_txrate;	/* index to ni_rates[] */
368 	int			ni_state;
369 
370 	u_int32_t		ni_flags;	/* special-purpose state */
371 #define IEEE80211_NODE_ERP		0x0001
372 #define IEEE80211_NODE_QOS		0x0002
373 #define IEEE80211_NODE_REKEY		0x0004	/* GTK rekeying in progress */
374 #define IEEE80211_NODE_RXPROT		0x0008	/* RX protection ON */
375 #define IEEE80211_NODE_TXPROT		0x0010	/* TX protection ON */
376 #define IEEE80211_NODE_TXRXPROT	\
377 	(IEEE80211_NODE_TXPROT | IEEE80211_NODE_RXPROT)
378 #define IEEE80211_NODE_RXMGMTPROT	0x0020	/* RX MMPDU protection ON */
379 #define IEEE80211_NODE_TXMGMTPROT	0x0040	/* TX MMPDU protection ON */
380 #define IEEE80211_NODE_MFP		0x0080	/* MFP negotiated */
381 #define IEEE80211_NODE_PMK		0x0100	/* ni_pmk set */
382 #define IEEE80211_NODE_PMKID		0x0200	/* ni_pmkid set */
383 #define IEEE80211_NODE_HT		0x0400	/* HT negotiated */
384 #define IEEE80211_NODE_SA_QUERY		0x0800	/* SA Query in progress */
385 #define IEEE80211_NODE_SA_QUERY_FAILED	0x1000	/* last SA Query failed */
386 #define IEEE80211_NODE_RSN_NEW_PTK	0x2000	/* expecting a new PTK */
387 #define IEEE80211_NODE_HT_SGI20		0x4000	/* SGI on 20 MHz negotiated */
388 #define IEEE80211_NODE_HT_SGI40		0x8000	/* SGI on 40 MHz negotiated */
389 #define IEEE80211_NODE_VHT		0x10000	/* VHT negotiated */
390 #define IEEE80211_NODE_HTCAP		0x20000	/* claims to support HT */
391 
392 	/* If not NULL, this function gets called when ni_refcnt hits zero. */
393 	void			(*ni_unref_cb)(struct ieee80211com *,
394 					struct ieee80211_node *);
395 	void *			ni_unref_arg;
396 	size_t 			ni_unref_arg_size;
397 };
398 
399 RBT_HEAD(ieee80211_tree, ieee80211_node);
400 
401 struct ieee80211_ess_rbt {
402 	RBT_ENTRY(ieee80211_ess_rbt)	 ess_rbt;
403 	u_int8_t			 esslen;
404 	u_int8_t			 essid[IEEE80211_NWID_LEN];
405 	struct ieee80211_node		*ni2;
406 	struct ieee80211_node		*ni5;
407 	struct ieee80211_node		*ni;
408 };
409 
410 RBT_HEAD(ieee80211_ess_tree, ieee80211_ess_rbt);
411 
412 static inline void
413 ieee80211_node_incref(struct ieee80211_node *ni)
414 {
415 	int		s;
416 
417 	s = splnet();
418 	ni->ni_refcnt++;
419 	splx(s);
420 }
421 
422 static inline u_int
423 ieee80211_node_decref(struct ieee80211_node *ni)
424 {
425 	u_int		refcnt;
426 	int 		s;
427 
428 	s = splnet();
429 	refcnt = --ni->ni_refcnt;
430 	splx(s);
431 	return refcnt;
432 }
433 
434 static inline struct ieee80211_node *
435 ieee80211_ref_node(struct ieee80211_node *ni)
436 {
437 	ieee80211_node_incref(ni);
438 	return ni;
439 }
440 
441 static inline void
442 ieee80211_unref_node(struct ieee80211_node **ni)
443 {
444 	ieee80211_node_decref(*ni);
445 	*ni = NULL;			/* guard against use */
446 }
447 
448 /*
449  * Check if the peer supports HT.
450  * Require a HT capabilities IE and at least one of the mandatory MCS.
451  * MCS 0-7 are mandatory but some APs have particular MCS disabled.
452  */
453 static inline int
454 ieee80211_node_supports_ht(struct ieee80211_node *ni)
455 {
456 	return ((ni->ni_flags & IEEE80211_NODE_HTCAP) &&
457 	    ni->ni_rxmcs[0] & 0xff);
458 }
459 
460 /* Check if the peer supports HT short guard interval (SGI) on 20 MHz. */
461 static inline int
462 ieee80211_node_supports_ht_sgi20(struct ieee80211_node *ni)
463 {
464 	return ieee80211_node_supports_ht(ni) &&
465 	    (ni->ni_htcaps & IEEE80211_HTCAP_SGI20);
466 }
467 
468 /* Check if the peer supports HT short guard interval (SGI) on 40 MHz. */
469 static inline int
470 ieee80211_node_supports_ht_sgi40(struct ieee80211_node *ni)
471 {
472 	return ieee80211_node_supports_ht(ni) &&
473 	    (ni->ni_htcaps & IEEE80211_HTCAP_SGI40);
474 }
475 
476 struct ieee80211com;
477 
478 typedef void ieee80211_iter_func(void *, struct ieee80211_node *);
479 
480 void ieee80211_node_attach(struct ifnet *);
481 void ieee80211_node_lateattach(struct ifnet *);
482 void ieee80211_node_detach(struct ifnet *);
483 
484 void ieee80211_begin_scan(struct ifnet *);
485 void ieee80211_next_scan(struct ifnet *);
486 void ieee80211_end_scan(struct ifnet *);
487 void ieee80211_reset_scan(struct ifnet *);
488 struct ieee80211_node *ieee80211_alloc_node(struct ieee80211com *,
489 		const u_int8_t *);
490 struct ieee80211_node *ieee80211_dup_bss(struct ieee80211com *,
491 		const u_int8_t *);
492 struct ieee80211_node *ieee80211_find_node(struct ieee80211com *,
493 		const u_int8_t *);
494 void ieee80211_ba_del(struct ieee80211_node *);
495 struct ieee80211_node *ieee80211_find_rxnode(struct ieee80211com *,
496 		const struct ieee80211_frame *);
497 struct ieee80211_node *ieee80211_find_txnode(struct ieee80211com *,
498 		const u_int8_t *);
499 struct ieee80211_node *
500 		ieee80211_find_node_for_beacon(struct ieee80211com *,
501 		const u_int8_t *, const struct ieee80211_channel *,
502 		const char *, u_int8_t);
503 void ieee80211_release_node(struct ieee80211com *,
504 		struct ieee80211_node *);
505 void ieee80211_node_cleanup(struct ieee80211com *, struct ieee80211_node *);
506 void ieee80211_free_allnodes(struct ieee80211com *, int);
507 void ieee80211_iterate_nodes(struct ieee80211com *,
508 		ieee80211_iter_func *, void *);
509 void ieee80211_clean_cached(struct ieee80211com *);
510 void ieee80211_clean_nodes(struct ieee80211com *, int);
511 void ieee80211_setup_htcaps(struct ieee80211_node *, const uint8_t *,
512     uint8_t);
513 void ieee80211_clear_htcaps(struct ieee80211_node *);
514 int ieee80211_setup_htop(struct ieee80211_node *, const uint8_t *,
515     uint8_t, int);
516 int ieee80211_setup_rates(struct ieee80211com *,
517 	    struct ieee80211_node *, const u_int8_t *, const u_int8_t *, int);
518 void ieee80211_node_trigger_addba_req(struct ieee80211_node *, int);
519 int ieee80211_iserp_sta(const struct ieee80211_node *);
520 void ieee80211_count_longslotsta(void *, struct ieee80211_node *);
521 void ieee80211_count_nonerpsta(void *, struct ieee80211_node *);
522 void ieee80211_count_pssta(void *, struct ieee80211_node *);
523 void ieee80211_count_rekeysta(void *, struct ieee80211_node *);
524 void ieee80211_node_join(struct ieee80211com *,
525 		struct ieee80211_node *, int);
526 void ieee80211_node_leave(struct ieee80211com *,
527 		struct ieee80211_node *);
528 int ieee80211_match_bss(struct ieee80211com *, struct ieee80211_node *, int);
529 struct ieee80211_node *ieee80211_node_choose_bss(struct ieee80211com *, int,
530 		struct ieee80211_node **);
531 void ieee80211_node_join_bss(struct ieee80211com *, struct ieee80211_node *);
532 void ieee80211_create_ibss(struct ieee80211com* ,
533 		struct ieee80211_channel *);
534 void ieee80211_notify_dtim(struct ieee80211com *);
535 void ieee80211_set_tim(struct ieee80211com *, int, int);
536 void ieee80211_free_node(struct ieee80211com *, struct ieee80211_node *);
537 
538 int ieee80211_node_cmp(const struct ieee80211_node *,
539 		const struct ieee80211_node *);
540 int ieee80211_ess_cmp(const struct ieee80211_ess_rbt *,
541 		const struct ieee80211_ess_rbt *);
542 RBT_PROTOTYPE(ieee80211_tree, ieee80211_node, ni_node, ieee80211_node_cmp);
543 RBT_PROTOTYPE(ieee80211_ess_tree, ieee80211_ess_rbt, ess_rbt, ieee80211_ess_cmp);
544 
545 #endif /* _NET80211_IEEE80211_NODE_H_ */
546