]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/HttpDxe/HttpDriver.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / NetworkPkg / HttpDxe / HttpDriver.h
CommitLineData
47f51a06
YT
1/** @file\r
2 The header files of the driver binding and service binding protocol for HttpDxe driver.\r
3\r
ab796d3e 4 Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>\r
90f658c4 5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
47f51a06 6\r
ecf98fbc 7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
47f51a06
YT
8\r
9**/\r
10\r
11#ifndef __EFI_HTTP_DRIVER_H__\r
12#define __EFI_HTTP_DRIVER_H__\r
13\r
14#include <Uefi.h>\r
90f658c4 15#include <IndustryStandard/Http11.h>\r
47f51a06
YT
16\r
17//\r
18// Libraries\r
19//\r
20#include <Library/UefiBootServicesTableLib.h>\r
dac45de3 21#include <Library/UefiRuntimeServicesTableLib.h>\r
47f51a06
YT
22#include <Library/MemoryAllocationLib.h>\r
23#include <Library/BaseLib.h>\r
24#include <Library/UefiLib.h>\r
25#include <Library/DebugLib.h>\r
26#include <Library/NetLib.h>\r
27#include <Library/HttpLib.h>\r
49c9f74c 28#include <Library/DpcLib.h>\r
47f51a06
YT
29\r
30//\r
31// UEFI Driver Model Protocols\r
32//\r
33#include <Protocol/DriverBinding.h>\r
34#include <Protocol/ServiceBinding.h>\r
35#include <Protocol/ComponentName2.h>\r
36#include <Protocol/ComponentName.h>\r
37\r
38//\r
39// Consumed Protocols\r
40//\r
5ca29abe 41#include <Protocol/HttpUtilities.h>\r
47f51a06 42#include <Protocol/Tcp4.h>\r
b659408b 43#include <Protocol/Tcp6.h>\r
47f51a06 44#include <Protocol/Dns4.h>\r
b659408b 45#include <Protocol/Dns6.h>\r
47f51a06 46#include <Protocol/Ip4Config2.h>\r
b659408b 47#include <Protocol/Ip6Config.h>\r
dac45de3
JW
48#include <Protocol/Tls.h>\r
49#include <Protocol/TlsConfig.h>\r
ab796d3e 50#include <Protocol/HttpCallback.h>\r
b659408b 51\r
dac45de3 52#include <Guid/ImageAuthentication.h>\r
47f51a06
YT
53//\r
54// Produced Protocols\r
55//\r
56#include <Protocol/Http.h>\r
57\r
dac45de3 58#include <Guid/TlsAuthentication.h>\r
7ff68b5e 59#include <Guid/HttpTlsCipherList.h>\r
dac45de3
JW
60\r
61#include <IndustryStandard/Tls1.h>\r
62\r
47f51a06
YT
63//\r
64// Driver Version\r
65//\r
d1050b9d 66#define HTTP_DRIVER_VERSION 0xa\r
47f51a06
YT
67\r
68//\r
69// Protocol instances\r
70//\r
b659408b
ZL
71extern EFI_DRIVER_BINDING_PROTOCOL gHttpDxeIp4DriverBinding;\r
72extern EFI_DRIVER_BINDING_PROTOCOL gHttpDxeIp6DriverBinding;\r
73\r
d1050b9d
MK
74extern EFI_COMPONENT_NAME2_PROTOCOL gHttpDxeComponentName2;\r
75extern EFI_COMPONENT_NAME_PROTOCOL gHttpDxeComponentName;\r
47f51a06 76\r
5ca29abe
JW
77extern EFI_HTTP_UTILITIES_PROTOCOL *mHttpUtilities;\r
78\r
47f51a06
YT
79//\r
80// Include files with function prototypes\r
81//\r
82#include "ComponentName.h"\r
83#include "HttpImpl.h"\r
84#include "HttpProto.h"\r
dac45de3 85#include "HttpsSupport.h"\r
47f51a06 86#include "HttpDns.h"\r
47f51a06
YT
87\r
88typedef struct {\r
d1050b9d
MK
89 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;\r
90 UINTN NumberOfChildren;\r
91 EFI_HANDLE *ChildHandleBuffer;\r
47f51a06
YT
92} HTTP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;\r
93\r
94/**\r
f75a7f56 95 Tests to see if this driver supports a given controller. If a child device is provided,\r
47f51a06
YT
96 it further tests to see if this driver supports creating a handle for the specified child device.\r
97\r
f75a7f56
LG
98 This function checks to see if the driver specified by This supports the device specified by\r
99 ControllerHandle. Drivers will typically use the device path attached to\r
100 ControllerHandle and/or the services from the bus I/O abstraction attached to\r
101 ControllerHandle to determine if the driver supports ControllerHandle. This function\r
102 may be called many times during platform initialization. In order to reduce boot times, the tests\r
103 performed by this function must be very small, and take as little time as possible to execute. This\r
104 function must not change the state of any hardware devices, and this function must be aware that the\r
105 device specified by ControllerHandle may already be managed by the same driver or a\r
106 different driver. This function must match its calls to AllocatePages() with FreePages(),\r
107 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().\r
108 Because ControllerHandle may have been previously started by the same driver, if a protocol is\r
109 already in the opened state, then it must not be closed with CloseProtocol(). This is required\r
47f51a06
YT
110 to guarantee the state of ControllerHandle is not modified by this function.\r
111\r
112 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
f75a7f56
LG
113 @param[in] ControllerHandle The handle of the controller to test. This handle\r
114 must support a protocol interface that supplies\r
47f51a06 115 an I/O abstraction to the driver.\r
f75a7f56
LG
116 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r
117 parameter is ignored by device drivers, and is optional for bus\r
118 drivers. For bus drivers, if this parameter is not NULL, then\r
119 the bus driver must determine if the bus controller specified\r
120 by ControllerHandle and the child controller specified\r
121 by RemainingDevicePath are both supported by this\r
47f51a06
YT
122 bus driver.\r
123\r
124 @retval EFI_SUCCESS The device specified by ControllerHandle and\r
125 RemainingDevicePath is supported by the driver specified by This.\r
126 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r
127 RemainingDevicePath is already being managed by the driver\r
128 specified by This.\r
129 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r
130 RemainingDevicePath is already being managed by a different\r
131 driver or an application that requires exclusive access.\r
132 Currently not implemented.\r
133 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r
134 RemainingDevicePath is not supported by the driver specified by This.\r
135**/\r
136EFI_STATUS\r
137EFIAPI\r
b659408b 138HttpDxeIp4DriverBindingSupported (\r
47f51a06
YT
139 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
140 IN EFI_HANDLE ControllerHandle,\r
141 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
142 );\r
143\r
144/**\r
145 Starts a device controller or a bus controller.\r
146\r
147 The Start() function is designed to be invoked from the EFI boot service ConnectController().\r
f75a7f56
LG
148 As a result, much of the error checking on the parameters to Start() has been moved into this\r
149 common boot service. It is legal to call Start() from other locations,\r
47f51a06
YT
150 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
151 1. ControllerHandle must be a valid EFI_HANDLE.\r
152 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
153 EFI_DEVICE_PATH_PROTOCOL.\r
154 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
f75a7f56 155 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\r
47f51a06
YT
156\r
157 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
f75a7f56
LG
158 @param[in] ControllerHandle The handle of the controller to start. This handle\r
159 must support a protocol interface that supplies\r
47f51a06 160 an I/O abstraction to the driver.\r
f75a7f56
LG
161 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r
162 parameter is ignored by device drivers, and is optional for bus\r
163 drivers. For a bus driver, if this parameter is NULL, then handles\r
164 for all the children of Controller are created by this driver.\r
165 If this parameter is not NULL and the first Device Path Node is\r
166 not the End of Device Path Node, then only the handle for the\r
167 child device specified by the first Device Path Node of\r
47f51a06 168 RemainingDevicePath is created by this driver.\r
f75a7f56 169 If the first Device Path Node of RemainingDevicePath is\r
47f51a06
YT
170 the End of Device Path Node, no child handle is created by this\r
171 driver.\r
172\r
173 @retval EFI_SUCCESS The device was started.\r
174 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r
175 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
ba3b642d 176 @retval Others The driver failed to start the device.\r
47f51a06
YT
177\r
178**/\r
179EFI_STATUS\r
180EFIAPI\r
b659408b 181HttpDxeIp4DriverBindingStart (\r
47f51a06
YT
182 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
183 IN EFI_HANDLE ControllerHandle,\r
184 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
185 );\r
186\r
187/**\r
188 Stops a device controller or a bus controller.\r
f75a7f56
LG
189\r
190 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r
191 As a result, much of the error checking on the parameters to Stop() has been moved\r
192 into this common boot service. It is legal to call Stop() from other locations,\r
47f51a06
YT
193 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
194 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
195 same driver's Start() function.\r
196 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
197 EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
198 Start() function, and the Start() function must have called OpenProtocol() on\r
199 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
f75a7f56 200\r
47f51a06 201 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
f75a7f56
LG
202 @param[in] ControllerHandle A handle to the device being stopped. The handle must\r
203 support a bus specific I/O protocol for the driver\r
47f51a06
YT
204 to use to stop the device.\r
205 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
f75a7f56 206 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r
47f51a06
YT
207 if NumberOfChildren is 0.\r
208\r
209 @retval EFI_SUCCESS The device was stopped.\r
210 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
211\r
212**/\r
213EFI_STATUS\r
214EFIAPI\r
b659408b 215HttpDxeIp4DriverBindingStop (\r
47f51a06
YT
216 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
217 IN EFI_HANDLE ControllerHandle,\r
218 IN UINTN NumberOfChildren,\r
219 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
220 );\r
221\r
b659408b 222/**\r
f75a7f56 223 Tests to see if this driver supports a given controller. If a child device is provided,\r
b659408b
ZL
224 it further tests to see if this driver supports creating a handle for the specified child device.\r
225\r
f75a7f56
LG
226 This function checks to see if the driver specified by This supports the device specified by\r
227 ControllerHandle. Drivers will typically use the device path attached to\r
228 ControllerHandle and/or the services from the bus I/O abstraction attached to\r
229 ControllerHandle to determine if the driver supports ControllerHandle. This function\r
230 may be called many times during platform initialization. In order to reduce boot times, the tests\r
231 performed by this function must be very small, and take as little time as possible to execute. This\r
232 function must not change the state of any hardware devices, and this function must be aware that the\r
233 device specified by ControllerHandle may already be managed by the same driver or a\r
234 different driver. This function must match its calls to AllocatePages() with FreePages(),\r
235 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().\r
236 Because ControllerHandle may have been previously started by the same driver, if a protocol is\r
237 already in the opened state, then it must not be closed with CloseProtocol(). This is required\r
b659408b
ZL
238 to guarantee the state of ControllerHandle is not modified by this function.\r
239\r
240 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
f75a7f56
LG
241 @param[in] ControllerHandle The handle of the controller to test. This handle\r
242 must support a protocol interface that supplies\r
b659408b 243 an I/O abstraction to the driver.\r
f75a7f56
LG
244 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r
245 parameter is ignored by device drivers, and is optional for bus\r
246 drivers. For bus drivers, if this parameter is not NULL, then\r
247 the bus driver must determine if the bus controller specified\r
248 by ControllerHandle and the child controller specified\r
249 by RemainingDevicePath are both supported by this\r
b659408b
ZL
250 bus driver.\r
251\r
252 @retval EFI_SUCCESS The device specified by ControllerHandle and\r
253 RemainingDevicePath is supported by the driver specified by This.\r
254 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r
255 RemainingDevicePath is already being managed by the driver\r
256 specified by This.\r
257 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r
258 RemainingDevicePath is already being managed by a different\r
259 driver or an application that requires exclusive access.\r
260 Currently not implemented.\r
261 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r
262 RemainingDevicePath is not supported by the driver specified by This.\r
263**/\r
264EFI_STATUS\r
265EFIAPI\r
266HttpDxeIp6DriverBindingSupported (\r
267 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
268 IN EFI_HANDLE ControllerHandle,\r
269 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
270 );\r
271\r
272/**\r
273 Starts a device controller or a bus controller.\r
274\r
275 The Start() function is designed to be invoked from the EFI boot service ConnectController().\r
f75a7f56
LG
276 As a result, much of the error checking on the parameters to Start() has been moved into this\r
277 common boot service. It is legal to call Start() from other locations,\r
b659408b
ZL
278 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
279 1. ControllerHandle must be a valid EFI_HANDLE.\r
280 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
281 EFI_DEVICE_PATH_PROTOCOL.\r
282 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
f75a7f56 283 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\r
b659408b
ZL
284\r
285 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
f75a7f56
LG
286 @param[in] ControllerHandle The handle of the controller to start. This handle\r
287 must support a protocol interface that supplies\r
b659408b 288 an I/O abstraction to the driver.\r
f75a7f56
LG
289 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r
290 parameter is ignored by device drivers, and is optional for bus\r
291 drivers. For a bus driver, if this parameter is NULL, then handles\r
292 for all the children of Controller are created by this driver.\r
293 If this parameter is not NULL and the first Device Path Node is\r
294 not the End of Device Path Node, then only the handle for the\r
295 child device specified by the first Device Path Node of\r
b659408b 296 RemainingDevicePath is created by this driver.\r
f75a7f56 297 If the first Device Path Node of RemainingDevicePath is\r
b659408b
ZL
298 the End of Device Path Node, no child handle is created by this\r
299 driver.\r
300\r
301 @retval EFI_SUCCESS The device was started.\r
302 @retval EFI_ALREADY_STARTED This device is already running on ControllerHandle.\r
303 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r
304 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
ba3b642d 305 @retval Others The driver failed to start the device.\r
b659408b
ZL
306\r
307**/\r
308EFI_STATUS\r
309EFIAPI\r
310HttpDxeIp6DriverBindingStart (\r
311 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
312 IN EFI_HANDLE ControllerHandle,\r
313 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
314 );\r
315\r
316/**\r
317 Stops a device controller or a bus controller.\r
f75a7f56
LG
318\r
319 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r
320 As a result, much of the error checking on the parameters to Stop() has been moved\r
321 into this common boot service. It is legal to call Stop() from other locations,\r
b659408b
ZL
322 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
323 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
324 same driver's Start() function.\r
325 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
326 EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
327 Start() function, and the Start() function must have called OpenProtocol() on\r
328 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
f75a7f56 329\r
b659408b 330 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
f75a7f56
LG
331 @param[in] ControllerHandle A handle to the device being stopped. The handle must\r
332 support a bus specific I/O protocol for the driver\r
b659408b
ZL
333 to use to stop the device.\r
334 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
f75a7f56 335 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r
b659408b
ZL
336 if NumberOfChildren is 0.\r
337\r
338 @retval EFI_SUCCESS The device was stopped.\r
339 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
340\r
341**/\r
342EFI_STATUS\r
343EFIAPI\r
344HttpDxeIp6DriverBindingStop (\r
345 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
346 IN EFI_HANDLE ControllerHandle,\r
347 IN UINTN NumberOfChildren,\r
348 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
349 );\r
350\r
47f51a06
YT
351/**\r
352 Creates a child handle and installs a protocol.\r
353\r
354 The CreateChild() function installs a protocol on ChildHandle.\r
355 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.\r
356 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r
357\r
358 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
359 @param ChildHandle Pointer to the handle of the child to create. If it is NULL,\r
360 then a new handle is created. If it is a pointer to an existing UEFI handle,\r
361 then the protocol is added to the existing UEFI handle.\r
362\r
ba3b642d 363 @retval EFI_SUCCESS The protocol was added to ChildHandle.\r
47f51a06 364 @retval EFI_INVALID_PARAMETER This is NULL, or ChildHandle is NULL.\r
c2adf51f 365 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create\r
47f51a06
YT
366 the child.\r
367 @retval other The child handle was not created.\r
368\r
369**/\r
370EFI_STATUS\r
371EFIAPI\r
372HttpServiceBindingCreateChild (\r
373 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
374 IN OUT EFI_HANDLE *ChildHandle\r
375 );\r
376\r
377/**\r
378 Destroys a child handle with a protocol installed on it.\r
379\r
380 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol\r
381 that was installed by CreateChild() from ChildHandle. If the removed protocol is the\r
382 last protocol on ChildHandle, then ChildHandle is destroyed.\r
383\r
384 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
385 @param ChildHandle Handle of the child to destroy\r
386\r
ba3b642d 387 @retval EFI_SUCCESS The protocol was removed from ChildHandle.\r
47f51a06
YT
388 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.\r
389 @retval EFI_INVALID_PARAMETER Child handle is NULL.\r
390 @retval other The child handle was not destroyed\r
391\r
392**/\r
393EFI_STATUS\r
394EFIAPI\r
395HttpServiceBindingDestroyChild (\r
396 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
397 IN EFI_HANDLE ChildHandle\r
398 );\r
399\r
47f51a06 400#endif\r