Update plugin btests for namespace changes

This commit is contained in:
Tim Wojtulewicz 2020-08-21 18:10:39 +00:00
parent 70c2397f69
commit 874e170341
43 changed files with 420 additions and 317 deletions

View file

@ -6,9 +6,10 @@
#include "foo.bif.h"
using namespace analyzer::FOO;
using namespace btest::analyzer::FOO;
using namespace zeek::analyzer;
FOO_Analyzer::FOO_Analyzer(Connection* c) : tcp::TCP_ApplicationAnalyzer("FOO", c)
FOO_Analyzer::FOO_Analyzer(zeek::Connection* c) : tcp::TCP_ApplicationAnalyzer("FOO", c)
{
interp = new binpac::FOO::FOO_Conn(this);
had_gap = false;
@ -53,7 +54,7 @@ void FOO_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
catch ( const binpac::Exception& e )
{
printf("Exception: %s\n", e.c_msg());
ProtocolViolation(fmt("Binpac exception: %s", e.c_msg()));
ProtocolViolation(zeek::util::fmt("Binpac exception: %s", e.c_msg()));
}
}

View file

@ -7,11 +7,11 @@
#include "foo_pac.h"
namespace analyzer { namespace FOO {
namespace btest::analyzer::FOO {
class FOO_Analyzer : public tcp::TCP_ApplicationAnalyzer {
class FOO_Analyzer : public zeek::analyzer::tcp::TCP_ApplicationAnalyzer {
public:
FOO_Analyzer(Connection* conn);
FOO_Analyzer(zeek::Connection* conn);
virtual ~FOO_Analyzer();
// Overriden from Analyzer.
@ -23,7 +23,7 @@ public:
// Overriden from tcp::TCP_ApplicationAnalyzer.
virtual void EndpointEOF(bool is_orig);
static analyzer::Analyzer* InstantiateAnalyzer(Connection* conn)
static zeek::analyzer::Analyzer* InstantiateAnalyzer(zeek::Connection* conn)
{ return new FOO_Analyzer(conn); }
protected:
@ -32,6 +32,6 @@ protected:
};
} } // namespace analyzer::FOO
} // namespace btest::analyzer::FOO
#endif

View file

@ -3,17 +3,16 @@
#include "FOO.h"
namespace plugin {
namespace Foo_FOO {
namespace btest::plugin::Foo_FOO {
class Plugin : public plugin::Plugin {
class Plugin : public zeek::plugin::Plugin {
public:
plugin::Configuration Configure()
zeek::plugin::Configuration Configure()
{
AddComponent(new ::analyzer::Component("FOO",
::analyzer::FOO::FOO_Analyzer::InstantiateAnalyzer));
AddComponent(new zeek::analyzer::Component("FOO",
btest::analyzer::FOO::FOO_Analyzer::InstantiateAnalyzer));
plugin::Configuration config;
zeek::plugin::Configuration config;
config.name = "FOO::Foo";
config.description = "Foo Analyzer analyzer";
config.version.major = 1;
@ -23,4 +22,3 @@ public:
} plugin;
}
}

View file

@ -42,7 +42,7 @@ refine flow FOO_Flow += {
%{
// printf("FOO %d %d\n", msg->hdr()->len(), msg->hdr_len());
connection()->bro_analyzer()->ProtocolConfirmation();
BifEvent::Foo::generate_foo_message(
zeek::BifEvent::Foo::enqueue_foo_message(
connection()->bro_analyzer(),
connection()->bro_analyzer()->Conn(),
is_orig(),
@ -57,4 +57,3 @@ refine flow FOO_Flow += {
refine typeattr FOO_PDU += &let {
proc: bool = $context.flow.proc_foo_message(this);
};