VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.c@ 99404

Last change on this file since 99404 was 99404, checked in by vboxsync, 20 months ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 3.7 KB
Line 
1/** @file
2 Produce "http" shell dynamic command.
3
4 Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved. <BR>
5 Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>
6 Copyright (c) 2020, Broadcom. All rights reserved.<BR>
7
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10**/
11#include <Protocol/ShellDynamicCommand.h>
12#include "Http.h"
13
14/**
15 This is the shell command handler function pointer callback type. This
16 function handles the command when it is invoked in the shell.
17
18 @param[in] This The instance of the
19 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
20 @param[in] SystemTable The pointer to the system table.
21 @param[in] ShellParameters The parameters associated with the command.
22 @param[in] Shell The instance of the shell protocol used in
23 the context of processing this command.
24
25 @return EFI_SUCCESS the operation was sucessful
26 @return other the operation failed.
27**/
28SHELL_STATUS
29EFIAPI
30HttpCommandHandler (
31 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
32 IN EFI_SYSTEM_TABLE *SystemTable,
33 IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
34 IN EFI_SHELL_PROTOCOL *Shell
35 )
36{
37 gEfiShellParametersProtocol = ShellParameters;
38 gEfiShellProtocol = Shell;
39
40 return RunHttp (gImageHandle, SystemTable);
41}
42
43/**
44 This is the command help handler function pointer callback type. This
45 function is responsible for displaying help information for the associated
46 command.
47
48 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
49 @param[in] Language The pointer to the language string to use.
50
51 @return string Pool allocated help string, must be freed by caller
52**/
53CHAR16 *
54EFIAPI
55HttpCommandGetHelp (
56 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
57 IN CONST CHAR8 *Language
58 )
59{
60 return HiiGetString (
61 mHttpHiiHandle,
62 STRING_TOKEN (STR_GET_HELP_HTTP),
63 Language
64 );
65}
66
67EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mHttpDynamicCommand = {
68 HTTP_APP_NAME,
69 HttpCommandHandler,
70 HttpCommandGetHelp
71};
72
73/**
74 Entry point of Http Dynamic Command.
75
76 Produce the DynamicCommand protocol to handle "http" command.
77
78 @param ImageHandle The image handle of the process.
79 @param SystemTable The EFI System Table pointer.
80
81 @retval EFI_SUCCESS Http command is executed sucessfully.
82 @retval EFI_ABORTED HII package was failed to initialize.
83 @retval others Other errors when executing http command.
84**/
85EFI_STATUS
86EFIAPI
87HttpCommandInitialize (
88 IN EFI_HANDLE ImageHandle,
89 IN EFI_SYSTEM_TABLE *SystemTable
90 )
91{
92 EFI_STATUS Status;
93
94 mHttpHiiHandle = InitializeHiiPackage (ImageHandle);
95 if (mHttpHiiHandle == NULL) {
96 return EFI_ABORTED;
97 }
98
99 Status = gBS->InstallProtocolInterface (
100 &ImageHandle,
101 &gEfiShellDynamicCommandProtocolGuid,
102 EFI_NATIVE_INTERFACE,
103 &mHttpDynamicCommand
104 );
105 ASSERT_EFI_ERROR (Status);
106 return Status;
107}
108
109/**
110 Http driver unload handler.
111
112 @param ImageHandle The image handle of the process.
113
114 @retval EFI_SUCCESS The image is unloaded.
115 @retval Others Failed to unload the image.
116**/
117EFI_STATUS
118EFIAPI
119HttpUnload (
120 IN EFI_HANDLE ImageHandle
121 )
122{
123 EFI_STATUS Status;
124
125 Status = gBS->UninstallProtocolInterface (
126 ImageHandle,
127 &gEfiShellDynamicCommandProtocolGuid,
128 &mHttpDynamicCommand
129 );
130 if (EFI_ERROR (Status)) {
131 return Status;
132 }
133
134 HiiRemovePackages (mHttpHiiHandle);
135
136 return EFI_SUCCESS;
137}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette