suricata
thread-callbacks.h
Go to the documentation of this file.
1/* Copyright (C) 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#ifndef SURICATA_THREAD_CALLBACKS_H
19#define SURICATA_THREAD_CALLBACKS_H
20
21#include "suricata-common.h"
22#include "threadvars.h"
23
24/** \brief Function type for thread intialization callbacks.
25 *
26 * Once registered by SCThreadRegisterInitCallback, this function will
27 * be called for every thread being initialized during Suricata
28 * startup.
29 *
30 * \param tv The ThreadVars struct that has just been initialized.
31 * \param user The user data provided when registering the callback.
32 */
33typedef void (*SCThreadInitCallbackFn)(ThreadVars *tv, void *user);
34
35/** \brief Register a thread init callback.
36 *
37 * Register a user provided function to be called every time a thread is
38 * initialized for use.
39 *
40 * \param fn Pointer to function to be called
41 * \param user Additional user data to be passed to callback
42 *
43 * \returns true if callback was registered, otherwise false if the
44 * callback could not be registered due to memory allocation error.
45 */
47
48/** \internal
49 *
50 * Run all registered flow init callbacks.
51 */
53
54#endif /* SURICATA_THREAD_CALLBACKS_H */
ThreadVars * tv
Per thread variable structure.
Definition threadvars.h:58
bool SCThreadRegisterInitCallback(SCThreadInitCallbackFn fn, void *user)
Register a thread init callback.
void SCThreadRunInitCallbacks(ThreadVars *tv)
void(* SCThreadInitCallbackFn)(ThreadVars *tv, void *user)
Function type for thread intialization callbacks.