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