From: Mats Klepsland Date: Wed, 4 May 2016 10:53:55 +0000 (+0200) Subject: smtp: register logger functions X-Git-Tag: suricata-3.1RC1~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d484812d05669b10e82a5f782666d7e57fe43955;p=thirdparty%2Fsuricata.git smtp: register logger functions --- diff --git a/src/app-layer-smtp.c b/src/app-layer-smtp.c index d89b2c3588..5f89aea034 100644 --- a/src/app-layer-smtp.c +++ b/src/app-layer-smtp.c @@ -1545,6 +1545,21 @@ static void *SMTPStateGetTx(void *state, uint64_t id) } +static void SMTPStateSetTxLogged(void *state, void *vtx, uint32_t logger) +{ + SMTPTransaction *tx = vtx; + tx->logged |= logger; +} + +static int SMTPStateGetTxLogged(void *state, void *vtx, uint32_t logger) +{ + SMTPTransaction *tx = vtx; + if (tx->logged & logger) + return 1; + + return 0; +} + static int SMTPStateGetAlstateProgressCompletionStatus(uint8_t direction) { return 1; } @@ -1642,6 +1657,8 @@ void RegisterSMTPParsers(void) AppLayerParserRegisterGetStateProgressFunc(IPPROTO_TCP, ALPROTO_SMTP, SMTPStateGetAlstateProgress); AppLayerParserRegisterGetTxCnt(IPPROTO_TCP, ALPROTO_SMTP, SMTPStateGetTxCnt); AppLayerParserRegisterGetTx(IPPROTO_TCP, ALPROTO_SMTP, SMTPStateGetTx); + AppLayerParserRegisterLoggerFuncs(IPPROTO_TCP, ALPROTO_SMTP, SMTPStateGetTxLogged, + SMTPStateSetTxLogged); AppLayerParserRegisterGetStateProgressCompletionStatus(ALPROTO_SMTP, SMTPStateGetAlstateProgressCompletionStatus); AppLayerParserRegisterTruncateFunc(IPPROTO_TCP, ALPROTO_SMTP, SMTPStateTruncate); diff --git a/src/app-layer-smtp.h b/src/app-layer-smtp.h index 06ade068c7..f36029efe1 100644 --- a/src/app-layer-smtp.h +++ b/src/app-layer-smtp.h @@ -66,6 +66,8 @@ typedef struct SMTPTransaction_ { /** id of this tx, starting at 0 */ uint64_t tx_id; int done; + /** indicates loggers done logging */ + uint32_t logged; /** the first message contained in the session */ MimeDecEntity *msg_head; /** the last message contained in the session */