]> git.stg.codes - stg.git/blobdiff - projects/stargazer/traffcounter_impl.h
Changed USER_STAT_RES.
[stg.git] / projects / stargazer / traffcounter_impl.h
index 7d01c2e4b24d9b968186e515703d8e70c518a153..7e552f82c186e2eab2c179c72ecb2d0d972a43ca 100644 (file)
@@ -102,33 +102,47 @@ class TRAFFCOUNTER_IMPL;
 //-----------------------------------------------------------------------------
 class TRF_IP_BEFORE: public PROPERTY_NOTIFIER_BASE<uint32_t> {
 public:
 //-----------------------------------------------------------------------------
 class TRF_IP_BEFORE: public PROPERTY_NOTIFIER_BASE<uint32_t> {
 public:
-                    TRF_IP_BEFORE(TRAFFCOUNTER_IMPL & t, USER_IMPL * u)
-                        : PROPERTY_NOTIFIER_BASE<uint32_t>(),
-                          traffCnt(t),
-                          user(u)
-                    {}
-    void            Notify(const uint32_t & oldValue, const uint32_t & newValue);
-    void            SetUser(USER_IMPL * u) { user = u; }
-    USER_IMPL *     GetUser() const { return user; }
+                TRF_IP_BEFORE(TRAFFCOUNTER_IMPL & t, USER_IMPL * u)
+                    : PROPERTY_NOTIFIER_BASE<uint32_t>(),
+                      traffCnt(t),
+                      user(u)
+                {}
+                TRF_IP_BEFORE(const TRF_IP_BEFORE & rvalue)
+                    : PROPERTY_NOTIFIER_BASE<uint32_t>(),
+                      traffCnt(rvalue.traffCnt),
+                      user(rvalue.user)
+                {}
+    void        Notify(const uint32_t & oldValue, const uint32_t & newValue);
+    void        SetUser(USER_IMPL * u) { user = u; }
+    USER_IMPL * GetUser() const { return user; }
 
 private:
 
 private:
+    TRF_IP_BEFORE & operator=(const TRF_IP_BEFORE & rvalue);
+
     TRAFFCOUNTER_IMPL & traffCnt;
     TRAFFCOUNTER_IMPL & traffCnt;
-    USER_IMPL *         user;
+    USER_IMPL * user;
 };
 //-----------------------------------------------------------------------------
 class TRF_IP_AFTER: public PROPERTY_NOTIFIER_BASE<uint32_t> {
 public:
 };
 //-----------------------------------------------------------------------------
 class TRF_IP_AFTER: public PROPERTY_NOTIFIER_BASE<uint32_t> {
 public:
-                    TRF_IP_AFTER(TRAFFCOUNTER_IMPL & t, USER_IMPL * u)
-                        : PROPERTY_NOTIFIER_BASE<uint32_t>(),
-                          traffCnt(t),
-                          user(u)
-                    {}
-    void            Notify(const uint32_t & oldValue, const uint32_t & newValue);
-    void            SetUser(USER_IMPL * u) { user = u; }
-    USER_IMPL *     GetUser() const { return user; }
+                TRF_IP_AFTER(TRAFFCOUNTER_IMPL & t, USER_IMPL * u)
+                    : PROPERTY_NOTIFIER_BASE<uint32_t>(),
+                      traffCnt(t),
+                      user(u)
+                {}
+                TRF_IP_AFTER(const TRF_IP_AFTER & rvalue)
+                    : PROPERTY_NOTIFIER_BASE<uint32_t>(),
+                      traffCnt(rvalue.traffCnt),
+                      user(rvalue.user)
+                {}
+    void        Notify(const uint32_t & oldValue, const uint32_t & newValue);
+    void        SetUser(USER_IMPL * u) { user = u; }
+    USER_IMPL * GetUser() const { return user; }
 private:
 private:
+    TRF_IP_AFTER & operator=(const TRF_IP_AFTER & rvalue);
+
     TRAFFCOUNTER_IMPL & traffCnt;
     TRAFFCOUNTER_IMPL & traffCnt;
-    USER_IMPL *         user;
+    USER_IMPL * user;
 };
 //-----------------------------------------------------------------------------
 class ADD_USER_NONIFIER: public NOTIFIER_BASE<USER_IMPL_PTR> {
 };
 //-----------------------------------------------------------------------------
 class ADD_USER_NONIFIER: public NOTIFIER_BASE<USER_IMPL_PTR> {
@@ -139,7 +153,11 @@ public:
             {}
     virtual ~ADD_USER_NONIFIER() {}
     void    Notify(const USER_IMPL_PTR & user);
             {}
     virtual ~ADD_USER_NONIFIER() {}
     void    Notify(const USER_IMPL_PTR & user);
+
 private:
 private:
+    ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rvalue);
+    ADD_USER_NONIFIER & operator=(const ADD_USER_NONIFIER & rvalue);
+
     TRAFFCOUNTER_IMPL & traffCnt;
 };
 //-----------------------------------------------------------------------------
     TRAFFCOUNTER_IMPL & traffCnt;
 };
 //-----------------------------------------------------------------------------
