]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: bindgen AppLayerParserRegisterParserAcceptableDataDirection
authorPhilippe Antoine <pantoine@oisf.net>
Tue, 10 Jun 2025 07:53:45 +0000 (09:53 +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/enip/enip.rs
rust/sys/src/sys.rs
src/app-layer-ftp.c
src/app-layer-htp.c
src/app-layer-parser.c
src/app-layer-parser.h
src/app-layer-ssl.c

index 2e473f6c816abeeefd787d92c4f23d0c22e03636..6e94c7e44de7396c1e5cd1c79f28c4678c329e9e 100644 (file)
@@ -539,7 +539,6 @@ pub const APP_LAYER_TX_ACCEPT: u8 = BIT_U8!(4);
 extern "C" {
     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);
 }
 
 #[repr(C)]
index 3ff7c4f632b10e197314afdea7e1b0933a997fac..43425882c47d84ff6baec1e8a15651077a89b720 100644 (file)
@@ -30,8 +30,8 @@ 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,
-    SCAppLayerProtoDetectConfProtoDetectionEnabled,
+    AppLayerParserState, AppProto, SCAppLayerParserRegisterParserAcceptableDataDirection,
+    SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled,
 };
 
 pub(super) static mut ALPROTO_ENIP: AppProto = ALPROTO_UNKNOWN;
@@ -653,7 +653,7 @@ pub unsafe extern "C" fn SCEnipRegisterParsers() {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
         SCLogDebug!("Rust enip parser registered for UDP.");
-        AppLayerParserRegisterParserAcceptableDataDirection(
+        SCAppLayerParserRegisterParserAcceptableDataDirection(
             IPPROTO_UDP,
             ALPROTO_ENIP,
             STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -678,7 +678,7 @@ pub unsafe extern "C" fn SCEnipRegisterParsers() {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
         SCLogDebug!("Rust enip parser registered for TCP.");
-        AppLayerParserRegisterParserAcceptableDataDirection(
+        SCAppLayerParserRegisterParserAcceptableDataDirection(
             IPPROTO_TCP,
             ALPROTO_ENIP,
             STREAM_TOSERVER | STREAM_TOCLIENT,
index 3208f2b4792d389eb7efbf32efe11047e62317ca..d828f71ef7189d68f8d36f89f8fe87b3b68703e7 100644 (file)
@@ -695,6 +695,11 @@ pub struct AppLayerParserState_ {
     _unused: [u8; 0],
 }
 pub type AppLayerParserState = AppLayerParserState_;
+extern "C" {
+    pub fn SCAppLayerParserRegisterParserAcceptableDataDirection(
+        ipproto: u8, alproto: AppProto, direction: u8,
+    );
+}
 extern "C" {
     pub fn SCAppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32);
 }
index 2458ef78f81ad4596daecfc9fd4b81407546ef92..64ea722409f8384979d7688a5a4fc6421b6c3dfd 100644 (file)
@@ -1287,7 +1287,8 @@ void RegisterFTPParsers(void)
         AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_FTP, STREAM_TOCLIENT,
                                      FTPParseResponse);
         AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_FTP, FTPStateAlloc, FTPStateFree);
-        AppLayerParserRegisterParserAcceptableDataDirection(IPPROTO_TCP, ALPROTO_FTP, STREAM_TOSERVER | STREAM_TOCLIENT);
+        SCAppLayerParserRegisterParserAcceptableDataDirection(
+                IPPROTO_TCP, ALPROTO_FTP, STREAM_TOSERVER | STREAM_TOCLIENT);
 
         AppLayerParserRegisterTxFreeFunc(IPPROTO_TCP, ALPROTO_FTP, FTPStateTransactionFree);
 
@@ -1311,7 +1312,8 @@ void RegisterFTPParsers(void)
         AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_FTPDATA, STREAM_TOCLIENT,
                                      FTPDataParseResponse);
         AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_FTPDATA, FTPDataStateAlloc, FTPDataStateFree);
-        AppLayerParserRegisterParserAcceptableDataDirection(IPPROTO_TCP, ALPROTO_FTPDATA, STREAM_TOSERVER | STREAM_TOCLIENT);
+        SCAppLayerParserRegisterParserAcceptableDataDirection(
+                IPPROTO_TCP, ALPROTO_FTPDATA, STREAM_TOSERVER | STREAM_TOCLIENT);
         AppLayerParserRegisterTxFreeFunc(IPPROTO_TCP, ALPROTO_FTPDATA, FTPDataStateTransactionFree);
 
         AppLayerParserRegisterGetTxFilesFunc(IPPROTO_TCP, ALPROTO_FTPDATA, FTPDataStateGetTxFiles);
index a873764d9561fa366c3714e3473db500166afe4d..f19e1df631e2fd4b631a2a6d33cdecec2eeb27a2 100644 (file)
@@ -2659,7 +2659,7 @@ void RegisterHTPParsers(void)
         /* This parser accepts gaps. */
         AppLayerParserRegisterOptionFlags(
                 IPPROTO_TCP, ALPROTO_HTTP1, APP_LAYER_PARSER_OPT_ACCEPT_GAPS);
-        AppLayerParserRegisterParserAcceptableDataDirection(
+        SCAppLayerParserRegisterParserAcceptableDataDirection(
                 IPPROTO_TCP, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_TOCLIENT);
         /* app-layer-frame-documentation tag start: registering relevant callbacks */
         AppLayerParserRegisterGetFrameFuncs(
index 1b6ebecde550ece9ebbeae171e5a7afd01ef7584..56e018f74792180968b3c2ed51c16545763fa257 100644 (file)
@@ -412,8 +412,8 @@ int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto,
     SCReturnInt(0);
 }
 
-void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto, AppProto alproto,
-                                              uint8_t direction)
+void SCAppLayerParserRegisterParserAcceptableDataDirection(
+        uint8_t ipproto, AppProto alproto, uint8_t direction)
 {
     SCEnter();
 
index 04d0d4487b27faa8e70e7bbf2e66f0427300e69d..f38ffc809a12b3ec2a262f45b8d7d371a28e132f 100644 (file)
@@ -171,9 +171,8 @@ int AppLayerParserPreRegister(void (*Register)(void));
 int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto,
                       uint8_t direction,
                       AppLayerParserFPtr Parser);
-void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto,
-                                              AppProto alproto,
-                                              uint8_t direction);
+void SCAppLayerParserRegisterParserAcceptableDataDirection(
+        uint8_t ipproto, AppProto alproto, uint8_t direction);
 void AppLayerParserRegisterOptionFlags(uint8_t ipproto, AppProto alproto,
         uint32_t flags);
 void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto,
index 9f8e3b56191cda860ca799cdad0a6e5f18f0db68..9ca4b10a2fdfd4e564b88a258573402df180f462 100644 (file)
@@ -3231,7 +3231,8 @@ void RegisterSSLParsers(void)
 
         AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_TLS, SSLStateAlloc, SSLStateFree);
 
-        AppLayerParserRegisterParserAcceptableDataDirection(IPPROTO_TCP, ALPROTO_TLS, STREAM_TOSERVER);
+        SCAppLayerParserRegisterParserAcceptableDataDirection(
+                IPPROTO_TCP, ALPROTO_TLS, STREAM_TOSERVER);
 
         AppLayerParserRegisterTxFreeFunc(IPPROTO_TCP, ALPROTO_TLS, SSLStateTransactionFree);