suricata
runmodes.c File Reference
#include "suricata-common.h"
#include "detect.h"
#include "detect-engine.h"
#include "detect-engine-mpm.h"
#include "app-layer-parser.h"
#include "tm-threads.h"
#include "util-debug.h"
#include "util-time.h"
#include "util-cpu.h"
#include "util-byte.h"
#include "util-affinity.h"
#include "conf.h"
#include "queue.h"
#include "runmodes.h"
#include "runmode-af-packet.h"
#include "runmode-af-xdp.h"
#include "runmode-dpdk.h"
#include "runmode-erf-dag.h"
#include "runmode-erf-file.h"
#include "runmode-ipfw.h"
#include "runmode-napatech.h"
#include "runmode-netmap.h"
#include "runmode-nflog.h"
#include "runmode-nfq.h"
#include "runmode-pcap.h"
#include "runmode-pcap-file.h"
#include "runmode-pfring.h"
#include "runmode-unix-socket.h"
#include "runmode-windivert.h"
#include "util-unittest.h"
#include "util-misc.h"
#include "util-plugin.h"
#include "output.h"
#include "alert-fastlog.h"
#include "alert-debuglog.h"
#include "log-httplog.h"
#include "source-pfring.h"
#include "tmqh-flow.h"
#include "flow-manager.h"
#include "flow-bypass.h"
#include "counters.h"
#include "suricata-plugin.h"
#include "util-device.h"
Include dependency graph for runmodes.c:

Go to the source code of this file.

Data Structures

struct  RunMode_
 Holds description for a runmode. More...
 
struct  RunModes_
 
struct  OutputFreeList_
 

Typedefs

typedef struct RunMode_ RunMode
 Holds description for a runmode. More...
 
typedef struct RunModes_ RunModes
 
typedef struct OutputFreeList_ OutputFreeList
 

Functions

char * RunmodeGetActive (void)
 
const char * RunModeGetMainMode (void)
 
void RunModeRegisterRunModes (void)
 Register all runmodes in the engine. More...
 
void RunModeListRunmodes (void)
 Lists all registered runmodes. More...
 
int RunModeEngineIsIPS (int capture_mode, const char *runmode, const char *capture_plugin_name)
 
void RunModeDispatch (int runmode, const char *custom_mode, const char *capture_plugin_name, const char *capture_plugin_args)
 
void RunModeEnablesBypassManager (void)
 
int RunModeNeedsBypassManager (void)
 
void RunModeRegisterNewRunMode (enum RunModes runmode, const char *name, const char *description, int(*RunModeFunc)(void), int(*RunModeIsIPSEnabled)(void))
 Registers a new runmode. More...
 
int RunModeOutputFiledataEnabled (void)
 
bool IsRunModeSystem (enum RunModes run_mode_to_check)
 
bool IsRunModeOffline (enum RunModes run_mode_to_check)
 
void RunModeShutDown (void)
 
void RunModeInitializeOutputs (void)
 
void RunModeInitializeThreadSettings (void)
 

Variables

int debuglog_enabled = 0
 
bool threading_set_cpu_affinity = false
 
uint64_t threading_set_stack_size = 0
 
const char * thread_name_autofp = "RX"
 
const char * thread_name_single = "W"
 
const char * thread_name_workers = "W"
 
const char * thread_name_verdict = "TX"
 
const char * thread_name_flow_mgr = "FM"
 
const char * thread_name_flow_rec = "FR"
 
const char * thread_name_flow_bypass = "FB"
 
const char * thread_name_unix_socket = "US"
 
const char * thread_name_detect_loader = "DL"
 
const char * thread_name_counter_stats = "CS"
 
const char * thread_name_counter_wakeup = "CW"
 
bool g_file_logger_enabled
 
bool g_filedata_logger_enabled
 
float threading_detect_ratio = 1
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t

Pre-cooked threading runmodes.

Definition in file runmodes.c.

Typedef Documentation

◆ OutputFreeList

◆ RunMode

typedef struct RunMode_ RunMode

Holds description for a runmode.

◆ RunModes

typedef struct RunModes_ RunModes

Function Documentation

◆ IsRunModeOffline()

bool IsRunModeOffline ( enum RunModes  run_mode_to_check)

bool indicating if run mode is offline

Definition at line 580 of file runmodes.c.

References RUNMODE_CONF_TEST, RUNMODE_ENGINE_ANALYSIS, RUNMODE_ERF_FILE, RUNMODE_PCAP_FILE, and RUNMODE_UNIX_SOCKET.

Referenced by ConfUnixSocketIsEnable().

Here is the caller graph for this function:

◆ IsRunModeSystem()

bool IsRunModeSystem ( enum RunModes  run_mode_to_check)

Definition at line 567 of file runmodes.c.

References RUNMODE_ENGINE_ANALYSIS, RUNMODE_ERF_FILE, and RUNMODE_PCAP_FILE.

◆ RunModeDispatch()

void RunModeDispatch ( int  runmode,
const char *  custom_mode,
const char *  capture_plugin_name,
const char *  capture_plugin_args 
)

Definition at line 427 of file runmodes.c.

◆ RunModeEnablesBypassManager()

void RunModeEnablesBypassManager ( void  )

Definition at line 481 of file runmodes.c.

◆ RunModeEngineIsIPS()

int RunModeEngineIsIPS ( int  capture_mode,
const char *  runmode,
const char *  capture_plugin_name 
)

