63 size_t queues_size = n * 13;
66 char *queues =
SCMalloc(queues_size);
72 memset(queues, 0x00, queues_size);
74 for (
int thread = 0; thread < n; thread++) {
75 if (strlen(queues) > 0)
76 strlcat(queues,
",", queues_size);
78 snprintf(qname,
sizeof(qname),
"pickup%d", (int16_t)thread+1);
79 strlcat(queues, qname, queues_size);
82 SCLogDebug(
"%d %"PRIuMAX
", queues %s", n, (uintmax_t)queues_size, queues);
90 const char *recv_mod_name,
91 const char *decode_mod_name,
92 const char *thread_name,
103 if (queues == NULL) {
107 if ((nlive <= 1) && (live_dev != NULL)) {
110 void *aconf = ConfigParser(live_dev);
116 int threads_count = ModThreadsCount(aconf);
117 SCLogInfo(
"Going to use %" PRId32
" %s receive thread(s)",
118 threads_count, recv_mod_name);
121 for (
int thread = 0; thread < threads_count; thread++) {
122 snprintf(tname,
sizeof(tname),
"%s#%02d", thread_name, thread+1);
125 "packetpool",
"packetpool",
126 queues,
"flow",
"pktacqloop");
127 if (tv_receive == NULL) {
131 if (tm_module == NULL) {
133 "TmModuleGetByName failed for %s",
139 if (tm_module == NULL) {
141 "TmModuleGetByName %s failed", decode_mod_name);
152 SCLogInfo(
"Using %d live device(s).", nlive);
154 for (
int lthread = 0; lthread < nlive; lthread++) {
163 void *aconf = ConfigParser(dev);
169 int threads_count = ModThreadsCount(aconf);
170 for (
int thread = 0; thread < threads_count; thread++) {
171 char *printable_threadname =
SCMalloc(
sizeof(
char) * (strlen(thread_name)+5+strlen(dev)));
172 if (
unlikely(printable_threadname == NULL)) {
175 snprintf(tname,
sizeof(tname),
"%s#%02d-%s", thread_name,
176 thread+1, visual_devname);
177 snprintf(printable_threadname, strlen(thread_name)+5+strlen(dev),
178 "%s#%02d-%s", thread_name, thread+1,
183 "packetpool",
"packetpool",
184 queues,
"flow",
"pktacqloop");
185 if (tv_receive == NULL) {
190 if (tm_module == NULL) {
196 if (tm_module == NULL) {
210 for (
int thread = 0; thread < thread_max; thread++) {
212 snprintf(qname,
sizeof(qname),
"pickup%u", thread+1);
214 SCLogDebug(
"tname %s, qname %s", tname, qname);
219 "packetpool",
"packetpool",
221 if (tv_detect_ncpu == NULL) {
225 if (tm_module == NULL) {
235 if (tm_module == NULL) {
252 const char *recv_mod_name,
253 const char *decode_mod_name,
const char *thread_name,
254 const char *live_dev,
void *aconf,
255 unsigned char single_mode)
263 threads_count =
MIN(ModThreadsCount(aconf), thread_max);
264 SCLogInfo(
"Going to use %" PRId32
" thread(s)", threads_count);
268 for (
int thread = 0; thread < threads_count; thread++) {
272 char *printable_threadname =
SCMalloc(
sizeof(
char) * (strlen(thread_name)+5+strlen(live_dev)));
273 if (
unlikely(printable_threadname == NULL)) {
279 snprintf(tname,
sizeof(tname),
"%s#01-%s", thread_name, visual_devname);
280 snprintf(printable_threadname, strlen(thread_name)+5+strlen(live_dev),
"%s#01-%s",
281 thread_name, live_dev);
283 snprintf(tname,
sizeof(tname),
"%s#%02d-%s", thread_name,
284 thread+1, visual_devname);
285 snprintf(printable_threadname, strlen(thread_name)+5+strlen(live_dev),
"%s#%02d-%s",
286 thread_name, thread+1, live_dev);
289 "packetpool",
"packetpool",
290 "packetpool",
"packetpool",
298 if (tm_module == NULL) {
304 if (tm_module == NULL) {
310 if (tm_module == NULL) {
316 if (tm_module == NULL) {
333 const char *recv_mod_name,
334 const char *decode_mod_name,
const char *thread_name,
335 const char *live_dev)
341 for (ldev = 0; ldev < nlive; ldev++) {
342 const char *live_dev_c = NULL;
343 if ((nlive <= 1) && (live_dev != NULL)) {
344 aconf = ConfigParser(live_dev);
345 live_dev_c = live_dev;
351 aconf = ConfigParser(live_dev_c);
353 RunModeSetLiveCaptureWorkersForDevice(ModThreadsCount,
367 const char *recv_mod_name,
368 const char *decode_mod_name,
const char *thread_name,
369 const char *live_dev)
372 const char *live_dev_c = NULL;
377 "Can't use the 'single' runmode with multiple devices");
380 if (live_dev != NULL) {
381 aconf = ConfigParser(live_dev);
382 live_dev_c = live_dev;
385 aconf = ConfigParser(live_dev_c);
388 return RunModeSetLiveCaptureWorkersForDevice(
402 const char *recv_mod_name,
403 const char *verdict_mod_name,
404 const char *decode_mod_name)
416 if (queues == NULL) {
421 for (
int i = 0; i < nqueue; i++) {
423 if (cur_queue == NULL) {
426 memset(tname, 0,
sizeof(tname));
431 "packetpool",
"packetpool",
432 queues,
"flow",
"pktacqloop");
433 if (tv_receive == NULL) {
437 if (tm_module == NULL) {
443 if (tm_module == NULL) {
455 for (
int thread = 0; thread < thread_max; thread++) {
458 snprintf(qname,
sizeof(qname),
"pickup%u", thread+1);
460 SCLogDebug(
"tname %s, qname %s", tname, qname);
465 "verdict-queue",
"simple",
467 if (tv_detect_ncpu == NULL) {
472 if (tm_module == NULL) {
487 for (
int i = 0; i < nqueue; i++) {
488 memset(tname, 0,
sizeof(tname));
493 "verdict-queue",
"simple",
494 "packetpool",
"packetpool",
496 if (tv_verdict == NULL) {
500 if (tm_module == NULL) {
506 if (tm_module == NULL) {
525 const char *recv_mod_name,
526 const char *verdict_mod_name,
527 const char *decode_mod_name)
532 for (
int i = 0; i < nqueue; i++) {
535 if (cur_queue == NULL) {
540 memset(tname, 0,
sizeof(tname));
544 "packetpool",
"packetpool",
545 "packetpool",
"packetpool",
552 if (tm_module == NULL) {
558 if (tm_module == NULL) {
564 if (tm_module == NULL) {
570 if (tm_module == NULL) {
576 if (tm_module == NULL) {