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
33typedef struct SCACPatternList_ {
34 uint8_t *cs;
35 uint16_t patlen;
36
37 uint16_t offset;
38 uint16_t depth;
39
41
42 /* sid(s) for this pattern */
43 uint32_t sids_size;
46
47typedef 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
54typedef 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
82void MpmACRegister(void);
83
84#endif /* SURICATA_UTIL_MPM_AC__H */
uint32_t pattern_id_bitarray_size
Definition util-mpm-ac.h:61
uint32_t single_state_size
Definition util-mpm-ac.h:76
int32_t(* goto_table)[256]
Definition util-mpm-ac.h:70
uint32_t allocated_state_count
Definition util-mpm-ac.h:78
MpmPattern ** parray
Definition util-mpm-ac.h:56
SC_AC_STATE_TYPE_U16(* state_table_u16)[256]
Definition util-mpm-ac.h:64
SCACPatternList * pid_pat_list
Definition util-mpm-ac.h:73
int32_t * failure_table
Definition util-mpm-ac.h:71
uint32_t state_count
Definition util-mpm-ac.h:59
SCACOutputTable * output_table
Definition util-mpm-ac.h:72
SC_AC_STATE_TYPE_U32(* state_table_u32)[256]
Definition util-mpm-ac.h:66
uint32_t no_of_entries
Definition util-mpm-ac.h:51
uint32_t * pids
Definition util-mpm-ac.h:49
uint32_t sids_size
Definition util-mpm-ac.h:43
SigIntId * sids
Definition util-mpm-ac.h:44
#define SigIntId
struct SCACPatternList_ SCACPatternList
struct SCACCtx_ SCACCtx
#define SC_AC_STATE_TYPE_U32
Definition util-mpm-ac.h:31
void MpmACRegister(void)
Register the aho-corasick mpm.
struct SCACOutputTable_ SCACOutputTable
#define SC_AC_STATE_TYPE_U16
Definition util-mpm-ac.h:30