1 /* 2 * Copyright (C) 2021-2022 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 #ifndef OHOS_IDL_IWIFI_STRUCT_H 16 #define OHOS_IDL_IWIFI_STRUCT_H 17 18 #include <stdint.h> 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 #define WIFI_SSID_LENGTH 132 24 #define WIFI_BSSID_LENGTH 18 25 #define WIFI_NETWORK_FLAGS_LENGTH 64 26 #define WIFI_SCAN_INFO_CAPABILITIES_LENGTH 256 27 #define WIFI_NETWORK_CONFIG_NAME_LENGTH 64 28 #define WIFI_NETWORK_CONFIG_VALUE_LENGTH 256 29 #define WIFI_MAC_ADDR_LENGTH 17 30 #define WIFI_AP_PASSWORD_LENGTH 64 31 #define WIFI_INTERFACE_NAME_SIZE 32 32 #define WIFI_PIN_CODE_LENGTH 8 33 34 /* IWifiIface */ 35 /* 36 * This is a temporary definition. The empty structure compilation alarm needs 37 * to be deleted, affecting other alarms. 38 */ 39 typedef struct TagIWifiIface { 40 int index; 41 int type; 42 char name[WIFI_INTERFACE_NAME_SIZE]; 43 char macAddr[WIFI_MAC_ADDR_LENGTH + 1]; 44 } IWifiIface; 45 46 /* IWifiClientIface */ 47 /* 48 * This is a temporary definition. The empty structure compilation alarm needs 49 * to be deleted, affecting other alarms. 50 */ 51 typedef struct TagIWifiClientIface { 52 char name[WIFI_INTERFACE_NAME_SIZE]; 53 int type; 54 } IWifiClientIface; 55 56 /* IWifiApIface */ 57 /* 58 * This is a temporary definition. The empty structure compilation alarm needs 59 * to be deleted, affecting other alarms. 60 */ 61 typedef struct TagIWifiApIface { 62 char name[WIFI_INTERFACE_NAME_SIZE]; 63 int type; 64 } IWifiApIface; 65 66 /* IWifiChip */ 67 /* 68 * This is a temporary definition. The empty structure compilation alarm needs 69 * to be deleted, affecting other alarms. 70 */ 71 typedef struct TagIWifiChip { 72 int i; 73 } IWifiChip; 74 75 typedef struct StSupplicantEventCallback { 76 void (*onScanNotify)(int32_t result); 77 } ISupplicantEventCallback; 78 79 typedef struct ScanSettings { 80 int freqSize; 81 int *freqs; 82 int hiddenSsidSize; 83 char **hiddenSsid; 84 int scanStyle; 85 } ScanSettings; 86 87 typedef struct ScanInfoElem { 88 unsigned int id; 89 char* content; 90 int size; 91 } ScanInfoElem; 92 93 typedef struct ScanInfo { 94 char ssid[WIFI_SSID_LENGTH]; 95 char bssid[WIFI_BSSID_LENGTH]; 96 int frequency; 97 int channelWidth; 98 int centerFrequency0; 99 int centerFrequency1; 100 ScanInfoElem* infoElems; 101 int ieSize; 102 int64_t features; 103 int signalLevel; 104 char capability[WIFI_SCAN_INFO_CAPABILITIES_LENGTH]; 105 int64_t timestamp; 106 int associated; 107 int antValue; 108 } ScanInfo; 109 110 typedef struct HidlNetworkInfo { 111 int id; 112 char ssid[WIFI_SSID_LENGTH]; 113 char bssid[WIFI_BSSID_LENGTH]; 114 char flags[WIFI_NETWORK_FLAGS_LENGTH]; 115 } HidlNetworkInfo; 116 117 typedef struct PnoScanSettings { 118 int scanInterval; 119 int minRssi2Dot4Ghz; 120 int minRssi5Ghz; 121 int freqSize; 122 int *freqs; 123 int hiddenSsidSize; 124 char **hiddenSsid; 125 int savedSsidSize; 126 char **savedSsid; 127 } PnoScanSettings; 128 129 /* Wifi Network configuration parameter flag */ 130 typedef enum DeviceConfigType { 131 DEVICE_CONFIG_SSID = 0, /* SSID */ 132 DEVICE_CONFIG_PSK = 1, /* psk */ 133 DEVICE_CONFIG_KEYMGMT = 2, /* key_mgmt,WPA-PSK,WPA-NONE,WPA-EAP */ 134 DEVICE_CONFIG_PRIORITY = 3, /* wpaNetwork Priority */ 135 DEVICE_CONFIG_SCAN_SSID = 4, /* Set this bit to 1 and deliver it when the hidden network is connected. */ 136 DEVICE_CONFIG_EAP = 5, /* EPA mode:/EAP/PEAP */ 137 DEVICE_CONFIG_IDENTITY = 6, /* Account name */ 138 DEVICE_CONFIG_PASSWORD = 7, /* Account password */ 139 DEVICE_CONFIG_BSSID = 8, /* bssid */ 140 DEVICE_CONFIG_AUTH_ALGORITHMS = 9, /* auth algorithms */ 141 DEVICE_CONFIG_WEP_KEY_IDX = 10, /* wep key idx */ 142 DEVICE_CONFIG_WEP_KEY_0 = 11, 143 DEVICE_CONFIG_WEP_KEY_1 = 12, 144 DEVICE_CONFIG_WEP_KEY_2 = 13, 145 DEVICE_CONFIG_WEP_KEY_3 = 14, 146 DEVICE_CONFIG_END_POS, /* Number of network configuration parameters, which is used as the last parameter. */ 147 } DeviceConfigType; 148 149 typedef struct HidlSetNetworkConfig { 150 DeviceConfigType cfgParam; /* param */ 151 char cfgValue[WIFI_NETWORK_CONFIG_VALUE_LENGTH]; /* param value */ 152 } HidlSetNetworkConfig; 153 154 typedef struct HidlGetNetworkConfig { 155 int networkId; 156 char param[WIFI_NETWORK_CONFIG_NAME_LENGTH]; 157 char value[WIFI_NETWORK_CONFIG_VALUE_LENGTH]; 158 } HidlGetNetworkConfig; 159 160 typedef struct WifiWpsParam { 161 int anyFlag; 162 int multiAp; 163 char bssid[WIFI_BSSID_LENGTH]; 164 char pinCode[WIFI_PIN_CODE_LENGTH + 1]; 165 } WifiWpsParam; 166 167 typedef struct WifiRoamCapability { 168 int maxBlocklistSize; 169 int maxTrustlistSize; 170 } WifiRoamCapability; 171 172 typedef struct HidlWpaSignalInfo { 173 int signal; 174 int txrate; 175 int rxrate; 176 int noise; 177 int frequency; 178 } HidlWpaSignalInfo; 179 180 typedef struct HostapdConfig { 181 char ssid[WIFI_SSID_LENGTH]; 182 int32_t ssidLen; 183 char preSharedKey[WIFI_AP_PASSWORD_LENGTH]; 184 int32_t preSharedKeyLen; 185 int32_t securityType; 186 int32_t band; 187 int32_t channel; 188 int32_t maxConn; 189 } HostapdConfig; 190 191 typedef struct CStationInfo { 192 int type; 193 char mac[WIFI_MAC_ADDR_LENGTH + 1]; 194 } CStationInfo; 195 196 typedef struct IWifiApEventCallback { 197 void (*onStaJoinOrLeave)(const CStationInfo *info); 198 void (*onApEnableOrDisable)(int event); 199 } IWifiApEventCallback; 200 201 typedef enum IfaceType { TYPE_STA, TYPE_AP, TYPE_P2P, TYPE_NAN } IfaceType; 202 203 /*----------------p2p struct defines begin-------------------------*/ 204 #define WIFI_P2P_TMP_MSG_LENGTH_128 128 205 #define WIFI_P2P_TMP_MSG_LENGTH_64 64 206 #define WIFI_P2P_MAX_GROUP_IFACE_NAME_LENGTH 64 207 #define WIFI_P2P_DEVICE_TYPE_LENGTH 64 208 #define WIFI_P2P_DEVICE_NAME_LENGTH 128 209 #define WIFI_P2P_WFD_DEVICE_INFO_LENGTH 32 210 #define WIFI_P2P_IDL_SERVER_NAME_LENGTH 256 211 #define WIFI_P2P_IDL_SERVER_INFO_LENGTH 256 212 #define WIFI_P2P_GROUP_CONFIG_VALUE_LENGTH 256 213 214 typedef struct HidlP2pDeviceInfo { 215 char srcAddress[WIFI_MAC_ADDR_LENGTH + 1]; 216 char p2pDeviceAddress[WIFI_MAC_ADDR_LENGTH + 1]; 217 char primaryDeviceType[WIFI_P2P_DEVICE_TYPE_LENGTH]; 218 char deviceName[WIFI_P2P_DEVICE_NAME_LENGTH]; 219 int configMethods; 220 int deviceCapabilities; 221 int groupCapabilities; 222 char wfdDeviceInfo[WIFI_P2P_WFD_DEVICE_INFO_LENGTH]; 223 unsigned int wfdLength; 224 } HidlP2pDeviceInfo; 225 226 typedef struct HidlP2pGroupInfo { 227 int isGo; 228 int isPersistent; 229 int frequency; 230 char groupName[WIFI_P2P_MAX_GROUP_IFACE_NAME_LENGTH]; 231 char ssid[WIFI_SSID_LENGTH]; 232 char psk[WIFI_P2P_TMP_MSG_LENGTH_128]; 233 char passphrase[WIFI_P2P_TMP_MSG_LENGTH_128]; 234 char goDeviceAddress[WIFI_MAC_ADDR_LENGTH + 1]; 235 } HidlP2pGroupInfo; 236 237 typedef struct HidlP2pInvitationInfo { 238 int type; /* 0:Recived, 1:Accepted */ 239 int persistentNetworkId; 240 int operatingFrequency; 241 char srcAddress[WIFI_MAC_ADDR_LENGTH + 1]; 242 char goDeviceAddress[WIFI_MAC_ADDR_LENGTH + 1]; 243 char bssid[WIFI_MAC_ADDR_LENGTH + 1]; 244 } HidlP2pInvitationInfo; 245 246 typedef struct HidlP2pServDiscReqInfo { 247 int freq; 248 int dialogToken; 249 int updateIndic; 250 int tlvsLength; 251 char mac[WIFI_MAC_ADDR_LENGTH + 1]; 252 unsigned char *tlvs; 253 } HidlP2pServDiscReqInfo; 254 255 typedef struct HidlP2pServiceInfo { 256 int mode; /* 0/1, upnp/bonjour */ 257 int version; 258 char name[WIFI_P2P_IDL_SERVER_NAME_LENGTH]; 259 char query[WIFI_P2P_IDL_SERVER_INFO_LENGTH]; 260 char resp[WIFI_P2P_IDL_SERVER_INFO_LENGTH]; 261 } HidlP2pServiceInfo; 262 263 typedef struct HidlP2pNetworkInfo { 264 int id; 265 char ssid[WIFI_SSID_LENGTH]; 266 char bssid[WIFI_MAC_ADDR_LENGTH + 1]; 267 char flags[WIFI_P2P_TMP_MSG_LENGTH_64]; 268 } HidlP2pNetworkInfo; 269 270 typedef struct HidlP2pNetworkList { 271 int infoNum; 272 HidlP2pNetworkInfo *infos; 273 } HidlP2pNetworkList; 274 275 typedef struct HidlP2pConnectInfo { 276 int persistent; /* |persistent=<network id>] */ 277 int mode; /* [join|auth] */ 278 int goIntent; /* [go_intent=<0..15>] */ 279 int provdisc; /* [provdisc] */ 280 char peerDevAddr[WIFI_MAC_ADDR_LENGTH + 1]; 281 char pin[WIFI_PIN_CODE_LENGTH + 1]; /* <pbc|pin|PIN#|p2ps> */ 282 } HidlP2pConnectInfo; 283 284 /* Wifi P2P Group Network configuration parameter flag */ 285 typedef enum P2pGroupConfigType { 286 GROUP_CONFIG_SSID = 0, 287 GROUP_CONFIG_BSSID, 288 GROUP_CONFIG_PSK, 289 GROUP_CONFIG_PROTO, 290 GROUP_CONFIG_KEY_MGMT, 291 GROUP_CONFIG_PAIRWISE, 292 GROUP_CONFIG_AUTH_ALG, 293 GROUP_CONFIG_MODE, 294 GROUP_CONFIG_DISABLED, 295 GROUP_CONFIG_END_POS, 296 } P2pGroupConfigType; 297 298 typedef struct HidlP2pGroupConfig { 299 P2pGroupConfigType cfgParam; /* param */ 300 char cfgValue[WIFI_P2P_GROUP_CONFIG_VALUE_LENGTH]; /* param value */ 301 } HidlP2pGroupConfig; 302 303 typedef struct Hid2dConnectInfo { 304 char ssid[WIFI_SSID_LENGTH]; 305 char bssid[WIFI_MAC_ADDR_LENGTH + 1]; 306 char passphrase[WIFI_P2P_TMP_MSG_LENGTH_128]; 307 int frequency; 308 } Hid2dConnectInfo; 309 /* ----------------p2p struct defines end--------------------------- */ 310 311 #ifdef __cplusplus 312 } 313 #endif 314 #endif