]>
Commit | Line | Data |
---|---|---|
cff298f4 | 1 | /** @file\r |
2 | This file defines the EFI HTTP Protocol interface. It is split into\r | |
3 | the following two main sections:\r | |
4 | HTTP Service Binding Protocol (HTTPSB)\r | |
5 | HTTP Protocol (HTTP)\r | |
6 | \r | |
9095d37b | 7 | Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r |
8ab9f769 | 8 | (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP<BR>\r |
9344f092 | 9 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
cff298f4 | 10 | \r |
11 | @par Revision Reference:\r | |
12 | This Protocol is introduced in UEFI Specification 2.5\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef __EFI_HTTP_PROTOCOL_H__\r | |
17 | #define __EFI_HTTP_PROTOCOL_H__\r | |
18 | \r | |
19 | #define EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID \\r | |
20 | { \\r | |
21 | 0xbdc8e6af, 0xd9bc, 0x4379, {0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 0x1c } \\r | |
22 | }\r | |
23 | \r | |
24 | #define EFI_HTTP_PROTOCOL_GUID \\r | |
25 | { \\r | |
26 | 0x7a59b29b, 0x910b, 0x4171, {0x82, 0x42, 0xa8, 0x5a, 0x0d, 0xf2, 0x5b, 0x5b } \\r | |
27 | }\r | |
28 | \r | |
29 | typedef struct _EFI_HTTP_PROTOCOL EFI_HTTP_PROTOCOL;\r | |
30 | \r | |
31 | ///\r | |
32 | /// EFI_HTTP_VERSION\r | |
33 | ///\r | |
34 | typedef enum {\r | |
35 | HttpVersion10,\r | |
36 | HttpVersion11,\r | |
37 | HttpVersionUnsupported\r | |
38 | } EFI_HTTP_VERSION;\r | |
39 | \r | |
40 | ///\r | |
41 | /// EFI_HTTP_METHOD\r | |
42 | ///\r | |
43 | typedef enum {\r | |
44 | HttpMethodGet,\r | |
45 | HttpMethodPost,\r | |
46 | HttpMethodPatch,\r | |
47 | HttpMethodOptions,\r | |
48 | HttpMethodConnect,\r | |
49 | HttpMethodHead,\r | |
50 | HttpMethodPut,\r | |
51 | HttpMethodDelete,\r | |
cfc46163 SEHM |
52 | HttpMethodTrace,\r |
53 | HttpMethodMax\r | |
cff298f4 | 54 | } EFI_HTTP_METHOD;\r |
55 | \r | |
56 | ///\r | |
57 | /// EFI_HTTP_STATUS_CODE\r | |
58 | ///\r | |
59 | typedef enum {\r | |
60 | HTTP_STATUS_UNSUPPORTED_STATUS = 0,\r | |
61 | HTTP_STATUS_100_CONTINUE,\r | |
62 | HTTP_STATUS_101_SWITCHING_PROTOCOLS,\r | |
63 | HTTP_STATUS_200_OK,\r | |
64 | HTTP_STATUS_201_CREATED,\r | |
65 | HTTP_STATUS_202_ACCEPTED,\r | |
66 | HTTP_STATUS_203_NON_AUTHORITATIVE_INFORMATION,\r | |
67 | HTTP_STATUS_204_NO_CONTENT,\r | |
68 | HTTP_STATUS_205_RESET_CONTENT,\r | |
69 | HTTP_STATUS_206_PARTIAL_CONTENT,\r | |
3310ca8f | 70 | HTTP_STATUS_300_MULTIPLE_CHOICES,\r |
cff298f4 | 71 | HTTP_STATUS_301_MOVED_PERMANENTLY,\r |
72 | HTTP_STATUS_302_FOUND,\r | |
73 | HTTP_STATUS_303_SEE_OTHER,\r | |
74 | HTTP_STATUS_304_NOT_MODIFIED,\r | |
75 | HTTP_STATUS_305_USE_PROXY,\r | |
76 | HTTP_STATUS_307_TEMPORARY_REDIRECT,\r | |
77 | HTTP_STATUS_400_BAD_REQUEST,\r | |
78 | HTTP_STATUS_401_UNAUTHORIZED,\r | |
79 | HTTP_STATUS_402_PAYMENT_REQUIRED,\r | |
80 | HTTP_STATUS_403_FORBIDDEN,\r | |
81 | HTTP_STATUS_404_NOT_FOUND,\r | |
82 | HTTP_STATUS_405_METHOD_NOT_ALLOWED,\r | |
83 | HTTP_STATUS_406_NOT_ACCEPTABLE,\r | |
84 | HTTP_STATUS_407_PROXY_AUTHENTICATION_REQUIRED,\r | |
85 | HTTP_STATUS_408_REQUEST_TIME_OUT,\r | |
86 | HTTP_STATUS_409_CONFLICT,\r | |
87 | HTTP_STATUS_410_GONE,\r | |
88 | HTTP_STATUS_411_LENGTH_REQUIRED,\r | |
89 | HTTP_STATUS_412_PRECONDITION_FAILED,\r | |
90 | HTTP_STATUS_413_REQUEST_ENTITY_TOO_LARGE,\r | |
91 | HTTP_STATUS_414_REQUEST_URI_TOO_LARGE,\r | |
8cfd008e | 92 | HTTP_STATUS_415_UNSUPPORTED_MEDIA_TYPE,\r |
cff298f4 | 93 | HTTP_STATUS_416_REQUESTED_RANGE_NOT_SATISFIED,\r |
94 | HTTP_STATUS_417_EXPECTATION_FAILED,\r | |
95 | HTTP_STATUS_500_INTERNAL_SERVER_ERROR,\r | |
8cfd008e | 96 | HTTP_STATUS_501_NOT_IMPLEMENTED,\r |
cff298f4 | 97 | HTTP_STATUS_502_BAD_GATEWAY,\r |
98 | HTTP_STATUS_503_SERVICE_UNAVAILABLE,\r | |
99 | HTTP_STATUS_504_GATEWAY_TIME_OUT,\r | |
8ab9f769 | 100 | HTTP_STATUS_505_HTTP_VERSION_NOT_SUPPORTED,\r |
101 | HTTP_STATUS_308_PERMANENT_REDIRECT\r | |
cff298f4 | 102 | } EFI_HTTP_STATUS_CODE;\r |
103 | \r | |
104 | ///\r | |
105 | /// EFI_HTTPv4_ACCESS_POINT\r | |
106 | ///\r | |
107 | typedef struct {\r | |
108 | ///\r | |
109 | /// Set to TRUE to instruct the EFI HTTP instance to use the default address\r | |
110 | /// information in every TCP connection made by this instance. In addition, when set\r | |
34d00172 | 111 | /// to TRUE, LocalAddress and LocalSubnet are ignored.\r |
cff298f4 | 112 | ///\r |
2f88bd3a | 113 | BOOLEAN UseDefaultAddress;\r |
cff298f4 | 114 | ///\r |
115 | /// If UseDefaultAddress is set to FALSE, this defines the local IP address to be\r | |
116 | /// used in every TCP connection opened by this instance.\r | |
117 | ///\r | |
2f88bd3a | 118 | EFI_IPv4_ADDRESS LocalAddress;\r |
cff298f4 | 119 | ///\r |
120 | /// If UseDefaultAddress is set to FALSE, this defines the local subnet to be used\r | |
121 | /// in every TCP connection opened by this instance.\r | |
122 | ///\r | |
2f88bd3a | 123 | EFI_IPv4_ADDRESS LocalSubnet;\r |
cff298f4 | 124 | ///\r |
34d00172 | 125 | /// This defines the local port to be used in\r |
cff298f4 | 126 | /// every TCP connection opened by this instance.\r |
127 | ///\r | |
2f88bd3a | 128 | UINT16 LocalPort;\r |
cff298f4 | 129 | } EFI_HTTPv4_ACCESS_POINT;\r |
130 | \r | |
131 | ///\r | |
132 | /// EFI_HTTPv6_ACCESS_POINT\r | |
133 | ///\r | |
134 | typedef struct {\r | |
135 | ///\r | |
136 | /// Local IP address to be used in every TCP connection opened by this instance.\r | |
137 | ///\r | |
2f88bd3a | 138 | EFI_IPv6_ADDRESS LocalAddress;\r |
cff298f4 | 139 | ///\r |
140 | /// Local port to be used in every TCP connection opened by this instance.\r | |
141 | ///\r | |
2f88bd3a | 142 | UINT16 LocalPort;\r |
cff298f4 | 143 | } EFI_HTTPv6_ACCESS_POINT;\r |
144 | \r | |
145 | ///\r | |
146 | /// EFI_HTTP_CONFIG_DATA_ACCESS_POINT\r | |
147 | ///\r | |
148 | \r | |
cff298f4 | 149 | typedef struct {\r |
150 | ///\r | |
151 | /// HTTP version that this instance will support.\r | |
152 | ///\r | |
2f88bd3a | 153 | EFI_HTTP_VERSION HttpVersion;\r |
cff298f4 | 154 | ///\r |
155 | /// Time out (in milliseconds) when blocking for requests.\r | |
156 | ///\r | |
2f88bd3a | 157 | UINT32 TimeOutMillisec;\r |
cff298f4 | 158 | ///\r |
159 | /// Defines behavior of EFI DNS and TCP protocols consumed by this instance. If\r | |
160 | /// FALSE, this instance will use EFI_DNS4_PROTOCOL and EFI_TCP4_PROTOCOL. If TRUE,\r | |
161 | /// this instance will use EFI_DNS6_PROTOCOL and EFI_TCP6_PROTOCOL.\r | |
162 | ///\r | |
2f88bd3a | 163 | BOOLEAN LocalAddressIsIPv6;\r |
cff298f4 | 164 | \r |
165 | union {\r | |
166 | ///\r | |
167 | /// When LocalAddressIsIPv6 is FALSE, this points to the local address, subnet, and\r | |
168 | /// port used by the underlying TCP protocol.\r | |
169 | ///\r | |
2f88bd3a | 170 | EFI_HTTPv4_ACCESS_POINT *IPv4Node;\r |
cff298f4 | 171 | ///\r |
172 | /// When LocalAddressIsIPv6 is TRUE, this points to the local IPv6 address and port\r | |
173 | /// used by the underlying TCP protocol.\r | |
174 | ///\r | |
2f88bd3a | 175 | EFI_HTTPv6_ACCESS_POINT *IPv6Node;\r |
cff298f4 | 176 | } AccessPoint;\r |
177 | } EFI_HTTP_CONFIG_DATA;\r | |
178 | \r | |
179 | ///\r | |
180 | /// EFI_HTTP_REQUEST_DATA\r | |
181 | ///\r | |
182 | typedef struct {\r | |
183 | ///\r | |
184 | /// The HTTP method (e.g. GET, POST) for this HTTP Request.\r | |
185 | ///\r | |
2f88bd3a | 186 | EFI_HTTP_METHOD Method;\r |
cff298f4 | 187 | ///\r |
188 | /// The URI of a remote host. From the information in this field, the HTTP instance\r | |
189 | /// will be able to determine whether to use HTTP or HTTPS and will also be able to\r | |
190 | /// determine the port number to use. If no port number is specified, port 80 (HTTP)\r | |
191 | /// is assumed. See RFC 3986 for more details on URI syntax.\r | |
192 | ///\r | |
2f88bd3a | 193 | CHAR16 *Url;\r |
cff298f4 | 194 | } EFI_HTTP_REQUEST_DATA;\r |
195 | \r | |
196 | ///\r | |
197 | /// EFI_HTTP_RESPONSE_DATA\r | |
198 | ///\r | |
199 | typedef struct {\r | |
200 | ///\r | |
201 | /// Response status code returned by the remote host.\r | |
202 | ///\r | |
2f88bd3a | 203 | EFI_HTTP_STATUS_CODE StatusCode;\r |
cff298f4 | 204 | } EFI_HTTP_RESPONSE_DATA;\r |
205 | \r | |
206 | ///\r | |
207 | /// EFI_HTTP_HEADER\r | |
208 | ///\r | |
209 | typedef struct {\r | |
210 | ///\r | |
211 | /// Null terminated string which describes a field name. See RFC 2616 Section 14 for\r | |
212 | /// detailed information about field names.\r | |
213 | ///\r | |
2f88bd3a | 214 | CHAR8 *FieldName;\r |
cff298f4 | 215 | ///\r |
216 | /// Null terminated string which describes the corresponding field value. See RFC 2616\r | |
217 | /// Section 14 for detailed information about field values.\r | |
218 | ///\r | |
2f88bd3a | 219 | CHAR8 *FieldValue;\r |
cff298f4 | 220 | } EFI_HTTP_HEADER;\r |
221 | \r | |
222 | ///\r | |
223 | /// EFI_HTTP_MESSAGE\r | |
224 | ///\r | |
225 | typedef struct {\r | |
226 | ///\r | |
227 | /// HTTP message data.\r | |
228 | ///\r | |
229 | union {\r | |
230 | ///\r | |
231 | /// When the token is used to send a HTTP request, Request is a pointer to storage that\r | |
232 | /// contains such data as URL and HTTP method.\r | |
233 | ///\r | |
2f88bd3a | 234 | EFI_HTTP_REQUEST_DATA *Request;\r |
cff298f4 | 235 | ///\r |
236 | /// When used to await a response, Response points to storage containing HTTP response\r | |
237 | /// status code.\r | |
238 | ///\r | |
2f88bd3a | 239 | EFI_HTTP_RESPONSE_DATA *Response;\r |
cff298f4 | 240 | } Data;\r |
241 | ///\r | |
242 | /// Number of HTTP header structures in Headers list. On request, this count is\r | |
243 | /// provided by the caller. On response, this count is provided by the HTTP driver.\r | |
244 | ///\r | |
2f88bd3a | 245 | UINTN HeaderCount;\r |
cff298f4 | 246 | ///\r |
247 | /// Array containing list of HTTP headers. On request, this array is populated by the\r | |
248 | /// caller. On response, this array is allocated and populated by the HTTP driver. It\r | |
249 | /// is the responsibility of the caller to free this memory on both request and\r | |
250 | /// response.\r | |
251 | ///\r | |
2f88bd3a | 252 | EFI_HTTP_HEADER *Headers;\r |
cff298f4 | 253 | ///\r |
254 | /// Length in bytes of the HTTP body. This can be zero depending on the HttpMethod type.\r | |
255 | ///\r | |
2f88bd3a | 256 | UINTN BodyLength;\r |
cff298f4 | 257 | ///\r |
258 | /// Body associated with the HTTP request or response. This can be NULL depending on\r | |
259 | /// the HttpMethod type.\r | |
260 | ///\r | |
2f88bd3a | 261 | VOID *Body;\r |
cff298f4 | 262 | } EFI_HTTP_MESSAGE;\r |
263 | \r | |
cff298f4 | 264 | ///\r |
265 | /// EFI_HTTP_TOKEN\r | |
266 | ///\r | |
267 | typedef struct {\r | |
268 | ///\r | |
269 | /// This Event will be signaled after the Status field is updated by the EFI HTTP\r | |
270 | /// Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL. The Task Priority\r | |
271 | /// Level (TPL) of Event must be lower than or equal to TPL_CALLBACK.\r | |
272 | ///\r | |
2f88bd3a | 273 | EFI_EVENT Event;\r |
cff298f4 | 274 | ///\r |
275 | /// Status will be set to one of the following value if the HTTP request is\r | |
276 | /// successfully sent or if an unexpected error occurs:\r | |
277 | /// EFI_SUCCESS: The HTTP request was successfully sent to the remote host.\r | |
10a3840f ZL |
278 | /// EFI_HTTP_ERROR: The response message was successfully received but contains a\r |
279 | /// HTTP error. The response status code is returned in token.\r | |
cff298f4 | 280 | /// EFI_ABORTED: The HTTP request was cancelled by the caller and removed from\r |
281 | /// the transmit queue.\r | |
282 | /// EFI_TIMEOUT: The HTTP request timed out before reaching the remote host.\r | |
283 | /// EFI_DEVICE_ERROR: An unexpected system or network error occurred.\r | |
284 | ///\r | |
2f88bd3a | 285 | EFI_STATUS Status;\r |
cff298f4 | 286 | ///\r |
287 | /// Pointer to storage containing HTTP message data.\r | |
288 | ///\r | |
2f88bd3a | 289 | EFI_HTTP_MESSAGE *Message;\r |
cff298f4 | 290 | } EFI_HTTP_TOKEN;\r |
291 | \r | |
292 | /**\r | |
293 | Returns the operational parameters for the current HTTP child instance.\r | |
294 | \r | |
295 | The GetModeData() function is used to read the current mode data (operational\r | |
296 | parameters) for this HTTP protocol instance.\r | |
297 | \r | |
298 | @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.\r | |
299 | @param[out] HttpConfigData Point to buffer for operational parameters of this\r | |
9095d37b LG |
300 | HTTP instance. It is the responsibility of the caller\r |
301 | to allocate the memory for HttpConfigData and\r | |
302 | HttpConfigData->AccessPoint.IPv6Node/IPv4Node. In fact,\r | |
303 | it is recommended to allocate sufficient memory to record\r | |
bf06b383 | 304 | IPv6Node since it is big enough for all possibilities.\r |
cff298f4 | 305 | \r |
306 | @retval EFI_SUCCESS Operation succeeded.\r | |
307 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
34d00172 | 308 | HttpConfigData is NULL.\r |
9095d37b | 309 | HttpConfigData->AccessPoint.IPv4Node or\r |
bf06b383 | 310 | HttpConfigData->AccessPoint.IPv6Node is NULL.\r |
34d00172 | 311 | @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started.\r |
cff298f4 | 312 | **/\r |
313 | typedef\r | |
314 | EFI_STATUS\r | |
fd49f2c1 | 315 | (EFIAPI *EFI_HTTP_GET_MODE_DATA)(\r |
cff298f4 | 316 | IN EFI_HTTP_PROTOCOL *This,\r |
317 | OUT EFI_HTTP_CONFIG_DATA *HttpConfigData\r | |
318 | );\r | |
319 | \r | |
320 | /**\r | |
321 | Initialize or brutally reset the operational parameters for this EFI HTTP instance.\r | |
322 | \r | |
323 | The Configure() function does the following:\r | |
324 | When HttpConfigData is not NULL Initialize this EFI HTTP instance by configuring\r | |
325 | timeout, local address, port, etc.\r | |
326 | When HttpConfigData is NULL, reset this EFI HTTP instance by closing all active\r | |
327 | connections with remote hosts, canceling all asynchronous tokens, and flush request\r | |
328 | and response buffers without informing the appropriate hosts.\r | |
329 | \r | |
34d00172 ZL |
330 | No other EFI HTTP function can be executed by this instance until the Configure()\r |
331 | function is executed and returns successfully.\r | |
cff298f4 | 332 | \r |
333 | @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.\r | |
334 | @param[in] HttpConfigData Pointer to the configure data to configure the instance.\r | |
335 | \r | |
336 | @retval EFI_SUCCESS Operation succeeded.\r | |
337 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
338 | This is NULL.\r | |
339 | HttpConfigData->LocalAddressIsIPv6 is FALSE and\r | |
bf06b383 | 340 | HttpConfigData->AccessPoint.IPv4Node is NULL.\r |
cff298f4 | 341 | HttpConfigData->LocalAddressIsIPv6 is TRUE and\r |
bf06b383 | 342 | HttpConfigData->AccessPoint.IPv6Node is NULL.\r |
cff298f4 | 343 | @retval EFI_ALREADY_STARTED Reinitialize this HTTP instance without calling\r |
344 | Configure() with NULL to reset it.\r | |
345 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
346 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when\r | |
347 | executing Configure().\r | |
348 | @retval EFI_UNSUPPORTED One or more options in ConfigData are not supported\r | |
349 | in the implementation.\r | |
350 | **/\r | |
351 | typedef\r | |
352 | EFI_STATUS\r | |
fd49f2c1 | 353 | (EFIAPI *EFI_HTTP_CONFIGURE)(\r |
cff298f4 | 354 | IN EFI_HTTP_PROTOCOL *This,\r |
fd49f2c1 | 355 | IN EFI_HTTP_CONFIG_DATA *HttpConfigData OPTIONAL\r |
cff298f4 | 356 | );\r |
357 | \r | |
358 | /**\r | |
9095d37b | 359 | The Request() function queues an HTTP request to this HTTP instance,\r |
cff298f4 | 360 | similar to Transmit() function in the EFI TCP driver. When the HTTP request is sent\r |
361 | successfully, or if there is an error, Status in token will be updated and Event will\r | |
362 | be signaled.\r | |
363 | \r | |
364 | @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.\r | |
365 | @param[in] Token Pointer to storage containing HTTP request token.\r | |
366 | \r | |
367 | @retval EFI_SUCCESS Outgoing data was processed.\r | |
368 | @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started.\r | |
369 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
370 | @retval EFI_TIMEOUT Data was dropped out of the transmit or receive queue.\r | |
371 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
372 | This is NULL.\r | |
34d00172 | 373 | Token is NULL.\r |
cff298f4 | 374 | Token->Message is NULL.\r |
375 | Token->Message->Body is not NULL,\r | |
376 | Token->Message->BodyLength is non-zero, and\r | |
377 | Token->Message->Data is NULL, but a previous call to\r | |
378 | Request()has not been completed successfully.\r | |
34d00172 ZL |
379 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.\r |
380 | @retval EFI_UNSUPPORTED The HTTP method is not supported in current implementation.\r | |
cff298f4 | 381 | **/\r |
382 | typedef\r | |
383 | EFI_STATUS\r | |
2f88bd3a | 384 | (EFIAPI *EFI_HTTP_REQUEST)(\r |
cff298f4 | 385 | IN EFI_HTTP_PROTOCOL *This,\r |
386 | IN EFI_HTTP_TOKEN *Token\r | |
387 | );\r | |
388 | \r | |
389 | /**\r | |
390 | Abort an asynchronous HTTP request or response token.\r | |
391 | \r | |
392 | The Cancel() function aborts a pending HTTP request or response transaction. If\r | |
393 | Token is not NULL and the token is in transmit or receive queues when it is being\r | |
394 | cancelled, its Token->Status will be set to EFI_ABORTED and then Token->Event will\r | |
395 | be signaled. If the token is not in one of the queues, which usually means that the\r | |
396 | asynchronous operation has completed, EFI_NOT_FOUND is returned. If Token is NULL,\r | |
397 | all asynchronous tokens issued by Request() or Response() will be aborted.\r | |
398 | \r | |
399 | @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.\r | |
400 | @param[in] Token Point to storage containing HTTP request or response\r | |
401 | token.\r | |
402 | \r | |
403 | @retval EFI_SUCCESS Request and Response queues are successfully flushed.\r | |
404 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
405 | @retval EFI_NOT_STARTED This instance hasn't been configured.\r | |
cff298f4 | 406 | @retval EFI_NOT_FOUND The asynchronous request or response token is not\r |
407 | found.\r | |
408 | @retval EFI_UNSUPPORTED The implementation does not support this function.\r | |
409 | **/\r | |
410 | typedef\r | |
411 | EFI_STATUS\r | |
412 | (EFIAPI *EFI_HTTP_CANCEL)(\r | |
413 | IN EFI_HTTP_PROTOCOL *This,\r | |
414 | IN EFI_HTTP_TOKEN *Token\r | |
415 | );\r | |
416 | \r | |
417 | /**\r | |
418 | The Response() function queues an HTTP response to this HTTP instance, similar to\r | |
34d00172 | 419 | Receive() function in the EFI TCP driver. When the HTTP Response is received successfully,\r |
cff298f4 | 420 | or if there is an error, Status in token will be updated and Event will be signaled.\r |
421 | \r | |
422 | The HTTP driver will queue a receive token to the underlying TCP instance. When data\r | |
423 | is received in the underlying TCP instance, the data will be parsed and Token will\r | |
424 | be populated with the response data. If the data received from the remote host\r | |
425 | contains an incomplete or invalid HTTP header, the HTTP driver will continue waiting\r | |
426 | (asynchronously) for more data to be sent from the remote host before signaling\r | |
427 | Event in Token.\r | |
428 | \r | |
429 | It is the responsibility of the caller to allocate a buffer for Body and specify the\r | |
430 | size in BodyLength. If the remote host provides a response that contains a content\r | |
431 | body, up to BodyLength bytes will be copied from the receive buffer into Body and\r | |
432 | BodyLength will be updated with the amount of bytes received and copied to Body. This\r | |
433 | allows the client to download a large file in chunks instead of into one contiguous\r | |
434 | block of memory. Similar to HTTP request, if Body is not NULL and BodyLength is\r | |
435 | non-zero and all other fields are NULL or 0, the HTTP driver will queue a receive\r | |
436 | token to underlying TCP instance. If data arrives in the receive buffer, up to\r | |
437 | BodyLength bytes of data will be copied to Body. The HTTP driver will then update\r | |
438 | BodyLength with the amount of bytes received and copied to Body.\r | |
439 | \r | |
440 | If the HTTP driver does not have an open underlying TCP connection with the host\r | |
441 | specified in the response URL, Request() will return EFI_ACCESS_DENIED. This is\r | |
442 | consistent with RFC 2616 recommendation that HTTP clients should attempt to maintain\r | |
443 | an open TCP connection between client and host.\r | |
444 | \r | |
445 | @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.\r | |
446 | @param[in] Token Pointer to storage containing HTTP response token.\r | |
447 | \r | |
448 | @retval EFI_SUCCESS Allocation succeeded.\r | |
449 | @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been\r | |
450 | initialized.\r | |
451 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
452 | This is NULL.\r | |
34d00172 | 453 | Token is NULL.\r |
cff298f4 | 454 | Token->Message->Headers is NULL.\r |
455 | Token->Message is NULL.\r | |
456 | Token->Message->Body is not NULL,\r | |
457 | Token->Message->BodyLength is non-zero, and\r | |
458 | Token->Message->Data is NULL, but a previous call to\r | |
459 | Response() has not been completed successfully.\r | |
34d00172 | 460 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.\r |
cff298f4 | 461 | @retval EFI_ACCESS_DENIED An open TCP connection is not present with the host\r |
462 | specified by response URL.\r | |
463 | **/\r | |
464 | typedef\r | |
465 | EFI_STATUS\r | |
2f88bd3a | 466 | (EFIAPI *EFI_HTTP_RESPONSE)(\r |
cff298f4 | 467 | IN EFI_HTTP_PROTOCOL *This,\r |
468 | IN EFI_HTTP_TOKEN *Token\r | |
469 | );\r | |
470 | \r | |
471 | /**\r | |
472 | The Poll() function can be used by network drivers and applications to increase the\r | |
473 | rate that data packets are moved between the communication devices and the transmit\r | |
474 | and receive queues.\r | |
475 | \r | |
476 | In some systems, the periodic timer event in the managed network driver may not poll\r | |
477 | the underlying communications device fast enough to transmit and/or receive all data\r | |
478 | packets without missing incoming packets or dropping outgoing packets. Drivers and\r | |
479 | applications that are experiencing packet loss should try calling the Poll() function\r | |
480 | more often.\r | |
481 | \r | |
482 | @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.\r | |
483 | \r | |
484 | @retval EFI_SUCCESS Incoming or outgoing data was processed..\r | |
485 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred\r | |
486 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
487 | @retval EFI_NOT_READY No incoming or outgoing data is processed.\r | |
34d00172 | 488 | @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started.\r |
cff298f4 | 489 | **/\r |
490 | typedef\r | |
491 | EFI_STATUS\r | |
2f88bd3a | 492 | (EFIAPI *EFI_HTTP_POLL)(\r |
cff298f4 | 493 | IN EFI_HTTP_PROTOCOL *This\r |
494 | );\r | |
495 | \r | |
496 | ///\r | |
497 | /// The EFI HTTP protocol is designed to be used by EFI drivers and applications to\r | |
498 | /// create and transmit HTTP Requests, as well as handle HTTP responses that are\r | |
499 | /// returned by a remote host. This EFI protocol uses and relies on an underlying EFI\r | |
500 | /// TCP protocol.\r | |
501 | ///\r | |
502 | struct _EFI_HTTP_PROTOCOL {\r | |
2f88bd3a MK |
503 | EFI_HTTP_GET_MODE_DATA GetModeData;\r |
504 | EFI_HTTP_CONFIGURE Configure;\r | |
505 | EFI_HTTP_REQUEST Request;\r | |
506 | EFI_HTTP_CANCEL Cancel;\r | |
507 | EFI_HTTP_RESPONSE Response;\r | |
508 | EFI_HTTP_POLL Poll;\r | |
cff298f4 | 509 | };\r |
510 | \r | |
2f88bd3a MK |
511 | extern EFI_GUID gEfiHttpServiceBindingProtocolGuid;\r |
512 | extern EFI_GUID gEfiHttpProtocolGuid;\r | |
cff298f4 | 513 | \r |
514 | #endif\r |