I am working on improving the btests for the kafka writer plugin with the
goal of validating some logic in KafkaWriter::DoInit. The best approach
that I have so far is to write a BiF and use it in both DoInit and the
btest via Zeek policy, but I have only been able to find limited
documentation[1][2] on the topic.

I've looked around for examples of this approach without success, including
in the past few years of the Zeek-dev mailing list archives. I explicitly
want to stay away from the assumption that the Manager/Logger has a kafka
broker available to it at the time of testing.

My BiF is fairly simple:

```
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,

1: https://www.zeek.org/development/howtos/bif-doc/index.html#functions
2: https://www.zeek.org/development/howtos/bif-doc/example.html

Jon
-- 

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

Reply via email to