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;
int DetectEngineMoveToFreeList(DetectEngineCtx *de_ctx);
void DetectEngineDeReference(DetectEngineCtx **de_ctx);
int DetectEngineReload(void);
+int DetectEngineEnabled(void);
/**
* \brief Registers an app inspection engine.
return has_ips;
}
-int RunModeIdsAFPAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIdsAFPAutoFp(void)
{
SCEnter();
exit(EXIT_FAILURE);
}
- ret = RunModeSetLiveCaptureAutoFp(de_ctx,
- ParseAFPConfig,
+ ret = RunModeSetLiveCaptureAutoFp(ParseAFPConfig,
AFPConfigGeThreadsCount,
"ReceiveAFP",
"DecodeAFP", "RxAFP",
/**
* \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();
exit(EXIT_FAILURE);
}
- ret = RunModeSetLiveCaptureSingle(de_ctx,
- ParseAFPConfig,
+ ret = RunModeSetLiveCaptureSingle(ParseAFPConfig,
AFPConfigGeThreadsCount,
"ReceiveAFP",
"DecodeAFP", "AFPacket",
* 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();
exit(EXIT_FAILURE);
}
- ret = RunModeSetLiveCaptureWorkers(de_ctx,
- ParseAFPConfig,
+ ret = RunModeSetLiveCaptureWorkers(ParseAFPConfig,
AFPConfigGeThreadsCount,
"ReceiveAFP",
"DecodeAFP", "AFPacket",
#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();
#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"
return;
}
-int RunModeIdsErfDagSingle(DetectEngineCtx *de_ctx)
+int RunModeIdsErfDagSingle(void)
{
int ret;
TimeModeSetLive();
- ret = RunModeSetLiveCaptureSingle(de_ctx,
- ParseDagConfig,
+ ret = RunModeSetLiveCaptureSingle(ParseDagConfig,
DagConfigGetThreadCount,
"ReceiveErfDag",
"DecodeErfDag",
SCReturnInt(0);
}
-int RunModeIdsErfDagAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIdsErfDagAutoFp(void)
{
int ret;
TimeModeSetLive();
- ret = RunModeSetLiveCaptureAutoFp(de_ctx,
- ParseDagConfig,
+ ret = RunModeSetLiveCaptureAutoFp(ParseDagConfig,
DagConfigGetThreadCount,
"ReceiveErfDag",
"DecodeErfDag",
SCReturnInt(0);
}
-int RunModeIdsErfDagWorkers(DetectEngineCtx *de_ctx)
+int RunModeIdsErfDagWorkers(void)
{
int ret;
TimeModeSetLive();
- ret = RunModeSetLiveCaptureWorkers(de_ctx,
- ParseDagConfig,
+ ret = RunModeSetLiveCaptureWorkers(ParseDagConfig,
DagConfigGetThreadCount,
"ReceiveErfDag",
"DecodeErfDag",
#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);
#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"
return;
}
-int RunModeErfFileSingle(DetectEngineCtx *de_ctx)
+int RunModeErfFileSingle(void)
{
char *file;
}
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);
SCReturnInt(0);
}
-int RunModeErfFileAutoFp(DetectEngineCtx *de_ctx)
+int RunModeErfFileAutoFp(void)
{
SCEnter();
char tname[TM_THREAD_NAME_MAX];
}
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) {
#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);
#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"
return;
}
-int RunModeIpsIPFWAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIpsIPFWAutoFp(void)
{
SCEnter();
int ret = 0;
LiveDeviceHasNoStats();
- ret = RunModeSetIPSAutoFp(de_ctx,
- IPFWGetThread,
+ ret = RunModeSetIPSAutoFp(IPFWGetThread,
"ReceiveIPFW",
"VerdictIPFW",
"DecodeIPFW");
return ret;
}
-int RunModeIpsIPFWWorker(DetectEngineCtx *de_ctx)
+int RunModeIpsIPFWWorker(void)
{
SCEnter();
int ret = 0;
LiveDeviceHasNoStats();
- ret = RunModeSetIPSWorker(de_ctx,
- IPFWGetThread,
+ ret = RunModeSetIPSWorker(IPFWGetThread,
"ReceiveIPFW",
"VerdictIPFW",
"DecodeIPFW");
#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);
#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"
return 1;
}
-int NapatechInit(DetectEngineCtx *de_ctx, int runmode)
+static int NapatechInit(int runmode)
{
int ret;
char errbuf[100];
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;
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
#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);
#endif // #ifdef HAVE_NETMAP
-int RunModeIdsNetmapAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIdsNetmapAutoFp(void)
{
SCEnter();
SCLogDebug("live_dev %s", live_dev);
- ret = RunModeSetLiveCaptureAutoFp(de_ctx,
+ ret = RunModeSetLiveCaptureAutoFp(
ParseNetmapConfig,
NetmapConfigGeThreadsCount,
"ReceiveNetmap",
/**
* \brief Single thread version of the netmap processing.
*/
-int RunModeIdsNetmapSingle(DetectEngineCtx *de_ctx)
+int RunModeIdsNetmapSingle(void)
{
SCEnter();
(void)ConfGet("netmap.live-interface", &live_dev);
- ret = RunModeSetLiveCaptureSingle(de_ctx,
+ ret = RunModeSetLiveCaptureSingle(
ParseNetmapConfig,
NetmapConfigGeThreadsCount,
"ReceiveNetmap",
* Start N threads with each thread doing all the work.
*
*/
-int RunModeIdsNetmapWorkers(DetectEngineCtx *de_ctx)
+int RunModeIdsNetmapWorkers(void)
{
SCEnter();
(void)ConfGet("netmap.live-interface", &live_dev);
- ret = RunModeSetLiveCaptureWorkers(de_ctx,
+ ret = RunModeSetLiveCaptureWorkers(
ParseNetmapConfig,
NetmapConfigGeThreadsCount,
"ReceiveNetmap",
#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();
return 1;
}
-int RunModeIdsNflogAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIdsNflogAutoFp(void)
{
SCEnter();
RunModeInitialize();
TimeModeSetLive();
- ret = RunModeSetLiveCaptureAutoFp(de_ctx,
- ParseNflogConfig,
+ ret = RunModeSetLiveCaptureAutoFp(ParseNflogConfig,
NflogConfigGeThreadsCount,
"ReceiveNFLOG",
"DecodeNFLOG",
SCReturnInt(0);
}
-int RunModeIdsNflogSingle(DetectEngineCtx *de_ctx)
+int RunModeIdsNflogSingle(void)
{
SCEnter();
RunModeInitialize();
TimeModeSetLive();
- ret = RunModeSetLiveCaptureSingle(de_ctx,
- ParseNflogConfig,
+ ret = RunModeSetLiveCaptureSingle(ParseNflogConfig,
NflogConfigGeThreadsCount,
"ReceiveNFLOG",
"DecodeNFLOG",
SCReturnInt(0);
}
-int RunModeIdsNflogWorkers(DetectEngineCtx *de_ctx)
+int RunModeIdsNflogWorkers(void)
{
SCEnter();
RunModeInitialize();
TimeModeSetLive();
- ret = RunModeSetLiveCaptureWorkers(de_ctx,
- ParseNflogConfig,
+ ret = RunModeSetLiveCaptureWorkers(ParseNflogConfig,
NflogConfigGeThreadsCount,
"ReceiveNFLOG",
"DecodeNFLOG",
#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);
#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"
return;
}
-int RunModeIpsNFQAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIpsNFQAutoFp(void)
{
SCEnter();
int ret = 0;
LiveDeviceHasNoStats();
- ret = RunModeSetIPSAutoFp(de_ctx,
- NFQGetThread,
+ ret = RunModeSetIPSAutoFp(NFQGetThread,
"ReceiveNFQ",
"VerdictNFQ",
"DecodeNFQ");
return ret;
}
-int RunModeIpsNFQWorker(DetectEngineCtx *de_ctx)
+int RunModeIpsNFQWorker(void)
{
SCEnter();
int ret = 0;
LiveDeviceHasNoStats();
- ret = RunModeSetIPSWorker(de_ctx,
- NFQGetThread,
+ ret = RunModeSetIPSWorker(NFQGetThread,
"ReceiveNFQ",
"VerdictNFQ",
"DecodeNFQ");
#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);
#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"
/**
* \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) {
}
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);
* 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];
}
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");
#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);
#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"
return default_mode;
}
-int RunModeIdsPcapWorkers(DetectEngineCtx *de_ctx);
+int RunModeIdsPcapWorkers(void);
void RunModeIdsPcapRegister(void)
{
/**
* \brief Single thread version of the Pcap live processing.
*/
-int RunModeIdsPcapSingle(DetectEngineCtx *de_ctx)
+int RunModeIdsPcapSingle(void)
{
int ret;
char *live_dev = NULL;
(void)ConfGet("pcap.single-pcap-dev", &live_dev);
- ret = RunModeSetLiveCaptureSingle(de_ctx,
- ParsePcapConfig,
+ ret = RunModeSetLiveCaptureSingle(ParsePcapConfig,
PcapConfigGeThreadsCount,
"ReceivePcap",
"DecodePcap", "PcapLive",
* 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;
(void) ConfGet("pcap.single-pcap-dev", &live_dev);
- ret = RunModeSetLiveCaptureAutoFp(de_ctx,
- ParsePcapConfig,
+ ret = RunModeSetLiveCaptureAutoFp(ParsePcapConfig,
PcapConfigGeThreadsCount,
"ReceivePcap",
"DecodePcap", "RxPcap",
* Start N threads with each thread doing all the work.
*
*/
-int RunModeIdsPcapWorkers(DetectEngineCtx *de_ctx)
+int RunModeIdsPcapWorkers(void)
{
int ret;
char *live_dev = NULL;
(void) ConfGet("pcap.single-pcap-dev", &live_dev);
- ret = RunModeSetLiveCaptureWorkers(de_ctx,
- ParsePcapConfig,
+ ret = RunModeSetLiveCaptureWorkers(ParsePcapConfig,
PcapConfigGeThreadsCount,
"ReceivePcap",
"DecodePcap", "RxPcap",
#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);
#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"
}
#endif
-int RunModeIdsPfringAutoFp(DetectEngineCtx *de_ctx)
+int RunModeIdsPfringAutoFp(void)
{
SCEnter();
exit(EXIT_FAILURE);
}
- ret = RunModeSetLiveCaptureAutoFp(de_ctx,
- tparser,
+ ret = RunModeSetLiveCaptureAutoFp(tparser,
PfringConfigGeThreadsCount,
"ReceivePfring",
"DecodePfring", "RxPFR",
return 0;
}
-int RunModeIdsPfringSingle(DetectEngineCtx *de_ctx)
+int RunModeIdsPfringSingle(void)
{
SCEnter();
exit(EXIT_FAILURE);
}
- ret = RunModeSetLiveCaptureSingle(de_ctx,
- tparser,
+ ret = RunModeSetLiveCaptureSingle(tparser,
PfringConfigGeThreadsCount,
"ReceivePfring",
"DecodePfring", "RxPFR",
return 0;
}
-int RunModeIdsPfringWorkers(DetectEngineCtx *de_ctx)
+int RunModeIdsPfringWorkers(void)
{
SCEnter();
exit(EXIT_FAILURE);
}
- ret = RunModeSetLiveCaptureWorkers(de_ctx,
- tparser,
+ ret = RunModeSetLiveCaptureWorkers(tparser,
PfringConfigGeThreadsCount,
"ReceivePfring",
"DecodePfring", "RxPFR",
#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);
#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"
/**
* \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];
}
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");
extern int tile_num_pipelines;
-int RunModeTileMpipeWorkers(DetectEngineCtx *);
+int RunModeTileMpipeWorkers(void);
void *ParseMpipeConfig(const char *iface);
#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"
#include "util-affinity.h"
#include "unix-manager.h"
+#include "detect-engine.h"
+
#include "flow-manager.h"
#include "flow-timeout.h"
#include "stream-tcp.h"
} PcapFiles;
typedef struct PcapCommand_ {
- DetectEngineCtx *de_ctx;
TAILQ_HEAD(, PcapFiles_) files;
int running;
char *currentfile;
StreamTcpInitConfig(STREAM_VERBOSE);
RunModeInitializeOutputs();
SCPerfInitCounterApi();
- RunModeDispatch(RUNMODE_PCAP_FILE, NULL, this->de_ctx);
+ RunModeDispatch(RUNMODE_PCAP_FILE, NULL);
FlowManagerThreadSpawn();
FlowRecyclerThreadSpawn();
SCPerfSpawnThreads();
/**
* \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));
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;
#ifndef __RUNMODE_UNIX_SOCKET_H__
#define __RUNMODE_UNIX_SOCKET_H__
-int RunModeUnixSocketSingle(DetectEngineCtx *);
+int RunModeUnixSocketSingle(void);
void RunModeUnixSocketRegister(void);
const char *RunModeUnixSocketGetDefaultMode(void);
const char *name;
const char *description;
/* runmode function */
- int (*RunModeFunc)(DetectEngineCtx *);
+ int (*RunModeFunc)(void);
} RunMode;
typedef struct RunModes_ {
*
* \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)
{
}
/**
- * \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;
exit(EXIT_FAILURE);
}
- mode->RunModeFunc(de_ctx);
+ mode->RunModeFunc();
if (local_custom_mode != NULL)
SCFree(local_custom_mode);
*/
void RunModeRegisterNewRunMode(int runmode, const char *name,
const char *description,
- int (*RunModeFunc)(DetectEngineCtx *))
+ int (*RunModeFunc)(void))
{
void *ptmp;
if (RunModeGetCustomMode(runmode, name) != NULL) {
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 *);
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) {
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);
/** \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;
SCCtrlCondT unix_manager_ctrl_cond;
SCCtrlMutex unix_manager_ctrl_mutex;
-void UnixManagerThreadSpawn(DetectEngineCtx *de_ctx, int mode);
+void UnixManagerThreadSpawn(int mode);
void UnixSocketKillSocketThread(void);
#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"
}
/**
- * \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,
}
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);
}
/**
- * \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,
}
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");
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,
live_dev_c = LiveGetDeviceName(ldev);
aconf = ConfigParser(live_dev_c);
}
- RunModeSetLiveCaptureWorkersForDevice(de_ctx,
- ModThreadsCount,
+ RunModeSetLiveCaptureWorkersForDevice(ModThreadsCount,
recv_mod_name,
decode_mod_name,
thread_name,
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,
/* \todo Set threads number in config to 1 */
}
- return RunModeSetLiveCaptureWorkersForDevice(de_ctx,
+ return RunModeSetLiveCaptureWorkersForDevice(
ModThreadsCount,
recv_mod_name,
decode_mod_name,
/**
- * \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)
}
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);
}
/**
- * \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)
}
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);
exit(EXIT_FAILURE);
}
- TmSlotSetFuncAppend(tv, tm_module, (void *)de_ctx);
+ TmSlotSetFuncAppend(tv, tm_module, NULL);
tm_module = TmModuleGetByName("RespondReject");
if (tm_module == NULL) {
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);