mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 15:18:20 +00:00
Move everything in util.h to zeek::util namespace.
This commit includes renaming a number of methods prefixed with bro_ to be prefixed with zeek_.
This commit is contained in:
parent
8862b585fa
commit
8d2d867a65
179 changed files with 1277 additions and 1033 deletions
|
@ -390,7 +390,7 @@ void File::DeliverStream(const u_char* data, uint64_t len)
|
|||
"[%s] %" PRIu64 " stream bytes in at offset %" PRIu64 "; %s [%s%s]",
|
||||
id.c_str(), len, stream_offset,
|
||||
IsComplete() ? "complete" : "incomplete",
|
||||
fmt_bytes((const char*) data, std::min((uint64_t)40, len)),
|
||||
zeek::util::fmt_bytes((const char*) data, std::min((uint64_t)40, len)),
|
||||
len > 40 ? "..." : "");
|
||||
|
||||
file_analysis::Analyzer* a = nullptr;
|
||||
|
@ -494,7 +494,7 @@ void File::DeliverChunk(const u_char* data, uint64_t len, uint64_t offset)
|
|||
"[%s] %" PRIu64 " chunk bytes in at offset %" PRIu64 "; %s [%s%s]",
|
||||
id.c_str(), len, offset,
|
||||
IsComplete() ? "complete" : "incomplete",
|
||||
fmt_bytes((const char*) data, std::min((uint64_t)40, len)),
|
||||
zeek::util::fmt_bytes((const char*) data, std::min((uint64_t)40, len)),
|
||||
len > 40 ? "..." : "");
|
||||
|
||||
file_analysis::Analyzer* a = nullptr;
|
||||
|
|
|
@ -22,7 +22,7 @@ Extract::Extract(zeek::RecordValPtr args, zeek::file_analysis::File* file,
|
|||
{
|
||||
fd = 0;
|
||||
char buf[128];
|
||||
bro_strerror_r(errno, buf, sizeof(buf));
|
||||
zeek::util::zeek_strerror_r(errno, buf, sizeof(buf));
|
||||
zeek::reporter->Error("cannot open %s: %s", filename.c_str(), buf);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ Extract::Extract(zeek::RecordValPtr args, zeek::file_analysis::File* file,
|
|||
Extract::~Extract()
|
||||
{
|
||||
if ( fd )
|
||||
safe_close(fd);
|
||||
zeek::util::safe_close(fd);
|
||||
}
|
||||
|
||||
static const zeek::ValPtr& get_extract_field_val(const zeek::RecordValPtr& args,
|
||||
|
@ -107,7 +107,7 @@ bool Extract::DeliverStream(const u_char* data, uint64_t len)
|
|||
|
||||
if ( towrite > 0 )
|
||||
{
|
||||
safe_write(fd, reinterpret_cast<const char*>(data), towrite);
|
||||
zeek::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]();
|
||||
safe_write(fd, tmp, len);
|
||||
zeek::util::safe_write(fd, tmp, len);
|
||||
delete [] tmp;
|
||||
depth += len;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace zeek::file_analysis::detail {
|
|||
|
||||
Hash::Hash(zeek::RecordValPtr args, zeek::file_analysis::File* file,
|
||||
zeek::HashVal* hv, const char* arg_kind)
|
||||
: zeek::file_analysis::Analyzer(zeek::file_mgr->GetComponentTag(to_upper(arg_kind).c_str()),
|
||||
: zeek::file_analysis::Analyzer(zeek::file_mgr->GetComponentTag(zeek::util::to_upper(arg_kind).c_str()),
|
||||
std::move(args), file),
|
||||
hash(hv), fed(false), kind(arg_kind)
|
||||
{
|
||||
|
|
|
@ -261,7 +261,7 @@ X509_STORE* X509::GetRootStore(zeek::TableVal* root_certs)
|
|||
::X509* x = d2i_X509(NULL, &data, sv->Len());
|
||||
if ( ! x )
|
||||
{
|
||||
zeek::emit_builtin_error(fmt("Root CA error: %s", ERR_error_string(ERR_get_error(), NULL)));
|
||||
zeek::emit_builtin_error(zeek::util::fmt("Root CA error: %s", ERR_error_string(ERR_get_error(), NULL)));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ void X509::ParseSAN(X509_EXTENSION* ext)
|
|||
|
||||
else
|
||||
{
|
||||
zeek::reporter->Weird(GetFile(), "x509_san_ip_length", fmt("%d", gen->d.ip->length));
|
||||
zeek::reporter->Weird(GetFile(), "x509_san_ip_length", zeek::util::fmt("%d", gen->d.ip->length));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ STACK_OF(X509)* x509_get_untrusted_stack(zeek::VectorVal* certs_vec)
|
|||
STACK_OF(X509)* untrusted_certs = sk_X509_new_null();
|
||||
if ( ! untrusted_certs )
|
||||
{
|
||||
zeek::emit_builtin_error(fmt("Untrusted certificate stack initialization error: %s",
|
||||
zeek::emit_builtin_error(zeek::util::fmt("Untrusted certificate stack initialization error: %s",
|
||||
ERR_error_string(ERR_get_error(),NULL)));
|
||||
return 0;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ STACK_OF(X509)* x509_get_untrusted_stack(zeek::VectorVal* certs_vec)
|
|||
if ( ! x )
|
||||
{
|
||||
sk_X509_free(untrusted_certs);
|
||||
zeek::emit_builtin_error(fmt("No certificate in opaque in stack"));
|
||||
zeek::emit_builtin_error(zeek::util::fmt("No certificate in opaque in stack"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ function x509_ocsp_verify%(certs: x509_opaque_vector, ocsp_reply: string, root_c
|
|||
X509* cert = cert_handle->GetCertificate();
|
||||
if ( ! cert )
|
||||
{
|
||||
zeek::emit_builtin_error(fmt("No certificate in opaque"));
|
||||
zeek::emit_builtin_error(zeek::util::fmt("No certificate in opaque"));
|
||||
return x509_result_record(-1, "No certificate in opaque");
|
||||
}
|
||||
|
||||
|
@ -528,7 +528,7 @@ function x509_verify%(certs: x509_opaque_vector, root_certs: table_string_of_str
|
|||
X509* cert = cert_handle->GetCertificate();
|
||||
if ( ! cert )
|
||||
{
|
||||
zeek::emit_builtin_error(fmt("No certificate in opaque"));
|
||||
zeek::emit_builtin_error(zeek::util::fmt("No certificate in opaque"));
|
||||
return x509_result_record(-1, "No certificate in opaque");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue