]>
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 |
113 | BOOLEAN UseDefaultAddress;\r | |
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 | |
118 | EFI_IPv4_ADDRESS LocalAddress;\r | |
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 | |
123 | EFI_IPv4_ADDRESS LocalSubnet;\r | |
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 | |
128 | UINT16 LocalPort;\r | |
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 | |
138 | EFI_IPv6_ADDRESS LocalAddress;\r | |
139 | ///\r | |
140 | /// Local port to be used in every TCP connection opened by this instance.\r | |
141 | ///\r | |
142 | UINT16 LocalPort;\r | |
143 | } EFI_HTTPv6_ACCESS_POINT;\r | |
144 | \r | |
145 | ///\r | |
146 | /// EFI_HTTP_CONFIG_DATA_ACCESS_POINT\r | |
147 | ///\r | |
148 | \r | |
149 | \r | |
150 | typedef struct {\r | |
151 | ///\r | |
152 | /// HTTP version that this instance will support.\r | |
153 | ///\r | |
154 | EFI_HTTP_VERSION HttpVersion;\r | |
155 | ///\r | |
156 | /// Time out (in milliseconds) when blocking for requests.\r | |
157 | ///\r | |
158 | UINT32 TimeOutMillisec;\r | |
159 | ///\r | |
160 | /// Defines behavior of EFI DNS and TCP protocols consumed by this instance. If\r | |
161 | /// FALSE, this instance will use EFI_DNS4_PROTOCOL and EFI_TCP4_PROTOCOL. If TRUE,\r | |
162 | /// this instance will use EFI_DNS6_PROTOCOL and EFI_TCP6_PROTOCOL.\r | |
163 | ///\r | |
164 | BOOLEAN LocalAddressIsIPv6;\r | |
165 | \r | |
166 | union {\r | |
167 | ///\r | |
168 | /// When LocalAddressIsIPv6 is FALSE, this points to the local address, subnet, and\r | |
169 | /// port used by the underlying TCP protocol.\r | |
170 | ///\r | |
171 | EFI_HTTPv4_ACCESS_POINT *IPv4Node;\r | |
172 | ///\r | |
173 | /// When LocalAddressIsIPv6 is TRUE, this points to the local IPv6 address and port\r | |
174 | /// used by the underlying TCP protocol.\r | |
175 | ///\r | |
176 | EFI_HTTPv6_ACCESS_POINT *IPv6Node;\r | |
177 | } AccessPoint;\r | |
178 | } EFI_HTTP_CONFIG_DATA;\r | |
179 | \r | |
180 | ///\r | |
181 | /// EFI_HTTP_REQUEST_DATA\r | |
182 | ///\r | |
183 | typedef struct {\r | |
184 | ///\r | |
185 | /// The HTTP method (e.g. GET, POST) for this HTTP Request.\r | |
186 | ///\r | |
187 | EFI_HTTP_METHOD Method;\r | |
188 | ///\r | |
189 | /// The URI of a remote host. From the information in this field, the HTTP instance\r | |
190 | /// will be able to determine whether to use HTTP or HTTPS and will also be able to\r | |
191 | /// determine the port number to use. If no port number is specified, port 80 (HTTP)\r | |
192 | /// is assumed. See RFC 3986 for more details on URI syntax.\r | |
193 | ///\r | |
194 | CHAR16 *Url;\r | |
195 | } EFI_HTTP_REQUEST_DATA;\r | |
196 | \r | |
197 | ///\r | |
198 | /// EFI_HTTP_RESPONSE_DATA\r | |
199 | ///\r | |
200 | typedef struct {\r | |
201 | ///\r | |
202 | /// Response status code returned by the remote host.\r | |
203 | ///\r | |
204 | EFI_HTTP_STATUS_CODE StatusCode;\r | |
205 | } EFI_HTTP_RESPONSE_DATA;\r | |
206 | \r | |
207 | ///\r | |
208 | /// EFI_HTTP_HEADER\r | |
209 | ///\r | |
210 | typedef struct {\r | |
211 | ///\r | |
212 | /// Null terminated string which describes a field name. See RFC 2616 Section 14 for\r | |
213 | /// detailed information about field names.\r | |
214 | ///\r | |
215 | CHAR8 *FieldName;\r | |
216 | ///\r | |
217 | /// Null terminated string which describes the corresponding field value. See RFC 2616\r | |
218 | /// Section 14 for detailed information about field values.\r | |
219 | ///\r | |
220 | CHAR8 *FieldValue;\r | |
221 | } EFI_HTTP_HEADER;\r | |
222 | \r | |
223 | ///\r | |
224 | /// EFI_HTTP_MESSAGE\r | |
225 | ///\r | |
226 | typedef struct {\r | |
227 | ///\r | |
228 | /// HTTP message data.\r | |
229 | ///\r | |
230 | union {\r | |
231 | ///\r | |
232 | /// When the token is used to send a HTTP request, Request is a pointer to storage that\r | |
233 | /// contains such data as URL and HTTP method.\r | |
234 | ///\r | |
235 | EFI_HTTP_REQUEST_DATA *Request;\r | |
236 | ///\r | |
237 | /// When used to await a response, Response points to storage containing HTTP response\r | |
238 | /// status code.\r | |
239 | ///\r | |
240 | EFI_HTTP_RESPONSE_DATA *Response;\r | |
241 | } Data;\r | |
242 | ///\r | |
243 | /// Number of HTTP header structures in Headers list. On request, this count is\r | |
244 | /// provided by the caller. On response, this count is provided by the HTTP driver.\r | |
245 | ///\r | |
246 | UINTN HeaderCount;\r | |
247 | ///\r | |
248 | /// Array containing list of HTTP headers. On request, this array is populated by the\r | |
249 | /// caller. On response, this array is allocated and populated by the HTTP driver. It\r | |
250 | /// is the responsibility of the caller to free this memory on both request and\r | |
251 | /// response.\r | |
252 | ///\r | |
253 | EFI_HTTP_HEADER *Headers;\r | |
254 | ///\r | |
255 | /// Length in bytes of the HTTP body. This can be zero depending on the HttpMethod type.\r | |
256 | ///\r | |
257 | UINTN BodyLength;\r | |
258 | ///\r | |
259 | /// Body associated with the HTTP request or response. This can be NULL depending on\r | |
260 | /// the HttpMethod type.\r | |
261 | ///\r | |
262 | VOID *Body;\r | |
263 | } EFI_HTTP_MESSAGE;\r | |
264 | \r | |
265 | \r | |
266 | ///\r | |
267 | /// EFI_HTTP_TOKEN\r | |
268 | ///\r | |
269 | typedef struct {\r | |
270 | ///\r | |
271 | /// This Event will be signaled after the Status field is updated by the EFI HTTP\r | |
272 | /// Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL. The Task Priority\r | |
273 | /// Level (TPL) of Event must be lower than or equal to TPL_CALLBACK.\r | |
274 | ///\r | |
275 | EFI_EVENT Event;\r | |
276 | ///\r | |
277 | /// Status will be set to one of the following value if the HTTP request is\r | |
278 | /// successfully sent or if an unexpected error occurs:\r | |
279 | /// EFI_SUCCESS: The HTTP request was successfully sent to the remote host.\r | |
10a3840f ZL |
280 | /// EFI_HTTP_ERROR: The response message was successfully received but contains a\r |
281 | /// HTTP error. The response status code is returned in token.\r | |
cff298f4 | 282 | /// EFI_ABORTED: The HTTP request was cancelled by the caller and removed from\r |
283 | /// the transmit queue.\r | |
284 | /// EFI_TIMEOUT: The HTTP request timed out before reaching the remote host.\r | |
285 | /// EFI_DEVICE_ERROR: An unexpected system or network error occurred.\r | |
286 | ///\r | |
287 | EFI_STATUS Status;\r | |
288 | ///\r | |
289 | /// Pointer to storage containing HTTP message data.\r | |
290 | ///\r | |
291 | EFI_HTTP_MESSAGE *Message;\r | |
292 | } EFI_HTTP_TOKEN;\r | |
293 | \r | |
294 | /**\r | |
295 | Returns the operational parameters for the current HTTP child instance.\r | |
296 | \r | |
297 | The GetModeData() function is used to read the current mode data (operational\r | |
298 | parameters) for this HTTP protocol instance.\r | |
299 | \r | |
300 | @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.\r | |
301 | @param[out] HttpConfigData Point to buffer for operational parameters of this\r | |
9095d37b LG |
302 | HTTP instance. It is the responsibility of the caller\r |
303 | to allocate the memory for HttpConfigData and\r | |
304 | HttpConfigData->AccessPoint.IPv6Node/IPv4Node. In fact,\r | |
305 | it is recommended to allocate sufficient memory to record\r | |
bf06b383 | 306 | IPv6Node since it is big enough for all possibilities.\r |
cff298f4 | 307 | \r |
308 | @retval EFI_SUCCESS Operation succeeded.\r | |
309 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
34d00172 | 310 | HttpConfigData is NULL.\r |
9095d37b | 311 | HttpConfigData->AccessPoint.IPv4Node or\r |
bf06b383 | 312 | HttpConfigData->AccessPoint.IPv6Node is NULL.\r |
34d00172 | 313 | @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started.\r |
cff298f4 | 314 | **/\r |
315 | typedef\r | |
316 | EFI_STATUS\r | |
fd49f2c1 | 317 | (EFIAPI *EFI_HTTP_GET_MODE_DATA)(\r |
cff298f4 | 318 | IN EFI_HTTP_PROTOCOL *This,\r |
319 | OUT EFI_HTTP_CONFIG_DATA *HttpConfigData\r | |
320 | );\r | |
321 | \r | |
322 | /**\r | |
323 | Initialize or brutally reset the operational parameters for this EFI HTTP instance.\r | |
324 | \r | |
325 | The Configure() function does the following:\r | |
326 | When HttpConfigData is not NULL Initialize this EFI HTTP instance by configuring\r | |
327 | timeout, local address, port, etc.\r | |
328 | When HttpConfigData is NULL, reset this EFI HTTP instance by closing all active\r | |
329 | connections with remote hosts, canceling all asynchronous tokens, and flush request\r | |
330 | and response buffers without informing the appropriate hosts.\r | |
331 | \r | |
34d00172 ZL |
332 | No other EFI HTTP function can be executed by this instance until the Configure()\r |
333 | function is executed and returns successfully.\r | |
cff298f4 | 334 | \r |
335 | @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.\r | |
336 | @param[in] HttpConfigData Pointer to the configure data to configure the instance.\r | |
337 | \r | |
338 | @retval EFI_SUCCESS Operation succeeded.\r | |
339 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
340 | This is NULL.\r | |
341 | HttpConfigData->LocalAddressIsIPv6 is FALSE and\r | |
bf06b383 | 342 | HttpConfigData->AccessPoint.IPv4Node is NULL.\r |
cff298f4 | 343 | HttpConfigData->LocalAddressIsIPv6 is TRUE and\r |
bf06b383 | 344 | HttpConfigData->AccessPoint.IPv6Node is NULL.\r |
cff298f4 | 345 | @retval EFI_ALREADY_STARTED Reinitialize this HTTP instance without calling\r |
346 | Configure() with NULL to reset it.\r | |
347 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
348 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when\r | |
349 | executing Configure().\r | |
350 | @retval EFI_UNSUPPORTED One or more options in ConfigData are not supported\r | |
351 | in the implementation.\r | |
352 | **/\r | |
353 | typedef\r | |
354 | EFI_STATUS\r | |
fd49f2c1 | 355 | (EFIAPI *EFI_HTTP_CONFIGURE)(\r |
cff298f4 | 356 | IN EFI_HTTP_PROTOCOL *This,\r |
fd49f2c1 | 357 | IN EFI_HTTP_CONFIG_DATA *HttpConfigData OPTIONAL\r |
cff298f4 | 358 | );\r |
359 | \r | |
360 | /**\r | |
9095d37b | 361 | The Request() function queues an HTTP request to this HTTP instance,\r |
cff298f4 | 362 | similar to Transmit() function in the EFI TCP driver. When the HTTP request is sent\r |
363 | successfully, or if there is an error, Status in token will be updated and Event will\r | |
364 | be signaled.\r | |
365 | \r | |
366 | @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.\r | |
367 | @param[in] Token Pointer to storage containing HTTP request token.\r | |
368 | \r | |
369 | @retval EFI_SUCCESS Outgoing data was processed.\r | |
370 | @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started.\r | |
371 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
372 | @retval EFI_TIMEOUT Data was dropped out of the transmit or receive queue.\r | |
373 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
374 | This is NULL.\r | |
34d00172 | 375 | Token is NULL.\r |
cff298f4 | 376 | Token->Message is NULL.\r |
377 | Token->Message->Body is not NULL,\r | |
378 | Token->Message->BodyLength is non-zero, and\r | |
379 | Token->Message->Data is NULL, but a previous call to\r | |
380 | Request()has not been completed successfully.\r | |
34d00172 ZL |
381 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.\r |
382 | @retval EFI_UNSUPPORTED The HTTP method is not supported in current implementation.\r | |
cff298f4 | 383 | **/\r |
384 | typedef\r | |
385 | EFI_STATUS\r | |
386 | (EFIAPI *EFI_HTTP_REQUEST) (\r | |
387 | IN EFI_HTTP_PROTOCOL *This,\r | |
388 | IN EFI_HTTP_TOKEN *Token\r | |
389 | );\r | |
390 | \r | |
391 | /**\r | |
392 | Abort an asynchronous HTTP request or response token.\r | |
393 | \r | |
394 | The Cancel() function aborts a pending HTTP request or response transaction. If\r | |
395 | Token is not NULL and the token is in transmit or receive queues when it is being\r | |
396 | cancelled, its Token->Status will be set to EFI_ABORTED and then Token->Event will\r | |
397 | be signaled. If the token is not in one of the queues, which usually means that the\r | |
398 | asynchronous operation has completed, EFI_NOT_FOUND is returned. If Token is NULL,\r | |
399 | all asynchronous tokens issued by Request() or Response() will be aborted.\r | |
400 | \r | |
401 | @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.\r | |
402 | @param[in] Token Point to storage containing HTTP request or response\r | |
403 | token.\r | |
404 | \r | |
405 | @retval EFI_SUCCESS Request and Response queues are successfully flushed.\r | |
406 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
407 | @retval EFI_NOT_STARTED This instance hasn't been configured.\r | |
cff298f4 | 408 | @retval EFI_NOT_FOUND The asynchronous request or response token is not\r |
409 | found.\r | |
410 | @retval EFI_UNSUPPORTED The implementation does not support this function.\r | |
411 | **/\r | |
412 | typedef\r | |
413 | EFI_STATUS\r | |
414 | (EFIAPI *EFI_HTTP_CANCEL)(\r | |
415 | IN EFI_HTTP_PROTOCOL *This,\r | |
416 | IN EFI_HTTP_TOKEN *Token\r | |
417 | );\r | |
418 | \r | |
419 | /**\r | |
420 | The Response() function queues an HTTP response to this HTTP instance, similar to\r | |
34d00172 | 421 | Receive() function in the EFI TCP driver. When the HTTP Response is received successfully,\r |
cff298f4 | 422 | or if there is an error, Status in token will be updated and Event will be signaled.\r |
423 | \r | |
424 | The HTTP driver will queue a receive token to the underlying TCP instance. When data\r | |
425 | is received in the underlying TCP instance, the data will be parsed and Token will\r | |
426 | be populated with the response data. If the data received from the remote host\r | |
427 | contains an incomplete or invalid HTTP header, the HTTP driver will continue waiting\r | |
428 | (asynchronously) for more data to be sent from the remote host before signaling\r | |
429 | Event in Token.\r | |
430 | \r | |
431 | It is the responsibility of the caller to allocate a buffer for Body and specify the\r | |
432 | size in BodyLength. If the remote host provides a response that contains a content\r | |
433 | body, up to BodyLength bytes will be copied from the receive buffer into Body and\r | |
434 | BodyLength will be updated with the amount of bytes received and copied to Body. This\r | |
435 | allows the client to download a large file in chunks instead of into one contiguous\r | |
436 | block of memory. Similar to HTTP request, if Body is not NULL and BodyLength is\r | |
437 | non-zero and all other fields are NULL or 0, the HTTP driver will queue a receive\r | |
438 | token to underlying TCP instance. If data arrives in the receive buffer, up to\r | |
439 | BodyLength bytes of data will be copied to Body. The HTTP driver will then update\r | |
440 | BodyLength with the amount of bytes received and copied to Body.\r | |
441 | \r | |
442 | If the HTTP driver does not have an open underlying TCP connection with the host\r | |
443 | specified in the response URL, Request() will return EFI_ACCESS_DENIED. This is\r | |
444 | consistent with RFC 2616 recommendation that HTTP clients should attempt to maintain\r | |
445 | an open TCP connection between client and host.\r | |
446 | \r | |
447 | @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.\r | |
448 | @param[in] Token Pointer to storage containing HTTP response token.\r | |
449 | \r | |
450 | @retval EFI_SUCCESS Allocation succeeded.\r | |
451 | @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been\r | |
452 | initialized.\r | |
453 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
454 | This is NULL.\r | |
34d00172 | 455 | Token is NULL.\r |
cff298f4 | 456 | Token->Message->Headers is NULL.\r |
457 | Token->Message is NULL.\r | |
458 | Token->Message->Body is not NULL,\r | |
459 | Token->Message->BodyLength is non-zero, and\r | |
460 | Token->Message->Data is NULL, but a previous call to\r | |
461 | Response() has not been completed successfully.\r | |
34d00172 | 462 | @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.\r |
cff298f4 | 463 | @retval EFI_ACCESS_DENIED An open TCP connection is not present with the host\r |
464 | specified by response URL.\r | |
465 | **/\r | |
466 | typedef\r | |
467 | EFI_STATUS\r | |
468 | (EFIAPI *EFI_HTTP_RESPONSE) (\r | |
469 | IN EFI_HTTP_PROTOCOL *This,\r | |
470 | IN EFI_HTTP_TOKEN *Token\r | |
471 | );\r | |
472 | \r | |
473 | /**\r | |
474 | The Poll() function can be used by network drivers and applications to increase the\r | |
475 | rate that data packets are moved between the communication devices and the transmit\r | |
476 | and receive queues.\r | |
477 | \r | |
478 | In some systems, the periodic timer event in the managed network driver may not poll\r | |
479 | the underlying communications device fast enough to transmit and/or receive all data\r | |
480 | packets without missing incoming packets or dropping outgoing packets. Drivers and\r | |
481 | applications that are experiencing packet loss should try calling the Poll() function\r | |
482 | more often.\r | |
483 | \r | |
484 | @param[in] This Pointer to EFI_HTTP_PROTOCOL instance.\r | |
485 | \r | |
486 | @retval EFI_SUCCESS Incoming or outgoing data was processed..\r | |
487 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred\r | |
488 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
489 | @retval EFI_NOT_READY No incoming or outgoing data is processed.\r | |
34d00172 | 490 | @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started.\r |
cff298f4 | 491 | **/\r |
492 | typedef\r | |
493 | EFI_STATUS\r | |
494 | (EFIAPI *EFI_HTTP_POLL) (\r | |
495 | IN EFI_HTTP_PROTOCOL *This\r | |
496 | );\r | |
497 | \r | |
498 | ///\r | |
499 | /// The EFI HTTP protocol is designed to be used by EFI drivers and applications to\r | |
500 | /// create and transmit HTTP Requests, as well as handle HTTP responses that are\r | |
501 | /// returned by a remote host. This EFI protocol uses and relies on an underlying EFI\r | |
502 | /// TCP protocol.\r | |
503 | ///\r | |
504 | struct _EFI_HTTP_PROTOCOL {\r | |
505 | EFI_HTTP_GET_MODE_DATA GetModeData;\r | |
506 | EFI_HTTP_CONFIGURE Configure;\r | |
507 | EFI_HTTP_REQUEST Request;\r | |
508 | EFI_HTTP_CANCEL Cancel;\r | |
509 | EFI_HTTP_RESPONSE Response;\r | |
510 | EFI_HTTP_POLL Poll;\r | |
511 | };\r | |
512 | \r | |
513 | extern EFI_GUID gEfiHttpServiceBindingProtocolGuid;\r | |
514 | extern EFI_GUID gEfiHttpProtocolGuid;\r | |
515 | \r | |
516 | #endif\r |