Definition at line 397 of file runmodes.c.

Referenced by PostConfLoadedSetup().

Here is the caller graph for this function:

◆ RunmodeGetActive()

char* RunmodeGetActive ( void  )

Return the running mode

The returned string must not be freed.

Returns
a string containing the current running mode

Definition at line 218 of file runmodes.c.

◆ RunModeGetMainMode()

const char* RunModeGetMainMode ( void  )

Return the running mode

The returned string must not be freed.

Returns
a string containing the current running mode

Definition at line 230 of file runmodes.c.

References RunmodeGetCurrent().

Here is the call graph for this function:

◆ RunModeInitializeOutputs()

void RunModeInitializeOutputs ( void  )

Initialize the output modules.

Definition at line 797 of file runmodes.c.

References ConfGetNode().

Referenced by PreRunPostPrivsDropInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RunModeInitializeThreadSettings()

void RunModeInitializeThreadSettings ( void  )

◆ RunModeListRunmodes()

void RunModeListRunmodes ( void  )

Lists all registered runmodes.

Definition at line 268 of file runmodes.c.

References RUNMODE_UNKNOWN, and RUNMODE_USER_MAX.

◆ RunModeNeedsBypassManager()

int RunModeNeedsBypassManager ( void  )

Definition at line 486 of file runmodes.c.

◆ RunModeOutputFiledataEnabled()

int RunModeOutputFiledataEnabled ( void  )

Definition at line 562 of file runmodes.c.

◆ RunModeRegisterNewRunMode()

void RunModeRegisterNewRunMode ( enum RunModes  runmode,
const char *  name,
const char *  description,
int(*)(void)  RunModeFunc,
int(*)(void)  RunModeIsIPSEnabled 
)

Registers a new runmode.

Parameters
runmodeRunmode type.
nameCustom mode for this specific runmode type. Within each runmode type, each custom name is a primary key.
descriptionDescription for this runmode.
RunModeFuncThe function to be run for this runmode.

Definition at line 502 of file runmodes.c.

Referenced by CiCaptureIdsRegister(), RunModeDpdkRegister(), RunModeErfDagRegister(), RunModeErfFileRegister(), RunModeFilePcapRegister(), RunModeIdsAFPRegister(), RunModeIdsAFXDPRegister(), RunModeIdsNetmapRegister(), RunModeIdsNflogRegister(), RunModeIdsPcapRegister(), RunModeIdsPfringRegister(), RunModeIpsIPFWRegister(), RunModeIpsNFQRegister(), RunModeIpsWinDivertRegister(), RunModeNapatechRegister(), RunModeUnixSocketRegister(), and UtRunModeRegister().

Here is the caller graph for this function:

◆ RunModeRegisterRunModes()

void RunModeRegisterRunModes ( void  )

Register all runmodes in the engine.

Definition at line 240 of file runmodes.c.

Referenced by InitGlobal().

Here is the caller graph for this function:

◆ RunModeShutDown()

void RunModeShutDown ( void  )

Cleanup the run mode.

Definition at line 598 of file runmodes.c.

Variable Documentation

◆ debuglog_enabled

int debuglog_enabled = 0

Definition at line 75 of file runmodes.c.

◆ g_file_logger_enabled

bool g_file_logger_enabled

Definition at line 39 of file output-file.c.

◆ g_filedata_logger_enabled

bool g_filedata_logger_enabled

Definition at line 37 of file output-filedata.c.

◆ thread_name_autofp

const char* thread_name_autofp = "RX"

◆ thread_name_counter_stats

const char* thread_name_counter_stats = "CS"

Definition at line 89 of file runmodes.c.

◆ thread_name_counter_wakeup

const char* thread_name_counter_wakeup = "CW"

Definition at line 90 of file runmodes.c.

◆ thread_name_detect_loader

const char* thread_name_detect_loader = "DL"

Definition at line 88 of file runmodes.c.

◆ thread_name_flow_bypass

const char* thread_name_flow_bypass = "FB"

Definition at line 86 of file runmodes.c.

Referenced by BypassedFlowManagerThreadSpawn().

◆ thread_name_flow_mgr

const char* thread_name_flow_mgr = "FM"

Definition at line 84 of file runmodes.c.

Referenced by FlowDisableFlowManagerThread(), and TmThreadWaitOnThreadRunning().

◆ thread_name_flow_rec

const char* thread_name_flow_rec = "FR"

Definition at line 85 of file runmodes.c.

Referenced by TmThreadWaitOnThreadRunning().

◆ thread_name_single

const char* thread_name_single = "W"

Definition at line 81 of file runmodes.c.

Referenced by RunModeErfFileSingle(), RunModeFilePcapSingle(), and RunModeIdsAFXDPSingle().

◆ thread_name_unix_socket

const char* thread_name_unix_socket = "US"

Definition at line 87 of file runmodes.c.

◆ thread_name_verdict

const char* thread_name_verdict = "TX"

Definition at line 83 of file runmodes.c.

Referenced by RunModeSetIPSAutoFp(), and TmThreadWaitOnThreadRunning().

◆ thread_name_workers

◆ threading_detect_ratio

float threading_detect_ratio = 1

◆ threading_set_cpu_affinity

bool threading_set_cpu_affinity = false

◆ threading_set_stack_size

uint64_t threading_set_stack_size = 0

Definition at line 77 of file runmodes.c.

Referenced by RunModeInitializeThreadSettings(), and TmThreadSpawn().