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