suricata
app-layer-register.h
Go to the documentation of this file.
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 SURICATA_APP_LAYER_REGISTER_H
25#define SURICATA_APP_LAYER_REGISTER_H
26
28
29typedef struct AppLayerParser {
30 const char *name;
31 const char *default_port;
32 uint8_t ip_proto;
33
36
37 uint16_t min_depth;
38 uint16_t max_depth;
39
40 void *(*StateAlloc)(void *, AppProto);
41 void (*StateFree)(void *);
42
45
46 uint64_t (*StateGetTxCnt)(void *alstate);
47 void *(*StateGetTx)(void *alstate, uint64_t tx_id);
48 void (*StateTransactionFree)(void *, uint64_t);
49
50 const int complete_ts;
51 const int complete_tc;
52 int (*StateGetProgress)(void *alstate, uint8_t direction);
53
55 const char *event_name, uint8_t *event_id, AppLayerEventType *event_type);
57 uint8_t event_id, const char **event_name, AppLayerEventType *event_type);
58
59 void *(*LocalStorageAlloc)(void);
60 void (*LocalStorageFree)(void *);
61
62 AppLayerGetFileState (*GetTxFiles)(void *, uint8_t);
63
64 AppLayerGetTxIterTuple (*GetTxIterator)(const uint8_t ipproto,
65 const AppProto alproto, void *alstate, uint64_t min_tx_id,
66 uint64_t max_tx_id, AppLayerGetTxIterState *istate);
67
68 AppLayerStateData *(*GetStateData)(void *state);
69 AppLayerTxData *(*GetTxData)(void *tx);
70 bool (*ApplyTxConfig)(void *state, void *tx, int mode, AppLayerTxConfig);
71
72 uint32_t flags;
73
76
80
81/**
82 * \brief App layer protocol detection function.
83 *
84 * \param parser The parser declaration structure.
85 * \param enable_default A boolean to indicate if default port configuration should be used if none given
86 *
87 * \retval The AppProto constant if successful. On error, this function never returns.
88 */
89AppProto AppLayerRegisterProtocolDetection(const struct AppLayerParser *parser, int enable_default);
90
91/**
92 * \brief App layer protocol registration function.
93 *
94 * \param parser The parser declaration structure.
95 * \param alproto The application layer protocol identifier.
96 *
97 * \retval 0 if successful. On error, this function never returns.
98 */
99int AppLayerRegisterParser(const struct AppLayerParser *p, AppProto alproto);
100
101int AppLayerRegisterParserAlias(const char *proto_name, const char *proto_alias);
102
103#endif /* SURICATA_APP_LAYER_REGISTER_H */
AppProto(* ProbingParserFPtr)(const Flow *f, uint8_t flags, const uint8_t *input, uint32_t input_len, uint8_t *rdir)
int(* AppLayerParserGetStateIdByNameFn)(const char *name, const uint8_t direction)
struct AppLayerGetFileState AppLayerGetFileState
struct AppLayerGetTxIterTuple AppLayerGetTxIterTuple
const char *(* AppLayerParserGetStateNameByIdFn)(const int id, const uint8_t direction)
AppLayerResult(* AppLayerParserFPtr)(Flow *f, void *protocol_state, AppLayerParserState *pstate, StreamSlice stream_slice, void *local_storage)
Prototype for parsing functions.
struct AppLayerTxData AppLayerTxData
const char *(* AppLayerParserGetFrameNameByIdFn)(const uint8_t id)
int(* AppLayerParserGetFrameIdByNameFn)(const char *frame_name)
struct AppLayerTxConfig AppLayerTxConfig
struct AppLayerStateData AppLayerStateData
enum AppLayerEventType AppLayerEventType
uint16_t AppProto
AppProto AppLayerRegisterProtocolDetection(const struct AppLayerParser *parser, int enable_default)
App layer protocol detection function.
int AppLayerRegisterParserAlias(const char *proto_name, const char *proto_alias)
int AppLayerRegisterParser(const struct AppLayerParser *p, AppProto alproto)
App layer protocol registration function.
ProbingParserFPtr ProbeTS
AppLayerParserGetStateNameByIdFn GetStateNameById
AppLayerParserFPtr ParseTS
bool(* ApplyTxConfig)(void *state, void *tx, int mode, AppLayerTxConfig)
void(* StateFree)(void *)
int(* StateGetProgress)(void *alstate, uint8_t direction)
int(* StateGetEventInfo)(const char *event_name, uint8_t *event_id, AppLayerEventType *event_type)
const char * default_port
AppLayerGetTxIterTuple(* GetTxIterator)(const uint8_t ipproto, const AppProto alproto, void *alstate, uint64_t min_tx_id, uint64_t max_tx_id, AppLayerGetTxIterState *istate)
AppLayerParserGetFrameIdByNameFn GetFrameIdByName
AppLayerParserGetFrameNameByIdFn GetFrameNameById
ProbingParserFPtr ProbeTC
int(* StateGetEventInfoById)(uint8_t event_id, const char **event_name, AppLayerEventType *event_type)
AppLayerParserFPtr ParseTC
AppLayerParserGetStateIdByNameFn GetStateIdByName
uint64_t(* StateGetTxCnt)(void *alstate)
void(* StateTransactionFree)(void *, uint64_t)
void(* LocalStorageFree)(void *)
AppLayerGetFileState(* GetTxFiles)(void *, uint8_t)