rust: bindgen AppLayerParserRegisterParserAcceptableDataDirection

Ticket: 7667
pull/13419/head
Philippe Antoine 2 months ago committed by Victor Julien
parent 1ff4dbfc24
commit 7bfef2e1e8

@ -539,7 +539,6 @@ pub const APP_LAYER_TX_ACCEPT: u8 = BIT_U8!(4);
extern "C" { extern "C" {
pub fn AppLayerParserConfParserEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int; pub fn AppLayerParserConfParserEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int;
pub fn AppLayerParserRegisterLogger(pproto: u8, alproto: AppProto); pub fn AppLayerParserRegisterLogger(pproto: u8, alproto: AppProto);
pub fn AppLayerParserRegisterParserAcceptableDataDirection(ipproto: u8, alproto: AppProto, dir: u8);
} }
#[repr(C)] #[repr(C)]

@ -30,8 +30,8 @@ use std::collections::VecDeque;
use std::ffi::CString; use std::ffi::CString;
use std::os::raw::{c_char, c_int, c_void}; use std::os::raw::{c_char, c_int, c_void};
use suricata_sys::sys::{ use suricata_sys::sys::{
AppLayerParserState, AppProto, SCAppLayerParserStateIssetFlag, AppLayerParserState, AppProto, SCAppLayerParserRegisterParserAcceptableDataDirection,
SCAppLayerProtoDetectConfProtoDetectionEnabled, SCAppLayerParserStateIssetFlag, SCAppLayerProtoDetectConfProtoDetectionEnabled,
}; };
pub(super) static mut ALPROTO_ENIP: AppProto = ALPROTO_UNKNOWN; pub(super) static mut ALPROTO_ENIP: AppProto = ALPROTO_UNKNOWN;
@ -653,7 +653,7 @@ pub unsafe extern "C" fn SCEnipRegisterParsers() {
let _ = AppLayerRegisterParser(&parser, alproto); let _ = AppLayerRegisterParser(&parser, alproto);
} }
SCLogDebug!("Rust enip parser registered for UDP."); SCLogDebug!("Rust enip parser registered for UDP.");
AppLayerParserRegisterParserAcceptableDataDirection( SCAppLayerParserRegisterParserAcceptableDataDirection(
IPPROTO_UDP, IPPROTO_UDP,
ALPROTO_ENIP, ALPROTO_ENIP,
STREAM_TOSERVER | STREAM_TOCLIENT, STREAM_TOSERVER | STREAM_TOCLIENT,
@ -678,7 +678,7 @@ pub unsafe extern "C" fn SCEnipRegisterParsers() {
let _ = AppLayerRegisterParser(&parser, alproto); let _ = AppLayerRegisterParser(&parser, alproto);
} }
SCLogDebug!("Rust enip parser registered for TCP."); SCLogDebug!("Rust enip parser registered for TCP.");
AppLayerParserRegisterParserAcceptableDataDirection( SCAppLayerParserRegisterParserAcceptableDataDirection(
IPPROTO_TCP, IPPROTO_TCP,
ALPROTO_ENIP, ALPROTO_ENIP,
STREAM_TOSERVER | STREAM_TOCLIENT, STREAM_TOSERVER | STREAM_TOCLIENT,

@ -695,6 +695,11 @@ pub struct AppLayerParserState_ {
_unused: [u8; 0], _unused: [u8; 0],
} }
pub type AppLayerParserState = AppLayerParserState_; pub type AppLayerParserState = AppLayerParserState_;
extern "C" {
pub fn SCAppLayerParserRegisterParserAcceptableDataDirection(
ipproto: u8, alproto: AppProto, direction: u8,
);
}
extern "C" { extern "C" {
pub fn SCAppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32); pub fn SCAppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32);
} }

