/** @file\r
The header files of miscellaneous routines for HttpDxe driver.\r
\r
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
HTTP_SERVICE_SIGNATURE \\r
)\r
\r
+\r
//\r
// The state of HTTP protocol. It starts from UNCONFIGED.\r
//\r
#define HTTP_BUFFER_SIZE_DEAULT 65535\r
#define HTTP_MAX_SYN_BACK_LOG 5\r
#define HTTP_CONNECTION_TIMEOUT 60\r
+#define HTTP_RESPONSE_TIMEOUT 5\r
#define HTTP_DATA_RETRIES 12\r
#define HTTP_FIN_TIMEOUT 2\r
#define HTTP_KEEP_ALIVE_PROBES 6\r
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
EFI_HANDLE ImageHandle;\r
EFI_HANDLE ControllerHandle;\r
+ EFI_HANDLE Tcp4ChildHandle;\r
+ EFI_HANDLE Tcp6ChildHandle;\r
LIST_ENTRY ChildrenList;\r
UINTN ChildrenNumber;\r
- EFI_HANDLE TcpChildHandle;\r
INTN State;\r
} HTTP_SERVICE;\r
\r
typedef struct {\r
- EFI_TCP4_IO_TOKEN TxToken;\r
- EFI_TCP4_TRANSMIT_DATA TxData;\r
+ EFI_TCP4_IO_TOKEN Tx4Token;\r
+ EFI_TCP4_TRANSMIT_DATA Tx4Data;\r
+ EFI_TCP6_IO_TOKEN Tx6Token;\r
+ EFI_TCP6_TRANSMIT_DATA Tx6Data;\r
+ EFI_TCP4_IO_TOKEN Rx4Token;\r
+ EFI_TCP4_RECEIVE_DATA Rx4Data;\r
+ EFI_TCP6_IO_TOKEN Rx6Token;\r
+ EFI_TCP6_RECEIVE_DATA Rx6Data;\r
BOOLEAN IsTxDone;\r
- EFI_TCP4_IO_TOKEN RxToken;\r
- EFI_TCP4_RECEIVE_DATA RxData;\r
BOOLEAN IsRxDone;\r
UINTN BodyLen;\r
EFI_HTTP_METHOD Method;\r
LIST_ENTRY Link; // Link to all HTTP instance from the service.\r
BOOLEAN InDestroy;\r
INTN State;\r
+ EFI_HTTP_METHOD Method;\r
+\r
+ UINTN StatusCode;\r
\r
- EFI_HANDLE TcpChildHandle;\r
+ EFI_EVENT TimeoutEvent;\r
+\r
+ EFI_HANDLE Tcp4ChildHandle;\r
EFI_TCP4_PROTOCOL *Tcp4;\r
EFI_TCP4_CONFIG_DATA Tcp4CfgData;\r
EFI_TCP4_OPTION Tcp4Option;\r
\r
- EFI_TCP4_CONNECTION_TOKEN ConnToken;\r
- BOOLEAN IsConnDone;\r
- EFI_TCP4_CLOSE_TOKEN CloseToken;\r
- BOOLEAN IsCloseDone;\r
-\r
+ EFI_TCP4_CONNECTION_TOKEN Tcp4ConnToken;\r
+ BOOLEAN IsTcp4ConnDone;\r
+ EFI_TCP4_CLOSE_TOKEN Tcp4CloseToken;\r
+ BOOLEAN IsTcp4CloseDone;\r
CHAR8 *RemoteHost;\r
UINT16 RemotePort;\r
EFI_IPv4_ADDRESS RemoteAddr;\r
+ \r
+ EFI_HANDLE Tcp6ChildHandle;\r
+ EFI_TCP6_PROTOCOL *Tcp6;\r
+ EFI_TCP6_CONFIG_DATA Tcp6CfgData;\r
+ EFI_TCP6_OPTION Tcp6Option;\r
+ \r
+ EFI_TCP6_CONNECTION_TOKEN Tcp6ConnToken;\r
+ BOOLEAN IsTcp6ConnDone;\r
+ EFI_TCP6_CLOSE_TOKEN Tcp6CloseToken;\r
+ BOOLEAN IsTcp6CloseDone;\r
+ EFI_IPv6_ADDRESS RemoteIpv6Addr;\r
+ \r
//\r
- // RxToken used for receiving HTTP header.\r
+ // Rx4Token or Rx6Token used for receiving HTTP header.\r
//\r
- EFI_TCP4_IO_TOKEN RxToken;\r
- EFI_TCP4_RECEIVE_DATA RxData;\r
+ EFI_TCP4_IO_TOKEN Rx4Token;\r
+ EFI_TCP4_RECEIVE_DATA Rx4Data;\r
+ EFI_TCP6_IO_TOKEN Rx6Token;\r
+ EFI_TCP6_RECEIVE_DATA Rx6Data;\r
BOOLEAN IsRxDone;\r
\r
+ CHAR8 **EndofHeader;\r
+ CHAR8 **HttpHeaders;\r
CHAR8 *CacheBody;\r
CHAR8 *NextMsg;\r
UINTN CacheLen;\r
BOOLEAN LocalAddressIsIPv6;\r
\r
EFI_HTTPv4_ACCESS_POINT IPv4Node;\r
+ EFI_HTTPv6_ACCESS_POINT Ipv6Node;\r
\r
NET_MAP TxTokens;\r
NET_MAP RxTokens;\r
);\r
\r
/**\r
- Create events for the TCP4 connection token and TCP4 close token.\r
+ Create events for the TCP connection token and TCP close token.\r
\r
@param[in] HttpInstance Pointer to HTTP_PROTOCOL structure.\r
\r
\r
**/\r
EFI_STATUS\r
-HttpCreateTcp4ConnCloseEvent (\r
+HttpCreateTcpConnCloseEvent (\r
IN HTTP_PROTOCOL *HttpInstance\r
);\r
\r
/**\r
- Close events in the TCP4 connection token and TCP4 close token.\r
+ Close events in the TCP connection token and TCP close token.\r
\r
@param[in] HttpInstance Pointer to HTTP_PROTOCOL structure.\r
\r
**/\r
VOID\r
-HttpCloseTcp4ConnCloseEvent (\r
+HttpCloseTcpConnCloseEvent (\r
IN HTTP_PROTOCOL *HttpInstance\r
);\r
\r
/**\r
- Create event for the TCP4 transmit token.\r
+ Create event for the TCP transmit token.\r
\r
@param[in] Wrap Point to HTTP token's wrap data.\r
\r
\r
**/\r
EFI_STATUS\r
-HttpCreateTcp4TxEvent (\r
+HttpCreateTcpTxEvent (\r
IN HTTP_TOKEN_WRAP *Wrap\r
);\r
\r
/**\r
- Create event for the TCP4 receive token which is used to receive HTTP header.\r
+ Create event for the TCP receive token which is used to receive HTTP header.\r
\r
@param[in] HttpInstance Pointer to HTTP_PROTOCOL structure.\r
\r
\r
**/\r
EFI_STATUS\r
-HttpCreateTcp4RxEventForHeader (\r
+HttpCreateTcpRxEventForHeader (\r
IN HTTP_PROTOCOL *HttpInstance\r
);\r
\r
/**\r
- Create event for the TCP4 receive token which is used to receive HTTP body.\r
+ Create event for the TCP receive token which is used to receive HTTP body.\r
\r
@param[in] Wrap Point to HTTP token's wrap data.\r
\r
\r
**/\r
EFI_STATUS\r
-HttpCreateTcp4RxEvent (\r
+HttpCreateTcpRxEvent (\r
IN HTTP_TOKEN_WRAP *Wrap \r
);\r
\r
+/**\r
+ Close Events for Tcp Receive Tokens for HTTP body and HTTP header.\r
+\r
+ @param[in] Wrap Pointer to HTTP token's wrap data.\r
+ \r
+**/\r
+VOID\r
+HttpCloseTcpRxEvent (\r
+ IN HTTP_TOKEN_WRAP *Wrap\r
+ );\r
+\r
/**\r
Intiialize the HTTP_PROTOCOL structure to the unconfigured state.\r
\r
- @param[in] HttpSb The HTTP service private instance.\r
@param[in, out] HttpInstance Pointer to HTTP_PROTOCOL structure.\r
+ @param[in] IpVersion Indicate us TCP4 protocol or TCP6 protocol.\r
\r
@retval EFI_SUCCESS HTTP_PROTOCOL structure is initialized successfully. \r
@retval Others Other error as indicated.\r
**/\r
EFI_STATUS\r
HttpInitProtocol (\r
- IN HTTP_SERVICE *HttpSb,\r
- IN OUT HTTP_PROTOCOL *HttpInstance\r
+ IN OUT HTTP_PROTOCOL *HttpInstance,\r
+ IN BOOLEAN IpVersion\r
);\r
\r
/**\r
IN HTTP_TOKEN_WRAP *Wrap\r
);\r
\r
+/**\r
+ Configure TCP6 protocol child.\r
+\r
+ @param[in] HttpInstance The HTTP instance private data.\r
+ @param[in] Wrap The HTTP token's wrap data.\r
+\r
+ @retval EFI_SUCCESS The TCP6 protocol child is configured.\r
+ @retval Others Other error as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+HttpConfigureTcp6 (\r
+ IN HTTP_PROTOCOL *HttpInstance,\r
+ IN HTTP_TOKEN_WRAP *Wrap\r
+ );\r
+\r
/**\r
Check existing TCP connection, if in error state, receover TCP4 connection.\r
\r
);\r
\r
/**\r
- Send the HTTP message through TCP4.\r
+ Check existing TCP connection, if in error state, recover TCP6 connection.\r
+\r
+ @param[in] HttpInstance The HTTP instance private data.\r
+\r
+ @retval EFI_SUCCESS The TCP connection is established.\r
+ @retval EFI_NOT_READY TCP6 protocol child is not created or configured.\r
+ @retval Others Other error as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+HttpConnectTcp6 (\r
+ IN HTTP_PROTOCOL *HttpInstance\r
+ );\r
+\r
+/**\r
+ Send the HTTP message through TCP4 or TCP6.\r
\r
@param[in] HttpInstance The HTTP instance private data.\r
@param[in] Wrap The HTTP token's wrap data.\r
\r
**/\r
EFI_STATUS\r
-HttpTransmitTcp4 (\r
+HttpTransmitTcp (\r
IN HTTP_PROTOCOL *HttpInstance,\r
IN HTTP_TOKEN_WRAP *Wrap,\r
IN UINT8 *TxString,\r
IN UINTN TxStringLen\r
);\r
\r
-/**\r
- Translate the status code in HTTP message to EFI_HTTP_STATUS_CODE defined \r
- in UEFI 2.5 specification.\r
-\r
- @param[in] StatusCode The status code value in HTTP message.\r
-\r
- @return Value defined in EFI_HTTP_STATUS_CODE .\r
-\r
-**/\r
-EFI_HTTP_STATUS_CODE\r
-HttpMappingToStatusCode (\r
- IN UINTN StatusCode\r
- );\r
-\r
/**\r
Check whether the user's token or event has already\r
- been enqueue on HTTP TxToken or RxToken list.\r
+ been enqueue on HTTP Tx or Rx Token list.\r
\r
@param[in] Map The container of either user's transmit or receive\r
token.\r
);\r
\r
/**\r
- Check whether the HTTP message associated with TxToken is already sent out.\r
+ Check whether the HTTP message associated with TxToken or Tx6Token is already sent out.\r
\r
@param[in] Map The container of TxToken.\r
@param[in] Item Current item to check against.\r
IN VOID *Context\r
);\r
\r
+/**\r
+ Initialize TCP related data.\r
+\r
+ @param[in] HttpInstance The HTTP instance private data.\r
+ @param[in] Wrap The HTTP token's wrap data.\r
+ @param[in] Configure The Flag indicates whether the first time to initialize Tcp.\r
+\r
+ @retval EFI_SUCCESS The initialization of TCP instance is done. \r
+ @retval Others Other error as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+HttpInitTcp (\r
+ IN HTTP_PROTOCOL *HttpInstance,\r
+ IN HTTP_TOKEN_WRAP *Wrap,\r
+ IN BOOLEAN Configure\r
+ );\r
+\r
/**\r
Transmit the HTTP mssage by processing the associated HTTP token.\r
\r
- @param[in] Map The container of TxToken.\r
+ @param[in] Map The container of TxToken or Tx6Token.\r
@param[in] Item Current item to check against.\r
@param[in] Context The Token to check againist.\r
\r
/**\r
Receive the HTTP response by processing the associated HTTP token.\r
\r
- @param[in] Map The container of RxToken.\r
+ @param[in] Map The container of Rx4Token or Rx6Token.\r
@param[in] Item Current item to check against.\r
@param[in] Context The Token to check againist.\r
\r
);\r
\r
/**\r
- Generate HTTP request string.\r
+ Receive the HTTP header by processing the associated HTTP token.\r
\r
- @param[in] HttpInstance Pointer to HTTP_PROTOCOL structure.\r
- @param[in] Message Pointer to storage containing HTTP message data.\r
- @param[in] Url The URL of a remote host.\r
+ @param[in] HttpInstance The HTTP instance private data.\r
+ @param[in, out] SizeofHeaders The HTTP header length.\r
+ @param[in, out] BufferSize The size of buffer to cacahe the header message.\r
+ @param[in] Timeout The time to wait for receiving the header packet.\r
\r
- @return Pointer to the created HTTP request string.\r
- @return NULL if any error occured.\r
+ @retval EFI_SUCCESS The HTTP header is received. \r
+ @retval Others Other errors as indicated.\r
\r
**/\r
-CHAR8 *\r
-HttpGenRequestString (\r
- IN HTTP_PROTOCOL *HttpInstance,\r
- IN EFI_HTTP_MESSAGE *Message,\r
- IN CHAR8 *Url\r
+EFI_STATUS\r
+HttpTcpReceiveHeader (\r
+ IN HTTP_PROTOCOL *HttpInstance,\r
+ IN OUT UINTN *SizeofHeaders,\r
+ IN OUT UINTN *BufferSize,\r
+ IN EFI_EVENT Timeout\r
+ );\r
+\r
+/**\r
+ Receive the HTTP body by processing the associated HTTP token.\r
+\r
+ @param[in] Wrap The HTTP token's wrap data.\r
+ @param[in] HttpMsg The HTTP message data.\r
+\r
+ @retval EFI_SUCCESS The HTTP body is received. \r
+ @retval Others Other error as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+HttpTcpReceiveBody (\r
+ IN HTTP_TOKEN_WRAP *Wrap,\r
+ IN EFI_HTTP_MESSAGE *HttpMsg\r
+ );\r
+\r
+/**\r
+ Clean up Tcp Tokens while the Tcp transmission error occurs.\r
+\r
+ @param[in] Wrap Pointer to HTTP token's wrap data.\r
+ \r
+**/\r
+VOID\r
+HttpTcpTokenCleanup (\r
+ IN HTTP_TOKEN_WRAP *Wrap\r
);\r
\r
/**\r