#include "util-ioctl.h"
#include "util-device.h"
#include "util-misc.h"
+#include "util-running-modes.h"
#include "detect-parse.h"
#include "detect-engine.h"
}
}
- if (!list_keywords && !list_app_layer_protocols) {
+ if (list_keywords) {
+ return SuriListKeywords(keyword_info);
+ }
+
+ if (list_app_layer_protocols) {
+ return SuriListAppLayerProtocols();
+ }
+
#ifdef REVISION
- SCLogInfo("This is %s version %s (rev %s)", PROG_NAME, PROG_VER, xstr(REVISION));
+ SCLogInfo("This is %s version %s (rev %s)", PROG_NAME, PROG_VER, xstr(REVISION));
#elif defined RELEASE
- SCLogInfo("This is %s version %s RELEASE", PROG_NAME, PROG_VER);
+ SCLogInfo("This is %s version %s RELEASE", PROG_NAME, PROG_VER);
#else
- SCLogInfo("This is %s version %s", PROG_NAME, PROG_VER);
+ SCLogInfo("This is %s version %s", PROG_NAME, PROG_VER);
#endif
- }
SetBpfString(optind, argv);
- if (!list_keywords && !list_app_layer_protocols)
- UtilCpuPrintSummary();
+ UtilCpuPrintSummary();
#ifdef __SC_CUDA_SUPPORT__
/* Init the CUDA environment */
TimeInit();
SupportFastPatternForSigMatchTypes();
- if (run_mode != RUNMODE_UNITTEST &&
- !list_keywords &&
- !list_app_layer_protocols) {
+ if (run_mode != RUNMODE_UNITTEST) {
if (conf_filename == NULL)
conf_filename = DEFAULT_CONF_FILE;
}
#endif
AppLayerDetectProtoThreadInit();
- if (list_app_layer_protocols) {
- AppLayerListSupportedProtocols();
- exit(EXIT_SUCCESS);
- }
AppLayerParsersInitPostProcess();
if (dump_config) {
#endif /* OS_WIN32 */
}
- if (!list_keywords && !list_app_layer_protocols) {
#ifdef OS_WIN32
- if (_stat(log_dir, &buf) != 0) {
+ if (_stat(log_dir, &buf) != 0) {
#else
- if (stat(log_dir, &buf) != 0) {
+ if (stat(log_dir, &buf) != 0) {
#endif /* OS_WIN32 */
- SCLogError(SC_ERR_LOGDIR_CONFIG, "The logging directory \"%s\" "
- "supplied by %s (default-log-dir) doesn't exist. "
- "Shutting down the engine", log_dir, conf_filename);
- exit(EXIT_FAILURE);
- }
+ SCLogError(SC_ERR_LOGDIR_CONFIG, "The logging directory \"%s\" "
+ "supplied by %s (default-log-dir) doesn't exist. "
+ "Shutting down the engine", log_dir, conf_filename);
+ exit(EXIT_FAILURE);
}
/* Pull the max pending packets from the config, if not found fall
/* Load the Host-OS lookup. */
SCHInfoLoadFromConfig();
- if (!list_keywords && !list_app_layer_protocols &&
- (run_mode != RUNMODE_UNIX_SOCKET)) {
+ if (run_mode != RUNMODE_UNIX_SOCKET) {
DefragInit();
}
if (run_mode == RUNMODE_UNKNOWN) {
- if (!engine_analysis && !list_keywords && !conf_test) {
+ if (!engine_analysis && !conf_test) {
usage(argv[0]);
exit(EXIT_FAILURE);
}
/* hardcoded initialization code */
SigTableSetup(); /* load the rule keywords */
- if (list_keywords) {
- SigTableList(keyword_info);
- exit(EXIT_FAILURE);
- }
TmqhSetup();
StorageInit();
--- /dev/null
+/* Copyright (C) 2013 Open Information Security Foundation
+ *
+ * You can copy, redistribute or modify this Program under the terms of
+ * the GNU General Public License version 2 as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/** \file
+ *
+ * \author Eric Leblond <eric@regit.org>
+ */
+
+#include "suricata-common.h"
+#include "app-layer-detect-proto.h"
+
+int SuriListKeywords(const char *keyword_info)
+{
+ SigTableSetup(); /* load the rule keywords */
+ SigTableList(keyword_info);
+ exit(EXIT_SUCCESS);
+}
+
+int SuriListAppLayerProtocols()
+{
+ MpmTableSetup();
+ AppLayerDetectProtoThreadInit();
+ AppLayerListSupportedProtocols();
+ exit(EXIT_SUCCESS);
+}
--- /dev/null
+/* Copyright (C) 2013 Open Information Security Foundation
+ *
+ * You can copy, redistribute or modify this Program under the terms of
+ * the GNU General Public License version 2 as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/** \file
+ *
+ * \author Eric Leblond <eric@regit.org>
+ */
+
+#ifndef __UTIL_RUNNING_MODES_H__
+#define __UTIL_RUNNING_MODES_H__
+
+
+int SuriListKeywords(const char *keyword_info);
+int SuriListAppLayerProtocols();
+
+
+#endif /* __UTIL_RUNNING_MODES_H__ */