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

39 files changed:
examples/plugins/altemplate/src/template.rs
rust/src/applayer.rs
rust/src/applayertemplate/template.rs
rust/src/bittorrent_dht/bittorrent_dht.rs
rust/src/enip/enip.rs
rust/src/http2/http2.rs
rust/src/krb/krb5.rs
rust/src/ldap/ldap.rs
rust/src/modbus/modbus.rs
rust/src/pop3/pop3.rs
rust/src/quic/quic.rs
rust/src/rdp/rdp.rs
rust/src/rfb/rfb.rs
rust/src/sip/sip.rs
rust/src/snmp/snmp.rs
rust/src/ssh/ssh.rs
rust/src/websocket/websocket.rs
rust/sys/src/sys.rs
src/app-layer-ftp.c
src/app-layer-parser.c
src/app-layer-parser.h
src/app-layer-tftp.c
src/log-httplog.c
src/log-tlslog.c
src/log-tlsstore.c
src/output-json-dcerpc.c
src/output-json-dhcp.c
src/output-json-dnp3.c
src/output-json-dns.c
src/output-json-http.c
src/output-json-ike.c
src/output-json-mdns.c
src/output-json-mqtt.c
src/output-json-nfs.c
src/output-json-pgsql.c
src/output-json-smb.c
src/output-json-smtp.c
src/output-json-tls.c
src/output-lua.c

index 48dc4c48f1f2eea14eb6d6d3495cd8332749e04d..da05a5057bf6d31b1ba9e98addd3efa4c2d27272 100644 (file)
@@ -27,10 +27,10 @@ use std::collections::VecDeque;
 use std::ffi::CString;
 use std::os::raw::{c_char, c_int, c_void};
 use suricata::applayer::{
-    state_get_tx_iterator, AppLayerEvent, AppLayerParserConfParserEnabled,
-    AppLayerParserRegisterLogger, AppLayerRegisterParser, AppLayerRegisterProtocolDetection,
-    AppLayerResult, AppLayerStateData, AppLayerTxData, RustParser, State, StreamSlice, Transaction,
-    APP_LAYER_PARSER_EOF_TC, APP_LAYER_PARSER_EOF_TS, APP_LAYER_PARSER_OPT_ACCEPT_GAPS,
+    state_get_tx_iterator, AppLayerEvent, AppLayerParserConfParserEnabled, AppLayerRegisterParser,
+    AppLayerRegisterProtocolDetection, AppLayerResult, AppLayerStateData, AppLayerTxData,
+    RustParser, State, StreamSlice, Transaction, APP_LAYER_PARSER_EOF_TC, APP_LAYER_PARSER_EOF_TS,
+    APP_LAYER_PARSER_OPT_ACCEPT_GAPS,
 };
 use suricata::conf::conf_get;
 use suricata::core::{ALPROTO_UNKNOWN, IPPROTO_TCP};
@@ -38,8 +38,8 @@ use suricata::{
     build_slice, cast_pointer, export_state_data_get, export_tx_data_get, SCLogError, SCLogNotice,
 };
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, Flow, SCAppLayerParserStateIssetFlag,
-    SCAppLayerProtoDetectConfProtoDetectionEnabled,
+    AppLayerParserState, AppProto, Flow, SCAppLayerParserRegisterLogger,
+    SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled,
 };
 
 static mut TEMPLATE_MAX_TX: usize = 256;
@@ -423,7 +423,7 @@ pub(super) unsafe extern "C" fn template_register_parser() {
                 SCLogError!("Invalid value for template.max-tx");
             }
         }
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TEMPLATE);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TEMPLATE);
         SCLogNotice!("Rust template parser registered.");
     } else {
         SCLogNotice!("Protocol detector and parser disabled for TEMPLATE.");
index 6e94c7e44de7396c1e5cd1c79f28c4678c329e9e..1841376306b7dbfbf939f1751eaed2a71121500c 100644 (file)
@@ -538,7 +538,6 @@ pub const APP_LAYER_TX_ACCEPT: u8 = BIT_U8!(4);
 /// cbindgen:ignore
 extern "C" {
     pub fn AppLayerParserConfParserEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int;
-    pub fn AppLayerParserRegisterLogger(pproto: u8, alproto: AppProto);
 }
 
 #[repr(C)]
index 05c0ba60da59a7acacd8d29fa126ee1673609f9c..f30f4bae0d22d332314b29c714a50242aa3fed56 100644 (file)
@@ -26,7 +26,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, SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag,
     SCAppLayerProtoDetectConfProtoDetectionEnabled,
 };
 
