TianoCore EDK2 master
Loading...
Searching...
No Matches
WifiConnectionMgrDxe.h
Go to the documentation of this file.
1
10#ifndef __EFI_WIFI_MGR_DXE_H__
11#define __EFI_WIFI_MGR_DXE_H__
12
13#include <Uefi.h>
14
15//
16// Libraries
17//
22#include <Library/BaseLib.h>
23#include <Library/UefiLib.h>
25#include <Library/DebugLib.h>
26#include <Library/HiiLib.h>
27#include <Library/NetLib.h>
28#include <Library/PrintLib.h>
31
32//
33// UEFI Driver Model Protocols
34//
40
41//
42// Consumed Protocols
43//
44#include <Protocol/WiFi2.h>
46#include <Protocol/Supplicant.h>
51
52//
53// Produced Protocols
54//
56
57//
58// Guids
59//
61#include <Guid/MdeModuleHii.h>
63
64//
65// NvData struct definition
66//
69#include "EapContext.h"
71
72//
73// Driver Version
74//
75#define WIFI_MGR_DXE_VERSION 0xb
76
77#define OUI_IEEE_80211I 0xAC0F00
78#define MAX_WIFI_CONNETION_ATTEMPTS 3
79
80typedef enum {
81 Ieee80211PairwiseCipherSuiteUseGroupCipherSuite = 0,
82 Ieee80211PairwiseCipherSuiteWEP40 = 1,
83 Ieee80211PairwiseCipherSuiteTKIP = 2,
84 Ieee80211PairwiseCipherSuiteCCMP = 4,
85 Ieee80211PairwiseCipherSuiteWEP104 = 5,
86 Ieee80211PairwiseCipherSuiteBIP = 6,
87 Ieee80211PairwiseCipherSuiteGCMP = 8,
88 Ieee80211PairwiseCipherSuiteGCMP256 = 9,
89 // ...
90} IEEE_80211_PAIRWISE_CIPHER_SUITE;
91
92#define IEEE_80211_PAIRWISE_CIPHER_SUITE_USE_GROUP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteUseGroupCipherSuite << 24))
93#define IEEE_80211_PAIRWISE_CIPHER_SUITE_WEP40 (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteWEP40 << 24))
94#define IEEE_80211_PAIRWISE_CIPHER_SUITE_TKIP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteTKIP << 24))
95#define IEEE_80211_PAIRWISE_CIPHER_SUITE_CCMP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteCCMP << 24))
96#define IEEE_80211_PAIRWISE_CIPHER_SUITE_WEP104 (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteWEP104 << 24))
97#define IEEE_80211_PAIRWISE_CIPHER_SUITE_BIP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteBIP << 24))
98#define IEEE_80211_PAIRWISE_CIPHER_SUITE_GCMP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteGCMP << 24))
99#define IEEE_80211_PAIRWISE_CIPHER_SUITE_GCMP256 (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteGCMP256 << 24))
100
101typedef enum {
102 Ieee80211AkmSuite8021XOrPMKSA = 1,
103 Ieee80211AkmSuitePSK = 2,
104 Ieee80211AkmSuite8021XOrPMKSASHA256 = 5,
105 Ieee80211AkmSuitePSKSHA256 = 6,
106 Ieee80211AkmSuiteSAE = 8,
107 Ieee80211AkmSuite8021XSuiteB = 11,
108 Ieee80211AkmSuite8021XSuiteB192 = 12,
109 Ieee80211AkmSuiteOWE = 18,
110 // ...
111} IEEE_80211_AKM_SUITE;
112
113#define IEEE_80211_AKM_SUITE_8021X_OR_PMKSA (OUI_IEEE_80211I | (Ieee80211AkmSuite8021XOrPMKSA << 24))
114#define IEEE_80211_AKM_SUITE_PSK (OUI_IEEE_80211I | (Ieee80211AkmSuitePSK << 24))
115#define IEEE_80211_AKM_SUITE_8021X_OR_PMKSA_SHA256 (OUI_IEEE_80211I | (Ieee80211AkmSuite8021XOrPMKSASHA256 << 24))
116#define IEEE_80211_AKM_SUITE_PSK_SHA256 (OUI_IEEE_80211I | (Ieee80211AkmSuitePSKSHA256 << 24))
117#define IEEE_80211_AKM_SUITE_SAE (OUI_IEEE_80211I | (Ieee80211AkmSuiteSAE << 24))
118#define IEEE_80211_AKM_SUITE_8021X_SUITE_B (OUI_IEEE_80211I | (Ieee80211AkmSuite8021XSuiteB << 24))
119#define IEEE_80211_AKM_SUITE_8021X_SUITE_B192 (OUI_IEEE_80211I | (Ieee80211AkmSuite8021XSuiteB192 << 24))
120#define IEEE_80211_AKM_SUITE_OWE (OUI_IEEE_80211I | (Ieee80211AkmSuiteOWE << 24))
121
122//
123// Protocol instances
124//
128extern EFI_HII_CONFIG_ACCESS_PROTOCOL gWifiMgrDxeHiiConfigAccess;
129
130//
131// Private Context Data Structure
132//
133typedef enum {
134 WifiMgrDisconnected,
135 WifiMgrConnectingToAp,
136 WifiMgrConnectedToAp,
137 WifiMgrDisconnectingToAp,
138 WifiMgrConnectStateMaximum
139} WIFI_MGR_CONNECT_STATE;
140
141typedef enum {
142 WifiMgrScanFinished,
143 WifiMgrScanning,
144 WifiMgrScanStateMaximum
145} WIFI_MGR_SCAN_STATE;
146
147#define WIFI_SCAN_FREQUENCY 30
148
150 EFI_80211_AKM_SUITE_SELECTOR *SupportedAKMSuites;
151 EFI_80211_CIPHER_SUITE_SELECTOR *SupportedSwCipherSuites;
152 EFI_80211_CIPHER_SUITE_SELECTOR *SupportedHwCipherSuites;
154
155#define EFI_WIFIMGR_PRIVATE_GUID \
156 { \
157 0x99b7c019, 0x4789, 0x4829, { 0xa7, 0xbd, 0x0d, 0x4b, 0xaa, 0x62, 0x28, 0x72 } \
158 }
159
161
163 UINT32 Reserved;
165
167 EFI_FILE_HANDLE FHandle;
168 UINT16 *FileName;
170
171typedef enum {
172 FileTypeCACert,
173 FileTypeClientCert,
174 FileTypeMax
175} WIFI_MGR_FILE_TYPE;
176
177typedef struct {
178 UINT32 Signature;
179 EFI_HANDLE DriverHandle;
180 EFI_HANDLE ControllerHandle;
181 EFI_EVENT TickTimer;
182 WIFI_MGR_PRIVATE_DATA *Private;
183
184 //
185 // Pointers to consumed protocols
186 //
188 EFI_SUPPLICANT_PROTOCOL *Supplicant;
190
191 //
192 // Produced protocols
193 //
194 WIFI_MGR_PRIVATE_PROTOCOL WifiMgrIdentifier;
195
196 //
197 // Private functions and data fields
198 //
199 LIST_ENTRY Link; // Link to the NicList in global private data structure.
200 UINT32 NicIndex;
201 EFI_80211_MAC_ADDRESS MacAddress;
202 WIFI_MGR_SUPPORTED_SUITES SupportedSuites;
203 EFI_ADAPTER_INFO_MEDIA_STATE LastLinkState;
204
205 //
206 // The network is currently connected, connecting or disconnecting.
207 // Only one network can be operated at one time.
208 //
209 WIFI_MGR_NETWORK_PROFILE *CurrentOperateNetwork;
210 WIFI_MGR_NETWORK_PROFILE *ConnectPendingNetwork;
211 BOOLEAN HasDisconnectPendingNetwork;
212
213 //
214 // Profile related data fields
215 //
216 LIST_ENTRY ProfileList; // List of WIFI_MGR_NETWORK_PROFILE
217 UINT32 AvailableCount;
218 UINT32 MaxProfileIndex;
219 WIFI_MGR_NETWORK_PROFILE *UserSelectedProfile;
220
221 //
222 // Data fields for Hii functionlity
223 //
224 BOOLEAN OneTimeScanRequest;
225 BOOLEAN OneTimeConnectRequest;
226 BOOLEAN OneTimeDisconnectRequest;
227 WIFI_MGR_SCAN_STATE ScanState;
228 UINTN ScanTickTime;
229 WIFI_MGR_CONNECT_STATE ConnectState;
230 BOOLEAN ConnectStateChanged;
232
233#define WIFI_MGR_DEVICE_DATA_SIGNATURE SIGNATURE_32 ('W','M','D','D')
234
235#define WIFI_MGR_DEVICE_DATA_FROM_IDENTIFIER(Identifier) \
236 CR ( \
237 Identifier, \
238 WIFI_MGR_DEVICE_DATA, \
239 WifiMgrIdentifier, \
240 WIFI_MGR_DEVICE_DATA_SIGNATURE \
241 )
242
243typedef struct {
244 UINT32 Signature;
245 LIST_ENTRY Link;
246 CHAR16 SSId[SSID_STORAGE_SIZE];
248
249#define WIFI_MGR_HIDDEN_NETWORK_SIGNATURE SIGNATURE_32 ('W','M','H','N')
250
251#define WIFI_MGR_HIDDEN_NETWORK_FROM_IDENTIFIER(Identifier) \
252 CR ( \
253 Identifier, \
254 WIFI_HIDDEN_NETWORK_DATA, \
255 WifiMgrIdentifier, \
256 WIFI_MGR_HIDDEN_NETWORK_SIGNATURE \
257 )
258
259//
260// Global private data struct
261//
263 UINT32 Signature;
264 EFI_HANDLE DriverHandle;
265 EFI_HII_HANDLE RegisteredHandle;
267
268 UINT32 NicCount;
269 LIST_ENTRY NicList;
270 WIFI_MGR_DEVICE_DATA *CurrentNic;
271
272 //
273 // Data fields for Hii functionlity
274 //
275 EFI_EVENT NetworkListRefreshEvent; // Event to refresh the network list form
276 EFI_EVENT ConnectFormRefreshEvent; // Event to refresh the connect form
277 EFI_EVENT MainPageRefreshEvent; // Event to refresh the main page
278
279 //
280 // User Input Record
281 //
282 UINT8 SecurityType;
283 UINT8 EapAuthMethod;
284 UINT8 EapSecondAuthMethod;
285 CHAR16 EapIdentity[EAP_IDENTITY_SIZE];
286
287 WIFI_MGR_FILE_CONTEXT *FileContext;
288 WIFI_MGR_FILE_TYPE FileType;
289
290 UINT32 HiddenNetworkCount;
291 LIST_ENTRY HiddenNetworkList;
292};
293
294#define WIFI_MGR_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('W','M','P','D')
295
296#define WIFI_MGR_PRIVATE_DATA_FROM_CONFIG_ACCESS(This) \
297 CR ( \
298 This, \
299 WIFI_MGR_PRIVATE_DATA, \
300 ConfigAccess, \
301 WIFI_MGR_PRIVATE_DATA_SIGNATURE \
302 )
303extern WIFI_MGR_PRIVATE_DATA *mPrivate;
304
305typedef enum {
306 TokenTypeGetNetworksToken,
307 TokenTypeConnectNetworkToken,
308 TokenTypeDisconnectNetworkToken,
309 TokenTypeMax,
310} WIFI_MGR_MAC_CONFIG_TOKEN_TYPE;
311
312typedef union {
313 EFI_80211_GET_NETWORKS_TOKEN *GetNetworksToken;
314 EFI_80211_CONNECT_NETWORK_TOKEN *ConnectNetworkToken;
315 EFI_80211_DISCONNECT_NETWORK_TOKEN *DisconnectNetworkToken;
317
318typedef struct {
320 WIFI_MGR_MAC_CONFIG_TOKEN_TYPE Type;
323
324//
325// Include files with function prototypes
326//
333
334#endif
UINT64 UINTN
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
VOID * EFI_HII_HANDLE
EFI_DRIVER_BINDING_PROTOCOL gWifiMgrDxeDriverBinding
EFI_COMPONENT_NAME_PROTOCOL gWifiMgrDxeComponentName
EFI_COMPONENT_NAME2_PROTOCOL gWifiMgrDxeComponentName2