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 #else 50 esp_timer_handle_t blacklist_timer; 51 #endif 52 }; 53 54 #define SSID_MAX_LEN 32 55 struct beacon_rep_data { 56 u8 token; 57 u8 last_indication; 58 struct wpa_driver_scan_params scan_params; 59 u8 ssid[SSID_MAX_LEN]; 60 size_t ssid_len; 61 u8 bssid[ETH_ALEN]; 62 enum beacon_report_detail report_detail; 63 struct bitfield *eids; 64 }; 65 66 enum scan_trigger_reason { 67 REASON_INVALID, 68 REASON_RRM_BEACON_REPORT, 69 REASON_WNM_BSS_TRANS_REQ, 70 }; 71 72 struct wpa_supplicant { 73 int disable_btm; 74 unsigned int disable_mbo_oce; 75 /* rrm ie */ 76 uint8_t rrm_ie[5]; 77 u8 extend_caps[8]; 78 79 int scanning; 80 enum scan_trigger_reason scan_reason; 81 u64 scan_start_tsf; 82 u8 tsf_bssid[ETH_ALEN]; 83 struct wpa_bss *current_bss; 84 85 struct dl_list bss; /* struct wpa_bss::list */ 86 struct dl_list bss_id; /* struct wpa_bss::list_id */ 87 size_t num_bss; 88 unsigned int bss_update_idx; 89 unsigned int bss_next_id; 90 91 /* 92 * Pointers to BSS entries in the order they were in the last scan 93 * results. 94 */ 95 struct wpa_bss **last_scan_res; 96 unsigned int last_scan_res_used; 97 unsigned int last_scan_res_size; 98 struct os_reltime last_scan; 99 100 struct os_reltime scan_trigger_time, scan_start_time; 101 102 u8 next_scan_bssid[ETH_ALEN]; 103 /* type and subtype of frames for which supplicant has registered */ 104 uint32_t type, subtype; 105 u8 next_scan_chan; 106 #ifdef CONFIG_WNM 107 u8 wnm_dialog_token; 108 u8 wnm_reply; 109 u8 wnm_num_neighbor_report; 110 u8 wnm_mode; 111 u16 wnm_dissoc_timer; 112 u8 wnm_bss_termination_duration[12]; 113 struct neighbor_report *wnm_neighbor_report_elements; 114 struct os_reltime wnm_cand_valid_until; 115 #ifdef CONFIG_MBO 116 unsigned int wnm_mbo_trans_reason_present:1; 117 u8 wnm_mbo_transition_reason; 118 /* Multiband operation non-preferred channel */ 119 struct wpa_mbo_non_pref_channel { 120 enum mbo_non_pref_chan_reason reason; 121 u8 oper_class; 122 u8 chan; 123 u8 preference; 124 } *non_pref_chan; 125 size_t non_pref_chan_num; 126 u8 mbo_wnm_token; 127 /** 128 * enable_oce - Enable OCE if it is enabled by user and device also 129 * supports OCE. 130 * User can enable OCE with wpa_config's 'oce' parameter as follows - 131 * - Set BIT(0) to enable OCE in non-AP STA mode. 132 * - Set BIT(1) to enable OCE in STA-CFON mode. 133 */ 134 u8 enable_oce; 135 struct dl_list bss_tmp_disallowed; 136 #endif /* CONFIG_MBO */ 137 #endif /* CONFIG_WNM */ 138 struct rrm_data rrm; 139 struct beacon_rep_data beacon_rep_data; 140 struct os_reltime beacon_rep_scan; 141 }; 142 143 struct non_pref_chan_s; 144 145 /* MBO functions */ 146 int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len, 147 int add_oce_capa); 148 const u8 * mbo_attr_from_mbo_ie(const u8 *mbo_ie, enum mbo_attr_id attr); 149 const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr); 150 const u8 * mbo_get_attr_from_ies(const u8 *ies, size_t ies_len, 151 enum mbo_attr_id attr); 152 void wpas_mbo_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ie); 153 void wpas_mbo_ie_trans_req(struct wpa_supplicant *wpa_s, const u8 *ie, 154 size_t len); 155 size_t wpas_mbo_ie_bss_trans_reject(struct wpa_supplicant *wpa_s, u8 *pos, 156 size_t len, 157 enum mbo_transition_reject_reason reason); 158 void wpas_mbo_update_cell_capa(struct wpa_supplicant *wpa_s, u8 mbo_cell_capa); 159 struct wpabuf * mbo_build_anqp_buf(struct wpa_supplicant *wpa_s, 160 struct wpa_bss *bss, u32 mbo_subtypes); 161 void mbo_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s, 162 struct wpa_bss *bss, const u8 *sa, 163 const u8 *data, size_t slen); 164 void wpas_update_mbo_connect_params(struct wpa_supplicant *wpa_s); 165 166 int wpas_mbo_update_non_pref_chan(struct wpa_supplicant *wpa_s, 167 struct non_pref_chan_s *non_pref_chan); 168 169 #endif /* WPA_SUPPLICANT_I_H */ 170