@@ -418,7 +418,7 @@ pub unsafe extern "C" fn SCRegisterTemplateParser() {
                 SCLogError!("Invalid value for template.max-tx");
             }
         }
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TEMPLATE);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TEMPLATE);
         SCLogNotice!("Rust template parser registered.");
     } else {
         SCLogNotice!("Protocol detector and parser disabled for TEMPLATE.");
index 8ebf232687b3cd20371811a096e9b3bd7ab12fa8..963fe099d872c47ed66db256aae8118ecd97bf94 100644 (file)
@@ -16,8 +16,8 @@
  */
 
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled,
-    SCAppLayerProtoDetectPMRegisterPatternCS,
+    AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger,
+    SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerProtoDetectPMRegisterPatternCS,
 };
 
 use crate::applayer::{self, *};
@@ -321,7 +321,7 @@ pub unsafe extern "C" fn SCRegisterBittorrentDhtUdpParser() {
         {
             SCLogDebug!("Failed to register protocol detection pattern for direction TOCLIENT");
         }
-        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_BITTORRENT_DHT);
+        SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_BITTORRENT_DHT);
 
         SCLogDebug!("Parser registered for bittorrent-dht.");
     } else {
index 43425882c47d84ff6baec1e8a15651077a89b720..70a3d97044fd588af1b0a7627176a32ce6b135d9 100644 (file)
@@ -30,8 +30,9 @@ use std::collections::VecDeque;
 use std::ffi::CString;
 use std::os::raw::{c_char, c_int, c_void};
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerParserRegisterParserAcceptableDataDirection,
-    SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled,
+    AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger,
+    SCAppLayerParserRegisterParserAcceptableDataDirection, SCAppLayerParserStateIssetFlag,
+    SCAppLayerProtoDetectConfProtoDetectionEnabled,
 };
 
 pub(super) static mut ALPROTO_ENIP: AppProto = ALPROTO_UNKNOWN;
@@ -658,7 +659,7 @@ pub unsafe extern "C" fn SCEnipRegisterParsers() {
             ALPROTO_ENIP,
             STREAM_TOSERVER | STREAM_TOCLIENT,
         );
-        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_ENIP);
+        SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_ENIP);
     } else {
         SCLogDebug!("Protocol detector and parser disabled for ENIP on UDP.");
     }
@@ -683,7 +684,7 @@ pub unsafe extern "C" fn SCEnipRegisterParsers() {
             ALPROTO_ENIP,
             STREAM_TOSERVER | STREAM_TOCLIENT,
         );
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_ENIP);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_ENIP);
     } else {
         SCLogDebug!("Protocol detector and parser disabled for ENIP on TCP.");
     }
index 4502180809bfefb5e89d90ee0bf67fcc287706bd..bb35a8d1dbf7509b39aa9dd074fc59fab36072d5 100644 (file)
@@ -39,7 +39,7 @@ use std::ffi::CString;
 use std::fmt;
 use std::io;
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerForceProtocolChange,
+    AppLayerParserState, AppProto, SCAppLayerForceProtocolChange, SCAppLayerParserRegisterLogger,
     SCAppLayerProtoDetectConfProtoDetectionEnabled,
 };
 
@@ -1598,7 +1598,7 @@ pub unsafe extern "C" fn SCRegisterHttp2Parser() {
                 SCLogError!("Invalid value for http2.max-reassembly-size");
             }
         }
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP2);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP2);
         SCLogDebug!("Rust http2 parser registered.");
     } else {
         SCLogNotice!("Protocol detector and parser disabled for HTTP2.");
@@ -1616,7 +1616,7 @@ pub unsafe extern "C" fn SCRegisterHttp2Parser() {
         } else {
             SCLogWarning!("DOH2 is not meant to be detection-only.");
         }
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_DOH2);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_DOH2);
         SCLogDebug!("Rust doh2 parser registered.");
     } else {
         SCLogNotice!("Protocol detector and parser disabled for DOH2.");
index ffd5978d1084002c4b7299c4032d8ea237cd0f6b..a778c80353ff05f95713e66b6378f0d9ff8a8ea1 100644 (file)
@@ -33,7 +33,8 @@ use nom7::{Err, IResult};
 use std;
 use std::ffi::CString;
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled,
+    AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger,
+    SCAppLayerProtoDetectConfProtoDetectionEnabled,
 };
 
 #[derive(AppLayerEvent)]
@@ -640,7 +641,7 @@ pub unsafe extern "C" fn SCRegisterKrb5Parser() {
         if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
-        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_KRB5);
+        SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_KRB5);
     } else {
         SCLogDebug!("Protocol detector and parser disabled for KRB5/UDP.");
     }
@@ -658,7 +659,7 @@ pub unsafe extern "C" fn SCRegisterKrb5Parser() {
         if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_KRB5);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_KRB5);
     } else {
         SCLogDebug!("Protocol detector and parser disabled for KRB5/TCP.");
     }
index 53df6b49c5426ea868fd0c6693f7cd75eb0fb758..b81afa8bca36f3e1ceddd4afd3895dee72a55208 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, SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag,
     SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerRequestProtocolTLSUpgrade,
 };
 
