diff --git a/src/alert-json.c b/src/alert-json.c index 1140f1e4f4..b3f5fc5218 100644 --- a/src/alert-json.c +++ b/src/alert-json.c @@ -43,6 +43,7 @@ #include "detect-engine.h" #include "detect-engine-mpm.h" #include "detect-reference.h" +#include "app-layer-parser.h" #include "util-classification-config.h" #include "util-syslog.h" @@ -61,8 +62,8 @@ #include "alert-json.h" -/*#undef HAVE_LIBJANSSON for testing without messing with config */ #ifndef HAVE_LIBJANSSON + /** Handle the case where no JSON support is compiled in. * */ @@ -79,12 +80,7 @@ void TmModuleAlertJsonRegister (void) { tmm_modules[TMM_OUTPUTJSON].Func = AlertJson; tmm_modules[TMM_OUTPUTJSON].ThreadDeinit = AlertJsonThreadDeinit; tmm_modules[TMM_OUTPUTJSON].RegisterTests = AlertJsonRegisterTests; - - /* enable the logger for the app layer */ - AppLayerRegisterLogger(ALPROTO_DNS_UDP); - AppLayerRegisterLogger(ALPROTO_DNS_TCP); - - AppLayerRegisterLogger(ALPROTO_HTTP); +} OutputCtx *AlertJsonInitCtx(ConfNode *conf) { @@ -108,7 +104,8 @@ TmEcode AlertJsonThreadDeinit(ThreadVars *t, void *data) return TM_ECODE_FAILED; } -void AlertJsonRegisterTests (void) { +void AlertJsonRegisterTests (void) +{ } #else /* implied we do have JSON support */ @@ -147,6 +144,12 @@ void TmModuleAlertJsonRegister (void) { tmm_modules[TMM_OUTPUTJSON].cap_flags = 0; OutputRegisterModule(MODULE_NAME, "eve-log", AlertJsonInitCtx); + + /* enable the logger for the app layer */ + AppLayerRegisterLogger(ALPROTO_DNS_UDP); + AppLayerRegisterLogger(ALPROTO_DNS_TCP); + AppLayerRegisterLogger(ALPROTO_HTTP); + AppLayerRegisterLogger(ALPROTO_TLS); } /* Default Sensor ID value */ @@ -753,7 +756,6 @@ void AlertJsonRegisterTests(void) #ifdef UNITTESTS - #endif /* UNITTESTS */ } diff --git a/src/alert-json.h b/src/alert-json.h index da84d645dc..aa8e8fb1fd 100644 --- a/src/alert-json.h +++ b/src/alert-json.h @@ -24,10 +24,13 @@ #ifndef __ALERT_JSON_H__ #define __ALERT_JSON_H__ +void TmModuleAlertJsonRegister (void); + +#ifdef HAVE_LIBJANSSON + json_t *CreateJSONHeader(Packet *p, int direction_sensative); TmEcode OutputJSON(json_t *js, void *data, uint64_t *count); -void TmModuleAlertJsonRegister (void); void TmModuleAlertJsonIPv4Register (void); void TmModuleAlertJsonPv6Register (void); OutputCtx *AlertJsonInitCtx(ConfNode *); @@ -57,5 +60,7 @@ typedef struct AlertJsonThread_ { OutputCtx *tls_ctx; } AlertJsonThread; +#endif /* HAVE_LIBJANSSON */ + #endif /* __ALERT_JSON_H__ */