suricata
detect-engine-loader.c File Reference
#include "suricata-common.h"
#include "suricata.h"
#include "conf.h"
#include "detect.h"
#include "detect-parse.h"
#include "runmodes.h"
#include "threads.h"
#include "threadvars.h"
#include "tm-threads.h"
#include "queue.h"
#include "detect-engine-loader.h"
#include "detect-engine-build.h"
#include "detect-engine-analyzer.h"
#include "detect-engine-mpm.h"
#include "detect-engine-sigorder.h"
#include "util-detect.h"
#include "util-threshold-config.h"
#include "util-path.h"
#include "rust.h"
Include dependency graph for detect-engine-loader.c:

Go to the source code of this file.

Data Structures

struct  DetectLoaderThreadData_
 

Macros

#define NLOADERS   4
 

Typedefs

typedef struct DetectLoaderThreadData_ DetectLoaderThreadData
 

Functions

char * DetectLoadCompleteSigPath (const DetectEngineCtx *de_ctx, const char *sig_file)
 Create the path if default-rule-path was specified. More...
 
int SigLoadSignatures (DetectEngineCtx *de_ctx, char *sig_file, bool sig_file_exclusive)
 Load signatures. More...
 
int DetectLoaderQueueTask (int loader_id, LoaderFunc Func, void *func_ctx, LoaderFreeFunc FreeFunc)
 
int DetectLoadersSync (void)
 wait for loader tasks to complete More...
 
void DetectLoadersInit (void)
 
void TmThreadContinueDetectLoaderThreads (void)
 Unpauses all threads present in tv_root. More...
 
 SC_ATOMIC_DECLARE (int, detect_loader_cnt)
 
void DetectLoaderThreadSpawn (void)
 spawn the detect loader manager thread More...
 
void TmModuleDetectLoaderRegister (void)
 

Variables

int rule_reload
 
int engine_analysis
 
bool rule_engine_analysis_set = false
 

Detailed Description

Macro Definition Documentation

◆ NLOADERS

#define NLOADERS   4

Definition at line 416 of file detect-engine-loader.c.

Typedef Documentation

◆ DetectLoaderThreadData

Function Documentation

◆ DetectLoadCompleteSigPath()

char* DetectLoadCompleteSigPath ( const DetectEngineCtx de_ctx,
const char *  sig_file 
)

Create the path if default-rule-path was specified.

Parameters
sig_fileThe name of the file
Return values
strPointer to the string path + sig_file

Definition at line 62 of file detect-engine-loader.c.

References ConfGetNode(), DetectEngineCtx_::config_prefix, de_ctx, ConfNode_::final, PathIsRelative(), PathMergeAlloc(), SCLogError, SCStrdup, unlikely, and ConfNode_::val.

Here is the call graph for this function:

◆ DetectLoaderQueueTask()

int DetectLoaderQueueTask ( int  loader_id,
LoaderFunc  Func,
void *  func_ctx,
LoaderFreeFunc  FreeFunc 
)
Parameters
loader-1 for auto select
Return values
loader_idor negative in case of error

Definition at line 423 of file detect-engine-loader.c.

◆ DetectLoadersInit()

void DetectLoadersInit ( void  )

Definition at line 500 of file detect-engine-loader.c.

References ConfGetInt(), FatalError, and NLOADERS.

Here is the call graph for this function:

◆ DetectLoadersSync()

int DetectLoadersSync ( void  )

wait for loader tasks to complete

Return values
result0 for ok, -1 for errors

Definition at line 457 of file detect-engine-loader.c.

References SCLogDebug.

◆ DetectLoaderThreadSpawn()

void DetectLoaderThreadSpawn ( void  )

spawn the detect loader manager thread

Definition at line 636 of file detect-engine-loader.c.

◆ SC_ATOMIC_DECLARE()

SC_ATOMIC_DECLARE ( int  ,
detect_loader_cnt   
)

◆ SigLoadSignatures()

int SigLoadSignatures ( DetectEngineCtx de_ctx,
char *  sig_file,
bool  sig_file_exclusive 
)

Load signatures.

Parameters
de_ctxPointer to the detection engine context
sig_fileFilename (or pattern) holding signatures
sig_file_exclusiveFile passed in 'sig_file' should be loaded exclusively.
Return values
-1on error

Definition at line 287 of file detect-engine-loader.c.

References DetectEngineCtx_::config_prefix, de_ctx, RUNMODE_ENGINE_ANALYSIS, SCEnter, SCRunmodeGet(), SetupEngineAnalysis(), and DetectEngineCtx_::sig_stat.

Here is the call graph for this function:

◆ TmModuleDetectLoaderRegister()

void TmModuleDetectLoaderRegister ( void  )

◆ TmThreadContinueDetectLoaderThreads()

void TmThreadContinueDetectLoaderThreads ( void  )

Unpauses all threads present in tv_root.

Definition at line 545 of file detect-engine-loader.c.

References ThreadVars_::name, ThreadVars_::next, SCMutexLock, SCMutexUnlock, TmThreadContinue(), tv, tv_root, tv_root_lock, and TVT_MAX.

Here is the call graph for this function:

Variable Documentation

◆ engine_analysis

int engine_analysis

Referenced by SCParseCommandLine().

◆ rule_engine_analysis_set

bool rule_engine_analysis_set = false

Definition at line 55 of file detect-engine-loader.c.

Referenced by DetectFlowbitsAnalyze().

◆ rule_reload

int rule_reload