]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: RustParser same fields as AppLayerParser
authorPhilippe Antoine <contact@catenacyber.fr>
Mon, 2 May 2022 20:50:04 +0000 (22:50 +0200)
committerJeff Lucovsky <jeff@lucovsky.org>
Fri, 27 May 2022 15:26:17 +0000 (11:26 -0400)
So that there is no problem when crossing FFI

(cherry picked from commit c78722a671e819261dea9ce148966718cfca7c64)

rust/src/applayer.rs
rust/src/core.rs
src/app-layer-register.h

index f7db5792532564a540718f0c29468ad1ca03b41e..795db989a48dd906fe95bf6fa8853b23a5465eb8 100644 (file)
@@ -179,7 +179,7 @@ pub struct RustParser {
     pub default_port:       *const c_char,
 
     /// IP Protocol (core::IPPROTO_UDP, core::IPPROTO_TCP, etc.)
-    pub ipproto:            c_int,
+    pub ipproto:            u8,
 
     /// Probing function, for packets going to server
     pub probe_ts:           Option<ProbeFn>,
index 61073ed6576f188d1bc216e7ff259e4c9944d22b..3a5440039e7f768e0c5e57bdac3cb51518cb6c63 100644 (file)
@@ -45,8 +45,8 @@ pub type AppProto = std::os::raw::c_int;
 pub const ALPROTO_UNKNOWN : AppProto = 0;
 pub static mut ALPROTO_FAILED : AppProto = 0; // updated during init
 
-pub const IPPROTO_TCP : i32 = 6;
-pub const IPPROTO_UDP : i32 = 17;
+pub const IPPROTO_TCP : u8 = 6;
+pub const IPPROTO_UDP : u8 = 17;
 
 macro_rules!BIT_U8 {
     ($x:expr) => (1 << $x);
index 47da98dadef082d07e030084fd02352d597c7c6c..8da026b9077dc22f9bebf7974627fe1a0b338cd0 100644 (file)
@@ -27,7 +27,7 @@
 typedef struct AppLayerParser {
     const char *name;
     const char *default_port;
-    int ip_proto;
+    uint8_t ip_proto;
 
     ProbingParserFPtr ProbeTS;
     ProbingParserFPtr ProbeTC;