NetworkPkg: Support print help information using -? command.
authorZhang, Lubo <C:/Program Files (x86)/Git/o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Zhang, Lubob8d>
Mon, 29 Feb 2016 06:25:50 +0000 (14:25 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Mon, 7 Mar 2016 01:57:09 +0000 (09:57 +0800)
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>
15 files changed:
NetworkPkg/Application/IfConfig6/IfConfig6.c
NetworkPkg/Application/IfConfig6/IfConfig6.h
NetworkPkg/Application/IfConfig6/IfConfig6.inf
NetworkPkg/Application/IfConfig6/IfConfig6Strings.uni
NetworkPkg/Application/IpsecConfig/IpSecConfig.c
NetworkPkg/Application/IpsecConfig/IpSecConfig.h
NetworkPkg/Application/IpsecConfig/IpSecConfig.inf
NetworkPkg/Application/IpsecConfig/IpSecConfigStrings.uni
NetworkPkg/Application/Ping6/Ping6.c
NetworkPkg/Application/Ping6/Ping6.h
NetworkPkg/Application/Ping6/Ping6.inf
NetworkPkg/Application/Ping6/Ping6Strings.uni
NetworkPkg/Application/VConfig/VConfig.c
NetworkPkg/Application/VConfig/VConfig.inf
NetworkPkg/Application/VConfig/VConfigStrings.uni

index 8d464b8..8bd6243 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation for Shell application IfConfig6.\r
 \r
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -19,6 +19,7 @@
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiHiiServicesLib.h>\r
 #include <Library/HiiLib.h>\r
 #include <Library/NetLib.h>\r
 \r
@@ -46,10 +47,6 @@ SHELL_PARAM_ITEM    mIfConfig6CheckList[] = {
     L"-r",\r
     TypeValue\r
   },\r
-  {\r
-    L"-?",\r
-    TypeFlag\r
-  },\r
   {\r
     NULL,\r
     TypeMax\r
@@ -1648,20 +1645,45 @@ IfConfig6Initialize (
   IN  EFI_SYSTEM_TABLE    *SystemTable\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
-  IFCONFIG6_PRIVATE_DATA    *Private;\r
-  LIST_ENTRY                *ParamPackage;\r
-  CONST CHAR16              *ValueStr;\r
-  ARG_LIST                  *ArgList;\r
-  CHAR16                    *ProblemParam;\r
-  CHAR16                    *Str;\r
+  EFI_STATUS                    Status;\r
+  IFCONFIG6_PRIVATE_DATA        *Private;\r
+  EFI_HII_PACKAGE_LIST_HEADER   *PackageList;\r
+  LIST_ENTRY                    *ParamPackage;\r
+  CONST CHAR16                  *ValueStr;\r
+  ARG_LIST                      *ArgList;\r
+  CHAR16                        *ProblemParam;\r
+  CHAR16                        *Str;\r
 \r
   Private = NULL;\r
 \r
   //\r
-  // Register our string package with HII and return the handle to it.\r
+  // Retrieve HII package list from ImageHandle\r
   //\r
-  mHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, IfConfig6Strings, NULL);\r
+  Status = gBS->OpenProtocol (\r
+                  ImageHandle,\r
+                  &gEfiHiiPackageListProtocolGuid,\r
+                  (VOID **) &PackageList,\r
+                  ImageHandle,\r
+                  NULL,\r
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // Publish HII package list to HII Database.\r
+  //\r
+  Status = gHiiDatabase->NewPackageList (\r
+                          gHiiDatabase,\r
+                          PackageList,\r
+                          NULL,\r
+                          &mHiiHandle\r
+                          );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+  \r
   ASSERT (mHiiHandle != NULL);\r
 \r
   Status = ShellCommandLineParseEx (mIfConfig6CheckList, &ParamPackage, &ProblemParam, TRUE, FALSE);\r
@@ -1674,7 +1696,7 @@ IfConfig6Initialize (
   // To handle no option.\r
   //\r
   if (!ShellCommandLineGetFlag (ParamPackage, L"-r") && !ShellCommandLineGetFlag (ParamPackage, L"-s") &&\r
-      !ShellCommandLineGetFlag (ParamPackage, L"-?") && !ShellCommandLineGetFlag (ParamPackage, L"-l")) {\r
+      !ShellCommandLineGetFlag (ParamPackage, L"-l")) {\r
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_LACK_OPTION), mHiiHandle);\r
     goto ON_EXIT;\r
   }\r
@@ -1683,20 +1705,10 @@ IfConfig6Initialize (
   //\r
   if (((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-s"))) ||\r
       ((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) ||\r
-      ((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))) ||\r
-      ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) ||\r
-      ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))) ||\r
-      ((ShellCommandLineGetFlag (ParamPackage, L"-l")) && (ShellCommandLineGetFlag (ParamPackage, L"-?")))) {\r
+      ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-l")))) {\r
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_CONFLICT_OPTIONS), mHiiHandle);\r
     goto ON_EXIT;\r
   }\r