@@ -718,7 +718,7 @@ pub unsafe extern "C" fn SCRegisterLdapTcpParser() {
                 SCLogError!("Invalid value for ldap.max-tx");
             }
         }
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_LDAP);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_LDAP);
     } else {
         SCLogDebug!("Protocol detection and parser disabled for LDAP/TCP.");
     }
@@ -777,7 +777,7 @@ pub unsafe extern "C" fn SCRegisterLdapUdpParser() {
                 SCLogError!("Invalid value for ldap.max-tx");
             }
         }
-        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_LDAP);
+        SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_LDAP);
     } else {
         SCLogDebug!("Protocol detection and parser disabled for LDAP/UDP.");
     }
index 49e39ce46fb62899aae82bca85728e8d293a8fcf..39bc8638dddbc0188f9c9cbddae2c773709ddc39 100644 (file)
@@ -26,7 +26,7 @@ use sawp::parser::{Direction, Parse};
 use sawp::probe::{Probe, Status};
 use sawp_modbus::{self, AccessType, ErrorFlags, Flags, Message};
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerParserStateIssetFlag,
+    AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag,
     SCAppLayerProtoDetectConfProtoDetectionEnabledDefault,
 };
 
@@ -453,7 +453,7 @@ pub unsafe extern "C" fn SCRegisterModbusParser() {
         if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_MODBUS);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_MODBUS);
     }
 }
 
index 33d36203e5abac36736e0f3d9f21fa414bd917a9..4ce9d83aadf7d0aac6b6c2afd506646f571a9b5f 100644 (file)
@@ -29,8 +29,9 @@ use std::collections::VecDeque;
 use std::ffi::CString;
 use std::os::raw::{c_char, c_int, c_void};
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerParserSetStreamDepth, SCAppLayerParserStateIssetFlag,
-    SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerRequestProtocolTLSUpgrade,
+    AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, SCAppLayerParserSetStreamDepth,
+    SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled,
+    SCAppLayerRequestProtocolTLSUpgrade,
 };
 
 use sawp::error::Error as SawpError;
@@ -539,7 +540,7 @@ pub unsafe extern "C" fn SCRegisterPop3Parser() {
                 SCLogError!("Invalid value for pop3.max-tx");
             }
         }
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_POP3);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_POP3);
         SCLogDebug!("Rust pop3 parser registered.");
     } else {
         SCLogDebug!("Protocol detector and parser disabled for POP3.");
index aa3e40587c0c7008eb54016bff97330661f7d8ca..3a2fdf185f3d20986077c3e20bd6e188a6cf9277 100644 (file)
@@ -34,7 +34,8 @@ use crate::{
 use std::collections::VecDeque;
 use std::ffi::CString;
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled,
+    AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger,
+    SCAppLayerProtoDetectConfProtoDetectionEnabled,
 };
 use tls_parser::TlsExtensionType;
 
@@ -588,7 +589,7 @@ pub unsafe extern "C" fn SCRegisterQuicParser() {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
         SCLogDebug!("Rust quic parser registered.");
-        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_QUIC);
+        SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_QUIC);
     } else {
         SCLogDebug!("Protocol detector and parser disabled for quic.");
     }
index 2048481d4e13548dcb49597daa56a4c4efaaece1..bae570a032dc69bbe8b34b2b642fde397c057ade 100644 (file)
 //! RDP application layer
 
 use crate::applayer::{self, *};
-use crate::core::{ALPROTO_UNKNOWN, IPPROTO_TCP, sc_app_layer_parser_trigger_raw_stream_inspection};
+use crate::core::{
+    sc_app_layer_parser_trigger_raw_stream_inspection, ALPROTO_UNKNOWN, IPPROTO_TCP,
+};
+use crate::direction::Direction;
 use crate::flow::Flow;
 use crate::rdp::parser::*;
-use crate::direction::Direction;
 use nom7::Err;
-use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled,
-};
 use std;
 use std::collections::VecDeque;
+use suricata_sys::sys::{
+    AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger,
+    SCAppLayerProtoDetectConfProtoDetectionEnabled,
+};
 use tls_parser::{parse_tls_plaintext, TlsMessage, TlsMessageHandshake, TlsRecordType};
 
 static mut ALPROTO_RDP: AppProto = ALPROTO_UNKNOWN;
@@ -210,7 +213,10 @@ impl RdpState {
                                     self.new_tx(RdpTransactionItem::X224ConnectionRequest(x224));
                                 self.transactions.push_back(tx);
                                 if !flow.is_null() {
-                                    sc_app_layer_parser_trigger_raw_stream_inspection(flow, Direction::ToServer as i32);
+                                    sc_app_layer_parser_trigger_raw_stream_inspection(
+                                        flow,
+                                        Direction::ToServer as i32,
+                                    );
                                 }
                             }
 
