2 * Copyright (C) 2016 Austin English
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef _WLAN_WLANAPI_H
20 #define _WLAN_WLANAPI_H
24 typedef enum _WLAN_INTERFACE_STATE
26 wlan_interface_state_not_ready
,
27 wlan_interface_state_connected
,
28 wlan_interface_state_ad_hoc_network_formed
,
29 wlan_interface_state_disconnecting
,
30 wlan_interface_state_disconnected
,
31 wlan_interface_state_associating
,
32 wlan_interface_state_discovering
,
33 wlan_interface_state_authenticating
34 } WLAN_INTERFACE_STATE
, *PWLAN_INTERFACE_STATE
;
36 typedef struct _WLAN_INTERFACE_INFO
39 WCHAR strInterfaceDescription
[256];
40 WLAN_INTERFACE_STATE isState
;
41 } WLAN_INTERFACE_INFO
, *PWLAN_INTERFACE_INFO
;
43 typedef struct _WLAN_INTERFACE_INFO_LIST
45 DWORD dwNumberOfItems
;
47 WLAN_INTERFACE_INFO InterfaceInfo
[1];
48 } WLAN_INTERFACE_INFO_LIST
, *PWLAN_INTERFACE_INFO_LIST
;
50 #define DOT11_SSID_MAX_LENGTH 32
51 typedef struct _DOT11_SSID
54 UCHAR ucSSID
[DOT11_SSID_MAX_LENGTH
];
57 typedef struct _WLAN_RAW_DATA
61 } WLAN_RAW_DATA
, *PWLAN_RAW_DATA
;
63 typedef struct _WLAN_NOTIFICATION_DATA
65 DWORD NotificationSource
;
66 DWORD NotificationCode
;
70 } WLAN_NOTIFICATION_DATA
, *PWLAN_NOTIFICATION_DATA
;
72 typedef void (WINAPI
*WLAN_NOTIFICATION_CALLBACK
)(WLAN_NOTIFICATION_DATA
*, void *);
74 typedef enum _DOT11_BSS_TYPE
76 dot11_BSS_type_infrastructure
= 0x01,
77 dot11_BSS_type_independent
= 0x02,
78 dot11_BSS_type_any
= 0x03
79 } DOT11_BSS_TYPE
, *PDOT11_BSS_TYPE
;
81 typedef DWORD WLAN_REASON_CODE
, *PWLAN_REASON_CODE
, WLAN_SIGNAL_QUALITY
;
83 typedef enum _DOT11_AUTH_ALGORITHM
85 DOT11_AUTH_ALGO_80211_OPEN
= 0x01,
86 DOT11_AUTH_ALGO_80211_SHARED_KEY
= 0x02,
87 DOT11_AUTH_ALGO_WPA
= 0x03,
88 DOT11_AUTH_ALGO_WPA_PSK
= 0x04,
89 DOT11_AUTH_ALGO_WPA_NONE
= 0x05,
90 DOT11_AUTH_ALGO_RSNA
= 0x06,
91 DOT11_AUTH_ALGO_RSNA_PSK
= 0x07,
92 DOT11_AUTH_ALGO_IHV_START
= 0x80000000,
93 DOT11_AUTH_ALGO_IHV_END
= 0xFFFFFFFF
94 } DOT11_AUTH_ALGORITHM
, *PDOT11_AUTH_ALGORITHM
;
96 typedef enum _DOT11_CIPHER_ALGORITHM
98 DOT11_CIPHER_ALGO_NONE
= 0x00,
99 DOT11_CIPHER_ALGO_WEP40
= 0x01,
100 DOT11_CIPHER_ALGO_TKIP
= 0x02,
101 DOT11_CIPHER_ALGO_CCMP
= 0x04,
102 DOT11_CIPHER_ALGO_WEP104
= 0x05,
103 DOT11_CIPHER_ALGO_WPA_USE_GROUP
= 0x100,
104 DOT11_CIPHER_ALGO_RSN_USE_GROUP
= 0x100,
105 DOT11_CIPHER_ALGO_WEP
= 0x101,
106 DOT11_CIPHER_ALGO_IHV_START
= 0x80000000,
107 DOT11_CIPHER_ALGO_IHV_END
= 0xFFFFFFFF
108 } DOT11_CIPHER_ALGORITHM
, *PDOT11_CIPHER_ALGORITHM
;
110 #define WLAN_MAX_PHY_TYPE_NUMBER 8
112 typedef struct _WLAN_AVAILABLE_NETWORK
114 WCHAR strProfileName
[256];
115 DOT11_SSID dot11Ssid
;
116 DOT11_BSS_TYPE dot11BssType
;
117 ULONG uNumberOfBssids
;
118 BOOL bNetworkConnectable
;
119 WLAN_REASON_CODE wlanNotConnectableReason
;
120 ULONG uNumberOfPhyTypes
;
121 DOT11_PHY_TYPE dot11PhyTypes
[WLAN_MAX_PHY_TYPE_NUMBER
];
123 WLAN_SIGNAL_QUALITY wlanSignalQuality
;
124 BOOL bSecurityEnabled
;
125 DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm
;
126 DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgorithm
;
129 } WLAN_AVAILABLE_NETWORK
, *PWLAN_AVAILABLE_NETWORK
;
131 typedef enum _WLAN_INTF_OPCODE
133 wlan_intf_opcode_autoconf_start
= 0x000000000,
134 wlan_intf_opcode_autoconf_enabled
,
135 wlan_intf_opcode_background_scan_enabled
,
136 wlan_intf_opcode_media_streaming_mode
,
137 wlan_intf_opcode_radio_state
,
138 wlan_intf_opcode_bss_type
,
139 wlan_intf_opcode_interface_state
,
140 wlan_intf_opcode_current_connection
,
141 wlan_intf_opcode_channel_number
,
142 wlan_intf_opcode_supported_infrastructure_auth_cipher_pairs
,
143 wlan_intf_opcode_supported_adhoc_auth_cipher_pairs
,
144 wlan_intf_opcode_supported_country_or_region_string_list
,
145 wlan_intf_opcode_current_operation_mode
,
146 wlan_intf_opcode_supported_safe_mode
,
147 wlan_intf_opcode_certified_safe_mode
,
148 wlan_intf_opcode_hosted_network_capable
,
149 wlan_intf_opcode_management_frame_protection_capable
,
150 wlan_intf_opcode_autoconf_end
= 0x0fffffff,
151 wlan_intf_opcode_msm_start
= 0x10000100,
152 wlan_intf_opcode_statistics
,
153 wlan_intf_opcode_rssi
,
154 wlan_intf_opcode_msm_end
= 0x1fffffff,
155 wlan_intf_opcode_security_start
= 0x20010000,
156 wlan_intf_opcode_security_end
= 0x2fffffff,
157 wlan_intf_opcode_ihv_start
= 0x30000000,
158 wlan_intf_opcode_ihv_end
= 0x3fffffff
159 } WLAN_INTF_OPCODE
, *PWLAN_INTF_OPCODE
;
161 typedef enum _WLAN_OPCODE_VALUE_TYPE
163 wlan_opcode_value_type_query_only
= 0,
164 wlan_opcode_value_type_set_by_group_policy
,
165 wlan_opcode_value_type_set_by_user
,
166 wlan_opcode_value_type_invalid
167 } WLAN_OPCODE_VALUE_TYPE
, *PWLAN_OPCODE_VALUE_TYPE
;
169 typedef struct _WLAN_AVAILABLE_NETWORK_LIST
171 DWORD dwNumberOfItems
;
173 WLAN_AVAILABLE_NETWORK Network
[1];
174 } WLAN_AVAILABLE_NETWORK_LIST
, *PWLAN_AVAILABLE_NETWORK_LIST
;
176 typedef enum _WLAN_HOSTED_NETWORK_OPCODE
178 wlan_hosted_network_opcode_connection_settings
,
179 wlan_hosted_network_opcode_security_settings
,
180 wlan_hosted_network_opcode_station_profile
,
181 wlan_hosted_network_opcode_enable
182 } WLAN_HOSTED_NETWORK_OPCODE
, *PWLAN_HOSTED_NETWORK_OPCODE
;
184 typedef enum _WLAN_HOSTED_NETWORK_REASON
186 wlan_hosted_network_reason_success
= 0,
187 wlan_hosted_network_reason_unspecified
,
188 wlan_hosted_network_reason_bad_parameters
,
189 wlan_hosted_network_reason_service_shutting_down
,
190 wlan_hosted_network_reason_insufficient_resources
,
191 wlan_hosted_network_reason_elevation_required
,
192 wlan_hosted_network_reason_read_only
,
193 wlan_hosted_network_reason_persistence_failed
,
194 wlan_hosted_network_reason_crypt_error
,
195 wlan_hosted_network_reason_impersonation
,
196 wlan_hosted_network_reason_stop_before_start
,
197 wlan_hosted_network_reason_interface_available
,
198 wlan_hosted_network_reason_interface_unavailable
,
199 wlan_hosted_network_reason_miniport_stopped
,
200 wlan_hosted_network_reason_miniport_started
,
201 wlan_hosted_network_reason_incompatible_connection_started
,
202 wlan_hosted_network_reason_incompatible_connection_stopped
,
203 wlan_hosted_network_reason_user_action
,
204 wlan_hosted_network_reason_client_abort
,
205 wlan_hosted_network_reason_ap_start_failed
,
206 wlan_hosted_network_reason_peer_arrived
,
207 wlan_hosted_network_reason_peer_departed
,
208 wlan_hosted_network_reason_peer_timeout
,
209 wlan_hosted_network_reason_gp_denied
,
210 wlan_hosted_network_reason_service_unavailable
,
211 wlan_hosted_network_reason_device_change
,
212 wlan_hosted_network_reason_properties_change
,
213 wlan_hosted_network_reason_virtual_station_blocking_use
,
214 wlan_hosted_network_reason_service_available_on_virtual_station
215 } WLAN_HOSTED_NETWORK_REASON
, *PWLAN_HOSTED_NETWORK_REASON
;
217 typedef enum _WLAN_HOSTED_NETWORK_STATE
219 wlan_hosted_network_unavailable
,
220 wlan_hosted_network_idle
,
221 wlan_hosted_network_active
222 } WLAN_HOSTED_NETWORK_STATE
, *PWLAN_HOSTED_NETWORK_STATE
;
224 typedef enum _WLAN_HOSTED_NETWORK_PEER_AUTH_STATE
226 wlan_hosted_network_peer_state_invalid
,
227 wlan_hosted_network_peer_state_authenticated
228 } WLAN_HOSTED_NETWORK_PEER_AUTH_STATE
, *PWLAN_HOSTED_NETWORK_PEER_AUTH_STATE
;
230 typedef struct _WLAN_HOSTED_NETWORK_PEER_STATE
232 DOT11_MAC_ADDRESS PeerMacAddress
;
233 WLAN_HOSTED_NETWORK_PEER_AUTH_STATE PeerAuthState
;
234 } WLAN_HOSTED_NETWORK_PEER_STATE
, *PWLAN_HOSTED_NETWORK_PEER_STATE
;
236 typedef struct _WLAN_HOSTED_NETWORK_STATUS
238 WLAN_HOSTED_NETWORK_STATE HostedNetworkState
;
240 DOT11_MAC_ADDRESS wlanHostedNetworkBSSID
;
241 DOT11_PHY_TYPE dot11PhyType
;
242 ULONG ulChannelFrequency
;
243 DWORD dwNumberOfPeers
;
244 WLAN_HOSTED_NETWORK_PEER_STATE PeerList
[1];
245 } WLAN_HOSTED_NETWORK_STATUS
, *PWLAN_HOSTED_NETWORK_STATUS
;
247 DWORD WINAPI
WlanCloseHandle(HANDLE
, void *);
248 DWORD WINAPI
WlanEnumInterfaces(HANDLE
, void *, WLAN_INTERFACE_INFO_LIST
**);
249 DWORD WINAPI
WlanOpenHandle(DWORD
, void *, DWORD
*, HANDLE
*);
250 void *WINAPI
WlanAllocateMemory(DWORD
);
251 void WINAPI
WlanFreeMemory(void *);
252 DWORD WINAPI
WlanScan(HANDLE
, const GUID
*, const DOT11_SSID
*, const WLAN_RAW_DATA
*, void *);
253 DWORD WINAPI
WlanRegisterNotification(HANDLE
, DWORD
, BOOL
, WLAN_NOTIFICATION_CALLBACK
, void *, void *, DWORD
*);
254 DWORD WINAPI
WlanGetAvailableNetworkList(HANDLE
, const GUID
*, DWORD
, void *, WLAN_AVAILABLE_NETWORK_LIST
**);
255 DWORD WINAPI
WlanQueryInterface(HANDLE
, const GUID
*, WLAN_INTF_OPCODE
, void *, DWORD
*, void **, WLAN_OPCODE_VALUE_TYPE
*);
257 #endif /* _WLAN_WLANAPI_H */