suricata
detect-lua.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2022 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 Victor Julien <victor@inliniac.net>
22  */
23 
24 #ifndef SURICATA_DETECT_LUA_H
25 #define SURICATA_DETECT_LUA_H
26 
27 #include "util-lua.h"
28 #include "util-lua-sandbox.h"
29 
30 typedef struct DetectLuaThreadData {
32  uint32_t flags;
34 
35 #define DETECT_LUA_MAX_FLOWVARS 15
36 #define DETECT_LUA_MAX_FLOWINTS 15
37 #define DETECT_LUA_MAX_BYTEVARS 15
38 
39 typedef struct DetectLuaData {
41  int negated;
42  char *filename;
43  uint32_t flags;
44  char *buffername; /* buffer name in case of a single buffer */
46  uint16_t flowints;
47  uint16_t flowvars;
49  uint16_t bytevars;
51  uint64_t alloc_limit;
55 
56 /* prototypes */
57 void DetectLuaRegister (void);
59  const Signature *s, const SigMatchData *smd,
60  const uint8_t *buffer, uint32_t buffer_len, uint32_t offset,
61  Flow *f);
62 
63 void LuaDumpStack(lua_State *state, const char *prefix);
64 
65 #endif /* SURICATA_DETECT_LUA_H */
DetectLuaData::bytevars
uint16_t bytevars
Definition: detect-lua.h:49
DetectLuaData
Definition: detect-lua.h:39
offset
uint64_t offset
Definition: util-streaming-buffer.h:0
DetectLuaData::flags
uint32_t flags
Definition: detect-lua.h:43
util-lua.h
Flow_
Flow data structure.
Definition: flow.h:356
DetectLuaData::allow_restricted_functions
int allow_restricted_functions
Definition: detect-lua.h:53
DETECT_LUA_MAX_FLOWVARS
#define DETECT_LUA_MAX_FLOWVARS
Definition: detect-lua.h:35
DetectLuaData
struct DetectLuaData DetectLuaData
DetectLuaData::flowvar
uint32_t flowvar[DETECT_LUA_MAX_FLOWVARS]
Definition: detect-lua.h:48
SigMatchData_
Data needed for Match()
Definition: detect.h:365
DetectLuaThreadData::flags
uint32_t flags
Definition: detect-lua.h:32
DetectLuaThreadData::luastate
lua_State * luastate
Definition: detect-lua.h:31
lua_State
struct lua_State lua_State
Definition: suricata-common.h:515
DetectLuaMatchBuffer
int DetectLuaMatchBuffer(DetectEngineThreadCtx *det_ctx, const Signature *s, const SigMatchData *smd, const uint8_t *buffer, uint32_t buffer_len, uint32_t offset, Flow *f)
Definition: detect-lua.c:253
DetectLuaData::buffername
char * buffername
Definition: detect-lua.h:44
DetectLuaData::negated
int negated
Definition: detect-lua.h:41
DetectEngineThreadCtx_
Definition: detect.h:1197
DetectLuaData::thread_ctx_id
int thread_ctx_id
Definition: detect-lua.h:40
DetectLuaData::instruction_limit
uint64_t instruction_limit
Definition: detect-lua.h:52
DETECT_LUA_MAX_BYTEVARS
#define DETECT_LUA_MAX_BYTEVARS
Definition: detect-lua.h:37
DETECT_LUA_MAX_FLOWINTS
#define DETECT_LUA_MAX_FLOWINTS
Definition: detect-lua.h:36
DetectLuaData::bytevar
uint32_t bytevar[DETECT_LUA_MAX_BYTEVARS]
Definition: detect-lua.h:50
DetectLuaData::alloc_limit
uint64_t alloc_limit
Definition: detect-lua.h:51
DetectLuaData::flowints
uint16_t flowints
Definition: detect-lua.h:46
DetectLuaData::flowint
uint32_t flowint[DETECT_LUA_MAX_FLOWINTS]
Definition: detect-lua.h:45
DetectLuaThreadData
Definition: detect-lua.h:30
util-lua-sandbox.h
LuaDumpStack
void LuaDumpStack(lua_State *state, const char *prefix)
dump stack from lua state to screen
Definition: detect-lua.c:115
DetectLuaData::flowvars
uint16_t flowvars
Definition: detect-lua.h:47
Signature_
Signature container.
Definition: detect.h:669
DetectLuaThreadData
struct DetectLuaThreadData DetectLuaThreadData
DetectLuaData::filename
char * filename
Definition: detect-lua.h:42
DetectLuaRegister
void DetectLuaRegister(void)
Registration function for keyword: lua.
Definition: detect-lua.c:79