]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/HttpDxe/HttpDriver.h
NetworkPkg: Update Http driver to use DPC mechanism.
[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
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php.\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __EFI_HTTP_DRIVER_H__\r
17#define __EFI_HTTP_DRIVER_H__\r
18\r
19#include <Uefi.h>\r
20\r
21//\r
22// Libraries\r
23//\r
24#include <Library/UefiBootServicesTableLib.h>\r
25#include <Library/MemoryAllocationLib.h>\r
26#include <Library/BaseLib.h>\r
27#include <Library/UefiLib.h>\r
28#include <Library/DebugLib.h>\r
29#include <Library/NetLib.h>\r
30#include <Library/HttpLib.h>\r
49c9f74c 31#include <Library/DpcLib.h>\r
47f51a06
YT
32\r
33//\r
34// UEFI Driver Model Protocols\r
35//\r
36#include <Protocol/DriverBinding.h>\r
37#include <Protocol/ServiceBinding.h>\r
38#include <Protocol/ComponentName2.h>\r
39#include <Protocol/ComponentName.h>\r
40\r
41//\r
42// Consumed Protocols\r
43//\r
5ca29abe 44#include <Protocol/HttpUtilities.h>\r
47f51a06
YT
45#include <Protocol/Tcp4.h>\r
46#include <Protocol/Dns4.h>\r
47#include <Protocol/Ip4Config2.h>\r
48\r
49//\r
50// Produced Protocols\r
51//\r
52#include <Protocol/Http.h>\r
53\r
54//\r
55// Driver Version\r
56//\r
57#define HTTP_DRIVER_VERSION 0xa\r
58\r
59//\r
60// Protocol instances\r
61//\r
62extern EFI_DRIVER_BINDING_PROTOCOL gHttpDxeDriverBinding;\r
63extern EFI_COMPONENT_NAME2_PROTOCOL gHttpDxeComponentName2;\r
64extern EFI_COMPONENT_NAME_PROTOCOL gHttpDxeComponentName;\r
65\r
5ca29abe
JW
66extern EFI_HTTP_UTILITIES_PROTOCOL *mHttpUtilities;\r
67\r
47f51a06
YT
68//\r
69// Include files with function prototypes\r
70//\r
71#include "ComponentName.h"\r
72#include "HttpImpl.h"\r
73#include "HttpProto.h"\r
74#include "HttpDns.h"\r
47f51a06
YT
75\r
76typedef struct {\r
77 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;\r
78 UINTN NumberOfChildren;\r
79 EFI_HANDLE *ChildHandleBuffer;\r
80} HTTP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;\r
81\r
82/**\r
83 Tests to see if this driver supports a given controller. If a child device is provided, \r
84 it further tests to see if this driver supports creating a handle for the specified child device.\r
85\r
86 This function checks to see if the driver specified by This supports the device specified by \r
87 ControllerHandle. Drivers will typically use the device path attached to \r
88 ControllerHandle and/or the services from the bus I/O abstraction attached to \r
89 ControllerHandle to determine if the driver supports ControllerHandle. This function \r
90 may be called many times during platform initialization. In order to reduce boot times, the tests \r
91 performed by this function must be very small, and take as little time as possible to execute. This \r
92 function must not change the state of any hardware devices, and this function must be aware that the \r
93 device specified by ControllerHandle may already be managed by the same driver or a \r
94 different driver. This function must match its calls to AllocatePages() with FreePages(), \r
95 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). \r
96 Because ControllerHandle may have been previously started by the same driver, if a protocol is \r
97 already in the opened state, then it must not be closed with CloseProtocol(). This is required \r
98 to guarantee the state of ControllerHandle is not modified by this function.\r
99\r
100 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
101 @param[in] ControllerHandle The handle of the controller to test. This handle \r
102 must support a protocol interface that supplies \r
103 an I/O abstraction to the driver.\r
104 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This \r
105 parameter is ignored by device drivers, and is optional for bus \r
106 drivers. For bus drivers, if this parameter is not NULL, then \r
107 the bus driver must determine if the bus controller specified \r
108 by ControllerHandle and the child controller specified \r
109 by RemainingDevicePath are both supported by this \r
110 bus driver.\r
111\r
112 @retval EFI_SUCCESS The device specified by ControllerHandle and\r
113 RemainingDevicePath is supported by the driver specified by This.\r
114 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r
115 RemainingDevicePath is already being managed by the driver\r
116 specified by This.\r
117 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r
118 RemainingDevicePath is already being managed by a different\r
119 driver or an application that requires exclusive access.\r
120 Currently not implemented.\r
121 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r
122 RemainingDevicePath is not supported by the driver specified by This.\r
123**/\r
124EFI_STATUS\r
125EFIAPI\r
126HttpDxeDriverBindingSupported (\r
127 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
128 IN EFI_HANDLE ControllerHandle,\r
129 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
130 );\r
131\r
132/**\r
133 Starts a device controller or a bus controller.\r
134\r
135 The Start() function is designed to be invoked from the EFI boot service ConnectController().\r
136 As a result, much of the error checking on the parameters to Start() has been moved into this \r
137 common boot service. It is legal to call Start() from other locations, \r
138 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
139 1. ControllerHandle must be a valid EFI_HANDLE.\r
140 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
141 EFI_DEVICE_PATH_PROTOCOL.\r
142 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
143 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. \r
144\r
145 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
146 @param[in] ControllerHandle The handle of the controller to start. This handle \r
147 must support a protocol interface that supplies \r
148 an I/O abstraction to the driver.\r
149 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This \r
150 parameter is ignored by device drivers, and is optional for bus \r
151 drivers. For a bus driver, if this parameter is NULL, then handles \r
152 for all the children of Controller are created by this driver. \r
153 If this parameter is not NULL and the first Device Path Node is \r
154 not the End of Device Path Node, then only the handle for the \r
155 child device specified by the first Device Path Node of \r
156 RemainingDevicePath is created by this driver.\r
157 If the first Device Path Node of RemainingDevicePath is \r
158 the End of Device Path Node, no child handle is created by this\r
159 driver.\r
160\r
161 @retval EFI_SUCCESS The device was started.\r
162 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r
163 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
164 @retval Others The driver failded to start the device.\r
165\r
166**/\r
167EFI_STATUS\r
168EFIAPI\r
169HttpDxeDriverBindingStart (\r
170 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
171 IN EFI_HANDLE ControllerHandle,\r
172 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
173 );\r
174\r
175/**\r
176 Stops a device controller or a bus controller.\r
177 \r
178 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). \r
179 As a result, much of the error checking on the parameters to Stop() has been moved \r
180 into this common boot service. It is legal to call Stop() from other locations, \r
181 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
182 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
183 same driver's Start() function.\r
184 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
185 EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
186 Start() function, and the Start() function must have called OpenProtocol() on\r
187 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
188 \r
189 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
190 @param[in] ControllerHandle A handle to the device being stopped. The handle must \r
191 support a bus specific I/O protocol for the driver \r
192 to use to stop the device.\r
193 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
194 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL \r
195 if NumberOfChildren is 0.\r
196\r
197 @retval EFI_SUCCESS The device was stopped.\r
198 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
199\r
200**/\r
201EFI_STATUS\r
202EFIAPI\r
203HttpDxeDriverBindingStop (\r
204 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
205 IN EFI_HANDLE ControllerHandle,\r
206 IN UINTN NumberOfChildren,\r
207 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
208 );\r
209\r
210/**\r
211 Creates a child handle and installs a protocol.\r
212\r
213 The CreateChild() function installs a protocol on ChildHandle.\r
214 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.\r
215 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r
216\r
217 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
218 @param ChildHandle Pointer to the handle of the child to create. If it is NULL,\r
219 then a new handle is created. If it is a pointer to an existing UEFI handle,\r
220 then the protocol is added to the existing UEFI handle.\r
221\r
222 @retval EFI_SUCCES The protocol was added to ChildHandle.\r
223 @retval EFI_INVALID_PARAMETER This is NULL, or ChildHandle is NULL.\r
224 @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create\r
225 the child.\r
226 @retval other The child handle was not created.\r
227\r
228**/\r
229EFI_STATUS\r
230EFIAPI\r
231HttpServiceBindingCreateChild (\r
232 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
233 IN OUT EFI_HANDLE *ChildHandle\r
234 );\r
235\r
236/**\r
237 Destroys a child handle with a protocol installed on it.\r
238\r
239 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol\r
240 that was installed by CreateChild() from ChildHandle. If the removed protocol is the\r
241 last protocol on ChildHandle, then ChildHandle is destroyed.\r
242\r
243 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
244 @param ChildHandle Handle of the child to destroy\r
245\r
246 @retval EFI_SUCCES The protocol was removed from ChildHandle.\r
247 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.\r
248 @retval EFI_INVALID_PARAMETER Child handle is NULL.\r
249 @retval other The child handle was not destroyed\r
250\r
251**/\r
252EFI_STATUS\r
253EFIAPI\r
254HttpServiceBindingDestroyChild (\r
255 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
256 IN EFI_HANDLE ChildHandle\r
257 );\r
258\r
259\r
260extern EFI_HTTP_PROTOCOL mEfiHttpProtocolTemplete;\r
261\r
262#endif\r