]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
instance: use enum for runmode 2131/head
authorVictor Julien <victor@inliniac.net>
Wed, 1 Jun 2016 18:08:47 +0000 (20:08 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 1 Jun 2016 18:08:47 +0000 (20:08 +0200)
src/runmodes.h
src/suricata.c
src/suricata.h

index d935b9a3fef026acc1ebcc00c30f67a2757f5404..0f1884e990ada52727f61ce63d00087fcdc31082 100644 (file)
@@ -24,7 +24,7 @@
 #define __RUNMODES_H__
 
 /* Run mode */
-enum {
+enum RunModes {
     RUNMODE_UNKNOWN = 0,
     RUNMODE_PCAP_DEV,
     RUNMODE_PCAP_FILE,
index 8b3abd84a701f1b33d58c5805c924c7d774f20c8..e53d6ea0a08156ae50fd381ab60f1fcd854500d6 100644 (file)
@@ -2110,6 +2110,8 @@ static int FinalizeRunMode(SCInstance *suri, char **argv)
         case RUNMODE_UNKNOWN:
             usage(argv[0]);
             return TM_ECODE_FAILED;
+        default:
+            break;
     }
     /* Set the global run mode */
     run_mode = suri->run_mode;
index 1edd129d81e88437c786a999a858bdf98ce6d0bd..337305361d848286038a52d9668995bc28477ee2 100644 (file)
@@ -119,6 +119,8 @@ enum {
 #define IS_SURI_HOST_MODE_SNIFFER_ONLY(host_mode)  ((host_mode) == SURI_HOST_IS_SNIFFER_ONLY)
 #define IS_SURI_HOST_MODE_ROUTER(host_mode)  ((host_mode) == SURI_HOST_IS_ROUTER)
 
+#include "runmodes.h"
+
 /* queue's between various other threads
  * XXX move to the TmQueue structure later
  */
@@ -127,7 +129,7 @@ PacketQueue trans_q[256];
 SCDQDataQueue data_queues[256];
 
 typedef struct SCInstance_ {
-    int run_mode;
+    enum RunModes run_mode;
 
     char pcap_dev[128];
     char *sig_file;