X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=NetworkPkg%2FHttpDxe%2FHttpProto.h;h=ced8acac367c200f2d1e775cd27f2c33fe3d48ad;hp=3a574949de24657e084fc8445b54b37eb131050b;hb=dac45de3d6afd6da19c192a65ad8493f513fd1be;hpb=072289f45c7ac13e6f70ba4ad739e95086e5d2d2 diff --git a/NetworkPkg/HttpDxe/HttpProto.h b/NetworkPkg/HttpDxe/HttpProto.h index 3a574949de..ced8acac36 100644 --- a/NetworkPkg/HttpDxe/HttpProto.h +++ b/NetworkPkg/HttpDxe/HttpProto.h @@ -2,6 +2,7 @@ The header files of miscellaneous routines for HttpDxe driver. Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -46,6 +47,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define HTTP_BUFFER_SIZE_DEAULT 65535 #define HTTP_MAX_SYN_BACK_LOG 5 #define HTTP_CONNECTION_TIMEOUT 60 +#define HTTP_RESPONSE_TIMEOUT 5 #define HTTP_DATA_RETRIES 12 #define HTTP_FIN_TIMEOUT 2 #define HTTP_KEEP_ALIVE_PROBES 6 @@ -81,6 +83,13 @@ typedef struct { EFI_HTTP_METHOD Method; } HTTP_TCP_TOKEN_WRAP; +typedef struct { + EFI_TLS_VERSION Version; + EFI_TLS_CONNECTION_END ConnectionEnd; + EFI_TLS_VERIFY VerifyMethod; + EFI_TLS_SESSION_STATE SessionState; +} TLS_CONFIG_DATA; + typedef struct _HTTP_PROTOCOL { UINT32 Signature; EFI_HTTP_PROTOCOL Http; @@ -89,9 +98,12 @@ typedef struct _HTTP_PROTOCOL { LIST_ENTRY Link; // Link to all HTTP instance from the service. BOOLEAN InDestroy; INTN State; + EFI_HTTP_METHOD Method; UINTN StatusCode; + EFI_EVENT TimeoutEvent; + EFI_HANDLE Tcp4ChildHandle; EFI_TCP4_PROTOCOL *Tcp4; EFI_TCP4_CONFIG_DATA Tcp4CfgData; @@ -115,9 +127,7 @@ typedef struct _HTTP_PROTOCOL { EFI_TCP6_CLOSE_TOKEN Tcp6CloseToken; BOOLEAN IsTcp6CloseDone; EFI_IPv6_ADDRESS RemoteIpv6Addr; - - - + // // Rx4Token or Rx6Token used for receiving HTTP header. // @@ -150,6 +160,35 @@ typedef struct _HTTP_PROTOCOL { NET_MAP RxTokens; CHAR8 *Url; + + // + // Https Support + // + BOOLEAN UseHttps; + + EFI_HANDLE TlsChildHandle; /// Tls ChildHandle + TLS_CONFIG_DATA TlsConfigData; + EFI_TLS_PROTOCOL *Tls; + EFI_TLS_CONFIGURATION_PROTOCOL *TlsConfiguration; + EFI_TLS_SESSION_STATE TlsSessionState; + + // + // TlsTxData used for transmitting TLS related messages. + // + EFI_TCP4_IO_TOKEN Tcp4TlsTxToken; + EFI_TCP4_TRANSMIT_DATA Tcp4TlsTxData; + EFI_TCP6_IO_TOKEN Tcp6TlsTxToken; + EFI_TCP6_TRANSMIT_DATA Tcp6TlsTxData; + BOOLEAN TlsIsTxDone; + + // + // TlsRxData used for receiving TLS related messages. + // + EFI_TCP4_IO_TOKEN Tcp4TlsRxToken; + EFI_TCP4_RECEIVE_DATA Tcp4TlsRxData; + EFI_TCP6_IO_TOKEN Tcp6TlsRxToken; + EFI_TCP6_RECEIVE_DATA Tcp6TlsRxData; + BOOLEAN TlsIsRxDone; } HTTP_PROTOCOL; typedef struct { @@ -349,7 +388,8 @@ HttpConfigureTcp6 ( ); /** - Check existing TCP connection, if in error state, receover TCP4 connection. + Check existing TCP connection, if in error state, recover TCP4 connection. Then, + connect one TLS session if required. @param[in] HttpInstance The HTTP instance private data. @@ -364,7 +404,8 @@ HttpConnectTcp4 ( ); /** - Check existing TCP connection, if in error state, recover TCP6 connection. + Check existing TCP connection, if in error state, recover TCP6 connection. Then, + connect one TLS session if required. @param[in] HttpInstance The HTTP instance private data. @@ -379,7 +420,7 @@ HttpConnectTcp6 ( ); /** - Send the HTTP message through TCP4 or TCP6. + Send the HTTP or HTTPS message through TCP4 or TCP6. @param[in] HttpInstance The HTTP instance private data. @param[in] Wrap The HTTP token's wrap data. @@ -398,20 +439,6 @@ HttpTransmitTcp ( IN UINTN TxStringLen ); -/** - Translate the status code in HTTP message to EFI_HTTP_STATUS_CODE defined - in UEFI 2.5 specification. - - @param[in] StatusCode The status code value in HTTP message. - - @return Value defined in EFI_HTTP_STATUS_CODE . - -**/ -EFI_HTTP_STATUS_CODE -HttpMappingToStatusCode ( - IN UINTN StatusCode - ); - /** Check whether the user's token or event has already been enqueue on HTTP Tx or Rx Token list. @@ -454,25 +481,27 @@ HttpTcpNotReady ( ); /** - Initialize TCP related data. + Initialize Http session. @param[in] HttpInstance The HTTP instance private data. @param[in] Wrap The HTTP token's wrap data. - @param[in] Configure The Flag indicates whether the first time to initialize Tcp. + @param[in] Configure The Flag indicates whether need to initialize session. + @param[in] TlsConfigure The Flag indicates whether it's the new Tls session. - @retval EFI_SUCCESS The initialization of TCP instance is done. + @retval EFI_SUCCESS The initialization of session is done. @retval Others Other error as indicated. **/ EFI_STATUS -HttpInitTcp ( +HttpInitSession ( IN HTTP_PROTOCOL *HttpInstance, IN HTTP_TOKEN_WRAP *Wrap, - IN BOOLEAN Configure + IN BOOLEAN Configure, + IN BOOLEAN TlsConfigure ); /** - Transmit the HTTP mssage by processing the associated HTTP token. + Transmit the HTTP or HTTPS mssage by processing the associated HTTP token. @param[in] Map The container of TxToken or Tx6Token. @param[in] Item Current item to check against. @@ -517,6 +546,7 @@ HttpTcpReceive ( @param[in] HttpInstance The HTTP instance private data. @param[in, out] SizeofHeaders The HTTP header length. @param[in, out] BufferSize The size of buffer to cacahe the header message. + @param[in] Timeout The time to wait for receiving the header packet. @retval EFI_SUCCESS The HTTP header is received. @retval Others Other errors as indicated. @@ -526,7 +556,8 @@ EFI_STATUS HttpTcpReceiveHeader ( IN HTTP_PROTOCOL *HttpInstance, IN OUT UINTN *SizeofHeaders, - IN OUT UINTN *BufferSize + IN OUT UINTN *BufferSize, + IN EFI_EVENT Timeout ); /** @@ -556,24 +587,6 @@ HttpTcpTokenCleanup ( IN HTTP_TOKEN_WRAP *Wrap ); -/** - Generate HTTP request string. - - @param[in] HttpInstance Pointer to HTTP_PROTOCOL structure. - @param[in] Message Pointer to storage containing HTTP message data. - @param[in] Url The URL of a remote host. - - @return Pointer to the created HTTP request string. - @return NULL if any error occured. - -**/ -CHAR8 * -HttpGenRequestString ( - IN HTTP_PROTOCOL *HttpInstance, - IN EFI_HTTP_MESSAGE *Message, - IN CHAR8 *Url - ); - /** The work function of EfiHttpResponse().