using namespace std;
#include "config_file.h"
-#include "parser.h"
-#include "vars.h"
-#include "detection/detect.h"
#include "helpers/process.h"
-#include "main/analyzer.h"
-#include "main/shell.h"
+#include "main/snort.h"
#include "main/snort_module.h"
#include "managers/event_manager.h"
#include "managers/so_manager.h"
#include "managers/inspector_manager.h"
#include "managers/module_manager.h"
#include "managers/plugin_manager.h"
-#include "packet_io/trough.h"
#include "packet_io/sfdaq.h"
#include "packet_io/intf.h"
-#include "parser/parser.h"
#include "utils/util.h"
#include "helpers/markup.h"
#include "framework/module.h"
"creates stub rule files of all loaded rules libraries" },
{ "--dump-dynamic-rules", Parameter::PT_STRING, nullptr, nullptr,
- "<path> creates stub rule files of all loaded rules libraries" },
+ "<path> creates stub rule file of all loaded rules libraries" },
{ "--dirty-pig", Parameter::PT_IMPLIED, nullptr, nullptr,
"don't flush packets and release memory on shutdown" },
{ "--help", Parameter::PT_IMPLIED, nullptr, nullptr,
"overview of help" },
- { "--help-builtin", Parameter::PT_STRING, nullptr, nullptr,
+ { "--help-builtin", Parameter::PT_STRING, "(optional)", nullptr,
"<module prefix> output matching builtin rules" },
{ "--help-buffers", Parameter::PT_IMPLIED, nullptr, nullptr,
"output available inspection buffers" },
- { "--help-commands", Parameter::PT_STRING, nullptr, nullptr,
+ { "--help-commands", Parameter::PT_STRING, "(optional)", nullptr,
"[<module prefix>] output matching commands" },
- { "--help-config", Parameter::PT_STRING, nullptr, nullptr,
+ { "--help-config", Parameter::PT_STRING, "(optional)", nullptr,
"[<module prefix>] output matching config options" },
- { "--help-gids", Parameter::PT_STRING, nullptr, nullptr,
+ { "--help-gids", Parameter::PT_STRING, "(optional)", nullptr,
"[<module prefix>] output matching generators" },
{ "--help-module", Parameter::PT_STRING, nullptr, nullptr,
"<module> output description of given module" },
- { "--help-options", Parameter::PT_STRING, nullptr, nullptr,
+ { "--help-options", Parameter::PT_STRING, "(optional)", nullptr,
"<option prefix> output matching command line option quick help" },
{ "--help-signals", Parameter::PT_IMPLIED, nullptr, nullptr,
// singleton
//-------------------------------------------------------------------------
-static SnortModule snort_module;
+static SnortModule* snort_module = nullptr;
Module* get_snort_module()
-{ return &snort_module; }
+{
+ if ( !snort_module )
+ snort_module = new SnortModule;
+
+ return snort_module;
+}
+
#include "config.h"
#endif
-#include <syslog.h>
-#include <iostream>
#include <string>
using namespace std;
-#include "config_file.h"
-#include "vars.h"
-#include "detection/detect.h"
-#include "helpers/process.h"
-#include "main/analyzer.h"
-#include "main/snort.h"
#include "main/snort_module.h"
-#include "main/shell.h"
#include "framework/module.h"
#include "framework/parameter.h"
-#include "managers/event_manager.h"
-#include "managers/so_manager.h"
-#include "managers/inspector_manager.h"
-#include "managers/module_manager.h"
-#include "managers/plugin_manager.h"
#include "packet_io/trough.h"
-#include "packet_io/sfdaq.h"
-#include "packet_io/intf.h"
#include "parser/arg_list.h"
#include "parser/parser.h"
#include "utils/util.h"
-#include "helpers/markup.h"
//-------------------------------------------------------------------------
bool ok = true;
if ( p->type == Parameter::PT_IMPLIED )
- v.set(true);
-
+ {
+ if ( *val )
+ ok = false;
+ else
+ v.set(true);
+ }
else if ( p->type == Parameter::PT_INT )
{
char* end = nullptr;
p = Parameter::find(p, key);
if ( !p )
- ParseError("unknown option %s %s\n", key, val);
+ ParseError("unknown option %s %s", key, val);
else if ( !set_arg(m, p, k.c_str(), val, sc) )
- ParseError("can't set %s %s\n", key, val);
+ {
+ ParseError("can't set %s %s", key, val);
+ ParseError("usage: %s %s", key, p->help);
+ }
}
//-------------------------------------------------------------------------
set(key, val, sc, true);
check_flags(sc);
+
+ if ( int k = get_parse_errors() )
+ FatalError("see prioir %d errors\n", k);
+
return sc;
}