[Bro] how to get the oldest entry out of table

Robin Sommer sommer at in.tum.de
Mon Feb 7 07:57:12 PST 2005


On Mon, Feb 07, 2005 at 16:28 +0100, Christoph Goeldi wrote:

> is it possible to get the oldest entry out of a table?

For tables, I do not see a way other than iterating over all
entries. But perhaps you can use a combination of tables and
vectors; something like

         type entry: record {
              t: time;
              c: count;     
         };

         global test: table[addr] of vector of entry;

Then you can keep the vector entries sorted by time.

> does a for-loop go through the table in a predictable way?

No, for tables the order is derived from the internal hashing, i.e.
basically random.

Robin

-- 
Robin Sommer * Room        01.08.055 * www.net.in.tum.de
TU Muenchen  * Phone (089) 289-18006 *  sommer at in.tum.de 



More information about the Bro mailing list