-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[draft] bindgen poc - v1 #12018
base: master
Are you sure you want to change the base?
[draft] bindgen poc - v1 #12018
Commits on Oct 23, 2024
-
Revert "rust/applayer: use c_int as return type for get_info_by_id"
This reverts commit 45384ef.
Configuration menu - View commit details
-
Copy full SHA for 0216af5 - Browse repository at this point
Copy the full SHA 0216af5View commit details
Commits on Oct 24, 2024
-
app-layer: extract out a simple function type to simple header
Extract a simple function function to a simple header with no circular dependencies. Next we'll use bindgen to generate Rust bindings for this function. Ticket: OISF#7341
Configuration menu - View commit details
-
Copy full SHA for de28619 - Browse repository at this point
Copy the full SHA de28619View commit details -
rust: integrate bindgen to generate rust bindings to C
Add a build.rs to generate Rust bindings to specific C functions at build time using the bindgen crate. As can be seen in build.rs, we currently only pull in the test header, "app-layer-ext.h" and only output items starting with "SC". Bindgen generates the bindings in a file named "bindings.rs" in the target/ direction, which "sys.rs" will statically "include" at compiling name, making these bindings available under package "crate::sys". "build.rs" had to be placed in the non-standard location of "src/build.rs" (its usually alongside Cargo.toml) to satisfy the out-of-tree build requirements of distcheck. Note that bindgen is also available as a command line tool which could be used instead of integrating this at compile time, however the tool requires a newer version of Rust than our MSRV, and may present additional issues with respect to autoconf and distcheck.
Configuration menu - View commit details
-
Copy full SHA for ad27d3b - Browse repository at this point
Copy the full SHA ad27d3bView commit details -
rust: used bindgen generated bindings for StateGetProgressFn
This function is now named SCAppLayerStateGetProgressFn, note how its definition differs from ours: pub type SCAppLayerStateGetProgressFn = ::std::option::Option< unsafe extern "C" fn( alstate: *mut ::std::os::raw::c_void, direction: u8, ) -> ::std::os::raw::c_int, >; Our previous definition: pub type StateGetProgressFn = unsafe extern "C" fn (*mut c_void, u8) -> c_int; The main differing being wrapped in an option which makes sense as its a function pointer that could be NULL/None, but does require wrapping it in an Option now.
Configuration menu - View commit details
-
Copy full SHA for e010f9b - Browse repository at this point
Copy the full SHA e010f9bView commit details -
Configuration menu - View commit details
-
Copy full SHA for e7f9983 - Browse repository at this point
Copy the full SHA e7f9983View commit details -
app-layer: export to SCAppLayerStateGetEventInfoByFn with bindgen
Rust will now fail, as the discrepancy between i8 and i32 is picked up.
Configuration menu - View commit details
-
Copy full SHA for 8294905 - Browse repository at this point
Copy the full SHA 8294905View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6bf01cd - Browse repository at this point
Copy the full SHA 6bf01cdView commit details