mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Minor API changes to analyzers.
This commit is contained in:
parent
d34f23c8d4
commit
d727af097b
6 changed files with 27 additions and 12 deletions
|
@ -644,12 +644,12 @@ void Analyzer::FlipRoles()
|
|||
resp_supporters = tmp;
|
||||
}
|
||||
|
||||
void Analyzer::ProtocolConfirmation()
|
||||
void Analyzer::ProtocolConfirmation(Tag arg_tag)
|
||||
{
|
||||
if ( protocol_confirmed )
|
||||
return;
|
||||
|
||||
EnumVal* tval = tag.AsEnumVal();
|
||||
EnumVal* tval = arg_tag ? arg_tag.AsEnumVal() : tag.AsEnumVal();
|
||||
Ref(tval);
|
||||
|
||||
val_list* vl = new val_list;
|
||||
|
|
|
@ -97,8 +97,8 @@ public:
|
|||
|
||||
/**
|
||||
* Constructor. As this version of the constructor does not receive a
|
||||
* name or tag, setTag() must be called before the instance can be
|
||||
* used.
|
||||
* name or tag, SetAnalyzerTag() must be called before the instance
|
||||
* can be used.
|
||||
*
|
||||
* @param conn The connection the analyzer is associated with.
|
||||
*/
|
||||
|
@ -471,8 +471,11 @@ public:
|
|||
* may turn into \c protocol_confirmed event at the script-layer (but
|
||||
* only once per analyzer for each connection, even if the method is
|
||||
* called multiple times).
|
||||
*
|
||||
* If tag is given, it overrides the analyzer tag passed to the
|
||||
* scripting layer; the default is the one of the analyzer itself.
|
||||
*/
|
||||
virtual void ProtocolConfirmation();
|
||||
virtual void ProtocolConfirmation(Tag tag = Tag());
|
||||
|
||||
/**
|
||||
* Signals Bro's protocol detection that the analyzer has found a
|
||||
|
|
|
@ -17,6 +17,8 @@ Component::Component(const char* arg_name, factory_callback arg_factory, Tag::su
|
|||
factory = arg_factory;
|
||||
enabled = arg_enabled;
|
||||
partial = arg_partial;
|
||||
|
||||
analyzer_mgr->RegisterComponent(this, "ANALYZER_");
|
||||
}
|
||||
|
||||
Component::Component(const Component& other)
|
||||
|
@ -28,6 +30,8 @@ Component::Component(const Component& other)
|
|||
factory = other.factory;
|
||||
enabled = other.enabled;
|
||||
partial = other.partial;
|
||||
|
||||
// TODO: Do we need the RegisterComponent() call here?
|
||||
}
|
||||
|
||||
Component::~Component()
|
||||
|
|
|
@ -86,11 +86,6 @@ Manager::~Manager()
|
|||
|
||||
void Manager::InitPreScript()
|
||||
{
|
||||
std::list<Component*> analyzers = plugin_mgr->Components<Component>();
|
||||
|
||||
for ( std::list<Component*>::const_iterator i = analyzers.begin(); i != analyzers.end(); i++ )
|
||||
RegisterComponent(*i, "ANALYZER_");
|
||||
|
||||
// Cache these tags.
|
||||
analyzer_backdoor = GetComponentTag("BACKDOOR");
|
||||
analyzer_connsize = GetComponentTag("CONNSIZE");
|
||||
|
@ -202,6 +197,11 @@ void Manager::DisableAllAnalyzers()
|
|||
(*i)->SetEnabled(false);
|
||||
}
|
||||
|
||||
analyzer::Tag Manager::GetAnalyzerTag(const char* name)
|
||||
{
|
||||
return GetComponentTag(name);
|
||||
}
|
||||
|
||||
bool Manager::IsEnabled(Tag tag)
|
||||
{
|
||||
if ( ! tag )
|
||||
|
|
|
@ -133,6 +133,14 @@ public:
|
|||
*/
|
||||
void DisableAllAnalyzers();
|
||||
|
||||
/**
|
||||
* Returns the tag associated with an analyer name, or the tag
|
||||
* associated with an error if no such analyzer exists.
|
||||
*
|
||||
* @param name The canonical analyzer name to check.
|
||||
*/
|
||||
Tag GetAnalyzerTag(const char* name);
|
||||
|
||||
/**
|
||||
* Returns true if an analyzer is enabled.
|
||||
*
|
||||
|
|
|
@ -294,8 +294,8 @@ public:
|
|||
// TCP_ENDPOINT_RESET. If gen_event is true and the connection
|
||||
// is now fully closed, a connection_finished event will be
|
||||
// generated; otherwise not.
|
||||
virtual void ConnectionClosed(TCP_Endpoint* endpoint,
|
||||
TCP_Endpoint* peer, int gen_event);
|
||||
virtual void ConnectionClosed(analyzer::tcp::TCP_Endpoint* endpoint,
|
||||
analyzer::tcp::TCP_Endpoint* peer, int gen_event);
|
||||
virtual void ConnectionFinished(int half_finished);
|
||||
virtual void ConnectionReset();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue