[Bro] expire entries

Robin Sommer robin at icir.org
Tue Sep 20 08:36:08 PDT 2016

On Mon, Sep 19, 2016 at 17:53 -0700, Dk Jack wrote:

> I see that there are a couple of classes that could be useful...i.e.
> the Timer and TimerMgr classes. However, I am not sure how they work.

Generally you need to derive your own timer class from Timer and
override the Dispatch() method. Then create an instance of your new
class and call timer_mgr->Add(instance). There are a few examples
across the code base, look for instance at the FileTimer in
src/file_analysis/FileTimer.h and how it is used in
File::ScheduleInactivityTimer() in src/file_analysis/File.cc

One note: You don't mention what type of plugin you are writing. If
you're adding a component that runs inside its own thread (log writer,
input reader), you cannot use the built-in timer machinery, as it's
not thread-safe.


Robin Sommer * ICSI/LBNL * robin at icir.org * www.icir.org/robin

More information about the Bro mailing list