suricata
app-layer-parser.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2020 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 __APP_LAYER_PARSER_H__
26 #define __APP_LAYER_PARSER_H__
27 
28 #include "app-layer-events.h"
29 #include "util-file.h"
30 #include "rust.h"
31 #include "util-config.h"
32 
33 /* Flags for AppLayerParserState. */
34 // flag available BIT_U8(0)
35 #define APP_LAYER_PARSER_NO_INSPECTION BIT_U8(1)
36 #define APP_LAYER_PARSER_NO_REASSEMBLY BIT_U8(2)
37 #define APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD BIT_U8(3)
38 #define APP_LAYER_PARSER_BYPASS_READY BIT_U8(4)
39 #define APP_LAYER_PARSER_EOF_TS BIT_U8(5)
40 #define APP_LAYER_PARSER_EOF_TC BIT_U8(6)
41 
42 /* Flags for AppLayerParserProtoCtx. */
43 #define APP_LAYER_PARSER_OPT_ACCEPT_GAPS BIT_U32(0)
44 #define APP_LAYER_PARSER_OPT_UNIDIR_TXS BIT_U32(1)
45 
46 #define APP_LAYER_PARSER_INT_STREAM_DEPTH_SET BIT_U32(0)
47 
48 /* applies to DetectFlags uint64_t field */
49 
50 /** reserved for future use */
51 #define APP_LAYER_TX_RESERVED1_FLAG BIT_U64(48)
52 #define APP_LAYER_TX_RESERVED2_FLAG BIT_U64(49)
53 #define APP_LAYER_TX_RESERVED3_FLAG BIT_U64(50)
54 #define APP_LAYER_TX_RESERVED4_FLAG BIT_U64(51)
55 #define APP_LAYER_TX_RESERVED5_FLAG BIT_U64(52)
56 #define APP_LAYER_TX_RESERVED6_FLAG BIT_U64(53)
57 #define APP_LAYER_TX_RESERVED7_FLAG BIT_U64(54)
58 #define APP_LAYER_TX_RESERVED8_FLAG BIT_U64(55)
59 #define APP_LAYER_TX_RESERVED9_FLAG BIT_U64(56)
60 #define APP_LAYER_TX_RESERVED10_FLAG BIT_U64(57)
61 #define APP_LAYER_TX_RESERVED11_FLAG BIT_U64(58)
62 #define APP_LAYER_TX_RESERVED12_FLAG BIT_U64(59)
63 #define APP_LAYER_TX_RESERVED13_FLAG BIT_U64(60)
64 #define APP_LAYER_TX_RESERVED14_FLAG BIT_U64(61)
65 #define APP_LAYER_TX_RESERVED15_FLAG BIT_U64(62)
66 
67 #define APP_LAYER_TX_RESERVED_FLAGS \
68  (APP_LAYER_TX_RESERVED1_FLAG | APP_LAYER_TX_RESERVED2_FLAG | APP_LAYER_TX_RESERVED3_FLAG | \
69  APP_LAYER_TX_RESERVED4_FLAG | APP_LAYER_TX_RESERVED5_FLAG | \
70  APP_LAYER_TX_RESERVED6_FLAG | APP_LAYER_TX_RESERVED7_FLAG | \
71  APP_LAYER_TX_RESERVED8_FLAG | APP_LAYER_TX_RESERVED9_FLAG | \
72  APP_LAYER_TX_RESERVED10_FLAG | APP_LAYER_TX_RESERVED11_FLAG | \
73  APP_LAYER_TX_RESERVED12_FLAG | APP_LAYER_TX_RESERVED13_FLAG | \
74  APP_LAYER_TX_RESERVED14_FLAG | APP_LAYER_TX_RESERVED15_FLAG)
75 
76 /** is tx fully inspected? */
77 #define APP_LAYER_TX_INSPECTED_FLAG BIT_U64(63)
78 /** other 63 bits are for tracking which prefilter engine is already
79  * completely inspected */
80 #define APP_LAYER_TX_PREFILTER_MASK ~(APP_LAYER_TX_INSPECTED_FLAG | APP_LAYER_TX_RESERVED_FLAGS)
81 
82 /** parser has successfully processed in the input, and has consumed
83  * all of it. */
84 #define APP_LAYER_OK (AppLayerResult) { 0, 0, 0 }
85 
86 /** parser has hit an unrecoverable error. Returning this to the API
87  * leads to no further calls to the parser. */
88 #define APP_LAYER_ERROR (AppLayerResult) { -1, 0, 0 }
89 
90 /** parser needs more data. Through 'c' it will indicate how many
91  * of the input bytes it has consumed. Through 'n' it will indicate
92  * how many more bytes it needs before getting called again.
93  * \note consumed (c) should never be more than the input len
94  * needed (n) + consumed (c) should be more than the input len
95  */
96 #define APP_LAYER_INCOMPLETE(c,n) (AppLayerResult) { 1, (c), (n) }
97 
98 int AppLayerParserProtoIsRegistered(uint8_t ipproto, AppProto alproto);
99 
100 /***** transaction handling *****/
101 
102 int AppLayerParserSetup(void);
105 
107 
108 /**
109  * \brief Gets a new app layer protocol's parser thread context.
110  *
111  * \retval Non-NULL pointer on success.
112  * NULL pointer on failure.
113  */
115 
116 /**
117  * \brief Destroys the app layer parser thread context obtained
118  * using AppLayerParserThreadCtxAlloc().
119  *
120  * \param tctx Pointer to the thread context to be destroyed.
121  */
123 
124 /**
125  * \brief Given a protocol name, checks if the parser is enabled in
126  * the conf file.
127  *
128  * \param alproto_name Name of the app layer protocol.
129  *
130  * \retval 1 If enabled.
131  * \retval 0 If disabled.
132  */
133 int AppLayerParserConfParserEnabled(const char *ipproto,
134  const char *alproto_name);
135 
136 /** \brief Prototype for parsing functions */
137 typedef AppLayerResult (*AppLayerParserFPtr)(Flow *f, void *protocol_state,
138  AppLayerParserState *pstate, StreamSlice stream_slice, void *local_storage);
139 
140 typedef struct AppLayerGetTxIterState {
141  union {
142  void *ptr;
143  uint64_t u64;
144  } un;
146 
147 /** \brief tx iterator prototype */
148 typedef AppLayerGetTxIterTuple (*AppLayerGetTxIteratorFunc)
149  (const uint8_t ipproto, const AppProto alproto,
150  void *alstate, uint64_t min_tx_id, uint64_t max_tx_id,
151  AppLayerGetTxIterState *state);
152 
153 /***** Parser related registration *****/
154 
155 typedef int (*AppLayerParserGetFrameIdByNameFn)(const char *frame_name);
156 typedef const char *(*AppLayerParserGetFrameNameByIdFn)(const uint8_t id);
157 
158 /**
159  * \brief Register app layer parser for the protocol.
160  *
161  * \retval 0 On success.
162  * \retval -1 On failure.
163  */
164 int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto,
165  uint8_t direction,
166  AppLayerParserFPtr Parser);
168  AppProto alproto,
169  uint8_t direction);
170 void AppLayerParserRegisterOptionFlags(uint8_t ipproto, AppProto alproto,
171  uint32_t flags);
172 void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto,
173  void *(*StateAlloc)(void *, AppProto), void (*StateFree)(void *));
175  void *(*LocalStorageAlloc)(void),
176  void (*LocalStorageFree)(void *));
177 void AppLayerParserRegisterGetFilesFunc(uint8_t ipproto, AppProto alproto,
178  FileContainer *(*StateGetFiles)(void *, uint8_t));
179 // void AppLayerParserRegisterGetEventsFunc(uint8_t ipproto, AppProto proto,
180 // AppLayerDecoderEvents *(*StateGetEvents)(void *) __attribute__((nonnull)));
181 void AppLayerParserRegisterLoggerFuncs(uint8_t ipproto, AppProto alproto,
182  LoggerId (*StateGetTxLogged)(void *, void *),
183  void (*StateSetTxLogged)(void *, void *, LoggerId));
184 void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto);
185 void AppLayerParserRegisterLoggerBits(uint8_t ipproto, AppProto alproto, LoggerId bits);
186 void AppLayerParserRegisterTruncateFunc(uint8_t ipproto, AppProto alproto,
187  void (*Truncate)(void *, uint8_t));
188 void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto,
189  int (*StateGetStateProgress)(void *alstate, uint8_t direction));
190 void AppLayerParserRegisterTxFreeFunc(uint8_t ipproto, AppProto alproto,
191  void (*StateTransactionFree)(void *, uint64_t));
192 void AppLayerParserRegisterGetTxCnt(uint8_t ipproto, AppProto alproto,
193  uint64_t (*StateGetTxCnt)(void *alstate));
194 void AppLayerParserRegisterGetTx(uint8_t ipproto, AppProto alproto,
195  void *(StateGetTx)(void *alstate, uint64_t tx_id));
196 void AppLayerParserRegisterGetTxIterator(uint8_t ipproto, AppProto alproto,
199  AppProto alproto, const int ts, const int tc);
200 void AppLayerParserRegisterGetEventInfo(uint8_t ipproto, AppProto alproto,
201  int (*StateGetEventInfo)(const char *event_name, int *event_id,
202  AppLayerEventType *event_type));
203 void AppLayerParserRegisterGetEventInfoById(uint8_t ipproto, AppProto alproto,
204  int (*StateGetEventInfoById)(int event_id, const char **event_name,
205  AppLayerEventType *event_type));
206 void AppLayerParserRegisterGetFrameFuncs(uint8_t ipproto, AppProto alproto,
207  AppLayerParserGetFrameIdByNameFn GetFrameIdByName,
208  AppLayerParserGetFrameNameByIdFn GetFrameNameById);
210  AppProto alproto,
211  uint32_t (*GetStreamDepth)(void));
212 void AppLayerParserRegisterSetStreamDepthFlag(uint8_t ipproto, AppProto alproto,
213  void (*SetStreamDepthFlag)(void *tx, uint8_t flags));
214 
215 void AppLayerParserRegisterTxDataFunc(uint8_t ipproto, AppProto alproto,
216  AppLayerTxData *(*GetTxData)(void *tx));
217 void AppLayerParserRegisterApplyTxConfigFunc(uint8_t ipproto, AppProto alproto,
218  bool (*ApplyTxConfig)(void *state, void *tx, int mode, AppLayerTxConfig));
219 
220 /***** Get and transaction functions *****/
221 
222 uint32_t AppLayerParserGetOptionFlags(uint8_t protomap, AppProto alproto);
224  const AppProto alproto);
225 
226 void *AppLayerParserGetProtocolParserLocalStorage(uint8_t ipproto, AppProto alproto);
227 void AppLayerParserDestroyProtocolParserLocalStorage(uint8_t ipproto, AppProto alproto,
228  void *local_data);
229 
230 
232 void AppLayerParserSetTransactionLogId(AppLayerParserState *pstate, uint64_t tx_id);
233 
234 uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint8_t direction);
236  void *alstate, const uint8_t flags, bool tag_txs_as_inspected);
237 
240 AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *tx);
241 FileContainer *AppLayerParserGetFiles(const Flow *f, const uint8_t direction);
242 int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto,
243  void *alstate, uint8_t direction);
244 uint64_t AppLayerParserGetTxCnt(const Flow *, void *alstate);
245 void *AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id);
246 int AppLayerParserGetStateProgressCompletionStatus(AppProto alproto, uint8_t direction);
247 int AppLayerParserGetEventInfo(uint8_t ipproto, AppProto alproto, const char *event_name,
248  int *event_id, AppLayerEventType *event_type);
249 int AppLayerParserGetEventInfoById(uint8_t ipproto, AppProto alproto, int event_id,
250  const char **event_name, AppLayerEventType *event_type);
251 
252 uint64_t AppLayerParserGetTransactionActive(const Flow *f, AppLayerParserState *pstate, uint8_t direction);
253 
254 uint8_t AppLayerParserGetFirstDataDir(uint8_t ipproto, AppProto alproto);
255 
256 int AppLayerParserSupportsFiles(uint8_t ipproto, AppProto alproto);
257 
258 AppLayerTxData *AppLayerParserGetTxData(uint8_t ipproto, AppProto alproto, void *tx);
259 void AppLayerParserApplyTxConfig(uint8_t ipproto, AppProto alproto,
260  void *state, void *tx, enum ConfigAction mode, AppLayerTxConfig);
261 
262 /***** General *****/
263 
265  uint8_t flags, const uint8_t *input, uint32_t input_len);
268 int AppLayerParserProtocolHasLogger(uint8_t ipproto, AppProto alproto);
269 LoggerId AppLayerParserProtocolGetLoggerBits(uint8_t ipproto, AppProto alproto);
270 void AppLayerParserTriggerRawStreamReassembly(Flow *f, int direction);
271 void AppLayerParserSetStreamDepth(uint8_t ipproto, AppProto alproto, uint32_t stream_depth);
272 uint32_t AppLayerParserGetStreamDepth(const Flow *f);
273 void AppLayerParserSetStreamDepthFlag(uint8_t ipproto, AppProto alproto, void *state, uint64_t tx_id, uint8_t flags);
274 int AppLayerParserIsEnabled(AppProto alproto);
275 int AppLayerParserGetFrameIdByName(uint8_t ipproto, AppProto alproto, const char *name);
276 const char *AppLayerParserGetFrameNameById(uint8_t ipproto, AppProto alproto, const uint8_t id);
277 
278 /***** Cleanup *****/
279 
281  uint8_t protomap, AppProto alproto, void *alstate, AppLayerParserState *pstate);
282 void AppLayerParserStateCleanup(const Flow *f, void *alstate, AppLayerParserState *pstate);
283 
285 
286 
287 void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint8_t flag);
288 int AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint8_t flag);
289 
290 void AppLayerParserStreamTruncated(uint8_t ipproto, AppProto alproto, void *alstate,
291  uint8_t direction);
292 
293 
294 
297 
299 
300 #ifdef DEBUG
301 void AppLayerParserStatePrintDetails(AppLayerParserState *pstate);
302 #endif
303 
304 
305 /***** Unittests *****/
306 
307 #ifdef UNITTESTS
308 void AppLayerParserRegisterProtocolUnittests(uint8_t ipproto, AppProto alproto,
309  void (*RegisterUnittests)(void));
313 void UTHAppLayerParserStateGetIds(void *ptr, uint64_t *i1, uint64_t *i2, uint64_t *log, uint64_t *min);
314 #endif
315 
317 
318 #endif /* __APP_LAYER_PARSER_H__ */
AppLayerParserGetStateProgress
int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto, void *alstate, uint8_t direction)
get the progress value for a tx/protocol
Definition: app-layer-parser.c:1102
AppLayerParserThreadCtxFree
void AppLayerParserThreadCtxFree(AppLayerParserThreadCtx *tctx)
Destroys the app layer parser thread context obtained using AppLayerParserThreadCtxAlloc().
Definition: app-layer-parser.c:327
AppLayerParserGetFiles
FileContainer * AppLayerParserGetFiles(const Flow *f, const uint8_t direction)
Definition: app-layer-parser.c:894
AppLayerParserGetTx
void * AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id)
Definition: app-layer-parser.c:1123
AppLayerParserStreamTruncated
void AppLayerParserStreamTruncated(uint8_t ipproto, AppProto alproto, void *alstate, uint8_t direction)
Definition: app-layer-parser.c:1733
AppLayerParserPostStreamSetup
void AppLayerParserPostStreamSetup(void)
Definition: app-layer-parser.c:282
AppLayerParserGetDecoderEvents
AppLayerDecoderEvents * AppLayerParserGetDecoderEvents(AppLayerParserState *pstate)
Definition: app-layer-parser.c:865
FileContainer_
Definition: util-file.h:110
AppLayerParserRegisterGetTx
void AppLayerParserRegisterGetTx(uint8_t ipproto, AppProto alproto, void *(StateGetTx)(void *alstate, uint64_t tx_id))
Definition: app-layer-parser.c:543
AppLayerParserRegisterLogger
void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:491
ts
uint64_t ts
Definition: source-erf-file.c:55
AppLayerParserRegisterLoggerBits
void AppLayerParserRegisterLoggerBits(uint8_t ipproto, AppProto alproto, LoggerId bits)
Definition: app-layer-parser.c:482
AppLayerGetTxIterState::ptr
void * ptr
Definition: app-layer-parser.h:142
AppLayerParserStateAlloc
AppLayerParserState * AppLayerParserStateAlloc(void)
Definition: app-layer-parser.c:250
AppLayerParserTransactionsCleanup
void AppLayerParserTransactionsCleanup(Flow *f)
remove obsolete (inspected and logged) transactions
Definition: app-layer-parser.c:918
AppLayerParserSetEOF
void AppLayerParserSetEOF(AppLayerParserState *pstate)
Definition: app-layer-parser.c:1439
AppLayerParserRegisterGetTxCnt
void AppLayerParserRegisterGetTxCnt(uint8_t ipproto, AppProto alproto, uint64_t(*StateGetTxCnt)(void *alstate))
Definition: app-layer-parser.c:532
AppLayerParserGetEventInfoById
int AppLayerParserGetEventInfoById(uint8_t ipproto, AppProto alproto, int event_id, const char **event_name, AppLayerEventType *event_type)
Definition: app-layer-parser.c:1148
AppLayerParserRegisterGetFrameFuncs
void AppLayerParserRegisterGetFrameFuncs(uint8_t ipproto, AppProto alproto, AppLayerParserGetFrameIdByNameFn GetFrameIdByName, AppLayerParserGetFrameNameByIdFn GetFrameNameById)
Definition: app-layer-parser.c:589
AppLayerParserGetStreamDepth
uint32_t AppLayerParserGetStreamDepth(const Flow *f)
Definition: app-layer-parser.c:1521
AppProto
uint16_t AppProto
Definition: app-layer-protos.h:80
AppLayerParserSetDecoderEvents
void AppLayerParserSetDecoderEvents(AppLayerParserState *pstate, AppLayerDecoderEvents *devents)
Definition: app-layer-parser.c:873
AppLayerParserRegisterSetStreamDepthFlag
void AppLayerParserRegisterSetStreamDepthFlag(uint8_t ipproto, AppProto alproto, void(*SetStreamDepthFlag)(void *tx, uint8_t flags))
Definition: app-layer-parser.c:631
Flow_
Flow data structure.
Definition: flow.h:353
AppLayerEventType
enum AppLayerEventType_ AppLayerEventType
LoggerId
LoggerId
Definition: suricata-common.h:441
AppLayerParserRegisterGetEventInfoById
void AppLayerParserRegisterGetEventInfoById(uint8_t ipproto, AppProto alproto, int(*StateGetEventInfoById)(int event_id, const char **event_name, AppLayerEventType *event_type))
Definition: app-layer-parser.c:577
UTHAppLayerParserStateGetIds
void UTHAppLayerParserStateGetIds(void *ptr, uint64_t *i1, uint64_t *i2, uint64_t *log, uint64_t *min)
Definition: app-layer-parser.c:229
AppLayerParserRegisterGetFilesFunc
void AppLayerParserRegisterGetFilesFunc(uint8_t ipproto, AppProto alproto, FileContainer *(*StateGetFiles)(void *, uint8_t))
Definition: app-layer-parser.c:471
rust.h
proto
uint8_t proto
Definition: decode-template.h:0
AppLayerParserRegisterGetStreamDepth
void AppLayerParserRegisterGetStreamDepth(uint8_t ipproto, AppProto alproto, uint32_t(*GetStreamDepth)(void))
AppLayerParserProtocolGetLoggerBits
LoggerId AppLayerParserProtocolGetLoggerBits(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:1491
AppLayerParserStateSetFlag
void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint8_t flag)
Definition: app-layer-parser.c:1718
AppLayerParserGetFrameIdByName
int AppLayerParserGetFrameIdByName(uint8_t ipproto, AppProto alproto, const char *name)
Definition: app-layer-parser.c:1540
AppLayerGetTxIterState::u64
uint64_t u64
Definition: app-layer-parser.h:143
AppLayerParserSetup
int AppLayerParserSetup(void)
Definition: app-layer-parser.c:275
AppLayerParserRegisterProtocolUnittests
void AppLayerParserRegisterProtocolUnittests(uint8_t ipproto, AppProto alproto, void(*RegisterUnittests)(void))
Definition: app-layer-parser.c:1823
AppLayerDecoderEvents_
Data structure to store app layer decoder events.
Definition: app-layer-events.h:34
AppLayerParserSetStreamDepth
void AppLayerParserSetStreamDepth(uint8_t ipproto, AppProto alproto, uint32_t stream_depth)
Definition: app-layer-parser.c:1510
AppLayerParserGetProtocolParserLocalStorage
void * AppLayerParserGetProtocolParserLocalStorage(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:643
AppLayerParserFPtr
AppLayerResult(* AppLayerParserFPtr)(Flow *f, void *protocol_state, AppLayerParserState *pstate, StreamSlice stream_slice, void *local_storage)
Prototype for parsing functions.
Definition: app-layer-parser.h:137
AppLayerParserRegisterLoggerFuncs
void AppLayerParserRegisterLoggerFuncs(uint8_t ipproto, AppProto alproto, LoggerId(*StateGetTxLogged)(void *, void *), void(*StateSetTxLogged)(void *, void *, LoggerId))
AppLayerParserConfParserEnabled
int AppLayerParserConfParserEnabled(const char *ipproto, const char *alproto_name)
Given a protocol name, checks if the parser is enabled in the conf file.
Definition: app-layer-parser.c:347
AppLayerParserTriggerRawStreamReassembly
void AppLayerParserTriggerRawStreamReassembly(Flow *f, int direction)
Definition: app-layer-parser.c:1499
AppLayerParserGetEventInfo
int AppLayerParserGetEventInfo(uint8_t ipproto, AppProto alproto, const char *event_name, int *event_id, AppLayerEventType *event_type)
Definition: app-layer-parser.c:1138
AppLayerParserState_
Definition: app-layer-parser.c:155
AppLayerParserGetTransactionLogId
uint64_t AppLayerParserGetTransactionLogId(AppLayerParserState *pstate)
Definition: app-layer-parser.c:716
AppLayerParserRegisterLocalStorageFunc
void AppLayerParserRegisterLocalStorageFunc(uint8_t ipproto, AppProto proto, void *(*LocalStorageAlloc)(void), void(*LocalStorageFree)(void *))
Definition: app-layer-parser.c:457
AppLayerParserRegisterStateProgressCompletionStatus
void AppLayerParserRegisterStateProgressCompletionStatus(AppProto alproto, const int ts, const int tc)
Definition: app-layer-parser.c:562
AppLayerParserProtoIsRegistered
int AppLayerParserProtoIsRegistered(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:243
AppLayerParserSupportsFiles
int AppLayerParserSupportsFiles(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:1183
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:56
AppLayerParserGetOptionFlags
uint32_t AppLayerParserGetOptionFlags(uint8_t protomap, AppProto alproto)
Definition: app-layer-parser.c:438
AppLayerParserRegisterOptionFlags
void AppLayerParserRegisterOptionFlags(uint8_t ipproto, AppProto alproto, uint32_t flags)
Definition: app-layer-parser.c:428
AppLayerParserGetTxData
AppLayerTxData * AppLayerParserGetTxData(uint8_t ipproto, AppProto alproto, void *tx)
Definition: app-layer-parser.c:1195
AppLayerParserRegisterTxDataFunc
void AppLayerParserRegisterTxDataFunc(uint8_t ipproto, AppProto alproto, AppLayerTxData *(*GetTxData)(void *tx))
Definition: app-layer-parser.c:611
AppLayerParserDestroyProtocolParserLocalStorage
void AppLayerParserDestroyProtocolParserLocalStorage(uint8_t ipproto, AppProto alproto, void *local_data)
Definition: app-layer-parser.c:658
AppLayerGetTxIterState
Definition: app-layer-parser.h:140
AppLayerParserGetTransactionInspectId
uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint8_t direction)
Definition: app-layer-parser.c:733
AppLayerParserHasDecoderEvents
bool AppLayerParserHasDecoderEvents(AppLayerParserState *pstate)
Definition: app-layer-parser.c:1455
AppLayerParserSetTransactionInspectId
void AppLayerParserSetTransactionInspectId(const Flow *f, AppLayerParserState *pstate, void *alstate, const uint8_t flags, bool tag_txs_as_inspected)
Definition: app-layer-parser.c:764
AppLayerParserRegisterGetTxIterator
void AppLayerParserRegisterGetTxIterator(uint8_t ipproto, AppProto alproto, AppLayerGetTxIteratorFunc Func)
Definition: app-layer-parser.c:554
AppLayerGetTxIterator
AppLayerGetTxIteratorFunc AppLayerGetTxIterator(const uint8_t ipproto, const AppProto alproto)
Definition: app-layer-parser.c:708
AppLayerParserRestoreParserTable
void AppLayerParserRestoreParserTable(void)
Definition: app-layer-parser.c:1840
AppLayerGetTxIterState
struct AppLayerGetTxIterState AppLayerGetTxIterState
AppLayerParserStateIssetFlag
int AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint8_t flag)
Definition: app-layer-parser.c:1726
AppLayerParserRegisterTxFreeFunc
void AppLayerParserRegisterTxFreeFunc(uint8_t ipproto, AppProto alproto, void(*StateTransactionFree)(void *, uint64_t))
Definition: app-layer-parser.c:521
AppLayerParserDeSetup
int AppLayerParserDeSetup(void)
Definition: app-layer-parser.c:296
ConfigAction
ConfigAction
Definition: util-config.h:27
AppLayerParserGetFrameNameById
const char * AppLayerParserGetFrameNameById(uint8_t ipproto, AppProto alproto, const uint8_t id)
Definition: app-layer-parser.c:1549
AppLayerFramesFreeContainer
void AppLayerFramesFreeContainer(Flow *f)
Definition: app-layer-parser.c:191
util-file.h
AppLayerParserIsEnabled
int AppLayerParserIsEnabled(AppProto alproto)
simple way to globally test if a alproto is registered and fully enabled in the configuration.
Definition: app-layer-parser.c:1473
flags
uint8_t flags
Definition: decode-gre.h:0
AppLayerParserGetFrameNameByIdFn
const char *(* AppLayerParserGetFrameNameByIdFn)(const uint8_t id)
Definition: app-layer-parser.h:156
AppLayerParserApplyTxConfig
void AppLayerParserApplyTxConfig(uint8_t ipproto, AppProto alproto, void *state, void *tx, enum ConfigAction mode, AppLayerTxConfig)
Definition: app-layer-parser.c:1202
AppLayerParserSetTransactionLogId
void AppLayerParserSetTransactionLogId(AppLayerParserState *pstate, uint64_t tx_id)
Definition: app-layer-parser.c:723
AppLayerParserRegisterStateFuncs
void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto, void *(*StateAlloc)(void *, AppProto), void(*StateFree)(void *))
Definition: app-layer-parser.c:444
AppLayerParserRegisterUnittests
void AppLayerParserRegisterUnittests(void)
Definition: app-layer-parser.c:1935
AppLayerParserStateCleanup
void AppLayerParserStateCleanup(const Flow *f, void *alstate, AppLayerParserState *pstate)
Definition: app-layer-parser.c:1577
AppLayerParserBackupParserTable
void AppLayerParserBackupParserTable(void)
Definition: app-layer-parser.c:1832
AppLayerParserRegisterGetStateProgressFunc
void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto, int(*StateGetStateProgress)(void *alstate, uint8_t direction))
Definition: app-layer-parser.c:510
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:31
AppLayerGetTxIterState::un
union AppLayerGetTxIterState::@16 un
app-layer-events.h
AppLayerParserRegisterTruncateFunc
void AppLayerParserRegisterTruncateFunc(uint8_t ipproto, AppProto alproto, void(*Truncate)(void *, uint8_t))
Definition: app-layer-parser.c:500
AppLayerParserRegisterProtocolParsers
void AppLayerParserRegisterProtocolParsers(void)
Definition: app-layer-parser.c:1659
AppLayerParserGetFirstDataDir
uint8_t AppLayerParserGetFirstDataDir(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:1159
AppLayerParserRegisterGetEventInfo
void AppLayerParserRegisterGetEventInfo(uint8_t ipproto, AppProto alproto, int(*StateGetEventInfo)(const char *event_name, int *event_id, AppLayerEventType *event_type))
Definition: app-layer-parser.c:599
util-config.h
AppLayerParserGetTxCnt
uint64_t AppLayerParserGetTxCnt(const Flow *, void *alstate)
Definition: app-layer-parser.c:1116
AppLayerParserRegisterParser
int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto, uint8_t direction, AppLayerParserFPtr Parser)
Register app layer parser for the protocol.
Definition: app-layer-parser.c:405
AppLayerParserProtocolHasLogger
int AppLayerParserProtocolHasLogger(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:1483
AppLayerParserThreadCtxAlloc
AppLayerParserThreadCtx * AppLayerParserThreadCtxAlloc(void)
Gets a new app layer protocol's parser thread context.
Definition: app-layer-parser.c:306
AppLayerParserSetStreamDepthFlag
void AppLayerParserSetStreamDepthFlag(uint8_t ipproto, AppProto alproto, void *state, uint64_t tx_id, uint8_t flags)
Definition: app-layer-parser.c:1526
AppLayerGetTxIteratorFunc
AppLayerGetTxIterTuple(* AppLayerGetTxIteratorFunc)(const uint8_t ipproto, const AppProto alproto, void *alstate, uint64_t min_tx_id, uint64_t max_tx_id, AppLayerGetTxIterState *state)
tx iterator prototype
Definition: app-layer-parser.h:149
AppLayerParserThreadCtx_
Definition: app-layer-parser.c:86
AppLayerParserStateFree
void AppLayerParserStateFree(AppLayerParserState *pstate)
Definition: app-layer-parser.c:263
AppLayerParserGetEventsByTx
AppLayerDecoderEvents * AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *tx)
Definition: app-layer-parser.c:878
AppLayerParserRegisterApplyTxConfigFunc
void AppLayerParserRegisterApplyTxConfigFunc(uint8_t ipproto, AppProto alproto, bool(*ApplyTxConfig)(void *state, void *tx, int mode, AppLayerTxConfig))
Definition: app-layer-parser.c:621
AppLayerParserParse
int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *tctx, Flow *f, AppProto alproto, uint8_t flags, const uint8_t *input, uint32_t input_len)
Definition: app-layer-parser.c:1244
AppLayerParserGetFrameIdByNameFn
int(* AppLayerParserGetFrameIdByNameFn)(const char *frame_name)
Definition: app-layer-parser.h:155
AppLayerParserRegisterParserAcceptableDataDirection
void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto, AppProto alproto, uint8_t direction)
Definition: app-layer-parser.c:417
AppLayerParserGetStateProgressCompletionStatus
int AppLayerParserGetStateProgressCompletionStatus(AppProto alproto, uint8_t direction)
Definition: app-layer-parser.c:1130
AppLayerParserStateProtoCleanup
void AppLayerParserStateProtoCleanup(uint8_t protomap, AppProto alproto, void *alstate, AppLayerParserState *pstate)
Definition: app-layer-parser.c:1560
AppLayerParserGetTransactionActive
uint64_t AppLayerParserGetTransactionActive(const Flow *f, AppLayerParserState *pstate, uint8_t direction)
Definition: app-layer-parser.c:1166