use crate::filecontainer::FileContainer;
use crate::applayer;
use std::os::raw::{c_void,c_char,c_int};
+use crate::core::SC;
#[repr(C)]
#[derive(Debug,PartialEq)]
// Defined in app-layer-register.h
extern {
pub fn AppLayerRegisterProtocolDetection(parser: *const RustParser, enable_default: c_int) -> AppProto;
- pub fn AppLayerRegisterParser(parser: *const RustParser, alproto: AppProto) -> c_int;
+}
+
+#[allow(non_snake_case)]
+pub unsafe fn AppLayerRegisterParser(parser: *const RustParser, alproto: AppProto) -> c_int {
+ (SC.unwrap().AppLayerRegisterParser)(parser, alproto)
}
// Defined in app-layer-detect-proto.h
pub FileContainerRecycle: SCFileContainerRecycle,
pub FilePrune: SCFilePrune,
pub FileSetTx: SCFileSetTx,
+
+ pub AppLayerRegisterParser: extern fn(parser: *const crate::applayer::RustParser, alproto: AppProto) -> std::os::raw::c_int,
}
#[allow(non_snake_case)]
#include "app-layer-snmp.h" //SNMPState, SNMPTransaction
#include "app-layer-tftp.h" //TFTPState, TFTPTransaction
+struct AppLayerParser;
+
typedef struct SuricataContext_ {
SCError (*SCLogMessage)(const SCLogLevel, const char *, const unsigned int,
const char *, const SCError, const char *message);
void (*FilePrune)(FileContainer *ffc);
void (*FileSetTx)(FileContainer *, uint64_t);
+ int (*AppLayerRegisterParser)(const struct AppLayerParser *p, AppProto alproto);
+
} SuricataContext;
extern SuricataContext suricata_context;
#include "app-layer.h"
#include "app-layer-parser.h"
+#include "app-layer-register.h"
#include "app-layer-htp.h"
#include "app-layer-ssl.h"
#include "app-layer-ssh.h"
suricata_context.FilePrune = FilePrune;
suricata_context.FileSetTx = FileContainerSetTx;
+ suricata_context.AppLayerRegisterParser = AppLayerRegisterParser;
+
rs_init(&suricata_context);
SC_ATOMIC_INIT(engine_stage);