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