From: Victor Julien Date: Fri, 11 Oct 2019 10:06:59 +0000 (+0200) Subject: jansson: remove HAVE_LIBJANSSON guards X-Git-Tag: suricata-5.0.0~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edd2cd626fb126646c630bbf271f0d055898d62d;p=thirdparty%2Fsuricata.git jansson: remove HAVE_LIBJANSSON guards --- diff --git a/scripts/dnp3-gen/dnp3-gen.py b/scripts/dnp3-gen/dnp3-gen.py index 261b347fe4..ae2fef7baa 100755 --- a/scripts/dnp3-gen/dnp3-gen.py +++ b/scripts/dnp3-gen/dnp3-gen.py @@ -158,8 +158,6 @@ output_json_dnp3_objects_template = """/* Copyright (C) 2015 Open Information Se #include "app-layer-dnp3-objects.h" #include "output-json-dnp3-objects.h" -#ifdef HAVE_LIBJANSSON - void OutputJsonDNP3SetItem(json_t *js, DNP3Object *object, DNP3Point *point) { @@ -215,8 +213,6 @@ void OutputJsonDNP3SetItem(json_t *js, DNP3Object *object, } -#endif /* HAVE_LIBJANSSON */ - """ def has_freeable_types(fields): diff --git a/src/alert-prelude.c b/src/alert-prelude.c index b26ac4754c..81f8bf1d9a 100644 --- a/src/alert-prelude.c +++ b/src/alert-prelude.c @@ -53,16 +53,12 @@ #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 -#endif #include "util-privs.h" #include "util-optimize.h" @@ -473,7 +469,6 @@ static int AddIntData(idmef_alert_t *alert, const char *meaning, uint32_t data) 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). @@ -568,7 +563,6 @@ static int AddRealData(idmef_alert_t *alert, const char *meaning, uint32_t data) SCReturnInt(0); } -#endif /** * \brief Add IPv4 header data, to be stored in the Additional Data @@ -618,7 +612,6 @@ static int PacketToDataV6(const Packet *p, const PacketAlert *pa, idmef_alert_t 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 @@ -798,8 +791,6 @@ static void PacketToDataProtoEmail(const Packet *p, const PacketAlert *pa, idmef } -#endif - /** * \brief Convert IP packet to an IDMEF alert (RFC 4765). * This function stores the alert SID (description and reference), @@ -814,7 +805,6 @@ static int PacketToData(const Packet *p, const PacketAlert *pa, idmef_alert_t *a if (unlikely(p == NULL)) SCReturnInt(0); -#ifdef HAVE_LIBJANSSON if (p->flow != NULL) { uint16_t proto = FlowGetAppProtocol(p->flow); switch (proto) { @@ -834,7 +824,6 @@ static int PacketToData(const Packet *p, const PacketAlert *pa, idmef_alert_t *a break; } } -#endif AddIntData(alert, "snort_rule_sid", pa->s->id); AddIntData(alert, "snort_rule_rev", pa->s->rev); diff --git a/src/detect-engine-build.c b/src/detect-engine-build.c index a07644685c..71d103aa9b 100644 --- a/src/detect-engine-build.c +++ b/src/detect-engine-build.c @@ -617,7 +617,6 @@ static int RuleMpmIsNegated(const Signature *s) 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) { @@ -850,12 +849,10 @@ static json_t *RulesGroupPrintSghStats(const SigGroupHead *sgh, 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; @@ -930,7 +927,6 @@ static void RulesDumpGrouping(const DetectEngineCtx *de_ctx, fprintf(fp, "%s\n", js_s); free(js_s); fclose(fp); -#endif return; } @@ -1846,9 +1842,7 @@ static int SigMatchPrepare(DetectEngineCtx *de_ctx) 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; diff --git a/src/detect-engine-profile.c b/src/detect-engine-profile.c index 3b1d5cd782..fb2603234a 100644 --- a/src/detect-engine-profile.c +++ b/src/detect-engine-profile.c @@ -33,7 +33,6 @@ #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) { @@ -139,5 +138,4 @@ void RulesDumpMatchArray(const DetectEngineThreadCtx *det_ctx, json_object_clear(js); json_decref(js); } -#endif /* HAVE_LIBJANSSON */ #endif /* PROFILING */ diff --git a/src/detect-flowbits.c b/src/detect-flowbits.c index 651303bd0a..921beeba27 100644 --- a/src/detect-flowbits.c +++ b/src/detect-flowbits.c @@ -329,11 +329,9 @@ struct FBAnalyze { 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) { @@ -520,10 +518,8 @@ 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++) { @@ -536,7 +532,6 @@ end: } #ifdef PROFILING -#ifdef HAVE_LIBJANSSON #include "output-json.h" #include "util-buffer.h" SCMutex g_flowbits_dump_write_m = SCMUTEX_INITIALIZER; @@ -664,7 +659,6 @@ static void DetectFlowbitsAnalyzeDump(const DetectEngineCtx *de_ctx, json_object_clear(js); json_decref(js); } -#endif /* HAVE_LIBJANSSON */ #endif /* PROFILING */ #ifdef UNITTESTS diff --git a/src/detect.c b/src/detect.c index 62f430dc0b..890c743f2b 100644 --- a/src/detect.c +++ b/src/detect.c @@ -729,10 +729,8 @@ static inline void DetectRulePacketRules( 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; diff --git a/src/output-json-alert.c b/src/output-json-alert.c index c3bba04a87..b70be12082 100644 --- a/src/output-json-alert.c +++ b/src/output-json-alert.c @@ -80,8 +80,6 @@ #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) @@ -1005,12 +1003,3 @@ void JsonAlertLogRegister (void) JsonAlertLogCondition, JsonAlertLogThreadInit, JsonAlertLogThreadDeinit, NULL); } - -#else - -void JsonAlertLogRegister (void) -{ -} - -#endif - diff --git a/src/output-json-alert.h b/src/output-json-alert.h index 379ec8bb44..c8d3f7f456 100644 --- a/src/output-json-alert.h +++ b/src/output-json-alert.h @@ -28,10 +28,8 @@ #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__ */ diff --git a/src/output-json-anomaly.h b/src/output-json-anomaly.h index 2e58551b5d..d4b2249bd0 100644 --- a/src/output-json-anomaly.h +++ b/src/output-json-anomaly.h @@ -28,10 +28,8 @@ #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__ */ diff --git a/src/output-json-common.c b/src/output-json-common.c index d6c59b48dc..8165a96077 100644 --- a/src/output-json-common.c +++ b/src/output-json-common.c @@ -41,8 +41,6 @@ #include "app-layer.h" #include "app-layer-parser.h" -#ifdef HAVE_LIBJANSSON - static void OutputJsonLogDeInitCtxSub(OutputCtx *output_ctx) { SCFree(output_ctx->data); @@ -108,6 +106,3 @@ TmEcode JsonLogThreadDeinit(ThreadVars *t, void *data) SCFree(thread); return TM_ECODE_OK; } - -#endif /* HAVE_LIBJANSSON */ - diff --git a/src/output-json-dnp3-objects.c b/src/output-json-dnp3-objects.c index 2d44aaf0ea..67d05b645a 100644 --- a/src/output-json-dnp3-objects.c +++ b/src/output-json-dnp3-objects.c @@ -31,8 +31,6 @@ #include "output-json-dnp3-objects.h" #include "output-json.h" -#ifdef HAVE_LIBJANSSON - void OutputJsonDNP3SetItem(json_t *js, DNP3Object *object, DNP3Point *point) { @@ -2718,5 +2716,3 @@ void OutputJsonDNP3SetItem(json_t *js, DNP3Object *object, } } - -#endif /* HAVE_LIBJANSSON */ diff --git a/src/output-json-dnp3-objects.h b/src/output-json-dnp3-objects.h index 6517d0631d..5ff3c0ea30 100644 --- a/src/output-json-dnp3-objects.h +++ b/src/output-json-dnp3-objects.h @@ -18,9 +18,7 @@ #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__ */ diff --git a/src/output-json-dnp3.c b/src/output-json-dnp3.c index 5830fc0e20..dfa6ba054b 100644 --- a/src/output-json-dnp3.c +++ b/src/output-json-dnp3.c @@ -43,9 +43,6 @@ #include "output-json-dnp3.h" #include "output-json-dnp3-objects.h" -#ifdef HAVE_LIBJANSSON -#include - typedef struct LogDNP3FileCtx_ { LogFileCtx *file_ctx; uint32_t flags; @@ -449,11 +446,3 @@ void JsonDNP3LogRegister(void) JsonDNP3LoggerToClient, 1, 1, JsonDNP3LogThreadInit, JsonDNP3LogThreadDeinit, NULL); } - -#else - -void JsonDNP3LogRegister (void) -{ -} - -#endif diff --git a/src/output-json-dnp3.h b/src/output-json-dnp3.h index da1e019300..6d1232eebf 100644 --- a/src/output-json-dnp3.h +++ b/src/output-json-dnp3.h @@ -20,10 +20,8 @@ #include "app-layer-dnp3.h" -#ifdef HAVE_LIBJANSSON json_t *JsonDNP3LogRequest(DNP3Transaction *); json_t *JsonDNP3LogResponse(DNP3Transaction *); -#endif /* HAVE_LIBJANSSON */ void JsonDNP3LogRegister(void); diff --git a/src/output-json-drop.c b/src/output-json-drop.c index 6086267a21..51e8ad41a4 100644 --- a/src/output-json-drop.c +++ b/src/output-json-drop.c @@ -58,8 +58,6 @@ #define MODULE_NAME "JsonDropLog" -#ifdef HAVE_LIBJANSSON - #define LOG_DROP_ALERTS 1 typedef struct JsonDropOutputCtx_ { @@ -447,11 +445,3 @@ void JsonDropLogRegister (void) JsonDropLogCondition, JsonDropLogThreadInit, JsonDropLogThreadDeinit, NULL); } - -#else - -void JsonDropLogRegister (void) -{ -} - -#endif diff --git a/src/output-json-email-common.c b/src/output-json-email-common.c index 85ae62331b..2f5620a510 100644 --- a/src/output-json-email-common.c +++ b/src/output-json-email-common.c @@ -53,8 +53,6 @@ #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 */ @@ -465,6 +463,3 @@ void OutputEmailInitConf(ConfNode *conf, OutputJsonEmailCtx *email_ctx) } return; } - - -#endif diff --git a/src/output-json-email-common.h b/src/output-json-email-common.h index 70deaf9e57..bf3de4692c 100644 --- a/src/output-json-email-common.h +++ b/src/output-json-email-common.h @@ -24,7 +24,6 @@ #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 */ @@ -42,5 +41,4 @@ json_t *JsonEmailAddMetadata(const Flow *f, uint32_t tx_id); void OutputEmailInitConf(ConfNode *conf, OutputJsonEmailCtx *email_ctx); -#endif /* HAVE_LIBJANSSON */ #endif /* __OUTPUT_JSON_EMAIL_COMMON_H__ */ diff --git a/src/output-json-flow.c b/src/output-json-flow.c index 55f2b908e4..171b9424d9 100644 --- a/src/output-json-flow.c +++ b/src/output-json-flow.c @@ -50,8 +50,6 @@ #include "stream-tcp-private.h" #include "flow-storage.h" -#ifdef HAVE_LIBJANSSON - typedef struct LogJsonFileCtx_ { LogFileCtx *file_ctx; uint32_t flags; /** Store mode */ @@ -540,11 +538,3 @@ void JsonFlowLogRegister (void) "eve-log.flow", OutputFlowLogInitSub, JsonFlowLogger, JsonFlowLogThreadInit, JsonFlowLogThreadDeinit, NULL); } - -#else - -void JsonFlowLogRegister (void) -{ -} - -#endif diff --git a/src/output-json-flow.h b/src/output-json-flow.h index 0e105819c8..8af35ed041 100644 --- a/src/output-json-flow.h +++ b/src/output-json-flow.h @@ -25,8 +25,6 @@ #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__ */ diff --git a/src/output-json-ftp.c b/src/output-json-ftp.c index 021c7d1a88..8d4a087bda 100644 --- a/src/output-json-ftp.c +++ b/src/output-json-ftp.c @@ -49,8 +49,6 @@ #include "app-layer-ftp.h" #include "output-json-ftp.h" -#ifdef HAVE_LIBJANSSON - typedef struct LogFTPFileCtx_ { LogFileCtx *file_ctx; OutputJsonCommonSettings cfg; @@ -279,10 +277,3 @@ void JsonFTPLogRegister(void) SCLogDebug("FTP JSON logger registered."); } -#else /* HAVE_LIBJANSSON */ - -void JsonFTPLogRegister(void) -{ -} - -#endif /* HAVE_LIBJANSSON */ diff --git a/src/output-json-http.c b/src/output-json-http.c index dc9d95c63e..eb84e0b1ba 100644 --- a/src/output-json-http.c +++ b/src/output-json-http.c @@ -55,8 +55,6 @@ #include "output-json-http.h" #include "util-byte.h" -#ifdef HAVE_LIBJANSSON - typedef struct LogHttpFileCtx_ { LogFileCtx *file_ctx; uint32_t flags; /** Store mode */ @@ -813,11 +811,3 @@ void JsonHttpLogRegister (void) "eve-log.http", OutputHttpLogInitSub, ALPROTO_HTTP, JsonHttpLogger, JsonHttpLogThreadInit, JsonHttpLogThreadDeinit, NULL); } - -#else - -void JsonHttpLogRegister (void) -{ -} - -#endif diff --git a/src/output-json-http.h b/src/output-json-http.h index a37fe92fe6..12b4046d5b 100644 --- a/src/output-json-http.h +++ b/src/output-json-http.h @@ -26,11 +26,9 @@ 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__ */ diff --git a/src/output-json-ikev2.c b/src/output-json-ikev2.c index 26af90f9de..c36525ba3e 100644 --- a/src/output-json-ikev2.c +++ b/src/output-json-ikev2.c @@ -47,8 +47,6 @@ #include "app-layer-ikev2.h" #include "output-json-ikev2.h" -#ifdef HAVE_LIBJANSSON - #include "rust.h" #include "rust-ikev2-log-gen.h" @@ -178,11 +176,3 @@ void JsonIKEv2LogRegister(void) SCLogDebug("IKEv2 JSON logger registered."); } - -#else /* No JSON support. */ - -void JsonIKEv2LogRegister(void) -{ -} - -#endif /* HAVE_LIBJANSSON */ diff --git a/src/output-json-krb5.c b/src/output-json-krb5.c index 0578809a58..a6933c07ff 100644 --- a/src/output-json-krb5.c +++ b/src/output-json-krb5.c @@ -47,8 +47,6 @@ #include "app-layer-krb5.h" #include "output-json-krb5.h" -#ifdef HAVE_LIBJANSSON - #include "rust.h" #include "rust-krb-log-gen.h" @@ -179,11 +177,3 @@ void JsonKRB5LogRegister(void) SCLogDebug("KRB5 JSON logger registered."); } - -#else /* No JSON support. */ - -void JsonKRB5LogRegister(void) -{ -} - -#endif /* HAVE_LIBJANSSON */ diff --git a/src/output-json-metadata.c b/src/output-json-metadata.c index 25e71a3ea8..27d2223323 100644 --- a/src/output-json-metadata.c +++ b/src/output-json-metadata.c @@ -65,8 +65,6 @@ #define MODULE_NAME "JsonMetadataLog" -#ifdef HAVE_LIBJANSSON - #define JSON_STREAM_BUFFER_SIZE 4096 typedef struct MetadataJsonOutputCtx_ { @@ -289,11 +287,3 @@ void JsonMetadataLogRegister (void) JsonMetadataLogCondition, JsonMetadataLogThreadInit, JsonMetadataLogThreadDeinit, NULL); } - -#else - -void JsonMetadataLogRegister (void) -{ -} - -#endif diff --git a/src/output-json-netflow.c b/src/output-json-netflow.c index 093135feb4..5b544b534c 100644 --- a/src/output-json-netflow.c +++ b/src/output-json-netflow.c @@ -49,8 +49,6 @@ #include "stream-tcp-private.h" -#ifdef HAVE_LIBJANSSON - typedef struct LogJsonFileCtx_ { LogFileCtx *file_ctx; OutputJsonCommonSettings cfg; @@ -462,11 +460,3 @@ void JsonNetFlowLogRegister(void) "eve-log.netflow", OutputNetFlowLogInitSub, JsonNetFlowLogger, JsonNetFlowLogThreadInit, JsonNetFlowLogThreadDeinit, NULL); } - -#else - -void JsonNetFlowLogRegister (void) -{ -} - -#endif diff --git a/src/output-json-nfs.c b/src/output-json-nfs.c index e63495620c..7b5683b861 100644 --- a/src/output-json-nfs.c +++ b/src/output-json-nfs.c @@ -46,7 +46,6 @@ #include "output-json-nfs.h" -#ifdef HAVE_LIBJANSSON #include "rust.h" #include "rust-nfs-log-gen.h" @@ -133,11 +132,3 @@ void JsonNFSLogRegister(void) SCLogDebug("NFS JSON logger registered."); } - -#else /* No JSON support. */ - -void JsonNFSLogRegister(void) -{ -} - -#endif /* HAVE_LIBJANSSON */ diff --git a/src/output-json-sip.c b/src/output-json-sip.c index ab1ddce315..aea820e600 100644 --- a/src/output-json-sip.c +++ b/src/output-json-sip.c @@ -50,8 +50,6 @@ #include "rust.h" #include "rust-sip-log-gen.h" -#ifdef HAVE_LIBJANSSON - typedef struct LogSIPFileCtx_ { LogFileCtx *file_ctx; OutputJsonCommonSettings cfg; @@ -193,11 +191,3 @@ void JsonSIPLogRegister(void) SCLogDebug("SIP JSON logger registered."); } - -#else /* No JSON support. */ - -void JsonSIPLogRegister(void) -{ -} - -#endif /* HAVE_LIBJANSSON */ diff --git a/src/output-json-sip.h b/src/output-json-sip.h index 1cfde6c4be..bc8836dad6 100644 --- a/src/output-json-sip.h +++ b/src/output-json-sip.h @@ -26,8 +26,6 @@ void JsonSIPLogRegister(void); -#ifdef HAVE_LIBJANSSON json_t *JsonSIPAddMetadata(const Flow *f, uint64_t tx_id); -#endif /* HAVE_LIBJANSSON */ #endif /* __OUTPUT_JSON_SIP_H__ */ diff --git a/src/output-json-smb.c b/src/output-json-smb.c index e768c5f025..d5ada56d54 100644 --- a/src/output-json-smb.c +++ b/src/output-json-smb.c @@ -45,7 +45,6 @@ #include "output-json-smb.h" -#ifdef HAVE_LIBJANSSON #include "rust.h" #include "rust-smb-log-gen.h" @@ -107,12 +106,3 @@ void JsonSMBLogRegister(void) SCLogDebug("SMB JSON logger registered."); } - -#else /* No JSON support. */ - -void JsonSMBLogRegister(void) -{ -} - -#endif /* HAVE_LIBJANSSON */ - diff --git a/src/output-json-smtp.c b/src/output-json-smtp.c index 158e43a09a..75e646d440 100644 --- a/src/output-json-smtp.c +++ b/src/output-json-smtp.c @@ -52,8 +52,6 @@ #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(); @@ -276,11 +274,3 @@ void JsonSmtpLogRegister (void) { "eve-log.smtp", OutputSmtpLogInitSub, ALPROTO_SMTP, JsonSmtpLogger, JsonSmtpLogThreadInit, JsonSmtpLogThreadDeinit, NULL); } - -#else - -void JsonSmtpLogRegister (void) -{ -} - -#endif diff --git a/src/output-json-smtp.h b/src/output-json-smtp.h index 24d3f8c22d..8a8e1bf7bd 100644 --- a/src/output-json-smtp.h +++ b/src/output-json-smtp.h @@ -25,8 +25,6 @@ #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__ */ diff --git a/src/output-json-snmp.c b/src/output-json-snmp.c index 9f07d5ceba..b584a1c9af 100644 --- a/src/output-json-snmp.c +++ b/src/output-json-snmp.c @@ -47,8 +47,6 @@ #include "app-layer-snmp.h" #include "output-json-snmp.h" -#ifdef HAVE_LIBJANSSON - #include "rust.h" #include "rust-snmp-log-gen.h" @@ -178,11 +176,3 @@ void JsonSNMPLogRegister(void) SCLogDebug("SNMP JSON logger registered."); } - -#else /* No JSON support. */ - -void JsonSNMPLogRegister(void) -{ -} - -#endif /* HAVE_LIBJANSSON */ diff --git a/src/output-json-ssh.c b/src/output-json-ssh.c index 3d64e19678..348cae8359 100644 --- a/src/output-json-ssh.c +++ b/src/output-json-ssh.c @@ -50,8 +50,6 @@ #include "output-json.h" #include "output-json-ssh.h" -#ifdef HAVE_LIBJANSSON - #define MODULE_NAME "LogSshLog" typedef struct OutputSshCtx_ { @@ -273,11 +271,3 @@ void JsonSshLogRegister (void) SSH_STATE_BANNER_DONE, SSH_STATE_BANNER_DONE, JsonSshLogThreadInit, JsonSshLogThreadDeinit, NULL); } - -#else - -void JsonSshLogRegister (void) -{ -} - -#endif diff --git a/src/output-json-ssh.h b/src/output-json-ssh.h index 68a7f974c6..aa939b0934 100644 --- a/src/output-json-ssh.h +++ b/src/output-json-ssh.h @@ -26,10 +26,8 @@ void JsonSshLogRegister(void); -#ifdef HAVE_LIBJANSSON #include "app-layer-ssh.h" void JsonSshLogJSON(json_t *js, SshState *tx); -#endif #endif /* __OUTPUT_JSON_SSH_H__ */ diff --git a/src/output-json-stats.c b/src/output-json-stats.c index f890f22e3b..188a3311a9 100644 --- a/src/output-json-stats.c +++ b/src/output-json-stats.c @@ -50,8 +50,6 @@ #define MODULE_NAME "JsonStatsLog" -#ifdef HAVE_LIBJANSSON - extern bool stats_decoder_events; const char *stats_decoder_events_prefix; @@ -536,11 +534,3 @@ void JsonStatsLogRegister(void) { "eve-log.stats", OutputStatsLogInitSub, JsonStatsLogger, JsonStatsLogThreadInit, JsonStatsLogThreadDeinit, NULL); } - -#else - -void JsonStatsLogRegister (void) -{ -} - -#endif diff --git a/src/output-json-stats.h b/src/output-json-stats.h index 6cdec99e07..9b96d50012 100644 --- a/src/output-json-stats.h +++ b/src/output-json-stats.h @@ -30,11 +30,9 @@ #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__ */ diff --git a/src/output-json-template.c b/src/output-json-template.c index 2f09e62826..c91563307a 100644 --- a/src/output-json-template.c +++ b/src/output-json-template.c @@ -53,8 +53,6 @@ #include "app-layer-template.h" #include "output-json-template.h" -#ifdef HAVE_LIBJANSSON - typedef struct LogTemplateFileCtx_ { LogFileCtx *file_ctx; uint32_t flags; @@ -203,11 +201,3 @@ void JsonTemplateLogRegister(void) SCLogNotice("Template JSON logger registered."); } - -#else /* No JSON support. */ - -void JsonTemplateLogRegister(void) -{ -} - -#endif /* HAVE_LIBJANSSON */ diff --git a/src/output-json-tftp.c b/src/output-json-tftp.c index ec33f4d42f..94f5b05e94 100644 --- a/src/output-json-tftp.c +++ b/src/output-json-tftp.c @@ -51,8 +51,6 @@ #include "rust.h" #include "rust-tftp-log-gen.h" -#ifdef HAVE_LIBJANSSON - typedef struct LogTFTPFileCtx_ { LogFileCtx *file_ctx; uint32_t flags; @@ -177,11 +175,3 @@ void JsonTFTPLogRegister(void) SCLogDebug("TFTP JSON logger registered."); } - -#else /* HAVE_LIBJANSSON */ - -void JsonTFTPLogRegister(void) -{ -} - -#endif /* HAVE_LIBJANSSON */ diff --git a/src/output-json-tls.c b/src/output-json-tls.c index e70aebb7f6..fb4685f606 100644 --- a/src/output-json-tls.c +++ b/src/output-json-tls.c @@ -51,8 +51,6 @@ #include "output-json.h" #include "output-json-tls.h" -#ifdef HAVE_LIBJANSSON - SC_ATOMIC_DECLARE(unsigned int, cert_id); #define MODULE_NAME "LogTlsLog" @@ -665,12 +663,3 @@ void JsonTlsLogRegister (void) JsonTlsLogger, TLS_HANDSHAKE_DONE, TLS_HANDSHAKE_DONE, JsonTlsLogThreadInit, JsonTlsLogThreadDeinit, NULL); } - -#else - -void JsonTlsLogRegister (void) -{ -} - -#endif /* HAVE_LIBJANSSON */ - diff --git a/src/output-json-tls.h b/src/output-json-tls.h index 06657c8e85..799a8ea19c 100644 --- a/src/output-json-tls.h +++ b/src/output-json-tls.h @@ -26,11 +26,9 @@ 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__ */ diff --git a/src/output-json.c b/src/output-json.c index cf258707af..925d9664ea 100644 --- a/src/output-json.c +++ b/src/output-json.c @@ -66,21 +66,6 @@ #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 @@ -1100,5 +1085,3 @@ static void OutputJsonDeInitCtx(OutputCtx *output_ctx) SCFree(json_ctx); SCFree(output_ctx); } - -#endif diff --git a/src/output-json.h b/src/output-json.h index 99edefe1fb..34bde321d8 100644 --- a/src/output-json.h +++ b/src/output-json.h @@ -33,8 +33,6 @@ void OutputJsonRegister(void); -#ifdef HAVE_LIBJANSSON - enum OutputJsonLogDirection { LOG_DIR_PACKET = 0, LOG_DIR_FLOW, @@ -97,6 +95,4 @@ void SCJsonDecref(json_t *js); void JsonAddCommonOptions(const OutputJsonCommonSettings *cfg, const Packet *p, const Flow *f, json_t *js); -#endif /* HAVE_LIBJANSSON */ - #endif /* __OUTPUT_JSON_H__ */ diff --git a/src/runmodes.c b/src/runmodes.c index 1d7d82cbf0..47f774493d 100644 --- a/src/runmodes.c +++ b/src/runmodes.c @@ -765,14 +765,6 @@ void RunModeInitializeOutputs(void) "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 diff --git a/src/suricata-common.h b/src/suricata-common.h index c3f7e9e632..627de0d78e 100644 --- a/src/suricata-common.h +++ b/src/suricata-common.h @@ -236,7 +236,6 @@ #include #endif -#ifdef HAVE_LIBJANSSON #include #ifndef JSON_ESCAPE_SLASH #define JSON_ESCAPE_SLASH 0 @@ -246,7 +245,6 @@ #define json_boolean(val) SCJsonBool((val)) //#define json_boolean(val) ((val) ? json_true() : json_false()) #endif -#endif #ifdef HAVE_MAGIC #include diff --git a/src/suricata.c b/src/suricata.c index 38a323ecfb..709c7bfd12 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -750,9 +750,7 @@ static void PrintBuildInfo(void) #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 diff --git a/src/util-conf.c b/src/util-conf.c index ff2c490749..90db1f70f3 100644 --- a/src/util-conf.c +++ b/src/util-conf.c @@ -155,7 +155,6 @@ int ConfUnixSocketIsEnable(void) } if (!strcmp(value, "auto")) { -#ifdef HAVE_LIBJANSSON #ifdef OS_WIN32 return 0; #else @@ -165,9 +164,6 @@ int ConfUnixSocketIsEnable(void) } else { return 0; } -#endif -#else - return 0; #endif } diff --git a/src/util-debug.c b/src/util-debug.c index 84b0fd2cbe..d700d05786 100644 --- a/src/util-debug.c +++ b/src/util-debug.c @@ -200,7 +200,6 @@ static inline void SCLogPrintToSyslog(int syslog_log_level, const char *msg) return; } -#ifdef HAVE_LIBJANSSON #include /** */ @@ -264,7 +263,6 @@ static int SCLogMessageJSON(struct timeval *tval, char *buffer, size_t buffer_si error: return -1; } -#endif /* HAVE_LIBJANSSON */ /** * \brief Adds the global log_format to the outgoing buffer @@ -286,10 +284,8 @@ static SCError SCLogMessageGetBuffer( 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; @@ -1357,13 +1353,7 @@ void SCLogLoadConfig(int daemon, int verbose) 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 */ } } diff --git a/src/util-logopenfile.c b/src/util-logopenfile.c index 8eea87ab2c..ee825fa462 100644 --- a/src/util-logopenfile.c +++ b/src/util-logopenfile.c @@ -386,7 +386,6 @@ SCConfLogOpenGeneric(ConfNode *conf, 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; @@ -412,7 +411,6 @@ SCConfLogOpenGeneric(ConfNode *conf, 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) { diff --git a/src/util-profiling-rulegroups.c b/src/util-profiling-rulegroups.c index 66831b5fe0..c2e002dea0 100644 --- a/src/util-profiling-rulegroups.c +++ b/src/util-profiling-rulegroups.c @@ -66,9 +66,7 @@ static int profiling_sghs_output_to_file = 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) { @@ -96,17 +94,12 @@ 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]; @@ -165,7 +158,6 @@ static void DoDumpJSON(SCProfileSghDetectCtx *rules_ctx, FILE *fp, const char *n } json_decref(js); } -#endif /* HAVE_LIBJANSSON */ static void DoDump(SCProfileSghDetectCtx *rules_ctx, FILE *fp, const char *name) { @@ -252,12 +244,9 @@ SCProfilingSghDump(DetectEngineCtx *de_ctx) 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"); } diff --git a/src/util-profiling-rules.c b/src/util-profiling-rules.c index 74d8eff40f..f7beb0efe5 100644 --- a/src/util-profiling-rules.c +++ b/src/util-profiling-rules.c @@ -81,9 +81,7 @@ extern int profiling_output_to_file; 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. @@ -185,11 +183,7 @@ void SCProfilingRulesGlobalInit(void) 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 } } } @@ -294,8 +288,6 @@ SCProfileSummarySortByMaxTicks(const void *a, const void *b) 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) @@ -359,8 +351,6 @@ static void DumpJson(FILE *fp, SCProfileSummary *summary, json_decref(js); } -#endif /* HAVE_LIBJANSSON */ - static void DumpText(FILE *fp, SCProfileSummary *summary, uint32_t count, uint64_t total_ticks, const char *sort_desc) @@ -530,12 +520,9 @@ SCProfilingRuleDump(SCProfileDetectCtx *rules_ctx) 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++;