rust: add tx detect flags function to registration struct

pull/4405/head
Jason Ish 6 years ago
parent 20bc08a722
commit cde49ec246

@ -544,6 +544,8 @@ pub unsafe extern "C" fn rs_template_register_parser() {
set_tx_mpm_id: None, set_tx_mpm_id: None,
get_files: None, get_files: None,
get_tx_iterator: Some(rs_template_state_get_tx_iterator), get_tx_iterator: Some(rs_template_state_get_tx_iterator),
get_tx_detect_flags: None,
set_tx_detect_flags: None,
}; };
let ip_proto_str = CString::new("tcp").unwrap(); let ip_proto_str = CString::new("tcp").unwrap();

@ -452,6 +452,8 @@ pub unsafe extern "C" fn rs_dhcp_register_parser() {
set_tx_mpm_id : None, set_tx_mpm_id : None,
get_files : None, get_files : None,
get_tx_iterator : Some(rs_dhcp_state_get_tx_iterator), get_tx_iterator : Some(rs_dhcp_state_get_tx_iterator),
set_tx_detect_flags: None,
get_tx_detect_flags: None,
}; };
let ip_proto_str = CString::new("udp").unwrap(); let ip_proto_str = CString::new("udp").unwrap();

@ -730,6 +730,8 @@ pub unsafe extern "C" fn rs_register_ikev2_parser() {
set_tx_mpm_id : None, set_tx_mpm_id : None,
get_files : None, get_files : None,
get_tx_iterator : None, get_tx_iterator : None,
get_tx_detect_flags: None,
set_tx_detect_flags: None,
}; };
let ip_proto_str = CString::new("udp").unwrap(); let ip_proto_str = CString::new("udp").unwrap();

@ -669,6 +669,8 @@ pub unsafe extern "C" fn rs_register_krb5_parser() {
set_tx_mpm_id : None, set_tx_mpm_id : None,
get_files : None, get_files : None,
get_tx_iterator : None, get_tx_iterator : None,
get_tx_detect_flags: None,
set_tx_detect_flags: None,
}; };
// register UDP parser // register UDP parser
let ip_proto_str = CString::new("udp").unwrap(); let ip_proto_str = CString::new("udp").unwrap();

@ -429,6 +429,8 @@ pub unsafe extern "C" fn rs_register_ntp_parser() {
set_tx_mpm_id : None, set_tx_mpm_id : None,
get_files : None, get_files : None,
get_tx_iterator : None, get_tx_iterator : None,
get_tx_detect_flags: None,
set_tx_detect_flags: None,
}; };
let ip_proto_str = CString::new("udp").unwrap(); let ip_proto_str = CString::new("udp").unwrap();

@ -100,6 +100,12 @@ pub struct RustParser {
/// Function to get the TX iterator /// Function to get the TX iterator
pub get_tx_iterator: Option<GetTxIteratorFn>, pub get_tx_iterator: Option<GetTxIteratorFn>,
// Function to set TX detect flags.
pub set_tx_detect_flags: Option<SetTxDetectFlagsFn>,
// Function to get TX detect flags.
pub get_tx_detect_flags: Option<GetTxDetectFlagsFn>,
} }
@ -154,6 +160,8 @@ pub type GetTxIteratorFn = extern "C" fn (ipproto: u8, alproto: AppProto,
max_tx_id: u64, max_tx_id: u64,
istate: &mut u64) istate: &mut u64)
-> AppLayerGetTxIterTuple; -> AppLayerGetTxIterTuple;
pub type GetTxDetectFlagsFn = unsafe extern "C" fn(*mut c_void, u8) -> u64;
pub type SetTxDetectFlagsFn = unsafe extern "C" fn(*mut c_void, u8, u64);
// Defined in app-layer-register.h // Defined in app-layer-register.h
extern { extern {
@ -185,4 +193,10 @@ extern {
pub fn AppLayerParserStateIssetFlag(state: *mut c_void, flag: u8) -> c_int; pub fn AppLayerParserStateIssetFlag(state: *mut c_void, flag: u8) -> c_int;
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 AppLayerParserRegisterGetTxIterator(ipproto: u8, alproto: AppProto, fun: AppLayerGetTxIteratorFn); pub fn AppLayerParserRegisterGetTxIterator(ipproto: u8, alproto: AppProto, fun: AppLayerGetTxIteratorFn);
pub fn AppLayerParserRegisterDetectFlagsFuncs(
ipproto: u8,
alproto: AppProto,
GetTxDetectFlats: GetTxDetectFlagsFn,
SetTxDetectFlags: SetTxDetectFlagsFn,
);
} }

@ -531,6 +531,8 @@ pub unsafe extern "C" fn rs_rdp_register_parser() {
set_tx_mpm_id: None, set_tx_mpm_id: None,
get_files: None, get_files: None,
get_tx_iterator: None, get_tx_iterator: None,
get_tx_detect_flags: None,
set_tx_detect_flags: None,
}; };
/* For 5.0 we want this disabled by default, so check that it /* For 5.0 we want this disabled by default, so check that it

@ -422,6 +422,8 @@ pub unsafe extern "C" fn rs_sip_register_parser() {
set_tx_mpm_id: None, set_tx_mpm_id: None,
get_files: None, get_files: None,
get_tx_iterator: None, get_tx_iterator: None,
get_tx_detect_flags: None,
set_tx_detect_flags: None,
}; };
/* For 5.0 we want this disabled by default, so check that it /* For 5.0 we want this disabled by default, so check that it

@ -607,6 +607,8 @@ pub unsafe extern "C" fn rs_register_snmp_parser() {
set_tx_mpm_id : None, set_tx_mpm_id : None,
get_files : None, get_files : None,
get_tx_iterator : None, get_tx_iterator : None,
get_tx_detect_flags: None,
set_tx_detect_flags: None,
}; };
let ip_proto_str = CString::new("udp").unwrap(); let ip_proto_str = CString::new("udp").unwrap();
if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 { if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {

Loading…
Cancel
Save