smb: split probing function for code style

Introduces rs_smb_probe_tcp_midstream

(cherry picked from commit 9dc5258a21)
pull/5962/head
Philippe Antoine 6 years ago committed by Victor Julien
parent 61718deabd
commit fe50461346

@ -1905,15 +1905,8 @@ pub extern "C" fn rs_smb_parse_response_tcp_gap(
state.parse_tcp_data_tc_gap(input_len as u32)
}
// probing parser
// return 1 if found, 0 is not found
#[no_mangle]
pub extern "C" fn rs_smb_probe_tcp(direction: u8,
input: *const u8, len: u32,
rdir: *mut u8)
-> i8
fn rs_smb_probe_tcp_midstream(direction: u8, slice: &[u8], rdir: *mut u8) -> i8
{
let slice = build_slice!(input, len as usize);
match search_smb_record(slice) {
Ok((_, ref data)) => {
SCLogDebug!("smb found");
@ -1972,6 +1965,21 @@ pub extern "C" fn rs_smb_probe_tcp(direction: u8,
SCLogDebug!("no dice");
},
}
return 0;
}
// probing parser
// return 1 if found, 0 is not found
#[no_mangle]
pub extern "C" fn rs_smb_probe_tcp(flags: u8,
input: *const u8, len: u32,
rdir: *mut u8)
-> i8
{
let slice = build_slice!(input, len as usize);
if rs_smb_probe_tcp_midstream(flags, slice, rdir) == 1 {
return 1;
}
match parse_nbss_record_partial(slice) {
Ok((_, ref hdr)) => {
if hdr.is_smb() {

Loading…
Cancel
Save