]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
file: use enum for state
authorVictor Julien <victor@inliniac.net>
Thu, 25 Jan 2018 09:32:13 +0000 (10:32 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 12 Feb 2018 09:02:08 +0000 (10:02 +0100)
Makes debugging easier.

src/util-file.h
src/util-lua-common.c

index 9b578bc1f52006d6d2611a6d92d31eaec0a4b53a..8de03699376033f0616c136e4e7d150cd8eee015 100644 (file)
@@ -64,7 +64,7 @@ typedef enum FileState_ {
 typedef struct File_ {
     uint16_t flags;
     uint16_t name_len;
-    int16_t state;
+    FileState state;
     StreamingBuffer *sb;
     uint64_t txid;                  /**< tx this file is part of */
     uint32_t file_track_id;         /**< id used by protocol parser. Optional
index 2b605aa236cc7f410f91ca9f94a7d7008e9eeb11..06a43f68635838d2273b7c2c7b364e8760af7c96 100644 (file)
@@ -803,6 +803,14 @@ static int LuaCallbackFileStatePushToStackFromFile(lua_State *luastate, const Fi
         case FILE_STATE_ERROR:
             state = "ERROR";
             break;
+        case FILE_STATE_OPENED:
+            state = "OPENED";
+            break;
+        case FILE_STATE_NONE:
+            state = "NONE";
+            break;
+        case FILE_STATE_MAX:
+            break;
     }
 
     lua_pushstring (luastate, state);