-  //\r
-  // To show the help information of ifconfig6 command.\r
-  //\r
-  if (ShellCommandLineGetFlag (ParamPackage, L"-?")) {\r
-    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_HELP), mHiiHandle);\r
-    goto ON_EXIT;\r
-  }\r
 \r
   Status = EFI_INVALID_PARAMETER;\r
 \r
index ad3a775..53b6d72 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The interface function declaration of shell application IfConfig6.\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
 #ifndef _IFCONFIG6_H_\r
 #define _IFCONFIG6_H_\r
 \r
+//\r
+// String token ID of ifconfig6 command help message text.\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringIfconfig6HelpTokenId = STRING_TOKEN (STR_IFCONFIG6_HELP);\r
+\r
 enum {\r
   IfConfig6OpList     = 1,\r
   IfConfig6OpSet      = 2,\r
index 7b329f5..519b7c3 100644 (file)
@@ -4,7 +4,7 @@
 #  It is shell application which is used to set and get configurations for the\r
 #  EFI IPv6 network stack.\r
 #\r
-#  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
   ENTRY_POINT                    = IfConfig6Initialize\r
   MODULE_UNI_FILE                = IfConfig6.uni\r
 \r
+#\r
+#\r
+#  This flag specifies whether HII resource section is generated into PE image.\r
+#\r
+   UEFI_HII_RESOURCE_SECTION     = TRUE\r
+\r
 #\r
 # The following information is for reference only and not required by the build tools.\r
 #\r
@@ -44,6 +50,7 @@
   BaseLib\r
   UefiBootServicesTableLib\r
   UefiApplicationEntryPoint\r
+  UefiHiiServicesLib\r
   BaseMemoryLib\r
   ShellLib\r
   MemoryAllocationLib\r
@@ -54,6 +61,7 @@
 [Protocols]\r
   gEfiIp6ServiceBindingProtocolGuid             ## CONSUMES\r
   gEfiIp6ConfigProtocolGuid                     ## CONSUMES\r
+  gEfiHiiPackageListProtocolGuid                ## CONSUMES\r
 \r
 [UserExtensions.TianoCore."ExtraFiles"]\r
   IfConfig6Extra.uni\r
index 3753bd8..0c10bbd 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   String definitions for the Shell application IfConfig6.\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions\r
 #string STR_IFCONFIG6_INFO_PREFIX_LEN          #language en-US    "/%d"\r
 \r
 #string STR_IFCONFIG6_LINE_HELP                #language en-US    "Displays or modifies the IPv6 configuration"\r
-#string STR_IFCONFIG6_HELP                     #language en-US    "Displays or modifies IPv6 configuration for network interface.\n\n"\r
-                                                                  "Usage:\n"\r
-                                                                  "  IfConfig6 [-b] [-r {ifname}] [-l {ifname}] [-s {ifname} {command ...}] [-?]\n"\r
-                                                                  "\n"\r
-                                                                  "Option:\n"\r
-                                                                  "  -b (break) enable page break.\n"\r
-                                                                  "  -r (renew) renew configuration of interface and set automatic policy.\n"\r
-                                                                  "  -l (list)  list the configuration of interface.\n"\r
-                                                                  "  -s (set)   set configuration of interface as follows.\n"\r
-                                                                  "  -? (help)  list the help documentation.\n"\r
-                                                                  "     |man/auto     manual or automatic policy\n"\r
-                                                                  "     |id  {mac}    alternative interface id.\n"\r
-                                                                  "     |dad {num}    dad transmits count.\n"\r
-                                                                  "     |host{ip}     static host ip address, must under manual policy.\n"\r
-                                                                  "     |gw  {ip}     gateway ip address, must under manual policy.\n"\r
-                                                                  "     |dns {ip}     dns server ip address, must under manual policy.\n"\r
-                                                                  "\n"\r
-                                                                  "Example:\n"\r
-                                                                  "  IfConfig6 -l\n"\r
-                                                                  "  IfConfig6 -b -l\n"\r
-                                                                  "  IfConfig6 -r eth0\n"\r
-                                                                  "  IfConfig6 -s eth0 auto dad 10\n"\r
-                                                                  "  IfConfig6 -s eth0 man id ff:dd:aa:88:66:cc\n"\r
-                                                                  "  IfConfig6 -s eth1 man host 2002::1/64 2002::2/64 gw 2002::3\n"\r
 #string STR_IFCONFIG6_ERR_LACK_INTERFACE       #language en-US    "Lack interface name.\n"\r
                                                                   "Usage: IfConfig6 -s {ifname} {config options ...}\n"\r
                                                                   "Example: IfConfig6 -s eth0 auto\n"\r
                                                                   "Hint: Please type 'IfConfig6 -?' for help info.\n"\r
 #string STR_IFCONFIG6_ERR_ADDRESS_FAILED       #language en-US    "It failed to set .\n"\r
 #string STR_IFCONFIG6_INVALID_IP               #language en-US    "%IfConfig6: Invalid IP6 address, %s\n"\r
+\r
+#string STR_IFCONFIG6_HELP                     #language en-US    ""\r
+".TH IfConfig6 0 "Displays or modifies IPv6 configuration for network interface."\r\n"\r
+".SH NAME\r\n"\r
+"Displays or modifies IPv6 configuration for network interface.\r\n"\r
+".SH SYNOPSIS\r\n"\r
+" \r\n"\r
+"IfConfig6 [-b] [-r {ifname}] [-l {ifname}] [-s {ifname} {command ...}] [-?]\r\n"\r
+".SH OPTIONS\r\n"\r
+" \r\n"\r
+"  -b (break) enable page break.\r\n"\r
+"  -r (renew) renew configuration of interface and set automatic policy.\r\n"\r
+"  -l (list)  list the configuration of interface.\r\n"\r
+"  -s (set)   set configuration of interface as follows.\r\n"\r
+"     |man/auto   manual or automatic policy\r\n"\r
+"     |id  {mac}  alternative interface id.\r\n"\r
+"     |dad {num}  dad transmits count.\r\n"\r
+"     |host{ip}   static host ip address, must under manual policy.\r\n"\r
+"     |gw  {ip}   gateway ip address, must under manual policy.\r\n"\r
+"     |dns {ip}   dns server ip address, must under manual policy.\r\n"\r
+".SH EXAMPLES\r\n"\r
+" \r\n"\r
+"Examples:\r\n"\r
+"  IfConfig6 -l\r\n"\r
+"  IfConfig6 -b -l\r\n"\r
+"  IfConfig6 -r eth0\r\n"\r
+"  IfConfig6 -s eth0 auto dad 10\r\n"\r
+"  IfConfig6 -s eth0 man id ff:dd:aa:88:66:cc\r\n"\r
+"  IfConfig6 -s eth1 man host 2002::1/64 2002::2/64 gw 2002::3\r\n"\r
index e4f6057..ff895bc 100644 (file)
@@ -40,7 +40,6 @@ SHELL_PARAM_ITEM    mIpSecConfigParamList[] = {
   { L"-enable",               TypeFlag },\r
   { L"-disable",              TypeFlag },\r
   { L"-status",               TypeFlag },\r
-  { L"-?",                    TypeFlag },\r
 \r
   //\r
   // SPD Selector\r
@@ -622,11 +621,36 @@ InitializeIpSecConfig (
   CONST CHAR16                  *ValueStr;\r
   CHAR16                        *ProblemParam;\r
   UINTN                         NonOptionCount;\r
+  EFI_HII_PACKAGE_LIST_HEADER   *PackageList;\r
 \r
   //\r
-  // Register our string package with HII and return the handle to it.\r
+  // Retrieve HII package list from ImageHandle\r
   //\r
-  mHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, IpSecConfigStrings, NULL);\r
+  Status = gBS->OpenProtocol (\r
+                  ImageHandle,\r
+                  &gEfiHiiPackageListProtocolGuid,\r
+                  (VOID **) &PackageList,\r
+                  ImageHandle,\r
+                  NULL,\r
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // Publish HII package list to HII Database.\r
+  //\r
+  Status = gHiiDatabase->NewPackageList (\r
+                          gHiiDatabase,\r
+                          PackageList,\r
+                          NULL,\r
+                          &mHiiHandle\r
+                          );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
   ASSERT (mHiiHandle != NULL);\r
 \r
   Status = ShellCommandLineParseEx (mIpSecConfigParamList, &ParamPackage, &ProblemParam, TRUE, FALSE);\r
@@ -728,33 +752,6 @@ InitializeIpSecConfig (
     }\r
   }\r
 \r
-  if (ShellCommandLineGetFlag (ParamPackage, L"-?")) {\r
-    if (DataType == -1) {\r
-      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_HELP), mHiiHandle);\r
-      goto Done;\r
-    }\r
-\r
-    switch (DataType) {\r
-      case IPsecConfigDataTypeSpd:\r
-        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_SPD_HELP), mHiiHandle);\r
-        break;\r
-\r
-      case IPsecConfigDataTypeSad:\r
-        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_SAD_HELP), mHiiHandle);\r
-        break;\r
-\r
-      case IPsecConfigDataTypePad:\r
-        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_PAD_HELP), mHiiHandle);\r
-        break;\r
-\r
-      default:\r
-        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_INCORRECT_DB), mHiiHandle);\r
-        break;\r
-    }\r
-\r
-    goto Done;\r
-  }\r
-\r
   NonOptionCount = ShellCommandLineGetCount (ParamPackage);\r
   if ((NonOptionCount - 1) > 0) {\r
     ValueStr = ShellCommandLineGetRawValue (ParamPackage, (UINT32) (NonOptionCount - 1));\r
index 17044fe..244926f 100644 (file)
 #include <Library/DebugLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiHiiServicesLib.h>\r
 #include <Library/NetLib.h>\r
 \r
 #include <Protocol/IpSecConfig.h>\r
 \r
+//\r
+// String token ID of VConfig command help message text.\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringIpSecHelpTokenId = STRING_TOKEN (STR_IPSEC_CONFIG_HELP);\r
+\r
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))\r
 \r
 #define IPSECCONFIG_STATUS_NAME    L"IpSecStatus"\r
