pub const FILE_USE_DETECT: u16 = 0x2000;
+// Generic file structure, so it can be used by different protocols
+#[derive(Debug)]
+pub struct Files {
+ pub files_ts: FileContainer,
+ pub files_tc: FileContainer,
+ pub flags_ts: u16,
+ pub flags_tc: u16,
+}
+
+impl Files {
+ pub fn new() -> Files {
+ Files {
+ 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)
+ }
+ }
+}
+
pub struct File;
#[repr(C)]
#[derive(Debug)]
+++ /dev/null
-/* 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)
- }
- }
-}
* 02110-1301, USA.
*/
-use super::files::*;
use super::parser;
use crate::applayer::{self, *};
use crate::core::{
dynamic_headers_tc: HTTP2DynTable,
transactions: Vec<HTTP2Transaction>,
progress: HTTP2ConnectionState,
- pub files: HTTP2Files,
+ pub files: Files,
}
impl HTTP2State {
dynamic_headers_tc: HTTP2DynTable::new(),
transactions: Vec::new(),
progress: HTTP2ConnectionState::Http2StateInit,
- files: HTTP2Files::new(),
+ files: Files::new(),
}
}
*/
pub mod detect;
-pub mod files;
pub mod http2;
mod huffman;
pub mod logger;
}
}
-#[derive(Debug)]
-pub struct NFSFiles {
- pub files_ts: FileContainer,
- pub files_tc: FileContainer,
- pub flags_ts: u16,
- pub flags_tc: u16,
-}
-
-impl NFSFiles {
- pub fn new() -> NFSFiles {
- NFSFiles {
- 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)
- }
- }
-}
-
/// little wrapper around the FileTransferTracker::new_chunk method
pub fn filetracker_newchunk(ft: &mut FileTransferTracker, files: &mut FileContainer,
flags: u16, name: &Vec<u8>, data: &[u8],
/// transactions list
pub transactions: Vec<NFSTransaction>,
- pub files: NFSFiles,
+ pub files: Files,
/// partial record tracking
pub ts_chunk_xid: u32,
requestmap:HashMap::new(),
namemap:HashMap::new(),
transactions: Vec::new(),
- files:NFSFiles::new(),
+ files:Files::new(),
ts_chunk_xid:0,
tc_chunk_xid:0,
ts_chunk_left:0,
}
}
-/// Wrapper around Suricata's internal file container logic.
-#[derive(Debug)]
-pub struct SMBFiles {
- pub files_ts: FileContainer,
- pub files_tc: FileContainer,
- pub flags_ts: u16,
- pub flags_tc: u16,
-}
-
-impl SMBFiles {
- pub fn new() -> SMBFiles {
- SMBFiles {
- 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)
- }
- }
-}
-
/// little wrapper around the FileTransferTracker::new_chunk method
pub fn filetracker_newchunk(ft: &mut FileTransferTracker, files: &mut FileContainer,
flags: u16, name: &Vec<u8>, data: &[u8],
use crate::core::*;
use crate::applayer;
use crate::applayer::{AppLayerResult, AppLayerTxData};
+use crate::filecontainer::*;
use crate::smb::nbss_records::*;
use crate::smb::smb1_records::*;
// requests for DCERPC.
pub ssnguid2vec_map: HashMap<SMBHashKeyHdrGuid, Vec<u8>>,
- pub files: SMBFiles,
+ pub files: Files,
skip_ts: u32,
skip_tc: u32,
ssn2vecoffset_map:HashMap::new(),
ssn2tree_map:HashMap::new(),
ssnguid2vec_map:HashMap::new(),
- files: SMBFiles::new(),
+ files: Files::new(),
skip_ts:0,
skip_tc:0,
file_ts_left:0,