# include/net/icmp.h File Reference

`#include <event.h>`
`#include <sys/socket.h>`

## Data Structures
struct | ping_cbargs
## Defines
#define | _ICMP_H 1
## Typedefs
typedef struct ping_cbargs | ping_cbargs_t
## Functions
int16_t | ping (const char *dst, void(*ping_handler)(event_t event, void *cbargs, void *context), ping_cbargs_t *ping_result, void *context)

## Define Documentation

#define _ICMP_H 1

## Typedef Documentation

typedef struct ping_cbargs ping_cbargs_t

## Function Documentation

int16_t ping | ( | const char * | dst,
|  | void(*)(event_t event, void *cbargs, void *context) | ping_handler,
|  | ping_cbargs_t * | ping_result,
|  | void * | context |
| ) |  |  |

A system call to perform the standard ICMP ping service to an unicast IP address or to a link local multicast address.

The ping service is either completed by getting a ping response from the destination or a timeout notification. In the case of link local multicast with multiple responses, the ping_handler() will be invoked for each ping respond. A timeout notification will always be generated to signal the completion of a link local multicast ping. The done field in ping_cbargs_t signals the completion of the ping and thus expires the binding of the callback handler with the ping call.

Parameters:

  `[in]` | dst | IPv6 address of the desired destination(s) to ping
  `[in]` | ping_handler | continuation callback handler. If NULL is passed, call will fail.
  `[out]` | ping_result | results of the calls for the continatuion callback are stored here. if NULL is passed, call will fail
  `[in]` | context | application context

Returns:
  0 if succeed and -1 if fail and errno is set appropriately.

Errors:
  EBUSY if the underlying system is busy

  EOFF if underlying system is off. (e.g. link interface is off)

  EINVAL if invalid parameters are passed

## Callback Descriptions

### ping_handler

Parameters:

  `[in]` | event | Type is PING in EventsEnum
  `[in]` | cbargs | is ping_result in ping()
  `[in]` | context | is context in ping()

Returns:
  None.