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