mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Merge remote-tracking branch 'origin/topic/bernhard/reader-info'
* origin/topic/bernhard/reader-info: fix small bug - now configuration actually is passed. add mode to readerinfo - no need to have it separately everywhere anymore. introduce reader-info struct analogous to writer-info. Introduce support for a table of key/value pairs with further configuration options, with the same userinterface as in the logging interface. make writer-info work when debugging is enabled Conflicts: testing/btest/Baseline/scripts.base.frameworks.input.event/out testing/btest/Baseline/scripts.base.frameworks.input.executeraw/out testing/btest/Baseline/scripts.base.frameworks.input.raw/out testing/btest/Baseline/scripts.base.frameworks.input.rereadraw/out testing/btest/Baseline/scripts.base.frameworks.input.tableevent/out Closes #841.
This commit is contained in:
commit
06d2fd52bd
18 changed files with 213 additions and 106 deletions
|
@ -11,19 +11,18 @@ namespace input {
|
|||
class InitMessage : public threading::InputMessage<ReaderBackend>
|
||||
{
|
||||
public:
|
||||
InitMessage(ReaderBackend* backend, const string source, ReaderMode mode,
|
||||
InitMessage(ReaderBackend* backend, const ReaderBackend::ReaderInfo& info,
|
||||
const int num_fields, const threading::Field* const* fields)
|
||||
: threading::InputMessage<ReaderBackend>("Init", backend),
|
||||
source(source), mode(mode), num_fields(num_fields), fields(fields) { }
|
||||
info(info), num_fields(num_fields), fields(fields) { }
|
||||
|
||||
virtual bool Process()
|
||||
{
|
||||
return Object()->Init(source, mode, num_fields, fields);
|
||||
return Object()->Init(info, num_fields, fields);
|
||||
}
|
||||
|
||||
private:
|
||||
const string source;
|
||||
const ReaderMode mode;
|
||||
const ReaderBackend::ReaderInfo info;
|
||||
const int num_fields;
|
||||
const threading::Field* const* fields;
|
||||
};
|
||||
|
@ -63,8 +62,8 @@ ReaderFrontend::~ReaderFrontend()
|
|||
{
|
||||
}
|
||||
|
||||
void ReaderFrontend::Init(string arg_source, ReaderMode mode, const int num_fields,
|
||||
const threading::Field* const* fields)
|
||||
void ReaderFrontend::Init(const ReaderBackend::ReaderInfo& arg_info, const int arg_num_fields,
|
||||
const threading::Field* const* arg_fields)
|
||||
{
|
||||
if ( disabled )
|
||||
return;
|
||||
|
@ -72,10 +71,12 @@ void ReaderFrontend::Init(string arg_source, ReaderMode mode, const int num_fiel
|
|||
if ( initialized )
|
||||
reporter->InternalError("reader initialize twice");
|
||||
|
||||
source = arg_source;
|
||||
info = arg_info;
|
||||
num_fields = arg_num_fields;
|
||||
fields = arg_fields;
|
||||
initialized = true;
|
||||
|
||||
backend->SendIn(new InitMessage(backend, arg_source, mode, num_fields, fields));
|
||||
backend->SendIn(new InitMessage(backend, info, num_fields, fields));
|
||||
}
|
||||
|
||||
void ReaderFrontend::Update()
|
||||
|
@ -109,10 +110,10 @@ void ReaderFrontend::Close()
|
|||
|
||||
string ReaderFrontend::Name() const
|
||||
{
|
||||
if ( source.size() )
|
||||
if ( ! info.source.size() )
|
||||
return ty_name;
|
||||
|
||||
return ty_name + "/" + source;
|
||||
return ty_name + "/" + info.source;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue