mirror of https://github.com/OISF/suricata
Rust: generic files definition
Issue: Optimization 3825 - filecontainer: add Files structure, to replace/unify SMBFiles, NFSFiles and HTTP2Files - smb/files: delete SMBFiles implementation - smb/smb: replace SMBFiles with Files - nfs/nfs: delete NFSFiles implementation, replace its former declarations with Files' ones - http2/http2: replace HTTP2Files with Files - http2/mod: Delete reference to file files.rs - http2/files: Deletepull/5646/head
parent
d2144c0dfb
commit
5226ba1c15
@ -1,51 +0,0 @@
|
||||
/* Copyright (C) 2020 Open Information Security Foundation
|
||||
*
|
||||
* You can copy, redistribute or modify this Program under the terms of
|
||||
* the GNU General Public License version 2 as published by the Free
|
||||
* Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* version 2 along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
use crate::core::*;
|
||||
use crate::filecontainer::*;
|
||||
|
||||
/// Wrapper around Suricata's internal file container logic.
|
||||
#[derive(Debug)]
|
||||
pub struct HTTP2Files {
|
||||
pub files_ts: FileContainer,
|
||||
pub files_tc: FileContainer,
|
||||
pub flags_ts: u16,
|
||||
pub flags_tc: u16,
|
||||
}
|
||||
|
||||
impl HTTP2Files {
|
||||
pub fn new() -> HTTP2Files {
|
||||
HTTP2Files {
|
||||
files_ts: FileContainer::default(),
|
||||
files_tc: FileContainer::default(),
|
||||
flags_ts: 0,
|
||||
flags_tc: 0,
|
||||
}
|
||||
}
|
||||
pub fn free(&mut self) {
|
||||
self.files_ts.free();
|
||||
self.files_tc.free();
|
||||
}
|
||||
|
||||
pub fn get(&mut self, direction: u8) -> (&mut FileContainer, u16) {
|
||||
if direction == STREAM_TOSERVER {
|
||||
(&mut self.files_ts, self.flags_ts)
|
||||
} else {
|
||||
(&mut self.files_tc, self.flags_tc)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue