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>
This commit is contained in:
Zhang, Lubo
2016-02-29 14:25:50 +08:00
committed by Jiaxin Wu
parent fa848a4048
commit be6cd654eb
15 changed files with 325 additions and 214 deletions

View File

@@ -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>
@@ -42,10 +43,6 @@ SHELL_PARAM_ITEM Ping6ParamList[] = {
L"-s",
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;

View File

@@ -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
@@ -21,6 +21,11 @@
#define PING6_MAX_BUFFER_SIZE 32768
#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.

View File

@@ -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
@@ -24,6 +24,12 @@
ENTRY_POINT = InitializePing6
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.
#
@@ -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

View File

@@ -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"
#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"