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" {
pub fn AppLayerParserConfParserEnabled(ipproto: *const c_char, proto: *const c_char) -> c_int;
pub fn AppLayerParserRegisterLogger(pproto: u8, alproto: AppProto);
pub fn AppLayerParserRegisterParserAcceptableDataDirection(ipproto: u8, alproto: AppProto, dir: u8);
}
#[repr(C)]

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

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

@ -1287,7 +1287,8 @@ void RegisterFTPParsers(void)
AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_FTP, STREAM_TOCLIENT,
FTPParseResponse);
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);
@ -1311,7 +1312,8 @@ void RegisterFTPParsers(void)
AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_FTPDATA, STREAM_TOCLIENT,
FTPDataParseResponse);
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);
AppLayerParserRegisterGetTxFilesFunc(IPPROTO_TCP, ALPROTO_FTPDATA, FTPDataStateGetTxFiles);

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

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

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

@ -3231,7 +3231,8 @@ void RegisterSSLParsers(void)
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);

Loading…
Cancel
Save