]> git.ipfire.org Git - people/ms/suricata.git/blame - src/app-layer-register.h
app-layer: include decoder events in app-layer tx data
[people/ms/suricata.git] / src / app-layer-register.h
CommitLineData
3edc7653
PC
1/* Copyright (C) 2017 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 Pierre Chifflier <chifflier@wzdftpd.net>
22 */
23
24#ifndef __APP_LAYER_REGISTER_H__
25#define __APP_LAYER_REGISTER_H__
26
27typedef struct AppLayerParser {
28 const char *name;
29 const char *default_port;
30 int ip_proto;
31
32 ProbingParserFPtr ProbeTS;
33 ProbingParserFPtr ProbeTC;
34
35 uint16_t min_depth;
36 uint16_t max_depth;
37
547d6c2d 38 void *(*StateAlloc)(void *, AppProto);
3edc7653
PC
39 void (*StateFree)(void *);
40
41 AppLayerParserFPtr ParseTS;
42 AppLayerParserFPtr ParseTC;
43
44 uint64_t (*StateGetTxCnt)(void *alstate);
45 void *(*StateGetTx)(void *alstate, uint64_t tx_id);
46 void (*StateTransactionFree)(void *, uint64_t);
bca0cd71 47
efc9a7a3
VJ
48 const int complete_ts;
49 const int complete_tc;
3edc7653 50 int (*StateGetProgress)(void *alstate, uint8_t direction);
bca0cd71 51
3edc7653
PC
52 int (*StateGetEventInfo)(const char *event_name,
53 int *event_id, AppLayerEventType *event_type);
a5d9d37c
JL
54 int (*StateGetEventInfoById)(int event_id, const char **event_name,
55 AppLayerEventType *event_type);
3edc7653
PC
56
57 void *(*LocalStorageAlloc)(void);
58 void (*LocalStorageFree)(void *);
59
3edc7653 60 FileContainer *(*StateGetFiles)(void *, uint8_t);
14843a7b
JI
61
62 AppLayerGetTxIterTuple (*GetTxIterator)(const uint8_t ipproto,
63 const AppProto alproto, void *alstate, uint64_t min_tx_id,
64 uint64_t max_tx_id, AppLayerGetTxIterState *istate);
20bc08a7 65
411f428a 66 AppLayerTxData *(*GetTxData)(void *tx);
5665fc83 67 bool (*ApplyTxConfig)(void *state, void *tx, int mode, AppLayerTxConfig);
53aa967e
JI
68
69 uint32_t flags;
4da0d9bd
VJ
70
71 void (*Truncate)(void *state, uint8_t direction);
72
3edc7653
PC
73} AppLayerParser;
74
75/**
76 * \brief App layer protocol detection function.
77 *
78 * \param parser The parser declaration structure.
79 * \param enable_default A boolean to indicate if default port configuration should be used if none given
80 *
81 * \retval The AppProto constant if successful. On error, this function never returns.
82 */
83AppProto AppLayerRegisterProtocolDetection(const struct AppLayerParser *parser, int enable_default);
84
85/**
86 * \brief App layer protocol registration function.
87 *
88 * \param parser The parser declaration structure.
89 * \param alproto The application layer protocol identifier.
90 *
91 * \retval 0 if successful. On error, this function never returns.
92 */
93int AppLayerRegisterParser(const struct AppLayerParser *p, AppProto alproto);
94
ab6171c4 95int AppLayerRegisterParserAlias(const char *proto_name, const char *proto_alias);
96
3edc7653 97#endif /* __APP_LAYER_REGISTER_H__ */