[Bro] defining a table of sets

Stephen Smith ssmit7 at gmail.com
Mon Nov 10 05:35:58 PST 2008


Hello again,

Sorry for the previous email fragment, apparently there is a hot-key in
GMail that automagically sends the message. What I meant to say was....

I'm trying to use a table of sets in my policy, and can't figure out how to
statically define values. The manual covers use of the add() function, but I
would need to define them just as a redef in my startup policy. The
objective here is a hash table of strings with chaining. I define the table
as

global table_of_sets: table[string] of set[string]

after the similar definition in scan.bro of

global distinct_peers: table[addr] of set[addr]

Then I try to redef the table and add values:

redef SMITH::table_of_sets = {
       [ "a" ] = { "alpha", "anchor", "armor" },
       [ "b" ] = { "bravo", "biscuit", "blue" },
};

This gives me

smith.bro, line 149: error: syntax error, at or near "{"

Just to see what would happen I changed the curly brackets to square
brackets, and that changes to error to

smith.bro, line 150 (alpha, anchor, armor): bad tag in Val::CONVERTER
(types/table)

I can't seem to find this being done anywhere else the existing policies, it
is always done through the add() function, but I can't imagine that it is
not possible. Is there an explanation in the reference manual and I am just
missing it?

Thanks,
Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/bro/attachments/20081110/3c70434d/attachment.html 


More information about the Bro mailing list