You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
suricata/src/util-mpm-wumanber.h

77 lines
2.0 KiB
C

/* Copyright (c) 2008 Victor Julien <victor@inliniac.net> */
#ifndef __UTIL_MPM_WUMANBER_H__
#define __UTIL_MPM_WUMANBER_H__
#include "util-mpm.h"
17 years ago
#define WUMANBER_NOCASE 0x01
#define WUMANBER_SCAN 0x02
//#define WUMANBER_COUNTERS
typedef struct _WmPattern {
u_int8_t *cs; /* case sensitive */
u_int8_t *ci; /* case INsensitive */
u_int16_t len;
struct _WmPattern *next;
u_int16_t prefix_ci;
u_int16_t prefix_cs;
u_int8_t flags;
MpmEndMatch *em;
} WmPattern;
typedef struct _WmHashItem_ {
u_int8_t flags;
u_int16_t idx;
struct _WmHashItem_ *nxt;
} WmHashItem;
typedef struct _WmCtx {
/* hash used during ctx initialization */
WmPattern **init_hash;
17 years ago
u_int16_t scan_shiftlen;
u_int16_t search_shiftlen;
u_int32_t scan_hash_size;
WmHashItem **scan_hash;
WmHashItem scan_hash1[256];
u_int32_t search_hash_size;
WmHashItem **search_hash;
WmHashItem search_hash1[256];
17 years ago
/* we store our own multi byte scan ptr here for WmSearch1 */
u_int32_t (*MBScan)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
/* we store our own multi byte search ptr here for WmSearch1 */
17 years ago
u_int32_t (*MBSearch)(struct _MpmCtx *, struct _MpmThreadCtx *, PatternMatcherQueue *, u_int8_t *, u_int16_t);
/* pattern arrays */
WmPattern **parray;
/* only used for multibyte pattern search */
17 years ago
u_int16_t *scan_shifttable;
u_int16_t *search_shifttable;
} WmCtx;
typedef struct _WmThreadCtx {
17 years ago
#ifdef WUMANBER_COUNTERS
u_int32_t scan_stat_shift_null;
u_int32_t scan_stat_loop_match;
u_int32_t scan_stat_loop_no_match;
u_int32_t scan_stat_num_shift;
u_int32_t scan_stat_total_shift;
u_int32_t search_stat_shift_null;
u_int32_t search_stat_loop_match;
u_int32_t search_stat_loop_no_match;
u_int32_t search_stat_num_shift;
u_int32_t search_stat_total_shift;
#endif /* WUMANBER_COUNTERS */
} WmThreadCtx;
void MpmWuManberRegister(void);
#endif /* __UTIL_MPM_WUMANBER_H__ */