]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: bindgen AppLayerParserSetStreamDepth
authorPhilippe Antoine <pantoine@oisf.net>
Tue, 10 Jun 2025 07:49:10 +0000 (09:49 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 10 Jun 2025 20:13:53 +0000 (22:13 +0200)
Ticket: 7667

rust/src/applayer.rs
rust/src/pgsql/pgsql.rs
rust/src/pop3/pop3.rs
rust/src/smb/smb.rs
rust/sys/src/sys.rs
src/app-layer-parser.c
src/app-layer-parser.h

index c68a3b88cc036935607d828777a3f70a421e4fd0..2e473f6c816abeeefd787d92c4f23d0c22e03636 100644 (file)
@@ -537,7 +537,6 @@ pub const APP_LAYER_TX_ACCEPT: u8 = BIT_U8!(4);
 
 /// cbindgen:ignore
 extern "C" {
-    pub fn AppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32);
     pub fn AppLayerParserConfParserEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int;
     pub fn AppLayerParserRegisterLogger(pproto: u8, alproto: AppProto);
     pub fn AppLayerParserRegisterParserAcceptableDataDirection(ipproto: u8, alproto: AppProto, dir: u8);
index bc5c701a2d7c7cf054f5e56566ead3285a9b9940..42720ca231b15e62e2cbceb6b96c90930ab159ce 100644 (file)
@@ -31,7 +31,7 @@ use std;
 use std::collections::VecDeque;
 use std::ffi::CString;
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerParserStateIssetFlag,
+    AppLayerParserState, AppProto, SCAppLayerParserSetStreamDepth, SCAppLayerParserStateIssetFlag,
     SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerRequestProtocolTLSUpgrade,
 };
 
@@ -975,7 +975,7 @@ pub unsafe extern "C" fn SCRegisterPgsqlParser() {
                     SCLogError!("Invalid depth value");
                 }
             }
-            AppLayerParserSetStreamDepth(IPPROTO_TCP, ALPROTO_PGSQL, stream_depth)
+            SCAppLayerParserSetStreamDepth(IPPROTO_TCP, ALPROTO_PGSQL, stream_depth)
         }
         if let Some(val) = conf_get("app-layer.protocols.pgsql.max-tx") {
             if let Ok(v) = val.parse::<usize>() {
index 018d0a312776d9914af6b3fdaf025bbc19592c98..33d36203e5abac36736e0f3d9f21fa414bd917a9 100644 (file)
@@ -29,7 +29,7 @@ use std::collections::VecDeque;
 use std::ffi::CString;
 use std::os::raw::{c_char, c_int, c_void};
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerParserStateIssetFlag,
+    AppLayerParserState, AppProto, SCAppLayerParserSetStreamDepth, SCAppLayerParserStateIssetFlag,
     SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerRequestProtocolTLSUpgrade,
 };
 
@@ -525,7 +525,7 @@ pub unsafe extern "C" fn SCRegisterPop3Parser() {
             match get_memval(val) {
                 Ok(retval) => {
                     let stream_depth = retval as u32;
-                    AppLayerParserSetStreamDepth(IPPROTO_TCP, ALPROTO_POP3, stream_depth);
+                    SCAppLayerParserSetStreamDepth(IPPROTO_TCP, ALPROTO_POP3, stream_depth);
                 }
                 Err(_) => {
                     SCLogError!("Invalid depth value");
index 269c0483b5ad27d1cb4542f87110d5e2a2b946b2..3f231ee43674a6f6cd7349a355bd5a542a32ea37 100644 (file)
@@ -35,9 +35,9 @@ use nom7::error::{make_error, ErrorKind};
 
 use lru::LruCache;
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled,
-    SCAppLayerProtoDetectPMRegisterPatternCSwPP, SCAppLayerProtoDetectPPParseConfPorts,
-    SCAppLayerProtoDetectPPRegister,
+    AppLayerParserState, AppProto, SCAppLayerParserSetStreamDepth,
+    SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerProtoDetectPMRegisterPatternCSwPP,
+    SCAppLayerProtoDetectPPParseConfPorts, SCAppLayerProtoDetectPPRegister,
 };
 use std::num::NonZeroUsize;
 
@@ -2405,7 +2405,7 @@ pub unsafe extern "C" fn SCRegisterSmbParser() {
                 Err(_) => { SCLogError!("Invalid depth value"); }
             }
         }
-        AppLayerParserSetStreamDepth(IPPROTO_TCP, ALPROTO_SMB, stream_depth);
+        SCAppLayerParserSetStreamDepth(IPPROTO_TCP, ALPROTO_SMB, stream_depth);
         let retval = conf_get("app-layer.protocols.smb.max-read-size");
         if let Some(val) = retval {
             match get_memval(val) {
index 47c54734be498fee58d6b6f3f6ea4a5e65e614de..3208f2b4792d389eb7efbf32efe11047e62317ca 100644 (file)
@@ -695,6 +695,9 @@ pub struct AppLayerParserState_ {
     _unused: [u8; 0],
 }
 pub type AppLayerParserState = AppLayerParserState_;
+extern "C" {
+    pub fn SCAppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32);
+}
 extern "C" {
     pub fn SCAppLayerParserStateSetFlag(pstate: *mut AppLayerParserState, flag: u16);
 }
index 1af0bc6ce2976f6b7ff76b0a6b7b9b3c74304d77..1b6ebecde550ece9ebbeae171e5a7afd01ef7584 100644 (file)
@@ -1566,7 +1566,7 @@ void AppLayerParserTriggerRawStreamInspection(Flow *f, int direction)
     SCReturn;
 }
 
-void AppLayerParserSetStreamDepth(uint8_t ipproto, AppProto alproto, uint32_t stream_depth)
+void SCAppLayerParserSetStreamDepth(uint8_t ipproto, AppProto alproto, uint32_t stream_depth)
 {
     SCEnter();
 
index b4c33581d5b0f160bda33eab953847e6ceef15b1..04d0d4487b27faa8e70e7bbf2e66f0427300e69d 100644 (file)
@@ -275,7 +275,7 @@ bool AppLayerParserHasDecoderEvents(AppLayerParserState *pstate);
 int AppLayerParserProtocolHasLogger(uint8_t ipproto, AppProto alproto);
 LoggerId AppLayerParserProtocolGetLoggerBits(uint8_t ipproto, AppProto alproto);
 void AppLayerParserTriggerRawStreamInspection(Flow *f, int direction);
-void AppLayerParserSetStreamDepth(uint8_t ipproto, AppProto alproto, uint32_t stream_depth);
+void SCAppLayerParserSetStreamDepth(uint8_t ipproto, AppProto alproto, uint32_t stream_depth);
 uint32_t AppLayerParserGetStreamDepth(const Flow *f);
 void AppLayerParserSetStreamDepthFlag(uint8_t ipproto, AppProto alproto, void *state, uint64_t tx_id, uint8_t flags);
 int AppLayerParserIsEnabled(AppProto alproto);