index 52cf6b0..02371e5 100644 (file)
   ENTRY_POINT                    = InitializeIpSecConfig\r
   MODULE_UNI_FILE                = IpSecConfig.uni\r
 \r
+#\r
+#\r
+#  This flag specifies whether HII resource section is generated into PE image.\r
+#\r
+  UEFI_HII_RESOURCE_SECTION      = TRUE\r
+\r
 [Sources]\r
   IpSecConfigStrings.uni\r
   IpSecConfig.c\r
@@ -52,6 +58,7 @@
 [LibraryClasses]\r
   UefiBootServicesTableLib\r
   UefiApplicationEntryPoint\r
+  UefiHiiServicesLib\r
   BaseMemoryLib\r
   ShellLib\r
   MemoryAllocationLib\r
@@ -63,6 +70,7 @@
 [Protocols]\r
   gEfiIpSec2ProtocolGuid                        ##CONSUMES\r
   gEfiIpSecConfigProtocolGuid                   ##CONSUMES\r
+  gEfiHiiPackageListProtocolGuid                ##CONSUMES\r
 \r
 [UserExtensions.TianoCore."ExtraFiles"]\r
   IpSecConfigExtra.uni\r
index 2c342d3..bd7f546 100644 (file)
 \r
 #string STR_IPSEC_CONFIG_INSERT_UNSUPPORT           #language en-US  "%s: Policy entry insertion not supported!\n"\r
 \r
