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