1 /* $OpenBSD: ieee80211_proto.h,v 1.38 2009/01/28 18:55:18 damien 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 u_int ieee80211_get_hdrlen(const struct ieee80211_frame *); 67 extern void ieee80211_input(struct ifnet *, struct mbuf *, 68 struct ieee80211_node *, struct ieee80211_rxinfo *); 69 extern int ieee80211_output(struct ifnet *, struct mbuf *, struct sockaddr *, 70 struct rtentry *); 71 extern void ieee80211_recv_mgmt(struct ieee80211com *, struct mbuf *, 72 struct ieee80211_node *, struct ieee80211_rxinfo *, int); 73 extern int ieee80211_send_mgmt(struct ieee80211com *, struct ieee80211_node *, 74 int, int, int); 75 extern void ieee80211_eapol_key_input(struct ieee80211com *, struct mbuf *, 76 struct ieee80211_node *); 77 extern struct mbuf *ieee80211_encap(struct ifnet *, struct mbuf *, 78 struct ieee80211_node **); 79 extern struct mbuf *ieee80211_get_rts(struct ieee80211com *, 80 const struct ieee80211_frame *, u_int16_t); 81 extern struct mbuf *ieee80211_get_cts_to_self(struct ieee80211com *, 82 u_int16_t); 83 extern struct mbuf *ieee80211_beacon_alloc(struct ieee80211com *, 84 struct ieee80211_node *); 85 extern int ieee80211_save_ie(const u_int8_t *, u_int8_t **); 86 extern void ieee80211_eapol_timeout(void *); 87 extern int ieee80211_send_4way_msg1(struct ieee80211com *, 88 struct ieee80211_node *); 89 extern int ieee80211_send_4way_msg2(struct ieee80211com *, 90 struct ieee80211_node *, const u_int8_t *, 91 const struct ieee80211_ptk *); 92 extern int ieee80211_send_4way_msg3(struct ieee80211com *, 93 struct ieee80211_node *); 94 extern int ieee80211_send_4way_msg4(struct ieee80211com *, 95 struct ieee80211_node *); 96 extern int ieee80211_send_group_msg1(struct ieee80211com *, 97 struct ieee80211_node *); 98 extern int ieee80211_send_group_msg2(struct ieee80211com *, 99 struct ieee80211_node *, const struct ieee80211_key *); 100 extern int ieee80211_send_eapol_key_req(struct ieee80211com *, 101 struct ieee80211_node *, u_int16_t, u_int64_t); 102 extern int ieee80211_pwrsave(struct ieee80211com *, struct mbuf *, 103 struct ieee80211_node *); 104 #define ieee80211_new_state(_ic, _nstate, _arg) \ 105 (((_ic)->ic_newstate)((_ic), (_nstate), (_arg))) 106 extern enum ieee80211_edca_ac ieee80211_up_to_ac(struct ieee80211com *, int); 107 extern u_int8_t *ieee80211_add_capinfo(u_int8_t *, struct ieee80211com *, 108 const struct ieee80211_node *); 109 extern u_int8_t *ieee80211_add_ssid(u_int8_t *, const u_int8_t *, u_int); 110 extern u_int8_t *ieee80211_add_rates(u_int8_t *, 111 const struct ieee80211_rateset *); 112 extern u_int8_t *ieee80211_add_fh_params(u_int8_t *, struct ieee80211com *, 113 const struct ieee80211_node *); 114 extern u_int8_t *ieee80211_add_ds_params(u_int8_t *, struct ieee80211com *, 115 const struct ieee80211_node *); 116 extern u_int8_t *ieee80211_add_tim(u_int8_t *, struct ieee80211com *); 117 extern u_int8_t *ieee80211_add_ibss_params(u_int8_t *, 118 const struct ieee80211_node *); 119 extern u_int8_t *ieee80211_add_edca_params(u_int8_t *, struct ieee80211com *); 120 extern u_int8_t *ieee80211_add_erp(u_int8_t *, struct ieee80211com *); 121 extern u_int8_t *ieee80211_add_qos_capability(u_int8_t *, 122 struct ieee80211com *); 123 extern u_int8_t *ieee80211_add_rsn(u_int8_t *, struct ieee80211com *, 124 const struct ieee80211_node *); 125 extern u_int8_t *ieee80211_add_wpa(u_int8_t *, struct ieee80211com *, 126 const struct ieee80211_node *); 127 extern u_int8_t *ieee80211_add_xrates(u_int8_t *, 128 const struct ieee80211_rateset *); 129 extern u_int8_t *ieee80211_add_htcaps(u_int8_t *, struct ieee80211com *); 130 extern u_int8_t *ieee80211_add_htop(u_int8_t *, struct ieee80211com *); 131 extern u_int8_t *ieee80211_add_tie(u_int8_t *, u_int8_t, u_int32_t); 132 133 extern int ieee80211_parse_rsn(struct ieee80211com *, const u_int8_t *, 134 struct ieee80211_rsnparams *); 135 extern int ieee80211_parse_wpa(struct ieee80211com *, const u_int8_t *, 136 struct ieee80211_rsnparams *); 137 extern void ieee80211_print_essid(const u_int8_t *, int); 138 #ifdef IEEE80211_DEBUG 139 extern void ieee80211_dump_pkt(const u_int8_t *, int, int, int); 140 #endif 141 extern int ieee80211_ibss_merge(struct ieee80211com *, 142 struct ieee80211_node *, u_int64_t); 143 extern void ieee80211_reset_erp(struct ieee80211com *); 144 extern void ieee80211_set_shortslottime(struct ieee80211com *, int); 145 extern void ieee80211_auth_open(struct ieee80211com *, 146 const struct ieee80211_frame *, struct ieee80211_node *, 147 struct ieee80211_rxinfo *rs, u_int16_t, u_int16_t); 148 extern void ieee80211_gtk_rekey_timeout(void *); 149 extern int ieee80211_keyrun(struct ieee80211com *, u_int8_t *); 150 extern void ieee80211_setkeys(struct ieee80211com *); 151 extern void ieee80211_setkeysdone(struct ieee80211com *); 152 extern void ieee80211_sa_query_timeout(void *); 153 extern void ieee80211_sa_query_request(struct ieee80211com *, 154 struct ieee80211_node *); 155 #ifndef IEEE80211_NO_HT 156 extern void ieee80211_tx_ba_timeout(void *); 157 extern void ieee80211_rx_ba_timeout(void *); 158 extern int ieee80211_addba_request(struct ieee80211com *, 159 struct ieee80211_node *, u_int16_t, u_int8_t); 160 extern void ieee80211_delba_request(struct ieee80211com *, 161 struct ieee80211_node *, u_int16_t, u_int8_t, u_int8_t); 162 #endif 163 164 #endif /* _NET80211_IEEE80211_PROTO_H_ */ 165