suricata
output-tx.h
Go to the documentation of this file.
1/* Copyright (C) 2007-2022 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 TX Logger Output registration functions
24 */
25
26#ifndef SURICATA_OUTPUT_TX_H
27#define SURICATA_OUTPUT_TX_H
28
29#include "tm-threads.h"
30#include "decode.h"
31#include "flow.h"
32
33/** \brief Transaction logger function pointer type. */
34typedef int (*TxLogger)(ThreadVars *, void *thread_data, const Packet *, Flow *f, void *state, void *tx, uint64_t tx_id);
35
36/** \brief Transaction logger condition function pointer type.
37 *
38 * If a TxLoggerCondition is provided to the registration function,
39 * the logger function will only be called if this return true.
40 */
41typedef bool (*TxLoggerCondition)(
42 ThreadVars *, const Packet *, void *state, void *tx, uint64_t tx_id);
43
44/** \brief Register a transaction logger.
45 *
46 * \param logger_id An ID used to distinguish this logger from others
47 * while profiling. For transaction logging this is only used for
48 * some internal state tracking.
49 *
50 * \param name An informational name for this logger. Used for
51 * debugging.
52 *
53 * \param alproto The application layer protocol this logger is for,
54 * for example ALPROTO_DNS.
55 *
56 * \param LogFunc A pointer to the logging function.
57 *
58 * \param initdata Initialization data that will be provided to the
59 * ThreadInit callback.
60 *
61 * \param tc_log_progress The to_client progress state required for
62 * the log function to be called.
63 *
64 * \param ts_log_progress The to_server progress state required for
65 * the log function to be called.
66 *
67 * \param LogCondition A pointer to a function that will be called
68 * before the log function to test if the log function should be
69 * called.
70 *
71 * \param ThreadInitFunc Callback a thread initialization function,
72 * initdata will be provided.
73 *
74 * \param ThreadDeinitFunc Callback to a thread de-initialization
75 * function for cleanup.
76 */
77int SCOutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto, TxLogger LogFunc,
78 void *, int tc_log_progress, int ts_log_progress, TxLoggerCondition LogCondition,
80
81/** Internal function: private API. */
82void OutputTxLoggerRegister (void);
83
84/** Internal function: private API. */
85void OutputTxShutdown(void);
86
87#endif /* SURICATA_OUTPUT_TX_H */
uint16_t AppProto
void OutputTxLoggerRegister(void)
Definition output-tx.c:650
void OutputTxShutdown(void)
Definition output-tx.c:661
bool(* TxLoggerCondition)(ThreadVars *, const Packet *, void *state, void *tx, uint64_t tx_id)
Transaction logger condition function pointer type.
Definition output-tx.h:41
int(* TxLogger)(ThreadVars *, void *thread_data, const Packet *, Flow *f, void *state, void *tx, uint64_t tx_id)
Transaction logger function pointer type.
Definition output-tx.h:34
int SCOutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto, TxLogger LogFunc, void *, int tc_log_progress, int ts_log_progress, TxLoggerCondition LogCondition, ThreadInitFunc, ThreadDeinitFunc)
Register a transaction logger.
Definition output-tx.c:66
Flow data structure.
Definition flow.h:356
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