ieee80211_proto.h revision 1.23.16.4 1 1.23.16.4 phil /* $NetBSD: ieee80211_proto.h,v 1.23.16.4 2018/07/16 20:11:11 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.4 phil #if __NetBSD__
74 1.23.16.4 phil void ieee80211_auth_setup(void);
75 1.23.16.4 phil #endif
76 1.23.16.4 phil
77 1.23.16.1 phil const char *ieee80211_reason_to_string(uint16_t);
78 1.1 dyoung
79 1.10 dyoung void ieee80211_proto_attach(struct ieee80211com *);
80 1.10 dyoung void ieee80211_proto_detach(struct ieee80211com *);
81 1.23.16.1 phil void ieee80211_proto_vattach(struct ieee80211vap *);
82 1.23.16.1 phil void ieee80211_proto_vdetach(struct ieee80211vap *);
83 1.1 dyoung
84 1.23.16.1 phil void ieee80211_promisc(struct ieee80211vap *, bool);
85 1.23.16.1 phil void ieee80211_allmulti(struct ieee80211vap *, bool);
86 1.23.16.1 phil void ieee80211_syncflag(struct ieee80211vap *, int flag);
87 1.23.16.1 phil void ieee80211_syncflag_ht(struct ieee80211vap *, int flag);
88 1.23.16.1 phil void ieee80211_syncflag_vht(struct ieee80211vap *, int flag);
89 1.23.16.1 phil void ieee80211_syncflag_ext(struct ieee80211vap *, int flag);
90 1.23.16.1 phil
91 1.23.16.1 phil #define ieee80211_input(ni, m, rssi, nf) \
92 1.23.16.1 phil ((ni)->ni_vap->iv_input(ni, m, NULL, rssi, nf))
93 1.23.16.1 phil int ieee80211_input_all(struct ieee80211com *, struct mbuf *, int, int);
94 1.23.16.1 phil
95 1.23.16.1 phil int ieee80211_input_mimo(struct ieee80211_node *, struct mbuf *);
96 1.23.16.1 phil int ieee80211_input_mimo_all(struct ieee80211com *, struct mbuf *);
97 1.23.16.1 phil
98 1.23.16.1 phil struct ieee80211_bpf_params;
99 1.23.16.1 phil int ieee80211_mgmt_output(struct ieee80211_node *, struct mbuf *, int,
100 1.23.16.1 phil struct ieee80211_bpf_params *);
101 1.23.16.1 phil int ieee80211_raw_xmit(struct ieee80211_node *, struct mbuf *,
102 1.23.16.1 phil const struct ieee80211_bpf_params *);
103 1.23.16.4 phil #if __FreeBSD__
104 1.23.16.1 phil int ieee80211_output(struct ifnet *, struct mbuf *,
105 1.23.16.1 phil const struct sockaddr *, struct route *ro);
106 1.23.16.4 phil #elif __NetBSD__
107 1.23.16.4 phil int ieee80211_output(struct ifnet *, struct mbuf *,
108 1.23.16.4 phil const struct sockaddr *, const struct rtentry *ro);
109 1.23.16.4 phil #endif
110 1.23.16.1 phil int ieee80211_vap_pkt_send_dest(struct ieee80211vap *, struct mbuf *,
111 1.10 dyoung struct ieee80211_node *);
112 1.23.16.1 phil int ieee80211_raw_output(struct ieee80211vap *, struct ieee80211_node *,
113 1.23.16.1 phil struct mbuf *, const struct ieee80211_bpf_params *);
114 1.23.16.1 phil void ieee80211_send_setup(struct ieee80211_node *, struct mbuf *, int, int,
115 1.23.16.1 phil const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN],
116 1.23.16.1 phil const uint8_t [IEEE80211_ADDR_LEN]);
117 1.23.16.1 phil int ieee80211_vap_transmit(struct ifnet *ifp, struct mbuf *m);
118 1.23.16.1 phil void ieee80211_vap_qflush(struct ifnet *ifp);
119 1.23.16.1 phil int ieee80211_send_nulldata(struct ieee80211_node *);
120 1.23.16.1 phil int ieee80211_classify(struct ieee80211_node *, struct mbuf *m);
121 1.23.16.1 phil struct mbuf *ieee80211_mbuf_adjust(struct ieee80211vap *, int,
122 1.23.16.1 phil struct ieee80211_key *, struct mbuf *);
123 1.23.16.1 phil struct mbuf *ieee80211_encap(struct ieee80211vap *, struct ieee80211_node *,
124 1.3 dyoung struct mbuf *);
125 1.23.16.1 phil void ieee80211_free_mbuf(struct mbuf *);
126 1.23.16.1 phil int ieee80211_send_mgmt(struct ieee80211_node *, int, int);
127 1.23.16.1 phil struct ieee80211_appie;
128 1.23.16.1 phil int ieee80211_send_probereq(struct ieee80211_node *ni,
129 1.23.16.1 phil const uint8_t sa[IEEE80211_ADDR_LEN],
130 1.23.16.1 phil const uint8_t da[IEEE80211_ADDR_LEN],
131 1.23.16.1 phil const uint8_t bssid[IEEE80211_ADDR_LEN],
132 1.23.16.1 phil const uint8_t *ssid, size_t ssidlen);
133 1.23.16.1 phil struct mbuf * ieee80211_ff_encap1(struct ieee80211vap *, struct mbuf *,
134 1.23.16.1 phil const struct ether_header *);
135 1.23.16.1 phil void ieee80211_tx_complete(struct ieee80211_node *,
136 1.23.16.1 phil struct mbuf *, int);
137 1.10 dyoung
138 1.23.16.1 phil /*
139 1.23.16.1 phil * The formation of ProbeResponse frames requires guidance to
140 1.23.16.1 phil * deal with legacy clients. When the client is identified as
141 1.23.16.1 phil * "legacy 11b" ieee80211_send_proberesp is passed this token.
142 1.23.16.1 phil */
143 1.23.16.1 phil #define IEEE80211_SEND_LEGACY_11B 0x1 /* legacy 11b client */
144 1.23.16.1 phil #define IEEE80211_SEND_LEGACY_11 0x2 /* other legacy client */
145 1.23.16.1 phil #define IEEE80211_SEND_LEGACY 0x3 /* any legacy client */
146 1.23.16.1 phil struct mbuf *ieee80211_alloc_proberesp(struct ieee80211_node *, int);
147 1.23.16.1 phil int ieee80211_send_proberesp(struct ieee80211vap *,
148 1.23.16.1 phil const uint8_t da[IEEE80211_ADDR_LEN], int);
149 1.23.16.1 phil struct mbuf *ieee80211_alloc_rts(struct ieee80211com *ic,
150 1.23.16.1 phil const uint8_t [IEEE80211_ADDR_LEN],
151 1.23.16.1 phil const uint8_t [IEEE80211_ADDR_LEN], uint16_t);
152 1.23.16.1 phil struct mbuf *ieee80211_alloc_cts(struct ieee80211com *,
153 1.23.16.1 phil const uint8_t [IEEE80211_ADDR_LEN], uint16_t);
154 1.23.16.1 phil struct mbuf *ieee80211_alloc_prot(struct ieee80211_node *,
155 1.23.16.1 phil const struct mbuf *, uint8_t, int);
156 1.23.16.1 phil
157 1.23.16.1 phil uint8_t *ieee80211_add_rates(uint8_t *, const struct ieee80211_rateset *);
158 1.23.16.1 phil uint8_t *ieee80211_add_xrates(uint8_t *, const struct ieee80211_rateset *);
159 1.23.16.1 phil uint8_t *ieee80211_add_ssid(uint8_t *, const uint8_t *, u_int);
160 1.23.16.1 phil uint8_t *ieee80211_add_wpa(uint8_t *, const struct ieee80211vap *);
161 1.23.16.1 phil uint8_t *ieee80211_add_rsn(uint8_t *, const struct ieee80211vap *);
162 1.23.16.1 phil uint8_t *ieee80211_add_qos(uint8_t *, const struct ieee80211_node *);
163 1.23.16.1 phil uint16_t ieee80211_getcapinfo(struct ieee80211vap *,
164 1.23.16.1 phil struct ieee80211_channel *);
165 1.23 nonaka struct ieee80211_wme_state;
166 1.23.16.1 phil uint8_t * ieee80211_add_wme_info(uint8_t *frm, struct ieee80211_wme_state *wme);
167 1.23 nonaka
168 1.10 dyoung void ieee80211_reset_erp(struct ieee80211com *);
169 1.10 dyoung void ieee80211_set_shortslottime(struct ieee80211com *, int onoff);
170 1.23.16.1 phil int ieee80211_iserp_rateset(const struct ieee80211_rateset *);
171 1.23.16.1 phil void ieee80211_setbasicrates(struct ieee80211_rateset *,
172 1.23.16.1 phil enum ieee80211_phymode);
173 1.23.16.1 phil void ieee80211_addbasicrates(struct ieee80211_rateset *,
174 1.10 dyoung enum ieee80211_phymode);
175 1.10 dyoung
176 1.10 dyoung /*
177 1.10 dyoung * Return the size of the 802.11 header for a management or data frame.
178 1.10 dyoung */
179 1.10 dyoung static __inline int
180 1.10 dyoung ieee80211_hdrsize(const void *data)
181 1.10 dyoung {
182 1.10 dyoung const struct ieee80211_frame *wh = data;
183 1.10 dyoung int size = sizeof(struct ieee80211_frame);
184 1.10 dyoung
185 1.10 dyoung /* NB: we don't handle control frames */
186 1.23.16.3 phil #if __FreeBSD__
187 1.23.16.1 phil KASSERT((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL,
188 1.10 dyoung ("%s: control frame", __func__));
189 1.23.16.3 phil #elif __NetBSD__
190 1.23.16.3 phil FBSDKASSERT((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL,
191 1.23.16.3 phil ("%s: control frame", __func__));
192 1.23.16.3 phil #else
193 1.23.16.3 phil #error
194 1.23.16.3 phil #endif
195 1.23.16.1 phil if (IEEE80211_IS_DSTODS(wh))
196 1.10 dyoung size += IEEE80211_ADDR_LEN;
197 1.23.16.1 phil if (IEEE80211_QOS_HAS_SEQ(wh))
198 1.23.16.1 phil size += sizeof(uint16_t);
199 1.10 dyoung return size;
200 1.10 dyoung }
201 1.10 dyoung
202 1.10 dyoung /*
203 1.23.16.1 phil * Like ieee80211_hdrsize, but handles any type of frame.
204 1.10 dyoung */
205 1.10 dyoung static __inline int
206 1.10 dyoung ieee80211_anyhdrsize(const void *data)
207 1.10 dyoung {
208 1.10 dyoung const struct ieee80211_frame *wh = data;
209 1.10 dyoung
210 1.10 dyoung if ((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) {
211 1.10 dyoung switch (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) {
212 1.10 dyoung case IEEE80211_FC0_SUBTYPE_CTS:
213 1.10 dyoung case IEEE80211_FC0_SUBTYPE_ACK:
214 1.10 dyoung return sizeof(struct ieee80211_frame_ack);
215 1.23.16.1 phil case IEEE80211_FC0_SUBTYPE_BAR:
216 1.23.16.1 phil return sizeof(struct ieee80211_frame_bar);
217 1.10 dyoung }
218 1.10 dyoung return sizeof(struct ieee80211_frame_min);
219 1.10 dyoung } else
220 1.10 dyoung return ieee80211_hdrsize(data);
221 1.10 dyoung }
222 1.10 dyoung
223 1.10 dyoung /*
224 1.10 dyoung * Template for an in-kernel authenticator. Authenticators
225 1.10 dyoung * register with the protocol code and are typically loaded
226 1.23.16.1 phil * as separate modules as needed. One special authenticator
227 1.23.16.1 phil * is xauth; it intercepts requests so that protocols like
228 1.23.16.1 phil * WPA can be handled in user space.
229 1.10 dyoung */
230 1.10 dyoung struct ieee80211_authenticator {
231 1.10 dyoung const char *ia_name; /* printable name */
232 1.23.16.1 phil int (*ia_attach)(struct ieee80211vap *);
233 1.23.16.1 phil void (*ia_detach)(struct ieee80211vap *);
234 1.23.16.1 phil void (*ia_node_join)(struct ieee80211_node *);
235 1.23.16.1 phil void (*ia_node_leave)(struct ieee80211_node *);
236 1.10 dyoung };
237 1.10 dyoung void ieee80211_authenticator_register(int type,
238 1.10 dyoung const struct ieee80211_authenticator *);
239 1.10 dyoung void ieee80211_authenticator_unregister(int type);
240 1.10 dyoung const struct ieee80211_authenticator *ieee80211_authenticator_get(int auth);
241 1.10 dyoung
242 1.13 skrll struct ieee80211req;
243 1.10 dyoung /*
244 1.10 dyoung * Template for an MAC ACL policy module. Such modules
245 1.10 dyoung * register with the protocol code and are passed the sender's
246 1.23.16.1 phil * address of each received auth frame for validation.
247 1.10 dyoung */
248 1.10 dyoung struct ieee80211_aclator {
249 1.10 dyoung const char *iac_name; /* printable name */
250 1.23.16.1 phil int (*iac_attach)(struct ieee80211vap *);
251 1.23.16.1 phil void (*iac_detach)(struct ieee80211vap *);
252 1.23.16.1 phil int (*iac_check)(struct ieee80211vap *,
253 1.23.16.1 phil const struct ieee80211_frame *wh);
254 1.23.16.1 phil int (*iac_add)(struct ieee80211vap *,
255 1.23.16.1 phil const uint8_t mac[IEEE80211_ADDR_LEN]);
256 1.23.16.1 phil int (*iac_remove)(struct ieee80211vap *,
257 1.23.16.1 phil const uint8_t mac[IEEE80211_ADDR_LEN]);
258 1.23.16.1 phil int (*iac_flush)(struct ieee80211vap *);
259 1.23.16.1 phil int (*iac_setpolicy)(struct ieee80211vap *, int);
260 1.23.16.1 phil int (*iac_getpolicy)(struct ieee80211vap *);
261 1.23.16.1 phil int (*iac_setioctl)(struct ieee80211vap *, struct ieee80211req *);
262 1.23.16.1 phil int (*iac_getioctl)(struct ieee80211vap *, struct ieee80211req *);
263 1.10 dyoung };
264 1.10 dyoung void ieee80211_aclator_register(const struct ieee80211_aclator *);
265 1.10 dyoung void ieee80211_aclator_unregister(const struct ieee80211_aclator *);
266 1.10 dyoung const struct ieee80211_aclator *ieee80211_aclator_get(const char *name);
267 1.10 dyoung
268 1.10 dyoung /* flags for ieee80211_fix_rate() */
269 1.23.16.1 phil #define IEEE80211_F_DOSORT 0x00000001 /* sort rate list */
270 1.23.16.1 phil #define IEEE80211_F_DOFRATE 0x00000002 /* use fixed legacy rate */
271 1.23.16.1 phil #define IEEE80211_F_DONEGO 0x00000004 /* calc negotiated rate */
272 1.23.16.1 phil #define IEEE80211_F_DODEL 0x00000008 /* delete ignore rate */
273 1.23.16.1 phil #define IEEE80211_F_DOBRS 0x00000010 /* check basic rate set */
274 1.23.16.1 phil #define IEEE80211_F_JOIN 0x00000020 /* sta joining our bss */
275 1.23.16.1 phil #define IEEE80211_F_DOFMCS 0x00000040 /* use fixed HT rate */
276 1.23.16.1 phil int ieee80211_fix_rate(struct ieee80211_node *,
277 1.23.16.1 phil struct ieee80211_rateset *, int);
278 1.10 dyoung
279 1.10 dyoung /*
280 1.10 dyoung * WME/WMM support.
281 1.10 dyoung */
282 1.10 dyoung struct wmeParams {
283 1.23.16.1 phil uint8_t wmep_acm;
284 1.23.16.1 phil uint8_t wmep_aifsn;
285 1.23.16.1 phil uint8_t wmep_logcwmin; /* log2(cwmin) */
286 1.23.16.1 phil uint8_t wmep_logcwmax; /* log2(cwmax) */
287 1.23.16.1 phil uint8_t wmep_txopLimit;
288 1.23.16.1 phil uint8_t wmep_noackPolicy; /* 0 (ack), 1 (no ack) */
289 1.10 dyoung };
290 1.10 dyoung #define IEEE80211_TXOP_TO_US(_txop) ((_txop)<<5)
291 1.10 dyoung #define IEEE80211_US_TO_TXOP(_us) ((_us)>>5)
292 1.10 dyoung
293 1.10 dyoung struct chanAccParams {
294 1.23.16.1 phil uint8_t cap_info; /* version of the current set */
295 1.10 dyoung struct wmeParams cap_wmeParams[WME_NUM_AC];
296 1.10 dyoung };
297 1.10 dyoung
298 1.10 dyoung struct ieee80211_wme_state {
299 1.10 dyoung u_int wme_flags;
300 1.23.16.1 phil #define WME_F_AGGRMODE 0x00000001 /* STATUS: WME aggressive mode */
301 1.10 dyoung u_int wme_hipri_traffic; /* VI/VO frames in beacon interval */
302 1.23.16.1 phil u_int wme_hipri_switch_thresh;/* aggressive mode switch thresh */
303 1.23.16.1 phil u_int wme_hipri_switch_hysteresis;/* aggressive mode switch hysteresis */
304 1.10 dyoung
305 1.10 dyoung struct wmeParams wme_params[4]; /* from assoc resp for each AC*/
306 1.10 dyoung struct chanAccParams wme_wmeChanParams; /* WME params applied to self */
307 1.10 dyoung struct chanAccParams wme_wmeBssChanParams;/* WME params bcast to stations */
308 1.10 dyoung struct chanAccParams wme_chanParams; /* params applied to self */
309 1.10 dyoung struct chanAccParams wme_bssChanParams; /* params bcast to stations */
310 1.10 dyoung
311 1.10 dyoung int (*wme_update)(struct ieee80211com *);
312 1.10 dyoung };
313 1.10 dyoung
314 1.23.16.1 phil void ieee80211_wme_initparams(struct ieee80211vap *);
315 1.23.16.1 phil void ieee80211_wme_updateparams(struct ieee80211vap *);
316 1.23.16.1 phil void ieee80211_wme_updateparams_locked(struct ieee80211vap *);
317 1.23.16.1 phil void ieee80211_wme_vap_getparams(struct ieee80211vap *vap,
318 1.23.16.1 phil struct chanAccParams *);
319 1.23.16.1 phil void ieee80211_wme_ic_getparams(struct ieee80211com *ic,
320 1.23.16.1 phil struct chanAccParams *);
321 1.23.16.1 phil int ieee80211_wme_vap_ac_is_noack(struct ieee80211vap *vap, int ac);
322 1.23.16.1 phil
323 1.23.16.1 phil /*
324 1.23.16.1 phil * Return the WME TID from a QoS frame. If no TID
325 1.23.16.1 phil * is present return the index for the "non-QoS" entry.
326 1.23.16.1 phil */
327 1.23.16.1 phil static __inline uint8_t
328 1.23.16.1 phil ieee80211_gettid(const struct ieee80211_frame *wh)
329 1.23.16.1 phil {
330 1.23.16.1 phil uint8_t tid;
331 1.23.16.1 phil
332 1.23.16.1 phil if (IEEE80211_QOS_HAS_SEQ(wh)) {
333 1.23.16.1 phil if (IEEE80211_IS_DSTODS(wh))
334 1.23.16.1 phil tid = ((const struct ieee80211_qosframe_addr4 *)wh)->
335 1.23.16.1 phil i_qos[0];
336 1.23.16.1 phil else
337 1.23.16.1 phil tid = ((const struct ieee80211_qosframe *)wh)->i_qos[0];
338 1.23.16.1 phil tid &= IEEE80211_QOS_TID;
339 1.23.16.1 phil } else
340 1.23.16.1 phil tid = IEEE80211_NONQOS_TID;
341 1.23.16.1 phil return tid;
342 1.23.16.1 phil }
343 1.23.16.1 phil
344 1.23.16.1 phil void ieee80211_waitfor_parent(struct ieee80211com *);
345 1.23.16.1 phil void ieee80211_start_locked(struct ieee80211vap *);
346 1.23.16.4 phil #if __FreeBSD__
347 1.23.16.1 phil void ieee80211_init(void *);
348 1.23.16.4 phil #elif __NetBSD__
349 1.23.16.4 phil int ieee80211_init(struct ifnet *);
350 1.23.16.4 phil #endif
351 1.23.16.1 phil void ieee80211_start_all(struct ieee80211com *);
352 1.23.16.1 phil void ieee80211_stop_locked(struct ieee80211vap *);
353 1.23.16.1 phil void ieee80211_stop(struct ieee80211vap *);
354 1.23.16.1 phil void ieee80211_stop_all(struct ieee80211com *);
355 1.23.16.1 phil void ieee80211_suspend_all(struct ieee80211com *);
356 1.23.16.1 phil void ieee80211_resume_all(struct ieee80211com *);
357 1.23.16.1 phil void ieee80211_restart_all(struct ieee80211com *);
358 1.23.16.1 phil void ieee80211_dturbo_switch(struct ieee80211vap *, int newflags);
359 1.23.16.1 phil void ieee80211_swbmiss(void *arg);
360 1.16 dyoung void ieee80211_beacon_miss(struct ieee80211com *);
361 1.23.16.1 phil int ieee80211_new_state(struct ieee80211vap *, enum ieee80211_state, int);
362 1.23.16.1 phil int ieee80211_new_state_locked(struct ieee80211vap *, enum ieee80211_state,
363 1.23.16.1 phil int);
364 1.23.16.1 phil void ieee80211_print_essid(const uint8_t *, int);
365 1.23.16.1 phil void ieee80211_dump_pkt(struct ieee80211com *,
366 1.23.16.1 phil const uint8_t *, int, int, int);
367 1.1 dyoung
368 1.23.16.1 phil extern const char *ieee80211_opmode_name[];
369 1.1 dyoung extern const char *ieee80211_state_name[IEEE80211_S_MAX];
370 1.10 dyoung extern const char *ieee80211_wme_acnames[];
371 1.10 dyoung
372 1.10 dyoung /*
373 1.10 dyoung * Beacon frames constructed by ieee80211_beacon_alloc
374 1.10 dyoung * have the following structure filled in so drivers
375 1.10 dyoung * can update the frame later w/ minimal overhead.
376 1.10 dyoung */
377 1.10 dyoung struct ieee80211_beacon_offsets {
378 1.23.16.1 phil uint8_t bo_flags[4]; /* update/state flags */
379 1.23.16.1 phil uint16_t *bo_caps; /* capabilities */
380 1.23.16.1 phil uint8_t *bo_cfp; /* start of CFParms element */
381 1.23.16.1 phil uint8_t *bo_tim; /* start of atim/dtim */
382 1.23.16.1 phil uint8_t *bo_wme; /* start of WME parameters */
383 1.23.16.1 phil uint8_t *bo_tdma; /* start of TDMA parameters */
384 1.23.16.1 phil uint8_t *bo_tim_trailer;/* start of fixed-size trailer */
385 1.23.16.1 phil uint16_t bo_tim_len; /* atim/dtim length in bytes */
386 1.23.16.1 phil uint16_t bo_tim_trailer_len;/* tim trailer length in bytes */
387 1.23.16.1 phil uint8_t *bo_erp; /* start of ERP element */
388 1.23.16.1 phil uint8_t *bo_htinfo; /* start of HT info element */
389 1.23.16.1 phil uint8_t *bo_ath; /* start of ATH parameters */
390 1.23.16.1 phil uint8_t *bo_appie; /* start of AppIE element */
391 1.23.16.1 phil uint16_t bo_appie_len; /* AppIE length in bytes */
392 1.23.16.1 phil uint16_t bo_csa_trailer_len;
393 1.23.16.1 phil uint8_t *bo_csa; /* start of CSA element */
394 1.23.16.1 phil uint8_t *bo_quiet; /* start of Quiet element */
395 1.23.16.1 phil uint8_t *bo_meshconf; /* start of MESHCONF element */
396 1.23.16.1 phil uint8_t *bo_vhtinfo; /* start of VHT info element (XXX VHTCAP?) */
397 1.23.16.1 phil uint8_t *bo_spare[2];
398 1.10 dyoung };
399 1.23.16.1 phil struct mbuf *ieee80211_beacon_alloc(struct ieee80211_node *);
400 1.23.16.1 phil
401 1.23.16.1 phil /*
402 1.23.16.1 phil * Beacon frame updates are signaled through calls to iv_update_beacon
403 1.23.16.1 phil * with one of the IEEE80211_BEACON_* tokens defined below. For devices
404 1.23.16.1 phil * that construct beacon frames on the host this can trigger a rebuild
405 1.23.16.1 phil * or defer the processing. For devices that offload beacon frame
406 1.23.16.1 phil * handling this callback can be used to signal a rebuild. The bo_flags
407 1.23.16.1 phil * array in the ieee80211_beacon_offsets structure is intended to record
408 1.23.16.1 phil * deferred processing requirements; ieee80211_beacon_update uses the
409 1.23.16.1 phil * state to optimize work. Since this structure is owned by the driver
410 1.23.16.1 phil * and not visible to the 802.11 layer drivers must supply an iv_update_beacon
411 1.23.16.1 phil * callback that marks the flag bits and schedules (as necessary) an update.
412 1.23.16.1 phil */
413 1.23.16.1 phil enum {
414 1.23.16.1 phil IEEE80211_BEACON_CAPS = 0, /* capabilities */
415 1.23.16.1 phil IEEE80211_BEACON_TIM = 1, /* DTIM/ATIM */
416 1.23.16.1 phil IEEE80211_BEACON_WME = 2,
417 1.23.16.1 phil IEEE80211_BEACON_ERP = 3, /* Extended Rate Phy */
418 1.23.16.1 phil IEEE80211_BEACON_HTINFO = 4, /* HT Information */
419 1.23.16.1 phil IEEE80211_BEACON_APPIE = 5, /* Application IE's */
420 1.23.16.1 phil IEEE80211_BEACON_CFP = 6, /* CFParms */
421 1.23.16.1 phil IEEE80211_BEACON_CSA = 7, /* Channel Switch Announcement */
422 1.23.16.1 phil IEEE80211_BEACON_TDMA = 9, /* TDMA Info */
423 1.23.16.1 phil IEEE80211_BEACON_ATH = 10, /* ATH parameters */
424 1.23.16.1 phil IEEE80211_BEACON_MESHCONF = 11, /* Mesh Configuration */
425 1.23.16.1 phil IEEE80211_BEACON_QUIET = 12, /* Quiet time IE */
426 1.23.16.1 phil IEEE80211_BEACON_VHTINFO = 13, /* VHT information */
427 1.23.16.1 phil };
428 1.23.16.1 phil int ieee80211_beacon_update(struct ieee80211_node *,
429 1.23.16.1 phil struct mbuf *, int mcast);
430 1.23.16.1 phil
431 1.23.16.1 phil void ieee80211_csa_startswitch(struct ieee80211com *,
432 1.23.16.1 phil struct ieee80211_channel *, int mode, int count);
433 1.23.16.1 phil void ieee80211_csa_completeswitch(struct ieee80211com *);
434 1.23.16.1 phil void ieee80211_csa_cancelswitch(struct ieee80211com *);
435 1.23.16.1 phil void ieee80211_cac_completeswitch(struct ieee80211vap *);
436 1.10 dyoung
437 1.10 dyoung /*
438 1.10 dyoung * Notification methods called from the 802.11 state machine.
439 1.10 dyoung * Note that while these are defined here, their implementation
440 1.10 dyoung * is OS-specific.
441 1.10 dyoung */
442 1.23.16.1 phil void ieee80211_notify_node_join(struct ieee80211_node *, int newassoc);
443 1.23.16.1 phil void ieee80211_notify_node_leave(struct ieee80211_node *);
444 1.23.16.1 phil void ieee80211_notify_scan_done(struct ieee80211vap *);
445 1.23.16.1 phil void ieee80211_notify_wds_discover(struct ieee80211_node *);
446 1.23.16.1 phil void ieee80211_notify_csa(struct ieee80211com *,
447 1.23.16.1 phil const struct ieee80211_channel *, int mode, int count);
448 1.23.16.1 phil void ieee80211_notify_radar(struct ieee80211com *,
449 1.23.16.1 phil const struct ieee80211_channel *);
450 1.23.16.1 phil enum ieee80211_notify_cac_event {
451 1.23.16.1 phil IEEE80211_NOTIFY_CAC_START = 0, /* CAC timer started */
452 1.23.16.1 phil IEEE80211_NOTIFY_CAC_STOP = 1, /* CAC intentionally stopped */
453 1.23.16.1 phil IEEE80211_NOTIFY_CAC_RADAR = 2, /* CAC stopped due to radar detectio */
454 1.23.16.1 phil IEEE80211_NOTIFY_CAC_EXPIRE = 3, /* CAC expired w/o radar */
455 1.23.16.1 phil };
456 1.23.16.1 phil void ieee80211_notify_cac(struct ieee80211com *,
457 1.23.16.1 phil const struct ieee80211_channel *,
458 1.23.16.1 phil enum ieee80211_notify_cac_event);
459 1.23.16.1 phil void ieee80211_notify_node_deauth(struct ieee80211_node *);
460 1.23.16.1 phil void ieee80211_notify_node_auth(struct ieee80211_node *);
461 1.23.16.1 phil void ieee80211_notify_country(struct ieee80211vap *, const uint8_t [],
462 1.23.16.1 phil const uint8_t cc[2]);
463 1.23.16.1 phil void ieee80211_notify_radio(struct ieee80211com *, int);
464 1.23.16.1 phil #endif /* _NET80211_IEEE80211_PROTO_H_ */
465