VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.c

Last change on this file was 105670, checked in by vboxsync, 5 months ago

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1/** @file
2 Main file for NULL named library for network2 shell command functions.
3
4 Copyright (c) 2016, Intel Corporation. All rights reserved. <BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8#include "UefiShellNetwork2CommandsLib.h"
9
10CONST CHAR16 gShellNetwork2FileName[] = L"ShellCommands";
11EFI_HII_HANDLE gShellNetwork2HiiHandle = NULL;
12
13/**
14 return the file name of the help text file if not using HII.
15
16 @return The string pointer to the file name.
17**/
18CONST CHAR16 *
19EFIAPI
20ShellCommandGetManFileNameNetwork2 (
21 VOID
22 )
23{
24 return (gShellNetwork2FileName);
25}
26
27/**
28 Constructor for the Shell Network2 Commands library.
29
30 Install the handlers for Network2 UEFI Shell 2.0 profile commands.
31
32 @param ImageHandle The image handle of the process.
33 @param SystemTable The EFI System Table pointer.
34
35 @retval EFI_SUCCESS The shell command handlers were installed successfully.
36 @retval EFI_UNSUPPORTED The shell level required was not found.
37**/
38EFI_STATUS
39EFIAPI
40ShellNetwork2CommandsLibConstructor (
41 IN EFI_HANDLE ImageHandle,
42 IN EFI_SYSTEM_TABLE *SystemTable
43 )
44{
45 gShellNetwork2HiiHandle = NULL;
46
47 //
48 // check our bit of the profiles mask
49 //
50 if ((PcdGet8 (PcdShellProfileMask) & BIT4) == 0) {
51 return (EFI_SUCCESS);
52 }
53
54 gShellNetwork2HiiHandle = HiiAddPackages (&gShellNetwork2HiiGuid, gImageHandle, UefiShellNetwork2CommandsLibStrings, NULL);
55 if (gShellNetwork2HiiHandle == NULL) {
56 return (EFI_DEVICE_ERROR);
57 }
58
59 //
60 // install our shell command handlers
61 //
62 ShellCommandRegisterCommandName (L"ping6", ShellCommandRunPing6, ShellCommandGetManFileNameNetwork2, 0, L"network2", TRUE, gShellNetwork2HiiHandle, STRING_TOKEN (STR_GET_HELP_PING6));
63 ShellCommandRegisterCommandName (L"ifconfig6", ShellCommandRunIfconfig6, ShellCommandGetManFileNameNetwork2, 0, L"network2", TRUE, gShellNetwork2HiiHandle, STRING_TOKEN (STR_GET_HELP_IFCONFIG6));
64
65 return EFI_SUCCESS;
66}
67
68/**
69 Destructor for the library. free any resources.
70
71 @param ImageHandle The image handle of the process.
72 @param SystemTable The EFI System Table pointer.
73**/
74EFI_STATUS
75EFIAPI
76ShellNetwork2CommandsLibDestructor (
77 IN EFI_HANDLE ImageHandle,
78 IN EFI_SYSTEM_TABLE *SystemTable
79 )
80{
81 if (gShellNetwork2HiiHandle != NULL) {
82 HiiRemovePackages (gShellNetwork2HiiHandle);
83 }
84
85 return EFI_SUCCESS;
86}
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