mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Extend the file analyzer API to set source manually.
The API didn't offer methods for passing in data that allow setting all of offset, source and MIME type. Adding overloads for that (no breakage to existing APIs).
This commit is contained in:
parent
f38eae06f1
commit
355ecc0c43
2 changed files with 49 additions and 2 deletions
|
@ -149,7 +149,7 @@ string Manager::DataIn(const u_char* data, uint64_t len, const analyzer::Tag& ta
|
|||
}
|
||||
|
||||
void Manager::DataIn(const u_char* data, uint64_t len, const string& file_id,
|
||||
const string& source)
|
||||
const string& source, const string& mime_type)
|
||||
{
|
||||
File* file = GetFile(file_id, nullptr, analyzer::Tag::Error, false, false,
|
||||
source.c_str());
|
||||
|
@ -157,12 +157,34 @@ void Manager::DataIn(const u_char* data, uint64_t len, const string& file_id,
|
|||
if ( ! file )
|
||||
return;
|
||||
|
||||
if ( ! mime_type.empty() )
|
||||
file->SetMime(mime_type);
|
||||
|
||||
file->DataIn(data, len);
|
||||
|
||||
if ( file->IsComplete() )
|
||||
RemoveFile(file->GetID());
|
||||
}
|
||||
|
||||
void Manager::DataIn(const u_char* data, uint64_t len, uint64_t offset,
|
||||
const string& file_id, const string& source,
|
||||
const string& mime_type)
|
||||
{
|
||||
File* file = GetFile(file_id, nullptr, analyzer::Tag::Error, false, false,
|
||||
source.c_str());
|
||||
|
||||
if ( ! file )
|
||||
return;
|
||||
|
||||
if ( ! mime_type.empty() )
|
||||
file->SetMime(mime_type);
|
||||
|
||||
file->DataIn(data, len, offset);
|
||||
|
||||
if ( file->IsComplete() )
|
||||
RemoveFile(file->GetID());
|
||||
}
|
||||
|
||||
void Manager::EndOfFile(const analyzer::Tag& tag, Connection* conn)
|
||||
{
|
||||
EndOfFile(tag, conn, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue