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 
40  char *name;
41  uint32_t id;
43 
44 typedef struct DetectLuaData {
46  int negated;
47  char *filename;
48  uint32_t flags;
49  char *buffername; /* buffer name in case of a single buffer */
51  uint16_t flowints;
52  uint16_t flowvars;
54  uint16_t bytevars;
56  uint64_t alloc_limit;
60 
61 /* prototypes */
62 void DetectLuaRegister (void);
64  const Signature *s, const SigMatchData *smd,
65  const uint8_t *buffer, uint32_t buffer_len, uint32_t offset,
66  Flow *f);
67 
68 void LuaDumpStack(lua_State *state, const char *prefix);
69 
70 #endif /* SURICATA_DETECT_LUA_H */
DetectLuaData::bytevars
uint16_t bytevars
Definition: detect-lua.h:54
DetectLuaData
Definition: detect-lua.h:44
offset
uint64_t offset
Definition: util-streaming-buffer.h:0
DetectLuaDataBytevarEntry_::name
char * name
Definition: detect-lua.h:40
DetectLuaData::flags
uint32_t flags
Definition: detect-lua.h:48
util-lua.h
DetectLuaDataBytevarEntry_
Definition: detect-lua.h:39
Flow_
Flow data structure.
Definition: flow.h:356
DetectLuaData::allow_restricted_functions
int allow_restricted_functions
Definition: detect-lua.h:58
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:53
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:523
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:272
DetectLuaData::buffername
char * buffername
Definition: detect-lua.h:49
DetectLuaData::negated
int negated
Definition: detect-lua.h:46
DetectLuaDataBytevarEntry
struct DetectLuaDataBytevarEntry_ DetectLuaDataBytevarEntry
DetectEngineThreadCtx_
Definition: detect.h:1244
DetectLuaData::thread_ctx_id
int thread_ctx_id
Definition: detect-lua.h:45
DetectLuaData::instruction_limit
uint64_t instruction_limit
Definition: detect-lua.h:57
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
DetectLuaDataBytevarEntry bytevar[DETECT_LUA_MAX_BYTEVARS]
Definition: detect-lua.h:55
DetectLuaData::alloc_limit
uint64_t alloc_limit
Definition: detect-lua.h:56
DetectLuaData::flowints
uint16_t flowints
Definition: detect-lua.h:51
DetectLuaData::flowint
uint32_t flowint[DETECT_LUA_MAX_FLOWINTS]
Definition: detect-lua.h:50
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:127
DetectLuaData::flowvars
uint16_t flowvars
Definition: detect-lua.h:52
Signature_
Signature container.
Definition: detect.h:668
DetectLuaThreadData
struct DetectLuaThreadData DetectLuaThreadData
DetectLuaDataBytevarEntry_::id
uint32_t id
Definition: detect-lua.h:41
DetectLuaData::filename
char * filename
Definition: detect-lua.h:47
DetectLuaRegister
void DetectLuaRegister(void)
Registration function for keyword: lua.
Definition: detect-lua.c:83