"Meta" event handling?

From within an event handler, is there a generic way to find out the name of the event, and the names and types of the parameters that were passed to the event?

    The reason I'm asking is that I'd like a generic way to encapsulate events and send them to a broccoli listener, which is only requesting the "wrapper" events. The client would then unwrap it, and then figure out what to do with it based on it's local configuration (the particular thing I'd like to write is a broccoli listener that pushes events into a database).

    Ideally, there would be some function such as "whatamI()" that returned some representation of the calling handler's name, and name value pairs that corresponded to the parameters names and values. This could then be the parameter for the wrapper event, which is sent out to the listener.

    Has anyone tried to do this? A lot of the serialization stuff seems to exist already, so maybe the only new code would be something to peek under the hood of the call stack?

    Steve

You're asking about the Bro side, right? No, there isn't, and if I
understood correctly what you want to do I think it would be rather
tricky to implement it as Bro generally doesn't have much support
for such generic analysis at all. It relies almost completely on
static type checking which makes such things difficult.

However, I'm not completely sure I got the idea of what you are
trying to achieve. Would it be possible to do this all within
another Broccoli client? Broccoli's interface provides you with most
of the information you look for (event name, argument types (though
not argumemtnames)). Could you write a Broccoli app that does the
wrapping?

Or asked differently, why can't you just send "normal" Bro events to
your Broccoli listener? It could subscribe to everything[1] and then
have generic event-handling code which does the neccessary steps.

Robin

[1] Subscribing to everything is actually not possible at the moment
but I have patch which adds that for Broccoli-to-Broccoli
connections and we could also implement it on the Bro side.

Robin Sommer wrote:

However, I'm not completely sure I got the idea of what you are
trying to achieve. Would it be possible to do this all within
another Broccoli client? Broccoli's interface provides you with most
of the information you look for (event name, argument types (though
not argumemtnames)). Could you write a Broccoli app that does the
wrapping?

Or asked differently, why can't you just send "normal" Bro events to
your Broccoli listener? It could subscribe to everything[1] and then
have generic event-handling code which does the neccessary steps.
  

    This is actually what I originally hoped to do, but there seemed to be a stumbling block with Bro not forwarding events, so I was curious about the option of playing with things on the Bro side.

    Is there any sample code that shows how you would setup a generic handler that has access to the event name and argument count/types?

    Steve

Yes, have a look at bro_pong_compact() in broccoli/test/broping.c

Robin