suricata
detect-engine-prefilter.h
Go to the documentation of this file.
1 /* Copyright (C) 2016 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Victor Julien <victor@inliniac.net>
22  */
23 
24 #ifndef __DETECT_ENGINE_PREFILTER_H__
25 #define __DETECT_ENGINE_PREFILTER_H__
26 
27 #include "detect.h"
28 #include "detect-engine-state.h"
29 
30 // TODO
31 typedef struct DetectTransaction_ {
32  void *tx_ptr;
33  const uint64_t tx_id;
36  const uint64_t detect_flags; /* detect flags get/set from/to applayer */
37  uint64_t prefilter_flags; /* prefilter flags for direction, to be updated by prefilter code */
38  const uint64_t
39  prefilter_flags_orig; /* prefilter flags for direction, before prefilter has run */
40  const int tx_progress;
41  const int tx_end_state;
43 
44 typedef struct PrefilterStore_ {
45  const char *name;
46  void (*FreeFunc)(void *);
47  uint32_t id;
49 
51  const uint8_t flags);
52 
54  void (*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
55  void *pectx, void (*FreeFunc)(void *pectx),
56  const char *name);
58  void (*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
59  void *pectx, void (*FreeFunc)(void *pectx),
60  const char *name);
62  PrefilterTxFn PrefilterTxFunc, const AppProto alproto, const int tx_min_progress,
63  void *pectx, void (*FreeFunc)(void *pectx), const char *name);
65  PrefilterFrameFn PrefilterFrameFunc, AppProto alproto, uint8_t frame_type, void *pectx,
66  void (*FreeFunc)(void *pectx), const char *name);
67 
69  const SigGroupHead *sgh,
70  Packet *p,
71  const uint8_t ipproto,
72  const uint8_t flow_flags,
73  const AppProto alproto,
74  void *alstate,
75  DetectTransaction *tx);
76 
78 
81 
82 #ifdef PROFILING
83 const char *PrefilterStoreGetName(const uint32_t id);
84 #endif
85 
88 
90  SigGroupHead *sgh, MpmCtx *mpm_ctx,
91  const DetectBufferMpmRegistery *mpm_reg, int list_id);
92 
94  SigGroupHead *sgh, MpmCtx *mpm_ctx,
95  const DetectBufferMpmRegistery *mpm_reg, int list_id);
96 
97 
98 #endif
DetectTransaction_::tx_data_ptr
struct AppLayerTxData * tx_data_ptr
Definition: detect-engine-prefilter.h:34
PrefilterAppendTxEngine
int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, PrefilterTxFn PrefilterTxFunc, const AppProto alproto, const int tx_min_progress, void *pectx, void(*FreeFunc)(void *pectx), const char *name)
Definition: detect-engine-prefilter.c:270
PrefilterGenericMpmRegister
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistery *mpm_reg, int list_id)
Definition: detect-engine-prefilter.c:749
PrefilterStore_::FreeFunc
void(* FreeFunc)(void *)
Definition: detect-engine-prefilter.h:46
PrefilterStore_
Definition: detect-engine-prefilter.h:44
SigGroupHead_
Container for matching data for a signature group.
Definition: detect.h:1393
DetectRunPrefilterTx
void DetectRunPrefilterTx(DetectEngineThreadCtx *det_ctx, const SigGroupHead *sgh, Packet *p, const uint8_t ipproto, const uint8_t flow_flags, const AppProto alproto, void *alstate, DetectTransaction *tx)
run prefilter engines on a transaction
Definition: detect-engine-prefilter.c:93
AppProto
uint16_t AppProto
Definition: app-layer-protos.h:81
DetectTransaction_::tx_end_state
const int tx_end_state
Definition: detect-engine-prefilter.h:41
PrefilterDeinit
void PrefilterDeinit(DetectEngineCtx *de_ctx)
Definition: detect-engine-prefilter.c:622
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:784
PrefilterAppendFrameEngine
int PrefilterAppendFrameEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, PrefilterFrameFn PrefilterFrameFunc, AppProto alproto, uint8_t frame_type, void *pectx, void(*FreeFunc)(void *pectx), const char *name)
Definition: detect-engine-prefilter.c:307
DetectBufferMpmRegistery_
one time registration of keywords at start up
Definition: detect.h:625
DetectTransaction_::tx_progress
const int tx_progress
Definition: detect-engine-prefilter.h:40
DetectTransaction_::prefilter_flags_orig
const uint64_t prefilter_flags_orig
Definition: detect-engine-prefilter.h:39
PrefilterStore_::id
uint32_t id
Definition: detect-engine-prefilter.h:47
PrefilterAppendPayloadEngine
int PrefilterAppendPayloadEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, void(*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx), void *pectx, void(*FreeFunc)(void *pectx), const char *name)
Definition: detect-engine-prefilter.c:236
PrefilterCleanupRuleGroup
void PrefilterCleanupRuleGroup(const DetectEngineCtx *de_ctx, SigGroupHead *sgh)
Definition: detect-engine-prefilter.c:378
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:17
DetectTransaction
struct DetectTransaction_ DetectTransaction
DetectEngineThreadCtx_
Definition: detect.h:1024
PrefilterFreeEnginesList
void PrefilterFreeEnginesList(PrefilterEngineList *list)
Definition: detect-engine-prefilter.c:350
PrefilterFrameFn
void(* PrefilterFrameFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, const struct Frames *frames, const struct Frame *frame, const uint32_t idx)
Definition: detect.h:1298
detect.h
PrefilterStoreGetName
const char * PrefilterStoreGetName(const uint32_t id)
Definition: detect-engine-prefilter.c:694
DetectTransaction_::tx_id
const uint64_t tx_id
Definition: detect-engine-prefilter.h:33
PrefilterStore
struct PrefilterStore_ PrefilterStore
DetectTransaction_::prefilter_flags
uint64_t prefilter_flags
Definition: detect-engine-prefilter.h:37
Packet_
Definition: decode.h:425
DetectTransaction_::de_state
DetectEngineStateDirection * de_state
Definition: detect-engine-prefilter.h:35
detect-engine-state.h
Data structures and function prototypes for keeping state for the detection engine.
PrefilterTxFn
void(* PrefilterTxFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f, void *tx, const uint64_t tx_id, const AppLayerTxData *tx_data, const uint8_t flags)
Definition: detect.h:1302
PrefilterInit
void PrefilterInit(DetectEngineCtx *de_ctx)
Definition: detect-engine-prefilter.c:629
AppLayerTxData
struct AppLayerTxData AppLayerTxData
Definition: detect.h:1301
Prefilter
void Prefilter(DetectEngineThreadCtx *, const SigGroupHead *, Packet *p, const uint8_t flags)
Definition: detect-engine-prefilter.c:143
flags
uint8_t flags
Definition: decode-gre.h:0
DetectTransaction_
Definition: detect-engine-prefilter.h:31
PrefilterEngineList_
Definition: detect.h:1305
DetectEngineStateDirection_
Definition: detect-engine-state.h:83
PrefilterAppendEngine
int PrefilterAppendEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, void(*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx), void *pectx, void(*FreeFunc)(void *pectx), const char *name)
Definition: detect-engine-prefilter.c:202
DetectTransaction_::tx_ptr
void * tx_ptr
Definition: detect-engine-prefilter.h:32
PrefilterStore_::name
const char * name
Definition: detect-engine-prefilter.h:45
PrefilterSetupRuleGroup
void PrefilterSetupRuleGroup(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
Definition: detect-engine-prefilter.c:413
PrefilterGenericMpmPktRegister
int PrefilterGenericMpmPktRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistery *mpm_reg, int list_id)
Definition: detect-engine-prefilter.c:820
MpmCtx_
Definition: util-mpm.h:88
DetectTransaction_::detect_flags
const uint64_t detect_flags
Definition: detect-engine-prefilter.h:36