1 | /** @file
|
---|
2 | The header files of miscellaneous routines for HttpDxe driver.
|
---|
3 |
|
---|
4 | Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
|
---|
5 | (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
---|
6 | Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
|
---|
7 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
8 |
|
---|
9 | **/
|
---|
10 |
|
---|
11 | #ifndef __EFI_HTTP_PROTO_H__
|
---|
12 | #define __EFI_HTTP_PROTO_H__
|
---|
13 |
|
---|
14 | #define DEF_BUF_LEN 2048
|
---|
15 |
|
---|
16 | #define HTTP_SERVICE_SIGNATURE SIGNATURE_32('H', 't', 't', 'S')
|
---|
17 |
|
---|
18 | #define HTTP_SERVICE_FROM_PROTOCOL(a) \
|
---|
19 | CR ( \
|
---|
20 | (a), \
|
---|
21 | HTTP_SERVICE, \
|
---|
22 | ServiceBinding, \
|
---|
23 | HTTP_SERVICE_SIGNATURE \
|
---|
24 | )
|
---|
25 |
|
---|
26 | //
|
---|
27 | // The state of HTTP protocol. It starts from UNCONFIGED.
|
---|
28 | //
|
---|
29 | #define HTTP_STATE_UNCONFIGED 0
|
---|
30 | #define HTTP_STATE_HTTP_CONFIGED 1
|
---|
31 | #define HTTP_STATE_TCP_CONFIGED 2
|
---|
32 | #define HTTP_STATE_TCP_UNCONFIGED 3
|
---|
33 | #define HTTP_STATE_TCP_CONNECTED 4
|
---|
34 | #define HTTP_STATE_TCP_CLOSED 5
|
---|
35 |
|
---|
36 | //
|
---|
37 | // TCP configured data.
|
---|
38 | //
|
---|
39 | #define HTTP_TOS_DEAULT 8
|
---|
40 | #define HTTP_TTL_DEAULT 255
|
---|
41 | #define HTTP_BUFFER_SIZE_DEAULT 0x200000
|
---|
42 | #define HTTP_MAX_SYN_BACK_LOG 5
|
---|
43 | #define HTTP_CONNECTION_TIMEOUT 60
|
---|
44 | #define HTTP_DATA_RETRIES 12
|
---|
45 | #define HTTP_FIN_TIMEOUT 2
|
---|
46 | #define HTTP_KEEP_ALIVE_PROBES 6
|
---|
47 | #define HTTP_KEEP_ALIVE_TIME 7200
|
---|
48 | #define HTTP_KEEP_ALIVE_INTERVAL 30
|
---|
49 |
|
---|
50 | #define HTTP_URL_BUFFER_LEN 4096
|
---|
51 |
|
---|
52 | typedef struct _HTTP_SERVICE {
|
---|
53 | UINT32 Signature;
|
---|
54 | EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
|
---|
55 | EFI_HANDLE Ip4DriverBindingHandle;
|
---|
56 | EFI_HANDLE Ip6DriverBindingHandle;
|
---|
57 | EFI_HANDLE ControllerHandle;
|
---|
58 | EFI_HANDLE Tcp4ChildHandle;
|
---|
59 | EFI_HANDLE Tcp6ChildHandle;
|
---|
60 | LIST_ENTRY ChildrenList;
|
---|
61 | UINTN ChildrenNumber;
|
---|
62 | INTN State;
|
---|
63 | } HTTP_SERVICE;
|
---|
64 |
|
---|
65 | typedef struct {
|
---|
66 | EFI_TCP4_IO_TOKEN Tx4Token;
|
---|
67 | EFI_TCP4_TRANSMIT_DATA Tx4Data;
|
---|
68 | EFI_TCP6_IO_TOKEN Tx6Token;
|
---|
69 | EFI_TCP6_TRANSMIT_DATA Tx6Data;
|
---|
70 | EFI_TCP4_IO_TOKEN Rx4Token;
|
---|
71 | EFI_TCP4_RECEIVE_DATA Rx4Data;
|
---|
72 | EFI_TCP6_IO_TOKEN Rx6Token;
|
---|
73 | EFI_TCP6_RECEIVE_DATA Rx6Data;
|
---|
74 | BOOLEAN IsTxDone;
|
---|
75 | BOOLEAN IsRxDone;
|
---|
76 | UINTN BodyLen;
|
---|
77 | EFI_HTTP_METHOD Method;
|
---|
78 | } HTTP_TCP_TOKEN_WRAP;
|
---|
79 |
|
---|
80 | typedef struct {
|
---|
81 | EFI_TLS_VERSION Version;
|
---|
82 | EFI_TLS_CONNECTION_END ConnectionEnd;
|
---|
83 | EFI_TLS_VERIFY VerifyMethod;
|
---|
84 | EFI_TLS_VERIFY_HOST VerifyHost;
|
---|
85 | EFI_TLS_SESSION_STATE SessionState;
|
---|
86 | } TLS_CONFIG_DATA;
|
---|
87 |
|
---|
88 | //
|
---|
89 | // Callback data for HTTP_PARSER_CALLBACK()
|
---|
90 | //
|
---|
91 | typedef struct {
|
---|
92 | UINTN ParseDataLength;
|
---|
93 | VOID *ParseData;
|
---|
94 | VOID *Wrap;
|
---|
95 | } HTTP_CALLBACK_DATA;
|
---|
96 |
|
---|
97 | typedef struct _HTTP_PROTOCOL {
|
---|
98 | UINT32 Signature;
|
---|
99 | EFI_HTTP_PROTOCOL Http;
|
---|
100 | EFI_HANDLE Handle;
|
---|
101 | HTTP_SERVICE *Service;
|
---|
102 | LIST_ENTRY Link; // Link to all HTTP instance from the service.
|
---|
103 | BOOLEAN InDestroy;
|
---|
104 | INTN State;
|
---|
105 | EFI_HTTP_METHOD Method;
|
---|
106 |
|
---|
107 | UINTN StatusCode;
|
---|
108 |
|
---|
109 | EFI_EVENT TimeoutEvent;
|
---|
110 |
|
---|
111 | EFI_HANDLE Tcp4ChildHandle;
|
---|
112 | EFI_TCP4_PROTOCOL *Tcp4;
|
---|
113 | EFI_TCP4_CONFIG_DATA Tcp4CfgData;
|
---|
114 | EFI_TCP4_OPTION Tcp4Option;
|
---|
115 |
|
---|
116 | EFI_TCP4_CONNECTION_TOKEN Tcp4ConnToken;
|
---|
117 | BOOLEAN IsTcp4ConnDone;
|
---|
118 | EFI_TCP4_CLOSE_TOKEN Tcp4CloseToken;
|
---|
119 | BOOLEAN IsTcp4CloseDone;
|
---|
120 | CHAR8 *RemoteHost;
|
---|
121 | UINT16 RemotePort;
|
---|
122 | EFI_IPv4_ADDRESS RemoteAddr;
|
---|
123 |
|
---|
124 | EFI_HANDLE Tcp6ChildHandle;
|
---|
125 | EFI_TCP6_PROTOCOL *Tcp6;
|
---|
126 | EFI_TCP6_CONFIG_DATA Tcp6CfgData;
|
---|
127 | EFI_TCP6_OPTION Tcp6Option;
|
---|
128 |
|
---|
129 | EFI_TCP6_CONNECTION_TOKEN Tcp6ConnToken;
|
---|
130 | BOOLEAN IsTcp6ConnDone;
|
---|
131 | EFI_TCP6_CLOSE_TOKEN Tcp6CloseToken;
|
---|
132 | BOOLEAN IsTcp6CloseDone;
|
---|
133 | EFI_IPv6_ADDRESS RemoteIpv6Addr;
|
---|
134 |
|
---|
135 | //
|
---|
136 | // Rx4Token or Rx6Token used for receiving HTTP header.
|
---|
137 | //
|
---|
138 | EFI_TCP4_IO_TOKEN Rx4Token;
|
---|
139 | EFI_TCP4_RECEIVE_DATA Rx4Data;
|
---|
140 | EFI_TCP6_IO_TOKEN Rx6Token;
|
---|
141 | EFI_TCP6_RECEIVE_DATA Rx6Data;
|
---|
142 | BOOLEAN IsRxDone;
|
---|
143 |
|
---|
144 | CHAR8 **EndofHeader;
|
---|
145 | CHAR8 **HttpHeaders;
|
---|
146 | CHAR8 *CacheBody;
|
---|
147 | CHAR8 *NextMsg;
|
---|
148 | UINTN CacheLen;
|
---|
149 | UINTN CacheOffset;
|
---|
150 |
|
---|
151 | //
|
---|
152 | // HTTP message-body parser.
|
---|
153 | //
|
---|
154 | VOID *MsgParser;
|
---|
155 | HTTP_CALLBACK_DATA CallbackData;
|
---|
156 |
|
---|
157 | EFI_HTTP_VERSION HttpVersion;
|
---|
158 | UINT32 TimeOutMillisec;
|
---|
159 | BOOLEAN LocalAddressIsIPv6;
|
---|
160 |
|
---|
161 | EFI_HTTPv4_ACCESS_POINT IPv4Node;
|
---|
162 | EFI_HTTPv6_ACCESS_POINT Ipv6Node;
|
---|
163 |
|
---|
164 | NET_MAP TxTokens;
|
---|
165 | NET_MAP RxTokens;
|
---|
166 |
|
---|
167 | CHAR8 *Url;
|
---|
168 |
|
---|
169 | //
|
---|
170 | // Https Support
|
---|
171 | //
|
---|
172 | BOOLEAN UseHttps;
|
---|
173 |
|
---|
174 | EFI_SERVICE_BINDING_PROTOCOL *TlsSb;
|
---|
175 | BOOLEAN TlsAlreadyCreated;
|
---|
176 | TLS_CONFIG_DATA TlsConfigData;
|
---|
177 | EFI_TLS_PROTOCOL *Tls;
|
---|
178 | EFI_TLS_CONFIGURATION_PROTOCOL *TlsConfiguration;
|
---|
179 | EFI_TLS_SESSION_STATE TlsSessionState;
|
---|
180 |
|
---|
181 | //
|
---|
182 | // TlsTxData used for transmitting TLS related messages.
|
---|
183 | //
|
---|
184 | EFI_TCP4_IO_TOKEN Tcp4TlsTxToken;
|
---|
185 | EFI_TCP4_TRANSMIT_DATA Tcp4TlsTxData;
|
---|
186 | EFI_TCP6_IO_TOKEN Tcp6TlsTxToken;
|
---|
187 | EFI_TCP6_TRANSMIT_DATA Tcp6TlsTxData;
|
---|
188 | BOOLEAN TlsIsTxDone;
|
---|
189 |
|
---|
190 | //
|
---|
191 | // TlsRxData used for receiving TLS related messages.
|
---|
192 | //
|
---|
193 | EFI_TCP4_IO_TOKEN Tcp4TlsRxToken;
|
---|
194 | EFI_TCP4_RECEIVE_DATA Tcp4TlsRxData;
|
---|
195 | EFI_TCP6_IO_TOKEN Tcp6TlsRxToken;
|
---|
196 | EFI_TCP6_RECEIVE_DATA Tcp6TlsRxData;
|
---|
197 | BOOLEAN TlsIsRxDone;
|
---|
198 |
|
---|
199 | BOOLEAN ConnectionClose;
|
---|
200 | } HTTP_PROTOCOL;
|
---|
201 |
|
---|
202 | typedef struct {
|
---|
203 | EFI_HTTP_TOKEN *HttpToken;
|
---|
204 | HTTP_PROTOCOL *HttpInstance;
|
---|
205 | HTTP_TCP_TOKEN_WRAP TcpWrap;
|
---|
206 | } HTTP_TOKEN_WRAP;
|
---|
207 |
|
---|
208 | #define HTTP_PROTOCOL_SIGNATURE SIGNATURE_32('H', 't', 't', 'P')
|
---|
209 |
|
---|
210 | #define HTTP_INSTANCE_FROM_PROTOCOL(a) \
|
---|
211 | CR ( \
|
---|
212 | (a), \
|
---|
213 | HTTP_PROTOCOL, \
|
---|
214 | Http, \
|
---|
215 | HTTP_PROTOCOL_SIGNATURE \
|
---|
216 | )
|
---|
217 |
|
---|
218 | /**
|
---|
219 | The common notify function used in HTTP driver.
|
---|
220 |
|
---|
221 | @param[in] Event The event signaled.
|
---|
222 | @param[in] Context The context.
|
---|
223 |
|
---|
224 | **/
|
---|
225 | VOID
|
---|
226 | EFIAPI
|
---|
227 | HttpCommonNotify (
|
---|
228 | IN EFI_EVENT Event,
|
---|
229 | IN VOID *Context
|
---|
230 | );
|
---|
231 |
|
---|
232 | /**
|
---|
233 | Create events for the TCP connection token and TCP close token.
|
---|
234 |
|
---|
235 | @param[in] HttpInstance Pointer to HTTP_PROTOCOL structure.
|
---|
236 |
|
---|
237 | @retval EFI_SUCCESS The events are created successfully.
|
---|
238 | @retval others Other error as indicated.
|
---|
239 |
|
---|
240 | **/
|
---|
241 | EFI_STATUS
|
---|
242 | HttpCreateTcpConnCloseEvent (
|
---|
243 | IN HTTP_PROTOCOL *HttpInstance
|
---|
244 | );
|
---|
245 |
|
---|
246 | /**
|
---|
247 | Close events in the TCP connection token and TCP close token.
|
---|
248 |
|
---|
249 | @param[in] HttpInstance Pointer to HTTP_PROTOCOL structure.
|
---|
250 |
|
---|
251 | **/
|
---|
252 | VOID
|
---|
253 | HttpCloseTcpConnCloseEvent (
|
---|
254 | IN HTTP_PROTOCOL *HttpInstance
|
---|
255 | );
|
---|
256 |
|
---|
257 | /**
|
---|
258 | Create event for the TCP transmit token.
|
---|
259 |
|
---|
260 | @param[in] Wrap Point to HTTP token's wrap data.
|
---|
261 |
|
---|
262 | @retval EFI_SUCCESS The events is created successfully.
|
---|
263 | @retval others Other error as indicated.
|
---|
264 |
|
---|
265 | **/
|
---|
266 | EFI_STATUS
|
---|
267 | HttpCreateTcpTxEvent (
|
---|
268 | IN HTTP_TOKEN_WRAP *Wrap
|
---|
269 | );
|
---|
270 |
|
---|
271 | /**
|
---|
272 | Create event for the TCP receive token which is used to receive HTTP header.
|
---|
273 |
|
---|
274 | @param[in] HttpInstance Pointer to HTTP_PROTOCOL structure.
|
---|
275 |
|
---|
276 | @retval EFI_SUCCESS The events is created successfully.
|
---|
277 | @retval others Other error as indicated.
|
---|
278 |
|
---|
279 | **/
|
---|
280 | EFI_STATUS
|
---|
281 | HttpCreateTcpRxEventForHeader (
|
---|
282 | IN HTTP_PROTOCOL *HttpInstance
|
---|
283 | );
|
---|
284 |
|
---|
285 | /**
|
---|
286 | Create event for the TCP receive token which is used to receive HTTP body.
|
---|
287 |
|
---|
288 | @param[in] Wrap Point to HTTP token's wrap data.
|
---|
289 |
|
---|
290 | @retval EFI_SUCCESS The events is created successfully.
|
---|
291 | @retval others Other error as indicated.
|
---|
292 |
|
---|
293 | **/
|
---|
294 | EFI_STATUS
|
---|
295 | HttpCreateTcpRxEvent (
|
---|
296 | IN HTTP_TOKEN_WRAP *Wrap
|
---|
297 | );
|
---|
298 |
|
---|
299 | /**
|
---|
300 | Close Events for Tcp Receive Tokens for HTTP body and HTTP header.
|
---|
301 |
|
---|
302 | @param[in] Wrap Pointer to HTTP token's wrap data.
|
---|
303 |
|
---|
304 | **/
|
---|
305 | VOID
|
---|
306 | HttpCloseTcpRxEvent (
|
---|
307 | IN HTTP_TOKEN_WRAP *Wrap
|
---|
308 | );
|
---|
309 |
|
---|
310 | /**
|
---|
311 | Initialize the HTTP_PROTOCOL structure to the unconfigured state.
|
---|
312 |
|
---|
313 | @param[in, out] HttpInstance Pointer to HTTP_PROTOCOL structure.
|
---|
314 | @param[in] IpVersion Indicate us TCP4 protocol or TCP6 protocol.
|
---|
315 |
|
---|
316 | @retval EFI_SUCCESS HTTP_PROTOCOL structure is initialized successfully.
|
---|
317 | @retval Others Other error as indicated.
|
---|
318 |
|
---|
319 | **/
|
---|
320 | EFI_STATUS
|
---|
321 | HttpInitProtocol (
|
---|
322 | IN OUT HTTP_PROTOCOL *HttpInstance,
|
---|
323 | IN BOOLEAN IpVersion
|
---|
324 | );
|
---|
325 |
|
---|
326 | /**
|
---|
327 | Clean up the HTTP child, release all the resources used by it.
|
---|
328 |
|
---|
329 | @param[in] HttpInstance The HTTP child to clean up.
|
---|
330 |
|
---|
331 | **/
|
---|
332 | VOID
|
---|
333 | HttpCleanProtocol (
|
---|
334 | IN HTTP_PROTOCOL *HttpInstance
|
---|
335 | );
|
---|
336 |
|
---|
337 | /**
|
---|
338 | Establish TCP connection with HTTP server.
|
---|
339 |
|
---|
340 | @param[in] HttpInstance The HTTP instance private data.
|
---|
341 |
|
---|
342 | @retval EFI_SUCCESS The TCP connection is established.
|
---|
343 | @retval Others Other error as indicated.
|
---|
344 |
|
---|
345 | **/
|
---|
346 | EFI_STATUS
|
---|
347 | HttpCreateConnection (
|
---|
348 | IN HTTP_PROTOCOL *HttpInstance
|
---|
349 | );
|
---|
350 |
|
---|
351 | /**
|
---|
352 | Close existing TCP connection.
|
---|
353 |
|
---|
354 | @param[in] HttpInstance The HTTP instance private data.
|
---|
355 |
|
---|
356 | @retval EFI_SUCCESS The TCP connection is closed.
|
---|
357 | @retval Others Other error as indicated.
|
---|
358 |
|
---|
359 | **/
|
---|
360 | EFI_STATUS
|
---|
361 | HttpCloseConnection (
|
---|
362 | IN HTTP_PROTOCOL *HttpInstance
|
---|
363 | );
|
---|
364 |
|
---|
365 | /**
|
---|
366 | Configure TCP4 protocol child.
|
---|
367 |
|
---|
368 | @param[in] HttpInstance The HTTP instance private data.
|
---|
369 | @param[in] Wrap The HTTP token's wrap data.
|
---|
370 |
|
---|
371 | @retval EFI_SUCCESS The TCP4 protocol child is configured.
|
---|
372 | @retval Others Other error as indicated.
|
---|
373 |
|
---|
374 | **/
|
---|
375 | EFI_STATUS
|
---|
376 | HttpConfigureTcp4 (
|
---|
377 | IN HTTP_PROTOCOL *HttpInstance,
|
---|
378 | IN HTTP_TOKEN_WRAP *Wrap
|
---|
379 | );
|
---|
380 |
|
---|
381 | /**
|
---|
382 | Configure TCP6 protocol child.
|
---|
383 |
|
---|
384 | @param[in] HttpInstance The HTTP instance private data.
|
---|
385 | @param[in] Wrap The HTTP token's wrap data.
|
---|
386 |
|
---|
387 | @retval EFI_SUCCESS The TCP6 protocol child is configured.
|
---|
388 | @retval Others Other error as indicated.
|
---|
389 |
|
---|
390 | **/
|
---|
391 | EFI_STATUS
|
---|
392 | HttpConfigureTcp6 (
|
---|
393 | IN HTTP_PROTOCOL *HttpInstance,
|
---|
394 | IN HTTP_TOKEN_WRAP *Wrap
|
---|
395 | );
|
---|
396 |
|
---|
397 | /**
|
---|
398 | Check existing TCP connection, if in error state, recover TCP4 connection. Then,
|
---|
399 | connect one TLS session if required.
|
---|
400 |
|
---|
401 | @param[in] HttpInstance The HTTP instance private data.
|
---|
402 |
|
---|
403 | @retval EFI_SUCCESS The TCP connection is established.
|
---|
404 | @retval EFI_NOT_READY TCP4 protocol child is not created or configured.
|
---|
405 | @retval Others Other error as indicated.
|
---|
406 |
|
---|
407 | **/
|
---|
408 | EFI_STATUS
|
---|
409 | HttpConnectTcp4 (
|
---|
410 | IN HTTP_PROTOCOL *HttpInstance
|
---|
411 | );
|
---|
412 |
|
---|
413 | /**
|
---|
414 | Check existing TCP connection, if in error state, recover TCP6 connection. Then,
|
---|
415 | connect one TLS session if required.
|
---|
416 |
|
---|
417 | @param[in] HttpInstance The HTTP instance private data.
|
---|
418 |
|
---|
419 | @retval EFI_SUCCESS The TCP connection is established.
|
---|
420 | @retval EFI_NOT_READY TCP6 protocol child is not created or configured.
|
---|
421 | @retval Others Other error as indicated.
|
---|
422 |
|
---|
423 | **/
|
---|
424 | EFI_STATUS
|
---|
425 | HttpConnectTcp6 (
|
---|
426 | IN HTTP_PROTOCOL *HttpInstance
|
---|
427 | );
|
---|
428 |
|
---|
429 | /**
|
---|
430 | Send the HTTP or HTTPS message through TCP4 or TCP6.
|
---|
431 |
|
---|
432 | @param[in] HttpInstance The HTTP instance private data.
|
---|
433 | @param[in] Wrap The HTTP token's wrap data.
|
---|
434 | @param[in] TxString Buffer containing the HTTP message string.
|
---|
435 | @param[in] TxStringLen Length of the HTTP message string in bytes.
|
---|
436 |
|
---|
437 | @retval EFI_SUCCESS The HTTP message is queued into TCP transmit queue.
|
---|
438 | @retval Others Other error as indicated.
|
---|
439 |
|
---|
440 | **/
|
---|
441 | EFI_STATUS
|
---|
442 | HttpTransmitTcp (
|
---|
443 | IN HTTP_PROTOCOL *HttpInstance,
|
---|
444 | IN HTTP_TOKEN_WRAP *Wrap,
|
---|
445 | IN UINT8 *TxString,
|
---|
446 | IN UINTN TxStringLen
|
---|
447 | );
|
---|
448 |
|
---|
449 | /**
|
---|
450 | Check whether the user's token or event has already
|
---|
451 | been enqueue on HTTP Tx or Rx Token list.
|
---|
452 |
|
---|
453 | @param[in] Map The container of either user's transmit or receive
|
---|
454 | token.
|
---|
455 | @param[in] Item Current item to check against.
|
---|
456 | @param[in] Context The Token to check against.
|
---|
457 |
|
---|
458 | @retval EFI_ACCESS_DENIED The token or event has already been enqueued in IP
|
---|
459 | @retval EFI_SUCCESS The current item isn't the same token/event as the
|
---|
460 | context.
|
---|
461 |
|
---|
462 | **/
|
---|
463 | EFI_STATUS
|
---|
464 | EFIAPI
|
---|
465 | HttpTokenExist (
|
---|
466 | IN NET_MAP *Map,
|
---|
467 | IN NET_MAP_ITEM *Item,
|
---|
468 | IN VOID *Context
|
---|
469 | );
|
---|
470 |
|
---|
471 | /**
|
---|
472 | Check whether the HTTP message associated with TxToken or Tx6Token is already sent out.
|
---|
473 |
|
---|
474 | @param[in] Map The container of TxToken.
|
---|
475 | @param[in] Item Current item to check against.
|
---|
476 | @param[in] Context The Token to check against.
|
---|
477 |
|
---|
478 | @retval EFI_NOT_READY The HTTP message is still queued in the list.
|
---|
479 | @retval EFI_SUCCESS The HTTP message has been sent out.
|
---|
480 |
|
---|
481 | **/
|
---|
482 | EFI_STATUS
|
---|
483 | EFIAPI
|
---|
484 | HttpTcpNotReady (
|
---|
485 | IN NET_MAP *Map,
|
---|
486 | IN NET_MAP_ITEM *Item,
|
---|
487 | IN VOID *Context
|
---|
488 | );
|
---|
489 |
|
---|
490 | /**
|
---|
491 | Initialize Http session.
|
---|
492 |
|
---|
493 | @param[in] HttpInstance The HTTP instance private data.
|
---|
494 | @param[in] Wrap The HTTP token's wrap data.
|
---|
495 | @param[in] Configure The Flag indicates whether need to initialize session.
|
---|
496 | @param[in] TlsConfigure The Flag indicates whether it's the new Tls session.
|
---|
497 |
|
---|
498 | @retval EFI_SUCCESS The initialization of session is done.
|
---|
499 | @retval Others Other error as indicated.
|
---|
500 |
|
---|
501 | **/
|
---|
502 | EFI_STATUS
|
---|
503 | HttpInitSession (
|
---|
504 | IN HTTP_PROTOCOL *HttpInstance,
|
---|
505 | IN HTTP_TOKEN_WRAP *Wrap,
|
---|
506 | IN BOOLEAN Configure,
|
---|
507 | IN BOOLEAN TlsConfigure
|
---|
508 | );
|
---|
509 |
|
---|
510 | /**
|
---|
511 | Transmit the HTTP or HTTPS message by processing the associated HTTP token.
|
---|
512 |
|
---|
513 | @param[in] Map The container of TxToken or Tx6Token.
|
---|
514 | @param[in] Item Current item to check against.
|
---|
515 | @param[in] Context The Token to check against.
|
---|
516 |
|
---|
517 | @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
|
---|
518 | @retval EFI_SUCCESS The HTTP message is queued into TCP transmit
|
---|
519 | queue.
|
---|
520 |
|
---|
521 | **/
|
---|
522 | EFI_STATUS
|
---|
523 | EFIAPI
|
---|
524 | HttpTcpTransmit (
|
---|
525 | IN NET_MAP *Map,
|
---|
526 | IN NET_MAP_ITEM *Item,
|
---|
527 | IN VOID *Context
|
---|
528 | );
|
---|
529 |
|
---|
530 | /**
|
---|
531 | Receive the HTTP response by processing the associated HTTP token.
|
---|
532 |
|
---|
533 | @param[in] Map The container of Rx4Token or Rx6Token.
|
---|
534 | @param[in] Item Current item to check against.
|
---|
535 | @param[in] Context The Token to check against.
|
---|
536 |
|
---|
537 | @retval EFI_SUCCESS The HTTP response is queued into TCP receive
|
---|
538 | queue.
|
---|
539 | @retval Others Other error as indicated.
|
---|
540 |
|
---|
541 | **/
|
---|
542 | EFI_STATUS
|
---|
543 | EFIAPI
|
---|
544 | HttpTcpReceive (
|
---|
545 | IN NET_MAP *Map,
|
---|
546 | IN NET_MAP_ITEM *Item,
|
---|
547 | IN VOID *Context
|
---|
548 | );
|
---|
549 |
|
---|
550 | /**
|
---|
551 | Receive the HTTP header by processing the associated HTTP token.
|
---|
552 |
|
---|
553 | @param[in] HttpInstance The HTTP instance private data.
|
---|
554 | @param[in, out] SizeofHeaders The HTTP header length.
|
---|
555 | @param[in, out] BufferSize The size of buffer to cache the header message.
|
---|
556 | @param[in] Timeout The time to wait for receiving the header packet.
|
---|
557 |
|
---|
558 | @retval EFI_SUCCESS The HTTP header is received.
|
---|
559 | @retval Others Other errors as indicated.
|
---|
560 |
|
---|
561 | **/
|
---|
562 | EFI_STATUS
|
---|
563 | HttpTcpReceiveHeader (
|
---|
564 | IN HTTP_PROTOCOL *HttpInstance,
|
---|
565 | IN OUT UINTN *SizeofHeaders,
|
---|
566 | IN OUT UINTN *BufferSize,
|
---|
567 | IN EFI_EVENT Timeout
|
---|
568 | );
|
---|
569 |
|
---|
570 | /**
|
---|
571 | Receive the HTTP body by processing the associated HTTP token.
|
---|
572 |
|
---|
573 | @param[in] Wrap The HTTP token's wrap data.
|
---|
574 | @param[in] HttpMsg The HTTP message data.
|
---|
575 |
|
---|
576 | @retval EFI_SUCCESS The HTTP body is received.
|
---|
577 | @retval Others Other error as indicated.
|
---|
578 |
|
---|
579 | **/
|
---|
580 | EFI_STATUS
|
---|
581 | HttpTcpReceiveBody (
|
---|
582 | IN HTTP_TOKEN_WRAP *Wrap,
|
---|
583 | IN EFI_HTTP_MESSAGE *HttpMsg
|
---|
584 | );
|
---|
585 |
|
---|
586 | /**
|
---|
587 | Clean up Tcp Tokens while the Tcp transmission error occurs.
|
---|
588 |
|
---|
589 | @param[in] Wrap Pointer to HTTP token's wrap data.
|
---|
590 |
|
---|
591 | **/
|
---|
592 | VOID
|
---|
593 | HttpTcpTokenCleanup (
|
---|
594 | IN HTTP_TOKEN_WRAP *Wrap
|
---|
595 | );
|
---|
596 |
|
---|
597 | /**
|
---|
598 | The work function of EfiHttpResponse().
|
---|
599 |
|
---|
600 | @param[in] Wrap Pointer to HTTP token's wrap data.
|
---|
601 |
|
---|
602 | @retval EFI_SUCCESS Allocation succeeded.
|
---|
603 | @retval EFI_OUT_OF_RESOURCES Failed to complete the operation due to lack of resources.
|
---|
604 | @retval EFI_NOT_READY Can't find a corresponding TxToken.
|
---|
605 |
|
---|
606 | **/
|
---|
607 | EFI_STATUS
|
---|
608 | HttpResponseWorker (
|
---|
609 | IN HTTP_TOKEN_WRAP *Wrap
|
---|
610 | );
|
---|
611 |
|
---|
612 | /**
|
---|
613 | Send Events via EDKII_HTTP_CALLBACK_PROTOCOL.
|
---|
614 |
|
---|
615 | @param[in] Event The event that occurs in the current state.
|
---|
616 | @param[in] EventStatus The Status of Event, EFI_SUCCESS or other errors.
|
---|
617 |
|
---|
618 | **/
|
---|
619 | VOID
|
---|
620 | HttpNotify (
|
---|
621 | IN EDKII_HTTP_CALLBACK_EVENT Event,
|
---|
622 | IN EFI_STATUS EventStatus
|
---|
623 | );
|
---|
624 |
|
---|
625 | #endif
|
---|