Morse Micro IoT SDK  2.9.7

Detailed Description

This is the ICMP echo (ping) request implementation.

This implementation is designed to be similar to Unix ping, but differs from it in some respects.

The behavior of this ping implementation is as follows:

The ping retry timeout is calculated as the 2 times average RTT if one or more ping responses have been received, otherwise it will be MMPING_INITIAL_RETRY_INTERVAL_MS.

Data Structures

struct  mmping_args
 Ping request arguments data structure. More...
 
struct  mmping_stats
 Data structure to store ping results. More...
 

Macros

#define MMPING_DEFAULT_PING_INTERVAL_MS   (1000)
 Default time interval in milliseconds between ping requests. More...
 
#define MMPING_DEFAULT_PING_COUNT   (0)
 Default max count for ping request to run forever. More...
 
#define MMPING_DEFAULT_DATA_SIZE   (56)
 Default ping data packet size in bytes, excluding ICMP header. More...
 
#define MMPING_MIN_DATA_SIZE   (8)
 Minimum data size of ping request packet excluding ICMP header. More...
 
#define MMPING_MAX_DATA_SIZE   (1500)
 Maximum data size of ping request packet excluding ICMP header. More...
 
#define MMPING_MAX_COUNT   (0xffff)
 Maximum number of pings before terminating. More...
 
#define MMPING_MAX_RETRIES   (2)
 Maximum number of times to retransmit a ping request before giving up and moving on. More...
 
#define MMPING_INITIAL_RETRY_INTERVAL_MS   (1000)
 Rate at which to retry unacknowledged ping requests when the RTT is not known. More...
 
#define MMPING_IPADDR_MAXLEN   (48)
 Maximum length of an IP address string including null-terminator. More...
 
#define MMPING_ICMP_ECHO_HDR_LEN   (8)
 Length of the ICMP echo header in octets. More...
 
#define MMPING_ARGS_DEFAULT
 Initializer for mmping_args. More...
 

Functions

uint16_t mmping_start (const struct mmping_args *args)
 Initialize ping parameters and start ping. More...
 
void mmping_stop (void)
 Stop any running ping request.
 
void mmping_stats (struct mmping_stats *stats)
 Get Ping Statistics. More...
 

Macro Definition Documentation

◆ MMPING_ARGS_DEFAULT

#define MMPING_ARGS_DEFAULT
Value:
{ \
MMPING_DEFAULT_PING_COUNT, MMPING_DEFAULT_DATA_SIZE, \
}
#define MMPING_DEFAULT_DATA_SIZE
Default ping data packet size in bytes, excluding ICMP header.
Definition: mmping.h:48
#define MMPING_DEFAULT_PING_INTERVAL_MS
Default time interval in milliseconds between ping requests.
Definition: mmping.h:44

Initializer for mmping_args.

Definition at line 95 of file mmping.h.

◆ MMPING_DEFAULT_DATA_SIZE

#define MMPING_DEFAULT_DATA_SIZE   (56)

Default ping data packet size in bytes, excluding ICMP header.

Definition at line 48 of file mmping.h.

◆ MMPING_DEFAULT_PING_COUNT

#define MMPING_DEFAULT_PING_COUNT   (0)

Default max count for ping request to run forever.

Definition at line 46 of file mmping.h.

◆ MMPING_DEFAULT_PING_INTERVAL_MS

#define MMPING_DEFAULT_PING_INTERVAL_MS   (1000)

Default time interval in milliseconds between ping requests.

Definition at line 44 of file mmping.h.

◆ MMPING_ICMP_ECHO_HDR_LEN

#define MMPING_ICMP_ECHO_HDR_LEN   (8)

Length of the ICMP echo header in octets.

Definition at line 64 of file mmping.h.

◆ MMPING_INITIAL_RETRY_INTERVAL_MS

#define MMPING_INITIAL_RETRY_INTERVAL_MS   (1000)

Rate at which to retry unacknowledged ping requests when the RTT is not known.

``

Definition at line 58 of file mmping.h.

◆ MMPING_IPADDR_MAXLEN

#define MMPING_IPADDR_MAXLEN   (48)

Maximum length of an IP address string including null-terminator.

Definition at line 61 of file mmping.h.

◆ MMPING_MAX_COUNT

#define MMPING_MAX_COUNT   (0xffff)

Maximum number of pings before terminating.

Definition at line 54 of file mmping.h.

◆ MMPING_MAX_DATA_SIZE

#define MMPING_MAX_DATA_SIZE   (1500)

Maximum data size of ping request packet excluding ICMP header.

Definition at line 52 of file mmping.h.

◆ MMPING_MAX_RETRIES

#define MMPING_MAX_RETRIES   (2)

Maximum number of times to retransmit a ping request before giving up and moving on.

Definition at line 56 of file mmping.h.

◆ MMPING_MIN_DATA_SIZE

#define MMPING_MIN_DATA_SIZE   (8)

Minimum data size of ping request packet excluding ICMP header.

Definition at line 50 of file mmping.h.

Function Documentation

◆ mmping_start()

uint16_t mmping_start ( const struct mmping_args args)

Initialize ping parameters and start ping.

Parameters
argsPing request arguments
Returns
the ID for this ping on success, on failure returns 0.

◆ mmping_stats()

void mmping_stats ( struct mmping_stats stats)

Get Ping Statistics.

Parameters
statsInstance to receive ping statistics
Note
Calling mmping_start() will reset the ping statistics