]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpBootDxe/HttpBootSupport.h
NetworkPkg: Add PCD to enable the HTTP connections switch
[mirror_edk2.git] / NetworkPkg / HttpBootDxe / HttpBootSupport.h
index 2eba14e0267ff8f699a77307c47764a258f4e487..65302d2be203abb12424f5f88d8adf57084b9724 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support functions declaration for UEFI HTTP boot driver.\r
 \r
-Copyright (c) 2015, 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
@@ -81,6 +81,17 @@ HttpBootShowIp6Addr (
   IN EFI_IPv6_ADDRESS   *Ip\r
   );\r
 \r
+/**\r
+  This function is to display the HTTP error status.\r
+\r
+  @param[in]      StatusCode      The status code value in HTTP message.\r
+\r
+**/\r
+VOID\r
+HttpBootPrintErrorMessage (\r
+  EFI_HTTP_STATUS_CODE            StatusCode\r
+  );\r
+\r
 //\r
 // A wrapper structure to hold the HTTP headers.\r
 //\r
@@ -185,6 +196,8 @@ typedef struct {
 \r
   BOOLEAN                   IsTxDone;\r
   BOOLEAN                   IsRxDone;\r
+\r
+  EFI_EVENT                 TimeoutEvent;\r
 } HTTP_IO;\r
 \r
 //\r
@@ -196,6 +209,7 @@ typedef struct {
   EFI_HTTP_HEADER             *Headers;\r
   UINTN                       BodyLength;\r
   CHAR8                       *Body;\r
+  EFI_STATUS                  Status;\r
 } HTTP_IO_RESPONSE_DATA;\r
 \r
 /**\r
@@ -317,4 +331,84 @@ 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
+  Caller need to free the buffer in the UriAddress pointer.\r
+  \r
+  @param[in]   FilePath         Pointer to the device path which contains a URI device path node.\r
+  @param[out]  UriAddress       The URI address string extract from the device path.\r
+  \r
+  @retval EFI_SUCCESS            The URI string is returned.\r
+  @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.\r
+\r
+**/\r
+EFI_STATUS\r
+HttpBootParseFilePath (\r
+  IN     EFI_DEVICE_PATH_PROTOCOL     *FilePath,\r
+     OUT CHAR8                        **UriAddress\r
+  );\r
+\r
+/**\r
+  This function returns the image type according to server replied HTTP message\r
+  and also the image's URI info.\r
+\r
+  @param[in]    Uri              The pointer to the image's URI string.\r
+  @param[in]    UriParser        URI Parse result returned by NetHttpParseUrl(). \r
+  @param[in]    HeaderCount      Number of HTTP header structures in Headers list. \r
+  @param[in]    Headers          Array containing list of HTTP headers.\r
+  @param[out]   ImageType        The image type of the downloaded file.\r
+  \r
+  @retval EFI_SUCCESS            The image type is returned in ImageType.\r
+  @retval EFI_INVALID_PARAMETER  ImageType, Uri or UriParser is NULL.\r
+  @retval EFI_INVALID_PARAMETER  HeaderCount is not zero, and Headers is NULL.\r
+  @retval EFI_NOT_FOUND          Failed to identify the image type.\r
+  @retval Others                 Unexpect error happened.\r
+\r
+**/\r
+EFI_STATUS\r
+HttpBootCheckImageType (\r
+  IN      CHAR8                  *Uri,\r
+  IN      VOID                   *UriParser,\r
+  IN      UINTN                  HeaderCount,\r
+  IN      EFI_HTTP_HEADER        *Headers,\r
+     OUT  HTTP_BOOT_IMAGE_TYPE   *ImageType\r
+  );\r
+\r
+/**\r
+  This function register the RAM disk info to the system.\r
+  \r
+  @param[in]       Private         The pointer to the driver's private data.\r
+  @param[in]       BufferSize      The size of Buffer in bytes.\r
+  @param[in]       Buffer          The base address of the RAM disk.\r
+  @param[in]       ImageType       The image type of the file in Buffer.\r
+\r
+  @retval EFI_SUCCESS              The RAM disk has been registered.\r
+  @retval EFI_NOT_FOUND            No RAM disk protocol instances were found.\r
+  @retval EFI_UNSUPPORTED          The ImageType is not supported.\r
+  @retval Others                   Unexpected error happened.\r
+\r
+**/\r
+EFI_STATUS\r
+HttpBootRegisterRamDisk (\r
+  IN  HTTP_BOOT_PRIVATE_DATA       *Private,\r
+  IN  UINTN                        BufferSize,\r
+  IN  VOID                         *Buffer,\r
+  IN  HTTP_BOOT_IMAGE_TYPE         ImageType\r
+  );\r
 #endif\r