Go to the documentation of this file.
77 SCLogDebug(
"OutputRegisterFiledataLogger happy");
85 void *tx,
const uint64_t tx_id,
const uint8_t *data, uint32_t data_len, uint8_t
flags,
92 while (logger && store) {
103 logger = logger->
next;
112 static void CloseFile(
const Packet *p,
Flow *f,
File *file,
void *txv)
125 AppLayerGetFileState files,
void *txv,
const uint64_t tx_id,
AppLayerTxData *txd,
126 const uint8_t call_flags,
const bool file_close,
const bool file_trunc,
const uint8_t dir)
131 for (
File *ff = files.fc->head; ff != NULL; ff = ff->
next) {
135 uint8_t file_flags = call_flags;
138 FilemagicThreadLookup(&td->magic_ctx, ff);
163 CallLoggers(
tv, store, p, ff, txv, tx_id, NULL, 0, file_flags, dir);
164 CloseFile(p, p->
flow, ff, txv);
179 const uint8_t *data = NULL;
180 uint32_t data_len = 0;
184 const int file_logged =
185 CallLoggers(
tv, store, p, ff, txv, tx_id, data, data_len, file_flags, dir);
191 CloseFile(p, p->
flow, ff, txv);
208 td->magic_ctx = MagicInitContext();
209 if (td->magic_ctx == NULL) {
215 SCLogDebug(
"OutputFiledataLogThreadInit happy (*data %p)", *data);
226 ts->thread_data = retptr;
228 if (td->
store == NULL) {
232 while (tmp->
next != NULL)
241 logger = logger->
next;
252 while (logger && store) {
260 logger = logger->
next;
264 MagicDeinitContext(op_thread_data->magic_ctx);
283 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(* SCFiledataLogger)(ThreadVars *, void *thread_data, const Packet *, File *, void *tx, const uint64_t tx_id, const uint8_t *, uint32_t, uint8_t, uint8_t dir)
File-data logger function pointer type.
int StreamingBufferGetDataAtOffset(const StreamingBuffer *sb, const uint8_t **data, uint32_t *data_len, uint64_t offset)
#define OUTPUT_FILEDATA_FLAG_CLOSE
SC_ATOMIC_DECLARE(unsigned int, g_file_store_id)
void FileApplyTxFlags(const AppLayerTxData *txd, const uint8_t direction, File *file)
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
#define OUTPUT_FILEDATA_FLAG_OPEN
AppLayerTxData * AppLayerParserGetTxData(uint8_t ipproto, AppProto alproto, void *tx)
#define FilePrintFlags(file)
#define PACKET_PROFILING_LOGGER_START(p, id)
int SCOutputRegisterFiledataLogger(LoggerId id, const char *name, SCFiledataLogger LogFunc, void *initdata, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Register a file-data logger.
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 *)