nflog: fix missing util-time include; cleanups

pull/7670/head
Victor Julien 3 years ago
parent 09c0128138
commit ebc2714e07

@ -33,26 +33,9 @@
#include "source-nflog.h" #include "source-nflog.h"
const char *RunModeIdsNflogGetDefaultMode(void)
{
return "autofp";
}
void RunModeIdsNflogRegister(void)
{
RunModeRegisterNewRunMode(RUNMODE_NFLOG, "autofp",
"Multi threaded nflog mode",
RunModeIdsNflogAutoFp);
RunModeRegisterNewRunMode(RUNMODE_NFLOG, "single",
"Single threaded nflog mode",
RunModeIdsNflogSingle);
RunModeRegisterNewRunMode(RUNMODE_NFLOG, "workers",
"Workers nflog mode",
RunModeIdsNflogWorkers);
return;
}
#ifdef HAVE_NFLOG #ifdef HAVE_NFLOG
#include "util-time.h"
static void NflogDerefConfig(void *data) static void NflogDerefConfig(void *data)
{ {
NflogGroupConfig *nflogconf = (NflogGroupConfig *)data; NflogGroupConfig *nflogconf = (NflogGroupConfig *)data;
@ -165,23 +148,16 @@ static int NflogConfigGeThreadsCount(void *conf)
} }
#endif #endif
int RunModeIdsNflogAutoFp(void) static int RunModeIdsNflogAutoFp(void)
{ {
SCEnter(); SCEnter();
#ifdef HAVE_NFLOG #ifdef HAVE_NFLOG
int ret = 0;
char *live_dev = NULL;
RunModeInitialize(); RunModeInitialize();
TimeModeSetLive(); TimeModeSetLive();
ret = RunModeSetLiveCaptureAutoFp(ParseNflogConfig, int ret = RunModeSetLiveCaptureAutoFp(ParseNflogConfig, NflogConfigGeThreadsCount,
NflogConfigGeThreadsCount, "ReceiveNFLOG", "DecodeNFLOG", thread_name_autofp, NULL);
"ReceiveNFLOG",
"DecodeNFLOG",
thread_name_autofp,
live_dev);
if (ret != 0) { if (ret != 0) {
FatalError(SC_ERR_FATAL, "Unable to start runmode"); FatalError(SC_ERR_FATAL, "Unable to start runmode");
} }
@ -192,23 +168,16 @@ int RunModeIdsNflogAutoFp(void)
SCReturnInt(0); SCReturnInt(0);
} }
int RunModeIdsNflogSingle(void) static int RunModeIdsNflogSingle(void)
{ {
SCEnter(); SCEnter();
#ifdef HAVE_NFLOG #ifdef HAVE_NFLOG
int ret = 0;
char *live_dev = NULL;
RunModeInitialize(); RunModeInitialize();
TimeModeSetLive(); TimeModeSetLive();
ret = RunModeSetLiveCaptureSingle(ParseNflogConfig, int ret = RunModeSetLiveCaptureSingle(ParseNflogConfig, NflogConfigGeThreadsCount,
NflogConfigGeThreadsCount, "ReceiveNFLOG", "DecodeNFLOG", thread_name_single, NULL);
"ReceiveNFLOG",
"DecodeNFLOG",
thread_name_single,
live_dev);
if (ret != 0) { if (ret != 0) {
FatalError(SC_ERR_FATAL, "Unable to start runmode"); FatalError(SC_ERR_FATAL, "Unable to start runmode");
} }
@ -219,23 +188,16 @@ int RunModeIdsNflogSingle(void)
SCReturnInt(0); SCReturnInt(0);
} }
int RunModeIdsNflogWorkers(void) static int RunModeIdsNflogWorkers(void)
{ {
SCEnter(); SCEnter();
#ifdef HAVE_NFLOG #ifdef HAVE_NFLOG
int ret = 0;
char *live_dev = NULL;
RunModeInitialize(); RunModeInitialize();
TimeModeSetLive(); TimeModeSetLive();
ret = RunModeSetLiveCaptureWorkers(ParseNflogConfig, int ret = RunModeSetLiveCaptureWorkers(ParseNflogConfig, NflogConfigGeThreadsCount,
NflogConfigGeThreadsCount, "ReceiveNFLOG", "DecodeNFLOG", thread_name_workers, NULL);
"ReceiveNFLOG",
"DecodeNFLOG",
thread_name_workers,
live_dev);
if (ret != 0) { if (ret != 0) {
FatalError(SC_ERR_FATAL, "Unable to start runmode"); FatalError(SC_ERR_FATAL, "Unable to start runmode");
} }
@ -245,3 +207,19 @@ int RunModeIdsNflogWorkers(void)
SCReturnInt(0); SCReturnInt(0);
} }
const char *RunModeIdsNflogGetDefaultMode(void)
{
return "autofp";
}
void RunModeIdsNflogRegister(void)
{
RunModeRegisterNewRunMode(
RUNMODE_NFLOG, "autofp", "Multi threaded nflog mode", RunModeIdsNflogAutoFp);
RunModeRegisterNewRunMode(
RUNMODE_NFLOG, "single", "Single threaded nflog mode", RunModeIdsNflogSingle);
RunModeRegisterNewRunMode(
RUNMODE_NFLOG, "workers", "Workers nflog mode", RunModeIdsNflogWorkers);
return;
}

@ -23,9 +23,6 @@
#ifndef __RUNMODE_NFLOG_H__ #ifndef __RUNMODE_NFLOG_H__
#define __RUNMODE_NFLOG_H__ #define __RUNMODE_NFLOG_H__
int RunModeIdsNflogAutoFp(void);
int RunModeIdsNflogSingle(void);
int RunModeIdsNflogWorkers(void);
void RunModeIdsNflogRegister(void); void RunModeIdsNflogRegister(void);
const char *RunModeIdsNflogGetDefaultMode(void); const char *RunModeIdsNflogGetDefaultMode(void);

Loading…
Cancel
Save