@@ -223,7 +229,10 @@ impl RdpState {
                                             self.new_tx(RdpTransactionItem::McsConnectRequest(mcs));
                                         self.transactions.push_back(tx);
                                         if !flow.is_null() {
-                                            sc_app_layer_parser_trigger_raw_stream_inspection(flow, Direction::ToServer as i32);
+                                            sc_app_layer_parser_trigger_raw_stream_inspection(
+                                                flow,
+                                                Direction::ToServer as i32,
+                                            );
                                         }
                                     }
                                     // unknown message in X.223, skip
@@ -297,7 +306,10 @@ impl RdpState {
                                         self.new_tx(RdpTransactionItem::TlsCertificateChain(chain));
                                     self.transactions.push_back(tx);
                                     if !flow.is_null() {
-                                        sc_app_layer_parser_trigger_raw_stream_inspection(flow, Direction::ToClient as i32);
+                                        sc_app_layer_parser_trigger_raw_stream_inspection(
+                                            flow,
+                                            Direction::ToClient as i32,
+                                        );
                                     }
                                     self.bypass_parsing = true;
                                 }
@@ -333,7 +345,10 @@ impl RdpState {
                                     self.new_tx(RdpTransactionItem::X224ConnectionConfirm(x224));
                                 self.transactions.push_back(tx);
                                 if !flow.is_null() {
-                                    sc_app_layer_parser_trigger_raw_stream_inspection(flow, Direction::ToClient as i32);
+                                    sc_app_layer_parser_trigger_raw_stream_inspection(
+                                        flow,
+                                        Direction::ToClient as i32,
+                                    );
                                 }
                             }
 
@@ -346,7 +361,10 @@ impl RdpState {
                                             .new_tx(RdpTransactionItem::McsConnectResponse(mcs));
                                         self.transactions.push_back(tx);
                                         if !flow.is_null() {
-                                            sc_app_layer_parser_trigger_raw_stream_inspection(flow, Direction::ToClient as i32);
+                                            sc_app_layer_parser_trigger_raw_stream_inspection(
+                                                flow,
+                                                Direction::ToClient as i32,
+                                            );
                                         }
                                         self.bypass_parsing = true;
                                         return AppLayerResult::ok();
@@ -391,7 +409,9 @@ impl RdpState {
     }
 }
 
