ieee80211_proto.h revision 287946
1116742Ssam/*- 2116904Ssam * Copyright (c) 2001 Atsushi Onoe 3186904Ssam * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 4116742Ssam * All rights reserved. 5116742Ssam * 6116742Ssam * Redistribution and use in source and binary forms, with or without 7116742Ssam * modification, are permitted provided that the following conditions 8116742Ssam * are met: 9116742Ssam * 1. Redistributions of source code must retain the above copyright 10116742Ssam * notice, this list of conditions and the following disclaimer. 11116742Ssam * 2. Redistributions in binary form must reproduce the above copyright 12116742Ssam * notice, this list of conditions and the following disclaimer in the 13116742Ssam * documentation and/or other materials provided with the distribution. 14116742Ssam * 15116904Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16116904Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17116904Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18116904Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19116904Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20116904Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21116904Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22116904Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23116904Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24116904Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25116904Ssam * 26116742Ssam * $FreeBSD: head/sys/net80211/ieee80211_proto.h 287946 2015-09-18 04:01:26Z adrian $ 27116742Ssam */ 28116742Ssam#ifndef _NET80211_IEEE80211_PROTO_H_ 29116742Ssam#define _NET80211_IEEE80211_PROTO_H_ 30116742Ssam 31116742Ssam/* 32116742Ssam * 802.11 protocol implementation definitions. 33116742Ssam */ 34116742Ssam 35116742Ssamenum ieee80211_state { 36117811Ssam IEEE80211_S_INIT = 0, /* default state */ 37117811Ssam IEEE80211_S_SCAN = 1, /* scanning */ 38117811Ssam IEEE80211_S_AUTH = 2, /* try to authenticate */ 39117811Ssam IEEE80211_S_ASSOC = 3, /* try to assoc */ 40172058Ssam IEEE80211_S_CAC = 4, /* doing channel availability check */ 41172058Ssam IEEE80211_S_RUN = 5, /* operational (e.g. associated) */ 42172058Ssam IEEE80211_S_CSA = 6, /* channel switch announce pending */ 43172058Ssam IEEE80211_S_SLEEP = 7, /* power save */ 44116742Ssam}; 45172058Ssam#define IEEE80211_S_MAX (IEEE80211_S_SLEEP+1) 46116742Ssam 47178354Ssam#define IEEE80211_SEND_MGMT(_ni,_type,_arg) \ 48178354Ssam ((*(_ni)->ni_ic->ic_send_mgmt)(_ni, _type, _arg)) 49116742Ssam 50116742Ssamextern const char *ieee80211_mgt_subtype_name[]; 51178959Ssamextern const char *ieee80211_phymode_name[IEEE80211_MODE_MAX]; 52178957Ssamextern const int ieee80211_opcap[IEEE80211_OPMODE_MAX]; 53116742Ssam 54144618Ssamvoid ieee80211_proto_attach(struct ieee80211com *); 55144618Ssamvoid ieee80211_proto_detach(struct ieee80211com *); 56178354Ssamvoid ieee80211_proto_vattach(struct ieee80211vap *); 57178354Ssamvoid ieee80211_proto_vdetach(struct ieee80211vap *); 58116742Ssam 59287197Sglebiusvoid ieee80211_promisc(struct ieee80211vap *, bool); 60287197Sglebiusvoid ieee80211_allmulti(struct ieee80211vap *, bool); 61178354Ssamvoid ieee80211_syncflag(struct ieee80211vap *, int flag); 62193655Ssamvoid ieee80211_syncflag_ht(struct ieee80211vap *, int flag); 63178354Ssamvoid ieee80211_syncflag_ext(struct ieee80211vap *, int flag); 64178354Ssam 65220445Sadrian#define IEEE80211_R_NF 0x0000001 /* global NF value valid */ 66220445Sadrian#define IEEE80211_R_RSSI 0x0000002 /* global RSSI value valid */ 67220445Sadrian#define IEEE80211_R_C_CHAIN 0x0000004 /* RX chain count valid */ 68220445Sadrian#define IEEE80211_R_C_NF 0x0000008 /* per-chain NF value valid */ 69220445Sadrian#define IEEE80211_R_C_RSSI 0x0000010 /* per-chain RSSI value valid */ 70220445Sadrian#define IEEE80211_R_C_EVM 0x0000020 /* per-chain EVM valid */ 71220445Sadrian#define IEEE80211_R_C_HT40 0x0000040 /* RX'ed packet is 40mhz, pilots 4,5 valid */ 72283535Sadrian#define IEEE80211_R_FREQ 0x0000080 /* Freq value populated, MHz */ 73283535Sadrian#define IEEE80211_R_IEEE 0x0000100 /* IEEE value populated */ 74283535Sadrian#define IEEE80211_R_BAND 0x0000200 /* Frequency band populated */ 75220445Sadrian 76220445Sadrianstruct ieee80211_rx_stats { 77220445Sadrian uint32_t r_flags; /* IEEE80211_R_* flags */ 78220445Sadrian uint8_t c_chain; /* number of RX chains involved */ 79220445Sadrian int16_t c_nf_ctl[IEEE80211_MAX_CHAINS]; /* per-chain NF */ 80220445Sadrian int16_t c_nf_ext[IEEE80211_MAX_CHAINS]; /* per-chain NF */ 81220445Sadrian int16_t c_rssi_ctl[IEEE80211_MAX_CHAINS]; /* per-chain RSSI */ 82220445Sadrian int16_t c_rssi_ext[IEEE80211_MAX_CHAINS]; /* per-chain RSSI */ 83220445Sadrian uint8_t nf; /* global NF */ 84220445Sadrian uint8_t rssi; /* global RSSI */ 85220445Sadrian uint8_t evm[IEEE80211_MAX_CHAINS][IEEE80211_MAX_EVM_PILOTS]; 86220445Sadrian /* per-chain, per-pilot EVM values */ 87283535Sadrian uint16_t c_freq; 88283535Sadrian uint8_t c_ieee; 89220445Sadrian}; 90220445Sadrian 91192468Ssam#define ieee80211_input(ni, m, rssi, nf) \ 92283535Sadrian ((ni)->ni_vap->iv_input(ni, m, NULL, rssi, nf)) 93192468Ssamint ieee80211_input_all(struct ieee80211com *, struct mbuf *, int, int); 94220445Sadrian 95220445Sadrianint ieee80211_input_mimo(struct ieee80211_node *, struct mbuf *, 96220445Sadrian struct ieee80211_rx_stats *); 97220445Sadrianint ieee80211_input_mimo_all(struct ieee80211com *, struct mbuf *, 98220445Sadrian struct ieee80211_rx_stats *); 99220445Sadrian 100184287Ssamstruct ieee80211_bpf_params; 101184282Ssamint ieee80211_mgmt_output(struct ieee80211_node *, struct mbuf *, int, 102184282Ssam struct ieee80211_bpf_params *); 103160690Ssamint ieee80211_raw_xmit(struct ieee80211_node *, struct mbuf *, 104160690Ssam const struct ieee80211_bpf_params *); 105160690Ssamint ieee80211_output(struct ifnet *, struct mbuf *, 106249925Sglebius const struct sockaddr *, struct route *ro); 107253743Sadrianint ieee80211_vap_pkt_send_dest(struct ieee80211vap *, struct mbuf *, 108253743Sadrian struct ieee80211_node *); 109248069Sadrianint ieee80211_raw_output(struct ieee80211vap *, struct ieee80211_node *, 110248069Sadrian struct mbuf *, const struct ieee80211_bpf_params *); 111195618Srpaulovoid ieee80211_send_setup(struct ieee80211_node *, struct mbuf *, int, int, 112195618Srpaulo const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN], 113195618Srpaulo const uint8_t [IEEE80211_ADDR_LEN]); 114254082Sadrianint ieee80211_vap_transmit(struct ifnet *ifp, struct mbuf *m); 115254082Sadrianvoid ieee80211_vap_qflush(struct ifnet *ifp); 116148301Ssamint ieee80211_send_nulldata(struct ieee80211_node *); 117178354Ssamint ieee80211_classify(struct ieee80211_node *, struct mbuf *m); 118190391Ssamstruct mbuf *ieee80211_mbuf_adjust(struct ieee80211vap *, int, 119190579Ssam struct ieee80211_key *, struct mbuf *); 120190579Ssamstruct mbuf *ieee80211_encap(struct ieee80211vap *, struct ieee80211_node *, 121190579Ssam struct mbuf *); 122178354Ssamint ieee80211_send_mgmt(struct ieee80211_node *, int, int); 123178354Ssamstruct ieee80211_appie; 124148315Ssamint ieee80211_send_probereq(struct ieee80211_node *ni, 125170530Ssam const uint8_t sa[IEEE80211_ADDR_LEN], 126170530Ssam const uint8_t da[IEEE80211_ADDR_LEN], 127170530Ssam const uint8_t bssid[IEEE80211_ADDR_LEN], 128178354Ssam const uint8_t *ssid, size_t ssidlen); 129254900Sadrianstruct mbuf * ieee80211_ff_encap1(struct ieee80211vap *, struct mbuf *, 130254900Sadrian const struct ether_header *); 131254956Sadrianvoid ieee80211_tx_complete(struct ieee80211_node *, 132254956Sadrian struct mbuf *, int); 133254900Sadrian 134178354Ssam/* 135178354Ssam * The formation of ProbeResponse frames requires guidance to 136178354Ssam * deal with legacy clients. When the client is identified as 137178354Ssam * "legacy 11b" ieee80211_send_proberesp is passed this token. 138178354Ssam */ 139178354Ssam#define IEEE80211_SEND_LEGACY_11B 0x1 /* legacy 11b client */ 140178354Ssam#define IEEE80211_SEND_LEGACY_11 0x2 /* other legacy client */ 141178354Ssam#define IEEE80211_SEND_LEGACY 0x3 /* any legacy client */ 142178354Ssamstruct mbuf *ieee80211_alloc_proberesp(struct ieee80211_node *, int); 143178354Ssamint ieee80211_send_proberesp(struct ieee80211vap *, 144178354Ssam const uint8_t da[IEEE80211_ADDR_LEN], int); 145178354Ssamstruct mbuf *ieee80211_alloc_rts(struct ieee80211com *ic, 146178354Ssam const uint8_t [IEEE80211_ADDR_LEN], 147178354Ssam const uint8_t [IEEE80211_ADDR_LEN], uint16_t); 148178354Ssamstruct mbuf *ieee80211_alloc_cts(struct ieee80211com *, 149178354Ssam const uint8_t [IEEE80211_ADDR_LEN], uint16_t); 150138568Ssam 151195618Srpaulouint8_t *ieee80211_add_rates(uint8_t *, const struct ieee80211_rateset *); 152195618Srpaulouint8_t *ieee80211_add_xrates(uint8_t *, const struct ieee80211_rateset *); 153275928Sadrianuint8_t *ieee80211_add_ssid(uint8_t *, const uint8_t *, u_int); 154253639Srpaulouint8_t *ieee80211_add_wpa(uint8_t *, const struct ieee80211vap *); 155253639Srpaulouint8_t *ieee80211_add_rsn(uint8_t *, const struct ieee80211vap *); 156253639Srpaulouint8_t *ieee80211_add_qos(uint8_t *, const struct ieee80211_node *); 157195618Srpaulouint16_t ieee80211_getcapinfo(struct ieee80211vap *, 158195618Srpaulo struct ieee80211_channel *); 159287946Sadrianstruct ieee80211_wme_state; 160287946Sadrianuint8_t * ieee80211_add_wme_info(uint8_t *frm, struct ieee80211_wme_state *wme); 161195618Srpaulo 162144618Ssamvoid ieee80211_reset_erp(struct ieee80211com *); 163144618Ssamvoid ieee80211_set_shortslottime(struct ieee80211com *, int onoff); 164178354Ssamint ieee80211_iserp_rateset(const struct ieee80211_rateset *); 165178354Ssamvoid ieee80211_setbasicrates(struct ieee80211_rateset *, 166138568Ssam enum ieee80211_phymode); 167178354Ssamvoid ieee80211_addbasicrates(struct ieee80211_rateset *, 168178354Ssam enum ieee80211_phymode); 169138568Ssam 170138568Ssam/* 171138568Ssam * Return the size of the 802.11 header for a management or data frame. 172138568Ssam */ 173139525Ssamstatic __inline int 174138568Ssamieee80211_hdrsize(const void *data) 175138568Ssam{ 176138568Ssam const struct ieee80211_frame *wh = data; 177138568Ssam int size = sizeof(struct ieee80211_frame); 178138568Ssam 179138568Ssam /* NB: we don't handle control frames */ 180138568Ssam KASSERT((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL, 181138568Ssam ("%s: control frame", __func__)); 182193840Ssam if (IEEE80211_IS_DSTODS(wh)) 183138568Ssam size += IEEE80211_ADDR_LEN; 184138568Ssam if (IEEE80211_QOS_HAS_SEQ(wh)) 185170530Ssam size += sizeof(uint16_t); 186138568Ssam return size; 187138568Ssam} 188138568Ssam 189138568Ssam/* 190170530Ssam * Like ieee80211_hdrsize, but handles any type of frame. 191138568Ssam */ 192139525Ssamstatic __inline int 193138568Ssamieee80211_anyhdrsize(const void *data) 194138568Ssam{ 195138568Ssam const struct ieee80211_frame *wh = data; 196138568Ssam 197138568Ssam if ((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) { 198138568Ssam switch (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) { 199138568Ssam case IEEE80211_FC0_SUBTYPE_CTS: 200138568Ssam case IEEE80211_FC0_SUBTYPE_ACK: 201138568Ssam return sizeof(struct ieee80211_frame_ack); 202170530Ssam case IEEE80211_FC0_SUBTYPE_BAR: 203170530Ssam return sizeof(struct ieee80211_frame_bar); 204138568Ssam } 205138568Ssam return sizeof(struct ieee80211_frame_min); 206138568Ssam } else 207138568Ssam return ieee80211_hdrsize(data); 208138568Ssam} 209138568Ssam 210138568Ssam/* 211138568Ssam * Template for an in-kernel authenticator. Authenticators 212138568Ssam * register with the protocol code and are typically loaded 213178354Ssam * as separate modules as needed. One special authenticator 214178354Ssam * is xauth; it intercepts requests so that protocols like 215178354Ssam * WPA can be handled in user space. 216138568Ssam */ 217138568Ssamstruct ieee80211_authenticator { 218138568Ssam const char *ia_name; /* printable name */ 219178354Ssam int (*ia_attach)(struct ieee80211vap *); 220178354Ssam void (*ia_detach)(struct ieee80211vap *); 221178354Ssam void (*ia_node_join)(struct ieee80211_node *); 222178354Ssam void (*ia_node_leave)(struct ieee80211_node *); 223138568Ssam}; 224144618Ssamvoid ieee80211_authenticator_register(int type, 225138568Ssam const struct ieee80211_authenticator *); 226144618Ssamvoid ieee80211_authenticator_unregister(int type); 227144618Ssamconst struct ieee80211_authenticator *ieee80211_authenticator_get(int auth); 228138568Ssam 229149028Ssamstruct ieee80211req; 230138568Ssam/* 231138568Ssam * Template for an MAC ACL policy module. Such modules 232138568Ssam * register with the protocol code and are passed the sender's 233178354Ssam * address of each received auth frame for validation. 234138568Ssam */ 235138568Ssamstruct ieee80211_aclator { 236138568Ssam const char *iac_name; /* printable name */ 237178354Ssam int (*iac_attach)(struct ieee80211vap *); 238178354Ssam void (*iac_detach)(struct ieee80211vap *); 239178354Ssam int (*iac_check)(struct ieee80211vap *, 240228622Sbschmidt const struct ieee80211_frame *wh); 241178354Ssam int (*iac_add)(struct ieee80211vap *, 242170530Ssam const uint8_t mac[IEEE80211_ADDR_LEN]); 243178354Ssam int (*iac_remove)(struct ieee80211vap *, 244170530Ssam const uint8_t mac[IEEE80211_ADDR_LEN]); 245178354Ssam int (*iac_flush)(struct ieee80211vap *); 246178354Ssam int (*iac_setpolicy)(struct ieee80211vap *, int); 247178354Ssam int (*iac_getpolicy)(struct ieee80211vap *); 248178354Ssam int (*iac_setioctl)(struct ieee80211vap *, struct ieee80211req *); 249178354Ssam int (*iac_getioctl)(struct ieee80211vap *, struct ieee80211req *); 250138568Ssam}; 251144618Ssamvoid ieee80211_aclator_register(const struct ieee80211_aclator *); 252144618Ssamvoid ieee80211_aclator_unregister(const struct ieee80211_aclator *); 253144618Ssamconst struct ieee80211_aclator *ieee80211_aclator_get(const char *name); 254138568Ssam 255138568Ssam/* flags for ieee80211_fix_rate() */ 256138568Ssam#define IEEE80211_F_DOSORT 0x00000001 /* sort rate list */ 257178354Ssam#define IEEE80211_F_DOFRATE 0x00000002 /* use fixed legacy rate */ 258138568Ssam#define IEEE80211_F_DONEGO 0x00000004 /* calc negotiated rate */ 259138568Ssam#define IEEE80211_F_DODEL 0x00000008 /* delete ignore rate */ 260170530Ssam#define IEEE80211_F_DOBRS 0x00000010 /* check basic rate set */ 261170530Ssam#define IEEE80211_F_JOIN 0x00000020 /* sta joining our bss */ 262178354Ssam#define IEEE80211_F_DOFMCS 0x00000040 /* use fixed HT rate */ 263167442Ssamint ieee80211_fix_rate(struct ieee80211_node *, 264167442Ssam struct ieee80211_rateset *, int); 265138568Ssam 266138568Ssam/* 267138568Ssam * WME/WMM support. 268138568Ssam */ 269138568Ssamstruct wmeParams { 270170530Ssam uint8_t wmep_acm; 271170530Ssam uint8_t wmep_aifsn; 272170530Ssam uint8_t wmep_logcwmin; /* log2(cwmin) */ 273170530Ssam uint8_t wmep_logcwmax; /* log2(cwmax) */ 274170530Ssam uint8_t wmep_txopLimit; 275170530Ssam uint8_t wmep_noackPolicy; /* 0 (ack), 1 (no ack) */ 276138568Ssam}; 277140762Ssam#define IEEE80211_TXOP_TO_US(_txop) ((_txop)<<5) 278140762Ssam#define IEEE80211_US_TO_TXOP(_us) ((_us)>>5) 279138568Ssam 280138568Ssamstruct chanAccParams { 281170530Ssam uint8_t cap_info; /* version of the current set */ 282138568Ssam struct wmeParams cap_wmeParams[WME_NUM_AC]; 283138568Ssam}; 284138568Ssam 285138568Ssamstruct ieee80211_wme_state { 286138568Ssam u_int wme_flags; 287138568Ssam#define WME_F_AGGRMODE 0x00000001 /* STATUS: WME agressive mode */ 288138568Ssam u_int wme_hipri_traffic; /* VI/VO frames in beacon interval */ 289138568Ssam u_int wme_hipri_switch_thresh;/* agressive mode switch thresh */ 290138568Ssam u_int wme_hipri_switch_hysteresis;/* agressive mode switch hysteresis */ 291138568Ssam 292138568Ssam struct wmeParams wme_params[4]; /* from assoc resp for each AC*/ 293138568Ssam struct chanAccParams wme_wmeChanParams; /* WME params applied to self */ 294138568Ssam struct chanAccParams wme_wmeBssChanParams;/* WME params bcast to stations */ 295138568Ssam struct chanAccParams wme_chanParams; /* params applied to self */ 296138568Ssam struct chanAccParams wme_bssChanParams; /* params bcast to stations */ 297138568Ssam 298138568Ssam int (*wme_update)(struct ieee80211com *); 299138568Ssam}; 300138568Ssam 301178354Ssamvoid ieee80211_wme_initparams(struct ieee80211vap *); 302178354Ssamvoid ieee80211_wme_updateparams(struct ieee80211vap *); 303178354Ssamvoid ieee80211_wme_updateparams_locked(struct ieee80211vap *); 304138568Ssam 305178354Ssam/* 306178354Ssam * Return the WME TID from a QoS frame. If no TID 307178354Ssam * is present return the index for the "non-QoS" entry. 308178354Ssam */ 309178354Ssamstatic __inline uint8_t 310178354Ssamieee80211_gettid(const struct ieee80211_frame *wh) 311178354Ssam{ 312178354Ssam uint8_t tid; 313178354Ssam 314178354Ssam if (IEEE80211_QOS_HAS_SEQ(wh)) { 315193840Ssam if (IEEE80211_IS_DSTODS(wh)) 316193840Ssam tid = ((const struct ieee80211_qosframe_addr4 *)wh)-> 317193840Ssam i_qos[0]; 318193840Ssam else 319193840Ssam tid = ((const struct ieee80211_qosframe *)wh)->i_qos[0]; 320193840Ssam tid &= IEEE80211_QOS_TID; 321178354Ssam } else 322178354Ssam tid = IEEE80211_NONQOS_TID; 323178354Ssam return tid; 324178354Ssam} 325178354Ssam 326188533Sthompsavoid ieee80211_waitfor_parent(struct ieee80211com *); 327178354Ssamvoid ieee80211_start_locked(struct ieee80211vap *); 328178354Ssamvoid ieee80211_init(void *); 329178354Ssamvoid ieee80211_start_all(struct ieee80211com *); 330178354Ssamvoid ieee80211_stop_locked(struct ieee80211vap *); 331178354Ssamvoid ieee80211_stop(struct ieee80211vap *); 332178354Ssamvoid ieee80211_stop_all(struct ieee80211com *); 333179391Ssamvoid ieee80211_suspend_all(struct ieee80211com *); 334179391Ssamvoid ieee80211_resume_all(struct ieee80211com *); 335178354Ssamvoid ieee80211_dturbo_switch(struct ieee80211vap *, int newflags); 336178354Ssamvoid ieee80211_swbmiss(void *arg); 337153349Ssamvoid ieee80211_beacon_miss(struct ieee80211com *); 338178354Ssamint ieee80211_new_state(struct ieee80211vap *, enum ieee80211_state, int); 339257065Sadrianint ieee80211_new_state_locked(struct ieee80211vap *, enum ieee80211_state, 340257065Sadrian int); 341170530Ssamvoid ieee80211_print_essid(const uint8_t *, int); 342170530Ssamvoid ieee80211_dump_pkt(struct ieee80211com *, 343170530Ssam const uint8_t *, int, int, int); 344117811Ssam 345167283Ssamextern const char *ieee80211_opmode_name[]; 346117811Ssamextern const char *ieee80211_state_name[IEEE80211_S_MAX]; 347138568Ssamextern const char *ieee80211_wme_acnames[]; 348138568Ssam 349138568Ssam/* 350138568Ssam * Beacon frames constructed by ieee80211_beacon_alloc 351138568Ssam * have the following structure filled in so drivers 352138568Ssam * can update the frame later w/ minimal overhead. 353138568Ssam */ 354138568Ssamstruct ieee80211_beacon_offsets { 355172211Ssam uint8_t bo_flags[4]; /* update/state flags */ 356170530Ssam uint16_t *bo_caps; /* capabilities */ 357172211Ssam uint8_t *bo_cfp; /* start of CFParms element */ 358170530Ssam uint8_t *bo_tim; /* start of atim/dtim */ 359170530Ssam uint8_t *bo_wme; /* start of WME parameters */ 360186904Ssam uint8_t *bo_tdma; /* start of TDMA parameters */ 361172211Ssam uint8_t *bo_tim_trailer;/* start of fixed-size trailer */ 362170530Ssam uint16_t bo_tim_len; /* atim/dtim length in bytes */ 363172211Ssam uint16_t bo_tim_trailer_len;/* tim trailer length in bytes */ 364170530Ssam uint8_t *bo_erp; /* start of ERP element */ 365170530Ssam uint8_t *bo_htinfo; /* start of HT info element */ 366190451Ssam uint8_t *bo_ath; /* start of ATH parameters */ 367172211Ssam uint8_t *bo_appie; /* start of AppIE element */ 368172211Ssam uint16_t bo_appie_len; /* AppIE length in bytes */ 369199187Santoine uint16_t bo_csa_trailer_len; 370172211Ssam uint8_t *bo_csa; /* start of CSA element */ 371227331Sadrian uint8_t *bo_quiet; /* start of Quiet element */ 372198242Srpaulo uint8_t *bo_meshconf; /* start of MESHCONF element */ 373198242Srpaulo uint8_t *bo_spare[3]; 374138568Ssam}; 375172211Ssamstruct mbuf *ieee80211_beacon_alloc(struct ieee80211_node *, 376172211Ssam struct ieee80211_beacon_offsets *); 377138568Ssam 378138568Ssam/* 379178354Ssam * Beacon frame updates are signaled through calls to iv_update_beacon 380172211Ssam * with one of the IEEE80211_BEACON_* tokens defined below. For devices 381172211Ssam * that construct beacon frames on the host this can trigger a rebuild 382172211Ssam * or defer the processing. For devices that offload beacon frame 383172211Ssam * handling this callback can be used to signal a rebuild. The bo_flags 384172211Ssam * array in the ieee80211_beacon_offsets structure is intended to record 385172211Ssam * deferred processing requirements; ieee80211_beacon_update uses the 386172211Ssam * state to optimize work. Since this structure is owned by the driver 387178354Ssam * and not visible to the 802.11 layer drivers must supply an iv_update_beacon 388172211Ssam * callback that marks the flag bits and schedules (as necessary) an update. 389172211Ssam */ 390172211Ssamenum { 391172211Ssam IEEE80211_BEACON_CAPS = 0, /* capabilities */ 392172211Ssam IEEE80211_BEACON_TIM = 1, /* DTIM/ATIM */ 393172211Ssam IEEE80211_BEACON_WME = 2, 394172211Ssam IEEE80211_BEACON_ERP = 3, /* Extended Rate Phy */ 395172211Ssam IEEE80211_BEACON_HTINFO = 4, /* HT Information */ 396172211Ssam IEEE80211_BEACON_APPIE = 5, /* Application IE's */ 397172211Ssam IEEE80211_BEACON_CFP = 6, /* CFParms */ 398172211Ssam IEEE80211_BEACON_CSA = 7, /* Channel Switch Announcement */ 399186904Ssam IEEE80211_BEACON_TDMA = 9, /* TDMA Info */ 400190451Ssam IEEE80211_BEACON_ATH = 10, /* ATH parameters */ 401198242Srpaulo IEEE80211_BEACON_MESHCONF = 11, /* Mesh Configuration */ 402172211Ssam}; 403172211Ssamint ieee80211_beacon_update(struct ieee80211_node *, 404172211Ssam struct ieee80211_beacon_offsets *, struct mbuf *, int mcast); 405172211Ssam 406178354Ssamvoid ieee80211_csa_startswitch(struct ieee80211com *, 407178354Ssam struct ieee80211_channel *, int mode, int count); 408178354Ssamvoid ieee80211_csa_completeswitch(struct ieee80211com *); 409193439Ssamvoid ieee80211_csa_cancelswitch(struct ieee80211com *); 410178354Ssamvoid ieee80211_cac_completeswitch(struct ieee80211vap *); 411178354Ssam 412172211Ssam/* 413138568Ssam * Notification methods called from the 802.11 state machine. 414138568Ssam * Note that while these are defined here, their implementation 415138568Ssam * is OS-specific. 416138568Ssam */ 417178354Ssamvoid ieee80211_notify_node_join(struct ieee80211_node *, int newassoc); 418178354Ssamvoid ieee80211_notify_node_leave(struct ieee80211_node *); 419178354Ssamvoid ieee80211_notify_scan_done(struct ieee80211vap *); 420178354Ssamvoid ieee80211_notify_wds_discover(struct ieee80211_node *); 421178354Ssamvoid ieee80211_notify_csa(struct ieee80211com *, 422178354Ssam const struct ieee80211_channel *, int mode, int count); 423178354Ssamvoid ieee80211_notify_radar(struct ieee80211com *, 424178354Ssam const struct ieee80211_channel *); 425178354Ssamenum ieee80211_notify_cac_event { 426178354Ssam IEEE80211_NOTIFY_CAC_START = 0, /* CAC timer started */ 427178354Ssam IEEE80211_NOTIFY_CAC_STOP = 1, /* CAC intentionally stopped */ 428178354Ssam IEEE80211_NOTIFY_CAC_RADAR = 2, /* CAC stopped due to radar detectio */ 429178354Ssam IEEE80211_NOTIFY_CAC_EXPIRE = 3, /* CAC expired w/o radar */ 430178354Ssam}; 431178354Ssamvoid ieee80211_notify_cac(struct ieee80211com *, 432178354Ssam const struct ieee80211_channel *, 433178354Ssam enum ieee80211_notify_cac_event); 434178354Ssamvoid ieee80211_notify_node_deauth(struct ieee80211_node *); 435178354Ssamvoid ieee80211_notify_node_auth(struct ieee80211_node *); 436178354Ssamvoid ieee80211_notify_country(struct ieee80211vap *, const uint8_t [], 437178354Ssam const uint8_t cc[2]); 438178354Ssamvoid ieee80211_notify_radio(struct ieee80211com *, int); 439116742Ssam#endif /* _NET80211_IEEE80211_PROTO_H_ */ 440