TianoCore EDK2 master
Loading...
Searching...
No Matches
Ping6.c File Reference

Go to the source code of this file.

Data Structures

struct  _ICMP6_ECHO_REQUEST_REPLY
 
struct  _PING6_ICMP6_TX_INFO
 
struct  _PING6_PRIVATE_DATA
 

Macros

#define PING6_DEFAULT_TIMEOUT   5000
 
#define PING6_MAX_SEND_NUMBER   10000
 
#define PING6_MAX_BUFFER_SIZE   32768
 
#define PING6_ONE_SECOND   10000000
 
#define STALL_1_MILLI_SECOND   1000
 

Typedefs

typedef struct _ICMP6_ECHO_REQUEST_REPLY ICMP6_ECHO_REQUEST_REPLY
 
typedef struct _PING6_ICMP6_TX_INFO PING6_ICMP6_TX_INFO
 
typedef struct _PING6_PRIVATE_DATA PING6_PRIVATE_DATA
 

Functions

VOID EFIAPI Ping6RttTimerTickRoutine (IN EFI_EVENT Event, IN VOID *Context)
 
UINT32 Ping6GetTimerPeriod (VOID)
 
EFI_STATUS Ping6InitRttTimer (IN PING6_PRIVATE_DATA *Private)
 
VOID Ping6FreeRttTimer (IN PING6_PRIVATE_DATA *Private)
 
UINT32 Ping6ReadTime (IN PING6_PRIVATE_DATA *Private)
 
UINT32 Ping6CalculateTick (IN PING6_PRIVATE_DATA *Private, IN UINT32 Begin, IN UINT32 End)
 
VOID Ping6DestroyTxInfo (IN PING6_ICMP6_TX_INFO *TxInfo)
 
EFI_STATUS Ping6OnMatchEchoReply (IN PING6_PRIVATE_DATA *Private, IN ICMP6_ECHO_REQUEST_REPLY *Packet)
 