-#string STR_IPSEC_CONFIG_LINE_HELP                  #language en-US  "Displays or modifies the IPsec configuration"\r
-\r
-#string STR_IPSEC_CONFIG_HELP                       #language en-US  "Displays or modifies the current IPsec configuration.\n"\r
-                                                                     "%HUsage: IpSecConfig [-p {SPD|SAD|PAD}] [command] [options[parameters]]%N\n"\r
-                                                                     "\n"\r
-                                                                     "%H-p (SPD|SAD|PAD)%N                   required.point to certain policy database.\n"\r
-                                                                     "%Hcommand%N:\n"\r
-                                                                     "  -a [options[parameters]]         Add new policy entry.\n"\r
-                                                                     "  -i entryid [options[parameters]] Insert new policy entry before the one\n"\r
-                                                                     "                                   matched by the entryid.\n"\r
-                                                                     "                                   It's only supported on SPD policy database.\n"\r
-                                                                     "  -d entryid                       Delete the policy entry matched by the \n"\r
-                                                                     "                                   entryid.\n"\r
-                                                                     "  -e entryid [options[parameters]] Edit the policy entry matched by the\n"\r
-                                                                     "                                   entryid.\n"\r
-                                                                     "  -f                               Flush the entire policy database.\n"\r
-                                                                     "  -l                               List all entries for specified database.\n"\r
-                                                                     "  -enable                          Enable IPsec.\n"\r
-                                                                     "  -disable                         Disable IPsec.\n"\r
-                                                                     "  -status                          Show IPsec current status.\n"\r
-                                                                     "%H[options[parametes]]%N               depend on the type of policy database.Type\n "\r
-                                                                     "                                  'IpSecConfig -p'followed by the database \n"\r
-                                                                     "                                   name, and then type ' -?'.\n"\r
-                                                                     "                                   e.g.: 'IpSecConfig -p SPD -?'\n"\r
-\r
-#string STR_IPSEC_CONFIG_SPD_HELP                   #language en-US  "Explain the %H[options[parametes]%N for %HSPD%N\n"\r
-                                                                     "\n"\r
-                                                                     "%H[options[parameters]]%N:\n"\r
-                                                                     "  --local localaddress               optional local address\n"\r
-                                                                     "  --remote remoteaddress             required remote address\n"\r
-                                                                     "  --proto (TCP|UDP|ICMP|...)         required IP protocol\n"\r
-                                                                     "  --local-port port                  optional local port for tcp/udp protocol\n"\r
-                                                                     "  --remote-port port                 optional remote port for tcp/udp protocol\n"\r
-                                                                     "  --name name                        optional SPD name\n"\r
-                                                                     "  --action (Bypass|Discard|Protect)  required \n"\r
-                                                                     "                                     required IPsec action\n"\r
-                                                                     "  --mode (Transport|Tunnel)          optional IPsec mode, transport by default\n"\r
-                                                                     "  --ipsec-proto (AH|ESP)             optional IPsec protocol, ESP by default\n"\r
-                                                                     "  --auth-algo (NONE|SHA1HMAC)        optional authentication algorithm\n"\r
-                                                                     "  --encrypt-algo(NONE|DESCBC|3DESCBC)optional encryption algorithm\n"\r
-                                                                     "  --tunnel-local tunnellocaladdr     optional tunnel local address(only for tunnel mode)\n"\r
-                                                                     "  --tunnel-remote tunnelremoteaddr   optional tunnel remote address(only for tunnel mode)\n"\r
-                                                                     "\n"\r
-\r
-#string STR_IPSEC_CONFIG_SAD_HELP                   #language en-US  "Explain the %H[options[parameters]]%N for %HSAD%N\n"\r
-                                                                     "\n"\r
-                                                                     "%H[options[parameters]]%N:\n"\r
-                                                                     "  --spi  spi                            required SPI value\n"\r
-                                                                     "  --ipsec-proto   (AH|ESP)              required IPsec protocol\n"\r
-                                                                     "  --local         localaddress          optional local address\n"\r
-                                                                     "  --remote        remoteaddress         required destination address\n"\r
-                                                                     "  --auth-algo     (NONE|SHA1HMAC)       required for AH. authentication algorithm\n"\r
-                                                                     "  --auth-key      key                   required for AH. key for authentication\n"\r
-                                                                     "  --encrypt-algo  (NONE|DESCBC|3DESCBC) required for ESP. encryption algorithm\n"\r
-                                                                     "  --encrypt-key   key                   required for ESP. key for encryption\n"\r
-                                                                     "  --mode          (Transport|Tunnel)    optional IPsec mode, transport by default\n"\r
-                                                                     "  --tunnel-dest   tunneldestaddr        optional tunnel destination address(only for tunnel mode)\n"\r
-                                                                     "  --tunnel-source tunnelsourceaddr      optional tunnel source address(only for tunnel mode)\n"\r
-                                                                     "\n"\r
-\r
-#string STR_IPSEC_CONFIG_PAD_HELP                   #language en-US  "Explain the %H[options[parameters]]%N for %HPAD%N\n"\r
-                                                                     "\n"\r
-                                                                     "%H[options[parameters]]%N:\n"\r
-                                                                     "  --peer-address address                        required peer address\n"\r
-                                                                     "  --auth-proto (IKEv1|IKEv2)                    optional IKE protocol, IKEv1 by\n"\r
-                                                                     "                                                default\n"\r
-                                                                     "  --auth-method (PreSharedSecret|Certificates)  required authentication method\n"\r
-                                                                     "  --auth-data  authdata                         required data for authentication\n"\r
-                                                                     "\n"\r
-\r
 #string STR_IPSEC_MISTAKEN_OPTIONS                  #language en-US  "Mistaken Input. Please refer to %H"IpSecConfig -?"%N for more help information.\n"\r
 \r
 #string STR_IPSEC_REDUNDANCY_MANY                   #language en-US  "%s has one redundancy option: %H%s%N\n"\r
 \r
 #string STR_IPSEC_CONFIG_DISABLE_FAILED             #language en-US  "Error: Disable IPsec failed !\n"\r
 \r
