MeterLogger
ping.h
Go to the documentation of this file.
1 #ifndef __PING_H__
2 #define __PING_H__
3 #include "lwip/ip_addr.h"
4 #include "lwip/icmp.h"
5 /**
6  * PING_USE_SOCKETS: Set to 1 to use sockets, otherwise the raw api is used
7  */
8 #ifndef PING_USE_SOCKETS
9 #define PING_USE_SOCKETS LWIP_SOCKET
10 #endif
11 
12 /**
13  * PING_DEBUG: Enable debugging for PING.
14  */
15 #ifndef PING_DEBUG
16 #define PING_DEBUG LWIP_DBG_OFF
17 #endif
18 
19 /** ping receive timeout - in milliseconds */
20 #ifndef PING_RCV_TIMEO
21 #define PING_RCV_TIMEO 1000
22 #endif
23 
24 /** ping delay - in milliseconds */
25 #ifndef PING_COARSE
26 #define PING_COARSE 1000
27 #endif
28 
29 /** ping identifier - must fit on a u16_t */
30 #ifndef PING_ID
31 #define PING_ID 0xAFAF
32 #endif
33 
34 /** ping additional data size to include in the packet */
35 #ifndef PING_DATA_SIZE
36 #define PING_DATA_SIZE 32
37 #endif
38 
39 /** ping result action - no default action */
40 #ifndef PING_RESULT
41 #define PING_RESULT(ping_ok)
42 #endif
43 
44 #define DEFAULT_PING_MAX_COUNT 4
45 #define PING_TIMEOUT_MS 1000
46 
47 typedef void (* ping_recv_function)(void* arg, void *pdata);
48 typedef void (* ping_sent_function)(void* arg, void *pdata);
49 
50 struct ping_option{
56  void* reverse;
57 };
58 
59 struct ping_msg{
61  struct raw_pcb *ping_pcb;
68 };
69 
70 struct ping_resp{
79 };
80 
81 bool ping_start(struct ping_option *ping_opt);
82 bool ping_regist_recv(struct ping_option *ping_opt, ping_recv_function ping_recv);
83 bool ping_regist_sent(struct ping_option *ping_opt, ping_sent_function ping_sent);
84 
85 #endif /* __PING_H__ */
uint32 total_time
Definition: ping.h:77
bool ping_regist_recv(struct ping_option *ping_opt, ping_recv_function ping_recv)
void(* ping_sent_function)(void *arg, void *pdata)
Definition: ping.h:48
ping_recv_function recv_function
Definition: ping.h:54
struct ping_option * ping_opt
Definition: ping.h:60
uint32 max_count
Definition: ping.h:65
uint32 coarse_time
Definition: ping.h:67
ping_sent_function sent_function
Definition: ping.h:55
Definition: ping.h:59
uint32 resp_time
Definition: ping.h:72
uint32 ip
Definition: ping.h:52
sint8 ping_err
Definition: ping.h:78
struct raw_pcb * ping_pcb
Definition: ping.h:61
uint32 timeout_count
Definition: ping.h:74
uint32 count
Definition: ping.h:51
uint32 sent_count
Definition: ping.h:66
uint32 bytes
Definition: ping.h:75
uint32 coarse_time
Definition: ping.h:53
uint32 total_count
Definition: ping.h:71
unsigned int uint32
Definition: c_types.h:54
uint32 ping_sent
Definition: ping.h:63
void * reverse
Definition: ping.h:56
uint32 ping_start
Definition: ping.h:62
Definition: ping.h:70
void(* ping_recv_function)(void *arg, void *pdata)
Definition: ping.h:47
uint32 timeout_count
Definition: ping.h:64
uint32 seqno
Definition: ping.h:73
signed char sint8
Definition: c_types.h:47
bool ping_start(struct ping_option *ping_opt)
uint32 total_bytes
Definition: ping.h:76
bool ping_regist_sent(struct ping_option *ping_opt, ping_sent_function ping_sent)