suricata
runmodes.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2013 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 /** \file
19  *
20  * \author Victor Julien <victor@inliniac.net>
21  *
22  * Pre-cooked threading runmodes.
23  */
24 
25 #include "suricata-common.h"
26 #include "detect.h"
27 #include "detect-engine.h"
28 #include "detect-engine-mpm.h"
29 #include "app-layer-parser.h"
30 #include "tm-threads.h"
31 #include "util-debug.h"
32 #include "util-time.h"
33 #include "util-cpu.h"
34 #include "util-byte.h"
35 #include "util-affinity.h"
36 #include "conf.h"
37 #include "queue.h"
38 #include "runmodes.h"
39 #include "util-unittest.h"
40 #include "util-misc.h"
41 #include "util-plugin.h"
42 
43 #include "output.h"
44 
45 #include "alert-fastlog.h"
46 #include "alert-debuglog.h"
47 
48 #include "log-httplog.h"
49 
50 #include "source-pfring.h"
51 
52 #include "tmqh-flow.h"
53 #include "flow-manager.h"
54 #include "flow-bypass.h"
55 #include "counters.h"
56 
57 #include "suricata-plugin.h"
58 
61 
62 /* Runmode Global Thread Names */
63 const char *thread_name_autofp = "RX";
64 const char *thread_name_single = "W";
65 const char *thread_name_workers = "W";
66 const char *thread_name_verdict = "TX";
67 const char *thread_name_flow_mgr = "FM";
68 const char *thread_name_flow_rec = "FR";
69 const char *thread_name_flow_bypass = "FB";
70 const char *thread_name_unix_socket = "US";
71 const char *thread_name_detect_loader = "DL";
72 const char *thread_name_counter_stats = "CS";
73 const char *thread_name_counter_wakeup = "CW";
74 
75 /**
76  * \brief Holds description for a runmode.
77  */
78 typedef struct RunMode_ {
79  /* the runmode type */
80  enum RunModes runmode;
81  const char *name;
82  const char *description;
83  /* runmode function */
84  int (*RunModeFunc)(void);
86 
87 typedef struct RunModes_ {
88  int cnt;
91 
92 static RunModes runmodes[RUNMODE_USER_MAX];
93 
94 static char *active_runmode;
95 
96 /* free list for our outputs */
97 typedef struct OutputFreeList_ {
100 
101  TAILQ_ENTRY(OutputFreeList_) entries;
103 static TAILQ_HEAD(, OutputFreeList_) output_free_list =
104  TAILQ_HEAD_INITIALIZER(output_free_list);
105 
106 /**
107  * \internal
108  * \brief Translate a runmode mode to a printale string.
109  *
110  * \param runmode Runmode to be converted into a printable string.
111  *
112  * \retval string Printable string.
113  */
114 static const char *RunModeTranslateModeToName(int runmode)
115 {
116  switch (runmode) {
117  case RUNMODE_PCAP_DEV:
118  return "PCAP_DEV";
119  case RUNMODE_PCAP_FILE:
120  return "PCAP_FILE";
121  case RUNMODE_PFRING:
122 #ifdef HAVE_PFRING
123  return "PFRING";
124 #else
125  return "PFRING(DISABLED)";
126 #endif
127  case RUNMODE_PLUGIN:
128  return "PLUGIN";
129  case RUNMODE_NFQ:
130  return "NFQ";
131  case RUNMODE_NFLOG:
132  return "NFLOG";
133  case RUNMODE_IPFW:
134  return "IPFW";
135  case RUNMODE_ERF_FILE:
136  return "ERF_FILE";
137  case RUNMODE_DAG:
138  return "ERF_DAG";
139  case RUNMODE_NAPATECH:
140  return "NAPATECH";
141  case RUNMODE_UNITTEST:
142  return "UNITTEST";
143  case RUNMODE_AFP_DEV:
144  return "AF_PACKET_DEV";
145  case RUNMODE_NETMAP:
146 #ifdef HAVE_NETMAP
147  return "NETMAP";
148 #else
149  return "NETMAP(DISABLED)";
150 #endif
151  case RUNMODE_UNIX_SOCKET:
152  return "UNIX_SOCKET";
153  case RUNMODE_WINDIVERT:
154 #ifdef WINDIVERT
155  return "WINDIVERT";
156 #else
157  return "WINDIVERT(DISABLED)";
158 #endif
159  default:
160  FatalError(SC_ERR_UNKNOWN_RUN_MODE, "Unknown runtime mode. Aborting");
161  }
162 }
163 
164 /**
165  * \internal
166  * \brief Dispatcher function for runmodes. Calls the required runmode function
167  * based on runmode + runmode_custom_id.
168  *
169  * \param runmode The runmode type.
170  * \param runmode_customd_id The runmode custom id.
171  */
172 static RunMode *RunModeGetCustomMode(enum RunModes runmode, const char *custom_mode)
173 {
174  if (runmode < RUNMODE_USER_MAX) {
175  for (int i = 0; i < runmodes[runmode].cnt; i++) {
176  if (strcmp(runmodes[runmode].runmodes[i].name, custom_mode) == 0)
177  return &runmodes[runmode].runmodes[i];
178  }
179  }
180  return NULL;
181 }
182 
183 
184 /**
185  * Return the running mode
186  *
187  * The returned string must not be freed.
188  *
189  * \return a string containing the current running mode
190  */
191 char *RunmodeGetActive(void)
192 {
193  return active_runmode;
194 }
195 
196 /**
197  * Return the running mode
198  *
199  * The returned string must not be freed.
200  *
201  * \return a string containing the current running mode
202  */
203 const char *RunModeGetMainMode(void)
204 {
205  int mainmode = RunmodeGetCurrent();
206 
207  return RunModeTranslateModeToName(mainmode);
208 }
209 
210 /**
211  * \brief Register all runmodes in the engine.
212  */
214 {
215  memset(runmodes, 0, sizeof(runmodes));
216 
230 #ifdef UNITTESTS
232 #endif
233  return;
234 }
235 
236 /**
237  * \brief Lists all registered runmodes.
238  */
240 {
241  printf("------------------------------------- Runmodes -------------------"
242  "-----------------------\n");
243 
244  printf("| %-17s | %-17s | %-10s \n",
245  "RunMode Type", "Custom Mode ", "Description");
246  printf("|-----------------------------------------------------------------"
247  "-----------------------\n");
248  int i = RUNMODE_UNKNOWN + 1;
249  int j = 0;
250  for ( ; i < RUNMODE_USER_MAX; i++) {
251  int mode_displayed = 0;
252  for (j = 0; j < runmodes[i].cnt; j++) {
253  if (mode_displayed == 1) {
254  printf("| ----------------------------------------------"
255  "-----------------------\n");
256  RunMode *runmode = &runmodes[i].runmodes[j];
257  printf("| %-17s | %-17s | %-27s \n",
258  "",
259  runmode->name,
260  runmode->description);
261  } else {
262  RunMode *runmode = &runmodes[i].runmodes[j];
263  printf("| %-17s | %-17s | %-27s \n",
264  RunModeTranslateModeToName(runmode->runmode),
265  runmode->name,
266  runmode->description);
267  }
268  if (mode_displayed == 0)
269  mode_displayed = 1;
270  }
271  if (mode_displayed == 1) {
272  printf("|-----------------------------------------------------------------"
273  "-----------------------\n");
274  }
275  }
276 
277  return;
278 }
279 
280 /**
281  */
282 void RunModeDispatch(int runmode, const char *custom_mode,
283  const char *capture_plugin_name, const char *capture_plugin_args)
284 {
285  char *local_custom_mode = NULL;
286 
287  if (custom_mode == NULL) {
288  const char *val = NULL;
289  if (ConfGet("runmode", &val) != 1) {
290  custom_mode = NULL;
291  } else {
292  custom_mode = val;
293  }
294  }
295 
296  if (custom_mode == NULL || strcmp(custom_mode, "auto") == 0) {
297  switch (runmode) {
298  case RUNMODE_PCAP_DEV:
299  custom_mode = RunModeIdsGetDefaultMode();
300  break;
301  case RUNMODE_PCAP_FILE:
302  custom_mode = RunModeFilePcapGetDefaultMode();
303  break;
304 #ifdef HAVE_PFRING
305  case RUNMODE_PFRING:
306  custom_mode = RunModeIdsPfringGetDefaultMode();
307  break;
308 #endif
309  case RUNMODE_PLUGIN: {
310 #ifdef HAVE_PLUGINS
311  SCCapturePlugin *plugin = SCPluginFindCaptureByName(capture_plugin_name);
312  if (plugin == NULL) {
313  FatalError(SC_ERR_PLUGIN, "No capture plugin found with name %s",
314  capture_plugin_name);
315  }
316  custom_mode = (const char *)plugin->GetDefaultMode();
317 #endif
318  break;
319  }
320  case RUNMODE_NFQ:
321  custom_mode = RunModeIpsNFQGetDefaultMode();
322  break;
323  case RUNMODE_IPFW:
324  custom_mode = RunModeIpsIPFWGetDefaultMode();
325  break;
326  case RUNMODE_ERF_FILE:
327  custom_mode = RunModeErfFileGetDefaultMode();
328  break;
329  case RUNMODE_DAG:
330  custom_mode = RunModeErfDagGetDefaultMode();
331  break;
332  case RUNMODE_NAPATECH:
333  custom_mode = RunModeNapatechGetDefaultMode();
334  break;
335  case RUNMODE_AFP_DEV:
336  custom_mode = RunModeAFPGetDefaultMode();
337  break;
338  case RUNMODE_NETMAP:
339  custom_mode = RunModeNetmapGetDefaultMode();
340  break;
341  case RUNMODE_UNIX_SOCKET:
342  custom_mode = RunModeUnixSocketGetDefaultMode();
343  break;
344  case RUNMODE_NFLOG:
345  custom_mode = RunModeIdsNflogGetDefaultMode();
346  break;
347 #ifdef WINDIVERT
348  case RUNMODE_WINDIVERT:
349  custom_mode = RunModeIpsWinDivertGetDefaultMode();
350  break;
351 #endif
352  default:
353  FatalError(SC_ERR_FATAL, "Unknown runtime mode. Aborting");
354  }
355  } else { /* if (custom_mode == NULL) */
356  /* Add compability with old 'worker' name */
357  if (!strcmp("worker", custom_mode)) {
358  SCLogWarning(SC_ERR_RUNMODE, "'worker' mode have been renamed "
359  "to 'workers', please modify your setup.");
360  local_custom_mode = SCStrdup("workers");
361  if (unlikely(local_custom_mode == NULL)) {
362  FatalError(SC_ERR_FATAL, "Unable to dup custom mode");
363  }
364  custom_mode = local_custom_mode;
365  }
366  }
367 
368  RunMode *mode = RunModeGetCustomMode(runmode, custom_mode);
369  if (mode == NULL) {
370  SCLogError(SC_ERR_RUNMODE, "The custom type \"%s\" doesn't exist "
371  "for this runmode type \"%s\". Please use --list-runmodes to "
372  "see available custom types for this runmode",
373  custom_mode, RunModeTranslateModeToName(runmode));
374  exit(EXIT_FAILURE);
375  }
376 
377  /* Export the custom mode */
378  if (active_runmode) {
379  SCFree(active_runmode);
380  }
381  active_runmode = SCStrdup(custom_mode);
382  if (unlikely(active_runmode == NULL)) {
383  FatalError(SC_ERR_FATAL, "Unable to dup active mode");
384  }
385 
386  if (strcasecmp(active_runmode, "autofp") == 0) {
388  }
389 
390  mode->RunModeFunc();
391 
392  if (local_custom_mode != NULL)
393  SCFree(local_custom_mode);
394 
395  /* Check if the alloted queues have at least 1 reader and writer */
397 
398  if (runmode != RUNMODE_UNIX_SOCKET) {
399  /* spawn management threads */
404  }
406  }
407 }
408 
409 static int g_runmode_needs_bypass = 0;
410 
412 {
413  g_runmode_needs_bypass = 1;
414 }
415 
417 {
418  return g_runmode_needs_bypass;
419 }
420 
421 
422 
423 /**
424  * \brief Registers a new runmode.
425  *
426  * \param runmode Runmode type.
427  * \param name Custom mode for this specific runmode type. Within each
428  * runmode type, each custom name is a primary key.
429  * \param description Description for this runmode.
430  * \param RunModeFunc The function to be run for this runmode.
431  */
433  const char *name,
434  const char *description,
435  int (*RunModeFunc)(void))
436 {
437  if (RunModeGetCustomMode(runmode, name) != NULL) {
438  FatalError(SC_ERR_RUNMODE, "runmode '%s' has already "
439  "been registered. Please use an unique name.", name);
440  }
441 
442  void *ptmp = SCRealloc(runmodes[runmode].runmodes,
443  (runmodes[runmode].cnt + 1) * sizeof(RunMode));
444  if (ptmp == NULL) {
445  SCFree(runmodes[runmode].runmodes);
446  runmodes[runmode].runmodes = NULL;
447  exit(EXIT_FAILURE);
448  }
449  runmodes[runmode].runmodes = ptmp;
450 
451  RunMode *mode = &runmodes[runmode].runmodes[runmodes[runmode].cnt];
452  runmodes[runmode].cnt++;
453  memset(mode, 0x00, sizeof(*mode));
454 
455  mode->runmode = runmode;
456  mode->name = SCStrdup(name);
457  if (unlikely(mode->name == NULL)) {
458  FatalError(SC_ERR_MEM_ALLOC, "Failed to allocate string");
459  }
460  mode->description = SCStrdup(description);
461  if (unlikely(mode->description == NULL)) {
462  FatalError(SC_ERR_MEM_ALLOC, "Failed to allocate string");
463  }
464  mode->RunModeFunc = RunModeFunc;
465 
466  return;
467 }
468 
469 /**
470  * Setup the outputs for this run mode.
471  *
472  * \param tv The ThreadVars for the thread the outputs will be
473  * appended to.
474  */
475 static void RunOutputFreeList(void)
476 {
477  OutputFreeList *output;
478  while ((output = TAILQ_FIRST(&output_free_list))) {
479  SCLogDebug("output %s %p %p", output->output_module->name, output,
480  output->output_ctx);
481 
482  if (output->output_ctx != NULL && output->output_ctx->DeInit != NULL)
483  output->output_ctx->DeInit(output->output_ctx);
484 
485  TAILQ_REMOVE(&output_free_list, output, entries);
486  SCFree(output);
487  }
488 }
489 
490 static int file_logger_count = 0;
491 static int filedata_logger_count = 0;
492 static LoggerId logger_bits[ALPROTO_MAX];
493 
495 {
496  return file_logger_count > 0;
497 }
498 
500 {
501  return filedata_logger_count > 0;
502 }
503 
504 bool IsRunModeSystem(enum RunModes run_mode_to_check)
505 {
506  switch (run_mode_to_check) {
507  case RUNMODE_PCAP_FILE:
508  case RUNMODE_ERF_FILE:
510  return false;
511  break;
512  default:
513  return true;
514  }
515 }
516 
517 bool IsRunModeOffline(enum RunModes run_mode_to_check)
518 {
519  switch(run_mode_to_check) {
520  case RUNMODE_CONF_TEST:
521  case RUNMODE_PCAP_FILE:
522  case RUNMODE_ERF_FILE:
524  case RUNMODE_UNIX_SOCKET:
525  return true;
526  break;
527  default:
528  return false;
529  }
530 }
531 
532 /**
533  * Cleanup the run mode.
534  */
535 void RunModeShutDown(void)
536 {
537  RunOutputFreeList();
538 
546 
548 
549  /* Reset logger counts. */
550  file_logger_count = 0;
551  filedata_logger_count = 0;
552 }
553 
554 /** \internal
555  * \brief add Sub RunModeOutput to list for Submodule so we can free
556  * the output ctx at shutdown and unix socket reload */
557 static void AddOutputToFreeList(OutputModule *module, OutputCtx *output_ctx)
558 {
559  OutputFreeList *fl_output = SCCalloc(1, sizeof(OutputFreeList));
560  if (unlikely(fl_output == NULL))
561  return;
562  fl_output->output_module = module;
563  fl_output->output_ctx = output_ctx;
564  TAILQ_INSERT_TAIL(&output_free_list, fl_output, entries);
565 }
566 
567 /** \brief Turn output into thread module */
568 static void SetupOutput(const char *name, OutputModule *module, OutputCtx *output_ctx)
569 {
570  /* flow logger doesn't run in the packet path */
571  if (module->FlowLogFunc) {
572  OutputRegisterFlowLogger(module->name, module->FlowLogFunc,
573  output_ctx, module->ThreadInit, module->ThreadDeinit,
574  module->ThreadExitPrintStats);
575  return;
576  }
577  /* stats logger doesn't run in the packet path */
578  if (module->StatsLogFunc) {
580  output_ctx,module->ThreadInit, module->ThreadDeinit,
581  module->ThreadExitPrintStats);
582  return;
583  }
584 
585  if (module->logger_id == LOGGER_ALERT_DEBUG) {
586  debuglog_enabled = 1;
587  }
588 
589  if (module->PacketLogFunc) {
590  SCLogDebug("%s is a packet logger", module->name);
591  OutputRegisterPacketLogger(module->logger_id, module->name,
592  module->PacketLogFunc, module->PacketConditionFunc, output_ctx,
593  module->ThreadInit, module->ThreadDeinit,
594  module->ThreadExitPrintStats);
595  } else if (module->TxLogFunc) {
596  SCLogDebug("%s is a tx logger", module->name);
597  OutputRegisterTxLogger(module->logger_id, module->name, module->alproto,
598  module->TxLogFunc, output_ctx, module->tc_log_progress,
599  module->ts_log_progress, module->TxLogCondition,
600  module->ThreadInit, module->ThreadDeinit,
601  module->ThreadExitPrintStats);
602  /* Not used with wild card loggers */
603  if (module->alproto != ALPROTO_UNKNOWN) {
604  logger_bits[module->alproto] |= (1<<module->logger_id);
605  }
606  } else if (module->FiledataLogFunc) {
607  SCLogDebug("%s is a filedata logger", module->name);
609  module->FiledataLogFunc, output_ctx, module->ThreadInit,
610  module->ThreadDeinit, module->ThreadExitPrintStats);
611  filedata_logger_count++;
612  } else if (module->FileLogFunc) {
613  SCLogDebug("%s is a file logger", module->name);
614  OutputRegisterFileLogger(module->logger_id, module->name,
615  module->FileLogFunc, output_ctx, module->ThreadInit,
616  module->ThreadDeinit, module->ThreadExitPrintStats);
617  file_logger_count++;
618  } else if (module->StreamingLogFunc) {
619  SCLogDebug("%s is a streaming logger", module->name);
621  module->StreamingLogFunc, output_ctx, module->stream_type,
622  module->ThreadInit, module->ThreadDeinit,
623  module->ThreadExitPrintStats);
624  } else {
625  SCLogError(SC_ERR_INVALID_ARGUMENT, "Unknown logger type: name=%s",
626  module->name);
627  }
628 }
629 
630 static void RunModeInitializeEveOutput(ConfNode *conf, OutputCtx *parent_ctx)
631 {
632  ConfNode *types = ConfNodeLookupChild(conf, "types");
633  SCLogDebug("types %p", types);
634  if (types == NULL) {
635  return;
636  }
637 
638  ConfNode *type = NULL;
639  TAILQ_FOREACH(type, &types->head, next) {
640  int sub_count = 0;
641  char subname[256];
642 
643  if (strcmp(type->val, "ikev2") == 0) {
644  SCLogWarning(SC_ERR_INVALID_ARGUMENT, "eve module 'ikev2' has been replaced by 'ike'");
645  strlcpy(subname, "eve-log.ike", sizeof(subname));
646  } else {
647  snprintf(subname, sizeof(subname), "eve-log.%s", type->val);
648  }
649 
650  SCLogConfig("enabling 'eve-log' module '%s'", type->val);
651 
652  ConfNode *sub_output_config = ConfNodeLookupChild(type, type->val);
653  if (sub_output_config != NULL) {
654  const char *enabled = ConfNodeLookupChildValue(
655  sub_output_config, "enabled");
656  if (enabled != NULL && !ConfValIsTrue(enabled)) {
657  continue;
658  }
659  }
660 
661  /* Now setup all registers logger of this name. */
662  OutputModule *sub_module;
663  TAILQ_FOREACH(sub_module, &output_modules, entries) {
664  if (strcmp(subname, sub_module->conf_name) == 0) {
665  sub_count++;
666 
667  if (sub_module->parent_name == NULL ||
668  strcmp(sub_module->parent_name, "eve-log") != 0) {
670  "bad parent for %s", subname);
671  }
672  if (sub_module->InitSubFunc == NULL) {
674  "bad sub-module for %s", subname);
675  }
676 
677  /* pass on parent output_ctx */
678  OutputInitResult result =
679  sub_module->InitSubFunc(sub_output_config, parent_ctx);
680  if (!result.ok || result.ctx == NULL) {
681  continue;
682  }
683 
684  AddOutputToFreeList(sub_module, result.ctx);
685  SetupOutput(sub_module->name, sub_module,
686  result.ctx);
687  }
688  }
689 
690  /* Error is no registered loggers with this name
691  * were found .*/
692  if (!sub_count) {
694  "No output module named %s", subname);
695  continue;
696  }
697  }
698 }
699 
700 static void RunModeInitializeLuaOutput(ConfNode *conf, OutputCtx *parent_ctx)
701 {
702  OutputModule *lua_module = OutputGetModuleByConfName("lua");
703  BUG_ON(lua_module == NULL);
704 
705  ConfNode *scripts = ConfNodeLookupChild(conf, "scripts");
706  BUG_ON(scripts == NULL); //TODO
707 
708  OutputModule *m;
709  TAILQ_FOREACH(m, &parent_ctx->submodules, entries) {
710  SCLogDebug("m %p %s:%s", m, m->name, m->conf_name);
711 
712  ConfNode *script = NULL;
713  TAILQ_FOREACH(script, &scripts->head, next) {
714  SCLogDebug("script %s", script->val);
715  if (strcmp(script->val, m->conf_name) == 0) {
716  break;
717  }
718  }
719  BUG_ON(script == NULL);
720 
721  /* pass on parent output_ctx */
722  OutputInitResult result = m->InitSubFunc(script, parent_ctx);
723  if (!result.ok || result.ctx == NULL) {
724  continue;
725  }
726 
727  AddOutputToFreeList(m, result.ctx);
728  SetupOutput(m->name, m, result.ctx);
729  }
730 }
731 
732 /**
733  * Initialize the output modules.
734  */
736 {
737  ConfNode *outputs = ConfGetNode("outputs");
738  if (outputs == NULL) {
739  /* No "outputs" section in the configuration. */
740  return;
741  }
742 
743  ConfNode *output, *output_config;
744  const char *enabled;
745  char tls_log_enabled = 0;
746  char tls_store_present = 0;
747 
748  memset(&logger_bits, 0, sizeof(logger_bits));
749 
750  TAILQ_FOREACH(output, &outputs->head, next) {
751 
752  output_config = ConfNodeLookupChild(output, output->val);
753  if (output_config == NULL) {
754  /* Shouldn't happen. */
756  "Failed to lookup configuration child node: %s", output->val);
757  }
758 
759  if (strcmp(output->val, "tls-store") == 0) {
760  tls_store_present = 1;
761  }
762 
763  enabled = ConfNodeLookupChildValue(output_config, "enabled");
764  if (enabled == NULL || !ConfValIsTrue(enabled)) {
765  continue;
766  }
767 
768  if (strcmp(output->val, "file-log") == 0) {
770  "file-log is no longer supported,"
771  " use eve.files instead "
772  "(see https://redmine.openinfosecfoundation.org/issues/2376"
773  " for an explanation)");
774  continue;
775  } else if (strncmp(output->val, "unified-", sizeof("unified-") - 1) == 0) {
777  "Unified1 is no longer supported,"
778  " use Unified2 instead "
779  "(see https://redmine.openinfosecfoundation.org/issues/353"
780  " for an explanation)");
781  continue;
782  } else if (strncmp(output->val, "unified2-", sizeof("unified2-") - 1) == 0) {
784  "Unified2 is no longer supported.");
785  continue;
786  } else if (strcmp(output->val, "lua") == 0) {
787 #ifndef HAVE_LUA
789  "lua support not compiled in. Reconfigure/"
790  "recompile with lua(jit) and its development "
791  "files installed to add lua support.");
792  continue;
793 #endif
794  } else if (strcmp(output->val, "dns-log") == 0) {
796  "dns-log is not longer available as of Suricata 5.0");
797  continue;
798  } else if (strcmp(output->val, "tls-log") == 0) {
799  tls_log_enabled = 1;
800  }
801 
802  OutputModule *module;
803  int count = 0;
804  TAILQ_FOREACH(module, &output_modules, entries) {
805  if (strcmp(module->conf_name, output->val) != 0) {
806  continue;
807  }
808 
809  count++;
810 
811  OutputCtx *output_ctx = NULL;
812  if (module->InitFunc != NULL) {
813  OutputInitResult r = module->InitFunc(output_config);
814  if (!r.ok) {
816  "output module \"%s\": setup failed", output->val);
817  continue;
818  } else if (r.ctx == NULL) {
819  continue;
820  }
821  output_ctx = r.ctx;
822  } else if (module->InitSubFunc != NULL) {
823  SCLogInfo("skipping submodule");
824  continue;
825  }
826 
827  // TODO if module == parent, find it's children
828  if (strcmp(output->val, "eve-log") == 0) {
829  RunModeInitializeEveOutput(output_config, output_ctx);
830 
831  /* add 'eve-log' to free list as it's the owner of the
832  * main output ctx from which the sub-modules share the
833  * LogFileCtx */
834  AddOutputToFreeList(module, output_ctx);
835  } else if (strcmp(output->val, "lua") == 0) {
836  SCLogDebug("handle lua");
837  if (output_ctx == NULL)
838  continue;
839  RunModeInitializeLuaOutput(output_config, output_ctx);
840  AddOutputToFreeList(module, output_ctx);
841  } else {
842  AddOutputToFreeList(module, output_ctx);
843  SetupOutput(module->name, module, output_ctx);
844  }
845  }
846  if (count == 0) {
848  "No output module named %s", output->val);
849  continue;
850  }
851  }
852 
853  /* Backward compatibility code */
854  if (!tls_store_present && tls_log_enabled) {
855  /* old YAML with no "tls-store" in outputs. "tls-log" value needs
856  * to be started using 'tls-log' config as own config */
858  "Please use 'tls-store' in YAML to configure TLS storage");
859 
860  TAILQ_FOREACH(output, &outputs->head, next) {
861  output_config = ConfNodeLookupChild(output, output->val);
862 
863  if (strcmp(output->val, "tls-log") == 0) {
864 
865  OutputModule *module = OutputGetModuleByConfName("tls-store");
866  if (module == NULL) {
868  "No output module named %s, ignoring", "tls-store");
869  continue;
870  }
871 
872  OutputCtx *output_ctx = NULL;
873  if (module->InitFunc != NULL) {
874  OutputInitResult r = module->InitFunc(output_config);
875  if (!r.ok) {
877  "output module setup failed");
878  continue;
879  } else if (r.ctx == NULL) {
880  continue;
881  }
882  output_ctx = r.ctx;
883  }
884 
885  AddOutputToFreeList(module, output_ctx);
886  SetupOutput(module->name, module, output_ctx);
887  }
888  }
889  }
890 
891  /* register the logger bits to the app-layer */
892  int a;
893  for (a = 0; a < ALPROTO_MAX; a++) {
894  if (logger_bits[a] == 0)
895  continue;
896 
897  const int tcp = AppLayerParserProtocolHasLogger(IPPROTO_TCP, a);
898  const int udp = AppLayerParserProtocolHasLogger(IPPROTO_UDP, a);
899 
900  SCLogDebug("logger for %s: %s %s", AppProtoToString(a),
901  tcp ? "true" : "false", udp ? "true" : "false");
902 
903  SCLogDebug("logger bits for %s: %08x", AppProtoToString(a), logger_bits[a]);
904  if (tcp)
905  AppLayerParserRegisterLoggerBits(IPPROTO_TCP, a, logger_bits[a]);
906  if (udp)
907  AppLayerParserRegisterLoggerBits(IPPROTO_UDP, a, logger_bits[a]);
908 
909  }
911 }
912 
914 
915 /**
916  * Initialize multithreading settings.
917  */
919 {
921  if ((ConfGetBool("threading.set-cpu-affinity", &threading_set_cpu_affinity)) == 0) {
923  }
924  /* try to get custom cpu mask value if needed */
927  }
928  if ((ConfGetFloat("threading.detect-thread-ratio", &threading_detect_ratio)) != 1) {
929  if (ConfGetNode("threading.detect-thread-ratio") != NULL)
930  WarnInvalidConfEntry("threading.detect-thread-ratio", "%s", "1");
932  }
933 
934  SCLogDebug("threading.detect-thread-ratio %f", threading_detect_ratio);
935 }
thread_name_workers
const char * thread_name_workers
Definition: runmodes.c:65
RunModeIpsIPFWGetDefaultMode
const char * RunModeIpsIPFWGetDefaultMode(void)
Definition: runmode-ipfw.c:44
OutputRegisterStreamingLogger
int OutputRegisterStreamingLogger(LoggerId id, const char *name, StreamingLogger LogFunc, OutputCtx *output_ctx, enum OutputStreamingType type, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-streaming.c:70
suricata-plugin.h
util-byte.h
OutputModule_::parent_name
const char * parent_name
Definition: output.h:57
tm-threads.h
thread_name_counter_wakeup
const char * thread_name_counter_wakeup
Definition: runmodes.c:73
flow-bypass.h
RunMode_::description
const char * description
Definition: runmodes.c:82
detect-engine.h
RUNMODE_UNIX_SOCKET
@ RUNMODE_UNIX_SOCKET
Definition: runmodes.h:41
RunModeErfFileRegister
void RunModeErfFileRegister(void)
Definition: runmode-erf-file.c:39
OutputStreamingShutdown
void OutputStreamingShutdown(void)
Definition: output-streaming.c:464
AppLayerParserProtocolHasLogger
int AppLayerParserProtocolHasLogger(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:1430
thread_name_flow_mgr
const char * thread_name_flow_mgr
Definition: runmodes.c:67
RUNMODE_UNITTEST
@ RUNMODE_UNITTEST
Definition: runmodes.h:39
alert-debuglog.h
FatalErrorOnInit
#define FatalErrorOnInit(x,...)
Fatal error IF we're starting up, and configured to consider errors to be fatal errors.
Definition: util-debug.h:540
RunModeErfFileGetDefaultMode
const char * RunModeErfFileGetDefaultMode(void)
Definition: runmode-erf-file.c:34
ConfNode_::val
char * val
Definition: conf.h:34
ConfGetBool
int ConfGetBool(const char *name, int *val)
Retrieve a configuration value as an boolen.
Definition: conf.c:516
RUNMODE_UNKNOWN
@ RUNMODE_UNKNOWN
Definition: runmodes.h:28
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
OutputTxShutdown
void OutputTxShutdown(void)
Definition: output-tx.c:452
TmqhFlowPrintAutofpHandler
void TmqhFlowPrintAutofpHandler(void)
Definition: tmqh-flow.c:82
RunModeIdsAFPRegister
void RunModeIdsAFPRegister(void)
Definition: runmode-af-packet.c:66
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:298
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
OutputRegisterFileLogger
int OutputRegisterFileLogger(LoggerId id, const char *name, FileLogger LogFunc, OutputCtx *output_ctx, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-file.c:69
RunModeShutDown
void RunModeShutDown(void)
Definition: runmodes.c:535
OutputRegisterStatsLogger
int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc, OutputCtx *output_ctx, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-stats.c:57
RunModeDispatch
void RunModeDispatch(int runmode, const char *custom_mode, const char *capture_plugin_name, const char *capture_plugin_args)
Definition: runmodes.c:282
SC_ERR_NOT_SUPPORTED
@ SC_ERR_NOT_SUPPORTED
Definition: util-error.h:257
ConfGetNode
ConfNode * ConfGetNode(const char *name)
Get a ConfNode by name.
Definition: conf.c:175
OutputModule_::name
const char * name
Definition: output.h:55
thread_name_counter_stats
const char * thread_name_counter_stats
Definition: runmodes.c:72
OutputModule_::StreamingLogFunc
StreamingLogger StreamingLogFunc
Definition: output.h:72
OutputModule_::FileLogFunc
FileLogger FileLogFunc
Definition: output.h:69
OutputModule_::logger_id
LoggerId logger_id
Definition: output.h:54
LoggerId
LoggerId
Definition: suricata-common.h:432
AppProtoToString
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
Definition: app-layer-protos.c:30
RunModeAFPGetDefaultMode
const char * RunModeAFPGetDefaultMode(void)
Definition: runmode-af-packet.c:61
thread_name_flow_rec
const char * thread_name_flow_rec
Definition: runmodes.c:68
OutputFiledataShutdown
void OutputFiledataShutdown(void)
Definition: output-filedata.c:486
RunModeInitialize
void RunModeInitialize(void)
Definition: runmodes.c:918
RUNMODE_ERF_FILE
@ RUNMODE_ERF_FILE
Definition: runmodes.h:35
RunModeIdsPfringRegister
void RunModeIdsPfringRegister(void)
Definition: runmode-pfring.c:51
OutputModule_::ts_log_progress
int ts_log_progress
Definition: output.h:77
RunModeFilePcapGetDefaultMode
const char * RunModeFilePcapGetDefaultMode(void)
Definition: runmode-pcap-file.c:35
TAILQ_FOREACH
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:253
thread_name_autofp
const char * thread_name_autofp
Definition: runmodes.c:63
RUNMODE_NFLOG
@ RUNMODE_NFLOG
Definition: runmodes.h:33
OutputGetModuleByConfName
OutputModule * OutputGetModuleByConfName(const char *conf_name)
Get an output module by name.
Definition: output.c:783
OutputSetupActiveLoggers
void OutputSetupActiveLoggers(void)
Definition: output.c:995
OutputModule_::StatsLogFunc
StatsLogger StatsLogFunc
Definition: output.h:73
RunModeIdsNflogGetDefaultMode
const char * RunModeIdsNflogGetDefaultMode(void)
Definition: runmode-nflog.c:36
RUNMODE_PCAP_DEV
@ RUNMODE_PCAP_DEV
Definition: runmodes.h:29
RunMode_::RunModeFunc
int(* RunModeFunc)(void)
Definition: runmodes.c:84
OutputStatsShutdown
void OutputStatsShutdown(void)
Definition: output-stats.c:213
TAILQ_INSERT_TAIL
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:295
RunmodeGetActive
char * RunmodeGetActive(void)
Definition: runmodes.c:191
m
SCMutex m
Definition: flow-hash.h:6
OutputModule_::InitSubFunc
OutputInitSubFunc InitSubFunc
Definition: output.h:59
RUNMODE_NAPATECH
@ RUNMODE_NAPATECH
Definition: runmodes.h:40
RunModes
struct RunModes_ RunModes
OutputModule_::PacketLogFunc
PacketLogger PacketLogFunc
Definition: output.h:65
TmValidateQueueState
void TmValidateQueueState(void)
Checks if all the queues allocated so far have at least one reader and writer.
Definition: tm-queues.c:101
ALPROTO_MAX
@ ALPROTO_MAX
Definition: app-layer-protos.h:72
IsRunModeOffline
bool IsRunModeOffline(enum RunModes run_mode_to_check)
Definition: runmodes.c:517
RunModeInitializeOutputs
void RunModeInitializeOutputs(void)
Definition: runmodes.c:735
debuglog_enabled
int debuglog_enabled
Definition: runmodes.c:59
SC_ERR_RUNMODE
@ SC_ERR_RUNMODE
Definition: util-error.h:219
thread_name_single
const char * thread_name_single
Definition: runmodes.c:64
OutputModule_::alproto
AppProto alproto
Definition: output.h:74
RUNMODE_DAG
@ RUNMODE_DAG
Definition: runmodes.h:36
RunModes_
Definition: runmodes.c:87
util-unittest.h
RUNMODE_NETMAP
@ RUNMODE_NETMAP
Definition: runmodes.h:38
SCCapturePlugin_::GetDefaultMode
const char *(* GetDefaultMode)(void)
Definition: suricata-plugin.h:72
ConfValIsTrue
int ConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:565
OutputClearActiveLoggers
void OutputClearActiveLoggers(void)
Definition: output.c:1008
OutputCtx_
Definition: tm-modules.h:78
RunModeIdsPfringGetDefaultMode
const char * RunModeIdsPfringGetDefaultMode(void)
Definition: runmode-pfring.c:42
OutputModule_::stream_type
enum OutputStreamingType stream_type
Definition: output.h:75
strlcpy
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: util-strlcpyu.c:43
OutputRegisterFiledataLogger
int OutputRegisterFiledataLogger(LoggerId id, const char *name, FiledataLogger LogFunc, OutputCtx *output_ctx, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-filedata.c:74
TAILQ_ENTRY
#define TAILQ_ENTRY(type)
Definition: queue.h:240
RunModeUnixSocketGetDefaultMode
const char * RunModeUnixSocketGetDefaultMode(void)
Definition: runmode-unix-socket.c:80
OutputRegisterFlowLogger
int OutputRegisterFlowLogger(const char *name, FlowLogger LogFunc, OutputCtx *output_ctx, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-flow.c:58
ConfGet
int ConfGet(const char *name, const char **vptr)
Retrieve the value of a configuration node.
Definition: conf.c:330
RUNMODE_USER_MAX
@ RUNMODE_USER_MAX
Definition: runmodes.h:44
RunModeIpsNFQRegister
void RunModeIpsNFQRegister(void)
Definition: runmode-nfq.c:47
counters.h
OutputRegisterTxLogger
int OutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto, TxLogger LogFunc, OutputCtx *output_ctx, int tc_log_progress, int ts_log_progress, TxLoggerCondition LogCondition, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, void(*ThreadExitPrintStats)(ThreadVars *, void *))
Definition: output-tx.c:67
OutputModule_::ThreadInit
ThreadInitFunc ThreadInit
Definition: output.h:61
TAILQ_HEAD_INITIALIZER
#define TAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:237
IsRunModeSystem
bool IsRunModeSystem(enum RunModes run_mode_to_check)
Definition: runmodes.c:504
output_modules
OutputModuleList output_modules
RunModes
RunModes
Definition: runmodes.h:27
TAILQ_REMOVE
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:313
OutputModule_::FiledataLogFunc
FiledataLogger FiledataLogFunc
Definition: output.h:70
util-debug.h
RunModes_::runmodes
RunMode * runmodes
Definition: runmodes.c:89
TAILQ_FIRST
#define TAILQ_FIRST(head)
Definition: queue.h:251
type
uint8_t type
Definition: decode-icmpv4.h:0
thread_name_flow_bypass
const char * thread_name_flow_bypass
Definition: runmodes.c:69
SC_ERR_CONF_YAML_ERROR
@ SC_ERR_CONF_YAML_ERROR
Definition: util-error.h:274
BypassedFlowManagerThreadSpawn
void BypassedFlowManagerThreadSpawn()
spawn the flow bypass manager thread
Definition: flow-bypass.c:183
SC_ERR_PLUGIN
@ SC_ERR_PLUGIN
Definition: util-error.h:367
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:44
RUNMODE_CONF_TEST
@ RUNMODE_CONF_TEST
Definition: runmodes.h:52
OutputModule_::ThreadDeinit
ThreadDeinitFunc ThreadDeinit
Definition: output.h:62
RunModeListRunmodes
void RunModeListRunmodes(void)
Lists all registered runmodes.
Definition: runmodes.c:239
util-cpu.h
RunModeEnablesBypassManager
void RunModeEnablesBypassManager(void)
Definition: runmodes.c:411
OutputPacketShutdown
void OutputPacketShutdown(void)
Definition: output-packet.c:229
RunModeIdsNflogRegister
void RunModeIdsNflogRegister(void)
Definition: runmode-nflog.c:41
detect-engine-mpm.h
detect.h
util-affinity.h
RunMode_
Holds description for a runmode.
Definition: runmodes.c:78
SCCapturePlugin_
Definition: suricata-plugin.h:67
AppLayerParserRegisterLoggerBits
void AppLayerParserRegisterLoggerBits(uint8_t ipproto, AppProto alproto, LoggerId bits)
Definition: app-layer-parser.c:446
RunModeIpsIPFWRegister
void RunModeIpsIPFWRegister(void)
Definition: runmode-ipfw.c:49
util-time.h
OutputInitResult_::ok
bool ok
Definition: output.h:45
RunModeErfDagGetDefaultMode
const char * RunModeErfDagGetDefaultMode(void)
Definition: runmode-erf-dag.c:43
threading_set_cpu_affinity
int threading_set_cpu_affinity
Definition: runmodes.c:60
SC_ERR_INVALID_ARGUMENT
@ SC_ERR_INVALID_ARGUMENT
Definition: util-error.h:43
app-layer-parser.h
TRUE
#define TRUE
Definition: suricata-common.h:33
source-pfring.h
BUG_ON
#define BUG_ON(x)
Definition: suricata-common.h:277
FALSE
#define FALSE
Definition: suricata-common.h:34
thread_name_detect_loader
const char * thread_name_detect_loader
Definition: runmodes.c:71
OutputModule_::conf_name
const char * conf_name
Definition: output.h:56
OutputModule_::FlowLogFunc
FlowLogger FlowLogFunc
Definition: output.h:71
FlowManagerThreadSpawn
void FlowManagerThreadSpawn()
spawn the flow manager thread
Definition: flow-manager.c:1077
conf.h
OutputFileShutdown
void OutputFileShutdown(void)
Definition: output-file.c:318
util-plugin.h
queue.h
RunModeErfDagRegister
void RunModeErfDagRegister(void)
Definition: runmode-erf-dag.c:48
OutputModule_::ThreadExitPrintStats
ThreadExitPrintStatsFunc ThreadExitPrintStats
Definition: output.h:63
RunMode
struct RunMode_ RunMode
Holds description for a runmode.
FlowRecyclerThreadSpawn
void FlowRecyclerThreadSpawn()
spawn the flow recycler thread
Definition: flow-manager.c:1280
runmodes.h
SCLogInfo
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
Definition: util-debug.h:217
WarnInvalidConfEntry
#define WarnInvalidConfEntry(param_name, format, value)
Generic API that can be used by all to log an invalid conf entry.
Definition: util-misc.h:37
RunModes_::cnt
int cnt
Definition: runmodes.c:88
RunModeIpsWinDivertRegister
void RunModeIpsWinDivertRegister(void)
Definition: runmode-windivert.c:45
SCRealloc
#define SCRealloc(ptr, sz)
Definition: util-mem.h:50
RunModeNapatechGetDefaultMode
const char * RunModeNapatechGetDefaultMode(void)
Definition: runmode-napatech.c:82
alert-fastlog.h
ConfNodeLookupChild
ConfNode * ConfNodeLookupChild(const ConfNode *node, const char *name)
Lookup a child configuration node by name.
Definition: conf.c:814
OutputFreeList_::output_ctx
OutputCtx * output_ctx
Definition: runmodes.c:99
SC_ERR_UNKNOWN_RUN_MODE
@ SC_ERR_UNKNOWN_RUN_MODE
Definition: util-error.h:155
OutputInitResult_
Definition: output.h:43
ConfGetFloat
int ConfGetFloat(const char *name, float *val)
Retrieve a configuration value as a float.
Definition: conf.c:644
OutputModule_::TxLogCondition
TxLoggerCondition TxLogCondition
Definition: output.h:68
RUNMODE_PFRING
@ RUNMODE_PFRING
Definition: runmodes.h:31
RunModeUnixSocketRegister
void RunModeUnixSocketRegister(void)
Definition: runmode-unix-socket.c:587
flow-manager.h
suricata-common.h
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:84
RunModeRegisterNewRunMode
void RunModeRegisterNewRunMode(enum RunModes runmode, const char *name, const char *description, int(*RunModeFunc)(void))
Registers a new runmode.
Definition: runmodes.c:432
StatsSpawnThreads
void StatsSpawnThreads(void)
Spawns the wakeup, and the management thread used by the stats api.
Definition: counters.c:893
RunModeNeedsBypassManager
int RunModeNeedsBypassManager(void)
Definition: runmodes.c:416
SCLogError
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
Definition: util-debug.h:257
LOGGER_ALERT_DEBUG
@ LOGGER_ALERT_DEBUG
Definition: suricata-common.h:469
RunModeIdsPcapRegister
void RunModeIdsPcapRegister(void)
Definition: runmode-pcap.c:43
RunModeRegisterRunModes
void RunModeRegisterRunModes(void)
Register all runmodes in the engine.
Definition: runmodes.c:213
SCStrdup
#define SCStrdup(s)
Definition: util-mem.h:56
RunModeFilePcapRegister
void RunModeFilePcapRegister(void)
Definition: runmode-pcap-file.c:40
FatalError
#define FatalError(x,...)
Definition: util-debug.h:532
AffinitySetupLoadFromConfig
void AffinitySetupLoadFromConfig()
Extract cpu affinity configuration from current config file.
Definition: util-affinity.c:180
log-httplog.h
OutputModule_::PacketConditionFunc
PacketLogCondition PacketConditionFunc
Definition: output.h:66
RunmodeGetCurrent
int RunmodeGetCurrent(void)
Definition: suricata.c:276
RUNMODE_NFQ
@ RUNMODE_NFQ
Definition: runmodes.h:32
SCLogConfig
struct SCLogConfig_ SCLogConfig
Holds the config state used by the logging api.
RunModeNetmapGetDefaultMode
const char * RunModeNetmapGetDefaultMode(void)
Definition: runmode-netmap.c:58
RunModeIpsNFQGetDefaultMode
const char * RunModeIpsNFQGetDefaultMode(void)
Definition: runmode-nfq.c:42
RUNMODE_ENGINE_ANALYSIS
@ RUNMODE_ENGINE_ANALYSIS
Definition: runmodes.h:54
RunMode_::runmode
enum RunModes runmode
Definition: runmodes.c:80
SCLogWarning
#define SCLogWarning(err_code,...)
Macro used to log WARNING messages.
Definition: util-debug.h:244
SCFree
#define SCFree(p)
Definition: util-mem.h:61
RunModeIdsNetmapRegister
void RunModeIdsNetmapRegister(void)
Definition: runmode-netmap.c:63
ConfNode_
Definition: conf.h:32
OutputFreeList
struct OutputFreeList_ OutputFreeList
SC_ERR_FATAL
@ SC_ERR_FATAL
Definition: util-error.h:203
thread_name_verdict
const char * thread_name_verdict
Definition: runmodes.c:66
OutputModule_::TxLogFunc
TxLogger TxLogFunc
Definition: output.h:67
OutputModule_::tc_log_progress
int tc_log_progress
Definition: output.h:76
TAILQ_HEAD
#define TAILQ_HEAD(name, type)
Definition: queue.h:231
OutputFlowShutdown
void OutputFlowShutdown(void)
Definition: output-flow.c:213
ALPROTO_UNKNOWN
@ ALPROTO_UNKNOWN
Definition: app-layer-protos.h:29
OutputFreeList_
Definition: runmodes.c:97
tmqh-flow.h
RUNMODE_WINDIVERT
@ RUNMODE_WINDIVERT
Definition: runmodes.h:42
SC_ERR_MEM_ALLOC
@ SC_ERR_MEM_ALLOC
Definition: util-error.h:31
thread_name_unix_socket
const char * thread_name_unix_socket
Definition: runmodes.c:70
RunModeNapatechRegister
void RunModeNapatechRegister(void)
Definition: runmode-napatech.c:87
OutputFreeList_::output_module
OutputModule * output_module
Definition: runmodes.c:98
RunModeGetMainMode
const char * RunModeGetMainMode(void)
Definition: runmodes.c:203
RunModeOutputFiledataEnabled
int RunModeOutputFiledataEnabled(void)
Definition: runmodes.c:499
util-misc.h
RunMode_::name
const char * name
Definition: runmodes.c:81
OutputModule_
Definition: output.h:53
UtRunModeRegister
void UtRunModeRegister(void)
Definition: util-unittest.c:284
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
RUNMODE_AFP_DEV
@ RUNMODE_AFP_DEV
Definition: runmodes.h:37
RUNMODE_PCAP_FILE
@ RUNMODE_PCAP_FILE
Definition: runmodes.h:30
RunModeIpsWinDivertGetDefaultMode
const char * RunModeIpsWinDivertGetDefaultMode(void)
Definition: runmode-windivert.c:40
RUNMODE_PLUGIN
@ RUNMODE_PLUGIN
Definition: runmodes.h:43
RUNMODE_IPFW
@ RUNMODE_IPFW
Definition: runmodes.h:34
SCPluginFindCaptureByName
SCCapturePlugin * SCPluginFindCaptureByName(const char *name)
threading_detect_ratio
float threading_detect_ratio
Definition: runmodes.c:913
output.h
RunModeOutputFileEnabled
int RunModeOutputFileEnabled(void)
Definition: runmodes.c:494
OutputModule_::InitFunc
OutputInitFunc InitFunc
Definition: output.h:58
OutputRegisterPacketLogger
int OutputRegisterPacketLogger(LoggerId logger_id, const char *name, PacketLogger LogFunc, PacketLogCondition ConditionFunc, OutputCtx *output_ctx, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-packet.c:61
RunModeIdsGetDefaultMode
const char * RunModeIdsGetDefaultMode(void)
Definition: runmode-pcap.c:36
ConfNodeLookupChildValue
const char * ConfNodeLookupChildValue(const ConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
Definition: conf.c:842