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