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;
19c1d255d3SCy Schubert struct radius_sta;
20206b73d0SCy Schubert enum ieee80211_op_mode;
21*a90b9d01SCy Schubert enum oper_chan_width;
22*a90b9d01SCy Schubert struct ieee802_11_elems;
23*a90b9d01SCy Schubert struct sae_pk;
24*a90b9d01SCy Schubert struct sae_pt;
25*a90b9d01SCy Schubert struct sae_password_entry;
26*a90b9d01SCy Schubert struct mld_info;
27e28a4053SRui Paulo
285b9c547cSRui Paulo int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
29e28a4053SRui Paulo struct hostapd_frame_info *fi);
30e28a4053SRui Paulo void ieee802_11_mgmt_cb(struct hostapd_data *hapd, const u8 *buf, size_t len,
31e28a4053SRui Paulo u16 stype, int ok);
325b9c547cSRui Paulo void hostapd_2040_coex_action(struct hostapd_data *hapd,
335b9c547cSRui Paulo const struct ieee80211_mgmt *mgmt, size_t len);
34e28a4053SRui Paulo #ifdef NEED_AP_MLME
35e28a4053SRui Paulo int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
36e28a4053SRui Paulo int ieee802_11_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
37e28a4053SRui Paulo char *buf, size_t buflen);
38e28a4053SRui Paulo #else /* NEED_AP_MLME */
ieee802_11_get_mib(struct hostapd_data * hapd,char * buf,size_t buflen)39e28a4053SRui Paulo static inline int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf,
40e28a4053SRui Paulo size_t buflen)
41e28a4053SRui Paulo {
42e28a4053SRui Paulo return 0;
43e28a4053SRui Paulo }
44e28a4053SRui Paulo
ieee802_11_get_mib_sta(struct hostapd_data * hapd,struct sta_info * sta,char * buf,size_t buflen)45e28a4053SRui Paulo static inline int ieee802_11_get_mib_sta(struct hostapd_data *hapd,
46e28a4053SRui Paulo struct sta_info *sta,
47e28a4053SRui Paulo char *buf, size_t buflen)
48e28a4053SRui Paulo {
49e28a4053SRui Paulo return 0;
50e28a4053SRui Paulo }
51e28a4053SRui Paulo #endif /* NEED_AP_MLME */
52325151a3SRui Paulo u16 hostapd_own_capab_info(struct hostapd_data *hapd);
535b9c547cSRui Paulo void ap_ht2040_timeout(void *eloop_data, void *user_data);
54*a90b9d01SCy Schubert u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid,
55*a90b9d01SCy Schubert bool mbssid_complete);
565b9c547cSRui Paulo u8 * hostapd_eid_qos_map_set(struct hostapd_data *hapd, u8 *eid);
57e28a4053SRui Paulo u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid);
58e28a4053SRui Paulo u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid);
59c1d255d3SCy Schubert u8 * hostapd_eid_rm_enabled_capab(struct hostapd_data *hapd, u8 *eid,
60c1d255d3SCy Schubert size_t len);
61e28a4053SRui Paulo u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid);
62e28a4053SRui Paulo u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid);
63780fb4a2SCy Schubert u8 * hostapd_eid_vht_capabilities(struct hostapd_data *hapd, u8 *eid, u32 nsts);
64f05cddf9SRui Paulo u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid);
655b9c547cSRui Paulo u8 * hostapd_eid_vendor_vht(struct hostapd_data *hapd, u8 *eid);
66780fb4a2SCy Schubert u8 * hostapd_eid_wb_chsw_wrapper(struct hostapd_data *hapd, u8 *eid);
67780fb4a2SCy Schubert u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid);
68206b73d0SCy Schubert u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid,
69206b73d0SCy Schubert enum ieee80211_op_mode opmode);
7085732ac8SCy Schubert u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid);
714bc52338SCy Schubert u8 * hostapd_eid_he_mu_edca_parameter_set(struct hostapd_data *hapd, u8 *eid);
72206b73d0SCy Schubert u8 * hostapd_eid_spatial_reuse(struct hostapd_data *hapd, u8 *eid);
73c1d255d3SCy Schubert u8 * hostapd_eid_he_6ghz_band_cap(struct hostapd_data *hapd, u8 *eid);
74780fb4a2SCy Schubert
75e28a4053SRui Paulo int hostapd_ht_operation_update(struct hostapd_iface *iface);
76e28a4053SRui Paulo void ieee802_11_send_sa_query_req(struct hostapd_data *hapd,
77e28a4053SRui Paulo const u8 *addr, const u8 *trans_id);
78e28a4053SRui Paulo void hostapd_get_ht_capab(struct hostapd_data *hapd,
79e28a4053SRui Paulo struct ieee80211_ht_capabilities *ht_cap,
80e28a4053SRui Paulo struct ieee80211_ht_capabilities *neg_ht_cap);
815b9c547cSRui Paulo void hostapd_get_vht_capab(struct hostapd_data *hapd,
825b9c547cSRui Paulo struct ieee80211_vht_capabilities *vht_cap,
835b9c547cSRui Paulo struct ieee80211_vht_capabilities *neg_vht_cap);
84206b73d0SCy Schubert void hostapd_get_he_capab(struct hostapd_data *hapd,
85206b73d0SCy Schubert const struct ieee80211_he_capabilities *he_cap,
86206b73d0SCy Schubert struct ieee80211_he_capabilities *neg_he_cap,
87206b73d0SCy Schubert size_t he_capab_len);
88*a90b9d01SCy Schubert void hostapd_get_eht_capab(struct hostapd_data *hapd,
89*a90b9d01SCy Schubert const struct ieee80211_eht_capabilities *src,
90*a90b9d01SCy Schubert struct ieee80211_eht_capabilities *dest,
91*a90b9d01SCy Schubert size_t len);
92*a90b9d01SCy Schubert u8 * hostapd_eid_eht_ml_beacon(struct hostapd_data *hapd,
93*a90b9d01SCy Schubert struct mld_info *mld_info,
94*a90b9d01SCy Schubert u8 *eid, bool include_mld_id);
95*a90b9d01SCy Schubert u8 * hostapd_eid_eht_ml_assoc(struct hostapd_data *hapd, struct sta_info *info,
96*a90b9d01SCy Schubert u8 *eid);
97*a90b9d01SCy Schubert size_t hostapd_eid_eht_ml_beacon_len(struct hostapd_data *hapd,
98*a90b9d01SCy Schubert struct mld_info *info,
99*a90b9d01SCy Schubert bool include_mld_id);
100*a90b9d01SCy Schubert struct wpabuf * hostapd_ml_auth_resp(struct hostapd_data *hapd);
101*a90b9d01SCy Schubert const u8 * hostapd_process_ml_auth(struct hostapd_data *hapd,
102*a90b9d01SCy Schubert const struct ieee80211_mgmt *mgmt,
103*a90b9d01SCy Schubert size_t len);
104*a90b9d01SCy Schubert u16 hostapd_process_ml_assoc_req(struct hostapd_data *hapd,
105*a90b9d01SCy Schubert struct ieee802_11_elems *elems,
106*a90b9d01SCy Schubert struct sta_info *sta);
107*a90b9d01SCy Schubert int hostapd_process_ml_assoc_req_addr(struct hostapd_data *hapd,
108*a90b9d01SCy Schubert const u8 *basic_mle, size_t basic_mle_len,
109*a90b9d01SCy Schubert u8 *mld_addr);
110780fb4a2SCy Schubert int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta);
111f05cddf9SRui Paulo u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta,
112325151a3SRui Paulo const u8 *ht_capab);
1135b9c547cSRui Paulo u16 copy_sta_vendor_vht(struct hostapd_data *hapd, struct sta_info *sta,
1145b9c547cSRui Paulo const u8 *ie, size_t len);
1155b9c547cSRui Paulo
116*a90b9d01SCy Schubert int update_ht_state(struct hostapd_data *hapd, struct sta_info *sta);
1175b9c547cSRui Paulo void ht40_intolerant_add(struct hostapd_iface *iface, struct sta_info *sta);
1185b9c547cSRui Paulo void ht40_intolerant_remove(struct hostapd_iface *iface, struct sta_info *sta);
119f05cddf9SRui Paulo u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
120325151a3SRui Paulo const u8 *vht_capab);
1214bc52338SCy Schubert u16 copy_sta_vht_oper(struct hostapd_data *hapd, struct sta_info *sta,
1224bc52338SCy Schubert const u8 *vht_oper);
1235b9c547cSRui Paulo u16 set_sta_vht_opmode(struct hostapd_data *hapd, struct sta_info *sta,
1245b9c547cSRui Paulo const u8 *vht_opmode);
125206b73d0SCy Schubert u16 copy_sta_he_capab(struct hostapd_data *hapd, struct sta_info *sta,
126206b73d0SCy Schubert enum ieee80211_op_mode opmode, const u8 *he_capab,
127206b73d0SCy Schubert size_t he_capab_len);
128c1d255d3SCy Schubert u16 copy_sta_he_6ghz_capab(struct hostapd_data *hapd, struct sta_info *sta,
129c1d255d3SCy Schubert const u8 *he_6ghz_capab);
130c1d255d3SCy Schubert int hostapd_get_he_twt_responder(struct hostapd_data *hapd,
131c1d255d3SCy Schubert enum ieee80211_op_mode mode);
132*a90b9d01SCy Schubert bool hostapd_get_ht_vht_twt_responder(struct hostapd_data *hapd);
133*a90b9d01SCy Schubert u8 * hostapd_eid_cca(struct hostapd_data *hapd, u8 *eid);
134e28a4053SRui Paulo void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
135e28a4053SRui Paulo const u8 *buf, size_t len, int ack);
136e28a4053SRui Paulo void ieee802_11_rx_from_unknown(struct hostapd_data *hapd, const u8 *src,
137e28a4053SRui Paulo int wds);
138f05cddf9SRui Paulo u8 * hostapd_eid_assoc_comeback_time(struct hostapd_data *hapd,
139f05cddf9SRui Paulo struct sta_info *sta, u8 *eid);
140f05cddf9SRui Paulo void ieee802_11_sa_query_action(struct hostapd_data *hapd,
1414bc52338SCy Schubert const struct ieee80211_mgmt *mgmt,
1424bc52338SCy Schubert size_t len);
143f05cddf9SRui Paulo u8 * hostapd_eid_interworking(struct hostapd_data *hapd, u8 *eid);
144f05cddf9SRui Paulo u8 * hostapd_eid_adv_proto(struct hostapd_data *hapd, u8 *eid);
145f05cddf9SRui Paulo u8 * hostapd_eid_roaming_consortium(struct hostapd_data *hapd, u8 *eid);
146f05cddf9SRui Paulo u8 * hostapd_eid_time_adv(struct hostapd_data *hapd, u8 *eid);
147f05cddf9SRui Paulo u8 * hostapd_eid_time_zone(struct hostapd_data *hapd, u8 *eid);
148f05cddf9SRui Paulo int hostapd_update_time_adv(struct hostapd_data *hapd);
149f05cddf9SRui Paulo void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr);
150*a90b9d01SCy Schubert u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid,
151*a90b9d01SCy Schubert u16 value);
152e28a4053SRui Paulo
1535b9c547cSRui Paulo int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta);
1545b9c547cSRui Paulo #ifdef CONFIG_SAE
1555b9c547cSRui Paulo void sae_clear_retransmit_timer(struct hostapd_data *hapd,
1565b9c547cSRui Paulo struct sta_info *sta);
157780fb4a2SCy Schubert void sae_accept_sta(struct hostapd_data *hapd, struct sta_info *sta);
1585b9c547cSRui Paulo #else /* CONFIG_SAE */
sae_clear_retransmit_timer(struct hostapd_data * hapd,struct sta_info * sta)1595b9c547cSRui Paulo static inline void sae_clear_retransmit_timer(struct hostapd_data *hapd,
1605b9c547cSRui Paulo struct sta_info *sta)
1615b9c547cSRui Paulo {
1625b9c547cSRui Paulo }
1635b9c547cSRui Paulo #endif /* CONFIG_SAE */
1645b9c547cSRui Paulo
165780fb4a2SCy Schubert #ifdef CONFIG_MBO
166780fb4a2SCy Schubert
167780fb4a2SCy Schubert u8 * hostapd_eid_mbo(struct hostapd_data *hapd, u8 *eid, size_t len);
168780fb4a2SCy Schubert
169780fb4a2SCy Schubert u8 hostapd_mbo_ie_len(struct hostapd_data *hapd);
170780fb4a2SCy Schubert
1714bc52338SCy Schubert u8 * hostapd_eid_mbo_rssi_assoc_rej(struct hostapd_data *hapd, u8 *eid,
1724bc52338SCy Schubert size_t len, int delta);
1734bc52338SCy Schubert
174780fb4a2SCy Schubert #else /* CONFIG_MBO */
175780fb4a2SCy Schubert
hostapd_eid_mbo(struct hostapd_data * hapd,u8 * eid,size_t len)176780fb4a2SCy Schubert static inline u8 * hostapd_eid_mbo(struct hostapd_data *hapd, u8 *eid,
177780fb4a2SCy Schubert size_t len)
178780fb4a2SCy Schubert {
179780fb4a2SCy Schubert return eid;
180780fb4a2SCy Schubert }
181780fb4a2SCy Schubert
hostapd_mbo_ie_len(struct hostapd_data * hapd)182780fb4a2SCy Schubert static inline u8 hostapd_mbo_ie_len(struct hostapd_data *hapd)
183780fb4a2SCy Schubert {
184780fb4a2SCy Schubert return 0;
185780fb4a2SCy Schubert }
186780fb4a2SCy Schubert
187780fb4a2SCy Schubert #endif /* CONFIG_MBO */
188780fb4a2SCy Schubert
189780fb4a2SCy Schubert void ap_copy_sta_supp_op_classes(struct sta_info *sta,
190780fb4a2SCy Schubert const u8 *supp_op_classes,
191780fb4a2SCy Schubert size_t supp_op_classes_len);
192780fb4a2SCy Schubert
19385732ac8SCy Schubert u8 * hostapd_eid_fils_indic(struct hostapd_data *hapd, u8 *eid, int hessid);
19485732ac8SCy Schubert void ieee802_11_finish_fils_auth(struct hostapd_data *hapd,
19585732ac8SCy Schubert struct sta_info *sta, int success,
19685732ac8SCy Schubert struct wpabuf *erp_resp,
19785732ac8SCy Schubert const u8 *msk, size_t msk_len);
19885732ac8SCy Schubert u8 * owe_assoc_req_process(struct hostapd_data *hapd, struct sta_info *sta,
19985732ac8SCy Schubert const u8 *owe_dh, u8 owe_dh_len,
200c1d255d3SCy Schubert u8 *owe_buf, size_t owe_buf_len, u16 *status);
201206b73d0SCy Schubert u16 owe_process_rsn_ie(struct hostapd_data *hapd, struct sta_info *sta,
202206b73d0SCy Schubert const u8 *rsn_ie, size_t rsn_ie_len,
203*a90b9d01SCy Schubert const u8 *owe_dh, size_t owe_dh_len,
204*a90b9d01SCy Schubert const u8 *link_addr);
205206b73d0SCy Schubert u16 owe_validate_request(struct hostapd_data *hapd, const u8 *peer,
206206b73d0SCy Schubert const u8 *rsn_ie, size_t rsn_ie_len,
207206b73d0SCy Schubert const u8 *owe_dh, size_t owe_dh_len);
20885732ac8SCy Schubert void fils_hlp_timeout(void *eloop_ctx, void *eloop_data);
20985732ac8SCy Schubert void fils_hlp_finish_assoc(struct hostapd_data *hapd, struct sta_info *sta);
21085732ac8SCy Schubert void handle_auth_fils(struct hostapd_data *hapd, struct sta_info *sta,
21185732ac8SCy Schubert const u8 *pos, size_t len, u16 auth_alg,
21285732ac8SCy Schubert u16 auth_transaction, u16 status_code,
21385732ac8SCy Schubert void (*cb)(struct hostapd_data *hapd,
21485732ac8SCy Schubert struct sta_info *sta,
21585732ac8SCy Schubert u16 resp, struct wpabuf *data, int pub));
21685732ac8SCy Schubert
21785732ac8SCy Schubert size_t hostapd_eid_owe_trans_len(struct hostapd_data *hapd);
21885732ac8SCy Schubert u8 * hostapd_eid_owe_trans(struct hostapd_data *hapd, u8 *eid, size_t len);
219c1d255d3SCy Schubert
220c1d255d3SCy Schubert size_t hostapd_eid_dpp_cc_len(struct hostapd_data *hapd);
221c1d255d3SCy Schubert u8 * hostapd_eid_dpp_cc(struct hostapd_data *hapd, u8 *eid, size_t len);
22285732ac8SCy Schubert
2234bc52338SCy Schubert int get_tx_parameters(struct sta_info *sta, int ap_max_chanwidth,
2244bc52338SCy Schubert int ap_seg1_idx, int *bandwidth, int *seg1_idx);
2254bc52338SCy Schubert
2264bc52338SCy Schubert void auth_sae_process_commit(void *eloop_ctx, void *user_ctx);
227c1d255d3SCy Schubert u8 * hostapd_eid_rsnxe(struct hostapd_data *hapd, u8 *eid, size_t len);
228*a90b9d01SCy Schubert u16 check_ext_capab(struct hostapd_data *hapd, struct sta_info *sta,
229*a90b9d01SCy Schubert const u8 *ext_capab_ie, size_t ext_capab_ie_len);
230*a90b9d01SCy Schubert size_t hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type,
231*a90b9d01SCy Schubert bool include_mld_params);
232*a90b9d01SCy Schubert u8 * hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type,
233*a90b9d01SCy Schubert bool include_mld_params);
234*a90b9d01SCy Schubert int ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta,
235*a90b9d01SCy Schubert int res, struct radius_sta *info);
236*a90b9d01SCy Schubert size_t hostapd_eid_eht_capab_len(struct hostapd_data *hapd,
237*a90b9d01SCy Schubert enum ieee80211_op_mode opmode);
238*a90b9d01SCy Schubert u8 * hostapd_eid_eht_capab(struct hostapd_data *hapd, u8 *eid,
239*a90b9d01SCy Schubert enum ieee80211_op_mode opmode);
240*a90b9d01SCy Schubert u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid);
241*a90b9d01SCy Schubert u16 copy_sta_eht_capab(struct hostapd_data *hapd, struct sta_info *sta,
242*a90b9d01SCy Schubert enum ieee80211_op_mode opmode,
243*a90b9d01SCy Schubert const u8 *he_capab, size_t he_capab_len,
244*a90b9d01SCy Schubert const u8 *eht_capab, size_t eht_capab_len);
245*a90b9d01SCy Schubert size_t hostapd_eid_mbssid_len(struct hostapd_data *hapd, u32 frame_type,
246*a90b9d01SCy Schubert u8 *elem_count, const u8 *known_bss,
247*a90b9d01SCy Schubert size_t known_bss_len, size_t *rnr_len);
248*a90b9d01SCy Schubert u8 * hostapd_eid_mbssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
249*a90b9d01SCy Schubert unsigned int frame_stype, u8 elem_count,
250*a90b9d01SCy Schubert u8 **elem_offset,
251*a90b9d01SCy Schubert const u8 *known_bss, size_t known_bss_len, u8 *rnr_eid,
252*a90b9d01SCy Schubert u8 *rnr_count, u8 **rnr_offset, size_t rnr_len);
253*a90b9d01SCy Schubert bool hostapd_is_mld_ap(struct hostapd_data *hapd);
254*a90b9d01SCy Schubert const char * sae_get_password(struct hostapd_data *hapd,
255*a90b9d01SCy Schubert struct sta_info *sta, const char *rx_id,
256*a90b9d01SCy Schubert struct sae_password_entry **pw_entry,
257*a90b9d01SCy Schubert struct sae_pt **s_pt, const struct sae_pk **s_pk);
258*a90b9d01SCy Schubert struct sta_info * hostapd_ml_get_assoc_sta(struct hostapd_data *hapd,
259*a90b9d01SCy Schubert struct sta_info *sta,
260*a90b9d01SCy Schubert struct hostapd_data **assoc_hapd);
261*a90b9d01SCy Schubert int hostapd_process_assoc_ml_info(struct hostapd_data *hapd,
262*a90b9d01SCy Schubert struct sta_info *sta,
263*a90b9d01SCy Schubert const u8 *ies, size_t ies_len,
264*a90b9d01SCy Schubert bool reassoc, int tx_link_status,
265*a90b9d01SCy Schubert bool offload);
2664bc52338SCy Schubert
267e28a4053SRui Paulo #endif /* IEEE802_11_H */
268