1
6
7
8
9
10
11
12
13
14
15
16
17
21
22
23
27
28
32
33
34
38
39
40
44
45
46
50
51
52
53
57
58
59
60
61
62
63
64
65
66
67
68
69
70
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/* ... */
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "esp_err.h"
#include "lwip/ip_addr.h"
/* ... */
typedef void *esp_ping_handle_t;
/* ... */
typedef struct {
/* ... */
void *cb_args;
/* ... */
void (*on_ping_success)(esp_ping_handle_t hdl, void *args);
/* ... */
void (*on_ping_timeout)(esp_ping_handle_t hdl, void *args);
/* ... */
void (*on_ping_end)(esp_ping_handle_t hdl, void *args);
}{ ... } esp_ping_callbacks_t;
/* ... */
typedef struct {
uint32_t count;
uint32_t interval_ms;
uint32_t timeout_ms;
uint32_t data_size;
int tos;
int ttl;
ip_addr_t target_addr;
uint32_t task_stack_size;
uint32_t task_prio;
uint32_t interface;
}{ ... } esp_ping_config_t;
/* ... */
#define ESP_PING_DEFAULT_CONFIG() \
{ \
.count = 5, \
.interval_ms = 1000, \
.timeout_ms = 1000, \
.data_size = 64, \
.tos = 0, \
.ttl = IP_DEFAULT_TTL, \
.target_addr = *(IP_ANY_TYPE), \
.task_stack_size = ESP_TASK_PING_STACK, \
.task_prio = 2, \
.interface = 0,\
}{...}
...
#define ESP_PING_COUNT_INFINITE (0)
/* ... */
typedef enum {
ESP_PING_PROF_SEQNO,
ESP_PING_PROF_TOS,
ESP_PING_PROF_TTL,
ESP_PING_PROF_REQUEST,
ESP_PING_PROF_REPLY,
ESP_PING_PROF_IPADDR,
ESP_PING_PROF_SIZE,
ESP_PING_PROF_TIMEGAP,
ESP_PING_PROF_DURATION
}{ ... } esp_ping_profile_t;
/* ... */
esp_err_t esp_ping_new_session(const esp_ping_config_t *config, const esp_ping_callbacks_t *cbs, esp_ping_handle_t *hdl_out);
/* ... */
esp_err_t esp_ping_delete_session(esp_ping_handle_t hdl);
/* ... */
esp_err_t esp_ping_start(esp_ping_handle_t hdl);
/* ... */
esp_err_t esp_ping_stop(esp_ping_handle_t hdl);
/* ... */
esp_err_t esp_ping_get_profile(esp_ping_handle_t hdl, esp_ping_profile_t profile, void *data, uint32_t size);
#ifdef __cplusplus
}{...}
#endif