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