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
\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
\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
\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
}\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
//\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
// 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
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
//\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
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
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
//\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
//\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
\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