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