-extern "C" fn rdp_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
+extern "C" fn rdp_state_new(
+    _orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto,
+) -> *mut std::os::raw::c_void {
     let state = RdpState::new();
     let boxed = Box::new(state);
     return Box::into_raw(boxed) as *mut _;
@@ -444,8 +464,7 @@ fn probe_tls_handshake(input: &[u8]) -> bool {
 
 unsafe extern "C" fn rdp_parse_ts(
     flow: *mut Flow, state: *mut std::os::raw::c_void, _pstate: *mut AppLayerParserState,
-    stream_slice: StreamSlice,
-    _data: *const std::os::raw::c_void
+    stream_slice: StreamSlice, _data: *const std::os::raw::c_void,
 ) -> AppLayerResult {
     let state = cast_pointer!(state, RdpState);
     let buf = stream_slice.as_slice();
@@ -455,8 +474,7 @@ unsafe extern "C" fn rdp_parse_ts(
 
 unsafe extern "C" fn rdp_parse_tc(
     flow: *mut Flow, state: *mut std::os::raw::c_void, _pstate: *mut AppLayerParserState,
-    stream_slice: StreamSlice,
-    _data: *const std::os::raw::c_void
+    stream_slice: StreamSlice, _data: *const std::os::raw::c_void,
 ) -> AppLayerResult {
     let state = cast_pointer!(state, RdpState);
     let buf = stream_slice.as_slice();
@@ -518,7 +536,7 @@ pub unsafe extern "C" fn SCRegisterRdpParser() {
         if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_RDP);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_RDP);
     }
 }
 
@@ -561,10 +579,16 @@ mod tests {
         ];
         let mut state = RdpState::new();
         // will consume 0, request length + 1
-        assert_eq!(AppLayerResult::incomplete(0, 9), state.parse_ts(std::ptr::null(), buf_1));
+        assert_eq!(
+            AppLayerResult::incomplete(0, 9),
+            state.parse_ts(std::ptr::null(), buf_1)
+        );
         assert_eq!(0, state.transactions.len());
         // exactly aligns with transaction
-        assert_eq!(AppLayerResult::ok(), state.parse_ts(std::ptr::null(), buf_2));
+        assert_eq!(
+            AppLayerResult::ok(),
+            state.parse_ts(std::ptr::null(), buf_2)
+        );
         assert_eq!(1, state.transactions.len());
         let item = RdpTransactionItem::X224ConnectionRequest(X224ConnectionRequest {
             cdt: 0,
@@ -594,10 +618,16 @@ mod tests {
         let buf_2: &[u8] = &[0x03, 0x00, 0x00, 0x09, 0x02, 0xf0, 0x80, 0x7f, 0x66];
         let mut state = RdpState::new();
         // will consume 0, request length + 1
-        assert_eq!(AppLayerResult::incomplete(0, 6), state.parse_tc(std::ptr::null(), buf_1));
+        assert_eq!(
+            AppLayerResult::incomplete(0, 6),
+            state.parse_tc(std::ptr::null(), buf_1)
+        );
         assert_eq!(0, state.transactions.len());
         // exactly aligns with transaction
-        assert_eq!(AppLayerResult::ok(), state.parse_tc(std::ptr::null(), buf_2));
+        assert_eq!(
+            AppLayerResult::ok(),
+            state.parse_tc(std::ptr::null(), buf_2)
+        );
         assert_eq!(1, state.transactions.len());
         let item = RdpTransactionItem::McsConnectResponse(McsConnectResponse {});
         assert_eq!(item, state.transactions[0].item);
index ceb58f404f98b50c33e818faceb8ed30b209fdd1..80da7f1c2972a6d28dd145de8ef812a9aab2d944 100644 (file)
@@ -32,8 +32,8 @@ use std;
 use std::ffi::CString;
 use std::os::raw::c_char;
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled,
-    SCAppLayerProtoDetectPMRegisterPatternCI,
+    AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger,
+    SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerProtoDetectPMRegisterPatternCI,
 };
 
 pub(super) static mut ALPROTO_RFB: AppProto = ALPROTO_UNKNOWN;
@@ -926,7 +926,7 @@ pub unsafe extern "C" fn SCRfbRegisterParser() {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
         SCLogDebug!("Rust rfb parser registered.");
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_RFB);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_RFB);
         if SCAppLayerProtoDetectPMRegisterPatternCI(
             IPPROTO_TCP,
             ALPROTO_RFB,
index d77ed07d9a6476b489a6e536ebd3cf76f66da5bb..77c0f46aa2e3adfb1e2d61cc14ac418b557305c4 100755 (executable)
@@ -31,7 +31,7 @@ use std;
 use std::collections::VecDeque;
 use std::ffi::CString;
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerParserStateIssetFlag,
+    AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, SCAppLayerParserStateIssetFlag,
     SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerProtoDetectPMRegisterPatternCS,
 };
 
@@ -601,7 +601,7 @@ pub unsafe extern "C" fn SCRegisterSipParser() {
         if register_pattern_probe(core::IPPROTO_UDP) < 0 {
             return;
         }
-        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_SIP);
+        SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_SIP);
     } else {
         SCLogDebug!("Protocol detection and parsing disabled for UDP SIP.");
     }
@@ -623,7 +623,7 @@ pub unsafe extern "C" fn SCRegisterSipParser() {
         if register_pattern_probe(core::IPPROTO_TCP) < 0 {
             return;
         }
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SIP);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SIP);
     } else {
         SCLogDebug!("Protocol detection and parsing disabled for TCP SIP.");
     }
index 01462042e6a0095965af8c44bfc25c5be4c89c55..5e164d95844aa44f6d160f5af827b060e7e04303 100644 (file)
@@ -34,8 +34,8 @@ use nom7::{Err, IResult};
 use nom7::error::{ErrorKind, make_error};
 use suricata_sys::sys::{
     AppLayerParserState, AppProto, AppProtoNewProtoFromString, EveJsonTxLoggerRegistrationData,
-    SCAppLayerProtoDetectConfProtoDetectionEnabled, SCOutputEvePreRegisterLogger,
-    SCOutputJsonLogDirection, SCSigTablePreRegister,
+    SCAppLayerParserRegisterLogger, SCAppLayerProtoDetectConfProtoDetectionEnabled,
+    SCOutputEvePreRegisterLogger, SCOutputJsonLogDirection, SCSigTablePreRegister,
 };
 
 #[derive(AppLayerEvent)]
@@ -435,7 +435,7 @@ pub unsafe extern "C" fn SCRegisterSnmpParser() {
         if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
             let _ = AppLayerRegisterParser(&parser, ALPROTO_SNMP);
         }
-        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_SNMP);
+        SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_SNMP);
     } else {
         SCLogDebug!("Protocol detector and parser disabled for SNMP.");
     }
index 7d0063a7ef0fb8aef9d25d0c1a6c111b51a2d4be..9c25fe5a19a93f83adebbf6f7931cb85d28a0236 100644 (file)
@@ -25,7 +25,7 @@ use nom7::Err;
 use std::ffi::CString;
 use std::sync::atomic::{AtomicBool, Ordering};
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerParserStateSetFlag,
+    AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger, SCAppLayerParserStateSetFlag,
     SCAppLayerProtoDetectConfProtoDetectionEnabled,
 };
 
