diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:39:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:39:49 +0000 |
commit | a0aa2307322cd47bbf416810ac0292925e03be87 (patch) | |
tree | 37076262a026c4b48c8a0e84f44ff9187556ca35 /src/util-mpm-ac-bs.h | |
parent | Initial commit. (diff) | |
download | suricata-a0aa2307322cd47bbf416810ac0292925e03be87.tar.xz suricata-a0aa2307322cd47bbf416810ac0292925e03be87.zip |
Adding upstream version 1:7.0.3.upstream/1%7.0.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/util-mpm-ac-bs.h')
-rw-r--r-- | src/util-mpm-ac-bs.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/util-mpm-ac-bs.h b/src/util-mpm-ac-bs.h new file mode 100644 index 0000000..80ac0f4 --- /dev/null +++ b/src/util-mpm-ac-bs.h @@ -0,0 +1,81 @@ +/* Copyright (C) 2007-2014 Open Information Security Foundation + * + * You can copy, redistribute or modify this Program under the terms of + * the GNU General Public License version 2 as published by the Free + * Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +/** + * \file + * + * \author Anoop Saldanha <anoopsaldanha@gmail.com> + * + */ + +#include "util-mpm.h" + +#define SC_AC_BS_STATE_TYPE_U16 uint16_t +#define SC_AC_BS_STATE_TYPE_U32 uint32_t + +typedef struct SCACBSPatternList_ { + uint8_t *cs; + uint16_t patlen; + + /* sid(s) for this pattern */ + uint32_t sids_size; + SigIntId *sids; +} SCACBSPatternList; + +typedef struct SCACBSOutputTable_ { + /* list of pattern sids */ + uint32_t *pids; + /* no of entries we have in pids */ + uint32_t no_of_entries; +} SCACBSOutputTable; + +typedef struct SCACBSCtx_ { + /* pattern arrays. We need this only during the goto table creation phase */ + MpmPattern **parray; + + /* no of states used by ac */ + uint32_t state_count; + + uint32_t pattern_id_bitarray_size; + + /* the all important memory hungry state_table */ + SC_AC_BS_STATE_TYPE_U16 (*state_table_u16)[256]; + /* the all important memory hungry state_table */ + SC_AC_BS_STATE_TYPE_U32 (*state_table_u32)[256]; + /* the modified goto_table */ + uint8_t *state_table_mod; + uint8_t **state_table_mod_pointers; + + /* goto_table, failure table and output table. Needed to create state_table. + * Will be freed, once we have created the state_table */ + int32_t (*goto_table)[256]; + int32_t *failure_table; + SCACBSOutputTable *output_table; + SCACBSPatternList *pid_pat_list; + + /* the size of each state */ + uint16_t single_state_size; +} SCACBSCtx; + +typedef struct SCACBSThreadCtx_ { + /* the total calls we make to the search function */ + uint32_t total_calls; + /* the total patterns that we ended up matching against */ + uint64_t total_matches; +} SCACBSThreadCtx; + +void MpmACBSRegister(void); |