xref: /freebsd/sys/net80211/ieee80211_proto.h (revision 7660b554bc59a07be0431c17e0e33815818baa69)
1 /*-
2  * Copyright (c) 2001 Atsushi Onoe
3  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission.
16  *
17  * Alternatively, this software may be distributed under the terms of the
18  * GNU General Public License ("GPL") version 2 as published by the Free
19  * Software Foundation.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * $FreeBSD$
33  */
34 #ifndef _NET80211_IEEE80211_PROTO_H_
35 #define _NET80211_IEEE80211_PROTO_H_
36 
37 /*
38  * 802.11 protocol implementation definitions.
39  */
40 
41 enum ieee80211_state {
42 	IEEE80211_S_INIT	= 0,	/* default state */
43 	IEEE80211_S_SCAN	= 1,	/* scanning */
44 	IEEE80211_S_AUTH	= 2,	/* try to authenticate */
45 	IEEE80211_S_ASSOC	= 3,	/* try to assoc */
46 	IEEE80211_S_RUN		= 4,	/* associated */
47 };
48 #define	IEEE80211_S_MAX		(IEEE80211_S_RUN+1)
49 
50 #define	IEEE80211_SEND_MGMT(_ic,_ni,_type,_arg) \
51 	((*(_ic)->ic_send_mgmt)(_ic, _ni, _type, _arg))
52 
53 extern	const char *ieee80211_mgt_subtype_name[];
54 
55 extern	void ieee80211_proto_attach(struct ifnet *);
56 extern	void ieee80211_proto_detach(struct ifnet *);
57 
58 struct ieee80211_node;
59 extern	void ieee80211_input(struct ifnet *, struct mbuf *,
60 		struct ieee80211_node *, int, u_int32_t);
61 extern	void ieee80211_recv_mgmt(struct ieee80211com *, struct mbuf *,
62 		struct ieee80211_node *, int, int, u_int32_t);
63 extern	int ieee80211_send_mgmt(struct ieee80211com *, struct ieee80211_node *,
64 		int, int);
65 extern	struct mbuf *ieee80211_encap(struct ifnet *, struct mbuf *,
66 		struct ieee80211_node **);
67 extern	struct mbuf *ieee80211_decap(struct ifnet *, struct mbuf *);
68 extern	u_int8_t *ieee80211_add_rates(u_int8_t *frm,
69 		const struct ieee80211_rateset *);
70 #define	ieee80211_new_state(_ic, _nstate, _arg) \
71 	(((_ic)->ic_newstate)((_ic), (_nstate), (_arg)))
72 extern	u_int8_t *ieee80211_add_xrates(u_int8_t *frm,
73 		const struct ieee80211_rateset *);
74 extern	void ieee80211_print_essid(u_int8_t *, int);
75 extern	void ieee80211_dump_pkt(u_int8_t *, int, int, int);
76 
77 extern	const char *ieee80211_state_name[IEEE80211_S_MAX];
78 #endif /* _NET80211_IEEE80211_PROTO_H_ */
79