@ -1287,7 +1287,8 @@ void RegisterFTPParsers(void)
AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_FTP, STREAM_TOCLIENT, AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_FTP, STREAM_TOCLIENT,
FTPParseResponse); FTPParseResponse);
AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_FTP, FTPStateAlloc, FTPStateFree); AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_FTP, FTPStateAlloc, FTPStateFree);
AppLayerParserRegisterParserAcceptableDataDirection(IPPROTO_TCP, ALPROTO_FTP, STREAM_TOSERVER | STREAM_TOCLIENT); SCAppLayerParserRegisterParserAcceptableDataDirection(
IPPROTO_TCP, ALPROTO_FTP, STREAM_TOSERVER | STREAM_TOCLIENT);
AppLayerParserRegisterTxFreeFunc(IPPROTO_TCP, ALPROTO_FTP, FTPStateTransactionFree); AppLayerParserRegisterTxFreeFunc(IPPROTO_TCP, ALPROTO_FTP, FTPStateTransactionFree);
@ -1311,7 +1312,8 @@ void RegisterFTPParsers(void)
AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_FTPDATA, STREAM_TOCLIENT, AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_FTPDATA, STREAM_TOCLIENT,
FTPDataParseResponse); FTPDataParseResponse);
AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_FTPDATA, FTPDataStateAlloc, FTPDataStateFree); AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_FTPDATA, FTPDataStateAlloc, FTPDataStateFree);
AppLayerParserRegisterParserAcceptableDataDirection(IPPROTO_TCP, ALPROTO_FTPDATA, STREAM_TOSERVER | STREAM_TOCLIENT); SCAppLayerParserRegisterParserAcceptableDataDirection(
IPPROTO_TCP, ALPROTO_FTPDATA, STREAM_TOSERVER | STREAM_TOCLIENT);
AppLayerParserRegisterTxFreeFunc(IPPROTO_TCP, ALPROTO_FTPDATA, FTPDataStateTransactionFree); AppLayerParserRegisterTxFreeFunc(IPPROTO_TCP, ALPROTO_FTPDATA, FTPDataStateTransactionFree);
AppLayerParserRegisterGetTxFilesFunc(IPPROTO_TCP, ALPROTO_FTPDATA, FTPDataStateGetTxFiles); AppLayerParserRegisterGetTxFilesFunc(IPPROTO_TCP, ALPROTO_FTPDATA, FTPDataStateGetTxFiles);

@ -2659,7 +2659,7 @@ void RegisterHTPParsers(void)
/* This parser accepts gaps. */ /* This parser accepts gaps. */
AppLayerParserRegisterOptionFlags( AppLayerParserRegisterOptionFlags(
IPPROTO_TCP, ALPROTO_HTTP1, APP_LAYER_PARSER_OPT_ACCEPT_GAPS); IPPROTO_TCP, ALPROTO_HTTP1, APP_LAYER_PARSER_OPT_ACCEPT_GAPS);
AppLayerParserRegisterParserAcceptableDataDirection( SCAppLayerParserRegisterParserAcceptableDataDirection(
IPPROTO_TCP, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_TOCLIENT); IPPROTO_TCP, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_TOCLIENT);
/* app-layer-frame-documentation tag start: registering relevant callbacks */ /* app-layer-frame-documentation tag start: registering relevant callbacks */
AppLayerParserRegisterGetFrameFuncs( AppLayerParserRegisterGetFrameFuncs(

@ -412,8 +412,8 @@ int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto,
SCReturnInt(0); SCReturnInt(0);
} }
void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto, AppProto alproto, void SCAppLayerParserRegisterParserAcceptableDataDirection(
uint8_t direction) uint8_t ipproto, AppProto alproto, uint8_t direction)
{ {
SCEnter(); SCEnter();

@ -171,9 +171,8 @@ int AppLayerParserPreRegister(void (*Register)(void));
int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto, int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto,
uint8_t direction, uint8_t direction,
AppLayerParserFPtr Parser); AppLayerParserFPtr Parser);
void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto, void SCAppLayerParserRegisterParserAcceptableDataDirection(
AppProto alproto, uint8_t ipproto, AppProto alproto, uint8_t direction);
uint8_t direction);
void AppLayerParserRegisterOptionFlags(uint8_t ipproto, AppProto alproto, void AppLayerParserRegisterOptionFlags(uint8_t ipproto, AppProto alproto,
uint32_t flags); uint32_t flags);
void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto, void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto,

@ -3231,7 +3231,8 @@ void RegisterSSLParsers(void)
AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_TLS, SSLStateAlloc, SSLStateFree); AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_TLS, SSLStateAlloc, SSLStateFree);
AppLayerParserRegisterParserAcceptableDataDirection(IPPROTO_TCP, ALPROTO_TLS, STREAM_TOSERVER); SCAppLayerParserRegisterParserAcceptableDataDirection(
IPPROTO_TCP, ALPROTO_TLS, STREAM_TOSERVER);
AppLayerParserRegisterTxFreeFunc(IPPROTO_TCP, ALPROTO_TLS, SSLStateTransactionFree); AppLayerParserRegisterTxFreeFunc(IPPROTO_TCP, ALPROTO_TLS, SSLStateTransactionFree);

Loading…
Cancel
Save