# Ping Sender

# Ping Sender

This file includes the OpenThread API for the ping sender module.

## Summary

| ### Typedefs ||
|---|---|
| `https://openthread.io/reference/group/api-ping-sender#group__api-ping-sender_1gaefa84bff4070284faf93aa1fb88bbaea` | typedef `struct https://openthread.io/reference/struct/ot-ping-sender-config` Represents a ping request configuration. |
| `https://openthread.io/reference/group/api-ping-sender#group__api-ping-sender_1ga03512ba000895c3aca9e40d168356eed` | typedef `struct https://openthread.io/reference/struct/ot-ping-sender-reply` Represents a ping reply. |
| `https://openthread.io/reference/group/api-ping-sender#group__api-ping-sender_1ga2ff70763e156d85ed9845506dae4d32d)(const otPingSenderReply *aReply, void *aContext)` | typedef `void(*` Pointer type specifies the callback to notify receipt of a ping reply. |
| `https://openthread.io/reference/group/api-ping-sender#group__api-ping-sender_1ga01e3b5d80dc4738b3736037f89638967` | typedef `struct https://openthread.io/reference/struct/ot-ping-sender-statistics` Represents statistics of a ping request. |
| `https://openthread.io/reference/group/api-ping-sender#group__api-ping-sender_1ga1824c68194ac85275fa73b7024e83c51)(const otPingSenderStatistics *aStatistics, void *aContext)` | typedef `void(*` Pointer type specifies the callback to report the ping statistics. |

| ### Functions ||
|---|---|
| `https://openthread.io/reference/group/api-ping-sender#group__api-ping-sender_1gaed43ae662eba31e260c0f505329b38e5(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-ping-sender-config *aConfig)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Starts a ping. |
| `https://openthread.io/reference/group/api-ping-sender#group__api-ping-sender_1gaa65478269efda3716c9b604bc0cfd507(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Stops an ongoing ping. |

| ### Structs ||
|---|---|
| [otPingSenderConfig](https://openthread.io/reference/struct/ot-ping-sender-config) | Represents a ping request configuration. |
| [otPingSenderReply](https://openthread.io/reference/struct/ot-ping-sender-reply) | Represents a ping reply. |
| [otPingSenderStatistics](https://openthread.io/reference/struct/ot-ping-sender-statistics) | Represents statistics of a ping request. |

## Typedefs

### otPingSenderConfig

```
struct otPingSenderConfig otPingSenderConfig
```
Represents a ping request configuration.

### otPingSenderReply

```
struct otPingSenderReply otPingSenderReply
```
Represents a ping reply.

### otPingSenderReplyCallback

```
void(* otPingSenderReplyCallback)(const otPingSenderReply *aReply, void *aContext)
```
Pointer type specifies the callback to notify receipt of a ping reply.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aReply` | A pointer to a `https://openthread.io/reference/struct/ot-ping-sender-reply` containing info about the received ping reply. | | `[in] aContext` | A pointer to application-specific context. | |

### otPingSenderStatistics

```
struct otPingSenderStatistics otPingSenderStatistics
```
Represents statistics of a ping request.

### otPingSenderStatisticsCallback

```
void(* otPingSenderStatisticsCallback)(const otPingSenderStatistics *aStatistics, void *aContext)
```
Pointer type specifies the callback to report the ping statistics.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aStatistics` | A pointer to a `https://openthread.io/reference/struct/ot-ping-sender-statistics` containing info about the received ping statistics. | | `[in] aContext` | A pointer to application-specific context. | |

## Functions

### otPingSenderPing

```
otError otPingSenderPing(
  otInstance *aInstance,
  const otPingSenderConfig *aConfig
)
```
Starts a ping.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aConfig` | The ping config to use. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | The ping started successfully. | | `OT_ERROR_BUSY` | Could not start since busy with a previous ongoing ping request. | | `OT_ERROR_INVALID_ARGS` | The `aConfig` contains invalid parameters (e.g., ping interval is too long). | |

### otPingSenderStop

```
void otPingSenderStop(
  otInstance *aInstance
)
```
Stops an ongoing ping.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |

## Resources

OpenThread API Reference topics originate from the source code, available
on [GitHub](https://github.com/openthread/openthread/tree/main/include/openthread).
For more information, or to contribute to our documentation, refer to
[Resources](https://openthread.io/resources).