suricata
output-file.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 File Logger Output registration functions
24 */
25
26#ifndef SURICATA_OUTPUT_FILE_H
27#define SURICATA_OUTPUT_FILE_H
28
29#include "rust.h"
30
31/** per thread data for this module, contains a list of per thread
32 * data for the packet loggers. */
35#ifdef HAVE_MAGIC
36 magic_t magic_ctx;
37#endif
39
42
44 FileContainer *ffc, void *txv, const uint64_t tx_id, AppLayerTxData *txd,
45 const bool file_close, const bool file_trunc, uint8_t dir);
46
47/** file logger function pointer type */
48typedef int (*SCFileLogger)(ThreadVars *, void *thread_data, const Packet *, const File *, void *tx,
49 const uint64_t tx_id, uint8_t direction);
50
51/** \brief Register a file logger.
52 *
53 * \param logger_id An ID used to distinguish this logger from others
54 * while profiling.
55 *
56 * \param name An informational name for this logger. Used only for
57 * debugging.
58 *
59 * \param LogFunc A function that will be called to log each file to be logged.
60 *
61 * \param initdata Initialization data that will pass to the
62 * ThreadInitFunc.
63 *
64 * \param ThreadInitFunc Thread initialization function.
65 *
66 * \param ThreadDeinitFunc Thread de-initialization function.
67 *
68 * \retval 0 on success, -1 on failure.
69 */
70int SCOutputRegisterFileLogger(LoggerId id, const char *name, SCFileLogger LogFunc, void *initdata,
71 ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit);
72
73/** Internal function: private API. */
75
76/** Internal function: private API. */
77void OutputFileShutdown(void);
78
79#endif /* SURICATA_OUTPUT_FILE_H */
struct AppLayerTxData AppLayerTxData
ThreadVars * tv
TmEcode OutputFileLogThreadInit(ThreadVars *tv, OutputFileLoggerThreadData **data)
thread init for the file logger This will run the thread init functions for the individual registered...
void OutputFileLoggerRegister(void)
void OutputFileLogFfc(ThreadVars *tv, OutputFileLoggerThreadData *op_thread_data, Packet *p, FileContainer *ffc, void *txv, const uint64_t tx_id, AppLayerTxData *txd, const bool file_close, const bool file_trunc, uint8_t dir)
Definition output-file.c:96
TmEcode OutputFileLogThreadDeinit(ThreadVars *tv, OutputFileLoggerThreadData *thread_data)
void OutputFileShutdown(void)
int SCOutputRegisterFileLogger(LoggerId id, const char *name, SCFileLogger LogFunc, void *initdata, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Register a file logger.
Definition output-file.c:56
struct OutputFileLoggerThreadData_ OutputFileLoggerThreadData
int(* SCFileLogger)(ThreadVars *, void *thread_data, const Packet *, const File *, void *tx, const uint64_t tx_id, uint8_t direction)
Definition output-file.h:48
OutputLoggerThreadStore * store
Definition output-file.h:34
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