]> git.stg.codes - stg.git/blobdiff - stglibs/pinger.lib/include/stg/pinger.h
Moved base and utility classes from global scope.
[stg.git] / stglibs / pinger.lib / include / stg / pinger.h
index b1b777813fc617f0710ae51799a76b3c80a2f804..91608dbbc2b38c8341943635f6e8dc8878967bcf 100644 (file)
@@ -18,7 +18,7 @@
 #include <netinet/ip_icmp.h>
 #endif
 
-#if defined (FREE_BSD) || defined (FREE_BSD5)
+#if defined (FREE_BSD) || defined (FREE_BSD5) || defined(DARWIN)
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
@@ -84,6 +84,9 @@ struct PING_MESSAGE
 class STG_PINGER
 {
 public:
+    typedef std::multimap<uint32_t, time_t> PingIPs;
+    typedef PingIPs::size_type SizeType;
+
             STG_PINGER(time_t delay = 15);
             ~STG_PINGER();
 
@@ -91,7 +94,7 @@ public:
     int     Stop();
     void    AddIP(uint32_t ip);
     void    DelIP(uint32_t ip);
-    int     GetPingIPNum() const;
+    SizeType GetPingIPNum() const { return pingIP.size(); }
     void    PrintAllIP();
     int     GetIPTime(uint32_t ip, time_t * t) const;
     void    SetDelayTime(time_t d) { delay = d; }
@@ -108,7 +111,7 @@ private:
     static void * RunSendPing(void * d);
     static void * RunRecvPing(void * d);
 
-    int         delay;
+    time_t      delay;
     bool        nonstop;
     bool        isRunningRecver;
     bool        isRunningSender;