blob: 30f43951c2a8f49ad150e41ea4a34d61dc732cda [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/*
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#define DEFAULT_NOISE_FLOOR_6GHZ (-92)
20
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
33#define IS_2P4GHZ(n) (n >= 2412 && n <= 2484)
34#define IS_5GHZ(n) (n > 4000 && n < 5895)
35
36int wpa_supplicant_enabled_networks(struct wpa_supplicant *wpa_s);
37void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
38int 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);
41void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
42void wpa_supplicant_cancel_delayed_sched_scan(struct wpa_supplicant *wpa_s);
43void wpa_supplicant_cancel_sched_scan(struct wpa_supplicant *wpa_s);
44void 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_ml_ie(const struct wpa_scan_res *res, u8 type);
55const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res,
56 u32 vendor_type);
57const u8 * wpa_scan_get_vendor_ie_beacon(const struct wpa_scan_res *res,
58 u32 vendor_type);
59struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res,
60 u32 vendor_type);
61int wpa_supplicant_filter_bssid_match(struct wpa_supplicant *wpa_s,
62 const u8 *bssid);
63void wpa_supplicant_update_scan_int(struct wpa_supplicant *wpa_s, int sec);
64void scan_only_handler(struct wpa_supplicant *wpa_s,
65 struct wpa_scan_results *scan_res);
66int wpas_scan_scheduled(struct wpa_supplicant *wpa_s);
67struct wpa_driver_scan_params *
68wpa_scan_clone_params(const struct wpa_driver_scan_params *src);
69void wpa_scan_free_params(struct wpa_driver_scan_params *params);
70int wpas_start_pno(struct wpa_supplicant *wpa_s);
71int wpas_stop_pno(struct wpa_supplicant *wpa_s);
72void wpas_scan_reset_sched_scan(struct wpa_supplicant *wpa_s);
73void wpas_scan_restart_sched_scan(struct wpa_supplicant *wpa_s);
74
75void wpas_mac_addr_rand_scan_clear(struct wpa_supplicant *wpa_s,
76 unsigned int type);
77int wpas_mac_addr_rand_scan_set(struct wpa_supplicant *wpa_s,
78 unsigned int type, const u8 *addr,
79 const u8 *mask);
80int wpas_mac_addr_rand_scan_get_mask(struct wpa_supplicant *wpa_s,
81 unsigned int type, u8 *mask);
82int wpas_abort_ongoing_scan(struct wpa_supplicant *wpa_s);
83void filter_scan_res(struct wpa_supplicant *wpa_s,
84 struct wpa_scan_results *res);
85void scan_snr(struct wpa_scan_res *res);
86void scan_est_throughput(struct wpa_supplicant *wpa_s,
87 struct wpa_scan_res *res);
88unsigned int wpas_get_est_tpt(const struct wpa_supplicant *wpa_s,
89 const u8 *ies, size_t ies_len, int rate,
90 int snr, int freq);
91void wpa_supplicant_set_default_scan_ies(struct wpa_supplicant *wpa_s);
92int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s,
93 enum hostapd_hw_mode band,
94 struct wpa_driver_scan_params *params,
95 bool is_6ghz, bool only_6ghz_psc,
96 bool exclude_radar);
97
98#endif /* SCAN_H */