1 /* $OpenBSD: ieee80211_proto.h,v 1.49 2024/05/29 00:48:15 jsg Exp $ */ 2 /* $NetBSD: ieee80211_proto.h,v 1.3 2003/10/13 04:23:56 dyoung Exp $ */ 3 4 /*- 5 * Copyright (c) 2001 Atsushi Onoe 6 * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. The name of the author may not be used to endorse or promote products 18 * derived from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 * $FreeBSD: src/sys/net80211/ieee80211_proto.h,v 1.4 2003/08/19 22:17:03 sam Exp $ 32 */ 33 #ifndef _NET80211_IEEE80211_PROTO_H_ 34 #define _NET80211_IEEE80211_PROTO_H_ 35 36 /* 37 * 802.11 protocol implementation definitions. 38 */ 39 40 enum ieee80211_state { 41 IEEE80211_S_INIT = 0, /* default state */ 42 IEEE80211_S_SCAN = 1, /* scanning */ 43 IEEE80211_S_AUTH = 2, /* try to authenticate */ 44 IEEE80211_S_ASSOC = 3, /* try to assoc */ 45 IEEE80211_S_RUN = 4 /* associated */ 46 }; 47 #define IEEE80211_S_MAX (IEEE80211_S_RUN+1) 48 49 #define IEEE80211_SEND_MGMT(_ic,_ni,_type,_arg) \ 50 ((*(_ic)->ic_send_mgmt)(_ic, _ni, _type, _arg, 0)) 51 /* shortcut */ 52 #define IEEE80211_SEND_ACTION(_ic,_ni,_categ,_action,_arg) \ 53 ((*(_ic)->ic_send_mgmt)(_ic, _ni, IEEE80211_FC0_SUBTYPE_ACTION, \ 54 (_categ) << 16 | (_action), _arg)) 55 56 extern const char * const ieee80211_mgt_subtype_name[]; 57 extern const char * const ieee80211_state_name[IEEE80211_S_MAX]; 58 extern const char * const ieee80211_phymode_name[]; 59 60 extern void ieee80211_proto_attach(struct ifnet *); 61 extern void ieee80211_proto_detach(struct ifnet *); 62 63 struct ieee80211_node; 64 struct ieee80211_rxinfo; 65 struct ieee80211_rsnparams; 66 extern void ieee80211_rtm_80211info_task(void *); 67 extern void ieee80211_set_link_state(struct ieee80211com *, int); 68 extern u_int ieee80211_get_hdrlen(const struct ieee80211_frame *); 69 extern int ieee80211_classify(struct ieee80211com *, struct mbuf *); 70 extern void ieee80211_inputm(struct ifnet *, struct mbuf *, 71 struct ieee80211_node *, struct ieee80211_rxinfo *, 72 struct mbuf_list *); 73 extern void ieee80211_input(struct ifnet *, struct mbuf *, 74 struct ieee80211_node *, struct ieee80211_rxinfo *); 75 extern int ieee80211_output(struct ifnet *, struct mbuf *, struct sockaddr *, 76 struct rtentry *); 77 extern void ieee80211_recv_mgmt(struct ieee80211com *, struct mbuf *, 78 struct ieee80211_node *, struct ieee80211_rxinfo *, int); 79 extern int ieee80211_send_mgmt(struct ieee80211com *, struct ieee80211_node *, 80 int, int, int); 81 extern void ieee80211_eapol_key_input(struct ieee80211com *, struct mbuf *, 82 struct ieee80211_node *); 83 extern void ieee80211_tx_compressed_bar(struct ieee80211com *, 84 struct ieee80211_node *, int, uint16_t); 85 extern struct mbuf *ieee80211_encap(struct ifnet *, struct mbuf *, 86 struct ieee80211_node **); 87 extern struct mbuf *ieee80211_get_rts(struct ieee80211com *, 88 const struct ieee80211_frame *, u_int16_t); 89 extern struct mbuf *ieee80211_get_cts_to_self(struct ieee80211com *, 90 u_int16_t); 91 extern struct mbuf *ieee80211_get_compressed_bar(struct ieee80211com *, 92 struct ieee80211_node *, int, uint16_t); 93 extern struct mbuf *ieee80211_beacon_alloc(struct ieee80211com *, 94 struct ieee80211_node *); 95 extern int ieee80211_save_ie(const u_int8_t *, u_int8_t **); 96 extern void ieee80211_eapol_timeout(void *); 97 extern int ieee80211_send_4way_msg1(struct ieee80211com *, 98 struct ieee80211_node *); 99 extern int ieee80211_send_4way_msg2(struct ieee80211com *, 100 struct ieee80211_node *, const u_int8_t *, 101 const struct ieee80211_ptk *); 102 extern int ieee80211_send_4way_msg3(struct ieee80211com *, 103 struct ieee80211_node *); 104 extern int ieee80211_send_4way_msg4(struct ieee80211com *, 105 struct ieee80211_node *); 106 extern int ieee80211_send_group_msg1(struct ieee80211com *, 107 struct ieee80211_node *); 108 extern int ieee80211_send_group_msg2(struct ieee80211com *, 109 struct ieee80211_node *, const struct ieee80211_key *); 110 extern int ieee80211_send_eapol_key_req(struct ieee80211com *, 111 struct ieee80211_node *, u_int16_t, u_int64_t); 112 extern int ieee80211_pwrsave(struct ieee80211com *, struct mbuf *, 113 struct ieee80211_node *); 114 #define ieee80211_new_state(_ic, _nstate, _arg) \ 115 (((_ic)->ic_newstate)((_ic), (_nstate), (_arg))) 116 extern enum ieee80211_edca_ac ieee80211_up_to_ac(struct ieee80211com *, int); 117 extern u_int8_t *ieee80211_add_capinfo(u_int8_t *, struct ieee80211com *, 118 const struct ieee80211_node *); 119 extern u_int8_t *ieee80211_add_ssid(u_int8_t *, const u_int8_t *, u_int); 120 extern u_int8_t *ieee80211_add_rates(u_int8_t *, 121 const struct ieee80211_rateset *); 122 extern u_int8_t *ieee80211_add_ds_params(u_int8_t *, struct ieee80211com *, 123 const struct ieee80211_node *); 124 extern u_int8_t *ieee80211_add_tim(u_int8_t *, struct ieee80211com *); 125 extern u_int8_t *ieee80211_add_ibss_params(u_int8_t *, 126 const struct ieee80211_node *); 127 extern u_int8_t *ieee80211_add_edca_params(u_int8_t *, struct ieee80211com *); 128 extern u_int8_t *ieee80211_add_erp(u_int8_t *, struct ieee80211com *); 129 extern u_int8_t *ieee80211_add_qos_capability(u_int8_t *, 130 struct ieee80211com *); 131 extern u_int8_t *ieee80211_add_rsn(u_int8_t *, struct ieee80211com *, 132 const struct ieee80211_node *); 133 extern u_int8_t *ieee80211_add_wpa(u_int8_t *, struct ieee80211com *, 134 const struct ieee80211_node *); 135 extern u_int8_t *ieee80211_add_xrates(u_int8_t *, 136 const struct ieee80211_rateset *); 137 extern u_int8_t *ieee80211_add_htcaps(u_int8_t *, struct ieee80211com *); 138 extern u_int8_t *ieee80211_add_htop(u_int8_t *, struct ieee80211com *); 139 extern u_int8_t *ieee80211_add_vhtcaps(u_int8_t *, struct ieee80211com *); 140 extern u_int8_t *ieee80211_add_tie(u_int8_t *, u_int8_t, u_int32_t); 141 142 extern int ieee80211_parse_rsn(struct ieee80211com *, const u_int8_t *, 143 struct ieee80211_rsnparams *); 144 extern int ieee80211_parse_wpa(struct ieee80211com *, const u_int8_t *, 145 struct ieee80211_rsnparams *); 146 extern void ieee80211_print_essid(const u_int8_t *, int); 147 #ifdef IEEE80211_DEBUG 148 extern void ieee80211_dump_pkt(const u_int8_t *, int, int, int); 149 #endif 150 extern int ieee80211_ibss_merge(struct ieee80211com *, 151 struct ieee80211_node *, u_int64_t); 152 extern void ieee80211_reset_erp(struct ieee80211com *); 153 extern void ieee80211_set_shortslottime(struct ieee80211com *, int); 154 extern void ieee80211_auth_open_confirm(struct ieee80211com *, 155 struct ieee80211_node *, uint16_t); 156 extern void ieee80211_auth_open(struct ieee80211com *, 157 const struct ieee80211_frame *, struct ieee80211_node *, 158 struct ieee80211_rxinfo *rs, u_int16_t, u_int16_t); 159 extern void ieee80211_stop_ampdu_tx(struct ieee80211com *, 160 struct ieee80211_node *, int); 161 extern void ieee80211_gtk_rekey_timeout(void *); 162 extern int ieee80211_keyrun(struct ieee80211com *, u_int8_t *); 163 extern void ieee80211_setkeys(struct ieee80211com *); 164 extern void ieee80211_setkeysdone(struct ieee80211com *); 165 extern void ieee80211_sa_query_timeout(void *); 166 extern void ieee80211_sa_query_request(struct ieee80211com *, 167 struct ieee80211_node *); 168 extern void ieee80211_ht_negotiate(struct ieee80211com *, 169 struct ieee80211_node *); 170 extern void ieee80211_vht_negotiate(struct ieee80211com *, 171 struct ieee80211_node *); 172 extern void ieee80211_tx_ba_timeout(void *); 173 extern void ieee80211_rx_ba_timeout(void *); 174 extern int ieee80211_addba_request(struct ieee80211com *, 175 struct ieee80211_node *, u_int16_t, u_int8_t); 176 extern void ieee80211_delba_request(struct ieee80211com *, 177 struct ieee80211_node *, u_int16_t, u_int8_t, u_int8_t); 178 extern void ieee80211_addba_req_accept(struct ieee80211com *, 179 struct ieee80211_node *, uint8_t); 180 extern void ieee80211_addba_req_refuse(struct ieee80211com *, 181 struct ieee80211_node *, uint8_t); 182 extern void ieee80211_addba_resp_accept(struct ieee80211com *, 183 struct ieee80211_node *, uint8_t); 184 extern void ieee80211_addba_resp_refuse(struct ieee80211com *, 185 struct ieee80211_node *, uint8_t, uint16_t); 186 extern void ieee80211_output_ba_move_window(struct ieee80211com *, 187 struct ieee80211_node *, uint8_t, uint16_t); 188 extern void ieee80211_output_ba_move_window_to_first_unacked( 189 struct ieee80211com *, struct ieee80211_node *, uint8_t, uint16_t); 190 extern void ieee80211_output_ba_record_ack(struct ieee80211com *, 191 struct ieee80211_node *, uint8_t, uint16_t); 192 193 #endif /* _NET80211_IEEE80211_PROTO_H_ */ 194