2 The header files of the driver binding and service binding protocol for HttpDxe driver.
4 Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #ifndef __EFI_HTTP_DRIVER_H__
12 #define __EFI_HTTP_DRIVER_H__
15 #include <IndustryStandard/Http11.h>
20 #include <Library/UefiBootServicesTableLib.h>
21 #include <Library/UefiRuntimeServicesTableLib.h>
22 #include <Library/MemoryAllocationLib.h>
23 #include <Library/BaseLib.h>
24 #include <Library/UefiLib.h>
25 #include <Library/DebugLib.h>
26 #include <Library/NetLib.h>
27 #include <Library/HttpLib.h>
28 #include <Library/DpcLib.h>
31 // UEFI Driver Model Protocols
33 #include <Protocol/DriverBinding.h>
34 #include <Protocol/ServiceBinding.h>
35 #include <Protocol/ComponentName2.h>
36 #include <Protocol/ComponentName.h>
41 #include <Protocol/HttpUtilities.h>
42 #include <Protocol/Tcp4.h>
43 #include <Protocol/Tcp6.h>
44 #include <Protocol/Dns4.h>
45 #include <Protocol/Dns6.h>
46 #include <Protocol/Ip4Config2.h>
47 #include <Protocol/Ip6Config.h>
48 #include <Protocol/Tls.h>
49 #include <Protocol/TlsConfig.h>
50 #include <Protocol/HttpCallback.h>
52 #include <Guid/ImageAuthentication.h>
56 #include <Protocol/Http.h>
58 #include <Guid/TlsAuthentication.h>
59 #include <Guid/HttpTlsCipherList.h>
61 #include <IndustryStandard/Tls1.h>
66 #define HTTP_DRIVER_VERSION 0xa
71 extern EFI_DRIVER_BINDING_PROTOCOL gHttpDxeIp4DriverBinding
;
72 extern EFI_DRIVER_BINDING_PROTOCOL gHttpDxeIp6DriverBinding
;
74 extern EFI_COMPONENT_NAME2_PROTOCOL gHttpDxeComponentName2
;
75 extern EFI_COMPONENT_NAME_PROTOCOL gHttpDxeComponentName
;
77 extern EFI_HTTP_UTILITIES_PROTOCOL
*mHttpUtilities
;
80 // Include files with function prototypes
82 #include "ComponentName.h"
84 #include "HttpProto.h"
85 #include "HttpsSupport.h"
89 EFI_SERVICE_BINDING_PROTOCOL
*ServiceBinding
;
90 UINTN NumberOfChildren
;
91 EFI_HANDLE
*ChildHandleBuffer
;
92 } HTTP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT
;
95 Tests to see if this driver supports a given controller. If a child device is provided,
96 it further tests to see if this driver supports creating a handle for the specified child device.
98 This function checks to see if the driver specified by This supports the device specified by
99 ControllerHandle. Drivers will typically use the device path attached to
100 ControllerHandle and/or the services from the bus I/O abstraction attached to
101 ControllerHandle to determine if the driver supports ControllerHandle. This function
102 may be called many times during platform initialization. In order to reduce boot times, the tests
103 performed by this function must be very small, and take as little time as possible to execute. This
104 function must not change the state of any hardware devices, and this function must be aware that the
105 device specified by ControllerHandle may already be managed by the same driver or a
106 different driver. This function must match its calls to AllocatePages() with FreePages(),
107 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
108 Because ControllerHandle may have been previously started by the same driver, if a protocol is
109 already in the opened state, then it must not be closed with CloseProtocol(). This is required
110 to guarantee the state of ControllerHandle is not modified by this function.
112 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
113 @param[in] ControllerHandle The handle of the controller to test. This handle
114 must support a protocol interface that supplies
115 an I/O abstraction to the driver.
116 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
117 parameter is ignored by device drivers, and is optional for bus
118 drivers. For bus drivers, if this parameter is not NULL, then
119 the bus driver must determine if the bus controller specified
120 by ControllerHandle and the child controller specified
121 by RemainingDevicePath are both supported by this
124 @retval EFI_SUCCESS The device specified by ControllerHandle and
125 RemainingDevicePath is supported by the driver specified by This.
126 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
127 RemainingDevicePath is already being managed by the driver
129 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
130 RemainingDevicePath is already being managed by a different
131 driver or an application that requires exclusive access.
132 Currently not implemented.
133 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
134 RemainingDevicePath is not supported by the driver specified by This.
138 HttpDxeIp4DriverBindingSupported (
139 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
140 IN EFI_HANDLE ControllerHandle
,
141 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
145 Starts a device controller or a bus controller.
147 The Start() function is designed to be invoked from the EFI boot service ConnectController().
148 As a result, much of the error checking on the parameters to Start() has been moved into this
149 common boot service. It is legal to call Start() from other locations,
150 but the following calling restrictions must be followed, or the system behavior will not be deterministic.
151 1. ControllerHandle must be a valid EFI_HANDLE.
152 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
153 EFI_DEVICE_PATH_PROTOCOL.
154 3. Prior to calling Start(), the Supported() function for the driver specified by This must
155 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
157 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
158 @param[in] ControllerHandle The handle of the controller to start. This handle
159 must support a protocol interface that supplies
160 an I/O abstraction to the driver.
161 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
162 parameter is ignored by device drivers, and is optional for bus
163 drivers. For a bus driver, if this parameter is NULL, then handles
164 for all the children of Controller are created by this driver.
165 If this parameter is not NULL and the first Device Path Node is
166 not the End of Device Path Node, then only the handle for the
167 child device specified by the first Device Path Node of
168 RemainingDevicePath is created by this driver.
169 If the first Device Path Node of RemainingDevicePath is
170 the End of Device Path Node, no child handle is created by this
173 @retval EFI_SUCCESS The device was started.
174 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
175 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
176 @retval Others The driver failed to start the device.
181 HttpDxeIp4DriverBindingStart (
182 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
183 IN EFI_HANDLE ControllerHandle
,
184 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
188 Stops a device controller or a bus controller.
190 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
191 As a result, much of the error checking on the parameters to Stop() has been moved
192 into this common boot service. It is legal to call Stop() from other locations,
193 but the following calling restrictions must be followed, or the system behavior will not be deterministic.
194 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
195 same driver's Start() function.
196 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
197 EFI_HANDLE. In addition, all of these handles must have been created in this driver's
198 Start() function, and the Start() function must have called OpenProtocol() on
199 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
201 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
202 @param[in] ControllerHandle A handle to the device being stopped. The handle must
203 support a bus specific I/O protocol for the driver
204 to use to stop the device.
205 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
206 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
207 if NumberOfChildren is 0.
209 @retval EFI_SUCCESS The device was stopped.
210 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
215 HttpDxeIp4DriverBindingStop (
216 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
217 IN EFI_HANDLE ControllerHandle
,
218 IN UINTN NumberOfChildren
,
219 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
223 Tests to see if this driver supports a given controller. If a child device is provided,
224 it further tests to see if this driver supports creating a handle for the specified child device.
226 This function checks to see if the driver specified by This supports the device specified by
227 ControllerHandle. Drivers will typically use the device path attached to
228 ControllerHandle and/or the services from the bus I/O abstraction attached to
229 ControllerHandle to determine if the driver supports ControllerHandle. This function
230 may be called many times during platform initialization. In order to reduce boot times, the tests
231 performed by this function must be very small, and take as little time as possible to execute. This
232 function must not change the state of any hardware devices, and this function must be aware that the
233 device specified by ControllerHandle may already be managed by the same driver or a
234 different driver. This function must match its calls to AllocatePages() with FreePages(),
235 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
236 Because ControllerHandle may have been previously started by the same driver, if a protocol is
237 already in the opened state, then it must not be closed with CloseProtocol(). This is required
238 to guarantee the state of ControllerHandle is not modified by this function.
240 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
241 @param[in] ControllerHandle The handle of the controller to test. This handle
242 must support a protocol interface that supplies
243 an I/O abstraction to the driver.
244 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
245 parameter is ignored by device drivers, and is optional for bus
246 drivers. For bus drivers, if this parameter is not NULL, then
247 the bus driver must determine if the bus controller specified
248 by ControllerHandle and the child controller specified
249 by RemainingDevicePath are both supported by this
252 @retval EFI_SUCCESS The device specified by ControllerHandle and
253 RemainingDevicePath is supported by the driver specified by This.
254 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
255 RemainingDevicePath is already being managed by the driver
257 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
258 RemainingDevicePath is already being managed by a different
259 driver or an application that requires exclusive access.
260 Currently not implemented.
261 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
262 RemainingDevicePath is not supported by the driver specified by This.
266 HttpDxeIp6DriverBindingSupported (
267 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
268 IN EFI_HANDLE ControllerHandle
,
269 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
273 Starts a device controller or a bus controller.
275 The Start() function is designed to be invoked from the EFI boot service ConnectController().
276 As a result, much of the error checking on the parameters to Start() has been moved into this
277 common boot service. It is legal to call Start() from other locations,
278 but the following calling restrictions must be followed, or the system behavior will not be deterministic.
279 1. ControllerHandle must be a valid EFI_HANDLE.
280 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
281 EFI_DEVICE_PATH_PROTOCOL.
282 3. Prior to calling Start(), the Supported() function for the driver specified by This must
283 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
285 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
286 @param[in] ControllerHandle The handle of the controller to start. This handle
287 must support a protocol interface that supplies
288 an I/O abstraction to the driver.
289 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
290 parameter is ignored by device drivers, and is optional for bus
291 drivers. For a bus driver, if this parameter is NULL, then handles
292 for all the children of Controller are created by this driver.
293 If this parameter is not NULL and the first Device Path Node is
294 not the End of Device Path Node, then only the handle for the
295 child device specified by the first Device Path Node of
296 RemainingDevicePath is created by this driver.
297 If the first Device Path Node of RemainingDevicePath is
298 the End of Device Path Node, no child handle is created by this
301 @retval EFI_SUCCESS The device was started.
302 @retval EFI_ALREADY_STARTED This device is already running on ControllerHandle.
303 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
304 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
305 @retval Others The driver failed to start the device.
310 HttpDxeIp6DriverBindingStart (
311 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
312 IN EFI_HANDLE ControllerHandle
,
313 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
317 Stops a device controller or a bus controller.
319 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
320 As a result, much of the error checking on the parameters to Stop() has been moved
321 into this common boot service. It is legal to call Stop() from other locations,
322 but the following calling restrictions must be followed, or the system behavior will not be deterministic.
323 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
324 same driver's Start() function.
325 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
326 EFI_HANDLE. In addition, all of these handles must have been created in this driver's
327 Start() function, and the Start() function must have called OpenProtocol() on
328 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
330 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
331 @param[in] ControllerHandle A handle to the device being stopped. The handle must
332 support a bus specific I/O protocol for the driver
333 to use to stop the device.
334 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
335 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
336 if NumberOfChildren is 0.
338 @retval EFI_SUCCESS The device was stopped.
339 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
344 HttpDxeIp6DriverBindingStop (
345 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
346 IN EFI_HANDLE ControllerHandle
,
347 IN UINTN NumberOfChildren
,
348 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
352 Creates a child handle and installs a protocol.
354 The CreateChild() function installs a protocol on ChildHandle.
355 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
356 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
358 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
359 @param ChildHandle Pointer to the handle of the child to create. If it is NULL,
360 then a new handle is created. If it is a pointer to an existing UEFI handle,
361 then the protocol is added to the existing UEFI handle.
363 @retval EFI_SUCCESS The protocol was added to ChildHandle.
364 @retval EFI_INVALID_PARAMETER This is NULL, or ChildHandle is NULL.
365 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create
367 @retval other The child handle was not created.
372 HttpServiceBindingCreateChild (
373 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
374 IN OUT EFI_HANDLE
*ChildHandle
378 Destroys a child handle with a protocol installed on it.
380 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
381 that was installed by CreateChild() from ChildHandle. If the removed protocol is the
382 last protocol on ChildHandle, then ChildHandle is destroyed.
384 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
385 @param ChildHandle Handle of the child to destroy
387 @retval EFI_SUCCESS The protocol was removed from ChildHandle.
388 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.
389 @retval EFI_INVALID_PARAMETER Child handle is NULL.
390 @retval other The child handle was not destroyed
395 HttpServiceBindingDestroyChild (
396 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
397 IN EFI_HANDLE ChildHandle