Select one of the symbols to view example projects that use it.
 
Outline
#include <stdint.h>
#include "esp_err.h"
#include "lwip/ip_addr.h"
esp_ping_handle_t
esp_ping_callbacks_t
esp_ping_config_t
#define ESP_PING_COUNT_INFINITE
esp_ping_profile_t
esp_ping_new_session(const esp_ping_config_t *, const esp_ping_callbacks_t *, esp_ping_handle_t *);
esp_ping_delete_session(esp_ping_handle_t);
esp_ping_start(esp_ping_handle_t);
esp_ping_stop(esp_ping_handle_t);
esp_ping_get_profile(esp_ping_handle_t, esp_ping_profile_t, void *, uint32_t);
Files
loading...
SourceVuESP-IDF Framework and ExampleslwIPinclude/apps/ping/ping_sock.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #pragma once #ifdef __cplusplus extern "C" { #endif #include <stdint.h> #include "esp_err.h" #include "lwip/ip_addr.h" /** * @brief Type of "ping" session handle * *//* ... */ typedef void *esp_ping_handle_t; /** * @brief Type of "ping" callback functions * *//* ... */ typedef struct { /** * @brief arguments for callback functions * *//* ... */ void *cb_args; /** * @brief Invoked by internal ping thread when received ICMP echo reply packet * *//* ... */ void (*on_ping_success)(esp_ping_handle_t hdl, void *args); /** * @brief Invoked by internal ping thread when receive ICMP echo reply packet timeout * *//* ... */ void (*on_ping_timeout)(esp_ping_handle_t hdl, void *args); /** * @brief Invoked by internal ping thread when a ping session is finished * *//* ... */ void (*on_ping_end)(esp_ping_handle_t hdl, void *args); }{ ... } esp_ping_callbacks_t; /** * @brief Type of "ping" configuration * *//* ... */ typedef struct { uint32_t count; /*!< A "ping" session contains count procedures */ uint32_t interval_ms; /*!< Milliseconds between each ping procedure */ uint32_t timeout_ms; /*!< Timeout value (in milliseconds) of each ping procedure */ uint32_t data_size; /*!< Size of the data next to ICMP packet header */ int tos; /*!< Type of Service, a field specified in the IP header */ int ttl; /*!< Time to Live,a field specified in the IP header */ ip_addr_t target_addr; /*!< Target IP address, either IPv4 or IPv6 */ uint32_t task_stack_size; /*!< Stack size of internal ping task */ uint32_t task_prio; /*!< Priority of internal ping task */ uint32_t interface; /*!< Netif index, interface=0 means NETIF_NO_INDEX*/ }{ ... } esp_ping_config_t; /** * @brief Default ping configuration * *//* ... */ #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) /*!< Set ping count to zero will ping target infinitely */ /** * @brief Profile of ping session * *//* ... */ typedef enum { ESP_PING_PROF_SEQNO, /*!< Sequence number of a ping procedure */ ESP_PING_PROF_TOS, /*!< Type of service of a ping procedure */ ESP_PING_PROF_TTL, /*!< Time to live of a ping procedure */ ESP_PING_PROF_REQUEST, /*!< Number of request packets sent out */ ESP_PING_PROF_REPLY, /*!< Number of reply packets received */ ESP_PING_PROF_IPADDR, /*!< IP address of replied target */ ESP_PING_PROF_SIZE, /*!< Size of received packet */ ESP_PING_PROF_TIMEGAP, /*!< Elapsed time between request and reply packet */ ESP_PING_PROF_DURATION /*!< Elapsed time of the whole ping session */ }{ ... } esp_ping_profile_t; /** * @brief Create a ping session * * @param config ping configuration * @param cbs a bunch of callback functions invoked by internal ping task * @param hdl_out handle of ping session * @return * - ESP_ERR_INVALID_ARG: invalid parameters (e.g. configuration is null, etc) * - ESP_ERR_NO_MEM: out of memory * - ESP_FAIL: other internal error (e.g. socket error) * - ESP_OK: create ping session successfully, user can take the ping handle to do follow-on jobs *//* ... */ 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); /** * @brief Delete a ping session * * @param hdl handle of ping session * @return * - ESP_ERR_INVALID_ARG: invalid parameters (e.g. ping handle is null, etc) * - ESP_OK: delete ping session successfully *//* ... */ esp_err_t esp_ping_delete_session(esp_ping_handle_t hdl); /** * @brief Start the ping session * * @param hdl handle of ping session * @return * - ESP_ERR_INVALID_ARG: invalid parameters (e.g. ping handle is null, etc) * - ESP_OK: start ping session successfully *//* ... */ esp_err_t esp_ping_start(esp_ping_handle_t hdl); /** * @brief Stop the ping session * * @param hdl handle of ping session * @return * - ESP_ERR_INVALID_ARG: invalid parameters (e.g. ping handle is null, etc) * - ESP_OK: stop ping session successfully *//* ... */ esp_err_t esp_ping_stop(esp_ping_handle_t hdl); /** * @brief Get runtime profile of ping session * * @param hdl handle of ping session * @param profile type of profile * @param data profile data * @param size profile data size * @return * - ESP_ERR_INVALID_ARG: invalid parameters (e.g. ping handle is null, etc) * - ESP_ERR_INVALID_SIZE: the actual profile data size doesn't match the "size" parameter * - ESP_OK: get profile successfully *//* ... */ 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
Details
Show:
from
Types: Columns: