mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Plugins: Clean up explicit uses of namespaces in places where they're not necessary.
This commit covers all of the plugin classes.
This commit is contained in:
parent
fe0c22c789
commit
70c2397f69
169 changed files with 3139 additions and 3141 deletions
|
@ -10,9 +10,9 @@
|
|||
|
||||
namespace zeek::file_analysis::detail {
|
||||
|
||||
Extract::Extract(zeek::RecordValPtr args, zeek::file_analysis::File* file,
|
||||
Extract::Extract(RecordValPtr args, file_analysis::File* file,
|
||||
const std::string& arg_filename, uint64_t arg_limit)
|
||||
: file_analysis::Analyzer(zeek::file_mgr->GetComponentTag("EXTRACT"),
|
||||
: file_analysis::Analyzer(file_mgr->GetComponentTag("EXTRACT"),
|
||||
std::move(args), file),
|
||||
filename(arg_filename), limit(arg_limit), depth(0)
|
||||
{
|
||||
|
@ -22,30 +22,30 @@ Extract::Extract(zeek::RecordValPtr args, zeek::file_analysis::File* file,
|
|||
{
|
||||
fd = 0;
|
||||
char buf[128];
|
||||
zeek::util::zeek_strerror_r(errno, buf, sizeof(buf));
|
||||
zeek::reporter->Error("cannot open %s: %s", filename.c_str(), buf);
|
||||
util::zeek_strerror_r(errno, buf, sizeof(buf));
|
||||
reporter->Error("cannot open %s: %s", filename.c_str(), buf);
|
||||
}
|
||||
}
|
||||
|
||||
Extract::~Extract()
|
||||
{
|
||||
if ( fd )
|
||||
zeek::util::safe_close(fd);
|
||||
util::safe_close(fd);
|
||||
}
|
||||
|
||||
static const zeek::ValPtr& get_extract_field_val(const zeek::RecordValPtr& args,
|
||||
const char* name)
|
||||
static const ValPtr& get_extract_field_val(const RecordValPtr& args,
|
||||
const char* name)
|
||||
{
|
||||
const auto& rval = args->GetField(name);
|
||||
|
||||
if ( ! rval )
|
||||
zeek::reporter->Error("File extraction analyzer missing arg field: %s", name);
|
||||
reporter->Error("File extraction analyzer missing arg field: %s", name);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
zeek::file_analysis::Analyzer* Extract::Instantiate(zeek::RecordValPtr args,
|
||||
zeek::file_analysis::File* file)
|
||||
file_analysis::Analyzer* Extract::Instantiate(RecordValPtr args,
|
||||
file_analysis::File* file)
|
||||
{
|
||||
const auto& fname = get_extract_field_val(args, "extract_filename");
|
||||
const auto& limit = get_extract_field_val(args, "extract_limit");
|
||||
|
@ -93,12 +93,12 @@ bool Extract::DeliverStream(const u_char* data, uint64_t len)
|
|||
|
||||
if ( limit_exceeded && file_extraction_limit )
|
||||
{
|
||||
zeek::file_analysis::File* f = GetFile();
|
||||
file_analysis::File* f = GetFile();
|
||||
f->FileEvent(file_extraction_limit, {
|
||||
f->ToVal(),
|
||||
GetArgs(),
|
||||
zeek::val_mgr->Count(limit),
|
||||
zeek::val_mgr->Count(len)
|
||||
val_mgr->Count(limit),
|
||||
val_mgr->Count(len)
|
||||
});
|
||||
|
||||
// Limit may have been modified by a BIF, re-check it.
|
||||
|
@ -107,7 +107,7 @@ bool Extract::DeliverStream(const u_char* data, uint64_t len)
|
|||
|
||||
if ( towrite > 0 )
|
||||
{
|
||||
zeek::util::safe_write(fd, reinterpret_cast<const char*>(data), towrite);
|
||||
util::safe_write(fd, reinterpret_cast<const char*>(data), towrite);
|
||||
depth += towrite;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ bool Extract::Undelivered(uint64_t offset, uint64_t len)
|
|||
if ( depth == offset )
|
||||
{
|
||||
char* tmp = new char[len]();
|
||||
zeek::util::safe_write(fd, tmp, len);
|
||||
util::safe_write(fd, tmp, len);
|
||||
delete [] tmp;
|
||||
depth += len;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace zeek::file_analysis::detail {
|
|||
/**
|
||||
* An analyzer to extract content of files to local disk.
|
||||
*/
|
||||
class Extract : public zeek::file_analysis::Analyzer {
|
||||
class Extract : public file_analysis::Analyzer {
|
||||
public:
|
||||
|
||||
/**
|
||||
|
@ -47,8 +47,8 @@ public:
|
|||
* @return the new Extract analyzer instance or a null pointer if the
|
||||
* the "extraction_file" field of \a args wasn't set.
|
||||
*/
|
||||
static zeek::file_analysis::Analyzer* Instantiate(zeek::RecordValPtr args,
|
||||
zeek::file_analysis::File* file);
|
||||
static file_analysis::Analyzer* Instantiate(RecordValPtr args,
|
||||
file_analysis::File* file);
|
||||
|
||||
/**
|
||||
* Sets the maximum allowed extracted file size. A value of zero means
|
||||
|
@ -67,7 +67,7 @@ protected:
|
|||
* to which the contents of the file will be extracted/written.
|
||||
* @param arg_limit the maximum allowed file size.
|
||||
*/
|
||||
Extract(zeek::RecordValPtr args, zeek::file_analysis::File* file,
|
||||
Extract(RecordValPtr args, file_analysis::File* file,
|
||||
const std::string& arg_filename, uint64_t arg_limit);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue