Skip to content

Commit

Permalink
fixup! plugin: add in-tree app-layer template plugin for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
catenacyber committed Jan 24, 2025
1 parent f2baf40 commit 7304bfe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/plugins/altemplate/src/detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ unsafe extern "C" fn template_buffer_get(
}

#[no_mangle]
pub unsafe extern "C" fn ScDetectTemplateRegister() {
pub unsafe extern "C" fn DetectTemplateRegister() {
// TODO create a suricata-verify test
// Setup a keyword structure and register it
let kw = SCSigTableElmt {
Expand Down
2 changes: 1 addition & 1 deletion examples/plugins/altemplate/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn log_template(tx: &TemplateTransaction, js: &mut JsonBuilder) -> Result<(), Js
}

#[no_mangle]
pub unsafe extern "C" fn rs_template_logger_log(
pub unsafe extern "C" fn template_logger_log(
tx: *const std::os::raw::c_void, js: *mut std::os::raw::c_void,
) -> bool {
let tx = cast_pointer!(tx, TemplateTransaction);
Expand Down
12 changes: 6 additions & 6 deletions examples/plugins/altemplate/src/plugin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::template::rs_template_register_parser;
use crate::detect::ScDetectTemplateRegister;
use crate::log::rs_template_logger_log;
use super::template::template_register_parser;
use crate::detect::DetectTemplateRegister;
use crate::log::template_logger_log;
use suricata::plugin::{
SCAppLayerPlugin, SCPlugin, SCPluginRegisterAppLayer, SC_PLUGIN_API_VERSION,
};
Expand All @@ -14,9 +14,9 @@ extern "C" fn altemplate_plugin_init() {
name: b"altemplate\0".as_ptr() as *const libc::c_char,
logname: b"JsonaltemplateLog\0".as_ptr() as *const libc::c_char,
confname: b"eve-log.altemplate\0".as_ptr() as *const libc::c_char,
Register: rs_template_register_parser,
Logger: rs_template_logger_log,
KeywordsRegister: ScDetectTemplateRegister,
Register: template_register_parser,
Logger: template_logger_log,
KeywordsRegister: DetectTemplateRegister,
};
unsafe {
if SCPluginRegisterAppLayer(Box::into_raw(Box::new(plugin))) != 0 {
Expand Down
2 changes: 1 addition & 1 deletion examples/plugins/altemplate/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ export_state_data_get!(rs_template_get_state_data, TemplateState);
const PARSER_NAME: &[u8] = b"altemplate\0";

#[no_mangle]
pub unsafe extern "C" fn rs_template_register_parser() {
pub unsafe extern "C" fn template_register_parser() {
let default_port = CString::new("[7000]").unwrap();
let parser = RustParser {
name: PARSER_NAME.as_ptr() as *const c_char,
Expand Down

0 comments on commit 7304bfe

Please sign in to comment.