xref: /freebsd/contrib/wpa/src/ap/ieee802_11.h (revision 4bc523382c7e72183c32be2c3aedecc1f5e844dd)
1e28a4053SRui Paulo /*
2e28a4053SRui Paulo  * hostapd / IEEE 802.11 Management
3e28a4053SRui Paulo  * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
4e28a4053SRui Paulo  *
5f05cddf9SRui Paulo  * This software may be distributed under the terms of the BSD license.
6f05cddf9SRui Paulo  * See README for more details.
7e28a4053SRui Paulo  */
8e28a4053SRui Paulo 
9e28a4053SRui Paulo #ifndef IEEE802_11_H
10e28a4053SRui Paulo #define IEEE802_11_H
11e28a4053SRui Paulo 
12e28a4053SRui Paulo struct hostapd_iface;
13e28a4053SRui Paulo struct hostapd_data;
14e28a4053SRui Paulo struct sta_info;
15e28a4053SRui Paulo struct hostapd_frame_info;
16e28a4053SRui Paulo struct ieee80211_ht_capabilities;
17325151a3SRui Paulo struct ieee80211_vht_capabilities;
185b9c547cSRui Paulo struct ieee80211_mgmt;
1985732ac8SCy Schubert struct vlan_description;
2085732ac8SCy Schubert struct hostapd_sta_wpa_psk_short;
21e28a4053SRui Paulo 
225b9c547cSRui Paulo int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
23e28a4053SRui Paulo 		    struct hostapd_frame_info *fi);
24e28a4053SRui Paulo void ieee802_11_mgmt_cb(struct hostapd_data *hapd, const u8 *buf, size_t len,
25e28a4053SRui Paulo 			u16 stype, int ok);
265b9c547cSRui Paulo void hostapd_2040_coex_action(struct hostapd_data *hapd,
275b9c547cSRui Paulo 			      const struct ieee80211_mgmt *mgmt, size_t len);
28e28a4053SRui Paulo #ifdef NEED_AP_MLME
29e28a4053SRui Paulo int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
30e28a4053SRui Paulo int ieee802_11_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
31e28a4053SRui Paulo 			   char *buf, size_t buflen);
32e28a4053SRui Paulo #else /* NEED_AP_MLME */
33e28a4053SRui Paulo static inline int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf,
34e28a4053SRui Paulo 				     size_t buflen)
35e28a4053SRui Paulo {
36e28a4053SRui Paulo 	return 0;
37e28a4053SRui Paulo }
38e28a4053SRui Paulo 
39e28a4053SRui Paulo static inline int ieee802_11_get_mib_sta(struct hostapd_data *hapd,
40e28a4053SRui Paulo 					 struct sta_info *sta,
41e28a4053SRui Paulo 					 char *buf, size_t buflen)
42e28a4053SRui Paulo {
43e28a4053SRui Paulo 	return 0;
44e28a4053SRui Paulo }
45e28a4053SRui Paulo #endif /* NEED_AP_MLME */
46325151a3SRui Paulo u16 hostapd_own_capab_info(struct hostapd_data *hapd);
475b9c547cSRui Paulo void ap_ht2040_timeout(void *eloop_data, void *user_data);
48f05cddf9SRui Paulo u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid);
495b9c547cSRui Paulo u8 * hostapd_eid_qos_map_set(struct hostapd_data *hapd, u8 *eid);
50e28a4053SRui Paulo u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid);
51e28a4053SRui Paulo u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid);
52e28a4053SRui Paulo u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid);
53e28a4053SRui Paulo u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid);
54780fb4a2SCy Schubert u8 * hostapd_eid_secondary_channel(struct hostapd_data *hapd, u8 *eid);
55780fb4a2SCy Schubert u8 * hostapd_eid_vht_capabilities(struct hostapd_data *hapd, u8 *eid, u32 nsts);
56f05cddf9SRui Paulo u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid);
575b9c547cSRui Paulo u8 * hostapd_eid_vendor_vht(struct hostapd_data *hapd, u8 *eid);
58780fb4a2SCy Schubert u8 * hostapd_eid_wb_chsw_wrapper(struct hostapd_data *hapd, u8 *eid);
59780fb4a2SCy Schubert u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid);
6085732ac8SCy Schubert u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid);
6185732ac8SCy Schubert u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid);
62*4bc52338SCy Schubert u8 * hostapd_eid_he_mu_edca_parameter_set(struct hostapd_data *hapd, u8 *eid);
63780fb4a2SCy Schubert 
64e28a4053SRui Paulo int hostapd_ht_operation_update(struct hostapd_iface *iface);
65e28a4053SRui Paulo void ieee802_11_send_sa_query_req(struct hostapd_data *hapd,
66e28a4053SRui Paulo 				  const u8 *addr, const u8 *trans_id);
67e28a4053SRui Paulo void hostapd_get_ht_capab(struct hostapd_data *hapd,
68e28a4053SRui Paulo 			  struct ieee80211_ht_capabilities *ht_cap,
69e28a4053SRui Paulo 			  struct ieee80211_ht_capabilities *neg_ht_cap);
705b9c547cSRui Paulo void hostapd_get_vht_capab(struct hostapd_data *hapd,
715b9c547cSRui Paulo 			   struct ieee80211_vht_capabilities *vht_cap,
725b9c547cSRui Paulo 			   struct ieee80211_vht_capabilities *neg_vht_cap);
73780fb4a2SCy Schubert int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta);
74f05cddf9SRui Paulo u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta,
75325151a3SRui Paulo 		      const u8 *ht_capab);
765b9c547cSRui Paulo u16 copy_sta_vendor_vht(struct hostapd_data *hapd, struct sta_info *sta,
775b9c547cSRui Paulo 			const u8 *ie, size_t len);
785b9c547cSRui Paulo 
79e28a4053SRui Paulo void update_ht_state(struct hostapd_data *hapd, struct sta_info *sta);
805b9c547cSRui Paulo void ht40_intolerant_add(struct hostapd_iface *iface, struct sta_info *sta);
815b9c547cSRui Paulo void ht40_intolerant_remove(struct hostapd_iface *iface, struct sta_info *sta);
82f05cddf9SRui Paulo u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
83325151a3SRui Paulo 		       const u8 *vht_capab);
84*4bc52338SCy Schubert u16 copy_sta_vht_oper(struct hostapd_data *hapd, struct sta_info *sta,
85*4bc52338SCy Schubert 		      const u8 *vht_oper);
865b9c547cSRui Paulo u16 set_sta_vht_opmode(struct hostapd_data *hapd, struct sta_info *sta,
875b9c547cSRui Paulo 		       const u8 *vht_opmode);
88e28a4053SRui Paulo void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
89e28a4053SRui Paulo 		       const u8 *buf, size_t len, int ack);
90f05cddf9SRui Paulo void hostapd_eapol_tx_status(struct hostapd_data *hapd, const u8 *dst,
91f05cddf9SRui Paulo 			     const u8 *data, size_t len, int ack);
92e28a4053SRui Paulo void ieee802_11_rx_from_unknown(struct hostapd_data *hapd, const u8 *src,
93e28a4053SRui Paulo 				int wds);
94f05cddf9SRui Paulo u8 * hostapd_eid_assoc_comeback_time(struct hostapd_data *hapd,
95f05cddf9SRui Paulo 				     struct sta_info *sta, u8 *eid);
96f05cddf9SRui Paulo void ieee802_11_sa_query_action(struct hostapd_data *hapd,
97*4bc52338SCy Schubert 				const struct ieee80211_mgmt *mgmt,
98*4bc52338SCy Schubert 				size_t len);
99f05cddf9SRui Paulo u8 * hostapd_eid_interworking(struct hostapd_data *hapd, u8 *eid);
100f05cddf9SRui Paulo u8 * hostapd_eid_adv_proto(struct hostapd_data *hapd, u8 *eid);
101f05cddf9SRui Paulo u8 * hostapd_eid_roaming_consortium(struct hostapd_data *hapd, u8 *eid);
102f05cddf9SRui Paulo u8 * hostapd_eid_time_adv(struct hostapd_data *hapd, u8 *eid);
103f05cddf9SRui Paulo u8 * hostapd_eid_time_zone(struct hostapd_data *hapd, u8 *eid);
104f05cddf9SRui Paulo int hostapd_update_time_adv(struct hostapd_data *hapd);
105f05cddf9SRui Paulo void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr);
106f05cddf9SRui Paulo u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid);
107e28a4053SRui Paulo 
1085b9c547cSRui Paulo int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta);
1095b9c547cSRui Paulo #ifdef CONFIG_SAE
1105b9c547cSRui Paulo void sae_clear_retransmit_timer(struct hostapd_data *hapd,
1115b9c547cSRui Paulo 				struct sta_info *sta);
112780fb4a2SCy Schubert void sae_accept_sta(struct hostapd_data *hapd, struct sta_info *sta);
1135b9c547cSRui Paulo #else /* CONFIG_SAE */
1145b9c547cSRui Paulo static inline void sae_clear_retransmit_timer(struct hostapd_data *hapd,
1155b9c547cSRui Paulo 					      struct sta_info *sta)
1165b9c547cSRui Paulo {
1175b9c547cSRui Paulo }
1185b9c547cSRui Paulo #endif /* CONFIG_SAE */
1195b9c547cSRui Paulo 
120780fb4a2SCy Schubert #ifdef CONFIG_MBO
121780fb4a2SCy Schubert 
122780fb4a2SCy Schubert u8 * hostapd_eid_mbo(struct hostapd_data *hapd, u8 *eid, size_t len);
123780fb4a2SCy Schubert 
124780fb4a2SCy Schubert u8 hostapd_mbo_ie_len(struct hostapd_data *hapd);
125780fb4a2SCy Schubert 
126*4bc52338SCy Schubert u8 * hostapd_eid_mbo_rssi_assoc_rej(struct hostapd_data *hapd, u8 *eid,
127*4bc52338SCy Schubert 				    size_t len, int delta);
128*4bc52338SCy Schubert 
129780fb4a2SCy Schubert #else /* CONFIG_MBO */
130780fb4a2SCy Schubert 
131780fb4a2SCy Schubert static inline u8 * hostapd_eid_mbo(struct hostapd_data *hapd, u8 *eid,
132780fb4a2SCy Schubert 				   size_t len)
133780fb4a2SCy Schubert {
134780fb4a2SCy Schubert 	return eid;
135780fb4a2SCy Schubert }
136780fb4a2SCy Schubert 
137780fb4a2SCy Schubert static inline u8 hostapd_mbo_ie_len(struct hostapd_data *hapd)
138780fb4a2SCy Schubert {
139780fb4a2SCy Schubert 	return 0;
140780fb4a2SCy Schubert }
141780fb4a2SCy Schubert 
142780fb4a2SCy Schubert #endif /* CONFIG_MBO */
143780fb4a2SCy Schubert 
144780fb4a2SCy Schubert void ap_copy_sta_supp_op_classes(struct sta_info *sta,
145780fb4a2SCy Schubert 				 const u8 *supp_op_classes,
146780fb4a2SCy Schubert 				 size_t supp_op_classes_len);
147780fb4a2SCy Schubert 
14885732ac8SCy Schubert u8 * hostapd_eid_fils_indic(struct hostapd_data *hapd, u8 *eid, int hessid);
14985732ac8SCy Schubert void ieee802_11_finish_fils_auth(struct hostapd_data *hapd,
15085732ac8SCy Schubert 				 struct sta_info *sta, int success,
15185732ac8SCy Schubert 				 struct wpabuf *erp_resp,
15285732ac8SCy Schubert 				 const u8 *msk, size_t msk_len);
15385732ac8SCy Schubert u8 * owe_assoc_req_process(struct hostapd_data *hapd, struct sta_info *sta,
15485732ac8SCy Schubert 			   const u8 *owe_dh, u8 owe_dh_len,
15585732ac8SCy Schubert 			   u8 *owe_buf, size_t owe_buf_len, u16 *reason);
15685732ac8SCy Schubert void fils_hlp_timeout(void *eloop_ctx, void *eloop_data);
15785732ac8SCy Schubert void fils_hlp_finish_assoc(struct hostapd_data *hapd, struct sta_info *sta);
15885732ac8SCy Schubert void handle_auth_fils(struct hostapd_data *hapd, struct sta_info *sta,
15985732ac8SCy Schubert 		      const u8 *pos, size_t len, u16 auth_alg,
16085732ac8SCy Schubert 		      u16 auth_transaction, u16 status_code,
16185732ac8SCy Schubert 		      void (*cb)(struct hostapd_data *hapd,
16285732ac8SCy Schubert 				 struct sta_info *sta,
16385732ac8SCy Schubert 				 u16 resp, struct wpabuf *data, int pub));
16485732ac8SCy Schubert 
16585732ac8SCy Schubert size_t hostapd_eid_owe_trans_len(struct hostapd_data *hapd);
16685732ac8SCy Schubert u8 * hostapd_eid_owe_trans(struct hostapd_data *hapd, u8 *eid, size_t len);
16785732ac8SCy Schubert int ieee802_11_allowed_address(struct hostapd_data *hapd, const u8 *addr,
16885732ac8SCy Schubert 			       const u8 *msg, size_t len, u32 *session_timeout,
16985732ac8SCy Schubert 			       u32 *acct_interim_interval,
17085732ac8SCy Schubert 			       struct vlan_description *vlan_id,
17185732ac8SCy Schubert 			       struct hostapd_sta_wpa_psk_short **psk,
17285732ac8SCy Schubert 			       char **identity, char **radius_cui,
17385732ac8SCy Schubert 			       int is_probe_req);
17485732ac8SCy Schubert 
175*4bc52338SCy Schubert int get_tx_parameters(struct sta_info *sta, int ap_max_chanwidth,
176*4bc52338SCy Schubert 		      int ap_seg1_idx, int *bandwidth, int *seg1_idx);
177*4bc52338SCy Schubert 
178*4bc52338SCy Schubert void auth_sae_process_commit(void *eloop_ctx, void *user_ctx);
179*4bc52338SCy Schubert 
180e28a4053SRui Paulo #endif /* IEEE802_11_H */
181