mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 15:18:20 +00:00
Base: Clean up explicit uses of namespaces in places where they're not necessary.
This commit covers all of the common and base classes.
This commit is contained in:
parent
9f802b2a4d
commit
fe0c22c789
240 changed files with 6823 additions and 6787 deletions
|
@ -20,9 +20,9 @@ static void analyzer_del_func(void* v)
|
|||
|
||||
AnalyzerSet::AnalyzerSet(File* arg_file) : file(arg_file)
|
||||
{
|
||||
auto t = zeek::make_intrusive<zeek::TypeList>();
|
||||
auto t = make_intrusive<TypeList>();
|
||||
t->Append(file_mgr->GetTagType());
|
||||
t->Append(zeek::BifType::Record::Files::AnalyzerArgs);
|
||||
t->Append(BifType::Record::Files::AnalyzerArgs);
|
||||
analyzer_hash = new zeek::detail::CompositeHash(std::move(t));
|
||||
analyzer_map.SetDeleteFunc(analyzer_del_func);
|
||||
}
|
||||
|
@ -41,20 +41,20 @@ AnalyzerSet::~AnalyzerSet()
|
|||
}
|
||||
|
||||
Analyzer* AnalyzerSet::Find(const file_analysis::Tag& tag,
|
||||
zeek::RecordValPtr args)
|
||||
RecordValPtr args)
|
||||
{
|
||||
auto key = GetKey(tag, std::move(args));
|
||||
Analyzer* rval = analyzer_map.Lookup(key.get());
|
||||
return rval;
|
||||
}
|
||||
|
||||
bool AnalyzerSet::Add(const file_analysis::Tag& tag, zeek::RecordValPtr args)
|
||||
bool AnalyzerSet::Add(const file_analysis::Tag& tag, RecordValPtr args)
|
||||
{
|
||||
auto key = GetKey(tag, args);
|
||||
|
||||
if ( analyzer_map.Lookup(key.get()) )
|
||||
{
|
||||
DBG_LOG(zeek::DBG_FILE_ANALYSIS, "[%s] Instantiate analyzer %s skipped: already exists",
|
||||
DBG_LOG(DBG_FILE_ANALYSIS, "[%s] Instantiate analyzer %s skipped: already exists",
|
||||
file->GetID().c_str(),
|
||||
file_mgr->GetComponentName(tag).c_str());
|
||||
|
||||
|
@ -72,7 +72,7 @@ bool AnalyzerSet::Add(const file_analysis::Tag& tag, zeek::RecordValPtr args)
|
|||
}
|
||||
|
||||
Analyzer* AnalyzerSet::QueueAdd(const file_analysis::Tag& tag,
|
||||
zeek::RecordValPtr args)
|
||||
RecordValPtr args)
|
||||
{
|
||||
auto key = GetKey(tag, args);
|
||||
file_analysis::Analyzer* a = InstantiateAnalyzer(tag, std::move(args));
|
||||
|
@ -89,7 +89,7 @@ bool AnalyzerSet::AddMod::Perform(AnalyzerSet* set)
|
|||
{
|
||||
if ( set->analyzer_map.Lookup(key.get()) )
|
||||
{
|
||||
DBG_LOG(zeek::DBG_FILE_ANALYSIS, "[%s] Add analyzer %s skipped: already exists",
|
||||
DBG_LOG(DBG_FILE_ANALYSIS, "[%s] Add analyzer %s skipped: already exists",
|
||||
a->GetFile()->GetID().c_str(),
|
||||
file_mgr->GetComponentName(a->Tag()).c_str());
|
||||
|
||||
|
@ -108,7 +108,7 @@ void AnalyzerSet::AddMod::Abort()
|
|||
}
|
||||
|
||||
bool AnalyzerSet::Remove(const file_analysis::Tag& tag,
|
||||
zeek::RecordValPtr args)
|
||||
RecordValPtr args)
|
||||
{
|
||||
return Remove(tag, GetKey(tag, std::move(args)));
|
||||
}
|
||||
|
@ -120,12 +120,12 @@ bool AnalyzerSet::Remove(const file_analysis::Tag& tag,
|
|||
|
||||
if ( ! a )
|
||||
{
|
||||
DBG_LOG(zeek::DBG_FILE_ANALYSIS, "[%s] Skip remove analyzer %s",
|
||||
DBG_LOG(DBG_FILE_ANALYSIS, "[%s] Skip remove analyzer %s",
|
||||
file->GetID().c_str(), file_mgr->GetComponentName(tag).c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
DBG_LOG(zeek::DBG_FILE_ANALYSIS, "[%s] Remove analyzer %s",
|
||||
DBG_LOG(DBG_FILE_ANALYSIS, "[%s] Remove analyzer %s",
|
||||
file->GetID().c_str(),
|
||||
file_mgr->GetComponentName(tag).c_str());
|
||||
|
||||
|
@ -140,7 +140,7 @@ bool AnalyzerSet::Remove(const file_analysis::Tag& tag,
|
|||
}
|
||||
|
||||
bool AnalyzerSet::QueueRemove(const file_analysis::Tag& tag,
|
||||
zeek::RecordValPtr args)
|
||||
RecordValPtr args)
|
||||
{
|
||||
auto key = GetKey(tag, std::move(args));
|
||||
auto rval = analyzer_map.Lookup(key.get());
|
||||
|
@ -154,29 +154,29 @@ bool AnalyzerSet::RemoveMod::Perform(AnalyzerSet* set)
|
|||
}
|
||||
|
||||
std::unique_ptr<zeek::detail::HashKey> AnalyzerSet::GetKey(const file_analysis::Tag& t,
|
||||
zeek::RecordValPtr args) const
|
||||
RecordValPtr args) const
|
||||
{
|
||||
auto lv = zeek::make_intrusive<zeek::ListVal>(zeek::TYPE_ANY);
|
||||
auto lv = make_intrusive<ListVal>(TYPE_ANY);
|
||||
lv->Append(t.AsVal());
|
||||
lv->Append(std::move(args));
|
||||
auto key = analyzer_hash->MakeHashKey(*lv, true);
|
||||
|
||||
if ( ! key )
|
||||
zeek::reporter->InternalError("AnalyzerArgs type mismatch");
|
||||
reporter->InternalError("AnalyzerArgs type mismatch");
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
file_analysis::Analyzer* AnalyzerSet::InstantiateAnalyzer(const Tag& tag,
|
||||
zeek::RecordValPtr args) const
|
||||
RecordValPtr args) const
|
||||
{
|
||||
auto a = file_mgr->InstantiateAnalyzer(tag, std::move(args), file);
|
||||
|
||||
if ( ! a )
|
||||
{
|
||||
zeek::reporter->Error("[%s] Failed file analyzer %s instantiation",
|
||||
file->GetID().c_str(),
|
||||
file_mgr->GetComponentName(tag).c_str());
|
||||
reporter->Error("[%s] Failed file analyzer %s instantiation",
|
||||
file->GetID().c_str(),
|
||||
file_mgr->GetComponentName(tag).c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ file_analysis::Analyzer* AnalyzerSet::InstantiateAnalyzer(const Tag& tag,
|
|||
void AnalyzerSet::Insert(file_analysis::Analyzer* a,
|
||||
std::unique_ptr<zeek::detail::HashKey> key)
|
||||
{
|
||||
DBG_LOG(zeek::DBG_FILE_ANALYSIS, "[%s] Add analyzer %s",
|
||||
DBG_LOG(DBG_FILE_ANALYSIS, "[%s] Add analyzer %s",
|
||||
file->GetID().c_str(), file_mgr->GetComponentName(a->Tag()).c_str());
|
||||
analyzer_map.Insert(key.get(), a);
|
||||
|
||||
|
@ -198,7 +198,7 @@ void AnalyzerSet::DrainModifications()
|
|||
if ( mod_queue.empty() )
|
||||
return;
|
||||
|
||||
DBG_LOG(zeek::DBG_FILE_ANALYSIS, "[%s] Start analyzer mod queue flush",
|
||||
DBG_LOG(DBG_FILE_ANALYSIS, "[%s] Start analyzer mod queue flush",
|
||||
file->GetID().c_str());
|
||||
do
|
||||
{
|
||||
|
@ -207,7 +207,7 @@ void AnalyzerSet::DrainModifications()
|
|||
delete mod;
|
||||
mod_queue.pop();
|
||||
} while ( ! mod_queue.empty() );
|
||||
DBG_LOG(zeek::DBG_FILE_ANALYSIS, "[%s] End flushing analyzer mod queue.",
|
||||
DBG_LOG(DBG_FILE_ANALYSIS, "[%s] End flushing analyzer mod queue.",
|
||||
file->GetID().c_str());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue