]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h
ShellPkg/DynamicCommand: add HttpDynamicCommand
[mirror_edk2.git] / ShellPkg / DynamicCommand / HttpDynamicCommand / Http.h
diff --git a/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h b/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h
new file mode 100644 (file)
index 0000000..fa8b6f5
--- /dev/null
@@ -0,0 +1,92 @@
+/** @file\r
+  Header file for 'http' command functions.\r
+\r
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved. <BR>\r
+  Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>\r
+  Copyright (c) 2020, Broadcom. All rights reserved.<BR>\r
+\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef _HTTP_H_\r
+#define _HTTP_H_\r
+\r
+#include <Uefi.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/HiiLib.h>\r
+#include <Library/HttpLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/NetLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/ShellLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiHiiServicesLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+\r
+#include <Protocol/HiiPackageList.h>\r
+#include <Protocol/HttpUtilities.h>\r
+#include <Protocol/ServiceBinding.h>\r
+\r
+#define HTTP_APP_NAME L"http"\r
+\r
+#define REQ_OK           0\r
+#define REQ_NEED_REPEAT  1\r
+\r
+//\r
+// Download Flags.\r
+//\r
+#define DL_FLAG_TIME     BIT0 // Show elapsed time.\r
+#define DL_FLAG_KEEP_BAD BIT1 // Keep files even if download failed.\r
+\r
+extern EFI_HII_HANDLE mHttpHiiHandle;\r
+\r
+typedef struct {\r
+  UINTN                 ContentDownloaded;\r
+  UINTN                 ContentLength;\r
+  UINTN                 LastReportedNbOfBytes;\r
+  UINTN                 BufferSize;\r
+  UINTN                 Status;\r
+  UINTN                 Flags;\r
+  UINT8                 *Buffer;\r
+  CHAR16                *ServerAddrAndProto;\r
+  CHAR16                *Uri;\r
+  EFI_HTTP_TOKEN        ResponseToken;\r
+  EFI_HTTP_TOKEN        RequestToken;\r
+  EFI_HTTP_PROTOCOL     *Http;\r
+  EFI_HTTP_CONFIG_DATA  HttpConfigData;\r
+} HTTP_DOWNLOAD_CONTEXT;\r
+\r
+/**\r
+  Function for 'http' command.\r
+\r
+  @param[in]  ImageHandle     The image handle.\r
+  @param[in]  SystemTable     The system table.\r
+\r
+  @retval SHELL_SUCCESS            Command completed successfully.\r
+  @retval SHELL_INVALID_PARAMETER  Command usage error.\r
+  @retval SHELL_ABORTED            The user aborts the operation.\r
+  @retval value                    Unknown error.\r
+**/\r
+SHELL_STATUS\r
+RunHttp (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  );\r
+\r
+/**\r
+  Retrieve HII package list from ImageHandle and publish to HII database.\r
+\r
+  @param[in] ImageHandle            The image handle of the process.\r
+\r
+  @retval HII handle.\r
+**/\r
+EFI_HII_HANDLE\r
+InitializeHiiPackage (\r
+  IN EFI_HANDLE                  ImageHandle\r
+  );\r
+#endif // _HTTP_H_\r