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 #include "util-enum.h"
29 
30 /**
31  * \brief Data structure to store app layer decoder events.
32  */
34  /* array of events */
35  uint8_t *events;
36  /* number of events in the above buffer */
37  uint8_t cnt;
38  /* current event buffer size */
40  /* last logged */
42 };
43 
44 /* app layer pkt level events */
45 enum {
52 };
53 
54 int AppLayerGetPktEventInfo(const char *event_name, uint8_t *event_id);
55 
57  uint8_t event_id, const char **event_name, AppLayerEventType *event_type);
58 void SCAppLayerDecoderEventsSetEventRaw(AppLayerDecoderEvents **sevents, uint8_t event);
59 
60 #ifndef SURICATA_BINDGEN_H
61 static inline int AppLayerDecoderEventsIsEventSet(
62  const AppLayerDecoderEvents *devents, uint8_t event)
63 {
64  if (devents == NULL)
65  return 0;
66 
67  int cnt = devents->cnt;
68  for (int i = 0; i < cnt; i++) {
69  if (devents->events[i] == event)
70  return 1;
71  }
72 
73  return 0;
74 }
75 #endif
76 
80  const char *event_name, uint8_t *event_id, AppLayerEventType *event_type);
81 int SCAppLayerGetEventIdByName(const char *event_name, SCEnumCharMap *table, uint8_t *event_id);
82 
83 #endif /* SURICATA_APP_LAYER_EVENTS_H */
DetectEngineGetEventInfo
int DetectEngineGetEventInfo(const char *event_name, uint8_t *event_id, AppLayerEventType *event_type)
Definition: app-layer-events.c:172
APPLAYER_UNEXPECTED_PROTOCOL
@ APPLAYER_UNEXPECTED_PROTOCOL
Definition: app-layer-events.h:51
AppLayerDecoderEvents_::events_buffer_size
uint8_t events_buffer_size
Definition: app-layer-events.h:39
AppLayerDecoderEvents_::event_last_logged
uint8_t event_last_logged
Definition: app-layer-events.h:41
AppLayerEventType
enum AppLayerEventType AppLayerEventType
Definition: app-layer-parser.h:43
APPLAYER_PROTO_DETECTION_SKIPPED
@ APPLAYER_PROTO_DETECTION_SKIPPED
Definition: app-layer-events.h:49
AppLayerDecoderEvents_
Data structure to store app layer decoder events.
Definition: app-layer-events.h:33
AppLayerDecoderEventsResetEvents
void AppLayerDecoderEventsResetEvents(AppLayerDecoderEvents *events)
Definition: app-layer-events.c:129
APPLAYER_NO_TLS_AFTER_STARTTLS
@ APPLAYER_NO_TLS_AFTER_STARTTLS
Definition: app-layer-events.h:50
APPLAYER_MISMATCH_PROTOCOL_BOTH_DIRECTIONS
@ APPLAYER_MISMATCH_PROTOCOL_BOTH_DIRECTIONS
Definition: app-layer-events.h:46
AppLayerGetEventInfoById
int AppLayerGetEventInfoById(uint8_t event_id, const char **event_name, AppLayerEventType *event_type)
Definition: app-layer-events.c:65
AppLayerDecoderEvents_::cnt
uint8_t cnt
Definition: app-layer-events.h:37
cnt
uint32_t cnt
Definition: tmqh-packetpool.h:7
SCEnumCharMap_
Definition: util-enum.h:27
APPLAYER_DETECT_PROTOCOL_ONLY_ONE_DIRECTION
@ APPLAYER_DETECT_PROTOCOL_ONLY_ONE_DIRECTION
Definition: app-layer-events.h:48
SCAppLayerGetEventIdByName
int SCAppLayerGetEventIdByName(const char *event_name, SCEnumCharMap *table, uint8_t *event_id)
Definition: app-layer-events.c:30
SCAppLayerDecoderEventsSetEventRaw
void SCAppLayerDecoderEventsSetEventRaw(AppLayerDecoderEvents **sevents, uint8_t event)
Set an app layer decoder event.
Definition: app-layer-events.c:96
AppLayerGetPktEventInfo
int AppLayerGetPktEventInfo(const char *event_name, uint8_t *event_id)
Definition: app-layer-events.c:82
SCAppLayerDecoderEventsFreeEvents
void SCAppLayerDecoderEventsFreeEvents(AppLayerDecoderEvents **events)
Definition: app-layer-events.c:137
util-enum.h
APPLAYER_WRONG_DIRECTION_FIRST_DATA
@ APPLAYER_WRONG_DIRECTION_FIRST_DATA
Definition: app-layer-events.h:47
AppLayerDecoderEvents_::events
uint8_t * events
Definition: app-layer-events.h:35