diff --git a/src/decode.c b/src/decode.c index 95504d843d..7980e20195 100644 --- a/src/decode.c +++ b/src/decode.c @@ -382,6 +382,13 @@ void PacketDefragPktSetupParent(Packet *parent) DecodeSetNoPayloadInspectionFlag(parent); } +void PacketBypassCallback(Packet *p) +{ + if (p->BypassPacketsFlow) { + p->BypassPacketsFlow(p); + } +} + void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv) { /* register counters */ diff --git a/src/decode.h b/src/decode.h index 0a829ec2fa..bb4d39f96b 100644 --- a/src/decode.h +++ b/src/decode.h @@ -447,6 +447,9 @@ typedef struct Packet_ /** The release function for packet structure and data */ void (*ReleasePacket)(struct Packet_ *); + /** The function triggering bypass the flow in the capture method. + * Return 1 for success and 0 on error */ + int (*BypassPacketsFlow)(struct Packet_ *); /* pkt vars */ PktVar *pktvar; @@ -774,6 +777,7 @@ void CaptureStatsSetup(ThreadVars *tv, CaptureStats *s); (p)->vlanh[1] = NULL; \ (p)->payload = NULL; \ (p)->payload_len = 0; \ + (p)->BypassPacketsFlow = NULL; \ (p)->pktlen = 0; \ (p)->alerts.cnt = 0; \ (p)->alerts.drop.action = 0; \ @@ -902,6 +906,7 @@ int PacketCopyData(Packet *p, uint8_t *pktdata, int pktlen); int PacketSetData(Packet *p, uint8_t *pktdata, int pktlen); int PacketCopyDataOffset(Packet *p, int offset, uint8_t *data, int datalen); const char *PktSrcToString(enum PktSrcEnum pkt_src); +void PacketBypassCallback(Packet *p); DecodeThreadVars *DecodeThreadVarsAlloc(ThreadVars *); void DecodeThreadVarsFree(ThreadVars *, DecodeThreadVars *);