1/* 2 * Copyright (c) 2023 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/** 17 * @addtogroup WPA 18 * @{ 19 * 20 * @brief Provides APIs for the upper-layer WLAN service. 21 * 22 * You can use the APIs to enable or disable a WLAN hotspot, scan for hotspots, connect to a WLAN hotspot, 23 * manage WLAN chips, network devices, and power, and apply for, release, and move network data buffers. 24 * 25 * @since 4.1 26 * @version 1.0 27 */ 28 29 /** 30 * @file WpaTypes.idl 31 * 32 * @brief Defines data types related to the WLAN module. 33 * 34 * The WLAN module data includes the {@code Feature} object information, station (STA) information, 35 * scan information, and network device information. 36 * 37 * @since 4.1 38 * @version 1.0 39 */ 40 41/** 42 * @brief Defines the package path of the WLAN module interface. 43 * 44 * @since 4.1 45 * @version 1.0 46 */ 47package ohos.hdi.wlan.wpa.v1_0; 48 49/** 50 * @brief Defines the {@code Feature} object information. 51 * 52 * @since 4.1 53 * @version 1.0 54 */ 55struct HdiFeatureInfo { 56 /** NIC name of the {@code Feature} object. */ 57 String ifName; 58 /** {@code Feature} object. */ 59 int type; 60}; 61 62/** 63 * @brief Defines the Wifi Status information for a Wi-Fi. 64 * 65 * @since 4.1 66 * @version 1.0 67 */ 68struct HdiWifiStatus { 69 /** Basic service set identifier (BSSID) to scan. */ 70 unsigned char[] bssid; 71 int freq; 72 /** SSID to scan. */ 73 String ssid; 74 /** Length of the SSID. */ 75 int ssidLen; 76 String keyMgmt; 77 int keyMgmtLen; 78 unsigned char[] address; 79}; 80 81/** 82 * @brief Defines the Wpa Status information for a Wi-Fi 83 * 84 * @since 4.1 85 * @version 1.0 86 */ 87struct HdiWifiWpaNetworkInfo { 88 int id; 89 unsigned char[] ssid; 90 unsigned char[] bssid; 91 unsigned char[] flags; 92}; 93 94/** 95 * @brief Defines the Wpa Status information for a Wi-Fi 96 * 97 * @since 4.1 98 * @version 1.0 99 */ 100struct HdiWifiWpsParam { 101 int anyFlag; 102 int multiAp; 103 unsigned char[] bssid; 104 unsigned char[] pinCode; 105}; 106 107/** 108 * @brief Defines the Wpa Status information for a Wi-Fi 109 * 110 * @since 4.1 111 * @version 1.0 112 */ 113struct HdiWpaCmdStatus { 114 unsigned char[] bssid; 115 int freq; 116 unsigned char[] ssid; 117 int id; 118 unsigned char[] keyMgmt; 119 unsigned char[] address; 120}; 121 122/** 123 * @brief Defines the Wpa Status information for a Wi-Fi 124 * 125 * @since 4.1 126 * @version 1.0 127 */ 128struct HdiWpaDisconnectParam { 129 unsigned char[] bssid; 130 int reasonCode; 131 int locallyGenerated; 132}; 133 134/** 135 * @brief Defines the Wpa Status information for a Wi-Fi 136 * 137 * @since 4.1 138 * @version 1.0 139 */ 140struct HdiWpaConnectParam { 141 unsigned char[] bssid; 142 int networkId; 143}; 144 145/** 146 * @brief Defines the Wpa Status information for a Wi-Fi 147 * 148 * @since 4.1 149 * @version 1.0 150 */ 151struct HdiWpaBssidChangedParam { 152 unsigned char[] bssid; 153 unsigned char[] reason; 154}; 155 156/** 157 * @brief Defines the Wpa Status information for a Wi-Fi 158 * 159 * @since 4.1 160 * @version 1.0 161 */ 162struct HdiWpaStateChangedParam { 163 int status; 164 unsigned char[] bssid; 165 int networkId; 166 unsigned char[] ssid; 167}; 168 169/** 170 * @brief Defines the Wpa Status information for a Wi-Fi 171 * 172 * @since 4.1 173 * @version 1.0 174 */ 175struct HdiWpaTempDisabledParam { 176 int networkId; 177 unsigned char[] ssid; 178 int authFailures; 179 int duration; 180 unsigned char[] reason; 181}; 182 183/** 184 * @brief Defines the Wpa Status information for a Wi-Fi 185 * 186 * @since 4.1 187 * @version 1.0 188 */ 189struct HdiWpaAssociateRejectParam { 190 unsigned char[] bssid; 191 int statusCode; 192 int timeOut; 193}; 194 195/** 196 * @brief Defines the Recv ScanResult information for a Wi-Fi 197 * 198 * @since 4.1 199 * @version 1.0 200 */ 201struct HdiWpaRecvScanResultParam { 202 unsigned int scanId; 203}; 204 205/** 206 * @brief Enumerates Wifi Technologies 207 */ 208enum WifiTechnology { 209 UNKNOWN_TECHNOLOGY = 0, 210 /** 211 * For 802.11a/b/g 212 */ 213 LEGACY = 1, 214 /** 215 * For 802.11n 216 */ 217 HT = 2, 218 /** 219 * For 802.11ac 220 */ 221 VHT = 3, 222 /** 223 * For 802.11ax 224 */ 225 HE = 4, 226}; 227 228/** 229 * @brief Enumerates Channel operating width in Mhz. 230 */ 231enum WifiChannelWidthInMhz { 232 WIDTH_20 = 0, 233 WIDTH_40 = 1, 234 WIDTH_80 = 2, 235 WIDTH_160 = 3, 236 WIDTH_80P80 = 4, 237 WIDTH_5 = 5, 238 WIDTH_10 = 6, 239 WIDTH_INVALID = -1 240}; 241 242/** 243 *@brief Enumerates Detailed network mode for legacy network 244 */ 245enum LegacyMode { 246 UNKNOWN_MODE = 0, 247 /** 248 * For 802.11a 249 */ 250 A_MODE = 1, 251 /** 252 * For 802.11b 253 */ 254 B_MODE = 2, 255 /** 256 * For 802.11g 257 */ 258 G_MODE = 3, 259}; 260 261/** 262 * Connection Capabilities supported by current network and device 263 */ 264struct ConnectionCapabilities { 265 /** 266 * Wifi Technology 267 */ 268 WifiTechnology technology; 269 /** 270 * channel bandwidth 271 */ 272 WifiChannelWidthInMhz channelBandwidth; 273 /** 274 * max number of Tx spatial streams 275 */ 276 int maxNumberTxSpatialStreams; 277 /** 278 * max number of Rx spatial streams 279 */ 280 int maxNumberRxSpatialStreams; 281 /** 282 * detailed network mode for legacy network 283 */ 284 LegacyMode legacyMode; 285}; 286 287/** 288 * @brief Defines the p2p Network Info for a Wi-Fi 289 * 290 * @since 4.1 291 * @version 1.0 292 */ 293struct HdiP2pNetworkInfo { 294 int id; 295 unsigned char[] ssid; 296 unsigned char[] bssid; 297 unsigned char[] flags; 298}; 299 300/** 301 * @brief Defines the p2p Network List for a Wi-Fi 302 * 303 * @since 4.1 304 * @version 1.0 305 */ 306struct HdiP2pNetworkList { 307 int infoNum; 308 struct HdiP2pNetworkInfo[] infos; 309}; 310 311/** 312 * @brief Defines the P2p Device Info for a Wi-Fi 313 * 314 * @since 4.1 315 * @version 1.0 316 */ 317struct HdiP2pDeviceInfo { 318 unsigned char[] srcAddress; 319 unsigned char[] p2pDeviceAddress; 320 unsigned char[] primaryDeviceType; 321 unsigned char[] deviceName; 322 int configMethods; 323 int deviceCapabilities; 324 int groupCapabilities; 325 unsigned char[] wfdDeviceInfo; 326 unsigned int wfdLength; 327 unsigned char[] operSsid; 328}; 329 330struct HdiP2pServiceInfo { 331 int mode; /* 0/1, upnp/bonjour */ 332 int version; 333 unsigned char[] name; 334 unsigned char[] query; 335 unsigned char[] resp; 336}; 337 338struct HdiP2pReqService { 339 unsigned char[] bssid; 340 unsigned char[] msg; 341}; 342 343struct HdiP2pServDiscReqInfo { 344 int freq; 345 int dialogToken; 346 int updateIndic; 347 unsigned char[] mac; 348 unsigned char[] tlvs; 349}; 350 351struct HdiHid2dConnectInfo { 352 unsigned char[] ssid; 353 unsigned char[] bssid; 354 unsigned char[] passphrase; 355 int frequency; 356}; 357struct HdiP2pConnectInfo { 358 int persistent; /* |persistent=<network id>] */ 359 int mode; /* [join|auth] */ 360 int goIntent; /* [go_intent=<0..15>] */ 361 int provdisc; /* [provdisc] */ 362 unsigned char[] peerDevAddr; 363 unsigned char[] pin; /* <pbc|pin|PIN#|p2ps> */ 364}; 365 366struct HdiP2pDeviceInfoParam { 367 unsigned char[] srcAddress; 368 unsigned char[] p2pDeviceAddress; 369 unsigned char[] primaryDeviceType; 370 unsigned char[] deviceName; 371 int configMethods; 372 int deviceCapabilities; 373 int groupCapabilities; 374 unsigned char[] wfdDeviceInfo; 375 unsigned int wfdLength; 376 unsigned char[] operSsid; 377}; 378 379struct HdiP2pDeviceLostParam { 380 unsigned char[] p2pDeviceAddress; 381 int networkId; 382}; 383 384struct HdiP2pGoNegotiationRequestParam { 385 unsigned char[] srcAddress; 386 int passwordId; 387}; 388 389struct HdiP2pGoNegotiationCompletedParam { 390 int status; 391}; 392 393struct HdiP2pInvitationReceivedParam { 394 int type; /* 0:Received, 1:Accepted */ 395 int persistentNetworkId; 396 int operatingFrequency; 397 unsigned char[] srcAddress; 398 unsigned char[] goDeviceAddress; 399 unsigned char[] bssid; 400}; 401 402struct HdiP2pInvitationResultParam { 403 int status; 404 unsigned char[] bssid; 405}; 406 407struct HdiP2pGroupStartedParam { 408 int isGo; 409 int isPersistent; 410 int frequency; 411 unsigned char[] groupIfName; 412 unsigned char[] ssid; 413 unsigned char[] psk; 414 unsigned char[] passphrase; 415 unsigned char[] goDeviceAddress; 416}; 417 418struct HdiP2pGroupRemovedParam { 419 int isGo; 420 unsigned char[] groupIfName; 421}; 422 423struct HdiP2pProvisionDiscoveryCompletedParam { 424 int isRequest; 425 int provDiscStatusCode; 426 int configMethods; 427 unsigned char[] p2pDeviceAddress; 428 unsigned char[] generatedPin; 429}; 430 431struct HdiP2pServDiscReqInfoParam { 432 int freq; 433 int dialogToken; 434 int updateIndic; 435 unsigned char[] mac; 436 unsigned char[] tlvs; 437}; 438 439struct HdiP2pServDiscRespParam { 440 int updateIndicator; 441 unsigned char[] srcAddress; 442 unsigned char[] tlvs; 443}; 444 445struct HdiP2pStaConnectStateParam { 446 int state; 447 unsigned char[] srcAddress; 448 unsigned char[] p2pDeviceAddress; 449}; 450 451struct HdiP2pIfaceCreatedParam { 452 int isGo; 453}; 454 455/** 456 * @brief STA authentication rejection parameter 457 * 458 * @since 4.1 459 * @version 1.0 460 */ 461struct HdiWpaAuthRejectParam { 462 unsigned char[] bssid; 463 unsigned short authType; 464 unsigned short authTransaction; 465 unsigned short statusCode; 466};