suricata
detect.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2022 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_H__
25 #define __DETECT_H__
26 
27 #include "suricata-common.h"
28 #include "flow.h"
29 #include "app-layer-events.h"
30 
31 #include "detect-engine-proto.h"
32 #include "detect-reference.h"
33 #include "detect-metadata.h"
34 #include "detect-engine-register.h"
35 
36 #include "util-prefilter.h"
37 #include "util-mpm.h"
38 #include "util-spm.h"
39 #include "util-hash.h"
40 #include "util-hashlist.h"
41 #include "util-radix-tree.h"
42 #include "util-file.h"
43 #include "reputation.h"
44 
45 #define DETECT_MAX_RULE_SIZE 8192
46 
47 #define DETECT_TRANSFORMS_MAX 16
48 
49 /** default rule priority if not set through priority keyword or via
50  * classtype. */
51 #define DETECT_DEFAULT_PRIO 3
52 
53 /* forward declarations for the structures from detect-engine-sigorder.h */
54 struct SCSigOrderFunc_;
56 
57 /*
58  The detection engine groups similar signatures/rules together. Internally a
59  tree of different types of data is created on initialization. This is it's
60  global layout:
61 
62  For TCP/UDP
63 
64  - Flow direction
65  -- Protocol
66  -=- Dst port
67 
68  For the other protocols
69 
70  - Flow direction
71  -- Protocol
72 */
73 
74 /* holds the values for different possible lists in struct Signature.
75  * These codes are access points to particular lists in the array
76  * Signature->sm_lists[DETECT_SM_LIST_MAX]. */
80 
81  /* base64_data keyword uses some hardcoded logic so consider
82  * built-in
83  * TODO convert to inspect engine */
85 
86  /* list for post match actions: flowbit set, flowint increment, etc */
88 
89  DETECT_SM_LIST_TMATCH, /**< post-detection tagging */
90 
91  /* lists for alert thresholding and suppression */
94 
96 
97  /* start of dynamically registered lists */
99 };
100 
101 /* used for Signature->list, which indicates which list
102  * we're adding keywords to in cases of sticky buffers like
103  * file_data */
104 #define DETECT_SM_LIST_NOTSET INT_MAX
105 
106 /*
107  * DETECT ADDRESS
108  */
109 
110 /* a is ... than b */
111 enum {
112  ADDRESS_ER = -1, /**< error e.g. compare ipv4 and ipv6 */
113  ADDRESS_LT, /**< smaller [aaa] [bbb] */
114  ADDRESS_LE, /**< smaller with overlap [aa[bab]bb] */
115  ADDRESS_EQ, /**< exactly equal [abababab] */
116  ADDRESS_ES, /**< within [bb[aaa]bb] and [[abab]bbb] and [bbb[abab]] */
117  ADDRESS_EB, /**< completely overlaps [aa[bbb]aa] and [[baba]aaa] and [aaa[baba]] */
118  ADDRESS_GE, /**< bigger with overlap [bb[aba]aa] */
119  ADDRESS_GT, /**< bigger [bbb] [aaa] */
120 };
121 
122 #define ADDRESS_FLAG_NOT 0x01 /**< address is negated */
123 
124 /** \brief address structure for use in the detection engine.
125  *
126  * Contains the address information and matching information.
127  */
128 typedef struct DetectAddress_ {
129  /** address data for this group */
132 
133  /** flags affecting this address */
134  uint8_t flags;
135 
136  /** ptr to the previous address in the list */
138  /** ptr to the next address in the list */
141 
142 /** Address grouping head. IPv4 and IPv6 are split out */
143 typedef struct DetectAddressHead_ {
147 
148 
149 typedef struct DetectMatchAddressIPv4_ {
150  uint32_t ip; /**< address in host order, start of range */
151  uint32_t ip2; /**< address in host order, end of range */
153 
154 typedef struct DetectMatchAddressIPv6_ {
155  uint32_t ip[4];
156  uint32_t ip2[4];
158 
159 /*
160  * DETECT PORT
161  */
162 
163 /* a is ... than b */
164 enum {
165  PORT_ER = -1, /* error e.g. compare ipv4 and ipv6 */
166  PORT_LT, /* smaller [aaa] [bbb] */
167  PORT_LE, /* smaller with overlap [aa[bab]bb] */
168  PORT_EQ, /* exactly equal [abababab] */
169  PORT_ES, /* within [bb[aaa]bb] and [[abab]bbb] and [bbb[abab]] */
170  PORT_EB, /* completely overlaps [aa[bbb]aa] and [[baba]aaa] and [aaa[baba]] */
171  PORT_GE, /* bigger with overlap [bb[aba]aa] */
172  PORT_GT, /* bigger [bbb] [aaa] */
173 };
174 
175 #define PORT_FLAG_ANY 0x01 /**< 'any' special port */
176 #define PORT_FLAG_NOT 0x02 /**< negated port */
177 #define PORT_SIGGROUPHEAD_COPY 0x04 /**< sgh is a ptr copy */
178 
179 /** \brief Port structure for detection engine */
180 typedef struct DetectPort_ {
181  uint16_t port;
182  uint16_t port2;
183 
184  uint8_t flags; /**< flags for this port */
185 
186  /* signatures that belong in this group
187  *
188  * If the PORT_SIGGROUPHEAD_COPY flag is set, we don't own this pointer
189  * (memory is freed elsewhere).
190  */
191  struct SigGroupHead_ *sh;
192 
193  struct DetectPort_ *prev;
194  struct DetectPort_ *next;
196 
197 /* Signature flags */
198 /** \note: additions should be added to the rule analyzer as well */
199 
200 #define SIG_FLAG_SRC_ANY BIT_U32(0) /**< source is any */
201 #define SIG_FLAG_DST_ANY BIT_U32(1) /**< destination is any */
202 #define SIG_FLAG_SP_ANY BIT_U32(2) /**< source port is any */
203 #define SIG_FLAG_DP_ANY BIT_U32(3) /**< destination port is any */
204 
205 #define SIG_FLAG_NOALERT BIT_U32(4) /**< no alert flag is set */
206 #define SIG_FLAG_DSIZE BIT_U32(5) /**< signature has a dsize setting */
207 #define SIG_FLAG_APPLAYER BIT_U32(6) /**< signature applies to app layer instead of packets */
208 #define SIG_FLAG_IPONLY BIT_U32(7) /**< ip only signature */
209 #define SIG_FLAG_LIKE_IPONLY \
210  BIT_U32(8) /**< signature that is almost ip only, but contains negation prevening some iponly \
211  optimizations */
212 
213 // vacancy
214 
215 #define SIG_FLAG_REQUIRE_PACKET BIT_U32(9) /**< signature is requiring packet match */
216 #define SIG_FLAG_REQUIRE_STREAM BIT_U32(10) /**< signature is requiring stream match */
217 
218 #define SIG_FLAG_MPM_NEG BIT_U32(11)
219 
220 #define SIG_FLAG_FLUSH BIT_U32(12) /**< detection logic needs stream flush notification */
221 
222 // vacancies
223 
224 #define SIG_FLAG_REQUIRE_FLOWVAR BIT_U32(17) /**< signature can only match if a flowbit, flowvar or flowint is available. */
225 
226 #define SIG_FLAG_FILESTORE BIT_U32(18) /**< signature has filestore keyword */
227 
228 #define SIG_FLAG_TOSERVER BIT_U32(19)
229 #define SIG_FLAG_TOCLIENT BIT_U32(20)
230 
231 #define SIG_FLAG_TLSSTORE BIT_U32(21)
232 
233 #define SIG_FLAG_BYPASS BIT_U32(22)
234 
235 #define SIG_FLAG_PREFILTER BIT_U32(23) /**< sig is part of a prefilter engine */
236 
237 /** Proto detect only signature.
238  * Inspected once per direction when protocol detection is done. */
239 #define SIG_FLAG_PDONLY BIT_U32(24)
240 /** Info for Source and Target identification */
241 #define SIG_FLAG_SRC_IS_TARGET BIT_U32(25)
242 /** Info for Source and Target identification */
243 #define SIG_FLAG_DEST_IS_TARGET BIT_U32(26)
244 
245 #define SIG_FLAG_HAS_TARGET (SIG_FLAG_DEST_IS_TARGET|SIG_FLAG_SRC_IS_TARGET)
246 
247 /* signature init flags */
248 #define SIG_FLAG_INIT_DEONLY BIT_U32(0) /**< decode event only signature */
249 #define SIG_FLAG_INIT_PACKET BIT_U32(1) /**< signature has matches against a packet (as opposed to app layer) */
250 #define SIG_FLAG_INIT_FLOW BIT_U32(2) /**< signature has a flow setting */
251 #define SIG_FLAG_INIT_BIDIREC BIT_U32(3) /**< signature has bidirectional operator */
252 #define SIG_FLAG_INIT_FIRST_IPPROTO_SEEN BIT_U32(4) /** < signature has seen the first ip_proto keyword */
253 #define SIG_FLAG_INIT_HAS_TRANSFORM BIT_U32(5)
254 #define SIG_FLAG_INIT_STATE_MATCH BIT_U32(6) /**< signature has matches that require stateful inspection */
255 #define SIG_FLAG_INIT_NEED_FLUSH BIT_U32(7)
256 #define SIG_FLAG_INIT_PRIO_EXPLICT BIT_U32(8) /**< priority is explicitly set by the priority keyword */
257 #define SIG_FLAG_INIT_FILEDATA BIT_U32(9) /**< signature has filedata keyword */
258 #define SIG_FLAG_INIT_JA3 BIT_U32(10) /**< signature has ja3 keyword */
259 
260 /* signature mask flags */
261 /** \note: additions should be added to the rule analyzer as well */
262 #define SIG_MASK_REQUIRE_PAYLOAD BIT_U8(0)
263 #define SIG_MASK_REQUIRE_FLOW BIT_U8(1)
264 #define SIG_MASK_REQUIRE_FLAGS_INITDEINIT BIT_U8(2) /* SYN, FIN, RST */
265 #define SIG_MASK_REQUIRE_FLAGS_UNUSUAL BIT_U8(3) /* URG, ECN, CWR */
266 #define SIG_MASK_REQUIRE_NO_PAYLOAD BIT_U8(4)
267 #define SIG_MASK_REQUIRE_DCERPC BIT_U8(5) /* require either SMB+DCE or raw DCE */
268 // vacancy
269 #define SIG_MASK_REQUIRE_ENGINE_EVENT BIT_U8(7)
270 
271 /* for now a uint8_t is enough */
272 #define SignatureMask uint8_t
273 
274 #define DETECT_ENGINE_THREAD_CTX_FRAME_ID_SET 0x0001
275 #define DETECT_ENGINE_THREAD_CTX_STREAM_CONTENT_MATCH 0x0004
276 
277 #define FILE_SIG_NEED_FILE 0x01
278 #define FILE_SIG_NEED_FILENAME 0x02
279 #define FILE_SIG_NEED_MAGIC 0x04 /**< need the start of the file */
280 #define FILE_SIG_NEED_FILECONTENT 0x08
281 #define FILE_SIG_NEED_MD5 0x10
282 #define FILE_SIG_NEED_SHA1 0x20
283 #define FILE_SIG_NEED_SHA256 0x40
284 #define FILE_SIG_NEED_SIZE 0x80
285 
286 /* Detection Engine flags */
287 #define DE_QUIET 0x01 /**< DE is quiet (esp for unittests) */
288 
289 typedef struct IPOnlyCIDRItem_ {
290  /* address data for this item */
291  uint8_t family;
292  /* netmask in CIDR values (ex. /16 /18 /24..) */
293  uint8_t netmask;
294  /* If this host or net is negated for the signum */
295  uint8_t negated;
296 
297  uint32_t ip[4];
298  SigIntId signum; /**< our internal id */
299 
300  /* linked list, the header should be the biggest network */
302 
304 
305 /** \brief Used to start a pointer to SigMatch context
306  * Should never be dereferenced without casting to something else.
307  */
308 typedef struct SigMatchCtx_ {
309  int foo;
311 
312 /** \brief a single match condition for a signature */
313 typedef struct SigMatch_ {
314  uint16_t type; /**< match type */
315  uint16_t idx; /**< position in the signature */
316  SigMatchCtx *ctx; /**< plugin specific data */
317  struct SigMatch_ *next;
318  struct SigMatch_ *prev;
320 
321 /** \brief Data needed for Match() */
322 typedef struct SigMatchData_ {
323  uint16_t type; /**< match type */
324  uint8_t is_last; /**< Last element of the list */
325  SigMatchCtx *ctx; /**< plugin specific data */
327 
328 struct DetectEngineThreadCtx_;// DetectEngineThreadCtx;
329 
330 /* inspection buffer is a simple structure that is passed between prefilter,
331  * transformation functions and inspection functions.
332  * Initially setup with 'orig' ptr and len, transformations can then take
333  * then and fill the 'buf'. Multiple transformations can update the buffer,
334  * both growing and shrinking it.
335  * Prefilter and inspection will only deal with 'inspect'. */
336 
337 typedef struct InspectionBuffer {
338  const uint8_t *inspect; /**< active pointer, points either to ::buf or ::orig */
339  uint64_t inspect_offset;
340  uint32_t inspect_len; /**< size of active data. See to ::len or ::orig_len */
341  uint8_t flags; /**< DETECT_CI_FLAGS_* for use with DetectEngineContentInspection */
342 #ifdef DEBUG_VALIDATION
343  bool multi;
344 #endif
345  uint32_t len; /**< how much is in use */
346  uint8_t *buf;
347  uint32_t size; /**< size of the memory allocation */
348 
349  uint32_t orig_len;
350  const uint8_t *orig;
352 
353 /* inspection buffers are kept per tx (in det_ctx), but some protocols
354  * need a bit more. A single TX might have multiple buffers, e.g. files in
355  * SMTP or DNS queries. Since all prefilters+transforms run before the
356  * individual rules need the same buffers, we need a place to store the
357  * transformed data. This array of arrays is that place. */
358 
361  uint32_t size; /**< size in number of elements */
362  uint32_t max:31; /**< max id in use in this run */
363  uint32_t init:1; /**< first time used this run. Used for clean logic */
365 
366 typedef struct TransformData_ {
368  void *options;
370 
371 typedef struct DetectEngineTransforms {
373  int cnt;
375 
376 /** callback for getting the buffer we need to prefilter/inspect */
377 typedef InspectionBuffer *(*InspectionBufferGetDataPtr)(
378  struct DetectEngineThreadCtx_ *det_ctx,
379  const DetectEngineTransforms *transforms,
380  Flow *f, const uint8_t flow_flags,
381  void *txv, const int list_id);
383 
384 typedef uint8_t (*InspectEngineFuncPtr2)(struct DetectEngineCtx_ *de_ctx,
385  struct DetectEngineThreadCtx_ *det_ctx,
386  const struct DetectEngineAppInspectionEngine_ *engine, const struct Signature_ *s, Flow *f,
387  uint8_t flags, void *alstate, void *txv, uint64_t tx_id);
388 
391  uint8_t dir;
392  uint8_t id; /**< per sig id used in state keeping */
393  bool mpm;
394  bool stream;
395  uint16_t sm_list;
396  uint16_t sm_list_base; /**< base buffer being transformed */
397  int16_t progress;
398 
399  struct {
402  /** pointer to the transforms in the 'DetectBuffer entry for this list */
404  } v2;
405 
407 
410 
411 typedef struct DetectBufferType_ {
412  char name[32];
413  char description[128];
414  int id;
416  bool mpm;
417  bool packet; /**< compat to packet matches */
418  bool frame; /**< is about Frame inspection */
420  void (*SetupCallback)(const struct DetectEngineCtx_ *, struct Signature_ *);
421  bool (*ValidateCallback)(const struct Signature_ *, const char **sigerror);
424 
426 
427 /**
428  * \param alert_flags[out] for setting PACKET_ALERT_FLAG_*
429  */
431  struct DetectEngineThreadCtx_ *,
432  const struct DetectEnginePktInspectionEngine *engine,
433  const struct Signature_ *s,
434  Packet *p, uint8_t *alert_flags);
435 
436 /** callback for getting the buffer we need to prefilter/inspect */
437 typedef InspectionBuffer *(*InspectionBufferGetPktDataPtr)(
438  struct DetectEngineThreadCtx_ *det_ctx,
439  const DetectEngineTransforms *transforms,
440  Packet *p, const int list_id);
441 
444  bool mpm;
445  uint16_t sm_list;
446  uint16_t sm_list_base;
447  struct {
450  /** pointer to the transforms in the 'DetectBuffer entry for this list */
452  } v1;
455 
456 struct Frame;
457 struct Frames;
459 
460 /**
461  * \param alert_flags[out] for setting PACKET_ALERT_FLAG_*
462  */
464  const struct DetectEngineFrameInspectionEngine *engine, const struct Signature_ *s,
465  Packet *p, const struct Frames *frames, const struct Frame *frame, const uint32_t idx);
466 
469  uint8_t dir;
470  uint8_t type;
471  bool mpm;
472  uint16_t sm_list;
473  uint16_t sm_list_base;
474  struct {
476  /** pointer to the transforms in the 'DetectBuffer entry for this list */
478  } v1;
482 
483 #ifdef UNITTESTS
484 #define sm_lists init_data->smlists
485 #define sm_lists_tail init_data->smlists_tail
486 #endif
487 
488 typedef struct SignatureInitData_ {
489  /** Number of sigmatches. Used for assigning SigMatch::idx */
490  uint16_t sm_cnt;
491 
492  /** option was prefixed with '!'. Only set for sigmatches that
493  * have the SIGMATCH_HANDLE_NEGATION flag set. */
494  bool negated;
495 
496  /* track if we saw any negation in the addresses. If so, we
497  * skip it for ip-only */
500 
501  /* used to hold flags that are used during init */
502  uint32_t init_flags;
503  /* coccinelle: SignatureInitData:init_flags:SIG_FLAG_INIT_ */
504 
505  /* used at init to determine max dsize */
507 
508  /* list id for `mpm_sm`. Should always match `SigMatchListSMBelongsTo(s, mpm_sm)`. */
510  /* the fast pattern added from this signature */
512  /* used to speed up init of prefilter */
514 
515  /* SigMatch list used for adding content and friends. E.g. file_data; */
516  int list;
517  bool list_set;
518 
520 
521  /** score to influence rule grouping. A higher value leads to a higher
522  * likelihood of a rulegroup with this sig ending up as a contained
523  * group. */
525 
526  /** address settings for this signature */
528 
530 
532  /* holds all sm lists */
533  struct SigMatch_ **smlists;
534  /* holds all sm lists' tails */
537 
538 /** \brief Signature container */
539 typedef struct Signature_ {
540  uint32_t flags;
541  /* coccinelle: Signature:flags:SIG_FLAG_ */
542 
544 
545  uint16_t dsize_low;
546  uint16_t dsize_high;
547  uint8_t dsize_mode;
548 
550  SigIntId num; /**< signature number, internal id */
551 
552  /** inline -- action */
553  uint8_t action;
554  uint8_t file_flags;
555 
556  /** addresses, ports and proto this sig matches on */
558 
559  /** classification id **/
560  uint16_t class_id;
561 
562  /** ipv4 match arrays */
569  /** ipv6 match arrays */
572 
573  uint32_t id; /**< sid, set by the 'sid' rule keyword */
574  uint32_t gid; /**< generator id */
575  uint32_t rev;
576  int prio;
577 
578  /** port settings for this signature */
580 
581 #ifdef PROFILING
582  uint16_t profiling_id;
583 #endif
584 
585  /** netblocks and hosts specified at the sid, in CIDR format */
587 
591 
592  /* Matching structures for the built-ins. The others are in
593  * their inspect engines. */
595 
596  /* memory is still owned by the sm_lists/sm_arrays entry */
598 
599  char *msg;
600 
601  /** classification message */
602  char *class_msg;
603  /** Reference */
605  /** Metadata */
607 
608  char *sig_str;
609 
611 
612  /** ptr to the next sig in the list */
613  struct Signature_ *next;
615 
620  /* must be last */
622 };
623 
624 /** \brief one time registration of keywords at start up */
626  const char *name;
627  char pname[32]; /**< name used in profiling */
628  int direction; /**< SIG_FLAG_TOSERVER or SIG_FLAG_TOCLIENT */
629  int16_t sm_list;
630  int16_t sm_list_base;
631  int priority;
632  int id; /**< index into this array and result arrays */
635 
637  struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx,
638  const struct DetectBufferMpmRegistery_ *mpm_reg, int list_id);
640 
641  union {
642  /* app-layer matching: use if type == DETECT_BUFFER_MPM_TYPE_APP */
643  struct {
648 
649  /* pkt matching: use if type == DETECT_BUFFER_MPM_TYPE_PKT */
650  struct {
652  struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx,
653  const struct DetectBufferMpmRegistery_ *mpm_reg, int list_id);
656 
657  /* frame matching: use if type == DETECT_BUFFER_MPM_TYPE_FRAME */
658  struct {
660  uint8_t type;
662  };
663 
666 
667 /* helper structure to track pattern stats and assign pattern id's. */
668 typedef struct DetectPatternTracker {
669  const struct DetectContentData_ *cd;
670  int sm_list;
671  uint32_t cnt;
672  uint32_t mpm;
674 
675 typedef struct DetectReplaceList_ {
677  uint8_t *found;
680 
681 /** only execute flowvar storage if rule matched */
682 #define DETECT_VAR_TYPE_FLOW_POSTMATCH 1
683 #define DETECT_VAR_TYPE_PKT_POSTMATCH 2
684 
685 /** list for flowvar store candidates, to be stored from
686  * post-match function */
687 typedef struct DetectVarList_ {
688  uint32_t idx; /**< flowvar name idx */
689  uint16_t len; /**< data len */
690  uint16_t key_len;
691  int type; /**< type of store candidate POSTMATCH or ALWAYS */
692  uint8_t *key;
693  uint8_t *buffer; /**< alloc'd buffer, may be freed by
694  post-match, post-non-match */
697 
698 typedef struct SCFPSupportSMList_ {
699  int list_id;
700  int priority;
703 
705  uint8_t *sig_match_array; /* bit array of sig nums */
706  uint32_t sig_match_size; /* size in bytes of the array */
708 
709 /** \brief IP only rules matching ctx. */
710 typedef struct DetectEngineIPOnlyCtx_ {
711  /* Lookup trees */
714 
715  /* Used to build the radix trees */
717  uint32_t max_idx;
719 
720 typedef struct DetectEngineLookupFlow_ {
723  struct SigGroupHead_ *sgh[256];
725 
726 #include "detect-threshold.h"
727 
728 /** \brief threshold ctx */
729 typedef struct ThresholdCtx_ {
730  SCMutex threshold_table_lock; /**< Mutex for hash table */
731 
732  /** to support rate_filter "by_rule" option */
734  uint32_t th_size;
736 
737 typedef struct SigString_ {
738  char *filename;
739  char *sig_str;
740  char *sig_error;
741  int line;
744 
745 /** \brief Signature loader statistics */
746 typedef struct SigFileLoaderStat_ {
747  TAILQ_HEAD(, SigString_) failed_sigs;
753 
755  void *(*InitFunc)(void *);
756  void (*FreeFunc)(void *);
757  void *data;
759  int id;
760  const char *name; /* keyword name, for error printing */
762 
764 {
765  DETECT_PREFILTER_MPM = 0, /**< use only mpm / fast_pattern */
766  DETECT_PREFILTER_AUTO = 1, /**< use mpm + keyword prefilters */
767 };
768 
770 {
772  DETECT_ENGINE_TYPE_DD_STUB = 1, /* delayed detect stub: can be reloaded */
773  DETECT_ENGINE_TYPE_MT_STUB = 2, /* multi-tenant stub: cannot be reloaded */
775 };
776 
777 /* Flow states:
778  * toserver
779  * toclient
780  */
781 #define FLOW_STATES 2
782 
783 /** \brief main detection engine ctx */
784 typedef struct DetectEngineCtx_ {
785  uint8_t flags;
787 
789 
791  uint32_t sig_cnt;
792 
793  /* version of the srep data */
794  uint32_t srep_version;
795 
796  /* reputation for netblocks */
798 
800  uint32_t sig_array_size; /* size in bytes */
801  uint32_t sig_array_len; /* size in array members */
802 
803  uint32_t signum;
804 
805  /** Maximum value of all our sgh's non_mpm_store_cnt setting,
806  * used to alloc det_ctx::non_mpm_id_array */
808 
809  /* used by the signature ordering module */
811 
812  /* hash table used for holding the classification config info */
814  /* hash table used for holding the reference config info */
816 
817  /* main sigs */
819 
820  uint32_t gh_unique, gh_reuse;
821 
822  /* init phase vars */
824 
827 
828  /* hash table used to cull out duplicate sigs */
830 
833 
834  uint8_t mpm_matcher; /**< mpm matcher this ctx uses */
835  uint16_t spm_matcher; /**< spm matcher this ctx uses */
836 
837  /* spm thread context prototype, built as spm matchers are constructed and
838  * later used to construct thread context for each thread. */
840 
841  /* Config options */
842 
845 
846  /* specify the configuration for mpm context factory */
848 
849  /* max flowbit id that is used */
850  uint32_t max_fb_id;
851 
852  uint32_t max_fp_id;
853 
855 
856  /* maximum recursion depth for content inspection */
858 
859  /* conf parameter that limits the length of the http request body inspected */
861  /* conf parameter that limits the length of the http response body inspected */
863 
864  /* array containing all sgh's in use so we can loop
865  * through it in Stage4. */
867  uint32_t sgh_array_cnt;
868  uint32_t sgh_array_size;
869 
874 
875  /* the max local id used amongst all sigs */
877 
878  /** version of the detect engine. The version is incremented on reloads */
879  uint32_t version;
880 
881  /** sgh for signatures that match against invalid packets. In those cases
882  * we can't lookup by proto, address, port as we don't have these */
884 
885  /* Maximum size of the buffer for decoded base64 data. */
887 
888  /** Store rule file and line so that parsers can use them in errors. */
889  char *rule_file;
893  const char *sigerror;
894 
895  /** hash list of keywords that need thread local ctxs */
898 
899  struct {
900  uint32_t content_limit;
905 
906 #ifdef PROFILING
913 #endif
914  uint32_t prefilter_maxid;
915 
916  char config_prefix[64];
917 
918  enum DetectEngineType type;
919 
920  /** how many de_ctx' are referencing this */
921  uint32_t ref_cnt;
922  /** list in master: either active or freelist */
924 
925  /** id of loader thread 'owning' this de_ctx */
927 
928  /** are we using just mpm or also other prefilters */
930 
932 
935 
936  /** table for storing the string representation with the parsers result */
938 
939  /** table to store metadata keys and values */
941 
942  /* hash tables with rule-time buffer registration. Start time registration
943  * is in detect-engine.c::g_buffer_type_hash */
946  uint32_t buffer_type_id;
947 
948  /* list with app inspect engines. Both the start-time registered ones and
949  * the rule-time registered ones. */
959 
960  uint32_t prefilter_id;
962 
963  /** time of last ruleset reload */
964  struct timeval last_reload;
965 
966  /** signatures stats */
968 
969  /** per keyword flag indicating if a prefilter has been
970  * set for it. If true, the setup function will have to
971  * run. */
974 
975  /* list of Fast Pattern registrations. Initially filled using a copy of
976  * `g_fp_support_smlist_list`, then extended at rule loading time if needed */
979 
980 /* Engine groups profiles (low, medium, high, custom) */
981 enum {
988 };
989 
990 /* Siggroup mpm context profile */
991 enum {
995 #define ENGINE_SGH_MPM_FACTORY_CONTEXT_START_ID_RANGE (ENGINE_SGH_MPM_FACTORY_CONTEXT_AUTO + 1)
996 };
997 
998 #define DETECT_FILESTORE_MAX 15
999 
1005 
1006 /** array of TX inspect rule candidates */
1007 typedef struct RuleMatchCandidateTx {
1008  SigIntId id; /**< internal signature id */
1009  uint32_t *flags; /**< inspect flags ptr */
1010  union {
1011  struct {
1013  uint8_t stream_result;
1014  };
1015  uint32_t stream_reset;
1016  };
1017 
1018  const Signature *s; /**< ptr to sig */
1020 
1021 /**
1022  * Detection engine thread data.
1023  */
1024 typedef struct DetectEngineThreadCtx_ {
1025  /** \note multi-tenant hash lookup code from Detect() *depends*
1026  * on this being the first member */
1027  uint32_t tenant_id;
1028 
1029  /* the thread to which this detection engine thread belongs */
1031 
1032  /** Array of non-prefiltered sigs that need to be evaluated. Updated
1033  * per packet based on the rule group and traffic properties. */
1035  uint32_t non_pf_id_cnt; // size is cnt * sizeof(uint32_t)
1036 
1040 
1043 
1044  uint32_t (*TenantGetId)(const void *, const Packet *p);
1045 
1046  /* detection engine variables */
1047 
1049 
1050  /** offset into the payload of the last match by:
1051  * content, pcre, etc */
1052  uint32_t buffer_offset;
1053  /* used by pcre match function alone */
1055 
1056  /* counter for the filestore array below -- up here for cache reasons. */
1057  uint16_t filestore_cnt;
1058 
1059  /** id for alert counter */
1060  uint16_t counter_alerts;
1061  /** id for discarded alerts counter */
1063  /** id for suppressed alerts counter */
1065 #ifdef PROFILING
1070 #endif
1071 
1072  int inspect_list; /**< list we're currently inspecting, DETECT_SM_LIST_* */
1073 
1074  struct {
1076  uint32_t buffers_size; /**< in number of elements */
1077  uint32_t to_clear_idx;
1078  uint32_t *to_clear_queue;
1080 
1081  struct {
1082  /** inspection buffers for more complex case. As we can inspect multiple
1083  * buffers in parallel, we need this extra wrapper struct */
1085  uint32_t buffers_size; /**< in number of elements */
1086  uint32_t to_clear_idx;
1087  uint32_t *to_clear_queue;
1089 
1090  /* used to discontinue any more matching */
1092  uint16_t flags; /**< DETECT_ENGINE_THREAD_CTX_* flags */
1093 
1094  /* true if tx_id is set */
1096  /** ID of the transaction currently being inspected. */
1097  uint64_t tx_id;
1098  int64_t frame_id;
1100 
1104 
1105  SC_ATOMIC_DECLARE(int, so_far_used_by_detect);
1106 
1107  /* holds the current recursion depth on content inspection */
1109 
1110  /** array of signature pointers we're going to inspect in the detection
1111  * loop. */
1113  /** size of the array in items (mem size if * sizeof(Signature *)
1114  * Only used during initialization. */
1116  /** size in use */
1118 
1121 
1124 
1125  /** pointer to the current mpm ctx that is stored
1126  * in a rule group head -- can be either a content
1127  * or uricontent ctx. */
1128  MpmThreadCtx mtc; /**< thread ctx for the mpm */
1129  MpmThreadCtx mtcu; /**< thread ctx for uricontent mpm */
1130  MpmThreadCtx mtcs; /**< thread ctx for stream mpm */
1132 
1133  /** SPM thread context used for scanning. This has been cloned from the
1134  * prototype held by DetectEngineCtx. */
1136 
1137  /** ip only rules ctx */
1139 
1140  /* byte_* values */
1141  uint64_t *byte_values;
1142 
1143  /* string to replace */
1145  /* vars to store in post match function */
1147 
1148  /* Array in which the filestore keyword stores file id and tx id. If the
1149  * full signature matches, these are processed by a post-match filestore
1150  * function to finalize the store. */
1151  struct {
1152  uint32_t file_id;
1153  uint64_t tx_id;
1155 
1157  /** store for keyword contexts that need a per thread storage. Per de_ctx. */
1160  /** store for keyword contexts that need a per thread storage. Global. */
1163 
1164  uint8_t *base64_decoded;
1167 
1169  uint16_t events;
1170 
1171 #ifdef DEBUG
1172  uint64_t pkt_stream_add_cnt;
1173  uint64_t payload_mpm_cnt;
1174  uint64_t payload_mpm_size;
1175  uint64_t stream_mpm_cnt;
1176  uint64_t stream_mpm_size;
1177  uint64_t payload_persig_cnt;
1178  uint64_t payload_persig_size;
1179  uint64_t stream_persig_cnt;
1180  uint64_t stream_persig_size;
1181 #endif
1182 #ifdef PROFILING
1187  int keyword_perf_list; /**< list we're currently inspecting, DETECT_SM_LIST_* */
1189 
1192  /** bytes inspected by current prefilter callback call */
1194  /** number of times we inspected a buffer */
1196 #endif
1198 
1199 /** \brief element in sigmatch type table.
1200  */
1201 typedef struct SigTableElmt_ {
1202  /** Packet match function pointer */
1203  int (*Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *);
1204 
1205  /** AppLayer TX match function pointer */
1207  uint8_t flags, void *alstate, void *txv,
1208  const Signature *, const SigMatchCtx *);
1209 
1210  /** File match function pointer */
1212  Flow *, /**< *LOCKED* flow */
1213  uint8_t flags, File *, const Signature *, const SigMatchCtx *);
1214 
1215  /** InspectionBuffer transformation callback */
1216  void (*Transform)(InspectionBuffer *, void *context);
1217  bool (*TransformValidate)(const uint8_t *content, uint16_t content_len, void *context);
1218 
1219  /** keyword setup function pointer */
1220  int (*Setup)(DetectEngineCtx *, Signature *, const char *);
1221 
1222  bool (*SupportsPrefilter)(const Signature *s);
1224 
1225  void (*Free)(DetectEngineCtx *, void *);
1226 #ifdef UNITTESTS
1227  void (*RegisterTests)(void);
1228 #endif
1229  uint16_t flags;
1230  /* coccinelle: SigTableElmt:flags:SIGMATCH_ */
1231 
1232  /** better keyword to replace the current one */
1233  uint16_t alternative;
1234 
1235  const char *name; /**< keyword name alias */
1236  const char *alias; /**< name alias */
1237  const char *desc;
1238  const char *url;
1239 
1241 
1242 /* event code */
1243 enum {
1244 #ifdef UNITTESTS
1246 #endif
1261 
1263 };
1264 
1265 #define SIG_GROUP_HEAD_HAVERAWSTREAM BIT_U32(0)
1266 #ifdef HAVE_MAGIC
1267 #define SIG_GROUP_HEAD_HAVEFILEMAGIC BIT_U32(20)
1268 #endif
1269 #define SIG_GROUP_HEAD_HAVEFILEMD5 BIT_U32(21)
1270 #define SIG_GROUP_HEAD_HAVEFILESIZE BIT_U32(22)
1271 #define SIG_GROUP_HEAD_HAVEFILESHA1 BIT_U32(23)
1272 #define SIG_GROUP_HEAD_HAVEFILESHA256 BIT_U32(24)
1283 };
1284 
1285 typedef struct MpmStore_ {
1286  uint8_t *sid_array;
1287  uint32_t sid_array_size;
1288 
1291  int sm_list;
1293 
1295 
1297 
1298 typedef void (*PrefilterFrameFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p,
1299  const struct Frames *frames, const struct Frame *frame, const uint32_t idx);
1300 
1301 typedef struct AppLayerTxData AppLayerTxData;
1302 typedef void (*PrefilterTxFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f,
1303  void *tx, const uint64_t tx_id, const AppLayerTxData *tx_data, const uint8_t flags);
1304 
1305 typedef struct PrefilterEngineList_ {
1306  uint16_t id;
1307 
1308  /** App Proto this engine applies to: only used with Tx Engines */
1310  /** Minimal Tx progress we need before running the engine. Only used
1311  * with Tx Engine */
1313 
1314  uint8_t frame_type;
1315 
1316  /** Context for matching. Might be MpmCtx for MPM engines, other ctx'
1317  * for other engines. */
1318  void *pectx;
1319 
1320  void (*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx);
1323 
1325 
1326  /** Free function for pectx data. If NULL the memory is not freed. */
1327  void (*Free)(void *pectx);
1328 
1329  const char *name;
1330  /* global id for this prefilter */
1331  uint32_t gid;
1333 
1334 typedef struct PrefilterEngine_ {
1335  uint16_t local_id;
1336 
1337  /** App Proto this engine applies to: only used with Tx Engines */
1339 
1340  union {
1341  /** Minimal Tx progress we need before running the engine. Only used
1342  * with Tx Engine */
1344  uint8_t frame_type;
1345  } ctx;
1346 
1347  /** Context for matching. Might be MpmCtx for MPM engines, other ctx'
1348  * for other engines. */
1349  void *pectx;
1350 
1351  union {
1352  void (*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx);
1355  } cb;
1356 
1357  /* global id for this prefilter */
1358  uint32_t gid;
1359  bool is_last;
1362 
1363 typedef struct SigGroupHeadInitData_ {
1365 
1366  uint8_t *sig_array; /**< bit array of sig nums (internal id's) */
1367  uint32_t sig_size; /**< size in bytes */
1368 
1369  uint8_t protos[256]; /**< proto(s) this sgh is for */
1370  uint32_t direction; /**< set to SIG_FLAG_TOSERVER, SIG_FLAG_TOCLIENT or both */
1371  int whitelist; /**< try to make this group a unique one */
1372 
1376 
1381 
1382  /** number of sigs in this group */
1384 
1385  /** Array with sig ptrs... size is sig_cnt * sizeof(Signature *) */
1387 
1388  /* port ptr */
1391 
1392 /** \brief Container for matching data for a signature group */
1393 typedef struct SigGroupHead_ {
1394  uint32_t flags;
1395  /* coccinelle: SigGroupHead:flags:SIG_GROUP_HEAD_ */
1396 
1397  /* non prefilter list excluding SYN rules */
1400  SignatureNonPrefilterStore *non_pf_other_store_array; // size is non_mpm_store_cnt * sizeof(SignatureNonPrefilterStore)
1401  /* non mpm list including SYN rules */
1402  SignatureNonPrefilterStore *non_pf_syn_store_array; // size is non_mpm_syn_store_cnt * sizeof(SignatureNonPrefilterStore)
1403 
1404  /** the number of signatures in this sgh that have the filestore keyword
1405  * set. */
1406  uint16_t filestore_cnt;
1407 
1408  uint32_t id; /**< unique id used to index sgh_array for stats */
1409 
1414 
1415  /* ptr to our init data we only use at... init :) */
1417 
1419 
1420 /** sigmatch has no options, so the parser shouldn't expect any */
1421 #define SIGMATCH_NOOPT BIT_U16(0)
1422 /** sigmatch is compatible with a ip only rule */
1423 #define SIGMATCH_IPONLY_COMPAT BIT_U16(1)
1424 /** sigmatch is compatible with a decode event only rule */
1425 #define SIGMATCH_DEONLY_COMPAT BIT_U16(2)
1426 /**< Flag to indicate that the signature is not built-in */
1427 #define SIGMATCH_NOT_BUILT BIT_U16(3)
1428 /** sigmatch may have options, so the parser should be ready to
1429  * deal with both cases */
1430 #define SIGMATCH_OPTIONAL_OPT BIT_U16(4)
1431 /** input may be wrapped in double quotes. They will be stripped before
1432  * input data is passed to keyword parser */
1433 #define SIGMATCH_QUOTES_OPTIONAL BIT_U16(5)
1434 /** input MUST be wrapped in double quotes. They will be stripped before
1435  * input data is passed to keyword parser. Missing double quotes lead to
1436  * error and signature invalidation. */
1437 #define SIGMATCH_QUOTES_MANDATORY BIT_U16(6)
1438 /** negation parsing is handled by the rule parser. Signature::init_data::negated
1439  * will be set to true or false prior to calling the keyword parser. Exclamation
1440  * mark is stripped from the input to the keyword parser. */
1441 #define SIGMATCH_HANDLE_NEGATION BIT_U16(7)
1442 /** keyword is a content modifier */
1443 #define SIGMATCH_INFO_CONTENT_MODIFIER BIT_U16(8)
1444 /** keyword is a sticky buffer */
1445 #define SIGMATCH_INFO_STICKY_BUFFER BIT_U16(9)
1446 /** keyword is deprecated: used to suggest an alternative */
1447 #define SIGMATCH_INFO_DEPRECATED BIT_U16(10)
1448 /** strict parsing is enabled */
1449 #define SIGMATCH_STRICT_PARSING BIT_U16(11)
1452 {
1453  TENANT_SELECTOR_UNKNOWN = 0, /**< not set */
1454  TENANT_SELECTOR_DIRECT, /**< method provides direct tenant id */
1455  TENANT_SELECTOR_VLAN, /**< map vlan to tenant id */
1456  TENANT_SELECTOR_LIVEDEV, /**< map livedev to tenant id */
1457 };
1458 
1460  uint32_t tenant_id;
1461 
1462  /* traffic id that maps to the tenant id */
1463  uint32_t traffic_id;
1464 
1467 
1468 typedef struct DetectEngineMasterCtx_ {
1470 
1471  /** enable multi tenant mode */
1473 
1474  /** version, incremented after each 'apply to threads' */
1475  uint32_t version;
1476 
1477  /** list of active detection engines. This list is used to generate the
1478  * threads det_ctx's */
1480 
1481  /** free list, containing detection engines that will be removed but may
1482  * still be referenced by det_ctx's. Freed as soon as all references are
1483  * gone. */
1485 
1487 
1488  /** list of tenant mappings. Updated under lock. Used to generate lookup
1489  * structures. */
1491 
1492  /** list of keywords that need thread local ctxs,
1493  * only updated by keyword registration at start up. Not
1494  * covered by the lock. */
1498 
1499 /* Table with all SigMatch registrations */
1501 
1502 /** Remember to add the options in SignatureIsIPOnly() at detect.c otherwise it wont be part of a signature group */
1503 
1504 /* detection api */
1505 TmEcode Detect(ThreadVars *tv, Packet *p, void *data);
1506 
1507 SigMatch *SigMatchAlloc(void);
1508 Signature *SigFindSignatureBySidGid(DetectEngineCtx *, uint32_t, uint32_t);
1510  Packet *, SignatureMask,
1511  uint16_t);
1513 
1514 void SigRegisterTests(void);
1516 
1518 
1520 char *DetectLoadCompleteSigPath(const DetectEngineCtx *, const char *sig_file);
1521 int SigLoadSignatures (DetectEngineCtx *, char *, int);
1523  DetectEngineThreadCtx *det_ctx, Packet *p);
1524 
1527 
1529 
1530 int DetectUnregisterThreadCtxFuncs(DetectEngineCtx *, void *data, const char *name);
1531 int DetectRegisterThreadCtxFuncs(DetectEngineCtx *, const char *name, void *(*InitFunc)(void *), void *data, void (*FreeFunc)(void *), int);
1533 
1534 void RuleMatchCandidateTxArrayInit(DetectEngineThreadCtx *det_ctx, uint32_t size);
1536 
1537 void AlertQueueInit(DetectEngineThreadCtx *det_ctx);
1538 void AlertQueueFree(DetectEngineThreadCtx *det_ctx);
1539 void AlertQueueAppend(DetectEngineThreadCtx *det_ctx, const Signature *s, Packet *p, uint64_t tx_id,
1540  uint8_t alert_flags);
1541 
1543 
1546 
1547 /* events */
1548 void DetectEngineSetEvent(DetectEngineThreadCtx *det_ctx, uint8_t e);
1550 int DetectEngineGetEventInfo(const char *event_name, int *event_id,
1551  AppLayerEventType *event_type);
1552 
1554 
1555 
1556 #endif /* __DETECT_H__ */
1557 
DetectEngineThreadCtx_::byte_values
uint64_t * byte_values
Definition: detect.h:1141
DetectEngineCtx_::sgh_hash_table
HashListTable * sgh_hash_table
Definition: detect.h:823
DetectEngineCtx_::pkt_mpms_list_cnt
uint32_t pkt_mpms_list_cnt
Definition: detect.h:955
DetectEngineAppInspectionEngine_::stream
bool stream
Definition: detect.h:394
DetectEngineCtx_::frame_mpms_list_cnt
uint32_t frame_mpms_list_cnt
Definition: detect.h:958
SCFPSupportSMList
struct SCFPSupportSMList_ SCFPSupportSMList
SigFileLoaderStat_::bad_files
int bad_files
Definition: detect.h:748
SigGroupHead_::non_pf_syn_store_cnt
uint32_t non_pf_syn_store_cnt
Definition: detect.h:1399
DetectEngineThreadCtx_::non_pf_store_ptr
SignatureNonPrefilterStore * non_pf_store_ptr
Definition: detect.h:1122
DetectEngineTenantMapping_
Definition: detect.h:1459
Signature_::cidr_src
IPOnlyCIDRItem * cidr_src
Definition: detect.h:586
DetectAddress_::ip
Address ip
Definition: detect.h:130
SigMatchSignaturesGetSgh
const SigGroupHead * SigMatchSignaturesGetSgh(const DetectEngineCtx *de_ctx, const Packet *p)
Get the SigGroupHead for a packet.
Definition: detect.c:201
DetectPatternTracker
Definition: detect.h:668
PrefilterEngineList_::frame_type
uint8_t frame_type
Definition: detect.h:1314
SCFPSupportSMList_
Definition: detect.h:698
DetectEngineThreadCtx_::keyword_perf_data_per_list
struct SCProfileKeywordData_ ** keyword_perf_data_per_list
Definition: detect.h:1186
DetectEngineCtx_::tenant_id
int tenant_id
Definition: detect.h:788
SigGroupHead_::tx_engines
PrefilterEngine * tx_engines
Definition: detect.h:1412
AlertQueueInit
void AlertQueueInit(DetectEngineThreadCtx *det_ctx)
Definition: detect-engine-alert.c:222
SigMatchAlloc
SigMatch * SigMatchAlloc(void)
Definition: detect-parse.c:238
DetectEngineAppInspectionEngine_
Definition: detect.h:389
SigTableElmt_::url
const char * url
Definition: detect.h:1238
DetectBufferType_::supports_transforms
bool supports_transforms
Definition: detect.h:419
MPMB_UDP_TS
@ MPMB_UDP_TS
Definition: detect.h:1279
SigMatch_::prev
struct SigMatch_ * prev
Definition: detect.h:318
DetectBufferMpmRegistery_::direction
int direction
Definition: detect.h:628
DetectEngineAppInspectionEngine_::mpm
bool mpm
Definition: detect.h:393
SCProfileKeywordData_
Definition: util-profiling-keywords.c:40
DetectBufferType_::mpm
bool mpm
Definition: detect.h:416
RuleMatchCandidateTx::stream_stored
bool stream_stored
Definition: detect.h:1012
DetectEngineThreadCtx_::alert_queue_size
uint16_t alert_queue_size
Definition: detect.h:1101
DetectEngineThreadCtx_::buffer_offset
uint32_t buffer_offset
Definition: detect.h:1052
DETECT_SM_LIST_PMATCH
@ DETECT_SM_LIST_PMATCH
Definition: detect.h:79
DetectEngineThreadCtx_::to_clear_idx
uint32_t to_clear_idx
Definition: detect.h:1077
SigMatchFree
void SigMatchFree(DetectEngineCtx *, SigMatch *sm)
free a SigMatch
Definition: detect-parse.c:253
DetectEngineCtx_::class_conf_ht
HashTable * class_conf_ht
Definition: detect.h:813
PrefilterEngine_::Prefilter
void(* Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)
Definition: detect.h:1352
FILE_DECODER_EVENT_LZMA_DATA_ERROR
@ FILE_DECODER_EVENT_LZMA_DATA_ERROR
Definition: detect.h:1258
detect-engine-proto.h
DetectEngineThreadCtx_::keyword_perf_data
struct SCProfileKeywordData_ * keyword_perf_data
Definition: detect.h:1185
DetectEngineThreadCtx_::match_array_cnt
SigIntId match_array_cnt
Definition: detect.h:1117
DetectVarList_::idx
uint32_t idx
Definition: detect.h:688
MpmStore_::sid_array_size
uint32_t sid_array_size
Definition: detect.h:1287
SigTableElmt_::desc
const char * desc
Definition: detect.h:1237
SignatureInitData_::list_set
bool list_set
Definition: detect.h:517
Signature_::addr_src_match6
DetectMatchAddressIPv6 * addr_src_match6
Definition: detect.h:571
DetectEngineThreadCtx_::SC_ATOMIC_DECLARE
SC_ATOMIC_DECLARE(int, so_far_used_by_detect)
Signature_::sig_str
char * sig_str
Definition: detect.h:608
MpmStore_::sid_array
uint8_t * sid_array
Definition: detect.h:1286
DetectEngineThreadKeywordCtxItem
struct DetectEngineThreadKeywordCtxItem_ DetectEngineThreadKeywordCtxItem
DetectEngineCtx_::sgh_mpm_context_proto_tcp_packet
int32_t sgh_mpm_context_proto_tcp_packet
Definition: detect.h:870
DetectVarList_::buffer
uint8_t * buffer
Definition: detect.h:693
SigTableElmt_::Free
void(* Free)(DetectEngineCtx *, void *)
Definition: detect.h:1225
IPOnlyCIDRItem
struct IPOnlyCIDRItem_ IPOnlyCIDRItem
util-hashlist.h
DetectEngineCtx_::decoder_event_sgh
struct SigGroupHead_ * decoder_event_sgh
Definition: detect.h:883
DetectEngineCtx_::flow_gh
DetectEngineLookupFlow flow_gh[FLOW_STATES]
Definition: detect.h:818
SCFPSupportSMList_::next
struct SCFPSupportSMList_ * next
Definition: detect.h:701
DetectEngineThreadCtx_::counter_match_list
uint16_t counter_match_list
Definition: detect.h:1069
SigString
struct SigString_ SigString
DetectEnginePktInspectionEngine
Definition: detect.h:442
DetectEngineMasterCtx_::tenant_mapping_list
DetectEngineTenantMapping * tenant_mapping_list
Definition: detect.h:1490
Signature_::filestore_ctx
const struct DetectFilestoreData_ * filestore_ctx
Definition: detect.h:597
DetectEngineAppInspectionEngine_::next
struct DetectEngineAppInspectionEngine_ * next
Definition: detect.h:408
ADDRESS_ER
@ ADDRESS_ER
Definition: detect.h:112
DetectBufferMpmRegistery_::frame_v1
struct DetectBufferMpmRegistery_::@88::@92 frame_v1
DetectEngineGetEventInfo
int DetectEngineGetEventInfo(const char *event_name, int *event_id, AppLayerEventType *event_type)
Definition: detect-engine.c:4652
PrefilterEngine_::ctx
union PrefilterEngine_::@101 ctx
SignatureIsIPOnly
int SignatureIsIPOnly(DetectEngineCtx *de_ctx, const Signature *s)
Test is a initialized signature is IP only.
Definition: detect-engine-build.c:195
SCFPSupportSMList_::list_id
int list_id
Definition: detect.h:699
SigTableElmt_::name
const char * name
Definition: detect.h:1235
DetectEngineMasterCtx_::list
DetectEngineCtx * list
Definition: detect.h:1479
MpmThreadCtx_
Definition: util-mpm.h:46
DetectPatternTracker::mpm
uint32_t mpm
Definition: detect.h:672
Signature_::num
SigIntId num
Definition: detect.h:550
DetectEngineCtx
struct DetectEngineCtx_ DetectEngineCtx
main detection engine ctx
IPOnlyCIDRItem_::netmask
uint8_t netmask
Definition: detect.h:293
DetectEngineCtx_::type
enum DetectEngineType type
Definition: detect.h:918
SigGroupHead_
Container for matching data for a signature group.
Definition: detect.h:1393
DetectEnginePktInspectionEngine::v1
struct DetectEnginePktInspectionEngine::@86 v1
DetectEngineCtx_::pattern_hash_table
HashListTable * pattern_hash_table
Definition: detect.h:826
DetectEngineThreadCtx_::sgh_perf_data
struct SCProfileSghData_ * sgh_perf_data
Definition: detect.h:1188
FILE_DECODER_EVENT_INVALID_SWF_VERSION
@ FILE_DECODER_EVENT_INVALID_SWF_VERSION
Definition: detect.h:1249
ThresholdCtx_::threshold_table_lock
SCMutex threshold_table_lock
Definition: detect.h:730
DetectEngineCtx_::rule_file
char * rule_file
Definition: detect.h:889
DetectEngineTransforms
Definition: detect.h:371
PrefilterEngineList_::id
uint16_t id
Definition: detect.h:1306
SigGroupHeadInitData_::sig_array
uint8_t * sig_array
Definition: detect.h:1366
SCProfileSghDetectCtx_
Definition: util-profiling-rulegroups.c:51
DetectAddress_
address structure for use in the detection engine.
Definition: detect.h:128
DetectEngineCtx_::max_uniq_toclient_groups
uint16_t max_uniq_toclient_groups
Definition: detect.h:843
DetectEngineThreadCtx_::buffers
InspectionBufferMultipleForList * buffers
Definition: detect.h:1084
SignatureInitData_::prefilter_sm
SigMatch * prefilter_sm
Definition: detect.h:513
PrefilterRuleStore_
structure for storing potential rule matches
Definition: util-prefilter.h:34
SignatureInitData_::src_contains_negation
bool src_contains_negation
Definition: detect.h:498
DetectEngineCtx_::ref_cnt
uint32_t ref_cnt
Definition: detect.h:921
SignatureInitData_::whitelist
int whitelist
Definition: detect.h:524
DetectEngineCtx_::sigerror_silent
bool sigerror_silent
Definition: detect.h:891
Signature_::alproto
AppProto alproto
Definition: detect.h:543
SignatureNonPrefilterStore_::id
SigIntId id
Definition: detect.h:1001
SigString_
Definition: detect.h:737
DetectAddressHead_
Definition: detect.h:143
PORT_LT
@ PORT_LT
Definition: detect.h:166
MPMB_OTHERIP
@ MPMB_OTHERIP
Definition: detect.h:1281
DetectEngineCtx_::max_fp_id
uint32_t max_fp_id
Definition: detect.h:852
DetectEngineCtx_::non_pf_store_cnt_max
uint32_t non_pf_store_cnt_max
Definition: detect.h:807
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
DetectEngineFrameInspectionEngine::sm_list_base
uint16_t sm_list_base
Definition: detect.h:473
DetectPort_::port
uint16_t port
Definition: detect.h:181
DetectEngineIPOnlyCtx_::ip_src
IPOnlyCIDRItem * ip_src
Definition: detect.h:716
SigGroupHeadInitData_::port
struct DetectPort_ * port
Definition: detect.h:1389
AppProto
uint16_t AppProto
Definition: app-layer-protos.h:81
DETECT_SM_LIST_DYNAMIC_START
@ DETECT_SM_LIST_DYNAMIC_START
Definition: detect.h:98
DetectEngineThreadCtx_::prefilter_perf_size
int prefilter_perf_size
Definition: detect.h:1191
IPOnlyCIDRItem_
Definition: detect.h:289
DetectBufferMpmRegistery_::transforms
DetectEngineTransforms transforms
Definition: detect.h:639
SigMatchSignaturesBuildMatchArray
void SigMatchSignaturesBuildMatchArray(DetectEngineThreadCtx *, Packet *, SignatureMask, uint16_t)
DetectEngineThreadCtx_::tx_id
uint64_t tx_id
Definition: detect.h:1097
DetectEngineThreadCtx_::decoder_events
AppLayerDecoderEvents * decoder_events
Definition: detect.h:1168
DetectBufferMpmRegistery_::app_v2
struct DetectBufferMpmRegistery_::@88::@90 app_v2
SigMatchData_::ctx
SigMatchCtx * ctx
Definition: detect.h:325
InspectionBuffer
Definition: detect.h:337
SigLoadSignatures
int SigLoadSignatures(DetectEngineCtx *, char *, int)
Load signatures.
Definition: detect-engine-loader.c:283
DetectVarList_::key_len
uint16_t key_len
Definition: detect.h:690
MpmStore_::sm_list
int sm_list
Definition: detect.h:1291
DetectEngineAppInspectionEngine_::GetData
InspectionBufferGetDataPtr GetData
Definition: detect.h:400
DetectEngineThreadKeywordCtxItem_
Definition: detect.h:754
DETECT_BUFFER_MPM_TYPE_FRAME
@ DETECT_BUFFER_MPM_TYPE_FRAME
Definition: detect.h:619
DetectEngineCtx_::prefilter_maxid
uint32_t prefilter_maxid
Definition: detect.h:914
Frame
Definition: app-layer-frames.h:40
DETECT_TBLSIZE
@ DETECT_TBLSIZE
Definition: detect-engine-register.h:336
Flow_
Flow data structure.
Definition: flow.h:356
SigTableElmt_::FileMatch
int(* FileMatch)(DetectEngineThreadCtx *, Flow *, uint8_t flags, File *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1211
DetectVarList_
Definition: detect.h:687
DETECT_SM_LIST_THRESHOLD
@ DETECT_SM_LIST_THRESHOLD
Definition: detect.h:93
DetectReplaceList_::found
uint8_t * found
Definition: detect.h:677
AppLayerEventType
enum AppLayerEventType_ AppLayerEventType
DetectEngineThreadKeywordCtxItem_::data
void * data
Definition: detect.h:757
DetectEngineThreadCtx_::pmq
PrefilterRuleStore pmq
Definition: detect.h:1131
util-hash.h
ENGINE_PROFILE_LOW
@ ENGINE_PROFILE_LOW
Definition: detect.h:983
InspectionBufferGetDataPtr
InspectionBuffer *(* InspectionBufferGetDataPtr)(struct DetectEngineThreadCtx_ *det_ctx, const DetectEngineTransforms *transforms, Flow *f, const uint8_t flow_flags, void *txv, const int list_id)
Definition: detect.h:377
SigGroupHeadInitData_::mpm_store
MpmStore mpm_store[MPMB_MAX]
Definition: detect.h:1364
DetectEngineCtx_::frame_mpms_list
DetectBufferMpmRegistery * frame_mpms_list
Definition: detect.h:957
SigTableElmt_::flags
uint16_t flags
Definition: detect.h:1229
SCRadixTree_
Structure for the radix tree.
Definition: util-radix-tree.h:86
SigFindSignatureBySidGid
Signature * SigFindSignatureBySidGid(DetectEngineCtx *, uint32_t, uint32_t)
Find a specific signature by sid and gid.
Definition: detect-engine-build.c:70
DetectEngineIPOnlyCtx_::tree_ipv6dst
SCRadixTree * tree_ipv6dst
Definition: detect.h:713
DetectEngineCtx_::inspection_recursion_limit
int inspection_recursion_limit
Definition: detect.h:857
PrefilterEngineList_::name
const char * name
Definition: detect.h:1329
DetectVarList_::len
uint16_t len
Definition: detect.h:689
DetectEngineFrameInspectionEngine::transforms
const DetectEngineTransforms * transforms
Definition: detect.h:477
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:784
DetectBufferMpmRegistery_::type
enum DetectBufferMpmType type
Definition: detect.h:633
DetectEnginePktInspectionEngine::smd
SigMatchData * smd
Definition: detect.h:443
DetectPatternTracker
struct DetectPatternTracker DetectPatternTracker
SCProfilePrefilterDetectCtx_
Definition: util-profiling-prefilter.c:47
SigMatchSignatures
void SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
Definition: detect.c:1788
DetectEngineThreadCtx_::global_keyword_ctxs_array
void ** global_keyword_ctxs_array
Definition: detect.h:1162
TransformData_::options
void * options
Definition: detect.h:368
DetectEngineFrameInspectionEngine::mpm
bool mpm
Definition: detect.h:471
detect-engine-register.h
DetectBufferMpmRegistery_::pkt_v1
struct DetectBufferMpmRegistery_::@88::@91 pkt_v1
ThresholdCtx_::th_size
uint32_t th_size
Definition: detect.h:734
PrefilterEngine_::tx_min_progress
uint8_t tx_min_progress
Definition: detect.h:1343
InspectionBuffer::orig
const uint8_t * orig
Definition: detect.h:350
RuleMatchCandidateTxArrayFree
void RuleMatchCandidateTxArrayFree(DetectEngineThreadCtx *det_ctx)
Definition: detect.c:981
DetectEngineThreadCtx_::p
Packet * p
Definition: detect.h:1099
SigTableElmt_::AppLayerTxMatch
int(* AppLayerTxMatch)(DetectEngineThreadCtx *, Flow *, uint8_t flags, void *alstate, void *txv, const Signature *, const SigMatchCtx *)
Definition: detect.h:1206
DetectEngineThreadCtx_::keyword_perf_list
int keyword_perf_list
Definition: detect.h:1187
InspectionBufferGetPktDataPtr
InspectionBuffer *(* InspectionBufferGetPktDataPtr)(struct DetectEngineThreadCtx_ *det_ctx, const DetectEngineTransforms *transforms, Packet *p, const int list_id)
Definition: detect.h:437
DetectEngineCtx_::keyword_id
int keyword_id
Definition: detect.h:897
RuleMatchCandidateTx::id
SigIntId id
Definition: detect.h:1008
ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL
@ ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL
Definition: detect.h:992
Detect
TmEcode Detect(ThreadVars *tv, Packet *p, void *data)
Detection engine thread wrapper.
Definition: detect.c:1720
DetectEngineIPOnlyCtx_::tree_ipv4src
SCRadixTree * tree_ipv4src
Definition: detect.h:712
HashTable_
Definition: util-hash.h:35
DetectEngineThreadCtx_::flags
uint16_t flags
Definition: detect.h:1092
DetectPatternTracker::cnt
uint32_t cnt
Definition: detect.h:671
DetectEngineTenantMapping_::next
struct DetectEngineTenantMapping_ * next
Definition: detect.h:1465
DetectEngineThreadCtx_::buffers_size
uint32_t buffers_size
Definition: detect.h:1076
DetectEngineCtx_::srep_version
uint32_t srep_version
Definition: detect.h:794
DetectBufferType_::name
char name[32]
Definition: detect.h:412
DetectEngineCtx_::profile_sgh_ctx
struct SCProfileSghDetectCtx_ * profile_sgh_ctx
Definition: detect.h:911
Frames
Definition: app-layer-frames.h:56
DetectPort_::next
struct DetectPort_ * next
Definition: detect.h:194
DetectReplaceList_
Definition: detect.h:675
MPMB_TCP_STREAM_TS
@ MPMB_TCP_STREAM_TS
Definition: detect.h:1277
FILE_DECODER_EVENT_LZMA_UNKNOWN_ERROR
@ FILE_DECODER_EVENT_LZMA_UNKNOWN_ERROR
Definition: detect.h:1260
DetectEngineAppInspectionEngine_::sm_list_base
uint16_t sm_list_base
Definition: detect.h:396
Address_
Definition: decode.h:111
DetectPatternTracker::cd
const struct DetectContentData_ * cd
Definition: detect.h:669
DetectBufferMpmRegistery_
one time registration of keywords at start up
Definition: detect.h:625
DetectThresholdEntry_
Definition: detect-threshold.h:65
InspectionBuffer::size
uint32_t size
Definition: detect.h:347
DetectEngineThreadCtx_::spm_thread_ctx
SpmThreadCtx * spm_thread_ctx
Definition: detect.h:1135
DetectAddressHead
struct DetectAddressHead_ DetectAddressHead
InspectionBuffer::flags
uint8_t flags
Definition: detect.h:341
DetectEngineCtx_::dport_hash_table
HashListTable * dport_hash_table
Definition: detect.h:931
PrefilterEngineList_::Prefilter
void(* Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)
Definition: detect.h:1320
DetectEngineCtx_::gh_reuse
uint32_t gh_reuse
Definition: detect.h:820
Signature_::sm_arrays
SigMatchData * sm_arrays[DETECT_SM_LIST_MAX]
Definition: detect.h:594
SigGroupHead_::payload_engines
PrefilterEngine * payload_engines
Definition: detect.h:1411
DetectEngineCtx_::mpm_ctx_factory_container
MpmCtxFactoryContainer * mpm_ctx_factory_container
Definition: detect.h:854
DetectEngineCtx_::prefilter_setting
enum DetectEnginePrefilterSetting prefilter_setting
Definition: detect.h:929
SignatureInitData_::init_flags
uint32_t init_flags
Definition: detect.h:502
DetectBufferType_
Definition: detect.h:411
ADDRESS_LT
@ ADDRESS_LT
Definition: detect.h:113
DetectPort_::sh
struct SigGroupHead_ * sh
Definition: detect.h:191
DetectContentData_
Definition: detect-content.h:86
DetectEngineSetEvent
void DetectEngineSetEvent(DetectEngineThreadCtx *det_ctx, uint8_t e)
Definition: detect-engine.c:4641
FILE_DECODER_EVENT_LZMA_FORMAT_ERROR
@ FILE_DECODER_EVENT_LZMA_FORMAT_ERROR
Definition: detect.h:1257
SigFileLoaderStat_::TAILQ_HEAD
TAILQ_HEAD(, SigString_) failed_sigs
DetectEngineCtx_::sigerror_ok
bool sigerror_ok
Definition: detect.h:892
Signature_::profiling_id
uint16_t profiling_id
Definition: detect.h:582
DetectBufferMpmRegistery_::GetData
InspectionBufferGetDataPtr GetData
Definition: detect.h:644
PrefilterEngine_::local_id
uint16_t local_id
Definition: detect.h:1335
DetectBufferMpmRegistery_::GetData
InspectionBufferGetPktDataPtr GetData
Definition: detect.h:654
PrefilterEngineList_::Free
void(* Free)(void *pectx)
Definition: detect.h:1327
RuleMatchCandidateTxArrayInit
void RuleMatchCandidateTxArrayInit(DetectEngineThreadCtx *det_ctx, uint32_t size)
Definition: detect.c:968
ALPROTO_MAX
@ ALPROTO_MAX
Definition: app-layer-protos.h:76
MPMB_MAX
@ MPMB_MAX
Definition: detect.h:1282
SigTableElmt_
element in sigmatch type table.
Definition: detect.h:1201
SigMatchData_
Data needed for Match()
Definition: detect.h:322
InspectionBufferMultipleForList::init
uint32_t init
Definition: detect.h:363
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1220
DetectEngineCtx_::sgh_mpm_context_proto_udp_packet
int32_t sgh_mpm_context_proto_udp_packet
Definition: detect.h:871
DetectPort
struct DetectPort_ DetectPort
Port structure for detection engine.
RuleMatchCandidateTx::s
const Signature * s
Definition: detect.h:1018
DetectEngineCtx_::reference_conf_ht
HashTable * reference_conf_ht
Definition: detect.h:815
DetectEngineCtx_::content_inspect_window
uint32_t content_inspect_window
Definition: detect.h:902
PORT_EB
@ PORT_EB
Definition: detect.h:170
DetectEngineThreadCtx_::counter_fnonmpm_list
uint16_t counter_fnonmpm_list
Definition: detect.h:1068
SigMatchData_::type
uint16_t type
Definition: detect.h:323
DetectEngineCtx_::version
uint32_t version
Definition: detect.h:879
DetectMatchAddressIPv4_::ip
uint32_t ip
Definition: detect.h:150
DETECT_TRANSFORMS_MAX
#define DETECT_TRANSFORMS_MAX
Definition: detect.h:47
InspectionBuffer::orig_len
uint32_t orig_len
Definition: detect.h:349
DetectEngineThreadCtx_::varlist
DetectVarList * varlist
Definition: detect.h:1146
Signature_::dsize_low
uint16_t dsize_low
Definition: detect.h:545
DetectPort_::port2
uint16_t port2
Definition: detect.h:182
SignatureNonPrefilterStore_
Definition: detect.h:1000
DetectEngineThreadCtx_::counter_nonmpm_list
uint16_t counter_nonmpm_list
Definition: detect.h:1067
MPMB_TCP_STREAM_TC
@ MPMB_TCP_STREAM_TC
Definition: detect.h:1278
DetectEngineThreadCtx_::events
uint16_t events
Definition: detect.h:1169
AppLayerDecoderEvents_
Data structure to store app layer decoder events.
Definition: app-layer-events.h:34
SigGroupHead
struct SigGroupHead_ SigGroupHead
Container for matching data for a signature group.
DetectMatchAddressIPv6
struct DetectMatchAddressIPv6_ DetectMatchAddressIPv6
DetectUnregisterThreadCtxFuncs
int DetectUnregisterThreadCtxFuncs(DetectEngineCtx *, void *data, const char *name)
Remove Thread keyword context registration.
Definition: detect-engine.c:3484
DetectEngineThreadCtx_::mtcu
MpmThreadCtx mtcu
Definition: detect.h:1129
TransformData_
Definition: detect.h:366
DetectBufferMpmRegistery_::id
int id
Definition: detect.h:632
FLOW_STATES
#define FLOW_STATES
Definition: detect.h:781
Signature_::frame_inspect
DetectEngineFrameInspectionEngine * frame_inspect
Definition: detect.h:590
DetectEnginePktInspectionEngine::transforms
const DetectEngineTransforms * transforms
Definition: detect.h:451
MpmBuiltinBuffers
MpmBuiltinBuffers
Definition: detect.h:1274
DetectPort_::flags
uint8_t flags
Definition: detect.h:184
DetectEngineCtx_::app_mpms_list
DetectBufferMpmRegistery * app_mpms_list
Definition: detect.h:951
SigRegisterTests
void SigRegisterTests(void)
Definition: detect.c:5153
DetectThreadCtxGetKeywordThreadCtx
void * DetectThreadCtxGetKeywordThreadCtx(DetectEngineThreadCtx *, int)
Retrieve thread local keyword ctx by id.
Definition: detect-engine.c:3502
DetectEngineFrameInspectionEngine::Callback
InspectionBufferFrameInspectFunc Callback
Definition: detect.h:475
PORT_GE
@ PORT_GE
Definition: detect.h:171
DetectEngineThreadCtx_::mtcs
MpmThreadCtx mtcs
Definition: detect.h:1130
InspectionBufferMultipleForList::size
uint32_t size
Definition: detect.h:361
DetectEngineCtx_::udp_whitelist
DetectPort * udp_whitelist
Definition: detect.h:934
DetectEngineThreadCtx_::mt_det_ctxs_hash
HashTable * mt_det_ctxs_hash
Definition: detect.h:1039
DetectAddress_::prev
struct DetectAddress_ * prev
Definition: detect.h:137
DETECT_PREFILTER_AUTO
@ DETECT_PREFILTER_AUTO
Definition: detect.h:766
DetectEngineThreadCtx_::keyword_ctxs_size
int keyword_ctxs_size
Definition: detect.h:1159
PrefilterEngine_::is_last_for_progress
bool is_last_for_progress
Definition: detect.h:1360
detect-reference.h
TmModuleDetectRegister
void TmModuleDetectRegister(void)
Signature_::gid
uint32_t gid
Definition: detect.h:574
DetectEngineCtx_::prefilter_id
uint32_t prefilter_id
Definition: detect.h:960
DetectEngineCtx_::sgh_array_size
uint32_t sgh_array_size
Definition: detect.h:868
SigGroupHeadInitData_::pkt_mpms
MpmCtx ** pkt_mpms
Definition: detect.h:1374
SigString_::sig_error
char * sig_error
Definition: detect.h:740
DetectMatchAddressIPv6_::ip2
uint32_t ip2[4]
Definition: detect.h:156
DetectEngineAppInspectionEngine_::id
uint8_t id
Definition: detect.h:392
PrefilterEngineList_::next
struct PrefilterEngineList_ * next
Definition: detect.h:1324
DetectEngineThreadCtx_::counter_alerts_suppressed
uint16_t counter_alerts_suppressed
Definition: detect.h:1064
SigTableElmt_::SetupPrefilter
int(* SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh)
Definition: detect.h:1223
DetectBufferMpmRegistery_::sgh_mpm_context
int sgh_mpm_context
Definition: detect.h:634
Signature_::next
struct Signature_ * next
Definition: detect.h:613
DetectEngineCtx_::sgh_mpm_context_proto_other_packet
int32_t sgh_mpm_context_proto_other_packet
Definition: detect.h:872
DetectVarList
struct DetectVarList_ DetectVarList
DetectEngineAppInspectionEngine_::sm_list
uint16_t sm_list
Definition: detect.h:395
DetectEngineThreadCtx_::filestore
struct DetectEngineThreadCtx_::@100 filestore[DETECT_FILESTORE_MAX]
FILE_DECODER_EVENT_LZMA_BUF_ERROR
@ FILE_DECODER_EVENT_LZMA_BUF_ERROR
Definition: detect.h:1259
TENANT_SELECTOR_UNKNOWN
@ TENANT_SELECTOR_UNKNOWN
Definition: detect.h:1453
SignatureInitData_::smlists_tail
struct SigMatch_ ** smlists_tail
Definition: detect.h:535
DetectEngineTenantMapping_::tenant_id
uint32_t tenant_id
Definition: detect.h:1460
InspectionBufferMultipleForList
Definition: detect.h:359
DetectBufferMpmType
DetectBufferMpmType
Definition: detect.h:616
DETECT_SM_LIST_POSTMATCH
@ DETECT_SM_LIST_POSTMATCH
Definition: detect.h:87
PrefilterEngine_::cb
union PrefilterEngine_::@102 cb
DetectEngineTenantMapping
struct DetectEngineTenantMapping_ DetectEngineTenantMapping
DetectEngineCtx_::prefilter_hash_table
HashListTable * prefilter_hash_table
Definition: detect.h:961
DetectReplaceList
struct DetectReplaceList_ DetectReplaceList
DetectEngineCtx_::sm_types_silent_error
bool sm_types_silent_error[DETECT_TBLSIZE]
Definition: detect.h:973
SigString_::TAILQ_ENTRY
TAILQ_ENTRY(SigString_) next
DetectEngineTenantSelectors
DetectEngineTenantSelectors
Definition: detect.h:1452
FILE_DECODER_EVENT_LZMA_DECODER_ERROR
@ FILE_DECODER_EVENT_LZMA_DECODER_ERROR
Definition: detect.h:1254
InspectionBufferPktInspectFunc
int(* InspectionBufferPktInspectFunc)(struct DetectEngineThreadCtx_ *, const struct DetectEnginePktInspectionEngine *engine, const struct Signature_ *s, Packet *p, uint8_t *alert_flags)
Definition: detect.h:430
DetectBufferType
struct DetectBufferType_ DetectBufferType
DetectEngineThreadCtx_::tx_candidates
RuleMatchCandidateTx * tx_candidates
Definition: detect.h:1119
InspectionBuffer
struct InspectionBuffer InspectionBuffer
DetectEngineMasterCtx
struct DetectEngineMasterCtx_ DetectEngineMasterCtx
SignatureInitData_::prefilter_list
int prefilter_list
Definition: detect.h:529
Signature_::addr_src_match4
DetectMatchAddressIPv4 * addr_src_match4
Definition: detect.h:568
SigTableElmt_::TransformValidate
bool(* TransformValidate)(const uint8_t *content, uint16_t content_len, void *context)
Definition: detect.h:1217
Signature_::class_id
uint16_t class_id
Definition: detect.h:560
DetectEngineThreadCtx_::counter_alerts_overflow
uint16_t counter_alerts_overflow
Definition: detect.h:1062
DETECT_FILESTORE_MAX
#define DETECT_FILESTORE_MAX
Definition: detect.h:998
PrefilterEngineList_::alproto
AppProto alproto
Definition: detect.h:1309
SignatureInitData
struct SignatureInitData_ SignatureInitData
SigGroupHeadInitData_::sig_cnt
SigIntId sig_cnt
Definition: detect.h:1383
SRepCIDRTree_
Definition: reputation.h:35
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:17
ADDRESS_EB
@ ADDRESS_EB
Definition: detect.h:117
DetectEnginePktInspectionEngine::sm_list
uint16_t sm_list
Definition: detect.h:445
DetectEngineThreadCtx_::match_array_len
uint32_t match_array_len
Definition: detect.h:1115
IPOnlyCIDRItem_::negated
uint8_t negated
Definition: detect.h:295
DetectEngineThreadCtx_
Definition: detect.h:1024
PrefilterEngine_
Definition: detect.h:1334
MpmStore_
Definition: detect.h:1285
SigGroupHeadInitData_::tx_engines
PrefilterEngineList * tx_engines
Definition: detect.h:1379
SCProfileKeywordDetectCtx_
Definition: util-profiling-keywords.c:48
SignatureInitData_::mpm_sm
SigMatch * mpm_sm
Definition: detect.h:511
DetectEngineCtx_::srepCIDR_ctx
SRepCIDRTree * srepCIDR_ctx
Definition: detect.h:797
DetectBufferMpmRegistery_::PrefilterRegisterWithListId
int(* PrefilterRegisterWithListId)(struct DetectEngineCtx_ *de_ctx, struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx, const struct DetectBufferMpmRegistery_ *mpm_reg, int list_id)
Definition: detect.h:636
SignatureInitData_::src
const DetectAddressHead * src
Definition: detect.h:527
DetectEngineThreadCtx_::tx_candidates_size
uint32_t tx_candidates_size
Definition: detect.h:1120
DETECT_SM_LIST_BASE64_DATA
@ DETECT_SM_LIST_BASE64_DATA
Definition: detect.h:84
DetectEngineThreadKeywordCtxItem_::id
int id
Definition: detect.h:759
DetectEngineThreadCtx_::buffers
InspectionBuffer * buffers
Definition: detect.h:1075
PORT_GT
@ PORT_GT
Definition: detect.h:172
SigAddressPrepareBidirectionals
void SigAddressPrepareBidirectionals(DetectEngineCtx *)
DetectEngineMasterCtx_::keyword_list
DetectEngineThreadKeywordCtxItem * keyword_list
Definition: detect.h:1495
SignatureInitData_::mpm_sm_list
int mpm_sm_list
Definition: detect.h:509
PrefilterEngineList_::PrefilterFrame
PrefilterFrameFn PrefilterFrame
Definition: detect.h:1322
DetectEngineIPOnlyThreadCtx_::sig_match_array
uint8_t * sig_match_array
Definition: detect.h:705
DetectEngineMasterCtx_::tenant_selector
enum DetectEngineTenantSelectors tenant_selector
Definition: detect.h:1486
DetectEngineCtx_::keyword_hash
HashListTable * keyword_hash
Definition: detect.h:896
FILE_DECODER_EVENT_Z_UNKNOWN_ERROR
@ FILE_DECODER_EVENT_Z_UNKNOWN_ERROR
Definition: detect.h:1253
PrefilterEngineList_::pectx
void * pectx
Definition: detect.h:1318
DetectEngineCtx_::last_reload
struct timeval last_reload
Definition: detect.h:964
SignatureInitData_::list
int list
Definition: detect.h:516
Signature_::pkt_inspect
DetectEnginePktInspectionEngine * pkt_inspect
Definition: detect.h:589
SCProfileSghData_
Definition: util-profiling-rulegroups.c:37
DetectReplaceList_::next
struct DetectReplaceList_ * next
Definition: detect.h:678
DetectEngineLookupFlow_::sgh
struct SigGroupHead_ * sgh[256]
Definition: detect.h:723
Signature_::references
DetectReference * references
Definition: detect.h:604
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
PrefilterEngineList_::PrefilterTx
PrefilterTxFn PrefilterTx
Definition: detect.h:1321
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
SignatureNonPrefilterStore_::alproto
AppProto alproto
Definition: detect.h:1003
PrefilterEngineList_::gid
uint32_t gid
Definition: detect.h:1331
DetectEngineFrameInspectionEngine::sm_list
uint16_t sm_list
Definition: detect.h:472
DetectMetadataHead
Definition: detect-metadata.h:39
FILE_DECODER_EVENT_INVALID_SWF_LENGTH
@ FILE_DECODER_EVENT_INVALID_SWF_LENGTH
Definition: detect.h:1248
SCSigSignatureWrapper_
Signature wrapper used by signature ordering module while ordering signatures.
Definition: detect-engine-sigorder.h:45
SigTableElmt
struct SigTableElmt_ SigTableElmt
element in sigmatch type table.
SigMatch
struct SigMatch_ SigMatch
a single match condition for a signature
SigMatch_::next
struct SigMatch_ * next
Definition: detect.h:317
DetectEngineCtx_::mpm_matcher
uint8_t mpm_matcher
Definition: detect.h:834
DETECT_EVENT_TOO_MANY_BUFFERS
@ DETECT_EVENT_TOO_MANY_BUFFERS
Definition: detect.h:1262
InspectionBuffer::inspect_offset
uint64_t inspect_offset
Definition: detect.h:339
DetectEngineCtx_::frame_inspect_engines
DetectEngineFrameInspectionEngine * frame_inspect_engines
Definition: detect.h:956
PrefilterEngineList
struct PrefilterEngineList_ PrefilterEngineList
DetectEngineMasterCtx_::free_list
DetectEngineCtx * free_list
Definition: detect.h:1484
DetectBufferMpmRegistery_::alproto
AppProto alproto
Definition: detect.h:645
DetectEngineThreadKeywordCtxItem_::next
struct DetectEngineThreadKeywordCtxItem_ * next
Definition: detect.h:758
DetectAddress_::ip2
Address ip2
Definition: detect.h:131
DetectEngineThreadCtx_::non_pf_id_cnt
uint32_t non_pf_id_cnt
Definition: detect.h:1035
DETECT_SM_LIST_MATCH
@ DETECT_SM_LIST_MATCH
Definition: detect.h:78
DetectPort_
Port structure for detection engine.
Definition: detect.h:180
SigGroupHead_::init
SigGroupHeadInitData * init
Definition: detect.h:1416
DetectEngineCtx_::ths_ctx
ThresholdCtx ths_ctx
Definition: detect.h:832
DetectEngineCtx_::sig_cnt
uint32_t sig_cnt
Definition: detect.h:791
InspectionBuffer::buf
uint8_t * buf
Definition: detect.h:346
SigTableElmt_::alternative
uint16_t alternative
Definition: detect.h:1233
Signature_::app_inspect
DetectEngineAppInspectionEngine * app_inspect
Definition: detect.h:588
SigMatch_::ctx
SigMatchCtx * ctx
Definition: detect.h:316
DetectReference_
Signature reference list.
Definition: detect-reference.h:31
DetectBufferType_::ValidateCallback
bool(* ValidateCallback)(const struct Signature_ *, const char **sigerror)
Definition: detect.h:421
AlertQueueAppend
void AlertQueueAppend(DetectEngineThreadCtx *det_ctx, const Signature *s, Packet *p, uint64_t tx_id, uint8_t alert_flags)
Append signature to local packet alert queue for later preprocessing.
Definition: detect-engine-alert.c:283
DET_CTX_EVENT_TEST
@ DET_CTX_EVENT_TEST
Definition: detect.h:1245
ENGINE_PROFILE_MEDIUM
@ ENGINE_PROFILE_MEDIUM
Definition: detect.h:984
SigFileLoaderStat_::bad_sigs_total
int bad_sigs_total
Definition: detect.h:751
SigGroupHeadInitData_::direction
uint32_t direction
Definition: detect.h:1370
DetectLoadCompleteSigPath
char * DetectLoadCompleteSigPath(const DetectEngineCtx *, const char *sig_file)
Create the path if default-rule-path was specified.
Definition: detect-engine-loader.c:61
MpmStore_::direction
int direction
Definition: detect.h:1289
DetectEngineThreadCtx_::base64_decoded_len
int base64_decoded_len
Definition: detect.h:1165
DetectVarList_::next
struct DetectVarList_ * next
Definition: detect.h:695
RuleMatchCandidateTx::stream_result
uint8_t stream_result
Definition: detect.h:1013
Signature_::action
uint8_t action
Definition: detect.h:553
DetectBufferMpmRegistery_::name
const char * name
Definition: detect.h:626
DetectEngineLookupFlow_::udp
DetectPort * udp
Definition: detect.h:722
DetectEngineThreadCtx_::raw_stream_progress
uint64_t raw_stream_progress
Definition: detect.h:1048
DetectEngineCtx_::profile_ctx
struct SCProfileDetectCtx_ * profile_ctx
Definition: detect.h:907
PrefilterEngine_::alproto
AppProto alproto
Definition: detect.h:1338
Signature_::flags
uint32_t flags
Definition: detect.h:540
ThresholdCtx_::th_entry
DetectThresholdEntry ** th_entry
Definition: detect.h:733
IPOnlyCIDRItem_::next
struct IPOnlyCIDRItem_ * next
Definition: detect.h:301
DetectEngineCtx_::max_fb_id
uint32_t max_fb_id
Definition: detect.h:850
Packet_
Definition: decode.h:425
DetectEngineFrameInspectionEngine::alproto
AppProto alproto
Definition: detect.h:468
DetectEngineCtx_::sgh_mpm_context_stream
int32_t sgh_mpm_context_stream
Definition: detect.h:873
SignatureNonPrefilterStore
struct SignatureNonPrefilterStore_ SignatureNonPrefilterStore
DetectEngineThreadCtx_::rule_perf_data_size
int rule_perf_data_size
Definition: detect.h:1184
DetectEngineThreadCtx_::frame_id
int64_t frame_id
Definition: detect.h:1098
DetectEngineAppInspectionEngine_::Callback
InspectEngineFuncPtr2 Callback
Definition: detect.h:401
TransformData
struct TransformData_ TransformData
DetectEngineCtx_::sgh_mpm_ctx_cnf
uint8_t sgh_mpm_ctx_cnf
Definition: detect.h:847
DetectBufferType_::packet
bool packet
Definition: detect.h:417
SCSigOrderFunc_
Structure holding the signature ordering function used by the signature ordering module.
Definition: detect-engine-sigorder.h:69
PrefilterEngine
struct PrefilterEngine_ PrefilterEngine
DetectEngineMasterCtx_::multi_tenant_enabled
int multi_tenant_enabled
Definition: detect.h:1472
ADDRESS_EQ
@ ADDRESS_EQ
Definition: detect.h:115
DetectRegisterThreadCtxFuncs
int DetectRegisterThreadCtxFuncs(DetectEngineCtx *, const char *name, void *(*InitFunc)(void *), void *data, void(*FreeFunc)(void *), int)
Register Thread keyword context Funcs.
Definition: detect-engine.c:3432
DetectEngineThreadCtx_::filestore_cnt
uint16_t filestore_cnt
Definition: detect.h:1057
DetectEngineFrameInspectionEngine
Definition: detect.h:467
SigFileLoaderStat
struct SigFileLoaderStat_ SigFileLoaderStat
Signature loader statistics.
DetectEngineCtx_::hcbd_buffer_limit
int hcbd_buffer_limit
Definition: detect.h:860
DetectEngineCtx_::max_uniq_toserver_groups
uint16_t max_uniq_toserver_groups
Definition: detect.h:844
DETECT_BUFFER_MPM_TYPE_PKT
@ DETECT_BUFFER_MPM_TYPE_PKT
Definition: detect.h:617
util-radix-tree.h
PORT_ES
@ PORT_ES
Definition: detect.h:169
SCProfileData_
Definition: util-profiling-rules.c:38
TmEcode
TmEcode
Definition: tm-threads-common.h:81
DetectEnginePktInspectionEngine::Callback
InspectionBufferPktInspectFunc Callback
Definition: detect.h:449
DetectEngineCtx_::gh_unique
uint32_t gh_unique
Definition: detect.h:820
PrefilterEngine_::PrefilterFrame
PrefilterFrameFn PrefilterFrame
Definition: detect.h:1354
PrefilterEngine_::frame_type
uint8_t frame_type
Definition: detect.h:1344
Signature_::init_data
SignatureInitData * init_data
Definition: detect.h:610
DetectEngineCtx_::profile_keyword_ctx
struct SCProfileKeywordDetectCtx_ * profile_keyword_ctx
Definition: detect.h:908
DetectEngineCtx_::sgh_array_cnt
uint32_t sgh_array_cnt
Definition: detect.h:867
DetectEngineThreadCtx_::alert_queue_capacity
uint16_t alert_queue_capacity
Definition: detect.h:1102
FILE_DECODER_EVENT_Z_DATA_ERROR
@ FILE_DECODER_EVENT_Z_DATA_ERROR
Definition: detect.h:1250
SignatureInitData_::negated
bool negated
Definition: detect.h:494
DetectEngineCtx_::sgh_array
struct SigGroupHead_ ** sgh_array
Definition: detect.h:866
SigTableElmt_::Match
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1203
reputation.h
MpmStore
struct MpmStore_ MpmStore
SignatureInitData_
Definition: detect.h:488
SignatureInitData_::smlists
struct SigMatch_ ** smlists
Definition: detect.h:533
SCFPSupportSMList_::priority
int priority
Definition: detect.h:700
ADDRESS_GE
@ ADDRESS_GE
Definition: detect.h:118
HashListTable_
Definition: util-hashlist.h:37
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
DetectEngineCtx_::byte_extract_max_local_id
int32_t byte_extract_max_local_id
Definition: detect.h:876
SignatureInitData_::dst_contains_negation
bool dst_contains_negation
Definition: detect.h:499
DetectEnginePktInspectionEngine::sm_list_base
uint16_t sm_list_base
Definition: detect.h:446
DetectEngineTransforms::transforms
TransformData transforms[DETECT_TRANSFORMS_MAX]
Definition: detect.h:372
PORT_EQ
@ PORT_EQ
Definition: detect.h:168
DetectEngineCtx_::hsbd_buffer_limit
int hsbd_buffer_limit
Definition: detect.h:862
Signature_::addr_dst_match6_cnt
uint16_t addr_dst_match6_cnt
Definition: detect.h:565
DetectEngineThreadCtx_::rule_perf_data
struct SCProfileData_ * rule_perf_data
Definition: detect.h:1183
DetectEngineThreadCtx
struct DetectEngineThreadCtx_ DetectEngineThreadCtx
SigGroupHead_::frame_engines
PrefilterEngine * frame_engines
Definition: detect.h:1413
SigGroupHeadInitData_::app_mpms
MpmCtx ** app_mpms
Definition: detect.h:1373
DetectEngineAppInspectionEngine_::v2
struct DetectEngineAppInspectionEngine_::@85 v2
DetectEngineFrameInspectionEngine::dir
uint8_t dir
Definition: detect.h:469
DetectEngineTransforms
struct DetectEngineTransforms DetectEngineTransforms
Signature_::sp
DetectPort * sp
Definition: detect.h:579
FILE_DECODER_EVENT_Z_STREAM_ERROR
@ FILE_DECODER_EVENT_Z_STREAM_ERROR
Definition: detect.h:1251
DetectEngineThreadCtx_::mtc
MpmThreadCtx mtc
Definition: detect.h:1128
SigString_::filename
char * filename
Definition: detect.h:738
DETECT_ENGINE_TYPE_TENANT
@ DETECT_ENGINE_TYPE_TENANT
Definition: detect.h:774
RuleMatchCandidateTx::flags
uint32_t * flags
Definition: detect.h:1009
DetectEngineCtx_::dup_sig_hash_table
HashListTable * dup_sig_hash_table
Definition: detect.h:829
DetectEngineCtx_::config_prefix
char config_prefix[64]
Definition: detect.h:916
DetectVarList_::type
int type
Definition: detect.h:691
DetectEngineAppInspectionEngine_::alproto
AppProto alproto
Definition: detect.h:390
InspectEngineFuncPtr2
uint8_t(* InspectEngineFuncPtr2)(struct DetectEngineCtx_ *de_ctx, struct DetectEngineThreadCtx_ *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, const struct Signature_ *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Definition: detect.h:384
SigMatchCtx_
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
Definition: detect.h:308
Signature_::class_msg
char * class_msg
Definition: detect.h:602
DetectEngineCtx_::filedata_config
struct DetectEngineCtx_::@93 filedata_config[ALPROTO_MAX]
DetectEngineThreadCtx_::discontinue_matching
uint16_t discontinue_matching
Definition: detect.h:1091
DetectEngineCtx_::sig_array_size
uint32_t sig_array_size
Definition: detect.h:800
ThresholdCtx_
threshold ctx
Definition: detect.h:729
DetectPatternTracker::sm_list
int sm_list
Definition: detect.h:670
DetectEngineAppInspectionEngine_::smd
SigMatchData * smd
Definition: detect.h:406
SigGroupHeadInitData_::pkt_engines
PrefilterEngineList * pkt_engines
Definition: detect.h:1377
DetectBufferType_::id
int id
Definition: detect.h:414
DetectGetTagSignature
Signature * DetectGetTagSignature(void)
DetectEnginePktInspectionEngine::GetData
InspectionBufferGetPktDataPtr GetData
Definition: detect.h:448
DETECT_ENGINE_TYPE_NORMAL
@ DETECT_ENGINE_TYPE_NORMAL
Definition: detect.h:771
DetectEngineIPOnlyCtx_::ip_dst
IPOnlyCIDRItem * ip_dst
Definition: detect.h:716
MpmStore_::mpm_ctx
MpmCtx * mpm_ctx
Definition: detect.h:1294
util-file.h
DetectAddressHead_::ipv6_head
DetectAddress * ipv6_head
Definition: detect.h:145
DetectMetadataHashFree
void DetectMetadataHashFree(DetectEngineCtx *de_ctx)
Definition: detect-metadata.c:80
util-prefilter.h
SignatureInitData_::dsize_sm
SigMatch * dsize_sm
Definition: detect.h:506
DetectBufferType_::frame
bool frame
Definition: detect.h:418
DetectBufferMpmRegistery_::priority
int priority
Definition: detect.h:631
File_
Definition: util-file.h:79
AppLayerTxData
struct AppLayerTxData AppLayerTxData
Definition: detect.h:1301
DetectEngineIPOnlyCtx
struct DetectEngineIPOnlyCtx_ DetectEngineIPOnlyCtx
IP only rules matching ctx.
ENGINE_PROFILE_UNKNOWN
@ ENGINE_PROFILE_UNKNOWN
Definition: detect.h:982
MPMB_TCP_PKT_TC
@ MPMB_TCP_PKT_TC
Definition: detect.h:1276
DetectEngineCtx_::sig_stat
SigFileLoaderStat sig_stat
Definition: detect.h:967
DetectEngineCtx_::address_table
HashListTable * address_table
Definition: detect.h:937
DetectEngineThreadCtx_::to_clear_queue
uint32_t * to_clear_queue
Definition: detect.h:1078
DetectEngineThreadCtx_::inspect_list
int inspect_list
Definition: detect.h:1072
DetectEngineCtx_::profile_prefilter_ctx
struct SCProfilePrefilterDetectCtx_ * profile_prefilter_ctx
Definition: detect.h:909
TENANT_SELECTOR_DIRECT
@ TENANT_SELECTOR_DIRECT
Definition: detect.h:1454
InspectionBufferMultipleForList
struct InspectionBufferMultipleForList InspectionBufferMultipleForList
util-mpm.h
DetectBufferMpmRegistery_::pname
char pname[32]
Definition: detect.h:627
flags
uint8_t flags
Definition: decode-gre.h:0
Signature_::proto
DetectProto proto
Definition: detect.h:557
SigTableElmt_::alias
const char * alias
Definition: detect.h:1236
SigMatchCtx
struct SigMatchCtx_ SigMatchCtx
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
SigGroupHead_::non_pf_other_store_array
SignatureNonPrefilterStore * non_pf_other_store_array
Definition: detect.h:1400
DetectEngineMasterCtx_::keyword_id
int keyword_id
Definition: detect.h:1496
DetectBufferMpmRegistery_::type
uint8_t type
Definition: detect.h:660
SigMatchData_::is_last
uint8_t is_last
Definition: detect.h:324
suricata-common.h
SigMatch_::idx
uint16_t idx
Definition: detect.h:315
DetectEngineThreadCtx_::prefilter_bytes_called
uint64_t prefilter_bytes_called
Definition: detect.h:1195
SigString_::line
int line
Definition: detect.h:741
SigGroupHeadInitData_::frame_engines
PrefilterEngineList * frame_engines
Definition: detect.h:1380
SigMatch_::type
uint16_t type
Definition: detect.h:314
DETECT_BUFFER_MPM_TYPE_APP
@ DETECT_BUFFER_MPM_TYPE_APP
Definition: detect.h:618
SigGroupHeadInitData_::payload_engines
PrefilterEngineList * payload_engines
Definition: detect.h:1378
ADDRESS_GT
@ ADDRESS_GT
Definition: detect.h:119
DetectEngineThreadCtx_::tenant_id
uint32_t tenant_id
Definition: detect.h:1027
SigGroupHeadInitData_::match_array
Signature ** match_array
Definition: detect.h:1386
DetectEngineCtx_::buffer_type_hash_name
HashListTable * buffer_type_hash_name
Definition: detect.h:944
DetectEngineCtx_::next
struct DetectEngineCtx_ * next
Definition: detect.h:923
Signature_::dsize_high
uint16_t dsize_high
Definition: detect.h:546
SigGroupHead_::non_pf_other_store_cnt
uint32_t non_pf_other_store_cnt
Definition: detect.h:1398
Signature_::file_flags
uint8_t file_flags
Definition: detect.h:554
DetectBufferMpmRegistery_::tx_min_progress
int tx_min_progress
Definition: detect.h:646
detect-metadata.h
DETECT_ENGINE_TYPE_DD_STUB
@ DETECT_ENGINE_TYPE_DD_STUB
Definition: detect.h:772
TENANT_SELECTOR_VLAN
@ TENANT_SELECTOR_VLAN
Definition: detect.h:1455
DetectEngineFrameInspectionEngine::next
struct DetectEngineFrameInspectionEngine * next
Definition: detect.h:480
SigTableElmt_::Transform
void(* Transform)(InspectionBuffer *, void *context)
Definition: detect.h:1216
DetectEngineThreadCtx_::inspection_recursion_counter
int inspection_recursion_counter
Definition: detect.h:1108
DetectEngineThreadCtx_::prefilter_perf_data
struct SCProfilePrefilterData_ * prefilter_perf_data
Definition: detect.h:1190
DetectEnginePrefilterSetting
DetectEnginePrefilterSetting
Definition: detect.h:764
DetectPort_::prev
struct DetectPort_ * prev
Definition: detect.h:193
util-spm.h
DetectEnginePktInspectionEngine::next
struct DetectEnginePktInspectionEngine * next
Definition: detect.h:453
ENGINE_SGH_MPM_FACTORY_CONTEXT_AUTO
@ ENGINE_SGH_MPM_FACTORY_CONTEXT_AUTO
Definition: detect.h:994
SigGroupHeadInitData_::sig_size
uint32_t sig_size
Definition: detect.h:1367
PrefilterEngineList_
Definition: detect.h:1305
SigFileLoaderStat_::total_files
int total_files
Definition: detect.h:749
DetectEngineIPOnlyCtx_::tree_ipv4dst
SCRadixTree * tree_ipv4dst
Definition: detect.h:712
DetectMatchAddressIPv4_::ip2
uint32_t ip2
Definition: detect.h:151
DetectEngineCtx_::profile_match_logging_threshold
uint32_t profile_match_logging_threshold
Definition: detect.h:912
IPOnlyCIDRItem_::ip
uint32_t ip[4]
Definition: detect.h:297
PrefilterEngine_::gid
uint32_t gid
Definition: detect.h:1358
Signature_::rev
uint32_t rev
Definition: detect.h:575
SignatureInitData_::sm_cnt
uint16_t sm_cnt
Definition: detect.h:490
PORT_ER
@ PORT_ER
Definition: detect.h:165
DetectEngineCtx_::sig_list
Signature * sig_list
Definition: detect.h:790
ADDRESS_ES
@ ADDRESS_ES
Definition: detect.h:116
DETECT_SM_LIST_TMATCH
@ DETECT_SM_LIST_TMATCH
Definition: detect.h:89
DetectEngineCtx_::profile_keyword_ctx_per_list
struct SCProfileKeywordDetectCtx_ ** profile_keyword_ctx_per_list
Definition: detect.h:910
RuleMatchCandidateTx
struct RuleMatchCandidateTx RuleMatchCandidateTx
DetectEngineCtx_::tcp_whitelist
DetectPort * tcp_whitelist
Definition: detect.h:933
DetectEngineCtx_::loader_id
int loader_id
Definition: detect.h:926
TransformData_::transform
int transform
Definition: detect.h:367
DetectEngineCtx_::pkt_inspect_engines
DetectEnginePktInspectionEngine * pkt_inspect_engines
Definition: detect.h:953
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:32
Signature_::prio
int prio
Definition: detect.h:576
DetectEngineThreadCtx_::non_pf_id_array
SigIntId * non_pf_id_array
Definition: detect.h:1034
DetectEngineAppInspectionEngine_::progress
int16_t progress
Definition: detect.h:397
DetectEngineThreadKeywordCtxItem_::FreeFunc
void(* FreeFunc)(void *)
Definition: detect.h:756
DetectMatchAddressIPv6_::ip
uint32_t ip[4]
Definition: detect.h:155
app-layer-events.h
SigGroupHeadInitData
struct SigGroupHeadInitData_ SigGroupHeadInitData
DetectAddress
struct DetectAddress_ DetectAddress
address structure for use in the detection engine.
SpmGlobalThreadCtx_
Definition: util-spm.h:47
DetectEngineCtx_::app_mpms_list_cnt
uint32_t app_mpms_list_cnt
Definition: detect.h:952
Signature_::addr_src_match6_cnt
uint16_t addr_src_match6_cnt
Definition: detect.h:566
FILE_DECODER_EVENT_Z_BUF_ERROR
@ FILE_DECODER_EVENT_Z_BUF_ERROR
Definition: detect.h:1252
InspectionBufferFrameInspectFunc
int(* InspectionBufferFrameInspectFunc)(struct DetectEngineThreadCtx_ *, const struct DetectEngineFrameInspectionEngine *engine, const struct Signature_ *s, Packet *p, const struct Frames *frames, const struct Frame *frame, const uint32_t idx)
Definition: detect.h:463
DetectProto_
Definition: detect-engine-proto.h:36
DetectFilestoreData_
Definition: detect-filestore.h:36
ENGINE_PROFILE_CUSTOM
@ ENGINE_PROFILE_CUSTOM
Definition: detect.h:986
SigGroupHeadInitData_
Definition: detect.h:1363
InspectionBuffer::inspect_len
uint32_t inspect_len
Definition: detect.h:340
DetectEngineCtx_::app_inspect_engines
DetectEngineAppInspectionEngine * app_inspect_engines
Definition: detect.h:950
SignatureInitData_::dst
const DetectAddressHead * dst
Definition: detect.h:527
PrefilterEngine_::pectx
void * pectx
Definition: detect.h:1349
DetectEngineThreadCtx_::alert_queue
PacketAlert * alert_queue
Definition: detect.h:1103
DetectEngineThreadCtx_::pcre_match_start_offset
uint32_t pcre_match_start_offset
Definition: detect.h:1054
DetectEngineThreadCtx_::global_keyword_ctxs_size
int global_keyword_ctxs_size
Definition: detect.h:1161
Signature_::dp
DetectPort * dp
Definition: detect.h:579
DetectEngineCtx_::sm_types_prefilter
bool sm_types_prefilter[DETECT_TBLSIZE]
Definition: detect.h:972
DetectEngineCtx_::mpm_hash_table
HashListTable * mpm_hash_table
Definition: detect.h:825
InspectionBuffer::inspect
const uint8_t * inspect
Definition: detect.h:338
DumpPatterns
void DumpPatterns(DetectEngineCtx *de_ctx)
Definition: detect-engine-analyzer.c:979
Signature_::metadata
DetectMetadataHead * metadata
Definition: detect.h:606
DetectEngineThreadCtx_::tv
ThreadVars * tv
Definition: detect.h:1030
MPMB_UDP_TC
@ MPMB_UDP_TC
Definition: detect.h:1280
DetectEngineThreadCtx_::non_pf_store_cnt
uint32_t non_pf_store_cnt
Definition: detect.h:1123
DetectEngineThreadCtx_::counter_alerts
uint16_t counter_alerts
Definition: detect.h:1060
InspectionBuffer::len
uint32_t len
Definition: detect.h:345
SigGroupHead_::flags
uint32_t flags
Definition: detect.h:1394
DetectVarList_::key
uint8_t * key
Definition: detect.h:692
DetectEngineThreadCtx_::keyword_ctxs_array
void ** keyword_ctxs_array
Definition: detect.h:1158
Signature_::cidr_dst
IPOnlyCIDRItem * cidr_dst
Definition: detect.h:586
SigFileLoaderStat_::good_sigs_total
int good_sigs_total
Definition: detect.h:750
SigTableElmt_::SupportsPrefilter
bool(* SupportsPrefilter)(const Signature *s)
Definition: detect.h:1222
DetectEngineGetEvents
AppLayerDecoderEvents * DetectEngineGetEvents(DetectEngineThreadCtx *det_ctx)
Definition: detect-engine.c:4647
Signature_::addr_dst_match6
DetectMatchAddressIPv6 * addr_dst_match6
Definition: detect.h:570
DetectEngineMasterCtx_
Definition: detect.h:1468
FILE_DECODER_EVENT_LZMA_MEMLIMIT_ERROR
@ FILE_DECODER_EVENT_LZMA_MEMLIMIT_ERROR
Definition: detect.h:1255
Signature_::id
uint32_t id
Definition: detect.h:573
DetectEngineThreadKeywordCtxItem_::name
const char * name
Definition: detect.h:760
DetectEngineThreadCtx_::base64_decoded_len_max
int base64_decoded_len_max
Definition: detect.h:1166
DetectEngineLookupFlow
struct DetectEngineLookupFlow_ DetectEngineLookupFlow
RuleMatchCandidateTx::stream_reset
uint32_t stream_reset
Definition: detect.h:1015
DisableDetectFlowFileFlags
void DisableDetectFlowFileFlags(Flow *f)
disable file features we don't need Called if we have no detection engine.
Definition: detect.c:1778
DetectBufferType_::transforms
DetectEngineTransforms transforms
Definition: detect.h:422
DetectEngineCtx_::content_limit
uint32_t content_limit
Definition: detect.h:900
PORT_LE
@ PORT_LE
Definition: detect.h:167
DetectEngineType
DetectEngineType
Definition: detect.h:770
FILE_DECODER_EVENT_NO_MEM
@ FILE_DECODER_EVENT_NO_MEM
Definition: detect.h:1247
Signature_
Signature container.
Definition: detect.h:539
SCProfileDetectCtx_
Definition: util-profiling-rules.c:49
SigMatch_
a single match condition for a signature
Definition: detect.h:313
SCProfilePrefilterData_
Definition: util-profiling-prefilter.c:35
DetectEngineAppInspectionEngine_::transforms
const DetectEngineTransforms * transforms
Definition: detect.h:403
DetectEngineThreadCtx_::inspect
struct DetectEngineThreadCtx_::@98 inspect
DETECT_SM_LIST_MAX
@ DETECT_SM_LIST_MAX
Definition: detect.h:95
detect-threshold.h
SigMatchCtx_::foo
int foo
Definition: detect.h:309
DetectBufferType_::parent_id
int parent_id
Definition: detect.h:415
DETECT_PREFILTER_MPM
@ DETECT_PREFILTER_MPM
Definition: detect.h:765
SignatureMask
#define SignatureMask
Definition: detect.h:272
DetectAddress_::next
struct DetectAddress_ * next
Definition: detect.h:139
DetectEngineTenantMapping_::traffic_id
uint32_t traffic_id
Definition: detect.h:1463
SigGroupHeadInitData_::protos
uint8_t protos[256]
Definition: detect.h:1369
DetectMatchAddressIPv6_
Definition: detect.h:154
MPMB_TCP_PKT_TS
@ MPMB_TCP_PKT_TS
Definition: detect.h:1275
DetectMatchAddressIPv4_
Definition: detect.h:149
DetectEngineCtx_::spm_matcher
uint16_t spm_matcher
Definition: detect.h:835
DetectEngineThreadCtx_::tx_id_set
bool tx_id_set
Definition: detect.h:1095
AlertQueueFree
void AlertQueueFree(DetectEngineThreadCtx *det_ctx)
Definition: detect-engine-alert.c:235
DetectEnginePktInspectionEngine
struct DetectEnginePktInspectionEngine DetectEnginePktInspectionEngine
DetectEngineThreadCtx_::base64_decoded
uint8_t * base64_decoded
Definition: detect.h:1164
Signature_::dsize_mode
uint8_t dsize_mode
Definition: detect.h:547
DetectEngineLookupFlow_
Definition: detect.h:720
DetectEngineCtx_::filedata_config_initialized
bool filedata_config_initialized
Definition: detect.h:904
DetectEngineCtx_::pkt_mpms_list
DetectBufferMpmRegistery * pkt_mpms_list
Definition: detect.h:954
DetectEngineCtx_::content_inspect_min_size
uint32_t content_inspect_min_size
Definition: detect.h:901
DetectEngineTransforms::cnt
int cnt
Definition: detect.h:373
PrefilterEngine_::is_last
bool is_last
Definition: detect.h:1359
DetectEngineThreadCtx_::de_ctx
DetectEngineCtx * de_ctx
Definition: detect.h:1156
DetectEngineCtx_::sig_array
Signature ** sig_array
Definition: detect.h:799
SigGroupHead_::non_pf_syn_store_array
SignatureNonPrefilterStore * non_pf_syn_store_array
Definition: detect.h:1402
ADDRESS_LE
@ ADDRESS_LE
Definition: detect.h:114
PacketAlert_
Definition: decode.h:260
PrefilterEngineList_::tx_min_progress
uint8_t tx_min_progress
Definition: detect.h:1312
DetectEngineAppInspectionEngine_::dir
uint8_t dir
Definition: detect.h:391
DETECT_BUFFER_MPM_TYPE_SIZE
@ DETECT_BUFFER_MPM_TYPE_SIZE
Definition: detect.h:621
DetectEngineThreadCtx_::multi_inspect
struct DetectEngineThreadCtx_::@99 multi_inspect
DETECT_ENGINE_TYPE_MT_STUB
@ DETECT_ENGINE_TYPE_MT_STUB
Definition: detect.h:773
SignatureNonPrefilterStore_::mask
SignatureMask mask
Definition: detect.h:1002
DetectEngineCtx_::buffer_type_id
uint32_t buffer_type_id
Definition: detect.h:946
Signature
struct Signature_ Signature
Signature container.
DetectEngineIPOnlyCtx_
IP only rules matching ctx.
Definition: detect.h:710
DetectEngineCtx_::sigerror
const char * sigerror
Definition: detect.h:893
DetectBufferType_::SetupCallback
void(* SetupCallback)(const struct DetectEngineCtx_ *, struct Signature_ *)
Definition: detect.h:420
DetectEngineThreadCtx_::mt_det_ctxs_cnt
uint32_t mt_det_ctxs_cnt
Definition: detect.h:1037
DetectMetadataHashInit
int DetectMetadataHashInit(DetectEngineCtx *de_ctx)
Definition: detect-metadata.c:69
DetectEngineIPOnlyThreadCtx
struct DetectEngineIPOnlyThreadCtx_ DetectEngineIPOnlyThreadCtx
DetectEngineMasterCtx_::lock
SCMutex lock
Definition: detect.h:1469
DetectEnginePktInspectionEngine::mpm
bool mpm
Definition: detect.h:444
DetectEngineCtx_::spm_global_thread_ctx
SpmGlobalThreadCtx * spm_global_thread_ctx
Definition: detect.h:839
DetectFlowbitsAnalyze
int DetectFlowbitsAnalyze(DetectEngineCtx *de_ctx)
Definition: detect-flowbits.c:409
SigGroupHead_::pkt_engines
PrefilterEngine * pkt_engines
Definition: detect.h:1410
DetectEngineCtx_::flags
uint8_t flags
Definition: detect.h:785
SigGroupHeadInitData_::whitelist
int whitelist
Definition: detect.h:1371
DetectEngineThreadCtx_::replist
DetectReplaceList * replist
Definition: detect.h:1144
SignatureInitData_::transforms
DetectEngineTransforms transforms
Definition: detect.h:519
ENGINE_PROFILE_MAX
@ ENGINE_PROFILE_MAX
Definition: detect.h:987
SigString_::sig_str
char * sig_str
Definition: detect.h:739
DetectEngineCtx_::io_ctx
DetectEngineIPOnlyCtx io_ctx
Definition: detect.h:831
PrefilterEngine_::PrefilterTx
PrefilterTxFn PrefilterTx
Definition: detect.h:1353
DetectMatchAddressIPv4
struct DetectMatchAddressIPv4_ DetectMatchAddressIPv4
DetectEngineCtx_::rule_line
int rule_line
Definition: detect.h:890
MpmCtx_
Definition: util-mpm.h:88
DetectBufferMpmRegistery
struct DetectBufferMpmRegistery_ DetectBufferMpmRegistery
one time registration of keywords at start up
Signature_::addr_dst_match4
DetectMatchAddressIPv4 * addr_dst_match4
Definition: detect.h:567
Signature_::msg
char * msg
Definition: detect.h:599
flow.h
DetectReplaceList_::cd
struct DetectContentData_ * cd
Definition: detect.h:676
sigmatch_table
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
Definition: detect-parse.c:76
Signature_::addr_src_match4_cnt
uint16_t addr_src_match4_cnt
Definition: detect.h:564
SigIntId
#define SigIntId
Definition: suricata-common.h:304
DetectEngineAppInspectionEngine
struct DetectEngineAppInspectionEngine_ DetectEngineAppInspectionEngine
TENANT_SELECTOR_LIVEDEV
@ TENANT_SELECTOR_LIVEDEV
Definition: detect.h:1456
Signature_::addr_dst_match4_cnt
uint16_t addr_dst_match4_cnt
Definition: detect.h:563
DetectEngineFrameInspectionEngine::type
uint8_t type
Definition: detect.h:470
DetectEngineFrameInspectionEngine::v1
struct DetectEngineFrameInspectionEngine::@87 v1
DetectSigmatchListEnum
DetectSigmatchListEnum
Definition: detect.h:77
DetectEngineMasterCtx_::version
uint32_t version
Definition: detect.h:1475
DetectEngineCtx_::sig_array_len
uint32_t sig_array_len
Definition: detect.h:801
DetectBufferMpmRegistery_::sm_list
int16_t sm_list
Definition: detect.h:629
DetectEngineCtx_::metadata_table
HashTable * metadata_table
Definition: detect.h:940
DetectEngineIPOnlyCtx_::tree_ipv6src
SCRadixTree * tree_ipv6src
Definition: detect.h:713
DetectEngineCtx_::signum
uint32_t signum
Definition: detect.h:803
SigGroupHead_::filestore_cnt
uint16_t filestore_cnt
Definition: detect.h:1406
IPOnlyCIDRItem_::signum
SigIntId signum
Definition: detect.h:298
SigFileLoaderStat_
Signature loader statistics.
Definition: detect.h:746
DetectAddress_::flags
uint8_t flags
Definition: detect.h:134
ENGINE_PROFILE_HIGH
@ ENGINE_PROFILE_HIGH
Definition: detect.h:985
FILE_DECODER_EVENT_LZMA_OPTIONS_ERROR
@ FILE_DECODER_EVENT_LZMA_OPTIONS_ERROR
Definition: detect.h:1256
DetectEngineCtx_::buffer_type_hash_id
HashListTable * buffer_type_hash_id
Definition: detect.h:945
DetectEngineCtx_::base64_decode_max_len
uint32_t base64_decode_max_len
Definition: detect.h:886
DetectEngineLookupFlow_::tcp
DetectPort * tcp
Definition: detect.h:721
ThresholdCtx
struct ThresholdCtx_ ThresholdCtx
threshold ctx
DETECT_SM_LIST_SUPPRESS
@ DETECT_SM_LIST_SUPPRESS
Definition: detect.h:92
SCMutex
#define SCMutex
Definition: threads-debug.h:114
DetectEngineCtx_::fp_support_smlist_list
SCFPSupportSMList * fp_support_smlist_list
Definition: detect.h:977
InspectionBufferMultipleForList::inspection_buffers
InspectionBuffer * inspection_buffers
Definition: detect.h:360
MpmStore_::sgh_mpm_context
int32_t sgh_mpm_context
Definition: detect.h:1292
InspectionBufferMultipleForList::max
uint32_t max
Definition: detect.h:362
DetectAddressHead_::ipv4_head
DetectAddress * ipv4_head
Definition: detect.h:144
SigGroupHead_::id
uint32_t id
Definition: detect.h:1408
IPOnlyCIDRItem_::family
uint8_t family
Definition: detect.h:291
DetectEngineThreadCtx_::counter_mpm_list
uint16_t counter_mpm_list
Definition: detect.h:1066
DetectEngineThreadCtx_::prefilter_bytes
uint64_t prefilter_bytes
Definition: detect.h:1193
DetectEngineFrameInspectionEngine
struct DetectEngineFrameInspectionEngine DetectEngineFrameInspectionEngine
SigMatchData
struct SigMatchData_ SigMatchData
Data needed for Match()
DetectEngineCtx_::failure_fatal
int failure_fatal
Definition: detect.h:786
MpmStore_::buffer
enum MpmBuiltinBuffers buffer
Definition: detect.h:1290
DetectEngineThreadCtx_::tenant_array_size
uint32_t tenant_array_size
Definition: detect.h:1042
DetectEngineThreadCtx_::tenant_array
struct DetectEngineTenantMapping_ * tenant_array
Definition: detect.h:1041
DetectEngineCtx_::sc_sig_order_funcs
struct SCSigOrderFunc_ * sc_sig_order_funcs
Definition: detect.h:810
MpmCtxFactoryContainer_
Definition: util-mpm.h:124
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1227
DetectEngineThreadCtx_::file_id
uint32_t file_id
Definition: detect.h:1152
ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE
@ ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE
Definition: detect.h:993
DetectEngineThreadCtx_::io_ctx
DetectEngineIPOnlyThreadCtx io_ctx
Definition: detect.h:1138
DetectEngineThreadCtx_::mt_det_ctxs
struct DetectEngineThreadCtx_ ** mt_det_ctxs
Definition: detect.h:1038
Signature_::mask
SignatureMask mask
Definition: detect.h:549
DetectBufferMpmRegistery_::next
struct DetectBufferMpmRegistery_ * next
Definition: detect.h:664
RuleMatchCandidateTx
Definition: detect.h:1007
SignatureInitData_::smlists_array_size
uint32_t smlists_array_size
Definition: detect.h:531
DetectEngineThreadCtx_::TenantGetId
uint32_t(* TenantGetId)(const void *, const Packet *p)
Definition: detect.h:1044
DetectBufferType_::description
char description[128]
Definition: detect.h:413
DetectBufferMpmRegistery_::sm_list_base
int16_t sm_list_base
Definition: detect.h:630
DetectEngineIPOnlyCtx_::max_idx
uint32_t max_idx
Definition: detect.h:717
SigGroupHeadInitData_::frame_mpms
MpmCtx ** frame_mpms
Definition: detect.h:1375
SpmThreadCtx_
Definition: util-spm.h:54
DetectEngineFrameInspectionEngine::smd
SigMatchData * smd
Definition: detect.h:479
DetectEngineIPOnlyThreadCtx_::sig_match_size
uint32_t sig_match_size
Definition: detect.h:706
DetectEngineThreadCtx_::match_array
Signature ** match_array
Definition: detect.h:1112
DetectEngineIPOnlyThreadCtx_
Definition: detect.h:704