NetworkPkg/HttpDxe: HTTPS support over IPv4 and IPv6
[mirror_edk2.git] / NetworkPkg / HttpDxe / HttpProto.h
index e1fd785b2cefe2d01c0f70c05e5cacefa8fe8f60..ced8acac367c200f2d1e775cd27f2c33fe3d48ad 100644 (file)
@@ -83,6 +83,13 @@ typedef struct {
   EFI_HTTP_METHOD               Method;\r
 } HTTP_TCP_TOKEN_WRAP;\r
 \r
+typedef struct {\r
+  EFI_TLS_VERSION               Version;\r
+  EFI_TLS_CONNECTION_END        ConnectionEnd;\r
+  EFI_TLS_VERIFY                VerifyMethod;\r
+  EFI_TLS_SESSION_STATE         SessionState;\r
+} TLS_CONFIG_DATA;\r
+\r
 typedef struct _HTTP_PROTOCOL {\r
   UINT32                        Signature;\r
   EFI_HTTP_PROTOCOL             Http;\r
@@ -153,6 +160,35 @@ typedef struct _HTTP_PROTOCOL {
   NET_MAP                       RxTokens;\r
 \r
   CHAR8                         *Url;\r
+\r
+  //\r
+  // Https Support\r
+  //\r
+  BOOLEAN                          UseHttps;\r
+  \r
+  EFI_HANDLE                       TlsChildHandle; /// Tls ChildHandle\r
+  TLS_CONFIG_DATA                  TlsConfigData;\r
+  EFI_TLS_PROTOCOL                 *Tls;\r
+  EFI_TLS_CONFIGURATION_PROTOCOL   *TlsConfiguration;\r
+  EFI_TLS_SESSION_STATE            TlsSessionState;\r
+\r
+  //\r
+  // TlsTxData used for transmitting TLS related messages.\r
+  //\r
+  EFI_TCP4_IO_TOKEN                Tcp4TlsTxToken;\r
+  EFI_TCP4_TRANSMIT_DATA           Tcp4TlsTxData;\r
+  EFI_TCP6_IO_TOKEN                Tcp6TlsTxToken;\r
+  EFI_TCP6_TRANSMIT_DATA           Tcp6TlsTxData;\r
+  BOOLEAN                          TlsIsTxDone;\r
+\r
+  //\r
+  // TlsRxData used for receiving TLS related messages.\r
+  //\r
+  EFI_TCP4_IO_TOKEN                Tcp4TlsRxToken;\r
+  EFI_TCP4_RECEIVE_DATA            Tcp4TlsRxData;\r
+  EFI_TCP6_IO_TOKEN                Tcp6TlsRxToken;\r
+  EFI_TCP6_RECEIVE_DATA            Tcp6TlsRxData;\r
+  BOOLEAN                          TlsIsRxDone;\r
 } HTTP_PROTOCOL;\r
 \r
 typedef struct {\r
@@ -352,7 +388,8 @@ HttpConfigureTcp6 (
   );\r
 \r
 /**\r
-  Check existing TCP connection, if in error state, receover TCP4 connection.\r
+  Check existing TCP connection, if in error state, recover TCP4 connection. Then, \r
+  connect one TLS session if required.\r
 \r
   @param[in]  HttpInstance       The HTTP instance private data.\r
 \r
@@ -367,7 +404,8 @@ HttpConnectTcp4 (
   );\r
 \r
 /**\r
-  Check existing TCP connection, if in error state, recover TCP6 connection.\r
+  Check existing TCP connection, if in error state, recover TCP6 connection. Then, \r
+  connect one TLS session if required.\r
 \r
   @param[in]  HttpInstance       The HTTP instance private data.\r
 \r
@@ -382,7 +420,7 @@ HttpConnectTcp6 (
   );\r
 \r
 /**\r
-  Send the HTTP message through TCP4 or TCP6.\r
+  Send the HTTP or HTTPS 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
@@ -443,25 +481,27 @@ HttpTcpNotReady (
   );\r
 \r
 /**\r
-  Initialize TCP related data.\r
+  Initialize Http session.\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
+  @param[in]  Configure          The Flag indicates whether need to initialize session.\r
+  @param[in]  TlsConfigure       The Flag indicates whether it's the new Tls session.\r
 \r
-  @retval EFI_SUCCESS            The initialization of TCP instance is done. \r
+  @retval EFI_SUCCESS            The initialization of session is done. \r
   @retval Others                 Other error as indicated.\r
 \r
 **/\r
 EFI_STATUS\r
-HttpInitTcp (\r
+HttpInitSession (\r
   IN  HTTP_PROTOCOL    *HttpInstance,\r
   IN  HTTP_TOKEN_WRAP  *Wrap,\r
-  IN  BOOLEAN          Configure\r
+  IN  BOOLEAN          Configure,\r
+  IN  BOOLEAN          TlsConfigure\r
   );\r
 \r
 /**\r
-  Transmit the HTTP mssage by processing the associated HTTP token.\r
+  Transmit the HTTP or HTTPS mssage by processing the associated HTTP token.\r
 \r
   @param[in]  Map                The container of TxToken or Tx6Token.\r
   @param[in]  Item               Current item to check against.\r