From f909bbba6866179134086b47a2dfa7015a04ade2 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Mon, 12 May 2025 20:44:21 +0200 Subject: [PATCH] rust: bindgen SCDetectHelperKeywordAliasRegister Ticket: 7667 --- rust/src/detect/mod.rs | 3 +-- rust/src/dns/detect.rs | 10 +++++----- rust/sys/src/sys.rs | 5 +++++ src/detect-engine-helper.c | 2 +- src/detect-engine-helper.h | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/rust/src/detect/mod.rs b/rust/src/detect/mod.rs index 6999ff4f1c..a0df2995b0 100644 --- a/rust/src/detect/mod.rs +++ b/rust/src/detect/mod.rs @@ -35,7 +35,7 @@ pub mod tojson; pub mod vlan; pub mod datasets; -use std::os::raw::{c_char, c_int, c_void}; +use std::os::raw::{c_int, c_void}; use std::ffi::CString; use suricata_sys::sys::{AppProto, DetectEngineCtx, Signature}; @@ -169,7 +169,6 @@ extern "C" { ) -> *mut c_void, ) -> c_int; pub fn DetectHelperKeywordRegister(kw: *const SCSigTableAppLiteElmt) -> c_int; - pub fn DetectHelperKeywordAliasRegister(kwid: c_int, alias: *const c_char); 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, diff --git a/rust/src/dns/detect.rs b/rust/src/dns/detect.rs index 9e891e3dc8..c8d8664e68 100644 --- a/rust/src/dns/detect.rs +++ b/rust/src/dns/detect.rs @@ -22,16 +22,16 @@ use crate::detect::uint::{ SCDetectU8Parse, }; use crate::detect::{ - helper_keyword_register_sticky_buffer, DetectHelperKeywordAliasRegister, - DetectHelperKeywordRegister, DetectSignatureSetAppProto, SCSigTableAppLiteElmt, - SigMatchAppendSMToList, SigTableElmtStickyBuffer, + helper_keyword_register_sticky_buffer, 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, - SCDetectHelperBufferRegister, SCDetectHelperMultiBufferProgressMpmRegister, Signature, + SCDetectHelperBufferRegister, SCDetectHelperKeywordAliasRegister, + SCDetectHelperMultiBufferProgressMpmRegister, Signature, }; /// Perform the DNS opcode match. @@ -411,7 +411,7 @@ pub unsafe extern "C" fn SCDetectDNSRegister() { setup: dns_detect_query_setup, }; let g_dns_query_name_kw_id = helper_keyword_register_sticky_buffer(&kw); - DetectHelperKeywordAliasRegister( + SCDetectHelperKeywordAliasRegister( g_dns_query_name_kw_id, b"dns_query\0".as_ptr() as *const libc::c_char, ); diff --git a/rust/sys/src/sys.rs b/rust/sys/src/sys.rs index 9acbb6b131..7dc5c9468e 100644 --- a/rust/sys/src/sys.rs +++ b/rust/sys/src/sys.rs @@ -326,6 +326,11 @@ pub struct SCTransformTableElmt { extern "C" { pub fn SCDetectHelperNewKeywordId() -> ::std::os::raw::c_int; } +extern "C" { + pub fn SCDetectHelperKeywordAliasRegister( + kwid: ::std::os::raw::c_int, alias: *const ::std::os::raw::c_char, + ); +} extern "C" { pub fn SCDetectHelperBufferRegister( name: *const ::std::os::raw::c_char, alproto: AppProto, direction: u8, diff --git a/src/detect-engine-helper.c b/src/detect-engine-helper.c index 2c0d6d14a6..ea6610c90a 100644 --- a/src/detect-engine-helper.c +++ b/src/detect-engine-helper.c @@ -139,7 +139,7 @@ int DetectHelperKeywordRegister(const SCSigTableAppLiteElmt *kw) return keyword_id; } -void DetectHelperKeywordAliasRegister(int kwid, const char *alias) +void SCDetectHelperKeywordAliasRegister(int kwid, const char *alias) { sigmatch_table[kwid].alias = alias; } diff --git a/src/detect-engine-helper.h b/src/detect-engine-helper.h index 706fa28259..125adfa657 100644 --- a/src/detect-engine-helper.h +++ b/src/detect-engine-helper.h @@ -76,7 +76,7 @@ typedef struct SCTransformTableElmt { int SCDetectHelperNewKeywordId(void); int DetectHelperKeywordRegister(const SCSigTableAppLiteElmt *kw); -void DetectHelperKeywordAliasRegister(int kwid, const char *alias); +void SCDetectHelperKeywordAliasRegister(int kwid, const char *alias); int SCDetectHelperBufferRegister(const char *name, AppProto alproto, uint8_t direction); typedef bool (*SimpleGetTxBuffer)(void *, uint8_t, const uint8_t **, uint32_t *); -- 2.47.2