xref: /openbsd/sys/net80211/ieee80211_proto.h (revision a6445c1d)
1 /*	$OpenBSD: ieee80211_proto.h,v 1.39 2009/11/21 18:09:31 damien Exp $	*/
2 /*	$NetBSD: ieee80211_proto.h,v 1.3 2003/10/13 04:23:56 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_proto.h,v 1.4 2003/08/19 22:17:03 sam Exp $
32  */
33 #ifndef _NET80211_IEEE80211_PROTO_H_
34 #define _NET80211_IEEE80211_PROTO_H_
35 
36 /*
37  * 802.11 protocol implementation definitions.
38  */
39 
40 enum ieee80211_state {
41 	IEEE80211_S_INIT	= 0,	/* default state */
42 	IEEE80211_S_SCAN	= 1,	/* scanning */
43 	IEEE80211_S_AUTH	= 2,	/* try to authenticate */
44 	IEEE80211_S_ASSOC	= 3,	/* try to assoc */
45 	IEEE80211_S_RUN		= 4	/* associated */
46 };
47 #define	IEEE80211_S_MAX		(IEEE80211_S_RUN+1)
48 
49 #define	IEEE80211_SEND_MGMT(_ic,_ni,_type,_arg) \
50 	((*(_ic)->ic_send_mgmt)(_ic, _ni, _type, _arg, 0))
51 /* shortcut */
52 #define IEEE80211_SEND_ACTION(_ic,_ni,_categ,_action,_arg) \
53 	((*(_ic)->ic_send_mgmt)(_ic, _ni, IEEE80211_FC0_SUBTYPE_ACTION, \
54 	    (_categ) << 16 | (_action), _arg))
55 
56 extern	const char * const ieee80211_mgt_subtype_name[];
57 extern	const char * const ieee80211_state_name[IEEE80211_S_MAX];
58 extern	const char * const ieee80211_phymode_name[];
59 
60 extern	void ieee80211_proto_attach(struct ifnet *);
61 extern	void ieee80211_proto_detach(struct ifnet *);
62 
63 struct ieee80211_node;
64 struct ieee80211_rxinfo;
65 struct ieee80211_rsnparams;
66 extern	void ieee80211_set_link_state(struct ieee80211com *, int);
67 extern	u_int ieee80211_get_hdrlen(const struct ieee80211_frame *);
68 extern	void ieee80211_input(struct ifnet *, struct mbuf *,
69 		struct ieee80211_node *, struct ieee80211_rxinfo *);
70 extern	int ieee80211_output(struct ifnet *, struct mbuf *, struct sockaddr *,
71 		struct rtentry *);
72 extern	void ieee80211_recv_mgmt(struct ieee80211com *, struct mbuf *,
73 		struct ieee80211_node *, struct ieee80211_rxinfo *, int);
74 extern	int ieee80211_send_mgmt(struct ieee80211com *, struct ieee80211_node *,
75 		int, int, int);
76 extern	void ieee80211_eapol_key_input(struct ieee80211com *, struct mbuf *,
77 		struct ieee80211_node *);
78 extern	struct mbuf *ieee80211_encap(struct ifnet *, struct mbuf *,
79 		struct ieee80211_node **);
80 extern	struct mbuf *ieee80211_get_rts(struct ieee80211com *,
81 		const struct ieee80211_frame *, u_int16_t);
82 extern	struct mbuf *ieee80211_get_cts_to_self(struct ieee80211com *,
83 		u_int16_t);
84 extern	struct mbuf *ieee80211_beacon_alloc(struct ieee80211com *,
85 		struct ieee80211_node *);
86 extern int ieee80211_save_ie(const u_int8_t *, u_int8_t **);
87 extern	void ieee80211_eapol_timeout(void *);
88 extern	int ieee80211_send_4way_msg1(struct ieee80211com *,
89 		struct ieee80211_node *);
90 extern	int ieee80211_send_4way_msg2(struct ieee80211com *,
91 		struct ieee80211_node *, const u_int8_t *,
92 		const struct ieee80211_ptk *);
93 extern	int ieee80211_send_4way_msg3(struct ieee80211com *,
94 		struct ieee80211_node *);
95 extern	int ieee80211_send_4way_msg4(struct ieee80211com *,
96 		struct ieee80211_node *);
97 extern	int ieee80211_send_group_msg1(struct ieee80211com *,
98 		struct ieee80211_node *);
99 extern	int ieee80211_send_group_msg2(struct ieee80211com *,
100 		struct ieee80211_node *, const struct ieee80211_key *);
101 extern	int ieee80211_send_eapol_key_req(struct ieee80211com *,
102 		struct ieee80211_node *, u_int16_t, u_int64_t);
103 extern	int ieee80211_pwrsave(struct ieee80211com *, struct mbuf *,
104 		struct ieee80211_node *);
105 #define	ieee80211_new_state(_ic, _nstate, _arg) \
106 	(((_ic)->ic_newstate)((_ic), (_nstate), (_arg)))
107 extern	enum ieee80211_edca_ac ieee80211_up_to_ac(struct ieee80211com *, int);
108 extern	u_int8_t *ieee80211_add_capinfo(u_int8_t *, struct ieee80211com *,
109 		const struct ieee80211_node *);
110 extern	u_int8_t *ieee80211_add_ssid(u_int8_t *, const u_int8_t *, u_int);
111 extern	u_int8_t *ieee80211_add_rates(u_int8_t *,
112 		const struct ieee80211_rateset *);
113 extern	u_int8_t *ieee80211_add_fh_params(u_int8_t *, struct ieee80211com *,
114 		const struct ieee80211_node *);
115 extern	u_int8_t *ieee80211_add_ds_params(u_int8_t *, struct ieee80211com *,
116 		const struct ieee80211_node *);
117 extern	u_int8_t *ieee80211_add_tim(u_int8_t *, struct ieee80211com *);
118 extern	u_int8_t *ieee80211_add_ibss_params(u_int8_t *,
119 		const struct ieee80211_node *);
120 extern	u_int8_t *ieee80211_add_edca_params(u_int8_t *, struct ieee80211com *);
121 extern	u_int8_t *ieee80211_add_erp(u_int8_t *, struct ieee80211com *);
122 extern	u_int8_t *ieee80211_add_qos_capability(u_int8_t *,
123 		struct ieee80211com *);
124 extern	u_int8_t *ieee80211_add_rsn(u_int8_t *, struct ieee80211com *,
125 		const struct ieee80211_node *);
126 extern	u_int8_t *ieee80211_add_wpa(u_int8_t *, struct ieee80211com *,
127 		const struct ieee80211_node *);
128 extern	u_int8_t *ieee80211_add_xrates(u_int8_t *,
129 		const struct ieee80211_rateset *);
130 extern	u_int8_t *ieee80211_add_htcaps(u_int8_t *, struct ieee80211com *);
131 extern	u_int8_t *ieee80211_add_htop(u_int8_t *, struct ieee80211com *);
132 extern	u_int8_t *ieee80211_add_tie(u_int8_t *, u_int8_t, u_int32_t);
133 
134 extern	int ieee80211_parse_rsn(struct ieee80211com *, const u_int8_t *,
135 		struct ieee80211_rsnparams *);
136 extern	int ieee80211_parse_wpa(struct ieee80211com *, const u_int8_t *,
137 		struct ieee80211_rsnparams *);
138 extern	void ieee80211_print_essid(const u_int8_t *, int);
139 #ifdef IEEE80211_DEBUG
140 extern	void ieee80211_dump_pkt(const u_int8_t *, int, int, int);
141 #endif
142 extern	int ieee80211_ibss_merge(struct ieee80211com *,
143 		struct ieee80211_node *, u_int64_t);
144 extern	void ieee80211_reset_erp(struct ieee80211com *);
145 extern	void ieee80211_set_shortslottime(struct ieee80211com *, int);
146 extern	void ieee80211_auth_open(struct ieee80211com *,
147 	    const struct ieee80211_frame *, struct ieee80211_node *,
148 	    struct ieee80211_rxinfo *rs, u_int16_t, u_int16_t);
149 extern	void ieee80211_gtk_rekey_timeout(void *);
150 extern	int ieee80211_keyrun(struct ieee80211com *, u_int8_t *);
151 extern	void ieee80211_setkeys(struct ieee80211com *);
152 extern	void ieee80211_setkeysdone(struct ieee80211com *);
153 extern	void ieee80211_sa_query_timeout(void *);
154 extern	void ieee80211_sa_query_request(struct ieee80211com *,
155 	    struct ieee80211_node *);
156 #ifndef IEEE80211_NO_HT
157 extern	void ieee80211_tx_ba_timeout(void *);
158 extern	void ieee80211_rx_ba_timeout(void *);
159 extern	int ieee80211_addba_request(struct ieee80211com *,
160 	    struct ieee80211_node *,  u_int16_t, u_int8_t);
161 extern	void ieee80211_delba_request(struct ieee80211com *,
162 	    struct ieee80211_node *, u_int16_t, u_int8_t, u_int8_t);
163 #endif
164 
165 #endif /* _NET80211_IEEE80211_PROTO_H_ */
166