ieee80211_proto.h revision 1.23.16.2 1 1.23.16.2 phil /* $NetBSD: ieee80211_proto.h,v 1.23.16.2 2018/06/28 21:23:01 phil Exp $ */
2 1.23.16.2 phil
3 1.1 dyoung /*-
4 1.23.16.1 phil * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
5 1.23.16.1 phil *
6 1.1 dyoung * Copyright (c) 2001 Atsushi Onoe
7 1.23.16.1 phil * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
8 1.1 dyoung * All rights reserved.
9 1.1 dyoung *
10 1.1 dyoung * Redistribution and use in source and binary forms, with or without
11 1.1 dyoung * modification, are permitted provided that the following conditions
12 1.1 dyoung * are met:
13 1.1 dyoung * 1. Redistributions of source code must retain the above copyright
14 1.1 dyoung * notice, this list of conditions and the following disclaimer.
15 1.1 dyoung * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 dyoung * notice, this list of conditions and the following disclaimer in the
17 1.1 dyoung * documentation and/or other materials provided with the distribution.
18 1.1 dyoung *
19 1.1 dyoung * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 1.1 dyoung * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 1.1 dyoung * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 1.1 dyoung * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 1.1 dyoung * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 1.1 dyoung * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 1.1 dyoung * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 1.1 dyoung * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 1.1 dyoung * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 1.1 dyoung * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 1.1 dyoung *
30 1.23.16.1 phil * $FreeBSD$
31 1.1 dyoung */
32 1.1 dyoung #ifndef _NET80211_IEEE80211_PROTO_H_
33 1.1 dyoung #define _NET80211_IEEE80211_PROTO_H_
34 1.1 dyoung
35 1.1 dyoung /*
36 1.1 dyoung * 802.11 protocol implementation definitions.
37 1.1 dyoung */
38 1.1 dyoung
39 1.1 dyoung enum ieee80211_state {
40 1.1 dyoung IEEE80211_S_INIT = 0, /* default state */
41 1.1 dyoung IEEE80211_S_SCAN = 1, /* scanning */
42 1.1 dyoung IEEE80211_S_AUTH = 2, /* try to authenticate */
43 1.1 dyoung IEEE80211_S_ASSOC = 3, /* try to assoc */
44 1.23.16.1 phil IEEE80211_S_CAC = 4, /* doing channel availability check */
45 1.23.16.1 phil IEEE80211_S_RUN = 5, /* operational (e.g. associated) */
46 1.23.16.1 phil IEEE80211_S_CSA = 6, /* channel switch announce pending */
47 1.23.16.1 phil IEEE80211_S_SLEEP = 7, /* power save */
48 1.1 dyoung };
49 1.23.16.1 phil #define IEEE80211_S_MAX (IEEE80211_S_SLEEP+1)
50 1.23.16.1 phil
51 1.23.16.1 phil #define IEEE80211_SEND_MGMT(_ni,_type,_arg) \
52 1.23.16.1 phil ((*(_ni)->ni_ic->ic_send_mgmt)(_ni, _type, _arg))
53 1.1 dyoung
54 1.23.16.1 phil extern const char *mgt_subtype_name[];
55 1.23.16.1 phil extern const char *ctl_subtype_name[];
56 1.23.16.1 phil extern const char *ieee80211_phymode_name[IEEE80211_MODE_MAX];
57 1.23.16.1 phil extern const int ieee80211_opcap[IEEE80211_OPMODE_MAX];
58 1.23.16.1 phil
59 1.23.16.1 phil static __inline const char *
60 1.23.16.1 phil ieee80211_mgt_subtype_name(uint8_t subtype)
61 1.23.16.1 phil {
62 1.23.16.1 phil return mgt_subtype_name[(subtype & IEEE80211_FC0_SUBTYPE_MASK) >>
63 1.23.16.1 phil IEEE80211_FC0_SUBTYPE_SHIFT];
64 1.23.16.1 phil }
65 1.23.16.1 phil
66 1.23.16.1 phil static __inline const char *
67 1.23.16.1 phil ieee80211_ctl_subtype_name(uint8_t subtype)
68 1.23.16.1 phil {
69 1.23.16.1 phil return ctl_subtype_name[(subtype & IEEE80211_FC0_SUBTYPE_MASK) >>
70 1.23.16.1 phil IEEE80211_FC0_SUBTYPE_SHIFT];
71 1.23.16.1 phil }
72 1.1 dyoung
73 1.23.16.1 phil const char *ieee80211_reason_to_string(uint16_t);
74 1.1 dyoung
75 1.10 dyoung void ieee80211_proto_attach(struct ieee80211com *);
76 1.10 dyoung void ieee80211_proto_detach(struct ieee80211com *);
77 1.23.16.1 phil void ieee80211_proto_vattach(struct ieee80211vap *);
78 1.23.16.1 phil void ieee80211_proto_vdetach(struct ieee80211vap *);
79 1.1 dyoung
80 1.23.16.1 phil void ieee80211_promisc(struct ieee80211vap *, bool);
81 1.23.16.1 phil void ieee80211_allmulti(struct ieee80211vap *, bool);
82 1.23.16.1 phil void ieee80211_syncflag(struct ieee80211vap *, int flag);
83 1.23.16.1 phil void ieee80211_syncflag_ht(struct ieee80211vap *, int flag);
84 1.23.16.1 phil void ieee80211_syncflag_vht(struct ieee80211vap *, int flag);
85 1.23.16.1 phil void ieee80211_syncflag_ext(struct ieee80211vap *, int flag);
86 1.23.16.1 phil
87 1.23.16.1 phil #define ieee80211_input(ni, m, rssi, nf) \
88 1.23.16.1 phil ((ni)->ni_vap->iv_input(ni, m, NULL, rssi, nf))
89 1.23.16.1 phil int ieee80211_input_all(struct ieee80211com *, struct mbuf *, int, int);
90 1.23.16.1 phil
91 1.23.16.1 phil int ieee80211_input_mimo(struct ieee80211_node *, struct mbuf *);
92 1.23.16.1 phil int ieee80211_input_mimo_all(struct ieee80211com *, struct mbuf *);
93 1.23.16.1 phil
94 1.23.16.1 phil struct ieee80211_bpf_params;
95 1.23.16.1 phil int ieee80211_mgmt_output(struct ieee80211_node *, struct mbuf *, int,
96 1.23.16.1 phil struct ieee80211_bpf_params *);
97 1.23.16.1 phil int ieee80211_raw_xmit(struct ieee80211_node *, struct mbuf *,
98 1.23.16.1 phil const struct ieee80211_bpf_params *);
99 1.23.16.1 phil int ieee80211_output(struct ifnet *, struct mbuf *,
100 1.23.16.1 phil const struct sockaddr *, struct route *ro);
101 1.23.16.1 phil int ieee80211_vap_pkt_send_dest(struct ieee80211vap *, struct mbuf *,
102 1.10 dyoung struct ieee80211_node *);
103 1.23.16.1 phil int ieee80211_raw_output(struct ieee80211vap *, struct ieee80211_node *,
104 1.23.16.1 phil struct mbuf *, const struct ieee80211_bpf_params *);
105 1.23.16.1 phil void ieee80211_send_setup(struct ieee80211_node *, struct mbuf *, int, int,
106 1.23.16.1 phil const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN],
107 1.23.16.1 phil const uint8_t [IEEE80211_ADDR_LEN]);
108 1.23.16.1 phil int ieee80211_vap_transmit(struct ifnet *ifp, struct mbuf *m);
109 1.23.16.1 phil void ieee80211_vap_qflush(struct ifnet *ifp);
110 1.23.16.1 phil int ieee80211_send_nulldata(struct ieee80211_node *);
111 1.23.16.1 phil int ieee80211_classify(struct ieee80211_node *, struct mbuf *m);
112 1.23.16.1 phil struct mbuf *ieee80211_mbuf_adjust(struct ieee80211vap *, int,
113 1.23.16.1 phil struct ieee80211_key *, struct mbuf *);
114 1.23.16.1 phil struct mbuf *ieee80211_encap(struct ieee80211vap *, struct ieee80211_node *,
115 1.3 dyoung struct mbuf *);
116 1.23.16.1 phil void ieee80211_free_mbuf(struct mbuf *);
117 1.23.16.1 phil int ieee80211_send_mgmt(struct ieee80211_node *, int, int);
118 1.23.16.1 phil struct ieee80211_appie;
119 1.23.16.1 phil int ieee80211_send_probereq(struct ieee80211_node *ni,
120 1.23.16.1 phil const uint8_t sa[IEEE80211_ADDR_LEN],
121 1.23.16.1 phil const uint8_t da[IEEE80211_ADDR_LEN],
122 1.23.16.1 phil const uint8_t bssid[IEEE80211_ADDR_LEN],
123 1.23.16.1 phil const uint8_t *ssid, size_t ssidlen);
124 1.23.16.1 phil struct mbuf * ieee80211_ff_encap1(struct ieee80211vap *, struct mbuf *,
125 1.23.16.1 phil const struct ether_header *);
126 1.23.16.1 phil void ieee80211_tx_complete(struct ieee80211_node *,
127 1.23.16.1 phil struct mbuf *, int);
128 1.10 dyoung
129 1.23.16.1 phil /*
130 1.23.16.1 phil * The formation of ProbeResponse frames requires guidance to
131 1.23.16.1 phil * deal with legacy clients. When the client is identified as
132 1.23.16.1 phil * "legacy 11b" ieee80211_send_proberesp is passed this token.
133 1.23.16.1 phil */
134 1.23.16.1 phil #define IEEE80211_SEND_LEGACY_11B 0x1 /* legacy 11b client */
135 1.23.16.1 phil #define IEEE80211_SEND_LEGACY_11 0x2 /* other legacy client */
136 1.23.16.1 phil #define IEEE80211_SEND_LEGACY 0x3 /* any legacy client */
137 1.23.16.1 phil struct mbuf *ieee80211_alloc_proberesp(struct ieee80211_node *, int);
138 1.23.16.1 phil int ieee80211_send_proberesp(struct ieee80211vap *,
139 1.23.16.1 phil const uint8_t da[IEEE80211_ADDR_LEN], int);
140 1.23.16.1 phil struct mbuf *ieee80211_alloc_rts(struct ieee80211com *ic,
141 1.23.16.1 phil const uint8_t [IEEE80211_ADDR_LEN],
142 1.23.16.1 phil const uint8_t [IEEE80211_ADDR_LEN], uint16_t);
143 1.23.16.1 phil struct mbuf *ieee80211_alloc_cts(struct ieee80211com *,
144 1.23.16.1 phil const uint8_t [IEEE80211_ADDR_LEN], uint16_t);
145 1.23.16.1 phil struct mbuf *ieee80211_alloc_prot(struct ieee80211_node *,
146 1.23.16.1 phil const struct mbuf *, uint8_t, int);
147 1.23.16.1 phil
148 1.23.16.1 phil uint8_t *ieee80211_add_rates(uint8_t *, const struct ieee80211_rateset *);
149 1.23.16.1 phil uint8_t *ieee80211_add_xrates(uint8_t *, const struct ieee80211_rateset *);
150 1.23.16.1 phil uint8_t *ieee80211_add_ssid(uint8_t *, const uint8_t *, u_int);
151 1.23.16.1 phil uint8_t *ieee80211_add_wpa(uint8_t *, const struct ieee80211vap *);
152 1.23.16.1 phil uint8_t *ieee80211_add_rsn(uint8_t *, const struct ieee80211vap *);
153 1.23.16.1 phil uint8_t *ieee80211_add_qos(uint8_t *, const struct ieee80211_node *);
154 1.23.16.1 phil uint16_t ieee80211_getcapinfo(struct ieee80211vap *,
155 1.23.16.1 phil struct ieee80211_channel *);
156 1.23 nonaka struct ieee80211_wme_state;
157 1.23.16.1 phil uint8_t * ieee80211_add_wme_info(uint8_t *frm, struct ieee80211_wme_state *wme);
158 1.23 nonaka
159 1.10 dyoung void ieee80211_reset_erp(struct ieee80211com *);
160 1.10 dyoung void ieee80211_set_shortslottime(struct ieee80211com *, int onoff);
161 1.23.16.1 phil int ieee80211_iserp_rateset(const struct ieee80211_rateset *);
162 1.23.16.1 phil void ieee80211_setbasicrates(struct ieee80211_rateset *,
163 1.23.16.1 phil enum ieee80211_phymode);
164 1.23.16.1 phil void ieee80211_addbasicrates(struct ieee80211_rateset *,
165 1.10 dyoung enum ieee80211_phymode);
166 1.10 dyoung
167 1.10 dyoung /*
168 1.10 dyoung * Return the size of the 802.11 header for a management or data frame.
169 1.10 dyoung */
170 1.10 dyoung static __inline int
171 1.10 dyoung ieee80211_hdrsize(const void *data)
172 1.10 dyoung {
173 1.10 dyoung const struct ieee80211_frame *wh = data;
174 1.10 dyoung int size = sizeof(struct ieee80211_frame);
175 1.10 dyoung
176 1.10 dyoung /* NB: we don't handle control frames */
177 1.23.16.1 phil KASSERT((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL,
178 1.10 dyoung ("%s: control frame", __func__));
179 1.23.16.1 phil if (IEEE80211_IS_DSTODS(wh))
180 1.10 dyoung size += IEEE80211_ADDR_LEN;
181 1.23.16.1 phil if (IEEE80211_QOS_HAS_SEQ(wh))
182 1.23.16.1 phil size += sizeof(uint16_t);
183 1.10 dyoung return size;
184 1.10 dyoung }
185 1.10 dyoung
186 1.10 dyoung /*
187 1.23.16.1 phil * Like ieee80211_hdrsize, but handles any type of frame.
188 1.10 dyoung */
189 1.10 dyoung static __inline int
190 1.10 dyoung ieee80211_anyhdrsize(const void *data)
191 1.10 dyoung {
192 1.10 dyoung const struct ieee80211_frame *wh = data;
193 1.10 dyoung
194 1.10 dyoung if ((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) {
195 1.10 dyoung switch (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) {
196 1.10 dyoung case IEEE80211_FC0_SUBTYPE_CTS:
197 1.10 dyoung case IEEE80211_FC0_SUBTYPE_ACK:
198 1.10 dyoung return sizeof(struct ieee80211_frame_ack);
199 1.23.16.1 phil case IEEE80211_FC0_SUBTYPE_BAR:
200 1.23.16.1 phil return sizeof(struct ieee80211_frame_bar);
201 1.10 dyoung }
202 1.10 dyoung return sizeof(struct ieee80211_frame_min);
203 1.10 dyoung } else
204 1.10 dyoung return ieee80211_hdrsize(data);
205 1.10 dyoung }
206 1.10 dyoung
207 1.10 dyoung /*
208 1.10 dyoung * Template for an in-kernel authenticator. Authenticators
209 1.10 dyoung * register with the protocol code and are typically loaded
210 1.23.16.1 phil * as separate modules as needed. One special authenticator
211 1.23.16.1 phil * is xauth; it intercepts requests so that protocols like
212 1.23.16.1 phil * WPA can be handled in user space.
213 1.10 dyoung */
214 1.10 dyoung struct ieee80211_authenticator {
215 1.10 dyoung const char *ia_name; /* printable name */
216 1.23.16.1 phil int (*ia_attach)(struct ieee80211vap *);
217 1.23.16.1 phil void (*ia_detach)(struct ieee80211vap *);
218 1.23.16.1 phil void (*ia_node_join)(struct ieee80211_node *);
219 1.23.16.1 phil void (*ia_node_leave)(struct ieee80211_node *);
220 1.10 dyoung };
221 1.10 dyoung void ieee80211_authenticator_register(int type,
222 1.10 dyoung const struct ieee80211_authenticator *);
223 1.10 dyoung void ieee80211_authenticator_unregister(int type);
224 1.10 dyoung const struct ieee80211_authenticator *ieee80211_authenticator_get(int auth);
225 1.10 dyoung
226 1.13 skrll struct ieee80211req;
227 1.10 dyoung /*
228 1.10 dyoung * Template for an MAC ACL policy module. Such modules
229 1.10 dyoung * register with the protocol code and are passed the sender's
230 1.23.16.1 phil * address of each received auth frame for validation.
231 1.10 dyoung */
232 1.10 dyoung struct ieee80211_aclator {
233 1.10 dyoung const char *iac_name; /* printable name */
234 1.23.16.1 phil int (*iac_attach)(struct ieee80211vap *);
235 1.23.16.1 phil void (*iac_detach)(struct ieee80211vap *);
236 1.23.16.1 phil int (*iac_check)(struct ieee80211vap *,
237 1.23.16.1 phil const struct ieee80211_frame *wh);
238 1.23.16.1 phil int (*iac_add)(struct ieee80211vap *,
239 1.23.16.1 phil const uint8_t mac[IEEE80211_ADDR_LEN]);
240 1.23.16.1 phil int (*iac_remove)(struct ieee80211vap *,
241 1.23.16.1 phil const uint8_t mac[IEEE80211_ADDR_LEN]);
242 1.23.16.1 phil int (*iac_flush)(struct ieee80211vap *);
243 1.23.16.1 phil int (*iac_setpolicy)(struct ieee80211vap *, int);
244 1.23.16.1 phil int (*iac_getpolicy)(struct ieee80211vap *);
245 1.23.16.1 phil int (*iac_setioctl)(struct ieee80211vap *, struct ieee80211req *);
246 1.23.16.1 phil int (*iac_getioctl)(struct ieee80211vap *, struct ieee80211req *);
247 1.10 dyoung };
248 1.10 dyoung void ieee80211_aclator_register(const struct ieee80211_aclator *);
249 1.10 dyoung void ieee80211_aclator_unregister(const struct ieee80211_aclator *);
250 1.10 dyoung const struct ieee80211_aclator *ieee80211_aclator_get(const char *name);
251 1.10 dyoung
252 1.10 dyoung /* flags for ieee80211_fix_rate() */
253 1.23.16.1 phil #define IEEE80211_F_DOSORT 0x00000001 /* sort rate list */
254 1.23.16.1 phil #define IEEE80211_F_DOFRATE 0x00000002 /* use fixed legacy rate */
255 1.23.16.1 phil #define IEEE80211_F_DONEGO 0x00000004 /* calc negotiated rate */
256 1.23.16.1 phil #define IEEE80211_F_DODEL 0x00000008 /* delete ignore rate */
257 1.23.16.1 phil #define IEEE80211_F_DOBRS 0x00000010 /* check basic rate set */
258 1.23.16.1 phil #define IEEE80211_F_JOIN 0x00000020 /* sta joining our bss */
259 1.23.16.1 phil #define IEEE80211_F_DOFMCS 0x00000040 /* use fixed HT rate */
260 1.23.16.1 phil int ieee80211_fix_rate(struct ieee80211_node *,
261 1.23.16.1 phil struct ieee80211_rateset *, int);
262 1.10 dyoung
263 1.10 dyoung /*
264 1.10 dyoung * WME/WMM support.
265 1.10 dyoung */
266 1.10 dyoung struct wmeParams {
267 1.23.16.1 phil uint8_t wmep_acm;
268 1.23.16.1 phil uint8_t wmep_aifsn;
269 1.23.16.1 phil uint8_t wmep_logcwmin; /* log2(cwmin) */
270 1.23.16.1 phil uint8_t wmep_logcwmax; /* log2(cwmax) */
271 1.23.16.1 phil uint8_t wmep_txopLimit;
272 1.23.16.1 phil uint8_t wmep_noackPolicy; /* 0 (ack), 1 (no ack) */
273 1.10 dyoung };
274 1.10 dyoung #define IEEE80211_TXOP_TO_US(_txop) ((_txop)<<5)
275 1.10 dyoung #define IEEE80211_US_TO_TXOP(_us) ((_us)>>5)
276 1.10 dyoung
277 1.10 dyoung struct chanAccParams {
278 1.23.16.1 phil uint8_t cap_info; /* version of the current set */
279 1.10 dyoung struct wmeParams cap_wmeParams[WME_NUM_AC];
280 1.10 dyoung };
281 1.10 dyoung
282 1.10 dyoung struct ieee80211_wme_state {
283 1.10 dyoung u_int wme_flags;
284 1.23.16.1 phil #define WME_F_AGGRMODE 0x00000001 /* STATUS: WME aggressive mode */
285 1.10 dyoung u_int wme_hipri_traffic; /* VI/VO frames in beacon interval */
286 1.23.16.1 phil u_int wme_hipri_switch_thresh;/* aggressive mode switch thresh */
287 1.23.16.1 phil u_int wme_hipri_switch_hysteresis;/* aggressive mode switch hysteresis */
288 1.10 dyoung
289 1.10 dyoung struct wmeParams wme_params[4]; /* from assoc resp for each AC*/
290 1.10 dyoung struct chanAccParams wme_wmeChanParams; /* WME params applied to self */
291 1.10 dyoung struct chanAccParams wme_wmeBssChanParams;/* WME params bcast to stations */
292 1.10 dyoung struct chanAccParams wme_chanParams; /* params applied to self */
293 1.10 dyoung struct chanAccParams wme_bssChanParams; /* params bcast to stations */
294 1.10 dyoung
295 1.10 dyoung int (*wme_update)(struct ieee80211com *);
296 1.10 dyoung };
297 1.10 dyoung
298 1.23.16.1 phil void ieee80211_wme_initparams(struct ieee80211vap *);
299 1.23.16.1 phil void ieee80211_wme_updateparams(struct ieee80211vap *);
300 1.23.16.1 phil void ieee80211_wme_updateparams_locked(struct ieee80211vap *);
301 1.23.16.1 phil void ieee80211_wme_vap_getparams(struct ieee80211vap *vap,
302 1.23.16.1 phil struct chanAccParams *);
303 1.23.16.1 phil void ieee80211_wme_ic_getparams(struct ieee80211com *ic,
304 1.23.16.1 phil struct chanAccParams *);
305 1.23.16.1 phil int ieee80211_wme_vap_ac_is_noack(struct ieee80211vap *vap, int ac);
306 1.23.16.1 phil
307 1.23.16.1 phil /*
308 1.23.16.1 phil * Return the WME TID from a QoS frame. If no TID
309 1.23.16.1 phil * is present return the index for the "non-QoS" entry.
310 1.23.16.1 phil */
311 1.23.16.1 phil static __inline uint8_t
312 1.23.16.1 phil ieee80211_gettid(const struct ieee80211_frame *wh)
313 1.23.16.1 phil {
314 1.23.16.1 phil uint8_t tid;
315 1.23.16.1 phil
316 1.23.16.1 phil if (IEEE80211_QOS_HAS_SEQ(wh)) {
317 1.23.16.1 phil if (IEEE80211_IS_DSTODS(wh))
318 1.23.16.1 phil tid = ((const struct ieee80211_qosframe_addr4 *)wh)->
319 1.23.16.1 phil i_qos[0];
320 1.23.16.1 phil else
321 1.23.16.1 phil tid = ((const struct ieee80211_qosframe *)wh)->i_qos[0];
322 1.23.16.1 phil tid &= IEEE80211_QOS_TID;
323 1.23.16.1 phil } else
324 1.23.16.1 phil tid = IEEE80211_NONQOS_TID;
325 1.23.16.1 phil return tid;
326 1.23.16.1 phil }
327 1.23.16.1 phil
328 1.23.16.1 phil void ieee80211_waitfor_parent(struct ieee80211com *);
329 1.23.16.1 phil void ieee80211_start_locked(struct ieee80211vap *);
330 1.23.16.1 phil void ieee80211_init(void *);
331 1.23.16.1 phil void ieee80211_start_all(struct ieee80211com *);
332 1.23.16.1 phil void ieee80211_stop_locked(struct ieee80211vap *);
333 1.23.16.1 phil void ieee80211_stop(struct ieee80211vap *);
334 1.23.16.1 phil void ieee80211_stop_all(struct ieee80211com *);
335 1.23.16.1 phil void ieee80211_suspend_all(struct ieee80211com *);
336 1.23.16.1 phil void ieee80211_resume_all(struct ieee80211com *);
337 1.23.16.1 phil void ieee80211_restart_all(struct ieee80211com *);
338 1.23.16.1 phil void ieee80211_dturbo_switch(struct ieee80211vap *, int newflags);
339 1.23.16.1 phil void ieee80211_swbmiss(void *arg);
340 1.16 dyoung void ieee80211_beacon_miss(struct ieee80211com *);
341 1.23.16.1 phil int ieee80211_new_state(struct ieee80211vap *, enum ieee80211_state, int);
342 1.23.16.1 phil int ieee80211_new_state_locked(struct ieee80211vap *, enum ieee80211_state,
343 1.23.16.1 phil int);
344 1.23.16.1 phil void ieee80211_print_essid(const uint8_t *, int);
345 1.23.16.1 phil void ieee80211_dump_pkt(struct ieee80211com *,
346 1.23.16.1 phil const uint8_t *, int, int, int);
347 1.1 dyoung
348 1.23.16.1 phil extern const char *ieee80211_opmode_name[];
349 1.1 dyoung extern const char *ieee80211_state_name[IEEE80211_S_MAX];
350 1.10 dyoung extern const char *ieee80211_wme_acnames[];
351 1.10 dyoung
352 1.10 dyoung /*
353 1.10 dyoung * Beacon frames constructed by ieee80211_beacon_alloc
354 1.10 dyoung * have the following structure filled in so drivers
355 1.10 dyoung * can update the frame later w/ minimal overhead.
356 1.10 dyoung */
357 1.10 dyoung struct ieee80211_beacon_offsets {
358 1.23.16.1 phil uint8_t bo_flags[4]; /* update/state flags */
359 1.23.16.1 phil uint16_t *bo_caps; /* capabilities */
360 1.23.16.1 phil uint8_t *bo_cfp; /* start of CFParms element */
361 1.23.16.1 phil uint8_t *bo_tim; /* start of atim/dtim */
362 1.23.16.1 phil uint8_t *bo_wme; /* start of WME parameters */
363 1.23.16.1 phil uint8_t *bo_tdma; /* start of TDMA parameters */
364 1.23.16.1 phil uint8_t *bo_tim_trailer;/* start of fixed-size trailer */
365 1.23.16.1 phil uint16_t bo_tim_len; /* atim/dtim length in bytes */
366 1.23.16.1 phil uint16_t bo_tim_trailer_len;/* tim trailer length in bytes */
367 1.23.16.1 phil uint8_t *bo_erp; /* start of ERP element */
368 1.23.16.1 phil uint8_t *bo_htinfo; /* start of HT info element */
369 1.23.16.1 phil uint8_t *bo_ath; /* start of ATH parameters */
370 1.23.16.1 phil uint8_t *bo_appie; /* start of AppIE element */
371 1.23.16.1 phil uint16_t bo_appie_len; /* AppIE length in bytes */
372 1.23.16.1 phil uint16_t bo_csa_trailer_len;
373 1.23.16.1 phil uint8_t *bo_csa; /* start of CSA element */
374 1.23.16.1 phil uint8_t *bo_quiet; /* start of Quiet element */
375 1.23.16.1 phil uint8_t *bo_meshconf; /* start of MESHCONF element */
376 1.23.16.1 phil uint8_t *bo_vhtinfo; /* start of VHT info element (XXX VHTCAP?) */
377 1.23.16.1 phil uint8_t *bo_spare[2];
378 1.10 dyoung };
379 1.23.16.1 phil struct mbuf *ieee80211_beacon_alloc(struct ieee80211_node *);
380 1.23.16.1 phil
381 1.23.16.1 phil /*
382 1.23.16.1 phil * Beacon frame updates are signaled through calls to iv_update_beacon
383 1.23.16.1 phil * with one of the IEEE80211_BEACON_* tokens defined below. For devices
384 1.23.16.1 phil * that construct beacon frames on the host this can trigger a rebuild
385 1.23.16.1 phil * or defer the processing. For devices that offload beacon frame
386 1.23.16.1 phil * handling this callback can be used to signal a rebuild. The bo_flags
387 1.23.16.1 phil * array in the ieee80211_beacon_offsets structure is intended to record
388 1.23.16.1 phil * deferred processing requirements; ieee80211_beacon_update uses the
389 1.23.16.1 phil * state to optimize work. Since this structure is owned by the driver
390 1.23.16.1 phil * and not visible to the 802.11 layer drivers must supply an iv_update_beacon
391 1.23.16.1 phil * callback that marks the flag bits and schedules (as necessary) an update.
392 1.23.16.1 phil */
393 1.23.16.1 phil enum {
394 1.23.16.1 phil IEEE80211_BEACON_CAPS = 0, /* capabilities */
395 1.23.16.1 phil IEEE80211_BEACON_TIM = 1, /* DTIM/ATIM */
396 1.23.16.1 phil IEEE80211_BEACON_WME = 2,
397 1.23.16.1 phil IEEE80211_BEACON_ERP = 3, /* Extended Rate Phy */
398 1.23.16.1 phil IEEE80211_BEACON_HTINFO = 4, /* HT Information */
399 1.23.16.1 phil IEEE80211_BEACON_APPIE = 5, /* Application IE's */
400 1.23.16.1 phil IEEE80211_BEACON_CFP = 6, /* CFParms */
401 1.23.16.1 phil IEEE80211_BEACON_CSA = 7, /* Channel Switch Announcement */
402 1.23.16.1 phil IEEE80211_BEACON_TDMA = 9, /* TDMA Info */
403 1.23.16.1 phil IEEE80211_BEACON_ATH = 10, /* ATH parameters */
404 1.23.16.1 phil IEEE80211_BEACON_MESHCONF = 11, /* Mesh Configuration */
405 1.23.16.1 phil IEEE80211_BEACON_QUIET = 12, /* Quiet time IE */
406 1.23.16.1 phil IEEE80211_BEACON_VHTINFO = 13, /* VHT information */
407 1.23.16.1 phil };
408 1.23.16.1 phil int ieee80211_beacon_update(struct ieee80211_node *,
409 1.23.16.1 phil struct mbuf *, int mcast);
410 1.23.16.1 phil
411 1.23.16.1 phil void ieee80211_csa_startswitch(struct ieee80211com *,
412 1.23.16.1 phil struct ieee80211_channel *, int mode, int count);
413 1.23.16.1 phil void ieee80211_csa_completeswitch(struct ieee80211com *);
414 1.23.16.1 phil void ieee80211_csa_cancelswitch(struct ieee80211com *);
415 1.23.16.1 phil void ieee80211_cac_completeswitch(struct ieee80211vap *);
416 1.10 dyoung
417 1.10 dyoung /*
418 1.10 dyoung * Notification methods called from the 802.11 state machine.
419 1.10 dyoung * Note that while these are defined here, their implementation
420 1.10 dyoung * is OS-specific.
421 1.10 dyoung */
422 1.23.16.1 phil void ieee80211_notify_node_join(struct ieee80211_node *, int newassoc);
423 1.23.16.1 phil void ieee80211_notify_node_leave(struct ieee80211_node *);
424 1.23.16.1 phil void ieee80211_notify_scan_done(struct ieee80211vap *);
425 1.23.16.1 phil void ieee80211_notify_wds_discover(struct ieee80211_node *);
426 1.23.16.1 phil void ieee80211_notify_csa(struct ieee80211com *,
427 1.23.16.1 phil const struct ieee80211_channel *, int mode, int count);
428 1.23.16.1 phil void ieee80211_notify_radar(struct ieee80211com *,
429 1.23.16.1 phil const struct ieee80211_channel *);
430 1.23.16.1 phil enum ieee80211_notify_cac_event {
431 1.23.16.1 phil IEEE80211_NOTIFY_CAC_START = 0, /* CAC timer started */
432 1.23.16.1 phil IEEE80211_NOTIFY_CAC_STOP = 1, /* CAC intentionally stopped */
433 1.23.16.1 phil IEEE80211_NOTIFY_CAC_RADAR = 2, /* CAC stopped due to radar detectio */
434 1.23.16.1 phil IEEE80211_NOTIFY_CAC_EXPIRE = 3, /* CAC expired w/o radar */
435 1.23.16.1 phil };
436 1.23.16.1 phil void ieee80211_notify_cac(struct ieee80211com *,
437 1.23.16.1 phil const struct ieee80211_channel *,
438 1.23.16.1 phil enum ieee80211_notify_cac_event);
439 1.23.16.1 phil void ieee80211_notify_node_deauth(struct ieee80211_node *);
440 1.23.16.1 phil void ieee80211_notify_node_auth(struct ieee80211_node *);
441 1.23.16.1 phil void ieee80211_notify_country(struct ieee80211vap *, const uint8_t [],
442 1.23.16.1 phil const uint8_t cc[2]);
443 1.23.16.1 phil void ieee80211_notify_radio(struct ieee80211com *, int);
444 1.23.16.1 phil #endif /* _NET80211_IEEE80211_PROTO_H_ */
445