dnp3: support AppLayerTxData

pull/5168/head
Victor Julien 6 years ago
parent 77a95eddd9
commit 302cf49486

@ -1551,16 +1551,10 @@ static int DNP3SetTxDetectState(void *vtx, DetectEngineState *s)
return 0; return 0;
} }
static void DNP3SetTxLogged(void *alstate, void *vtx, LoggerId logged) static AppLayerTxData *DNP3GetTxData(void *vtx)
{ {
DNP3Transaction *tx = (DNP3Transaction *)vtx; DNP3Transaction *tx = (DNP3Transaction *)vtx;
tx->logged = logged; return &tx->tx_data;
}
static LoggerId DNP3GetTxLogged(void *alstate, void *vtx)
{
DNP3Transaction *tx = (DNP3Transaction *)vtx;
return tx->logged;
} }
/** /**
@ -1581,27 +1575,6 @@ int DNP3PrefixIsSize(uint8_t prefix_code)
} }
} }
static uint64_t DNP3GetTxDetectFlags(void *vtx, uint8_t dir)
{
DNP3Transaction *tx = (DNP3Transaction *)vtx;
if (dir & STREAM_TOSERVER) {
return tx->detect_flags_ts;
} else {
return tx->detect_flags_tc;
}
}
static void DNP3SetTxDetectFlags(void *vtx, uint8_t dir, uint64_t detect_flags)
{
DNP3Transaction *tx = (DNP3Transaction *)vtx;
if (dir & STREAM_TOSERVER) {
tx->detect_flags_ts = detect_flags;
} else {
tx->detect_flags_tc = detect_flags;
}
return;
}
/** /**
* \brief Register the DNP3 application protocol parser. * \brief Register the DNP3 application protocol parser.
*/ */
@ -1650,8 +1623,6 @@ void RegisterDNP3Parsers(void)
DNP3GetEvents); DNP3GetEvents);
AppLayerParserRegisterDetectStateFuncs(IPPROTO_TCP, ALPROTO_DNP3, AppLayerParserRegisterDetectStateFuncs(IPPROTO_TCP, ALPROTO_DNP3,
DNP3GetTxDetectState, DNP3SetTxDetectState); DNP3GetTxDetectState, DNP3SetTxDetectState);
AppLayerParserRegisterDetectFlagsFuncs(IPPROTO_TCP, ALPROTO_DNP3,
DNP3GetTxDetectFlags, DNP3SetTxDetectFlags);
AppLayerParserRegisterGetTx(IPPROTO_TCP, ALPROTO_DNP3, DNP3GetTx); AppLayerParserRegisterGetTx(IPPROTO_TCP, ALPROTO_DNP3, DNP3GetTx);
AppLayerParserRegisterGetTxCnt(IPPROTO_TCP, ALPROTO_DNP3, DNP3GetTxCnt); AppLayerParserRegisterGetTxCnt(IPPROTO_TCP, ALPROTO_DNP3, DNP3GetTxCnt);
@ -1668,8 +1639,8 @@ void RegisterDNP3Parsers(void)
AppLayerParserRegisterGetEventInfoById(IPPROTO_TCP, ALPROTO_DNP3, AppLayerParserRegisterGetEventInfoById(IPPROTO_TCP, ALPROTO_DNP3,
DNP3StateGetEventInfoById); DNP3StateGetEventInfoById);
AppLayerParserRegisterLoggerFuncs(IPPROTO_TCP, ALPROTO_DNP3, AppLayerParserRegisterTxDataFunc(IPPROTO_TCP, ALPROTO_DNP3,
DNP3GetTxLogged, DNP3SetTxLogged); DNP3GetTxData);
} }
else { else {
SCLogConfig("Parser disabled for protocol %s. " SCLogConfig("Parser disabled for protocol %s. "

@ -21,6 +21,7 @@
#include "detect-engine-state.h" #include "detect-engine-state.h"
#include "util-hashlist.h" #include "util-hashlist.h"
#include "util-byte.h" #include "util-byte.h"
#include "rust.h"
/** /**
* The maximum size of a DNP3 link PDU. * The maximum size of a DNP3 link PDU.
@ -207,12 +208,9 @@ typedef TAILQ_HEAD(DNP3ObjectList_, DNP3Object_) DNP3ObjectList;
* \brief DNP3 transaction. * \brief DNP3 transaction.
*/ */
typedef struct DNP3Transaction_ { typedef struct DNP3Transaction_ {
/** detection engine flags */ AppLayerTxData tx_data;
uint64_t detect_flags_ts;
uint64_t detect_flags_tc;
uint64_t tx_num; /**< Internal transaction ID. */ uint64_t tx_num; /**< Internal transaction ID. */
uint32_t logged; /**< Flags indicating which loggers have logged this tx. */
struct DNP3State_ *dnp3; struct DNP3State_ *dnp3;

Loading…
Cancel
Save