@@ -151,7 +169,11 @@ public:
             {}
     virtual ~DEL_USER_NONIFIER() {}
     void    Notify(const USER_IMPL_PTR & user);
             {}
     virtual ~DEL_USER_NONIFIER() {}
     void    Notify(const USER_IMPL_PTR & user);
+
 private:
 private:
+    DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rvalue);
+    DEL_USER_NONIFIER & operator=(const DEL_USER_NONIFIER & rvalue);
+
     TRAFFCOUNTER_IMPL & traffCnt;
 };
 //-----------------------------------------------------------------------------
     TRAFFCOUNTER_IMPL & traffCnt;
 };
 //-----------------------------------------------------------------------------
@@ -173,7 +195,12 @@ public:
     void        Process(const RAW_PACKET & rawPacket);
     void        SetMonitorDir(const std::string & monitorDir);
 
     void        Process(const RAW_PACKET & rawPacket);
     void        SetMonitorDir(const std::string & monitorDir);
 
+    size_t      RulesCount() const { return rules.size(); }
+
 private:
 private:
+    TRAFFCOUNTER_IMPL(const TRAFFCOUNTER_IMPL & rvalue);
+    TRAFFCOUNTER_IMPL & operator=(const TRAFFCOUNTER_IMPL & rvalue);
+
     bool        ParseAddress(const char * ta, RULE * rule) const;
     uint32_t    CalcMask(uint32_t msk) const;
     void        FreeRules();
     bool        ParseAddress(const char * ta, RULE * rule) const;
     uint32_t    CalcMask(uint32_t msk) const;
     void        FreeRules();
@@ -194,15 +221,18 @@ private:
     void        UnSetUserNotifiers(USER_IMPL * user);
 
     typedef std::list<RULE>::iterator rule_iter;
     void        UnSetUserNotifiers(USER_IMPL * user);
 
     typedef std::list<RULE>::iterator rule_iter;
-    typedef std::map<RAW_PACKET, PACKET_EXTRA_DATA>::iterator pp_iter;
-    typedef std::multimap<uint32_t, pp_iter>::iterator ip2p_iter;
-    typedef std::multimap<uint32_t, pp_iter>::const_iterator ip2p_citer;
 
     std::list<RULE>          rules;
 
 
     std::list<RULE>          rules;
 
-    std::map<RAW_PACKET, PACKET_EXTRA_DATA> packets; // Packets tree
+    typedef std::map<RAW_PACKET, PACKET_EXTRA_DATA> Packets;
+    typedef Packets::iterator pp_iter;
+    typedef std::multimap<uint32_t, pp_iter> Index;
+    typedef Index::iterator ip2p_iter;
+    typedef Index::const_iterator ip2p_citer;
+
+    Packets packets; // Packets tree
 
 
-    std::multimap<uint32_t, pp_iter> ip2packets; // IP-to-Packet index
+    Index ip2packets; // IP-to-Packet index
 
     std::string              dirName[DIR_NUM + 1];
 
 
     std::string              dirName[DIR_NUM + 1];
 
@@ -211,6 +241,7 @@ private:
 
     std::string              monitorDir;
     bool                     monitoring;
 
     std::string              monitorDir;
     bool                     monitoring;
+    time_t                   touchTimeP;
 
     USERS_IMPL *             users;
 
 
     USERS_IMPL *             users;