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 #ifndef __RUST_CONTEXT_H__
19 #define __RUST_CONTEXT_H__
20 
21 #include "detect-engine-state.h" //DetectEngineState
22 #include "app-layer-krb5.h" //KRB5State, KRB5Transaction
23 #include "app-layer-ikev2.h" //IKEV2State, IKEV2Transaction
24 #include "app-layer-ntp.h" //NTPState, NTPTransaction
25 #include "app-layer-snmp.h" //SNMPState, SNMPTransaction
26 #include "app-layer-tftp.h" //TFTPState, TFTPTransaction
27 
28 typedef struct SuricataContext_ {
29     SCError (*SCLogMessage)(const SCLogLevel, const char *, const unsigned int,
30             const char *, const SCError, const char *message);
31     void (*DetectEngineStateFree)(DetectEngineState *);
32     void (*AppLayerDecoderEventsSetEventRaw)(AppLayerDecoderEvents **,
33             uint8_t);
34     void (*AppLayerDecoderEventsFreeEvents)(AppLayerDecoderEvents **);
35     void (*AppLayerParserTriggerRawStreamReassembly)(Flow *, int direction);
36 
37     int (*FileOpenFileWithId)(FileContainer *, const StreamingBufferConfig *,
38         uint32_t track_id, const uint8_t *name, uint16_t name_len,
39         const uint8_t *data, uint32_t data_len, uint16_t flags);
40     int (*FileCloseFileById)(FileContainer *, uint32_t track_id,
41             const uint8_t *data, uint32_t data_len, uint16_t flags);
42     int (*FileAppendDataById)(FileContainer *, uint32_t track_id,
43             const uint8_t *data, uint32_t data_len);
44     int (*FileAppendGAPById)(FileContainer *, uint32_t track_id,
45             const uint8_t *data, uint32_t data_len);
46     void (*FileContainerRecycle)(FileContainer *ffc);
47     void (*FilePrune)(FileContainer *ffc);
48     void (*FileSetTx)(FileContainer *, uint64_t);
49 
50 } SuricataContext;
51 
52 extern SuricataContext suricata_context;
53 
54 typedef struct SuricataFileContext_ {
55 
56     const StreamingBufferConfig *sbcfg;
57 
58 } SuricataFileContext;
59 
60 SuricataContext *SCGetContext(void);
61 
62 #endif /* !__RUST_CONTEXT_H__ */
63