xref: /openbsd-src/sys/net80211/ieee80211_node.h (revision 1a8dbaac879b9f3335ad7fb25429ce63ac1d6bac)
1 /*	$OpenBSD: ieee80211_node.h,v 1.87 2020/07/21 08:38:59 stsp 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 	RSNA_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 
230 	/*
231 	 * Counter for frames forced to wait in the reordering buffer
232 	 * due to a leading gap caused by one or more missing frames.
233 	 */
234 	int			ba_gapwait;
235 
236 	/* Counter for consecutive frames which missed the BA window. */
237 	int			ba_winmiss;
238 	/* Sequence number of previous frame which missed the BA window. */
239 	uint16_t		ba_missedsn;
240 	/* Window moves forward after this many frames have missed it. */
241 #define IEEE80211_BA_MAX_WINMISS	8
242 
243 	uint8_t			ba_token;
244 };
245 
246 /*
247  * Node specific information.  Note that drivers are expected
248  * to derive from this structure to add device-specific per-node
249  * state.  This is done by overriding the ic_node_* methods in
250  * the ieee80211com structure.
251  */
252 struct ieee80211_node {
253 	RBT_ENTRY(ieee80211_node)	ni_node;
254 
255 	struct ieee80211com	*ni_ic;		/* back-pointer */
256 
257 	u_int			ni_refcnt;
258 	u_int			ni_scangen;	/* gen# for timeout scan */
259 
260 	/* hardware */
261 	u_int32_t		ni_rstamp;	/* recv timestamp */
262 	u_int8_t		ni_rssi;	/* recv ssi */
263 
264 	/* header */
265 	u_int8_t		ni_macaddr[IEEE80211_ADDR_LEN];
266 	u_int8_t		ni_bssid[IEEE80211_ADDR_LEN];
267 
268 	/* beacon, probe response */
269 	u_int8_t		ni_tstamp[8];	/* from last rcv'd beacon */
270 	u_int16_t		ni_intval;	/* beacon interval */
271 	u_int16_t		ni_capinfo;	/* capabilities */
272 	u_int8_t		ni_esslen;
273 	u_int8_t		ni_essid[IEEE80211_NWID_LEN];
274 	struct ieee80211_rateset ni_rates;	/* negotiated rate set */
275 	u_int8_t		*ni_country;	/* country information XXX */
276 	struct ieee80211_channel *ni_chan;
277 	u_int8_t		ni_erp;		/* 11g only */
278 
279 	/* DTIM and contention free period (CFP) */
280 	u_int8_t		ni_dtimcount;
281 	u_int8_t		ni_dtimperiod;
282 #ifdef notyet
283 	u_int8_t		ni_cfpperiod;	/* # of DTIMs between CFPs */
284 	u_int16_t		ni_cfpduremain;	/* remaining cfp duration */
285 	u_int16_t		ni_cfpmaxduration;/* max CFP duration in TU */
286 	u_int16_t		ni_nextdtim;	/* time to next DTIM */
287 	u_int16_t		ni_timoffset;
288 #endif
289 
290 	/* power saving mode */
291 	u_int8_t		ni_pwrsave;
292 	struct mbuf_queue	ni_savedq;	/* packets queued for pspoll */
293 
294 	/* RSN */
295 	struct timeout		ni_eapol_to;
296 	u_int			ni_rsn_state;
297 	u_int			ni_rsn_supp_state;
298 	u_int			ni_rsn_gstate;
299 	u_int			ni_rsn_retries;
300 	u_int			ni_supported_rsnprotos;
301 	u_int			ni_rsnprotos;
302 	u_int			ni_supported_rsnakms;
303 	u_int			ni_rsnakms;
304 	u_int			ni_rsnciphers;
305 	enum ieee80211_cipher	ni_rsngroupcipher;
306 	enum ieee80211_cipher	ni_rsngroupmgmtcipher;
307 	u_int16_t		ni_rsncaps;
308 	enum ieee80211_cipher	ni_rsncipher;
309 	u_int8_t		ni_nonce[EAPOL_KEY_NONCE_LEN];
310 	u_int8_t		ni_pmk[IEEE80211_PMK_LEN];
311 	u_int8_t		ni_pmkid[IEEE80211_PMKID_LEN];
312 	u_int64_t		ni_replaycnt;
313 	u_int8_t		ni_replaycnt_ok;
314 	u_int64_t		ni_reqreplaycnt;
315 	u_int8_t		ni_reqreplaycnt_ok;
316 	u_int8_t		*ni_rsnie;
317 	struct ieee80211_key	ni_pairwise_key;
318 	struct ieee80211_ptk	ni_ptk;
319 	u_int8_t		ni_key_count;
320 	int			ni_port_valid;
321 
322 	/* SA Query */
323 	u_int16_t		ni_sa_query_trid;
324 	struct timeout		ni_sa_query_to;
325 	int			ni_sa_query_count;
326 
327 	/* HT capabilities */
328 	uint16_t		ni_htcaps;
329 	uint8_t			ni_ampdu_param;
330 	uint8_t			ni_rxmcs[howmany(80,NBBY)];
331 	uint16_t		ni_max_rxrate;	/* in Mb/s, 0 <= rate <= 1023 */
332 	uint8_t			ni_tx_mcs_set;
333 	uint16_t		ni_htxcaps;
334 	uint32_t		ni_txbfcaps;
335 	uint8_t			ni_aselcaps;
336 
337 	/* HT operation */
338 	uint8_t			ni_primary_chan; /* XXX corresponds to ni_chan */
339 	uint8_t			ni_htop0;
340 	uint16_t		ni_htop1;
341 	uint16_t		ni_htop2;
342 	uint8_t			ni_basic_mcs[howmany(128,NBBY)];
343 
344 	/* Timeout handlers which trigger Tx Block Ack negotiation. */
345 	struct timeout		ni_addba_req_to[IEEE80211_NUM_TID];
346 	int			ni_addba_req_intval[IEEE80211_NUM_TID];
347 #define IEEE80211_ADDBA_REQ_INTVAL_MAX 30	/* in seconds */
348 
349 	/* Block Ack records */
350 	struct ieee80211_tx_ba	ni_tx_ba[IEEE80211_NUM_TID];
351 	struct ieee80211_rx_ba	ni_rx_ba[IEEE80211_NUM_TID];
352 
353 	int			ni_txmcs;	/* current MCS used for TX */
354 	int			ni_vht_ss;	/* VHT # spatial streams */
355 
356 	/* others */
357 	u_int16_t		ni_associd;	/* assoc response */
358 	u_int16_t		ni_txseq;	/* seq to be transmitted */
359 	u_int16_t		ni_rxseq;	/* seq previous received */
360 	u_int16_t		ni_qos_txseqs[IEEE80211_NUM_TID];
361 	u_int16_t		ni_qos_rxseqs[IEEE80211_NUM_TID];
362 	int			ni_fails;	/* failure count to associate */
363 	uint32_t		ni_assoc_fail;	/* assoc failure reasons */
364 #define IEEE80211_NODE_ASSOCFAIL_CHAN		0x01
365 #define IEEE80211_NODE_ASSOCFAIL_IBSS		0x02
366 #define IEEE80211_NODE_ASSOCFAIL_PRIVACY	0x04
367 #define IEEE80211_NODE_ASSOCFAIL_BASIC_RATE	0x08
368 #define IEEE80211_NODE_ASSOCFAIL_ESSID		0x10
369 #define IEEE80211_NODE_ASSOCFAIL_BSSID		0x20
370 #define IEEE80211_NODE_ASSOCFAIL_WPA_PROTO	0x40
371 #define IEEE80211_NODE_ASSOCFAIL_WPA_KEY	0x80
372 
373 	int			ni_inact;	/* inactivity mark count */
374 	int			ni_txrate;	/* index to ni_rates[] */
375 	int			ni_state;
376 
377 	u_int32_t		ni_flags;	/* special-purpose state */
378 #define IEEE80211_NODE_ERP		0x0001
379 #define IEEE80211_NODE_QOS		0x0002
380 #define IEEE80211_NODE_REKEY		0x0004	/* GTK rekeying in progress */
381 #define IEEE80211_NODE_RXPROT		0x0008	/* RX protection ON */
382 #define IEEE80211_NODE_TXPROT		0x0010	/* TX protection ON */
383 #define IEEE80211_NODE_TXRXPROT	\
384 	(IEEE80211_NODE_TXPROT | IEEE80211_NODE_RXPROT)
385 #define IEEE80211_NODE_RXMGMTPROT	0x0020	/* RX MMPDU protection ON */
386 #define IEEE80211_NODE_TXMGMTPROT	0x0040	/* TX MMPDU protection ON */
387 #define IEEE80211_NODE_MFP		0x0080	/* MFP negotiated */
388 #define IEEE80211_NODE_PMK		0x0100	/* ni_pmk set */
389 #define IEEE80211_NODE_PMKID		0x0200	/* ni_pmkid set */
390 #define IEEE80211_NODE_HT		0x0400	/* HT negotiated */
391 #define IEEE80211_NODE_SA_QUERY		0x0800	/* SA Query in progress */
392 #define IEEE80211_NODE_SA_QUERY_FAILED	0x1000	/* last SA Query failed */
393 #define IEEE80211_NODE_RSN_NEW_PTK	0x2000	/* expecting a new PTK */
394 #define IEEE80211_NODE_HT_SGI20		0x4000	/* SGI on 20 MHz negotiated */
395 #define IEEE80211_NODE_HT_SGI40		0x8000	/* SGI on 40 MHz negotiated */
396 #define IEEE80211_NODE_VHT		0x10000	/* VHT negotiated */
397 #define IEEE80211_NODE_HTCAP		0x20000	/* claims to support HT */
398 
399 	/* If not NULL, this function gets called when ni_refcnt hits zero. */
400 	void			(*ni_unref_cb)(struct ieee80211com *,
401 					struct ieee80211_node *);
402 	void *			ni_unref_arg;
403 	size_t 			ni_unref_arg_size;
404 };
405 
406 RBT_HEAD(ieee80211_tree, ieee80211_node);
407 
408 struct ieee80211_ess_rbt {
409 	RBT_ENTRY(ieee80211_ess_rbt)	 ess_rbt;
410 	u_int8_t			 esslen;
411 	u_int8_t			 essid[IEEE80211_NWID_LEN];
412 	struct ieee80211_node		*ni2;
413 	struct ieee80211_node		*ni5;
414 	struct ieee80211_node		*ni;
415 };
416 
417 RBT_HEAD(ieee80211_ess_tree, ieee80211_ess_rbt);
418 
419 static inline void
420 ieee80211_node_incref(struct ieee80211_node *ni)
421 {
422 	int		s;
423 
424 	s = splnet();
425 	ni->ni_refcnt++;
426 	splx(s);
427 }
428 
429 static inline u_int
430 ieee80211_node_decref(struct ieee80211_node *ni)
431 {
432 	u_int		refcnt;
433 	int 		s;
434 
435 	s = splnet();
436 	refcnt = --ni->ni_refcnt;
437 	splx(s);
438 	return refcnt;
439 }
440 
441 static inline struct ieee80211_node *
442 ieee80211_ref_node(struct ieee80211_node *ni)
443 {
444 	ieee80211_node_incref(ni);
445 	return ni;
446 }
447 
448 static inline void
449 ieee80211_unref_node(struct ieee80211_node **ni)
450 {
451 	ieee80211_node_decref(*ni);
452 	*ni = NULL;			/* guard against use */
453 }
454 
455 /*
456  * Check if the peer supports HT.
457  * Require a HT capabilities IE and at least one of the mandatory MCS.
458  * MCS 0-7 are mandatory but some APs have particular MCS disabled.
459  */
460 static inline int
461 ieee80211_node_supports_ht(struct ieee80211_node *ni)
462 {
463 	return ((ni->ni_flags & IEEE80211_NODE_HTCAP) &&
464 	    ni->ni_rxmcs[0] & 0xff);
465 }
466 
467 /* Check if the peer supports HT short guard interval (SGI) on 20 MHz. */
468 static inline int
469 ieee80211_node_supports_ht_sgi20(struct ieee80211_node *ni)
470 {
471 	return ieee80211_node_supports_ht(ni) &&
472 	    (ni->ni_htcaps & IEEE80211_HTCAP_SGI20);
473 }
474 
475 /* Check if the peer supports HT short guard interval (SGI) on 40 MHz. */
476 static inline int
477 ieee80211_node_supports_ht_sgi40(struct ieee80211_node *ni)
478 {
479 	return ieee80211_node_supports_ht(ni) &&
480 	    (ni->ni_htcaps & IEEE80211_HTCAP_SGI40);
481 }
482 
483 struct ieee80211com;
484 
485 typedef void ieee80211_iter_func(void *, struct ieee80211_node *);
486 
487 void ieee80211_node_attach(struct ifnet *);
488 void ieee80211_node_lateattach(struct ifnet *);
489 void ieee80211_node_detach(struct ifnet *);
490 
491 void ieee80211_begin_scan(struct ifnet *);
492 void ieee80211_next_scan(struct ifnet *);
493 void ieee80211_end_scan(struct ifnet *);
494 void ieee80211_reset_scan(struct ifnet *);
495 struct ieee80211_node *ieee80211_alloc_node(struct ieee80211com *,
496 		const u_int8_t *);
497 struct ieee80211_node *ieee80211_dup_bss(struct ieee80211com *,
498 		const u_int8_t *);
499 struct ieee80211_node *ieee80211_find_node(struct ieee80211com *,
500 		const u_int8_t *);
501 void ieee80211_ba_del(struct ieee80211_node *);
502 struct ieee80211_node *ieee80211_find_rxnode(struct ieee80211com *,
503 		const struct ieee80211_frame *);
504 struct ieee80211_node *ieee80211_find_txnode(struct ieee80211com *,
505 		const u_int8_t *);
506 struct ieee80211_node *
507 		ieee80211_find_node_for_beacon(struct ieee80211com *,
508 		const u_int8_t *, const struct ieee80211_channel *,
509 		const char *, u_int8_t);
510 void ieee80211_release_node(struct ieee80211com *,
511 		struct ieee80211_node *);
512 void ieee80211_node_cleanup(struct ieee80211com *, struct ieee80211_node *);
513 void ieee80211_free_allnodes(struct ieee80211com *, int);
514 void ieee80211_iterate_nodes(struct ieee80211com *,
515 		ieee80211_iter_func *, void *);
516 void ieee80211_clean_cached(struct ieee80211com *);
517 void ieee80211_clean_nodes(struct ieee80211com *, int);
518 void ieee80211_setup_htcaps(struct ieee80211_node *, const uint8_t *,
519     uint8_t);
520 void ieee80211_clear_htcaps(struct ieee80211_node *);
521 int ieee80211_setup_htop(struct ieee80211_node *, const uint8_t *,
522     uint8_t, int);
523 int ieee80211_setup_rates(struct ieee80211com *,
524 	    struct ieee80211_node *, const u_int8_t *, const u_int8_t *, int);
525 void ieee80211_node_trigger_addba_req(struct ieee80211_node *, int);
526 int ieee80211_iserp_sta(const struct ieee80211_node *);
527 void ieee80211_count_longslotsta(void *, struct ieee80211_node *);
528 void ieee80211_count_nonerpsta(void *, struct ieee80211_node *);
529 void ieee80211_count_pssta(void *, struct ieee80211_node *);
530 void ieee80211_count_rekeysta(void *, struct ieee80211_node *);
531 void ieee80211_node_join(struct ieee80211com *,
532 		struct ieee80211_node *, int);
533 void ieee80211_node_leave(struct ieee80211com *,
534 		struct ieee80211_node *);
535 int ieee80211_match_bss(struct ieee80211com *, struct ieee80211_node *, int);
536 struct ieee80211_node *ieee80211_node_choose_bss(struct ieee80211com *, int,
537 		struct ieee80211_node **);
538 void ieee80211_node_join_bss(struct ieee80211com *, struct ieee80211_node *);
539 void ieee80211_create_ibss(struct ieee80211com* ,
540 		struct ieee80211_channel *);
541 void ieee80211_notify_dtim(struct ieee80211com *);
542 void ieee80211_set_tim(struct ieee80211com *, int, int);
543 void ieee80211_free_node(struct ieee80211com *, struct ieee80211_node *);
544 
545 int ieee80211_node_cmp(const struct ieee80211_node *,
546 		const struct ieee80211_node *);
547 int ieee80211_ess_cmp(const struct ieee80211_ess_rbt *,
548 		const struct ieee80211_ess_rbt *);
549 RBT_PROTOTYPE(ieee80211_tree, ieee80211_node, ni_node, ieee80211_node_cmp);
550 RBT_PROTOTYPE(ieee80211_ess_tree, ieee80211_ess_rbt, ess_rbt, ieee80211_ess_cmp);
551 
552 #endif /* _NET80211_IEEE80211_NODE_H_ */
553