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