suricata
detect-lua-extensions.c
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  * Functions to expose to the lua scripts.
24  */
25 
26 #include "suricata-common.h"
27 
28 #include "decode.h"
29 #include "detect.h"
30 
31 #include "flow.h"
32 #include "flow-var.h"
33 
34 #include "util-debug.h"
35 
36 #include "detect-lua.h"
37 
38 #include "app-layer-parser.h"
39 
40 #include "util-lua.h"
41 #include "util-lua-common.h"
42 #include "util-lua-http.h"
43 #include "util-lua-dns.h"
44 #include "util-lua-ja3.h"
45 #include "util-lua-tls.h"
46 #include "util-lua-ssh.h"
47 #include "util-lua-hassh.h"
48 #include "util-lua-smtp.h"
49 #include "util-lua-dnp3.h"
50 #include "detect-lua-extensions.h"
51 
52 static const char luaext_key_ld[] = "suricata:luadata";
53 
54 static int GetLuaData(lua_State *luastate, DetectLuaData **ret_ld)
55 {
56  *ret_ld = NULL;
57 
58  DetectLuaData *ld;
59  lua_pushlightuserdata(luastate, (void *)&luaext_key_ld);
60  lua_gettable(luastate, LUA_REGISTRYINDEX);
61  ld = lua_touserdata(luastate, -1);
62  if (ld == NULL) {
63  LUA_ERROR("internal error: no ld");
64  }
65  *ret_ld = ld;
66  return 0;
67 }
68 
69 static int GetFlow(lua_State *luastate, Flow **ret_f)
70 {
71  Flow *f = LuaStateGetFlow(luastate);
72  if (f == NULL) {
73  LUA_ERROR("no flow");
74  }
75  *ret_f = f;
76  return 0;
77 }
78 
79 static int GetFlowVarById(lua_State *luastate, Flow *f,
80  FlowVar **ret_fv, bool fv_may_be_null, uint32_t *ret_idx)
81 {
82  DetectLuaData *ld = NULL;
83  if (ret_idx)
84  *ret_idx = 0;
85  *ret_fv = NULL;
86 
87  /* need lua data for id -> idx conversion */
88  int ret = GetLuaData(luastate, &ld);
89  if (ret != 0)
90  return ret;
91 
92  if (!lua_isnumber(luastate, 1)) {
93  LUA_ERROR("flowvar id not a number");
94  }
95  int id = lua_tonumber(luastate, 1);
96  if (id < 0 || id >= DETECT_LUA_MAX_FLOWVARS) {
97  LUA_ERROR("flowvar id out of range");
98  }
99  uint32_t idx = ld->flowvar[id];
100  if (idx == 0) {
101  LUA_ERROR("flowvar id uninitialized");
102  }
103  FlowVar *fv = FlowVarGet(f, idx);
104  if (!fv_may_be_null && fv == NULL) {
105  LUA_ERROR("no flow var");
106  }
107  *ret_fv = fv;
108  if (ret_idx)
109  *ret_idx = idx;
110  return 0;
111 }
112 
113 static int GetFlowVarByKey(lua_State *luastate, Flow *f, FlowVar **ret_fv)
114 {
115  *ret_fv = NULL;
116 
117  if (!lua_isstring(luastate, 1)) {
118  LUA_ERROR("flowvar key not a string");
119  }
120  const char *keystr = lua_tostring(luastate, 1);
121  if (keystr == NULL) {
122  LUA_ERROR("key is null");
123  }
124  if (!lua_isnumber(luastate, 2)) {
125  LUA_ERROR("key length not specified");
126  }
127  int keylen = lua_tonumber(luastate, 2);
128  if (keylen < 0 || keylen > 0xff) {
129  LUA_ERROR("key len out of range: max 256");
130  }
131 
132  FlowVar *fv = FlowVarGetByKey(f, (const uint8_t *)keystr, (uint16_t)keylen);
133  if (fv == NULL) {
134  LUA_ERROR("no flow var");
135  }
136  *ret_fv = fv;
137  return 0;
138 }
139 
140 static int GetFlowIntById(lua_State *luastate, Flow *f,
141  FlowVar **ret_fv, bool fv_may_be_null, uint32_t *ret_idx)
142 {
143  DetectLuaData *ld = NULL;
144  if (ret_idx)
145  *ret_idx = 0;
146  *ret_fv = NULL;
147 
148  /* need lua data for id -> idx conversion */
149  int ret = GetLuaData(luastate, &ld);
150  if (ret != 0)
151  return ret;
152 
153  if (!lua_isnumber(luastate, 1)) {
154  LUA_ERROR("flowvar id not a number");
155  }
156  int id = lua_tonumber(luastate, 1);
157  if (id < 0 || id >= DETECT_LUA_MAX_FLOWVARS) {
158  LUA_ERROR("flowvar id out of range");
159  }
160  uint32_t idx = ld->flowint[id];
161  if (idx == 0) {
162  LUA_ERROR("flowvar id uninitialized");
163  }
164  FlowVar *fv = FlowVarGet(f, idx);
165  if (!fv_may_be_null && fv == NULL) {
166  LUA_ERROR("no flow var");
167  }
168  *ret_fv = fv;
169  if (ret_idx)
170  *ret_idx = idx;
171  return 0;
172 }
173 
174 static int LuaGetFlowvar(lua_State *luastate)
175 {
176  Flow *f;
177  FlowVar *fv;
178  int ret;
179 
180  /* need flow */
181  ret = GetFlow(luastate, &f);
182  if (ret != 0)
183  return ret;
184 
185  if (lua_isnumber(luastate, 1)) {
186  ret = GetFlowVarById(luastate, f, &fv, false, NULL);
187  if (ret != 0 || fv == NULL)
188  return ret;
189  } else if (lua_isstring(luastate, 1)) {
190  ret = GetFlowVarByKey(luastate, f, &fv);
191  if (ret != 0 || fv == NULL)
192  return ret;
193  } else {
194  LUA_ERROR("invalid data type as first argument");
195  }
196 
197  LuaPushStringBuffer(luastate,
198  (const uint8_t *)fv->data.fv_str.value,
199  (size_t)fv->data.fv_str.value_len);
200  return 1;
201 }
202 
203 static int LuaSetFlowvarById(lua_State *luastate)
204 {
205  uint32_t idx = 0;
206  Flow *f;
207  const char *str;
208  int len;
209  uint8_t *buffer;
210  FlowVar *fv = NULL;
211 
212  /* need flow */
213  int ret = GetFlow(luastate, &f);
214  if (ret != 0)
215  return ret;
216 
217  ret = GetFlowVarById(luastate, f, &fv, true, &idx);
218  if (ret != 0)
219  return ret;
220 
221  if (!lua_isstring(luastate, 2)) {
222  LUA_ERROR("buffer not a string");
223  }
224  str = lua_tostring(luastate, 2);
225  if (str == NULL) {
226  LUA_ERROR("buffer is null");
227  }
228 
229  if (!lua_isnumber(luastate, 3)) {
230  LUA_ERROR("buffer length not specified");
231  }
232  len = lua_tonumber(luastate, 3);
233  if (len < 0 || len > 0xffff) {
234  LUA_ERROR("len out of range: max 64k");
235  }
236 
237  buffer = SCMalloc(len+1);
238  if (unlikely(buffer == NULL)) {
239  LUA_ERROR("out of memory");
240  }
241  memcpy(buffer, str, len);
242  buffer[len] = '\0';
243 
244  FlowVarAddIdValue(f, idx, buffer, (uint16_t)len);
245  return 0;
246 }
247 
248 static int LuaSetFlowvarByKey(lua_State *luastate)
249 {
250  Flow *f;
251  const char *str;
252  int len;
253  uint8_t *buffer;
254 
255  /* need flow */
256  int ret = GetFlow(luastate, &f);
257  if (ret != 0)
258  return ret;
259 
260  const char *keystr = NULL;
261  int keylen = 0;
262 
263  keystr = lua_tostring(luastate, 1);
264  if (keystr == NULL) {
265  LUA_ERROR("key is null");
266  }
267  if (!lua_isnumber(luastate, 2)) {
268  LUA_ERROR("key length not specified");
269  }
270  keylen = lua_tonumber(luastate, 2);
271  if (keylen < 0 || keylen > 0xff) {
272  LUA_ERROR("key len out of range: max 256");
273  }
274 
275  if (!lua_isstring(luastate, 3)) {
276  LUA_ERROR("buffer not a string");
277  }
278  str = lua_tostring(luastate, 3);
279  if (str == NULL) {
280  LUA_ERROR("buffer is null");
281  }
282 
283  if (!lua_isnumber(luastate, 4)) {
284  LUA_ERROR("buffer length not specified");
285  }
286  len = lua_tonumber(luastate, 4);
287  if (len < 0 || len > 0xffff) {
288  LUA_ERROR("len out of range: max 64k");
289  }
290 
291  buffer = SCMalloc(len+1);
292  if (unlikely(buffer == NULL)) {
293  LUA_ERROR("out of memory");
294  }
295  memcpy(buffer, str, len);
296  buffer[len] = '\0';
297 
298  uint8_t *keybuf = SCMalloc(keylen+1);
299  if (unlikely(keybuf == NULL)) {
300  SCFree(buffer);
301  LUA_ERROR("out of memory");
302  }
303  memcpy(keybuf, keystr, keylen);
304  keybuf[keylen] = '\0';
305  FlowVarAddKeyValue(f, keybuf, (uint16_t)keylen, buffer, (uint16_t)len);
306 
307  return 0;
308 }
309 
310 static int LuaSetFlowvar(lua_State *luastate)
311 {
312  if (lua_isnumber(luastate, 1)) {
313  return LuaSetFlowvarById(luastate);
314  } else {
315  return LuaSetFlowvarByKey(luastate);
316  }
317 }
318 
319 static int LuaGetFlowint(lua_State *luastate)
320 {
321  Flow *f;
322  FlowVar *fv;
323  uint32_t number;
324 
325  /* need flow */
326  int ret = GetFlow(luastate, &f);
327  if (ret != 0)
328  return ret;
329 
330  ret = GetFlowIntById(luastate, f, &fv, false, NULL);
331  if (ret != 0)
332  return ret;
333 
334  number = fv->data.fv_int.value;
335 
336  /* return value through luastate, as a luanumber */
337  lua_pushnumber(luastate, (lua_Number)number);
338  return 1;
339 
340 }
341 
342 static int LuaSetFlowint(lua_State *luastate)
343 {
344  uint32_t idx;
345  Flow *f;
346  DetectLuaData *ld;
347 
348  /* need lua data for id -> idx conversion */
349  int ret = GetLuaData(luastate, &ld);
350  if (ret != 0)
351  return ret;
352 
353  /* need flow */
354  ret = GetFlow(luastate, &f);
355  if (ret != 0)
356  return ret;
357 
358  /* need flowint idx */
359  if (!lua_isnumber(luastate, 1)) {
360  LUA_ERROR("1st arg not a number");
361  }
362  int id = lua_tonumber(luastate, 1);
363  if (id < 0 || id >= DETECT_LUA_MAX_FLOWVARS) {
364  LUA_ERROR("flowint id out of range");
365  }
366 
367  if (!lua_isnumber(luastate, 2)) {
368  LUA_ERROR("2nd arg not a number");
369  }
370  lua_Number luanumber = lua_tonumber(luastate, 2);
371  if (luanumber < 0 || id > (double)UINT_MAX) {
372  LUA_ERROR("value out of range, "
373  "value must be unsigned 32bit int");
374  }
375  uint32_t number = (uint32_t)luanumber;
376 
377  idx = ld->flowint[id];
378  if (idx == 0) {
379  LUA_ERROR("flowint id uninitialized");
380  }
381 
382  FlowVarAddInt(f, idx, number);
383 
384  SCLogDebug("stored flow:%p idx:%u value:%u", f, idx, number);
385  return 0;
386 }
387 
388 static int LuaIncrFlowint(lua_State *luastate)
389 {
390  uint32_t idx;
391  Flow *f;
392  FlowVar *fv;
393  uint32_t number;
394 
395  /* need flow */
396  int ret = GetFlow(luastate, &f);
397  if (ret != 0)
398  return ret;
399 
400  ret = GetFlowIntById(luastate, f, &fv, true, &idx);
401  if (ret != 0)
402  return ret;
403 
404  if (fv == NULL) {
405  number = 1;
406  } else {
407  number = fv->data.fv_int.value;
408  if (number < UINT_MAX)
409  number++;
410  }
411  FlowVarAddIntNoLock(f, idx, number);
412 
413  /* return value through luastate, as a luanumber */
414  lua_pushnumber(luastate, (lua_Number)number);
415  SCLogDebug("incremented flow:%p idx:%u value:%u", f, idx, number);
416  return 1;
417 
418 }
419 
420 static int LuaDecrFlowint(lua_State *luastate)
421 {
422  uint32_t idx;
423  Flow *f;
424  FlowVar *fv;
425  uint32_t number;
426 
427  /* need flow */
428  int ret = GetFlow(luastate, &f);
429  if (ret != 0)
430  return ret;
431 
432  ret = GetFlowIntById(luastate, f, &fv, true, &idx);
433  if (ret != 0)
434  return ret;
435 
436  if (fv == NULL) {
437  number = 0;
438  } else {
439  number = fv->data.fv_int.value;
440  if (number > 0)
441  number--;
442  }
443  FlowVarAddIntNoLock(f, idx, number);
444 
445  /* return value through luastate, as a luanumber */
446  lua_pushnumber(luastate, (lua_Number)number);
447  SCLogDebug("decremented flow:%p idx:%u value:%u", f, idx, number);
448  return 1;
449 
450 }
451 
452 static int LuaGetByteVar(lua_State *luastate)
453 {
454  DetectLuaData *ld = NULL;
455  DetectEngineThreadCtx *det_ctx = LuaStateGetDetCtx(luastate);
456 
457  if (det_ctx == NULL)
458  return LuaCallbackError(luastate, "internal error: no ldet_ctx");
459 
460  int ret = GetLuaData(luastate, &ld);
461  if (ret != 0)
462  return ret;
463 
464  if (!lua_isnumber(luastate, 1)) {
465  LUA_ERROR("bytevar id not a number");
466  }
467  int id = lua_tonumber(luastate, 1);
468  if (id < 0 || id >= DETECT_LUA_MAX_BYTEVARS) {
469  LUA_ERROR("bytevar id out of range");
470  }
471  uint32_t idx = ld->bytevar[id];
472 
473  lua_pushinteger(luastate, det_ctx->byte_values[idx]);
474 
475  return 1;
476 }
477 
479  DetectEngineThreadCtx *det_ctx, Flow *f, Packet *p, const Signature *s, uint8_t flags)
480 {
481  SCLogDebug("det_ctx %p, f %p", det_ctx, f);
482 
483  /* lua keyword data */
484  lua_pushlightuserdata(lua_state, (void *)&luaext_key_ld);
485  lua_pushlightuserdata(lua_state, (void *)ld);
486  lua_settable(lua_state, LUA_REGISTRYINDEX);
487 
488  LuaStateSetSignature(lua_state, s);
489 
490  LuaStateSetFlow(lua_state, f);
491  LuaStateSetDetCtx(lua_state, det_ctx);
492 
493  if (det_ctx->tx_id_set) {
494  if (f && f->alstate) {
495  void *txptr = AppLayerParserGetTx(f->proto, f->alproto, f->alstate, det_ctx->tx_id);
496  if (txptr) {
497  LuaStateSetTX(lua_state, txptr, det_ctx->tx_id);
498  }
499  }
500  }
501 
502  if (p != NULL)
503  LuaStateSetPacket(lua_state, p);
504 
505  LuaStateSetDirection(lua_state, (flags & STREAM_TOSERVER));
506 }
507 
508 /**
509  * \brief Register Suricata Lua functions
510  */
512 {
513  lua_pushcfunction(lua_state, LuaGetFlowvar);
514  lua_setglobal(lua_state, "ScFlowvarGet");
515 
516  lua_pushcfunction(lua_state, LuaGetFlowvar);
517  lua_setglobal(lua_state, "SCFlowvarGet");
518 
519  lua_pushcfunction(lua_state, LuaSetFlowvar);
520  lua_setglobal(lua_state, "ScFlowvarSet");
521 
522  lua_pushcfunction(lua_state, LuaSetFlowvar);
523  lua_setglobal(lua_state, "SCFlowvarSet");
524 
525  lua_pushcfunction(lua_state, LuaGetFlowint);
526  lua_setglobal(lua_state, "ScFlowintGet");
527 
528  lua_pushcfunction(lua_state, LuaGetFlowint);
529  lua_setglobal(lua_state, "SCFlowintGet");
530 
531  lua_pushcfunction(lua_state, LuaSetFlowint);
532  lua_setglobal(lua_state, "ScFlowintSet");
533 
534  lua_pushcfunction(lua_state, LuaSetFlowint);
535  lua_setglobal(lua_state, "SCFlowintSet");
536 
537  lua_pushcfunction(lua_state, LuaIncrFlowint);
538  lua_setglobal(lua_state, "ScFlowintIncr");
539 
540  lua_pushcfunction(lua_state, LuaIncrFlowint);
541  lua_setglobal(lua_state, "SCFlowintIncr");
542 
543  lua_pushcfunction(lua_state, LuaDecrFlowint);
544  lua_setglobal(lua_state, "ScFlowintDecr");
545 
546  lua_pushcfunction(lua_state, LuaDecrFlowint);
547  lua_setglobal(lua_state, "SCFlowintDecr");
548 
549  lua_pushcfunction(lua_state, LuaGetByteVar);
550  lua_setglobal(lua_state, "SCByteVarGet");
551 
552  LuaRegisterFunctions(lua_state);
553  LuaRegisterHttpFunctions(lua_state);
554  LuaRegisterDnsFunctions(lua_state);
555  LuaRegisterJa3Functions(lua_state);
556  LuaRegisterTlsFunctions(lua_state);
557  LuaRegisterSshFunctions(lua_state);
558  LuaRegisterHasshFunctions(lua_state);
559  LuaRegisterSmtpFunctions(lua_state);
560  LuaRegisterDNP3Functions(lua_state);
561  return 0;
562 }
DetectEngineThreadCtx_::byte_values
uint64_t * byte_values
Definition: detect.h:1138
LuaStateSetTX
void LuaStateSetTX(lua_State *luastate, void *txptr, const uint64_t tx_id)
Definition: util-lua.c:150
LuaStateSetPacket
void LuaStateSetPacket(lua_State *luastate, Packet *p)
Definition: util-lua.c:126
DetectLuaData
Definition: detect-lua.h:40
len
uint8_t len
Definition: app-layer-dnp3.h:2
FlowVar_::data
union FlowVar_::@109 data
util-lua-ssh.h
LUA_ERROR
#define LUA_ERROR(msg)
Definition: util-lua-common.h:41
util-lua-hassh.h
util-lua-common.h
FlowVarAddKeyValue
void FlowVarAddKeyValue(Flow *f, uint8_t *key, uint16_t keysize, uint8_t *value, uint16_t size)
Definition: flow-var.c:94
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:269
LuaRegisterDNP3Functions
int LuaRegisterDNP3Functions(lua_State *luastate)
Definition: util-lua-dnp3.c:191
Flow_::proto
uint8_t proto
Definition: flow.h:379
util-lua.h
LuaCallbackError
int LuaCallbackError(lua_State *luastate, const char *msg)
Definition: util-lua-common.c:59
DetectEngineThreadCtx_::tx_id
uint64_t tx_id
Definition: detect.h:1175
FlowVarTypeStr::value_len
uint16_t value_len
Definition: flow-var.h:39
Flow_
Flow data structure.
Definition: flow.h:357
util-lua-ja3.h
LuaRegisterDnsFunctions
int LuaRegisterDnsFunctions(lua_State *luastate)
register http lua extensions in a luastate
Definition: util-lua-dns.c:134
FlowVar_::fv_str
FlowVarTypeStr fv_str
Definition: flow-var.h:57
LuaRegisterSshFunctions
int LuaRegisterSshFunctions(lua_State *luastate)
register ssh lua extensions in a luastate
Definition: util-lua-ssh.c:199
detect-lua.h
DETECT_LUA_MAX_FLOWVARS
#define DETECT_LUA_MAX_FLOWVARS
Definition: detect-lua.h:36
DetectLuaData::flowvar
uint32_t flowvar[DETECT_LUA_MAX_FLOWVARS]
Definition: detect-lua.h:50
LuaStateSetFlow
void LuaStateSetFlow(lua_State *luastate, Flow *f)
set a flow pointer in the lua state
Definition: util-lua.c:176
LuaStateGetDetCtx
DetectEngineThreadCtx * LuaStateGetDetCtx(lua_State *luastate)
get DetectEngineThreadCtx pointer from the lua state
Definition: util-lua.c:239
lua_State
struct lua_State lua_State
Definition: suricata-common.h:506
FlowVar_::fv_int
FlowVarTypeInt fv_int
Definition: flow-var.h:58
LuaRegisterHttpFunctions
int LuaRegisterHttpFunctions(lua_State *luastate)
register http lua extensions in a luastate
Definition: util-lua-http.c:318
decode.h
util-debug.h
FlowVarGetByKey
FlowVar * FlowVarGetByKey(Flow *f, const uint8_t *key, uint16_t keylen)
get the flowvar with index 'idx' from the flow
Definition: flow-var.c:54
LuaRegisterHasshFunctions
int LuaRegisterHasshFunctions(lua_State *luastate)
Register Hassh Lua extensions.
Definition: util-lua-hassh.c:199
DetectEngineThreadCtx_
Definition: detect.h:1098
detect.h
DETECT_LUA_MAX_BYTEVARS
#define DETECT_LUA_MAX_BYTEVARS
Definition: detect-lua.h:38
app-layer-parser.h
DetectLuaData::bytevar
uint32_t bytevar[DETECT_LUA_MAX_BYTEVARS]
Definition: detect-lua.h:52
LuaStateSetDetCtx
void LuaStateSetDetCtx(lua_State *luastate, DetectEngineThreadCtx *det_ctx)
Definition: util-lua.c:247
Packet_
Definition: decode.h:476
DetectLuaData::flowint
uint32_t flowint[DETECT_LUA_MAX_FLOWINTS]
Definition: detect-lua.h:47
util-lua-dnp3.h
FlowVarAddIdValue
void FlowVarAddIdValue(Flow *f, uint32_t idx, uint8_t *value, uint16_t size)
Definition: flow-var.c:113
LuaRegisterTlsFunctions
int LuaRegisterTlsFunctions(lua_State *luastate)
register tls lua extensions in a luastate
Definition: util-lua-tls.c:338
LuaExtensionsMatchSetup
void LuaExtensionsMatchSetup(lua_State *lua_state, DetectLuaData *ld, DetectEngineThreadCtx *det_ctx, Flow *f, Packet *p, const Signature *s, uint8_t flags)
Definition: detect-lua-extensions.c:478
AppLayerParserGetTx
void * AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id)
Definition: app-layer-parser.c:1092
FlowVarTypeInt_::value
uint32_t value
Definition: flow-var.h:44
LuaRegisterJa3Functions
int LuaRegisterJa3Functions(lua_State *luastate)
Register JA3 Lua extensions.
Definition: util-lua-ja3.c:153
util-lua-smtp.h
FlowVarTypeStr::value
uint8_t * value
Definition: flow-var.h:38
flags
uint8_t flags
Definition: decode-gre.h:0
detect-lua-extensions.h
suricata-common.h
util-lua-dns.h
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
str
#define str(s)
Definition: suricata-common.h:291
LuaStateSetDirection
void LuaStateSetDirection(lua_State *luastate, int direction)
Definition: util-lua.c:278
SCFree
#define SCFree(p)
Definition: util-mem.h:61
Flow_::alstate
void * alstate
Definition: flow.h:477
FlowVarAddInt
void FlowVarAddInt(Flow *f, uint32_t idx, uint32_t value)
Definition: flow-var.c:156
Signature_
Signature container.
Definition: detect.h:603
LuaStateGetFlow
Flow * LuaStateGetFlow(lua_State *luastate)
get flow pointer from lua state
Definition: util-lua.c:161
FlowVarAddIntNoLock
void FlowVarAddIntNoLock(Flow *f, uint32_t idx, uint32_t value)
Definition: flow-var.c:135
util-lua-tls.h
DetectEngineThreadCtx_::tx_id_set
bool tx_id_set
Definition: detect.h:1173
LuaRegisterExtensions
int LuaRegisterExtensions(lua_State *lua_state)
Register Suricata Lua functions.
Definition: detect-lua-extensions.c:511
util-lua-http.h
FlowVarGet
FlowVar * FlowVarGet(Flow *f, uint32_t idx)
get the flowvar with index 'idx' from the flow
Definition: flow-var.c:78
LuaRegisterSmtpFunctions
int LuaRegisterSmtpFunctions(lua_State *luastate)
Definition: util-lua-smtp.c:315
flow.h
Flow_::alproto
AppProto alproto
application level protocol
Definition: flow.h:451
flow-var.h
LuaStateSetSignature
void LuaStateSetSignature(lua_State *luastate, const Signature *s)
Definition: util-lua.c:215
FlowVar_
Definition: flow-var.h:48
LuaRegisterFunctions
int LuaRegisterFunctions(lua_State *luastate)
Definition: util-lua-common.c:931
LuaPushStringBuffer
int LuaPushStringBuffer(lua_State *luastate, const uint8_t *input, size_t input_len)
Definition: util-lua.c:319