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