[Bro-Dev] Policy script enums (and event engine interaction)

Gregor Maier gregor at icir.org
Tue Dec 7 18:31:19 PST 2010


Hi,

another question:
it seems that I can't specify the value that my enums should have, i.e.,
I can't do a
  enum { foo = 2, bar = 3 }

So, it seems that I'll have to use global const to simulate the
behavior. But the nice feature of enums is that if I print them with %s,
I get their name instead of their value. Is there any way to simulate
this (without using a table to map values->names?)

Looking a bit more at the event engine, it seems that there's no case in
which an enum is passed from the event engine to the policy layer as
part of an event. It also seems that there's no way to coerce an integer
into an enum, right (neither policy layer nor event engine).

I'm wondering whether there was a reason for not implementing that
(e.g., would break something, enums should be policy layer only). If
not, I guess my question is whether it would make sense to add it (at
some stage) as I think it would make handling of binary protocols easier.

(There seems to be one case (transport_proto) were there's interaction
in bro.bif, but it requires a lot of glue functions).

cu
gregor
-- 
Gregor Maier                                             gregor at icir.org
Int. Computer Science Institute (ICSI)          gregor at icsi.berkeley.edu
1947 Center St., Ste. 600                    http://www.icir.org/gregor/
Berkeley, CA 94704
USA


More information about the bro-dev mailing list