Skip to content

Ping

Types

mira_net_ping_callback_t

typedef void(* mira_net_ping_callback_t) (const mira_net_address_t *address, uint8_t ttl, int32_t rtt, void *storage);

Type for the callback to execute on ping reply.

Parameters

Name Description
address Address of the source of the reply.
ttl Time to live; how many more hops the packet would live.
rtt It is >= 0 at ping reply, < 0 when no reply was received.
storage Data set upon sending the ping, see mira_net_ping_send().

Note

rtt is only used to tell if a reply was received.

Functions

mira_net_ping_send

mira_status_t mira_net_ping_send(const mira_net_address_t *address, mira_net_ping_callback_t cb, void *storage);

Send a ping to the specified address.

The callback is only called once. Either at the first ping reply or when mira_net_ping_send is called the next time. The callback's rtt argument is < 0 if no reply was received.

Parameters

Name Description
address The node address.
cb The callback function, executes on ping reply.
storage Storage pointer which is used to store optional information to be used by the callback function. E.g. it could be used as an identifier or to pass on a configuration struct.

Return value

Name Description
MIRA_SUCCESS Ping successfully sent.
Back to top