]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
runmodes: remove DetectEngineCtx passing from API
authorVictor Julien <victor@inliniac.net>
Mon, 19 Jan 2015 09:27:34 +0000 (10:27 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 19 Mar 2015 16:52:31 +0000 (17:52 +0100)
No longer pass a pointer to the current detection engine to the
runmode API calls.

Note: breaks delayed detect. Will be fixed in a future commit.

35 files changed:
src/detect-engine.c
src/detect-engine.h
src/runmode-af-packet.c
src/runmode-af-packet.h
src/runmode-erf-dag.c
src/runmode-erf-dag.h
src/runmode-erf-file.c
src/runmode-erf-file.h
src/runmode-ipfw.c
src/runmode-ipfw.h
src/runmode-napatech.c
src/runmode-napatech.h
src/runmode-netmap.c
src/runmode-netmap.h
src/runmode-nflog.c
src/runmode-nflog.h
src/runmode-nfq.c
src/runmode-nfq.h
src/runmode-pcap-file.c
src/runmode-pcap-file.h
src/runmode-pcap.c
src/runmode-pcap.h
src/runmode-pfring.c
src/runmode-pfring.h
src/runmode-tile.c
src/runmode-tile.h
src/runmode-unix-socket.c
src/runmode-unix-socket.h
src/runmodes.c
src/runmodes.h
src/suricata.c
src/unix-manager.c
src/unix-manager.h
src/util-runmodes.c
src/util-runmodes.h

index 7e0f57138aff00f9c81bb42ef62a9572d4efba65..8abf373de29f29ede249a1ffe7dfb8dd89aa1162 100644 (file)
@@ -1796,6 +1796,22 @@ void *DetectThreadCtxGetKeywordThreadCtx(DetectEngineThreadCtx *det_ctx, int id)
     return det_ctx->keyword_ctxs_array[id];
 }
 
