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