Task #7341
openrust: use bindgen to generate Rust bindings to C functions
Description
Currently, we write out our own Rust bindings to C functions; however, a tool such as bindgen
could do this for us. This tool would automatically update the bindings when a change was made to C, minimizing possible issues resulting from one side being updated and not the other.
One issue we currently have is C functions called from Rust, containing a type defined in Rust with C bindings generated with cbindgen. This creates a circular dependency I don't think we can tool ourselves out of.
One rule to follow that could prevent this is if a function is defined in C, all types in its signature must also be defined in C, unless they can be expressed as an opaque type. Currently, we export some Rust structs/enums to C that are not opaque, which is probably the main source of these circular dependencies.
Updated by Jason Ish 2 months ago
- Status changed from New to Assigned
- Assignee changed from OISF Dev to Jason Ish
PoC PR: https://github.com/OISF/suricata/pull/12018
However, only PoC, so not moving this to in-progress at this time.