VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/HttpDxe/HttpDriver.h@ 106129

Last change on this file since 106129 was 99404, checked in by vboxsync, 20 months ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 19.8 KB
Line 
1/** @file
2 The header files of the driver binding and service binding protocol for HttpDxe driver.
3
4 Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9**/
10
11#ifndef __EFI_HTTP_DRIVER_H__
12#define __EFI_HTTP_DRIVER_H__
13
14#include <Uefi.h>
15#include <IndustryStandard/Http11.h>
16
17//
18// Libraries
19//
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>
29
30//
31// UEFI Driver Model Protocols
32//
33#include <Protocol/DriverBinding.h>
34#include <Protocol/ServiceBinding.h>
35#include <Protocol/ComponentName2.h>
36#include <Protocol/ComponentName.h>
37
38//
39// Consumed Protocols
40//
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>
51
52#include <Guid/ImageAuthentication.h>
53//
54// Produced Protocols
55//
56#include <Protocol/Http.h>
57
58#include <Guid/TlsAuthentication.h>
59#include <Guid/HttpTlsCipherList.h>
60
61#include <IndustryStandard/Tls1.h>
62
63//
64// Driver Version
65//
66#define HTTP_DRIVER_VERSION 0xa
67
68//
69// Protocol instances
70//
71extern EFI_DRIVER_BINDING_PROTOCOL gHttpDxeIp4DriverBinding;
72extern EFI_DRIVER_BINDING_PROTOCOL gHttpDxeIp6DriverBinding;
73
74extern EFI_COMPONENT_NAME2_PROTOCOL gHttpDxeComponentName2;
75extern EFI_COMPONENT_NAME_PROTOCOL gHttpDxeComponentName;
76
77extern EFI_HTTP_UTILITIES_PROTOCOL *mHttpUtilities;
78
79//
80// Include files with function prototypes
81//
82#include "ComponentName.h"
83#include "HttpImpl.h"
84#include "HttpProto.h"
85#include "HttpsSupport.h"
86#include "HttpDns.h"
87
88typedef struct {
89 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
90 UINTN NumberOfChildren;
91 EFI_HANDLE *ChildHandleBuffer;
92} HTTP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;
93
94/**
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.
97
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.
111
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
122 bus driver.
123
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
128 specified by This.
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.
135**/
136EFI_STATUS
137EFIAPI
138HttpDxeIp4DriverBindingSupported (
139 IN EFI_DRIVER_BINDING_PROTOCOL *This,
140 IN EFI_HANDLE ControllerHandle,
141 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
142 );
143
144/**
145 Starts a device controller or a bus controller.
146
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.
156
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
171 driver.
172
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.
177
178**/
179EFI_STATUS
180EFIAPI
181HttpDxeIp4DriverBindingStart (
182 IN EFI_DRIVER_BINDING_PROTOCOL *This,
183 IN EFI_HANDLE ControllerHandle,
184 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
185 );
186
187/**
188 Stops a device controller or a bus controller.
189
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.
200
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.
208
209 @retval EFI_SUCCESS The device was stopped.
210 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
211
212**/
213EFI_STATUS
214EFIAPI
215HttpDxeIp4DriverBindingStop (
216 IN EFI_DRIVER_BINDING_PROTOCOL *This,
217 IN EFI_HANDLE ControllerHandle,
218 IN UINTN NumberOfChildren,
219 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
220 );
221
222/**
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.
225
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.
239
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
250 bus driver.
251
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
256 specified by This.
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.
263**/
264EFI_STATUS
265EFIAPI
266HttpDxeIp6DriverBindingSupported (
267 IN EFI_DRIVER_BINDING_PROTOCOL *This,
268 IN EFI_HANDLE ControllerHandle,
269 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
270 );
271
272/**
273 Starts a device controller or a bus controller.
274
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.
284
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
299 driver.
300
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.
306
307**/
308EFI_STATUS
309EFIAPI
310HttpDxeIp6DriverBindingStart (
311 IN EFI_DRIVER_BINDING_PROTOCOL *This,
312 IN EFI_HANDLE ControllerHandle,
313 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
314 );
315
316/**
317 Stops a device controller or a bus controller.
318
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.
329
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.
337
338 @retval EFI_SUCCESS The device was stopped.
339 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
340
341**/
342EFI_STATUS
343EFIAPI
344HttpDxeIp6DriverBindingStop (
345 IN EFI_DRIVER_BINDING_PROTOCOL *This,
346 IN EFI_HANDLE ControllerHandle,
347 IN UINTN NumberOfChildren,
348 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
349 );
350
351/**
352 Creates a child handle and installs a protocol.
353
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.
357
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.
362
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
366 the child.
367 @retval other The child handle was not created.
368
369**/
370EFI_STATUS
371EFIAPI
372HttpServiceBindingCreateChild (
373 IN EFI_SERVICE_BINDING_PROTOCOL *This,
374 IN OUT EFI_HANDLE *ChildHandle
375 );
376
377/**
378 Destroys a child handle with a protocol installed on it.
379
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.
383
384 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
385 @param ChildHandle Handle of the child to destroy
386
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
391
392**/
393EFI_STATUS
394EFIAPI
395HttpServiceBindingDestroyChild (
396 IN EFI_SERVICE_BINDING_PROTOCOL *This,
397 IN EFI_HANDLE ChildHandle
398 );
399
400#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette