#include "app-layer-dnp3-objects.h"
#include "output-json-dnp3-objects.h"
-#ifdef HAVE_LIBJANSSON
-
void OutputJsonDNP3SetItem(json_t *js, DNP3Object *object,
DNP3Point *point)
{
}
-#endif /* HAVE_LIBJANSSON */
-
"""
def has_freeable_types(fields):
#include "util-print.h"
#include "output.h"
-
-#ifdef HAVE_LIBJANSSON
#include "output-json.h"
#include "output-json-http.h"
#include "output-json-tls.h"
#include "output-json-ssh.h"
#include "output-json-smtp.h"
#include "output-json-email-common.h"
-#include <jansson.h>
-#endif
#include "util-privs.h"
#include "util-optimize.h"
SCReturnInt(0);
}
-#ifdef HAVE_LIBJANSSON
/**
* \brief Add string data, to be stored in the Additional Data
* field of the IDMEF alert (see section 4.2.4.6 of RFC 4765).
SCReturnInt(0);
}
-#endif
/**
* \brief Add IPv4 header data, to be stored in the Additional Data
SCReturnInt(0);
}
-#ifdef HAVE_LIBJANSSON
/**
* \brief Convert JSON object to Prelude additional data with
* the right type of data. Browse the JSON object to get
}
-#endif
-
/**
* \brief Convert IP packet to an IDMEF alert (RFC 4765).
* This function stores the alert SID (description and reference),
if (unlikely(p == NULL))
SCReturnInt(0);
-#ifdef HAVE_LIBJANSSON
if (p->flow != NULL) {
uint16_t proto = FlowGetAppProtocol(p->flow);
switch (proto) {
break;
}
}
-#endif
AddIntData(alert, "snort_rule_sid", pa->s->id);
AddIntData(alert, "snort_rule_rev", pa->s->rev);
return (cd->flags & DETECT_CONTENT_NEGATED);
}
-#ifdef HAVE_LIBJANSSON
static json_t *RulesGroupPrintSghStats(const SigGroupHead *sgh,
const int add_rules, const int add_mpm_stats)
{
return js;
}
-#endif /* HAVE_LIBJANSSON */
static void RulesDumpGrouping(const DetectEngineCtx *de_ctx,
const int add_rules, const int add_mpm_stats)
{
-#ifdef HAVE_LIBJANSSON
json_t *js = json_object();
if (unlikely(js == NULL))
return;
fprintf(fp, "%s\n", js_s);
free(js_s);
fclose(fp);
-#endif
return;
}
DetectEnginePktInspectionSetup(s);
if (rule_engine_analysis_set) {
-#ifdef HAVE_LIBJANSSON
EngineAnalysisRules2(de_ctx, s);
-#endif
}
/* free lists. Ctx' are xferred to sm_arrays so won't get freed */
uint32_t i;
#include "detect-engine-profile.h"
#ifdef PROFILING
-#ifdef HAVE_LIBJANSSON
#if 0
static void DumpFp(const SigMatch *sm, char *pat_orig, uint32_t pat_orig_sz, char *pat_chop, uint32_t pat_chop_sz)
{
json_object_clear(js);
json_decref(js);
}
-#endif /* HAVE_LIBJANSSON */
#endif /* PROFILING */
uint32_t toggle_sids_size;
};
#ifdef PROFILING
-#ifdef HAVE_LIBJANSSON
static void DetectFlowbitsAnalyzeDump(const DetectEngineCtx *de_ctx,
struct FBAnalyze *array, uint32_t elements);
#endif
-#endif
void DetectFlowbitsAnalyze(DetectEngineCtx *de_ctx)
{
SCFree(varname);
}
#ifdef PROFILING
-#ifdef HAVE_LIBJANSSON
DetectFlowbitsAnalyzeDump(de_ctx, array, array_size);
#endif
-#endif
end:
for (uint32_t i = 0; i < array_size; i++) {
}
#ifdef PROFILING
-#ifdef HAVE_LIBJANSSON
#include "output-json.h"
#include "util-buffer.h"
SCMutex g_flowbits_dump_write_m = SCMUTEX_INITIALIZER;
json_object_clear(js);
json_decref(js);
}
-#endif /* HAVE_LIBJANSSON */
#endif /* PROFILING */
#ifdef UNITTESTS
SGH_PROFILING_RECORD(det_ctx, scratch->sgh);
#ifdef PROFILING
-#ifdef HAVE_LIBJANSSON
if (match_cnt >= de_ctx->profile_match_logging_threshold)
RulesDumpMatchArray(det_ctx, scratch->sgh, p);
-#endif
#endif
uint32_t sflags, next_sflags = 0;
#define MODULE_NAME "JsonAlertLog"
-#ifdef HAVE_LIBJANSSON
-
#define LOG_JSON_PAYLOAD BIT_U16(0)
#define LOG_JSON_PACKET BIT_U16(1)
#define LOG_JSON_PAYLOAD_BASE64 BIT_U16(2)
JsonAlertLogCondition, JsonAlertLogThreadInit, JsonAlertLogThreadDeinit,
NULL);
}
-
-#else
-
-void JsonAlertLogRegister (void)
-{
-}
-
-#endif
-
#define __OUTPUT_JSON_ALERT_H__
void JsonAlertLogRegister(void);
-#ifdef HAVE_LIBJANSSON
void AlertJsonHeader(void *ctx, const Packet *p, const PacketAlert *pa, json_t *js,
uint16_t flags);
-#endif /* HAVE_LIBJANSSON */
#endif /* __OUTPUT_JSON_ALERT_H__ */
#define __OUTPUT_JSON_ANOMALY_H__
void JsonAnomalyLogRegister(void);
-#ifdef HAVE_LIBJANSSON
void AnomalyJsonHeader(void *ctx, const Packet *p, const PacketAlert *pa, json_t *js,
uint16_t flags);
-#endif /* HAVE_LIBJANSSON */
#endif /* __OUTPUT_JSON_ALERT_H__ */
#include "app-layer.h"
#include "app-layer-parser.h"
-#ifdef HAVE_LIBJANSSON
-
static void OutputJsonLogDeInitCtxSub(OutputCtx *output_ctx)
{
SCFree(output_ctx->data);
SCFree(thread);
return TM_ECODE_OK;
}
-
-#endif /* HAVE_LIBJANSSON */
-
#include "output-json-dnp3-objects.h"
#include "output-json.h"
-#ifdef HAVE_LIBJANSSON
-
void OutputJsonDNP3SetItem(json_t *js, DNP3Object *object,
DNP3Point *point)
{
}
}
-
-#endif /* HAVE_LIBJANSSON */
#ifndef __OUTPUT_JSON_DNP3_OBJECTS_H__
#define __OUTPUT_JSON_DNP3_OBJECTS_H__
-#ifdef HAVE_LIBJANSSON
void OutputJsonDNP3SetItem(json_t *js, DNP3Object *object,
DNP3Point *item);
-#endif /* HAVE_LIBJANSSON */
#endif /* __OUTPUT_JSON_DNP3_OBJECTS_H__ */
#include "output-json-dnp3.h"
#include "output-json-dnp3-objects.h"
-#ifdef HAVE_LIBJANSSON
-#include <jansson.h>
-
typedef struct LogDNP3FileCtx_ {
LogFileCtx *file_ctx;
uint32_t flags;
JsonDNP3LoggerToClient, 1, 1, JsonDNP3LogThreadInit,
JsonDNP3LogThreadDeinit, NULL);
}
-
-#else
-
-void JsonDNP3LogRegister (void)
-{
-}
-
-#endif
#include "app-layer-dnp3.h"
-#ifdef HAVE_LIBJANSSON
json_t *JsonDNP3LogRequest(DNP3Transaction *);
json_t *JsonDNP3LogResponse(DNP3Transaction *);
-#endif /* HAVE_LIBJANSSON */
void JsonDNP3LogRegister(void);
#define MODULE_NAME "JsonDropLog"
-#ifdef HAVE_LIBJANSSON
-
#define LOG_DROP_ALERTS 1
typedef struct JsonDropOutputCtx_ {
JsonDropLogCondition, JsonDropLogThreadInit, JsonDropLogThreadDeinit,
NULL);
}
-
-#else
-
-void JsonDropLogRegister (void)
-{
-}
-
-#endif
#include "output-json.h"
#include "output-json-email-common.h"
-#ifdef HAVE_LIBJANSSON
-
#define LOG_EMAIL_DEFAULT 0
#define LOG_EMAIL_EXTENDED (1<<0)
#define LOG_EMAIL_ARRAY (1<<1) /* require array handling */
}
return;
}
-
-
-#endif
#ifndef __OUTPUT_JSON_EMAIL_COMMON_H__
#define __OUTPUT_JSON_EMAIL_COMMON_H__
-#ifdef HAVE_LIBJANSSON
typedef struct OutputJsonEmailCtx_ {
LogFileCtx *file_ctx;
uint32_t flags; /** Store mode */
void OutputEmailInitConf(ConfNode *conf, OutputJsonEmailCtx *email_ctx);
-#endif /* HAVE_LIBJANSSON */
#endif /* __OUTPUT_JSON_EMAIL_COMMON_H__ */
#include "stream-tcp-private.h"
#include "flow-storage.h"
-#ifdef HAVE_LIBJANSSON
-
typedef struct LogJsonFileCtx_ {
LogFileCtx *file_ctx;
uint32_t flags; /** Store mode */
"eve-log.flow", OutputFlowLogInitSub, JsonFlowLogger,
JsonFlowLogThreadInit, JsonFlowLogThreadDeinit, NULL);
}
-
-#else
-
-void JsonFlowLogRegister (void)
-{
-}
-
-#endif
#define __OUTPUT_JSON_FLOW_H__
void JsonFlowLogRegister(void);
-#ifdef HAVE_LIBJANSSON
void JsonAddFlow(Flow *f, json_t *js, json_t *hjs);
-#endif /* HAVE_LIBJANSSON */
#endif /* __OUTPUT_JSON_FLOW_H__ */
#include "app-layer-ftp.h"
#include "output-json-ftp.h"
-#ifdef HAVE_LIBJANSSON
-
typedef struct LogFTPFileCtx_ {
LogFileCtx *file_ctx;
OutputJsonCommonSettings cfg;
SCLogDebug("FTP JSON logger registered.");
}
-#else /* HAVE_LIBJANSSON */
-
-void JsonFTPLogRegister(void)
-{
-}
-
-#endif /* HAVE_LIBJANSSON */
#include "output-json-http.h"
#include "util-byte.h"
-#ifdef HAVE_LIBJANSSON
-
typedef struct LogHttpFileCtx_ {
LogFileCtx *file_ctx;
uint32_t flags; /** Store mode */
"eve-log.http", OutputHttpLogInitSub, ALPROTO_HTTP, JsonHttpLogger,
JsonHttpLogThreadInit, JsonHttpLogThreadDeinit, NULL);
}
-
-#else
-
-void JsonHttpLogRegister (void)
-{
-}
-
-#endif
void JsonHttpLogRegister(void);
-#ifdef HAVE_LIBJANSSON
json_t *JsonHttpAddMetadata(const Flow *f, uint64_t tx_id);
void JsonHttpLogJSONBodyPrintable(json_t *js, Flow *f, uint64_t tx_id);
void JsonHttpLogJSONBodyBase64(json_t *js, Flow *f, uint64_t tx_id);
-#endif /* HAVE_LIBJANSSON */
#endif /* __OUTPUT_JSON_HTTP_H__ */
#include "app-layer-ikev2.h"
#include "output-json-ikev2.h"
-#ifdef HAVE_LIBJANSSON
-
#include "rust.h"
#include "rust-ikev2-log-gen.h"
SCLogDebug("IKEv2 JSON logger registered.");
}
-
-#else /* No JSON support. */
-
-void JsonIKEv2LogRegister(void)
-{
-}
-
-#endif /* HAVE_LIBJANSSON */
#include "app-layer-krb5.h"
#include "output-json-krb5.h"
-#ifdef HAVE_LIBJANSSON
-
#include "rust.h"
#include "rust-krb-log-gen.h"
SCLogDebug("KRB5 JSON logger registered.");
}
-
-#else /* No JSON support. */
-
-void JsonKRB5LogRegister(void)
-{
-}
-
-#endif /* HAVE_LIBJANSSON */
#define MODULE_NAME "JsonMetadataLog"
-#ifdef HAVE_LIBJANSSON
-
#define JSON_STREAM_BUFFER_SIZE 4096
typedef struct MetadataJsonOutputCtx_ {
JsonMetadataLogCondition, JsonMetadataLogThreadInit,
JsonMetadataLogThreadDeinit, NULL);
}
-
-#else
-
-void JsonMetadataLogRegister (void)
-{
-}
-
-#endif
#include "stream-tcp-private.h"
-#ifdef HAVE_LIBJANSSON
-
typedef struct LogJsonFileCtx_ {
LogFileCtx *file_ctx;
OutputJsonCommonSettings cfg;
"eve-log.netflow", OutputNetFlowLogInitSub, JsonNetFlowLogger,
JsonNetFlowLogThreadInit, JsonNetFlowLogThreadDeinit, NULL);
}
-
-#else
-
-void JsonNetFlowLogRegister (void)
-{
-}
-
-#endif
#include "output-json-nfs.h"
-#ifdef HAVE_LIBJANSSON
#include "rust.h"
#include "rust-nfs-log-gen.h"
SCLogDebug("NFS JSON logger registered.");
}
-
-#else /* No JSON support. */
-
-void JsonNFSLogRegister(void)
-{
-}
-
-#endif /* HAVE_LIBJANSSON */
#include "rust.h"
#include "rust-sip-log-gen.h"
-#ifdef HAVE_LIBJANSSON
-
typedef struct LogSIPFileCtx_ {
LogFileCtx *file_ctx;
OutputJsonCommonSettings cfg;
SCLogDebug("SIP JSON logger registered.");
}
-
-#else /* No JSON support. */
-
-void JsonSIPLogRegister(void)
-{
-}
-
-#endif /* HAVE_LIBJANSSON */
void JsonSIPLogRegister(void);
-#ifdef HAVE_LIBJANSSON
json_t *JsonSIPAddMetadata(const Flow *f, uint64_t tx_id);
-#endif /* HAVE_LIBJANSSON */
#endif /* __OUTPUT_JSON_SIP_H__ */
#include "output-json-smb.h"
-#ifdef HAVE_LIBJANSSON
#include "rust.h"
#include "rust-smb-log-gen.h"
SCLogDebug("SMB JSON logger registered.");
}
-
-#else /* No JSON support. */
-
-void JsonSMBLogRegister(void)
-{
-}
-
-#endif /* HAVE_LIBJANSSON */
-
#include "output-json-smtp.h"
#include "output-json-email-common.h"
-#ifdef HAVE_LIBJANSSON
-
static json_t *JsonSmtpDataLogger(const Flow *f, void *state, void *vtx, uint64_t tx_id)
{
json_t *sjs = json_object();
"eve-log.smtp", OutputSmtpLogInitSub, ALPROTO_SMTP, JsonSmtpLogger,
JsonSmtpLogThreadInit, JsonSmtpLogThreadDeinit, NULL);
}
-
-#else
-
-void JsonSmtpLogRegister (void)
-{
-}
-
-#endif
#define __OUTPUT_JSON_SMTP_H__
void JsonSmtpLogRegister(void);
-#ifdef HAVE_LIBJANSSON
json_t *JsonSMTPAddMetadata(const Flow *f, uint64_t tx_id);
-#endif
#endif /* __OUTPUT_JSON_SMTP_H__ */
#include "app-layer-snmp.h"
#include "output-json-snmp.h"
-#ifdef HAVE_LIBJANSSON
-
#include "rust.h"
#include "rust-snmp-log-gen.h"
SCLogDebug("SNMP JSON logger registered.");
}
-
-#else /* No JSON support. */
-
-void JsonSNMPLogRegister(void)
-{
-}
-
-#endif /* HAVE_LIBJANSSON */
#include "output-json.h"
#include "output-json-ssh.h"
-#ifdef HAVE_LIBJANSSON
-
#define MODULE_NAME "LogSshLog"
typedef struct OutputSshCtx_ {
SSH_STATE_BANNER_DONE, SSH_STATE_BANNER_DONE,
JsonSshLogThreadInit, JsonSshLogThreadDeinit, NULL);
}
-
-#else
-
-void JsonSshLogRegister (void)
-{
-}
-
-#endif
void JsonSshLogRegister(void);
-#ifdef HAVE_LIBJANSSON
#include "app-layer-ssh.h"
void JsonSshLogJSON(json_t *js, SshState *tx);
-#endif
#endif /* __OUTPUT_JSON_SSH_H__ */
#define MODULE_NAME "JsonStatsLog"
-#ifdef HAVE_LIBJANSSON
-
extern bool stats_decoder_events;
const char *stats_decoder_events_prefix;
"eve-log.stats", OutputStatsLogInitSub, JsonStatsLogger,
JsonStatsLogThreadInit, JsonStatsLogThreadDeinit, NULL);
}
-
-#else
-
-void JsonStatsLogRegister (void)
-{
-}
-
-#endif
#define JSON_STATS_THREADS (1<<1)
#define JSON_STATS_DELTAS (1<<2)
-#ifdef HAVE_LIBJANSSON
json_t *StatsToJSON(const StatsTable *st, uint8_t flags);
TmEcode OutputEngineStatsReloadTime(json_t **jdata);
TmEcode OutputEngineStatsRuleset(json_t **jdata);
-#endif
void JsonStatsLogRegister(void);
#endif /* __OUTPUT_JSON_COUNTERS_H__ */
#include "app-layer-template.h"
#include "output-json-template.h"
-#ifdef HAVE_LIBJANSSON
-
typedef struct LogTemplateFileCtx_ {
LogFileCtx *file_ctx;
uint32_t flags;
SCLogNotice("Template JSON logger registered.");
}
-
-#else /* No JSON support. */
-
-void JsonTemplateLogRegister(void)
-{
-}
-
-#endif /* HAVE_LIBJANSSON */
#include "rust.h"
#include "rust-tftp-log-gen.h"
-#ifdef HAVE_LIBJANSSON
-
typedef struct LogTFTPFileCtx_ {
LogFileCtx *file_ctx;
uint32_t flags;
SCLogDebug("TFTP JSON logger registered.");
}
-
-#else /* HAVE_LIBJANSSON */
-
-void JsonTFTPLogRegister(void)
-{
-}
-
-#endif /* HAVE_LIBJANSSON */
#include "output-json.h"
#include "output-json-tls.h"
-#ifdef HAVE_LIBJANSSON
-
SC_ATOMIC_DECLARE(unsigned int, cert_id);
#define MODULE_NAME "LogTlsLog"
JsonTlsLogger, TLS_HANDSHAKE_DONE, TLS_HANDSHAKE_DONE,
JsonTlsLogThreadInit, JsonTlsLogThreadDeinit, NULL);
}
-
-#else
-
-void JsonTlsLogRegister (void)
-{
-}
-
-#endif /* HAVE_LIBJANSSON */
-
void JsonTlsLogRegister(void);
-#ifdef HAVE_LIBJANSSON
#include "app-layer-ssl.h"
void JsonTlsLogJSONBasic(json_t *js, SSLState *ssl_state);
void JsonTlsLogJSONExtended(json_t *js, SSLState *ssl_state);
-#endif /* HAVE_LIBJANSSON */
#endif /* __OUTPUT_JSON_TLS_H__ */
#include "source-pcap-file.h"
-#ifndef HAVE_LIBJANSSON
-
-/** Handle the case where no JSON support is compiled in.
- *
- */
-
-int OutputJsonOpenFileCtx(LogFileCtx *, char *);
-
-void OutputJsonRegister (void)
-{
- SCLogDebug("Can't register JSON output - JSON support was disabled during build.");
-}
-
-#else /* implied we do have JSON support */
-
#define DEFAULT_LOG_FILENAME "eve.json"
#define DEFAULT_ALERT_SYSLOG_FACILITY_STR "local0"
#define DEFAULT_ALERT_SYSLOG_FACILITY LOG_LOCAL0
SCFree(json_ctx);
SCFree(output_ctx);
}
-
-#endif
void OutputJsonRegister(void);
-#ifdef HAVE_LIBJANSSON
-
enum OutputJsonLogDirection {
LOG_DIR_PACKET = 0,
LOG_DIR_FLOW,
void JsonAddCommonOptions(const OutputJsonCommonSettings *cfg,
const Packet *p, const Flow *f, json_t *js);
-#endif /* HAVE_LIBJANSSON */
-
#endif /* __OUTPUT_JSON_H__ */
"recompile with --enable-prelude to add Prelude "
"support.");
continue;
-#endif
- } else if (strcmp(output->val, "eve-log") == 0) {
-#ifndef HAVE_LIBJANSSON
- SCLogWarning(SC_ERR_NOT_SUPPORTED,
- "Eve-log support not compiled in. Reconfigure/"
- "recompile with libjansson and its development "
- "files installed to add eve-log support.");
- continue;
#endif
} else if (strcmp(output->val, "lua") == 0) {
#ifndef HAVE_LUA
#include <w32api/wtypes.h>
#endif
-#ifdef HAVE_LIBJANSSON
#include <jansson.h>
#ifndef JSON_ESCAPE_SLASH
#define JSON_ESCAPE_SLASH 0
#define json_boolean(val) SCJsonBool((val))
//#define json_boolean(val) ((val) ? json_true() : json_false())
#endif
-#endif
#ifdef HAVE_MAGIC
#include <magic.h>
#ifdef HAVE_LUAJIT
strlcat(features, "HAVE_LUAJIT ", sizeof(features));
#endif
-#ifdef HAVE_LIBJANSSON
strlcat(features, "HAVE_LIBJANSSON ", sizeof(features));
-#endif
#ifdef PROFILING
strlcat(features, "PROFILING ", sizeof(features));
#endif
}
if (!strcmp(value, "auto")) {
-#ifdef HAVE_LIBJANSSON
#ifdef OS_WIN32
return 0;
#else
} else {
return 0;
}
-#endif
-#else
- return 0;
#endif
}
return;
}
-#ifdef HAVE_LIBJANSSON
#include <jansson.h>
/**
*/
error:
return -1;
}
-#endif /* HAVE_LIBJANSSON */
/**
* \brief Adds the global log_format to the outgoing buffer
const unsigned int line, const char *function,
const SCError error_code, const char *message)
{
-#ifdef HAVE_LIBJANSSON
if (type == SC_LOG_OP_TYPE_JSON)
return SCLogMessageJSON(tval, buffer, buffer_size, log_level, file, line, function, error_code, message);
-#endif
char *temp = buffer;
const char *s = NULL;
if (strcmp(type_s, "regular") == 0)
type = SC_LOG_OP_TYPE_REGULAR;
else if (strcmp(type_s, "json") == 0) {
-#ifdef HAVE_LIBJANSSON
type = SC_LOG_OP_TYPE_JSON;
-#else
- SCLogError(SC_ERR_INVALID_ARGUMENT, "libjansson support not "
- "compiled in, can't use 'json' logging");
- exit(EXIT_FAILURE);
-#endif /* HAVE_LIBJANSSON */
}
}
append = DEFAULT_LOG_MODE_APPEND;
/* JSON flags */
-#ifdef HAVE_LIBJANSSON
log_ctx->json_flags = JSON_PRESERVE_ORDER|JSON_COMPACT|
JSON_ENSURE_ASCII|JSON_ESCAPE_SLASH;
if (escape_slash != NULL && ConfValIsFalse(escape_slash))
log_ctx->json_flags &= ~(JSON_ESCAPE_SLASH);
}
-#endif /* HAVE_LIBJANSSON */
// Now, what have we been asked to open?
if (strcasecmp(filetype, "unix_stream") == 0) {
int profiling_sghs_enabled = 0;
static char profiling_file_name[PATH_MAX];
static const char *profiling_file_mode = "a";
-#ifdef HAVE_LIBJANSSON
static int profiling_rulegroup_json = 0;
-#endif
void SCProfilingSghsGlobalInit(void)
{
profiling_sghs_output_to_file = 1;
}
if (ConfNodeChildValueIsTrue(conf, "json")) {
-#ifdef HAVE_LIBJANSSON
profiling_rulegroup_json = 1;
-#else
- SCLogWarning(SC_ERR_NO_JSON_SUPPORT, "no json support compiled in, using plain output");
-#endif
}
}
}
}
-#ifdef HAVE_LIBJANSSON
static void DoDumpJSON(SCProfileSghDetectCtx *rules_ctx, FILE *fp, const char *name)
{
char timebuf[64];
}
json_decref(js);
}
-#endif /* HAVE_LIBJANSSON */
static void DoDump(SCProfileSghDetectCtx *rules_ctx, FILE *fp, const char *name)
{
fp = stdout;
}
-#ifdef HAVE_LIBJANSSON
if (profiling_rulegroup_json) {
DoDumpJSON(de_ctx->profile_sgh_ctx, fp, "rule groups");
- } else
-#endif
- {
+ } else {
DoDump(de_ctx->profile_sgh_ctx, fp, "rule groups");
}
int profiling_rules_enabled = 0;
static char profiling_file_name[PATH_MAX] = "";
static const char *profiling_file_mode = "a";
-#ifdef HAVE_LIBJANSSON
static int profiling_rule_json = 0;
-#endif
/**
* Sort orders for dumping profiled rules.
profiling_output_to_file = 1;
}
if (ConfNodeChildValueIsTrue(conf, "json")) {
-#ifdef HAVE_LIBJANSSON
profiling_rule_json = 1;
-#else
- SCLogWarning(SC_ERR_NO_JSON_SUPPORT, "no json support compiled in, using plain output");
-#endif
}
}
}
return s0->max > s1->max ? -1 : 1;
}
-#ifdef HAVE_LIBJANSSON
-
static void DumpJson(FILE *fp, SCProfileSummary *summary,
uint32_t count, uint64_t total_ticks,
const char *sort_desc)
json_decref(js);
}
-#endif /* HAVE_LIBJANSSON */
-
static void DumpText(FILE *fp, SCProfileSummary *summary,
uint32_t count, uint64_t total_ticks,
const char *sort_desc)
sort_desc = "average ticks (no match)";
break;
}
-#ifdef HAVE_LIBJANSSON
if (profiling_rule_json) {
DumpJson(fp, summary, count, total_ticks, sort_desc);
- } else
-#endif
- {
+ } else {
DumpText(fp, summary, count, total_ticks, sort_desc);
}
order++;