packet-logger: remove ThreadExitPrintStats

The ThreadExitPrintStats callback was never being used, remove.

Ticket: #7227
pull/11689/head
Jason Ish 1 year ago committed by Victor Julien
parent cdcb395142
commit 8735c02995

@ -93,8 +93,9 @@ static TmEcode ThreadDeinit(ThreadVars *tv, void *data)
static void Init(void)
{
OutputRegisterPacketLogger(LOGGER_USER, "custom-packet-logger", CustomPacketLogger,
CustomPacketLoggerCondition, NULL, ThreadInit, ThreadDeinit, NULL);
OutputRegisterFlowLogger("custom-flow-logger", CustomFlowLogger, NULL, ThreadInit, ThreadDeinit);
CustomPacketLoggerCondition, NULL, ThreadInit, ThreadDeinit);
OutputRegisterFlowLogger(
"custom-flow-logger", CustomFlowLogger, NULL, ThreadInit, ThreadDeinit);
}
const SCPlugin PluginRegistration = {

@ -484,7 +484,7 @@ static int AlertDebugLogLogger(ThreadVars *tv, void *thread_data, const Packet *
void AlertDebugLogRegister(void)
{
OutputRegisterPacketModule(LOGGER_ALERT_DEBUG, MODULE_NAME, "alert-debug",
AlertDebugLogInitCtx, AlertDebugLogLogger, AlertDebugLogCondition,
AlertDebugLogThreadInit, AlertDebugLogThreadDeinit, NULL);
OutputRegisterPacketModule(LOGGER_ALERT_DEBUG, MODULE_NAME, "alert-debug", AlertDebugLogInitCtx,
AlertDebugLogLogger, AlertDebugLogCondition, AlertDebugLogThreadInit,
AlertDebugLogThreadDeinit);
}

@ -76,9 +76,9 @@ int AlertFastLogger(ThreadVars *tv, void *data, const Packet *p);
void AlertFastLogRegister(void)
{
OutputRegisterPacketModule(LOGGER_ALERT_FAST, MODULE_NAME, "fast",
AlertFastLogInitCtx, AlertFastLogger, AlertFastLogCondition,
AlertFastLogThreadInit, AlertFastLogThreadDeinit, NULL);
OutputRegisterPacketModule(LOGGER_ALERT_FAST, MODULE_NAME, "fast", AlertFastLogInitCtx,
AlertFastLogger, AlertFastLogCondition, AlertFastLogThreadInit,
AlertFastLogThreadDeinit);
AlertFastLogRegisterTests();
}

@ -384,8 +384,8 @@ static int AlertSyslogLogger(ThreadVars *tv, void *thread_data, const Packet *p)
void AlertSyslogRegister (void)
{
#ifndef OS_WIN32
OutputRegisterPacketModule(LOGGER_ALERT_SYSLOG, MODULE_NAME, "syslog",
AlertSyslogInitCtx, AlertSyslogLogger, AlertSyslogCondition,
AlertSyslogThreadInit, AlertSyslogThreadDeinit, NULL);
OutputRegisterPacketModule(LOGGER_ALERT_SYSLOG, MODULE_NAME, "syslog", AlertSyslogInitCtx,
AlertSyslogLogger, AlertSyslogCondition, AlertSyslogThreadInit,
AlertSyslogThreadDeinit);
#endif /* !OS_WIN32 */
}

@ -209,9 +209,8 @@ static bool PcapLogCondition(ThreadVars *, void *, const Packet *);
void PcapLogRegister(void)
{
OutputRegisterPacketModule(LOGGER_PCAP, MODULE_NAME, "pcap-log",
PcapLogInitCtx, PcapLog, PcapLogCondition, PcapLogDataInit,
PcapLogDataDeinit, NULL);
OutputRegisterPacketModule(LOGGER_PCAP, MODULE_NAME, "pcap-log", PcapLogInitCtx, PcapLog,
PcapLogCondition, PcapLogDataInit, PcapLogDataDeinit);
PcapLogProfileSetup();
SC_ATOMIC_INIT(thread_cnt);
SC_ATOMIC_SET(thread_cnt, 1); /* first id is 1 */

@ -453,5 +453,5 @@ void EveStreamLogRegister(void)
{
OutputRegisterPacketSubModule(LOGGER_JSON_STREAM, "eve-log", MODULE_NAME, "eve-log.stream",
EveStreamLogInitCtxSub, EveStreamLogger, EveStreamLogCondition, EveStreamLogThreadInit,
EveStreamLogThreadDeinit, NULL);
EveStreamLogThreadDeinit);
}

@ -1024,8 +1024,7 @@ error:
void JsonAlertLogRegister (void)
{
OutputRegisterPacketSubModule(LOGGER_JSON_ALERT, "eve-log", MODULE_NAME,
"eve-log.alert", JsonAlertLogInitCtxSub, JsonAlertLogger,
JsonAlertLogCondition, JsonAlertLogThreadInit, JsonAlertLogThreadDeinit,
NULL);
OutputRegisterPacketSubModule(LOGGER_JSON_ALERT, "eve-log", MODULE_NAME, "eve-log.alert",
JsonAlertLogInitCtxSub, JsonAlertLogger, JsonAlertLogCondition, JsonAlertLogThreadInit,
JsonAlertLogThreadDeinit);
}

@ -450,10 +450,9 @@ static OutputInitResult JsonAnomalyLogInitCtxSub(ConfNode *conf, OutputCtx *pare
void JsonAnomalyLogRegister (void)
{
OutputRegisterPacketSubModule(LOGGER_JSON_ANOMALY, "eve-log", MODULE_NAME,
"eve-log.anomaly", JsonAnomalyLogInitCtxSub, JsonAnomalyLogger,
JsonAnomalyLogCondition, JsonAnomalyLogThreadInit, JsonAnomalyLogThreadDeinit,
NULL);
OutputRegisterPacketSubModule(LOGGER_JSON_ANOMALY, "eve-log", MODULE_NAME, "eve-log.anomaly",
JsonAnomalyLogInitCtxSub, JsonAnomalyLogger, JsonAnomalyLogCondition,
JsonAnomalyLogThreadInit, JsonAnomalyLogThreadDeinit);
OutputRegisterTxSubModule(LOGGER_JSON_ANOMALY, "eve-log", MODULE_NAME,
"eve-log.anomaly", JsonAnomalyLogInitCtxHelper, ALPROTO_UNKNOWN,

@ -105,7 +105,7 @@ void JsonArpLogRegister(void)
{
OutputRegisterPacketSubModule(LOGGER_JSON_ARP, "eve-log", "JsonArpLog", "eve-log.arp",
OutputJsonLogInitSub, JsonArpLogger, JsonArpLogCondition, JsonLogThreadInit,
JsonLogThreadDeinit, NULL);
JsonLogThreadDeinit);
SCLogDebug("ARP JSON logger registered.");
}

@ -390,8 +390,7 @@ static bool JsonDropLogCondition(ThreadVars *tv, void *data, const Packet *p)
void JsonDropLogRegister (void)
{
OutputRegisterPacketSubModule(LOGGER_JSON_DROP, "eve-log", MODULE_NAME,
"eve-log.drop", JsonDropLogInitCtxSub, JsonDropLogger,
JsonDropLogCondition, JsonDropLogThreadInit, JsonDropLogThreadDeinit,
NULL);
OutputRegisterPacketSubModule(LOGGER_JSON_DROP, "eve-log", MODULE_NAME, "eve-log.drop",
JsonDropLogInitCtxSub, JsonDropLogger, JsonDropLogCondition, JsonDropLogThreadInit,
JsonDropLogThreadDeinit);
}

@ -560,5 +560,5 @@ void JsonFrameLogRegister(void)
{
OutputRegisterPacketSubModule(LOGGER_JSON_FRAME, "eve-log", MODULE_NAME, "eve-log.frame",
JsonFrameLogInitCtxSub, JsonFrameLogger, JsonFrameLogCondition, JsonFrameLogThreadInit,
JsonFrameLogThreadDeinit, NULL);
JsonFrameLogThreadDeinit);
}

@ -96,10 +96,10 @@ void JsonMetadataLogRegister (void)
{
OutputRegisterPacketSubModule(LOGGER_JSON_METADATA, "eve-log", MODULE_NAME, "eve-log.metadata",
OutputJsonLogInitSub, JsonMetadataLogger, JsonMetadataLogCondition, JsonLogThreadInit,
JsonLogThreadDeinit, NULL);
JsonLogThreadDeinit);
/* Kept for compatibility. */
OutputRegisterPacketSubModule(LOGGER_JSON_METADATA, "eve-log", MODULE_NAME, "eve-log.vars",
OutputJsonLogInitSub, JsonMetadataLogger, JsonMetadataLogCondition, JsonLogThreadInit,
JsonLogThreadDeinit, NULL);
JsonLogThreadDeinit);
}

@ -48,14 +48,13 @@ typedef struct OutputPacketLogger_ {
LoggerId logger_id;
ThreadInitFunc ThreadInit;
ThreadDeinitFunc ThreadDeinit;
ThreadExitPrintStatsFunc ThreadExitPrintStats;
} OutputPacketLogger;
static OutputPacketLogger *list = NULL;
int OutputRegisterPacketLogger(LoggerId logger_id, const char *name, PacketLogger LogFunc,
PacketLogCondition ConditionFunc, void *initdata, ThreadInitFunc ThreadInit,
ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
ThreadDeinitFunc ThreadDeinit)
{
OutputPacketLogger *op = SCCalloc(1, sizeof(*op));
if (op == NULL)
@ -67,7 +66,6 @@ int OutputRegisterPacketLogger(LoggerId logger_id, const char *name, PacketLogge
op->name = name;
op->ThreadInit = ThreadInit;
op->ThreadDeinit = ThreadDeinit;
op->ThreadExitPrintStats = ThreadExitPrintStats;
op->logger_id = logger_id;
if (list == NULL)
@ -184,22 +182,6 @@ static TmEcode OutputPacketLogThreadDeinit(ThreadVars *tv, void *thread_data)
return TM_ECODE_OK;
}
static void OutputPacketLogExitPrintStats(ThreadVars *tv, void *thread_data)
{
OutputPacketLoggerThreadData *op_thread_data = (OutputPacketLoggerThreadData *)thread_data;
OutputLoggerThreadStore *store = op_thread_data->store;
OutputPacketLogger *logger = list;
while (logger && store) {
if (logger->ThreadExitPrintStats) {
logger->ThreadExitPrintStats(tv, store->thread_data);
}
logger = logger->next;
store = store->next;
}
}
static uint32_t OutputPacketLoggerGetActiveCount(void)
{
uint32_t cnt = 0;
@ -211,9 +193,8 @@ static uint32_t OutputPacketLoggerGetActiveCount(void)
void OutputPacketLoggerRegister(void)
{
OutputRegisterRootLogger(OutputPacketLogThreadInit,
OutputPacketLogThreadDeinit, OutputPacketLogExitPrintStats,
OutputPacketLog, OutputPacketLoggerGetActiveCount);
OutputRegisterRootLogger(OutputPacketLogThreadInit, OutputPacketLogThreadDeinit, NULL,
OutputPacketLog, OutputPacketLoggerGetActiveCount);
}
void OutputPacketShutdown(void)

@ -38,8 +38,7 @@ typedef int (*PacketLogger)(ThreadVars *, void *thread_data, const Packet *);
typedef bool (*PacketLogCondition)(ThreadVars *, void *thread_data, const Packet *);
int OutputRegisterPacketLogger(LoggerId logger_id, const char *name, PacketLogger LogFunc,
PacketLogCondition ConditionFunc, void *initdata, ThreadInitFunc, ThreadDeinitFunc,
ThreadExitPrintStatsFunc);
PacketLogCondition ConditionFunc, void *initdata, ThreadInitFunc, ThreadDeinitFunc);
void OutputPacketLoggerRegister(void);

@ -167,11 +167,9 @@ error:
*
* \retval Returns 0 on success, -1 on failure.
*/
void OutputRegisterPacketModule(LoggerId id, const char *name,
const char *conf_name, OutputInitFunc InitFunc,
PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc,
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
ThreadExitPrintStatsFunc ThreadExitPrintStats)
void OutputRegisterPacketModule(LoggerId id, const char *name, const char *conf_name,
OutputInitFunc InitFunc, PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc,
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
{
if (unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
goto error;
@ -190,7 +188,6 @@ void OutputRegisterPacketModule(LoggerId id, const char *name,
module->PacketConditionFunc = PacketConditionFunc;
module->ThreadInit = ThreadInit;
module->ThreadDeinit = ThreadDeinit;
module->ThreadExitPrintStats = ThreadExitPrintStats;
TAILQ_INSERT_TAIL(&output_modules, module, entries);
SCLogDebug("Packet logger \"%s\" registered.", name);
@ -207,11 +204,10 @@ error:
*
* \retval Returns 0 on success, -1 on failure.
*/
void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name,
const char *name, const char *conf_name, OutputInitSubFunc InitFunc,
PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc,
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
ThreadExitPrintStatsFunc ThreadExitPrintStats)
void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name, const char *name,
const char *conf_name, OutputInitSubFunc InitFunc, PacketLogger PacketLogFunc,
PacketLogCondition PacketConditionFunc, ThreadInitFunc ThreadInit,
ThreadDeinitFunc ThreadDeinit)
{
if (unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
goto error;
@ -231,7 +227,6 @@ void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name,
module->PacketConditionFunc = PacketConditionFunc;
module->ThreadInit = ThreadInit;
module->ThreadDeinit = ThreadDeinit;
module->ThreadExitPrintStats = ThreadExitPrintStats;
TAILQ_INSERT_TAIL(&output_modules, module, entries);
SCLogDebug("Packet logger \"%s\" registered.", name);

@ -87,15 +87,12 @@ extern OutputModuleList output_modules;
void OutputRegisterModule(const char *, const char *, OutputInitFunc);
void OutputRegisterPacketModule(LoggerId id, const char *name,
const char *conf_name, OutputInitFunc InitFunc, PacketLogger LogFunc,
PacketLogCondition ConditionFunc, ThreadInitFunc, ThreadDeinitFunc,
ThreadExitPrintStatsFunc);
void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name,
const char *name, const char *conf_name, OutputInitSubFunc InitFunc,
PacketLogger LogFunc, PacketLogCondition ConditionFunc,
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
ThreadExitPrintStatsFunc ThreadExitPrintStats);
void OutputRegisterPacketModule(LoggerId id, const char *name, const char *conf_name,
OutputInitFunc InitFunc, PacketLogger LogFunc, PacketLogCondition ConditionFunc,
ThreadInitFunc, ThreadDeinitFunc);
void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name, const char *name,
const char *conf_name, OutputInitSubFunc InitFunc, PacketLogger LogFunc,
PacketLogCondition ConditionFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit);
void OutputRegisterTxModule(LoggerId id, const char *name,
const char *conf_name, OutputInitFunc InitFunc, AppProto alproto,

@ -620,8 +620,7 @@ static void SetupOutput(
SCLogDebug("%s is a packet logger", module->name);
OutputRegisterPacketLogger(module->logger_id, module->name,
module->PacketLogFunc, module->PacketConditionFunc, output_ctx,
module->ThreadInit, module->ThreadDeinit,
module->ThreadExitPrintStats);
module->ThreadInit, module->ThreadDeinit);
} else if (module->TxLogFunc) {
SCLogDebug("%s is a tx logger", module->name);
OutputRegisterTxLogger(module->logger_id, module->name, module->alproto,

Loading…
Cancel
Save