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

@ -10,13 +10,13 @@
#include "threading/SerialTypes.h"
#include "threading/Manager.h"
using namespace input::reader;
using threading::Value;
using threading::Field;
using namespace btest::input::reader;
using zeek::threading::Value;
using zeek::threading::Field;
Foo::Foo(ReaderFrontend *frontend) : ReaderBackend(frontend)
Foo::Foo(zeek::input::ReaderFrontend *frontend) : zeek::input::ReaderBackend(frontend)
{
ascii = new threading::formatter::Ascii(this, threading::formatter::Ascii::SeparatorInfo());
ascii = new zeek::threading::formatter::Ascii(this, zeek::threading::formatter::Ascii::SeparatorInfo());
}
Foo::~Foo()
@ -29,7 +29,7 @@ void Foo::DoClose()
{
}
bool Foo::DoInit(const ReaderInfo& info, int num_fields, const Field* const* fields)
bool Foo::DoInit(const zeek::input::ReaderBackend::ReaderInfo& info, int num_fields, const Field* const* fields)
{
DoUpdate();
return true;
@ -71,7 +71,7 @@ bool Foo::DoUpdate()
return true;
}
threading::Value* Foo::EntryToVal(zeek::TypeTag type, zeek::TypeTag subtype)
zeek::threading::Value* Foo::EntryToVal(zeek::TypeTag type, zeek::TypeTag subtype)
{
Value* val = new Value(type, true);

View file

@ -4,28 +4,29 @@
#include "input/ReaderBackend.h"
#include "threading/formatters/Ascii.h"
namespace input { namespace reader {
namespace btest::input::reader {
/**
* A Foo reader to measure performance of the input framework.
*/
class Foo : public ReaderBackend {
class Foo : public zeek::input::ReaderBackend {
public:
Foo(ReaderFrontend* frontend);
Foo(zeek::input::ReaderFrontend* frontend);
~Foo();
static ReaderBackend* Instantiate(ReaderFrontend* frontend) { return new Foo(frontend); }
static zeek::input::ReaderBackend* Instantiate(zeek::input::ReaderFrontend* frontend) { return new Foo(frontend); }
protected:
virtual bool DoInit(const ReaderInfo& info, int arg_num_fields, const threading::Field* const* fields);
virtual bool DoInit(const zeek::input::ReaderBackend::ReaderInfo& info, int arg_num_fields,
const zeek::threading::Field* const* fields);
virtual void DoClose();
virtual bool DoUpdate();
virtual bool DoHeartbeat(double network_time, double current_time);
private:
std::string RandomString(const int len);
threading::Value* EntryToVal(zeek::TypeTag Type, zeek::TypeTag subtype);
threading::formatter::Ascii* ascii;
zeek::threading::Value* EntryToVal(zeek::TypeTag Type, zeek::TypeTag subtype);
zeek::threading::formatter::Ascii* ascii;
};
} }
}

View file

@ -2,15 +2,15 @@
#include "Foo.h"
namespace plugin { namespace Demo_Foo { Plugin plugin; } }
namespace btest::plugin::Demo_Foo { Plugin plugin; }
using namespace plugin::Demo_Foo;
using namespace btest::plugin::Demo_Foo;
plugin::Configuration Plugin::Configure()
zeek::plugin::Configuration Plugin::Configure()
{
AddComponent(new ::input::Component("Foo", ::input::reader::Foo::Instantiate));
AddComponent(new zeek::input::Component("Foo", btest::input::reader::Foo::Instantiate));
plugin::Configuration config;
zeek::plugin::Configuration config;
config.name = "Demo::Foo";
config.description = "A Foo test input reader";
config.version.major = 1;

View file

@ -3,17 +3,15 @@
#include <plugin/Plugin.h>
namespace plugin {
namespace Demo_Foo {
namespace btest::plugin::Demo_Foo {
class Plugin : public ::plugin::Plugin
class Plugin : public zeek::plugin::Plugin
{
protected:
// Overridden from plugin::Plugin.
virtual plugin::Configuration Configure();
virtual zeek::plugin::Configuration Configure();
};
extern Plugin plugin;
}
}