]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpBootDxe/HttpBootSupport.h
MdeModulePkg/BootLogoLib: Use Boot Logo 2 Protocol
[mirror_edk2.git] / NetworkPkg / HttpBootDxe / HttpBootSupport.h
index 28e8005d21585224b0792767fd88fedf7eeeb350..9b7acd9e1b92fa74c7720ff6311aba8422e3452f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support functions declaration for UEFI HTTP boot driver.\r
 \r
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
@@ -145,6 +145,32 @@ HttpBootSetHeader (
   IN  CHAR8                *FieldValue\r
   );\r
 \r
+///\r
+/// HTTP_IO_CALLBACK_EVENT\r
+///\r
+typedef enum {\r
+  HttpIoRequest,\r
+  HttpIoResponse\r
+} HTTP_IO_CALLBACK_EVENT;\r
+\r
+/**\r
+  HttpIo Callback function which will be invoked when specified HTTP_IO_CALLBACK_EVENT happened.\r
+\r
+  @param[in]    EventType      Indicate the Event type that occurs in the current callback.\r
+  @param[in]    Message        HTTP message which will be send to, or just received from HTTP server.\r
+  @param[in]    Context        The Callback Context pointer.\r
+  \r
+  @retval EFI_SUCCESS          Tells the HttpIo to continue the HTTP process.\r
+  @retval Others               Tells the HttpIo to abort the current HTTP process.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * HTTP_IO_CALLBACK) (\r
+  IN  HTTP_IO_CALLBACK_EVENT    EventType,\r
+  IN  EFI_HTTP_MESSAGE          *Message,\r
+  IN  VOID                      *Context\r
+  );\r
+\r
 //\r
 // HTTP_IO configuration data for IPv4\r
 //\r
@@ -189,6 +215,9 @@ typedef struct {
   \r
   EFI_HTTP_PROTOCOL         *Http;\r
 \r
+  HTTP_IO_CALLBACK          Callback;\r
+  VOID                      *Context;\r
+\r
   EFI_HTTP_TOKEN            ReqToken;\r
   EFI_HTTP_MESSAGE          ReqMessage;\r
   EFI_HTTP_TOKEN            RspToken;\r
@@ -196,6 +225,8 @@ typedef struct {
 \r
   BOOLEAN                   IsTxDone;\r
   BOOLEAN                   IsRxDone;\r
+\r
+  EFI_EVENT                 TimeoutEvent;\r
 } HTTP_IO;\r
 \r
 //\r
@@ -250,6 +281,9 @@ HttpBootCommonNotify (
   @param[in]  Controller     The handle of the controller.\r
   @param[in]  IpVersion      IP_VERSION_4 or IP_VERSION_6.\r
   @param[in]  ConfigData     The HTTP_IO configuration data.\r
+  @param[in]  Callback       Callback function which will be invoked when specified\r
+                             HTTP_IO_CALLBACK_EVENT happened.\r
+  @param[in]  Context        The Context data which will be passed to the Callback function.\r
   @param[out] HttpIo         The HTTP_IO.\r
   \r
   @retval EFI_SUCCESS            The HTTP_IO is created and configured.\r
@@ -266,6 +300,8 @@ HttpIoCreateIo (
   IN EFI_HANDLE             Controller,\r
   IN UINT8                  IpVersion,\r
   IN HTTP_IO_CONFIG_DATA    *ConfigData,\r
+  IN HTTP_IO_CALLBACK       Callback,\r
+  IN VOID                   *Context,\r
   OUT HTTP_IO               *HttpIo\r
   );\r
 \r
@@ -329,6 +365,21 @@ HttpIoRecvResponse (
      OUT  HTTP_IO_RESPONSE_DATA    *ResponseData\r
   );\r
 \r
+/**\r
+  This function checks the HTTP(S) URI scheme.\r
+\r
+  @param[in]    Uri              The pointer to the URI string.\r
+  \r
+  @retval EFI_SUCCESS            The URI scheme is valid.\r
+  @retval EFI_INVALID_PARAMETER  The URI scheme is not HTTP or HTTPS.\r
+  @retval EFI_ACCESS_DENIED      HTTP is disabled and the URI is HTTP.\r
+\r
+**/\r
+EFI_STATUS\r
+HttpBootCheckUriScheme (\r
+  IN      CHAR8                  *Uri\r
+  );\r
+\r
 /**\r
   Get the URI address string from the input device path.\r
 \r
@@ -394,4 +445,17 @@ HttpBootRegisterRamDisk (
   IN  VOID                         *Buffer,\r
   IN  HTTP_BOOT_IMAGE_TYPE         ImageType\r
   );\r
+\r
+/**\r
+  Indicate if the HTTP status code indicates a redirection.\r
+  \r
+  @param[in]  StatusCode      HTTP status code from server.\r
+\r
+  @return                     TRUE if it's redirection.\r
+\r
+**/\r
+BOOLEAN\r
+HttpBootIsHttpRedirectStatusCode (\r
+  IN   EFI_HTTP_STATUS_CODE        StatusCode\r
+  );\r
 #endif\r