fast_ping.h 704 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef FAST_PING_H
  2. #define FAST_PING_H
  3. #include <sys/time.h>
  4. #ifdef __cpluscplus
  5. extern "C" {
  6. #endif
  7. typedef enum {
  8. FAST_PING_ICMP = 1,
  9. FAST_PING_TCP,
  10. FAST_PING_UDP
  11. } FAST_PING_TYPE;
  12. typedef enum {
  13. PING_RESULT_RESPONSE = 1,
  14. PING_RESULT_TIMEOUT = 2,
  15. } FAST_PING_RESULT;
  16. typedef void (*fast_ping_result)(const char *host, FAST_PING_RESULT result, int seqno, struct timeval *tv, void *userptr);
  17. void fast_ping_result_callback(fast_ping_result result);
  18. int fast_ping_start(const char *host, int timeout, void *userptr);
  19. int fast_ping_stop(const char *host);
  20. int fast_ping_init();
  21. void fast_ping_exit();
  22. #ifdef __cpluscplus
  23. }
  24. #endif
  25. #endif // !FAST_PING_H