blob: d1780eb09979d0d57a863a3bbe1285675ce1460b [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * WPA Supplicant - Scanning
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08003 * Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi>
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#ifndef SCAN_H
10#define SCAN_H
11
Hai Shalomfdcde762020-04-02 11:19:20 -070012/*
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)
Hai Shaloma20dcd72022-02-04 13:43:00 -080019#define DEFAULT_NOISE_FLOOR_6GHZ (-92)
Hai Shalomfdcde762020-04-02 11:19:20 -070020
21/*
22 * Channels with a great SNR can operate at full rate. What is a great SNR?
23 * This doc https://supportforums.cisco.com/docs/DOC-12954 says, "the general
24 * rule of thumb is that any SNR above 20 is good." This one
25 * http://www.cisco.com/en/US/tech/tk722/tk809/technologies_q_and_a_item09186a00805e9a96.shtml#qa23
26 * recommends 25 as a minimum SNR for 54 Mbps data rate. The estimates used in
27 * scan_est_throughput() allow even smaller SNR values for the maximum rates
28 * (21 for 54 Mbps, 22 for VHT80 MCS9, 24 for HT40 and HT20 MCS7). Use 25 as a
29 * somewhat conservative value here.
30 */
31#define GREAT_SNR 25
32
Hai Shaloma20dcd72022-02-04 13:43:00 -080033#define IS_2P4GHZ(n) (n >= 2412 && n <= 2484)
34#define IS_5GHZ(n) (n > 4000 && n < 5895)
Hai Shalomfdcde762020-04-02 11:19:20 -070035
Dmitry Shmidt04949592012-07-19 12:16:46 -070036int wpa_supplicant_enabled_networks(struct wpa_supplicant *wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070037void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080038int wpa_supplicant_delayed_sched_scan(struct wpa_supplicant *wpa_s,
39 int sec, int usec);
40int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070041void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
Dmitry Shmidtc2ebb4b2013-07-24 12:57:51 -070042void wpa_supplicant_cancel_delayed_sched_scan(struct wpa_supplicant *wpa_s);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080043void wpa_supplicant_cancel_sched_scan(struct wpa_supplicant *wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070044void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,
45 int scanning);
46struct wpa_driver_scan_params;
47int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s,
48 struct wpa_driver_scan_params *params);
49struct wpa_scan_results *
50wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s,
51 struct scan_info *info, int new_scan);
52int wpa_supplicant_update_scan_results(struct wpa_supplicant *wpa_s);
53const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie);
54const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res,
55 u32 vendor_type);
Dmitry Shmidt96571392013-10-14 12:54:46 -070056const u8 * wpa_scan_get_vendor_ie_beacon(const struct wpa_scan_res *res,
57 u32 vendor_type);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070058struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res,
59 u32 vendor_type);
Dmitry Shmidt04949592012-07-19 12:16:46 -070060int wpa_supplicant_filter_bssid_match(struct wpa_supplicant *wpa_s,
61 const u8 *bssid);
Dmitry Shmidt4b9d52f2013-02-05 17:44:43 -080062void wpa_supplicant_update_scan_int(struct wpa_supplicant *wpa_s, int sec);
Dmitry Shmidt3a787e62013-01-17 10:32:35 -080063void scan_only_handler(struct wpa_supplicant *wpa_s,
64 struct wpa_scan_results *scan_res);
Dmitry Shmidt37d4d6a2013-03-18 13:09:42 -070065int wpas_scan_scheduled(struct wpa_supplicant *wpa_s);
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -080066struct wpa_driver_scan_params *
67wpa_scan_clone_params(const struct wpa_driver_scan_params *src);
68void wpa_scan_free_params(struct wpa_driver_scan_params *params);
Dmitry Shmidt98660862014-03-11 17:26:21 -070069int wpas_start_pno(struct wpa_supplicant *wpa_s);
70int wpas_stop_pno(struct wpa_supplicant *wpa_s);
Dmitry Shmidtaca489e2016-09-28 15:44:14 -070071void wpas_scan_reset_sched_scan(struct wpa_supplicant *wpa_s);
72void wpas_scan_restart_sched_scan(struct wpa_supplicant *wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070073
Dmitry Shmidtfb45fd52015-01-05 13:08:17 -080074void wpas_mac_addr_rand_scan_clear(struct wpa_supplicant *wpa_s,
75 unsigned int type);
76int wpas_mac_addr_rand_scan_set(struct wpa_supplicant *wpa_s,
77 unsigned int type, const u8 *addr,
78 const u8 *mask);
Hai Shalomc3565922019-10-28 11:58:20 -070079int wpas_mac_addr_rand_scan_get_mask(struct wpa_supplicant *wpa_s,
80 unsigned int type, u8 *mask);
Dmitry Shmidtd7ff03d2015-12-04 14:49:35 -080081int wpas_abort_ongoing_scan(struct wpa_supplicant *wpa_s);
Dmitry Shmidt849734c2016-05-27 09:59:01 -070082void filter_scan_res(struct wpa_supplicant *wpa_s,
83 struct wpa_scan_results *res);
84void scan_snr(struct wpa_scan_res *res);
85void scan_est_throughput(struct wpa_supplicant *wpa_s,
86 struct wpa_scan_res *res);
Hai Shalomfdcde762020-04-02 11:19:20 -070087unsigned int wpas_get_est_tpt(const struct wpa_supplicant *wpa_s,
88 const u8 *ies, size_t ies_len, int rate,
Hai Shaloma20dcd72022-02-04 13:43:00 -080089 int snr, int freq);
Dmitry Shmidt7f2c7532016-08-15 09:48:12 -070090void wpa_supplicant_set_default_scan_ies(struct wpa_supplicant *wpa_s);
Hai Shalom60840252021-02-19 19:02:11 -080091int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s,
92 enum hostapd_hw_mode band,
93 struct wpa_driver_scan_params *params,
94 bool is_6ghz);
Dmitry Shmidtfb45fd52015-01-05 13:08:17 -080095
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070096#endif /* SCAN_H */