1 /* 2 * wpa_supplicant - Internal definitions 3 * Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi> 4 * 5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details. 7 */ 8 9 #ifndef WPA_SUPPLICANT_I_H 10 #define WPA_SUPPLICANT_I_H 11 12 13 #include "drivers/driver.h" 14 #include "common/ieee802_11_defs.h" 15 /* 16 * struct rrm_data - Data used for managing RRM features 17 */ 18 struct rrm_data { 19 /* rrm_used - indication regarding the current connection */ 20 unsigned int rrm_used:1; 21 22 /* 23 * notify_neighbor_rep - Callback for notifying report requester 24 */ 25 void (*notify_neighbor_rep)(void *ctx, const u8 *neighbor_rep, size_t len); 26 27 /* 28 * neighbor_rep_cb_ctx - Callback context 29 * Received in the callback registration, and sent to the callback 30 * function as a parameter. 31 */ 32 void *neighbor_rep_cb_ctx; 33 34 /* next_neighbor_rep_token - Next request's dialog token */ 35 u8 next_neighbor_rep_token; 36 37 /* token - Dialog token of the current radio measurement */ 38 u8 token; 39 40 /* destination address of the current radio measurement request */ 41 u8 dst_addr[ETH_ALEN]; 42 }; 43 44 struct wpa_bss_tmp_disallowed { 45 struct dl_list list; 46 u8 bssid[ETH_ALEN]; 47 #ifndef ESP_SUPPLICANT 48 int rssi_threshold; 49 #endif 50 }; 51 52 #define SSID_MAX_LEN 32 53 struct beacon_rep_data { 54 u8 token; 55 u8 last_indication; 56 struct wpa_driver_scan_params scan_params; 57 u8 ssid[SSID_MAX_LEN]; 58 size_t ssid_len; 59 u8 bssid[ETH_ALEN]; 60 enum beacon_report_detail report_detail; 61 struct bitfield *eids; 62 }; 63 64 enum scan_trigger_reason { 65 REASON_INVALID, 66 REASON_RRM_BEACON_REPORT, 67 REASON_WNM_BSS_TRANS_REQ, 68 }; 69 70 #ifdef CONFIG_SAE_PK 71 struct sae_pk_elems { 72 u8 *fils_pk; 73 u8 fils_pk_len; 74 u8 *fils_key_confirm; 75 u8 fils_key_confirm_len; 76 u8 *sae_pk; 77 u8 sae_pk_len; 78 }; 79 #endif 80 81 struct wpa_supplicant { 82 83 int scanning; 84 enum scan_trigger_reason scan_reason; 85 u64 scan_start_tsf; 86 u8 tsf_bssid[ETH_ALEN]; 87 struct wpa_bss *current_bss; 88 89 struct dl_list bss; /* struct wpa_bss::list */ 90 struct dl_list bss_id; /* struct wpa_bss::list_id */ 91 size_t num_bss; 92 unsigned int bss_update_idx; 93 unsigned int bss_next_id; 94 95 /* 96 * Pointers to BSS entries in the order they were in the last scan 97 * results. 98 */ 99 struct wpa_bss **last_scan_res; 100 unsigned int last_scan_res_used; 101 unsigned int last_scan_res_size; 102 struct os_reltime last_scan; 103 104 struct os_reltime scan_trigger_time, scan_start_time; 105 106 u8 next_scan_bssid[ETH_ALEN]; 107 /* type and subtype of frames for which supplicant has registered */ 108 uint32_t type, subtype; 109 u8 next_scan_chan; 110 #ifdef CONFIG_WNM 111 int disable_btm; 112 unsigned int disable_mbo_oce; 113 u8 extend_caps[8]; 114 u8 wnm_dialog_token; 115 u8 wnm_reply; 116 u8 wnm_num_neighbor_report; 117 u8 wnm_mode; 118 u16 wnm_dissoc_timer; 119 u8 wnm_bss_termination_duration[12]; 120 struct neighbor_report *wnm_neighbor_report_elements; 121 struct os_reltime wnm_cand_valid_until; 122 #ifdef CONFIG_MBO 123 unsigned int wnm_mbo_trans_reason_present:1; 124 u8 wnm_mbo_transition_reason; 125 /* Multiband operation non-preferred channel */ 126 struct wpa_mbo_non_pref_channel { 127 enum mbo_non_pref_chan_reason reason; 128 u8 oper_class; 129 u8 chan; 130 u8 preference; 131 } *non_pref_chan; 132 size_t non_pref_chan_num; 133 u8 mbo_wnm_token; 134 /** 135 * enable_oce - Enable OCE if it is enabled by user and device also 136 * supports OCE. 137 * User can enable OCE with wpa_config's 'oce' parameter as follows - 138 * - Set BIT(0) to enable OCE in non-AP STA mode. 139 * - Set BIT(1) to enable OCE in STA-CFON mode. 140 */ 141 u8 enable_oce; 142 struct dl_list bss_tmp_disallowed; 143 #endif /* CONFIG_MBO */ 144 #endif /* CONFIG_WNM */ 145 #ifdef CONFIG_RRM 146 /* rrm ie */ 147 uint8_t rrm_ie[5]; 148 struct rrm_data rrm; 149 struct beacon_rep_data beacon_rep_data; 150 struct os_reltime beacon_rep_scan; 151 #endif 152 #ifdef CONFIG_SAE_PK 153 struct sae_pk_elems sae_pk_elems; 154 #endif 155 156 }; 157 158 struct non_pref_chan_s; 159 160 /* MBO functions */ 161 int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len, 162 int add_oce_capa); 163 const u8 * mbo_attr_from_mbo_ie(const u8 *mbo_ie, enum mbo_attr_id attr); 164 const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr); 165 const u8 * mbo_get_attr_from_ies(const u8 *ies, size_t ies_len, 166 enum mbo_attr_id attr); 167 void wpas_mbo_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ie); 168 void wpas_mbo_ie_trans_req(struct wpa_supplicant *wpa_s, const u8 *ie, 169 size_t len); 170 size_t wpas_mbo_ie_bss_trans_reject(struct wpa_supplicant *wpa_s, u8 *pos, 171 size_t len, 172 enum mbo_transition_reject_reason reason); 173 void wpas_mbo_update_cell_capa(struct wpa_supplicant *wpa_s, u8 mbo_cell_capa); 174 struct wpabuf * mbo_build_anqp_buf(struct wpa_supplicant *wpa_s, 175 struct wpa_bss *bss, u32 mbo_subtypes); 176 void mbo_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s, 177 struct wpa_bss *bss, const u8 *sa, 178 const u8 *data, size_t slen); 179 void wpas_update_mbo_connect_params(struct wpa_supplicant *wpa_s); 180 181 int wpas_mbo_update_non_pref_chan(struct wpa_supplicant *wpa_s, 182 struct non_pref_chan_s *non_pref_chan); 183 184 #endif /* WPA_SUPPLICANT_I_H */ 185