]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
help on plugins
authorRuss Combs <rucombs@cisco.com>
Fri, 5 Sep 2014 20:14:07 +0000 (16:14 -0400)
committerRuss Combs <rucombs@cisco.com>
Fri, 5 Sep 2014 20:14:07 +0000 (16:14 -0400)
src/main/help.cc
src/main/help.h
src/main/snort_module.cc
src/managers/plugin_manager.cc
src/managers/plugin_manager.h

index fabf633a872c529f553a01d4ccc7c7c476992f8d..6d2f8b392176487a6b0a2c9b3f485d42ddec01d3 100644 (file)
@@ -140,7 +140,7 @@ void help_signals(SnortConfig*, const char*)
 enum HelpType {
     HT_CFG, HT_CMD, HT_GID, HT_IPS, HT_MOD,
     HT_BUF, HT_LST, HT_PLG, HT_DDR, HT_DBR,
-    HT_SHO
+    HT_HMO, HT_HPL
 };
 
 static void show_help(SnortConfig* sc, const char* val, HelpType ht)
@@ -181,9 +181,12 @@ static void show_help(SnortConfig* sc, const char* val, HelpType ht)
     case HT_DBR:
         ModuleManager::dump_rules(val);
         break;
-    case HT_SHO:
+    case HT_HMO:
         ModuleManager::show_modules();
         break;
+    case HT_HPL:
+        PluginManager::show_plugins();
+        break;
     }
     ModuleManager::term();
     PluginManager::release_plugins();
@@ -228,7 +231,12 @@ void help_module(SnortConfig* sc, const char* val)
 
 void help_modules(SnortConfig* sc, const char* val)
 {
-    show_help(sc, val, HT_SHO);
+    show_help(sc, val, HT_HMO);
+}
+
+void help_plugins(SnortConfig* sc, const char* val)
+{
+    show_help(sc, val, HT_HPL);
 }
 
 void list_modules(SnortConfig* sc, const char* val)
index 8853bac5cd3d0782ec65035ac5e320f75b392f20..d1d64d76cc3651e78145722f12bdf2bb5679c51d 100644 (file)
@@ -37,6 +37,7 @@ void help_buffers(SnortConfig* sc, const char*);
 void help_builtin(SnortConfig* sc, const char*);
 void help_module(SnortConfig* sc, const char*);
 void help_modules(SnortConfig* sc, const char*);
+void help_plugins(SnortConfig* sc, const char*);
 void help_version(SnortConfig*, const char*);
 
 void list_modules(SnortConfig* sc, const char*);
index 14c8a4e7e7b40631b2e8ef8aba9bcfa472d48375..6d5e775e22517d089e95d68389422d29656fa0d1 100644 (file)
@@ -258,7 +258,10 @@ static const Parameter s_params[] =
       "<module> output description of given module" },
 
     { "--help-modules", Parameter::PT_IMPLIED, nullptr, nullptr,
-      "list all modules with brief help" },
+      "list all available modules with brief help" },
+
+    { "--help-plugins", Parameter::PT_IMPLIED, nullptr, nullptr,
+      "list all available plugins with brief help" },
 
     { "--help-options", Parameter::PT_STRING, "(optional)", nullptr,
       "<option prefix> output matching command line option quick help" },
@@ -579,6 +582,9 @@ bool SnortModule::set(const char*, Value& v, SnortConfig* sc)
     else if ( v.is("--help-modules") )
         help_modules(sc, v.get_string());
 
+    else if ( v.is("--help-plugins") )
+        help_plugins(sc, v.get_string());
+
     else if ( v.is("--help-options") )
         help_options(sc, v.get_string());
 
index ed8792937753890e8a08a3be829ef734b77c18f6..7ac18a1d024717694dfb8d2f1a4950d7ce6e8b4e 100644 (file)
@@ -349,6 +349,17 @@ void PluginManager::list_plugins()
     }
 }
 
+void PluginManager::show_plugins()
+{
+    PlugMap::iterator it;
+
+    for ( it = plug_map.begin(); it != plug_map.end(); ++it )
+    {
+        Plugin& p = it->second;
+        cout << p.key << ": " << p.api->help << endl;
+    }
+}
+
 void PluginManager::dump_plugins()
 {
     DataManager::dump_plugins();
index a9dc8da3d7fd560065279d3087b6c07c84b24877..801e2d2d879949df2966432b287e3c78358bcf83 100644 (file)
@@ -47,6 +47,7 @@ public:
     // plugin methods
     static void load_plugins(const char* lib_paths);
     static void list_plugins();
+    static void show_plugins();
     static void dump_plugins();
     static void release_plugins();
     static const BaseApi* get_api(PlugType, const char* name);