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