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:
@@ -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;
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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
|
||||
|
@@ -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"
|
||||
|
Reference in New Issue
Block a user