HttpApp.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /** @file
  2. Entrypoint of "http" shell standalone application.
  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. #include "Http.h"
  9. /*
  10. * String token ID of help message text.
  11. * Shell supports to find help message in the resource section of an
  12. * application image if * .MAN file is not found.
  13. * This global variable is added to make build tool recognizes
  14. * that the help string is consumed by user and then build tool will
  15. * add the string into the resource section.
  16. * Thus the application can use '-?' option to show help message in Shell.
  17. */
  18. GLOBAL_REMOVE_IF_UNREFERENCED
  19. EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_GET_HELP_HTTP);
  20. /**
  21. Entry point of Http standalone application.
  22. @param ImageHandle The image handle of the process.
  23. @param SystemTable The EFI System Table pointer.
  24. @retval EFI_SUCCESS Http command is executed sucessfully.
  25. @retval EFI_ABORTED HII package was failed to initialize.
  26. @retval others Other errors when executing http command.
  27. **/
  28. EFI_STATUS
  29. EFIAPI
  30. HttpAppInitialize (
  31. IN EFI_HANDLE ImageHandle,
  32. IN EFI_SYSTEM_TABLE *SystemTable
  33. )
  34. {
  35. EFI_STATUS Status;
  36. SHELL_STATUS ShellStatus;
  37. mHttpHiiHandle = InitializeHiiPackage (ImageHandle);
  38. if (mHttpHiiHandle == NULL) {
  39. return EFI_ABORTED;
  40. }
  41. Status = EFI_SUCCESS;
  42. ShellStatus = RunHttp (ImageHandle, SystemTable);
  43. HiiRemovePackages (mHttpHiiHandle);
  44. if (Status != SHELL_SUCCESS) {
  45. Status = ENCODE_ERROR (ShellStatus);
  46. }
  47. return Status;
  48. }