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 SURICATA_APP_LAYER_PARSER_H
26 #define SURICATA_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_U16(0)
35 #define APP_LAYER_PARSER_NO_INSPECTION BIT_U16(1)
36 #define APP_LAYER_PARSER_NO_REASSEMBLY BIT_U16(2)
37 #define APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD BIT_U16(3)
38 #define APP_LAYER_PARSER_BYPASS_READY BIT_U16(4)
39 #define APP_LAYER_PARSER_EOF_TS BIT_U16(5)
40 #define APP_LAYER_PARSER_EOF_TC BIT_U16(6)
41 #define APP_LAYER_PARSER_TRUNC_TS BIT_U16(7)
42 #define APP_LAYER_PARSER_TRUNC_TC BIT_U16(8)
43 #define APP_LAYER_PARSER_SFRAME_TS BIT_U16(9)
44 #define APP_LAYER_PARSER_SFRAME_TC BIT_U16(10)
45 
46 /* Flags for AppLayerParserProtoCtx. */
47 #define APP_LAYER_PARSER_OPT_ACCEPT_GAPS BIT_U32(0)
48 
49 #define APP_LAYER_PARSER_INT_STREAM_DEPTH_SET BIT_U32(0)
50 
51 /* applies to DetectFlags uint64_t field */
52 
53 /** reserved for future use */
54 #define APP_LAYER_TX_RESERVED1_FLAG BIT_U64(48)
55 #define APP_LAYER_TX_RESERVED2_FLAG BIT_U64(49)
56 #define APP_LAYER_TX_RESERVED3_FLAG BIT_U64(50)
57 #define APP_LAYER_TX_RESERVED4_FLAG BIT_U64(51)
58 #define APP_LAYER_TX_RESERVED5_FLAG BIT_U64(52)
59 #define APP_LAYER_TX_RESERVED6_FLAG BIT_U64(53)
60 #define APP_LAYER_TX_RESERVED7_FLAG BIT_U64(54)
61 #define APP_LAYER_TX_RESERVED8_FLAG BIT_U64(55)
62 #define APP_LAYER_TX_RESERVED9_FLAG BIT_U64(56)
63 #define APP_LAYER_TX_RESERVED10_FLAG BIT_U64(57)
64 #define APP_LAYER_TX_RESERVED11_FLAG BIT_U64(58)
65 #define APP_LAYER_TX_RESERVED12_FLAG BIT_U64(59)
66 #define APP_LAYER_TX_RESERVED13_FLAG BIT_U64(60)
67 #define APP_LAYER_TX_RESERVED14_FLAG BIT_U64(61)
68 
69 #define APP_LAYER_TX_RESERVED_FLAGS \
70  (APP_LAYER_TX_RESERVED1_FLAG | APP_LAYER_TX_RESERVED2_FLAG | APP_LAYER_TX_RESERVED3_FLAG | \
71  APP_LAYER_TX_RESERVED4_FLAG | APP_LAYER_TX_RESERVED5_FLAG | \
72  APP_LAYER_TX_RESERVED6_FLAG | APP_LAYER_TX_RESERVED7_FLAG | \
73  APP_LAYER_TX_RESERVED8_FLAG | APP_LAYER_TX_RESERVED9_FLAG | \
74  APP_LAYER_TX_RESERVED10_FLAG | APP_LAYER_TX_RESERVED11_FLAG | \
75  APP_LAYER_TX_RESERVED12_FLAG | APP_LAYER_TX_RESERVED13_FLAG | \
76  APP_LAYER_TX_RESERVED14_FLAG)
77 
78 /** should inspection be skipped in that direction */
79 #define APP_LAYER_TX_SKIP_INSPECT_FLAG BIT_U64(62)
80 /** is tx fully inspected? */
81 #define APP_LAYER_TX_INSPECTED_FLAG BIT_U64(63)
82 /** other 63 bits are for tracking which prefilter engine is already
83  * completely inspected */
84 #define APP_LAYER_TX_PREFILTER_MASK ~(APP_LAYER_TX_INSPECTED_FLAG | APP_LAYER_TX_RESERVED_FLAGS)
85 
86 /** parser has successfully processed in the input, and has consumed
87  * all of it. */
88 #define APP_LAYER_OK (AppLayerResult) { 0, 0, 0 }
89 
90 /** parser has hit an unrecoverable error. Returning this to the API
91  * leads to no further calls to the parser. */
92 #define APP_LAYER_ERROR (AppLayerResult) { -1, 0, 0 }
93 
94 /** parser needs more data. Through 'c' it will indicate how many
95  * of the input bytes it has consumed. Through 'n' it will indicate
96  * how many more bytes it needs before getting called again.
97  * \note consumed (c) should never be more than the input len
98  * needed (n) + consumed (c) should be more than the input len
99  */
100 #define APP_LAYER_INCOMPLETE(c,n) (AppLayerResult) { 1, (c), (n) }
101 
102 int AppLayerParserProtoIsRegistered(uint8_t ipproto, AppProto alproto);
103 
104 /***** transaction handling *****/
105 
106 int AppLayerParserSetup(void);
109 
111 
112 /**
113  * \brief Gets a new app layer protocol's parser thread context.
114  *
115  * \retval Non-NULL pointer on success.
116  * NULL pointer on failure.
117  */
119 
120 /**
121  * \brief Destroys the app layer parser thread context obtained
122  * using AppLayerParserThreadCtxAlloc().
123  *
124  * \param tctx Pointer to the thread context to be destroyed.
125  */
127 
128 /**
129  * \brief Given a protocol name, checks if the parser is enabled in
130  * the conf file.
131  *
132  * \param alproto_name Name of the app layer protocol.
133  *
134  * \retval 1 If enabled.
135  * \retval 0 If disabled.
136  */
137 int AppLayerParserConfParserEnabled(const char *ipproto,
138  const char *alproto_name);
139 
140 /** \brief Prototype for parsing functions */
141 typedef AppLayerResult (*AppLayerParserFPtr)(Flow *f, void *protocol_state,
142  AppLayerParserState *pstate, StreamSlice stream_slice, void *local_storage);
143 
144 typedef struct AppLayerGetTxIterState {
145  union {
146  void *ptr;
147  uint64_t u64;
148  } un;
150 
151 /** \brief tx iterator prototype */
152 typedef AppLayerGetTxIterTuple (*AppLayerGetTxIteratorFunc)
153  (const uint8_t ipproto, const AppProto alproto,
154  void *alstate, uint64_t min_tx_id, uint64_t max_tx_id,
155  AppLayerGetTxIterState *state);
156 
157 /***** Parser related registration *****/
158 
159 typedef int (*AppLayerParserGetFrameIdByNameFn)(const char *frame_name);
160 typedef const char *(*AppLayerParserGetFrameNameByIdFn)(const uint8_t id);
161 
162 /**
163  * \brief Register app layer parser for the protocol.
164  *
165  * \retval 0 On success.
166  * \retval -1 On failure.
167  */
168 int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto,
169  uint8_t direction,
170  AppLayerParserFPtr Parser);
172  AppProto alproto,
173  uint8_t direction);
174 void AppLayerParserRegisterOptionFlags(uint8_t ipproto, AppProto alproto,
175  uint32_t flags);
176 void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto,
177  void *(*StateAlloc)(void *, AppProto), void (*StateFree)(void *));
179  void *(*LocalStorageAlloc)(void), void (*LocalStorageFree)(void *));
180 // void AppLayerParserRegisterGetEventsFunc(uint8_t ipproto, AppProto proto,
181 // AppLayerDecoderEvents *(*StateGetEvents)(void *) __attribute__((nonnull)));
182 void AppLayerParserRegisterGetTxFilesFunc(uint8_t ipproto, AppProto alproto,
183  AppLayerGetFileState (*GetTxFiles)(void *, void *, uint8_t));
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);
209 void AppLayerParserRegisterSetStreamDepthFlag(uint8_t ipproto, AppProto alproto,
210  void (*SetStreamDepthFlag)(void *tx, uint8_t flags));
211 
212 void AppLayerParserRegisterTxDataFunc(uint8_t ipproto, AppProto alproto,
213  AppLayerTxData *(*GetTxData)(void *tx));
214 void AppLayerParserRegisterApplyTxConfigFunc(uint8_t ipproto, AppProto alproto,
215  bool (*ApplyTxConfig)(void *state, void *tx, int mode, AppLayerTxConfig));
217  uint8_t ipproto, AppProto alproto, AppLayerStateData *(*GetStateData)(void *state));
218 
219 /***** Get and transaction functions *****/
220 
221 uint32_t AppLayerParserGetOptionFlags(uint8_t protomap, AppProto alproto);
223  const AppProto alproto);
224 
225 void *AppLayerParserGetProtocolParserLocalStorage(uint8_t ipproto, AppProto alproto);
226 void AppLayerParserDestroyProtocolParserLocalStorage(uint8_t ipproto, AppProto alproto,
227  void *local_data);
228 
229 
231 void AppLayerParserSetTransactionLogId(AppLayerParserState *pstate, uint64_t tx_id);
232 
233 uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint8_t direction);
235  void *alstate, const uint8_t flags, bool tag_txs_as_inspected);
236 
239 AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *tx);
240 AppLayerGetFileState AppLayerParserGetTxFiles(
241  const Flow *f, void *state, void *tx, 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 bool AppLayerParserSupportsFiles(uint8_t ipproto, AppProto alproto);
257 
258 AppLayerTxData *AppLayerParserGetTxData(uint8_t ipproto, AppProto alproto, void *tx);
259 uint64_t AppLayerParserGetTxDetectFlags(AppLayerTxData *txd, const uint8_t dir);
260 AppLayerStateData *AppLayerParserGetStateData(uint8_t ipproto, AppProto alproto, void *state);
261 void AppLayerParserApplyTxConfig(uint8_t ipproto, AppProto alproto,
262  void *state, void *tx, enum ConfigAction mode, AppLayerTxConfig);
263 
264 static inline bool AppLayerParserIsFileTx(const AppLayerTxData *txd)
265 {
266  if (txd->file_tx != 0) {
267  return true;
268  }
269  return false;
270 }
271 
272 static inline bool AppLayerParserIsFileTxInDir(const AppLayerTxData *txd, const uint8_t direction)
273 {
274  if ((txd->file_tx & direction) != 0) {
275  return true;
276  }
277  return false;
278 }
279 
280 /** \brief check if tx (possibly) has files in this tx for the direction */
281 static inline bool AppLayerParserHasFilesInDir(const AppLayerTxData *txd, const uint8_t direction)
282 {
283  return (txd->files_opened && AppLayerParserIsFileTxInDir(txd, direction));
284 }
285 
286 /***** General *****/
287 
289  uint8_t flags, const uint8_t *input, uint32_t input_len);
292 int AppLayerParserProtocolHasLogger(uint8_t ipproto, AppProto alproto);
293 LoggerId AppLayerParserProtocolGetLoggerBits(uint8_t ipproto, AppProto alproto);
294 void AppLayerParserTriggerRawStreamReassembly(Flow *f, int direction);
295 void AppLayerParserSetStreamDepth(uint8_t ipproto, AppProto alproto, uint32_t stream_depth);
296 uint32_t AppLayerParserGetStreamDepth(const Flow *f);
297 void AppLayerParserSetStreamDepthFlag(uint8_t ipproto, AppProto alproto, void *state, uint64_t tx_id, uint8_t flags);
298 int AppLayerParserIsEnabled(AppProto alproto);
299 int AppLayerParserGetFrameIdByName(uint8_t ipproto, AppProto alproto, const char *name);
300 const char *AppLayerParserGetFrameNameById(uint8_t ipproto, AppProto alproto, const uint8_t id);
301 
302 /***** Cleanup *****/
303 
305  uint8_t protomap, AppProto alproto, void *alstate, AppLayerParserState *pstate);
306 void AppLayerParserStateCleanup(const Flow *f, void *alstate, AppLayerParserState *pstate);
307 
309 
310 void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint16_t flag);
311 uint16_t AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint16_t flag);
312 
315 
316 void AppLayerParserTransactionsCleanup(Flow *f, const uint8_t pkt_dir);
317 
318 #ifdef DEBUG
319 void AppLayerParserStatePrintDetails(AppLayerParserState *pstate);
320 #endif
321 
322 
323 /***** Unittests *****/
324 
325 #ifdef UNITTESTS
326 void AppLayerParserRegisterProtocolUnittests(uint8_t ipproto, AppProto alproto,
327  void (*RegisterUnittests)(void));
331 void UTHAppLayerParserStateGetIds(void *ptr, uint64_t *i1, uint64_t *i2, uint64_t *log, uint64_t *min);
332 #endif
333 
335 void FileApplyTxFlags(const AppLayerTxData *txd, const uint8_t direction, File *file);
336 
337 #endif /* SURICATA_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:1103
AppLayerParserThreadCtxFree
void AppLayerParserThreadCtxFree(AppLayerParserThreadCtx *tctx)
Destroys the app layer parser thread context obtained using AppLayerParserThreadCtxAlloc().
Definition: app-layer-parser.c:312
AppLayerParserGetTx
void * AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id)
Definition: app-layer-parser.c:1125
AppLayerParserPostStreamSetup
void AppLayerParserPostStreamSetup(void)
Definition: app-layer-parser.c:267
AppLayerParserGetDecoderEvents
AppLayerDecoderEvents * AppLayerParserGetDecoderEvents(AppLayerParserState *pstate)
Definition: app-layer-parser.c:859
AppLayerParserRegisterGetTx
void AppLayerParserRegisterGetTx(uint8_t ipproto, AppProto alproto, void *(StateGetTx)(void *alstate, uint64_t tx_id))
Definition: app-layer-parser.c:527
AppLayerParserRegisterLogger
void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:475
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:466
AppLayerGetTxIterState::ptr
void * ptr
Definition: app-layer-parser.h:146
AppLayerGetTxIterState::un
union AppLayerGetTxIterState::@15 un
AppLayerParserStateAlloc
AppLayerParserState * AppLayerParserStateAlloc(void)
Definition: app-layer-parser.c:236
AppLayerParserSetEOF
void AppLayerParserSetEOF(AppLayerParserState *pstate)
Definition: app-layer-parser.c:1513
AppLayerParserRegisterGetTxCnt
void AppLayerParserRegisterGetTxCnt(uint8_t ipproto, AppProto alproto, uint64_t(*StateGetTxCnt)(void *alstate))
Definition: app-layer-parser.c:516
AppLayerParserGetEventInfoById
int AppLayerParserGetEventInfoById(uint8_t ipproto, AppProto alproto, int event_id, const char **event_name, AppLayerEventType *event_type)
Definition: app-layer-parser.c:1150
AppLayerParserRegisterGetFrameFuncs
void AppLayerParserRegisterGetFrameFuncs(uint8_t ipproto, AppProto alproto, AppLayerParserGetFrameIdByNameFn GetFrameIdByName, AppLayerParserGetFrameNameByIdFn GetFrameNameById)
Definition: app-layer-parser.c:573
AppLayerParserGetStreamDepth
uint32_t AppLayerParserGetStreamDepth(const Flow *f)
Definition: app-layer-parser.c:1595
AppProto
uint16_t AppProto
Definition: app-layer-protos.h:80
AppLayerParserSetDecoderEvents
void AppLayerParserSetDecoderEvents(AppLayerParserState *pstate, AppLayerDecoderEvents *devents)
Definition: app-layer-parser.c:867
AppLayerParserRegisterSetStreamDepthFlag
void AppLayerParserRegisterSetStreamDepthFlag(uint8_t ipproto, AppProto alproto, void(*SetStreamDepthFlag)(void *tx, uint8_t flags))
Definition: app-layer-parser.c:625
Flow_
Flow data structure.
Definition: flow.h:350
LoggerId
LoggerId
Definition: suricata-common.h:460
AppLayerParserGetTxDetectFlags
uint64_t AppLayerParserGetTxDetectFlags(AppLayerTxData *txd, const uint8_t dir)
Definition: app-layer-parser.c:737
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:561
UTHAppLayerParserStateGetIds
void UTHAppLayerParserStateGetIds(void *ptr, uint64_t *i1, uint64_t *i2, uint64_t *log, uint64_t *min)
Definition: app-layer-parser.c:215
rust.h
proto
uint8_t proto
Definition: decode-template.h:0
AppLayerParserProtocolGetLoggerBits
LoggerId AppLayerParserProtocolGetLoggerBits(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:1565
AppLayerParserGetFrameIdByName
int AppLayerParserGetFrameIdByName(uint8_t ipproto, AppProto alproto, const char *name)
Definition: app-layer-parser.c:1614
AppLayerGetTxIterState::u64
uint64_t u64
Definition: app-layer-parser.h:147
AppLayerParserSetup
int AppLayerParserSetup(void)
Definition: app-layer-parser.c:260
AppLayerParserRegisterProtocolUnittests
void AppLayerParserRegisterProtocolUnittests(uint8_t ipproto, AppProto alproto, void(*RegisterUnittests)(void))
Definition: app-layer-parser.c:1908
AppLayerDecoderEvents_
Data structure to store app layer decoder events.
Definition: app-layer-events.h:35
AppLayerParserSetStreamDepth
void AppLayerParserSetStreamDepth(uint8_t ipproto, AppProto alproto, uint32_t stream_depth)
Definition: app-layer-parser.c:1584
AppLayerParserStateIssetFlag
uint16_t AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint16_t flag)
Definition: app-layer-parser.c:1804
AppLayerParserGetProtocolParserLocalStorage
void * AppLayerParserGetProtocolParserLocalStorage(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:637
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:141
FileApplyTxFlags
void FileApplyTxFlags(const AppLayerTxData *txd, const uint8_t direction, File *file)
Definition: util-file.c:295
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:332
AppLayerParserTriggerRawStreamReassembly
void AppLayerParserTriggerRawStreamReassembly(Flow *f, int direction)
Definition: app-layer-parser.c:1573
AppLayerParserGetEventInfo
int AppLayerParserGetEventInfo(uint8_t ipproto, AppProto alproto, const char *event_name, int *event_id, AppLayerEventType *event_type)
Definition: app-layer-parser.c:1140
AppLayerParserState_
Definition: app-layer-parser.c:138
AppLayerParserGetTransactionLogId
uint64_t AppLayerParserGetTransactionLogId(AppLayerParserState *pstate)
Definition: app-layer-parser.c:710
AppLayerParserRegisterLocalStorageFunc
void AppLayerParserRegisterLocalStorageFunc(uint8_t ipproto, AppProto proto, void *(*LocalStorageAlloc)(void), void(*LocalStorageFree)(void *))
Definition: app-layer-parser.c:442
AppLayerParserStateSetFlag
void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint16_t flag)
Definition: app-layer-parser.c:1796
AppLayerParserRegisterStateProgressCompletionStatus
void AppLayerParserRegisterStateProgressCompletionStatus(AppProto alproto, const int ts, const int tc)
Definition: app-layer-parser.c:546
AppLayerParserProtoIsRegistered
int AppLayerParserProtoIsRegistered(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:229
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
AppLayerParserGetTxFiles
AppLayerGetFileState AppLayerParserGetTxFiles(const Flow *f, void *state, void *tx, const uint8_t direction)
Definition: app-layer-parser.c:888
AppLayerParserGetOptionFlags
uint32_t AppLayerParserGetOptionFlags(uint8_t protomap, AppProto alproto)
Definition: app-layer-parser.c:423
AppLayerParserRegisterOptionFlags
void AppLayerParserRegisterOptionFlags(uint8_t ipproto, AppProto alproto, uint32_t flags)
Definition: app-layer-parser.c:413
AppLayerParserRegisterStateDataFunc
void AppLayerParserRegisterStateDataFunc(uint8_t ipproto, AppProto alproto, AppLayerStateData *(*GetStateData)(void *state))
Definition: app-layer-parser.c:605
AppLayerParserRegisterGetTxFilesFunc
void AppLayerParserRegisterGetTxFilesFunc(uint8_t ipproto, AppProto alproto, AppLayerGetFileState(*GetTxFiles)(void *, void *, uint8_t))
Definition: app-layer-parser.c:456
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:595
AppLayerParserTransactionsCleanup
void AppLayerParserTransactionsCleanup(Flow *f, const uint8_t pkt_dir)
remove obsolete (inspected and logged) transactions
Definition: app-layer-parser.c:919
AppLayerParserDestroyProtocolParserLocalStorage
void AppLayerParserDestroyProtocolParserLocalStorage(uint8_t ipproto, AppProto alproto, void *local_data)
Definition: app-layer-parser.c:652
AppLayerGetTxIterState
Definition: app-layer-parser.h:144
AppLayerParserGetTransactionInspectId
uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint8_t direction)
Definition: app-layer-parser.c:727
AppLayerParserHasDecoderEvents
bool AppLayerParserHasDecoderEvents(AppLayerParserState *pstate)
Definition: app-layer-parser.c:1529
AppLayerParserSetTransactionInspectId
void AppLayerParserSetTransactionInspectId(const Flow *f, AppLayerParserState *pstate, void *alstate, const uint8_t flags, bool tag_txs_as_inspected)
Definition: app-layer-parser.c:758
AppLayerParserRegisterGetTxIterator
void AppLayerParserRegisterGetTxIterator(uint8_t ipproto, AppProto alproto, AppLayerGetTxIteratorFunc Func)
Definition: app-layer-parser.c:538
AppLayerGetTxIterator
AppLayerGetTxIteratorFunc AppLayerGetTxIterator(const uint8_t ipproto, const AppProto alproto)
Definition: app-layer-parser.c:702
AppLayerParserRestoreParserTable
void AppLayerParserRestoreParserTable(void)
Definition: app-layer-parser.c:1925
AppLayerGetTxIterState
struct AppLayerGetTxIterState AppLayerGetTxIterState
AppLayerParserRegisterTxFreeFunc
void AppLayerParserRegisterTxFreeFunc(uint8_t ipproto, AppProto alproto, void(*StateTransactionFree)(void *, uint64_t))
Definition: app-layer-parser.c:505
AppLayerParserDeSetup
int AppLayerParserDeSetup(void)
Definition: app-layer-parser.c:281
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:1623
AppLayerFramesFreeContainer
void AppLayerFramesFreeContainer(Flow *f)
Definition: app-layer-parser.c:174
util-file.h
File_
Definition: util-file.h:79
AppLayerTxData
struct AppLayerTxData AppLayerTxData
Definition: detect.h:1355
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:1547
flags
uint8_t flags
Definition: decode-gre.h:0
AppLayerParserGetFrameNameByIdFn
const char *(* AppLayerParserGetFrameNameByIdFn)(const uint8_t id)
Definition: app-layer-parser.h:160
AppLayerParserGetStateData
AppLayerStateData * AppLayerParserGetStateData(uint8_t ipproto, AppProto alproto, void *state)
Definition: app-layer-parser.c:1202
AppLayerParserApplyTxConfig
void AppLayerParserApplyTxConfig(uint8_t ipproto, AppProto alproto, void *state, void *tx, enum ConfigAction mode, AppLayerTxConfig)
Definition: app-layer-parser.c:1213
AppLayerParserSetTransactionLogId
void AppLayerParserSetTransactionLogId(AppLayerParserState *pstate, uint64_t tx_id)
Definition: app-layer-parser.c:717
AppLayerParserRegisterStateFuncs
void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto, void *(*StateAlloc)(void *, AppProto), void(*StateFree)(void *))
Definition: app-layer-parser.c:429
AppLayerParserRegisterUnittests
void AppLayerParserRegisterUnittests(void)
Definition: app-layer-parser.c:2020
AppLayerParserStateCleanup
void AppLayerParserStateCleanup(const Flow *f, void *alstate, AppLayerParserState *pstate)
Definition: app-layer-parser.c:1651
AppLayerParserBackupParserTable
void AppLayerParserBackupParserTable(void)
Definition: app-layer-parser.c:1917
AppLayerParserRegisterGetStateProgressFunc
void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto, int(*StateGetStateProgress)(void *alstate, uint8_t direction))
Definition: app-layer-parser.c:494
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:32
app-layer-events.h
AppLayerParserRegisterTruncateFunc
void AppLayerParserRegisterTruncateFunc(uint8_t ipproto, AppProto alproto, void(*Truncate)(void *, uint8_t))
Definition: app-layer-parser.c:484
AppLayerParserRegisterProtocolParsers
void AppLayerParserRegisterProtocolParsers(void)
Definition: app-layer-parser.c:1737
AppLayerParserGetFirstDataDir
uint8_t AppLayerParserGetFirstDataDir(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:1161
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:583
util-config.h
AppLayerParserGetTxCnt
uint64_t AppLayerParserGetTxCnt(const Flow *, void *alstate)
Definition: app-layer-parser.c:1118
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:390
AppLayerParserProtocolHasLogger
int AppLayerParserProtocolHasLogger(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:1557
AppLayerParserThreadCtxAlloc
AppLayerParserThreadCtx * AppLayerParserThreadCtxAlloc(void)
Gets a new app layer protocol's parser thread context.
Definition: app-layer-parser.c:291
AppLayerParserSetStreamDepthFlag
void AppLayerParserSetStreamDepthFlag(uint8_t ipproto, AppProto alproto, void *state, uint64_t tx_id, uint8_t flags)
Definition: app-layer-parser.c:1600
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:153
AppLayerParserThreadCtx_
Definition: app-layer-parser.c:65
AppLayerParserStateFree
void AppLayerParserStateFree(AppLayerParserState *pstate)
Definition: app-layer-parser.c:248
AppLayerParserGetEventsByTx
AppLayerDecoderEvents * AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *tx)
Definition: app-layer-parser.c:872
AppLayerParserRegisterApplyTxConfigFunc
void AppLayerParserRegisterApplyTxConfigFunc(uint8_t ipproto, AppProto alproto, bool(*ApplyTxConfig)(void *state, void *tx, int mode, AppLayerTxConfig))
Definition: app-layer-parser.c:615
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:1303
AppLayerParserGetFrameIdByNameFn
int(* AppLayerParserGetFrameIdByNameFn)(const char *frame_name)
Definition: app-layer-parser.h:159
AppLayerParserSupportsFiles
bool AppLayerParserSupportsFiles(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:1185
AppLayerParserRegisterParserAcceptableDataDirection
void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto, AppProto alproto, uint8_t direction)
Definition: app-layer-parser.c:402
AppLayerParserGetStateProgressCompletionStatus
int AppLayerParserGetStateProgressCompletionStatus(AppProto alproto, uint8_t direction)
Definition: app-layer-parser.c:1132
AppLayerParserStateProtoCleanup
void AppLayerParserStateProtoCleanup(uint8_t protomap, AppProto alproto, void *alstate, AppLayerParserState *pstate)
Definition: app-layer-parser.c:1634
AppLayerParserGetTransactionActive
uint64_t AppLayerParserGetTransactionActive(const Flow *f, AppLayerParserState *pstate, uint8_t direction)
Definition: app-layer-parser.c:1168