]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h
ArmPkg: only attempt buildin MmCommunicationDxe for AArch64
[mirror_edk2.git] / NetworkPkg / TlsAuthConfigDxe / TlsAuthConfigImpl.h
CommitLineData
7618784b
HW
1/** @file\r
2 Header file of Miscellaneous Routines for TlsAuthConfigDxe driver.\r
3\r
4Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
5\r
ecf98fbc 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
7618784b
HW
7\r
8**/\r
9\r
10#ifndef __TLS_AUTH_CONFIG_IMPL_H__\r
11#define __TLS_AUTH_CONFIG_IMPL_H__\r
12\r
13#include <Uefi.h>\r
14\r
15#include <Protocol/HiiConfigAccess.h>\r
16#include <Protocol/SimpleFileSystem.h>\r
ddfb0ab1 17#include <Protocol/HiiPopup.h>\r
7618784b
HW
18\r
19//\r
20// Libraries\r
21//\r
22#include <Library/UefiBootServicesTableLib.h>\r
23#include <Library/UefiRuntimeServicesTableLib.h>\r
24#include <Library/MemoryAllocationLib.h>\r
25#include <Library/BaseMemoryLib.h>\r
26#include <Library/BaseLib.h>\r
27#include <Library/UefiLib.h>\r
28#include <Library/DebugLib.h>\r
29#include <Library/DevicePathLib.h>\r
30#include <Library/HiiLib.h>\r
31#include <Library/UefiHiiServicesLib.h>\r
32#include <Library/FileExplorerLib.h>\r
33#include <Library/PrintLib.h>\r
34\r
35#include <Guid/MdeModuleHii.h>\r
36#include <Guid/ImageAuthentication.h>\r
37#include <Guid/TlsAuthentication.h>\r
38\r
39\r
40//\r
41// Include files with function prototypes\r
42//\r
43#include "TlsAuthConfigNvData.h"\r
44\r
45extern UINT8 TlsAuthConfigDxeStrings[];\r
46extern UINT8 TlsAuthConfigVfrBin[];\r
47\r
48#define TLS_AUTH_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'A', 'C', 'D')\r
49#define TLS_AUTH_CONFIG_PRIVATE_FROM_THIS(a) CR (a, TLS_AUTH_CONFIG_PRIVATE_DATA, ConfigAccess, TLS_AUTH_CONFIG_PRIVATE_DATA_SIGNATURE)\r
50\r
51#define TLS_AUTH_CONFIG_VAR_BASE_ATTR (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)\r
52\r
53typedef struct _TLS_AUTH_CONFIG_PRIVATE_DATA TLS_AUTH_CONFIG_PRIVATE_DATA;\r
54typedef struct _TLS_AUTH_CONFIG_FILE_CONTEXT TLS_AUTH_CONFIG_FILE_CONTEXT;\r
55\r
56///\r
57/// HII specific Vendor Device Path definition.\r
58///\r
59typedef struct {\r
60 VENDOR_DEVICE_PATH VendorDevicePath;\r
61 EFI_DEVICE_PATH_PROTOCOL End;\r
62} HII_VENDOR_DEVICE_PATH;\r
63\r
64struct _TLS_AUTH_CONFIG_FILE_CONTEXT {\r
65 EFI_FILE_HANDLE FHandle;\r
66 UINT16 *FileName;\r
67};\r
68\r
69struct _TLS_AUTH_CONFIG_PRIVATE_DATA {\r
70 UINTN Signature;\r
71\r
72 EFI_HANDLE DriverHandle;\r
73 EFI_HII_HANDLE RegisteredHandle;\r
74 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
75 TLS_AUTH_CONFIG_IFR_NVDATA TlsAuthConfigNvData;\r
76\r
77 TLS_AUTH_CONFIG_FILE_CONTEXT *FileContext;\r
78\r
79 EFI_GUID *CertGuid;\r
80};\r
81\r
82/**\r
83 Unload the configuration form, this includes: delete all the configuration\r
84 entries, uninstall the form callback protocol, and free the resources used.\r
85 The form will only be unload completely when both IP4 and IP6 stack are stopped.\r
86\r
87 @param[in] Private Pointer to the driver private data.\r
88\r
89 @retval EFI_SUCCESS The configuration form is unloaded.\r
90 @retval Others Failed to unload the form.\r
91\r
92**/\r
93EFI_STATUS\r
94TlsAuthConfigFormUnload (\r
95 IN TLS_AUTH_CONFIG_PRIVATE_DATA *Private\r
96 );\r
97\r
98/**\r
99 Initialize the configuration form.\r
100\r
101 @param[in] Private Pointer to the driver private data.\r
102\r
103 @retval EFI_SUCCESS The configuration form is initialized.\r
104 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
105\r
106**/\r
107EFI_STATUS\r
108TlsAuthConfigFormInit (\r
109 IN TLS_AUTH_CONFIG_PRIVATE_DATA *Private\r
110 );\r
111\r
112/**\r
113\r
114 This function allows the caller to request the current\r
115 configuration for one or more named elements. The resulting\r
116 string is in <ConfigAltResp> format. Any and all alternative\r
117 configuration strings shall also be appended to the end of the\r
118 current configuration string. If they are, they must appear\r
119 after the current configuration. They must contain the same\r
120 routing (GUID, NAME, PATH) as the current configuration string.\r
121 They must have an additional description indicating the type of\r
122 alternative configuration the string represents,\r
123 "ALTCFG=<StringToken>". That <StringToken> (when\r
124 converted from Hex UNICODE to binary) is a reference to a\r
125 string in the associated string pack.\r
126\r
127 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
128\r
129 @param Request A null-terminated Unicode string in\r
130 <ConfigRequest> format. Note that this\r
131 includes the routing information as well as\r
132 the configurable name / value pairs. It is\r
133 invalid for this string to be in\r
134 <MultiConfigRequest> format.\r
135 If a NULL is passed in for the Request field,\r
136 all of the settings being abstracted by this function\r
137 will be returned in the Results field. In addition,\r
138 if a ConfigHdr is passed in with no request elements,\r
139 all of the settings being abstracted for that particular\r
140 ConfigHdr reference will be returned in the Results Field.\r
141\r
142 @param Progress On return, points to a character in the\r
143 Request string. Points to the string's null\r
144 terminator if request was successful. Points\r
145 to the most recent "&" before the first\r
146 failing name / value pair (or the beginning\r
147 of the string if the failure is in the first\r
148 name / value pair) if the request was not\r
149 successful.\r
150\r
151 @param Results A null-terminated Unicode string in\r
152 <MultiConfigAltResp> format which has all values\r
153 filled in for the names in the Request string.\r
154 String to be allocated by the called function.\r
155\r
156 @retval EFI_SUCCESS The Results string is filled with the\r
157 values corresponding to all requested\r
158 names.\r
159\r
160 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the\r
161 parts of the results that must be\r
162 stored awaiting possible future\r
163 protocols.\r
164\r
165 @retval EFI_NOT_FOUND Routing data doesn't match any\r
166 known driver. Progress set to the\r
167 first character in the routing header.\r
168 Note: There is no requirement that the\r
169 driver validate the routing data. It\r
170 must skip the <ConfigHdr> in order to\r
171 process the names.\r
172\r
173 @retval EFI_INVALID_PARAMETER Illegal syntax. Progress set\r
174 to most recent "&" before the\r
175 error or the beginning of the\r
176 string.\r
177\r
178 @retval EFI_INVALID_PARAMETER Unknown name. Progress points\r
179 to the & before the name in\r
180 question.\r
181\r
182**/\r
183EFI_STATUS\r
184EFIAPI\r
185TlsAuthConfigAccessExtractConfig (\r
186 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
187 IN CONST EFI_STRING Request,\r
188 OUT EFI_STRING *Progress,\r
189 OUT EFI_STRING *Results\r
190 );\r
191\r
192/**\r
193\r
194 This function applies changes in a driver's configuration.\r
195 Input is a Configuration, which has the routing data for this\r
196 driver followed by name / value configuration pairs. The driver\r
197 must apply those pairs to its configurable storage. If the\r
198 driver's configuration is stored in a linear block of data\r
199 and the driver's name / value pairs are in <BlockConfig>\r
200 format, it may use the ConfigToBlock helper function (above) to\r
201 simplify the job.\r
202\r
203 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
204\r
205 @param Configuration A null-terminated Unicode string in\r
206 <ConfigString> format.\r
207\r
208 @param Progress A pointer to a string filled in with the\r
209 offset of the most recent '&' before the\r
210 first failing name / value pair (or the\r
dad13c80 211 beginning of the string if the failure\r
7618784b
HW
212 is in the first name / value pair) or\r
213 the terminating NULL if all was\r
214 successful.\r
215\r
216 @retval EFI_SUCCESS The results have been distributed or are\r
217 awaiting distribution.\r
218\r
219 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the\r
220 parts of the results that must be\r
221 stored awaiting possible future\r
222 protocols.\r
223\r
224 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the\r
225 Results parameter would result\r
226 in this type of error.\r
227\r
228 @retval EFI_NOT_FOUND Target for the specified routing data\r
229 was not found\r
230\r
231**/\r
232EFI_STATUS\r
233EFIAPI\r
234TlsAuthConfigAccessRouteConfig (\r
235 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
236 IN CONST EFI_STRING Configuration,\r
237 OUT EFI_STRING *Progress\r
238 );\r
239\r
240/**\r
241\r
242 This function is called to provide results data to the driver.\r
243 This data consists of a unique key that is used to identify\r
244 which data is either being passed back or being asked for.\r
245\r
246 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
247 @param Action Specifies the type of action taken by the browser.\r
248 @param QuestionId A unique value which is sent to the original\r
249 exporting driver so that it can identify the type\r
250 of data to expect. The format of the data tends to\r
251 vary based on the opcode that generated the callback.\r
252 @param Type The type of value for the question.\r
253 @param Value A pointer to the data being sent to the original\r
254 exporting driver.\r
255 @param ActionRequest On return, points to the action requested by the\r
256 callback function.\r
257\r
258 @retval EFI_SUCCESS The callback successfully handled the action.\r
259 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the\r
260 variable and its data.\r
261 @retval EFI_DEVICE_ERROR The variable could not be saved.\r
262 @retval EFI_UNSUPPORTED The specified Action is not supported by the\r
263 callback.\r
264**/\r
265EFI_STATUS\r
266EFIAPI\r
267TlsAuthConfigAccessCallback (\r
268 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
269 IN EFI_BROWSER_ACTION Action,\r
270 IN EFI_QUESTION_ID QuestionId,\r
271 IN UINT8 Type,\r
272 IN OUT EFI_IFR_TYPE_VALUE *Value,\r
273 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
274 );\r
275\r
276#endif\r
277\r