typedef std::list<ModHook*> ModuleList;
static ModuleList s_modules;
-static std::unordered_map<std::string, Module*> s_module_map;
static unsigned s_errors = 0;
std::set<uint32_t> ModuleManager::gids;
{
ModHook* mh = new ModHook(m, b);
s_modules.emplace_back(mh);
- s_module_map[std::string(m->get_name())] = m;
Profiler::register_module(m);
Module* ModuleManager::get_module(const char* s)
{
- return s_module_map[std::string(s)];
+ for ( auto p : s_modules )
+ if ( !strcmp(p->mod->get_name(), s) )
+ return p->mod;
+
+ return nullptr;
}
Module* ModuleManager::get_default_module(const char* s, SnortConfig* sc)
//-------------------------------------------------------------------------
// helpers
//-------------------------------------------------------------------------
-static bool is_global(const char* key)
-{
- Module* m = ModuleManager::get_module(key);
- return m ? m->get_usage() == Module::GLOBAL : false;
-}
static void set_session(Flow* flow, const char* key)
{
- Inspector* pin = InspectorManager::get_inspector(key, is_global(key));
+ Inspector* pin = InspectorManager::get_inspector(key);
if ( pin )
{
const char* s = SnortConfig::get_conf()->proto_ref->get_name(flow->ssn_state.snort_protocol_id);
- return InspectorManager::get_inspector(s, is_global(s));
+ return InspectorManager::get_inspector(s);
}
//-------------------------------------------------------------------------
action = pb->use.action;
return true;
}
+
switch ( pb->use.what )
{
case BindUse::BW_NONE:
else
key = pb->use.svc.c_str();
- if ( (pb->use.object = InspectorManager::get_inspector(key, is_global(key))) )
+ Module* m = ModuleManager::get_module(key);
+ bool is_global = m ? m->get_usage() == Module::GLOBAL : false;
+ if ( (pb->use.object = InspectorManager::get_inspector(key, is_global)) )
{
switch ( ((Inspector*)pb->use.object)->get_api()->type )
{