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 __APP_LAYER_REGISTER_H__
25 #define __APP_LAYER_REGISTER_H__
26 
27 typedef struct AppLayerParser {
28  const char *name;
29  const char *default_port;
30  int ip_proto;
31 
34 
35  uint16_t min_depth;
36  uint16_t max_depth;
37 
38  void *(*StateAlloc)(void);
39  void (*StateFree)(void *);
40 
43 
44  uint64_t (*StateGetTxCnt)(void *alstate);
45  void *(*StateGetTx)(void *alstate, uint64_t tx_id);
46  void (*StateTransactionFree)(void *, uint64_t);
47 
48  int (*StateGetProgressCompletionStatus)(uint8_t direction);
49  int (*StateGetProgress)(void *alstate, uint8_t direction);
50 
51  uint32_t (*StateGetTxLogged)(void *alstate, void *tx);
52  void (*StateSetTxLogged)(void *alstate, void *tx, uint32_t logger);
53 
54  DetectEngineState *(*GetTxDetectState)(void *tx);
55  int (*SetTxDetectState)(void *tx, DetectEngineState *);
56 
57  AppLayerDecoderEvents *(*StateGetEvents)(void *);
58  int (*StateGetEventInfo)(const char *event_name,
59  int *event_id, AppLayerEventType *event_type);
60  int (*StateGetEventInfoById)(int event_id, const char **event_name,
62 
63  void *(*LocalStorageAlloc)(void);
64  void (*LocalStorageFree)(void *);
65 
66  uint64_t (*GetTxMpmIDs)(void *tx);
67  int (*SetTxMpmIDs)(void *tx, uint64_t);
68 
69  FileContainer *(*StateGetFiles)(void *, uint8_t);
70 
71  AppLayerGetTxIterTuple (*GetTxIterator)(const uint8_t ipproto,
72  const AppProto alproto, void *alstate, uint64_t min_tx_id,
73  uint64_t max_tx_id, AppLayerGetTxIterState *istate);
75 
76 /**
77  * \brief App layer protocol detection function.
78  *
79  * \param parser The parser declaration structure.
80  * \param enable_default A boolean to indicate if default port configuration should be used if none given
81  *
82  * \retval The AppProto constant if successful. On error, this function never returns.
83  */
84 AppProto AppLayerRegisterProtocolDetection(const struct AppLayerParser *parser, int enable_default);
85 
86 /**
87  * \brief App layer protocol registration function.
88  *
89  * \param parser The parser declaration structure.
90  * \param alproto The application layer protocol identifier.
91  *
92  * \retval 0 if successful. On error, this function never returns.
93  */
94 int AppLayerRegisterParser(const struct AppLayerParser *p, AppProto alproto);
95 
96 #endif /* __APP_LAYER_REGISTER_H__ */
const char * default_port
enum AppLayerEventType_ AppLayerEventType
int(* StateGetProgress)(void *alstate, uint8_t direction)
struct AppLayerGetTxIterTuple AppLayerGetTxIterTuple
int AppLayerRegisterParser(const struct AppLayerParser *p, AppProto alproto)
App layer protocol registration function.
int(* AppLayerParserFPtr)(Flow *f, void *protocol_state, AppLayerParserState *pstate, uint8_t *buf, uint32_t buf_len, void *local_storage, const uint8_t flags)
Prototype for parsing functions.
uint32_t event_type
int(* StateGetEventInfoById)(int event_id, const char **event_name, AppLayerEventType *event_type)
AppProto(* ProbingParserFPtr)(Flow *f, uint8_t dir, uint8_t *input, uint32_t input_len, uint8_t *rdir)
uint32_t(* StateGetTxLogged)(void *alstate, void *tx)
AppLayerGetTxIterTuple(* GetTxIterator)(const uint8_t ipproto, const AppProto alproto, void *alstate, uint64_t min_tx_id, uint64_t max_tx_id, AppLayerGetTxIterState *istate)
struct AppLayerParser AppLayerParser
uint16_t AppProto
int(* StateGetProgressCompletionStatus)(uint8_t direction)
uint64_t(* StateGetTxCnt)(void *alstate)
AppProto AppLayerRegisterProtocolDetection(const struct AppLayerParser *parser, int enable_default)
App layer protocol detection function.
Data structure to store app layer decoder events.
const char * name
void(* StateFree)(void *)
void(* LocalStorageFree)(void *)
uint64_t(* GetTxMpmIDs)(void *tx)
uint16_t tx_id
void(* StateTransactionFree)(void *, uint64_t)
int(* StateGetEventInfo)(const char *event_name, int *event_id, AppLayerEventType *event_type)
ProbingParserFPtr ProbeTS
void(* StateSetTxLogged)(void *alstate, void *tx, uint32_t logger)
ProbingParserFPtr ProbeTC
AppLayerParserFPtr ParseTC
int(* SetTxDetectState)(void *tx, DetectEngineState *)
AppLayerParserFPtr ParseTS
int(* SetTxMpmIDs)(void *tx, uint64_t)