suricata
util-mpm-hs.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2016 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 Jim Xu <jim.xu@windriver.com>
22  * \author Justin Viiret <justin.viiret@intel.com>
23  *
24  * MPM pattern matcher that calls the Hyperscan regex matcher.
25  */
26 
27 #ifndef SURICATA_UTIL_MPM_HS__H
28 #define SURICATA_UTIL_MPM_HS__H
29 
30 typedef struct SCHSPattern_ {
31  /* length of the pattern */
32  uint16_t len;
33  /* flags describing the pattern */
34  uint8_t flags;
35  /* holds the original pattern that was added */
36  uint8_t *original_pat;
37  /* pattern id */
38  uint32_t id;
39 
40  uint16_t offset;
41  uint16_t depth;
42 
43  /* sid(s) for this pattern */
44  uint32_t sids_size;
46 
47  /* only used at ctx init time, when this structure is part of a hash
48  * table. */
49  struct SCHSPattern_ *next;
51 
52 typedef struct SCHSCtx_ {
53  /* hash used during ctx initialization */
55 
56  /* pattern database and pattern arrays. */
57  void *pattern_db;
58 
59  /* size of database, for accounting. */
60  size_t hs_db_size;
62 
63 typedef struct SCHSThreadCtx_ {
64  /* Hyperscan scratch space region for this thread, capable of handling any
65  * database that has been compiled. */
66  void *scratch;
67 
68  /* size of scratch space, for accounting. */
69  size_t scratch_size;
71 
72 void MpmHSRegister(void);
73 
74 void MpmHSGlobalCleanup(void);
75 
76 #endif /* SURICATA_UTIL_MPM_HS__H */
SCHSThreadCtx
struct SCHSThreadCtx_ SCHSThreadCtx
SCHSPattern_::depth
uint16_t depth
Definition: util-mpm-hs.h:41
SCHSPattern_::original_pat
uint8_t * original_pat
Definition: util-mpm-hs.h:36
SCHSPattern_::id
uint32_t id
Definition: util-mpm-hs.h:38
SCHSCtx_::init_hash
SCHSPattern ** init_hash
Definition: util-mpm-hs.h:54
SCHSPattern_::sids_size
uint32_t sids_size
Definition: util-mpm-hs.h:44
SCHSPattern
struct SCHSPattern_ SCHSPattern
SCHSCtx_::pattern_db
void * pattern_db
Definition: util-mpm-hs.h:57
SCHSCtx_
Definition: util-mpm-hs.h:52
SCHSPattern_::sids
SigIntId * sids
Definition: util-mpm-hs.h:45
SCHSPattern_::flags
uint8_t flags
Definition: util-mpm-hs.h:34
SCHSThreadCtx_::scratch_size
size_t scratch_size
Definition: util-mpm-hs.h:69
SCHSPattern_::offset
uint16_t offset
Definition: util-mpm-hs.h:40
SCHSCtx_::hs_db_size
size_t hs_db_size
Definition: util-mpm-hs.h:60
SCHSThreadCtx_::scratch
void * scratch
Definition: util-mpm-hs.h:66
SCHSPattern_
Definition: util-mpm-hs.h:30
SCHSThreadCtx_
Definition: util-mpm-hs.h:63
SCHSCtx
struct SCHSCtx_ SCHSCtx
SCHSPattern_::len
uint16_t len
Definition: util-mpm-hs.h:32
SigIntId
#define SigIntId
Definition: suricata-common.h:315
MpmHSRegister
void MpmHSRegister(void)
SCHSPattern_::next
struct SCHSPattern_ * next
Definition: util-mpm-hs.h:49
MpmHSGlobalCleanup
void MpmHSGlobalCleanup(void)