]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrMisc.h
6c8806897e569545694d5cc94b1fe8b61a0f7a7d
[mirror_edk2.git] / NetworkPkg / WifiConnectionManagerDxe / WifiConnectionMgrMisc.h
1 /** @file
2 The Miscellaneous Routines for WiFi Connection Manager.
3
4 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
5
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef __EFI_WIFI_MGR_MISC_H__
17 #define __EFI_WIFI_MGR_MISC_H__
18
19 /**
20 Empty function for event process function.
21
22 @param[in] Event The Event needs to be processed
23 @param[in] Context The context of the event
24
25 **/
26 VOID
27 EFIAPI
28 WifiMgrInternalEmptyFunction (
29 IN EFI_EVENT Event,
30 IN VOID *Context
31 );
32
33 /**
34 Convert the mac address into a hexadecimal encoded ":" seperated string.
35
36 @param[in] Mac The mac address
37 @param[in] StrSize The size, in bytes, of the output buffer specified by Str
38 @param[out] Str The storage to return the mac string
39
40 **/
41 VOID
42 WifiMgrMacAddrToStr (
43 IN EFI_80211_MAC_ADDRESS *Mac,
44 IN UINT32 StrSize,
45 OUT CHAR16 *Str
46 );
47
48 /**
49 Read private key file to buffer.
50
51 @param[in] FileContext The file context of private key file.
52 @param[out] PrivateKeyDataAddr The buffer address to restore private key file, should be
53 freed by caller.
54 @param[out] PrivateKeyDataSize The size of read private key file.
55
56 @retval EFI_SUCCESS Successfully read the private key file.
57 @retval EFI_INVALID_PARAMETER One or more of the parameters is invalid.
58
59 **/
60 EFI_STATUS
61 WifiMgrReadFileToBuffer (
62 IN WIFI_MGR_FILE_CONTEXT *FileContext,
63 OUT VOID **PrivateKeyDataAddr,
64 OUT UINTN *PrivateKeyDataSize
65 );
66
67
68 /**
69 Get the Nic data by the NicIndex.
70
71 @param[in] Private The pointer to the global private data structure.
72 @param[in] NicIndex The index indicates the position of wireless NIC.
73
74 @return Pointer to the Nic data, or NULL if not found.
75
76 **/
77 WIFI_MGR_DEVICE_DATA *
78 WifiMgrGetNicByIndex (
79 IN WIFI_MGR_PRIVATE_DATA *Private,
80 IN UINT32 NicIndex
81 );
82
83 /**
84 Find a network profile through its' SSId and securit type, and the SSId is an unicode string.
85
86 @param[in] SSId The target network's SSId.
87 @param[in] SecurityType The target network's security type.
88 @param[in] ProfileList The profile list on a Nic.
89
90 @return Pointer to a network profile, or NULL if not found.
91
92 **/
93 WIFI_MGR_NETWORK_PROFILE *
94 WifiMgrGetProfileByUnicodeSSId (
95 IN CHAR16 *SSId,
96 IN UINT8 SecurityType,
97 IN LIST_ENTRY *ProfileList
98 );
99
100 /**
101 Find a network profile through its' SSId and securit type, and the SSId is an ascii string.
102
103 @param[in] SSId The target network's SSId.
104 @param[in] SecurityType The target network's security type.
105 @param[in] ProfileList The profile list on a Nic.
106
107 @return Pointer to a network profile, or NULL if not found.
108
109 **/
110 WIFI_MGR_NETWORK_PROFILE *
111 WifiMgrGetProfileByAsciiSSId (
112 IN CHAR8 *SSId,
113 IN UINT8 SecurityType,
114 IN LIST_ENTRY *ProfileList
115 );
116
117 /**
118 Find a network profile through its' profile index.
119
120 @param[in] ProfileIndex The target network's profile index.
121 @param[in] ProfileList The profile list on a Nic.
122
123 @return Pointer to a network profile, or NULL if not found.
124
125 **/
126 WIFI_MGR_NETWORK_PROFILE *
127 WifiMgrGetProfileByProfileIndex (
128 IN UINT32 ProfileIndex,
129 IN LIST_ENTRY *ProfileList
130 );
131
132 /**
133 To test if the AKMSuite is in supported AKMSuite list.
134
135 @param[in] SupportedAKMSuiteCount The count of the supported AKMSuites.
136 @param[in] SupportedAKMSuiteList The supported AKMSuite list.
137 @param[in] AKMSuite The AKMSuite to be tested.
138
139 @return True if this AKMSuite is supported, or False if not.
140
141 **/
142 BOOLEAN
143 WifiMgrSupportAKMSuite (
144 IN UINT16 SupportedAKMSuiteCount,
145 IN UINT32 *SupportedAKMSuiteList,
146 IN UINT32 *AKMSuite
147 );
148
149 /**
150 To check if the CipherSuite is in supported CipherSuite list.
151
152 @param[in] SupportedCipherSuiteCount The count of the supported CipherSuites.
153 @param[in] SupportedCipherSuiteList The supported CipherSuite list.
154 @param[in] CipherSuite The CipherSuite to be tested.
155
156 @return True if this CipherSuite is supported, or False if not.
157
158 **/
159 BOOLEAN
160 WifiMgrSupportCipherSuite (
161 IN UINT16 SupportedCipherSuiteCount,
162 IN UINT32 *SupportedCipherSuiteList,
163 IN UINT32 *CipherSuite
164 );
165
166 /**
167 Check an AKM suite list and a Cipher suite list to see if one or more AKM suites or Cipher suites
168 are supported and find the matchable security type.
169
170 @param[in] AKMList The target AKM suite list to be checked.
171 @param[in] CipherList The target Cipher suite list to be checked
172 @param[in] Nic The Nic to operate, contains the supported AKMSuite list
173 and supported CipherSuite list
174 @param[out] SecurityType To identify a security type from the AKM suite list and
175 Cipher suite list
176 @param[out] AKMSuiteSupported To identify if this security type is supported. If it is
177 NULL, overcome this field
178 @param[out] CipherSuiteSupported To identify if this security type is supported. If it is
179 NULL, overcome this field
180
181 @retval EFI_SUCCESS This operation has completed successfully.
182 @retval EFI_INVALID_PARAMETER No Nic found or the suite list is null.
183
184 **/
185 EFI_STATUS
186 WifiMgrCheckRSN (
187 IN EFI_80211_AKM_SUITE_SELECTOR *AKMList,
188 IN EFI_80211_CIPHER_SUITE_SELECTOR *CipherList,
189 IN WIFI_MGR_DEVICE_DATA *Nic,
190 OUT UINT8 *SecurityType,
191 OUT BOOLEAN *AKMSuiteSupported,
192 OUT BOOLEAN *CipherSuiteSupported
193 );
194
195 /**
196 To get the security type for a certain AKMSuite and CipherSuite.
197
198 @param[in] AKMSuite An certain AKMSuite.
199 @param[in] CipherSuite An certain CipherSuite.
200
201 @return a security type if found, or SECURITY_TYPE_UNKNOWN.
202
203 **/
204 UINT8
205 WifiMgrGetSecurityType (
206 IN UINT32 *AKMSuite,
207 IN UINT32 *CipherSuite
208 );
209
210 /**
211 Get supported AKMSuites and CipherSuites from supplicant.
212
213 @param[in] Nic The Nic to operate.
214
215 @retval EFI_SUCCESS Get the supported suite list successfully.
216 @retval EFI_INVALID_PARAMETER No Nic found or supplicant is NULL.
217
218 **/
219 EFI_STATUS
220 WifiMgrGetSupportedSuites (
221 IN WIFI_MGR_DEVICE_DATA *Nic
222 );
223
224 /**
225 Clean secrets from a network profile.
226
227 @param[in] Profile The profile to be cleanned.
228
229 **/
230 VOID
231 WifiMgrCleanProfileSecrets (
232 IN WIFI_MGR_NETWORK_PROFILE *Profile
233 );
234
235 /**
236 Free all network profiles in a profile list.
237
238 @param[in] ProfileList The profile list to be freed.
239
240 **/
241 VOID
242 WifiMgrFreeProfileList (
243 IN LIST_ENTRY *ProfileList
244 );
245
246 /**
247 Free user configured hidden network list.
248
249 @param[in] HiddenList The hidden network list to be freed.
250
251 **/
252 VOID
253 WifiMgrFreeHiddenList (
254 IN LIST_ENTRY *HiddenList
255 );
256
257 /**
258 Free the resources of a config token.
259
260 @param[in] ConfigToken The config token to be freed.
261
262 **/
263 VOID
264 WifiMgrFreeToken (
265 IN WIFI_MGR_MAC_CONFIG_TOKEN *ConfigToken
266 );
267
268 #endif