suricata
output-filedata.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2024 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 Victor Julien <victor@inliniac.net>
22  *
23  * AppLayer Filedata Logger Output registration functions
24  */
25 
26 #ifndef SURICATA_OUTPUT_FILEDATA_H
27 #define SURICATA_OUTPUT_FILEDATA_H
28 
29 #define OUTPUT_FILEDATA_FLAG_OPEN 0x01
30 #define OUTPUT_FILEDATA_FLAG_CLOSE 0x02
31 
32 /** per thread data for this module, contains a list of per thread
33  * data for the packet loggers. */
36 #ifdef HAVE_MAGIC
37  magic_t magic_ctx;
38 #endif
40 
43 
45  AppLayerGetFileState files, void *txv, const uint64_t tx_id, AppLayerTxData *txd,
46  const uint8_t call_flags, const bool file_close, const bool file_trunc, const uint8_t dir);
47 
48 /**
49  * \brief File-data logger function pointer type.
50  */
51 typedef int (*SCFiledataLogger)(ThreadVars *, void *thread_data, const Packet *, File *, void *tx,
52  const uint64_t tx_id, const uint8_t *, uint32_t, uint8_t, uint8_t dir);
53 
54 /** \brief Register a file-data logger.
55  *
56  * \param logger_id An ID used to distinguish this logger from others
57  * while profiling.
58  *
59  * \param name An informational name for this logger. Used only for
60  * debugging.
61  *
62  * \param LogFunc A function that will be called to log each file-data.
63  *
64  * \param initdata Initialization data that will pass to the
65  * ThreadInitFunc.
66  *
67  * \param ThreadInitFunc Thread initialization function.
68  *
69  * \param ThreadDeinitFunc Thread de-initialization function.
70  *
71  * \retval 0 on success, -1 on failure.
72  */
73 int SCOutputRegisterFiledataLogger(LoggerId id, const char *name, SCFiledataLogger LogFunc,
74  void *initdata, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit);
75 
77 
78 void OutputFiledataShutdown(void);
79 
80 #endif /* SURICATA_OUTPUT_FILEDATA_H */
OutputFiledataLogThreadDeinit
TmEcode OutputFiledataLogThreadDeinit(ThreadVars *tv, OutputFiledataLoggerThreadData *thread_data)
Definition: output-filedata.c:246
OutputLoggerThreadStore_
Definition: output.h:33
OutputFiledataLoggerThreadData_::store
OutputLoggerThreadStore * store
Definition: output-filedata.h:35
LoggerId
LoggerId
Definition: suricata-common.h:460
SCFiledataLogger
int(* SCFiledataLogger)(ThreadVars *, void *thread_data, const Packet *, File *, void *tx, const uint64_t tx_id, const uint8_t *, uint32_t, uint8_t, uint8_t dir)
File-data logger function pointer type.
Definition: output-filedata.h:51
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
ThreadInitFunc
TmEcode(* ThreadInitFunc)(ThreadVars *, const void *, void **)
Definition: tm-modules.h:39
Packet_
Definition: decode.h:473
TmEcode
TmEcode
Definition: tm-threads-common.h:79
OutputFiledataLoggerThreadData_
Definition: output-filedata.h:34
File_
Definition: util-file.h:79
AppLayerTxData
struct AppLayerTxData AppLayerTxData
Definition: detect.h:1367
OutputFiledataLogFfc
void OutputFiledataLogFfc(ThreadVars *tv, OutputFiledataLoggerThreadData *td, Packet *p, AppLayerGetFileState files, void *txv, const uint64_t tx_id, AppLayerTxData *txd, const uint8_t call_flags, const bool file_close, const bool file_trunc, const uint8_t dir)
Definition: output-filedata.c:124
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:32
OutputFiledataLoggerThreadData
struct OutputFiledataLoggerThreadData_ OutputFiledataLoggerThreadData
SCOutputRegisterFiledataLogger
int SCOutputRegisterFiledataLogger(LoggerId id, const char *name, SCFiledataLogger LogFunc, void *initdata, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Register a file-data logger.
Definition: output-filedata.c:54
OutputFiledataShutdown
void OutputFiledataShutdown(void)
Definition: output-filedata.c:277
OutputFiledataLogThreadInit
TmEcode OutputFiledataLogThreadInit(ThreadVars *tv, OutputFiledataLoggerThreadData **data)
thread init for the filedata logger This will run the thread init functions for the individual regist...
Definition: output-filedata.c:200
ThreadDeinitFunc
TmEcode(* ThreadDeinitFunc)(ThreadVars *, void *)
Definition: tm-modules.h:40
OutputFiledataLoggerRegister
void OutputFiledataLoggerRegister(void)
Definition: output-filedata.c:271