]>
Commit | Line | Data |
---|---|---|
68fb0527 | 1 | /** @file\r |
2 | Main file for NULL named library for network1 shell command functions.\r | |
3 | \r | |
4 | Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved. <BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | #include "UefiShellNetwork1CommandsLib.h"\r | |
15 | \r | |
16 | CONST CHAR16 gShellNetwork1FileName[] = L"ShellCommands";\r | |
17 | EFI_HANDLE gShellNetwork1HiiHandle = NULL;\r | |
18 | STATIC CONST EFI_GUID gShellNetwork1HiiGuid = \\r | |
19 | { \\r | |
20 | 0xf3d301bb, 0xf4a5, 0x45a8, { 0xb0, 0xb7, 0xfa, 0x99, 0x9c, 0x62, 0x37, 0xae } \\r | |
21 | };\r | |
22 | \r | |
23 | /**\r | |
24 | return the file name of the help text file if not using HII.\r | |
25 | \r | |
26 | @return The string pointer to the file name.\r | |
27 | **/\r | |
28 | CONST CHAR16*\r | |
29 | EFIAPI\r | |
30 | ShellCommandGetManFileNameNetwork1 (\r | |
31 | VOID\r | |
32 | )\r | |
33 | {\r | |
34 | return (gShellNetwork1FileName);\r | |
35 | }\r | |
36 | \r | |
37 | /**\r | |
38 | Constructor for the Shell Network1 Commands library.\r | |
39 | \r | |
40 | Install the handlers for Network1 UEFI Shell 2.0 profile commands.\r | |
41 | \r | |
42 | @param ImageHandle The image handle of the process.\r | |
43 | @param SystemTable The EFI System Table pointer.\r | |
44 | \r | |
45 | @retval EFI_SUCCESS The shell command handlers were installed sucessfully.\r | |
46 | @retval EFI_UNSUPPORTED The shell level required was not found.\r | |
47 | **/\r | |
48 | EFI_STATUS\r | |
49 | EFIAPI\r | |
50 | ShellNetwork1CommandsLibConstructor (\r | |
51 | IN EFI_HANDLE ImageHandle,\r | |
52 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
53 | )\r | |
54 | {\r | |
55 | gShellNetwork1HiiHandle = NULL;\r | |
56 | \r | |
57 | //\r | |
58 | // check our bit of the profiles mask\r | |
59 | //\r | |
60 | if ((PcdGet8(PcdShellProfileMask) & BIT3) == 0) {\r | |
61 | return (EFI_UNSUPPORTED);\r | |
62 | }\r | |
63 | \r | |
64 | gShellNetwork1HiiHandle = HiiAddPackages (&gShellNetwork1HiiGuid, gImageHandle, UefiShellNetwork1CommandsLibStrings, NULL);\r | |
65 | if (gShellNetwork1HiiHandle == NULL) {\r | |
66 | return (EFI_DEVICE_ERROR);\r | |
67 | }\r | |
68 | //\r | |
69 | // install our shell command handlers\r | |
70 | //\r | |
71 | ShellCommandRegisterCommandName(L"ping", ShellCommandRunPing , ShellCommandGetManFileNameNetwork1, 0, L"network1", TRUE , gShellNetwork1HiiHandle, STRING_TOKEN(STR_GET_HELP_PING));\r | |
72 | ShellCommandRegisterCommandName(L"ifconfig",ShellCommandRunIfconfig , ShellCommandGetManFileNameNetwork1, 0, L"network1", TRUE , gShellNetwork1HiiHandle, STRING_TOKEN(STR_GET_HELP_IFCONFIG));\r | |
73 | \r | |
74 | return (EFI_SUCCESS);\r | |
75 | }\r | |
76 | \r | |
77 | /**\r | |
78 | Destructor for the library. free any resources.\r | |
79 | \r | |
80 | @param ImageHandle The image handle of the process.\r | |
81 | @param SystemTable The EFI System Table pointer.\r | |
82 | **/\r | |
83 | EFI_STATUS\r | |
84 | EFIAPI\r | |
85 | ShellNetwork1CommandsLibDestructor (\r | |
86 | IN EFI_HANDLE ImageHandle,\r | |
87 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
88 | )\r | |
89 | {\r | |
90 | if (gShellNetwork1HiiHandle != NULL) {\r | |
91 | HiiRemovePackages(gShellNetwork1HiiHandle);\r | |
92 | }\r | |
93 | return (EFI_SUCCESS);\r | |
94 | }\r |