suricata
util-runmodes.c
Go to the documentation of this file.
1 /* Copyright (C) 2011-2025 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 Eric Leblond <eric@regit.org>
22  *
23  * Helper function for runmode.
24  *
25  */
26 
27 #include "suricata-common.h"
28 #include "tm-threads.h"
29 #include "conf.h"
30 #include "runmodes.h"
31 #include "runmode-af-packet.h"
32 #include "output.h"
33 #include "log-httplog.h"
34 
35 #include "detect-engine.h"
36 #include "detect-engine-mpm.h"
37 
38 #include "alert-fastlog.h"
39 #include "alert-debuglog.h"
40 
41 #include "util-debug.h"
42 #include "util-time.h"
43 #include "util-cpu.h"
44 #include "util-affinity.h"
45 #include "util-device-private.h"
46 
47 #include "util-runmodes.h"
48 
49 #include "flow-hash.h"
50 
51 #define THREADS_MAX (uint16_t)1024
52 
53 /** \brief create a queue string for autofp to pass to
54  * the flow queue handler.
55  *
56  * The string will be "pickup1,pickup2,pickup3\0"
57  */
59 {
60  if (n > 1024)
61  return NULL;
62 
63  /* 13 because pickup12345, = 12 + \0 */
64  size_t queues_size = n * 13;
65  char qname[TM_QUEUE_NAME_MAX];
66 
67  char *queues = SCCalloc(1, queues_size);
68  if (unlikely(queues == NULL)) {
69  SCLogError("failed to alloc queues buffer: %s", strerror(errno));
70  return NULL;
71  }
72 
73  for (int thread = 0; thread < n; thread++) {
74  if (strlen(queues) > 0)
75  strlcat(queues, ",", queues_size);
76 
77  snprintf(qname, sizeof(qname), "pickup%d", (int16_t)thread+1);
78  strlcat(queues, qname, queues_size);
79  }
80 
81  SCLogDebug("%d %"PRIuMAX", queues %s", n, (uintmax_t)queues_size, queues);
82  return queues;
83 }
84 
85 /**
86  */
88  ConfigIfaceThreadsCountFunc ModThreadsCount, const char *recv_mod_name,
89  const char *decode_mod_name, const char *thread_name, const char *live_dev)
90 {
91  char tname[TM_THREAD_NAME_MAX];
92  char qname[TM_QUEUE_NAME_MAX];
93 
94  /* Available cpus */
95  int nlive = LiveGetDeviceCount();
96  uint16_t thread_max = TmThreadsGetWorkerThreadMax();
97 
98  char *queues = RunmodeAutoFpCreatePickupQueuesString(thread_max);
99  if (queues == NULL) {
100  FatalError("RunmodeAutoFpCreatePickupQueuesString failed");
101  }
102 
103  if ((nlive <= 1) && (live_dev != NULL)) {
104  SCLogDebug("live_dev %s", live_dev);
105 
106  void *aconf = ConfigParser(live_dev);
107  if (aconf == NULL) {
108  FatalError("Failed to allocate config for %s", live_dev);
109  }
110 
111  const uint16_t threads_count = MIN(ModThreadsCount(aconf), THREADS_MAX);
112  SCLogInfo("Going to use %" PRIu16 " %s receive thread(s)", threads_count, recv_mod_name);
113 
114  /* create the threads */
115  for (uint16_t thread = 0; thread < threads_count; thread++) {
116  const uint16_t thread_id = (uint16_t)(thread + 1);
117  snprintf(tname, sizeof(tname), "%s#%02u", thread_name, thread_id);
118  ThreadVars *tv_receive =
120  "packetpool", "packetpool",
121  queues, "flow", "pktacqloop");
122  if (tv_receive == NULL) {
123  FatalError("TmThreadsCreate failed");
124  }
125  TmModule *tm_module = TmModuleGetByName(recv_mod_name);
126  if (tm_module == NULL) {
127  FatalError("TmModuleGetByName failed for %s", recv_mod_name);
128  }
129  TmSlotSetFuncAppend(tv_receive, tm_module, aconf);
130 
131  tm_module = TmModuleGetByName(decode_mod_name);
132  if (tm_module == NULL) {
133  FatalError("TmModuleGetByName %s failed", decode_mod_name);
134  }
135  TmSlotSetFuncAppend(tv_receive, tm_module, NULL);
136 
137  TmThreadSetCPU(tv_receive, RECEIVE_CPU_SET);
138 
139  if (TmThreadSpawn(tv_receive) != TM_ECODE_OK) {
140  FatalError("TmThreadSpawn failed");
141  }
142  }
143  } else { /* Multiple input device */
144  SCLogInfo("Using %d live device(s).", nlive);
145 
146  for (int lthread = 0; lthread < nlive; lthread++) {
147  const char *dev = LiveGetDeviceName(lthread);
148  const char *visual_devname = LiveGetShortName(dev);
149 
150  if (dev == NULL) {
151  FatalError("Failed to lookup live dev %d", lthread);
152  }
153  SCLogDebug("dev %s", dev);
154 
155  void *aconf = ConfigParser(dev);
156  if (aconf == NULL) {
157  FatalError("Multidev: Failed to allocate config for %s (%d)", dev, lthread);
158  }
159 
160  const uint16_t threads_count = MIN(ModThreadsCount(aconf), THREADS_MAX);
161  for (uint16_t thread = 0; thread < threads_count; thread++) {
162  const uint16_t thread_id = (uint16_t)(thread + 1);
163  const size_t printable_threadname_size = strlen(thread_name) + 5 + strlen(dev) + 1;
164  char *printable_threadname = SCMalloc(printable_threadname_size);
165  if (unlikely(printable_threadname == NULL)) {
166  FatalError("failed to alloc printable thread name: %s", strerror(errno));
167  }
168  snprintf(
169  tname, sizeof(tname), "%s#%02u-%s", thread_name, thread_id, visual_devname);
170  snprintf(printable_threadname, printable_threadname_size, "%s#%02u-%s", thread_name,
171  thread_id, dev);
172 
173  ThreadVars *tv_receive =
175  "packetpool", "packetpool",
176  queues, "flow", "pktacqloop");
177  if (tv_receive == NULL) {
178  FatalError("TmThreadsCreate failed");
179  }
180  tv_receive->printable_name = printable_threadname;
181  tv_receive->iface_name = SCStrdup(dev);
182  if (tv_receive->iface_name == NULL) {
183  FatalError("Failed to allocate memory for iface name");
184  }
185 
186  TmModule *tm_module = TmModuleGetByName(recv_mod_name);
187  if (tm_module == NULL) {
188  FatalError("TmModuleGetByName failed for %s", recv_mod_name);
189  }
190  TmSlotSetFuncAppend(tv_receive, tm_module, aconf);
191 
192  tm_module = TmModuleGetByName(decode_mod_name);
193  if (tm_module == NULL) {
194  FatalError("TmModuleGetByName %s failed", decode_mod_name);
195  }
196  TmSlotSetFuncAppend(tv_receive, tm_module, NULL);
197 
198  TmThreadSetCPU(tv_receive, RECEIVE_CPU_SET);
199 
200  if (TmThreadSpawn(tv_receive) != TM_ECODE_OK) {
201  FatalError("TmThreadSpawn failed");
202  }
203  }
204  }
205  }
206 
207  for (uint16_t thread = 0; thread < thread_max; thread++) {
208  const uint16_t thread_id = (uint16_t)(thread + 1);
209  snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread_id);
210  snprintf(qname, sizeof(qname), "pickup%u", thread_id);
211  SCLogDebug("tname %s, qname %s", tname, qname);
212 
213  ThreadVars *tv_detect_ncpu =
215  qname, "flow",
216  "packetpool", "packetpool",
217  "varslot");
218  if (tv_detect_ncpu == NULL) {
219  FatalError("TmThreadsCreate failed");
220  }
221  TmModule *tm_module = TmModuleGetByName("FlowWorker");
222  if (tm_module == NULL) {
223  FatalError("TmModuleGetByName for FlowWorker failed");
224  }
225  TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
226 
227  TmThreadSetCPU(tv_detect_ncpu, WORKER_CPU_SET);
228 
229  tm_module = TmModuleGetByName("RespondReject");
230  if (tm_module == NULL) {
231  FatalError("TmModuleGetByName RespondReject failed");
232  }
233  TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
234 
235  if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) {
236  FatalError("TmThreadSpawn failed");
237  }
238  }
239 
240  SCFree(queues);
241  return 0;
242 }
243 
244 /**
245  */
246 static int RunModeSetLiveCaptureWorkersForDevice(ConfigIfaceThreadsCountFunc ModThreadsCount,
247  const char *recv_mod_name,
248  const char *decode_mod_name, const char *thread_name,
249  const char *live_dev, void *aconf,
250  unsigned char single_mode)
251 {
252  uint16_t threads_count;
253  const uint16_t thread_max = TmThreadsGetWorkerThreadMax();
254 
255  if (single_mode) {
256  threads_count = 1;
257  } else {
258  threads_count = MIN(ModThreadsCount(aconf), thread_max);
259  SCLogInfo("%s: creating %" PRIu16 " thread%s", live_dev, threads_count,
260  threads_count > 1 ? "s" : "");
261  }
262 
263  /* create the threads */
264  for (uint16_t thread = 0; thread < threads_count; thread++) {
265  const uint16_t thread_id = (uint16_t)(thread + 1);
266  const char *visual_devname = LiveGetShortName(live_dev);
267  const size_t printable_threadname_size = strlen(thread_name) + 5 + strlen(live_dev) + 1;
268  char *printable_threadname = SCMalloc(printable_threadname_size);
269  if (unlikely(printable_threadname == NULL)) {
270  FatalError("failed to alloc printable thread name: %s", strerror(errno));
271  exit(EXIT_FAILURE);
272  }
273 
274  char tname[TM_THREAD_NAME_MAX];
275  if (single_mode) {
276  snprintf(tname, sizeof(tname), "%s#01-%s", thread_name, visual_devname);
277  snprintf(printable_threadname, printable_threadname_size, "%s#01-%s", thread_name,
278  live_dev);
279  } else {
280  snprintf(tname, sizeof(tname), "%s#%02u-%s", thread_name, thread_id, visual_devname);
281  snprintf(printable_threadname, printable_threadname_size, "%s#%02u-%s", thread_name,
282  thread_id, live_dev);
283  }
285  "packetpool", "packetpool",
286  "packetpool", "packetpool",
287  "pktacqloop");
288  if (tv == NULL) {
289  FatalError("TmThreadsCreate failed");
290  }
291  tv->printable_name = printable_threadname;
292  tv->iface_name = SCStrdup(live_dev);
293  if (tv->iface_name == NULL) {
294  FatalError("Failed to allocate memory for iface name");
295  }
296 
297  TmModule *tm_module = TmModuleGetByName(recv_mod_name);
298  if (tm_module == NULL) {
299  FatalError("TmModuleGetByName failed for %s", recv_mod_name);
300  }
301  TmSlotSetFuncAppend(tv, tm_module, aconf);
302 
303  tm_module = TmModuleGetByName(decode_mod_name);
304  if (tm_module == NULL) {
305  FatalError("TmModuleGetByName %s failed", decode_mod_name);
306  }
307  TmSlotSetFuncAppend(tv, tm_module, NULL);
308 
309  tm_module = TmModuleGetByName("FlowWorker");
310  if (tm_module == NULL) {
311  FatalError("TmModuleGetByName for FlowWorker failed");
312  }
313  TmSlotSetFuncAppend(tv, tm_module, NULL);
314 
315  tm_module = TmModuleGetByName("RespondReject");
316  if (tm_module == NULL) {
317  FatalError("TmModuleGetByName RespondReject failed");
318  }
319  TmSlotSetFuncAppend(tv, tm_module, NULL);
320 
322 
323  if (TmThreadSpawn(tv) != TM_ECODE_OK) {
324  FatalError("TmThreadSpawn failed");
325  }
326  }
327 
328  return 0;
329 }
330 
332  ConfigIfaceThreadsCountFunc ModThreadsCount, const char *recv_mod_name,
333  const char *decode_mod_name, const char *thread_name, const char *live_dev)
334 {
335  const int nlive = LiveGetDeviceCount();
336 
337  for (int ldev = 0; ldev < nlive; ldev++) {
338  const char *live_dev_c = NULL;
339  void *aconf;
340 
341  if ((nlive <= 1) && (live_dev != NULL)) {
342  aconf = ConfigParser(live_dev);
343  live_dev_c = live_dev;
344  } else {
345  live_dev_c = LiveGetDeviceName(ldev);
346  aconf = ConfigParser(live_dev_c);
347  }
348  RunModeSetLiveCaptureWorkersForDevice(
349  ModThreadsCount, recv_mod_name, decode_mod_name, thread_name, live_dev_c, aconf, 0);
350  }
351 
352  return 0;
353 }
354 
356  ConfigIfaceThreadsCountFunc ModThreadsCount,
357  const char *recv_mod_name,
358  const char *decode_mod_name, const char *thread_name,
359  const char *live_dev)
360 {
361  const int nlive = LiveGetDeviceCount();
362  const char *live_dev_c = NULL;
363  void *aconf;
364 
365  if (nlive > 1) {
366  FatalError("Can't use the 'single' runmode with multiple devices");
367  }
368 
369  if (live_dev != NULL) {
370  aconf = ConfigParser(live_dev);
371  live_dev_c = live_dev;
372  } else {
373  live_dev_c = LiveGetDeviceName(0);
374  aconf = ConfigParser(live_dev_c);
375  }
376 
377  return RunModeSetLiveCaptureWorkersForDevice(
378  ModThreadsCount, recv_mod_name, decode_mod_name, thread_name, live_dev_c, aconf, 1);
379 }
380 
381 
382 /**
383  */
385  const char *recv_mod_name,
386  const char *verdict_mod_name,
387  const char *decode_mod_name)
388 {
389  SCEnter();
390  char tname[TM_THREAD_NAME_MAX];
391  TmModule *tm_module ;
392 
393  const int nqueue = LiveGetDeviceCount();
394  const uint16_t thread_max = TmThreadsGetWorkerThreadMax();
395 
396  char *queues = RunmodeAutoFpCreatePickupQueuesString(thread_max);
397  if (queues == NULL) {
398  FatalError("RunmodeAutoFpCreatePickupQueuesString failed");
399  }
400 
401  /* create the threads */
402  for (int i = 0; i < nqueue; i++) {
403  const char *cur_queue = LiveGetDeviceName(i);
404  if (cur_queue == NULL) {
405  FatalError("invalid queue number");
406  }
407  memset(tname, 0, sizeof(tname));
408  snprintf(tname, sizeof(tname), "%s-%s", thread_name_autofp, cur_queue);
409 
410  ThreadVars *tv_receive =
412  "packetpool", "packetpool",
413  queues, "flow", "pktacqloop");
414  if (tv_receive == NULL) {
415  FatalError("TmThreadsCreate failed");
416  }
417  tm_module = TmModuleGetByName(recv_mod_name);
418  if (tm_module == NULL) {
419  FatalError("TmModuleGetByName failed for %s", recv_mod_name);
420  }
421  TmSlotSetFuncAppend(tv_receive, tm_module, (void *) ConfigParser(i));
422 
423  tm_module = TmModuleGetByName(decode_mod_name);
424  if (tm_module == NULL) {
425  FatalError("TmModuleGetByName %s failed", decode_mod_name);
426  }
427  TmSlotSetFuncAppend(tv_receive, tm_module, NULL);
428 
429  TmThreadSetCPU(tv_receive, RECEIVE_CPU_SET);
430 
431  if (TmThreadSpawn(tv_receive) != TM_ECODE_OK) {
432  FatalError("TmThreadSpawn failed");
433  }
434 
435  }
436  for (uint16_t thread = 0; thread < thread_max; thread++) {
437  const uint16_t thread_id = (uint16_t)(thread + 1);
438  snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread_id);
439  char qname[TM_QUEUE_NAME_MAX];
440  snprintf(qname, sizeof(qname), "pickup%u", thread_id);
441  SCLogDebug("tname %s, qname %s", tname, qname);
442 
443  ThreadVars *tv_detect_ncpu =
445  qname, "flow",
446  "verdict-queue", "simple",
447  "varslot");
448  if (tv_detect_ncpu == NULL) {
449  FatalError("TmThreadsCreate failed");
450  }
451 
452  tm_module = TmModuleGetByName("FlowWorker");
453  if (tm_module == NULL) {
454  FatalError("TmModuleGetByName for FlowWorker failed");
455  }
456  TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
457 
458  TmThreadSetCPU(tv_detect_ncpu, WORKER_CPU_SET);
459 
460  if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) {
461  FatalError("TmThreadSpawn failed");
462  }
463  }
464 
465  /* create the threads */
466  for (int i = 0; i < nqueue; i++) {
467  memset(tname, 0, sizeof(tname));
468  snprintf(tname, sizeof(tname), "%s#%02d", thread_name_verdict, i);
469 
470  ThreadVars *tv_verdict =
472  "verdict-queue", "simple",
473  "packetpool", "packetpool",
474  "varslot");
475  if (tv_verdict == NULL) {
476  FatalError("TmThreadsCreate failed");
477  }
478  tm_module = TmModuleGetByName(verdict_mod_name);
479  if (tm_module == NULL) {
480  FatalError("TmModuleGetByName %s failed", verdict_mod_name);
481  }
482  TmSlotSetFuncAppend(tv_verdict, tm_module, (void *)ConfigParser(i));
483 
484  tm_module = TmModuleGetByName("RespondReject");
485  if (tm_module == NULL) {
486  FatalError("TmModuleGetByName for RespondReject failed");
487  }
488  TmSlotSetFuncAppend(tv_verdict, tm_module, NULL);
489 
490  TmThreadSetCPU(tv_verdict, VERDICT_CPU_SET);
491 
492  if (TmThreadSpawn(tv_verdict) != TM_ECODE_OK) {
493  FatalError("TmThreadSpawn failed");
494  }
495  }
496 
497  SCFree(queues);
498  return 0;
499 }
500 
501 /**
502  */
504  const char *recv_mod_name,
505  const char *verdict_mod_name,
506  const char *decode_mod_name)
507 {
508  const int nqueue = LiveGetDeviceCount();
509 
510  for (int i = 0; i < nqueue; i++) {
511  /* create the threads */
512  const char *cur_queue = LiveGetDeviceName(i);
513  if (cur_queue == NULL) {
514  FatalError("invalid queue number");
515  }
516 
517  char tname[TM_THREAD_NAME_MAX];
518  memset(tname, 0, sizeof(tname));
519  snprintf(tname, sizeof(tname), "%s-%s", thread_name_workers, cur_queue);
520 
522  "packetpool", "packetpool",
523  "packetpool", "packetpool",
524  "pktacqloop");
525  if (tv == NULL) {
526  FatalError("TmThreadsCreate failed");
527  }
528 
529  TmModule *tm_module = TmModuleGetByName(recv_mod_name);
530  if (tm_module == NULL) {
531  FatalError("TmModuleGetByName failed for %s", recv_mod_name);
532  }
533  TmSlotSetFuncAppend(tv, tm_module, (void *) ConfigParser(i));
534 
535  tm_module = TmModuleGetByName(decode_mod_name);
536  if (tm_module == NULL) {
537  FatalError("TmModuleGetByName %s failed", decode_mod_name);
538  }
539  TmSlotSetFuncAppend(tv, tm_module, NULL);
540 
541  tm_module = TmModuleGetByName("FlowWorker");
542  if (tm_module == NULL) {
543  FatalError("TmModuleGetByName for FlowWorker failed");
544  }
545  TmSlotSetFuncAppend(tv, tm_module, NULL);
546 
547  tm_module = TmModuleGetByName(verdict_mod_name);
548  if (tm_module == NULL) {
549  FatalError("TmModuleGetByName %s failed", verdict_mod_name);
550  }
551  TmSlotSetFuncAppend(tv, tm_module, (void *) ConfigParser(i));
552 
553  tm_module = TmModuleGetByName("RespondReject");
554  if (tm_module == NULL) {
555  FatalError("TmModuleGetByName for RespondReject failed");
556  }
557  TmSlotSetFuncAppend(tv, tm_module, NULL);
558 
560 
561  if (TmThreadSpawn(tv) != TM_ECODE_OK) {
562  FatalError("TmThreadSpawn failed");
563  }
564  }
565 
566  return 0;
567 }
thread_name_workers
const char * thread_name_workers
Definition: runmodes.c:68
util-device-private.h
tm-threads.h
RunModeSetIPSAutoFp
int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser, const char *recv_mod_name, const char *verdict_mod_name, const char *decode_mod_name)
Definition: util-runmodes.c:384
TmThreadSpawn
TmEcode TmThreadSpawn(ThreadVars *tv)
Spawns a thread associated with the ThreadVars instance tv.
Definition: tm-threads.c:1702
detect-engine.h
ThreadVars_::iface_name
char * iface_name
Definition: threadvars.h:135
RunModeSetLiveCaptureWorkers
int RunModeSetLiveCaptureWorkers(ConfigIfaceParserFunc ConfigParser, ConfigIfaceThreadsCountFunc ModThreadsCount, const char *recv_mod_name, const char *decode_mod_name, const char *thread_name, const char *live_dev)
Definition: util-runmodes.c:331
alert-debuglog.h
LiveGetShortName
const char * LiveGetShortName(const char *dev)
Definition: util-device.c:286
runmode-af-packet.h
TmThreadCreatePacketHandler
ThreadVars * TmThreadCreatePacketHandler(const char *name, const char *inq_name, const char *inqh_name, const char *outq_name, const char *outqh_name, const char *slots)
Creates and returns a TV instance for a Packet Processing Thread. This function doesn't support custo...
Definition: tm-threads.c:1068
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
RunModeSetIPSWorker
int RunModeSetIPSWorker(ConfigIPSParserFunc ConfigParser, const char *recv_mod_name, const char *verdict_mod_name, const char *decode_mod_name)
Definition: util-runmodes.c:503
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:279
flow-hash.h
util-runmodes.h
thread_name_autofp
const char * thread_name_autofp
Definition: runmodes.c:66
MIN
#define MIN(x, y)
Definition: suricata-common.h:408
TM_THREAD_NAME_MAX
#define TM_THREAD_NAME_MAX
Definition: tm-threads.h:49
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:81
RunModeSetLiveCaptureAutoFp
int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser, ConfigIfaceThreadsCountFunc ModThreadsCount, const char *recv_mod_name, const char *decode_mod_name, const char *thread_name, const char *live_dev)
Definition: util-runmodes.c:87
TmModuleGetByName
TmModule * TmModuleGetByName(const char *name)
get a tm module ptr by name
Definition: tm-modules.c:46
util-debug.h
RunmodeAutoFpCreatePickupQueuesString
char * RunmodeAutoFpCreatePickupQueuesString(int n)
create a queue string for autofp to pass to the flow queue handler.
Definition: util-runmodes.c:58
strlcat
size_t strlcat(char *, const char *src, size_t siz)
Definition: util-strlcatu.c:45
util-cpu.h
ConfigIPSParserFunc
void *(* ConfigIPSParserFunc)(int)
Definition: util-runmodes.h:27
THREADS_MAX
#define THREADS_MAX
Definition: util-runmodes.c:51
SCEnter
#define SCEnter(...)
Definition: util-debug.h:281
detect-engine-mpm.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
util-affinity.h
VERDICT_CPU_SET
@ VERDICT_CPU_SET
Definition: util-affinity.h:59
util-time.h
TM_QUEUE_NAME_MAX
#define TM_QUEUE_NAME_MAX
Definition: tm-threads.h:48
ConfigIfaceThreadsCountFunc
uint16_t(* ConfigIfaceThreadsCountFunc)(void *)
Definition: util-runmodes.h:28
conf.h
runmodes.h
SCLogInfo
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
Definition: util-debug.h:229
TmModule_
Definition: tm-modules.h:47
WORKER_CPU_SET
@ WORKER_CPU_SET
Definition: util-affinity.h:58
alert-fastlog.h
TmSlotSetFuncAppend
void TmSlotSetFuncAppend(ThreadVars *tv, TmModule *tm, const void *data)
Appends a new entry to the slots.
Definition: tm-threads.c:658
suricata-common.h
TmThreadSetCPU
TmEcode TmThreadSetCPU(ThreadVars *tv, uint8_t type)
Definition: tm-threads.c:831
LiveGetDeviceName
const char * LiveGetDeviceName(int number)
Get a pointer to the device name at idx.
Definition: util-device.c:204
RECEIVE_CPU_SET
@ RECEIVE_CPU_SET
Definition: util-affinity.h:57
SCStrdup
#define SCStrdup(s)
Definition: util-mem.h:56
FatalError
#define FatalError(...)
Definition: util-debug.h:514
TmThreadsGetWorkerThreadMax
uint16_t TmThreadsGetWorkerThreadMax(void)
Definition: tm-threads.c:2388
ThreadVars_::printable_name
char * printable_name
Definition: threadvars.h:66
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:32
log-httplog.h
ConfigIfaceParserFunc
void *(* ConfigIfaceParserFunc)(const char *)
Definition: util-runmodes.h:26
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:271
SCFree
#define SCFree(p)
Definition: util-mem.h:61
thread_name_verdict
const char * thread_name_verdict
Definition: runmodes.c:69
RunModeSetLiveCaptureSingle
int RunModeSetLiveCaptureSingle(ConfigIfaceParserFunc ConfigParser, ConfigIfaceThreadsCountFunc ModThreadsCount, const char *recv_mod_name, const char *decode_mod_name, const char *thread_name, const char *live_dev)
Definition: util-runmodes.c:355
LiveGetDeviceCount
int LiveGetDeviceCount(void)
Get the number of registered devices.
Definition: util-device.c:170
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
output.h