@@ -581,7 +581,7 @@ pub unsafe extern "C" fn SCRegisterSshParser() {
         if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
             let _ = AppLayerRegisterParser(&parser, alproto);
         }
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SSH);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SSH);
         SCLogDebug!("Rust ssh parser registered.");
     } else {
         SCLogNotice!("Protocol detector and parser disabled for SSH.");
index f2ed6fd87f549ac261eabcec7923cd5bc8158b6f..6d4e6175687943861852a2902b240ad03a524fb3 100644 (file)
@@ -31,7 +31,8 @@ use nom7::Needed;
 use flate2::Decompress;
 use flate2::FlushDecompress;
 use suricata_sys::sys::{
-    AppLayerParserState, AppProto, SCAppLayerProtoDetectConfProtoDetectionEnabled,
+    AppLayerParserState, AppProto, SCAppLayerParserRegisterLogger,
+    SCAppLayerProtoDetectConfProtoDetectionEnabled,
 };
 
 use std;
@@ -442,7 +443,7 @@ pub unsafe extern "C" fn SCRegisterWebSocketParser() {
                 SCLogError!("Invalid value for websocket.max-payload-size");
             }
         }
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_WEBSOCKET);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_WEBSOCKET);
     } else {
         SCLogDebug!("Protocol detector and parser disabled for WEBSOCKET.");
     }
index d828f71ef7189d68f8d36f89f8fe87b3b68703e7..5e555a4d4cd6297f8e41a6a71018ee12598d93b2 100644 (file)
@@ -700,6 +700,9 @@ extern "C" {
         ipproto: u8, alproto: AppProto, direction: u8,
     );
 }
+extern "C" {
+    pub fn SCAppLayerParserRegisterLogger(ipproto: u8, alproto: AppProto);
+}
 extern "C" {
     pub fn SCAppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32);
 }
index 64ea722409f8384979d7688a5a4fc6421b6c3dfd..6ca2b3fc0ebd745521a5722020fd56f64850a892 100644 (file)
@@ -1332,8 +1332,8 @@ void RegisterFTPParsers(void)
         AppLayerParserRegisterGetEventInfo(IPPROTO_TCP, ALPROTO_FTP, ftp_get_event_info);
         AppLayerParserRegisterGetEventInfoById(IPPROTO_TCP, ALPROTO_FTP, ftp_get_event_info_by_id);
 
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_FTP);
-        AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_FTPDATA);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_FTP);
+        SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_FTPDATA);
 
         sbcfg.buf_size = 4096;
         sbcfg.Calloc = FTPCalloc;
index 56e018f74792180968b3c2ed51c16545763fa257..43ba87242c6c20c52e6db0066321467453d117b6 100644 (file)
@@ -489,7 +489,7 @@ void AppLayerParserRegisterLoggerBits(uint8_t ipproto, AppProto alproto, LoggerI
     SCReturn;
 }
 
-void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto)
+void SCAppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto)
 {
     SCEnter();
 
index f38ffc809a12b3ec2a262f45b8d7d371a28e132f..80b59a715abe1b6f47d25e47ae64c7c5235b7349 100644 (file)
@@ -183,7 +183,7 @@ void AppLayerParserRegisterLocalStorageFunc(uint8_t ipproto, AppProto proto,
 //     AppLayerDecoderEvents *(*StateGetEvents)(void *) __attribute__((nonnull)));
 void AppLayerParserRegisterGetTxFilesFunc(
         uint8_t ipproto, AppProto alproto, AppLayerGetFileState (*GetTxFiles)(void *, uint8_t));
-void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto);
+void SCAppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto);
 void AppLayerParserRegisterLoggerBits(uint8_t ipproto, AppProto alproto, LoggerId bits);
 void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto,
     int (*StateGetStateProgress)(void *alstate, uint8_t direction));
index 9f65a32912e7af4cd5a4f90816c9fb631cf4143a..618c44cd131abbd958709eb9c4fa33ac521d3811 100644 (file)
@@ -178,7 +178,7 @@ void RegisterTFTPParsers(void)
                         TFTP_MIN_FRAME_LEN, STREAM_TOSERVER, TFTPProbingParser, TFTPProbingParser);
             }
         }
-        AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_TFTP);
+        SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_TFTP);
     } else {
         SCLogDebug("Protocol detector and parser disabled for TFTP.");
         return;
index b7dabe1f731760840648f9a47920feb4928ac856..c776520cc168dc7db122a5beef42dcd3a26e2337 100644 (file)
@@ -594,7 +594,7 @@ OutputInitResult LogHttpLogInitCtx(SCConfNode *conf)
     SCLogDebug("HTTP log output initialized");
 
     /* enable the logger for the app layer */
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP1);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP1);
 
     result.ctx = output_ctx;
     result.ok = true;
