}
}
-int main(int argc, char **argv)
-{
- SCInstanceInit(&suricata, argv[0]);
+SuricataContext context;
+
+/**
+ * \brief Global initialization common to all runmodes.
+ *
+ * This can be used by fuzz targets.
+ */
- SuricataContext context;
+int InitGlobal(void) {
context.SCLogMessage = SCLogMessage;
context.DetectEngineStateFree = DetectEngineStateFree;
context.AppLayerDecoderEventsSetEventRaw =
UtilSignalHandlerSetup(SIGUSR2, SIG_IGN);
if (UtilSignalBlock(SIGUSR2)) {
SCLogError(SC_ERR_INITIALIZATION, "SIGUSR2 initialization error");
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
#endif
ParseSizeInit();
RunModeRegisterRunModes();
+ /* Initialize the configuration module. */
+ ConfInit();
+
+ return 0;
+}
+
+int main(int argc, char **argv)
+{
+ SCInstanceInit(&suricata, argv[0]);
+
+ if (InitGlobal() != 0) {
+ exit(EXIT_FAILURE);
+ }
+
#ifdef OS_WIN32
/* service initialization */
if (WindowsInitService(argc, argv) != 0) {
}
#endif /* OS_WIN32 */
- /* Initialize the configuration module. */
- ConfInit();
-
if (ParseCommandLine(argc, argv, &suricata) != TM_ECODE_OK) {
exit(EXIT_FAILURE);
}