ieee80211_freebsd.h revision 243532
1220422Sgabor/*- 2210389Sgabor * Copyright (c) 2003-2008 Sam Leffler, Errno Consulting 3210389Sgabor * All rights reserved. 4210389Sgabor * 5265420Simp * Redistribution and use in source and binary forms, with or without 6222273Sobrien * modification, are permitted provided that the following conditions 7222273Sobrien * are met: 8210389Sgabor * 1. Redistributions of source code must retain the above copyright 9222273Sobrien * notice, this list of conditions and the following disclaimer. 10222273Sobrien * 2. Redistributions in binary form must reproduce the above copyright 11226035Sgabor * notice, this list of conditions and the following disclaimer in the 12226035Sgabor * documentation and/or other materials provided with the distribution. 13226035Sgabor * 14277273Swill * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15222273Sobrien * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16226035Sgabor * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17220422Sgabor * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18322582Skevans * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19322582Skevans * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20226035Sgabor * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21322557Skevans * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22226035Sgabor * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23322582Skevans * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24322582Skevans * 25322582Skevans * $FreeBSD: head/sys/net80211/ieee80211_freebsd.h 243532 2012-11-26 00:06:55Z adrian $ 26226035Sgabor */ 27285884Spfg#ifndef _NET80211_IEEE80211_FREEBSD_H_ 28285884Spfg#define _NET80211_IEEE80211_FREEBSD_H_ 29222273Sobrien 30210389Sgabor#ifdef _KERNEL 31210389Sgabor#include <sys/param.h> 32322525Skevans#include <sys/lock.h> 33210389Sgabor#include <sys/mutex.h> 34210389Sgabor#include <sys/rwlock.h> 35228099Sgabor#include <sys/sysctl.h> 36210389Sgabor#include <sys/taskqueue.h> 37210389Sgabor 38210389Sgabor/* 39322525Skevans * Common state locking definitions. 40210389Sgabor */ 41210389Sgabortypedef struct { 42277939Sngie char name[16]; /* e.g. "ath0_com_lock" */ 43222273Sobrien struct mtx mtx; 44210389Sgabor} ieee80211_com_lock_t; 45275042Sbapt#define IEEE80211_LOCK_INIT(_ic, _name) do { \ 46245171Sobrien ieee80211_com_lock_t *cl = &(_ic)->ic_comlock; \ 47263997Simp snprintf(cl->name, sizeof(cl->name), "%s_com_lock", _name); \ 48275042Sbapt mtx_init(&cl->mtx, cl->name, NULL, MTX_DEF | MTX_RECURSE); \ 49245171Sobrien} while (0) 50284345Ssjg#define IEEE80211_LOCK_OBJ(_ic) (&(_ic)->ic_comlock.mtx) 51228099Sgabor#define IEEE80211_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_LOCK_OBJ(_ic)) 52228099Sgabor#define IEEE80211_LOCK(_ic) mtx_lock(IEEE80211_LOCK_OBJ(_ic)) 53228099Sgabor#define IEEE80211_UNLOCK(_ic) mtx_unlock(IEEE80211_LOCK_OBJ(_ic)) 54228099Sgabor#define IEEE80211_LOCK_ASSERT(_ic) \ 55228099Sgabor mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED) 56228099Sgabor#define IEEE80211_UNLOCK_ASSERT(_ic) \ 57277939Sngie mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_NOTOWNED) 58277939Sngie 59277939Sngie/* 60277939Sngie * Node locking definitions. 61277939Sngie */ 62277939Sngietypedef struct { 63277939Sngie char name[16]; /* e.g. "ath0_node_lock" */ 64284345Ssjg struct mtx mtx; 65245171Sobrien} ieee80211_node_lock_t; 66245171Sobrien#define IEEE80211_NODE_LOCK_INIT(_nt, _name) do { \ 67245171Sobrien ieee80211_node_lock_t *nl = &(_nt)->nt_nodelock; \ 68228099Sgabor snprintf(nl->name, sizeof(nl->name), "%s_node_lock", _name); \ 69263997Simp mtx_init(&nl->mtx, nl->name, NULL, MTX_DEF | MTX_RECURSE); \ 70275042Sbapt} while (0) 71226271Sgabor#define IEEE80211_NODE_LOCK_OBJ(_nt) (&(_nt)->nt_nodelock.mtx) 72226664Sgabor#define IEEE80211_NODE_LOCK_DESTROY(_nt) \ 73226271Sgabor mtx_destroy(IEEE80211_NODE_LOCK_OBJ(_nt)) 74226271Sgabor#define IEEE80211_NODE_LOCK(_nt) \ 75226271Sgabor mtx_lock(IEEE80211_NODE_LOCK_OBJ(_nt)) 76226271Sgabor#define IEEE80211_NODE_IS_LOCKED(_nt) \ 77226271Sgabor mtx_owned(IEEE80211_NODE_LOCK_OBJ(_nt)) 78226271Sgabor#define IEEE80211_NODE_UNLOCK(_nt) \ 79226664Sgabor mtx_unlock(IEEE80211_NODE_LOCK_OBJ(_nt)) 80226271Sgabor#define IEEE80211_NODE_LOCK_ASSERT(_nt) \ 81226271Sgabor mtx_assert(IEEE80211_NODE_LOCK_OBJ(_nt), MA_OWNED) 82226271Sgabor 83226271Sgabor/* 84263997Simp * Node table iteration locking definitions; this protects the 85322584Skevans * scan generation # used to iterate over the station table 86275042Sbapt * while grabbing+releasing the node lock. 87210389Sgabor */ 88210389Sgabortypedef struct { 89263997Simp char name[16]; /* e.g. "ath0_scan_lock" */ 90210389Sgabor struct mtx mtx; 91210389Sgabor} ieee80211_scan_lock_t; 92210389Sgabor#define IEEE80211_NODE_ITERATE_LOCK_INIT(_nt, _name) do { \ 93210389Sgabor ieee80211_scan_lock_t *sl = &(_nt)->nt_scanlock; \ 94210389Sgabor snprintf(sl->name, sizeof(sl->name), "%s_scan_lock", _name); \ 95272784Sngie mtx_init(&sl->mtx, sl->name, NULL, MTX_DEF); \ 96272784Sngie} while (0) 97272784Sngie#define IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt) (&(_nt)->nt_scanlock.mtx) 98272784Sngie#define IEEE80211_NODE_ITERATE_LOCK_DESTROY(_nt) \ 99210389Sgabor mtx_destroy(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)) 100#define IEEE80211_NODE_ITERATE_LOCK(_nt) \ 101 mtx_lock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)) 102#define IEEE80211_NODE_ITERATE_UNLOCK(_nt) \ 103 mtx_unlock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)) 104 105/* 106 * Power-save queue definitions. 107 */ 108typedef struct mtx ieee80211_psq_lock_t; 109#define IEEE80211_PSQ_INIT(_psq, _name) \ 110 mtx_init(&(_psq)->psq_lock, _name, "802.11 ps q", MTX_DEF) 111#define IEEE80211_PSQ_DESTROY(_psq) mtx_destroy(&(_psq)->psq_lock) 112#define IEEE80211_PSQ_LOCK(_psq) mtx_lock(&(_psq)->psq_lock) 113#define IEEE80211_PSQ_UNLOCK(_psq) mtx_unlock(&(_psq)->psq_lock) 114 115#ifndef IF_PREPEND_LIST 116#define _IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \ 117 (mtail)->m_nextpkt = (ifq)->ifq_head; \ 118 if ((ifq)->ifq_tail == NULL) \ 119 (ifq)->ifq_tail = (mtail); \ 120 (ifq)->ifq_head = (mhead); \ 121 (ifq)->ifq_len += (mcount); \ 122} while (0) 123#define IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \ 124 IF_LOCK(ifq); \ 125 _IF_PREPEND_LIST(ifq, mhead, mtail, mcount); \ 126 IF_UNLOCK(ifq); \ 127} while (0) 128#endif /* IF_PREPEND_LIST */ 129 130/* 131 * Age queue definitions. 132 */ 133typedef struct mtx ieee80211_ageq_lock_t; 134#define IEEE80211_AGEQ_INIT(_aq, _name) \ 135 mtx_init(&(_aq)->aq_lock, _name, "802.11 age q", MTX_DEF) 136#define IEEE80211_AGEQ_DESTROY(_aq) mtx_destroy(&(_aq)->aq_lock) 137#define IEEE80211_AGEQ_LOCK(_aq) mtx_lock(&(_aq)->aq_lock) 138#define IEEE80211_AGEQ_UNLOCK(_aq) mtx_unlock(&(_aq)->aq_lock) 139 140/* 141 * 802.1x MAC ACL database locking definitions. 142 */ 143typedef struct mtx acl_lock_t; 144#define ACL_LOCK_INIT(_as, _name) \ 145 mtx_init(&(_as)->as_lock, _name, "802.11 ACL", MTX_DEF) 146#define ACL_LOCK_DESTROY(_as) mtx_destroy(&(_as)->as_lock) 147#define ACL_LOCK(_as) mtx_lock(&(_as)->as_lock) 148#define ACL_UNLOCK(_as) mtx_unlock(&(_as)->as_lock) 149#define ACL_LOCK_ASSERT(_as) \ 150 mtx_assert((&(_as)->as_lock), MA_OWNED) 151 152/* 153 * Scan table definitions. 154 */ 155typedef struct mtx ieee80211_scan_table_lock_t; 156#define IEEE80211_SCAN_TABLE_LOCK_INIT(_st, _name) \ 157 mtx_init(&(_st)->st_lock, _name, "802.11 scan table", MTX_DEF) 158#define IEEE80211_SCAN_TABLE_LOCK_DESTROY(_st) mtx_destroy(&(_st)->st_lock) 159#define IEEE80211_SCAN_TABLE_LOCK(_st) mtx_lock(&(_st)->st_lock) 160#define IEEE80211_SCAN_TABLE_UNLOCK(_st) mtx_unlock(&(_st)->st_lock) 161 162/* 163 * Node reference counting definitions. 164 * 165 * ieee80211_node_initref initialize the reference count to 1 166 * ieee80211_node_incref add a reference 167 * ieee80211_node_decref remove a reference 168 * ieee80211_node_dectestref remove a reference and return 1 if this 169 * is the last reference, otherwise 0 170 * ieee80211_node_refcnt reference count for printing (only) 171 */ 172#include <machine/atomic.h> 173 174#define ieee80211_node_initref(_ni) \ 175 do { ((_ni)->ni_refcnt = 1); } while (0) 176#define ieee80211_node_incref(_ni) \ 177 atomic_add_int(&(_ni)->ni_refcnt, 1) 178#define ieee80211_node_decref(_ni) \ 179 atomic_subtract_int(&(_ni)->ni_refcnt, 1) 180struct ieee80211_node; 181int ieee80211_node_dectestref(struct ieee80211_node *ni); 182#define ieee80211_node_refcnt(_ni) (_ni)->ni_refcnt 183 184struct ifqueue; 185struct ieee80211vap; 186void ieee80211_drain_ifq(struct ifqueue *); 187void ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *); 188 189void ieee80211_vap_destroy(struct ieee80211vap *); 190 191#define IFNET_IS_UP_RUNNING(_ifp) \ 192 (((_ifp)->if_flags & IFF_UP) && \ 193 ((_ifp)->if_drv_flags & IFF_DRV_RUNNING)) 194 195#define msecs_to_ticks(ms) (((ms)*hz)/1000) 196#define ticks_to_msecs(t) (1000*(t) / hz) 197#define ticks_to_secs(t) ((t) / hz) 198#define time_after(a,b) ((long)(b) - (long)(a) < 0) 199#define time_before(a,b) time_after(b,a) 200#define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0) 201#define time_before_eq(a,b) time_after_eq(b,a) 202 203struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen); 204 205/* tx path usage */ 206#define M_ENCAP M_PROTO1 /* 802.11 encap done */ 207#define M_EAPOL M_PROTO3 /* PAE/EAPOL frame */ 208#define M_PWR_SAV M_PROTO4 /* bypass PS handling */ 209#define M_MORE_DATA M_PROTO5 /* more data frames to follow */ 210#define M_FF M_PROTO6 /* fast frame */ 211#define M_TXCB M_PROTO7 /* do tx complete callback */ 212#define M_AMPDU_MPDU M_PROTO8 /* ok for A-MPDU aggregation */ 213#define M_80211_TX \ 214 (M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_ENCAP|M_EAPOL|M_PWR_SAV|\ 215 M_MORE_DATA|M_FF|M_TXCB|M_AMPDU_MPDU) 216 217/* rx path usage */ 218#define M_AMPDU M_PROTO1 /* A-MPDU subframe */ 219#define M_WEP M_PROTO2 /* WEP done by hardware */ 220#if 0 221#define M_AMPDU_MPDU M_PROTO8 /* A-MPDU re-order done */ 222#endif 223#define M_80211_RX (M_AMPDU|M_WEP|M_AMPDU_MPDU) 224 225#define IEEE80211_MBUF_TX_FLAG_BITS \ 226 "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_ENCAP\6M_WEP\7M_EAPOL" \ 227 "\10M_PWR_SAV\11M_MORE_DATA\12M_BCAST\13M_MCAST\14M_FRAG\15M_FIRSTFRAG" \ 228 "\16M_LASTFRAG\17M_SKIP_FIREWALL\20M_FREELIST\21M_VLANTAG\22M_PROMISC" \ 229 "\23M_NOFREE\24M_FF\25M_TXCB\26M_AMPDU_MPDU\27M_FLOWID" 230 231#define IEEE80211_MBUF_RX_FLAG_BITS \ 232 "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_AMPDU\6M_WEP\7M_PROTO3" \ 233 "\10M_PROTO4\11M_PROTO5\12M_BCAST\13M_MCAST\14M_FRAG\15M_FIRSTFRAG" \ 234 "\16M_LASTFRAG\17M_SKIP_FIREWALL\20M_FREELIST\21M_VLANTAG\22M_PROMISC" \ 235 "\23M_NOFREE\24M_PROTO6\25M_PROTO7\26M_AMPDU_MPDU\27M_FLOWID" 236 237/* 238 * Store WME access control bits in the vlan tag. 239 * This is safe since it's done after the packet is classified 240 * (where we use any previous tag) and because it's passed 241 * directly in to the driver and there's no chance someone 242 * else will clobber them on us. 243 */ 244#define M_WME_SETAC(m, ac) \ 245 ((m)->m_pkthdr.ether_vtag = (ac)) 246#define M_WME_GETAC(m) ((m)->m_pkthdr.ether_vtag) 247 248/* 249 * Mbufs on the power save queue are tagged with an age and 250 * timed out. We reuse the hardware checksum field in the 251 * mbuf packet header to store this data. 252 */ 253#define M_AGE_SET(m,v) (m->m_pkthdr.csum_data = v) 254#define M_AGE_GET(m) (m->m_pkthdr.csum_data) 255#define M_AGE_SUB(m,adj) (m->m_pkthdr.csum_data -= adj) 256 257/* 258 * Store the sequence number. 259 */ 260#define M_SEQNO_SET(m, seqno) \ 261 ((m)->m_pkthdr.tso_segsz = (seqno)) 262#define M_SEQNO_GET(m) ((m)->m_pkthdr.tso_segsz) 263 264#define MTAG_ABI_NET80211 1132948340 /* net80211 ABI */ 265 266struct ieee80211_cb { 267 void (*func)(struct ieee80211_node *, void *, int status); 268 void *arg; 269}; 270#define NET80211_TAG_CALLBACK 0 /* xmit complete callback */ 271int ieee80211_add_callback(struct mbuf *m, 272 void (*func)(struct ieee80211_node *, void *, int), void *arg); 273void ieee80211_process_callback(struct ieee80211_node *, struct mbuf *, int); 274 275void get_random_bytes(void *, size_t); 276 277struct ieee80211com; 278 279void ieee80211_sysctl_attach(struct ieee80211com *); 280void ieee80211_sysctl_detach(struct ieee80211com *); 281void ieee80211_sysctl_vattach(struct ieee80211vap *); 282void ieee80211_sysctl_vdetach(struct ieee80211vap *); 283 284SYSCTL_DECL(_net_wlan); 285int ieee80211_sysctl_msecs_ticks(SYSCTL_HANDLER_ARGS); 286 287void ieee80211_load_module(const char *); 288 289/* 290 * A "policy module" is an adjunct module to net80211 that provides 291 * functionality that typically includes policy decisions. This 292 * modularity enables extensibility and vendor-supplied functionality. 293 */ 294#define _IEEE80211_POLICY_MODULE(policy, name, version) \ 295typedef void (*policy##_setup)(int); \ 296SET_DECLARE(policy##_set, policy##_setup); \ 297static int \ 298wlan_##name##_modevent(module_t mod, int type, void *unused) \ 299{ \ 300 policy##_setup * const *iter, f; \ 301 switch (type) { \ 302 case MOD_LOAD: \ 303 SET_FOREACH(iter, policy##_set) { \ 304 f = (void*) *iter; \ 305 f(type); \ 306 } \ 307 return 0; \ 308 case MOD_UNLOAD: \ 309 case MOD_QUIESCE: \ 310 if (nrefs) { \ 311 printf("wlan_##name: still in use (%u dynamic refs)\n",\ 312 nrefs); \ 313 return EBUSY; \ 314 } \ 315 if (type == MOD_UNLOAD) { \ 316 SET_FOREACH(iter, policy##_set) { \ 317 f = (void*) *iter; \ 318 f(type); \ 319 } \ 320 } \ 321 return 0; \ 322 } \ 323 return EINVAL; \ 324} \ 325static moduledata_t name##_mod = { \ 326 "wlan_" #name, \ 327 wlan_##name##_modevent, \ 328 0 \ 329}; \ 330DECLARE_MODULE(wlan_##name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\ 331MODULE_VERSION(wlan_##name, version); \ 332MODULE_DEPEND(wlan_##name, wlan, 1, 1, 1) 333 334/* 335 * Crypto modules implement cipher support. 336 */ 337#define IEEE80211_CRYPTO_MODULE(name, version) \ 338_IEEE80211_POLICY_MODULE(crypto, name, version); \ 339static void \ 340name##_modevent(int type) \ 341{ \ 342 if (type == MOD_LOAD) \ 343 ieee80211_crypto_register(&name); \ 344 else \ 345 ieee80211_crypto_unregister(&name); \ 346} \ 347TEXT_SET(crypto##_set, name##_modevent) 348 349/* 350 * Scanner modules provide scanning policy. 351 */ 352#define IEEE80211_SCANNER_MODULE(name, version) \ 353 _IEEE80211_POLICY_MODULE(scanner, name, version) 354 355#define IEEE80211_SCANNER_ALG(name, alg, v) \ 356static void \ 357name##_modevent(int type) \ 358{ \ 359 if (type == MOD_LOAD) \ 360 ieee80211_scanner_register(alg, &v); \ 361 else \ 362 ieee80211_scanner_unregister(alg, &v); \ 363} \ 364TEXT_SET(scanner_set, name##_modevent); \ 365 366/* 367 * ACL modules implement acl policy. 368 */ 369#define IEEE80211_ACL_MODULE(name, alg, version) \ 370_IEEE80211_POLICY_MODULE(acl, name, version); \ 371static void \ 372alg##_modevent(int type) \ 373{ \ 374 if (type == MOD_LOAD) \ 375 ieee80211_aclator_register(&alg); \ 376 else \ 377 ieee80211_aclator_unregister(&alg); \ 378} \ 379TEXT_SET(acl_set, alg##_modevent); \ 380 381/* 382 * Authenticator modules handle 802.1x/WPA authentication. 383 */ 384#define IEEE80211_AUTH_MODULE(name, version) \ 385 _IEEE80211_POLICY_MODULE(auth, name, version) 386 387#define IEEE80211_AUTH_ALG(name, alg, v) \ 388static void \ 389name##_modevent(int type) \ 390{ \ 391 if (type == MOD_LOAD) \ 392 ieee80211_authenticator_register(alg, &v); \ 393 else \ 394 ieee80211_authenticator_unregister(alg); \ 395} \ 396TEXT_SET(auth_set, name##_modevent) 397 398/* 399 * Rate control modules provide tx rate control support. 400 */ 401#define IEEE80211_RATECTL_MODULE(alg, version) \ 402 _IEEE80211_POLICY_MODULE(ratectl, alg, version); \ 403 404#define IEEE80211_RATECTL_ALG(name, alg, v) \ 405static void \ 406alg##_modevent(int type) \ 407{ \ 408 if (type == MOD_LOAD) \ 409 ieee80211_ratectl_register(alg, &v); \ 410 else \ 411 ieee80211_ratectl_unregister(alg); \ 412} \ 413TEXT_SET(ratectl##_set, alg##_modevent) 414 415struct ieee80211req; 416typedef int ieee80211_ioctl_getfunc(struct ieee80211vap *, 417 struct ieee80211req *); 418SET_DECLARE(ieee80211_ioctl_getset, ieee80211_ioctl_getfunc); 419#define IEEE80211_IOCTL_GET(_name, _get) TEXT_SET(ieee80211_ioctl_getset, _get) 420 421typedef int ieee80211_ioctl_setfunc(struct ieee80211vap *, 422 struct ieee80211req *); 423SET_DECLARE(ieee80211_ioctl_setset, ieee80211_ioctl_setfunc); 424#define IEEE80211_IOCTL_SET(_name, _set) TEXT_SET(ieee80211_ioctl_setset, _set) 425#endif /* _KERNEL */ 426 427/* XXX this stuff belongs elsewhere */ 428/* 429 * Message formats for messages from the net80211 layer to user 430 * applications via the routing socket. These messages are appended 431 * to an if_announcemsghdr structure. 432 */ 433struct ieee80211_join_event { 434 uint8_t iev_addr[6]; 435}; 436 437struct ieee80211_leave_event { 438 uint8_t iev_addr[6]; 439}; 440 441struct ieee80211_replay_event { 442 uint8_t iev_src[6]; /* src MAC */ 443 uint8_t iev_dst[6]; /* dst MAC */ 444 uint8_t iev_cipher; /* cipher type */ 445 uint8_t iev_keyix; /* key id/index */ 446 uint64_t iev_keyrsc; /* RSC from key */ 447 uint64_t iev_rsc; /* RSC from frame */ 448}; 449 450struct ieee80211_michael_event { 451 uint8_t iev_src[6]; /* src MAC */ 452 uint8_t iev_dst[6]; /* dst MAC */ 453 uint8_t iev_cipher; /* cipher type */ 454 uint8_t iev_keyix; /* key id/index */ 455}; 456 457struct ieee80211_wds_event { 458 uint8_t iev_addr[6]; 459}; 460 461struct ieee80211_csa_event { 462 uint32_t iev_flags; /* channel flags */ 463 uint16_t iev_freq; /* setting in Mhz */ 464 uint8_t iev_ieee; /* IEEE channel number */ 465 uint8_t iev_mode; /* CSA mode */ 466 uint8_t iev_count; /* CSA count */ 467}; 468 469struct ieee80211_cac_event { 470 uint32_t iev_flags; /* channel flags */ 471 uint16_t iev_freq; /* setting in Mhz */ 472 uint8_t iev_ieee; /* IEEE channel number */ 473 /* XXX timestamp? */ 474 uint8_t iev_type; /* IEEE80211_NOTIFY_CAC_* */ 475}; 476 477struct ieee80211_radar_event { 478 uint32_t iev_flags; /* channel flags */ 479 uint16_t iev_freq; /* setting in Mhz */ 480 uint8_t iev_ieee; /* IEEE channel number */ 481 /* XXX timestamp? */ 482}; 483 484struct ieee80211_auth_event { 485 uint8_t iev_addr[6]; 486}; 487 488struct ieee80211_deauth_event { 489 uint8_t iev_addr[6]; 490}; 491 492struct ieee80211_country_event { 493 uint8_t iev_addr[6]; 494 uint8_t iev_cc[2]; /* ISO country code */ 495}; 496 497struct ieee80211_radio_event { 498 uint8_t iev_state; /* 1 on, 0 off */ 499}; 500 501#define RTM_IEEE80211_ASSOC 100 /* station associate (bss mode) */ 502#define RTM_IEEE80211_REASSOC 101 /* station re-associate (bss mode) */ 503#define RTM_IEEE80211_DISASSOC 102 /* station disassociate (bss mode) */ 504#define RTM_IEEE80211_JOIN 103 /* station join (ap mode) */ 505#define RTM_IEEE80211_LEAVE 104 /* station leave (ap mode) */ 506#define RTM_IEEE80211_SCAN 105 /* scan complete, results available */ 507#define RTM_IEEE80211_REPLAY 106 /* sequence counter replay detected */ 508#define RTM_IEEE80211_MICHAEL 107 /* Michael MIC failure detected */ 509#define RTM_IEEE80211_REJOIN 108 /* station re-associate (ap mode) */ 510#define RTM_IEEE80211_WDS 109 /* WDS discovery (ap mode) */ 511#define RTM_IEEE80211_CSA 110 /* Channel Switch Announcement event */ 512#define RTM_IEEE80211_RADAR 111 /* radar event */ 513#define RTM_IEEE80211_CAC 112 /* Channel Availability Check event */ 514#define RTM_IEEE80211_DEAUTH 113 /* station deauthenticate */ 515#define RTM_IEEE80211_AUTH 114 /* station authenticate (ap mode) */ 516#define RTM_IEEE80211_COUNTRY 115 /* discovered country code (sta mode) */ 517#define RTM_IEEE80211_RADIO 116 /* RF kill switch state change */ 518 519/* 520 * Structure prepended to raw packets sent through the bpf 521 * interface when set to DLT_IEEE802_11_RADIO. This allows 522 * user applications to specify pretty much everything in 523 * an Atheros tx descriptor. XXX need to generalize. 524 * 525 * XXX cannot be more than 14 bytes as it is copied to a sockaddr's 526 * XXX sa_data area. 527 */ 528struct ieee80211_bpf_params { 529 uint8_t ibp_vers; /* version */ 530#define IEEE80211_BPF_VERSION 0 531 uint8_t ibp_len; /* header length in bytes */ 532 uint8_t ibp_flags; 533#define IEEE80211_BPF_SHORTPRE 0x01 /* tx with short preamble */ 534#define IEEE80211_BPF_NOACK 0x02 /* tx with no ack */ 535#define IEEE80211_BPF_CRYPTO 0x04 /* tx with h/w encryption */ 536#define IEEE80211_BPF_FCS 0x10 /* frame incldues FCS */ 537#define IEEE80211_BPF_DATAPAD 0x20 /* frame includes data padding */ 538#define IEEE80211_BPF_RTS 0x40 /* tx with RTS/CTS */ 539#define IEEE80211_BPF_CTS 0x80 /* tx with CTS only */ 540 uint8_t ibp_pri; /* WME/WMM AC+tx antenna */ 541 uint8_t ibp_try0; /* series 1 try count */ 542 uint8_t ibp_rate0; /* series 1 IEEE tx rate */ 543 uint8_t ibp_power; /* tx power (device units) */ 544 uint8_t ibp_ctsrate; /* IEEE tx rate for CTS */ 545 uint8_t ibp_try1; /* series 2 try count */ 546 uint8_t ibp_rate1; /* series 2 IEEE tx rate */ 547 uint8_t ibp_try2; /* series 3 try count */ 548 uint8_t ibp_rate2; /* series 3 IEEE tx rate */ 549 uint8_t ibp_try3; /* series 4 try count */ 550 uint8_t ibp_rate3; /* series 4 IEEE tx rate */ 551}; 552#endif /* _NET80211_IEEE80211_FREEBSD_H_ */ 553