suricata
detect-engine-loader.c File Reference
#include "suricata-common.h"
#include "suricata.h"
#include "conf.h"
#include "debug.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 "util-signal.h"
#include "detect-engine-loader.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 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, int sig_file_exclusive)
 Load signatures. More...
 
void TmThreadWakeupDetectLoaderThreads ()
 Unpauses all threads present in tv_root. More...
 
int DetectLoaderQueueTask (int loader_id, LoaderFunc Func, void *func_ctx)
 
int DetectLoadersSync (void)
 wait for loader tasks to complete More...
 
void DetectLoadersInit (void)
 
void TmThreadContinueDetectLoaderThreads ()
 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
 
int rule_engine_analysis_set = 0
 

Detailed Description

Macro Definition Documentation

◆ NLOADERS

#define NLOADERS   4

Definition at line 391 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 60 of file detect-engine-loader.c.

References ConfGet(), DetectEngineCtx_::config_prefix, de_ctx, PathIsRelative(), SC_ERR_INVALID_ARGUMENTS, SCLogDebug, SCLogError, SCMalloc, SCStrdup, strlcat(), strlcpy(), and unlikely.

Here is the call graph for this function:

◆ DetectLoaderQueueTask()

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

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

◆ DetectLoadersInit()

void DetectLoadersInit ( void  )

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

References ConfGetInt(), NLOADERS, SC_ERR_INVALID_ARGUMENTS, and SCLogError.

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 431 of file detect-engine-loader.c.

References SCLogDebug.

◆ DetectLoaderThreadSpawn()

void DetectLoaderThreadSpawn ( void  )

spawn the detect loader manager thread

Definition at line 615 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,
int  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 276 of file detect-engine-loader.c.

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

Here is the call graph for this function:

◆ TmModuleDetectLoaderRegister()

void TmModuleDetectLoaderRegister ( void  )

◆ TmThreadContinueDetectLoaderThreads()

void TmThreadContinueDetectLoaderThreads ( )

Unpauses all threads present in tv_root.

Definition at line 520 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:

◆ TmThreadWakeupDetectLoaderThreads()

void TmThreadWakeupDetectLoaderThreads ( void  )

Unpauses all threads present in tv_root.

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

References BUG_ON, ThreadVars_::ctrl_cond, ThreadVars_::name, ThreadVars_::next, SCMutexLock, SCMutexUnlock, tv, tv_root, tv_root_lock, and TVT_MAX.

Variable Documentation

◆ engine_analysis

int engine_analysis

◆ rule_engine_analysis_set

int rule_engine_analysis_set = 0

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

Referenced by DetectFlowbitsAnalyze().

◆ rule_reload

int rule_reload