2 * Copyright (c) 2003-2008 Sam Leffler, Errno Consulting
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #ifndef _NET80211_IEEE80211_FREEBSD_H_
28 #define _NET80211_IEEE80211_FREEBSD_H_
31 #include <sys/types.h>
32 #include <sys/systm.h>
33 #include <sys/counter.h>
35 #include <sys/mutex.h>
36 #include <sys/rwlock.h>
37 #include <sys/sysctl.h>
38 #include <sys/taskqueue.h>
41 * Common state locking definitions.
44 char name[16]; /* e.g. "ath0_com_lock" */
46 } ieee80211_com_lock_t;
47 #define IEEE80211_LOCK_INIT(_ic, _name) do { \
48 ieee80211_com_lock_t *cl = &(_ic)->ic_comlock; \
49 snprintf(cl->name, sizeof(cl->name), "%s_com_lock", _name); \
50 mtx_init(&cl->mtx, cl->name, NULL, MTX_DEF | MTX_RECURSE); \
52 #define IEEE80211_LOCK_OBJ(_ic) (&(_ic)->ic_comlock.mtx)
53 #define IEEE80211_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_LOCK_OBJ(_ic))
54 #define IEEE80211_LOCK(_ic) mtx_lock(IEEE80211_LOCK_OBJ(_ic))
55 #define IEEE80211_UNLOCK(_ic) mtx_unlock(IEEE80211_LOCK_OBJ(_ic))
56 #define IEEE80211_LOCK_ASSERT(_ic) \
57 mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED)
58 #define IEEE80211_UNLOCK_ASSERT(_ic) \
59 mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_NOTOWNED)
64 * This is a (mostly) temporary lock designed to serialise all of the
65 * transmission operations throughout the stack.
68 char name[16]; /* e.g. "ath0_com_lock" */
70 } ieee80211_tx_lock_t;
71 #define IEEE80211_TX_LOCK_INIT(_ic, _name) do { \
72 ieee80211_tx_lock_t *cl = &(_ic)->ic_txlock; \
73 snprintf(cl->name, sizeof(cl->name), "%s_tx_lock", _name); \
74 mtx_init(&cl->mtx, cl->name, NULL, MTX_DEF); \
76 #define IEEE80211_TX_LOCK_OBJ(_ic) (&(_ic)->ic_txlock.mtx)
77 #define IEEE80211_TX_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_TX_LOCK_OBJ(_ic))
78 #define IEEE80211_TX_LOCK(_ic) mtx_lock(IEEE80211_TX_LOCK_OBJ(_ic))
79 #define IEEE80211_TX_UNLOCK(_ic) mtx_unlock(IEEE80211_TX_LOCK_OBJ(_ic))
80 #define IEEE80211_TX_LOCK_ASSERT(_ic) \
81 mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_OWNED)
82 #define IEEE80211_TX_UNLOCK_ASSERT(_ic) \
83 mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_NOTOWNED)
86 * Node locking definitions.
89 char name[16]; /* e.g. "ath0_node_lock" */
91 } ieee80211_node_lock_t;
92 #define IEEE80211_NODE_LOCK_INIT(_nt, _name) do { \
93 ieee80211_node_lock_t *nl = &(_nt)->nt_nodelock; \
94 snprintf(nl->name, sizeof(nl->name), "%s_node_lock", _name); \
95 mtx_init(&nl->mtx, nl->name, NULL, MTX_DEF | MTX_RECURSE); \
97 #define IEEE80211_NODE_LOCK_OBJ(_nt) (&(_nt)->nt_nodelock.mtx)
98 #define IEEE80211_NODE_LOCK_DESTROY(_nt) \
99 mtx_destroy(IEEE80211_NODE_LOCK_OBJ(_nt))
100 #define IEEE80211_NODE_LOCK(_nt) \
101 mtx_lock(IEEE80211_NODE_LOCK_OBJ(_nt))
102 #define IEEE80211_NODE_IS_LOCKED(_nt) \
103 mtx_owned(IEEE80211_NODE_LOCK_OBJ(_nt))
104 #define IEEE80211_NODE_UNLOCK(_nt) \
105 mtx_unlock(IEEE80211_NODE_LOCK_OBJ(_nt))
106 #define IEEE80211_NODE_LOCK_ASSERT(_nt) \
107 mtx_assert(IEEE80211_NODE_LOCK_OBJ(_nt), MA_OWNED)
110 * Node table iteration locking definitions; this protects the
111 * scan generation # used to iterate over the station table
112 * while grabbing+releasing the node lock.
115 char name[16]; /* e.g. "ath0_scan_lock" */
117 } ieee80211_scan_lock_t;
118 #define IEEE80211_NODE_ITERATE_LOCK_INIT(_nt, _name) do { \
119 ieee80211_scan_lock_t *sl = &(_nt)->nt_scanlock; \
120 snprintf(sl->name, sizeof(sl->name), "%s_scan_lock", _name); \
121 mtx_init(&sl->mtx, sl->name, NULL, MTX_DEF); \
123 #define IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt) (&(_nt)->nt_scanlock.mtx)
124 #define IEEE80211_NODE_ITERATE_LOCK_DESTROY(_nt) \
125 mtx_destroy(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))
126 #define IEEE80211_NODE_ITERATE_LOCK(_nt) \
127 mtx_lock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))
128 #define IEEE80211_NODE_ITERATE_UNLOCK(_nt) \
129 mtx_unlock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))
132 * Power-save queue definitions.
134 typedef struct mtx ieee80211_psq_lock_t;
135 #define IEEE80211_PSQ_INIT(_psq, _name) \
136 mtx_init(&(_psq)->psq_lock, _name, "802.11 ps q", MTX_DEF)
137 #define IEEE80211_PSQ_DESTROY(_psq) mtx_destroy(&(_psq)->psq_lock)
138 #define IEEE80211_PSQ_LOCK(_psq) mtx_lock(&(_psq)->psq_lock)
139 #define IEEE80211_PSQ_UNLOCK(_psq) mtx_unlock(&(_psq)->psq_lock)
141 #ifndef IF_PREPEND_LIST
142 #define _IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \
143 (mtail)->m_nextpkt = (ifq)->ifq_head; \
144 if ((ifq)->ifq_tail == NULL) \
145 (ifq)->ifq_tail = (mtail); \
146 (ifq)->ifq_head = (mhead); \
147 (ifq)->ifq_len += (mcount); \
149 #define IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \
151 _IF_PREPEND_LIST(ifq, mhead, mtail, mcount); \
154 #endif /* IF_PREPEND_LIST */
157 * Age queue definitions.
159 typedef struct mtx ieee80211_ageq_lock_t;
160 #define IEEE80211_AGEQ_INIT(_aq, _name) \
161 mtx_init(&(_aq)->aq_lock, _name, "802.11 age q", MTX_DEF)
162 #define IEEE80211_AGEQ_DESTROY(_aq) mtx_destroy(&(_aq)->aq_lock)
163 #define IEEE80211_AGEQ_LOCK(_aq) mtx_lock(&(_aq)->aq_lock)
164 #define IEEE80211_AGEQ_UNLOCK(_aq) mtx_unlock(&(_aq)->aq_lock)
167 * 802.1x MAC ACL database locking definitions.
169 typedef struct mtx acl_lock_t;
170 #define ACL_LOCK_INIT(_as, _name) \
171 mtx_init(&(_as)->as_lock, _name, "802.11 ACL", MTX_DEF)
172 #define ACL_LOCK_DESTROY(_as) mtx_destroy(&(_as)->as_lock)
173 #define ACL_LOCK(_as) mtx_lock(&(_as)->as_lock)
174 #define ACL_UNLOCK(_as) mtx_unlock(&(_as)->as_lock)
175 #define ACL_LOCK_ASSERT(_as) \
176 mtx_assert((&(_as)->as_lock), MA_OWNED)
179 * Scan table definitions.
181 typedef struct mtx ieee80211_scan_table_lock_t;
182 #define IEEE80211_SCAN_TABLE_LOCK_INIT(_st, _name) \
183 mtx_init(&(_st)->st_lock, _name, "802.11 scan table", MTX_DEF)
184 #define IEEE80211_SCAN_TABLE_LOCK_DESTROY(_st) mtx_destroy(&(_st)->st_lock)
185 #define IEEE80211_SCAN_TABLE_LOCK(_st) mtx_lock(&(_st)->st_lock)
186 #define IEEE80211_SCAN_TABLE_UNLOCK(_st) mtx_unlock(&(_st)->st_lock)
188 typedef struct mtx ieee80211_scan_iter_lock_t;
189 #define IEEE80211_SCAN_ITER_LOCK_INIT(_st, _name) \
190 mtx_init(&(_st)->st_scanlock, _name, "802.11 scangen", MTX_DEF)
191 #define IEEE80211_SCAN_ITER_LOCK_DESTROY(_st) mtx_destroy(&(_st)->st_scanlock)
192 #define IEEE80211_SCAN_ITER_LOCK(_st) mtx_lock(&(_st)->st_scanlock)
193 #define IEEE80211_SCAN_ITER_UNLOCK(_st) mtx_unlock(&(_st)->st_scanlock)
196 * Mesh node/routing definitions.
198 typedef struct mtx ieee80211_rte_lock_t;
199 #define MESH_RT_ENTRY_LOCK_INIT(_rt, _name) \
200 mtx_init(&(rt)->rt_lock, _name, "802.11s route entry", MTX_DEF)
201 #define MESH_RT_ENTRY_LOCK_DESTROY(_rt) \
202 mtx_destroy(&(_rt)->rt_lock)
203 #define MESH_RT_ENTRY_LOCK(rt) mtx_lock(&(rt)->rt_lock)
204 #define MESH_RT_ENTRY_LOCK_ASSERT(rt) mtx_assert(&(rt)->rt_lock, MA_OWNED)
205 #define MESH_RT_ENTRY_UNLOCK(rt) mtx_unlock(&(rt)->rt_lock)
207 typedef struct mtx ieee80211_rt_lock_t;
208 #define MESH_RT_LOCK(ms) mtx_lock(&(ms)->ms_rt_lock)
209 #define MESH_RT_LOCK_ASSERT(ms) mtx_assert(&(ms)->ms_rt_lock, MA_OWNED)
210 #define MESH_RT_UNLOCK(ms) mtx_unlock(&(ms)->ms_rt_lock)
211 #define MESH_RT_LOCK_INIT(ms, name) \
212 mtx_init(&(ms)->ms_rt_lock, name, "802.11s routing table", MTX_DEF)
213 #define MESH_RT_LOCK_DESTROY(ms) \
214 mtx_destroy(&(ms)->ms_rt_lock)
217 * Node reference counting definitions.
219 * ieee80211_node_initref initialize the reference count to 1
220 * ieee80211_node_incref add a reference
221 * ieee80211_node_decref remove a reference
222 * ieee80211_node_dectestref remove a reference and return 1 if this
223 * is the last reference, otherwise 0
224 * ieee80211_node_refcnt reference count for printing (only)
226 #include <machine/atomic.h>
228 #define ieee80211_node_initref(_ni) \
229 do { ((_ni)->ni_refcnt = 1); } while (0)
230 #define ieee80211_node_incref(_ni) \
231 atomic_add_int(&(_ni)->ni_refcnt, 1)
232 #define ieee80211_node_decref(_ni) \
233 atomic_subtract_int(&(_ni)->ni_refcnt, 1)
234 struct ieee80211_node;
235 int ieee80211_node_dectestref(struct ieee80211_node *ni);
236 #define ieee80211_node_refcnt(_ni) (_ni)->ni_refcnt
240 void ieee80211_drain_ifq(struct ifqueue *);
241 void ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *);
243 void ieee80211_vap_destroy(struct ieee80211vap *);
245 #define IFNET_IS_UP_RUNNING(_ifp) \
246 (((_ifp)->if_flags & IFF_UP) && \
247 ((_ifp)->if_drv_flags & IFF_DRV_RUNNING))
249 #define msecs_to_ticks(ms) (((ms)*hz)/1000)
250 #define ticks_to_msecs(t) (1000*(t) / hz)
251 #define ticks_to_secs(t) ((t) / hz)
252 #define time_after(a,b) ((long)(b) - (long)(a) < 0)
253 #define time_before(a,b) time_after(b,a)
254 #define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0)
255 #define time_before_eq(a,b) time_after_eq(b,a)
257 struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen);
260 #define M_ENCAP M_PROTO1 /* 802.11 encap done */
261 #define M_EAPOL M_PROTO3 /* PAE/EAPOL frame */
262 #define M_PWR_SAV M_PROTO4 /* bypass PS handling */
263 #define M_MORE_DATA M_PROTO5 /* more data frames to follow */
264 #define M_FF M_PROTO6 /* fast frame */
265 #define M_TXCB M_PROTO7 /* do tx complete callback */
266 #define M_AMPDU_MPDU M_PROTO8 /* ok for A-MPDU aggregation */
267 #define M_FRAG M_PROTO9 /* frame fragmentation */
268 #define M_FIRSTFRAG M_PROTO10 /* first frame fragment */
269 #define M_LASTFRAG M_PROTO11 /* last frame fragment */
272 (M_ENCAP|M_EAPOL|M_PWR_SAV|M_MORE_DATA|M_FF|M_TXCB| \
273 M_AMPDU_MPDU|M_FRAG|M_FIRSTFRAG|M_LASTFRAG)
276 #define M_AMPDU M_PROTO1 /* A-MPDU subframe */
277 #define M_WEP M_PROTO2 /* WEP done by hardware */
279 #define M_AMPDU_MPDU M_PROTO8 /* A-MPDU re-order done */
281 #define M_80211_RX (M_AMPDU|M_WEP|M_AMPDU_MPDU)
283 #define IEEE80211_MBUF_TX_FLAG_BITS \
285 "\15M_ENCAP\17M_EAPOL\20M_PWR_SAV\21M_MORE_DATA\22M_FF\23M_TXCB" \
286 "\24M_AMPDU_MPDU\25M_FRAG\26M_FIRSTFRAG\27M_LASTFRAG"
288 #define IEEE80211_MBUF_RX_FLAG_BITS \
290 "\15M_AMPDU\16M_WEP\24M_AMPDU_MPDU"
293 * Store WME access control bits in the vlan tag.
294 * This is safe since it's done after the packet is classified
295 * (where we use any previous tag) and because it's passed
296 * directly in to the driver and there's no chance someone
297 * else will clobber them on us.
299 #define M_WME_SETAC(m, ac) \
300 ((m)->m_pkthdr.ether_vtag = (ac))
301 #define M_WME_GETAC(m) ((m)->m_pkthdr.ether_vtag)
304 * Mbufs on the power save queue are tagged with an age and
305 * timed out. We reuse the hardware checksum field in the
306 * mbuf packet header to store this data.
308 #define M_AGE_SET(m,v) (m->m_pkthdr.csum_data = v)
309 #define M_AGE_GET(m) (m->m_pkthdr.csum_data)
310 #define M_AGE_SUB(m,adj) (m->m_pkthdr.csum_data -= adj)
313 * Store the sequence number.
315 #define M_SEQNO_SET(m, seqno) \
316 ((m)->m_pkthdr.tso_segsz = (seqno))
317 #define M_SEQNO_GET(m) ((m)->m_pkthdr.tso_segsz)
319 #define MTAG_ABI_NET80211 1132948340 /* net80211 ABI */
321 struct ieee80211_cb {
322 void (*func)(struct ieee80211_node *, void *, int status);
325 #define NET80211_TAG_CALLBACK 0 /* xmit complete callback */
326 int ieee80211_add_callback(struct mbuf *m,
327 void (*func)(struct ieee80211_node *, void *, int), void *arg);
328 void ieee80211_process_callback(struct ieee80211_node *, struct mbuf *, int);
330 #define NET80211_TAG_XMIT_PARAMS 1
331 /* See below; this is after the bpf_params definition */
334 int ieee80211_parent_xmitpkt(struct ieee80211com *, struct mbuf *);
335 int ieee80211_vap_xmitpkt(struct ieee80211vap *, struct mbuf *);
337 void get_random_bytes(void *, size_t);
339 void ieee80211_sysctl_attach(struct ieee80211com *);
340 void ieee80211_sysctl_detach(struct ieee80211com *);
341 void ieee80211_sysctl_vattach(struct ieee80211vap *);
342 void ieee80211_sysctl_vdetach(struct ieee80211vap *);
344 SYSCTL_DECL(_net_wlan);
345 int ieee80211_sysctl_msecs_ticks(SYSCTL_HANDLER_ARGS);
347 void ieee80211_load_module(const char *);
350 * A "policy module" is an adjunct module to net80211 that provides
351 * functionality that typically includes policy decisions. This
352 * modularity enables extensibility and vendor-supplied functionality.
354 #define _IEEE80211_POLICY_MODULE(policy, name, version) \
355 typedef void (*policy##_setup)(int); \
356 SET_DECLARE(policy##_set, policy##_setup); \
358 wlan_##name##_modevent(module_t mod, int type, void *unused) \
360 policy##_setup * const *iter, f; \
363 SET_FOREACH(iter, policy##_set) { \
371 printf("wlan_" #name ": still in use " \
372 "(%u dynamic refs)\n", nrefs); \
375 if (type == MOD_UNLOAD) { \
376 SET_FOREACH(iter, policy##_set) { \
385 static moduledata_t name##_mod = { \
387 wlan_##name##_modevent, \
390 DECLARE_MODULE(wlan_##name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\
391 MODULE_VERSION(wlan_##name, version); \
392 MODULE_DEPEND(wlan_##name, wlan, 1, 1, 1)
395 * Crypto modules implement cipher support.
397 #define IEEE80211_CRYPTO_MODULE(name, version) \
398 _IEEE80211_POLICY_MODULE(crypto, name, version); \
400 name##_modevent(int type) \
402 if (type == MOD_LOAD) \
403 ieee80211_crypto_register(&name); \
405 ieee80211_crypto_unregister(&name); \
407 TEXT_SET(crypto##_set, name##_modevent)
410 * Scanner modules provide scanning policy.
412 #define IEEE80211_SCANNER_MODULE(name, version) \
413 _IEEE80211_POLICY_MODULE(scanner, name, version)
415 #define IEEE80211_SCANNER_ALG(name, alg, v) \
417 name##_modevent(int type) \
419 if (type == MOD_LOAD) \
420 ieee80211_scanner_register(alg, &v); \
422 ieee80211_scanner_unregister(alg, &v); \
424 TEXT_SET(scanner_set, name##_modevent); \
427 * ACL modules implement acl policy.
429 #define IEEE80211_ACL_MODULE(name, alg, version) \
430 _IEEE80211_POLICY_MODULE(acl, name, version); \
432 alg##_modevent(int type) \
434 if (type == MOD_LOAD) \
435 ieee80211_aclator_register(&alg); \
437 ieee80211_aclator_unregister(&alg); \
439 TEXT_SET(acl_set, alg##_modevent); \
442 * Authenticator modules handle 802.1x/WPA authentication.
444 #define IEEE80211_AUTH_MODULE(name, version) \
445 _IEEE80211_POLICY_MODULE(auth, name, version)
447 #define IEEE80211_AUTH_ALG(name, alg, v) \
449 name##_modevent(int type) \
451 if (type == MOD_LOAD) \
452 ieee80211_authenticator_register(alg, &v); \
454 ieee80211_authenticator_unregister(alg); \
456 TEXT_SET(auth_set, name##_modevent)
459 * Rate control modules provide tx rate control support.
461 #define IEEE80211_RATECTL_MODULE(alg, version) \
462 _IEEE80211_POLICY_MODULE(ratectl, alg, version); \
464 #define IEEE80211_RATECTL_ALG(name, alg, v) \
466 alg##_modevent(int type) \
468 if (type == MOD_LOAD) \
469 ieee80211_ratectl_register(alg, &v); \
471 ieee80211_ratectl_unregister(alg); \
473 TEXT_SET(ratectl##_set, alg##_modevent)
476 typedef int ieee80211_ioctl_getfunc(struct ieee80211vap *,
477 struct ieee80211req *);
478 SET_DECLARE(ieee80211_ioctl_getset, ieee80211_ioctl_getfunc);
479 #define IEEE80211_IOCTL_GET(_name, _get) TEXT_SET(ieee80211_ioctl_getset, _get)
481 typedef int ieee80211_ioctl_setfunc(struct ieee80211vap *,
482 struct ieee80211req *);
483 SET_DECLARE(ieee80211_ioctl_setset, ieee80211_ioctl_setfunc);
484 #define IEEE80211_IOCTL_SET(_name, _set) TEXT_SET(ieee80211_ioctl_setset, _set)
487 /* XXX this stuff belongs elsewhere */
489 * Message formats for messages from the net80211 layer to user
490 * applications via the routing socket. These messages are appended
491 * to an if_announcemsghdr structure.
493 struct ieee80211_join_event {
497 struct ieee80211_leave_event {
501 struct ieee80211_replay_event {
502 uint8_t iev_src[6]; /* src MAC */
503 uint8_t iev_dst[6]; /* dst MAC */
504 uint8_t iev_cipher; /* cipher type */
505 uint8_t iev_keyix; /* key id/index */
506 uint64_t iev_keyrsc; /* RSC from key */
507 uint64_t iev_rsc; /* RSC from frame */
510 struct ieee80211_michael_event {
511 uint8_t iev_src[6]; /* src MAC */
512 uint8_t iev_dst[6]; /* dst MAC */
513 uint8_t iev_cipher; /* cipher type */
514 uint8_t iev_keyix; /* key id/index */
517 struct ieee80211_wds_event {
521 struct ieee80211_csa_event {
522 uint32_t iev_flags; /* channel flags */
523 uint16_t iev_freq; /* setting in Mhz */
524 uint8_t iev_ieee; /* IEEE channel number */
525 uint8_t iev_mode; /* CSA mode */
526 uint8_t iev_count; /* CSA count */
529 struct ieee80211_cac_event {
530 uint32_t iev_flags; /* channel flags */
531 uint16_t iev_freq; /* setting in Mhz */
532 uint8_t iev_ieee; /* IEEE channel number */
534 uint8_t iev_type; /* IEEE80211_NOTIFY_CAC_* */
537 struct ieee80211_radar_event {
538 uint32_t iev_flags; /* channel flags */
539 uint16_t iev_freq; /* setting in Mhz */
540 uint8_t iev_ieee; /* IEEE channel number */
544 struct ieee80211_auth_event {
548 struct ieee80211_deauth_event {
552 struct ieee80211_country_event {
554 uint8_t iev_cc[2]; /* ISO country code */
557 struct ieee80211_radio_event {
558 uint8_t iev_state; /* 1 on, 0 off */
561 #define RTM_IEEE80211_ASSOC 100 /* station associate (bss mode) */
562 #define RTM_IEEE80211_REASSOC 101 /* station re-associate (bss mode) */
563 #define RTM_IEEE80211_DISASSOC 102 /* station disassociate (bss mode) */
564 #define RTM_IEEE80211_JOIN 103 /* station join (ap mode) */
565 #define RTM_IEEE80211_LEAVE 104 /* station leave (ap mode) */
566 #define RTM_IEEE80211_SCAN 105 /* scan complete, results available */
567 #define RTM_IEEE80211_REPLAY 106 /* sequence counter replay detected */
568 #define RTM_IEEE80211_MICHAEL 107 /* Michael MIC failure detected */
569 #define RTM_IEEE80211_REJOIN 108 /* station re-associate (ap mode) */
570 #define RTM_IEEE80211_WDS 109 /* WDS discovery (ap mode) */
571 #define RTM_IEEE80211_CSA 110 /* Channel Switch Announcement event */
572 #define RTM_IEEE80211_RADAR 111 /* radar event */
573 #define RTM_IEEE80211_CAC 112 /* Channel Availability Check event */
574 #define RTM_IEEE80211_DEAUTH 113 /* station deauthenticate */
575 #define RTM_IEEE80211_AUTH 114 /* station authenticate (ap mode) */
576 #define RTM_IEEE80211_COUNTRY 115 /* discovered country code (sta mode) */
577 #define RTM_IEEE80211_RADIO 116 /* RF kill switch state change */
580 * Structure prepended to raw packets sent through the bpf
581 * interface when set to DLT_IEEE802_11_RADIO. This allows
582 * user applications to specify pretty much everything in
583 * an Atheros tx descriptor. XXX need to generalize.
585 * XXX cannot be more than 14 bytes as it is copied to a sockaddr's
588 struct ieee80211_bpf_params {
589 uint8_t ibp_vers; /* version */
590 #define IEEE80211_BPF_VERSION 0
591 uint8_t ibp_len; /* header length in bytes */
593 #define IEEE80211_BPF_SHORTPRE 0x01 /* tx with short preamble */
594 #define IEEE80211_BPF_NOACK 0x02 /* tx with no ack */
595 #define IEEE80211_BPF_CRYPTO 0x04 /* tx with h/w encryption */
596 #define IEEE80211_BPF_FCS 0x10 /* frame incldues FCS */
597 #define IEEE80211_BPF_DATAPAD 0x20 /* frame includes data padding */
598 #define IEEE80211_BPF_RTS 0x40 /* tx with RTS/CTS */
599 #define IEEE80211_BPF_CTS 0x80 /* tx with CTS only */
600 uint8_t ibp_pri; /* WME/WMM AC+tx antenna */
601 uint8_t ibp_try0; /* series 1 try count */
602 uint8_t ibp_rate0; /* series 1 IEEE tx rate */
603 uint8_t ibp_power; /* tx power (device units) */
604 uint8_t ibp_ctsrate; /* IEEE tx rate for CTS */
605 uint8_t ibp_try1; /* series 2 try count */
606 uint8_t ibp_rate1; /* series 2 IEEE tx rate */
607 uint8_t ibp_try2; /* series 3 try count */
608 uint8_t ibp_rate2; /* series 3 IEEE tx rate */
609 uint8_t ibp_try3; /* series 4 try count */
610 uint8_t ibp_rate3; /* series 4 IEEE tx rate */
614 struct ieee80211_tx_params {
615 struct ieee80211_bpf_params params;
617 int ieee80211_add_xmit_params(struct mbuf *m,
618 const struct ieee80211_bpf_params *);
619 int ieee80211_get_xmit_params(struct mbuf *m,
620 struct ieee80211_bpf_params *);
624 * Malloc API. Other BSD operating systems have slightly
625 * different malloc/free namings (eg DragonflyBSD.)
627 #define IEEE80211_MALLOC malloc
628 #define IEEE80211_FREE free
630 /* XXX TODO: get rid of WAITOK, fix all the users of it? */
631 #define IEEE80211_M_NOWAIT M_NOWAIT
632 #define IEEE80211_M_WAITOK M_WAITOK
633 #define IEEE80211_M_ZERO M_ZERO
635 /* XXX TODO: the type fields */
637 #endif /* _NET80211_IEEE80211_FREEBSD_H_ */