On Tue, Mar 12, 2019 at 9:23 AM [email protected] <[email protected]> wrote:

> function SelectTopicName%(override: string, default: string, fallback: 
> string%) : string
>         %{
>         // Things
>         %}
> ```
>
> bifcl appears to be generating the following:
>
> ```
> namespace BifFunc { namespace Kafka { extern Val* bro_SelectTopicName(Frame* 
> frame, val_list*); }  }
> ```
>
> At this point I'm just randomly poking around in Zeek/src trying to find my 
> way - any pointers regarding how to use this function in C++ (or another 
> approach altogether) would be appreciated.  Thanks,

If I understand what you want, I think you may treat this just like
calling any other script-layer function from the C++ layer.  So for an
example, this would lookup the function you want to call (substitute
the name of the function you want):

https://github.com/zeek/zeek/blob/a36ac12e885a60ee77f9141d4c35882cb53bc1f2/src/broker/Manager.cc#L161

You can also find the definition of "get_option" in the same file in
case that helps to look at.

Then here's an example of calling that function:

https://github.com/zeek/zeek/blob/a36ac12e885a60ee77f9141d4c35882cb53bc1f2/src/broker/Manager.cc#L543-L557

Note that the return value becomes your responsibility -- here it gets
used and then Unref()'d right away to take care of the required memory
management duties.

- Jon
_______________________________________________
zeek-dev mailing list
[email protected]
http://mailman.icsi.berkeley.edu/mailman/listinfo/zeek-dev

Reply via email to