1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __WIFI_CACHED_SCAN_RESULTS_H__ 18 #define __WIFI_CACHED_SCAN_RESULTS_H__ 19 20 #include "wifi_hal.h" 21 22 #define WIFI_CACHED_SCAN_RESULT_FLAGS_NONE (0) 23 /* Element ID 61 (HT Operation) is present (see HT 7.3.2) */ 24 #define WIFI_CACHED_SCAN_RESULT_FLAGS_HT_OPS_PRESENT (1 << 0) 25 /* Element ID 192 (VHT Operation) is present (see VHT 8.4.2) */ 26 #define WIFI_CACHED_SCAN_RESULT_FLAGS_VHT_OPS_PRESENT (1 << 1) 27 /* Element ID 255 + Extension 36 (HE Operation) is present 28 * (see 802.11ax 9.4.2.1) 29 */ 30 #define WIFI_CACHED_SCAN_RESULT_FLAGS_HE_OPS_PRESENT (1 << 2) 31 /* Element ID 255 + Extension 106 (HE Operation) is present 32 * (see 802.11be D1.5 9.4.2.1) 33 */ 34 #define WIFI_CACHED_SCAN_RESULT_FLAGS_EHT_OPS_PRESENT (1 << 3) 35 /* Element ID 127 (Extended Capabilities) is present, and bit 70 36 * (Fine Timing Measurement Responder) is set to 1 37 * (see IEEE Std 802.11-2016 9.4.2.27) 38 */ 39 #define WIFI_CACHED_SCAN_RESULT_FLAGS_IS_FTM_RESPONDER (1 << 4) 40 41 /** 42 * Provides information about a single access point (AP) detected in a scan. 43 */ 44 typedef struct { 45 /* Number of milliseconds prior to ts in the enclosing 46 * wifi_cached_scan_result_report struct when 47 * the probe response or beacon frame that 48 * was used to populate this structure was received. 49 */ 50 u32 age_ms; 51 /* The Capability Information field */ 52 u16 capability; 53 /* null terminated */ 54 u8 ssid[33]; 55 u8 ssid_len; 56 u8 bssid[6]; 57 /* A set of flags from WIFI_CACHED_SCAN_RESULT_FLAGS_* */ 58 u8 flags; 59 s8 rssi; 60 wifi_channel_spec chanspec; 61 }wifi_cached_scan_result; 62 63 /* 64 * Data structure sent with events of type WifiCachedScanResult. 65 */ 66 typedef struct { 67 /* time since boot (in microsecond) when the result was retrieved */ 68 wifi_timestamp ts; 69 /* If 0, indicates that all frequencies in current regulation were 70 * scanned. Otherwise, indicates the number of frequencies scanned, as 71 * specified in scanned_freq_list. 72 */ 73 u16 scanned_freq_num; 74 /* Pointer to an array containing scanned_freq_num values comprising the 75 * set of frequencies that were scanned. Frequencies are specified as 76 * channel center frequencies in MHz. May be NULL if scannedFreqListLen is 77 * 0. 78 */ 79 const u32 *scanned_freq_list; 80 /* The total number of cached results returned. */ 81 u8 result_cnt; 82 /* Pointer to an array containing result_cnt entries. May be NULL if 83 * result_cnt is 0. 84 */ 85 const wifi_cached_scan_result *results; 86 } wifi_cached_scan_report; 87 88 /* callback for reporting cached scan report */ 89 typedef struct { 90 void (*on_cached_scan_results) (wifi_cached_scan_report *cache_report); 91 } wifi_cached_scan_result_handler; 92 #endif 93