1 /* Copyright (C) 2007-2013 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 {
28     RUNMODE_UNKNOWN = 0,
29     RUNMODE_PCAP_DEV,
30     RUNMODE_PCAP_FILE,
31     RUNMODE_PFRING,
32     RUNMODE_NFQ,
33     RUNMODE_NFLOG,
34     RUNMODE_IPFW,
35     RUNMODE_ERF_FILE,
36     RUNMODE_DAG,
37     RUNMODE_AFP_DEV,
38     RUNMODE_NETMAP,
39     RUNMODE_UNITTEST,
40     RUNMODE_NAPATECH,
41     RUNMODE_UNIX_SOCKET,
42     RUNMODE_WINDIVERT,
43     RUNMODE_PLUGIN,
44     RUNMODE_USER_MAX, /* Last standard running mode */
45     RUNMODE_LIST_KEYWORDS,
46     RUNMODE_LIST_APP_LAYERS,
47     RUNMODE_LIST_RUNMODES,
48     RUNMODE_PRINT_VERSION,
49     RUNMODE_PRINT_BUILDINFO,
50     RUNMODE_PRINT_USAGE,
51     RUNMODE_DUMP_CONFIG,
52     RUNMODE_CONF_TEST,
53     RUNMODE_LIST_UNITTEST,
54     RUNMODE_ENGINE_ANALYSIS,
55 #ifdef OS_WIN32
56     RUNMODE_INSTALL_SERVICE,
57     RUNMODE_REMOVE_SERVICE,
58     RUNMODE_CHANGE_SERVICE_PARAMS,
59 #endif
60     RUNMODE_DUMP_FEATURES,
61     RUNMODE_MAX,
62 };
63 
64 /* Run Mode Global Thread Names */
65 extern const char *thread_name_autofp;
66 extern const char *thread_name_single;
67 extern const char *thread_name_workers;
68 extern const char *thread_name_verdict;
69 extern const char *thread_name_flow_mgr;
70 extern const char *thread_name_flow_bypass;
71 extern const char *thread_name_flow_rec;
72 extern const char *thread_name_unix_socket;
73 extern const char *thread_name_detect_loader;
74 extern const char *thread_name_counter_stats;
75 extern const char *thread_name_counter_wakeup;
76 
77 char *RunmodeGetActive(void);
78 const char *RunModeGetMainMode(void);
79 
80 void RunModeListRunmodes(void);
81 void RunModeDispatch(int, const char *, const char *capture_plugin_name, const char *capture_plugin_args);
82 void RunModeRegisterRunModes(void);
83 void RunModeRegisterNewRunMode(enum RunModes, const char *, const char *,
84                                int (*RunModeFunc)(void));
85 void RunModeInitialize(void);
86 void RunModeInitializeOutputs(void);
87 void RunModeShutDown(void);
88 
89 /* bool indicating if file logger is enabled */
90 int RunModeOutputFileEnabled(void);
91 /* bool indicating if filedata logger is enabled */
92 int RunModeOutputFiledataEnabled(void);
93 /** bool indicating if run mode is offline */
94 bool IsRunModeOffline(enum RunModes run_mode_to_check);
95 bool IsRunModeSystem(enum RunModes run_mode_to_check);
96 
97 void RunModeEnablesBypassManager(void);
98 int RunModeNeedsBypassManager(void);
99 
100 #include "runmode-pcap.h"
101 #include "runmode-pcap-file.h"
102 #include "runmode-pfring.h"
103 #include "runmode-nfq.h"
104 #include "runmode-ipfw.h"
105 #include "runmode-erf-file.h"
106 #include "runmode-erf-dag.h"
107 #include "runmode-napatech.h"
108 #include "runmode-af-packet.h"
109 #include "runmode-nflog.h"
110 #include "runmode-unix-socket.h"
111 #include "runmode-netmap.h"
112 #include "runmode-windivert.h"
113 
114 extern int threading_set_cpu_affinity;
115 extern float threading_detect_ratio;
116 
117 extern int debuglog_enabled;
118 
119 #endif /* __RUNMODES_H__ */
120