runmode-windivert.c runmode-windivert.h \
runmodes.c runmodes.h \
rust.h \
-rust-context.h \
+rust-context.c rust-context.h \
source-af-packet.c source-af-packet.h \
source-erf-dag.c source-erf-dag.h \
source-erf-file.c source-erf-file.h \
--- /dev/null
+/* Copyright (C) 2020 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.
+ */
+
+#include "suricata-common.h"
+#include "rust-context.h"
+
+SuricataContext suricata_context;
+
+SuricataContext *SCGetContext(void)
+{
+ return &suricata_context;
+}
\ No newline at end of file
} SuricataContext;
+extern SuricataContext suricata_context;
+
typedef struct SuricataFileContext_ {
const StreamingBufferConfig *sbcfg;
} SuricataFileContext;
+SuricataContext *SCGetContext(void);
+
#endif /* !__RUST_CONTEXT_H__ */
}
}
-SuricataContext context;
-
/**
* \brief Global initialization common to all runmodes.
*
*/
int InitGlobal(void) {
- context.SCLogMessage = SCLogMessage;
- context.DetectEngineStateFree = DetectEngineStateFree;
- context.AppLayerDecoderEventsSetEventRaw =
- AppLayerDecoderEventsSetEventRaw;
- context.AppLayerDecoderEventsFreeEvents = AppLayerDecoderEventsFreeEvents;
-
- context.FileOpenFileWithId = FileOpenFileWithId;
- context.FileCloseFileById = FileCloseFileById;
- context.FileAppendDataById = FileAppendDataById;
- context.FileAppendGAPById = FileAppendGAPById;
- context.FileContainerRecycle = FileContainerRecycle;
- context.FilePrune = FilePrune;
- context.FileSetTx = FileContainerSetTx;
-
- rs_init(&context);
+ suricata_context.SCLogMessage = SCLogMessage;
+ suricata_context.DetectEngineStateFree = DetectEngineStateFree;
+ suricata_context.AppLayerDecoderEventsSetEventRaw = AppLayerDecoderEventsSetEventRaw;
+ suricata_context.AppLayerDecoderEventsFreeEvents = AppLayerDecoderEventsFreeEvents;
+
+ suricata_context.FileOpenFileWithId = FileOpenFileWithId;
+ suricata_context.FileCloseFileById = FileCloseFileById;
+ suricata_context.FileAppendDataById = FileAppendDataById;
+ suricata_context.FileAppendGAPById = FileAppendGAPById;
+ suricata_context.FileContainerRecycle = FileContainerRecycle;
+ suricata_context.FilePrune = FilePrune;
+ suricata_context.FileSetTx = FileContainerSetTx;
+
+ rs_init(&suricata_context);
SC_ATOMIC_INIT(engine_stage);