applayer: add flags to parser registration struct

This will allow Rust parsers to register for gap handing from
Rust (some Rust parsers do handle gaps, but they set the flag
from C).
pull/5184/head
Jason Ish 6 years ago
parent 7476399f43
commit 53aa967e0b

@ -228,6 +228,8 @@ pub struct RustParser {
// the requests and responses are not sharing tx. It is then up to
// the implementation to make sure the config is applied correctly.
pub apply_tx_config: Option<ApplyTxConfigFn>,
pub flags: u32,
}
/// Create a slice, given a buffer and a length

@ -518,6 +518,7 @@ pub unsafe extern "C" fn rs_template_register_parser() {
get_tx_iterator: Some(rs_template_state_get_tx_iterator),
get_tx_data: rs_template_get_tx_data,
apply_tx_config: None,
flags: 0,
};
let ip_proto_str = CString::new("tcp").unwrap();

@ -437,6 +437,7 @@ pub unsafe extern "C" fn rs_dhcp_register_parser() {
get_tx_iterator : Some(rs_dhcp_state_get_tx_iterator),
get_tx_data : rs_dhcp_get_tx_data,
apply_tx_config : None,
flags : 0,
};
let ip_proto_str = CString::new("udp").unwrap();

@ -1038,6 +1038,7 @@ pub unsafe extern "C" fn rs_dns_udp_register_parser() {
set_de_state: rs_dns_state_set_tx_detect_state,
get_tx_data: rs_dns_state_get_tx_data,
apply_tx_config: Some(rs_dns_apply_tx_config),
flags: 0,
};
let ip_proto_str = CString::new("udp").unwrap();
@ -1083,6 +1084,7 @@ pub unsafe extern "C" fn rs_dns_tcp_register_parser() {
set_de_state: rs_dns_state_set_tx_detect_state,
get_tx_data: rs_dns_state_get_tx_data,
apply_tx_config: Some(rs_dns_apply_tx_config),
flags: 0,
};
let ip_proto_str = CString::new("tcp").unwrap();

@ -712,6 +712,7 @@ pub unsafe extern "C" fn rs_register_ikev2_parser() {
get_tx_iterator : None,
get_tx_data : rs_ikev2_get_tx_data,
apply_tx_config : None,
flags : 0,
};
let ip_proto_str = CString::new("udp").unwrap();

@ -658,6 +658,7 @@ pub unsafe extern "C" fn rs_register_krb5_parser() {
get_tx_iterator : None,
get_tx_data : rs_krb5_get_tx_data,
apply_tx_config : None,
flags : 0,
};
// register UDP parser
let ip_proto_str = CString::new("udp").unwrap();

@ -408,6 +408,7 @@ pub unsafe extern "C" fn rs_register_ntp_parser() {
get_tx_iterator : None,
get_tx_data : rs_ntp_get_tx_data,
apply_tx_config : None,
flags : 0,
};
let ip_proto_str = CString::new("udp").unwrap();

@ -534,6 +534,7 @@ pub unsafe extern "C" fn rs_rdp_register_parser() {
get_tx_iterator: None,
get_tx_data: rs_rdp_get_tx_data,
apply_tx_config: None,
flags: 0,
};
let ip_proto_str = std::ffi::CString::new("tcp").unwrap();

@ -700,6 +700,7 @@ pub unsafe extern "C" fn rs_rfb_register_parser() {
get_tx_iterator: Some(rs_rfb_state_get_tx_iterator),
get_tx_data: rs_rfb_get_tx_data,
apply_tx_config: None,
flags: 0,
};
let ip_proto_str = CString::new("tcp").unwrap();

@ -393,6 +393,7 @@ pub unsafe extern "C" fn rs_sip_register_parser() {
get_tx_iterator: None,
get_tx_data: rs_sip_get_tx_data,
apply_tx_config: None,
flags: 0,
};
let ip_proto_str = CString::new("udp").unwrap();

@ -586,6 +586,7 @@ pub unsafe extern "C" fn rs_register_snmp_parser() {
get_tx_iterator : None,
get_tx_data : rs_snmp_get_tx_data,
apply_tx_config : None,
flags : 0,
};
let ip_proto_str = CString::new("udp").unwrap();
if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {

@ -560,6 +560,7 @@ pub unsafe extern "C" fn rs_ssh_register_parser() {
get_tx_iterator: None,
get_tx_data: rs_ssh_get_tx_data,
apply_tx_config: None,
flags: 0,
};
let ip_proto_str = CString::new("tcp").unwrap();

@ -176,6 +176,12 @@ int AppLayerRegisterParser(const struct AppLayerParser *p, AppProto alproto)
p->ApplyTxConfig);
}
if (p->flags) {
AppLayerParserRegisterOptionFlags(p->ip_proto, alproto,
p->flags);
}
return 0;
}

@ -68,6 +68,8 @@ typedef struct AppLayerParser {
AppLayerTxData *(*GetTxData)(void *tx);
bool (*ApplyTxConfig)(void *state, void *tx, int mode, AppLayerTxConfig);
uint32_t flags;
} AppLayerParser;
/**

Loading…
Cancel
Save