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 Shell application IfConfig6.
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>
@ -46,10 +47,6 @@ SHELL_PARAM_ITEM mIfConfig6CheckList[] = {
L"-r",
TypeValue
},
{
L"-?",
TypeFlag
},
{
NULL,
TypeMax
@ -1648,20 +1645,45 @@ IfConfig6Initialize (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
IFCONFIG6_PRIVATE_DATA *Private;
LIST_ENTRY *ParamPackage;
CONST CHAR16 *ValueStr;
ARG_LIST *ArgList;
CHAR16 *ProblemParam;
CHAR16 *Str;
EFI_STATUS Status;
IFCONFIG6_PRIVATE_DATA *Private;
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
LIST_ENTRY *ParamPackage;
CONST CHAR16 *ValueStr;
ARG_LIST *ArgList;
CHAR16 *ProblemParam;
CHAR16 *Str;
Private = NULL;
//
// Register our string package with HII and return the handle to it.
// Retrieve HII package list from ImageHandle
//
mHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, IfConfig6Strings, 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 (mIfConfig6CheckList, &ParamPackage, &ProblemParam, TRUE, FALSE);
@ -1674,7 +1696,7 @@ IfConfig6Initialize (
// To handle no option.
//
if (!ShellCommandLineGetFlag (ParamPackage, L"-r") && !ShellCommandLineGetFlag (ParamPackage, L"-s") &&
!ShellCommandLineGetFlag (ParamPackage, L"-?") && !ShellCommandLineGetFlag (ParamPackage, L"-l")) {
!ShellCommandLineGetFlag (ParamPackage, L"-l")) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_LACK_OPTION), mHiiHandle);
goto ON_EXIT;
}
@ -1683,20 +1705,10 @@ IfConfig6Initialize (
//
if (((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-s"))) ||
((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) ||
((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))) ||
((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) ||
((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))) ||
((ShellCommandLineGetFlag (ParamPackage, L"-l")) && (ShellCommandLineGetFlag (ParamPackage, L"-?")))) {
((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-l")))) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_CONFLICT_OPTIONS), mHiiHandle);
goto ON_EXIT;
}
//
// To show the help information of ifconfig6 command.
//
if (ShellCommandLineGetFlag (ParamPackage, L"-?")) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_HELP), mHiiHandle);
goto ON_EXIT;
}
Status = EFI_INVALID_PARAMETER;

View File

@ -1,7 +1,7 @@
/** @file
The interface function declaration of shell application IfConfig6.
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
@ -16,6 +16,11 @@
#ifndef _IFCONFIG6_H_
#define _IFCONFIG6_H_
//
// String token ID of ifconfig6 command help message text.
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringIfconfig6HelpTokenId = STRING_TOKEN (STR_IFCONFIG6_HELP);
enum {
IfConfig6OpList = 1,
IfConfig6OpSet = 2,

View File

@ -4,7 +4,7 @@
# It is shell application which is used to set and get configurations for the
# EFI IPv6 network 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 @@
ENTRY_POINT = IfConfig6Initialize
MODULE_UNI_FILE = IfConfig6.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.
#
@ -44,6 +50,7 @@
BaseLib
UefiBootServicesTableLib
UefiApplicationEntryPoint
UefiHiiServicesLib
BaseMemoryLib
ShellLib
MemoryAllocationLib
@ -54,6 +61,7 @@
[Protocols]
gEfiIp6ServiceBindingProtocolGuid ## CONSUMES
gEfiIp6ConfigProtocolGuid ## CONSUMES
gEfiHiiPackageListProtocolGuid ## CONSUMES
[UserExtensions.TianoCore."ExtraFiles"]
IfConfig6Extra.uni

View File

@ -1,7 +1,7 @@
/** @file
String definitions for the Shell application IfConfig6.
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
@ -36,30 +36,6 @@
#string STR_IFCONFIG6_INFO_PREFIX_LEN #language en-US "/%d"
#string STR_IFCONFIG6_LINE_HELP #language en-US "Displays or modifies the IPv6 configuration"
#string STR_IFCONFIG6_HELP #language en-US "Displays or modifies IPv6 configuration for network interface.\n\n"
"Usage:\n"
" IfConfig6 [-b] [-r {ifname}] [-l {ifname}] [-s {ifname} {command ...}] [-?]\n"
"\n"
"Option:\n"
" -b (break) enable page break.\n"
" -r (renew) renew configuration of interface and set automatic policy.\n"
" -l (list) list the configuration of interface.\n"
" -s (set) set configuration of interface as follows.\n"
" -? (help) list the help documentation.\n"
" |man/auto manual or automatic policy\n"
" |id {mac} alternative interface id.\n"
" |dad {num} dad transmits count.\n"
" |host{ip} static host ip address, must under manual policy.\n"
" |gw {ip} gateway ip address, must under manual policy.\n"
" |dns {ip} dns server ip address, must under manual policy.\n"
"\n"
"Example:\n"
" IfConfig6 -l\n"
" IfConfig6 -b -l\n"
" IfConfig6 -r eth0\n"
" IfConfig6 -s eth0 auto dad 10\n"
" IfConfig6 -s eth0 man id ff:dd:aa:88:66:cc\n"
" IfConfig6 -s eth1 man host 2002::1/64 2002::2/64 gw 2002::3\n"
#string STR_IFCONFIG6_ERR_LACK_INTERFACE #language en-US "Lack interface name.\n"
"Usage: IfConfig6 -s {ifname} {config options ...}\n"
"Example: IfConfig6 -s eth0 auto\n"
@ -85,3 +61,32 @@
"Hint: Please type 'IfConfig6 -?' for help info.\n"
#string STR_IFCONFIG6_ERR_ADDRESS_FAILED #language en-US "It failed to set .\n"
#string STR_IFCONFIG6_INVALID_IP #language en-US "%IfConfig6: Invalid IP6 address, %s\n"
#string STR_IFCONFIG6_HELP #language en-US ""
".TH IfConfig6 0 "Displays or modifies IPv6 configuration for network interface."\r\n"
".SH NAME\r\n"
"Displays or modifies IPv6 configuration for network interface.\r\n"
".SH SYNOPSIS\r\n"
" \r\n"
"IfConfig6 [-b] [-r {ifname}] [-l {ifname}] [-s {ifname} {command ...}] [-?]\r\n"
".SH OPTIONS\r\n"
" \r\n"
" -b (break) enable page break.\r\n"
" -r (renew) renew configuration of interface and set automatic policy.\r\n"
" -l (list) list the configuration of interface.\r\n"
" -s (set) set configuration of interface as follows.\r\n"
" |man/auto manual or automatic policy\r\n"
" |id {mac} alternative interface id.\r\n"
" |dad {num} dad transmits count.\r\n"
" |host{ip} static host ip address, must under manual policy.\r\n"
" |gw {ip} gateway ip address, must under manual policy.\r\n"
" |dns {ip} dns server ip address, must under manual policy.\r\n"
".SH EXAMPLES\r\n"
" \r\n"
"Examples:\r\n"
" IfConfig6 -l\r\n"
" IfConfig6 -b -l\r\n"
" IfConfig6 -r eth0\r\n"
" IfConfig6 -s eth0 auto dad 10\r\n"
" IfConfig6 -s eth0 man id ff:dd:aa:88:66:cc\r\n"
" IfConfig6 -s eth1 man host 2002::1/64 2002::2/64 gw 2002::3\r\n"

View File

@ -40,7 +40,6 @@ SHELL_PARAM_ITEM mIpSecConfigParamList[] = {
{ L"-enable", TypeFlag },
{ L"-disable", TypeFlag },
{ L"-status", TypeFlag },
{ L"-?", TypeFlag },
//
// SPD Selector
@ -622,11 +621,36 @@ InitializeIpSecConfig (
CONST CHAR16 *ValueStr;
CHAR16 *ProblemParam;
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, IpSecConfigStrings, 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 (mIpSecConfigParamList, &ParamPackage, &ProblemParam, TRUE, FALSE);
@ -728,33 +752,6 @@ InitializeIpSecConfig (
}
}
if (ShellCommandLineGetFlag (ParamPackage, L"-?")) {
if (DataType == -1) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_HELP), mHiiHandle);
goto Done;
}
switch (DataType) {
case IPsecConfigDataTypeSpd:
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_SPD_HELP), mHiiHandle);
break;
case IPsecConfigDataTypeSad:
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_SAD_HELP), mHiiHandle);
break;
case IPsecConfigDataTypePad:
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_PAD_HELP), mHiiHandle);
break;
default:
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_INCORRECT_DB), mHiiHandle);
break;
}
goto Done;
}
NonOptionCount = ShellCommandLineGetCount (ParamPackage);
if ((NonOptionCount - 1) > 0) {
ValueStr = ShellCommandLineGetRawValue (ParamPackage, (UINT32) (NonOptionCount - 1));

View File

@ -22,10 +22,16 @@
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiHiiServicesLib.h>
#include <Library/NetLib.h>
#include <Protocol/IpSecConfig.h>
//
// String token ID of VConfig command help message text.
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringIpSecHelpTokenId = STRING_TOKEN (STR_IPSEC_CONFIG_HELP);
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#define IPSECCONFIG_STATUS_NAME L"IpSecStatus"

View File

@ -25,6 +25,12 @@
ENTRY_POINT = InitializeIpSecConfig
MODULE_UNI_FILE = IpSecConfig.uni
#
#
# This flag specifies whether HII resource section is generated into PE image.
#
UEFI_HII_RESOURCE_SECTION = TRUE
[Sources]
IpSecConfigStrings.uni
IpSecConfig.c
@ -52,6 +58,7 @@
[LibraryClasses]
UefiBootServicesTableLib
UefiApplicationEntryPoint
UefiHiiServicesLib
BaseMemoryLib
ShellLib
MemoryAllocationLib
@ -63,6 +70,7 @@
[Protocols]
gEfiIpSec2ProtocolGuid ##CONSUMES
gEfiIpSecConfigProtocolGuid ##CONSUMES
gEfiHiiPackageListProtocolGuid ##CONSUMES
[UserExtensions.TianoCore."ExtraFiles"]
IpSecConfigExtra.uni

View File

@ -49,76 +49,6 @@
#string STR_IPSEC_CONFIG_INSERT_UNSUPPORT #language en-US "%s: Policy entry insertion not supported!\n"
#string STR_IPSEC_CONFIG_LINE_HELP #language en-US "Displays or modifies the IPsec configuration"
#string STR_IPSEC_CONFIG_HELP #language en-US "Displays or modifies the current IPsec configuration.\n"
"%HUsage: IpSecConfig [-p {SPD|SAD|PAD}] [command] [options[parameters]]%N\n"
"\n"
"%H-p (SPD|SAD|PAD)%N required.point to certain policy database.\n"
"%Hcommand%N:\n"
" -a [options[parameters]] Add new policy entry.\n"
" -i entryid [options[parameters]] Insert new policy entry before the one\n"
" matched by the entryid.\n"
" It's only supported on SPD policy database.\n"
" -d entryid Delete the policy entry matched by the \n"
" entryid.\n"
" -e entryid [options[parameters]] Edit the policy entry matched by the\n"
" entryid.\n"
" -f Flush the entire policy database.\n"
" -l List all entries for specified database.\n"
" -enable Enable IPsec.\n"
" -disable Disable IPsec.\n"
" -status Show IPsec current status.\n"
"%H[options[parametes]]%N depend on the type of policy database.Type\n "
" 'IpSecConfig -p'followed by the database \n"
" name, and then type ' -?'.\n"
" e.g.: 'IpSecConfig -p SPD -?'\n"
#string STR_IPSEC_CONFIG_SPD_HELP #language en-US "Explain the %H[options[parametes]%N for %HSPD%N\n"
"\n"
"%H[options[parameters]]%N:\n"
" --local localaddress optional local address\n"
" --remote remoteaddress required remote address\n"
" --proto (TCP|UDP|ICMP|...) required IP protocol\n"
" --local-port port optional local port for tcp/udp protocol\n"
" --remote-port port optional remote port for tcp/udp protocol\n"
" --name name optional SPD name\n"
" --action (Bypass|Discard|Protect) required \n"
" required IPsec action\n"
" --mode (Transport|Tunnel) optional IPsec mode, transport by default\n"
" --ipsec-proto (AH|ESP) optional IPsec protocol, ESP by default\n"
" --auth-algo (NONE|SHA1HMAC) optional authentication algorithm\n"
" --encrypt-algo(NONE|DESCBC|3DESCBC)optional encryption algorithm\n"
" --tunnel-local tunnellocaladdr optional tunnel local address(only for tunnel mode)\n"
" --tunnel-remote tunnelremoteaddr optional tunnel remote address(only for tunnel mode)\n"
"\n"
#string STR_IPSEC_CONFIG_SAD_HELP #language en-US "Explain the %H[options[parameters]]%N for %HSAD%N\n"
"\n"
"%H[options[parameters]]%N:\n"
" --spi spi required SPI value\n"
" --ipsec-proto (AH|ESP) required IPsec protocol\n"
" --local localaddress optional local address\n"
" --remote remoteaddress required destination address\n"
" --auth-algo (NONE|SHA1HMAC) required for AH. authentication algorithm\n"
" --auth-key key required for AH. key for authentication\n"
" --encrypt-algo (NONE|DESCBC|3DESCBC) required for ESP. encryption algorithm\n"
" --encrypt-key key required for ESP. key for encryption\n"
" --mode (Transport|Tunnel) optional IPsec mode, transport by default\n"
" --tunnel-dest tunneldestaddr optional tunnel destination address(only for tunnel mode)\n"
" --tunnel-source tunnelsourceaddr optional tunnel source address(only for tunnel mode)\n"
"\n"
#string STR_IPSEC_CONFIG_PAD_HELP #language en-US "Explain the %H[options[parameters]]%N for %HPAD%N\n"
"\n"
"%H[options[parameters]]%N:\n"
" --peer-address address required peer address\n"
" --auth-proto (IKEv1|IKEv2) optional IKE protocol, IKEv1 by\n"
" default\n"
" --auth-method (PreSharedSecret|Certificates) required authentication method\n"
" --auth-data authdata required data for authentication\n"
"\n"
#string STR_IPSEC_MISTAKEN_OPTIONS #language en-US "Mistaken Input. Please refer to %H"IpSecConfig -?"%N for more help information.\n"
#string STR_IPSEC_REDUNDANCY_MANY #language en-US "%s has one redundancy option: %H%s%N\n"
@ -139,3 +69,65 @@
#string STR_IPSEC_CONFIG_DISABLE_FAILED #language en-US "Error: Disable IPsec failed !\n"
#string STR_IPSEC_CONFIG_HELP #language en-US ""
".TH IpSecConfig 0 "Displays or modifies the current IPsec configuration."\r\n"
".SH NAME\r\n"
"Displays or modifies the current IPsec configuration.\r\n"
".SH SYNOPSIS\r\n"
" \r\n"
"%HIpSecConfig [-p {SPD|SAD|PAD}] [command] [options[parameters]]\r\n"
".SH OPTIONS\r\n"
" \r\n"
"%H-p (SPD|SAD|PAD)%N required.point to certain policy database.\r\n"
" \r\n"
"%Hcommand%N:\r\n"
" -a [options[parameters]] Add new policy entry.\r\n"
" -i entryid [options[parameters]] Insert new policy entry before the one\r\n"
" matched by the entryid.\r\n"
" It's only supported on SPD policy database.\r\n"
" -d entryid Delete the policy entry matched by the \r\n"
" entryid.\r\n"
" -e entryid [options[parameters]] Edit the policy entry matched by the\r\n"
" entryid.\r\n"
" -f Flush the entire policy database.\r\n"
" -l List all entries for specified database.\r\n"
" -enable Enable IPsec.\r\n"
" -disable Disable IPsec.\r\n"
" -status Show IPsec current status.\r\n"
" \r\n"
"%H[options[parameters]]%N for %HSPD%N:\r\n"
" --local localaddress optional local address\r\n"
" --remote remoteaddress required remote address\r\n"
" --proto (TCP|UDP|ICMP|...) required IP protocol\r\n"
" --local-port port optional local port for tcp/udp protocol\r\n"
" --remote-port port optional remote port for tcp/udp protocol\r\n"
" --name name optional SPD name\r\n"
" --action (Bypass|Discard|Protect) required \r\n"
" required IPsec action\r\n"
" --mode (Transport|Tunnel) optional IPsec mode, transport by default\r\n"
" --ipsec-proto (AH|ESP) optional IPsec protocol, ESP by default\r\n"
" --auth-algo (NONE|SHA1HMAC) optional authentication algorithm\r\n"
" --encrypt-algo(NONE|DESCBC|3DESCBC)optional encryption algorithm\r\n"
" --tunnel-local tunnellocaladdr optional tunnel local address(only for tunnel mode)\r\n"
" --tunnel-remote tunnelremoteaddr optional tunnel remote address(only for tunnel mode)\r\n"
" \r\n"
"%H[options[parameters]]%N for %HSAD%N:\r\n"
" --spi spi required SPI value\r\n"
" --ipsec-proto (AH|ESP) required IPsec protocol\r\n"
" --local localaddress optional local address\r\n"
" --remote remoteaddress required destination address\r\n"
" --auth-algo (NONE|SHA1HMAC) required for AH. authentication algorithm\n"
" --auth-key key required for AH. key for authentication\r\n"
" --encrypt-algo (NONE|DESCBC|3DESCBC) required for ESP. encryption algorithm\r\n"
" --encrypt-key key required for ESP. key for encryption\r\n"
" --mode (Transport|Tunnel) optional IPsec mode, transport by default\r\n"
" --tunnel-dest tunneldestaddr optional tunnel destination address(only for tunnel mode)\r\n"
" --tunnel-source tunnelsourceaddr optional tunnel source address(only for tunnel mode)\r\n"
" \r\n"
"%H[options[parameters]]%N for %HPAD%N:\r\n"
" --peer-address address required peer address\r\n"
" --auth-proto (IKEv1|IKEv2) optional IKE protocol, IKEv1 by\r\n"
" default\r\n"
" --auth-method (PreSharedSecret|Certificates) required authentication method\r\n"
" --auth-data authdata required data for authentication\r\n"
" \r\n"

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"

View File

@ -1,7 +1,7 @@
/** @file
Shell application for VLAN configuration.
Copyright (c) 2009 - 2013, 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
@ -23,8 +23,14 @@
#include <Library/MemoryAllocationLib.h>
#include <Library/HiiLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiHiiServicesLib.h>
#include <Library/NetLib.h>
//
// String token ID of VConfig command help message text.
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringVConfigHelpTokenId = STRING_TOKEN (STR_VCONFIG_HELP);
#define INVALID_NIC_INDEX 0xffff
#define INVALID_VLAN_ID 0xffff
@ -608,13 +614,39 @@ VlanConfigMain (
{
LIST_ENTRY *List;
CONST CHAR16 *Str;
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
EFI_STATUS Status;
mImageHandle = ImageHandle;
//
// Retrieve HII package list from ImageHandle
//
Status = gBS->OpenProtocol (
ImageHandle,
&gEfiHiiPackageListProtocolGuid,
(VOID **) &PackageList,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Register our string package to HII database.
// Publish HII package list to HII Database.
//
mHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, VConfigStrings, NULL);
Status = gHiiDatabase->NewPackageList (
gHiiDatabase,
PackageList,
NULL,
&mHiiHandle
);
if (EFI_ERROR (Status)) {
return Status;
}
if (mHiiHandle == NULL) {
return EFI_SUCCESS;
}
@ -626,11 +658,6 @@ VlanConfigMain (
goto Exit;
}
if (ShellCommandLineGetFlag (List, L"-?")) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_HELP), mHiiHandle);
goto Exit;
}
if (ShellCommandLineGetFlag (List, L"-l")) {
Str = ShellCommandLineGetValue (List, L"-l");
DisplayVlan ((CHAR16 *) Str);

View File

@ -3,7 +3,7 @@
#
# It is shell application which is used to get and set VLAN configuration.
#
# 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 = VlanConfigMain
MODULE_UNI_FILE = VConfig.uni
#
#
# This flag specifies whether HII resource section is generated into PE image.
#
UEFI_HII_RESOURCE_SECTION = TRUE
#
# VALID_ARCHITECTURES = IA32 X64 IPF
#
@ -40,6 +46,7 @@
[LibraryClasses]
UefiApplicationEntryPoint
UefiBootServicesTableLib
UefiHiiServicesLib
UefiLib
ShellLib
NetLib
@ -47,7 +54,8 @@
HiiLib
[Protocols]
gEfiVlanConfigProtocolGuid ## CONSUMES
gEfiVlanConfigProtocolGuid ## CONSUMES
gEfiHiiPackageListProtocolGuid ## CONSUMES
[UserExtensions.TianoCore."ExtraFiles"]
VConfigExtra.uni

View File

@ -1,7 +1,7 @@
/** @file
String definitions for VLAN configuration Shell application.
Copyright (c) 2009 - 2013, 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,24 +32,32 @@
#string STR_VCONFIG_SET_SUCCESS #language en-US "VLAN device added.\n"
#string STR_VCONFIG_REMOVE_SUCCESS #language en-US "VLAN device removed.\n"
#string STR_VCONFIG_NO_ARG #language en-US "Invalid argument, try "-?" for help.\n"
#string STR_VCONFIG_HELP #language en-US "Display or modify VLAN configuration for network interface.\n\n"
"VCONFIG [-?] [-l [IfName]] [-a IfName VlanId [Priority]] [-d IfName.VlanId]\n"
"\n"
" -l Display VLAN configuration for all or specified interface.\n"
" -a Add a VLAN device for the network interface.\n"
" -d Delete a VLAN device.\n"
" IfName Name of network interface, e.g. eth0, eth1.\n"
" VlanId Unique VLAN identifier (0~4094).\n"
" Priority 802.1Q priority level (0~7), default 0.\n"
"\n"
"Examples:\n"
" * To display VLAN configuration:\n"
" fs0:\> vconfig -l\n"
" fs0:\> vconfig -l eth0\n"
"\n"
" * To add VLAN device:\n"
" fs0:\> vconfig -a eth0 1000\n"
" fs0:\> vconfig -a eth0 2000 7\n"
"\n"
" * To delete VLAN device:\n"
" fs0:\> vconfig -d eth0.1000\n"
#string STR_VCONFIG_HELP #language en-US ""
".TH VConfig 0 "Display or modify VLAN configuration for network interface."\r\n"
".SH NAME\r\n"
"Display or modify VLAN configuration for network interface.\r\n"
".SH SYNOPSIS\r\n"
" \r\n"
"VCONFIG [-?] [-l [IfName]] [-a IfName VlanId [Priority]] [-d IfName.VlanId]\r\n"
".SH OPTIONS\r\n"
" \r\n"
" -l Display VLAN configuration for all or specified interface.\r\n"
" -a Add a VLAN device for the network interface.\r\n"
" -d Delete a VLAN device.\r\n"
" IfName Name of network interface, e.g. eth0, eth1.\r\n"
" VlanId Unique VLAN identifier (0~4094).\r\n"
" Priority 802.1Q priority level (0~7), default 0.\r\n"
".SH EXAMPLES\r\n"
" \r\n"
"Examples:\r\n"
" * To display VLAN configuration:\r\n"
" fs0:\> vconfig -l\r\n"
" fs0:\> vconfig -l eth0\r\n"
"\r\n"
" * To add VLAN device:\r\n"
" fs0:\> vconfig -a eth0 1000\r\n"
" fs0:\> vconfig -a eth0 2000 7\r\n"
"\r\n"
" * To delete VLAN device:\r\n"
" fs0:\> vconfig -d eth0.1000\r\n"