Advice on REST plugin structure


I am a Bro newbie and, having run into an endless loop, I’m looking for advice.


I’m working on a NetControl plugin that will use a REST API to talk to the network device. I am trying to do this using ActiveHTTP (my web search having failed to find a REST plugin template). I am working from the Debug plugin and other examples I’ve found in the Bro 2.5.2 distribution.

My endless loop:

Using “when (local rest_resp = ActiveHTTP::request(rest_req))” in the plugin’s init function leads to an endless loop (perhaps similar to type resolver loop mentioned in plugin.bro). I think the ‘when’ statement is involved since “WhenStmt::Exec” is in the early part of the (overflowing) stack. The loop starts with BroType::Serialize for NetControl::PluginState and returns there via BroType::Serialize for NetControl::Plugin after several steps.

My plea:

Can anyone offer advice about how I should structure my REST plugin to avoid this loop? Are there examples (templates) for the recommended structure?

Ben Mack-Crane