File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,4 +18,5 @@ Most code copied from rust/src/applayertemplate
1818## rust
1919
2020A pure Rust plugin example intended to grow into an omnibus plugin example.
21- Currently demonstrates plugin initialization and EVE callback registration.
21+ Currently demonstrates plugin initialization, EVE callback registration,
22+ and thread init callback registration.
Original file line number Diff line number Diff line change 33This is a pure Rust Suricata plugin example.
44
55It is intended to grow into an omnibus Rust plugin example over time.
6+ Currently it demonstrates plugin initialization, EVE callback registration,
7+ and thread init callback registration.
Original file line number Diff line number Diff line change 11mod eve;
2+ mod thread;
23
34use suricata_ffi:: { SCLogError , SCLogNotice } ;
45use suricata_sys:: sys:: SCPlugin ;
@@ -10,6 +11,12 @@ unsafe extern "C" fn init() {
1011 if let Err ( err) = eve:: register ( ) {
1112 SCLogError ! ( "Failed to register rust example EVE callback: {}" , err) ;
1213 }
14+ if let Err ( err) = thread:: register ( ) {
15+ SCLogError ! (
16+ "Failed to register rust example thread init callback: {}" ,
17+ err
18+ ) ;
19+ }
1320}
1421
1522#[ no_mangle]
Original file line number Diff line number Diff line change 1+ use suricata_ffi:: { thread, SCLogNotice } ;
2+ use suricata_sys:: sys:: ThreadVars ;
3+
4+ pub ( crate ) fn register ( ) -> Result < ( ) , & ' static str > {
5+ thread:: register_init_callback ( |tv : * mut ThreadVars | {
6+ SCLogNotice ! ( "Thread initialization callback (tv={:p})" , tv) ;
7+ } ) ?;
8+
9+ Ok ( ( ) )
10+ }
You can’t perform that action at this time.
0 commit comments