]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: bindgen SCDetectHelperBufferRegister
authorPhilippe Antoine <pantoine@oisf.net>
Mon, 12 May 2025 18:39:52 +0000 (20:39 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 13 May 2025 18:24:05 +0000 (20:24 +0200)
Ticket: 7667

12 files changed:
rust/src/detect/mod.rs
rust/src/dhcp/detect.rs
rust/src/dns/detect.rs
rust/src/enip/detect.rs
rust/src/ldap/detect.rs
rust/src/mqtt/detect.rs
rust/src/rfb/detect.rs
rust/src/snmp/detect.rs
rust/src/websocket/detect.rs
rust/sys/src/sys.rs
src/detect-engine-helper.c
src/detect-engine-helper.h

index 60ae90a1c5a5b36710d91dbc056fc058640edabd..6999ff4f1cf719cca7d6004adef7de7e3926dc3d 100644 (file)
@@ -170,9 +170,6 @@ extern "C" {
     ) -> c_int;
     pub fn DetectHelperKeywordRegister(kw: *const SCSigTableAppLiteElmt) -> c_int;
     pub fn DetectHelperKeywordAliasRegister(kwid: c_int, alias: *const c_char);
-    pub fn DetectHelperBufferRegister(
-        name: *const libc::c_char, alproto: AppProto, dir: u8,
-    ) -> c_int;
     pub fn DetectSignatureSetAppProto(s: *mut Signature, alproto: AppProto) -> c_int;
     pub fn SigMatchAppendSMToList(
         de: *mut DetectEngineCtx, s: *mut Signature, kwid: c_int, ctx: *const c_void, bufid: c_int,
index f29a5a6b1abe5b378671935be2050bc619af814a..a936e92c45e16be97c1a75f54405d4d6238514dd 100644 (file)
@@ -23,11 +23,11 @@ use super::parser::DHCPOptionWrapper;
 use crate::core::{STREAM_TOCLIENT, STREAM_TOSERVER};
 use crate::detect::uint::{DetectUintData, SCDetectU64Free, SCDetectU64Match, SCDetectU64Parse};
 use crate::detect::{
-    DetectHelperBufferRegister, DetectHelperKeywordRegister, DetectSignatureSetAppProto,
-    SCSigTableAppLiteElmt, SigMatchAppendSMToList,
+    DetectHelperKeywordRegister, DetectSignatureSetAppProto, SCSigTableAppLiteElmt,
+    SigMatchAppendSMToList,
 };
-use suricata_sys::sys::{DetectEngineCtx, Signature};
 use std::os::raw::{c_int, c_void};
+use suricata_sys::sys::{DetectEngineCtx, SCDetectHelperBufferRegister, Signature};
 
 fn dhcp_tx_get_time(tx: &DHCPTransaction, code: u8) -> Option<u64> {
     for option in &tx.message.options {
@@ -176,7 +176,7 @@ pub unsafe extern "C" fn SCDetectDHCPRegister() {
         flags: 0,
     };
     G_DHCP_LEASE_TIME_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_DHCP_LEASE_TIME_BUFFER_ID = DetectHelperBufferRegister(
+    G_DHCP_LEASE_TIME_BUFFER_ID = SCDetectHelperBufferRegister(
         b"dhcp.leasetime\0".as_ptr() as *const libc::c_char,
         ALPROTO_DHCP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -191,7 +191,7 @@ pub unsafe extern "C" fn SCDetectDHCPRegister() {
         flags: 0,
     };
     G_DHCP_REBINDING_TIME_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_DHCP_REBINDING_TIME_BUFFER_ID = DetectHelperBufferRegister(
+    G_DHCP_REBINDING_TIME_BUFFER_ID = SCDetectHelperBufferRegister(
         b"dhcp.rebinding-time\0".as_ptr() as *const libc::c_char,
         ALPROTO_DHCP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -206,7 +206,7 @@ pub unsafe extern "C" fn SCDetectDHCPRegister() {
         flags: 0,
     };
     G_DHCP_RENEWAL_TIME_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_DHCP_RENEWAL_TIME_BUFFER_ID = DetectHelperBufferRegister(
+    G_DHCP_RENEWAL_TIME_BUFFER_ID = SCDetectHelperBufferRegister(
         b"dhcp.renewal-time\0".as_ptr() as *const libc::c_char,
         ALPROTO_DHCP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
index 78d576fb8f6f46e586e93387b768f881b87277b8..9e891e3dc88d7e24da1d5d3a1f3f3069a118beb4 100644 (file)
@@ -22,16 +22,16 @@ use crate::detect::uint::{
     SCDetectU8Parse,
 };
 use crate::detect::{
-    helper_keyword_register_sticky_buffer, DetectHelperBufferRegister,
-    DetectHelperKeywordAliasRegister, DetectHelperKeywordRegister, DetectSignatureSetAppProto,
-    SCSigTableAppLiteElmt, SigMatchAppendSMToList, SigTableElmtStickyBuffer,
+    helper_keyword_register_sticky_buffer, DetectHelperKeywordAliasRegister,
+    DetectHelperKeywordRegister, DetectSignatureSetAppProto, SCSigTableAppLiteElmt,
+    SigMatchAppendSMToList, SigTableElmtStickyBuffer,
 };
 use crate::direction::Direction;
 use std::ffi::CStr;
 use std::os::raw::{c_int, c_void};
 use suricata_sys::sys::{
     DetectEngineCtx, DetectEngineThreadCtx, SCDetectBufferSetActiveList,
-    SCDetectHelperMultiBufferProgressMpmRegister, Signature,
+    SCDetectHelperBufferRegister, SCDetectHelperMultiBufferProgressMpmRegister, Signature,
 };
 
 /// Perform the DNS opcode match.
@@ -352,7 +352,7 @@ pub unsafe extern "C" fn SCDetectDNSRegister() {
         flags: 0,
     };
     G_DNS_OPCODE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_DNS_OPCODE_BUFFER_ID = DetectHelperBufferRegister(
+    G_DNS_OPCODE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"dns.opcode\0".as_ptr() as *const libc::c_char,
         ALPROTO_DNS,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -384,7 +384,7 @@ pub unsafe extern "C" fn SCDetectDNSRegister() {
         flags: 0,
     };
     G_DNS_RCODE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_DNS_RCODE_BUFFER_ID = DetectHelperBufferRegister(
+    G_DNS_RCODE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"dns.rcode\0".as_ptr() as *const libc::c_char,
         ALPROTO_DNS,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -399,7 +399,7 @@ pub unsafe extern "C" fn SCDetectDNSRegister() {
         flags: 0,
     };
     G_DNS_RRTYPE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_DNS_RRTYPE_BUFFER_ID = DetectHelperBufferRegister(
+    G_DNS_RRTYPE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"dns.rrtype\0".as_ptr() as *const libc::c_char,
         ALPROTO_DNS,
         STREAM_TOSERVER | STREAM_TOCLIENT,
index 58033ce6e18af30707e8395ed65365025656fd67..07786ef78bffbab9f8a84dad58202025482a4b2f 100644 (file)
@@ -36,12 +36,13 @@ use crate::detect::uint::{
     SCDetectU8Match, SCDetectU8Parse,
 };
 use crate::detect::{
-    helper_keyword_register_sticky_buffer, DetectHelperBufferMpmRegister,
-    DetectHelperBufferRegister, DetectHelperGetData, DetectHelperKeywordRegister,
-    DetectSignatureSetAppProto, SCSigTableAppLiteElmt, SigMatchAppendSMToList,
-    SigTableElmtStickyBuffer,
+    helper_keyword_register_sticky_buffer, DetectHelperBufferMpmRegister, DetectHelperGetData,
+    DetectHelperKeywordRegister, DetectSignatureSetAppProto, SCSigTableAppLiteElmt,
+    SigMatchAppendSMToList, SigTableElmtStickyBuffer,
+};
+use suricata_sys::sys::{
+    DetectEngineCtx, SCDetectBufferSetActiveList, SCDetectHelperBufferRegister, Signature,
 };
-use suricata_sys::sys::{DetectEngineCtx, SCDetectBufferSetActiveList, Signature};
 
 use crate::direction::Direction;
 
@@ -1345,7 +1346,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_CIPSERVICE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_CIPSERVICE_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_CIPSERVICE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"cip\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1360,7 +1361,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_CAPABILITIES_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_CAPABILITIES_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_CAPABILITIES_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.capabilities\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1375,7 +1376,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_CIP_ATTRIBUTE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_CIP_ATTRIBUTE_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_CIP_ATTRIBUTE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.cip_attribute\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1390,7 +1391,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_CIP_CLASS_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_CIP_CLASS_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_CIP_CLASS_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.cip_class\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1405,7 +1406,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_VENDOR_ID_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_VENDOR_ID_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_VENDOR_ID_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.vendor_id\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1420,7 +1421,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_STATUS_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_STATUS_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_STATUS_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.status\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1435,7 +1436,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_STATE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_STATE_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_STATE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.state\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1450,7 +1451,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_SERIAL_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_SERIAL_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_SERIAL_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.serial\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1465,7 +1466,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_REVISION_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_REVISION_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_REVISION_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.revision\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1480,7 +1481,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_PROTOCOL_VERSION_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_PROTOCOL_VERSION_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_PROTOCOL_VERSION_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.protocol_version\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1495,7 +1496,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_PRODUCT_CODE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_PRODUCT_CODE_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_PRODUCT_CODE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.product_code\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1510,7 +1511,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_COMMAND_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_COMMAND_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_COMMAND_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.command\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1525,7 +1526,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_IDENTITY_STATUS_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_IDENTITY_STATUS_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_IDENTITY_STATUS_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.identity_status\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1540,7 +1541,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_DEVICE_TYPE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_DEVICE_TYPE_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_DEVICE_TYPE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.device_type\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1555,7 +1556,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_CIP_STATUS_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_CIP_STATUS_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_CIP_STATUS_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.cip_status\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1570,7 +1571,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_CIP_INSTANCE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_CIP_INSTANCE_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_CIP_INSTANCE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.cip_instance\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1586,7 +1587,7 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
         flags: 0,
     };
     G_ENIP_CIP_EXTENDEDSTATUS_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_ENIP_CIP_EXTENDEDSTATUS_BUFFER_ID = DetectHelperBufferRegister(
+    G_ENIP_CIP_EXTENDEDSTATUS_BUFFER_ID = SCDetectHelperBufferRegister(
         b"enip.cip_extendedstatus\0".as_ptr() as *const libc::c_char,
         ALPROTO_ENIP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
index 7b036988cfad5d915cd9488d6ac957fccfa0cdad..0d792141e84686b0943efc52a4fb82bfcb82c8b8 100644 (file)
@@ -22,15 +22,14 @@ use crate::detect::uint::{
     SCDetectU8Free,
 };
 use crate::detect::{
-    helper_keyword_register_sticky_buffer, DetectHelperBufferMpmRegister,
-    DetectHelperBufferRegister, DetectHelperGetData, DetectHelperKeywordRegister,
-    DetectSignatureSetAppProto, SCSigTableAppLiteElmt, SigMatchAppendSMToList,
-    SigTableElmtStickyBuffer,
+    helper_keyword_register_sticky_buffer, DetectHelperBufferMpmRegister, DetectHelperGetData,
+    DetectHelperKeywordRegister, DetectSignatureSetAppProto, SCSigTableAppLiteElmt,
+    SigMatchAppendSMToList, SigTableElmtStickyBuffer,
 };
 use crate::ldap::types::{LdapMessage, LdapResultCode, ProtocolOp, ProtocolOpCode};
 use suricata_sys::sys::{
     DetectEngineCtx, DetectEngineThreadCtx, SCDetectBufferSetActiveList,
-    SCDetectHelperMultiBufferMpmRegister, Signature,
+    SCDetectHelperBufferRegister, SCDetectHelperMultiBufferMpmRegister, Signature,
 };
 
 use std::collections::VecDeque;
@@ -646,7 +645,7 @@ pub unsafe extern "C" fn SCDetectLdapRegister() {
         flags: 0,
     };
     G_LDAP_REQUEST_OPERATION_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_LDAP_REQUEST_OPERATION_BUFFER_ID = DetectHelperBufferRegister(
+    G_LDAP_REQUEST_OPERATION_BUFFER_ID = SCDetectHelperBufferRegister(
         b"ldap.request.operation\0".as_ptr() as *const libc::c_char,
         ALPROTO_LDAP,
         STREAM_TOSERVER,
@@ -662,7 +661,7 @@ pub unsafe extern "C" fn SCDetectLdapRegister() {
         flags: 0,
     };
     G_LDAP_RESPONSES_OPERATION_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_LDAP_RESPONSES_OPERATION_BUFFER_ID = DetectHelperBufferRegister(
+    G_LDAP_RESPONSES_OPERATION_BUFFER_ID = SCDetectHelperBufferRegister(
         b"ldap.responses.operation\0".as_ptr() as *const libc::c_char,
         ALPROTO_LDAP,
         STREAM_TOCLIENT,
@@ -677,7 +676,7 @@ pub unsafe extern "C" fn SCDetectLdapRegister() {
         flags: 0,
     };
     G_LDAP_RESPONSES_COUNT_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_LDAP_RESPONSES_COUNT_BUFFER_ID = DetectHelperBufferRegister(
+    G_LDAP_RESPONSES_COUNT_BUFFER_ID = SCDetectHelperBufferRegister(
         b"ldap.responses.count\0".as_ptr() as *const libc::c_char,
         ALPROTO_LDAP,
         STREAM_TOCLIENT,
@@ -721,7 +720,7 @@ pub unsafe extern "C" fn SCDetectLdapRegister() {
         flags: 0,
     };
     G_LDAP_RESPONSES_RESULT_CODE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_LDAP_RESPONSES_RESULT_CODE_BUFFER_ID = DetectHelperBufferRegister(
+    G_LDAP_RESPONSES_RESULT_CODE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"ldap.responses.result_code\0".as_ptr() as *const libc::c_char,
         ALPROTO_LDAP,
         STREAM_TOCLIENT,
index f980d3609dafb9590fd7872bc1b6e11410828f2e..b6317fd1e06406096c823bae4a4fb376774fdfce 100644 (file)
@@ -23,14 +23,13 @@ use crate::detect::uint::{
     SCDetectU8Free, SCDetectU8Parse,
 };
 use crate::detect::{
-    helper_keyword_register_sticky_buffer, DetectHelperBufferMpmRegister,
-    DetectHelperBufferRegister, DetectHelperGetData, DetectHelperKeywordRegister,
-    DetectSignatureSetAppProto, SCSigTableAppLiteElmt, SigMatchAppendSMToList,
-    SigTableElmtStickyBuffer,
+    helper_keyword_register_sticky_buffer, DetectHelperBufferMpmRegister, DetectHelperGetData,
+    DetectHelperKeywordRegister, DetectSignatureSetAppProto, SCSigTableAppLiteElmt,
+    SigMatchAppendSMToList, SigTableElmtStickyBuffer,
 };
 use suricata_sys::sys::{
     DetectEngineCtx, DetectEngineThreadCtx, SCDetectBufferSetActiveList,
-    SCDetectHelperMultiBufferMpmRegister, Signature,
+    SCDetectHelperBufferRegister, SCDetectHelperMultiBufferMpmRegister, Signature,
 };
 
 use nom7::branch::alt;
@@ -1108,7 +1107,7 @@ pub unsafe extern "C" fn SCDetectMqttRegister() {
         flags: 0,
     };
     G_MQTT_TYPE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_MQTT_TYPE_BUFFER_ID = DetectHelperBufferRegister(
+    G_MQTT_TYPE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"mqtt.type\0".as_ptr() as *const libc::c_char,
         ALPROTO_MQTT,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1148,7 +1147,7 @@ pub unsafe extern "C" fn SCDetectMqttRegister() {
         flags: 0,
     };
     G_MQTT_REASON_CODE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_MQTT_REASON_CODE_BUFFER_ID = DetectHelperBufferRegister(
+    G_MQTT_REASON_CODE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"mqtt.reason_code\0".as_ptr() as *const libc::c_char,
         ALPROTO_MQTT,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -1164,7 +1163,7 @@ pub unsafe extern "C" fn SCDetectMqttRegister() {
         flags: 0,
     };
     G_MQTT_CONNACK_SESSIONPRESENT_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_MQTT_CONNACK_SESSIONPRESENT_BUFFER_ID = DetectHelperBufferRegister(
+    G_MQTT_CONNACK_SESSIONPRESENT_BUFFER_ID = SCDetectHelperBufferRegister(
         b"mqtt.connack.session_present\0".as_ptr() as *const libc::c_char,
         ALPROTO_MQTT,
         STREAM_TOCLIENT,
@@ -1180,7 +1179,7 @@ pub unsafe extern "C" fn SCDetectMqttRegister() {
         flags: 0,
     };
     G_MQTT_QOS_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_MQTT_QOS_BUFFER_ID = DetectHelperBufferRegister(
+    G_MQTT_QOS_BUFFER_ID = SCDetectHelperBufferRegister(
         b"mqtt.qos\0".as_ptr() as *const libc::c_char,
         ALPROTO_MQTT,
         STREAM_TOSERVER,
@@ -1223,7 +1222,7 @@ pub unsafe extern "C" fn SCDetectMqttRegister() {
         flags: 0,
     };
     G_MQTT_PROTOCOL_VERSION_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_MQTT_PROTOCOL_VERSION_BUFFER_ID = DetectHelperBufferRegister(
+    G_MQTT_PROTOCOL_VERSION_BUFFER_ID = SCDetectHelperBufferRegister(
         b"mqtt.protocol_version\0".as_ptr() as *const libc::c_char,
         ALPROTO_MQTT,
         STREAM_TOSERVER,
@@ -1238,7 +1237,7 @@ pub unsafe extern "C" fn SCDetectMqttRegister() {
         flags: 0,
     };
     G_MQTT_FLAGS_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_MQTT_FLAGS_BUFFER_ID = DetectHelperBufferRegister(
+    G_MQTT_FLAGS_BUFFER_ID = SCDetectHelperBufferRegister(
         b"mqtt.flags\0".as_ptr() as *const libc::c_char,
         ALPROTO_MQTT,
         STREAM_TOSERVER,
@@ -1253,7 +1252,7 @@ pub unsafe extern "C" fn SCDetectMqttRegister() {
         flags: 0,
     };
     G_MQTT_CONN_FLAGS_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_MQTT_CONN_FLAGS_BUFFER_ID = DetectHelperBufferRegister(
+    G_MQTT_CONN_FLAGS_BUFFER_ID = SCDetectHelperBufferRegister(
         b"mqtt.connect.flags\0".as_ptr() as *const libc::c_char,
         ALPROTO_MQTT,
         STREAM_TOSERVER,
index e05e4d875271e4dda0aba21e4c1d7f93b8ad4ecb..4289fb31a965681f3badec02ad7133162e190bff 100644 (file)
@@ -24,15 +24,16 @@ use crate::detect::uint::{
     detect_match_uint, detect_parse_uint_enum, DetectUintData, SCDetectU32Free, SCDetectU32Parse,
 };
 use crate::detect::{
-    helper_keyword_register_sticky_buffer, DetectHelperBufferMpmRegister,
-    DetectHelperBufferRegister, DetectHelperGetData, DetectHelperKeywordRegister,
-    DetectSignatureSetAppProto, SCSigTableAppLiteElmt, SigMatchAppendSMToList,
-    SigTableElmtStickyBuffer,
+    helper_keyword_register_sticky_buffer, DetectHelperBufferMpmRegister, DetectHelperGetData,
+    DetectHelperKeywordRegister, DetectSignatureSetAppProto, SCSigTableAppLiteElmt,
+    SigMatchAppendSMToList, SigTableElmtStickyBuffer,
 };
 use std::ffi::CStr;
 use std::os::raw::{c_int, c_void};
 use std::ptr;
-use suricata_sys::sys::{DetectEngineCtx, SCDetectBufferSetActiveList, Signature};
+use suricata_sys::sys::{
+    DetectEngineCtx, SCDetectBufferSetActiveList, SCDetectHelperBufferRegister, Signature,
+};
 
 unsafe extern "C" fn rfb_name_get_data(
     tx: *const c_void, _flags: u8, buffer: *mut *const u8, buffer_len: *mut u32,
@@ -214,7 +215,7 @@ pub unsafe extern "C" fn SCDetectRfbRegister() {
         flags: 0,
     };
     G_RFB_SEC_TYPE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_RFB_SEC_TYPE_BUFFER_ID = DetectHelperBufferRegister(
+    G_RFB_SEC_TYPE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"rfb.sectype\0".as_ptr() as *const libc::c_char,
         ALPROTO_RFB,
         STREAM_TOSERVER,
@@ -229,7 +230,7 @@ pub unsafe extern "C" fn SCDetectRfbRegister() {
         flags: 0,
     };
     G_RFB_SEC_RESULT_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_RFB_SEC_RESULT_BUFFER_ID = DetectHelperBufferRegister(
+    G_RFB_SEC_RESULT_BUFFER_ID = SCDetectHelperBufferRegister(
         b"rfb.secresult\0".as_ptr() as *const libc::c_char,
         ALPROTO_RFB,
         STREAM_TOCLIENT,
index 8f0e9bf8b96c39409fcaf135e4bbe7cceaf071f6..c50637ff260c7b1420d73eccd68276a13d436e72 100644 (file)
@@ -21,13 +21,14 @@ use super::snmp::{SNMPTransaction, ALPROTO_SNMP};
 use crate::core::{STREAM_TOCLIENT, STREAM_TOSERVER};
 use crate::detect::uint::{DetectUintData, SCDetectU32Free, SCDetectU32Match, SCDetectU32Parse};
 use crate::detect::{
-    helper_keyword_register_sticky_buffer, DetectHelperBufferMpmRegister,
-    DetectHelperBufferRegister, DetectHelperGetData, DetectHelperKeywordRegister,
-    DetectSignatureSetAppProto, SCSigTableAppLiteElmt, SigMatchAppendSMToList,
-    SigTableElmtStickyBuffer,
+    helper_keyword_register_sticky_buffer, DetectHelperBufferMpmRegister, DetectHelperGetData,
+    DetectHelperKeywordRegister, DetectSignatureSetAppProto, SCSigTableAppLiteElmt,
+    SigMatchAppendSMToList, SigTableElmtStickyBuffer,
 };
 use std::os::raw::{c_int, c_void};
-use suricata_sys::sys::{DetectEngineCtx, SCDetectBufferSetActiveList, Signature};
+use suricata_sys::sys::{
+    DetectEngineCtx, SCDetectBufferSetActiveList, SCDetectHelperBufferRegister, Signature,
+};
 
 static mut G_SNMP_VERSION_KW_ID: c_int = 0;
 static mut G_SNMP_VERSION_BUFFER_ID: c_int = 0;
@@ -195,7 +196,7 @@ pub(super) unsafe extern "C" fn detect_snmp_register() {
         flags: 0,
     };
     G_SNMP_VERSION_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_SNMP_VERSION_BUFFER_ID = DetectHelperBufferRegister(
+    G_SNMP_VERSION_BUFFER_ID = SCDetectHelperBufferRegister(
         b"snmp.version\0".as_ptr() as *const libc::c_char,
         ALPROTO_SNMP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -211,7 +212,7 @@ pub(super) unsafe extern "C" fn detect_snmp_register() {
         flags: 0,
     };
     G_SNMP_PDUTYPE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_SNMP_PDUTYPE_BUFFER_ID = DetectHelperBufferRegister(
+    G_SNMP_PDUTYPE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"snmp.pdu_type\0".as_ptr() as *const libc::c_char,
         ALPROTO_SNMP,
         STREAM_TOSERVER | STREAM_TOCLIENT,
index 175970668f12ccb4c444a185ff741aaab129074c..39badd8dca67b5675a95800b3e88de0cb224ba94 100644 (file)
@@ -22,13 +22,14 @@ use crate::detect::uint::{
     SCDetectU32Match, SCDetectU32Parse, SCDetectU8Free, SCDetectU8Match,
 };
 use crate::detect::{
-    helper_keyword_register_sticky_buffer, DetectHelperBufferMpmRegister,
-    DetectHelperBufferRegister, DetectHelperGetData, DetectHelperKeywordRegister,
-    DetectSignatureSetAppProto, SCSigTableAppLiteElmt, SigMatchAppendSMToList,
-    SigTableElmtStickyBuffer,
+    helper_keyword_register_sticky_buffer, DetectHelperBufferMpmRegister, DetectHelperGetData,
+    DetectHelperKeywordRegister, DetectSignatureSetAppProto, SCSigTableAppLiteElmt,
+    SigMatchAppendSMToList, SigTableElmtStickyBuffer,
 };
 use crate::websocket::parser::WebSocketOpcode;
-use suricata_sys::sys::{DetectEngineCtx, SCDetectBufferSetActiveList, Signature};
+use suricata_sys::sys::{
+    DetectEngineCtx, SCDetectBufferSetActiveList, SCDetectHelperBufferRegister, Signature,
+};
 
 use nom7::branch::alt;
 use nom7::bytes::complete::{is_a, tag};
@@ -291,7 +292,7 @@ pub unsafe extern "C" fn SCDetectWebsocketRegister() {
         flags: 0,
     };
     G_WEBSOCKET_OPCODE_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_WEBSOCKET_OPCODE_BUFFER_ID = DetectHelperBufferRegister(
+    G_WEBSOCKET_OPCODE_BUFFER_ID = SCDetectHelperBufferRegister(
         b"websocket.opcode\0".as_ptr() as *const libc::c_char,
         ALPROTO_WEBSOCKET,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -306,7 +307,7 @@ pub unsafe extern "C" fn SCDetectWebsocketRegister() {
         flags: 0,
     };
     G_WEBSOCKET_MASK_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_WEBSOCKET_MASK_BUFFER_ID = DetectHelperBufferRegister(
+    G_WEBSOCKET_MASK_BUFFER_ID = SCDetectHelperBufferRegister(
         b"websocket.mask\0".as_ptr() as *const libc::c_char,
         ALPROTO_WEBSOCKET,
         STREAM_TOSERVER | STREAM_TOCLIENT,
@@ -321,7 +322,7 @@ pub unsafe extern "C" fn SCDetectWebsocketRegister() {
         flags: 0,
     };
     G_WEBSOCKET_FLAGS_KW_ID = DetectHelperKeywordRegister(&kw);
-    G_WEBSOCKET_FLAGS_BUFFER_ID = DetectHelperBufferRegister(
+    G_WEBSOCKET_FLAGS_BUFFER_ID = SCDetectHelperBufferRegister(
         b"websocket.flags\0".as_ptr() as *const libc::c_char,
         ALPROTO_WEBSOCKET,
         STREAM_TOSERVER | STREAM_TOCLIENT,
index 4c5361f1fff4826fdfced39fc0b871135b83b32c..9acbb6b131e9e94636505440ae25f71db201e19d 100644 (file)
@@ -326,6 +326,11 @@ pub struct SCTransformTableElmt {
 extern "C" {
     pub fn SCDetectHelperNewKeywordId() -> ::std::os::raw::c_int;
 }
+extern "C" {
+    pub fn SCDetectHelperBufferRegister(
+        name: *const ::std::os::raw::c_char, alproto: AppProto, direction: u8,
+    ) -> ::std::os::raw::c_int;
+}
 extern "C" {
     pub fn SCDetectHelperMultiBufferMpmRegister(
         name: *const ::std::os::raw::c_char, desc: *const ::std::os::raw::c_char,
index 099beb54404508ca00265555e6bb4517a5575c76..2c0d6d14a638ec74fd62050da97f401d15483b9d 100644 (file)
@@ -31,7 +31,7 @@
 #include "detect-engine-content-inspection.h"
 #include "rust.h"
 
-int DetectHelperBufferRegister(const char *name, AppProto alproto, uint8_t direction)
+int SCDetectHelperBufferRegister(const char *name, AppProto alproto, uint8_t direction)
 {
     if (direction & STREAM_TOSERVER) {
         DetectAppLayerInspectEngineRegister(
index 93efb2212c1627f18071c9ca0222bb2a78fde47e..706fa28259efa22c5fa60c623e0e83b2f8b907a9 100644 (file)
@@ -77,7 +77,7 @@ int SCDetectHelperNewKeywordId(void);
 
 int DetectHelperKeywordRegister(const SCSigTableAppLiteElmt *kw);
 void DetectHelperKeywordAliasRegister(int kwid, const char *alias);
-int DetectHelperBufferRegister(const char *name, AppProto alproto, uint8_t direction);
+int SCDetectHelperBufferRegister(const char *name, AppProto alproto, uint8_t direction);
 
 typedef bool (*SimpleGetTxBuffer)(void *, uint8_t, const uint8_t **, uint32_t *);