mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
* rework script interface, add autostart stream flag that starts up a stream automatically when first filter has been added ( probably the most common use case )
* change internal reader interface again * remove some quite embarassing bugs that must have been in the interface for rather long * add different read methods to script & internal interface (like normal, streaming, etc). Not implemented in ascii reader yet.
This commit is contained in:
parent
de149ff55e
commit
91943c2655
18 changed files with 191 additions and 43 deletions
|
@ -214,6 +214,10 @@ ReaderFrontend* Manager::CreateStream(EnumVal* id, RecordVal* description)
|
|||
}
|
||||
|
||||
EnumVal* reader = description->LookupWithDefault(rtype->FieldOffset("reader"))->AsEnumVal();
|
||||
EnumVal* mode = description->LookupWithDefault(rtype->FieldOffset("mode"))->AsEnumVal();
|
||||
Val *autostart = description->LookupWithDefault(rtype->FieldOffset("autostart"));
|
||||
bool do_autostart = ( autostart->InternalInt() == 1 );
|
||||
Unref(autostart); // Ref'd by LookupWithDefault
|
||||
|
||||
ReaderFrontend* reader_obj = new ReaderFrontend(reader->InternalInt());
|
||||
assert(reader_obj);
|
||||
|
@ -229,16 +233,7 @@ ReaderFrontend* Manager::CreateStream(EnumVal* id, RecordVal* description)
|
|||
|
||||
readers.push_back(info);
|
||||
|
||||
reader_obj->Init(source);
|
||||
/* if ( success == false ) {
|
||||
assert( RemoveStream(id) );
|
||||
return 0;
|
||||
} */
|
||||
reader_obj->Update();
|
||||
/* if ( success == false ) {
|
||||
assert ( RemoveStream(id) );
|
||||
return 0;
|
||||
} */
|
||||
reader_obj->Init(source, mode->InternalInt(), do_autostart);
|
||||
|
||||
return reader_obj;
|
||||
|
||||
|
@ -785,7 +780,7 @@ int Manager::SendEntryTable(const ReaderFrontend* reader, const int id, const Va
|
|||
//reporter->Error("Hashing %d val fields", i->num_val_fields);
|
||||
HashKey* valhash = 0;
|
||||
if ( filter->num_val_fields > 0 )
|
||||
HashValues(filter->num_val_fields, vals+filter->num_idx_fields);
|
||||
valhash = HashValues(filter->num_val_fields, vals+filter->num_idx_fields);
|
||||
|
||||
//reporter->Error("Result: %d", (uint64_t) valhash->Hash());
|
||||
|
||||
|
@ -794,6 +789,13 @@ int Manager::SendEntryTable(const ReaderFrontend* reader, const int id, const Va
|
|||
InputHash *h = filter->lastDict->Lookup(idxhash);
|
||||
if ( h != 0 ) {
|
||||
// seen before
|
||||
|
||||
valhash->Hash();
|
||||
|
||||
h->valhash->Hash();
|
||||
|
||||
|
||||
|
||||
if ( filter->num_val_fields == 0 || h->valhash->Hash() == valhash->Hash() ) {
|
||||
// ok, exact duplicate
|
||||
filter->lastDict->Remove(idxhash);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue