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