suricata
util-mpm-ac.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2014 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 Anoop Saldanha <anoopsaldanha@gmail.com>
22  *
23  */
24 
25 #ifndef __UTIL_MPM_AC__H__
26 #define __UTIL_MPM_AC__H__
27 
28 #define SC_AC_STATE_TYPE_U16 uint16_t
29 #define SC_AC_STATE_TYPE_U32 uint32_t
30 
31 typedef struct SCACPatternList_ {
32  uint8_t *cs;
33  uint16_t patlen;
34 
35  uint16_t offset;
36  uint16_t depth;
37 
38  /* sid(s) for this pattern */
39  uint32_t sids_size;
42 
43 typedef struct SCACOutputTable_ {
44  /* list of pattern sids */
45  uint32_t *pids;
46  /* no of entries we have in pids */
47  uint32_t no_of_entries;
49 
50 typedef struct SCACCtx_ {
51  /* pattern arrays. We need this only during the goto table creation phase */
53 
54  /* no of states used by ac */
55  uint32_t state_count;
56 
58 
59  /* the all important memory hungry state_table */
61  /* the all important memory hungry state_table */
63 
64  /* goto_table, failure table and output table. Needed to create state_table.
65  * Will be freed, once we have created the state_table */
66  int32_t (*goto_table)[256];
67  int32_t *failure_table;
70 
71  /* the size of each state */
73 
75 
76 } SCACCtx;
77 
78 typedef struct SCACThreadCtx_ {
79  /* the total calls we make to the search function */
80  uint32_t total_calls;
81  /* the total patterns that we ended up matching against */
82  uint64_t total_matches;
84 
85 void MpmACRegister(void);
86 
87 #endif /* __UTIL_MPM_AC__H__ */
SCACOutputTable_::no_of_entries
uint32_t no_of_entries
Definition: util-mpm-ac.h:47
SCACThreadCtx_
Definition: util-mpm-ac.h:78
SCACCtx_::parray
MpmPattern ** parray
Definition: util-mpm-ac.h:52
SCACCtx_::allocated_state_count
uint32_t allocated_state_count
Definition: util-mpm-ac.h:74
SCACPatternList_::patlen
uint16_t patlen
Definition: util-mpm-ac.h:33
SCACCtx_::pid_pat_list
SCACPatternList * pid_pat_list
Definition: util-mpm-ac.h:69
SCACCtx_::failure_table
int32_t * failure_table
Definition: util-mpm-ac.h:67
SC_AC_STATE_TYPE_U32
#define SC_AC_STATE_TYPE_U32
Definition: util-mpm-ac.h:29
SCACPatternList
struct SCACPatternList_ SCACPatternList
SCACCtx_::state_count
uint32_t state_count
Definition: util-mpm-ac.h:55
SC_AC_STATE_TYPE_U16
#define SC_AC_STATE_TYPE_U16
Definition: util-mpm-ac.h:28
SCACThreadCtx_::total_matches
uint64_t total_matches
Definition: util-mpm-ac.h:82
SCACOutputTable
struct SCACOutputTable_ SCACOutputTable
SCACThreadCtx
struct SCACThreadCtx_ SCACThreadCtx
SCACPatternList_::cs
uint8_t * cs
Definition: util-mpm-ac.h:32
SCACCtx_::output_table
SCACOutputTable * output_table
Definition: util-mpm-ac.h:68
SCACPatternList_::sids
SigIntId * sids
Definition: util-mpm-ac.h:40
MpmACRegister
void MpmACRegister(void)
Register the aho-corasick mpm.
Definition: util-mpm-ac.c:1239
MpmPattern_
Definition: util-mpm.h:54
SCACCtx_::pattern_id_bitarray_size
uint32_t pattern_id_bitarray_size
Definition: util-mpm-ac.h:57
SCACPatternList_::depth
uint16_t depth
Definition: util-mpm-ac.h:36
SCACPatternList_::offset
uint16_t offset
Definition: util-mpm-ac.h:35
SCACThreadCtx_::total_calls
uint32_t total_calls
Definition: util-mpm-ac.h:80
SCACCtx_
Definition: util-mpm-ac.h:50
SCACPatternList_
Definition: util-mpm-ac.h:31
SCACCtx
struct SCACCtx_ SCACCtx
SCACOutputTable_
Definition: util-mpm-ac.h:43
SCACCtx_::state_table_u16
SC_AC_STATE_TYPE_U16(* state_table_u16)[256]
Definition: util-mpm-ac.h:60
SCACOutputTable_::pids
uint32_t * pids
Definition: util-mpm-ac.h:45
SCACCtx_::goto_table
int32_t(* goto_table)[256]
Definition: util-mpm-ac.h:66
SigIntId
#define SigIntId
Definition: suricata-common.h:280
SCACCtx_::single_state_size
uint32_t single_state_size
Definition: util-mpm-ac.h:72
SCACPatternList_::sids_size
uint32_t sids_size
Definition: util-mpm-ac.h:39
SCACCtx_::state_table_u32
SC_AC_STATE_TYPE_U32(* state_table_u32)[256]
Definition: util-mpm-ac.h:62