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