Http.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /** @file
  2. Header file for 'http' command functions.
  3. Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved. <BR>
  4. Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>
  5. Copyright (c) 2020, Broadcom. All rights reserved.<BR>
  6. SPDX-License-Identifier: BSD-2-Clause-Patent
  7. **/
  8. #ifndef _HTTP_H_
  9. #define _HTTP_H_
  10. #include <Uefi.h>
  11. #include <Library/BaseLib.h>
  12. #include <Library/BaseMemoryLib.h>
  13. #include <Library/DebugLib.h>
  14. #include <Library/HiiLib.h>
  15. #include <Library/HttpLib.h>
  16. #include <Library/MemoryAllocationLib.h>
  17. #include <Library/NetLib.h>
  18. #include <Library/PrintLib.h>
  19. #include <Library/ShellLib.h>
  20. #include <Library/UefiBootServicesTableLib.h>
  21. #include <Library/UefiHiiServicesLib.h>
  22. #include <Library/UefiLib.h>
  23. #include <Library/UefiRuntimeServicesTableLib.h>
  24. #include <Protocol/HiiPackageList.h>
  25. #include <Protocol/HttpUtilities.h>
  26. #include <Protocol/ServiceBinding.h>
  27. #define HTTP_APP_NAME L"http"
  28. #define REQ_OK 0
  29. #define REQ_NEED_REPEAT 1
  30. //
  31. // Download Flags.
  32. //
  33. #define DL_FLAG_TIME BIT0 // Show elapsed time.
  34. #define DL_FLAG_KEEP_BAD BIT1 // Keep files even if download failed.
  35. extern EFI_HII_HANDLE mHttpHiiHandle;
  36. typedef struct {
  37. UINTN ContentDownloaded;
  38. UINTN ContentLength;
  39. UINTN LastReportedNbOfBytes;
  40. UINTN BufferSize;
  41. UINTN Status;
  42. UINTN Flags;
  43. UINT8 *Buffer;
  44. CHAR16 *ServerAddrAndProto;
  45. CHAR16 *Uri;
  46. EFI_HTTP_TOKEN ResponseToken;
  47. EFI_HTTP_TOKEN RequestToken;
  48. EFI_HTTP_PROTOCOL *Http;
  49. EFI_HTTP_CONFIG_DATA HttpConfigData;
  50. } HTTP_DOWNLOAD_CONTEXT;
  51. /**
  52. Function for 'http' command.
  53. @param[in] ImageHandle The image handle.
  54. @param[in] SystemTable The system table.
  55. @retval SHELL_SUCCESS Command completed successfully.
  56. @retval SHELL_INVALID_PARAMETER Command usage error.
  57. @retval SHELL_ABORTED The user aborts the operation.
  58. @retval value Unknown error.
  59. **/
  60. SHELL_STATUS
  61. RunHttp (
  62. IN EFI_HANDLE ImageHandle,
  63. IN EFI_SYSTEM_TABLE *SystemTable
  64. );
  65. /**
  66. Retrieve HII package list from ImageHandle and publish to HII database.
  67. @param[in] ImageHandle The image handle of the process.
  68. @retval HII handle.
  69. **/
  70. EFI_HII_HANDLE
  71. InitializeHiiPackage (
  72. IN EFI_HANDLE ImageHandle
  73. );
  74. #endif // _HTTP_H_