From: Mats Klepsland Date: Wed, 4 May 2016 11:37:04 +0000 (+0200) Subject: template: register logger functions X-Git-Tag: suricata-3.1RC1~161 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4166ec306414230d1b69fb28710824ba27c3af0d;p=thirdparty%2Fsuricata.git template: register logger functions --- diff --git a/src/app-layer-template.c b/src/app-layer-template.c index 9506ea8415..c89e7b241d 100644 --- a/src/app-layer-template.c +++ b/src/app-layer-template.c @@ -364,6 +364,21 @@ static void *TemplateGetTx(void *state, uint64_t tx_id) return NULL; } +static void TemplateSetTxLogged(void *state, void *vtx, uint32_t logger) +{ + TemplateTransaction *tx = (TemplateTransaction *)vtx; + tx->logged |= logger; +} + +static int TemplateGetTxLogged(void *state, void *vtx, uint32_t logger) +{ + TemplateTransaction *tx = (TemplateTransaction *)vtx; + if (tx->logged & logger) + return 1; + + return 0; +} + /** * \brief Called by the application layer. * @@ -496,6 +511,9 @@ void RegisterTemplateParsers(void) AppLayerParserRegisterTxFreeFunc(IPPROTO_TCP, ALPROTO_TEMPLATE, TemplateStateTxFree); + AppLayerParserRegisterLoggerFuncs(IPPROTO_TCP, ALPROTO_TEMPLATE, + TemplateGetTxLogged, TemplateSetTxLogged); + /* Register a function to return the current transaction count. */ AppLayerParserRegisterGetTxCnt(IPPROTO_TCP, ALPROTO_TEMPLATE, TemplateGetTxCnt); diff --git a/src/app-layer-template.h b/src/app-layer-template.h index 4e58fa89b5..191e0933b5 100644 --- a/src/app-layer-template.h +++ b/src/app-layer-template.h @@ -37,6 +37,9 @@ typedef struct TemplateTransaction_ { uint8_t *request_buffer; uint32_t request_buffer_len; + /* flags indicating which loggers that have logged */ + uint32_t logged; + uint8_t *response_buffer; uint32_t response_buffer_len;