+#string STR_IPSEC_CONFIG_HELP                 #language en-US    ""\r
+".TH IpSecConfig 0 "Displays or modifies the current IPsec configuration."\r\n"\r
+".SH NAME\r\n"\r
+"Displays or modifies the current IPsec configuration.\r\n"\r
+".SH SYNOPSIS\r\n"\r
+" \r\n"\r
+"%HIpSecConfig [-p {SPD|SAD|PAD}] [command] [options[parameters]]\r\n"\r
+".SH OPTIONS\r\n"\r
+" \r\n"\r
+"%H-p (SPD|SAD|PAD)%N                   required.point to certain policy database.\r\n"\r
+" \r\n"\r
+"%Hcommand%N:\r\n"\r
+"  -a [options[parameters]]         Add new policy entry.\r\n"\r
+"  -i entryid [options[parameters]] Insert new policy entry before the one\r\n"\r
+"                                   matched by the entryid.\r\n"\r
+"                                   It's only supported on SPD policy database.\r\n"\r
+"  -d entryid                       Delete the policy entry matched by the \r\n"\r
+"                                   entryid.\r\n"\r
+"  -e entryid [options[parameters]] Edit the policy entry matched by the\r\n"\r
+"                                   entryid.\r\n"\r
+"  -f                               Flush the entire policy database.\r\n"\r
+"  -l                               List all entries for specified database.\r\n"\r
+"  -enable                          Enable IPsec.\r\n"\r
+"  -disable                         Disable IPsec.\r\n"\r
+"  -status                          Show IPsec current status.\r\n"\r
+" \r\n"\r
+"%H[options[parameters]]%N for %HSPD%N:\r\n"\r
+"  --local localaddress               optional local address\r\n"\r
+"  --remote remoteaddress             required remote address\r\n"\r
+"  --proto (TCP|UDP|ICMP|...)         required IP protocol\r\n"\r
+"  --local-port port                  optional local port for tcp/udp protocol\r\n"\r
+"  --remote-port port                 optional remote port for tcp/udp protocol\r\n"\r
+"  --name name                        optional SPD name\r\n"\r
+"  --action (Bypass|Discard|Protect)  required \r\n"\r
+"                                     required IPsec action\r\n"\r
+"  --mode (Transport|Tunnel)          optional IPsec mode, transport by default\r\n"\r
+"  --ipsec-proto (AH|ESP)             optional IPsec protocol, ESP by default\r\n"\r
+"  --auth-algo (NONE|SHA1HMAC)        optional authentication algorithm\r\n"\r
+"  --encrypt-algo(NONE|DESCBC|3DESCBC)optional encryption algorithm\r\n"\r
+"  --tunnel-local tunnellocaladdr     optional tunnel local address(only for tunnel mode)\r\n"\r
+"  --tunnel-remote tunnelremoteaddr   optional tunnel remote address(only for tunnel mode)\r\n"\r
+" \r\n"\r
+"%H[options[parameters]]%N for %HSAD%N:\r\n"\r
+"  --spi  spi                            required SPI value\r\n"\r
+"  --ipsec-proto   (AH|ESP)              required IPsec protocol\r\n"\r
+"  --local         localaddress          optional local address\r\n"\r
+"  --remote        remoteaddress         required destination address\r\n"\r
+"  --auth-algo     (NONE|SHA1HMAC)       required for AH. authentication algorithm\n"\r
+"  --auth-key      key                   required for AH. key for authentication\r\n"\r
+"  --encrypt-algo  (NONE|DESCBC|3DESCBC) required for ESP. encryption algorithm\r\n"\r
+"  --encrypt-key   key                   required for ESP. key for encryption\r\n"\r
+"  --mode          (Transport|Tunnel)    optional IPsec mode, transport by default\r\n"\r
+"  --tunnel-dest   tunneldestaddr        optional tunnel destination address(only for tunnel mode)\r\n"\r
+"  --tunnel-source tunnelsourceaddr      optional tunnel source address(only for tunnel mode)\r\n"\r
+" \r\n"\r
+"%H[options[parameters]]%N for %HPAD%N:\r\n"\r
+"  --peer-address address                        required peer address\r\n"\r
+"  --auth-proto (IKEv1|IKEv2)                    optional IKE protocol, IKEv1 by\r\n"\r
+"                                                default\r\n"\r
+"  --auth-method (PreSharedSecret|Certificates)  required authentication method\r\n"\r
+"  --auth-data  authdata                         required data for authentication\r\n"\r
+" \r\n"\r
index 596ee3b..f1685f7 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation for Ping6 application.\r
 \r
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -19,6 +19,7 @@
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiHiiServicesLib.h>\r
 #include <Library/HiiLib.h>\r
 #include <Library/NetLib.h>\r
 \r
