suricata
runmodes.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2022 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /** \file
19  *
20  * \author Victor Julien <victor@inliniac.net>
21  */
22 
23 #ifndef __RUNMODES_H__
24 #define __RUNMODES_H__
25 
26 /* Run mode */
27 enum RunModes {
45  RUNMODE_USER_MAX, /* Last standard running mode */
56 #ifdef OS_WIN32
57  RUNMODE_INSTALL_SERVICE,
58  RUNMODE_REMOVE_SERVICE,
59  RUNMODE_CHANGE_SERVICE_PARAMS,
60 #endif
63 };
64 
65 /* Run Mode Global Thread Names */
66 extern const char *thread_name_autofp;
67 extern const char *thread_name_single;
68 extern const char *thread_name_workers;
69 extern const char *thread_name_verdict;
70 extern const char *thread_name_flow_mgr;
71 extern const char *thread_name_flow_bypass;
72 extern const char *thread_name_flow_rec;
73 extern const char *thread_name_unix_socket;
74 extern const char *thread_name_detect_loader;
75 extern const char *thread_name_counter_stats;
76 extern const char *thread_name_counter_wakeup;
77 
78 char *RunmodeGetActive(void);
79 const char *RunModeGetMainMode(void);
80 
81 void RunModeListRunmodes(void);
82 void RunModeDispatch(int, const char *, const char *capture_plugin_name, const char *capture_plugin_args);
83 void RunModeRegisterRunModes(void);
84 void RunModeRegisterNewRunMode(enum RunModes, const char *, const char *,
85  int (*RunModeFunc)(void));
86 void RunModeInitialize(void);
87 void RunModeInitializeOutputs(void);
88 void RunModeShutDown(void);
89 
90 /* bool indicating if file logger is enabled */
91 int RunModeOutputFileEnabled(void);
92 /* bool indicating if filedata logger is enabled */
94 /** bool indicating if run mode is offline */
95 bool IsRunModeOffline(enum RunModes run_mode_to_check);
96 bool IsRunModeSystem(enum RunModes run_mode_to_check);
97 
100 
101 #include "runmode-pcap.h"
102 #include "runmode-pcap-file.h"
103 #include "runmode-pfring.h"
104 #include "runmode-nfq.h"
105 #include "runmode-ipfw.h"
106 #include "runmode-erf-file.h"
107 #include "runmode-erf-dag.h"
108 #include "runmode-napatech.h"
109 #include "runmode-af-packet.h"
110 #include "runmode-nflog.h"
111 #include "runmode-unix-socket.h"
112 #include "runmode-netmap.h"
113 #include "runmode-windivert.h"
114 #include "runmode-dpdk.h"
115 
116 extern int threading_set_cpu_affinity;
117 extern float threading_detect_ratio;
118 extern uint64_t threading_set_stack_size;
119 
120 extern int debuglog_enabled;
121 
122 #endif /* __RUNMODES_H__ */
RunModeListRunmodes
void RunModeListRunmodes(void)
Lists all registered runmodes.
Definition: runmodes.c:248
threading_set_stack_size
uint64_t threading_set_stack_size
Definition: runmodes.c:61
RunModeEnablesBypassManager
void RunModeEnablesBypassManager(void)
Definition: runmodes.c:425
RUNMODE_UNIX_SOCKET
@ RUNMODE_UNIX_SOCKET
Definition: runmodes.h:42
IsRunModeOffline
bool IsRunModeOffline(enum RunModes run_mode_to_check)
Definition: runmodes.c:531
RUNMODE_UNITTEST
@ RUNMODE_UNITTEST
Definition: runmodes.h:40
RUNMODE_DPDK
@ RUNMODE_DPDK
Definition: runmodes.h:39
runmode-af-packet.h
RUNMODE_UNKNOWN
@ RUNMODE_UNKNOWN
Definition: runmodes.h:28
RunModeNeedsBypassManager
int RunModeNeedsBypassManager(void)
Definition: runmodes.c:430
RUNMODE_PRINT_BUILDINFO
@ RUNMODE_PRINT_BUILDINFO
Definition: runmodes.h:50
RUNMODE_LIST_RUNMODES
@ RUNMODE_LIST_RUNMODES
Definition: runmodes.h:48
runmode-pcap.h
RUNMODE_ERF_FILE
@ RUNMODE_ERF_FILE
Definition: runmodes.h:35
runmode-erf-file.h
runmode-windivert.h
RUNMODE_NFLOG
@ RUNMODE_NFLOG
Definition: runmodes.h:33
RUNMODE_PCAP_DEV
@ RUNMODE_PCAP_DEV
Definition: runmodes.h:29
RunModeRegisterNewRunMode
void RunModeRegisterNewRunMode(enum RunModes, const char *, const char *, int(*RunModeFunc)(void))
Registers a new runmode.
Definition: runmodes.c:446
RUNMODE_LIST_KEYWORDS
@ RUNMODE_LIST_KEYWORDS
Definition: runmodes.h:46
RUNMODE_NAPATECH
@ RUNMODE_NAPATECH
Definition: runmodes.h:41
thread_name_unix_socket
const char * thread_name_unix_socket
Definition: runmodes.c:71
RunModeGetMainMode
const char * RunModeGetMainMode(void)
Definition: runmodes.c:211
RunModeOutputFiledataEnabled
int RunModeOutputFiledataEnabled(void)
Definition: runmodes.c:513
RUNMODE_DAG
@ RUNMODE_DAG
Definition: runmodes.h:36
runmode-unix-socket.h
RUNMODE_NETMAP
@ RUNMODE_NETMAP
Definition: runmodes.h:38
RUNMODE_DUMP_FEATURES
@ RUNMODE_DUMP_FEATURES
Definition: runmodes.h:61
RUNMODE_USER_MAX
@ RUNMODE_USER_MAX
Definition: runmodes.h:45
threading_detect_ratio
float threading_detect_ratio
Definition: runmodes.c:927
RunModeShutDown
void RunModeShutDown(void)
Definition: runmodes.c:549
RunModes
RunModes
Definition: runmodes.h:27
thread_name_workers
const char * thread_name_workers
Definition: runmodes.c:66
RUNMODE_CONF_TEST
@ RUNMODE_CONF_TEST
Definition: runmodes.h:53
thread_name_flow_rec
const char * thread_name_flow_rec
Definition: runmodes.c:69
RUNMODE_PRINT_USAGE
@ RUNMODE_PRINT_USAGE
Definition: runmodes.h:51
runmode-pfring.h
RUNMODE_LIST_APP_LAYERS
@ RUNMODE_LIST_APP_LAYERS
Definition: runmodes.h:47
thread_name_counter_wakeup
const char * thread_name_counter_wakeup
Definition: runmodes.c:74
thread_name_autofp
const char * thread_name_autofp
Definition: runmodes.c:64
RunmodeGetActive
char * RunmodeGetActive(void)
Definition: runmodes.c:199
runmode-netmap.h
runmode-erf-dag.h
RunModeInitializeOutputs
void RunModeInitializeOutputs(void)
Definition: runmodes.c:749
RUNMODE_DUMP_CONFIG
@ RUNMODE_DUMP_CONFIG
Definition: runmodes.h:52
RunModeDispatch
void RunModeDispatch(int, const char *, const char *capture_plugin_name, const char *capture_plugin_args)
Definition: runmodes.c:291
runmode-pcap-file.h
RunModeOutputFileEnabled
int RunModeOutputFileEnabled(void)
Definition: runmodes.c:508
thread_name_verdict
const char * thread_name_verdict
Definition: runmodes.c:67
IsRunModeSystem
bool IsRunModeSystem(enum RunModes run_mode_to_check)
Definition: runmodes.c:518
runmode-nfq.h
thread_name_flow_mgr
const char * thread_name_flow_mgr
Definition: runmodes.c:68
RUNMODE_PFRING
@ RUNMODE_PFRING
Definition: runmodes.h:31
threading_set_cpu_affinity
int threading_set_cpu_affinity
Definition: runmodes.c:60
RUNMODE_NFQ
@ RUNMODE_NFQ
Definition: runmodes.h:32
RUNMODE_ENGINE_ANALYSIS
@ RUNMODE_ENGINE_ANALYSIS
Definition: runmodes.h:55
RUNMODE_PRINT_VERSION
@ RUNMODE_PRINT_VERSION
Definition: runmodes.h:49
RunModeInitialize
void RunModeInitialize(void)
Definition: runmodes.c:932
runmode-napatech.h
thread_name_flow_bypass
const char * thread_name_flow_bypass
Definition: runmodes.c:70
RUNMODE_WINDIVERT
@ RUNMODE_WINDIVERT
Definition: runmodes.h:43
runmode-dpdk.h
runmode-ipfw.h
runmode-nflog.h
debuglog_enabled
int debuglog_enabled
Definition: runmodes.c:59
thread_name_single
const char * thread_name_single
Definition: runmodes.c:65
RUNMODE_AFP_DEV
@ RUNMODE_AFP_DEV
Definition: runmodes.h:37
thread_name_detect_loader
const char * thread_name_detect_loader
Definition: runmodes.c:72
thread_name_counter_stats
const char * thread_name_counter_stats
Definition: runmodes.c:73
RUNMODE_PCAP_FILE
@ RUNMODE_PCAP_FILE
Definition: runmodes.h:30
RUNMODE_PLUGIN
@ RUNMODE_PLUGIN
Definition: runmodes.h:44
RunModeRegisterRunModes
void RunModeRegisterRunModes(void)
Register all runmodes in the engine.
Definition: runmodes.c:221
RUNMODE_IPFW
@ RUNMODE_IPFW
Definition: runmodes.h:34
RUNMODE_MAX
@ RUNMODE_MAX
Definition: runmodes.h:62
RUNMODE_LIST_UNITTEST
@ RUNMODE_LIST_UNITTEST
Definition: runmodes.h:54