1 /* 2 * Copyright (C) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef WPA_HAL_STRUCT_H 17 #define WPA_HAL_STRUCT_H 18 19 #include "wpa_hal_define.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 typedef struct WifiChip { 25 int chip; 26 } WifiChip; 27 28 typedef struct WifiIface { 29 int index; 30 int type; 31 char name[WIFI_IFACE_NAME_MAXLEN]; 32 char macAddr[WIFI_MAC_LENGTH + 1]; 33 } WifiIface; 34 35 typedef enum ScanStyle { 36 SCAN_TYPE_LOW_SPAN = 0, 37 SCAN_TYPE_LOW_POWER = 1, 38 SCAN_TYPE_HIGH_ACCURACY = 2, 39 SCAN_TYPE_PNO = 3, 40 SCAN_TYPE_INVALID = 0XFF 41 } ScanStyle; 42 43 typedef struct ScanSettings { 44 int freqSize; 45 int *freqs; 46 int hiddenSsidSize; 47 char **hiddenSsid; 48 ScanStyle scanStyle; 49 50 /* Only available for PNO scan */ 51 int savedPnoSsidSize; 52 char **savedPnoSsid; 53 int pnoScanInterval; 54 int minPnoRssi2Dot4Ghz; 55 int minPnoRssi5Ghz; 56 int isStartPnoScan; 57 } ScanSettings; 58 59 typedef struct ScanInfoElem { 60 unsigned int id; 61 char *content; 62 int size; 63 } ScanInfoElem; 64 65 typedef enum AntEnum { 66 NETWORK_PRIVATE = 0, 67 NETWORK_PRIVATEWITHGUEST = 1, 68 NETWORK_CHARGEABLEPUBLIC = 2, 69 NETWORK_FREEPUBLIC = 3, 70 NETWORK_PERSONAL = 4, 71 NETWORK_EMERGENCYONLY = 5, 72 NETWORK_RESVD6 = 6, 73 NETWORK_RESVD7 = 7, 74 NETWORK_RESVD8 = 8, 75 NETWORK_RESVD9 = 9, 76 NETWORK_RESVD10 = 10, 77 NETWORK_RESVD11 = 11, 78 NETWORK_RESVD12 = 12, 79 NETWORK_RESVD13 = 13, 80 NETWORK_TESTOREXPERIMENTAL = 14, 81 NETWORK_WILDCARD = 15, 82 NETWORK_ANT_INVALID = 16 83 } Ant; 84 85 typedef struct ScanInfo { 86 char ssid[WIFI_SSID_LENGTH]; 87 char bssid[WIFI_BSSID_LENGTH]; 88 int freq; 89 int channelWidth; 90 int centerFrequency0; 91 int centerFrequency1; 92 ScanInfoElem *infoElems; 93 int ieSize; 94 int64_t features; 95 int siglv; 96 char flags[WIFI_SCAN_INFO_CAPABILITY_LENGTH]; 97 int64_t timestamp; 98 Ant ant; 99 int isVhtInfoExist; 100 int isHtInfoExist; 101 int isHeInfoExist; 102 int isErpExist; 103 int maxRates; 104 int extMaxRates; 105 } ScanInfo; 106 107 typedef struct WifiNetworkInfo { 108 int id; 109 char ssid[WIFI_SSID_LENGTH]; 110 char bssid[WIFI_BSSID_LENGTH]; 111 char flags[WIFI_NETWORK_FLAGS_LENGTH]; 112 } WifiNetworkInfo; 113 114 typedef struct PnoScanSettings { 115 int scanInterval; 116 int minRssi2Dot4Ghz; 117 int minRssi5Ghz; 118 int freqSize; 119 int *freqs; 120 int hiddenSsidSize; 121 char **hiddenSsid; 122 int savedSsidSize; 123 char **savedSsid; 124 } PnoScanSettings; 125 126 typedef struct HostapdConfig { 127 char ssid[WIFI_SSID_LENGTH]; 128 int32_t ssidLen; 129 char preSharedKey[WIFI_AP_PASSWORD_LENGTH]; 130 int32_t preSharedKeyLen; 131 int32_t securityType; 132 int32_t band; 133 int32_t channel; 134 int32_t maxConn; 135 } HostapdConfig; 136 137 typedef struct SetNetworkConfig { 138 DeviceConfigType cfgParam; /* Setting parameters. */ 139 char cfgValue[WIFI_NETWORK_CONFIG_VALUE_LENGTH]; /* Parameter value. */ 140 } SetNetworkConfig; 141 142 typedef struct GetNetworkConfig { 143 int networkId; 144 char param[WIFI_NETWORK_CONFIG_NAME_LENGTH]; 145 char value[WIFI_NETWORK_CONFIG_VALUE_LENGTH]; 146 } GetNetworkConfig; 147 148 typedef struct WifiWpsParam { 149 int anyFlag; 150 int multiAp; 151 char bssid[WIFI_BSSID_LENGTH]; 152 char pinCode[WIFI_PIN_CODE_LENGTH + 1]; 153 } WifiWpsParam; 154 155 typedef struct WifiRoamCapability { 156 int maxBlocklistSize; 157 int maxTrustlistSize; 158 } WifiRoamCapability; 159 160 typedef struct WpaSignalInfo { 161 int signal; 162 int txrate; 163 int rxrate; 164 int noise; 165 int frequency; 166 int txPackets; 167 int rxPackets; 168 int snr; 169 int chload; 170 int ulDelay; 171 int txBytes; 172 int rxBytes; 173 int txFailed; 174 } WpaSignalInfo; 175 #ifdef __cplusplus 176 } 177 #endif 178 #endif