@@ -42,10 +43,6 @@ SHELL_PARAM_ITEM    Ping6ParamList[] = {
     L"-s",\r
     TypeValue\r
   },\r
-  {\r
-    L"-?",\r
-    TypeFlag\r
-  },\r
   {\r
     NULL,\r
     TypeMax\r
@@ -1059,11 +1056,36 @@ InitializePing6 (
   CONST CHAR16        *ValueStr;\r
   CONST CHAR16        *ValueStrPtr;\r
   UINTN               NonOptionCount;\r
+  EFI_HII_PACKAGE_LIST_HEADER     *PackageList;\r
 \r
   //\r
-  // Register our string package with HII and return the handle to it.\r
+  // Retrieve HII package list from ImageHandle\r
   //\r
-  mHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, Ping6Strings, NULL);\r
+  Status = gBS->OpenProtocol (\r
+                  ImageHandle,\r
+                  &gEfiHiiPackageListProtocolGuid,\r
+                  (VOID **) &PackageList,\r
+                  ImageHandle,\r
+                  NULL,\r
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // Publish HII package list to HII Database.\r
+  //\r
+  Status = gHiiDatabase->NewPackageList (\r
+                          gHiiDatabase,\r
+                          PackageList,\r
+                          NULL,\r
+                          &mHiiHandle\r
+                          );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+  \r
   ASSERT (mHiiHandle != NULL);\r
 \r
   Status = ShellCommandLineParseEx (Ping6ParamList, &ParamPackage, NULL, TRUE, FALSE);\r
@@ -1072,11 +1094,6 @@ InitializePing6 (
     goto ON_EXIT;\r
   }\r
 \r
-  if (ShellCommandLineGetFlag (ParamPackage, L"-?")) {\r
-    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_HELP), mHiiHandle);\r
-    goto ON_EXIT;\r
-  }\r
-\r
   SendNumber = 10;\r
   BufferSize = 16;\r
 \r
index b152ff1..4660b0e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The interface function declaration of shell application Ping6 (Ping for v6 series).\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
 #define PING6_MAX_BUFFER_SIZE      32768\r
 #define PING6_ONE_SECOND           10000000\r
 \r
+//\r
+// String token ID of Ping6 command help message text.\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringPing6HelpToken = STRING_TOKEN (STR_PING6_HELP);\r
+\r
 //\r
 // A similar amount of time that passes in femtoseconds\r
 // for each increment of TimerValue. It is for NT32 only.\r
index f8851b9..68b5f2d 100644 (file)
@@ -3,7 +3,7 @@
 #\r
 #  It is an shell application which is used to Ping the target host with IPv6 stack.\r
 #\r
-#  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
   ENTRY_POINT                    = InitializePing6\r
   MODULE_UNI_FILE                = Ping6.uni\r
 \r
+#\r
+#\r
+#  This flag specifies whether HII resource section is generated into PE image.\r
+#\r
+  UEFI_HII_RESOURCE_SECTION      = TRUE\r
+\r
 #\r
 # The following information is for reference only and not required by the build tools.\r
 #\r
@@ -53,6 +59,7 @@
   BaseLib\r
   UefiBootServicesTableLib\r
   UefiApplicationEntryPoint\r
+  UefiHiiServicesLib\r
   BaseMemoryLib\r
   ShellLib\r
   MemoryAllocationLib\r