VOID EFIAPI Ping6OnEchoRequestSent6 (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI Ping6OnEchoReplyReceived6 (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_IP6_COMPLETION_TOKENPing6GenerateToken (IN PING6_PRIVATE_DATA *Private, IN UINT32 TimeStamp, IN UINT16 SequenceNum)
 
EFI_STATUS Ping6SendEchoRequest (IN PING6_PRIVATE_DATA *Private)
 
EFI_STATUS Ping6OnReceiveEchoReply (IN PING6_PRIVATE_DATA *Private)
 
VOID EFIAPI Ping6OnTimerRoutine6 (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS Ping6CreateIpInstance (IN PING6_PRIVATE_DATA *Private)
 
VOID Ping6DestroyIpInstance (IN PING6_PRIVATE_DATA *Private)
 
SHELL_STATUS ShellPing6 (IN EFI_HANDLE ImageHandle, IN UINT32 SendNumber, IN UINT32 BufferSize, IN EFI_IPv6_ADDRESS *SrcAddress, IN EFI_IPv6_ADDRESS *DstAddress)
 
SHELL_STATUS EFIAPI ShellCommandRunPing6 (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

SHELL_PARAM_ITEM Ping6ParamList []
 
CONST CHAR16 * mIp6DstString
 
CONST CHAR16 * mIp6SrcString
 
EFI_CPU_ARCH_PROTOCOLCpu = NULL
 

Detailed Description

The implementation for Ping6 application.

Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Ping6.c.

Macro Definition Documentation

◆ PING6_DEFAULT_TIMEOUT

#define PING6_DEFAULT_TIMEOUT   5000

Definition at line 12 of file Ping6.c.

◆ PING6_MAX_BUFFER_SIZE

#define PING6_MAX_BUFFER_SIZE   32768

Definition at line 14 of file Ping6.c.

◆ PING6_MAX_SEND_NUMBER

#define PING6_MAX_SEND_NUMBER   10000

Definition at line 13 of file Ping6.c.

◆ PING6_ONE_SECOND

#define PING6_ONE_SECOND   10000000

Definition at line 15 of file Ping6.c.

◆ STALL_1_MILLI_SECOND

#define STALL_1_MILLI_SECOND   1000

Definition at line 16 of file Ping6.c.

Function Documentation

◆ Ping6CalculateTick()

UINT32 Ping6CalculateTick ( IN PING6_PRIVATE_DATA Private,
IN UINT32  Begin,
IN UINT32  End 
)

Get and calculate the duration in ms.

Parameters
[in]PrivateThe pointer to PING6_PRIVATE_DATA.
[in]BeginThe start point of time.
[in]EndThe end point of time.
Returns
The duration in ms.

Definition at line 263 of file Ping6.c.

◆ Ping6CreateIpInstance()

EFI_STATUS Ping6CreateIpInstance ( IN PING6_PRIVATE_DATA Private)

Create a valid IP6 instance.

Parameters
[in]PrivateThe pointer of PING6_PRIVATE_DATA.
Return values
EFI_SUCCESSCreate a valid IP6 instance successfully.
EFI_ABORTEDLocate handle with ip6 service binding protocol unsuccessfully.
EFI_INVALID_PARAMETERThe source address is unspecified when the destination address is a link -ocal address.
EFI_OUT_OF_RESOURCESNo memory is available on the platform.
EFI_NOT_FOUNDThe source address is not found.

Definition at line 744 of file Ping6.c.

◆ Ping6DestroyIpInstance()

VOID Ping6DestroyIpInstance ( IN PING6_PRIVATE_DATA Private)

Destroy the IP6 instance.

Parameters
[in]PrivateThe pointer of PING6_PRIVATE_DATA.

Definition at line 995 of file Ping6.c.

◆ Ping6DestroyTxInfo()

VOID Ping6DestroyTxInfo ( IN PING6_ICMP6_TX_INFO TxInfo)

Destroy IPING6_ICMP6_TX_INFO, and recollect the memory.

Parameters
[in]TxInfoThe pointer to PING6_ICMP6_TX_INFO.

Definition at line 283 of file Ping6.c.

◆ Ping6FreeRttTimer()

VOID Ping6FreeRttTimer ( IN PING6_PRIVATE_DATA Private)

Free RTT timer event resource.

Parameters
[in]PrivateThe pointer to PING6_PRIVATE_DATA.

Definition at line 227 of file Ping6.c.

◆ Ping6GenerateToken()

EFI_IP6_COMPLETION_TOKEN * Ping6GenerateToken ( IN PING6_PRIVATE_DATA Private,
IN UINT32  TimeStamp,
IN UINT16  SequenceNum 
)

Initial EFI_IP6_COMPLETION_TOKEN.

Parameters
[in]PrivateThe pointer of PING6_PRIVATE_DATA.
[in]TimeStampThe TimeStamp of request.
[in]SequenceNumThe SequenceNum of request.
Returns
The pointer of EFI_IP6_COMPLETION_TOKEN.

Definition at line 495 of file Ping6.c.

◆ Ping6GetTimerPeriod()

UINT32 Ping6GetTimerPeriod ( VOID  )

Get the timer period of the system.

This function tries to get the system timer period by creating an 1ms period timer.

Returns
System timer period in MS, or 0 if operation failed.

Definition at line 126 of file Ping6.c.

◆ Ping6InitRttTimer()

EFI_STATUS Ping6InitRttTimer ( IN PING6_PRIVATE_DATA Private)

Initialize the timer event for RTT (round trip time).

Parameters
[in]PrivateThe pointer to PING6_PRIVATE_DATA.
Return values
EFI_SUCCESSRTT timer is started.
OthersFailed to start the RTT timer.

Definition at line 184 of file Ping6.c.

◆ Ping6OnEchoReplyReceived6()

VOID EFIAPI Ping6OnEchoReplyReceived6 ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

receive reply, match and print reply infomation.

Parameters
[in]EventA EFI_EVENT type event.
[in]ContextThe pointer to context.

Definition at line 384 of file Ping6.c.

◆ Ping6OnEchoRequestSent6()

VOID EFIAPI Ping6OnEchoRequestSent6 ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

The original intention is to send a request. Currently, the application retransmits an icmp6 echo request packet per second in sendnumber times that is specified by the user. Because nothing can be done here, all things move to the timer routine.

Parameters
[in]EventA EFI_EVENT type event.
[in]ContextThe pointer to Context.

Definition at line 368 of file Ping6.c.

◆ Ping6OnMatchEchoReply()

EFI_STATUS Ping6OnMatchEchoReply ( IN PING6_PRIVATE_DATA Private,
IN ICMP6_ECHO_REQUEST_REPLY Packet 
)

Match the request, and reply with SequenceNum/TimeStamp.

Parameters
[in]PrivateThe pointer to PING6_PRIVATE_DATA.
[in]PacketThe pointer to ICMP6_ECHO_REQUEST_REPLY.
Return values
EFI_SUCCESSThe match is successful.
EFI_NOT_FOUNDThe reply can't be matched with any request.

Definition at line 333 of file Ping6.c.

◆ Ping6OnReceiveEchoReply()

EFI_STATUS Ping6OnReceiveEchoReply ( IN PING6_PRIVATE_DATA Private)

Place a completion token into the receive packet queue to receive the echo reply.

Parameters
[in]PrivateThe pointer of PING6_PRIVATE_DATA.
Return values
EFI_SUCCESSPut the token into the receive packet queue successfully.
othersPut the token into the receive packet queue unsuccessfully.

Definition at line 634 of file Ping6.c.

◆ Ping6OnTimerRoutine6()

VOID EFIAPI Ping6OnTimerRoutine6 ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Remove the timeout request from the list.

Parameters
[in]EventA EFI_EVENT type event.
[in]ContextThe pointer to Context.

Definition at line 673 of file Ping6.c.

◆ Ping6ReadTime()

UINT32 Ping6ReadTime ( IN PING6_PRIVATE_DATA Private)

Read the current time.

Parameters
[in]PrivateThe pointer to PING6_PRIVATE_DATA.
Return values
thecurrent tick value.

Definition at line 245 of file Ping6.c.

◆ Ping6RttTimerTickRoutine()

VOID EFIAPI Ping6RttTimerTickRoutine ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

RTT timer tick routine.

Parameters
[in]EventA EFI_EVENT type event.
[in]ContextThe pointer to Context.

Definition at line 105 of file Ping6.c.

◆ Ping6SendEchoRequest()

EFI_STATUS Ping6SendEchoRequest ( IN PING6_PRIVATE_DATA Private)

Transmit the EFI_IP6_COMPLETION_TOKEN.

Parameters
[in]PrivateThe pointer of PING6_PRIVATE_DATA.
Return values
EFI_SUCCESSTransmitted successfully.
EFI_OUT_OF_RESOURCESNo memory is available on the platform.
othersTransmitted unsuccessfully.

Definition at line 584 of file Ping6.c.

◆ ShellCommandRunPing6()

SHELL_STATUS EFIAPI ShellCommandRunPing6 ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Function for 'ping6' command.

Parameters
[in]ImageHandleHandle to the Image (NULL if Internal).
[in]SystemTablePointer to the System Table (NULL if Internal).
Return values
SHELL_SUCCESSThe ping6 processed successfullly.
othersThe ping6 processed unsuccessfully.

Definition at line 1257 of file Ping6.c.

◆ ShellPing6()

SHELL_STATUS ShellPing6 ( IN EFI_HANDLE  ImageHandle,
IN UINT32  SendNumber,
IN UINT32  BufferSize,
IN EFI_IPv6_ADDRESS SrcAddress,
IN EFI_IPv6_ADDRESS DstAddress 
)

The Ping6 Process.

Parameters
[in]ImageHandleThe firmware allocated handle for the UEFI image.
[in]SendNumberThe send request count.
[in]BufferSizeThe send buffer size.
[in]SrcAddressThe source IPv6 address.
[in]DstAddressThe destination IPv6 address.
Return values
SHELL_SUCCESSThe ping6 processed successfullly.
othersThe ping6 processed unsuccessfully.

Definition at line 1034 of file Ping6.c.

Variable Documentation

◆ Cpu

Definition at line 94 of file Ping6.c.

◆ mIp6DstString

CONST CHAR16* mIp6DstString

Definition at line 92 of file Ping6.c.

◆ mIp6SrcString

CONST CHAR16* mIp6SrcString

Definition at line 93 of file Ping6.c.

◆ Ping6ParamList

SHELL_PARAM_ITEM Ping6ParamList[]
Initial value:
= {
{
L"-l",
},
{
L"-n",
},
{
L"-s",
},
{
L"-?",
},
{
TypeMax
},
}
#define NULL
Definition: Base.h:319
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
Definition: ShellLib.h:700
@ TypeFlag
A flag that is present or not present only (IE "-a").
Definition: ShellLib.h:699

Definition at line 66 of file Ping6.c.