template: register logger functions

pull/2081/head
Mats Klepsland 10 years ago committed by Victor Julien
parent 593f81527a
commit 4166ec3064

@ -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);

@ -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;

Loading…
Cancel
Save