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 #ifdef HAVE_LUA
28 
29 #include "util-lua.h"
30 
31 typedef struct DetectLuaThreadData {
32  lua_State *luastate;
33  uint32_t flags;
34  int alproto;
35 } DetectLuaThreadData;
36 
37 #define DETECT_LUAJIT_MAX_FLOWVARS 15
38 #define DETECT_LUAJIT_MAX_FLOWINTS 15
39 #define DETECT_LUAJIT_MAX_BYTEVARS 15
40 
41 typedef struct DetectLuaData {
42  int thread_ctx_id;
43  int negated;
44  char *filename;
45  uint32_t flags;
46  AppProto alproto;
47  char *buffername; /* buffer name in case of a single buffer */
48  uint32_t flowint[DETECT_LUAJIT_MAX_FLOWINTS];
49  uint16_t flowints;
50  uint16_t flowvars;
51  uint32_t flowvar[DETECT_LUAJIT_MAX_FLOWVARS];
52  uint16_t bytevars;
53  uint32_t bytevar[DETECT_LUAJIT_MAX_BYTEVARS];
54  uint32_t sid;
55  uint32_t rev;
56  uint32_t gid;
57 } DetectLuaData;
58 
59 #endif /* HAVE_LUA */
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 
69 
70 #endif /* SURICATA_DETECT_LUA_H */
offset
uint64_t offset
Definition: util-streaming-buffer.h:0
util-lua.h
AppProto
uint16_t AppProto
Definition: app-layer-protos.h:81
Flow_
Flow data structure.
Definition: flow.h:351
DetectLuaPostSetup
void DetectLuaPostSetup(Signature *s)
SigMatchData_
Data needed for Match()
Definition: detect.h:359
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)
DetectEngineThreadCtx_
Definition: detect.h:1095
flags
uint8_t flags
Definition: decode-gre.h:0
lua_State
void lua_State
Definition: suricata-common.h:500
Signature_
Signature container.
Definition: detect.h:596
DetectLuaRegister
void DetectLuaRegister(void)
Registration function for keyword: lua.
Definition: detect-lua.c:77