+/** \brief Check if detection is enabled
+ *  \retval bool true or false */
+int DetectEngineEnabled(void)
+{
+    DetectEngineMasterCtx *master = &g_master_de_ctx;
+    SCMutexLock(&master->lock);
+
+    if (master->list == NULL) {
+        SCMutexUnlock(&master->lock);
+        return 0;
+    }
+
+    SCMutexUnlock(&master->lock);
+    return 1;
+}
+
 DetectEngineCtx *DetectEngineGetCurrent(void)
 {
     DetectEngineMasterCtx *master = &g_master_de_ctx;
index 14c6e6f18fd74fe003352963896ed627bd1dd9c5..1b6d55398415abf44204c990db88022e49f0a27c 100644 (file)
@@ -74,6 +74,7 @@ void DetectEnginePruneFreeList(void);
 int DetectEngineMoveToFreeList(DetectEngineCtx *de_ctx);
 void DetectEngineDeReference(DetectEngineCtx **de_ctx);
 int DetectEngineReload(void);
+int DetectEngineEnabled(void);
 
 /**
  * \brief Registers an app inspection engine.
index 29817d22be30150abfb0f11e041711852618b269..3a20cd09b3f015da2e5b065c86e13365972dc495 100644 (file)
@@ -433,7 +433,7 @@ int AFPRunModeIsIPS()
     return has_ips;
 }
 
-int RunModeIdsAFPAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIdsAFPAutoFp(void)
 {
     SCEnter();
 
@@ -455,8 +455,7 @@ int RunModeIdsAFPAutoFp(DetectEngineCtx *de_ctx)
         exit(EXIT_FAILURE);
     }
 
-    ret = RunModeSetLiveCaptureAutoFp(de_ctx,
-                              ParseAFPConfig,
+    ret = RunModeSetLiveCaptureAutoFp(ParseAFPConfig,
                               AFPConfigGeThreadsCount,
                               "ReceiveAFP",
                               "DecodeAFP", "RxAFP",
@@ -481,14 +480,12 @@ int RunModeIdsAFPAutoFp(DetectEngineCtx *de_ctx)
 /**
  * \brief Single thread version of the AF_PACKET processing.
  */
-int RunModeIdsAFPSingle(DetectEngineCtx *de_ctx)
+int RunModeIdsAFPSingle(void)
 {
+    SCEnter();
 #ifdef HAVE_AF_PACKET
     int ret;
     char *live_dev = NULL;
-#endif
-    SCEnter();
-#ifdef HAVE_AF_PACKET
 
     RunModeInitialize();
     TimeModeSetLive();
@@ -500,8 +497,7 @@ int RunModeIdsAFPSingle(DetectEngineCtx *de_ctx)
         exit(EXIT_FAILURE);
     }
 
-    ret = RunModeSetLiveCaptureSingle(de_ctx,
-                                    ParseAFPConfig,
+    ret = RunModeSetLiveCaptureSingle(ParseAFPConfig,
                                     AFPConfigGeThreadsCount,
                                     "ReceiveAFP",
                                     "DecodeAFP", "AFPacket",
@@ -529,14 +525,12 @@ int RunModeIdsAFPSingle(DetectEngineCtx *de_ctx)
  * Start N threads with each thread doing all the work.
  *
  */
-int RunModeIdsAFPWorkers(DetectEngineCtx *de_ctx)
+int RunModeIdsAFPWorkers(void)
 {
+    SCEnter();
 #ifdef HAVE_AF_PACKET
     int ret;
     char *live_dev = NULL;
-#endif
-    SCEnter();
-#ifdef HAVE_AF_PACKET
 
     RunModeInitialize();
     TimeModeSetLive();
@@ -548,8 +542,7 @@ int RunModeIdsAFPWorkers(DetectEngineCtx *de_ctx)
         exit(EXIT_FAILURE);
     }
 
-    ret = RunModeSetLiveCaptureWorkers(de_ctx,
-                                    ParseAFPConfig,
+    ret = RunModeSetLiveCaptureWorkers(ParseAFPConfig,
                                     AFPConfigGeThreadsCount,
                                     "ReceiveAFP",
                                     "DecodeAFP", "AFPacket",
index 0e1c764dd764664a0c232f41f2eae1ef8cb84e0c..79fe436a692f8b3291f29081aa085fd246d2bcca 100644 (file)
 #ifndef __RUNMODE_AF_PACKET_H__
 #define __RUNMODE_AF_PACKET_H__
 
-int RunModeIdsAFPAuto(DetectEngineCtx *);
-int RunModeIdsAFPSingle(DetectEngineCtx *);
-int RunModeIdsAFPAutoFp(DetectEngineCtx *);
-int RunModeIdsAFPWorkers(DetectEngineCtx *);
+int RunModeIdsAFPSingle(void);
+int RunModeIdsAFPAutoFp(void);
+int RunModeIdsAFPWorkers(void);
 void RunModeIdsAFPRegister(void);
 const char *RunModeAFPGetDefaultMode(void);
 int AFPRunModeIsIPS();
index 4fa9a6fccb927d3e562c479623eda334f768f600..5653b9ecfbe03d1a835a1e7d1468a21f7a42c6f9 100644 (file)
 #include "conf.h"
 #include "runmodes.h"
 #include "runmode-erf-dag.h"
-#include "log-httplog.h"
 #include "output.h"
-#include "source-pfring.h"
 
-#include "alert-fastlog.h"
-#include "alert-prelude.h"
-#include "alert-unified2-alert.h"
-#include "alert-debuglog.h"
+#include "detect-engine.h"
 
 #include "util-debug.h"
 #include "util-time.h"
@@ -76,7 +71,7 @@ void RunModeErfDagRegister(void)
     return;
 }
 
-int RunModeIdsErfDagSingle(DetectEngineCtx *de_ctx)
+int RunModeIdsErfDagSingle(void)
 {
     int ret;
 
@@ -86,8 +81,7 @@ int RunModeIdsErfDagSingle(DetectEngineCtx *de_ctx)
 
     TimeModeSetLive();
 
-    ret = RunModeSetLiveCaptureSingle(de_ctx,
-        ParseDagConfig,
+    ret = RunModeSetLiveCaptureSingle(ParseDagConfig,
         DagConfigGetThreadCount,
         "ReceiveErfDag",
         "DecodeErfDag",
@@ -103,7 +97,7 @@ int RunModeIdsErfDagSingle(DetectEngineCtx *de_ctx)
     SCReturnInt(0);
 }
 
-int RunModeIdsErfDagAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIdsErfDagAutoFp(void)
 {
     int ret;
 
@@ -113,8 +107,7 @@ int RunModeIdsErfDagAutoFp(DetectEngineCtx *de_ctx)
 
     TimeModeSetLive();
 
-    ret = RunModeSetLiveCaptureAutoFp(de_ctx,
-        ParseDagConfig,
+    ret = RunModeSetLiveCaptureAutoFp(ParseDagConfig,
         DagConfigGetThreadCount,
         "ReceiveErfDag",
         "DecodeErfDag",
@@ -130,7 +123,7 @@ int RunModeIdsErfDagAutoFp(DetectEngineCtx *de_ctx)
     SCReturnInt(0);
 }
 
-int RunModeIdsErfDagWorkers(DetectEngineCtx *de_ctx)
+int RunModeIdsErfDagWorkers(void)
 {
     int ret;
 
@@ -140,8 +133,7 @@ int RunModeIdsErfDagWorkers(DetectEngineCtx *de_ctx)
 
     TimeModeSetLive();
 
-    ret = RunModeSetLiveCaptureWorkers(de_ctx,
-        ParseDagConfig,
+    ret = RunModeSetLiveCaptureWorkers(ParseDagConfig,
         DagConfigGetThreadCount,
         "ReceiveErfDag",
         "DecodeErfDag",
index 2a4b20ea520c30cec9e0fe1ccb2363d121d5ae9c..c4b2a59cee5e201de9a053dcb0f700e851dec66f 100644 (file)
@@ -23,9 +23,9 @@
 #ifndef __RUNMODE_ERF_DAG_H__
 #define __RUNMODE_ERF_DAG_H__
 
-int RunModeIdsErfDagAutoFp(DetectEngineCtx *);
-int RunModeIdsErfDagSingle(DetectEngineCtx *);
-int RunModeIdsErfDagWorkers(DetectEngineCtx *);
+int RunModeIdsErfDagAutoFp(void);
+int RunModeIdsErfDagSingle(void);
+int RunModeIdsErfDagWorkers(void);
 void RunModeErfDagRegister(void);
 const char *RunModeErfDagGetDefaultMode(void);
 
index 50f47669d0170e5cad0c6602af6d0ff7609ad3a9..ef7d2e09ec9c7293c34a7698de8a0b404d0fad5b 100644 (file)
 #include "conf.h"
 #include "runmodes.h"
 #include "runmode-erf-file.h"
-#include "log-httplog.h"
 #include "output.h"
-#include "source-pfring.h"
 
-#include "alert-fastlog.h"
-#include "alert-prelude.h"
-#include "alert-unified2-alert.h"
-#include "alert-debuglog.h"
+#include "detect-engine.h"
 
 #include "util-debug.h"
 #include "util-time.h"
@@ -59,7 +54,7 @@ void RunModeErfFileRegister(void)
     return;
 }
 
-int RunModeErfFileSingle(DetectEngineCtx *de_ctx)
+int RunModeErfFileSingle(void)
 {
     char *file;
 
@@ -106,13 +101,13 @@ int RunModeErfFileSingle(DetectEngineCtx *de_ctx)
     }
     TmSlotSetFuncAppend(tv, tm_module, NULL);
 
-    if (de_ctx != NULL) {
+    if (DetectEngineEnabled()) {
         tm_module = TmModuleGetByName("Detect");
         if (tm_module == NULL) {
             printf("ERROR: TmModuleGetByName Detect failed\n");
             exit(EXIT_FAILURE);
         }
-        TmSlotSetFuncAppend(tv, tm_module, (void *)de_ctx);
+        TmSlotSetFuncAppend(tv, tm_module, NULL);
     }
 
     SetupOutputs(tv);
@@ -127,7 +122,7 @@ int RunModeErfFileSingle(DetectEngineCtx *de_ctx)
     SCReturnInt(0);
 }
 
-int RunModeErfFileAutoFp(DetectEngineCtx *de_ctx)
+int RunModeErfFileAutoFp(void)
 {
     SCEnter();
     char tname[TM_THREAD_NAME_MAX];
@@ -235,13 +230,13 @@ int RunModeErfFileAutoFp(DetectEngineCtx *de_ctx)
         }
         TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
 
-        if (de_ctx != NULL) {
+        if (DetectEngineEnabled()) {
             tm_module = TmModuleGetByName("Detect");
             if (tm_module == NULL) {
                 printf("ERROR: TmModuleGetByName Detect failed\n");
                 exit(EXIT_FAILURE);
             }
-            TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, (void *)de_ctx);
+            TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
         }
 
         if (threading_set_cpu_affinity) {
index 0612e9fa436cbe169095b8b00a704af704aea94d..54a8ba8972fae4835b1a26ed933a3874dbb2f465 100644 (file)
@@ -23,8 +23,8 @@
 #ifndef __RUNMODE_ERF_FILE_H__
 #define __RUNMODE_ERF_FILE_H__
 
-int RunModeErfFileSingle(DetectEngineCtx *);
-int RunModeErfFileAutoFp(DetectEngineCtx *);
+int RunModeErfFileSingle(void);
+int RunModeErfFileAutoFp(void);
 void RunModeErfFileRegister(void);
 const char *RunModeErfFileGetDefaultMode(void);
 
index 03bb02e55fb8399efa2120c7eccc2fba141bc73f..841692e1166b57ff32234165c99711c4ae56c21d 100644 (file)
 #include "conf.h"
 #include "runmodes.h"
 #include "runmode-ipfw.h"
-#include "log-httplog.h"
 #include "output.h"
-#include "source-pfring.h"
-
-#include "alert-fastlog.h"
-#include "alert-prelude.h"
-#include "alert-unified2-alert.h"
-#include "alert-debuglog.h"
 
 #include "util-debug.h"
 #include "util-time.h"
@@ -70,7 +63,7 @@ void RunModeIpsIPFWRegister(void)
     return;
 }
 
-int RunModeIpsIPFWAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIpsIPFWAutoFp(void)
 {
     SCEnter();
     int ret = 0;
@@ -82,8 +75,7 @@ int RunModeIpsIPFWAutoFp(DetectEngineCtx *de_ctx)
 
     LiveDeviceHasNoStats();
 
-    ret = RunModeSetIPSAutoFp(de_ctx,
-            IPFWGetThread,
+    ret = RunModeSetIPSAutoFp(IPFWGetThread,
             "ReceiveIPFW",
             "VerdictIPFW",
             "DecodeIPFW");
@@ -91,7 +83,7 @@ int RunModeIpsIPFWAutoFp(DetectEngineCtx *de_ctx)
     return ret;
 }
 
-int RunModeIpsIPFWWorker(DetectEngineCtx *de_ctx)
+int RunModeIpsIPFWWorker(void)
 {
     SCEnter();
     int ret = 0;
@@ -103,8 +95,7 @@ int RunModeIpsIPFWWorker(DetectEngineCtx *de_ctx)
 
     LiveDeviceHasNoStats();
 
-    ret = RunModeSetIPSWorker(de_ctx,
-            IPFWGetThread,
+    ret = RunModeSetIPSWorker(IPFWGetThread,
             "ReceiveIPFW",
             "VerdictIPFW",
             "DecodeIPFW");
index 92fae6b8ad320b4c266384744038e52897a329f4..5c8345b17455fc4cb2531814854814176c1a651a 100644 (file)
@@ -23,9 +23,8 @@
 #ifndef __RUNMODE_IPFW_H__
 #define __RUNMODE_IPFW_H__
 
-int RunModeIpsIPFWAuto(DetectEngineCtx *);
-int RunModeIpsIPFWAutoFp(DetectEngineCtx *);
-int RunModeIpsIPFWWorker(DetectEngineCtx *);
+int RunModeIpsIPFWAutoFp(void);
+int RunModeIpsIPFWWorker(void);
 void RunModeIpsIPFWRegister(void);
 const char *RunModeIpsIPFWGetDefaultMode(void);
 
index 0c9be2a233d36c553253d17dbedcd1b8496a0410..7c161ad864ae7288920244b0f20fa038c7357bed 100644 (file)
 #include "tm-threads.h"
 #include "conf.h"
 #include "runmodes.h"
-#include "log-httplog.h"
 #include "output.h"
 
-#include "alert-fastlog.h"
-#include "alert-prelude.h"
-#include "alert-unified2-alert.h"
-#include "alert-debuglog.h"
-
 #include "util-debug.h"
 #include "util-time.h"
 #include "util-cpu.h"
@@ -185,7 +179,7 @@ int NapatechGetThreadsCount(void *conf __attribute__((unused))) {
     return 1;
 }
 
-int NapatechInit(DetectEngineCtx *de_ctx, int runmode)
+static int NapatechInit(int runmode)
 {
     int ret;
     char errbuf[100];
@@ -208,12 +202,12 @@ int NapatechInit(DetectEngineCtx *de_ctx, int runmode)
 
     switch(runmode) {
         case NT_RUNMODE_AUTOFP:
-            ret = RunModeSetLiveCaptureAutoFp(de_ctx, NapatechConfigParser, NapatechGetThreadsCount,
+            ret = RunModeSetLiveCaptureAutoFp(NapatechConfigParser, NapatechGetThreadsCount,
                                               "NapatechStream", "NapatechDecode",
                                               "RxNT", NULL);
             break;
         case NT_RUNMODE_WORKERS:
-            ret = RunModeSetLiveCaptureWorkers(de_ctx, NapatechConfigParser, NapatechGetThreadsCount,
+            ret = RunModeSetLiveCaptureWorkers(NapatechConfigParser, NapatechGetThreadsCount,
                                                "NapatechStream", "NapatechDecode",
                                                "RxNT", NULL);
             break;
@@ -228,14 +222,14 @@ int NapatechInit(DetectEngineCtx *de_ctx, int runmode)
     return 0;
 }
 
-int RunModeNapatechAutoFp(DetectEngineCtx *de_ctx)
+int RunModeNapatechAutoFp(void)
 {
-    return NapatechInit(de_ctx, NT_RUNMODE_AUTOFP);
+    return NapatechInit(NT_RUNMODE_AUTOFP);
 }
 
-int RunModeNapatechWorkers(DetectEngineCtx *de_ctx)
+int RunModeNapatechWorkers(void)
 {
-    return NapatechInit(de_ctx, NT_RUNMODE_WORKERS);
+    return NapatechInit(NT_RUNMODE_WORKERS);
 }
 
 #endif
index ffb1d42efe09d2120971dbe0a1740b79088d435d..d10b406376d01fe44ecf5eb514a46716ba2582e5 100644 (file)
@@ -29,9 +29,8 @@
 #include <nt.h>
 #endif
 
-int RunModeNapatechAuto(DetectEngineCtx *);
-int RunModeNapatechAutoFp(DetectEngineCtx *);
-int RunModeNapatechWorkers(DetectEngineCtx *);
+int RunModeNapatechAutoFp(void);
+int RunModeNapatechWorkers(void);
 void RunModeNapatechRegister(void);
 const char *RunModeNapatechGetDefaultMode(void);
 
index f5172aba1aeb0d3701c36c6039959c9db2f9a692..3639bef92e39996b9dab68b9740e4980ecf39806 100644 (file)
@@ -332,7 +332,7 @@ int NetmapRunModeIsIPS()
 
 #endif // #ifdef HAVE_NETMAP
 
-int RunModeIdsNetmapAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIdsNetmapAutoFp(void)
 {
     SCEnter();
 
@@ -348,7 +348,7 @@ int RunModeIdsNetmapAutoFp(DetectEngineCtx *de_ctx)
 
     SCLogDebug("live_dev %s", live_dev);
 
-    ret = RunModeSetLiveCaptureAutoFp(de_ctx,
+    ret = RunModeSetLiveCaptureAutoFp(
                               ParseNetmapConfig,
                               NetmapConfigGeThreadsCount,
                               "ReceiveNetmap",
@@ -368,7 +368,7 @@ int RunModeIdsNetmapAutoFp(DetectEngineCtx *de_ctx)
 /**
 * \brief Single thread version of the netmap processing.
 */
-int RunModeIdsNetmapSingle(DetectEngineCtx *de_ctx)
+int RunModeIdsNetmapSingle(void)
 {
     SCEnter();
 
@@ -381,7 +381,7 @@ int RunModeIdsNetmapSingle(DetectEngineCtx *de_ctx)
 
     (void)ConfGet("netmap.live-interface", &live_dev);
 
-    ret = RunModeSetLiveCaptureSingle(de_ctx,
+    ret = RunModeSetLiveCaptureSingle(
                                     ParseNetmapConfig,
                                     NetmapConfigGeThreadsCount,
                                     "ReceiveNetmap",
@@ -404,7 +404,7 @@ int RunModeIdsNetmapSingle(DetectEngineCtx *de_ctx)
 * Start N threads with each thread doing all the work.
 *
 */
-int RunModeIdsNetmapWorkers(DetectEngineCtx *de_ctx)
+int RunModeIdsNetmapWorkers(void)
 {
     SCEnter();
 
@@ -417,7 +417,7 @@ int RunModeIdsNetmapWorkers(DetectEngineCtx *de_ctx)
 
     (void)ConfGet("netmap.live-interface", &live_dev);
 
-    ret = RunModeSetLiveCaptureWorkers(de_ctx,
+    ret = RunModeSetLiveCaptureWorkers(
                                     ParseNetmapConfig,
                                     NetmapConfigGeThreadsCount,
                                     "ReceiveNetmap",
index 392e9781ca070c2457be269540066c5a5d9d3bf3..988c349ab5a241490a7189f1ae058ad9ee186b95 100644 (file)
@@ -23,9 +23,9 @@
 #ifndef __RUNMODE_NETMAP_H__
 #define __RUNMODE_NETMAP_H__
 
-int RunModeIdsNetmapSingle(DetectEngineCtx *);
-int RunModeIdsNetmapAutoFp(DetectEngineCtx *);
-int RunModeIdsNetmapWorkers(DetectEngineCtx *);
+int RunModeIdsNetmapSingle(void);
+int RunModeIdsNetmapAutoFp(void);
+int RunModeIdsNetmapWorkers(void);
 void RunModeIdsNetmapRegister(void);
 const char *RunModeNetmapGetDefaultMode(void);
 int NetmapRunModeIsIPS();
index 17725622b5e89faf60ba4935625ddf4e9ebc116a..9c08f9aef060e7dd7cdcab5ccd57f60b19d1c7be 100644 (file)
@@ -169,7 +169,7 @@ int NflogConfigGeThreadsCount(void *conf)
     return 1;
 }
 
-int RunModeIdsNflogAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIdsNflogAutoFp(void)
 {
     SCEnter();
 
@@ -180,8 +180,7 @@ int RunModeIdsNflogAutoFp(DetectEngineCtx *de_ctx)
     RunModeInitialize();
     TimeModeSetLive();
 
-    ret = RunModeSetLiveCaptureAutoFp(de_ctx,
-                                      ParseNflogConfig,
+    ret = RunModeSetLiveCaptureAutoFp(ParseNflogConfig,
                                       NflogConfigGeThreadsCount,
                                       "ReceiveNFLOG",
                                       "DecodeNFLOG",
@@ -198,7 +197,7 @@ int RunModeIdsNflogAutoFp(DetectEngineCtx *de_ctx)
     SCReturnInt(0);
 }
 
-int RunModeIdsNflogSingle(DetectEngineCtx *de_ctx)
+int RunModeIdsNflogSingle(void)
 {
     SCEnter();
 
@@ -209,8 +208,7 @@ int RunModeIdsNflogSingle(DetectEngineCtx *de_ctx)
     RunModeInitialize();
     TimeModeSetLive();
 
-    ret = RunModeSetLiveCaptureSingle(de_ctx,
-                                      ParseNflogConfig,
+    ret = RunModeSetLiveCaptureSingle(ParseNflogConfig,
                                       NflogConfigGeThreadsCount,
                                       "ReceiveNFLOG",
                                       "DecodeNFLOG",
@@ -227,7 +225,7 @@ int RunModeIdsNflogSingle(DetectEngineCtx *de_ctx)
     SCReturnInt(0);
 }
 
-int RunModeIdsNflogWorkers(DetectEngineCtx *de_ctx)
+int RunModeIdsNflogWorkers(void)
 {
     SCEnter();
 
@@ -238,8 +236,7 @@ int RunModeIdsNflogWorkers(DetectEngineCtx *de_ctx)
     RunModeInitialize();
     TimeModeSetLive();
 
-    ret = RunModeSetLiveCaptureWorkers(de_ctx,
-                                       ParseNflogConfig,
+    ret = RunModeSetLiveCaptureWorkers(ParseNflogConfig,
                                        NflogConfigGeThreadsCount,
                                        "ReceiveNFLOG",
                                        "DecodeNFLOG",
index 2dd4e7a6358fe8436fe24a272a32da9a8df3f674..9c70c69397deb48f9906f061f2e75a669157e8c8 100644 (file)
@@ -23,9 +23,9 @@
 #ifndef __RUNMODE_NFLOG_H__
 #define __RUNMODE_NFLOG_H__
 
-int RunModeIdsNflogAutoFp(DetectEngineCtx *);
-int RunModeIdsNflogSingle(DetectEngineCtx *);
-int RunModeIdsNflogWorkers(DetectEngineCtx *);
+int RunModeIdsNflogAutoFp(void);
+int RunModeIdsNflogSingle(void);
+int RunModeIdsNflogWorkers(void);
 void RunModeIdsNflogRegister(void);
 const char *RunModeIdsNflogGetDefaultMode(void);
 
index edf7bc7e553ba986984d3b26bc0bda5e1c7addd5..67fa5bcbe969b1a30cc4ccac30a643ce9b1fbb83 100644 (file)
 #include "conf.h"
 #include "runmodes.h"
 #include "runmode-nfq.h"
-#include "log-httplog.h"
 #include "output.h"
-#include "source-pfring.h"
-
-#include "alert-fastlog.h"
-#include "alert-prelude.h"
-#include "alert-unified2-alert.h"
-#include "alert-debuglog.h"
 
 #include "util-debug.h"
 #include "util-time.h"
@@ -66,7 +59,7 @@ void RunModeIpsNFQRegister(void)
     return;
 }
 
-int RunModeIpsNFQAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIpsNFQAutoFp(void)
 {
     SCEnter();
     int ret = 0;
@@ -78,8 +71,7 @@ int RunModeIpsNFQAutoFp(DetectEngineCtx *de_ctx)
 
     LiveDeviceHasNoStats();
 
-    ret = RunModeSetIPSAutoFp(de_ctx,
-            NFQGetThread,
+    ret = RunModeSetIPSAutoFp(NFQGetThread,
             "ReceiveNFQ",
             "VerdictNFQ",
             "DecodeNFQ");
@@ -87,7 +79,7 @@ int RunModeIpsNFQAutoFp(DetectEngineCtx *de_ctx)
     return ret;
 }
 
-int RunModeIpsNFQWorker(DetectEngineCtx *de_ctx)
+int RunModeIpsNFQWorker(void)
 {
     SCEnter();
     int ret = 0;
@@ -99,8 +91,7 @@ int RunModeIpsNFQWorker(DetectEngineCtx *de_ctx)
 
     LiveDeviceHasNoStats();
 
-    ret = RunModeSetIPSWorker(de_ctx,
-            NFQGetThread,
+    ret = RunModeSetIPSWorker(NFQGetThread,
             "ReceiveNFQ",
             "VerdictNFQ",
             "DecodeNFQ");
index 677fff682bb45f2b2a115fcff741ca887510189e..6ad880146639c3dc8fc7fba7506487ca8a26bc79 100644 (file)
@@ -23,9 +23,8 @@
 #ifndef __RUNMODE_NFQ_H__
 #define __RUNMODE_NFQ_H__
 
-int RunModeIpsNFQAuto(DetectEngineCtx *);
-int RunModeIpsNFQAutoFp(DetectEngineCtx *);
-int RunModeIpsNFQWorker(DetectEngineCtx *);
+int RunModeIpsNFQAutoFp(void);
+int RunModeIpsNFQWorker(void);
 void RunModeIpsNFQRegister(void);
 const char *RunModeIpsNFQGetDefaultMode(void);
 
index f5a3c196b40b7f2b449542036fe2dad50a5ce80d..d337cb9711a72f68fdd1be58a056aea781b42228 100644 (file)
 #include "conf.h"
 #include "runmodes.h"
 #include "runmode-pcap-file.h"
-#include "log-httplog.h"
 #include "output.h"
-#include "detect-engine-mpm.h"
 
+#include "detect-engine.h"
 #include "source-pcap-file.h"
 
-#include "alert-fastlog.h"
-#include "alert-prelude.h"
-#include "alert-unified2-alert.h"
-#include "alert-debuglog.h"
-
 #include "util-debug.h"
 #include "util-time.h"
 #include "util-cpu.h"
@@ -65,7 +59,7 @@ void RunModeFilePcapRegister(void)
 /**
  * \brief Single thread version of the Pcap file processing.
  */
-int RunModeFilePcapSingle(DetectEngineCtx *de_ctx)
+int RunModeFilePcapSingle(void)
 {
     char *file = NULL;
     if (ConfGet("pcap-file.file", &file) == 0) {
@@ -109,13 +103,13 @@ int RunModeFilePcapSingle(DetectEngineCtx *de_ctx)
     }
     TmSlotSetFuncAppend(tv, tm_module, NULL);
 
-    if (de_ctx) {
+    if (DetectEngineEnabled()) {
         tm_module = TmModuleGetByName("Detect");
         if (tm_module == NULL) {
             SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
             exit(EXIT_FAILURE);
         }
-        TmSlotSetFuncAppend(tv, tm_module, (void *)de_ctx);
+        TmSlotSetFuncAppend(tv, tm_module, NULL);
     }
 
     SetupOutputs(tv);
@@ -142,12 +136,10 @@ int RunModeFilePcapSingle(DetectEngineCtx *de_ctx)
  *        By default the threads will use the first cpu available
  *        except the Detection threads if we have more than one cpu.
  *
- * \param de_ctx Pointer to the Detection Engine
- *
  * \retval 0 If all goes well. (If any problem is detected the engine will
  *           exit()).
  */
-int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx)
+int RunModeFilePcapAutoFp(void)
 {
     SCEnter();
     char tname[TM_THREAD_NAME_MAX];
@@ -253,13 +245,13 @@ int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx)
         }
         TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
 
-        if (de_ctx) {
+        if (DetectEngineEnabled()) {
             tm_module = TmModuleGetByName("Detect");
             if (tm_module == NULL) {
                 SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
                 exit(EXIT_FAILURE);
             }
-            TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, (void *)de_ctx);
+            TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
         }
 
         char *thread_group_name = SCStrdup("Detect");
index 5dbd3a9c2631ca3bc2499ac035a84cf7ddf1a248..52cab02228f0628b22035e24ed6479e53171929f 100644 (file)
@@ -23,9 +23,8 @@
 #ifndef __RUNMODE_PCAP_FILE_H__
 #define __RUNMODE_PCAP_FILE_H__
 
-int RunModeFilePcapSingle(DetectEngineCtx *);
-int RunModeFilePcapAuto(DetectEngineCtx *);
-int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx);
+int RunModeFilePcapSingle(void);
+int RunModeFilePcapAutoFp(void);
 void RunModeFilePcapRegister(void);
 const char *RunModeFilePcapGetDefaultMode(void);
 
index 17d9e692ee5c7ab8fa5cec91845efbb2c6eba8be..6561c1c8c4c8f42e525bd0be8b4f2c7b072eb126 100644 (file)
 #include "runmode-pcap.h"
 #include "log-httplog.h"
 #include "output.h"
-#include "source-pfring.h"
-#include "detect-engine-mpm.h"
-
-#include "alert-fastlog.h"
-#include "alert-prelude.h"
-#include "alert-unified2-alert.h"
-#include "alert-debuglog.h"
 
 #include "util-debug.h"
 #include "util-time.h"
@@ -46,7 +39,7 @@ const char *RunModeIdsGetDefaultMode(void)
     return default_mode;
 }
 
-int RunModeIdsPcapWorkers(DetectEngineCtx *de_ctx);
+int RunModeIdsPcapWorkers(void);
 
 void RunModeIdsPcapRegister(void)
 {
@@ -234,7 +227,7 @@ int PcapConfigGeThreadsCount(void *conf)
 /**
  * \brief Single thread version of the Pcap live processing.
  */
-int RunModeIdsPcapSingle(DetectEngineCtx *de_ctx)
+int RunModeIdsPcapSingle(void)
 {
     int ret;
     char *live_dev = NULL;
@@ -246,8 +239,7 @@ int RunModeIdsPcapSingle(DetectEngineCtx *de_ctx)
 
     (void)ConfGet("pcap.single-pcap-dev", &live_dev);
 
-    ret = RunModeSetLiveCaptureSingle(de_ctx,
-                                    ParsePcapConfig,
+    ret = RunModeSetLiveCaptureSingle(ParsePcapConfig,
                                     PcapConfigGeThreadsCount,
                                     "ReceivePcap",
                                     "DecodePcap", "PcapLive",
@@ -274,12 +266,10 @@ int RunModeIdsPcapSingle(DetectEngineCtx *de_ctx)
  *        By default the threads will use the first cpu available
  *        except the Detection threads if we have more than one cpu.
  *
- * \param de_ctx Pointer to the Detection Engine
- *
  * \retval 0 If all goes well. (If any problem is detected the engine will
  *           exit()).
  */
-int RunModeIdsPcapAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIdsPcapAutoFp(void)
 {
     int ret;
     char *live_dev = NULL;
@@ -290,8 +280,7 @@ int RunModeIdsPcapAutoFp(DetectEngineCtx *de_ctx)
 
     (void) ConfGet("pcap.single-pcap-dev", &live_dev);
 
-    ret = RunModeSetLiveCaptureAutoFp(de_ctx,
-                              ParsePcapConfig,
+    ret = RunModeSetLiveCaptureAutoFp(ParsePcapConfig,
                               PcapConfigGeThreadsCount,
                               "ReceivePcap",
                               "DecodePcap", "RxPcap",
@@ -312,7 +301,7 @@ int RunModeIdsPcapAutoFp(DetectEngineCtx *de_ctx)
  * Start N threads with each thread doing all the work.
  *
  */
-int RunModeIdsPcapWorkers(DetectEngineCtx *de_ctx)
+int RunModeIdsPcapWorkers(void)
 {
     int ret;
     char *live_dev = NULL;
@@ -323,8 +312,7 @@ int RunModeIdsPcapWorkers(DetectEngineCtx *de_ctx)
 
     (void) ConfGet("pcap.single-pcap-dev", &live_dev);
 
-    ret = RunModeSetLiveCaptureWorkers(de_ctx,
-                                    ParsePcapConfig,
+    ret = RunModeSetLiveCaptureWorkers(ParsePcapConfig,
                                     PcapConfigGeThreadsCount,
                                     "ReceivePcap",
                                     "DecodePcap", "RxPcap",
index 9e88c6d90f8b14f009bc88ed604b446587b89569..b68c6ddcfc7f91a3106469b5d232bf651c495df3 100644 (file)
@@ -23,9 +23,8 @@
 #ifndef __RUNMODE_PCAP_H__
 #define __RUNMODE_PCAP_H__
 
-int RunModeIdsPcapAuto(DetectEngineCtx *);
-int RunModeIdsPcapSingle(DetectEngineCtx *);
-int RunModeIdsPcapAutoFp(DetectEngineCtx *de_ctx);
+int RunModeIdsPcapSingle(void);
+int RunModeIdsPcapAutoFp(void);
 void RunModeIdsPcapRegister(void);
 const char *RunModeIdsGetDefaultMode(void);
 
index 21c22fc2e6b07b804b3da9e3b6e5297513b7b9d6..8c9a06fde4224261213875dfc8e155d678aa2bf2 100644 (file)
 #include "runmodes.h"
 #include "runmode-pfring.h"
 #include "source-pfring.h"
-#include "log-httplog.h"
 #include "output.h"
-#include "source-pfring.h"
-
-#include "alert-fastlog.h"
-#include "alert-prelude.h"
-#include "alert-unified2-alert.h"
-#include "alert-debuglog.h"
 
 #include "util-debug.h"
 #include "util-time.h"
@@ -418,7 +411,7 @@ static int GetDevAndParser(char **live_dev, ConfigIfaceParserFunc *parser)
 }
 #endif
 
-int RunModeIdsPfringAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIdsPfringAutoFp(void)
 {
     SCEnter();
 
@@ -439,8 +432,7 @@ int RunModeIdsPfringAutoFp(DetectEngineCtx *de_ctx)
         exit(EXIT_FAILURE);
     }
 
-    ret = RunModeSetLiveCaptureAutoFp(de_ctx,
-                              tparser,
+    ret = RunModeSetLiveCaptureAutoFp(tparser,
                               PfringConfigGeThreadsCount,
                               "ReceivePfring",
                               "DecodePfring", "RxPFR",
@@ -456,7 +448,7 @@ int RunModeIdsPfringAutoFp(DetectEngineCtx *de_ctx)
     return 0;
 }
 
-int RunModeIdsPfringSingle(DetectEngineCtx *de_ctx)
+int RunModeIdsPfringSingle(void)
 {
     SCEnter();
 
@@ -477,8 +469,7 @@ int RunModeIdsPfringSingle(DetectEngineCtx *de_ctx)
         exit(EXIT_FAILURE);
     }
 
-    ret = RunModeSetLiveCaptureSingle(de_ctx,
-                              tparser,
+    ret = RunModeSetLiveCaptureSingle(tparser,
                               PfringConfigGeThreadsCount,
                               "ReceivePfring",
                               "DecodePfring", "RxPFR",
@@ -494,7 +485,7 @@ int RunModeIdsPfringSingle(DetectEngineCtx *de_ctx)
     return 0;
 }
 
-int RunModeIdsPfringWorkers(DetectEngineCtx *de_ctx)
+int RunModeIdsPfringWorkers(void)
 {
     SCEnter();
 
@@ -515,8 +506,7 @@ int RunModeIdsPfringWorkers(DetectEngineCtx *de_ctx)
         exit(EXIT_FAILURE);
     }
 
-    ret = RunModeSetLiveCaptureWorkers(de_ctx,
-                              tparser,
+    ret = RunModeSetLiveCaptureWorkers(tparser,
                               PfringConfigGeThreadsCount,
                               "ReceivePfring",
                               "DecodePfring", "RxPFR",
index 9ba7d5c93f04cefd0e213a9becac18812692c412..316c82f74af68f51a987d45c24d2239eb2d6c2dc 100644 (file)
 
 #include "suricata-common.h"
 
-int RunModeIdsPfringAuto(DetectEngineCtx *);
-int RunModeIdsPfringAutoFp(DetectEngineCtx *de_ctx);
-int RunModeIdsPfringSingle(DetectEngineCtx *de_ctx);
-int RunModeIdsPfringWorkers(DetectEngineCtx *de_ctx);
+int RunModeIdsPfringAutoFp(void);
+int RunModeIdsPfringSingle(void);
+int RunModeIdsPfringWorkers(void);
 void RunModeIdsPfringRegister(void);
 const char *RunModeIdsPfringGetDefaultMode(void);
 
index 1839234dddb9f6f48d9e608bce6d17085f1a2894..38f5afecc0fde78c21a2c1e73ef6455b88606b2b 100644 (file)
 #include "conf.h"
 #include "runmodes.h"
 #include "runmode-tile.h"
-#include "log-httplog.h"
 #include "output.h"
 #include "source-mpipe.h"
 
-#include "alert-fastlog.h"
-#include "alert-prelude.h"
-#include "alert-unified2-alert.h"
-#include "alert-debuglog.h"
+#include "detect-engine.h"
 
 #include "util-debug.h"
 #include "util-time.h"
@@ -140,13 +136,12 @@ void *ParseMpipeConfig(const char *iface)
 /**
  * \brief RunModeTileMpipeWorkers set up to process all modules in each thread.
  *
- * \param de_ctx pointer to the Detection Engine
  * \param iface pointer to the name of the interface from which we will
  *              fetch the packets
  * \retval 0 if all goes well. (If any problem is detected the engine will
  *           exit())
  */
-int RunModeTileMpipeWorkers(DetectEngineCtx *de_ctx)
+int RunModeTileMpipeWorkers(void)
 {
     SCEnter();
     char tname[TM_THREAD_NAME_MAX];
@@ -262,13 +257,13 @@ int RunModeTileMpipeWorkers(DetectEngineCtx *de_ctx)
         }
         TmSlotSetFuncAppend(tv_worker, tm_module, NULL);
 
-        if (de_ctx != NULL) {
+        if (DetectEngineEnabled()) {
             tm_module = TmModuleGetByName("Detect");
             if (tm_module == NULL) {
                 printf("ERROR: TmModuleGetByName Detect failed\n");
                 exit(EXIT_FAILURE);
             }
-            TmSlotSetFuncAppend(tv_worker, tm_module, (void *)de_ctx);
+            TmSlotSetFuncAppend(tv_worker, tm_module, NULL);
         }
 
         tm_module = TmModuleGetByName("RespondReject");
index 8e0af793a99bcb663110f4b86db55a618dda35c2..ec6c9e5042dd364a8e8331c58ef46bd630e9cd42 100644 (file)
@@ -34,7 +34,7 @@ void RunModeTileMpipeRegister(void);
 
 extern int tile_num_pipelines;
 
-int RunModeTileMpipeWorkers(DetectEngineCtx *);
+int RunModeTileMpipeWorkers(void);
 
 void *ParseMpipeConfig(const char *iface);
 
index bff022d6eb225af7869cfced2ed91d668a86065c..1ee5ce0815a87387d8c1d038f524d62de2031c7a 100644 (file)
 #include "conf.h"
 #include "runmodes.h"
 #include "runmode-pcap-file.h"
-#include "log-httplog.h"
 #include "output.h"
-#include "source-pfring.h"
-#include "detect-engine-mpm.h"
-
-#include "alert-fastlog.h"
-#include "alert-prelude.h"
-#include "alert-unified2-alert.h"
-#include "alert-debuglog.h"
 
 #include "util-debug.h"
 #include "util-time.h"
@@ -36,6 +28,8 @@
 #include "util-affinity.h"
 #include "unix-manager.h"
 
+#include "detect-engine.h"
+
 #include "flow-manager.h"
 #include "flow-timeout.h"
 #include "stream-tcp.h"
@@ -56,7 +50,6 @@ typedef struct PcapFiles_ {
 } PcapFiles;
 
 typedef struct PcapCommand_ {
-    DetectEngineCtx *de_ctx;
     TAILQ_HEAD(, PcapFiles_) files;
     int running;
     char *currentfile;
@@ -354,7 +347,7 @@ TmEcode UnixSocketPcapFilesCheck(void *data)
         StreamTcpInitConfig(STREAM_VERBOSE);
         RunModeInitializeOutputs();
         SCPerfInitCounterApi();
-        RunModeDispatch(RUNMODE_PCAP_FILE, NULL, this->de_ctx);
+        RunModeDispatch(RUNMODE_PCAP_FILE, NULL);
         FlowManagerThreadSpawn();
         FlowRecyclerThreadSpawn();
         SCPerfSpawnThreads();
@@ -396,7 +389,7 @@ void UnixSocketPcapFile(TmEcode tm)
 /**
  * \brief Single thread version of the Pcap file processing.
  */
-int RunModeUnixSocketSingle(DetectEngineCtx *de_ctx)
+int RunModeUnixSocketSingle(void)
 {
 #ifdef BUILD_UNIX_SOCKET
     PcapCommand *pcapcmd = SCMalloc(sizeof(PcapCommand));
@@ -405,12 +398,11 @@ int RunModeUnixSocketSingle(DetectEngineCtx *de_ctx)
         SCLogError(SC_ERR_MEM_ALLOC, "Can not allocate pcap command");
         return 1;
     }
-    pcapcmd->de_ctx = de_ctx;
     TAILQ_INIT(&pcapcmd->files);
     pcapcmd->running = 0;
     pcapcmd->currentfile = NULL;
 
-    UnixManagerThreadSpawn(de_ctx, 1);
+    UnixManagerThreadSpawn(1);
 
     unix_socket_mode_is_running = 1;
 
index c2674f2d4a3d7ea1c7dc1294bcc7fa05db25c8b0..578469ec242d9fb9e27fda3b102afbb6ceaacc4c 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef __RUNMODE_UNIX_SOCKET_H__
 #define __RUNMODE_UNIX_SOCKET_H__
 
-int RunModeUnixSocketSingle(DetectEngineCtx *);
+int RunModeUnixSocketSingle(void);
 void RunModeUnixSocketRegister(void);
 const char *RunModeUnixSocketGetDefaultMode(void);
 
index 4ce80d7a937d31dd6ab403cad5874208e070520e..5fd9b91458219baed8b256ae1f1e641c5ee714eb 100644 (file)
@@ -60,7 +60,7 @@ typedef struct RunMode_ {
     const char *name;
     const char *description;
     /* runmode function */
-    int (*RunModeFunc)(DetectEngineCtx *);
+    int (*RunModeFunc)(void);
 } RunMode;
 
 typedef struct RunModes_ {
@@ -154,7 +154,6 @@ static const char *RunModeTranslateModeToName(int runmode)
  *
  * \param runmode            The runmode type.
  * \param runmode_customd_id The runmode custom id.
- * \param de_ctx             Detection Engine Context.
  */
 static RunMode *RunModeGetCustomMode(int runmode, const char *custom_mode)
 {
@@ -264,9 +263,8 @@ void RunModeListRunmodes(void)
 }
 
 /**
- *  \param de_ctx Detection engine ctx. Can be NULL is detect is disabled.
  */
-void RunModeDispatch(int runmode, const char *custom_mode, DetectEngineCtx *de_ctx)
+void RunModeDispatch(int runmode, const char *custom_mode)
 {
     char *local_custom_mode = NULL;
 
@@ -365,7 +363,7 @@ void RunModeDispatch(int runmode, const char *custom_mode, DetectEngineCtx *de_c
         exit(EXIT_FAILURE);
     }
 
-    mode->RunModeFunc(de_ctx);
+    mode->RunModeFunc();
 
     if (local_custom_mode != NULL)
         SCFree(local_custom_mode);
@@ -383,7 +381,7 @@ void RunModeDispatch(int runmode, const char *custom_mode, DetectEngineCtx *de_c
  */
 void RunModeRegisterNewRunMode(int runmode, const char *name,
                                const char *description,
-                               int (*RunModeFunc)(DetectEngineCtx *))
+                               int (*RunModeFunc)(void))
 {
     void *ptmp;
     if (RunModeGetCustomMode(runmode, name) != NULL) {
index 80ad652b34b44b6c765fc1a5e799e08226e533a7..bd8d03263eb9a47d602d76ac3a036c18440a127f 100644 (file)
@@ -64,10 +64,10 @@ char *RunmodeGetActive(void);
 const char *RunModeGetMainMode(void);
 
 void RunModeListRunmodes(void);
-void RunModeDispatch(int, const char *, DetectEngineCtx *);
+void RunModeDispatch(int, const char *);
 void RunModeRegisterRunModes(void);
 void RunModeRegisterNewRunMode(int, const char *, const char *,
-                               int (*RunModeFunc)(DetectEngineCtx *));
+                               int (*RunModeFunc)(void));
 void RunModeInitialize(void);
 void RunModeInitializeOutputs(void);
 void SetupOutputs(ThreadVars *);
index 96a61b819038b1e53121286187e0f8f35fbaf697..ff9ff74c7a45b26659446a42ece6fe02b0234774 100644 (file)
@@ -2359,7 +2359,7 @@ int main(int argc, char **argv)
         exit(EXIT_SUCCESS);
     }
 
-    RunModeDispatch(suri.run_mode, suri.runmode_custom_mode, de_ctx);
+    RunModeDispatch(suri.run_mode, suri.runmode_custom_mode);
 
     /* In Unix socket runmode, Flow manager is started on demand */
     if (suri.run_mode != RUNMODE_UNIX_SOCKET) {
@@ -2368,7 +2368,7 @@ int main(int argc, char **argv)
         if (ConfGetBool("unix-command.enabled", &unix_socket) != 1)
             unix_socket = 0;
         if (unix_socket == 1) {
-            UnixManagerThreadSpawn(de_ctx, 0);
+            UnixManagerThreadSpawn(0);
 #ifdef BUILD_UNIX_SOCKET
             UnixManagerRegisterCommand("iface-stat", LiveDeviceIfaceStat, NULL,
                                        UNIX_CMD_TAKE_ARGS);
index c3fbfc3d898ccbced026ba7087b483192dea2ff7..e9538a194b04b1ce52c6d05d6615d638bce424f8 100644 (file)
@@ -903,10 +903,9 @@ void *UnixManagerThread(void *td)
 
 /** \brief Spawn the unix socket manager thread
  *
- * \param de_ctx context for detection engine
  * \param mode if set to 1, init failure cause suricata exit
  * */
-void UnixManagerThreadSpawn(DetectEngineCtx *de_ctx, int mode)
+void UnixManagerThreadSpawn(int mode)
 {
     ThreadVars *tv_unixmgr = NULL;
 
index 937737ef110a74f4a22e39db6eaf3a016c055036..2bbdee11ed997c11783bb02ed05bf6a2874b99ae 100644 (file)
@@ -33,7 +33,7 @@
 SCCtrlCondT unix_manager_ctrl_cond;
 SCCtrlMutex unix_manager_ctrl_mutex;
 
-void UnixManagerThreadSpawn(DetectEngineCtx *de_ctx, int mode);
+void UnixManagerThreadSpawn(int mode);
 void UnixSocketKillSocketThread(void);
 
 
index 26ef2b76c0dca8cd8b5cd9d4acd1eddfc9e75a80..5e89f7b28dde40112bffccd5d17f608a8711a073 100644 (file)
@@ -32,6 +32,8 @@
 #include "runmode-af-packet.h"
 #include "log-httplog.h"
 #include "output.h"
+
+#include "detect-engine.h"
 #include "detect-engine-mpm.h"
 
 #include "alert-fastlog.h"
@@ -97,10 +99,8 @@ char *RunmodeAutoFpCreatePickupQueuesString(int n)
 }
 
 /**
- *  \param de_ctx detection engine, can be NULL
  */
-int RunModeSetLiveCaptureAutoFp(DetectEngineCtx *de_ctx,
-                              ConfigIfaceParserFunc ConfigParser,
+int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
                               ConfigIfaceThreadsCountFunc ModThreadsCount,
                               char *recv_mod_name,
                               char *decode_mod_name, char *thread_name,
@@ -275,14 +275,13 @@ int RunModeSetLiveCaptureAutoFp(DetectEngineCtx *de_ctx,
         }
         TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
 
-        if (de_ctx != NULL) {
+        if (DetectEngineEnabled()) {
             tm_module = TmModuleGetByName("Detect");
             if (tm_module == NULL) {
                 SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
                 exit(EXIT_FAILURE);
             }
-            TmSlotSetFuncAppendDelayed(tv_detect_ncpu, tm_module,
-                    (void *)de_ctx, de_ctx->delayed_detect);
+            TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
         }
 
         TmThreadSetCPU(tv_detect_ncpu, DETECT_CPU_SET);
@@ -315,10 +314,8 @@ int RunModeSetLiveCaptureAutoFp(DetectEngineCtx *de_ctx,
 }
 
 /**
- *  \param de_ctx detection engine, can be NULL
  */
-static int RunModeSetLiveCaptureWorkersForDevice(DetectEngineCtx *de_ctx,
-                              ConfigIfaceThreadsCountFunc ModThreadsCount,
+static int RunModeSetLiveCaptureWorkersForDevice(ConfigIfaceThreadsCountFunc ModThreadsCount,
                               char *recv_mod_name,
                               char *decode_mod_name, char *thread_name,
                               const char *live_dev, void *aconf,
@@ -382,14 +379,13 @@ static int RunModeSetLiveCaptureWorkersForDevice(DetectEngineCtx *de_ctx,
         }
         TmSlotSetFuncAppend(tv, tm_module, NULL);
 
-        if (de_ctx != NULL) {
+        if (DetectEngineEnabled()) {
             tm_module = TmModuleGetByName("Detect");
             if (tm_module == NULL) {
                 SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
                 exit(EXIT_FAILURE);
             }
-            TmSlotSetFuncAppendDelayed(tv, tm_module,
-                    (void *)de_ctx, de_ctx->delayed_detect);
+            TmSlotSetFuncAppend(tv, tm_module, NULL);
         }
 
         tm_module = TmModuleGetByName("RespondReject");
@@ -412,8 +408,7 @@ static int RunModeSetLiveCaptureWorkersForDevice(DetectEngineCtx *de_ctx,
     return 0;
 }
 
-int RunModeSetLiveCaptureWorkers(DetectEngineCtx *de_ctx,
-                              ConfigIfaceParserFunc ConfigParser,
+int RunModeSetLiveCaptureWorkers(ConfigIfaceParserFunc ConfigParser,
                               ConfigIfaceThreadsCountFunc ModThreadsCount,
                               char *recv_mod_name,
                               char *decode_mod_name, char *thread_name,
@@ -436,8 +431,7 @@ int RunModeSetLiveCaptureWorkers(DetectEngineCtx *de_ctx,
             live_dev_c = LiveGetDeviceName(ldev);
             aconf = ConfigParser(live_dev_c);
         }
-        RunModeSetLiveCaptureWorkersForDevice(de_ctx,
-                ModThreadsCount,
+        RunModeSetLiveCaptureWorkersForDevice(ModThreadsCount,
                 recv_mod_name,
                 decode_mod_name,
                 thread_name,
@@ -449,8 +443,7 @@ int RunModeSetLiveCaptureWorkers(DetectEngineCtx *de_ctx,
     return 0;
 }
 
-int RunModeSetLiveCaptureSingle(DetectEngineCtx *de_ctx,
-                              ConfigIfaceParserFunc ConfigParser,
+int RunModeSetLiveCaptureSingle(ConfigIfaceParserFunc ConfigParser,
                               ConfigIfaceThreadsCountFunc ModThreadsCount,
                               char *recv_mod_name,
                               char *decode_mod_name, char *thread_name,
@@ -473,7 +466,7 @@ int RunModeSetLiveCaptureSingle(DetectEngineCtx *de_ctx,
         /* \todo Set threads number in config to 1 */
     }
 
-    return RunModeSetLiveCaptureWorkersForDevice(de_ctx,
+    return RunModeSetLiveCaptureWorkersForDevice(
                                  ModThreadsCount,
                                  recv_mod_name,
                                  decode_mod_name,
@@ -485,10 +478,8 @@ int RunModeSetLiveCaptureSingle(DetectEngineCtx *de_ctx,
 
 
 /**
- *  \param de_ctx detection engine, can be NULL
  */
-int RunModeSetIPSAutoFp(DetectEngineCtx *de_ctx,
-                        ConfigIPSParserFunc ConfigParser,
+int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
                         char *recv_mod_name,
                         char *verdict_mod_name,
                         char *decode_mod_name)
@@ -592,14 +583,13 @@ int RunModeSetIPSAutoFp(DetectEngineCtx *de_ctx,
         }
         TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
 
-        if (de_ctx != NULL) {
+        if (DetectEngineEnabled()) {
             tm_module = TmModuleGetByName("Detect");
             if (tm_module == NULL) {
                 SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
                 exit(EXIT_FAILURE);
             }
-            TmSlotSetFuncAppendDelayed(tv_detect_ncpu, tm_module,
-                    (void *)de_ctx, de_ctx->delayed_detect);
+            TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
         }
 
         TmThreadSetCPU(tv_detect_ncpu, DETECT_CPU_SET);
@@ -665,10 +655,8 @@ int RunModeSetIPSAutoFp(DetectEngineCtx *de_ctx,
 }
 
 /**
- *  \param de_ctx detection engine, can be NULL
  */
-int RunModeSetIPSWorker(DetectEngineCtx *de_ctx,
-        ConfigIPSParserFunc ConfigParser,
+int RunModeSetIPSWorker(ConfigIPSParserFunc ConfigParser,
         char *recv_mod_name,
         char *verdict_mod_name,
         char *decode_mod_name)
@@ -725,14 +713,13 @@ int RunModeSetIPSWorker(DetectEngineCtx *de_ctx,
         }
         TmSlotSetFuncAppend(tv, tm_module, NULL);
 
-        if (de_ctx != NULL) {
+        if (DetectEngineEnabled()) {
             tm_module = TmModuleGetByName("Detect");
             if (tm_module == NULL) {
                 SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
                 exit(EXIT_FAILURE);
             }
-            TmSlotSetFuncAppendDelayed(tv, tm_module,
-                    (void *)de_ctx, de_ctx->delayed_detect);
+            TmSlotSetFuncAppend(tv, tm_module, NULL);
         }
 
         tm_module = TmModuleGetByName(verdict_mod_name);
@@ -741,7 +728,7 @@ int RunModeSetIPSWorker(DetectEngineCtx *de_ctx,
             exit(EXIT_FAILURE);
         }
 
-        TmSlotSetFuncAppend(tv, tm_module, (void *)de_ctx);
+        TmSlotSetFuncAppend(tv, tm_module, NULL);
 
         tm_module = TmModuleGetByName("RespondReject");
         if (tm_module == NULL) {
index c1852ccd8aac88e4b808bc5357bf9d8b1253f04f..607895a4ab38ebbe27ce820790f89c1a557ca9f8 100644 (file)
@@ -30,48 +30,36 @@ typedef void *(*ConfigIfaceParserFunc) (const char *);
 typedef void *(*ConfigIPSParserFunc) (int);
 typedef int (*ConfigIfaceThreadsCountFunc) (void *);
 
-int RunModeSetLiveCaptureAuto(DetectEngineCtx *de_ctx,
-                              ConfigIfaceParserFunc configparser,
+int RunModeSetLiveCaptureAuto(ConfigIfaceParserFunc configparser,
                               ConfigIfaceThreadsCountFunc ModThreadsCount,
                               char *recv_mod_name,
                               char *decode_mod_name, char *thread_name,
                               const char *live_dev);
 
-int RunModeSetLiveCaptureAutoFp(DetectEngineCtx *de_ctx,
-                              ConfigIfaceParserFunc configparser,
+int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc configparser,
                               ConfigIfaceThreadsCountFunc ModThreadsCount,
                               char *recv_mod_name,
                               char *decode_mod_name, char *thread_name,
                               const char *live_dev);
 
-int RunModeSetLiveCaptureSingle(DetectEngineCtx *de_ctx,
-                              ConfigIfaceParserFunc configparser,
+int RunModeSetLiveCaptureSingle(ConfigIfaceParserFunc configparser,
                               ConfigIfaceThreadsCountFunc ModThreadsCount,
                               char *recv_mod_name,
                               char *decode_mod_name, char *thread_name,
                               const char *live_dev);
 
-int RunModeSetLiveCaptureWorkers(DetectEngineCtx *de_ctx,
-                              ConfigIfaceParserFunc configparser,
+int RunModeSetLiveCaptureWorkers(ConfigIfaceParserFunc configparser,
                               ConfigIfaceThreadsCountFunc ModThreadsCount,
                               char *recv_mod_name,
                               char *decode_mod_name, char *thread_name,
                               const char *live_dev);
 
-int RunModeSetIPSAuto(DetectEngineCtx *de_ctx,
-                      ConfigIPSParserFunc ConfigParser,
-                      char *recv_mod_name,
-                      char *verdict_mod_name,
-                      char *decode_mod_name);
-
-int RunModeSetIPSAutoFp(DetectEngineCtx *de_ctx,
-                        ConfigIPSParserFunc ConfigParser,
+int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
                         char *recv_mod_name,
                         char *verdict_mod_name,
                         char *decode_mod_name);
 
-int RunModeSetIPSWorker(DetectEngineCtx *de_ctx,
-                        ConfigIPSParserFunc ConfigParser,
+int RunModeSetIPSWorker(ConfigIPSParserFunc ConfigParser,
                         char *recv_mod_name,
                         char *verdict_mod_name,
                         char *decode_mod_name);