index ae3797878db0f9b8bbcafc5d9b7da2d2e0e89e9c..1c3f693fa4390e06876b0e7bcc4095355d1300b7 100644 (file)
@@ -240,7 +240,7 @@ static OutputInitResult LogTlsLogInitCtx(SCConfNode *conf)
     SCLogDebug("TLS log output initialized");
 
     /* Enable the logger for the app layer */
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TLS);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TLS);
 
     result.ctx = output_ctx;
     result.ok = true;
index d0c48a5c566375c0f462b8d5bbbe5395d554c685..e26f50a7256b78e537c32b338aa86333813bc213 100644 (file)
@@ -427,7 +427,7 @@ static OutputInitResult LogTlsStoreLogInitCtx(SCConfNode *conf)
     SCLogInfo("storing certs in %s", tls_logfile_base_dir);
 
     /* enable the logger for the app layer */
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TLS);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TLS);
 
     result.ctx = output_ctx;
     result.ok = true;
index 2bae5f7e1b4f8741c087cdb74337e58d264868f4..b758b7fcafd30c9209deb285be0360d4e1c7eec9 100644 (file)
@@ -59,8 +59,8 @@ error:
 
 static OutputInitResult DCERPCLogInitSub(SCConfNode *conf, OutputCtx *parent_ctx)
 {
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_DCERPC);
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_DCERPC);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_DCERPC);
+    SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_DCERPC);
     return OutputJsonLogInitSub(conf, parent_ctx);
 }
 
index 208f2e31625b31161090ba01b98553d9c0b941cd..9012044175f289303dcccc25d03e680b923b98a6 100644 (file)
@@ -106,7 +106,7 @@ static OutputInitResult OutputDHCPLogInitSub(SCConfNode *conf, OutputCtx *parent
 
     dhcplog_ctx->rs_logger = SCDhcpLoggerNew(conf);
 
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_DHCP);
+    SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_DHCP);
 
     result.ctx = output_ctx;
     result.ok = true;
index 05659d5bf9c6af7a47e0652bc4b5d7a6d83b00d1..59835dbb1a4630043b6d500482b4a88121e9e3ca 100644 (file)
@@ -317,7 +317,7 @@ static OutputInitResult OutputDNP3LogInitSub(SCConfNode *conf, OutputCtx *parent
 
     SCLogInfo("DNP3 log sub-module initialized.");
 
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_DNP3);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_DNP3);
 
     result.ctx = output_ctx;
     result.ok = true;
index 1da90a51c72871cdbea0cfda69ff522bf25be961..161268823d02fd794b8f1c8d530dfe1315ad8e78 100644 (file)
@@ -673,8 +673,8 @@ static OutputInitResult JsonDnsLogInitCtxSub(SCConfNode *conf, OutputCtx *parent
 
     SCLogDebug("DNS log sub-module initialized");
 
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_DNS);
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_DNS);
+    SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_DNS);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_DNS);
 
     result.ctx = output_ctx;
     result.ok = true;
index 95ca0cbdecee71b08c5b52f2b25456ffffe9ebc0..97f2e6496bf77221272fa4259421e86d717f59cd 100644 (file)
@@ -590,7 +590,7 @@ static OutputInitResult OutputHttpLogInitSub(SCConfNode *conf, OutputCtx *parent
     output_ctx->DeInit = OutputHttpLogDeinitSub;
 
     /* enable the logger for the app layer */
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP1);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP1);
 
     result.ctx = output_ctx;
     result.ok = true;
index 241767a479a6c1bc33730d70c55d80b53b42015e..a990e72aa0b299c67fd22df97cbfcc388498cebf 100644 (file)
@@ -135,7 +135,7 @@ static OutputInitResult OutputIKELogInitSub(SCConfNode *conf, OutputCtx *parent_
     output_ctx->data = ikelog_ctx;
     output_ctx->DeInit = OutputIKELogDeInitCtxSub;
 
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_IKE);
+    SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_IKE);
 
     result.ctx = output_ctx;
     result.ok = true;
index be45b434a1dc52338d25a324cfb9b4fc9bd7ed16..bb1d45aba93f083e6fac1454a4ca6f95b8c42402 100644 (file)
@@ -145,7 +145,7 @@ static OutputInitResult DnsLogInitCtxSub(SCConfNode *conf, OutputCtx *parent_ctx
     output_ctx->data = dnslog_ctx;
     output_ctx->DeInit = DnsLogDeInitCtxSub;
 
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_MDNS);
+    SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_MDNS);
 
     result.ctx = output_ctx;
     result.ok = true;
index 2342f6323c6f35b4198ffa5ca23f4425802589ee..29e2639b0193000ec2242a9bc9ed5b22d7b1dbf9 100644 (file)
@@ -146,7 +146,7 @@ static OutputInitResult OutputMQTTLogInitSub(SCConfNode *conf, OutputCtx *parent
 
     JsonMQTTLogParseConfig(conf, mqttlog_ctx);
 
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_MQTT);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_MQTT);
 
     result.ctx = output_ctx;
     result.ok = true;
