Greetings,
I’ve been looking at several plugin examples for zeek and I have failed to find a definite answer to the following question: is it possible to write zeek plugins in Rust? The obvious way would be to compile any rust implementation in it’s own lib and then wrap it in C/C++ but I would be interested in something more “native”. Would it be possible?
Thanks for your help,
Regards
Hi Quentin,
I've been looking at several plugin examples for zeek and I have failed to
find a definite answer to the following question: is it possible to write
zeek plugins in Rust? The obvious way would be to compile any rust
implementation in it's own lib and then wrap it in C/C++ but I would be
interested in something more "native".
Disclaimer: I have not used Rust myself.
The only API that we currently provide for writing plug-ins is based on C++. So - Zeek has to be able to call into your code with the C++ API that it expects, and your code has to be able to call back into Zeek.
The way that you outline - with the Rust code in its own library - sounds like the easiest alternative.
If Rust can directly call into C++ - and can generate a library that is callable in exactly the way that C++ expects, you might be able to make this work without the wrapper - but after a short peek into the documetation this does not seem trivially possible.
Johanna
Thank you very much for your instructive answer. That’s pretty much what I figured, either wrap it up or start writing bindings until my fingers bleed, still it’s better to get an expert’s opinion before resigning oneself.
Regards,