]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c
ShellPkg: Refine global variable name to follow EDK II coding style.
[mirror_edk2.git] / ShellPkg / Library / UefiShellNetwork1CommandsLib / Ping.c
index b8f6728b0432e179df29d644dee7434c08d9013a..dbee764b64eb1230b7c6eb80e54f4bc6be727321 100644 (file)
@@ -2,7 +2,7 @@
   The implementation for Ping shell command.\r
 \r
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2015, 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
@@ -18,7 +18,7 @@
 \r
 #define PING_IP4_COPY_ADDRESS(Dest, Src) (CopyMem ((Dest), (Src), sizeof (EFI_IPv4_ADDRESS)))\r
 \r
-UINT64          CurrentTick = 0;\r
+UINT64          mCurrentTick = 0;\r
 \r
 //\r
 // Function templates to match the IPv4 and IPv6 commands that we use.\r
@@ -235,25 +235,25 @@ ReadTime (
 \r
   ASSERT (gCpu != NULL);\r
 \r
-  Status = gCpu->GetTimerValue (gCpu, 0, &CurrentTick, &TimerPeriod);\r
+  Status = gCpu->GetTimerValue (gCpu, 0, &mCurrentTick, &TimerPeriod);\r
   if (EFI_ERROR (Status)) {\r
     //\r
     // The WinntGetTimerValue will return EFI_UNSUPPORTED. Set the\r
     // TimerPeriod by ourselves.\r
     //\r
-    CurrentTick += 1000000;\r
+    mCurrentTick += 1000000;\r
   }\r
   \r
-  return CurrentTick;\r
+  return mCurrentTick;\r
 }\r
 \r
 \r
 /**\r
-  Get and caculate the frequency in tick/ms.\r
-  The result is saved in the globle variable mFrequency\r
+  Get and calculate the frequency in ticks/ms.\r
+  The result is saved in the global variable mFrequency\r
 \r
-  @retval EFI_SUCCESS    Caculated the frequency successfully.\r
-  @retval Others         Failed to caculate the frequency.\r
+  @retval EFI_SUCCESS    Calculated the frequency successfully.\r
+  @retval Others         Failed to calculate the frequency.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -279,7 +279,7 @@ GetFrequency (
 \r
   //\r
   // The timer period is in femtosecond (1 femtosecond is 1e-15 second).\r
-  // So 1e+12 is divided by timer period to produce the freq in tick/ms.\r
+  // So 1e+12 is divided by timer period to produce the freq in ticks/ms.\r
   //\r
   mFrequency = DivU64x64Remainder (1000000000000ULL, TimerPeriod, NULL);\r
 \r
@@ -287,7 +287,7 @@ GetFrequency (
 }\r
 \r
 /**\r
-  Caculate a duration in ms.\r
+  Calculate a duration in ms.\r
 \r
   @param[in]  Begin     The start point of time.\r
   @param[in]  End       The end point of time.\r
@@ -598,7 +598,7 @@ PingGenerateToken (
   //\r
   Request->Type        = (UINT8)(Private->IpChoice==PING_IP_CHOICE_IP6?ICMP_V6_ECHO_REQUEST:ICMP_V4_ECHO_REQUEST);\r
   Request->Code        = 0;\r
-  Request->SequenceNum = SequenceNum;\r
+  Request->SequenceNum = SequenceNum; \r
   Request->Identifier  = 0;\r
   Request->Checksum    = 0;\r
 \r
@@ -606,6 +606,7 @@ PingGenerateToken (
   // Assembly token for transmit.\r
   //\r
   if (Private->IpChoice==PING_IP_CHOICE_IP6) {\r
+    Request->TimeStamp   = TimeStamp;\r
     ((EFI_IP6_TRANSMIT_DATA*)TxData)->ExtHdrsLength                   = 0;\r
     ((EFI_IP6_TRANSMIT_DATA*)TxData)->ExtHdrs                         = NULL;\r
     ((EFI_IP6_TRANSMIT_DATA*)TxData)->OverrideData                    = 0;\r
@@ -804,11 +805,6 @@ Ping6OnTimerRoutine (
       RemoveEntryList (&TxInfo->Link);\r
       PingDestroyTxInfo (TxInfo, Private->IpChoice);\r
 \r
-      //\r
-      // We dont need to wait for this some other time...\r
-      //\r
-      Private->RxCount++;\r
-\r
       if (IsListEmpty (&Private->TxList) && (Private->TxCount == Private->SendNum)) {\r
         //\r
         // All the left icmp6 echo request in the list timeout.\r
@@ -955,7 +951,7 @@ PingCreateIpInstance (
       //\r
       Status = gBS->HandleProtocol (\r
                       HandleBuffer[HandleIndex],\r
-                      Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ConfigProtocolGuid:&gEfiIp4ConfigProtocolGuid,\r
+                      Private->IpChoice == PING_IP_CHOICE_IP6?&gEfiIp6ConfigProtocolGuid:&gEfiIp4Config2ProtocolGuid,\r
                       (VOID **) &IpXCfg\r
                       );\r
 \r
@@ -973,8 +969,9 @@ PingCreateIpInstance (
                            NULL\r
                            );\r
       } else {\r
-        Status = ((EFI_IP4_CONFIG_PROTOCOL*)IpXCfg)->GetData (\r
+        Status = ((EFI_IP4_CONFIG2_PROTOCOL*)IpXCfg)->GetData (\r
                            IpXCfg,\r
+                           Ip4Config2DataTypeInterfaceInfo,\r
                            &IfInfoSize,\r
                            NULL\r
                            );\r
@@ -1009,8 +1006,9 @@ PingCreateIpInstance (
                            IpXInterfaceInfo\r
                            );\r
       } else {\r
-        Status = ((EFI_IP4_CONFIG_PROTOCOL*)IpXCfg)->GetData (\r
+        Status = ((EFI_IP4_CONFIG2_PROTOCOL*)IpXCfg)->GetData (\r
                            IpXCfg,\r
+                           Ip4Config2DataTypeInterfaceInfo,\r
                            &IfInfoSize,\r
                            IpXInterfaceInfo\r
                            );\r
@@ -1045,7 +1043,7 @@ PingCreateIpInstance (
         //\r
         // IP4 address check\r
         //\r
-        if (EFI_IP4_EQUAL (&Private->SrcAddress, &((EFI_IP4_IPCONFIG_DATA*)IpXInterfaceInfo)->StationAddress)) {\r
+        if (EFI_IP4_EQUAL (&Private->SrcAddress, &((EFI_IP4_CONFIG2_INTERFACE_INFO*)IpXInterfaceInfo)->StationAddress)) {\r
           //\r
           // Match a certain interface address.\r
           //\r
@@ -1137,11 +1135,6 @@ PingCreateIpInstance (
     //\r
     // Configure the ip4 instance for icmp4 packet exchange.\r
     //\r
-//    PING_IP4_COPY_ADDRESS (&Ip4Config.StationAddress,     &Private->SrcAddress);\r
-//    Ip4Config.SubnetMask.Addr[0] = 0xFF;\r
-//    Ip4Config.SubnetMask.Addr[1] = 0xFF;\r
-//    Ip4Config.SubnetMask.Addr[2] = 0xFF;\r
-//    Ip4Config.SubnetMask.Addr[3] = 0x00;\r
     Ip4Config.DefaultProtocol   = 1;\r
     Ip4Config.AcceptAnyProtocol = FALSE;\r
     Ip4Config.AcceptBroadcast   = FALSE;\r
@@ -1429,6 +1422,10 @@ ON_EXIT:
 \r
   @param[in] ImageHandle  Handle to the Image (NULL if Internal).\r
   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).\r
+\r
+  @retval SHELL_SUCCESS  The ping processed successfullly.\r
+  @retval others         The ping processed unsuccessfully.\r
+  \r
 **/\r
 SHELL_STATUS\r
 EFIAPI\r