Go to the documentation of this file.
81 SCLogDebug(
"OutputRegisterFiledataLogger happy");
89 void *tx,
const uint64_t tx_id,
const uint8_t *data, uint32_t data_len, uint8_t
flags,
96 while (logger && store) {
107 logger = logger->
next;
116 static void CloseFile(
const Packet *p,
Flow *f,
File *file,
void *txv)
129 AppLayerGetFileState files,
void *txv,
const uint64_t tx_id,
AppLayerTxData *txd,
130 const uint8_t call_flags,
const bool file_close,
const bool file_trunc,
const uint8_t dir)
135 for (
File *ff = files.fc->head; ff != NULL; ff = ff->
next) {
139 uint8_t file_flags = call_flags;
142 FilemagicThreadLookup(&td->magic_ctx, ff);
167 CallLoggers(
tv, store, p, ff, txv, tx_id, NULL, 0, file_flags, dir);
168 CloseFile(p, p->
flow, ff, txv);
183 const uint8_t *data = NULL;
184 uint32_t data_len = 0;
188 const int file_logged =
189 CallLoggers(
tv, store, p, ff, txv, tx_id, data, data_len, file_flags, dir);
195 CloseFile(p, p->
flow, ff, txv);
212 td->magic_ctx = MagicInitContext();
213 if (td->magic_ctx == NULL) {
219 SCLogDebug(
"OutputFiledataLogThreadInit happy (*data %p)", *data);
230 ts->thread_data = retptr;
232 if (td->
store == NULL) {
236 while (tmp->
next != NULL)
245 logger = logger->
next;
256 while (logger && store) {
264 logger = logger->
next;
268 MagicDeinitContext(op_thread_data->magic_ctx);
287 logger = next_logger;
TmEcode OutputFiledataLogThreadInit(ThreadVars *tv, OutputFiledataLoggerThreadData **data)
thread init for the filedata logger This will run the thread init functions for the individual regist...
OutputLoggerThreadStore * store
#define SC_ATOMIC_INIT(name)
wrapper for initializing an atomic variable.
#define SC_ATOMIC_SET(name, val)
Set the value for the atomic variable.
ThreadDeinitFunc ThreadDeinit
TmEcode OutputFiledataLogThreadDeinit(ThreadVars *tv, OutputFiledataLoggerThreadData *op_thread_data)
#define SC_ATOMIC_ADD(name, val)
add a value to our atomic variable
void OutputFiledataShutdown(void)
struct OutputLoggerThreadStore_ * next
struct OutputFiledataLogger_ * next
int StreamingBufferGetDataAtOffset(const StreamingBuffer *sb, const uint8_t **data, uint32_t *data_len, uint64_t offset)
#define OUTPUT_FILEDATA_FLAG_CLOSE
int OutputRegisterFiledataLogger(LoggerId id, const char *name, FiledataLogger LogFunc, OutputCtx *output_ctx, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
SC_ATOMIC_DECLARE(unsigned int, g_file_store_id)
void FileApplyTxFlags(const AppLayerTxData *txd, const uint8_t direction, File *file)
int(* FiledataLogger)(ThreadVars *, void *thread_data, const Packet *, File *, void *tx, const uint64_t tx_id, const uint8_t *, uint32_t, uint8_t, uint8_t dir)
Per thread variable structure.
TmEcode(* ThreadInitFunc)(ThreadVars *, const void *, void **)
int FileCloseFilePtr(File *ff, const StreamingBufferConfig *sbcfg, const uint8_t *data, uint32_t data_len, uint16_t flags)
void OutputFiledataLogFfc(ThreadVars *tv, OutputFiledataLoggerThreadData *td, Packet *p, AppLayerGetFileState files, void *txv, const uint64_t tx_id, AppLayerTxData *txd, const uint8_t call_flags, const bool file_close, const bool file_trunc, const uint8_t dir)
uint64_t FileDataSize(const File *file)
get the size of the file data
#define PACKET_PROFILING_LOGGER_END(p, id)
struct AppLayerTxData AppLayerTxData
struct OutputFiledataLogger_ OutputFiledataLogger
void(* ThreadExitPrintStatsFunc)(ThreadVars *, void *)
#define OUTPUT_FILEDATA_FLAG_OPEN
AppLayerTxData * AppLayerParserGetTxData(uint8_t ipproto, AppProto alproto, void *tx)
ThreadExitPrintStatsFunc ThreadExitPrintStats
#define FilePrintFlags(file)
#define PACKET_PROFILING_LOGGER_START(p, id)
bool g_filedata_logger_enabled
ThreadInitFunc ThreadInit
AppProto alproto
application level protocol
void OutputFiledataLoggerRegister(void)
#define DEBUG_VALIDATE_BUG_ON(exp)
TmEcode(* ThreadDeinitFunc)(ThreadVars *, void *)