ieee80211_proto.h (170360) | ieee80211_proto.h (170530) |
---|---|
1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/net80211/ieee80211_proto.h 170360 2007-06-06 04:56:04Z sam $ | 26 * $FreeBSD: head/sys/net80211/ieee80211_proto.h 170530 2007-06-11 03:36:55Z sam $ |
27 */ 28#ifndef _NET80211_IEEE80211_PROTO_H_ 29#define _NET80211_IEEE80211_PROTO_H_ 30 31/* 32 * 802.11 protocol implementation definitions. 33 */ 34 --- 12 unchanged lines hidden (view full) --- 47extern const char *ieee80211_mgt_subtype_name[]; 48extern const char *ieee80211_phymode_name[]; 49 50void ieee80211_proto_attach(struct ieee80211com *); 51void ieee80211_proto_detach(struct ieee80211com *); 52 53struct ieee80211_node; 54int ieee80211_input(struct ieee80211com *, struct mbuf *, | 27 */ 28#ifndef _NET80211_IEEE80211_PROTO_H_ 29#define _NET80211_IEEE80211_PROTO_H_ 30 31/* 32 * 802.11 protocol implementation definitions. 33 */ 34 --- 12 unchanged lines hidden (view full) --- 47extern const char *ieee80211_mgt_subtype_name[]; 48extern const char *ieee80211_phymode_name[]; 49 50void ieee80211_proto_attach(struct ieee80211com *); 51void ieee80211_proto_detach(struct ieee80211com *); 52 53struct ieee80211_node; 54int ieee80211_input(struct ieee80211com *, struct mbuf *, |
55 struct ieee80211_node *, int, u_int32_t); | 55 struct ieee80211_node *, int, int, uint32_t); 56void ieee80211_deliver_data(struct ieee80211com *, 57 struct ieee80211_node *, struct mbuf *); 58struct mbuf *ieee80211_decap1(struct mbuf *, int *); |
56int ieee80211_setup_rates(struct ieee80211_node *ni, | 59int ieee80211_setup_rates(struct ieee80211_node *ni, |
57 const u_int8_t *rates, const u_int8_t *xrates, int flags); 58void ieee80211_saveie(u_int8_t **, const u_int8_t *); | 60 const uint8_t *rates, const uint8_t *xrates, int flags); 61void ieee80211_saveie(uint8_t **, const uint8_t *); 62void ieee80211_saveath(struct ieee80211_node *, uint8_t *); |
59void ieee80211_recv_mgmt(struct ieee80211com *, struct mbuf *, | 63void ieee80211_recv_mgmt(struct ieee80211com *, struct mbuf *, |
60 struct ieee80211_node *, int, int, u_int32_t); | 64 struct ieee80211_node *, int, int, int, uint32_t); 65int ieee80211_mgmt_output(struct ieee80211com *, struct ieee80211_node *, 66 struct mbuf *, int type); |
61struct ieee80211_bpf_params; 62int ieee80211_raw_xmit(struct ieee80211_node *, struct mbuf *, 63 const struct ieee80211_bpf_params *); 64int ieee80211_output(struct ifnet *, struct mbuf *, 65 struct sockaddr *, struct rtentry *); 66int ieee80211_send_nulldata(struct ieee80211_node *); | 67struct ieee80211_bpf_params; 68int ieee80211_raw_xmit(struct ieee80211_node *, struct mbuf *, 69 const struct ieee80211_bpf_params *); 70int ieee80211_output(struct ifnet *, struct mbuf *, 71 struct sockaddr *, struct rtentry *); 72int ieee80211_send_nulldata(struct ieee80211_node *); |
67int ieee80211_send_probereq(struct ieee80211_node *ni, 68 const u_int8_t sa[IEEE80211_ADDR_LEN], 69 const u_int8_t da[IEEE80211_ADDR_LEN], 70 const u_int8_t bssid[IEEE80211_ADDR_LEN], 71 const u_int8_t *ssid, size_t ssidlen, 72 const void *optie, size_t optielen); | |
73int ieee80211_send_mgmt(struct ieee80211com *, struct ieee80211_node *, 74 int, int); | 73int ieee80211_send_mgmt(struct ieee80211com *, struct ieee80211_node *, 74 int, int); |
75int ieee80211_send_probereq(struct ieee80211_node *ni, 76 const uint8_t sa[IEEE80211_ADDR_LEN], 77 const uint8_t da[IEEE80211_ADDR_LEN], 78 const uint8_t bssid[IEEE80211_ADDR_LEN], 79 const uint8_t *ssid, size_t ssidlen, 80 const void *optie, size_t optielen); |
|
75int ieee80211_classify(struct ieee80211com *, struct mbuf *, 76 struct ieee80211_node *); 77struct mbuf *ieee80211_encap(struct ieee80211com *, struct mbuf *, 78 struct ieee80211_node *); | 81int ieee80211_classify(struct ieee80211com *, struct mbuf *, 82 struct ieee80211_node *); 83struct mbuf *ieee80211_encap(struct ieee80211com *, struct mbuf *, 84 struct ieee80211_node *); |
79void ieee80211_pwrsave(struct ieee80211com *, struct ieee80211_node *, 80 struct mbuf *); | |
81 82void ieee80211_reset_erp(struct ieee80211com *); 83void ieee80211_set_shortslottime(struct ieee80211com *, int onoff); 84int ieee80211_iserp_rateset(struct ieee80211com *, 85 struct ieee80211_rateset *); 86void ieee80211_set11gbasicrates(struct ieee80211_rateset *, 87 enum ieee80211_phymode); 88 --- 7 unchanged lines hidden (view full) --- 96 int size = sizeof(struct ieee80211_frame); 97 98 /* NB: we don't handle control frames */ 99 KASSERT((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL, 100 ("%s: control frame", __func__)); 101 if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) 102 size += IEEE80211_ADDR_LEN; 103 if (IEEE80211_QOS_HAS_SEQ(wh)) | 85 86void ieee80211_reset_erp(struct ieee80211com *); 87void ieee80211_set_shortslottime(struct ieee80211com *, int onoff); 88int ieee80211_iserp_rateset(struct ieee80211com *, 89 struct ieee80211_rateset *); 90void ieee80211_set11gbasicrates(struct ieee80211_rateset *, 91 enum ieee80211_phymode); 92 --- 7 unchanged lines hidden (view full) --- 100 int size = sizeof(struct ieee80211_frame); 101 102 /* NB: we don't handle control frames */ 103 KASSERT((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL, 104 ("%s: control frame", __func__)); 105 if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) 106 size += IEEE80211_ADDR_LEN; 107 if (IEEE80211_QOS_HAS_SEQ(wh)) |
104 size += sizeof(u_int16_t); | 108 size += sizeof(uint16_t); |
105 return size; 106} 107 108/* | 109 return size; 110} 111 112/* |
109 * Return the size of the 802.11 header; handles any type of frame. | 113 * Like ieee80211_hdrsize, but handles any type of frame. |
110 */ 111static __inline int 112ieee80211_anyhdrsize(const void *data) 113{ 114 const struct ieee80211_frame *wh = data; 115 116 if ((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) { 117 switch (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) { 118 case IEEE80211_FC0_SUBTYPE_CTS: 119 case IEEE80211_FC0_SUBTYPE_ACK: 120 return sizeof(struct ieee80211_frame_ack); | 114 */ 115static __inline int 116ieee80211_anyhdrsize(const void *data) 117{ 118 const struct ieee80211_frame *wh = data; 119 120 if ((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) { 121 switch (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) { 122 case IEEE80211_FC0_SUBTYPE_CTS: 123 case IEEE80211_FC0_SUBTYPE_ACK: 124 return sizeof(struct ieee80211_frame_ack); |
125 case IEEE80211_FC0_SUBTYPE_BAR: 126 return sizeof(struct ieee80211_frame_bar); |
|
121 } 122 return sizeof(struct ieee80211_frame_min); 123 } else 124 return ieee80211_hdrsize(data); 125} 126 127/* 128 * Template for an in-kernel authenticator. Authenticators --- 20 unchanged lines hidden (view full) --- 149 * register with the protocol code and are passed the sender's 150 * address of each received frame for validation. 151 */ 152struct ieee80211_aclator { 153 const char *iac_name; /* printable name */ 154 int (*iac_attach)(struct ieee80211com *); 155 void (*iac_detach)(struct ieee80211com *); 156 int (*iac_check)(struct ieee80211com *, | 127 } 128 return sizeof(struct ieee80211_frame_min); 129 } else 130 return ieee80211_hdrsize(data); 131} 132 133/* 134 * Template for an in-kernel authenticator. Authenticators --- 20 unchanged lines hidden (view full) --- 155 * register with the protocol code and are passed the sender's 156 * address of each received frame for validation. 157 */ 158struct ieee80211_aclator { 159 const char *iac_name; /* printable name */ 160 int (*iac_attach)(struct ieee80211com *); 161 void (*iac_detach)(struct ieee80211com *); 162 int (*iac_check)(struct ieee80211com *, |
157 const u_int8_t mac[IEEE80211_ADDR_LEN]); | 163 const uint8_t mac[IEEE80211_ADDR_LEN]); |
158 int (*iac_add)(struct ieee80211com *, | 164 int (*iac_add)(struct ieee80211com *, |
159 const u_int8_t mac[IEEE80211_ADDR_LEN]); | 165 const uint8_t mac[IEEE80211_ADDR_LEN]); |
160 int (*iac_remove)(struct ieee80211com *, | 166 int (*iac_remove)(struct ieee80211com *, |
161 const u_int8_t mac[IEEE80211_ADDR_LEN]); | 167 const uint8_t mac[IEEE80211_ADDR_LEN]); |
162 int (*iac_flush)(struct ieee80211com *); 163 int (*iac_setpolicy)(struct ieee80211com *, int); 164 int (*iac_getpolicy)(struct ieee80211com *); 165 int (*iac_setioctl)(struct ieee80211com *, struct ieee80211req *); 166 int (*iac_getioctl)(struct ieee80211com *, struct ieee80211req *); 167}; 168void ieee80211_aclator_register(const struct ieee80211_aclator *); 169void ieee80211_aclator_unregister(const struct ieee80211_aclator *); 170const struct ieee80211_aclator *ieee80211_aclator_get(const char *name); 171 172/* flags for ieee80211_fix_rate() */ 173#define IEEE80211_F_DOSORT 0x00000001 /* sort rate list */ 174#define IEEE80211_F_DOFRATE 0x00000002 /* use fixed rate */ 175#define IEEE80211_F_DONEGO 0x00000004 /* calc negotiated rate */ 176#define IEEE80211_F_DODEL 0x00000008 /* delete ignore rate */ | 168 int (*iac_flush)(struct ieee80211com *); 169 int (*iac_setpolicy)(struct ieee80211com *, int); 170 int (*iac_getpolicy)(struct ieee80211com *); 171 int (*iac_setioctl)(struct ieee80211com *, struct ieee80211req *); 172 int (*iac_getioctl)(struct ieee80211com *, struct ieee80211req *); 173}; 174void ieee80211_aclator_register(const struct ieee80211_aclator *); 175void ieee80211_aclator_unregister(const struct ieee80211_aclator *); 176const struct ieee80211_aclator *ieee80211_aclator_get(const char *name); 177 178/* flags for ieee80211_fix_rate() */ 179#define IEEE80211_F_DOSORT 0x00000001 /* sort rate list */ 180#define IEEE80211_F_DOFRATE 0x00000002 /* use fixed rate */ 181#define IEEE80211_F_DONEGO 0x00000004 /* calc negotiated rate */ 182#define IEEE80211_F_DODEL 0x00000008 /* delete ignore rate */ |
177#define IEEE80211_F_JOIN 0x00000010 /* sta joining our bss */ | 183#define IEEE80211_F_DOBRS 0x00000010 /* check basic rate set */ 184#define IEEE80211_F_JOIN 0x00000020 /* sta joining our bss */ |
178int ieee80211_fix_rate(struct ieee80211_node *, 179 struct ieee80211_rateset *, int); 180 181/* 182 * WME/WMM support. 183 */ 184struct wmeParams { | 185int ieee80211_fix_rate(struct ieee80211_node *, 186 struct ieee80211_rateset *, int); 187 188/* 189 * WME/WMM support. 190 */ 191struct wmeParams { |
185 u_int8_t wmep_acm; 186 u_int8_t wmep_aifsn; 187 u_int8_t wmep_logcwmin; /* log2(cwmin) */ 188 u_int8_t wmep_logcwmax; /* log2(cwmax) */ 189 u_int8_t wmep_txopLimit; 190 u_int8_t wmep_noackPolicy; /* 0 (ack), 1 (no ack) */ | 192 uint8_t wmep_acm; 193 uint8_t wmep_aifsn; 194 uint8_t wmep_logcwmin; /* log2(cwmin) */ 195 uint8_t wmep_logcwmax; /* log2(cwmax) */ 196 uint8_t wmep_txopLimit; 197 uint8_t wmep_noackPolicy; /* 0 (ack), 1 (no ack) */ |
191}; 192#define IEEE80211_TXOP_TO_US(_txop) ((_txop)<<5) 193#define IEEE80211_US_TO_TXOP(_us) ((_us)>>5) 194 195struct chanAccParams { | 198}; 199#define IEEE80211_TXOP_TO_US(_txop) ((_txop)<<5) 200#define IEEE80211_US_TO_TXOP(_us) ((_us)>>5) 201 202struct chanAccParams { |
196 u_int8_t cap_info; /* version of the current set */ | 203 uint8_t cap_info; /* version of the current set */ |
197 struct wmeParams cap_wmeParams[WME_NUM_AC]; 198}; 199 200struct ieee80211_wme_state { 201 u_int wme_flags; 202#define WME_F_AGGRMODE 0x00000001 /* STATUS: WME agressive mode */ 203 u_int wme_hipri_traffic; /* VI/VO frames in beacon interval */ 204 u_int wme_hipri_switch_thresh;/* agressive mode switch thresh */ --- 9 unchanged lines hidden (view full) --- 214}; 215 216void ieee80211_wme_initparams(struct ieee80211com *); 217void ieee80211_wme_updateparams(struct ieee80211com *); 218void ieee80211_wme_updateparams_locked(struct ieee80211com *); 219 220#define ieee80211_new_state(_ic, _nstate, _arg) \ 221 (((_ic)->ic_newstate)((_ic), (_nstate), (_arg))) | 204 struct wmeParams cap_wmeParams[WME_NUM_AC]; 205}; 206 207struct ieee80211_wme_state { 208 u_int wme_flags; 209#define WME_F_AGGRMODE 0x00000001 /* STATUS: WME agressive mode */ 210 u_int wme_hipri_traffic; /* VI/VO frames in beacon interval */ 211 u_int wme_hipri_switch_thresh;/* agressive mode switch thresh */ --- 9 unchanged lines hidden (view full) --- 221}; 222 223void ieee80211_wme_initparams(struct ieee80211com *); 224void ieee80211_wme_updateparams(struct ieee80211com *); 225void ieee80211_wme_updateparams_locked(struct ieee80211com *); 226 227#define ieee80211_new_state(_ic, _nstate, _arg) \ 228 (((_ic)->ic_newstate)((_ic), (_nstate), (_arg))) |
229int ieee80211_init(struct ieee80211com *, int forcescan); 230void ieee80211_dturbo_switch(struct ieee80211com *, int newflags); |
|
222void ieee80211_beacon_miss(struct ieee80211com *); | 231void ieee80211_beacon_miss(struct ieee80211com *); |
223void ieee80211_print_essid(const u_int8_t *, int); 224void ieee80211_dump_pkt(const u_int8_t *, int, int, int); | 232void ieee80211_print_essid(const uint8_t *, int); 233void ieee80211_dump_pkt(struct ieee80211com *, 234 const uint8_t *, int, int, int); |
225 226extern const char *ieee80211_opmode_name[]; 227extern const char *ieee80211_state_name[IEEE80211_S_MAX]; 228extern const char *ieee80211_wme_acnames[]; 229 230/* 231 * Beacon frames constructed by ieee80211_beacon_alloc 232 * have the following structure filled in so drivers 233 * can update the frame later w/ minimal overhead. 234 */ 235struct ieee80211_beacon_offsets { | 235 236extern const char *ieee80211_opmode_name[]; 237extern const char *ieee80211_state_name[IEEE80211_S_MAX]; 238extern const char *ieee80211_wme_acnames[]; 239 240/* 241 * Beacon frames constructed by ieee80211_beacon_alloc 242 * have the following structure filled in so drivers 243 * can update the frame later w/ minimal overhead. 244 */ 245struct ieee80211_beacon_offsets { |
236 u_int16_t *bo_caps; /* capabilities */ 237 u_int8_t *bo_tim; /* start of atim/dtim */ 238 u_int8_t *bo_wme; /* start of WME parameters */ 239 u_int8_t *bo_trailer; /* start of fixed-size trailer */ 240 u_int16_t bo_tim_len; /* atim/dtim length in bytes */ 241 u_int16_t bo_trailer_len; /* trailer length in bytes */ 242 u_int8_t *bo_erp; /* start of ERP element */ | 246 uint16_t *bo_caps; /* capabilities */ 247 uint8_t *bo_tim; /* start of atim/dtim */ 248 uint8_t *bo_wme; /* start of WME parameters */ 249 uint8_t *bo_trailer; /* start of fixed-size trailer */ 250 uint16_t bo_tim_len; /* atim/dtim length in bytes */ 251 uint16_t bo_trailer_len; /* trailer length in bytes */ 252 uint8_t *bo_erp; /* start of ERP element */ 253 uint8_t *bo_htinfo; /* start of HT info element */ |
243}; 244struct mbuf *ieee80211_beacon_alloc(struct ieee80211com *, 245 struct ieee80211_node *, struct ieee80211_beacon_offsets *); 246int ieee80211_beacon_update(struct ieee80211com *, 247 struct ieee80211_node *, struct ieee80211_beacon_offsets *, 248 struct mbuf *, int broadcast); 249 250/* 251 * Notification methods called from the 802.11 state machine. 252 * Note that while these are defined here, their implementation 253 * is OS-specific. 254 */ 255void ieee80211_notify_node_join(struct ieee80211com *, 256 struct ieee80211_node *, int newassoc); 257void ieee80211_notify_node_leave(struct ieee80211com *, 258 struct ieee80211_node *); 259void ieee80211_notify_scan_done(struct ieee80211com *); 260#endif /* _NET80211_IEEE80211_PROTO_H_ */ | 254}; 255struct mbuf *ieee80211_beacon_alloc(struct ieee80211com *, 256 struct ieee80211_node *, struct ieee80211_beacon_offsets *); 257int ieee80211_beacon_update(struct ieee80211com *, 258 struct ieee80211_node *, struct ieee80211_beacon_offsets *, 259 struct mbuf *, int broadcast); 260 261/* 262 * Notification methods called from the 802.11 state machine. 263 * Note that while these are defined here, their implementation 264 * is OS-specific. 265 */ 266void ieee80211_notify_node_join(struct ieee80211com *, 267 struct ieee80211_node *, int newassoc); 268void ieee80211_notify_node_leave(struct ieee80211com *, 269 struct ieee80211_node *); 270void ieee80211_notify_scan_done(struct ieee80211com *); 271#endif /* _NET80211_IEEE80211_PROTO_H_ */ |