output: Remove unused output functions

This commit removes registration, initialization, and de-initialization
functions no longer needed
pull/5356/head
Jeff Lucovsky 5 years ago committed by Victor Julien
parent 15caf3eea5
commit ff29345527

@ -841,20 +841,6 @@ static TmEcode JsonAlertLogThreadDeinit(ThreadVars *t, void *data)
return TM_ECODE_OK;
}
static void JsonAlertLogDeInitCtx(OutputCtx *output_ctx)
{
AlertJsonOutputCtx *json_output_ctx = (AlertJsonOutputCtx *) output_ctx->data;
if (json_output_ctx != NULL) {
HttpXFFCfg *xff_cfg = json_output_ctx->xff_cfg;
if (xff_cfg != NULL) {
SCFree(xff_cfg);
}
LogFileFreeCtx(json_output_ctx->file_ctx);
SCFree(json_output_ctx);
}
SCFree(output_ctx);
}
static void JsonAlertLogDeInitCtxSub(OutputCtx *output_ctx)
{
SCLogDebug("cleaning up sub output_ctx %p", output_ctx);
@ -979,53 +965,6 @@ static HttpXFFCfg *JsonAlertLogGetXffCfg(ConfNode *conf)
return xff_cfg;
}
/**
* \brief Create a new LogFileCtx for "fast" output style.
* \param conf The configuration node for this output.
* \return A LogFileCtx pointer on success, NULL on failure.
*/
static OutputInitResult JsonAlertLogInitCtx(ConfNode *conf)
{
OutputInitResult result = { NULL, false };
AlertJsonOutputCtx *json_output_ctx = NULL;
LogFileCtx *logfile_ctx = LogFileNewCtx();
if (logfile_ctx == NULL) {
SCLogDebug("AlertFastLogInitCtx2: Could not create new LogFileCtx");
return result;
}
if (SCConfLogOpenGeneric(conf, logfile_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
LogFileFreeCtx(logfile_ctx);
return result;
}
OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
if (unlikely(output_ctx == NULL)) {
LogFileFreeCtx(logfile_ctx);
return result;
}
json_output_ctx = SCMalloc(sizeof(AlertJsonOutputCtx));
if (unlikely(json_output_ctx == NULL)) {
LogFileFreeCtx(logfile_ctx);
SCFree(output_ctx);
return result;
}
memset(json_output_ctx, 0, sizeof(AlertJsonOutputCtx));
json_output_ctx->file_ctx = logfile_ctx;
JsonAlertLogSetupMetadata(json_output_ctx, conf);
json_output_ctx->xff_cfg = JsonAlertLogGetXffCfg(conf);
output_ctx->data = json_output_ctx;
output_ctx->DeInit = JsonAlertLogDeInitCtx;
result.ctx = output_ctx;
result.ok = true;
return result;
}
/**
* \brief Create a new LogFileCtx for "fast" output style.
* \param conf The configuration node for this output.

@ -461,14 +461,6 @@ static TmEcode LogDnsLogThreadDeinit(ThreadVars *t, void *data)
return TM_ECODE_OK;
}
static void LogDnsLogDeInitCtx(OutputCtx *output_ctx)
{
LogDnsFileCtx *dnslog_ctx = (LogDnsFileCtx *)output_ctx->data;
LogFileFreeCtx(dnslog_ctx->file_ctx);
SCFree(dnslog_ctx);
SCFree(output_ctx);
}
static void LogDnsLogDeInitCtxSub(OutputCtx *output_ctx)
{
SCLogDebug("cleaning up sub output_ctx %p", output_ctx);
@ -649,65 +641,6 @@ static OutputInitResult JsonDnsLogInitCtxSub(ConfNode *conf, OutputCtx *parent_c
return result;
}
#define DEFAULT_LOG_FILENAME "dns.json"
/** \brief Create a new dns log LogFileCtx.
* \param conf Pointer to ConfNode containing this loggers configuration.
* \return NULL if failure, LogFileCtx* to the file_ctx if succesful
* */
static OutputInitResult JsonDnsLogInitCtx(ConfNode *conf)
{
OutputInitResult result = { NULL, false };
const char *enabled = ConfNodeLookupChildValue(conf, "enabled");
if (enabled != NULL && !ConfValIsTrue(enabled)) {
return result;
}
DnsVersion version = JsonDnsParseVersion(conf);
LogFileCtx *file_ctx = LogFileNewCtx();
if(file_ctx == NULL) {
SCLogError(SC_ERR_DNS_LOG_GENERIC, "couldn't create new file_ctx");
return result;
}
if (SCConfLogOpenGeneric(conf, file_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
LogFileFreeCtx(file_ctx);
return result;
}
LogDnsFileCtx *dnslog_ctx = SCMalloc(sizeof(LogDnsFileCtx));
if (unlikely(dnslog_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
return result;
}
memset(dnslog_ctx, 0x00, sizeof(LogDnsFileCtx));
dnslog_ctx->file_ctx = file_ctx;
OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
if (unlikely(output_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
SCFree(dnslog_ctx);
return result;
}
output_ctx->data = dnslog_ctx;
output_ctx->DeInit = LogDnsLogDeInitCtx;
dnslog_ctx->version = version;
JsonDnsLogInitFilters(dnslog_ctx, conf);
SCLogDebug("DNS log output initialized");
AppLayerParserRegisterLogger(IPPROTO_UDP, ALPROTO_DNS);
AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_DNS);
result.ctx = output_ctx;
result.ok = true;
return result;
}
#define MODULE_NAME "JsonDnsLog"
void JsonDnsLogRegister (void)

@ -240,15 +240,6 @@ static void JsonDropOutputCtxFree(JsonDropOutputCtx *drop_ctx)
}
}
static void JsonDropLogDeInitCtx(OutputCtx *output_ctx)
{
OutputDropLoggerDisable();
JsonDropOutputCtx *drop_ctx = output_ctx->data;
JsonDropOutputCtxFree(drop_ctx);
SCFree(output_ctx);
}
static void JsonDropLogDeInitCtxSub(OutputCtx *output_ctx)
{
OutputDropLoggerDisable();
@ -259,65 +250,6 @@ static void JsonDropLogDeInitCtxSub(OutputCtx *output_ctx)
SCFree(output_ctx);
}
#define DEFAULT_LOG_FILENAME "drop.json"
static OutputInitResult JsonDropLogInitCtx(ConfNode *conf)
{
OutputInitResult result = { NULL, false };
if (OutputDropLoggerEnable() != 0) {
SCLogError(SC_ERR_CONF_YAML_ERROR, "only one 'drop' logger "
"can be enabled");
return result;
}
JsonDropOutputCtx *drop_ctx = SCCalloc(1, sizeof(*drop_ctx));
if (drop_ctx == NULL)
return result;
drop_ctx->file_ctx = LogFileNewCtx();
if (drop_ctx->file_ctx == NULL) {
JsonDropOutputCtxFree(drop_ctx);
return result;
}
if (SCConfLogOpenGeneric(conf, drop_ctx->file_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
JsonDropOutputCtxFree(drop_ctx);
return result;
}
OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
if (unlikely(output_ctx == NULL)) {
JsonDropOutputCtxFree(drop_ctx);
return result;
}
if (conf) {
const char *extended = ConfNodeLookupChildValue(conf, "alerts");
if (extended != NULL) {
if (ConfValIsTrue(extended)) {
drop_ctx->flags = LOG_DROP_ALERTS;
}
}
extended = ConfNodeLookupChildValue(conf, "flows");
if (extended != NULL) {
if (strcasecmp(extended, "start") == 0) {
g_droplog_flows_start = 1;
} else if (strcasecmp(extended, "all") == 0) {
g_droplog_flows_start = 0;
} else {
SCLogWarning(SC_ERR_CONF_YAML_ERROR, "valid options for "
"'flow' are 'start' and 'all'");
}
}
}
output_ctx->data = drop_ctx;
output_ctx->DeInit = JsonDropLogDeInitCtx;
result.ctx = output_ctx;
result.ok = true;
return result;
}
static OutputInitResult JsonDropLogInitCtxSub(ConfNode *conf, OutputCtx *parent_ctx)
{
OutputInitResult result = { NULL, false };

@ -347,52 +347,6 @@ static int JsonFlowLogger(ThreadVars *tv, void *thread_data, Flow *f)
SCReturnInt(TM_ECODE_OK);
}
static void OutputFlowLogDeinit(OutputCtx *output_ctx)
{
LogJsonFileCtx *flow_ctx = output_ctx->data;
LogFileCtx *logfile_ctx = flow_ctx->file_ctx;
LogFileFreeCtx(logfile_ctx);
SCFree(flow_ctx);
SCFree(output_ctx);
}
#define DEFAULT_LOG_FILENAME "flow.json"
static OutputInitResult OutputFlowLogInit(ConfNode *conf)
{
OutputInitResult result = { NULL, false };
LogFileCtx *file_ctx = LogFileNewCtx();
if(file_ctx == NULL) {
SCLogError(SC_ERR_FLOW_LOG_GENERIC, "couldn't create new file_ctx");
return result;
}
if (SCConfLogOpenGeneric(conf, file_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
LogFileFreeCtx(file_ctx);
return result;
}
LogJsonFileCtx *flow_ctx = SCMalloc(sizeof(LogJsonFileCtx));
if (unlikely(flow_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
return result;
}
OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
if (unlikely(output_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
SCFree(flow_ctx);
return result;
}
flow_ctx->file_ctx = file_ctx;
output_ctx->data = flow_ctx;
output_ctx->DeInit = OutputFlowLogDeinit;
result.ctx = output_ctx;
result.ok = true;
return result;
}
static void OutputFlowLogDeinitSub(OutputCtx *output_ctx)
{
LogJsonFileCtx *flow_ctx = output_ctx->data;

@ -561,90 +561,6 @@ bool EveHttpAddMetadata(const Flow *f, uint64_t tx_id, JsonBuilder *js)
return false;
}
static void OutputHttpLogDeinit(OutputCtx *output_ctx)
{
LogHttpFileCtx *http_ctx = output_ctx->data;
LogFileCtx *logfile_ctx = http_ctx->file_ctx;
LogFileFreeCtx(logfile_ctx);
if (http_ctx->xff_cfg) {
SCFree(http_ctx->xff_cfg);
}
SCFree(http_ctx);
SCFree(output_ctx);
}
#define DEFAULT_LOG_FILENAME "http.json"
static OutputInitResult OutputHttpLogInit(ConfNode *conf)
{
OutputInitResult result = { NULL, false };
LogFileCtx *file_ctx = LogFileNewCtx();
if(file_ctx == NULL) {
SCLogError(SC_ERR_HTTP_LOG_GENERIC, "couldn't create new file_ctx");
return result;
}
if (SCConfLogOpenGeneric(conf, file_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
LogFileFreeCtx(file_ctx);
return result;
}
LogHttpFileCtx *http_ctx = SCMalloc(sizeof(LogHttpFileCtx));
if (unlikely(http_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
return result;
}
OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
if (unlikely(output_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
SCFree(http_ctx);
return result;
}
http_ctx->file_ctx = file_ctx;
http_ctx->flags = LOG_HTTP_DEFAULT;
if (conf) {
const char *extended = ConfNodeLookupChildValue(conf, "extended");
if (extended != NULL) {
if (ConfValIsTrue(extended)) {
http_ctx->flags = LOG_HTTP_EXTENDED;
}
}
const char *all_headers = ConfNodeLookupChildValue(
conf, "dump-all-headers");
if (all_headers != NULL) {
if (strcmp(all_headers, "both") == 0) {
http_ctx->flags |= LOG_HTTP_REQ_HEADERS;
http_ctx->flags |= LOG_HTTP_RES_HEADERS;
} else if (strcmp(all_headers, "request") == 0) {
http_ctx->flags |= LOG_HTTP_REQ_HEADERS;
} else if (strcmp(all_headers, "response") == 0) {
http_ctx->flags |= LOG_HTTP_RES_HEADERS;
} else if (strcmp(all_headers, "none") != 0) {
SCLogWarning(SC_WARN_ANOMALY_CONFIG,
"unhandled value for dump-all-headers configuration : %s",
all_headers);
}
}
}
http_ctx->xff_cfg = SCCalloc(1, sizeof(HttpXFFCfg));
if (http_ctx->xff_cfg != NULL) {
HttpXFFGetCfg(conf, http_ctx->xff_cfg);
}
output_ctx->data = http_ctx;
output_ctx->DeInit = OutputHttpLogDeinit;
/* enable the logger for the app layer */
AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP);
result.ctx = output_ctx;
result.ok = true;
return result;
}
static void OutputHttpLogDeinitSub(OutputCtx *output_ctx)
{
LogHttpFileCtx *http_ctx = output_ctx->data;

@ -155,16 +155,6 @@ static TmEcode JsonMetadataLogThreadDeinit(ThreadVars *t, void *data)
return TM_ECODE_OK;
}
static void JsonMetadataLogDeInitCtx(OutputCtx *output_ctx)
{
MetadataJsonOutputCtx *json_output_ctx = (MetadataJsonOutputCtx *) output_ctx->data;
if (json_output_ctx != NULL) {
LogFileFreeCtx(json_output_ctx->file_ctx);
SCFree(json_output_ctx);
}
SCFree(output_ctx);
}
static void JsonMetadataLogDeInitCtxSub(OutputCtx *output_ctx)
{
SCLogDebug("cleaning up sub output_ctx %p", output_ctx);
@ -177,53 +167,6 @@ static void JsonMetadataLogDeInitCtxSub(OutputCtx *output_ctx)
SCFree(output_ctx);
}
#define DEFAULT_LOG_FILENAME "metadata.json"
/**
* \brief Create a new LogFileCtx for "fast" output style.
* \param conf The configuration node for this output.
* \return A LogFileCtx pointer on success, NULL on failure.
*/
static OutputInitResult JsonMetadataLogInitCtx(ConfNode *conf)
{
OutputInitResult result = { NULL, false };
MetadataJsonOutputCtx *json_output_ctx = NULL;
LogFileCtx *logfile_ctx = LogFileNewCtx();
if (logfile_ctx == NULL) {
SCLogDebug("MetadataFastLogInitCtx2: Could not create new LogFileCtx");
return result;
}
if (SCConfLogOpenGeneric(conf, logfile_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
LogFileFreeCtx(logfile_ctx);
return result;
}
OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
if (unlikely(output_ctx == NULL)) {
LogFileFreeCtx(logfile_ctx);
return result;
}
json_output_ctx = SCMalloc(sizeof(MetadataJsonOutputCtx));
if (unlikely(json_output_ctx == NULL)) {
LogFileFreeCtx(logfile_ctx);
SCFree(output_ctx);
return result;
}
memset(json_output_ctx, 0, sizeof(MetadataJsonOutputCtx));
json_output_ctx->file_ctx = logfile_ctx;
json_output_ctx->cfg.include_metadata = true;
output_ctx->data = json_output_ctx;
output_ctx->DeInit = JsonMetadataLogDeInitCtx;
result.ctx = output_ctx;
result.ok = true;
return result;
}
/**
* \brief Create a new LogFileCtx for "fast" output style.
* \param conf The configuration node for this output.

@ -306,52 +306,6 @@ static int JsonNetFlowLogger(ThreadVars *tv, void *thread_data, Flow *f)
SCReturnInt(TM_ECODE_OK);
}
static void OutputNetFlowLogDeinit(OutputCtx *output_ctx)
{
LogJsonFileCtx *flow_ctx = output_ctx->data;
LogFileCtx *logfile_ctx = flow_ctx->file_ctx;
LogFileFreeCtx(logfile_ctx);
SCFree(flow_ctx);
SCFree(output_ctx);
}
#define DEFAULT_LOG_FILENAME "netflow.json"
static OutputInitResult OutputNetFlowLogInit(ConfNode *conf)
{
OutputInitResult result = { NULL, false };
LogFileCtx *file_ctx = LogFileNewCtx();
if(file_ctx == NULL) {
SCLogError(SC_ERR_NETFLOW_LOG_GENERIC, "couldn't create new file_ctx");
return result;
}
if (SCConfLogOpenGeneric(conf, file_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
LogFileFreeCtx(file_ctx);
return result;
}
LogJsonFileCtx *flow_ctx = SCMalloc(sizeof(LogJsonFileCtx));
if (unlikely(flow_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
return result;
}
OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
if (unlikely(output_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
SCFree(flow_ctx);
return result;
}
flow_ctx->file_ctx = file_ctx;
output_ctx->data = flow_ctx;
output_ctx->DeInit = OutputNetFlowLogDeinit;
result.ctx = output_ctx;
result.ok = true;
return result;
}
static void OutputNetFlowLogDeinitSub(OutputCtx *output_ctx)
{
LogJsonFileCtx *flow_ctx = output_ctx->data;

@ -112,16 +112,6 @@ bool EveSMTPAddMetadata(const Flow *f, uint64_t tx_id, JsonBuilder *js)
return false;
}
static void OutputSmtpLogDeInitCtx(OutputCtx *output_ctx)
{
OutputJsonEmailCtx *email_ctx = output_ctx->data;
if (email_ctx != NULL) {
LogFileFreeCtx(email_ctx->file_ctx);
SCFree(email_ctx);
}
SCFree(output_ctx);
}
static void OutputSmtpLogDeInitCtxSub(OutputCtx *output_ctx)
{
SCLogDebug("cleaning up sub output_ctx %p", output_ctx);
@ -132,47 +122,6 @@ static void OutputSmtpLogDeInitCtxSub(OutputCtx *output_ctx)
SCFree(output_ctx);
}
#define DEFAULT_LOG_FILENAME "smtp.json"
static OutputInitResult OutputSmtpLogInit(ConfNode *conf)
{
OutputInitResult result = { NULL, false };
LogFileCtx *file_ctx = LogFileNewCtx();
if(file_ctx == NULL) {
SCLogError(SC_ERR_SMTP_LOG_GENERIC, "couldn't create new file_ctx");
return result;
}
if (SCConfLogOpenGeneric(conf, file_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
LogFileFreeCtx(file_ctx);
return result;
}
OutputJsonEmailCtx *email_ctx = SCMalloc(sizeof(OutputJsonEmailCtx));
if (unlikely(email_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
return result;
}
OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
if (unlikely(output_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
SCFree(email_ctx);
return result;
}
email_ctx->file_ctx = file_ctx;
output_ctx->data = email_ctx;
output_ctx->DeInit = OutputSmtpLogDeInitCtx;
/* enable the logger for the app layer */
AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SMTP);
result.ctx = output_ctx;
result.ok = true;
return result;
}
static OutputInitResult OutputSmtpLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
{
OutputInitResult result = { NULL, false };

@ -147,55 +147,6 @@ static TmEcode JsonSshLogThreadDeinit(ThreadVars *t, void *data)
return TM_ECODE_OK;
}
static void OutputSshLogDeinit(OutputCtx *output_ctx)
{
OutputSshCtx *ssh_ctx = output_ctx->data;
LogFileCtx *logfile_ctx = ssh_ctx->file_ctx;
LogFileFreeCtx(logfile_ctx);
SCFree(ssh_ctx);
SCFree(output_ctx);
}
#define DEFAULT_LOG_FILENAME "ssh.json"
static OutputInitResult OutputSshLogInit(ConfNode *conf)
{
OutputInitResult result = { NULL, false };
LogFileCtx *file_ctx = LogFileNewCtx();
if(file_ctx == NULL) {
SCLogError(SC_ERR_SSH_LOG_GENERIC, "couldn't create new file_ctx");
return result;
}
if (SCConfLogOpenGeneric(conf, file_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
LogFileFreeCtx(file_ctx);
return result;
}
OutputSshCtx *ssh_ctx = SCMalloc(sizeof(OutputSshCtx));
if (unlikely(ssh_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
return result;
}
OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
if (unlikely(output_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
SCFree(ssh_ctx);
return result;
}
ssh_ctx->file_ctx = file_ctx;
output_ctx->data = ssh_ctx;
output_ctx->DeInit = OutputSshLogDeinit;
AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_SSH);
result.ctx = output_ctx;
result.ok = true;
return result;
}
static void OutputSshLogDeinitSub(OutputCtx *output_ctx)
{
OutputSshCtx *ssh_ctx = output_ctx->data;

@ -377,88 +377,6 @@ static TmEcode JsonStatsLogThreadDeinit(ThreadVars *t, void *data)
return TM_ECODE_OK;
}
static void OutputStatsLogDeinit(OutputCtx *output_ctx)
{
OutputStatsCtx *stats_ctx = output_ctx->data;
LogFileCtx *logfile_ctx = stats_ctx->file_ctx;
LogFileFreeCtx(logfile_ctx);
SCFree(stats_ctx);
SCFree(output_ctx);
}
#define DEFAULT_LOG_FILENAME "stats.json"
static OutputInitResult OutputStatsLogInit(ConfNode *conf)
{
OutputInitResult result = { NULL, false };
if (!StatsEnabled()) {
SCLogError(SC_ERR_STATS_LOG_GENERIC,
"stats.json: stats are disabled globally: set stats.enabled to true. "
"See %s/configuration/suricata-yaml.html#stats", GetDocURL());
return result;
}
LogFileCtx *file_ctx = LogFileNewCtx();
if(file_ctx == NULL) {
SCLogError(SC_ERR_STATS_LOG_GENERIC, "couldn't create new file_ctx");
return result;
}
if (stats_decoder_events &&
strcmp(stats_decoder_events_prefix, "decoder") == 0) {
SCLogWarning(SC_WARN_EVE_MISSING_EVENTS, "json stats will not display "
"all decoder events correctly. See #2225. Set a prefix in "
"stats.decoder-events-prefix.");
}
if (SCConfLogOpenGeneric(conf, file_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
LogFileFreeCtx(file_ctx);
return result;
}
OutputStatsCtx *stats_ctx = SCMalloc(sizeof(OutputStatsCtx));
if (unlikely(stats_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
return result;
}
stats_ctx->flags = JSON_STATS_TOTALS;
if (conf != NULL) {
const char *totals = ConfNodeLookupChildValue(conf, "totals");
const char *threads = ConfNodeLookupChildValue(conf, "threads");
const char *deltas = ConfNodeLookupChildValue(conf, "deltas");
SCLogDebug("totals %s threads %s deltas %s", totals, threads, deltas);
if (totals != NULL && ConfValIsFalse(totals)) {
stats_ctx->flags &= ~JSON_STATS_TOTALS;
}
if (threads != NULL && ConfValIsTrue(threads)) {
stats_ctx->flags |= JSON_STATS_THREADS;
}
if (deltas != NULL && ConfValIsTrue(deltas)) {
stats_ctx->flags |= JSON_STATS_DELTAS;
}
SCLogDebug("stats_ctx->flags %08x", stats_ctx->flags);
}
OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
if (unlikely(output_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
SCFree(stats_ctx);
return result;
}
stats_ctx->file_ctx = file_ctx;
output_ctx->data = stats_ctx;
output_ctx->DeInit = OutputStatsLogDeinit;
result.ctx = output_ctx;
result.ok = true;
return result;
}
static void OutputStatsLogDeinitSub(OutputCtx *output_ctx)
{
OutputStatsCtx *stats_ctx = output_ctx->data;

@ -498,15 +498,6 @@ static TmEcode JsonTlsLogThreadDeinit(ThreadVars *t, void *data)
return TM_ECODE_OK;
}
static void OutputTlsLogDeinit(OutputCtx *output_ctx)
{
OutputTlsCtx *tls_ctx = output_ctx->data;
LogFileCtx *logfile_ctx = tls_ctx->file_ctx;
LogFileFreeCtx(logfile_ctx);
SCFree(tls_ctx);
SCFree(output_ctx);
}
static OutputTlsCtx *OutputTlsInitCtx(ConfNode *conf)
{
OutputTlsCtx *tls_ctx = SCMalloc(sizeof(OutputTlsCtx));
@ -565,45 +556,6 @@ static OutputTlsCtx *OutputTlsInitCtx(ConfNode *conf)
return tls_ctx;
}
static OutputInitResult OutputTlsLogInit(ConfNode *conf)
{
OutputInitResult result = { NULL, false };
LogFileCtx *file_ctx = LogFileNewCtx();
if (file_ctx == NULL) {
SCLogError(SC_ERR_TLS_LOG_GENERIC, "couldn't create new file_ctx");
return result;
}
if (SCConfLogOpenGeneric(conf, file_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
LogFileFreeCtx(file_ctx);
return result;
}
OutputTlsCtx *tls_ctx = OutputTlsInitCtx(conf);
if (unlikely(tls_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
return result;
}
OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
if (unlikely(output_ctx == NULL)) {
LogFileFreeCtx(file_ctx);
SCFree(tls_ctx);
return result;
}
tls_ctx->file_ctx = file_ctx;
output_ctx->data = tls_ctx;
output_ctx->DeInit = OutputTlsLogDeinit;
AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_TLS);
result.ctx = output_ctx;
result.ok = true;
return result;
}
static void OutputTlsLogDeinitSub(OutputCtx *output_ctx)
{
OutputTlsCtx *tls_ctx = output_ctx->data;

@ -574,44 +574,6 @@ error:
FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
}
/**
* \brief Register a flow output module.
*
* This function will register an output module so it can be
* configured with the configuration file.
*
* \retval Returns 0 on success, -1 on failure.
*/
void OutputRegisterFlowModule(LoggerId id, const char *name,
const char *conf_name, OutputInitFunc InitFunc, FlowLogger FlowLogFunc,
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
ThreadExitPrintStatsFunc ThreadExitPrintStats)
{
if (unlikely(FlowLogFunc == NULL)) {
goto error;
}
OutputModule *module = SCCalloc(1, sizeof(*module));
if (unlikely(module == NULL)) {
goto error;
}
module->logger_id = id;
module->name = name;
module->conf_name = conf_name;
module->InitFunc = InitFunc;
module->FlowLogFunc = FlowLogFunc;
module->ThreadInit = ThreadInit;
module->ThreadDeinit = ThreadDeinit;
module->ThreadExitPrintStats = ThreadExitPrintStats;
TAILQ_INSERT_TAIL(&output_modules, module, entries);
SCLogDebug("Flow logger \"%s\" registered.", name);
return;
error:
FatalError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
}
/**
* \brief Register a flow output sub-module.
*

@ -151,11 +151,6 @@ void OutputRegisterFiledataSubModule(LoggerId, const char *parent_name,
ThreadDeinitFunc ThreadDeinit,
ThreadExitPrintStatsFunc ThreadExitPrintStats);
void OutputRegisterFlowModule(LoggerId id, const char *name,
const char *conf_name, OutputInitFunc InitFunc,
FlowLogger FlowLogFunc, ThreadInitFunc ThreadInit,
ThreadDeinitFunc ThreadDeinit,
ThreadExitPrintStatsFunc ThreadExitPrintStats);
void OutputRegisterFlowSubModule(LoggerId id, const char *parent_name,
const char *name, const char *conf_name, OutputInitSubFunc InitFunc,
FlowLogger FlowLogFunc, ThreadInitFunc ThreadInit,

Loading…
Cancel
Save