index 0dececa8fdc05d7954d11e5046fe67573ccaac33..1d77b8e989ba028c292dd724f045b83a034584ea 100644 (file)
@@ -101,8 +101,8 @@ static int JsonNFSLogger(ThreadVars *tv, void *thread_data,
 
 static OutputInitResult NFSLogInitSub(SCConfNode *conf, OutputCtx *parent_ctx)
 {
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_NFS);
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_NFS);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_NFS);
+    SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_NFS);
     return OutputJsonLogInitSub(conf, parent_ctx);
 }
 
index 8d864f169dfb4c8328e74f85beedb503c97f1698..d66dbebbf07ff271ddcf0fcdbc4d01187899a215 100644 (file)
@@ -135,7 +135,7 @@ static OutputInitResult OutputPgsqlLogInitSub(SCConfNode *conf, OutputCtx *paren
 
     JsonPgsqlLogParseConfig(conf, pgsql_ctx);
 
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_PGSQL);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_PGSQL);
 
     SCLogDebug("PostgreSQL log sub-module initialized.");
 
index a2fe47a71bd9312198bd34d023de79d35eab841b..f5c1e53ed71ac162b126579220285c3118235dde 100644 (file)
@@ -95,8 +95,8 @@ static void LogSmbLogDeInitCtxSub(OutputCtx *output_ctx)
 
 static OutputInitResult SMBLogInitSub(SCConfNode *conf, OutputCtx *parent_ctx)
 {
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SMB);
-    AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_SMB);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SMB);
+    SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_SMB);
     OutputInitResult r = OutputJsonLogInitSub(conf, parent_ctx);
     if (r.ok) {
         // generic init is ok, try smb-specific one
index 0201721f018b8f6a09bf1954fcb9a896d835c9c7..e4a706ce25c13232c661391b0627e9b74b54cd3a 100644 (file)
@@ -140,7 +140,7 @@ static OutputInitResult OutputSmtpLogInitSub(SCConfNode *conf, OutputCtx *parent
     output_ctx->DeInit = OutputSmtpLogDeInitCtxSub;
 
     /* enable the logger for the app layer */
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SMTP);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SMTP);
 
     result.ctx = output_ctx;
     result.ok = true;
index 7c68f7864e6b79733545035673c0755fc1023d2b..0f23b5247d7ade28f2133077e74df26279c2b570 100644 (file)
@@ -697,7 +697,7 @@ static OutputInitResult OutputTlsLogInitSub(SCConfNode *conf, OutputCtx *parent_
     output_ctx->data = tls_ctx;
     output_ctx->DeInit = OutputTlsLogDeinitSub;
 
-    AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TLS);
+    SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TLS);
 
     result.ctx = output_ctx;
     result.ok = true;
index 6f63fb1a706f8a32fdc683433d301d35b58e8829..fb2fe87034f7fbef1554166bf549481cc5197d44 100644 (file)
@@ -783,31 +783,31 @@ static OutputInitResult OutputLuaLogInit(SCConfNode *conf)
             om->alproto = ALPROTO_HTTP1;
             om->ts_log_progress = -1;
             om->tc_log_progress = -1;
-            AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP1);
+            SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP1);
         } else if (opts.alproto == ALPROTO_TLS) {
             om->TxLogFunc = LuaTxLogger;
             om->alproto = ALPROTO_TLS;
             om->tc_log_progress = TLS_STATE_SERVER_HANDSHAKE_DONE;
             om->ts_log_progress = TLS_STATE_CLIENT_HANDSHAKE_DONE;
-            AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TLS);
+            SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TLS);
         } else if (opts.alproto == ALPROTO_DNS) {
             om->TxLogFunc = LuaTxLogger;
             om->alproto = ALPROTO_DNS;
             om->ts_log_progress = -1;
             om->tc_log_progress = -1;
-            AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_DNS);
-            AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_DNS);
+            SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_DNS);
+            SCAppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_DNS);
         } else if (opts.alproto == ALPROTO_SSH) {
             om->TxLogFunc = LuaTxLogger;
             om->alproto = ALPROTO_SSH;
             om->TxLogCondition = SSHTxLogCondition;
-            AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SSH);
+            SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SSH);
         } else if (opts.alproto == ALPROTO_SMTP) {
             om->TxLogFunc = LuaTxLogger;
             om->alproto = ALPROTO_SMTP;
             om->ts_log_progress = -1;
             om->tc_log_progress = -1;
-            AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SMTP);
+            SCAppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SMTP);
         } else if (opts.packet && opts.alerts) {
             om->PacketLogFunc = LuaPacketLoggerAlerts;
             om->PacketConditionFunc = LuaPacketConditionAlerts;