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 SURICATA_UTIL_MPM_AC__H
26 #define SURICATA_UTIL_MPM_AC__H
27 
28 #include "util-mpm.h"
29 
30 #define SC_AC_STATE_TYPE_U16 uint16_t
31 #define SC_AC_STATE_TYPE_U32 uint32_t
32 
33 typedef struct SCACPatternList_ {
34  uint8_t *cs;
35  uint16_t patlen;
36 
37  uint16_t offset;
38  uint16_t depth;
39 
40  bool endswith;
41 
42  /* sid(s) for this pattern */
43  uint32_t sids_size;
46 
47 typedef struct SCACOutputTable_ {
48  /* list of pattern sids */
49  uint32_t *pids;
50  /* no of entries we have in pids */
51  uint32_t no_of_entries;
53 
54 typedef struct SCACCtx_ {
55  /* pattern arrays. We need this only during the goto table creation phase */
57 
58  /* no of states used by ac */
59  uint32_t state_count;
60 
62 
63  /* the all important memory hungry state_table */
65  /* the all important memory hungry state_table */
67 
68  /* goto_table, failure table and output table. Needed to create state_table.
69  * Will be freed, once we have created the state_table */
70  int32_t (*goto_table)[256];
71  int32_t *failure_table;
74 
75  /* the size of each state */
77 
79 
81 
82 void MpmACRegister(void);
83 
84 #endif /* SURICATA_UTIL_MPM_AC__H */
SCACOutputTable_::no_of_entries
uint32_t no_of_entries
Definition: util-mpm-ac.h:51
SCACCtx_::parray
MpmPattern ** parray
Definition: util-mpm-ac.h:56
SCACCtx_::allocated_state_count
uint32_t allocated_state_count
Definition: util-mpm-ac.h:78
SCACPatternList_::patlen
uint16_t patlen
Definition: util-mpm-ac.h:35
SCACCtx_::pid_pat_list
SCACPatternList * pid_pat_list
Definition: util-mpm-ac.h:73
SCACCtx_::failure_table
int32_t * failure_table
Definition: util-mpm-ac.h:71
SC_AC_STATE_TYPE_U32
#define SC_AC_STATE_TYPE_U32
Definition: util-mpm-ac.h:31
SCACPatternList
struct SCACPatternList_ SCACPatternList
SCACCtx_::state_count
uint32_t state_count
Definition: util-mpm-ac.h:59
SC_AC_STATE_TYPE_U16
#define SC_AC_STATE_TYPE_U16
Definition: util-mpm-ac.h:30
SCACOutputTable
struct SCACOutputTable_ SCACOutputTable
SCACPatternList_::endswith
bool endswith
Definition: util-mpm-ac.h:40
SCACPatternList_::cs
uint8_t * cs
Definition: util-mpm-ac.h:34
SCACCtx_::output_table
SCACOutputTable * output_table
Definition: util-mpm-ac.h:72
SCACPatternList_::sids
SigIntId * sids
Definition: util-mpm-ac.h:44
MpmACRegister
void MpmACRegister(void)
Register the aho-corasick mpm.
Definition: util-mpm-ac.c:1097
MpmPattern_
Definition: util-mpm.h:54
SCACCtx_::pattern_id_bitarray_size
uint32_t pattern_id_bitarray_size
Definition: util-mpm-ac.h:61
SCACPatternList_::depth
uint16_t depth
Definition: util-mpm-ac.h:38
SCACPatternList_::offset
uint16_t offset
Definition: util-mpm-ac.h:37
SCACCtx_
Definition: util-mpm-ac.h:54
util-mpm.h
SCACPatternList_
Definition: util-mpm-ac.h:33
SCACCtx
struct SCACCtx_ SCACCtx
SCACOutputTable_
Definition: util-mpm-ac.h:47
SCACCtx_::state_table_u16
SC_AC_STATE_TYPE_U16(* state_table_u16)[256]
Definition: util-mpm-ac.h:64
SCACOutputTable_::pids
uint32_t * pids
Definition: util-mpm-ac.h:49
SCACCtx_::goto_table
int32_t(* goto_table)[256]
Definition: util-mpm-ac.h:70
SigIntId
#define SigIntId
Definition: suricata-common.h:315
SCACCtx_::single_state_size
uint32_t single_state_size
Definition: util-mpm-ac.h:76
SCACPatternList_::sids_size
uint32_t sids_size
Definition: util-mpm-ac.h:43
SCACCtx_::state_table_u32
SC_AC_STATE_TYPE_U32(* state_table_u32)[256]
Definition: util-mpm-ac.h:66