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