output-tx: use void * instead of OutputCtx

Using OutputCtx results in the low level output-tx packet logger being
aware of Suricata's higher level loggers that use OutputCtx, for the
low level logger this is purely opaque data that may not be an
OutputCtx for custom loggers.

Ticket: #7227
pull/11689/head
Jason Ish 1 year ago committed by Victor Julien
parent bb128e3959
commit 32e2225b7d

@ -49,7 +49,7 @@ typedef struct OutputTxLogger_ {
AppProto alproto;
TxLogger LogFunc;
TxLoggerCondition LogCondition;
OutputCtx *output_ctx;
void *initdata;
struct OutputTxLogger_ *next;
const char *name;
LoggerId logger_id;
@ -63,12 +63,9 @@ typedef struct OutputTxLogger_ {
static OutputTxLogger **list = NULL;
int OutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto,
TxLogger LogFunc,
OutputCtx *output_ctx, int tc_log_progress,
int ts_log_progress, TxLoggerCondition LogCondition,
ThreadInitFunc ThreadInit,
ThreadDeinitFunc ThreadDeinit,
int OutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto, TxLogger LogFunc,
void *initdata, int tc_log_progress, int ts_log_progress, TxLoggerCondition LogCondition,
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
void (*ThreadExitPrintStats)(ThreadVars *, void *))
{
if (list == NULL) {
@ -91,7 +88,7 @@ int OutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto,
op->alproto = alproto;
op->LogFunc = LogFunc;
op->LogCondition = LogCondition;
op->output_ctx = output_ctx;
op->initdata = initdata;
op->name = name;
op->logger_id = id;
op->ThreadInit = ThreadInit;
@ -560,7 +557,7 @@ static TmEcode OutputTxLogThreadInit(ThreadVars *tv, const void *_initdata, void
while (logger) {
if (logger->ThreadInit) {
void *retptr = NULL;
if (logger->ThreadInit(tv, (void *)logger->output_ctx, &retptr) == TM_ECODE_OK) {
if (logger->ThreadInit(tv, logger->initdata, &retptr) == TM_ECODE_OK) {
OutputLoggerThreadStore *ts = SCCalloc(1, sizeof(*ts));
/* todo */ BUG_ON(ts == NULL);

@ -38,12 +38,9 @@ typedef int (*TxLogger)(ThreadVars *, void *thread_data, const Packet *, Flow *f
typedef bool (*TxLoggerCondition)(
ThreadVars *, const Packet *, void *state, void *tx, uint64_t tx_id);
int OutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto,
TxLogger LogFunc,
OutputCtx *, int tc_log_progress, int ts_log_progress,
TxLoggerCondition LogCondition,
ThreadInitFunc, ThreadDeinitFunc,
void (*ThreadExitPrintStats)(ThreadVars *, void *));
int OutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto, TxLogger LogFunc,
void *, int tc_log_progress, int ts_log_progress, TxLoggerCondition LogCondition,
ThreadInitFunc, ThreadDeinitFunc, void (*ThreadExitPrintStats)(ThreadVars *, void *));
void OutputTxLoggerRegister (void);

Loading…
Cancel
Save