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