|
|
|
|
@ -50,6 +50,7 @@ typedef struct LogDNP3FileCtx_ {
|
|
|
|
|
LogFileCtx *file_ctx;
|
|
|
|
|
uint32_t flags;
|
|
|
|
|
uint8_t include_object_data;
|
|
|
|
|
bool include_metadata;
|
|
|
|
|
} LogDNP3FileCtx;
|
|
|
|
|
|
|
|
|
|
typedef struct LogDNP3LogThread_ {
|
|
|
|
|
@ -315,6 +316,9 @@ static int JsonDNP3LoggerToServer(ThreadVars *tv, void *thread_data,
|
|
|
|
|
if (unlikely(js == NULL)) {
|
|
|
|
|
return TM_ECODE_OK;
|
|
|
|
|
}
|
|
|
|
|
if (thread->dnp3log_ctx->include_metadata) {
|
|
|
|
|
JsonAddMetadata(p, f, js);
|
|
|
|
|
}
|
|
|
|
|
json_t *dnp3js = JsonDNP3LogRequest(tx);
|
|
|
|
|
if (dnp3js != NULL) {
|
|
|
|
|
json_object_set_new(js, "dnp3", dnp3js);
|
|
|
|
|
@ -341,6 +345,9 @@ static int JsonDNP3LoggerToClient(ThreadVars *tv, void *thread_data,
|
|
|
|
|
if (unlikely(js == NULL)) {
|
|
|
|
|
return TM_ECODE_OK;
|
|
|
|
|
}
|
|
|
|
|
if (thread->dnp3log_ctx->include_metadata) {
|
|
|
|
|
JsonAddMetadata(p, f, js);
|
|
|
|
|
}
|
|
|
|
|
json_t *dnp3js = JsonDNP3LogResponse(tx);
|
|
|
|
|
if (dnp3js != NULL) {
|
|
|
|
|
json_object_set_new(js, "dnp3", dnp3js);
|
|
|
|
|
@ -365,13 +372,14 @@ static void OutputDNP3LogDeInitCtxSub(OutputCtx *output_ctx)
|
|
|
|
|
static OutputInitResult OutputDNP3LogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
|
|
|
|
|
{
|
|
|
|
|
OutputInitResult result = { NULL, false };
|
|
|
|
|
OutputJsonCtx *ajt = parent_ctx->data;
|
|
|
|
|
OutputJsonCtx *json_ctx = parent_ctx->data;
|
|
|
|
|
|
|
|
|
|
LogDNP3FileCtx *dnp3log_ctx = SCCalloc(1, sizeof(*dnp3log_ctx));
|
|
|
|
|
if (unlikely(dnp3log_ctx == NULL)) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
dnp3log_ctx->file_ctx = ajt->file_ctx;
|
|
|
|
|
dnp3log_ctx->file_ctx = json_ctx->file_ctx;
|
|
|
|
|
dnp3log_ctx->include_metadata = json_ctx->include_metadata;
|
|
|
|
|
|
|
|
|
|
OutputCtx *output_ctx = SCCalloc(1, sizeof(*output_ctx));
|
|
|
|
|
if (unlikely(output_ctx == NULL)) {
|
|
|
|
|
|