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 */
51typedef 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 */
74 void *initdata, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit);
75
77
78void OutputFiledataShutdown(void);
79
80#endif /* SURICATA_OUTPUT_FILEDATA_H */
struct AppLayerGetFileState AppLayerGetFileState
struct AppLayerTxData AppLayerTxData
ThreadVars * tv
void OutputFiledataShutdown(void)
struct OutputFiledataLoggerThreadData_ OutputFiledataLoggerThreadData
TmEcode OutputFiledataLogThreadDeinit(ThreadVars *tv, OutputFiledataLoggerThreadData *thread_data)
TmEcode OutputFiledataLogThreadInit(ThreadVars *tv, OutputFiledataLoggerThreadData **data)
thread init for the filedata logger This will run the thread init functions for the individual regist...
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)
int SCOutputRegisterFiledataLogger(LoggerId id, const char *name, SCFiledataLogger LogFunc, void *initdata, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Register a file-data logger.
void OutputFiledataLoggerRegister(void)
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.
OutputLoggerThreadStore * store
Per thread variable structure.
Definition threadvars.h:58
TmEcode(* ThreadDeinitFunc)(ThreadVars *, void *)
Definition tm-modules.h:44
TmEcode(* ThreadInitFunc)(ThreadVars *, const void *, void **)
Definition tm-modules.h:43
const char * name