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