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