#ifdef HAVE_LIBJANSSON
#include <jansson.h>
-static json_t *JsonSmtpDataLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f, void *state, void *vtx, uint64_t tx_id)
+static json_t *JsonSmtpDataLogger(const Flow *f, void *state, void *vtx, uint64_t tx_id)
{
json_t *sjs = json_object();
SMTPTransaction *tx = vtx;
/* reset */
MemBufferReset(buffer);
- sjs = JsonSmtpDataLogger(tv, thread_data, p, f, state, tx, tx_id);
+ sjs = JsonSmtpDataLogger(f, state, tx, tx_id);
if (sjs) {
json_object_set_new(js, "smtp", sjs);
}
}
+json_t *JsonSMTPAddMetadata(const Flow *f)
+{
+ SMTPState *smtp_state = (SMTPState *)FlowGetAppState(f);
+ if (smtp_state) {
+ uint64_t tx_id = AppLayerParserGetTransactionLogId(f->alparser);
+ SMTPTransaction *tx = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_SMTP, smtp_state, tx_id);
+
+ if (tx) {
+ return JsonSmtpDataLogger(f, smtp_state, tx, tx_id);
+ }
+ }
+
+ return NULL;
+}
+
static void OutputSmtpLogDeInitCtx(OutputCtx *output_ctx)
{
OutputJsonEmailCtx *email_ctx = output_ctx->data;