]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/net80211/ieee80211_freebsd.h
Merge OpenBSM 1.1 from OpenBSM vendor branch to head.
[FreeBSD/FreeBSD.git] / sys / net80211 / ieee80211_freebsd.h
1 /*-
2  * Copyright (c) 2003-2008 Sam Leffler, Errno Consulting
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
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.
13  *
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.
24  *
25  * $FreeBSD$
26  */
27 #ifndef _NET80211_IEEE80211_FREEBSD_H_
28 #define _NET80211_IEEE80211_FREEBSD_H_
29
30 #ifdef _KERNEL
31 #include <sys/param.h>
32 #include <sys/lock.h>
33 #include <sys/mutex.h>
34 #include <sys/rwlock.h>
35
36 /*
37  * Common state locking definitions.
38  */
39 typedef struct {
40         char            name[16];               /* e.g. "ath0_com_lock" */
41         struct mtx      mtx;
42 } ieee80211_com_lock_t;
43 #define IEEE80211_LOCK_INIT(_ic, _name) do {                            \
44         ieee80211_com_lock_t *cl = &(_ic)->ic_comlock;                  \
45         snprintf(cl->name, sizeof(cl->name), "%s_com_lock", _name);     \
46         mtx_init(&cl->mtx, cl->name, NULL, MTX_DEF | MTX_RECURSE);      \
47 } while (0)
48 #define IEEE80211_LOCK_OBJ(_ic) (&(_ic)->ic_comlock.mtx)
49 #define IEEE80211_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_LOCK_OBJ(_ic))
50 #define IEEE80211_LOCK(_ic)        mtx_lock(IEEE80211_LOCK_OBJ(_ic))
51 #define IEEE80211_UNLOCK(_ic)      mtx_unlock(IEEE80211_LOCK_OBJ(_ic))
52 #define IEEE80211_LOCK_ASSERT(_ic) \
53         mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED)
54
55 /*
56  * Node locking definitions.
57  */
58 typedef struct {
59         char            name[16];               /* e.g. "ath0_node_lock" */
60         struct mtx      mtx;
61 } ieee80211_node_lock_t;
62 #define IEEE80211_NODE_LOCK_INIT(_nt, _name) do {                       \
63         ieee80211_node_lock_t *nl = &(_nt)->nt_nodelock;                \
64         snprintf(nl->name, sizeof(nl->name), "%s_node_lock", _name);    \
65         mtx_init(&nl->mtx, nl->name, NULL, MTX_DEF | MTX_RECURSE);      \
66 } while (0)
67 #define IEEE80211_NODE_LOCK_OBJ(_nt)    (&(_nt)->nt_nodelock.mtx)
68 #define IEEE80211_NODE_LOCK_DESTROY(_nt) \
69         mtx_destroy(IEEE80211_NODE_LOCK_OBJ(_nt))
70 #define IEEE80211_NODE_LOCK(_nt) \
71         mtx_lock(IEEE80211_NODE_LOCK_OBJ(_nt))
72 #define IEEE80211_NODE_IS_LOCKED(_nt) \
73         mtx_owned(IEEE80211_NODE_LOCK_OBJ(_nt))
74 #define IEEE80211_NODE_UNLOCK(_nt) \
75         mtx_unlock(IEEE80211_NODE_LOCK_OBJ(_nt))
76 #define IEEE80211_NODE_LOCK_ASSERT(_nt) \
77         mtx_assert(IEEE80211_NODE_LOCK_OBJ(_nt), MA_OWNED)
78
79 /*
80  * Node table iteration locking definitions; this protects the
81  * scan generation # used to iterate over the station table
82  * while grabbing+releasing the node lock.
83  */
84 typedef struct {
85         char            name[16];               /* e.g. "ath0_scan_lock" */
86         struct mtx      mtx;
87 } ieee80211_scan_lock_t;
88 #define IEEE80211_NODE_ITERATE_LOCK_INIT(_nt, _name) do {               \
89         ieee80211_scan_lock_t *sl = &(_nt)->nt_scanlock;                \
90         snprintf(sl->name, sizeof(sl->name), "%s_scan_lock", _name);    \
91         mtx_init(&sl->mtx, sl->name, NULL, MTX_DEF);                    \
92 } while (0)
93 #define IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)    (&(_nt)->nt_scanlock.mtx)
94 #define IEEE80211_NODE_ITERATE_LOCK_DESTROY(_nt) \
95         mtx_destroy(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))
96 #define IEEE80211_NODE_ITERATE_LOCK(_nt) \
97         mtx_lock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))
98 #define IEEE80211_NODE_ITERATE_UNLOCK(_nt) \
99         mtx_unlock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))
100
101 #define _AGEQ_ENQUEUE(_ifq, _m, _qlen, _age) do {               \
102         (_m)->m_nextpkt = NULL;                                 \
103         if ((_ifq)->ifq_tail != NULL) {                         \
104                 _age -= M_AGE_GET((_ifq)->ifq_head);            \
105                 (_ifq)->ifq_tail->m_nextpkt = (_m);             \
106         } else {                                                \
107                 (_ifq)->ifq_head = (_m);                        \
108         }                                                       \
109         M_AGE_SET(_m, _age);                                    \
110         (_ifq)->ifq_tail = (_m);                                \
111         (_qlen) = ++(_ifq)->ifq_len;                            \
112 } while (0)
113
114 /*
115  * Power-save queue definitions. 
116  */
117 typedef struct mtx ieee80211_psq_lock_t;
118 #define IEEE80211_PSQ_INIT(_psq, _name) \
119         mtx_init(&(_psq)->psq_lock, _name, "802.11 ps q", MTX_DEF);
120 #define IEEE80211_PSQ_DESTROY(_psq)     mtx_destroy(&(_psq)->psq_lock)
121 #define IEEE80211_PSQ_LOCK(_psq)        mtx_lock(&(_psq)->psq_lock)
122 #define IEEE80211_PSQ_UNLOCK(_psq)      mtx_unlock(&(_psq)->psq_lock)
123
124 #ifndef IF_PREPEND_LIST
125 #define _IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do {        \
126         (mtail)->m_nextpkt = (ifq)->ifq_head;                   \
127         if ((ifq)->ifq_tail == NULL)                            \
128                 (ifq)->ifq_tail = (mtail);                      \
129         (ifq)->ifq_head = (mhead);                              \
130         (ifq)->ifq_len += (mcount);                             \
131 } while (0)
132 #define IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do {         \
133         IF_LOCK(ifq);                                           \
134         _IF_PREPEND_LIST(ifq, mhead, mtail, mcount);            \
135         IF_UNLOCK(ifq);                                         \
136 } while (0)
137 #endif /* IF_PREPEND_LIST */
138
139 /* XXX temporary */
140 #define IEEE80211_NODE_WDSQ_INIT(_ni, _name) do {               \
141         mtx_init(&(_ni)->ni_wdsq.ifq_mtx, _name, "802.11 wds queue", MTX_DEF);\
142         (_ni)->ni_wdsq.ifq_maxlen = IEEE80211_PS_MAX_QUEUE;     \
143 } while (0)
144 #define IEEE80211_NODE_WDSQ_DESTROY(_ni) do { \
145         mtx_destroy(&(_ni)->ni_wdsq.ifq_mtx); \
146 } while (0)
147 #define IEEE80211_NODE_WDSQ_QLEN(_ni)   _IF_QLEN(&(_ni)->ni_wdsq)
148 #define IEEE80211_NODE_WDSQ_LOCK(_ni)   IF_LOCK(&(_ni)->ni_wdsq)
149 #define IEEE80211_NODE_WDSQ_UNLOCK(_ni) IF_UNLOCK(&(_ni)->ni_wdsq)
150 #define _IEEE80211_NODE_WDSQ_DEQUEUE_HEAD(_ni, _m) do {         \
151         _IF_DEQUEUE(&(_ni)->ni_wdsq, m);                        \
152 } while (0)
153 #define _IEEE80211_NODE_WDSQ_ENQUEUE(_ni, _m, _qlen, _age) do { \
154         _AGEQ_ENQUEUE(&ni->ni_wdsq, _m, _qlen, _age);           \
155 } while (0)
156
157 /*
158  * 802.1x MAC ACL database locking definitions.
159  */
160 typedef struct mtx acl_lock_t;
161 #define ACL_LOCK_INIT(_as, _name) \
162         mtx_init(&(_as)->as_lock, _name, "802.11 ACL", MTX_DEF)
163 #define ACL_LOCK_DESTROY(_as)           mtx_destroy(&(_as)->as_lock)
164 #define ACL_LOCK(_as)                   mtx_lock(&(_as)->as_lock)
165 #define ACL_UNLOCK(_as)                 mtx_unlock(&(_as)->as_lock)
166 #define ACL_LOCK_ASSERT(_as) \
167         mtx_assert((&(_as)->as_lock), MA_OWNED)
168
169 /*
170  * Node reference counting definitions.
171  *
172  * ieee80211_node_initref       initialize the reference count to 1
173  * ieee80211_node_incref        add a reference
174  * ieee80211_node_decref        remove a reference
175  * ieee80211_node_dectestref    remove a reference and return 1 if this
176  *                              is the last reference, otherwise 0
177  * ieee80211_node_refcnt        reference count for printing (only)
178  */
179 #include <machine/atomic.h>
180
181 #define ieee80211_node_initref(_ni) \
182         do { ((_ni)->ni_refcnt = 1); } while (0)
183 #define ieee80211_node_incref(_ni) \
184         atomic_add_int(&(_ni)->ni_refcnt, 1)
185 #define ieee80211_node_decref(_ni) \
186         atomic_subtract_int(&(_ni)->ni_refcnt, 1)
187 struct ieee80211_node;
188 int     ieee80211_node_dectestref(struct ieee80211_node *ni);
189 #define ieee80211_node_refcnt(_ni)      (_ni)->ni_refcnt
190
191 struct ifqueue;
192 struct ieee80211vap;
193 void    ieee80211_drain_ifq(struct ifqueue *);
194 void    ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *);
195
196 void    ieee80211_vap_destroy(struct ieee80211vap *);
197
198 #define IFNET_IS_UP_RUNNING(_ifp) \
199         (((_ifp)->if_flags & IFF_UP) && \
200          ((_ifp)->if_drv_flags & IFF_DRV_RUNNING))
201
202 #define msecs_to_ticks(ms)      (((ms)*hz)/1000)
203 #define ticks_to_msecs(t)       (1000*(t) / hz)
204 #define ticks_to_secs(t)        ((t) / hz)
205 #define time_after(a,b)         ((long)(b) - (long)(a) < 0)
206 #define time_before(a,b)        time_after(b,a)
207 #define time_after_eq(a,b)      ((long)(a) - (long)(b) >= 0)
208 #define time_before_eq(a,b)     time_after_eq(b,a)
209
210 struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen);
211
212 /* tx path usage */
213 #define M_ENCAP         M_PROTO1                /* 802.11 encap done */
214 #define M_EAPOL         M_PROTO3                /* PAE/EAPOL frame */
215 #define M_PWR_SAV       M_PROTO4                /* bypass PS handling */
216 #define M_MORE_DATA     M_PROTO5                /* more data frames to follow */
217 #define M_FF            M_PROTO6                /* fast frame */
218 #define M_TXCB          M_PROTO7                /* do tx complete callback */
219 #define M_AMPDU_MPDU    M_PROTO8                /* ok for A-MPDU aggregation */
220 #define M_80211_TX \
221         (M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_ENCAP|M_EAPOL|M_PWR_SAV|\
222          M_MORE_DATA|M_FF|M_TXCB|M_AMPDU_MPDU)
223
224 /* rx path usage */
225 #define M_AMPDU         M_PROTO1                /* A-MPDU subframe */
226 #define M_WEP           M_PROTO2                /* WEP done by hardware */
227 #if 0
228 #define M_AMPDU_MPDU    M_PROTO8                /* A-MPDU re-order done */
229 #endif
230 #define M_80211_RX      (M_AMPDU|M_WEP|M_AMPDU_MPDU)
231 /*
232  * Store WME access control bits in the vlan tag.
233  * This is safe since it's done after the packet is classified
234  * (where we use any previous tag) and because it's passed
235  * directly in to the driver and there's no chance someone
236  * else will clobber them on us.
237  */
238 #define M_WME_SETAC(m, ac) \
239         ((m)->m_pkthdr.ether_vtag = (ac))
240 #define M_WME_GETAC(m)  ((m)->m_pkthdr.ether_vtag)
241
242 /*
243  * Mbufs on the power save queue are tagged with an age and
244  * timed out.  We reuse the hardware checksum field in the
245  * mbuf packet header to store this data.
246  */
247 #define M_AGE_SET(m,v)          (m->m_pkthdr.csum_data = v)
248 #define M_AGE_GET(m)            (m->m_pkthdr.csum_data)
249 #define M_AGE_SUB(m,adj)        (m->m_pkthdr.csum_data -= adj)
250
251 #define MTAG_ABI_NET80211       1132948340      /* net80211 ABI */
252
253 struct ieee80211_cb {
254         void    (*func)(struct ieee80211_node *, void *, int status);
255         void    *arg;
256 };
257 #define NET80211_TAG_CALLBACK   0       /* xmit complete callback */
258 int     ieee80211_add_callback(struct mbuf *m,
259                 void (*func)(struct ieee80211_node *, void *, int), void *arg);
260 void    ieee80211_process_callback(struct ieee80211_node *, struct mbuf *, int);
261
262 void    get_random_bytes(void *, size_t);
263
264 struct ieee80211com;
265
266 void    ieee80211_sysctl_attach(struct ieee80211com *);
267 void    ieee80211_sysctl_detach(struct ieee80211com *);
268 void    ieee80211_sysctl_vattach(struct ieee80211vap *);
269 void    ieee80211_sysctl_vdetach(struct ieee80211vap *);
270
271 void    ieee80211_load_module(const char *);
272
273 /*
274  * A "policy module" is an adjunct module to net80211 that provides
275  * functionality that typically includes policy decisions.  This
276  * modularity enables extensibility and vendor-supplied functionality.
277  */
278 #define _IEEE80211_POLICY_MODULE(policy, name, version)                 \
279 typedef void (*policy##_setup)(int);                                    \
280 SET_DECLARE(policy##_set, policy##_setup);                              \
281 static int                                                              \
282 wlan_##name##_modevent(module_t mod, int type, void *unused)            \
283 {                                                                       \
284         policy##_setup * const *iter, f;                                \
285         switch (type) {                                                 \
286         case MOD_LOAD:                                                  \
287                 SET_FOREACH(iter, policy##_set) {                       \
288                         f = (void*) *iter;                              \
289                         f(type);                                        \
290                 }                                                       \
291                 return 0;                                               \
292         case MOD_UNLOAD:                                                \
293         case MOD_QUIESCE:                                               \
294                 if (nrefs) {                                            \
295                         printf("wlan_##name: still in use (%u dynamic refs)\n",\
296                                 nrefs);                                 \
297                         return EBUSY;                                   \
298                 }                                                       \
299                 if (type == MOD_UNLOAD) {                               \
300                         SET_FOREACH(iter, policy##_set) {               \
301                                 f = (void*) *iter;                      \
302                                 f(type);                                \
303                         }                                               \
304                 }                                                       \
305                 return 0;                                               \
306         }                                                               \
307         return EINVAL;                                                  \
308 }                                                                       \
309 static moduledata_t name##_mod = {                                      \
310         "wlan_" #name,                                                  \
311         wlan_##name##_modevent,                                         \
312         0                                                               \
313 };                                                                      \
314 DECLARE_MODULE(wlan_##name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\
315 MODULE_VERSION(wlan_##name, version);                                   \
316 MODULE_DEPEND(wlan_##name, wlan, 1, 1, 1)
317
318 /*
319  * Crypto modules implement cipher support.
320  */
321 #define IEEE80211_CRYPTO_MODULE(name, version)                          \
322 _IEEE80211_POLICY_MODULE(crypto, name, version);                        \
323 static void                                                             \
324 name##_modevent(int type)                                               \
325 {                                                                       \
326         if (type == MOD_LOAD)                                           \
327                 ieee80211_crypto_register(&name);                       \
328         else                                                            \
329                 ieee80211_crypto_unregister(&name);                     \
330 }                                                                       \
331 TEXT_SET(crypto##_set, name##_modevent)
332
333 /*
334  * Scanner modules provide scanning policy.
335  */
336 #define IEEE80211_SCANNER_MODULE(name, version)                         \
337         _IEEE80211_POLICY_MODULE(scanner, name, version)
338
339 #define IEEE80211_SCANNER_ALG(name, alg, v)                             \
340 static void                                                             \
341 name##_modevent(int type)                                               \
342 {                                                                       \
343         if (type == MOD_LOAD)                                           \
344                 ieee80211_scanner_register(alg, &v);                    \
345         else                                                            \
346                 ieee80211_scanner_unregister(alg, &v);                  \
347 }                                                                       \
348 TEXT_SET(scanner_set, name##_modevent);                                 \
349
350 /*
351  * ACL modules implement acl policy.
352  */
353 #define IEEE80211_ACL_MODULE(name, alg, version)                        \
354 _IEEE80211_POLICY_MODULE(acl, name, version);                           \
355 static void                                                             \
356 alg##_modevent(int type)                                                \
357 {                                                                       \
358         if (type == MOD_LOAD)                                           \
359                 ieee80211_aclator_register(&alg);                       \
360         else                                                            \
361                 ieee80211_aclator_unregister(&alg);                     \
362 }                                                                       \
363 TEXT_SET(acl_set, alg##_modevent);                                      \
364
365 /*
366  * Authenticator modules handle 802.1x/WPA authentication.
367  */
368 #define IEEE80211_AUTH_MODULE(name, version)                            \
369         _IEEE80211_POLICY_MODULE(auth, name, version)
370
371 #define IEEE80211_AUTH_ALG(name, alg, v)                                \
372 static void                                                             \
373 name##_modevent(int type)                                               \
374 {                                                                       \
375         if (type == MOD_LOAD)                                           \
376                 ieee80211_authenticator_register(alg, &v);              \
377         else                                                            \
378                 ieee80211_authenticator_unregister(alg);                \
379 }                                                                       \
380 TEXT_SET(auth_set, name##_modevent)
381
382 /*
383  * Rate control modules provide tx rate control support.
384  */
385 #define IEEE80211_RATE_MODULE(alg, version)                             \
386 _IEEE80211_POLICY_MODULE(rate, alg, version);                           \
387 static void                                                             \
388 alg##_modevent(int type)                                                \
389 {                                                                       \
390         /* XXX nothing to do until the rate control framework arrives */\
391 }                                                                       \
392 TEXT_SET(rate##_set, alg##_modevent)
393
394 struct ieee80211req;
395 typedef int ieee80211_ioctl_getfunc(struct ieee80211vap *,
396     struct ieee80211req *);
397 SET_DECLARE(ieee80211_ioctl_getset, ieee80211_ioctl_getfunc);
398 #define IEEE80211_IOCTL_GET(_name, _get) TEXT_SET(ieee80211_ioctl_getset, _get)
399
400 typedef int ieee80211_ioctl_setfunc(struct ieee80211vap *,
401     struct ieee80211req *);
402 SET_DECLARE(ieee80211_ioctl_setset, ieee80211_ioctl_setfunc);
403 #define IEEE80211_IOCTL_SET(_name, _set) TEXT_SET(ieee80211_ioctl_setset, _set)
404 #endif /* _KERNEL */
405
406 /* XXX this stuff belongs elsewhere */
407 /*
408  * Message formats for messages from the net80211 layer to user
409  * applications via the routing socket.  These messages are appended
410  * to an if_announcemsghdr structure.
411  */
412 struct ieee80211_join_event {
413         uint8_t         iev_addr[6];
414 };
415
416 struct ieee80211_leave_event {
417         uint8_t         iev_addr[6];
418 };
419
420 struct ieee80211_replay_event {
421         uint8_t         iev_src[6];     /* src MAC */
422         uint8_t         iev_dst[6];     /* dst MAC */
423         uint8_t         iev_cipher;     /* cipher type */
424         uint8_t         iev_keyix;      /* key id/index */
425         uint64_t        iev_keyrsc;     /* RSC from key */
426         uint64_t        iev_rsc;        /* RSC from frame */
427 };
428
429 struct ieee80211_michael_event {
430         uint8_t         iev_src[6];     /* src MAC */
431         uint8_t         iev_dst[6];     /* dst MAC */
432         uint8_t         iev_cipher;     /* cipher type */
433         uint8_t         iev_keyix;      /* key id/index */
434 };
435
436 struct ieee80211_wds_event {
437         uint8_t         iev_addr[6];
438 };
439
440 struct ieee80211_csa_event {
441         uint32_t        iev_flags;      /* channel flags */
442         uint16_t        iev_freq;       /* setting in Mhz */
443         uint8_t         iev_ieee;       /* IEEE channel number */
444         uint8_t         iev_mode;       /* CSA mode */
445         uint8_t         iev_count;      /* CSA count */
446 };
447
448 struct ieee80211_cac_event {
449         uint32_t        iev_flags;      /* channel flags */
450         uint16_t        iev_freq;       /* setting in Mhz */
451         uint8_t         iev_ieee;       /* IEEE channel number */
452         /* XXX timestamp? */
453         uint8_t         iev_type;       /* IEEE80211_NOTIFY_CAC_* */
454 };
455
456 struct ieee80211_radar_event {
457         uint32_t        iev_flags;      /* channel flags */
458         uint16_t        iev_freq;       /* setting in Mhz */
459         uint8_t         iev_ieee;       /* IEEE channel number */
460         /* XXX timestamp? */
461 };
462
463 struct ieee80211_auth_event {
464         uint8_t         iev_addr[6];
465 };
466
467 struct ieee80211_deauth_event {
468         uint8_t         iev_addr[6];
469 };
470
471 struct ieee80211_country_event {
472         uint8_t         iev_addr[6];
473         uint8_t         iev_cc[2];      /* ISO country code */
474 };
475
476 struct ieee80211_radio_event {
477         uint8_t         iev_state;      /* 1 on, 0 off */
478 };
479
480 #define RTM_IEEE80211_ASSOC     100     /* station associate (bss mode) */
481 #define RTM_IEEE80211_REASSOC   101     /* station re-associate (bss mode) */
482 #define RTM_IEEE80211_DISASSOC  102     /* station disassociate (bss mode) */
483 #define RTM_IEEE80211_JOIN      103     /* station join (ap mode) */
484 #define RTM_IEEE80211_LEAVE     104     /* station leave (ap mode) */
485 #define RTM_IEEE80211_SCAN      105     /* scan complete, results available */
486 #define RTM_IEEE80211_REPLAY    106     /* sequence counter replay detected */
487 #define RTM_IEEE80211_MICHAEL   107     /* Michael MIC failure detected */
488 #define RTM_IEEE80211_REJOIN    108     /* station re-associate (ap mode) */
489 #define RTM_IEEE80211_WDS       109     /* WDS discovery (ap mode) */
490 #define RTM_IEEE80211_CSA       110     /* Channel Switch Announcement event */
491 #define RTM_IEEE80211_RADAR     111     /* radar event */
492 #define RTM_IEEE80211_CAC       112     /* Channel Availability Check event */
493 #define RTM_IEEE80211_DEAUTH    113     /* station deauthenticate */
494 #define RTM_IEEE80211_AUTH      114     /* station authenticate (ap mode) */
495 #define RTM_IEEE80211_COUNTRY   115     /* discovered country code (sta mode) */
496 #define RTM_IEEE80211_RADIO     116     /* RF kill switch state change */
497
498 /*
499  * Structure prepended to raw packets sent through the bpf
500  * interface when set to DLT_IEEE802_11_RADIO.  This allows
501  * user applications to specify pretty much everything in
502  * an Atheros tx descriptor.  XXX need to generalize.
503  *
504  * XXX cannot be more than 14 bytes as it is copied to a sockaddr's
505  * XXX sa_data area.
506  */
507 struct ieee80211_bpf_params {
508         uint8_t         ibp_vers;       /* version */
509 #define IEEE80211_BPF_VERSION   0
510         uint8_t         ibp_len;        /* header length in bytes */
511         uint8_t         ibp_flags;
512 #define IEEE80211_BPF_SHORTPRE  0x01    /* tx with short preamble */
513 #define IEEE80211_BPF_NOACK     0x02    /* tx with no ack */
514 #define IEEE80211_BPF_CRYPTO    0x04    /* tx with h/w encryption */
515 #define IEEE80211_BPF_FCS       0x10    /* frame incldues FCS */
516 #define IEEE80211_BPF_DATAPAD   0x20    /* frame includes data padding */
517 #define IEEE80211_BPF_RTS       0x40    /* tx with RTS/CTS */
518 #define IEEE80211_BPF_CTS       0x80    /* tx with CTS only */
519         uint8_t         ibp_pri;        /* WME/WMM AC+tx antenna */
520         uint8_t         ibp_try0;       /* series 1 try count */
521         uint8_t         ibp_rate0;      /* series 1 IEEE tx rate */
522         uint8_t         ibp_power;      /* tx power (device units) */
523         uint8_t         ibp_ctsrate;    /* IEEE tx rate for CTS */
524         uint8_t         ibp_try1;       /* series 2 try count */
525         uint8_t         ibp_rate1;      /* series 2 IEEE tx rate */
526         uint8_t         ibp_try2;       /* series 3 try count */
527         uint8_t         ibp_rate2;      /* series 3 IEEE tx rate */
528         uint8_t         ibp_try3;       /* series 4 try count */
529         uint8_t         ibp_rate3;      /* series 4 IEEE tx rate */
530 };
531 #endif /* _NET80211_IEEE80211_FREEBSD_H_ */