@@ -65,6 +72,7 @@
   gEfiIp6ProtocolGuid                           ## CONSUMES\r
   gEfiIp6ServiceBindingProtocolGuid             ## CONSUMES\r
   gEfiIp6ConfigProtocolGuid                     ## CONSUMES\r
+  gEfiHiiPackageListProtocolGuid                ## CONSUMES\r
 \r
 [UserExtensions.TianoCore."ExtraFiles"]\r
   Ping6Extra.uni\r
index c2f003d..e4ab19f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   String definitions for the Shell Ping6 application.\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
 #string STR_PING6_STAT                     #language en-US  "\n%d packets transmitted, %d received, %d%% packet loss, time %dms\n"\r
 #string STR_PING6_RTT                      #language en-US  "\nRtt(round trip time) min=%dms max=%dms avg=%dms\n"\r
 #string STR_PING6_LINE_HELP                #language en-US  "Ping a target machine with UEFI IPv6 network stack"\r
-#string STR_PING6_HELP                     #language en-US  "Ping a target machine with UEFI IPv6 network stack.\n\n"\r
-                                                            "Usage: Ping6 [-l size] [-n count] [-s SourceIp] TargetIp\n"\r
-                                                            "       Use ESC and Ctrl+C to interrupt Ping6 process.\n"\r
-                                                            "\n"\r
-                                                            "Options:\n"\r
-                                                            "  -l size     Send buffer size, in bytes(default=16, min=16, max=32768).\n"\r
-                                                            "  -n count    Send request count, (default=10, min=1, max=10000).\n"\r
-                                                            "  -s SourceIp Source IPv6 address.\n"\r
-                                                            "  TargetIp    Target IPv6 address.\n"\r
-                                                            "  -?          Help document.\n"\r
-                                                            "\n"\r
-                                                            "Examples:\n"\r
-                                                            "  Ping6 -s 2002::1 2002::2 -l 1000 -n 5\n"\r
-                                                            "  Ping6 2002::2 -l 1000\n"
\ No newline at end of file
+\r
+#string STR_PING6_HELP                     #language en-US ""\r
+".TH Ping6 0 "Ping a target machine with UEFI IPv6 network stack."\r\n"\r
+".SH NAME\r\n"\r
+"Ping a target machine with UEFI IPv6 network stack.\r\n"\r
+".SH SYNOPSIS\r\n"\r
+" \r\n"\r
+"Ping6 [-l size] [-n count] [-s SourceIp] TargetIp\r\n"\r
+".SH OPTIONS\r\n"\r
+" \r\n"\r
+"  -l size     Send buffer size, in bytes(default=16, min=16, max=32768).\r\n"\r
+"  -n count    Send request count, (default=10, min=1, max=10000).\r\n"\r
+"  -s SourceIp Source IPv6 address.\r\n"\r
+"  TargetIp    Target IPv6 address.\r\n"\r
+".SH EXAMPLES\r\n"\r
+" \r\n"\r
+"Examples:\r\n"\r
+"  Ping6 -s 2002::1 2002::2 -l 1000 -n 5\r\n"\r
+"  Ping6 2002::2 -l 1000\r\n"\r
index ba17207..d00a041 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Shell application for VLAN configuration.\r
 \r
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/HiiLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiHiiServicesLib.h>\r
 #include <Library/NetLib.h>\r
 \r
+//\r
+// String token ID of VConfig command help message text.\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringVConfigHelpTokenId = STRING_TOKEN (STR_VCONFIG_HELP);\r
+\r
 #define INVALID_NIC_INDEX   0xffff\r
 #define INVALID_VLAN_ID     0xffff\r
 \r
