]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
streaming/lua: add direction indication to streamer
authorVictor Julien <victor@inliniac.net>
Fri, 2 Jun 2017 08:01:47 +0000 (10:01 +0200)
committerVictor Julien <victor@inliniac.net>
Sat, 3 Jun 2017 08:41:57 +0000 (10:41 +0200)
Call SCStreamingBuffer as follows:

    data, sb_open, sb_close, sb_ts, sb_tc = SCStreamingBuffer()

sb_ts and sb_tc are bools indicating the direction of the data.

src/util-lua-common.c

index f29dc48532e450ab519f430b474753912f1f9ed4..2b605aa236cc7f410f91ca9f94a7d7008e9eeb11 100644 (file)
@@ -108,7 +108,7 @@ void LuaPushTableKeyValueArray(lua_State *luastate, const char *key, const uint8
  *  \param p packet
  *  \retval cnt number of data items placed on the stack
  *
- *  Places: payload (string)
+ *  Places: payload (string), open (bool), close (bool), toserver (bool), toclient (bool)
  */
 static int LuaCallbackStreamingBufferPushToStack(lua_State *luastate, const LuaStreamingBuffer *b)
 {
@@ -116,7 +116,9 @@ static int LuaCallbackStreamingBufferPushToStack(lua_State *luastate, const LuaS
     lua_pushlstring (luastate, (const char *)b->data, b->data_len);
     lua_pushboolean (luastate, (b->flags & OUTPUT_STREAMING_FLAG_OPEN));
     lua_pushboolean (luastate, (b->flags & OUTPUT_STREAMING_FLAG_CLOSE));
-    return 3;
+    lua_pushboolean (luastate, (b->flags & OUTPUT_STREAMING_FLAG_TOSERVER));
+    lua_pushboolean (luastate, (b->flags & OUTPUT_STREAMING_FLAG_TOCLIENT));
+    return 5;
 }
 
 /** \internal