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);
98 void GetAllIP(vector<PING_IP_TIME> * ipTime);
100 int GetIPTime(uint32_t ip, time_t * t);
101 void SetDelayTime(time_t delay);
102 time_t GetDelayTime();
103 string GetStrError();
109 bool isRunningRecver;
110 bool isRunningSender;
113 pthread_t sendThread;
114 pthread_t recvThread;
119 uint16_t PingCheckSum(void * data, int len);
120 int SendPing(uint32_t ip);
125 static void * RunSendPing(void * d);
126 static void * RunRecvPing(void * d);
130 multimap<uint32_t, time_t> pingIP;
131 list<uint32_t> ipToAdd;
132 list<uint32_t> ipToDel;
134 pthread_mutex_t mutex;
136 //-----------------------------------------------------------------------------