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