1 /* 2 * WPA Supplicant - Scanning 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 SCAN_H 10 #define SCAN_H 11 12 /* 13 * Noise floor values to use when we have signal strength 14 * measurements, but no noise floor measurements. These values were 15 * measured in an office environment with many APs. 16 */ 17 #define DEFAULT_NOISE_FLOOR_2GHZ (-89) 18 #define DEFAULT_NOISE_FLOOR_5GHZ (-92) 19 20 /* 21 * Channels with a great SNR can operate at full rate. What is a great SNR? 22 * This doc https://supportforums.cisco.com/docs/DOC-12954 says, "the general 23 * rule of thumb is that any SNR above 20 is good." This one 24 * http://www.cisco.com/en/US/tech/tk722/tk809/technologies_q_and_a_item09186a00805e9a96.shtml#qa23 25 * recommends 25 as a minimum SNR for 54 Mbps data rate. The estimates used in 26 * scan_est_throughput() allow even smaller SNR values for the maximum rates 27 * (21 for 54 Mbps, 22 for VHT80 MCS9, 24 for HT40 and HT20 MCS7). Use 25 as a 28 * somewhat conservative value here. 29 */ 30 #define GREAT_SNR 25 31 32 #define IS_5GHZ(n) (n > 4000) 33 34 int wpa_supplicant_enabled_networks(struct wpa_supplicant *wpa_s); 35 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec); 36 int wpa_supplicant_delayed_sched_scan(struct wpa_supplicant *wpa_s, 37 int sec, int usec); 38 int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s); 39 void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s); 40 void wpa_supplicant_cancel_delayed_sched_scan(struct wpa_supplicant *wpa_s); 41 void wpa_supplicant_cancel_sched_scan(struct wpa_supplicant *wpa_s); 42 void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s, 43 int scanning); 44 struct wpa_driver_scan_params; 45 int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s, 46 struct wpa_driver_scan_params *params); 47 struct wpa_scan_results * 48 wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s, 49 struct scan_info *info, int new_scan); 50 int wpa_supplicant_update_scan_results(struct wpa_supplicant *wpa_s); 51 const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie); 52 const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res, 53 u32 vendor_type); 54 const u8 * wpa_scan_get_vendor_ie_beacon(const struct wpa_scan_res *res, 55 u32 vendor_type); 56 struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res, 57 u32 vendor_type); 58 int wpa_supplicant_filter_bssid_match(struct wpa_supplicant *wpa_s, 59 const u8 *bssid); 60 void wpa_supplicant_update_scan_int(struct wpa_supplicant *wpa_s, int sec); 61 void scan_only_handler(struct wpa_supplicant *wpa_s, 62 struct wpa_scan_results *scan_res); 63 int wpas_scan_scheduled(struct wpa_supplicant *wpa_s); 64 struct wpa_driver_scan_params * 65 wpa_scan_clone_params(const struct wpa_driver_scan_params *src); 66 void wpa_scan_free_params(struct wpa_driver_scan_params *params); 67 int wpas_start_pno(struct wpa_supplicant *wpa_s); 68 int wpas_stop_pno(struct wpa_supplicant *wpa_s); 69 void wpas_scan_reset_sched_scan(struct wpa_supplicant *wpa_s); 70 void wpas_scan_restart_sched_scan(struct wpa_supplicant *wpa_s); 71 72 void wpas_mac_addr_rand_scan_clear(struct wpa_supplicant *wpa_s, 73 unsigned int type); 74 int wpas_mac_addr_rand_scan_set(struct wpa_supplicant *wpa_s, 75 unsigned int type, const u8 *addr, 76 const u8 *mask); 77 int wpas_mac_addr_rand_scan_get_mask(struct wpa_supplicant *wpa_s, 78 unsigned int type, u8 *mask); 79 int wpas_abort_ongoing_scan(struct wpa_supplicant *wpa_s); 80 void filter_scan_res(struct wpa_supplicant *wpa_s, 81 struct wpa_scan_results *res); 82 void scan_snr(struct wpa_scan_res *res); 83 void scan_est_throughput(struct wpa_supplicant *wpa_s, 84 struct wpa_scan_res *res); 85 unsigned int wpas_get_est_tpt(const struct wpa_supplicant *wpa_s, 86 const u8 *ies, size_t ies_len, int rate, 87 int snr); 88 void wpa_supplicant_set_default_scan_ies(struct wpa_supplicant *wpa_s); 89 int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s, 90 enum hostapd_hw_mode band, 91 struct wpa_driver_scan_params *params, 92 bool is_6ghz); 93 94 #endif /* SCAN_H */ 95