]> git.ipfire.org Git - people/ms/suricata.git/blame - src/app-layer-register.h
template: add gap handling
[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
38 void *(*StateAlloc)(void);
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
3edc7653
PC
48 int (*StateGetProgressCompletionStatus)(uint8_t direction);
49 int (*StateGetProgress)(void *alstate, uint8_t direction);
bca0cd71 50
3edc7653 51 DetectEngineState *(*GetTxDetectState)(void *tx);
7548944b 52 int (*SetTxDetectState)(void *tx, DetectEngineState *);
3edc7653 53
d568e7fa 54 AppLayerDecoderEvents *(*StateGetEvents)(void *);
3edc7653
PC
55 int (*StateGetEventInfo)(const char *event_name,
56 int *event_id, AppLayerEventType *event_type);
a5d9d37c
JL
57 int (*StateGetEventInfoById)(int event_id, const char **event_name,
58 AppLayerEventType *event_type);
3edc7653
PC
59
60 void *(*LocalStorageAlloc)(void);
61 void (*LocalStorageFree)(void *);
62
3edc7653 63 FileContainer *(*StateGetFiles)(void *, uint8_t);
14843a7b
JI
64
65 AppLayerGetTxIterTuple (*GetTxIterator)(const uint8_t ipproto,
66 const AppProto alproto, void *alstate, uint64_t min_tx_id,
67 uint64_t max_tx_id, AppLayerGetTxIterState *istate);
20bc08a7 68
411f428a 69 AppLayerTxData *(*GetTxData)(void *tx);
5665fc83 70 bool (*ApplyTxConfig)(void *state, void *tx, int mode, AppLayerTxConfig);
3edc7653
PC
71} AppLayerParser;
72
73/**
74 * \brief App layer protocol detection function.
75 *
76 * \param parser The parser declaration structure.
77 * \param enable_default A boolean to indicate if default port configuration should be used if none given
78 *
79 * \retval The AppProto constant if successful. On error, this function never returns.
80 */
81AppProto AppLayerRegisterProtocolDetection(const struct AppLayerParser *parser, int enable_default);
82
83/**
84 * \brief App layer protocol registration function.
85 *
86 * \param parser The parser declaration structure.
87 * \param alproto The application layer protocol identifier.
88 *
89 * \retval 0 if successful. On error, this function never returns.
90 */
91int AppLayerRegisterParser(const struct AppLayerParser *p, AppProto alproto);
92
93#endif /* __APP_LAYER_REGISTER_H__ */