3 $Date: 2008/05/10 11:59:53 $
17 #include <sys/types.h>
18 #include <sys/socket.h>
19 #include <netinet/ip_icmp.h>
22 #if defined (FREE_BSD) || defined (FREE_BSD5)
23 #include <netinet/in.h>
24 #include <netinet/in_systm.h>
25 #include <netinet/ip.h>
26 #include <netinet/ip_icmp.h>
27 #include <netinet/ip_var.h>
28 #include <arpa/inet.h>
35 //-----------------------------------------------------------------------------
56 //-----------------------------------------------------------------------------
71 //-----------------------------------------------------------------------------
77 //-----------------------------------------------------------------------------
79 #define PING_DATA_LEN (64)
80 //-----------------------------------------------------------------------------
84 char msg[PING_DATA_LEN];
86 //-----------------------------------------------------------------------------
90 STG_PINGER(time_t delay = 15);
95 void AddIP(uint32_t ip);
96 void DelIP(uint32_t ip);
97 int GetPingIPNum() const;
98 //void GetAllIP(vector<PING_IP_TIME> * ipTime) const;
100 int GetIPTime(uint32_t ip, time_t * t) const;
101 void SetDelayTime(time_t delay);
102 time_t GetDelayTime() const;
103 string GetStrError() const;
106 uint16_t PingCheckSum(void * data, int len);
107 int SendPing(uint32_t ip);
112 static void * RunSendPing(void * d);
113 static void * RunRecvPing(void * d);
117 bool isRunningRecver;
118 bool isRunningSender;
121 pthread_t sendThread;
122 pthread_t recvThread;
129 multimap<uint32_t, time_t> pingIP;
130 list<uint32_t> ipToAdd;
131 list<uint32_t> ipToDel;
133 mutable pthread_mutex_t mutex;
135 //-----------------------------------------------------------------------------