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