From b7d240fb14805a23887fc4be78b630a992690812 Mon Sep 17 00:00:00 2001 From: Jeff Lucovsky Date: Thu, 27 Feb 2025 11:48:16 -0500 Subject: [PATCH] applayer/ftp: Move MPM declaration This commit moves the MPM fn declaration into core.rs making it available for other Rust modules. Issue: 4082 --- rust/src/core.rs | 10 ++++++++++ rust/src/ftp/ftp.rs | 9 +-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/rust/src/core.rs b/rust/src/core.rs index bef967b0e1..3366f37838 100644 --- a/rust/src/core.rs +++ b/rust/src/core.rs @@ -18,6 +18,7 @@ //! This module exposes items from the core "C" code to Rust. use std; +use std::os::raw::{c_int, c_void}; use suricata_sys::sys::{AppProto, AppProtoEnum}; use crate::filecontainer::*; @@ -72,6 +73,15 @@ extern { pub fn StringToAppProto(proto_name: *const u8) -> AppProto; } +/// cbindgen:ignore +extern "C" { + pub fn MpmAddPatternCI( + ctx: *const c_void, pat: *const libc::c_char, pat_len: c_int, _offset: c_int, + _depth: c_int, id: c_int, rule_id: c_int, _flags: c_int, + ) -> c_void; +} + + // // Function types for calls into C. // diff --git a/rust/src/ftp/ftp.rs b/rust/src/ftp/ftp.rs index 3963a2adfa..f294c54a57 100644 --- a/rust/src/ftp/ftp.rs +++ b/rust/src/ftp/ftp.rs @@ -19,6 +19,7 @@ use std; use std::ffi::CString; use std::os::raw::{c_char, c_int, c_void}; +use crate::core::*; use crate::conf::{conf_get, get_memval}; use crate::ftp::constant::*; use lazy_static::lazy_static; @@ -97,14 +98,6 @@ lazy_static! { ]; } -/// cbindgen:ignore -extern "C" { - pub fn MpmAddPatternCI( - ctx: *const c_void, pat: *const libc::c_char, pat_len: c_int, _offset: c_int, - _depth: c_int, id: c_int, rule_id: c_int, _flags: c_int, - ) -> c_void; -} - #[allow(non_snake_case)] #[no_mangle] pub unsafe extern "C" fn SCGetFtpCommandInfo(