files: use Direction enum

pull/6629/head
Shivani Bhardwaj 4 years ago committed by Victor Julien
parent a19d2b4e1e
commit 0c6e9ac931

@ -37,9 +37,9 @@ pub struct Files {
}
impl Files {
pub fn get(&mut self, direction: u8) -> (&mut FileContainer, u16)
pub fn get(&mut self, direction: Direction) -> (&mut FileContainer, u16)
{
if direction == STREAM_TOSERVER {
if direction == Direction::ToServer {
(&mut self.files_ts, self.flags_ts)
} else {
(&mut self.files_tc, self.flags_tc)

@ -871,7 +871,7 @@ impl HTTP2State {
let index = self.find_tx_index(sid);
if index > 0 {
let tx_same = &mut self.transactions[index - 1];
let (files, flags) = self.files.get(dir);
let (files, flags) = self.files.get(dir.into());
match tx_same.decompress(
&rem[..hlsafe],
dir,

@ -474,7 +474,7 @@ impl NFSState {
if self.ts > f.post_gap_ts {
tx.request_done = true;
tx.response_done = true;
let (files, flags) = self.files.get(tx.file_tx_direction);
let (files, flags) = self.files.get(tx.file_tx_direction.into());
f.file_tracker.trunc(files, flags);
} else {
post_gap_txs = true;
@ -594,7 +594,7 @@ impl NFSState {
tx.id, String::from_utf8_lossy(file_name));
self.transactions.push(tx);
let tx_ref = self.transactions.last_mut();
let (files, flags) = self.files.get(direction);
let (files, flags) = self.files.get(direction.into());
return (tx_ref.unwrap(), files, flags)
}
@ -608,7 +608,7 @@ impl NFSState {
tx.file_handle == fh
{
SCLogDebug!("Found NFS file TX with ID {} XID {:04X}", tx.id, tx.xid);
let (files, flags) = self.files.get(direction);
let (files, flags) = self.files.get(direction.into());
return Some((tx, files, flags));
}
}

@ -77,7 +77,7 @@ impl SMBState {
tx.id, String::from_utf8_lossy(file_name));
self.transactions.push(tx);
let tx_ref = self.transactions.last_mut();
let (files, flags) = self.files.get(direction);
let (files, flags) = self.files.get(direction.into());
return (tx_ref.unwrap(), files, flags)
}
@ -95,7 +95,7 @@ impl SMBState {
if found {
SCLogDebug!("SMB: Found SMB file TX with ID {}", tx.id);
let (files, flags) = self.files.get(direction);
let (files, flags) = self.files.get(direction.into());
return Some((tx, files, flags));
}
}

@ -1131,7 +1131,7 @@ impl SMBState {
if self.ts > f.post_gap_ts {
tx.request_done = true;
tx.response_done = true;
let (files, flags) = self.files.get(f.direction);
let (files, flags) = self.files.get(f.direction.into());
f.file_tracker.trunc(files, flags);
} else {
post_gap_txs = true;

Loading…
Cancel
Save