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 __UTIL_MPM_HS__H__
28 #define __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;
50 } SCHSPattern;
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;
61 } SCHSCtx;
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 /* __UTIL_MPM_HS__H__ */
size_t scratch_size
Definition: util-mpm-hs.h:69
size_t hs_db_size
Definition: util-mpm-hs.h:60
uint16_t len
Definition: util-mpm-hs.h:32
uint16_t offset
Definition: util-mpm-hs.h:40
void * scratch
Definition: util-mpm-hs.h:66
uint8_t * original_pat
Definition: util-mpm-hs.h:36
void MpmHSGlobalCleanup(void)
uint16_t depth
Definition: util-mpm-hs.h:41
struct SCHSThreadCtx_ SCHSThreadCtx
struct SCHSPattern_ * next
Definition: util-mpm-hs.h:49
struct SCHSPattern_ SCHSPattern
SCHSPattern ** init_hash
Definition: util-mpm-hs.h:54
struct SCHSCtx_ SCHSCtx
uint32_t id
Definition: util-mpm-hs.h:38
void MpmHSRegister(void)
void * pattern_db
Definition: util-mpm-hs.h:57
SigIntId * sids
Definition: util-mpm-hs.h:45
uint32_t sids_size
Definition: util-mpm-hs.h:44
uint8_t flags
Definition: util-mpm-hs.h:34
#define SigIntId