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