X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/641204dfbdb9fc870cdd2e7f9e3169a44693e7bf..1566b2a693bb6462c5607f0f3833fdbd874f40fa:/stglibs/pinger.lib/pinger.h diff --git a/stglibs/pinger.lib/pinger.h b/stglibs/pinger.lib/pinger.h index 4349eb07..1398332d 100644 --- a/stglibs/pinger.lib/pinger.h +++ b/stglibs/pinger.lib/pinger.h @@ -7,7 +7,7 @@ #ifndef PINGER_H #define PINGER_H -#include +#include #include #include #include @@ -94,15 +94,23 @@ public: int Stop(); void AddIP(uint32_t ip); void DelIP(uint32_t ip); - int GetPingIPNum(); - void GetAllIP(vector * ipTime); + int GetPingIPNum() const; + //void GetAllIP(vector * ipTime) const; void PrintAllIP(); - int GetIPTime(uint32_t ip, time_t * t); + int GetIPTime(uint32_t ip, time_t * t) const; void SetDelayTime(time_t delay); - time_t GetDelayTime(); - string GetStrError(); + time_t GetDelayTime() const; + string GetStrError() const; private: + uint16_t PingCheckSum(void * data, int len); + int SendPing(uint32_t ip); + uint32_t RecvPing(); + void RealAddIP(); + void RealDelIP(); + + static void * RunSendPing(void * d); + static void * RunRecvPing(void * d); int delay; bool nonstop; @@ -116,24 +124,13 @@ private: PING_MESSAGE pmSend; uint32_t pid; - uint16_t PingCheckSum(void * data, int len); - int SendPing(uint32_t ip); - uint32_t RecvPing(); - void RealAddIP(); - void RealDelIP(); - - static void * RunSendPing(void * d); - static void * RunRecvPing(void * d); - string errorStr; multimap pingIP; list ipToAdd; list ipToDel; - pthread_mutex_t mutex; + mutable pthread_mutex_t mutex; }; //----------------------------------------------------------------------------- #endif - -