Reviewed-by: Jiaxin Wu <[email protected]>

> -----Original Message-----
> From: Zhang, Lubo
> Sent: Monday, February 29, 2016 2:26 PM
> To: [email protected]
> Cc: Fu, Siyuan <[email protected]>; Ye, Ting <[email protected]>; Wu,
> Jiaxin <[email protected]>
> Subject: [PATCH v2] 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 <[email protected]>
> Cc: Ye Ting <[email protected]>
> Cc: Wu Jiaxin <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo <[email protected]>
> ---
>  NetworkPkg/Application/IfConfig6/IfConfig6.c       |  64 ++++++----
>  NetworkPkg/Application/IfConfig6/IfConfig6.h       |   7 +-
>  NetworkPkg/Application/IfConfig6/IfConfig6.inf     |  10 +-
>  .../Application/IfConfig6/IfConfig6Strings.uni     |  55 +++++----
>  NetworkPkg/Application/IpsecConfig/IpSecConfig.c   |  57 +++++----
>  NetworkPkg/Application/IpsecConfig/IpSecConfig.h   |   6 +
>  NetworkPkg/Application/IpsecConfig/IpSecConfig.inf |   8 ++
>  .../Application/IpsecConfig/IpSecConfigStrings.uni | 132 ++++++++++---------
> --
>  NetworkPkg/Application/Ping6/Ping6.c               |  41 +++++--
>  NetworkPkg/Application/Ping6/Ping6.h               |   7 +-
>  NetworkPkg/Application/Ping6/Ping6.inf             |  10 +-
>  NetworkPkg/Application/Ping6/Ping6Strings.uni      |  35 +++---
>  NetworkPkg/Application/VConfig/VConfig.c           |  43 +++++--
>  NetworkPkg/Application/VConfig/VConfig.inf         |  12 +-
>  NetworkPkg/Application/VConfig/VConfigStrings.uni  |  52 ++++----
>  15 files changed, 325 insertions(+), 214 deletions(-)
> 
> diff --git a/NetworkPkg/Application/IfConfig6/IfConfig6.c
> b/NetworkPkg/Application/IfConfig6/IfConfig6.c
> index 8d464b8..8bd6243 100644
> --- a/NetworkPkg/Application/IfConfig6/IfConfig6.c
> +++ b/NetworkPkg/Application/IfConfig6/IfConfig6.c
> @@ -1,9 +1,9 @@
>  /** @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
>    which accompanies this distribution.  The full text of the license may be
> found at
>    http://opensource.org/licenses/bsd-license.php.
> @@ -17,10 +17,11 @@
>  #include <Library/BaseMemoryLib.h>
>  #include <Library/BaseLib.h>
>  #include <Library/MemoryAllocationLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/UefiBootServicesTableLib.h>
> +#include <Library/UefiHiiServicesLib.h>
>  #include <Library/HiiLib.h>
>  #include <Library/NetLib.h>
> 
>  #include <Protocol/Ip6.h>
>  #include <Protocol/Ip6Config.h>
> @@ -45,14 +46,10 @@ SHELL_PARAM_ITEM    mIfConfig6CheckList[] = {
>    {
>      L"-r",
>      TypeValue
>    },
>    {
> -    L"-?",
> -    TypeFlag
> -  },
> -  {
>      NULL,
>      TypeMax
>    },
>  };
> 
> @@ -1646,24 +1643,49 @@ EFIAPI
>  IfConfig6Initialize (
>    IN  EFI_HANDLE         ImageHandle,
>    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);
>    if (EFI_ERROR (Status)) {
>      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IFCONFIG6_ERR_INVALID_COMMAND), mHiiHandle, ProblemParam);
> @@ -1672,33 +1694,23 @@ 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;
>    }
>    //
>    // To handle conflict options.
>    //
>    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;
> 
>    Private = AllocateZeroPool (sizeof (IFCONFIG6_PRIVATE_DATA));
> 
> diff --git a/NetworkPkg/Application/IfConfig6/IfConfig6.h
> b/NetworkPkg/Application/IfConfig6/IfConfig6.h
> index ad3a775..53b6d72 100644
> --- a/NetworkPkg/Application/IfConfig6/IfConfig6.h
> +++ b/NetworkPkg/Application/IfConfig6/IfConfig6.h
> @@ -1,9 +1,9 @@
>  /** @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
>    which accompanies this distribution.  The full text of the license may be
> found at
>    http://opensource.org/licenses/bsd-license.php.
> @@ -14,10 +14,15 @@
>  **/
> 
>  #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,
>    IfConfig6OpClear    = 3
>  };
> diff --git a/NetworkPkg/Application/IfConfig6/IfConfig6.inf
> b/NetworkPkg/Application/IfConfig6/IfConfig6.inf
> index 7b329f5..519b7c3 100644
> --- a/NetworkPkg/Application/IfConfig6/IfConfig6.inf
> +++ b/NetworkPkg/Application/IfConfig6/IfConfig6.inf
> @@ -2,11 +2,11 @@
>  #  Shell application IfConfig6.
>  #
>  #  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
>  #  which accompanies this distribution. The full text of the license may be
> found at
>  #  http://opensource.org/licenses/bsd-license.php.
> @@ -24,10 +24,16 @@
>    VERSION_STRING                 = 1.0
>    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.
>  #
>  #  VALID_ARCHITECTURES           = IA32 X64 IPF
>  #
>  [Sources]
> @@ -42,18 +48,20 @@
> 
>  [LibraryClasses]
>    BaseLib
>    UefiBootServicesTableLib
>    UefiApplicationEntryPoint
> +  UefiHiiServicesLib
>    BaseMemoryLib
>    ShellLib
>    MemoryAllocationLib
>    DebugLib
>    HiiLib
>    NetLib
> 
>  [Protocols]
>    gEfiIp6ServiceBindingProtocolGuid             ## CONSUMES
>    gEfiIp6ConfigProtocolGuid                     ## CONSUMES
> +  gEfiHiiPackageListProtocolGuid                ## CONSUMES
> 
>  [UserExtensions.TianoCore."ExtraFiles"]
>    IfConfig6Extra.uni
> diff --git a/NetworkPkg/Application/IfConfig6/IfConfig6Strings.uni
> b/NetworkPkg/Application/IfConfig6/IfConfig6Strings.uni
> index 3753bd8..0c10bbd 100644
> --- a/NetworkPkg/Application/IfConfig6/IfConfig6Strings.uni
> +++ b/NetworkPkg/Application/IfConfig6/IfConfig6Strings.uni
> @@ -1,9 +1,9 @@
>  /** @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
>    of the BSD License which accompanies this distribution.  The full
>    text of the license may be found at<BR>
> @@ -34,34 +34,10 @@
>  #string STR_IFCONFIG6_INFO_IP_ADDR_BODY4BIT    #language en-US
> "%x"
>  #string STR_IFCONFIG6_INFO_ROUTE_HEAD          #language en-US
> "\n%Hroute table  : %N\n"
>  #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"
>  #string STR_IFCONFIG6_LACK_OPTION              #language en-US    "Flags 
> lack.
> Please type 'IfConfig6 -?' for help info.\n"
>  #string STR_IFCONFIG6_CONFLICT_OPTIONS         #language en-US    "Flags
> conflict. Please type 'IfConfig6 -?' for help info.\n"
> @@ -83,5 +59,34 @@
>                                                                    "Hint: 
> Please type 'IfConfig6 -?' for help
> info.\n"
>  #string STR_IFCONFIG6_ERR_UNKNOWN_COMMAND      #language en-US
> "Unknown commands. Bad command %H%s%N is skipped.\n"
>                                                                    "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"
> diff --git a/NetworkPkg/Application/IpsecConfig/IpSecConfig.c
> b/NetworkPkg/Application/IpsecConfig/IpSecConfig.c
> index e4f6057..ff895bc 100644
> --- a/NetworkPkg/Application/IpsecConfig/IpSecConfig.c
> +++ b/NetworkPkg/Application/IpsecConfig/IpSecConfig.c
> @@ -38,11 +38,10 @@ SHELL_PARAM_ITEM    mIpSecConfigParamList[] = {
>    { L"-f",                    TypeFlag },
>    { L"-l",                    TypeFlag },
>    { L"-enable",               TypeFlag },
>    { L"-disable",              TypeFlag },
>    { L"-status",               TypeFlag },
> -  { L"-?",                    TypeFlag },
> 
>    //
>    // SPD Selector
>    //
>    { L"--local",               TypeValue },
> @@ -620,15 +619,40 @@ InitializeIpSecConfig (
>    UINT8                         Value;
>    LIST_ENTRY                    *ParamPackage;
>    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);
>    if (EFI_ERROR (Status)) {
>      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IPSEC_CONFIG_UNKNOWN_OPERATION), mHiiHandle,
> ProblemParam);
> @@ -726,37 +750,10 @@ InitializeIpSecConfig (
>        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IPSEC_CONFIG_INCORRECT_DB), mHiiHandle, mAppName, ValueStr);
>        goto Done;
>      }
>    }
> 
> -  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));
>      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IPSEC_REDUNDANCY_MANY), mHiiHandle, mAppName, ValueStr);
>      goto Done;
> diff --git a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> index 17044fe..244926f 100644
> --- a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> +++ b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> @@ -20,14 +20,20 @@
>  #include <Library/UefiLib.h>
>  #include <Library/ShellLib.h>
>  #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"
> 
>  #define BIT(x)   (UINT32) (1 << (x))
> diff --git a/NetworkPkg/Application/IpsecConfig/IpSecConfig.inf
> b/NetworkPkg/Application/IpsecConfig/IpSecConfig.inf
> index 52cf6b0..02371e5 100644
> --- a/NetworkPkg/Application/IpsecConfig/IpSecConfig.inf
> +++ b/NetworkPkg/Application/IpsecConfig/IpSecConfig.inf
> @@ -23,10 +23,16 @@
>    MODULE_TYPE                    = UEFI_APPLICATION
>    VERSION_STRING                 = 1.0
>    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
>    IpSecConfig.h
>    Dump.c
> @@ -50,10 +56,11 @@
>    ShellPkg/ShellPkg.dec
> 
>  [LibraryClasses]
>    UefiBootServicesTableLib
>    UefiApplicationEntryPoint
> +  UefiHiiServicesLib
>    BaseMemoryLib
>    ShellLib
>    MemoryAllocationLib
>    DebugLib
>    HiiLib
> @@ -61,8 +68,9 @@
>    UefiLib
> 
>  [Protocols]
>    gEfiIpSec2ProtocolGuid                        ##CONSUMES
>    gEfiIpSecConfigProtocolGuid                   ##CONSUMES
> +  gEfiHiiPackageListProtocolGuid                ##CONSUMES
> 
>  [UserExtensions.TianoCore."ExtraFiles"]
>    IpSecConfigExtra.uni
> diff --git a/NetworkPkg/Application/IpsecConfig/IpSecConfigStrings.uni
> b/NetworkPkg/Application/IpsecConfig/IpSecConfigStrings.uni
> index 2c342d3..bd7f546 100644
> --- a/NetworkPkg/Application/IpsecConfig/IpSecConfigStrings.uni
> +++ b/NetworkPkg/Application/IpsecConfig/IpSecConfigStrings.uni
> @@ -47,80 +47,10 @@
> 
>  #string STR_IPSEC_CONFIG_INDEX_NOT_SPECIFIED        #language en-US
> "%s: Index should be Specified!\n"
> 
>  #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"
> 
>  #string STR_IPSEC_CONFIG_ALREADY_ENABLE             #language en-US
> "IPsec has been already enabled!\n"
> @@ -137,5 +67,67 @@
> 
>  #string STR_IPSEC_CONFIG_ENABLE_FAILED              #language en-US  "Error:
> Enable IPsec failed !\n"
> 
>  #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"
> diff --git a/NetworkPkg/Application/Ping6/Ping6.c
> b/NetworkPkg/Application/Ping6/Ping6.c
> index 596ee3b..f1685f7 100644
> --- a/NetworkPkg/Application/Ping6/Ping6.c
> +++ b/NetworkPkg/Application/Ping6/Ping6.c
> @@ -1,9 +1,9 @@
>  /** @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
>    which accompanies this distribution.  The full text of the license may be
> found at
>    http://opensource.org/licenses/bsd-license.php.
> @@ -17,10 +17,11 @@
>  #include <Library/BaseMemoryLib.h>
>  #include <Library/BaseLib.h>
>  #include <Library/MemoryAllocationLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/UefiBootServicesTableLib.h>
> +#include <Library/UefiHiiServicesLib.h>
>  #include <Library/HiiLib.h>
>  #include <Library/NetLib.h>
> 
>  #include <Protocol/Cpu.h>
>  #include <Protocol/ServiceBinding.h>
> @@ -41,14 +42,10 @@ SHELL_PARAM_ITEM    Ping6ParamList[] = {
>    {
>      L"-s",
>      TypeValue
>    },
>    {
> -    L"-?",
> -    TypeFlag
> -  },
> -  {
>      NULL,
>      TypeMax
>    },
>  };
> 
> @@ -1057,28 +1054,48 @@ InitializePing6 (
>    UINTN               SendNumber;
>    LIST_ENTRY          *ParamPackage;
>    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);
>    if (EFI_ERROR(Status)) {
>      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_PING6_INVALID_INPUT), mHiiHandle);
>      goto ON_EXIT;
>    }
> 
> -  if (ShellCommandLineGetFlag (ParamPackage, L"-?")) {
> -    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_HELP),
> mHiiHandle);
> -    goto ON_EXIT;
> -  }
> -
>    SendNumber = 10;
>    BufferSize = 16;
> 
>    //
>    // Parse the paramter of count number.
> diff --git a/NetworkPkg/Application/Ping6/Ping6.h
> b/NetworkPkg/Application/Ping6/Ping6.h
> index b152ff1..4660b0e 100644
> --- a/NetworkPkg/Application/Ping6/Ping6.h
> +++ b/NetworkPkg/Application/Ping6/Ping6.h
> @@ -1,9 +1,9 @@
>  /** @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
>    which accompanies this distribution.  The full text of the license may be
> found at
>    http://opensource.org/licenses/bsd-license.php.
> @@ -20,10 +20,15 @@
>  #define PING6_MAX_SEND_NUMBER      10000
>  #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.
>  //
>  #define NTTIMERPERIOD    358049
> 
> diff --git a/NetworkPkg/Application/Ping6/Ping6.inf
> b/NetworkPkg/Application/Ping6/Ping6.inf
> index f8851b9..68b5f2d 100644
> --- a/NetworkPkg/Application/Ping6/Ping6.inf
> +++ b/NetworkPkg/Application/Ping6/Ping6.inf
> @@ -1,11 +1,11 @@
>  ## @file
>  #  Shell application Ping6.
>  #
>  #  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
>  #  which accompanies this distribution. The full text of the license may be
> found at
>  #  http://opensource.org/licenses/bsd-license.php.
> @@ -23,10 +23,16 @@
>    VERSION_STRING                 = 1.0
>    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.
>  #
>  #  VALID_ARCHITECTURES           = IA32 X64 IPF
>  #
> 
> @@ -51,10 +57,11 @@
> 
>  [LibraryClasses]
>    BaseLib
>    UefiBootServicesTableLib
>    UefiApplicationEntryPoint
> +  UefiHiiServicesLib
>    BaseMemoryLib
>    ShellLib
>    MemoryAllocationLib
>    DebugLib
>    HiiLib
> @@ -63,8 +70,9 @@
>  [Protocols]
>    gEfiCpuArchProtocolGuid                       ## CONSUMES
>    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 c2f003d..e4ab19f 100644
> --- a/NetworkPkg/Application/Ping6/Ping6Strings.uni
> +++ b/NetworkPkg/Application/Ping6/Ping6Strings.uni
> @@ -1,9 +1,9 @@
>  /** @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
>    which accompanies this distribution.  The full text of the license may be
> found at
>    http://opensource.org/licenses/bsd-license.php.
> @@ -30,19 +30,24 @@
>  #string STR_PING6_TIMEOUT                  #language en-US  "Echo request
> sequence %d timeout.\n"
>  #string STR_PING6_REPLY_INFO               #language en-US  "%d bytes
> from %s : icmp_seq=%d ttl=%d time%c%dms\n"
>  #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"
> diff --git a/NetworkPkg/Application/VConfig/VConfig.c
> b/NetworkPkg/Application/VConfig/VConfig.c
> index ba17207..d00a041 100644
> --- a/NetworkPkg/Application/VConfig/VConfig.c
> +++ b/NetworkPkg/Application/VConfig/VConfig.c
> @@ -1,9 +1,9 @@
>  /** @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
>    which accompanies this distribution.  The full text of the license may be
> found at
>    http://opensource.org/licenses/bsd-license.php.
> @@ -21,12 +21,18 @@
>  #include <Library/UefiLib.h>
>  #include <Library/ShellLib.h>
>  #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
> 
>  //
>  // This is the generated String package data for all .UNI files.
> @@ -606,17 +612,43 @@ VlanConfigMain (
>    IN EFI_SYSTEM_TABLE  *SystemTable
>    )
>  {
>    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;
>    }
> 
>    List = NULL;
> @@ -624,15 +656,10 @@ VlanConfigMain (
>    if (List == NULL) {
>      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NO_ARG),
> mHiiHandle);
>      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);
>      goto Exit;
>    }
> diff --git a/NetworkPkg/Application/VConfig/VConfig.inf
> b/NetworkPkg/Application/VConfig/VConfig.inf
> index 7067e0c..771f585 100644
> --- a/NetworkPkg/Application/VConfig/VConfig.inf
> +++ b/NetworkPkg/Application/VConfig/VConfig.inf
> @@ -1,11 +1,11 @@
>  ## @file
>  #  Shell application VLAN configuration.
>  #
>  #  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
>  #  which accompanies this distribution. The full text of the license may be
> found at
>  #  http://opensource.org/licenses/bsd-license.php.
> @@ -23,10 +23,16 @@
>    VERSION_STRING                 = 1.0
>    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
>  #
> 
>  [Sources]
>    VConfigStrings.uni
> @@ -38,16 +44,18 @@
>    ShellPkg/ShellPkg.dec
> 
>  [LibraryClasses]
>    UefiApplicationEntryPoint
>    UefiBootServicesTableLib
> +  UefiHiiServicesLib
>    UefiLib
>    ShellLib
>    NetLib
>    MemoryAllocationLib
>    HiiLib
> 
>  [Protocols]
> -  gEfiVlanConfigProtocolGuid     ## CONSUMES
> +  gEfiVlanConfigProtocolGuid       ## CONSUMES
> +  gEfiHiiPackageListProtocolGuid   ## CONSUMES
> 
>  [UserExtensions.TianoCore."ExtraFiles"]
>    VConfigExtra.uni
> diff --git a/NetworkPkg/Application/VConfig/VConfigStrings.uni
> b/NetworkPkg/Application/VConfig/VConfigStrings.uni
> index 641e26e..1bb66ba 100644
> --- a/NetworkPkg/Application/VConfig/VConfigStrings.uni
> +++ b/NetworkPkg/Application/VConfig/VConfigStrings.uni
> @@ -1,9 +1,9 @@
>  /** @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
>    which accompanies this distribution.  The full text of the license may be
> found at
>    http://opensource.org/licenses/bsd-license.php.
> @@ -30,26 +30,34 @@
>  #string STR_VCONFIG_NO_VLAN              #language en-US    "    VLAN is not
> configured.\n"
>  #string STR_VCONFIG_ETH_MAC              #language en-US    "eth%d
> MAC:%s\n"
>  #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"
> --
> 1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to