Add support DNS-PING

This commit is contained in:
Nick Peng
2018-12-27 00:03:55 +08:00
parent 48112eb784
commit 4c81b46f76
4 changed files with 326 additions and 42 deletions

View File

@@ -8,12 +8,10 @@ extern "C" {
#endif
typedef enum {
FAST_PING_ICMP = 1,
FAST_PING_ICMP6 = 2,
FAST_PING_TCP,
FAST_PING_UDP,
FAST_PING_END
} FAST_PING_TYPE;
PING_TYPE_ICMP = 1,
PING_TYPE_TCP = 2,
PING_TYPE_DNS = 3,
} PING_TYPE;
typedef enum {
PING_RESULT_RESPONSE = 1,
@@ -25,7 +23,7 @@ struct ping_host_struct;
typedef void (*fast_ping_result)(struct ping_host_struct *ping_host, const char *host, FAST_PING_RESULT result, struct sockaddr *addr, socklen_t addr_len, int seqno, int ttl, struct timeval *tv, void *userptr);
/* start ping */
struct ping_host_struct *fast_ping_start(const char *host, int count, int interval, int timeout, fast_ping_result ping_callback, void *userptr);
struct ping_host_struct *fast_ping_start(PING_TYPE type, const char *host, int count, int interval, int timeout, fast_ping_result ping_callback, void *userptr);
/* stop ping */
int fast_ping_stop(struct ping_host_struct *ping_host);