diff options
author | Zhang, Lubo <C:/Program Files (x86)/Git/o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Zhang, Lubob8d> | 2016-02-29 14:25:50 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-03-07 09:57:09 +0800 |
commit | be6cd654eb27370bfa127dd387846ad983f4ef72 (patch) | |
tree | 2a219f73811787324d3d3a03ff96a872fd9f63e1 /NetworkPkg/Application/Ping6 | |
parent | fa848a4048943251fc057fe8d6c5a82e01d2ffb6 (diff) | |
download | edk2-platforms-be6cd654eb27370bfa127dd387846ad983f4ef72.tar.xz |
NetworkPkg: Support print help information using -? command.
v2:
*Modify the logic of show SAD,SPD and PAD help info, include them in -?
instead of follow -p command.
Since Shell supports finding help information from resource section
of application image. We modify the Shell application Under NetworkPkg
to support print help information string using -? command.
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Diffstat (limited to 'NetworkPkg/Application/Ping6')
-rw-r--r-- | NetworkPkg/Application/Ping6/Ping6.c | 41 | ||||
-rw-r--r-- | NetworkPkg/Application/Ping6/Ping6.h | 7 | ||||
-rw-r--r-- | NetworkPkg/Application/Ping6/Ping6.inf | 10 | ||||
-rw-r--r-- | NetworkPkg/Application/Ping6/Ping6Strings.uni | 35 |
4 files changed, 64 insertions, 29 deletions
diff --git a/NetworkPkg/Application/Ping6/Ping6.c b/NetworkPkg/Application/Ping6/Ping6.c index 596ee3b007..f1685f710b 100644 --- a/NetworkPkg/Application/Ping6/Ping6.c +++ b/NetworkPkg/Application/Ping6/Ping6.c @@ -1,7 +1,7 @@ /** @file
The implementation for Ping6 application.
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -19,6 +19,7 @@ #include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiHiiServicesLib.h>
#include <Library/HiiLib.h>
#include <Library/NetLib.h>
@@ -43,10 +44,6 @@ SHELL_PARAM_ITEM Ping6ParamList[] = { TypeValue
},
{
- L"-?",
- TypeFlag
- },
- {
NULL,
TypeMax
},
@@ -1059,11 +1056,36 @@ InitializePing6 ( CONST CHAR16 *ValueStr;
CONST CHAR16 *ValueStrPtr;
UINTN NonOptionCount;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
//
- // Register our string package with HII and return the handle to it.
+ // Retrieve HII package list from ImageHandle
//
- mHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, Ping6Strings, NULL);
+ Status = gBS->OpenProtocol (
+ ImageHandle,
+ &gEfiHiiPackageListProtocolGuid,
+ (VOID **) &PackageList,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Publish HII package list to HII Database.
+ //
+ Status = gHiiDatabase->NewPackageList (
+ gHiiDatabase,
+ PackageList,
+ NULL,
+ &mHiiHandle
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
ASSERT (mHiiHandle != NULL);
Status = ShellCommandLineParseEx (Ping6ParamList, &ParamPackage, NULL, TRUE, FALSE);
@@ -1072,11 +1094,6 @@ InitializePing6 ( goto ON_EXIT;
}
- if (ShellCommandLineGetFlag (ParamPackage, L"-?")) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_HELP), mHiiHandle);
- goto ON_EXIT;
- }
-
SendNumber = 10;
BufferSize = 16;
diff --git a/NetworkPkg/Application/Ping6/Ping6.h b/NetworkPkg/Application/Ping6/Ping6.h index b152ff18bc..4660b0e3be 100644 --- a/NetworkPkg/Application/Ping6/Ping6.h +++ b/NetworkPkg/Application/Ping6/Ping6.h @@ -1,7 +1,7 @@ /** @file
The interface function declaration of shell application Ping6 (Ping for v6 series).
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -22,6 +22,11 @@ #define PING6_ONE_SECOND 10000000
//
+// String token ID of Ping6 command help message text.
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringPing6HelpToken = STRING_TOKEN (STR_PING6_HELP);
+
+//
// A similar amount of time that passes in femtoseconds
// for each increment of TimerValue. It is for NT32 only.
//
diff --git a/NetworkPkg/Application/Ping6/Ping6.inf b/NetworkPkg/Application/Ping6/Ping6.inf index f8851b98b0..68b5f2d32f 100644 --- a/NetworkPkg/Application/Ping6/Ping6.inf +++ b/NetworkPkg/Application/Ping6/Ping6.inf @@ -3,7 +3,7 @@ #
# It is an shell application which is used to Ping the target host with IPv6 stack.
#
-# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -25,6 +25,12 @@ MODULE_UNI_FILE = Ping6.uni
#
+#
+# This flag specifies whether HII resource section is generated into PE image.
+#
+ UEFI_HII_RESOURCE_SECTION = TRUE
+
+#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF
@@ -53,6 +59,7 @@ BaseLib
UefiBootServicesTableLib
UefiApplicationEntryPoint
+ UefiHiiServicesLib
BaseMemoryLib
ShellLib
MemoryAllocationLib
@@ -65,6 +72,7 @@ gEfiIp6ProtocolGuid ## CONSUMES
gEfiIp6ServiceBindingProtocolGuid ## CONSUMES
gEfiIp6ConfigProtocolGuid ## CONSUMES
+ gEfiHiiPackageListProtocolGuid ## CONSUMES
[UserExtensions.TianoCore."ExtraFiles"]
Ping6Extra.uni
diff --git a/NetworkPkg/Application/Ping6/Ping6Strings.uni b/NetworkPkg/Application/Ping6/Ping6Strings.uni index c2f003defb..e4ab19fe63 100644 --- a/NetworkPkg/Application/Ping6/Ping6Strings.uni +++ b/NetworkPkg/Application/Ping6/Ping6Strings.uni @@ -1,7 +1,7 @@ /** @file
String definitions for the Shell Ping6 application.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -32,17 +32,22 @@ #string STR_PING6_STAT #language en-US "\n%d packets transmitted, %d received, %d%% packet loss, time %dms\n"
#string STR_PING6_RTT #language en-US "\nRtt(round trip time) min=%dms max=%dms avg=%dms\n"
#string STR_PING6_LINE_HELP #language en-US "Ping a target machine with UEFI IPv6 network stack"
-#string STR_PING6_HELP #language en-US "Ping a target machine with UEFI IPv6 network stack.\n\n"
- "Usage: Ping6 [-l size] [-n count] [-s SourceIp] TargetIp\n"
- " Use ESC and Ctrl+C to interrupt Ping6 process.\n"
- "\n"
- "Options:\n"
- " -l size Send buffer size, in bytes(default=16, min=16, max=32768).\n"
- " -n count Send request count, (default=10, min=1, max=10000).\n"
- " -s SourceIp Source IPv6 address.\n"
- " TargetIp Target IPv6 address.\n"
- " -? Help document.\n"
- "\n"
- "Examples:\n"
- " Ping6 -s 2002::1 2002::2 -l 1000 -n 5\n"
- " Ping6 2002::2 -l 1000\n"
\ No newline at end of file +
+#string STR_PING6_HELP #language en-US ""
+".TH Ping6 0 "Ping a target machine with UEFI IPv6 network stack."\r\n"
+".SH NAME\r\n"
+"Ping a target machine with UEFI IPv6 network stack.\r\n"
+".SH SYNOPSIS\r\n"
+" \r\n"
+"Ping6 [-l size] [-n count] [-s SourceIp] TargetIp\r\n"
+".SH OPTIONS\r\n"
+" \r\n"
+" -l size Send buffer size, in bytes(default=16, min=16, max=32768).\r\n"
+" -n count Send request count, (default=10, min=1, max=10000).\r\n"
+" -s SourceIp Source IPv6 address.\r\n"
+" TargetIp Target IPv6 address.\r\n"
+".SH EXAMPLES\r\n"
+" \r\n"
+"Examples:\r\n"
+" Ping6 -s 2002::1 2002::2 -l 1000 -n 5\r\n"
+" Ping6 2002::2 -l 1000\r\n"
|