#include <dolphin/ip.h>
struct ICMPInfo
{
//
// Note do not access members without API functions
//
IPInfo info;
IPSocket local; // Bind
IPSocket remote; // Connect
ICMPObj obj;
};
typedef void (* ICMPCallback )(ICMPInfo*info, s32result);
s32 ICMPPing( ICMPInfo* info, const void* data, s32 len,
const void* remote, ICMPCallback callback, s32* result);
ICMPPing() sends an ICMP Echo Request to a remote
socket. remote is
the pointer to a socket address structure (SOSockAddrIn or SOSockAddrIn6).
The port number of the remote socket is set
to the ID field of ICMP echo request.
The len bytes of data
pointed by data is included as the data
of the ICMP echo request.
When an ICMP Echo Reply or an ICMP Error Message is received from remote,
the callback will be called.
The function result pointed by result is
zero, if the received ICMP echo reply is valid.
Note: There is no timeout; ICMPPing() will wait
forever. To terminate the process of ICMPPing(), call ICMPCancel().
ICMPPing() returns IP_ERR_BUSY, while the operation of
ICMPPing() is in progress.
info |
The pointer to the data structure that represents an endpoint for ICMP communication. |
data |
The address family (SO_AF_INET for IPv4 or SO_AF_INET6 for IPv6). |
len
|
The length of the data in bytes. |
remote
|
Pointer to the target socket (SOSockAddrIn or SOSockAddrIn6). |
callback
|
Informed when an ICMP Echo Reply or an ICMP Error Message is received. callback
is also called when ICMPCancel()
is called. |
result
|
Pointer to s32 that receives the function result. |
IP_ERR_NONE |
Succeeded. |
IP_ERR_INVALID |
info is not a valid ICMPInfo.. |
IP_ERR_BUSY |
Specified socket is busy. |
IP_ERR_UNREACHABLE |
Specified socket is unreachable from this machine. |
IP_ERR_DATASIZE |
The data size exceeds the transfer limit. |
IP_ERR_REFUSED |
Specified remote socket is invalid. |
| zero | Succeeded. |
IP_ERR_CLOSING |
info is closed by ICMPClose(). |