suricata
detect.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2025 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 SURICATA_DETECT_H
25 #define SURICATA_DETECT_H
26 
27 #include "suricata-common.h"
28 #include "flow.h"
29 
30 #include "app-layer-parser.h"
31 #include "detect-engine-proto.h"
32 #include "detect-reference.h"
33 #include "detect-metadata.h"
34 #include "detect-engine-register.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-radix4-tree.h"
43 #include "util-radix6-tree.h"
44 #include "util-file.h"
45 #include "reputation.h"
46 
47 #define DETECT_MAX_RULE_SIZE 8192
48 
49 #define DETECT_TRANSFORMS_MAX 16
50 
51 /** default rule priority if not set through priority keyword or via
52  * classtype. */
53 #define DETECT_DEFAULT_PRIO 3
54 
55 // tx_id value to use when there is no transaction
56 #define PACKET_ALERT_NOTX UINT64_MAX
57 
58 /* forward declaration for sigorder logic in detect-engine-sigorder.[ch] */
59 struct SCSigOrderFunc_;
60 
61 /* Forward declarations for structures from Rust. */
63 
64 // rule types documentation tag start: SignatureType
67  SIG_TYPE_IPONLY, // rule is handled by IPONLY engine
68  SIG_TYPE_LIKE_IPONLY, // rule is handled by pkt engine, has action effect like ip-only
69  /** Proto detect only signature.
70  * Inspected once per direction when protocol detection is done. */
71  SIG_TYPE_PDONLY, // rule is handled by PDONLY engine
76 
77  SIG_TYPE_APPLAYER, // app-layer but not tx, e.g. appproto
78  SIG_TYPE_APP_TX, // rule is handled by TX engine
79 
81 };
82 // rule types documentation tag end: SignatureType
83 
88 };
89 
92 };
93 
95 
96 /*
97  The detection engine groups similar signatures/rules together. Internally a
98  tree of different types of data is created on initialization. This is it's
99  global layout:
100 
101  For TCP/UDP
102 
103  - Flow direction
104  -- Protocol
105  -=- Dst port
106 
107  For the other protocols
108 
109  - Flow direction
110  -- Protocol
111 */
112 
113 /* used for Signature->list, which indicates which list
114  * we're adding keywords to in cases of sticky buffers like
115  * file_data */
116 #define DETECT_SM_LIST_NOTSET INT_MAX
117 
118 /*
119  * DETECT ADDRESS
120  */
121 
122 /* a is ... than b */
123 enum {
124  ADDRESS_ER = -1, /**< error e.g. compare ipv4 and ipv6 */
125  ADDRESS_LT, /**< smaller [aaa] [bbb] */
126  ADDRESS_LE, /**< smaller with overlap [aa[bab]bb] */
127  ADDRESS_EQ, /**< exactly equal [abababab] */
128  ADDRESS_ES, /**< within [bb[aaa]bb] and [[abab]bbb] and [bbb[abab]] */
129  ADDRESS_EB, /**< completely overlaps [aa[bbb]aa] and [[baba]aaa] and [aaa[baba]] */
130  ADDRESS_GE, /**< bigger with overlap [bb[aba]aa] */
131  ADDRESS_GT, /**< bigger [bbb] [aaa] */
132 };
133 
134 #define ADDRESS_FLAG_NOT 0x01 /**< address is negated */
135 #define ADDRESS_FLAG_RANGE 0x02 /**< address has range */
136 
137 /** \brief address structure for use in the detection engine.
138  *
139  * Contains the address information and matching information.
140  */
141 typedef struct DetectAddress_ {
142  /** address data for this group */
145 
146  /** flags affecting this address */
147  uint8_t flags;
148 
149  /** ptr to the previous address in the list */
151  /** ptr to the next address in the list */
154 
155 /** Address grouping head. IPv4 and IPv6 are split out */
156 typedef struct DetectAddressHead_ {
159 
162 
163 
164 typedef struct DetectMatchAddressIPv4_ {
165  uint32_t ip; /**< address in host order, start of range */
166  uint32_t ip2; /**< address in host order, end of range */
168 
169 typedef struct DetectMatchAddressIPv6_ {
170  uint32_t ip[4];
171  uint32_t ip2[4];
173 
174 /*
175  * DETECT PORT
176  */
177 
178 /* a is ... than b */
179 enum {
180  PORT_ER = -1, /* error */
181  PORT_LT, /* smaller [aaa] [bbb] */
182  PORT_LE, /* smaller with overlap [aa[bab]bb] */
183  PORT_EQ, /* exactly equal [abababab] */
184  PORT_ES, /* within [bb[aaa]bb] and [[abab]bbb] and [bbb[abab]] */
185  PORT_EB, /* completely overlaps [aa[bbb]aa] and [[baba]aaa] and [aaa[baba]] */
186  PORT_GE, /* bigger with overlap [bb[aba]aa] */
187  PORT_GT, /* bigger [bbb] [aaa] */
188 };
189 
190 #define PORT_FLAG_NOT 0x02 /**< negated port */
191 #define PORT_SIGGROUPHEAD_COPY 0x04 /**< sgh is a ptr copy */
192 
193 /** \brief Port structure for detection engine */
194 typedef struct DetectPort_ {
195  uint16_t port;
196  uint16_t port2;
197 
198  uint8_t flags; /**< flags for this port */
199 
200  /* signatures that belong in this group
201  *
202  * If the PORT_SIGGROUPHEAD_COPY flag is set, we don't own this pointer
203  * (memory is freed elsewhere).
204  */
205  struct SigGroupHead_ *sh;
206 
207  struct DetectPort_ *prev;
208  struct DetectPort_ *next;
209  struct DetectPort_ *last; /* Pointer to the last node in the list */
211 
212 /* Signature flags */
213 /** \note: additions should be added to the rule analyzer as well */
214 
215 #define SIG_FLAG_SRC_ANY BIT_U32(0) /**< source is any */
216 #define SIG_FLAG_DST_ANY BIT_U32(1) /**< destination is any */
217 #define SIG_FLAG_SP_ANY BIT_U32(2) /**< source port is any */
218 #define SIG_FLAG_DP_ANY BIT_U32(3) /**< destination port is any */
219 
220 #define SIG_FLAG_FIREWALL BIT_U32(4) /**< sig is a firewall rule */
221 
222 #define SIG_FLAG_DSIZE BIT_U32(5) /**< signature has a dsize setting */
223 #define SIG_FLAG_APPLAYER BIT_U32(6) /**< signature applies to app layer instead of packets */
224 #define SIG_FLAG_TXBOTHDIR BIT_U32(7) /**< signature needs tx with both directions to match */
225 
226 #define SIG_FLAG_FW_HOOK_LTE BIT_U32(8) /**< Signature::app_progress_hook is to be used as LTE */
227 
228 #define SIG_FLAG_REQUIRE_PACKET BIT_U32(9) /**< signature is requiring packet match */
229 #define SIG_FLAG_REQUIRE_STREAM BIT_U32(10) /**< signature is requiring stream match */
230 
231 #define SIG_FLAG_MPM_NEG BIT_U32(11)
232 
233 #define SIG_FLAG_FLUSH BIT_U32(12) /**< detection logic needs stream flush notification */
234 
235 #define SIG_FLAG_REQUIRE_STREAM_ONLY \
236  BIT_U32(13) /**< signature is requiring stream match. Stream match is not optional, so no \
237  fallback to packet payload. */
238 
239 // vacancies
240 
241 #define SIG_FLAG_REQUIRE_FLOWVAR BIT_U32(17) /**< signature can only match if a flowbit, flowvar or flowint is available. */
242 
243 #define SIG_FLAG_FILESTORE BIT_U32(18) /**< signature has filestore keyword */
244 
245 #define SIG_FLAG_TOSERVER BIT_U32(19)
246 #define SIG_FLAG_TOCLIENT BIT_U32(20)
247 
248 #define SIG_FLAG_TLSSTORE BIT_U32(21)
249 
250 #define SIG_FLAG_BYPASS BIT_U32(22)
251 
252 #define SIG_FLAG_PREFILTER BIT_U32(23) /**< sig is part of a prefilter engine */
253 
254 // vacancy
255 
256 /** Info for Source and Target identification */
257 #define SIG_FLAG_SRC_IS_TARGET BIT_U32(25)
258 /** Info for Source and Target identification */
259 #define SIG_FLAG_DEST_IS_TARGET BIT_U32(26)
260 
261 #define SIG_FLAG_HAS_TARGET (SIG_FLAG_DEST_IS_TARGET|SIG_FLAG_SRC_IS_TARGET)
262 
263 /* signature init flags */
264 // available 0
265 #define SIG_FLAG_INIT_PACKET BIT_U32(1) /**< signature has matches against a packet (as opposed to app layer) */
266 #define SIG_FLAG_INIT_FLOW BIT_U32(2) /**< signature has a flow setting */
267 #define SIG_FLAG_INIT_BIDIREC BIT_U32(3) /**< signature has bidirectional operator */
268 #define SIG_FLAG_INIT_FIRST_IPPROTO_SEEN \
269  BIT_U32(4) /** < signature has seen the first ip_proto keyword */
270 #define SIG_FLAG_INIT_FRAME BIT_U32(5) /**< signature uses frames */
271 #define SIG_FLAG_INIT_STATE_MATCH BIT_U32(6) /**< signature has matches that require stateful inspection */
272 #define SIG_FLAG_INIT_NEED_FLUSH BIT_U32(7)
273 #define SIG_FLAG_INIT_PRIO_EXPLICIT \
274  BIT_U32(8) /**< priority is explicitly set by the priority keyword */
275 #define SIG_FLAG_INIT_FILEDATA BIT_U32(9) /**< signature has filedata keyword */
276 #define SIG_FLAG_INIT_FORCE_TOCLIENT BIT_U32(10) /**< signature now takes keywords toclient */
277 #define SIG_FLAG_INIT_FORCE_TOSERVER BIT_U32(11) /**< signature now takes keywords toserver */
278 // Two following flags are meant to be mutually exclusive
279 #define SIG_FLAG_INIT_TXDIR_STREAMING_TOSERVER \
280  BIT_U32(12) /**< transactional signature uses a streaming buffer to server */
281 #define SIG_FLAG_INIT_TXDIR_FAST_TOCLIENT \
282  BIT_U32(13) /**< transactional signature uses a fast pattern to client */
283 
284 /* signature mask flags */
285 /** \note: additions should be added to the rule analyzer as well */
286 #define SIG_MASK_REQUIRE_PAYLOAD BIT_U8(0)
287 #define SIG_MASK_REQUIRE_FLOW BIT_U8(1)
288 #define SIG_MASK_REQUIRE_FLAGS_INITDEINIT BIT_U8(2) /* SYN, FIN, RST */
289 #define SIG_MASK_REQUIRE_FLAGS_UNUSUAL BIT_U8(3) /* URG, ECN, CWR */
290 #define SIG_MASK_REQUIRE_NO_PAYLOAD BIT_U8(4)
291 #define SIG_MASK_REQUIRE_REAL_PKT BIT_U8(5)
292 // vacancy 1x
293 #define SIG_MASK_REQUIRE_ENGINE_EVENT BIT_U8(7)
294 
295 #define FILE_SIG_NEED_FILE 0x01
296 #define FILE_SIG_NEED_FILENAME 0x02
297 #define FILE_SIG_NEED_MAGIC 0x04 /**< need the start of the file */
298 #define FILE_SIG_NEED_FILECONTENT 0x08
299 #define FILE_SIG_NEED_MD5 0x10
300 #define FILE_SIG_NEED_SHA1 0x20
301 #define FILE_SIG_NEED_SHA256 0x40
302 #define FILE_SIG_NEED_SIZE 0x80
303 
304 /* Detection Engine flags */
305 #define DE_QUIET 0x01 /**< DE is quiet (esp for unittests) */
306 
307 typedef struct IPOnlyCIDRItem_ {
308  /* address data for this item */
309  uint8_t family;
310  /* netmask in CIDR values (ex. /16 /18 /24..) */
311  uint8_t netmask;
312  /* If this host or net is negated for the signum */
313  uint8_t negated;
314 
315  uint32_t ip[4];
316  SigIntId signum; /**< our internal id */
317 
318  /* linked list, the header should be the biggest network */
320 
322 
323 /** \brief Used to start a pointer to SigMatch context
324  * Should never be dereferenced without casting to something else.
325  */
326 typedef struct SigMatchCtx_ {
327  int foo;
329 
330 /** \brief a single match condition for a signature */
331 typedef struct SigMatch_ {
332  uint16_t type; /**< match type */
333  uint16_t idx; /**< position in the signature */
334  SigMatchCtx *ctx; /**< plugin specific data */
335  struct SigMatch_ *next;
336  struct SigMatch_ *prev;
338 
339 /** \brief Data needed for Match() */
340 typedef struct SigMatchData_ {
341  uint16_t type; /**< match type */
342  bool is_last; /**< Last element of the list */
343  SigMatchCtx *ctx; /**< plugin specific data */
345 
346 struct DetectEngineThreadCtx_;// DetectEngineThreadCtx;
347 
348 /* inspection buffers are kept per tx (in det_ctx), but some protocols
349  * need a bit more. A single TX might have multiple buffers, e.g. files in
350  * SMTP or DNS queries. Since all prefilters+transforms run before the
351  * individual rules need the same buffers, we need a place to store the
352  * transformed data. This array of arrays is that place. */
353 
356  uint32_t size; /**< size in number of elements */
357  uint32_t max:31; /**< max id in use in this run */
358  uint32_t init:1; /**< first time used this run. Used for clean logic */
360 
361 typedef struct TransformData_ {
363  void *options;
365 
366 typedef struct DetectEngineTransforms {
368  uint8_t cnt;
370 
371 /** callback for getting the buffer we need to prefilter/inspect */
372 typedef InspectionBuffer *(*InspectionBufferGetDataPtr)(
373  struct DetectEngineThreadCtx_ *det_ctx,
374  const DetectEngineTransforms *transforms,
375  Flow *f, const uint8_t flow_flags,
376  void *txv, const int list_id);
377 
379  const void *txv, const uint8_t flow_flags, const uint8_t **buf, uint32_t *buf_len);
380 
382  const void *txv, const uint8_t flow_flags, uint32_t local_id, const uint8_t **buf,
383  uint32_t *buf_len);
385 
386 typedef uint8_t (*InspectEngineFuncPtr)(struct DetectEngineCtx_ *de_ctx,
387  struct DetectEngineThreadCtx_ *det_ctx,
388  const struct DetectEngineAppInspectionEngine_ *engine, const struct Signature_ *s, Flow *f,
389  uint8_t flags, void *alstate, void *txv, uint64_t tx_id);
390 
393  uint8_t dir;
394  uint8_t id; /**< per sig id used in state keeping */
395  bool mpm;
396  bool stream;
397  /** will match on a NULL buffer (so an absent buffer) */
399  uint16_t sm_list;
400  uint16_t sm_list_base; /**< base buffer being transformed */
401  uint8_t progress;
402  uint8_t sub_state; /**< matches tx type */
403 
404  struct {
405  union {
409  };
411  /** pointer to the transforms in the 'DetectBuffer entry for this list */
413  } v2;
414 
416 
419 
420 typedef struct TransformIdData_ {
421  const uint8_t *id_data;
422  uint32_t id_data_len;
424 
425 typedef struct DetectBufferType_ {
426  char name[64];
427  char description[128];
428  int id;
430  bool mpm;
431  bool packet; /**< compat to packet matches */
432  bool frame; /**< is about Frame inspection */
433  /** the buffer's keywords can change as the transaction advances: run
434  * the inspect engine on every tx update instead of only at its progress. */
437  bool multi_instance; /**< buffer supports multiple buffer instances per tx */
438  void (*SetupCallback)(
439  const struct DetectEngineCtx_ *, struct Signature_ *, const struct DetectBufferType_ *);
441  const struct Signature_ *, const char **sigerror, const struct DetectBufferType_ *);
445 
447 
448 /**
449  * \param alert_flags[out] for setting PACKET_ALERT_FLAG_*
450  */
452  struct DetectEngineThreadCtx_ *,
453  const struct DetectEnginePktInspectionEngine *engine,
454  const struct Signature_ *s,
455  Packet *p, uint8_t *alert_flags);
456 
457 /** callback for getting the buffer we need to prefilter/inspect */
458 typedef InspectionBuffer *(*InspectionBufferGetPktDataPtr)(
459  struct DetectEngineThreadCtx_ *det_ctx,
460  const DetectEngineTransforms *transforms,
461  Packet *p, const int list_id);
462 
465  bool mpm;
466  uint16_t sm_list;
467  uint16_t sm_list_base;
468  struct {
471  /** pointer to the transforms in the 'DetectBuffer entry for this list */
473  } v1;
476 
477 struct Frame;
478 struct Frames;
480 
481 /**
482  * \param alert_flags[out] for setting PACKET_ALERT_FLAG_*
483  */
485  const struct DetectEngineFrameInspectionEngine *engine, const struct Signature_ *s,
486  Packet *p, const struct Frames *frames, const struct Frame *frame);
487 
490  uint8_t dir;
491  uint8_t type;
492  bool mpm;
493  uint16_t sm_list;
494  uint16_t sm_list_base;
495  struct {
497  /** pointer to the transforms in the 'DetectBuffer entry for this list */
499  } v1;
503 
504 typedef struct SignatureInitDataBuffer_ {
505  uint32_t id; /**< buffer id */
506  bool sm_init; /**< initialized by sigmatch, which is likely something like `urilen:10; http.uri;
507  content:"abc";`. These need to be in the same list. Unset once `http.uri` is
508  set up. */
509  bool multi_capable; /**< true if we can have multiple instances of this buffer, so e.g. for
510  http.uri. */
511  bool only_tc; /**< true if we can only used toclient. */
512  bool only_ts; /**< true if we can only used toserver. */
513  /* sig match list */
517 
523  SIGNATURE_HOOK_PKT_ALL, /**< match each packet */
524 };
525 
530 };
531 
532 /** detect table identifiers, ordered by how they logically
533  * evaluated. Used in rule ordering to ensure the correct order
534  * of rule actions. */
543 
544 #define DETECT_TABLE_PACKET_PRE_FLOW_FLAG BIT_U8(DETECT_TABLE_PACKET_PRE_FLOW)
545 #define DETECT_TABLE_PACKET_PRE_STREAM_FLAG BIT_U8(DETECT_TABLE_PACKET_PRE_STREAM)
546 #define DETECT_TABLE_PACKET_FILTER_FLAG BIT_U8(DETECT_TABLE_PACKET_FILTER)
547 #define DETECT_TABLE_PACKET_TD_FLAG BIT_U8(DETECT_TABLE_PACKET_TD)
548 #define DETECT_TABLE_APP_FILTER_FLAG BIT_U8(DETECT_TABLE_APP_FILTER)
549 #define DETECT_TABLE_APP_TD_FLAG BIT_U8(DETECT_TABLE_APP_TD)
550 };
551 
552 // dns:request_complete should add DetectBufferTypeGetByName("dns:request_complete");
553 // TODO to json
554 typedef struct SignatureHook_ {
555  enum SignatureHookType type;
556  int sm_list; /**< list id for the hook's generic list. e.g. for dns:request_complete:generic */
557  union {
558  struct {
560  /** sub state for a specific transaction type or 0 if not used */
561  uint8_t sub_state;
562  /** progress value of the app-layer hook specified in the rule. Sets the app_proto
563  * specific progress value. */
564  uint8_t app_progress;
565  } app;
566  struct {
567  enum SignatureHookPkt ph;
568  } pkt;
569  } t;
571 
572 #define SIG_ALPROTO_MAX 4
573 
574 typedef struct SignatureInitData_ {
576 
577  /** Number of sigmatches. Used for assigning SigMatch::idx */
578  uint16_t sm_cnt;
579 
580  /** option was prefixed with '!'. Only set for sigmatches that
581  * have the SIGMATCH_HANDLE_NEGATION flag set. */
582  bool negated;
583 
584  /* track if we saw any negation in the addresses. If so, we
585  * skip it for ip-only */
588  /* see if the address contains range and skip it from iponly engine */
591 
592  /** see if any of the sigmatches supports an enabled prefilter */
594 
595  /* used to hold flags that are used during init */
596  uint32_t init_flags;
597  /* coccinelle: SignatureInitData:init_flags:SIG_FLAG_INIT_ */
598 
599  /* alproto mask if multiple protocols are possible */
601 
602  /* used at init to determine max dsize */
604 
605  /** netblocks and hosts specified at the sid, in CIDR format */
607 
608  /* list id for `mpm_sm`. Should always match `SigMatchListSMBelongsTo(s, mpm_sm)`. */
610  /* the fast pattern added from this signature */
612  /* used to speed up init of prefilter */
614 
615  /* SigMatch list used for adding content and friends. E.g. file_data; */
616  int list;
617  bool list_set;
618 
619  /* Total number of times flowbits keyword is referenced in this signature (flowbits:noalert; not
620  * included) */
621  uint16_t total_flowbits;
622 
624 
625  /** rule protocol settings */
627 
628  /** score to influence rule grouping. A higher value leads to a higher
629  * likelihood of a rulegroup with this sig ending up as a contained
630  * group. */
631  int score;
632 
633  /** address settings for this signature */
635 
636  /* holds built-in sm lists */
638  /* holds built-in sm lists' tails */
640 
641  /* Storage for buffers. */
643  uint32_t buffer_index;
644  uint32_t buffers_size;
646 
647  /* highest list/buffer id which holds a DETECT_CONTENT */
649 
650  /* inter-signature state dependency */
657 
658  /* Signature is a "firewall" rule. */
661 
662 /** \brief Signature container */
663 typedef struct Signature_ {
664  uint32_t flags;
665  /* coccinelle: Signature:flags:SIG_FLAG_ */
666  enum SignatureType type;
667 
669 
670  uint16_t dsize_low;
671  uint16_t dsize_high;
672  uint8_t dsize_mode;
673 
675  SigIntId iid; /**< signature internal id */
676 
677  /** inline -- action */
678  uint8_t action;
679  uint8_t file_flags;
680 
681  /** rule protocol: can be NULL if the check can be skipped */
683 
684  /* scope setting for the action: enum ActionScope */
685  uint8_t action_scope;
686 
687  /** ipv4 match arrays */
692 
693  /** classification id **/
694  uint16_t class_id;
695 
696  /** detect: pseudo table this rule is part of (enum DetectTable) */
697  uint8_t detect_table;
698 
699  /** firewall: progress value for this signature */
701  /** firewall: sub state (transaction type) of the hook on protocols with sub
702  * states (http2 stream/global, DoH2); 0 when the hook has no sub state.
703  * Signatures are zero initialized, so unused stays 0. */
704  uint8_t sub_state;
705 
708  /** ipv6 match arrays */
711 
712  uint32_t id; /**< sid, set by the 'sid' rule keyword */
713  uint32_t gid; /**< generator id */
714  uint32_t rev;
715  int prio;
716 
717  /** port settings for this signature */
719 
720 #ifdef PROFILE_RULES
721  uint16_t profiling_id;
722 #endif
723 
727 
728  /* Matching structures for the built-ins. The others are in
729  * their inspect engines. */
731 
732  /* memory is still owned by the sm_lists/sm_arrays entry */
734 
735  char *msg;
736 
737  /** classification message */
738  char *class_msg;
739  /** Reference */
741  /** Metadata */
743 
744  char *sig_str;
745 
747 
748  /** ptr to the next sig in the list */
749  struct Signature_ *next;
751 
756  /* must be last */
758 };
759 
760 #define DETECT_PROFILE_NAME_LEN 32
761 /** \brief one time registration of keywords at start up */
762 typedef struct DetectBufferMpmRegistry_ {
763  const char *name;
764  char pname[DETECT_PROFILE_NAME_LEN]; /**< name used in profiling */
765  int direction; /**< SIG_FLAG_TOSERVER or SIG_FLAG_TOCLIENT */
766  int16_t sm_list;
767  int16_t sm_list_base;
768  int priority;
769  int id; /**< index into this array and result arrays */
772 
774  MpmCtx *mpm_ctx, const struct DetectBufferMpmRegistry_ *mpm_reg, int list_id);
776 
777  union {
778  /* app-layer matching: use if type == DETECT_BUFFER_MPM_TYPE_APP */
779  struct {
780  union {
784  };
787  uint8_t sub_state;
789 
790  /* pkt matching: use if type == DETECT_BUFFER_MPM_TYPE_PKT */
791  struct {
793  struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx,
794  const struct DetectBufferMpmRegistry_ *mpm_reg, int list_id);
797 
798  /* frame matching: use if type == DETECT_BUFFER_MPM_TYPE_FRAME */
799  struct {
801  uint8_t type;
803  };
804 
807 
808 /* helper structure to track pattern stats and assign pattern id's. */
809 typedef struct DetectPatternTracker {
810  const struct DetectContentData_ *cd;
811  int sm_list;
812  uint32_t cnt;
813  uint32_t mpm;
815 
816 typedef struct DetectReplaceList_ {
817  const struct DetectContentData_ *cd;
818  uint8_t *found;
821 
822 /** only execute flowvar storage if rule matched */
823 #define DETECT_VAR_TYPE_FLOW_POSTMATCH 1
824 #define DETECT_VAR_TYPE_PKT_POSTMATCH 2
825 
826 /** list for flowvar store candidates, to be stored from
827  * post-match function */
828 typedef struct DetectVarList_ {
829  uint16_t type; /**< type of store candidate POSTMATCH or ALWAYS */
830  uint8_t pad[2];
831  uint32_t idx; /**< flowvar name idx */
832  uint16_t len; /**< data len */
833  uint16_t key_len;
834  uint8_t *key;
835  uint8_t *buffer; /**< alloc'd buffer, may be freed by
836  post-match, post-non-match */
839 
840 typedef struct SCFPSupportSMList_ {
841  int list_id;
842  int priority;
845 
846 /** \brief IP only rules matching ctx. */
847 typedef struct DetectEngineIPOnlyCtx_ {
848  /* Lookup trees */
851 
852  /* Used to build the radix trees */
854  uint32_t max_idx;
855 
856  /* Used to map large signums to smaller values to compact the bitsets
857  * stored in the radix trees */
858  uint32_t *sig_mapping;
861 
862 typedef struct DetectEngineLookupFlow_ {
865  struct SigGroupHead_ *sgh[256];
867 
868 typedef struct SigString_ {
869  char *filename;
870  char *sig_str;
871  char *sig_error;
872  int line;
875 
876 /** \brief Signature loader statistics */
877 typedef struct SigFileLoaderStat_ {
878  TAILQ_HEAD(, SigString_) failed_sigs;
885 
887  void *(*InitFunc)(void *);
888  void (*FreeFunc)(void *);
889  void *data;
891  int id;
892  const char *name; /* keyword name, for error printing */
894 
896 {
897  DETECT_PREFILTER_MPM = 0, /**< use only mpm / fast_pattern */
898  DETECT_PREFILTER_AUTO = 1, /**< use mpm + keyword prefilters */
899 };
900 
902 {
904  DETECT_ENGINE_TYPE_DD_STUB = 1, /* delayed detect stub: can be reloaded */
905  DETECT_ENGINE_TYPE_MT_STUB = 2, /* multi-tenant stub: cannot be reloaded */
907 };
908 
913 #define DETECT_FIREWALL_POLICY_SIZE DETECT_FIREWALL_POLICY_PRE_STREAM + 1
914 };
915 
916 /** Single Firewall Policy */
918  uint8_t action; /**< same as Signature::action. Action flags to apply on policy match. */
919  uint8_t action_scope; /**< same as Signature::action_scope. Scope argument for the action. */
920 };
921 
924  uint8_t sub_state;
925  uint8_t progress;
926  uint8_t direction;
928  /* signature that will be logged if the policy includes "alert". Will
929  * be set to NULL if alert is not part of the policy. */
931 };
932 
934  /** policy for packet_filter, pre_flow, pre_stream hooks */
937 
938  /* hash table with policies, hashed by alproto, sub_state, progress and direction */
940 };
941 
942 /* Flow states:
943  * toserver
944  * toclient
945  */
946 #define FLOW_STATES 2
947 
948 typedef struct {
949  uint32_t content_limit;
952 
954 
955 /**
956  * \brief Function type for rate filter callback.
957  *
958  * This function should return the new action to be applied. If no change to the
959  * action is to be made, the callback should return the current action provided
960  * in the new_action parameter.
961  */
962 typedef uint8_t (*SCDetectRateFilterFunc)(const Packet *p, uint32_t sid, uint32_t gid, uint32_t rev,
963  uint8_t original_action, uint8_t new_action, void *arg);
964 
965 /** \brief main detection engine ctx */
966 typedef struct DetectEngineCtx_ {
968  uint8_t flags; /**< only DE_QUIET */
969  uint8_t mpm_matcher; /**< mpm matcher this ctx uses */
970  uint8_t max_flowbits; /**< maximum number of flowbits per signature */
971  uint32_t tenant_id;
972 
974  uint8_t spm_matcher; /**< spm matcher this ctx uses */
975 
977  uint32_t sig_cnt;
978 
979  /* version of the srep data */
980  uint32_t srep_version;
981 
982  /* reputation for netblocks */
984 
986  uint32_t sig_array_len; /* size in array members */
987 
988  uint32_t signum;
989 
990  /* used by the signature ordering module */
992 
993  /* main sigs */
995 
996  /** firewall policy table entry point */
998 
999  /* init phase vars */
1001 
1004 
1005  /* hash table used to cull out duplicate sigs */
1007 
1009 
1010  /* maximum recursion depth for content inspection */
1012 
1013  /* maximum number of times a tx will get logged for rules not using app-layer keywords */
1015 
1016  /* force app-layer tx finding for alerts with signatures not having app-layer keywords */
1018 
1019  /* registration id for per thread ctx for the filemagic/file.magic keywords */
1021 
1022  /* spm thread context prototype, built as spm matchers are constructed and
1023  * later used to construct thread context for each thread. */
1025 
1026  /* Config options */
1027 
1030 
1031  /* max flowbit id that is used */
1032  uint32_t max_fb_id;
1033 
1035 
1036  /* array containing all sgh's in use so we can loop
1037  * through it in Stage4. */
1039  uint32_t sgh_array_cnt;
1040  uint32_t sgh_array_size;
1041 
1046 
1047  /* the max local id used amongst all sigs */
1049 
1050  /** version of the detect engine. The version is incremented on reloads */
1051  uint32_t version;
1052 
1053  /** sgh for signatures that match against invalid packets. In those cases
1054  * we can't lookup by proto, address, port as we don't have these */
1056 
1057  /** sgh for `alert ether` / `alert arp` etc. */
1059 
1060  /* Maximum size of the buffer for decoded base64 data. */
1062 
1063  /** Store rule file and line so that parsers can use them in errors. */
1065  const char *rule_file;
1066  const char *sigerror;
1069 
1070  /** The rule errored out due to missing requirements. */
1072 
1073  /* specify the configuration for mpm context factory */
1075 
1077  /** hash list of keywords that need thread local ctxs */
1079 
1081 
1082 #ifdef PROFILE_RULES
1083  struct SCProfileDetectCtx_ *profile_ctx;
1084 #endif
1085 #ifdef PROFILING
1091 #endif
1092  char config_prefix[64];
1093 
1094  enum DetectEngineType type;
1095 
1096  /** how many de_ctx' are referencing this */
1097  uint32_t ref_cnt;
1098  /** list in master: either active or freelist */
1100 
1101  /** id of loader thread 'owning' this de_ctx */
1103 
1104  /** are we using just mpm or also other prefilters */
1106 
1108 
1111 
1112  /** table for storing the string representation with the parsers result */
1114 
1115  /** table to store metadata keys and values */
1117 
1118  /* hash tables with rule-time buffer registration. Start time registration
1119  * is in detect-engine.c::g_buffer_type_hash */
1122  uint32_t buffer_type_id;
1123 
1126  /* list with app inspect engines. Both the start-time registered ones and
1127  * the rule-time registered ones. */
1135 
1136  uint32_t prefilter_id;
1138 
1139  /** time of last ruleset reload */
1140  struct timeval last_reload;
1141 
1142  /** signatures stats */
1144 
1145  /* list of Fast Pattern registrations. Initially filled using a copy of
1146  * `g_fp_support_smlist_list`, then extended at rule loading time if needed */
1148 
1149  /** per keyword flag indicating if a prefilter has been
1150  * set for it. If true, the setup function will have to
1151  * run. */
1154 
1155  /* classification config parsing */
1156 
1157  /* hash table used for holding the classification config info */
1159  pcre2_code *class_conf_regex;
1160  pcre2_match_data *class_conf_regex_match;
1161 
1162  /* reference config parsing */
1163 
1164  /* hash table used for holding the reference config info */
1167  pcre2_match_data *reference_conf_regex_match;
1168 
1169  /* --engine-analysis */
1171 
1172  /* path to the tenant yaml for this engine */
1174 
1175  /* Track rule requirements for reporting after loading rules. */
1177 
1178  /* number of signatures using filestore, limited as u16 */
1179  uint16_t filestore_cnt;
1180 
1181  /* name store for non-prefilter engines. Used in profiling but
1182  * part of the API, so hash is always used. */
1184 
1186 
1187  /* user provided rate filter callbacks. */
1189 
1190  /* use provided data to be passed to rate_filter_callback. */
1192 
1193  /* Hook for pre_stream engine if it is used. */
1195  /** TCP pre_stream hook rule groups. One per direction. */
1197 
1198  /* Hook for pre_flow engine if it is used. */
1200  /** pre_flow hook rule groups. Before flow we don't know a direction yet. */
1203 
1204 /**
1205  * \brief Register a callback when a rate_filter has been applied to
1206  * an alert.
1207  *
1208  * This callback is added to the current detection engine and will be
1209  * copied to all future detection engines over rule reloads.
1210  */
1212 
1213 /* Engine groups profiles (low, medium, high, custom) */
1214 enum {
1220 };
1221 
1222 /* Siggroup mpm context profile */
1223 enum {
1227 #define ENGINE_SGH_MPM_FACTORY_CONTEXT_START_ID_RANGE (ENGINE_SGH_MPM_FACTORY_CONTEXT_AUTO + 1)
1228 };
1229 
1230 #define DETECT_FILESTORE_MAX 15
1237 
1238 /** array of TX inspect rule candidates */
1239 typedef struct RuleMatchCandidateTx {
1240  SigIntId id; /**< internal signature id */
1241  bool fw_lte_counted; /**< counted in the firewall LTE hook coverage */
1242  bool fw_lte_header_ok; /**< firewall LTE coverage already passed the rule header check */
1243  uint32_t *flags; /**< inspect flags ptr */
1244  union {
1245  struct {
1247  uint8_t stream_result;
1248  };
1249  uint32_t stream_reset;
1250  };
1251 
1252  const Signature *s; /**< ptr to sig */
1254 
1255 /** Stores a single u32 for a rule match of the type `sm_type`. Used by
1256  * flowbits prefilter to register DETECT_FLOWBITS,<flowbit id> for post
1257  * match handling. */
1259  int sm_type; /**< sigmatch type e.g. DETECT_FLOWBITS */
1260  uint32_t value; /**< value to be interpreted by the sm_type
1261  * implementation. E.g. flowbit id. */
1262 #ifdef DEBUG
1263  SigIntId id;
1264 #endif
1266 
1267 /** Array of PostRuleMatchWorkQueueItem's. */
1268 typedef struct PostRuleMatchWorkQueue {
1269  PostRuleMatchWorkQueueItem *q; /**< array pointer */
1270  uint32_t len; /**< number of array elements in use. */
1271  uint32_t size; /**< allocation size in number of elements. */
1273 
1274 #define SIG_JSON_CONTENT_ARRAY_LEN 16
1275 #define SIG_JSON_CONTENT_ITEM_LEN 1024
1276 #define SIG_JSON_CONTENT_KEY_LEN 32
1278 /** structure to store the json content with info on sig that triggered it */
1279 typedef struct SigJsonContent {
1280  void *id; /**< pointer to the sig that triggered this json content */
1283 
1284 /* byte_extract/byte_math slot: the value, the "written this detect
1285  * run" marker and the writing signature */
1286 typedef struct ByteVarSlot_ {
1287  uint64_t value;
1288  uint8_t set;
1291 
1292 /**
1293  * Detection engine thread data.
1294  */
1295 typedef struct DetectEngineThreadCtx_ {
1296  /** \note multi-tenant hash lookup code from Detect() *depends*
1297  * on this being the first member */
1298  uint32_t tenant_id;
1299 
1300  SC_ATOMIC_DECLARE(int, so_far_used_by_detect);
1301 
1302  /* the thread to which this detection engine thread belongs */
1304 
1308 
1311 
1312  uint32_t (*TenantGetId)(const void *, const Packet *p);
1313 
1314  /* detection engine variables */
1315 
1317 
1318  /** offset into the payload of the end of the last match by: content, pcre, etc */
1319  uint32_t buffer_offset;
1320 
1321  /** used by pcre match function alone: normally in sync with buffer_offset, but
1322  * points to 1 byte after the start of the last pcre match if a pcre match happened. */
1324 
1325  /** SPM thread context used for scanning. This has been cloned from the
1326  * prototype held by DetectEngineCtx. */
1328 
1329  /* byte_extract/byte_math slots: value + "written this detect run"
1330  * marker + writing signature, cleared per run for the slots the run
1331  * wrote; an unwritten slot reads as unset (nil) to scripts */
1333 
1337  /* true if tx_id is set */
1339 
1340  /* counter for the filestore array below -- up here for cache reasons. */
1341  uint16_t filestore_cnt;
1342 
1343  /** id for alert counter */
1345  /** id for discarded alerts counter */
1347  /** id for firewall discarded alerts counter */
1349  /** id for suppressed alerts counter */
1351 #ifdef PROFILING
1354 #endif
1355 #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
1356  uint64_t fuzzed_pcre_len;
1357 #endif
1358 
1359  struct {
1361  uint32_t buffers_size; /**< in number of elements */
1362  uint32_t to_clear_idx;
1363  uint32_t *to_clear_queue;
1365 
1366  struct {
1367  /** inspection buffers for more complex case. As we can inspect multiple
1368  * buffers in parallel, we need this extra wrapper struct */
1370  uint32_t buffers_size; /**< in number of elements */
1371  uint32_t to_clear_idx;
1372  uint32_t *to_clear_queue;
1374 
1375  /** ID of the transaction currently being inspected. */
1376  uint64_t tx_id;
1377  /** Transaction data of the transaction currently being inspected, as the
1378  * app-layer parser knows it (the flow's own transaction, not an inner one
1379  * handed to a keyword). Valid while tx_id_set is true. */
1381  int64_t frame_id;
1382  uint64_t frame_inspect_progress; /**< used to set Frame::inspect_progress after all inspection
1383  on a frame is complete. */
1385 
1386  uint8_t *base64_decoded;
1388 
1392 
1393  /** array of signature pointers we're going to inspect in the detection
1394  * loop. */
1396  /** temporary array of signature pointers we're going to inspect in the
1397  * detection loop. */
1399  /** size of the array in items (mem size if * sizeof(Signature *)
1400  * Only used during initialization. */
1402  /** size in use */
1404 
1407  /* highest slot index written this run, -1 if none; the per-run
1408  * clear only walks up to it */
1410 
1411  /** Per hook LTE coverage of the current tx walk. Kept here instead of in
1412  * the per-tx firewall state so IDS traffic does not pay to clear it.
1413  * Cleared by the firewall coverage build on first use in a walk. */
1415 
1416  MpmThreadCtx mtc; /**< thread ctx for the mpm */
1417  /* work queue for post-rule matching affecting prefilter */
1419 
1421 
1422  /* string to replace */
1424  /* vars to store in post match function */
1426 
1427  /* Array in which the filestore keyword stores file id and tx id. If the
1428  * full signature matches, these are processed by a post-match filestore
1429  * function to finalize the store. */
1430  struct {
1431  uint32_t file_id;
1432  uint64_t tx_id;
1434 
1436  /** store for keyword contexts that need a per thread storage. Per de_ctx. */
1439  /** store for keyword contexts that need a per thread storage. Global. */
1442 
1444  uint16_t events;
1445 
1446  /** stats id for lua rule errors */
1448 
1449  /** stats id for lua blocked function counts */
1451 
1452  /** stats if for lua instruction limit errors */
1454 
1455  /** stat of lua memory limit errors. */
1457 
1458  /** stats id for luaxform (transform) errors */
1460 
1461  /** stats id for luaxform blocked function counts */
1463 
1464  /** stats id for luaxform instruction limit errors */
1466 
1467  /** stats id for luaxform memory limit errors */
1469 
1470 #ifdef DEBUG
1471  uint64_t pkt_stream_add_cnt;
1472  uint64_t payload_mpm_cnt;
1473  uint64_t payload_mpm_size;
1474  uint64_t stream_mpm_cnt;
1475  uint64_t stream_mpm_size;
1476  uint64_t payload_persig_cnt;
1477  uint64_t payload_persig_size;
1478  uint64_t stream_persig_cnt;
1479  uint64_t stream_persig_size;
1480 #endif
1481 #ifdef PROFILE_RULES
1482  struct SCProfileData_ *rule_perf_data;
1483  int rule_perf_data_size;
1484  uint32_t rule_perf_last_sync;
1485 #endif
1486 #ifdef PROFILING
1489  int keyword_perf_list; /**< list we're currently inspecting, DETECT_SM_LIST_* */
1491 
1493  /** bytes inspected by current prefilter callback call */
1495  /** number of times we inspected a buffer */
1497 #endif
1499 
1500 // forward declaration
1501 typedef struct SCJsonBuilder SCJsonBuilder;
1502 
1503 /** \brief element in sigmatch type table.
1504  */
1505 typedef struct SigTableElmt_ {
1506  /** Packet match function pointer */
1507  int (*Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *);
1508 
1509  /** AppLayer TX match function pointer */
1511  uint8_t flags, void *alstate, void *txv,
1512  const Signature *, const SigMatchCtx *);
1513 
1514  /** File match function pointer */
1516  Flow *, /**< *LOCKED* flow */
1517  uint8_t flags, File *, const Signature *, const SigMatchCtx *);
1518 
1519  /** InspectionBuffer transformation callback */
1520  void (*Transform)(DetectEngineThreadCtx *, InspectionBuffer *, const void *context);
1521  bool (*TransformValidate)(const uint8_t *content, uint16_t content_len, const void *context);
1522 
1523  /** Transform identity callback */
1524  void (*TransformId)(const uint8_t **data, uint32_t *length, const void *context);
1525 
1526  /** keyword setup function pointer */
1527  int (*Setup)(DetectEngineCtx *, Signature *, const char *);
1528 
1529  bool (*SupportsPrefilter)(const Signature *s);
1531 
1532  void (*Free)(DetectEngineCtx *, void *);
1533 #ifdef UNITTESTS
1534  void (*RegisterTests)(void);
1535 #endif
1536  uint32_t flags;
1537  /* coccinelle: SigTableElmt:flags:SIGMATCH_ */
1538 
1539  /** bitfield of tables supported by this rule: used by DETECT_TABLE_*_FLAG flags. */
1540  uint8_t tables;
1541 
1542  /** better keyword to replace the current one */
1543  uint16_t alternative;
1544 
1545  const char *name; /**< keyword name alias */
1546  const char *alias; /**< name alias */
1547  const char *desc;
1548  const char *url;
1549 
1550  // Cleanup function for freeing rust allocated name or such
1551  void (*Cleanup)(struct SigTableElmt_ *);
1552 
1553  // Cleanup function for freeing rust allocated name or such
1556 
1557 /* event code */
1558 enum {
1572 
1575 };
1576 
1577 #define SIG_GROUP_HEAD_HAVERAWSTREAM BIT_U16(0)
1578 #ifdef HAVE_MAGIC
1579 #define SIG_GROUP_HEAD_HAVEFILEMAGIC BIT_U16(1)
1580 #endif
1581 #define SIG_GROUP_HEAD_HAVEFILEMD5 BIT_U16(2)
1582 // vacancy
1583 #define SIG_GROUP_HEAD_HAVEFILESHA1 BIT_U16(4)
1584 #define SIG_GROUP_HEAD_HAVEFILESHA256 BIT_U16(5)
1595 };
1596 
1597 typedef struct MpmStore_ {
1598  uint8_t *sid_array;
1599  uint32_t sid_array_size;
1600 
1603  int sm_list;
1607 
1609 
1610 typedef void (*PrefilterPktFn)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx);
1611 typedef void (*PrefilterFrameFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p,
1612  const struct Frames *frames, const struct Frame *frame);
1613 
1614 typedef struct AppLayerTxData AppLayerTxData;
1615 typedef void (*PrefilterTxFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f,
1616  void *tx, const uint64_t tx_id, const AppLayerTxData *tx_data, const uint8_t flags);
1617 
1618 typedef struct PrefilterEngineList_ {
1619  uint16_t id;
1620 
1621  /** App Proto this engine applies to: only used with Tx Engines */
1623  /** Minimal Tx progress we need before running the engine. Only used
1624  * with Tx Engine. Set to -1 for all states. */
1626 
1627  uint8_t frame_type;
1628 
1629  SignatureMask pkt_mask; /**< mask for pkt engines */
1630 
1631  uint8_t sub_state;
1632 
1634 
1635  /** Context for matching. Might be MpmCtx for MPM engines, other ctx'
1636  * for other engines. */
1637  void *pectx;
1638 
1643  DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f);
1644 
1646 
1647  /** Free function for pectx data. If NULL the memory is not freed. */
1648  void (*Free)(void *pectx);
1649 
1650  /** Run this tx engine on every tx update, regardless of tx progress.
1651  * Only used with Tx Engines. The engine keeps its real tx_min_progress,
1652  * so it still takes part in the progress bookkeeping. */
1654 
1655  const char *name;
1656  /* global id for this prefilter */
1657  uint32_t gid;
1659 
1660 typedef struct PrefilterEngine_ {
1661  uint16_t local_id;
1662 
1663  /** App Proto this engine applies to: only used with Tx Engines */
1665 
1666  union {
1667  struct {
1668  SignatureMask mask; /**< mask for pkt engines */
1669  uint8_t hook; /**< enum SignatureHookPkt */
1670  } pkt;
1671  struct {
1672  /** Minimal Tx progress we need before running the engine. Only used
1673  * with Tx Engine. Set to -1 for all states. */
1675  uint8_t sub_state;
1676  } app;
1677  uint8_t frame_type;
1678  } ctx;
1679 
1680  bool is_last;
1682 
1683  /** Tx engine must run on every tx update even once the tx progressed past
1684  * its tx_min_progress. Kept separate from tx_min_progress (-1 is the
1685  * proto-agnostic packet-style sentinel). */
1687 
1688  /** Context for matching. Might be MpmCtx for MPM engines, other ctx'
1689  * for other engines. */
1690  void *pectx;
1691 
1692  union {
1697  DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f);
1698  } cb;
1699 
1700  /* global id for this prefilter */
1701  uint32_t gid;
1703 
1704 typedef struct SigGroupHeadInitData_ {
1706 
1707  uint8_t *sig_array; /**< bit array of sig nums (internal id's) */
1708  uint32_t sig_size; /**< size in bytes */
1709 
1710  uint8_t protos[256]; /**< proto(s) this sgh is for */
1711  uint32_t direction; /**< set to SIG_FLAG_TOSERVER, SIG_FLAG_TOCLIENT or both */
1712  int score; /**< try to make this group a unique one */
1713  uint32_t max_sig_id; /**< max signature idx for this sgh */
1714 
1718 
1724 
1725  /** number of sigs in this group */
1727 
1728  /** Array with sig ptrs... size is sig_cnt * sizeof(Signature *) */
1731 
1732 /** \brief Container for matching data for a signature group */
1733 typedef struct SigGroupHead_ {
1734  uint16_t flags;
1735  /* coccinelle: SigGroupHead:flags:SIG_GROUP_HEAD_ */
1736 
1737  /** the number of signatures in this sgh that have the filestore keyword
1738  * set. */
1739  uint16_t filestore_cnt;
1740 
1741  uint32_t id; /**< unique id used to index sgh_array for stats */
1742 
1747  PrefilterEngine *post_rule_match_engines; /**< engines to run after rules modified a state */
1748 
1749  /* ptr to our init data we only use at... init :) */
1751 
1753 
1755  TENANT_SELECTOR_UNKNOWN = 0, /**< not set */
1756  TENANT_SELECTOR_DIRECT, /**< method provides direct tenant id */
1757  TENANT_SELECTOR_VLAN, /**< map vlan to tenant id */
1758  TENANT_SELECTOR_LIVEDEV, /**< map livedev to tenant id */
1759  TENANT_SELECTOR_TUNNEL, /**< map tunnel id to tenant id */
1760 };
1761 
1763  uint32_t tenant_id;
1764 
1765  /* traffic id that maps to the tenant id */
1766  uint32_t traffic_id;
1767 
1770 
1771 typedef struct DetectEngineMasterCtx_ {
1773 
1774  /** enable multi tenant mode */
1776 
1777  /** version, incremented after each 'apply to threads' */
1778  uint32_t version;
1779 
1780  /** list of active detection engines. This list is used to generate the
1781  * threads det_ctx's */
1783 
1784  /** free list, containing detection engines that will be removed but may
1785  * still be referenced by det_ctx's. Freed as soon as all references are
1786  * gone. */
1788 
1790 
1791  /** list of tenant mappings. Updated under lock. Used to generate lookup
1792  * structures. */
1794 
1795  /** list of keywords that need thread local ctxs,
1796  * only updated by keyword registration at start up. Not
1797  * covered by the lock. */
1801 
1802 /* Table with all SigMatch registrations */
1804 
1805 /** Remember to add the options in SignatureIsIPOnly() at detect.c otherwise it wont be part of a signature group */
1806 
1807 #define DETECT_ENGINE_MPM_CACHE_OP_PRUNE BIT_U32(0)
1808 #define DETECT_ENGINE_MPM_CACHE_OP_SAVE BIT_U32(1)
1810 /* detection api */
1811 TmEcode Detect(ThreadVars *tv, Packet *p, void *data);
1814 
1815 SigMatch *SigMatchAlloc(void);
1816 Signature *SigFindSignatureBySidGid(DetectEngineCtx *, uint32_t, uint32_t);
1818 
1819 void SigRegisterTests(void);
1820 
1822 char *DetectLoadCompleteSigPath(const DetectEngineCtx *, const char *sig_file);
1823 int SigLoadSignatures(DetectEngineCtx *, char *, bool);
1825  DetectEngineThreadCtx *det_ctx, Packet *p);
1826 
1829 
1830 int DetectUnregisterThreadCtxFuncs(DetectEngineCtx *, void *data, const char *name);
1831 int DetectRegisterThreadCtxFuncs(DetectEngineCtx *, const char *name, void *(*InitFunc)(void *), void *data, void (*FreeFunc)(void *), int);
1833 void *DetectGetInnerTx(void *tx_ptr, AppProto alproto, AppProto engine_alproto, uint8_t flow_flags);
1834 
1835 void RuleMatchCandidateTxArrayInit(DetectEngineThreadCtx *det_ctx, uint32_t size);
1837 
1839 
1842 
1843 /* events */
1844 void DetectEngineSetEvent(DetectEngineThreadCtx *det_ctx, uint8_t e);
1845 
1847 
1848 #endif /* SURICATA_DETECT_H */
SCJsonBuilder
struct SCJsonBuilder SCJsonBuilder
Definition: detect-engine-helper.h:87
DetectEngineCtx_::sgh_hash_table
HashListTable * sgh_hash_table
Definition: detect.h:1000
DetectEngineCtx_::pkt_mpms_list_cnt
uint32_t pkt_mpms_list_cnt
Definition: detect.h:1131
DETECT_TABLE_APP_TD
@ DETECT_TABLE_APP_TD
Definition: detect.h:542
DetectEngineAppInspectionEngine_::stream
bool stream
Definition: detect.h:396
DetectEngineCtx_::frame_mpms_list_cnt
uint32_t frame_mpms_list_cnt
Definition: detect.h:1134
SCFPSupportSMList
struct SCFPSupportSMList_ SCFPSupportSMList
SigFileLoaderStat_::bad_files
int bad_files
Definition: detect.h:879
SIG_TYPE_STREAM
@ SIG_TYPE_STREAM
Definition: detect.h:75
DetectEngineTenantMapping_
Definition: detect.h:1762
InspectionSingleBufferGetDataPtr
bool(* InspectionSingleBufferGetDataPtr)(const void *txv, const uint8_t flow_flags, const uint8_t **buf, uint32_t *buf_len)
Definition: detect.h:378
SignatureInitData_::max_content_list_id
uint32_t max_content_list_id
Definition: detect.h:648
DetectAddress_::ip
Address ip
Definition: detect.h:143
SigMatchSignaturesGetSgh
const SigGroupHead * SigMatchSignaturesGetSgh(const DetectEngineCtx *de_ctx, const Packet *p)
Get the SigGroupHead for a packet.
Definition: detect.c:293
DetectFirewallPolicies
Definition: detect.h:933
SignatureInitData_::total_flowbits
uint16_t total_flowbits
Definition: detect.h:621
PrefilterEngine_::mask
SignatureMask mask
Definition: detect.h:1668
DetectPatternTracker
Definition: detect.h:809
SignatureInitData_::rule_state_dependant_sids_idx
uint32_t rule_state_dependant_sids_idx
Definition: detect.h:654
PrefilterEngineList_::frame_type
uint8_t frame_type
Definition: detect.h:1627
SCFPSupportSMList_
Definition: detect.h:840
DetectEngineThreadCtx_::keyword_perf_data_per_list
struct SCProfileKeywordData_ ** keyword_perf_data_per_list
Definition: detect.h:1488
SigGroupHead_::tx_engines
PrefilterEngine * tx_engines
Definition: detect.h:1745
SigMatchAlloc
SigMatch * SigMatchAlloc(void)
Definition: detect-parse.c:311
DetectEngineAppInspectionEngine_
Definition: detect.h:391
SigTableElmt_::url
const char * url
Definition: detect.h:1548
DetectEngineThreadCtx_::inspect
struct DetectEngineThreadCtx_::@101 inspect
DetectBufferType_::supports_transforms
bool supports_transforms
Definition: detect.h:436
SigLoadSignatures
int SigLoadSignatures(DetectEngineCtx *, char *, bool)
Load signatures.
Definition: detect-engine-loader.c:384
MPMB_UDP_TS
@ MPMB_UDP_TS
Definition: detect.h:1591
SignatureInitDataBuffer_::head
SigMatch * head
Definition: detect.h:514
SigMatch_::prev
struct SigMatch_ * prev
Definition: detect.h:336
DetectEngineAppInspectionEngine_::mpm
bool mpm
Definition: detect.h:395
SCProfileKeywordData_
Definition: util-profiling-keywords.c:40
TransformIdData_
Definition: detect.h:420
DetectBufferType_::mpm
bool mpm
Definition: detect.h:430
PrefilterEngineList_::Prefilter
PrefilterPktFn Prefilter
Definition: detect.h:1639
SignatureInitDataBuffer_::sm_init
bool sm_init
Definition: detect.h:506
RuleMatchCandidateTx::stream_stored
bool stream_stored
Definition: detect.h:1246
DetectReplaceList_::cd
const struct DetectContentData_ * cd
Definition: detect.h:817
DetectEngineThreadCtx_::alert_queue_size
uint16_t alert_queue_size
Definition: detect.h:1389
DetectEngineThreadCtx_::buffer_offset
uint32_t buffer_offset
Definition: detect.h:1319
DetectEngineAppInspectionEngine_::v2
struct DetectEngineAppInspectionEngine_::@82 v2
DETECT_PROFILE_NAME_LEN
#define DETECT_PROFILE_NAME_LEN
Definition: detect.h:760
DetectBufferMpmRegistry_::direction
int direction
Definition: detect.h:765
DetectEngineThreadCtx_::to_clear_idx
uint32_t to_clear_idx
Definition: detect.h:1362
SignatureInitDataBuffer
struct SignatureInitDataBuffer_ SignatureInitDataBuffer
ENGINE_SGH_MPM_FACTORY_CONTEXT_AUTO
@ ENGINE_SGH_MPM_FACTORY_CONTEXT_AUTO
Definition: detect.h:1226
PrefilterEngineList_::sub_state
uint8_t sub_state
Definition: detect.h:1631
SigMatchFree
void SigMatchFree(DetectEngineCtx *, SigMatch *sm)
free a SigMatch
Definition: detect-parse.c:325
DetectEngineCtx_::class_conf_ht
HashTable * class_conf_ht
Definition: detect.h:1158
SignatureHook_::app_progress
uint8_t app_progress
Definition: detect.h:564
SignatureInitData_::smlists
struct SigMatch_ * smlists[DETECT_SM_LIST_MAX]
Definition: detect.h:637
detect-engine-proto.h
DetectEngineThreadCtx_::keyword_perf_data
struct SCProfileKeywordData_ * keyword_perf_data
Definition: detect.h:1487
DetectEngineThreadCtx_::match_array_cnt
SigIntId match_array_cnt
Definition: detect.h:1403
DetectVarList_::idx
uint32_t idx
Definition: detect.h:831
MpmStore_::sid_array_size
uint32_t sid_array_size
Definition: detect.h:1599
PrefilterEngine_::PrefilterPostRule
void(* PrefilterPostRule)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f)
Definition: detect.h:1696
DetectEngineThreadCtx_::counter_alerts
StatsCounterId counter_alerts
Definition: detect.h:1344
SignatureHook_
Definition: detect.h:554
SigTableElmt_::desc
const char * desc
Definition: detect.h:1547
SignatureInitData_::list_set
bool list_set
Definition: detect.h:617
Signature_::addr_src_match6
DetectMatchAddressIPv6 * addr_src_match6
Definition: detect.h:710
DetectEngineThreadCtx_::byte_values
ByteVarSlot * byte_values
Definition: detect.h:1332
ADDRESS_EB
@ ADDRESS_EB
Definition: detect.h:129
ADDRESS_LE
@ ADDRESS_LE
Definition: detect.h:126
DetectEngineThreadCtx_::SC_ATOMIC_DECLARE
SC_ATOMIC_DECLARE(int, so_far_used_by_detect)
Signature_::sig_str
char * sig_str
Definition: detect.h:744
MpmStore_::sid_array
uint8_t * sid_array
Definition: detect.h:1598
RuleMatchCandidateTx::fw_lte_header_ok
bool fw_lte_header_ok
Definition: detect.h:1242
DetectEngineThreadKeywordCtxItem
struct DetectEngineThreadKeywordCtxItem_ DetectEngineThreadKeywordCtxItem
DetectEngineCtx_::sgh_mpm_context_proto_tcp_packet
int32_t sgh_mpm_context_proto_tcp_packet
Definition: detect.h:1042
DetectEngineIPOnlyCtx_::tree_ipv6dst
SCRadix6Tree tree_ipv6dst
Definition: detect.h:850
SIG_TYPE_APP_TX
@ SIG_TYPE_APP_TX
Definition: detect.h:78
DetectPreFlow
uint8_t DetectPreFlow(ThreadVars *tv, DetectEngineThreadCtx *det_ctx, Packet *p)
Definition: detect.c:3252
DetectVarList_::buffer
uint8_t * buffer
Definition: detect.h:835
SigTableElmt_::Free
void(* Free)(DetectEngineCtx *, void *)
Definition: detect.h:1532
IPOnlyCIDRItem
struct IPOnlyCIDRItem_ IPOnlyCIDRItem
util-hashlist.h
DetectEngineCtx_::decoder_event_sgh
struct SigGroupHead_ * decoder_event_sgh
Definition: detect.h:1055
SignatureHook_::sm_list
int sm_list
Definition: detect.h:556
DetectEngineCtx_::flow_gh
DetectEngineLookupFlow flow_gh[FLOW_STATES]
Definition: detect.h:994
DETECT_TABLE_APP_FILTER
@ DETECT_TABLE_APP_FILTER
Definition: detect.h:541
SCFPSupportSMList_::next
struct SCFPSupportSMList_ * next
Definition: detect.h:843
DetectFirewallAppPolicy
Definition: detect.h:922
SigString
struct SigString_ SigString
DetectEnginePktInspectionEngine
Definition: detect.h:463
DetectAddressHead_::contains_range
bool contains_range
Definition: detect.h:160
DetectEngineMasterCtx_::tenant_mapping_list
DetectEngineTenantMapping * tenant_mapping_list
Definition: detect.h:1793
Signature_::filestore_ctx
const struct DetectFilestoreData_ * filestore_ctx
Definition: detect.h:733
DetectEngineAppInspectionEngine_::next
struct DetectEngineAppInspectionEngine_ * next
Definition: detect.h:417
SigGroupHead_::flags
uint16_t flags
Definition: detect.h:1734
SignatureIsIPOnly
int SignatureIsIPOnly(DetectEngineCtx *de_ctx, const Signature *s)
Test is a initialized signature is IP only.
Definition: detect-engine-build.c:191
PostRuleMatchWorkQueue::len
uint32_t len
Definition: detect.h:1270
PostRuleMatchWorkQueueItem::sm_type
int sm_type
Definition: detect.h:1259
SCFPSupportSMList_::list_id
int list_id
Definition: detect.h:841
SigTableElmt_::name
const char * name
Definition: detect.h:1545
DetectEngineMasterCtx_::list
DetectEngineCtx * list
Definition: detect.h:1782
SignatureInitData_::smlists_tail
struct SigMatch_ * smlists_tail[DETECT_SM_LIST_MAX]
Definition: detect.h:639
DetectEngineThreadCtx_::filestore
struct DetectEngineThreadCtx_::@103 filestore[DETECT_FILESTORE_MAX]
MpmThreadCtx_
Definition: util-mpm.h:62
SignatureInitData_::dst_contains_range
bool dst_contains_range
Definition: detect.h:590
DetectPatternTracker::mpm
uint32_t mpm
Definition: detect.h:813
DetectEngineCtx
struct DetectEngineCtx_ DetectEngineCtx
main detection engine ctx
IPOnlyCIDRItem_::netmask
uint8_t netmask
Definition: detect.h:311
DetectEngineCtx_::type
enum DetectEngineType type
Definition: detect.h:1094
SigGroupHead_
Container for matching data for a signature group.
Definition: detect.h:1733
DetectEngineCtx_::pattern_hash_table
HashListTable * pattern_hash_table
Definition: detect.h:1003
DetectEngineThreadCtx_::sgh_perf_data
struct SCProfileSghData_ * sgh_perf_data
Definition: detect.h:1490
DetectEngineCtx_::firewall_rule_file_exclusive
const char * firewall_rule_file_exclusive
Definition: detect.h:1185
DetectEngineCtx_::guess_applayer
bool guess_applayer
Definition: detect.h:1017
PostRuleMatchWorkQueueItem
Definition: detect.h:1258
DetectEngineIPOnlyCtx_::tree_ipv4dst
SCRadix4Tree tree_ipv4dst
Definition: detect.h:849
DetectEngineTransforms
Definition: detect.h:366
PORT_EQ
@ PORT_EQ
Definition: detect.h:183
PrefilterEngineList_::id
uint16_t id
Definition: detect.h:1619
DetectBufferMpmRegistry_::sm_list_base
int16_t sm_list_base
Definition: detect.h:767
SigGroupHeadInitData_::sig_array
uint8_t * sig_array
Definition: detect.h:1707
PORT_LT
@ PORT_LT
Definition: detect.h:181
SCProfileSghDetectCtx_
Definition: util-profiling-rulegroups.c:48
DetectEngineCtx_::PreFlowHook
DetectPacketHookFunc PreFlowHook
Definition: detect.h:1199
Signature_::app_progress_hook
uint8_t app_progress_hook
Definition: detect.h:700
DetectAddress_
address structure for use in the detection engine.
Definition: detect.h:141
SigTableElmt_::flags
uint32_t flags
Definition: detect.h:1536
TENANT_SELECTOR_TUNNEL
@ TENANT_SELECTOR_TUNNEL
Definition: detect.h:1759
DetectEngineCtx_::max_uniq_toclient_groups
uint16_t max_uniq_toclient_groups
Definition: detect.h:1028
DetectEngineThreadCtx_::buffers
InspectionBufferMultipleForList * buffers
Definition: detect.h:1369
SignatureInitData_::prefilter_sm
SigMatch * prefilter_sm
Definition: detect.h:613
PrefilterRuleStore_
structure for storing potential rule matches
Definition: util-prefilter.h:34
SignatureInitData_::src_contains_negation
bool src_contains_negation
Definition: detect.h:586
DetectEngineCtx_::ref_cnt
uint32_t ref_cnt
Definition: detect.h:1097
DetectEngineCtx_::sigerror_silent
bool sigerror_silent
Definition: detect.h:1067
DetectEngineAppInspectionEngine_::Callback
InspectEngineFuncPtr Callback
Definition: detect.h:410
Signature_::alproto
AppProto alproto
Definition: detect.h:668
DETECT_TABLE_PACKET_PRE_STREAM
@ DETECT_TABLE_PACKET_PRE_STREAM
Definition: detect.h:538
SignatureInitData_::is_rule_state_dependant
bool is_rule_state_dependant
Definition: detect.h:651
SignatureNonPrefilterStore_::id
SigIntId id
Definition: detect.h:1233
SigString_
Definition: detect.h:868
DetectAddressHead_
Definition: detect.h:156
MPMB_OTHERIP
@ MPMB_OTHERIP
Definition: detect.h:1593
DetectEngineCtx_::filedata_config
DetectFileDataCfg * filedata_config
Definition: detect.h:1080
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
DetectEngineFrameInspectionEngine::sm_list_base
uint16_t sm_list_base
Definition: detect.h:494
DetectPort_::port
uint16_t port
Definition: detect.h:195
SigMatchData_::is_last
bool is_last
Definition: detect.h:342
SignatureHook_::app
struct SignatureHook_::@87::@88 app
DetectEngineIPOnlyCtx_::ip_src
IPOnlyCIDRItem * ip_src
Definition: detect.h:853
DetectBufferMpmRegistry_::app_v2
struct DetectBufferMpmRegistry_::@90::@92 app_v2
name
const char * name
Definition: detect-engine-proto.c:47
ADDRESS_LT
@ ADDRESS_LT
Definition: detect.h:125
AppProto
uint16_t AppProto
Definition: app-layer-protos.h:87
IPOnlyCIDRItem_
Definition: detect.h:307
DetectFileDataCfg
Definition: detect.h:948
DetectEngineThreadCtx_::tx_id
uint64_t tx_id
Definition: detect.h:1376
DetectEngineThreadCtx_::decoder_events
AppLayerDecoderEvents * decoder_events
Definition: detect.h:1443
SigMatchData_::ctx
SigMatchCtx * ctx
Definition: detect.h:343
FILE_DECODER_EVENT_INVALID_SWF_VERSION
@ FILE_DECODER_EVENT_INVALID_SWF_VERSION
Definition: detect.h:1561
SignatureHook_::t
union SignatureHook_::@87 t
InspectionBuffer
Definition: detect-engine-inspect-buffer.h:34
DetectVarList_::key_len
uint16_t key_len
Definition: detect.h:833
DetectEngineCtx_::PreStreamHook
DetectPacketHookFunc PreStreamHook
Definition: detect.h:1194
MpmStore_::sm_list
int sm_list
Definition: detect.h:1603
DetectEngineAppInspectionEngine_::GetData
InspectionBufferGetDataPtr GetData
Definition: detect.h:406
DetectEngineThreadKeywordCtxItem_
Definition: detect.h:886
DetectTable
DetectTable
Definition: detect.h:535
DetectEngineCtx_::pkt_mpms_list
DetectBufferMpmRegistry * pkt_mpms_list
Definition: detect.h:1130
DETECT_BUFFER_MPM_TYPE_FRAME
@ DETECT_BUFFER_MPM_TYPE_FRAME
Definition: detect.h:755
Frame
Definition: app-layer-frames.h:49
Flow_
Flow data structure.
Definition: flow.h:360
SigTableElmt_::FileMatch
int(* FileMatch)(DetectEngineThreadCtx *, Flow *, uint8_t flags, File *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1515
DetectVarList_
Definition: detect.h:828
DetectReplaceList_::found
uint8_t * found
Definition: detect.h:818
DetectFirewallPacketPolicies
DetectFirewallPacketPolicies
Definition: detect.h:909
PrefilterEngine_::tx_min_progress
int8_t tx_min_progress
Definition: detect.h:1674
DetectBufferMpmRegistry_::tx_min_progress
uint8_t tx_min_progress
Definition: detect.h:786
DetectEngineThreadKeywordCtxItem_::data
void * data
Definition: detect.h:889
DetectEngineThreadCtx_::pmq
PrefilterRuleStore pmq
Definition: detect.h:1420
util-hash.h
EngineAnalysisCtx_
Definition: detect-engine-analyzer.c:89
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:372
ByteVarSlot_::writer
const Signature * writer
Definition: detect.h:1289
SigGroupHeadInitData_::mpm_store
MpmStore mpm_store[MPMB_MAX]
Definition: detect.h:1705
SigFindSignatureBySidGid
Signature * SigFindSignatureBySidGid(DetectEngineCtx *, uint32_t, uint32_t)
Find a specific signature by sid and gid.
Definition: detect-engine-build.c:80
DetectFirewallAppPolicy::sub_state
uint8_t sub_state
Definition: detect.h:924
DetectEngineIPOnlyCtx_::tree_ipv4src
SCRadix4Tree tree_ipv4src
Definition: detect.h:849
DetectEngineCtx_::inspection_recursion_limit
int inspection_recursion_limit
Definition: detect.h:1011
PrefilterEngineList_::name
const char * name
Definition: detect.h:1655
DetectVarList_::len
uint16_t len
Definition: detect.h:832
DetectEngineFrameInspectionEngine::transforms
const DetectEngineTransforms * transforms
Definition: detect.h:498
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:966
DetectEnginePktInspectionEngine::smd
SigMatchData * smd
Definition: detect.h:464
DetectPatternTracker
struct DetectPatternTracker DetectPatternTracker
SCProfilePrefilterDetectCtx_
Definition: util-profiling-prefilter.c:47
SIG_TYPE_PKT_STREAM
@ SIG_TYPE_PKT_STREAM
Definition: detect.h:74
DetectEngineCtx_::pre_stream_sgh
struct SigGroupHead_ * pre_stream_sgh[2]
Definition: detect.h:1196
SigMatchSignatures
void SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
Definition: detect.c:3360
DetectEngineThreadCtx_::global_keyword_ctxs_array
void ** global_keyword_ctxs_array
Definition: detect.h:1441
TransformData_::options
void * options
Definition: detect.h:363
DetectFirewallAppPolicy::policy
struct DetectFirewallPolicy policy
Definition: detect.h:927
DetectEngineFrameInspectionEngine::mpm
bool mpm
Definition: detect.h:492
detect-engine-register.h
SIGNATURE_HOOK_PKT_NOT_SET
@ SIGNATURE_HOOK_PKT_NOT_SET
Definition: detect.h:519
SCDetectRateFilterFunc
uint8_t(* SCDetectRateFilterFunc)(const Packet *p, uint32_t sid, uint32_t gid, uint32_t rev, uint8_t original_action, uint8_t new_action, void *arg)
Function type for rate filter callback.
Definition: detect.h:962
DetectFirewallPolicies::pkt_policy_signatures
Signature * pkt_policy_signatures[DETECT_FIREWALL_POLICY_SIZE]
Definition: detect.h:936
DetectEngineCtx_::reference_conf_regex_match
pcre2_match_data * reference_conf_regex_match
Definition: detect.h:1167
RuleMatchCandidateTxArrayFree
void RuleMatchCandidateTxArrayFree(DetectEngineThreadCtx *det_ctx)
Definition: detect.c:1242
DetectEngineThreadCtx_::p
Packet * p
Definition: detect.h:1384
SigTableElmt_::AppLayerTxMatch
int(* AppLayerTxMatch)(DetectEngineThreadCtx *, Flow *, uint8_t flags, void *alstate, void *txv, const Signature *, const SigMatchCtx *)
Definition: detect.h:1510
DetectEngineThreadCtx_::keyword_perf_list
int keyword_perf_list
Definition: detect.h:1489
DetectEngineCtx_::mpm_cfg
MpmConfig * mpm_cfg
Definition: detect.h:973
InspectionBufferGetPktDataPtr
InspectionBuffer *(* InspectionBufferGetPktDataPtr)(struct DetectEngineThreadCtx_ *det_ctx, const DetectEngineTransforms *transforms, Packet *p, const int list_id)
Definition: detect.h:458
PrefilterEngine_::cb
union PrefilterEngine_::@105 cb
ADDRESS_EQ
@ ADDRESS_EQ
Definition: detect.h:127
DetectEngineCtx_::keyword_id
int keyword_id
Definition: detect.h:1076
RuleMatchCandidateTx::id
SigIntId id
Definition: detect.h:1240
Detect
TmEcode Detect(ThreadVars *tv, Packet *p, void *data)
Detection engine thread wrapper.
Definition: detect.c:3281
DetectBufferMpmRegistry_::type
uint8_t type
Definition: detect.h:801
SignatureProperties
Definition: detect.h:90
DetectBufferMpmRegistry_::next
struct DetectBufferMpmRegistry_ * next
Definition: detect.h:805
HashTable_
Definition: util-hash.h:35
DetectPatternTracker::cnt
uint32_t cnt
Definition: detect.h:812
DetectEngineTenantMapping_::next
struct DetectEngineTenantMapping_ * next
Definition: detect.h:1768
DetectEngineThreadCtx_::buffers_size
uint32_t buffers_size
Definition: detect.h:1361
DetectEngineCtx_::srep_version
uint32_t srep_version
Definition: detect.h:980
DetectEngineCtx_::profile_sgh_ctx
struct SCProfileSghDetectCtx_ * profile_sgh_ctx
Definition: detect.h:1089
Frames
Definition: app-layer-frames.h:64
DetectBufferMpmRegistry_
one time registration of keywords at start up
Definition: detect.h:762
DetectPort_::next
struct DetectPort_ * next
Definition: detect.h:208
PORT_EB
@ PORT_EB
Definition: detect.h:185
DetectEngineCtx_::tcp_priorityports
DetectPort * tcp_priorityports
Definition: detect.h:1109
DetectReplaceList_
Definition: detect.h:816
MPMB_TCP_STREAM_TS
@ MPMB_TCP_STREAM_TS
Definition: detect.h:1589
DetectEngineThreadCtx_::counter_alerts_overflow
StatsCounterId counter_alerts_overflow
Definition: detect.h:1346
DetectEngineAppInspectionEngine_::sm_list_base
uint16_t sm_list_base
Definition: detect.h:400
SigTableElmt_::TransformId
void(* TransformId)(const uint8_t **data, uint32_t *length, const void *context)
Definition: detect.h:1524
Address_
Definition: decode.h:130
DetectPatternTracker::cd
const struct DetectContentData_ * cd
Definition: detect.h:810
DetectEngineCtx_::sigerror_requires
bool sigerror_requires
Definition: detect.h:1071
DetectEngineThreadCtx_::spm_thread_ctx
SpmThreadCtx * spm_thread_ctx
Definition: detect.h:1327
DetectAddressHead
struct DetectAddressHead_ DetectAddressHead
FILE_DECODER_EVENT_Z_UNKNOWN_ERROR
@ FILE_DECODER_EVENT_Z_UNKNOWN_ERROR
Definition: detect.h:1565
DetectEngineCtx_::dport_hash_table
HashListTable * dport_hash_table
Definition: detect.h:1107
p
Packet * p
Definition: fuzz_dataset.c:30
SignatureInitDataBuffer_::multi_capable
bool multi_capable
Definition: detect.h:509
Signature_::sm_arrays
SigMatchData * sm_arrays[DETECT_SM_LIST_MAX]
Definition: detect.h:730
SigGroupHead_::payload_engines
PrefilterEngine * payload_engines
Definition: detect.h:1744
StatsCounterId
Definition: counters.h:30
DetectEngineCtx_::mpm_ctx_factory_container
MpmCtxFactoryContainer * mpm_ctx_factory_container
Definition: detect.h:1034
DetectEngineCtx_::prefilter_setting
enum DetectEnginePrefilterSetting prefilter_setting
Definition: detect.h:1105
SignatureInitData_::init_flags
uint32_t init_flags
Definition: detect.h:596
DetectEngineCtx_::reference_conf_regex
pcre2_code * reference_conf_regex
Definition: detect.h:1166
DetectBufferType_
Definition: detect.h:425
DetectPort_::sh
struct SigGroupHead_ * sh
Definition: detect.h:205
DetectEngineCtx_::udp_priorityports
DetectPort * udp_priorityports
Definition: detect.h:1110
DetectContentData_
Definition: detect-content.h:93
DetectEngineSetEvent
void DetectEngineSetEvent(DetectEngineThreadCtx *det_ctx, uint8_t e)
Definition: detect-engine.c:5468
SigFileLoaderStat_::TAILQ_HEAD
TAILQ_HEAD(, SigString_) failed_sigs
PostRuleMatchWorkQueue::size
uint32_t size
Definition: detect.h:1271
ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL
@ ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL
Definition: detect.h:1224
DetectEngineThreadCtx_::counter_alerts_suppressed
StatsCounterId counter_alerts_suppressed
Definition: detect.h:1350
DetectEngineCtx_::sigerror_ok
bool sigerror_ok
Definition: detect.h:1068
DetectEngineCtx_::class_conf_regex
pcre2_code * class_conf_regex
Definition: detect.h:1159
DetectEngineThreadCtx_::lua_instruction_limit_errors
StatsCounterId lua_instruction_limit_errors
Definition: detect.h:1453
DetectEngineThreadCtx_::counter_firewall_discarded_alerts
StatsCounterId counter_firewall_discarded_alerts
Definition: detect.h:1348
PrefilterEngine_::local_id
uint16_t local_id
Definition: detect.h:1661
DetectEngineThreadCtx_::lua_transform_errors
StatsCounterId lua_transform_errors
Definition: detect.h:1459
PrefilterEngineList_::Free
void(* Free)(void *pectx)
Definition: detect.h:1648
PostRuleMatchWorkQueueItem
struct PostRuleMatchWorkQueueItem PostRuleMatchWorkQueueItem
RuleMatchCandidateTxArrayInit
void RuleMatchCandidateTxArrayInit(DetectEngineThreadCtx *det_ctx, uint32_t size)
Definition: detect.c:1229
MPMB_MAX
@ MPMB_MAX
Definition: detect.h:1594
SigTableElmt_
element in sigmatch type table.
Definition: detect.h:1505
SCDetectRequiresStatus
struct SCDetectRequiresStatus SCDetectRequiresStatus
Definition: detect.h:62
SigMatchData_
Data needed for Match()
Definition: detect.h:340
InspectionBufferMultipleForList::init
uint32_t init
Definition: detect.h:358
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1527
DetectFirewallAppPolicy::alert_signature
Signature * alert_signature
Definition: detect.h:930
DetectEngineCtx_::sgh_mpm_context_proto_udp_packet
int32_t sgh_mpm_context_proto_udp_packet
Definition: detect.h:1043
DetectPort
struct DetectPort_ DetectPort
Port structure for detection engine.
RuleMatchCandidateTx::s
const Signature * s
Definition: detect.h:1252
DetectEngineCtx_::reference_conf_ht
HashTable * reference_conf_ht
Definition: detect.h:1165
DetectBufferMpmRegistry_::transforms
DetectEngineTransforms transforms
Definition: detect.h:775
SIG_TYPE_APPLAYER
@ SIG_TYPE_APPLAYER
Definition: detect.h:77
SigMatchData_::type
uint16_t type
Definition: detect.h:341
DetectEngineCtx_::version
uint32_t version
Definition: detect.h:1051
DetectMatchAddressIPv4_::ip
uint32_t ip
Definition: detect.h:165
DetectFirewallPolicy::action
uint8_t action
Definition: detect.h:918
DETECT_TRANSFORMS_MAX
#define DETECT_TRANSFORMS_MAX
Definition: detect.h:49
DetectEngineThreadCtx_::varlist
DetectVarList * varlist
Definition: detect.h:1425
Signature_::dsize_low
uint16_t dsize_low
Definition: detect.h:670
DetectPort_::port2
uint16_t port2
Definition: detect.h:196
DetectEngineCtx_::non_pf_engine_names
HashTable * non_pf_engine_names
Definition: detect.h:1183
SignatureNonPrefilterStore_
Definition: detect.h:1232
MPMB_TCP_STREAM_TC
@ MPMB_TCP_STREAM_TC
Definition: detect.h:1590
DetectEngineThreadCtx_::events
uint16_t events
Definition: detect.h:1444
SIG_JSON_CONTENT_ITEM_LEN
#define SIG_JSON_CONTENT_ITEM_LEN
Definition: detect.h:1275
AppLayerDecoderEvents_
Data structure to store app layer decoder events.
Definition: app-layer-events.h:33
SigGroupHead
struct SigGroupHead_ SigGroupHead
Container for matching data for a signature group.
DetectMatchAddressIPv6
struct DetectMatchAddressIPv6_ DetectMatchAddressIPv6
DetectUnregisterThreadCtxFuncs
int DetectUnregisterThreadCtxFuncs(DetectEngineCtx *, void *data, const char *name)
Remove Thread keyword context registration.
Definition: detect-engine.c:4054
TransformIdData
struct TransformIdData_ TransformIdData
TransformData_
Definition: detect.h:361
FLOW_STATES
#define FLOW_STATES
Definition: detect.h:946
Signature_::frame_inspect
DetectEngineFrameInspectionEngine * frame_inspect
Definition: detect.h:726
DetectEngineIPOnlyCtx_::tree_ipv6src
SCRadix6Tree tree_ipv6src
Definition: detect.h:850
DetectEnginePktInspectionEngine::transforms
const DetectEngineTransforms * transforms
Definition: detect.h:472
MpmBuiltinBuffers
MpmBuiltinBuffers
Definition: detect.h:1586
DetectPort_::flags
uint8_t flags
Definition: detect.h:198
DetectBufferType_::SetupCallback
void(* SetupCallback)(const struct DetectEngineCtx_ *, struct Signature_ *, const struct DetectBufferType_ *)
Definition: detect.h:438
SigRegisterTests
void SigRegisterTests(void)
Definition: detect.c:4808
DetectThreadCtxGetKeywordThreadCtx
void * DetectThreadCtxGetKeywordThreadCtx(DetectEngineThreadCtx *, int)
Retrieve thread local keyword ctx by id.
Definition: detect-engine.c:4072
DetectEngineFrameInspectionEngine::Callback
InspectionBufferFrameInspectFunc Callback
Definition: detect.h:496
RuleMatchCandidateTx::fw_lte_counted
bool fw_lte_counted
Definition: detect.h:1241
InspectionBufferMultipleForList::size
uint32_t size
Definition: detect.h:356
DetectEngineThreadCtx_::mt_det_ctxs_hash
HashTable * mt_det_ctxs_hash
Definition: detect.h:1307
DetectBufferMpmRegistry_::pkt_v1
struct DetectBufferMpmRegistry_::@90::@93 pkt_v1
DetectAddress_::prev
struct DetectAddress_ * prev
Definition: detect.h:150
DETECT_PREFILTER_AUTO
@ DETECT_PREFILTER_AUTO
Definition: detect.h:898
DetectEngineThreadCtx_::keyword_ctxs_size
int keyword_ctxs_size
Definition: detect.h:1438
PrefilterEngine_::is_last_for_progress
bool is_last_for_progress
Definition: detect.h:1681
detect-reference.h
Signature_::gid
uint32_t gid
Definition: detect.h:713
DetectEngineCtx_::prefilter_id
uint32_t prefilter_id
Definition: detect.h:1136
DetectEngineCtx_::sgh_array_size
uint32_t sgh_array_size
Definition: detect.h:1040
SigGroupHeadInitData_::pkt_mpms
MpmCtx ** pkt_mpms
Definition: detect.h:1716
SigString_::sig_error
char * sig_error
Definition: detect.h:871
DetectMatchAddressIPv6_::ip2
uint32_t ip2[4]
Definition: detect.h:171
DetectEngineAppInspectionEngine_::id
uint8_t id
Definition: detect.h:394
SCRadix4Tree_
Structure for the radix tree.
Definition: util-radix4-tree.h:66
PrefilterEngineList_::next
struct PrefilterEngineList_ * next
Definition: detect.h:1645
SigTableElmt_::SetupPrefilter
int(* SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh)
Definition: detect.h:1530
DetectEngineCtx_::base64_decode_max_len
uint16_t base64_decode_max_len
Definition: detect.h:1061
SIGNATURE_HOOK_TYPE_APP
@ SIGNATURE_HOOK_TYPE_APP
Definition: detect.h:529
Signature_::next
struct Signature_ * next
Definition: detect.h:749
DetectEngineThreadCtx_::multi_inspect
struct DetectEngineThreadCtx_::@102 multi_inspect
DetectEngineCtx_::sgh_mpm_context_proto_other_packet
int32_t sgh_mpm_context_proto_other_packet
Definition: detect.h:1044
DetectVarList
struct DetectVarList_ DetectVarList
DetectEngineAppInspectionEngine_::sm_list
uint16_t sm_list
Definition: detect.h:399
TENANT_SELECTOR_UNKNOWN
@ TENANT_SELECTOR_UNKNOWN
Definition: detect.h:1755
DetectEngineTenantMapping_::tenant_id
uint32_t tenant_id
Definition: detect.h:1763
InspectionBufferMultipleForList
Definition: detect.h:354
SigFileLoaderStat_::skipped_sigs_total
int skipped_sigs_total
Definition: detect.h:883
DetectBufferMpmType
DetectBufferMpmType
Definition: detect.h:752
DetectEngineTenantMapping
struct DetectEngineTenantMapping_ DetectEngineTenantMapping
DetectEngineCtx_::prefilter_hash_table
HashListTable * prefilter_hash_table
Definition: detect.h:1137
SigGroupHeadInitData_::score
int score
Definition: detect.h:1712
DetectReplaceList
struct DetectReplaceList_ DetectReplaceList
SignatureHook_::sub_state
uint8_t sub_state
Definition: detect.h:561
SignaturePropertyFlowAction
SignaturePropertyFlowAction
Definition: detect.h:84
DetectPreStream
uint8_t DetectPreStream(ThreadVars *tv, DetectEngineThreadCtx *det_ctx, Packet *p)
Definition: detect.c:3262
SigString_::TAILQ_ENTRY
TAILQ_ENTRY(SigString_) next
DetectEngineTenantSelectors
DetectEngineTenantSelectors
Definition: detect.h:1754
DetectBufferMpmRegistry_::GetData
InspectionBufferGetDataPtr GetData
Definition: detect.h:781
detect-engine-inspect-buffer.h
DetectFileDataCfg::content_inspect_min_size
uint32_t content_inspect_min_size
Definition: detect.h:950
InspectionBufferPktInspectFunc
int(* InspectionBufferPktInspectFunc)(struct DetectEngineThreadCtx_ *, const struct DetectEnginePktInspectionEngine *engine, const struct Signature_ *s, Packet *p, uint8_t *alert_flags)
Definition: detect.h:451
DetectEngineCtx_::pre_flow_sgh
struct SigGroupHead_ * pre_flow_sgh
Definition: detect.h:1201
DetectBufferType
struct DetectBufferType_ DetectBufferType
DetectEngineCtx_::class_conf_regex_match
pcre2_match_data * class_conf_regex_match
Definition: detect.h:1160
DetectEngineThreadCtx_::tx_candidates
RuleMatchCandidateTx * tx_candidates
Definition: detect.h:1405
SIG_TYPE_PKT
@ SIG_TYPE_PKT
Definition: detect.h:73
DetectEngineCtx_::requirements
SCDetectRequiresStatus * requirements
Definition: detect.h:1176
DetectEngineMasterCtx
struct DetectEngineMasterCtx_ DetectEngineMasterCtx
ByteVarSlot_
Definition: detect.h:1286
Signature_::addr_src_match4
DetectMatchAddressIPv4 * addr_src_match4
Definition: detect.h:707
DetectBufferMpmRegistry_::pname
char pname[DETECT_PROFILE_NAME_LEN]
Definition: detect.h:764
PrefilterEngineList_::pkt_hook
enum SignatureHookPkt pkt_hook
Definition: detect.h:1633
Signature_::class_id
uint16_t class_id
Definition: detect.h:694
DetectBufferMpmRegistry_::frame_v1
struct DetectBufferMpmRegistry_::@90::@94 frame_v1
DetectBufferType_::ValidateCallback
bool(* ValidateCallback)(const struct Signature_ *, const char **sigerror, const struct DetectBufferType_ *)
Definition: detect.h:440
DETECT_FILESTORE_MAX
#define DETECT_FILESTORE_MAX
Definition: detect.h:1230
PrefilterEngineList_::alproto
AppProto alproto
Definition: detect.h:1622
DetectEngineCtx_::fw_policies
struct DetectFirewallPolicies * fw_policies
Definition: detect.h:997
SigTableElmt_::TransformValidate
bool(* TransformValidate)(const uint8_t *content, uint16_t content_len, const void *context)
Definition: detect.h:1521
SignatureInitData
struct SignatureInitData_ SignatureInitData
SigGroupHeadInitData_::sig_cnt
SigIntId sig_cnt
Definition: detect.h:1726
DetectEngineThreadCtx_::counter_mpm_list
StatsCounterAvgId counter_mpm_list
Definition: detect.h:1352
SRepCIDRTree_
Definition: reputation.h:40
AppLayerTxData
Definition: app-layer-parser.h:172
DetectBufferMpmRegistry_::sgh_mpm_context
int sgh_mpm_context
Definition: detect.h:771
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:22
DetectEnginePktInspectionEngine::sm_list
uint16_t sm_list
Definition: detect.h:466
DetectEngineThreadCtx_::match_array_len
uint32_t match_array_len
Definition: detect.h:1401
DetectBufferMpmRegistry_::GetData
InspectionBufferGetPktDataPtr GetData
Definition: detect.h:795
DETECT_EVENT_TOO_MANY_BUFFERS
@ DETECT_EVENT_TOO_MANY_BUFFERS
Definition: detect.h:1573
IPOnlyCIDRItem_::negated
uint8_t negated
Definition: detect.h:313
PrefilterEngineList_::run_always
bool run_always
Definition: detect.h:1653
SignatureInitData_::buffers_size
uint32_t buffers_size
Definition: detect.h:644
DetectEngineThreadCtx_
Definition: detect.h:1295
DetectEngineThreadCtx_::lua_memory_limit_errors
StatsCounterId lua_memory_limit_errors
Definition: detect.h:1456
PrefilterEngine_
Definition: detect.h:1660
MpmStore_
Definition: detect.h:1597
SigGroupHeadInitData_::tx_engines
PrefilterEngineList * tx_engines
Definition: detect.h:1721
SIG_TYPE_IPONLY
@ SIG_TYPE_IPONLY
Definition: detect.h:67
SCProfileKeywordDetectCtx_
Definition: util-profiling-keywords.c:48
SignatureInitData_::mpm_sm
SigMatch * mpm_sm
Definition: detect.h:611
length
uint16_t length
Definition: decode-sctp.h:2
DetectEngineCtx_::srepCIDR_ctx
SRepCIDRTree * srepCIDR_ctx
Definition: detect.h:983
SignatureInitData_::src
const DetectAddressHead * src
Definition: detect.h:634
DetectEngineThreadCtx_::tx_candidates_size
uint32_t tx_candidates_size
Definition: detect.h:1406
signature_properties
const struct SignatureProperties signature_properties[SIG_TYPE_MAX]
Definition: detect-engine.c:119
ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE
@ ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE
Definition: detect.h:1225
DetectEngineThreadKeywordCtxItem_::id
int id
Definition: detect.h:891
DetectBufferMpmRegistry_::sm_list
int16_t sm_list
Definition: detect.h:766
DetectEngineThreadCtx_::buffers
InspectionBuffer * buffers
Definition: detect.h:1360
DetectEngineMasterCtx_::keyword_list
DetectEngineThreadKeywordCtxItem * keyword_list
Definition: detect.h:1798
SigTableElmt_::Cleanup
void(* Cleanup)(struct SigTableElmt_ *)
Definition: detect.h:1551
SignatureInitData_::mpm_sm_list
int mpm_sm_list
Definition: detect.h:609
PrefilterEngineList_::PrefilterFrame
PrefilterFrameFn PrefilterFrame
Definition: detect.h:1641
PrefilterEngine_::ctx
union PrefilterEngine_::@104 ctx
DetectEngineMasterCtx_::tenant_selector
enum DetectEngineTenantSelectors tenant_selector
Definition: detect.h:1789
DetectEngineCtx_::keyword_hash
HashListTable * keyword_hash
Definition: detect.h:1078
PrefilterEngineList_::pectx
void * pectx
Definition: detect.h:1637
SignatureInitData_::cidr_dst
IPOnlyCIDRItem * cidr_dst
Definition: detect.h:606
ADDRESS_GE
@ ADDRESS_GE
Definition: detect.h:130
DetectEngineCtx_::last_reload
struct timeval last_reload
Definition: detect.h:1140
SignatureInitData_::list
int list
Definition: detect.h:616
DetectEngineCtx_::failure_fatal
bool failure_fatal
Definition: detect.h:967
Signature_::pkt_inspect
DetectEnginePktInspectionEngine * pkt_inspect
Definition: detect.h:725
DetectEngineAppInspectionEngine_::GetMultiData
InspectionMultiBufferGetDataPtr GetMultiData
Definition: detect.h:408
DetectEngineCtx_::max_flowbits
uint8_t max_flowbits
Definition: detect.h:970
SCProfileSghData_
Definition: util-profiling-rulegroups.c:37
DETECT_SM_LIST_MAX
@ DETECT_SM_LIST_MAX
Definition: detect-engine-register.h:324
ByteVarSlot_::value
uint64_t value
Definition: detect.h:1287
DetectReplaceList_::next
struct DetectReplaceList_ * next
Definition: detect.h:819
DetectEngineLookupFlow_::sgh
struct SigGroupHead_ * sgh[256]
Definition: detect.h:865
Signature_::references
DetectReference * references
Definition: detect.h:740
SigTableElmt_::tables
uint8_t tables
Definition: detect.h:1540
PrefilterEngineList_::PrefilterTx
PrefilterTxFn PrefilterTx
Definition: detect.h:1640
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
DetectEngineCtx_::sm_types_prefilter
bool * sm_types_prefilter
Definition: detect.h:1152
SignatureNonPrefilterStore_::alproto
AppProto alproto
Definition: detect.h:1235
SignatureInitData_::rule_state_flowbits_ids_size
uint32_t rule_state_flowbits_ids_size
Definition: detect.h:656
SignatureHookPkt
SignatureHookPkt
Definition: detect.h:518
PrefilterEngineList_::gid
uint32_t gid
Definition: detect.h:1657
DetectEngineFrameInspectionEngine::sm_list
uint16_t sm_list
Definition: detect.h:493
DetectMetadataHead
Definition: detect-metadata.h:39
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:335
DetectFirewallPolicies::pkt
struct DetectFirewallPolicy pkt[DETECT_FIREWALL_POLICY_SIZE]
Definition: detect.h:935
DetectEngineCtx_::mpm_matcher
uint8_t mpm_matcher
Definition: detect.h:969
DETECT_TABLE_PACKET_PRE_FLOW
@ DETECT_TABLE_PACKET_PRE_FLOW
Definition: detect.h:537
DetectBufferMpmRegistry_::GetDataSingle
InspectionSingleBufferGetDataPtr GetDataSingle
Definition: detect.h:782
SignatureInitData_::proto
DetectProto proto
Definition: detect.h:626
DETECT_TABLE_PACKET_FILTER
@ DETECT_TABLE_PACKET_FILTER
Definition: detect.h:539
DetectFirewallAppPolicy::progress
uint8_t progress
Definition: detect.h:925
DetectEngineCtx_::frame_inspect_engines
DetectEngineFrameInspectionEngine * frame_inspect_engines
Definition: detect.h:1132
DetectBufferMpmRegistry_::priority
int priority
Definition: detect.h:768
PORT_ES
@ PORT_ES
Definition: detect.h:184
PrefilterEngineList
struct PrefilterEngineList_ PrefilterEngineList
DetectEngineMasterCtx_::free_list
DetectEngineCtx * free_list
Definition: detect.h:1787
DetectVarList_::type
uint16_t type
Definition: detect.h:829
DetectEngineCtx_::filestore_cnt
uint16_t filestore_cnt
Definition: detect.h:1179
DetectEngineThreadKeywordCtxItem_::next
struct DetectEngineThreadKeywordCtxItem_ * next
Definition: detect.h:890
DetectAddress_::ip2
Address ip2
Definition: detect.h:144
PrefilterFrameFn
void(* PrefilterFrameFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, const struct Frames *frames, const struct Frame *frame)
Definition: detect.h:1611
DetectPort_
Port structure for detection engine.
Definition: detect.h:194
SigGroupHead_::init
SigGroupHeadInitData * init
Definition: detect.h:1750
DetectEngineCtx_::sig_cnt
uint32_t sig_cnt
Definition: detect.h:977
SignatureHook_::pkt
struct SignatureHook_::@87::@89 pkt
DetectEngineThreadCtx_::json_content_capacity
uint8_t json_content_capacity
Definition: detect.h:1335
SigTableElmt_::alternative
uint16_t alternative
Definition: detect.h:1543
SignatureInitData_::cidr_src
IPOnlyCIDRItem * cidr_src
Definition: detect.h:606
app-layer-parser.h
Signature_::app_inspect
DetectEngineAppInspectionEngine * app_inspect
Definition: detect.h:724
PrefilterEngine_::sub_state
uint8_t sub_state
Definition: detect.h:1675
SigMatch_::ctx
SigMatchCtx * ctx
Definition: detect.h:334
DetectReference_
Signature reference list.
Definition: detect-reference.h:30
SignatureInitData_::hook
SignatureHook hook
Definition: detect.h:575
SIGNATURE_HOOK_TYPE_NOT_SET
@ SIGNATURE_HOOK_TYPE_NOT_SET
Definition: detect.h:527
SigFileLoaderStat_::bad_sigs_total
int bad_sigs_total
Definition: detect.h:882
DetectEngineThreadCtx_::lua_transform_memory_limit_errors
StatsCounterId lua_transform_memory_limit_errors
Definition: detect.h:1468
Signature_::sub_state
uint8_t sub_state
Definition: detect.h:704
SigGroupHeadInitData_::direction
uint32_t direction
Definition: detect.h:1711
DetectEngineThreadCtx_::lua_rule_errors
StatsCounterId lua_rule_errors
Definition: detect.h:1447
DetectLoadCompleteSigPath
char * DetectLoadCompleteSigPath(const DetectEngineCtx *, const char *sig_file)
Create the path if default-rule-path was specified.
Definition: detect-engine-loader.c:108
PrefilterEngine_::pkt
struct PrefilterEngine_::@104::@106 pkt
MpmStore_::direction
int direction
Definition: detect.h:1601
DetectEngineThreadCtx_::base64_decoded_len
int base64_decoded_len
Definition: detect.h:1387
DetectVarList_::next
struct DetectVarList_ * next
Definition: detect.h:837
RuleMatchCandidateTx::stream_result
uint8_t stream_result
Definition: detect.h:1247
Signature_::action
uint8_t action
Definition: detect.h:678
DetectEngineLookupFlow_::udp
DetectPort * udp
Definition: detect.h:864
DetectEngineThreadCtx_::raw_stream_progress
uint64_t raw_stream_progress
Definition: detect.h:1316
SignatureHook_::alproto
AppProto alproto
Definition: detect.h:559
SignatureHookType
SignatureHookType
Definition: detect.h:526
SigIntId
#define SigIntId
Definition: detect-engine-state.h:38
PrefilterEngine_::alproto
AppProto alproto
Definition: detect.h:1664
Signature_::flags
uint32_t flags
Definition: detect.h:664
DetectEngineFrameInspectionEngine::v1
struct DetectEngineFrameInspectionEngine::@86 v1
PostRuleMatchWorkQueue
struct PostRuleMatchWorkQueue PostRuleMatchWorkQueue
DetectBufferType_::xform_id
TransformIdData xform_id[DETECT_TRANSFORMS_MAX]
Definition: detect.h:443
IPOnlyCIDRItem_::next
struct IPOnlyCIDRItem_ * next
Definition: detect.h:319
DetectEngineCtx_::max_fb_id
uint32_t max_fb_id
Definition: detect.h:1032
DetectEngineIPOnlyCtx_::sig_mapping
uint32_t * sig_mapping
Definition: detect.h:858
Packet_
Definition: decode.h:528
DetectEngineFrameInspectionEngine::alproto
AppProto alproto
Definition: detect.h:489
ByteVarSlot_::set
uint8_t set
Definition: detect.h:1288
DetectEngineCtx_::sgh_mpm_context_stream
int32_t sgh_mpm_context_stream
Definition: detect.h:1045
SignatureNonPrefilterStore
struct SignatureNonPrefilterStore_ SignatureNonPrefilterStore
DetectBufferMpmRegistry
struct DetectBufferMpmRegistry_ DetectBufferMpmRegistry
one time registration of keywords at start up
DetectPort_::last
struct DetectPort_ * last
Definition: detect.h:209
sigmatch_table
SigTableElmt * sigmatch_table
Definition: detect-parse.c:78
DetectEngineThreadCtx_::frame_id
int64_t frame_id
Definition: detect.h:1381
FILE_DECODER_EVENT_Z_BUF_ERROR
@ FILE_DECODER_EVENT_Z_BUF_ERROR
Definition: detect.h:1564
InspectionBufferFrameInspectFunc
int(* InspectionBufferFrameInspectFunc)(struct DetectEngineThreadCtx_ *, const struct DetectEngineFrameInspectionEngine *engine, const struct Signature_ *s, Packet *p, const struct Frames *frames, const struct Frame *frame)
Definition: detect.h:484
DetectEngineCtx_::frame_mpms_list
DetectBufferMpmRegistry * frame_mpms_list
Definition: detect.h:1133
TransformData
struct TransformData_ TransformData
DetectEngineCtx_::sgh_mpm_ctx_cnf
uint8_t sgh_mpm_ctx_cnf
Definition: detect.h:1074
DetectEngineAppInspectionEngine_::match_on_null
bool match_on_null
Definition: detect.h:398
DetectBufferType_::packet
bool packet
Definition: detect.h:431
SCSigOrderFunc_
Structure holding the signature ordering function used by the signature ordering module.
Definition: detect-engine-sigorder.c:100
PrefilterEngine
struct PrefilterEngine_ PrefilterEngine
MpmStore_::alproto
AppProto alproto
Definition: detect.h:1605
SigTableElmt_::JsonAdditionalInfo
void(* JsonAdditionalInfo)(struct SCJsonBuilder *)
Definition: detect.h:1554
DetectEngineMasterCtx_::multi_tenant_enabled
int multi_tenant_enabled
Definition: detect.h:1775
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:4002
DetectEngineThreadCtx_::filestore_cnt
uint16_t filestore_cnt
Definition: detect.h:1341
DetectEngineFrameInspectionEngine
Definition: detect.h:488
ENGINE_PROFILE_MEDIUM
@ ENGINE_PROFILE_MEDIUM
Definition: detect.h:1217
DetectFileDataCfg::content_limit
uint32_t content_limit
Definition: detect.h:949
SigFileLoaderStat
struct SigFileLoaderStat_ SigFileLoaderStat
Signature loader statistics.
DetectEngineCtx_::max_uniq_toserver_groups
uint16_t max_uniq_toserver_groups
Definition: detect.h:1029
DETECT_BUFFER_MPM_TYPE_PKT
@ DETECT_BUFFER_MPM_TYPE_PKT
Definition: detect.h:753
InspectionMultiBufferGetDataPtr
bool(* InspectionMultiBufferGetDataPtr)(struct DetectEngineThreadCtx_ *det_ctx, const void *txv, const uint8_t flow_flags, uint32_t local_id, const uint8_t **buf, uint32_t *buf_len)
Definition: detect.h:381
DETECT_TABLE_PACKET_TD
@ DETECT_TABLE_PACKET_TD
Definition: detect.h:540
TmEcode
TmEcode
Definition: tm-threads-common.h:80
DetectEnginePktInspectionEngine::Callback
InspectionBufferPktInspectFunc Callback
Definition: detect.h:470
PrefilterEngine_::PrefilterFrame
PrefilterFrameFn PrefilterFrame
Definition: detect.h:1695
PrefilterEngine_::frame_type
uint8_t frame_type
Definition: detect.h:1677
DetectBufferType_::name
char name[64]
Definition: detect.h:426
Signature_::init_data
SignatureInitData * init_data
Definition: detect.h:746
DetectEngineCtx_::profile_keyword_ctx
struct SCProfileKeywordDetectCtx_ * profile_keyword_ctx
Definition: detect.h:1086
DetectEngineAppInspectionEngine_::GetDataSingle
InspectionSingleBufferGetDataPtr GetDataSingle
Definition: detect.h:407
SigGroupHeadInitData_::max_sig_id
uint32_t max_sig_id
Definition: detect.h:1713
DetectEngineCtx_::sgh_array_cnt
uint32_t sgh_array_cnt
Definition: detect.h:1039
SignatureInitData_::rule_state_dependant_sids_array
uint32_t * rule_state_dependant_sids_array
Definition: detect.h:652
DetectEngineThreadCtx_::alert_queue_capacity
uint16_t alert_queue_capacity
Definition: detect.h:1390
SignatureInitData_::negated
bool negated
Definition: detect.h:582
DetectEngineCtx_::sgh_array
struct SigGroupHead_ ** sgh_array
Definition: detect.h:1038
SigTableElmt_::Match
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1507
reputation.h
MpmStore
struct MpmStore_ MpmStore
SignatureInitData_
Definition: detect.h:574
SCFPSupportSMList_::priority
int priority
Definition: detect.h:842
HashListTable_
Definition: util-hashlist.h:37
PrefilterTxFn
void(* PrefilterTxFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f, void *tx, const uint64_t tx_id, const AppLayerTxData *tx_data, const uint8_t flags)
Definition: detect.h:1615
SignatureInitData_::rule_state_dependant_sids_size
uint32_t rule_state_dependant_sids_size
Definition: detect.h:653
DetectEngineCtx_::byte_extract_max_local_id
int32_t byte_extract_max_local_id
Definition: detect.h:1048
SignatureInitData_::dst_contains_negation
bool dst_contains_negation
Definition: detect.h:587
DetectEngineThreadCtx_::lua_transform_blocked_function_errors
StatsCounterId lua_transform_blocked_function_errors
Definition: detect.h:1462
DetectEnginePktInspectionEngine::sm_list_base
uint16_t sm_list_base
Definition: detect.h:467
DetectEngineTransforms::transforms
TransformData transforms[DETECT_TRANSFORMS_MAX]
Definition: detect.h:367
PORT_ER
@ PORT_ER
Definition: detect.h:180
Signature_::addr_dst_match6_cnt
uint16_t addr_dst_match6_cnt
Definition: detect.h:690
SignatureInitData_::src_contains_range
bool src_contains_range
Definition: detect.h:589
SIG_TYPE_DEONLY
@ SIG_TYPE_DEONLY
Definition: detect.h:72
SIGNATURE_HOOK_PKT_PRE_STREAM
@ SIGNATURE_HOOK_PKT_PRE_STREAM
Definition: detect.h:522
SIG_PROP_FLOW_ACTION_PACKET
@ SIG_PROP_FLOW_ACTION_PACKET
Definition: detect.h:85
DetectEngineThreadCtx
struct DetectEngineThreadCtx_ DetectEngineThreadCtx
SigGroupHead_::frame_engines
PrefilterEngine * frame_engines
Definition: detect.h:1746
SigGroupHeadInitData_::app_mpms
MpmCtx ** app_mpms
Definition: detect.h:1715
DetectEngineCtx_::RateFilterCallback
SCDetectRateFilterFunc RateFilterCallback
Definition: detect.h:1188
FILE_DECODER_EVENT_LZMA_DECODER_ERROR
@ FILE_DECODER_EVENT_LZMA_DECODER_ERROR
Definition: detect.h:1568
FILE_DECODER_EVENT_LZMA_XZ_ERROR
@ FILE_DECODER_EVENT_LZMA_XZ_ERROR
Definition: detect.h:1570
SIG_ALPROTO_MAX
#define SIG_ALPROTO_MAX
Definition: detect.h:572
DetectEngineFrameInspectionEngine::dir
uint8_t dir
Definition: detect.h:490
DetectEngineTransforms
struct DetectEngineTransforms DetectEngineTransforms
Signature_::sp
DetectPort * sp
Definition: detect.h:718
SIG_TYPE_NOT_SET
@ SIG_TYPE_NOT_SET
Definition: detect.h:66
PORT_LE
@ PORT_LE
Definition: detect.h:182
DETECT_FIREWALL_POLICY_PRE_STREAM
@ DETECT_FIREWALL_POLICY_PRE_STREAM
Definition: detect.h:912
DetectEngineThreadCtx_::mtc
MpmThreadCtx mtc
Definition: detect.h:1416
SigString_::filename
char * filename
Definition: detect.h:869
DetectBufferType_::multi_instance
bool multi_instance
Definition: detect.h:437
DETECT_ENGINE_TYPE_TENANT
@ DETECT_ENGINE_TYPE_TENANT
Definition: detect.h:906
RuleMatchCandidateTx::flags
uint32_t * flags
Definition: detect.h:1243
PostRuleMatchWorkQueue
Definition: detect.h:1268
DetectEngineCtx_::dup_sig_hash_table
HashListTable * dup_sig_hash_table
Definition: detect.h:1006
DetectEngineCtx_::config_prefix
char config_prefix[64]
Definition: detect.h:1092
PrefilterEngineList_::tx_min_progress
int8_t tx_min_progress
Definition: detect.h:1625
DetectEngineAppInspectionEngine_::alproto
AppProto alproto
Definition: detect.h:392
SigMatchCtx_
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
Definition: detect.h:326
Signature_::class_msg
char * class_msg
Definition: detect.h:738
DetectPatternTracker::sm_list
int sm_list
Definition: detect.h:811
DetectEngineAppInspectionEngine_::smd
SigMatchData * smd
Definition: detect.h:415
SigGroupHeadInitData_::pkt_engines
PrefilterEngineList * pkt_engines
Definition: detect.h:1719
DetectBufferMpmRegistry_::GetMultiData
InspectionMultiBufferGetDataPtr GetMultiData
Definition: detect.h:783
DetectBufferType_::id
int id
Definition: detect.h:428
DetectEngineCtx_::spm_matcher
uint8_t spm_matcher
Definition: detect.h:974
SigGroupHead_::post_rule_match_engines
PrefilterEngine * post_rule_match_engines
Definition: detect.h:1747
DetectEnginePktInspectionEngine::GetData
InspectionBufferGetPktDataPtr GetData
Definition: detect.h:469
ENGINE_PROFILE_UNKNOWN
@ ENGINE_PROFILE_UNKNOWN
Definition: detect.h:1215
DETECT_ENGINE_TYPE_NORMAL
@ DETECT_ENGINE_TYPE_NORMAL
Definition: detect.h:903
SignatureInitDataBuffer_::tail
SigMatch * tail
Definition: detect.h:515
DetectEngineIPOnlyCtx_::ip_dst
IPOnlyCIDRItem * ip_dst
Definition: detect.h:853
MpmStore_::mpm_ctx
MpmCtx * mpm_ctx
Definition: detect.h:1606
util-file.h
DetectAddressHead_::ipv6_head
DetectAddress * ipv6_head
Definition: detect.h:158
DetectMetadataHashFree
void DetectMetadataHashFree(DetectEngineCtx *de_ctx)
Definition: detect-metadata.c:79
util-prefilter.h
DetectEngineCtx_::eth_non_ip_sgh
struct SigGroupHead_ * eth_non_ip_sgh
Definition: detect.h:1058
SignatureInitData_::dsize_sm
SigMatch * dsize_sm
Definition: detect.h:603
APP_LAYER_MAX_PROGRESS
#define APP_LAYER_MAX_PROGRESS
Definition: app-layer-parser.h:81
DetectBufferType_::frame
bool frame
Definition: detect.h:432
File_
Definition: util-file.h:146
th_v
ThreadVars * th_v
Definition: fuzz_dataset.c:29
DetectEngineIPOnlyCtx
struct DetectEngineIPOnlyCtx_ DetectEngineIPOnlyCtx
IP only rules matching ctx.
MPMB_TCP_PKT_TC
@ MPMB_TCP_PKT_TC
Definition: detect.h:1588
DetectEngineCtx_::sig_stat
SigFileLoaderStat sig_stat
Definition: detect.h:1143
DetectEngineCtx_::address_table
HashListTable * address_table
Definition: detect.h:1113
DetectEngineThreadCtx_::to_clear_queue
uint32_t * to_clear_queue
Definition: detect.h:1363
DetectEngineCtx_::profile_prefilter_ctx
struct SCProfilePrefilterDetectCtx_ * profile_prefilter_ctx
Definition: detect.h:1087
TENANT_SELECTOR_DIRECT
@ TENANT_SELECTOR_DIRECT
Definition: detect.h:1756
DetectEngineCtx_::rule_file
const char * rule_file
Definition: detect.h:1065
InspectionBufferMultipleForList
struct InspectionBufferMultipleForList InspectionBufferMultipleForList
util-mpm.h
InspectEngineFuncPtr
uint8_t(* InspectEngineFuncPtr)(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:386
flags
uint8_t flags
Definition: decode-gre.h:0
SigTableElmt_::alias
const char * alias
Definition: detect.h:1546
DetectBufferMpmRegistry_::type
enum DetectBufferMpmType type
Definition: detect.h:770
SigMatchCtx
struct SigMatchCtx_ SigMatchCtx
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
DetectEngineMasterCtx_::keyword_id
int keyword_id
Definition: detect.h:1799
FILE_DECODER_EVENT_LZMA_HEADER_TOO_SHORT_ERROR
@ FILE_DECODER_EVENT_LZMA_HEADER_TOO_SHORT_ERROR
Definition: detect.h:1567
DetectEngineCtx_::app_mpms_list
DetectBufferMpmRegistry * app_mpms_list
Definition: detect.h:1125
suricata-common.h
SigMatch_::idx
uint16_t idx
Definition: detect.h:333
DetectEnginePktInspectionEngine::v1
struct DetectEnginePktInspectionEngine::@85 v1
SIG_PROP_FLOW_ACTION_FLOW_IF_STATEFUL
@ SIG_PROP_FLOW_ACTION_FLOW_IF_STATEFUL
Definition: detect.h:87
DetectEngineThreadCtx_::prefilter_bytes_called
uint64_t prefilter_bytes_called
Definition: detect.h:1496
SigString_::line
int line
Definition: detect.h:872
SigGroupHeadInitData_::frame_engines
PrefilterEngineList * frame_engines
Definition: detect.h:1722
SigMatch_::type
uint16_t type
Definition: detect.h:332
DETECT_BUFFER_MPM_TYPE_APP
@ DETECT_BUFFER_MPM_TYPE_APP
Definition: detect.h:754
DETECT_FIREWALL_POLICY_PACKET_FILTER
@ DETECT_FIREWALL_POLICY_PACKET_FILTER
Definition: detect.h:910
SigGroupHeadInitData_::payload_engines
PrefilterEngineList * payload_engines
Definition: detect.h:1720
DetectEngineThreadCtx_::tenant_id
uint32_t tenant_id
Definition: detect.h:1298
SigGroupHeadInitData_::match_array
Signature ** match_array
Definition: detect.h:1729
FILE_DECODER_EVENT_Z_DATA_ERROR
@ FILE_DECODER_EVENT_Z_DATA_ERROR
Definition: detect.h:1562
DETECT_FIREWALL_POLICY_SIZE
#define DETECT_FIREWALL_POLICY_SIZE
Definition: detect.h:913
PORT_GE
@ PORT_GE
Definition: detect.h:186
SignatureHook_::ph
enum SignatureHookPkt ph
Definition: detect.h:567
DetectEngineCtx_::buffer_type_hash_name
HashListTable * buffer_type_hash_name
Definition: detect.h:1120
DetectEngineCtx_::next
struct DetectEngineCtx_ * next
Definition: detect.h:1099
Signature_::dsize_high
uint16_t dsize_high
Definition: detect.h:671
DETECT_TABLE_NOT_SET
@ DETECT_TABLE_NOT_SET
Definition: detect.h:536
Signature_::file_flags
uint8_t file_flags
Definition: detect.h:679
DetectBufferMpmRegistry_::name
const char * name
Definition: detect.h:763
detect-metadata.h
Signature_::action_scope
uint8_t action_scope
Definition: detect.h:685
DETECT_ENGINE_TYPE_DD_STUB
@ DETECT_ENGINE_TYPE_DD_STUB
Definition: detect.h:904
TENANT_SELECTOR_VLAN
@ TENANT_SELECTOR_VLAN
Definition: detect.h:1757
DetectEngineFrameInspectionEngine::next
struct DetectEngineFrameInspectionEngine * next
Definition: detect.h:501
SignatureInitData_::curbuf
SignatureInitDataBuffer * curbuf
Definition: detect.h:645
DetectEngineThreadCtx_::prefilter_perf_data
struct SCProfilePrefilterData_ * prefilter_perf_data
Definition: detect.h:1492
DetectEnginePrefilterSetting
DetectEnginePrefilterSetting
Definition: detect.h:896
SignatureHook_::type
enum SignatureHookType type
Definition: detect.h:555
DetectPort_::prev
struct DetectPort_ * prev
Definition: detect.h:207
util-spm.h
DetectEnginePktInspectionEngine::next
struct DetectEnginePktInspectionEngine * next
Definition: detect.h:474
SignatureType
SignatureType
Definition: detect.h:65
DetectEngineCtx_::rate_filter_callback_arg
void * rate_filter_callback_arg
Definition: detect.h:1191
PrefilterEngineList_::PrefilterPostRule
void(* PrefilterPostRule)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f)
Definition: detect.h:1642
SigGroupHeadInitData_::sig_size
uint32_t sig_size
Definition: detect.h:1708
PrefilterEngineList_
Definition: detect.h:1618
SigFileLoaderStat_::total_files
int total_files
Definition: detect.h:880
util-radix4-tree.h
SIGNATURE_HOOK_PKT_PRE_FLOW
@ SIGNATURE_HOOK_PKT_PRE_FLOW
Definition: detect.h:521
DetectEngineThreadCtx_::frame_inspect_progress
uint64_t frame_inspect_progress
Definition: detect.h:1382
DetectMatchAddressIPv4_::ip2
uint32_t ip2
Definition: detect.h:166
DetectEngineCtx_::profile_match_logging_threshold
uint32_t profile_match_logging_threshold
Definition: detect.h:1090
PostRuleMatchWorkQueue::q
PostRuleMatchWorkQueueItem * q
Definition: detect.h:1269
IPOnlyCIDRItem_::ip
uint32_t ip[4]
Definition: detect.h:315
TransformIdData_::id_data_len
uint32_t id_data_len
Definition: detect.h:422
PrefilterEngine_::gid
uint32_t gid
Definition: detect.h:1701
Signature_::rev
uint32_t rev
Definition: detect.h:714
SignatureInitData_::sm_cnt
uint16_t sm_cnt
Definition: detect.h:578
Signature_::proto
DetectProto * proto
Definition: detect.h:682
util-radix6-tree.h
DetectBufferMpmRegistry_::sub_state
uint8_t sub_state
Definition: detect.h:787
SIGNATURE_HOOK_TYPE_PKT
@ SIGNATURE_HOOK_TYPE_PKT
Definition: detect.h:528
DetectEngineCtx_::sig_list
Signature * sig_list
Definition: detect.h:976
FILE_DECODER_EVENT_NO_MEM
@ FILE_DECODER_EVENT_NO_MEM
Definition: detect.h:1559
DetectEngineCtx_::profile_keyword_ctx_per_list
struct SCProfileKeywordDetectCtx_ ** profile_keyword_ctx_per_list
Definition: detect.h:1088
RuleMatchCandidateTx
struct RuleMatchCandidateTx RuleMatchCandidateTx
PrefilterPktFn
void(* PrefilterPktFn)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)
Definition: detect.h:1610
DetectEngineCtx_::loader_id
int loader_id
Definition: detect.h:1102
TransformData_::transform
int transform
Definition: detect.h:362
DetectEngineCtx_::pkt_inspect_engines
DetectEnginePktInspectionEngine * pkt_inspect_engines
Definition: detect.h:1129
SIG_TYPE_MAX
@ SIG_TYPE_MAX
Definition: detect.h:80
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:34
Signature_::prio
int prio
Definition: detect.h:715
DetectEngineCtx_::ea
struct EngineAnalysisCtx_ * ea
Definition: detect.h:1170
DetectEngineIPOnlyCtx_::sig_mapping_size
uint32_t sig_mapping_size
Definition: detect.h:859
DetectEngineCtx_::sm_types_silent_error
bool * sm_types_silent_error
Definition: detect.h:1153
DetectEngineThreadKeywordCtxItem_::FreeFunc
void(* FreeFunc)(void *)
Definition: detect.h:888
DetectMatchAddressIPv6_::ip
uint32_t ip[4]
Definition: detect.h:170
SignatureInitDataBuffer_::only_ts
bool only_ts
Definition: detect.h:512
SigGroupHeadInitData
struct SigGroupHeadInitData_ SigGroupHeadInitData
DetectAddress
struct DetectAddress_ DetectAddress
address structure for use in the detection engine.
SpmGlobalThreadCtx_
Definition: util-spm.h:48
DetectEngineCtx_::app_mpms_list_cnt
uint32_t app_mpms_list_cnt
Definition: detect.h:1124
Signature_::addr_src_match6_cnt
uint16_t addr_src_match6_cnt
Definition: detect.h:691
DetectProto_
Definition: detect-engine-proto.h:38
DetectFilestoreData_
Definition: detect-filestore.h:36
SigGroupHeadInitData_
Definition: detect.h:1704
SignatureInitData_::buffers
SignatureInitDataBuffer * buffers
Definition: detect.h:642
DetectEngineCtx_::app_inspect_engines
DetectEngineAppInspectionEngine * app_inspect_engines
Definition: detect.h:1128
SignatureInitData_::dst
const DetectAddressHead * dst
Definition: detect.h:634
DetectEngineCtx_::filemagic_thread_ctx_id
int filemagic_thread_ctx_id
Definition: detect.h:1020
SigJsonContent
Definition: detect.h:1279
PrefilterEngine_::pectx
void * pectx
Definition: detect.h:1690
SignatureInitData_::firewall_rule
bool firewall_rule
Definition: detect.h:659
DetectEngineThreadCtx_::alert_queue
PacketAlert * alert_queue
Definition: detect.h:1391
SIGNATURE_HOOK_PKT_ALL
@ SIGNATURE_HOOK_PKT_ALL
Definition: detect.h:523
DetectEngineThreadCtx_::pcre_match_start_offset
uint32_t pcre_match_start_offset
Definition: detect.h:1323
DetectEngineThreadCtx_::global_keyword_ctxs_size
int global_keyword_ctxs_size
Definition: detect.h:1440
Signature_::dp
DetectPort * dp
Definition: detect.h:718
DetectEngineThreadCtx_::json_content
SigJsonContent * json_content
Definition: detect.h:1334
DetectEngineCtx_::mpm_hash_table
HashListTable * mpm_hash_table
Definition: detect.h:1002
DumpPatterns
void DumpPatterns(DetectEngineCtx *de_ctx)
Definition: detect-engine-analyzer.c:1613
DetectEngineThreadCtx_::replace
const Signature ** replace
Definition: detect.h:1398
Signature_::metadata
DetectMetadataHead * metadata
Definition: detect.h:742
DetectFirewallPolicy
Definition: detect.h:917
DetectEngineThreadCtx_::tv
ThreadVars * tv
Definition: detect.h:1303
DetectEngineThreadCtx_::byte_values_max
int32_t byte_values_max
Definition: detect.h:1409
MPMB_UDP_TC
@ MPMB_UDP_TC
Definition: detect.h:1592
Signature_::iid
SigIntId iid
Definition: detect.h:675
DetectBufferMpmRegistry_::id
int id
Definition: detect.h:769
SCRadix6Tree_
Structure for the radix tree.
Definition: util-radix6-tree.h:64
StatsCounterAvgId
Definition: counters.h:34
DetectVarList_::key
uint8_t * key
Definition: detect.h:834
DetectEngineThreadCtx_::keyword_ctxs_array
void ** keyword_ctxs_array
Definition: detect.h:1437
SigGroupHeadInitData_::post_rule_match_engines
PrefilterEngineList * post_rule_match_engines
Definition: detect.h:1723
SigFileLoaderStat_::good_sigs_total
int good_sigs_total
Definition: detect.h:881
DetectEngineAppInspectionEngine_::sub_state
uint8_t sub_state
Definition: detect.h:402
MpmConfig_
Definition: util-mpm.h:105
SigTableElmt_::SupportsPrefilter
bool(* SupportsPrefilter)(const Signature *s)
Definition: detect.h:1529
Signature_::addr_dst_match6
DetectMatchAddressIPv6 * addr_dst_match6
Definition: detect.h:709
DetectEngineMasterCtx_
Definition: detect.h:1771
Signature_::id
uint32_t id
Definition: detect.h:712
ENGINE_PROFILE_CUSTOM
@ ENGINE_PROFILE_CUSTOM
Definition: detect.h:1219
SignatureHook
struct SignatureHook_ SignatureHook
DetectBufferMpmRegistry_::PrefilterRegisterWithListId
int(* PrefilterRegisterWithListId)(struct DetectEngineCtx_ *de_ctx, struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx, const struct DetectBufferMpmRegistry_ *mpm_reg, int list_id)
Definition: detect.h:773
DetectEngineThreadKeywordCtxItem_::name
const char * name
Definition: detect.h:892
DetectEngineCtx_::guess_applayer_log_limit
uint8_t guess_applayer_log_limit
Definition: detect.h:1014
DetectEngineLookupFlow
struct DetectEngineLookupFlow_ DetectEngineLookupFlow
RuleMatchCandidateTx::stream_reset
uint32_t stream_reset
Definition: detect.h:1249
ENGINE_PROFILE_LOW
@ ENGINE_PROFILE_LOW
Definition: detect.h:1216
DisableDetectFlowFileFlags
void DisableDetectFlowFileFlags(Flow *f)
disable file features we don't need Called if we have no detection engine.
Definition: detect.c:3350
DetectBufferType_::transforms
DetectEngineTransforms transforms
Definition: detect.h:442
DetectEngineType
DetectEngineType
Definition: detect.h:902
DetectEngineThreadCtx_::fw_lte_cover
uint32_t fw_lte_cover[APP_LAYER_MAX_PROGRESS]
Definition: detect.h:1414
SignatureInitData_::score
int score
Definition: detect.h:631
SignatureInitDataBuffer_::id
uint32_t id
Definition: detect.h:505
Signature_
Signature container.
Definition: detect.h:663
SigMatch_
a single match condition for a signature
Definition: detect.h:331
DetectEngineCtx_::tenant_path
char * tenant_path
Definition: detect.h:1173
PrefilterEngineList_::pkt_mask
SignatureMask pkt_mask
Definition: detect.h:1629
DetectVarList_::pad
uint8_t pad[2]
Definition: detect.h:830
SCProfilePrefilterData_
Definition: util-profiling-prefilter.c:35
DetectEngineAppInspectionEngine_::transforms
const DetectEngineTransforms * transforms
Definition: detect.h:412
FILE_DECODER_EVENT_LZMA_MEMLIMIT_ERROR
@ FILE_DECODER_EVENT_LZMA_MEMLIMIT_ERROR
Definition: detect.h:1569
SigMatchCtx_::foo
int foo
Definition: detect.h:327
DetectBufferType_::parent_id
int parent_id
Definition: detect.h:429
DETECT_PREFILTER_MPM
@ DETECT_PREFILTER_MPM
Definition: detect.h:897
DetectBufferType_::run_always
bool run_always
Definition: detect.h:435
DetectBufferMpmRegistry_::alproto
AppProto alproto
Definition: detect.h:785
DetectAddress_::next
struct DetectAddress_ * next
Definition: detect.h:152
TransformIdData_::id_data
const uint8_t * id_data
Definition: detect.h:421
DetectEngineTenantMapping_::traffic_id
uint32_t traffic_id
Definition: detect.h:1766
SigGroupHeadInitData_::protos
uint8_t protos[256]
Definition: detect.h:1710
DetectMatchAddressIPv6_
Definition: detect.h:169
PostRuleMatchWorkQueueItem::value
uint32_t value
Definition: detect.h:1260
MPMB_TCP_PKT_TS
@ MPMB_TCP_PKT_TS
Definition: detect.h:1587
DetectMatchAddressIPv4_
Definition: detect.h:164
FILE_DECODER_EVENT_Z_STREAM_ERROR
@ FILE_DECODER_EVENT_Z_STREAM_ERROR
Definition: detect.h:1563
DetectEngineThreadCtx_::tx_id_set
bool tx_id_set
Definition: detect.h:1338
DetectEnginePktInspectionEngine
struct DetectEnginePktInspectionEngine DetectEnginePktInspectionEngine
DetectEngineThreadCtx_::base64_decoded
uint8_t * base64_decoded
Definition: detect.h:1386
Signature_::dsize_mode
uint8_t dsize_mode
Definition: detect.h:672
DetectEngineLookupFlow_
Definition: detect.h:862
SignatureInitData_::has_possible_prefilter
bool has_possible_prefilter
Definition: detect.h:593
SIGNATURE_HOOK_PKT_FLOW_START
@ SIGNATURE_HOOK_PKT_FLOW_START
Definition: detect.h:520
PrefilterEngine_::is_last
bool is_last
Definition: detect.h:1680
DetectEngineThreadCtx_::de_ctx
DetectEngineCtx * de_ctx
Definition: detect.h:1435
PrefilterEngine_::hook
uint8_t hook
Definition: detect.h:1669
DetectEngineCtx_::sig_array
Signature ** sig_array
Definition: detect.h:985
DETECT_FIREWALL_POLICY_PRE_FLOW
@ DETECT_FIREWALL_POLICY_PRE_FLOW
Definition: detect.h:911
PacketAlert_
Definition: decode.h:266
DetectEngineAppInspectionEngine_::dir
uint8_t dir
Definition: detect.h:393
DETECT_BUFFER_MPM_TYPE_SIZE
@ DETECT_BUFFER_MPM_TYPE_SIZE
Definition: detect.h:757
ADDRESS_ES
@ ADDRESS_ES
Definition: detect.h:128
DETECT_ENGINE_TYPE_MT_STUB
@ DETECT_ENGINE_TYPE_MT_STUB
Definition: detect.h:905
Signature_::detect_table
uint8_t detect_table
Definition: detect.h:697
PrefilterEngine_::run_always
bool run_always
Definition: detect.h:1686
SignatureInitDataBuffer_::only_tc
bool only_tc
Definition: detect.h:511
SignatureNonPrefilterStore_::mask
SignatureMask mask
Definition: detect.h:1234
DetectEngineCtx_::buffer_type_id
uint32_t buffer_type_id
Definition: detect.h:1122
Signature
struct Signature_ Signature
Signature container.
DetectEngineIPOnlyCtx_
IP only rules matching ctx.
Definition: detect.h:847
ENGINE_PROFILE_HIGH
@ ENGINE_PROFILE_HIGH
Definition: detect.h:1218
DetectEngineCtx_::sigerror
const char * sigerror
Definition: detect.h:1066
DetectEngineThreadCtx_::json_content_len
uint8_t json_content_len
Definition: detect.h:1336
DetectEngineThreadCtx_::mt_det_ctxs_cnt
uint32_t mt_det_ctxs_cnt
Definition: detect.h:1305
DetectMetadataHashInit
int DetectMetadataHashInit(DetectEngineCtx *de_ctx)
Definition: detect-metadata.c:68
DetectEngineMasterCtx_::lock
SCMutex lock
Definition: detect.h:1772
PrefilterEngine_::app
struct PrefilterEngine_::@104::@107 app
DetectEnginePktInspectionEngine::mpm
bool mpm
Definition: detect.h:465
DetectEngineCtx_::spm_global_thread_ctx
SpmGlobalThreadCtx * spm_global_thread_ctx
Definition: detect.h:1024
DetectFlowbitsAnalyze
int DetectFlowbitsAnalyze(DetectEngineCtx *de_ctx)
Definition: detect-flowbits.c:621
ByteVarSlot
struct ByteVarSlot_ ByteVarSlot
DetectEngineThreadCtx_::counter_match_list
StatsCounterAvgId counter_match_list
Definition: detect.h:1353
SigGroupHead_::pkt_engines
PrefilterEngine * pkt_engines
Definition: detect.h:1743
SignatureInitData_::rule_state_flowbits_ids_array
uint32_t * rule_state_flowbits_ids_array
Definition: detect.h:655
DetectEngineCtx_::flags
uint8_t flags
Definition: detect.h:968
SIG_PROP_FLOW_ACTION_FLOW
@ SIG_PROP_FLOW_ACTION_FLOW
Definition: detect.h:86
DetectEngineThreadCtx_::replist
DetectReplaceList * replist
Definition: detect.h:1423
DetectFirewallAppPolicy::alproto
AppProto alproto
Definition: detect.h:923
SignatureInitData_::transforms
DetectEngineTransforms transforms
Definition: detect.h:623
PrefilterEngine_::Prefilter
PrefilterPktFn Prefilter
Definition: detect.h:1693
DetectFirewallPolicies::app_policies
HashTable * app_policies
Definition: detect.h:939
SigString_::sig_str
char * sig_str
Definition: detect.h:870
DetectEngineCtx_::io_ctx
DetectEngineIPOnlyCtx io_ctx
Definition: detect.h:1008
PrefilterEngine_::PrefilterTx
PrefilterTxFn PrefilterTx
Definition: detect.h:1694
DetectMatchAddressIPv4
struct DetectMatchAddressIPv4_ DetectMatchAddressIPv4
DetectEngineCtx_::rule_line
int rule_line
Definition: detect.h:1064
MpmCtx_
Definition: util-mpm.h:111
Signature_::addr_dst_match4
DetectMatchAddressIPv4 * addr_dst_match4
Definition: detect.h:706
Signature_::msg
char * msg
Definition: detect.h:735
flow.h
SignatureInitDataBuffer_
Definition: detect.h:504
Signature_::addr_src_match4_cnt
uint16_t addr_src_match4_cnt
Definition: detect.h:689
DetectGetInnerTx
void * DetectGetInnerTx(void *tx_ptr, AppProto alproto, AppProto engine_alproto, uint8_t flow_flags)
Definition: detect.c:1315
DetectFirewallPolicy::action_scope
uint8_t action_scope
Definition: detect.h:919
DetectEngineAppInspectionEngine
struct DetectEngineAppInspectionEngine_ DetectEngineAppInspectionEngine
DetectEngineThreadCtx_::lua_transform_instruction_limit_errors
StatsCounterId lua_transform_instruction_limit_errors
Definition: detect.h:1465
TENANT_SELECTOR_LIVEDEV
@ TENANT_SELECTOR_LIVEDEV
Definition: detect.h:1758
SCDetectEngineRegisterRateFilterCallback
bool SCDetectEngineRegisterRateFilterCallback(SCDetectRateFilterFunc cb, void *arg)
Register a callback when a rate_filter has been applied to an alert.
Definition: detect-engine.c:5546
Signature_::addr_dst_match4_cnt
uint16_t addr_dst_match4_cnt
Definition: detect.h:688
DetectEngineFrameInspectionEngine::type
uint8_t type
Definition: detect.h:491
DetectEngineMasterCtx_::version
uint32_t version
Definition: detect.h:1778
DetectEngineCtx_::sig_array_len
uint32_t sig_array_len
Definition: detect.h:986
DetectEngineCtx_::metadata_table
HashTable * metadata_table
Definition: detect.h:1116
SigTableElmt_::Transform
void(* Transform)(DetectEngineThreadCtx *, InspectionBuffer *, const void *context)
Definition: detect.h:1520
Signature_::type
enum SignatureType type
Definition: detect.h:666
DetectEngineCtx_::signum
uint32_t signum
Definition: detect.h:988
FILE_DECODER_EVENT_LZMA_IO_ERROR
@ FILE_DECODER_EVENT_LZMA_IO_ERROR
Definition: detect.h:1566
DetectEngineCtx_::tenant_id
uint32_t tenant_id
Definition: detect.h:971
SigGroupHead_::filestore_cnt
uint16_t filestore_cnt
Definition: detect.h:1739
SignatureInitData_::buffer_index
uint32_t buffer_index
Definition: detect.h:643
IPOnlyCIDRItem_::signum
SigIntId signum
Definition: detect.h:316
SigFileLoaderStat_
Signature loader statistics.
Definition: detect.h:877
DetectFirewallAppPolicy::direction
uint8_t direction
Definition: detect.h:926
DetectAddress_::flags
uint8_t flags
Definition: detect.h:147
DetectEngineThreadCtx_::tx_data
struct AppLayerTxData * tx_data
Definition: detect.h:1380
DetectEngineCtx_::buffer_type_hash_id
HashListTable * buffer_type_hash_id
Definition: detect.h:1121
DetectEngineLookupFlow_::tcp
DetectPort * tcp
Definition: detect.h:863
FILE_DECODER_EVENT_LZMA_UNKNOWN_ERROR
@ FILE_DECODER_EVENT_LZMA_UNKNOWN_ERROR
Definition: detect.h:1571
SCMutex
#define SCMutex
Definition: threads-debug.h:114
DetectEngineCtx_::fp_support_smlist_list
SCFPSupportSMList * fp_support_smlist_list
Definition: detect.h:1147
SIG_TYPE_PDONLY
@ SIG_TYPE_PDONLY
Definition: detect.h:71
DetectEngineTransforms::cnt
uint8_t cnt
Definition: detect.h:368
InspectionBufferMultipleForList::inspection_buffers
InspectionBuffer * inspection_buffers
Definition: detect.h:355
MpmStore_::sgh_mpm_context
int32_t sgh_mpm_context
Definition: detect.h:1604
InspectionBufferMultipleForList::max
uint32_t max
Definition: detect.h:357
DetectAddressHead_::ipv4_head
DetectAddress * ipv4_head
Definition: detect.h:157
DetectEngineThreadCtx_::lua_blocked_function_errors
StatsCounterId lua_blocked_function_errors
Definition: detect.h:1450
SignatureProperties::flow_action
enum SignaturePropertyFlowAction flow_action
Definition: detect.h:91
SigGroupHead_::id
uint32_t id
Definition: detect.h:1741
IPOnlyCIDRItem_::family
uint8_t family
Definition: detect.h:309
DetectEngineThreadCtx_::prefilter_bytes
uint64_t prefilter_bytes
Definition: detect.h:1494
FILE_DECODER_EVENT_INVALID_SWF_LENGTH
@ FILE_DECODER_EVENT_INVALID_SWF_LENGTH
Definition: detect.h:1560
DetectEngineFrameInspectionEngine
struct DetectEngineFrameInspectionEngine DetectEngineFrameInspectionEngine
SigJsonContent::json_content
char json_content[SIG_JSON_CONTENT_ITEM_LEN]
Definition: detect.h:1281
SigJsonContent::id
void * id
Definition: detect.h:1280
SigMatchData
struct SigMatchData_ SigMatchData
Data needed for Match()
MpmStore_::buffer
enum MpmBuiltinBuffers buffer
Definition: detect.h:1602
DetectEngineThreadCtx_::post_rule_work_queue
PostRuleMatchWorkQueue post_rule_work_queue
Definition: detect.h:1418
DetectEngineThreadCtx_::tenant_array_size
uint32_t tenant_array_size
Definition: detect.h:1310
DetectEngineThreadCtx_::tenant_array
struct DetectEngineTenantMapping_ * tenant_array
Definition: detect.h:1309
DetectEngineCtx_::sc_sig_order_funcs
struct SCSigOrderFunc_ * sc_sig_order_funcs
Definition: detect.h:991
MpmCtxFactoryContainer_
Definition: util-mpm.h:148
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1534
DetectEngineThreadCtx_::file_id
uint32_t file_id
Definition: detect.h:1431
DetectPacketHookFunc
uint8_t(* DetectPacketHookFunc)(ThreadVars *tv, DetectEngineThreadCtx *det_ctx, Packet *p)
Definition: detect.h:953
SignatureMask
#define SignatureMask
Definition: decode.h:117
DetectEngineThreadCtx_::mt_det_ctxs
struct DetectEngineThreadCtx_ ** mt_det_ctxs
Definition: detect.h:1306
Signature_::mask
SignatureMask mask
Definition: detect.h:674
SignatureInitData_::alprotos
AppProto alprotos[SIG_ALPROTO_MAX]
Definition: detect.h:600
RuleMatchCandidateTx
Definition: detect.h:1239
DETECT_EVENT_POST_MATCH_QUEUE_FAILED
@ DETECT_EVENT_POST_MATCH_QUEUE_FAILED
Definition: detect.h:1574
SIG_TYPE_LIKE_IPONLY
@ SIG_TYPE_LIKE_IPONLY
Definition: detect.h:68
DetectEngineThreadCtx_::TenantGetId
uint32_t(* TenantGetId)(const void *, const Packet *p)
Definition: detect.h:1312
DetectEngineAppInspectionEngine_::progress
uint8_t progress
Definition: detect.h:401
f
Flow f
Definition: fuzz_dataset.c:32
DetectBufferType_::description
char description[128]
Definition: detect.h:427
PORT_GT
@ PORT_GT
Definition: detect.h:187
SigJsonContent
struct SigJsonContent SigJsonContent
ADDRESS_ER
@ ADDRESS_ER
Definition: detect.h:124
DetectEngineIPOnlyCtx_::max_idx
uint32_t max_idx
Definition: detect.h:854
SigGroupHeadInitData_::frame_mpms
MpmCtx ** frame_mpms
Definition: detect.h:1717
SpmThreadCtx_
Definition: util-spm.h:55
DetectEngineFrameInspectionEngine::smd
SigMatchData * smd
Definition: detect.h:500
ADDRESS_GT
@ ADDRESS_GT
Definition: detect.h:131
DetectEngineThreadCtx_::match_array
Signature ** match_array
Definition: detect.h:1395