@@ -608,13 +614,39 @@ VlanConfigMain (
 {\r
   LIST_ENTRY    *List;\r
   CONST CHAR16  *Str;\r
+  EFI_HII_PACKAGE_LIST_HEADER     *PackageList;\r
+  EFI_STATUS    Status;\r
 \r
   mImageHandle = ImageHandle;\r
+  \r
+  //\r
+  // Retrieve HII package list from ImageHandle\r
+  //\r
+  Status = gBS->OpenProtocol (\r
+                  ImageHandle,\r
+                  &gEfiHiiPackageListProtocolGuid,\r
+                  (VOID **) &PackageList,\r
+                  ImageHandle,\r
+                  NULL,\r
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
 \r
   //\r
-  // Register our string package to HII database.\r
+  // Publish HII package list to HII Database.\r
   //\r
-  mHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, VConfigStrings, NULL);\r
+  Status = gHiiDatabase->NewPackageList (\r
+                          gHiiDatabase,\r
+                          PackageList,\r
+                          NULL,\r
+                          &mHiiHandle\r
+                          );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
   if (mHiiHandle == NULL) {\r
     return EFI_SUCCESS;\r
   }\r
@@ -626,11 +658,6 @@ VlanConfigMain (
     goto Exit;\r
   }\r
 \r
-  if (ShellCommandLineGetFlag (List, L"-?")) {\r
-    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_HELP), mHiiHandle);\r
-    goto Exit;\r
-  }\r
-\r
   if (ShellCommandLineGetFlag (List, L"-l")) {\r
     Str = ShellCommandLineGetValue (List, L"-l");\r
     DisplayVlan ((CHAR16 *) Str);\r
index 7067e0c..771f585 100644 (file)
@@ -3,7 +3,7 @@
 #\r
 #  It is shell application which is used to get and set VLAN configuration.\r
 #\r
-#  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
   ENTRY_POINT                    = VlanConfigMain\r
   MODULE_UNI_FILE                = VConfig.uni\r
 \r
+#\r
+#\r
+#  This flag specifies whether HII resource section is generated into PE image.\r
+#\r
+  UEFI_HII_RESOURCE_SECTION      = TRUE\r
+\r
 #\r
 #  VALID_ARCHITECTURES           = IA32 X64 IPF\r
 #\r
@@ -40,6 +46,7 @@
 [LibraryClasses]\r
   UefiApplicationEntryPoint\r
   UefiBootServicesTableLib\r
+  UefiHiiServicesLib\r
   UefiLib\r
   ShellLib\r
   NetLib\r
@@ -47,7 +54,8 @@
   HiiLib\r
 \r
 [Protocols]\r
-  gEfiVlanConfigProtocolGuid     ## CONSUMES\r
+  gEfiVlanConfigProtocolGuid       ## CONSUMES\r
+  gEfiHiiPackageListProtocolGuid   ## CONSUMES\r
 \r
 [UserExtensions.TianoCore."ExtraFiles"]\r
   VConfigExtra.uni\r
index 641e26e..1bb66ba 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   String definitions for VLAN configuration Shell application.\r
 \r
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
 #string STR_VCONFIG_SET_SUCCESS          #language en-US    "VLAN device added.\n"\r
 #string STR_VCONFIG_REMOVE_SUCCESS       #language en-US    "VLAN device removed.\n"\r
 #string STR_VCONFIG_NO_ARG               #language en-US    "Invalid argument, try "-?" for help.\n"\r
-#string STR_VCONFIG_HELP                 #language en-US    "Display or modify VLAN configuration for network interface.\n\n"\r
-                                                            "VCONFIG [-?] [-l [IfName]] [-a IfName VlanId [Priority]] [-d IfName.VlanId]\n"\r
-                                                            "\n"\r
-                                                            "  -l          Display VLAN configuration for all or specified interface.\n"\r
-                                                            "  -a          Add a VLAN device for the network interface.\n"\r
-                                                            "  -d          Delete a VLAN device.\n"\r
-                                                            "  IfName      Name of network interface, e.g. eth0, eth1.\n"\r
-                                                            "  VlanId      Unique VLAN identifier (0~4094).\n"\r
-                                                            "  Priority    802.1Q priority level (0~7), default 0.\n"\r
-                                                            "\n"\r
-                                                            "Examples:\n"\r
-                                                            "  * To display VLAN configuration:\n"\r
-                                                            "    fs0:\> vconfig -l\n"\r
-                                                            "    fs0:\> vconfig -l eth0\n"\r
-                                                            "\n"\r
-                                                            "  * To add VLAN device:\n"\r
-                                                            "    fs0:\> vconfig -a eth0 1000\n"\r
-                                                            "    fs0:\> vconfig -a eth0 2000 7\n"\r
-                                                            "\n"\r
-                                                            "  * To delete VLAN device:\n"\r
-                                                            "    fs0:\> vconfig -d eth0.1000\n"\r
+\r
+#string STR_VCONFIG_HELP                 #language en-US    ""\r
+".TH VConfig 0 "Display or modify VLAN configuration for network interface."\r\n"\r
+".SH NAME\r\n"\r
+"Display or modify VLAN configuration for network interface.\r\n"\r
+".SH SYNOPSIS\r\n"\r
+" \r\n"\r
+"VCONFIG [-?] [-l [IfName]] [-a IfName VlanId [Priority]] [-d IfName.VlanId]\r\n"\r
+".SH OPTIONS\r\n"\r
+" \r\n"\r
+"  -l          Display VLAN configuration for all or specified interface.\r\n"\r
+"  -a          Add a VLAN device for the network interface.\r\n"\r
+"  -d          Delete a VLAN device.\r\n"\r
+"  IfName      Name of network interface, e.g. eth0, eth1.\r\n"\r
+"  VlanId      Unique VLAN identifier (0~4094).\r\n"\r
+"  Priority    802.1Q priority level (0~7), default 0.\r\n"\r
+".SH EXAMPLES\r\n"\r
+" \r\n"\r
+"Examples:\r\n"\r
+"  * To display VLAN configuration:\r\n"\r
+"    fs0:\> vconfig -l\r\n"\r
+"    fs0:\> vconfig -l eth0\r\n"\r
+"\r\n"\r
+"  * To add VLAN device:\r\n"\r
+"    fs0:\> vconfig -a eth0 1000\r\n"\r
+"    fs0:\> vconfig -a eth0 2000 7\r\n"\r
+"\r\n"\r
+"  * To delete VLAN device:\r\n"\r
+"    fs0:\> vconfig -d eth0.1000\r\n"\r