summaryrefslogtreecommitdiffstats
path: root/src/app-layer-events.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:39:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:39:49 +0000
commita0aa2307322cd47bbf416810ac0292925e03be87 (patch)
tree37076262a026c4b48c8a0e84f44ff9187556ca35 /src/app-layer-events.h
parentInitial commit. (diff)
downloadsuricata-a0aa2307322cd47bbf416810ac0292925e03be87.tar.xz
suricata-a0aa2307322cd47bbf416810ac0292925e03be87.zip
Adding upstream version 1:7.0.3.upstream/1%7.0.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/app-layer-events.h')
-rw-r--r--src/app-layer-events.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/app-layer-events.h b/src/app-layer-events.h
new file mode 100644
index 0000000..83cb0d9
--- /dev/null
+++ b/src/app-layer-events.h
@@ -0,0 +1,83 @@
+/* Copyright (C) 2014-2022 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 Victor Julien <victor@inliniac.net>
+ * \author Anoop Saldanha <anoopsaldanha@gmail.com>
+ */
+
+#ifndef __APP_LAYER_EVENTS_H__
+#define __APP_LAYER_EVENTS_H__
+
+/* contains fwd declaration of AppLayerDecoderEvents_ */
+#include "decode.h"
+#include "rust.h"
+
+/**
+ * \brief Data structure to store app layer decoder events.
+ */
+struct AppLayerDecoderEvents_ {
+ /* array of events */
+ uint8_t *events;
+ /* number of events in the above buffer */
+ uint8_t cnt;
+ /* current event buffer size */
+ uint8_t events_buffer_size;
+ /* last logged */
+ uint8_t event_last_logged;
+};
+
+/* app layer pkt level events */
+enum {
+ APPLAYER_MISMATCH_PROTOCOL_BOTH_DIRECTIONS,
+ APPLAYER_WRONG_DIRECTION_FIRST_DATA,
+ APPLAYER_DETECT_PROTOCOL_ONLY_ONE_DIRECTION,
+ APPLAYER_PROTO_DETECTION_SKIPPED,
+ APPLAYER_NO_TLS_AFTER_STARTTLS,
+ APPLAYER_UNEXPECTED_PROTOCOL,
+};
+
+int AppLayerGetPktEventInfo(const char *event_name, int *event_id);
+
+int AppLayerGetEventInfoById(int event_id, const char **event_name,
+ AppLayerEventType *event_type);
+void AppLayerDecoderEventsSetEventRaw(AppLayerDecoderEvents **sevents, uint8_t event);
+
+static inline int AppLayerDecoderEventsIsEventSet(AppLayerDecoderEvents *devents,
+ uint8_t event)
+{
+ if (devents == NULL)
+ return 0;
+
+ int i;
+ int cnt = devents->cnt;
+ for (i = 0; i < cnt; i++) {
+ if (devents->events[i] == event)
+ return 1;
+ }
+
+ return 0;
+}
+
+void AppLayerDecoderEventsResetEvents(AppLayerDecoderEvents *events);
+void AppLayerDecoderEventsFreeEvents(AppLayerDecoderEvents **events);
+int DetectEngineGetEventInfo(const char *event_name, int *event_id, AppLayerEventType *event_type);
+
+#endif /* __APP_LAYER_EVENTS_H__ */
+