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