suricata
app-layer-events.h
Go to the documentation of this file.
1/* Copyright (C) 2014-2022 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/**
19 * \file
20 *
21 * \author Victor Julien <victor@inliniac.net>
22 * \author Anoop Saldanha <anoopsaldanha@gmail.com>
23 */
24
25#ifndef SURICATA_APP_LAYER_EVENTS_H
26#define SURICATA_APP_LAYER_EVENTS_H
27
28/* contains fwd declaration of AppLayerDecoderEvents_ */
29#include "decode.h"
30#include "rust.h"
31#include "util-enum.h"
32
33/**
34 * \brief Data structure to store app layer decoder events.
35 */
37 /* array of events */
38 uint8_t *events;
39 /* number of events in the above buffer */
40 uint8_t cnt;
41 /* current event buffer size */
43 /* last logged */
45};
46
47/* app layer pkt level events */
48enum {
55};
56
57int AppLayerGetPktEventInfo(const char *event_name, uint8_t *event_id);
58
60 uint8_t event_id, const char **event_name, AppLayerEventType *event_type);
61void AppLayerDecoderEventsSetEventRaw(AppLayerDecoderEvents **sevents, uint8_t event);
62
63static inline int AppLayerDecoderEventsIsEventSet(
64 const AppLayerDecoderEvents *devents, uint8_t event)
65{
66 if (devents == NULL)
67 return 0;
68
69 int cnt = devents->cnt;
70 for (int i = 0; i < cnt; i++) {
71 if (devents->events[i] == event)
72 return 1;
73 }
74
75 return 0;
76}
77
81 const char *event_name, uint8_t *event_id, AppLayerEventType *event_type);
82int SCAppLayerGetEventIdByName(const char *event_name, SCEnumCharMap *table, uint8_t *event_id);
83
84#endif /* SURICATA_APP_LAYER_EVENTS_H */
int AppLayerGetEventInfoById(uint8_t event_id, const char **event_name, AppLayerEventType *event_type)
int SCAppLayerGetEventIdByName(const char *event_name, SCEnumCharMap *table, uint8_t *event_id)
int DetectEngineGetEventInfo(const char *event_name, uint8_t *event_id, AppLayerEventType *event_type)
int AppLayerGetPktEventInfo(const char *event_name, uint8_t *event_id)
@ APPLAYER_NO_TLS_AFTER_STARTTLS
@ APPLAYER_UNEXPECTED_PROTOCOL
@ APPLAYER_DETECT_PROTOCOL_ONLY_ONE_DIRECTION
@ APPLAYER_MISMATCH_PROTOCOL_BOTH_DIRECTIONS
@ APPLAYER_PROTO_DETECTION_SKIPPED
@ APPLAYER_WRONG_DIRECTION_FIRST_DATA
void AppLayerDecoderEventsSetEventRaw(AppLayerDecoderEvents **sevents, uint8_t event)
Set an app layer decoder event.
void AppLayerDecoderEventsFreeEvents(AppLayerDecoderEvents **events)
void AppLayerDecoderEventsResetEvents(AppLayerDecoderEvents *events)
enum AppLayerEventType AppLayerEventType
Data structure to store app layer decoder events.
uint32_t cnt