prelude-correlator/master: Implement context getUpdateCount() method

[email protected] Fri, 18 Dec 2009 16:58:31 +0100 (CET)
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
commit a3ef40e92baa240b1d11b2d54aa8588d321cd356
Author: Yoann Vandoorselaere <[email protected]>
Date:   Wed Nov 4 15:30:04 2009 +0100

    Implement context getUpdateCount() method
    
    This allow for a plugin to know how much time a context has been updated.


========================================

 PreludeCorrelator/context.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

========================================

diff --git a/PreludeCorrelator/context.py b/PreludeCorrelator/context.py
index ebb63c9..3f88348 100644
--- a/PreludeCorrelator/context.py
+++ b/PreludeCorrelator/context.py
@@ -80,10 +80,13 @@ class Context(idmef.IDMEF, Timer):
 
         def __init__(self, name, options={}, update=False):
                 if update and _CONTEXT_TABLE.has_key(name):
+                        self._update_count += 1
+
                         if Timer.running(self):
                                 Timer.reset(self)
                         return
 
+                self._update_count = 0
                 self._threshold = options.get("threshold", -1)
                 self._alert_on_expire = options.get("alert_on_expire", False)
 
@@ -119,6 +122,9 @@ class Context(idmef.IDMEF, Timer):
 
                 self.destroy()
 
+        def getUpdateCount(self):
+                return self._update_count
+
         def destroy(self):
                 if isinstance(self, Timer):
                         self.stop()
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog