detect: rename with prefix SCSigTablePreRegister

to make it available to rust via bindgen
pull/12965/head
Philippe Antoine 1 year ago committed by Victor Julien
parent e3ee922fbf
commit 3b271b3f5b

@ -491,12 +491,6 @@ pub type ApplyTxConfigFn = unsafe extern "C" fn (*mut c_void, *mut c_void, c_int
pub type GetFrameIdByName = unsafe extern "C" fn(*const c_char) -> c_int;
pub type GetFrameNameById = unsafe extern "C" fn(u8) -> *const c_char;
// Defined in detect-engine-register.h
/// cbindgen:ignore
extern "C" {
pub fn SigTablePreRegister(cb: unsafe extern "C" fn ());
}
// Defined in app-layer-register.h
/// cbindgen:ignore
extern "C" {

@ -34,7 +34,7 @@ use nom7::{Err, IResult};
use nom7::error::{ErrorKind, make_error};
use suricata_sys::sys::{
AppProto, AppProtoNewProtoFromString, EveJsonTxLoggerRegistrationData,
SCOutputJsonLogDirection, SCOutputEvePreRegisterLogger,
SCOutputJsonLogDirection, SCOutputEvePreRegisterLogger, SCSigTablePreRegister,
};
#[derive(AppLayerEvent)]
@ -418,7 +418,7 @@ pub unsafe extern "C" fn SCRegisterSnmpParser() {
LogTx: Some(snmp_log_json_response),
};
SCOutputEvePreRegisterLogger(reg_data);
SigTablePreRegister(detect_snmp_register);
SCSigTablePreRegister(Some(detect_snmp_register));
if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
// port 161
_ = AppLayerRegisterProtocolDetection(&parser, 1);

@ -171,6 +171,11 @@ extern "C" {
reg_data: EveJsonTxLoggerRegistrationData,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn SCSigTablePreRegister(
KeywordsRegister: ::std::option::Option<unsafe extern "C" fn()>,
) -> ::std::os::raw::c_int;
}
#[doc = " Structure of a configuration parameter."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]

@ -32,6 +32,7 @@
#include "app-layer-protos.h"
#include "suricata-plugin.h"
#include "output-eve-bindgen.h"
#include "detect-engine-register.h"
#include "conf.h"

@ -476,7 +476,7 @@ static size_t preregistered_callbacks_cap = 0;
// When an app-layer plugin is loaded, it wants to register its keywords
// But the plugin is loaded before keywords can register
// The preregistration callbacks will later be called by SigTableSetup
int SigTablePreRegister(void (*KeywordsRegister)(void))
int SCSigTablePreRegister(void (*KeywordsRegister)(void))
{
if (preregistered_callbacks_nb == preregistered_callbacks_cap) {
void *tmp = SCRealloc(PreregisteredCallbacks,

@ -24,8 +24,6 @@
#ifndef SURICATA_DETECT_ENGINE_REGISTER_H
#define SURICATA_DETECT_ENGINE_REGISTER_H
#include "suricata-common.h"
enum DetectKeywordId {
DETECT_SID,
DETECT_PRIORITY,
@ -350,7 +348,7 @@ int SigTableList(const char *keyword);
void SigTableCleanup(void);
void SigTableInit(void);
void SigTableSetup(void);
int SigTablePreRegister(void (*KeywordsRegister)(void));
int SCSigTablePreRegister(void (*KeywordsRegister)(void));
void SigTableRegisterTests(void);
bool SigTableHasKeyword(const char *keyword);

@ -22,8 +22,8 @@
*
*/
#include "detect-engine-register.h"
#include "suricata-common.h"
#include "detect-engine-register.h"
#include "detect.h"
#include "detect-parse.h"

@ -171,7 +171,7 @@ int SCPluginRegisterAppLayer(SCAppLayerPlugin *plugin)
}
}
if (plugin->KeywordsRegister) {
if (SigTablePreRegister(plugin->KeywordsRegister) != 0) {
if (SCSigTablePreRegister(plugin->KeywordsRegister) != 0) {
return 1;
}
}

Loading…
Cancel
Save