1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2016 The Qt Company Ltd. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of the plugins of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:LGPL$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see https://www.qt.io/terms-conditions. For further 15 ** information use the contact form at https://www.qt.io/contact-us. 16 ** 17 ** GNU Lesser General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU Lesser 19 ** General Public License version 3 as published by the Free Software 20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 ** packaging of this file. Please review the following information to 22 ** ensure the GNU Lesser General Public License version 3 requirements 23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 ** 25 ** GNU General Public License Usage 26 ** Alternatively, this file may be used under the terms of the GNU 27 ** General Public License version 2.0 or (at your option) the GNU General 28 ** Public license version 3 or any later version approved by the KDE Free 29 ** Qt Foundation. The licenses are as published by the Free Software 30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 ** included in the packaging of this file. Please review the following 32 ** information to ensure the GNU General Public License requirements will 33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 ** https://www.gnu.org/licenses/gpl-3.0.html. 35 ** 36 ** $QT_END_LICENSE$ 37 ** 38 ****************************************************************************/ 39 40 #ifndef PLATFORMDEFS_H 41 #define PLATFORMDEFS_H 42 43 #include <wtypes.h> 44 #undef interface 45 46 //proper header is wlanapi.h, but that is not included in windows XP 47 48 #define WLAN_MAX_NAME_LENGTH 256 49 #define WLAN_MAX_PHY_TYPE_NUMBER 8 50 #define WLAN_NOTIFICATION_SOURCE_ACM 0x00000008 51 #define WLAN_NOTIFICATION_SOURCE_ALL 0x0000ffff 52 #define WLAN_AVAILABLE_NETWORK_CONNECTED 1 53 #define WLAN_AVAILABLE_NETWORK_HAS_PROFILE 2 54 #define DOT11_SSID_MAX_LENGTH 32 55 56 QT_BEGIN_NAMESPACE 57 58 struct WLAN_NOTIFICATION_DATA { 59 DWORD NotificationSource; 60 DWORD NotificationCode; 61 GUID InterfaceGuid; 62 DWORD dwDataSize; 63 PVOID pData; 64 }; 65 66 enum WLAN_INTERFACE_STATE { 67 wlan_interface_state_not_ready = 0, 68 wlan_interface_state_connected, 69 wlan_interface_state_ad_hoc_network_formed, 70 wlan_interface_state_disconnecting, 71 wlan_interface_state_disconnected, 72 wlan_interface_state_associating, 73 wlan_interface_state_discovering, 74 wlan_interface_state_authenticating 75 }; 76 77 struct WLAN_INTERFACE_INFO { 78 GUID InterfaceGuid; 79 WCHAR strInterfaceDescription[WLAN_MAX_NAME_LENGTH]; 80 WLAN_INTERFACE_STATE isState; 81 }; 82 83 struct WLAN_INTERFACE_INFO_LIST { 84 DWORD dwNumberOfItems; 85 DWORD dwIndex; 86 WLAN_INTERFACE_INFO InterfaceInfo[1]; 87 }; 88 89 struct DOT11_SSID { 90 ULONG uSSIDLength; 91 UCHAR ucSSID[DOT11_SSID_MAX_LENGTH]; 92 }; 93 94 struct NDIS_OBJECT_HEADER { 95 UCHAR Type; 96 UCHAR Revision; 97 USHORT Size; 98 }; 99 100 typedef UCHAR DOT11_MAC_ADDRESS[6]; 101 struct DOT11_BSSID_LIST { 102 NDIS_OBJECT_HEADER Header; 103 ULONG uNumberOfEntries; 104 ULONG uTotalNumOfEntries; 105 DOT11_MAC_ADDRESS BSSIDs[1]; 106 }; 107 108 enum DOT11_BSS_TYPE { 109 dot11_BSS_type_infrastructure = 1, 110 dot11_BSS_type_independent = 2, 111 dot11_BSS_type_any = 3 112 }; 113 114 enum DOT11_PHY_TYPE { 115 dot11_phy_type_unknown = 0, 116 dot11_phy_type_any = dot11_phy_type_unknown, 117 dot11_phy_type_fhss = 1, 118 dot11_phy_type_dsss = 2, 119 dot11_phy_type_irbaseband = 3, 120 dot11_phy_type_ofdm = 4, 121 dot11_phy_type_hrdsss = 5, 122 dot11_phy_type_erp = 6, 123 dot11_phy_type_ht = 7, 124 dot11_phy_type_IHV_start = 0x80000000, 125 dot11_phy_type_IHV_end = 0xffffffff 126 }; 127 128 enum DOT11_AUTH_ALGORITHM { 129 DOT11_AUTH_ALGO_80211_OPEN = 1, 130 DOT11_AUTH_ALGO_80211_SHARED_KEY = 2, 131 DOT11_AUTH_ALGO_WPA = 3, 132 DOT11_AUTH_ALGO_WPA_PSK = 4, 133 DOT11_AUTH_ALGO_WPA_NONE = 5, 134 DOT11_AUTH_ALGO_RSNA = 6, 135 DOT11_AUTH_ALGO_RSNA_PSK = 7, 136 DOT11_AUTH_ALGO_IHV_START = 0x80000000, 137 DOT11_AUTH_ALGO_IHV_END = 0xffffffff 138 }; 139 140 enum DOT11_CIPHER_ALGORITHM { 141 DOT11_CIPHER_ALGO_NONE = 0x00, 142 DOT11_CIPHER_ALGO_WEP40 = 0x01, 143 DOT11_CIPHER_ALGO_TKIP = 0x02, 144 DOT11_CIPHER_ALGO_CCMP = 0x04, 145 DOT11_CIPHER_ALGO_WEP104 = 0x05, 146 DOT11_CIPHER_ALGO_WPA_USE_GROUP = 0x100, 147 DOT11_CIPHER_ALGO_RSN_USE_GROUP = 0x100, 148 DOT11_CIPHER_ALGO_WEP = 0x101, 149 DOT11_CIPHER_ALGO_IHV_START = 0x80000000, 150 DOT11_CIPHER_ALGO_IHV_END = 0xffffffff 151 }; 152 153 struct WLAN_AVAILABLE_NETWORK { 154 WCHAR strProfileName[WLAN_MAX_NAME_LENGTH]; 155 DOT11_SSID dot11Ssid; 156 DOT11_BSS_TYPE dot11BssType; 157 ULONG uNumberOfBssids; 158 BOOL bNetworkConnectable; 159 DWORD wlanNotConnectableReason; 160 ULONG uNumberOfPhyTypes; 161 DOT11_PHY_TYPE dot11PhyTypes[WLAN_MAX_PHY_TYPE_NUMBER]; 162 BOOL bMorePhyTypes; 163 ULONG wlanSignalQuality; 164 BOOL bSecurityEnabled; 165 DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm; 166 DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgorithm; 167 DWORD dwFlags; 168 DWORD dwReserved; 169 }; 170 171 struct WLAN_AVAILABLE_NETWORK_LIST { 172 DWORD dwNumberOfItems; 173 DWORD dwIndex; 174 WLAN_AVAILABLE_NETWORK Network[1]; 175 }; 176 177 enum WLAN_INTF_OPCODE { 178 wlan_intf_opcode_autoconf_start = 0x000000000, 179 wlan_intf_opcode_autoconf_enabled, 180 wlan_intf_opcode_background_scan_enabled, 181 wlan_intf_opcode_media_streaming_mode, 182 wlan_intf_opcode_radio_state, 183 wlan_intf_opcode_bss_type, 184 wlan_intf_opcode_interface_state, 185 wlan_intf_opcode_current_connection, 186 wlan_intf_opcode_channel_number, 187 wlan_intf_opcode_supported_infrastructure_auth_cipher_pairs, 188 wlan_intf_opcode_supported_adhoc_auth_cipher_pairs, 189 wlan_intf_opcode_supported_country_or_region_string_list, 190 wlan_intf_opcode_current_operation_mode, 191 wlan_intf_opcode_supported_safe_mode, 192 wlan_intf_opcode_certified_safe_mode, 193 wlan_intf_opcode_autoconf_end = 0x0fffffff, 194 wlan_intf_opcode_msm_start = 0x10000100, 195 wlan_intf_opcode_statistics, 196 wlan_intf_opcode_rssi, 197 wlan_intf_opcode_msm_end = 0x1fffffff, 198 wlan_intf_opcode_security_start = 0x20010000, 199 wlan_intf_opcode_security_end = 0x2fffffff, 200 wlan_intf_opcode_ihv_start = 0x30000000, 201 wlan_intf_opcode_ihv_end = 0x3fffffff 202 }; 203 204 enum WLAN_OPCODE_VALUE_TYPE { 205 wlan_opcode_value_type_query_only = 0, 206 wlan_opcode_value_type_set_by_group_policy, 207 wlan_opcode_value_type_set_by_user, 208 wlan_opcode_value_type_invalid 209 }; 210 211 enum WLAN_CONNECTION_MODE { 212 wlan_connection_mode_profile = 0, 213 wlan_connection_mode_temporary_profile, 214 wlan_connection_mode_discovery_secure, 215 wlan_connection_mode_discovery_unsecure, 216 wlan_connection_mode_auto, 217 wlan_connection_mode_invalid 218 }; 219 220 struct WLAN_CONNECTION_PARAMETERS { 221 WLAN_CONNECTION_MODE wlanConnectionMode; 222 LPCWSTR strProfile; 223 DOT11_SSID *pDot11Ssid; 224 DOT11_BSSID_LIST *pDesiredBssidList; 225 DOT11_BSS_TYPE dot11BssType; 226 DWORD dwFlags; 227 }; 228 229 struct WLAN_RAW_DATA { 230 DWORD dwDataSize; 231 BYTE DataBlob[1]; 232 }; 233 234 enum WLAN_NOTIFICATION_ACM { 235 wlan_notification_acm_start = 0, 236 wlan_notification_acm_autoconf_enabled, 237 wlan_notification_acm_autoconf_disabled, 238 wlan_notification_acm_background_scan_enabled, 239 wlan_notification_acm_background_scan_disabled, 240 wlan_notification_acm_bss_type_change, 241 wlan_notification_acm_power_setting_change, 242 wlan_notification_acm_scan_complete, 243 wlan_notification_acm_scan_fail, 244 wlan_notification_acm_connection_start, 245 wlan_notification_acm_connection_complete, 246 wlan_notification_acm_connection_attempt_fail, 247 wlan_notification_acm_filter_list_change, 248 wlan_notification_acm_interface_arrival, 249 wlan_notification_acm_interface_removal, 250 wlan_notification_acm_profile_change, 251 wlan_notification_acm_profile_name_change, 252 wlan_notification_acm_profiles_exhausted, 253 wlan_notification_acm_network_not_available, 254 wlan_notification_acm_network_available, 255 wlan_notification_acm_disconnecting, 256 wlan_notification_acm_disconnected, 257 wlan_notification_acm_adhoc_network_state_change, 258 wlan_notification_acm_end 259 }; 260 261 struct WLAN_ASSOCIATION_ATTRIBUTES { 262 DOT11_SSID dot11Ssid; 263 DOT11_BSS_TYPE dot11BssType; 264 DOT11_MAC_ADDRESS dot11Bssid; 265 DOT11_PHY_TYPE dot11PhyType; 266 ULONG uDot11PhyIndex; 267 ULONG wlanSignalQuality; 268 ULONG ulRxRate; 269 ULONG ulTxRate; 270 }; 271 272 struct WLAN_SECURITY_ATTRIBUTES { 273 BOOL bSecurityEnabled; 274 BOOL bOneXEnabled; 275 DOT11_AUTH_ALGORITHM dot11AuthAlgorithm; 276 DOT11_CIPHER_ALGORITHM dot11CipherAlgorithm; 277 }; 278 279 struct WLAN_CONNECTION_ATTRIBUTES { 280 WLAN_INTERFACE_STATE isState; 281 WLAN_CONNECTION_MODE wlanConnectionMode; 282 WCHAR strProfileName[WLAN_MAX_NAME_LENGTH]; 283 WLAN_ASSOCIATION_ATTRIBUTES wlanAssociationAttributes; 284 WLAN_SECURITY_ATTRIBUTES wlanSecurityAttributes; 285 }; 286 287 typedef void (WINAPI *WLAN_NOTIFICATION_CALLBACK)(WLAN_NOTIFICATION_DATA *, PVOID); 288 289 typedef DWORD (WINAPI *WlanOpenHandleProto) 290 (DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, PHANDLE phClientHandle); 291 typedef DWORD (WINAPI *WlanRegisterNotificationProto) 292 (HANDLE hClientHandle, DWORD dwNotifSource, BOOL bIgnoreDuplicate, 293 WLAN_NOTIFICATION_CALLBACK funcCallback, PVOID pCallbackContext, 294 PVOID pReserved, PDWORD pdwPrevNotifSource); 295 typedef DWORD (WINAPI *WlanEnumInterfacesProto) 296 (HANDLE hClientHandle, PVOID pReserved, WLAN_INTERFACE_INFO_LIST **ppInterfaceList); 297 typedef DWORD (WINAPI *WlanGetAvailableNetworkListProto) 298 (HANDLE hClientHandle, const GUID* pInterfaceGuid, DWORD dwFlags, PVOID pReserved, 299 WLAN_AVAILABLE_NETWORK_LIST **ppAvailableNetworkList); 300 typedef DWORD (WINAPI *WlanQueryInterfaceProto) 301 (HANDLE hClientHandle, const GUID *pInterfaceGuid, WLAN_INTF_OPCODE OpCode, PVOID pReserved, 302 PDWORD pdwDataSize, PVOID *ppData, WLAN_OPCODE_VALUE_TYPE *pWlanOpcodeValueType); 303 typedef DWORD (WINAPI *WlanConnectProto) 304 (HANDLE hClientHandle, const GUID *pInterfaceGuid, 305 const WLAN_CONNECTION_PARAMETERS *pConnectionParameters, PVOID pReserved); 306 typedef DWORD (WINAPI *WlanDisconnectProto) 307 (HANDLE hClientHandle, const GUID *pInterfaceGuid, PVOID pReserved); 308 typedef DWORD (WINAPI *WlanScanProto) 309 (HANDLE hClientHandle, const GUID *pInterfaceGuid, const DOT11_SSID *pDot11Ssid, 310 const WLAN_RAW_DATA *pIeData, PVOID pReserved); 311 typedef VOID (WINAPI *WlanFreeMemoryProto)(PVOID pMemory); 312 typedef DWORD (WINAPI *WlanCloseHandleProto)(HANDLE hClientHandle, PVOID pReserved); 313 314 extern WlanOpenHandleProto local_WlanOpenHandle; 315 extern WlanRegisterNotificationProto local_WlanRegisterNotification; 316 extern WlanEnumInterfacesProto local_WlanEnumInterfaces; 317 extern WlanGetAvailableNetworkListProto local_WlanGetAvailableNetworkList; 318 extern WlanQueryInterfaceProto local_WlanQueryInterface; 319 extern WlanConnectProto local_WlanConnect; 320 extern WlanDisconnectProto local_WlanDisconnect; 321 extern WlanScanProto local_WlanScan; 322 extern WlanFreeMemoryProto local_WlanFreeMemory; 323 extern WlanCloseHandleProto local_WlanCloseHandle; 324 325 QT_END_NAMESPACE 326 327 #endif // PLATFORMDEFS_H 328