Go to the documentation of this file.
25 #ifndef SURICATA_UTIL_FILE_H
26 #define SURICATA_UTIL_FILE_H
37 #define SC_SHA256_LEN 32
40 #define SC_SHA1_LEN 20
45 #define FILE_TRUNCATED BIT_U16(0)
46 #define FILE_NOMAGIC BIT_U16(1)
47 #define FILE_NOMD5 BIT_U16(2)
48 #define FILE_MD5 BIT_U16(3)
49 #define FILE_NOSHA1 BIT_U16(4)
50 #define FILE_SHA1 BIT_U16(5)
51 #define FILE_NOSHA256 BIT_U16(6)
52 #define FILE_SHA256 BIT_U16(7)
53 #define FILE_LOGGED BIT_U16(8)
54 #define FILE_NOSTORE BIT_U16(9)
55 #define FILE_STORE BIT_U16(10)
56 #define FILE_STORED BIT_U16(11)
57 #define FILE_NOTRACK BIT_U16(12)
58 #define FILE_USE_DETECT BIT_U16(13)
59 #define FILE_HAS_GAPS BIT_U16(15)
62 #define SC_FILENAME_MAX 4096
64 #define FILEDATA_CONTENT_LIMIT 100000
65 #define FILEDATA_CONTENT_INSPECT_MIN_SIZE 32768
66 #define FILEDATA_CONTENT_INSPECT_WINDOW 4096
146 uint32_t track_id,
const uint8_t *name, uint16_t name_len,
147 const uint8_t *data, uint32_t data_len, uint16_t
flags);
161 uint32_t data_len, uint16_t
flags);
163 const uint8_t *data, uint32_t data_len, uint16_t
flags);
165 uint32_t data_len, uint16_t
flags);
181 const uint8_t *data, uint32_t data_len);
183 const uint8_t *data, uint32_t data_len);
250 #define FilePrintFlags(file)
uint16_t FileFlowToFlags(const Flow *flow, uint8_t direction)
void FileContainerRecycle(FileContainer *, const StreamingBufferConfig *cfg)
Recycle a FileContainer.
void FileForceMagicEnable(void)
int FileCloseFile(FileContainer *, const StreamingBufferConfig *sbcfg, const uint8_t *data, uint32_t data_len, uint16_t flags)
Close a File.
uint32_t FileReassemblyDepth(void)
uint32_t inspect_min_size
int FileOpenFileWithId(FileContainer *, const StreamingBufferConfig *, uint32_t track_id, const uint8_t *name, uint16_t name_len, const uint8_t *data, uint32_t data_len, uint16_t flags)
Open a new File.
int FileStore(File *)
Tag a file for storing.
void FileForceSha1Enable(void)
void FileReassemblyDepthEnable(uint32_t size)
struct FileContainer_ FileContainer
uint8_t sha1[SC_SHA1_LEN]
int FileCloseFileById(FileContainer *, const StreamingBufferConfig *sbcfg, uint32_t track_id, const uint8_t *data, uint32_t data_len, uint16_t flags)
void FileForceTrackingEnable(void)
uint64_t FileTrackedSize(const File *file)
get the size of the file
void FileForceMd5Enable(void)
int FileForceFilestore(void)
int FileSetRange(FileContainer *, uint64_t start, uint64_t end)
Sets the offset range for a file.
int FileAppendGAPById(FileContainer *ffc, const StreamingBufferConfig *sbcfg, uint32_t track_id, const uint8_t *data, uint32_t data_len)
Store/handle a chunk of file data in the File structure The file with 'track_id' in the FileContainer...
void FileSetInspectSizes(File *file, const uint32_t win, const uint32_t min)
int FileAppendData(FileContainer *, const StreamingBufferConfig *sbcfg, const uint8_t *data, uint32_t data_len)
Store a chunk of file data in the flow. The open "flowfile" will be used.
void FileForceFilestoreEnable(void)
uint64_t content_inspected
void FileContainerFree(FileContainer *, const StreamingBufferConfig *cfg)
Free a FileContainer.
void FileContainerAdd(FileContainer *, File *)
uint8_t sha256[SC_SHA256_LEN]
#define FilePrintFlags(file)
uint64_t FileDataSize(const File *file)
get the size of the file data
void FilesPrune(FileContainer *fc, const StreamingBufferConfig *sbcfg, const bool trunc)
void FileForceSha256Enable(void)
void FileDisableStoringForTransaction(Flow *f, const uint8_t direction, void *tx, uint64_t tx_id)
disable file storing for a transaction
uint16_t FileFlowFlagsToFlags(const uint16_t flow_file_flags, uint8_t direction)
int FileCloseFilePtr(File *ff, const StreamingBufferConfig *sbcfg, const uint8_t *data, uint32_t data_len, uint16_t flags)
int FileForceSha256(void)
void FileForceHashParseCfg(ConfNode *)
Function to parse forced file hashing configuration.
FileContainer * FileContainerAlloc(void)
allocate a FileContainer
enum FileState_ FileState
int FileAppendDataById(FileContainer *, const StreamingBufferConfig *sbcfg, uint32_t track_id, const uint8_t *data, uint32_t data_len)
Store/handle a chunk of file data in the File structure The file with 'track_id' in the FileContainer...
void FileStoreFileById(FileContainer *fc, uint32_t)
flag a file with id "file_id" to be stored.
void FileUpdateFlowFileFlags(Flow *f, uint16_t set_file_flags, uint8_t direction)
set a flow's file flags