VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/HttpDxe/HttpDriver.h@ 85718

Last change on this file since 85718 was 85718, checked in by vboxsync, 4 years ago

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