mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 07:08:19 +00:00
FileAnalysis: add unit tests covering current protocol integration.
And had to make various fixes/refinements after scrutinizing results.
This commit is contained in:
parent
b30211c178
commit
59ed5c75f1
72 changed files with 2605 additions and 53 deletions
|
@ -6,7 +6,7 @@
|
|||
using namespace file_analysis;
|
||||
|
||||
Hash::Hash(RecordVal* args, Info* info, HashVal* hv, const char* field)
|
||||
: Action(args, info), hash(hv)
|
||||
: Action(args, info), hash(hv), fed(false)
|
||||
{
|
||||
using BifType::Record::FileAnalysis::ActionResults;
|
||||
if ( (result_field_idx = ActionResults->FieldOffset(field)) < 0 )
|
||||
|
@ -23,6 +23,9 @@ bool Hash::DeliverStream(const u_char* data, uint64 len)
|
|||
{
|
||||
if ( ! hash->IsValid() ) return false;
|
||||
|
||||
if ( ! fed )
|
||||
fed = len > 0;
|
||||
|
||||
hash->Feed(data, len);
|
||||
return true;
|
||||
}
|
||||
|
@ -40,7 +43,7 @@ bool Hash::Undelivered(uint64 offset, uint64 len)
|
|||
|
||||
void Hash::Finalize()
|
||||
{
|
||||
if ( ! hash->IsValid() ) return;
|
||||
if ( ! hash->IsValid() || ! fed ) return;
|
||||
|
||||
StringVal* sv = hash->Get();
|
||||
info->GetResults(args)->Assign(result_field_idx, sv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue