mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Move ODesc to zeek namespace
This commit is contained in:
parent
fdcb2760b2
commit
4e9a5e9d98
53 changed files with 162 additions and 143 deletions
|
@ -627,7 +627,7 @@ unsigned int Connection::MemoryAllocationConnVal() const
|
|||
return conn_val ? conn_val->MemoryAllocation() : 0;
|
||||
}
|
||||
|
||||
void Connection::Describe(ODesc* d) const
|
||||
void Connection::Describe(zeek::ODesc* d) const
|
||||
{
|
||||
d->Add(start_time);
|
||||
d->Add("(");
|
||||
|
@ -674,7 +674,7 @@ void Connection::Describe(ODesc* d) const
|
|||
d->NL();
|
||||
}
|
||||
|
||||
void Connection::IDString(ODesc* d) const
|
||||
void Connection::IDString(zeek::ODesc* d) const
|
||||
{
|
||||
d->Add(orig_addr);
|
||||
d->AddRaw(":", 1);
|
||||
|
|
|
@ -261,8 +261,8 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
void Describe(ODesc* d) const override;
|
||||
void IDString(ODesc* d) const;
|
||||
void Describe(zeek::ODesc* d) const override;
|
||||
void IDString(zeek::ODesc* d) const;
|
||||
|
||||
// Statistics.
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#define DEFAULT_SIZE 128
|
||||
#define SLOP 10
|
||||
|
||||
namespace zeek {
|
||||
|
||||
ODesc::ODesc(desc_type t, zeek::File* arg_f)
|
||||
{
|
||||
type = t;
|
||||
|
@ -424,3 +426,5 @@ bool ODesc::FindType(const zeek::Type* type)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace zeek
|
||||
|
|
36
src/Desc.h
36
src/Desc.h
|
@ -11,17 +11,6 @@
|
|||
|
||||
#include <sys/types.h> // for u_char
|
||||
|
||||
typedef enum {
|
||||
DESC_READABLE,
|
||||
DESC_PORTABLE,
|
||||
DESC_BINARY,
|
||||
} desc_type;
|
||||
|
||||
typedef enum {
|
||||
STANDARD_STYLE,
|
||||
RAW_STYLE,
|
||||
} desc_style;
|
||||
|
||||
namespace zeek { class File; }
|
||||
using BroFile [[deprecated("Remove in v4.1. Use zeek::File.")]] = zeek::File;
|
||||
|
||||
|
@ -31,6 +20,19 @@ ZEEK_FORWARD_DECLARE_NAMESPACED(IPPrefix, zeek);
|
|||
namespace zeek { class Type; }
|
||||
using BroType [[deprecated("Remove in v4.1. Use zeek::Type instead.")]] = zeek::Type;
|
||||
|
||||
namespace zeek {
|
||||
|
||||
enum desc_type {
|
||||
DESC_READABLE,
|
||||
DESC_PORTABLE,
|
||||
DESC_BINARY,
|
||||
};
|
||||
|
||||
enum desc_style {
|
||||
STANDARD_STYLE,
|
||||
RAW_STYLE,
|
||||
};
|
||||
|
||||
class ODesc {
|
||||
public:
|
||||
explicit ODesc(desc_type t=DESC_READABLE, zeek::File* f=nullptr);
|
||||
|
@ -210,3 +212,15 @@ protected:
|
|||
|
||||
std::set<const zeek::Type*> encountered_types;
|
||||
};
|
||||
|
||||
} // namespace zeek
|
||||
|
||||
using ODesc [[deprecated("Remove in v4.1. Use zeek::ODesc.")]] = zeek::ODesc;
|
||||
using desc_type [[deprecated("Remove in v4.1. Use zeek::desc_type.")]] = zeek::desc_type;
|
||||
constexpr auto DESC_READABLE [[deprecated("Remove in v4.1. Use zeek::DESC_READABLE.")]] = zeek::DESC_READABLE;
|
||||
constexpr auto DESC_PORTABLE [[deprecated("Remove in v4.1. Use zeek::DESC_PORTABLE.")]] = zeek::DESC_PORTABLE;
|
||||
constexpr auto DESC_BINARY [[deprecated("Remove in v4.1. Use zeek::DESC_BINARY.")]] = zeek::DESC_BINARY;
|
||||
|
||||
using desc_style [[deprecated("Remove in v4.1. Use zeek::desc_style.")]] = zeek::desc_style;
|
||||
constexpr auto STANDARD_STYLE [[deprecated("Remove in v4.1. Use zeek::STANDARD_STYLE.")]] = zeek::STANDARD_STYLE;
|
||||
constexpr auto RAW_STYLE [[deprecated("Remove in v4.1. Use zeek::RAW_STYLE.")]] = zeek::RAW_STYLE;
|
||||
|
|
22
src/Obj.cc
22
src/Obj.cc
|
@ -16,7 +16,7 @@ namespace detail {
|
|||
Location start_location("<start uninitialized>", 0, 0, 0, 0);
|
||||
Location end_location("<end uninitialized>", 0, 0, 0, 0);
|
||||
|
||||
void Location::Describe(ODesc* d) const
|
||||
void Location::Describe(zeek::ODesc* d) const
|
||||
{
|
||||
if ( filename )
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ Obj::~Obj()
|
|||
|
||||
void Obj::Warn(const char* msg, const Obj* obj2, bool pinpoint_only, const detail::Location* expr_location) const
|
||||
{
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
DoMsg(&d, msg, obj2, pinpoint_only, expr_location);
|
||||
zeek::reporter->Warning("%s", d.Description());
|
||||
zeek::reporter->PopLocation();
|
||||
|
@ -76,7 +76,7 @@ void Obj::Error(const char* msg, const Obj* obj2, bool pinpoint_only, const deta
|
|||
if ( suppress_errors )
|
||||
return;
|
||||
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
DoMsg(&d, msg, obj2, pinpoint_only, expr_location);
|
||||
zeek::reporter->Error("%s", d.Description());
|
||||
zeek::reporter->PopLocation();
|
||||
|
@ -93,7 +93,7 @@ void Obj::BadTag(const char* msg, const char* t1, const char* t2) const
|
|||
else
|
||||
snprintf(out, sizeof(out), "%s", msg);
|
||||
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
DoMsg(&d, out);
|
||||
zeek::reporter->FatalErrorWithCore("%s", d.Description());
|
||||
zeek::reporter->PopLocation();
|
||||
|
@ -101,7 +101,7 @@ void Obj::BadTag(const char* msg, const char* t1, const char* t2) const
|
|||
|
||||
void Obj::Internal(const char* msg) const
|
||||
{
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
DoMsg(&d, msg);
|
||||
auto rcs = zeek::render_call_stack();
|
||||
|
||||
|
@ -115,13 +115,13 @@ void Obj::Internal(const char* msg) const
|
|||
|
||||
void Obj::InternalWarning(const char* msg) const
|
||||
{
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
DoMsg(&d, msg);
|
||||
zeek::reporter->InternalWarning("%s", d.Description());
|
||||
zeek::reporter->PopLocation();
|
||||
}
|
||||
|
||||
void Obj::AddLocation(ODesc* d) const
|
||||
void Obj::AddLocation(zeek::ODesc* d) const
|
||||
{
|
||||
if ( ! location )
|
||||
{
|
||||
|
@ -162,8 +162,8 @@ void Obj::UpdateLocationEndInfo(const detail::Location& end)
|
|||
location->last_column = end.last_column;
|
||||
}
|
||||
|
||||
void Obj::DoMsg(ODesc* d, const char s1[], const Obj* obj2,
|
||||
bool pinpoint_only, const detail::Location* expr_location) const
|
||||
void Obj::DoMsg(zeek::ODesc* d, const char s1[], const Obj* obj2,
|
||||
bool pinpoint_only, const detail::Location* expr_location) const
|
||||
{
|
||||
d->SetShort();
|
||||
|
||||
|
@ -180,7 +180,7 @@ void Obj::DoMsg(ODesc* d, const char s1[], const Obj* obj2,
|
|||
zeek::reporter->PushLocation(GetLocationInfo(), loc2);
|
||||
}
|
||||
|
||||
void Obj::PinPoint(ODesc* d, const Obj* obj2, bool pinpoint_only) const
|
||||
void Obj::PinPoint(zeek::ODesc* d, const Obj* obj2, bool pinpoint_only) const
|
||||
{
|
||||
d->Add(" (");
|
||||
Describe(d);
|
||||
|
@ -196,7 +196,7 @@ void Obj::PinPoint(ODesc* d, const Obj* obj2, bool pinpoint_only) const
|
|||
void Obj::Print() const
|
||||
{
|
||||
static zeek::File fstderr(stderr);
|
||||
ODesc d(DESC_READABLE, &fstderr);
|
||||
zeek::ODesc d(DESC_READABLE, &fstderr);
|
||||
Describe(&d);
|
||||
d.Add("\n");
|
||||
}
|
||||
|
|
18
src/Obj.h
18
src/Obj.h
|
@ -2,9 +2,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "zeek-config.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
class ODesc;
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
|
||||
|
||||
namespace zeek {
|
||||
namespace detail {
|
||||
|
@ -19,7 +21,7 @@ public:
|
|||
|
||||
Location() = default;
|
||||
|
||||
void Describe(ODesc* d) const;
|
||||
void Describe(zeek::ODesc* d) const;
|
||||
|
||||
bool operator==(const Location& l) const;
|
||||
bool operator!=(const Location& l) const
|
||||
|
@ -103,9 +105,9 @@ public:
|
|||
[[noreturn]] void Internal(const char* msg) const;
|
||||
void InternalWarning(const char* msg) const;
|
||||
|
||||
virtual void Describe(ODesc* d) const { /* FIXME: Add code */ };
|
||||
virtual void Describe(zeek::ODesc* d) const { /* FIXME: Add code */ };
|
||||
|
||||
void AddLocation(ODesc* d) const;
|
||||
void AddLocation(zeek::ODesc* d) const;
|
||||
|
||||
// Get location info for debugging.
|
||||
const detail::Location* GetLocationInfo() const
|
||||
|
@ -142,10 +144,10 @@ protected:
|
|||
private:
|
||||
friend class SuppressErrors;
|
||||
|
||||
void DoMsg(ODesc* d, const char s1[], const Obj* obj2 = nullptr,
|
||||
bool pinpoint_only = false, const detail::Location* expr_location = nullptr) const;
|
||||
void PinPoint(ODesc* d, const Obj* obj2 = nullptr,
|
||||
bool pinpoint_only = false) const;
|
||||
void DoMsg(zeek::ODesc* d, const char s1[], const Obj* obj2 = nullptr,
|
||||
bool pinpoint_only = false, const detail::Location* expr_location = nullptr) const;
|
||||
void PinPoint(zeek::ODesc* d, const Obj* obj2 = nullptr,
|
||||
bool pinpoint_only = false) const;
|
||||
|
||||
friend inline void Ref(Obj* o);
|
||||
friend inline void Unref(Obj* o);
|
||||
|
|
|
@ -369,7 +369,7 @@ uint64_t Reassembler::TotalSize() const
|
|||
return block_list.DataSize() + old_block_list.DataSize();
|
||||
}
|
||||
|
||||
void Reassembler::Describe(ODesc* d) const
|
||||
void Reassembler::Describe(zeek::ODesc* d) const
|
||||
{
|
||||
d->Add("reassembler");
|
||||
}
|
||||
|
@ -384,4 +384,3 @@ uint64_t Reassembler::MemoryAllocation(ReassemblerType rtype)
|
|||
{
|
||||
return Reassembler::sizes[rtype];
|
||||
}
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ public:
|
|||
|
||||
uint64_t TotalSize() const; // number of bytes buffered up
|
||||
|
||||
void Describe(ODesc* d) const override;
|
||||
void Describe(zeek::ODesc* d) const override;
|
||||
|
||||
// Sum over all data buffered in some reassembler.
|
||||
static uint64_t TotalMemoryAllocation() { return total_size; }
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
class ODesc;
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
|
||||
|
||||
namespace zeek::detail {
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include "util.h"
|
||||
#include "IntrusivePtr.h"
|
||||
|
||||
class ODesc;
|
||||
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek);
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail);
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail);
|
||||
|
|
|
@ -180,7 +180,7 @@ void ARP_Analyzer::NextPacket(double t, const zeek::Packet* pkt)
|
|||
}
|
||||
}
|
||||
|
||||
void ARP_Analyzer::Describe(ODesc* d) const
|
||||
void ARP_Analyzer::Describe(zeek::ODesc* d) const
|
||||
{
|
||||
d->Add("<ARP analyzer>");
|
||||
d->NL();
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
void NextPacket(double t, const zeek::Packet* pkt);
|
||||
|
||||
void Describe(ODesc* d) const override;
|
||||
void Describe(zeek::ODesc* d) const override;
|
||||
void RREvent(zeek::EventHandlerPtr e, const u_char* src, const u_char* dst,
|
||||
const char* spa, const char* sha,
|
||||
const char* tpa, const char* tha);
|
||||
|
|
|
@ -452,7 +452,7 @@ bool ICMP_Analyzer::IsReuse(double /* t */, const u_char* /* pkt */)
|
|||
return false;
|
||||
}
|
||||
|
||||
void ICMP_Analyzer::Describe(ODesc* d) const
|
||||
void ICMP_Analyzer::Describe(zeek::ODesc* d) const
|
||||
{
|
||||
d->Add(Conn()->StartTime());
|
||||
d->Add("(");
|
||||
|
|
|
@ -52,7 +52,7 @@ protected:
|
|||
void RouterSolicit(double t, const struct icmp* icmpp, int len,
|
||||
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr);
|
||||
|
||||
void Describe(ODesc* d) const;
|
||||
void Describe(zeek::ODesc* d) const;
|
||||
|
||||
zeek::RecordValPtr BuildICMPVal(const struct icmp* icmpp, int len,
|
||||
int icmpv6, const zeek::IP_Hdr* ip_hdr);
|
||||
|
|
|
@ -62,14 +62,14 @@ zeek::VectorValPtr proc_padata(const KRB_PA_Data_Sequence* data, const BroAnalyz
|
|||
{
|
||||
const bytestring& cert = element->pa_data_element()->pa_pk_as_req()->cert();
|
||||
|
||||
ODesc common;
|
||||
zeek::ODesc common;
|
||||
common.AddRaw("Analyzer::ANALYZER_KRB");
|
||||
common.Add(bro_analyzer->Conn()->StartTime());
|
||||
// Request means is_orig=T
|
||||
common.AddRaw("T", 1);
|
||||
bro_analyzer->Conn()->IDString(&common);
|
||||
|
||||
ODesc file_handle;
|
||||
zeek::ODesc file_handle;
|
||||
file_handle.Add(common.Description());
|
||||
file_handle.Add(0);
|
||||
|
||||
|
@ -86,14 +86,14 @@ zeek::VectorValPtr proc_padata(const KRB_PA_Data_Sequence* data, const BroAnalyz
|
|||
{
|
||||
const bytestring& cert = element->pa_data_element()->pa_pk_as_rep()->cert();
|
||||
|
||||
ODesc common;
|
||||
zeek::ODesc common;
|
||||
common.AddRaw("Analyzer::ANALYZER_KRB");
|
||||
common.Add(bro_analyzer->Conn()->StartTime());
|
||||
// Response means is_orig=F
|
||||
common.AddRaw("F", 1);
|
||||
bro_analyzer->Conn()->IDString(&common);
|
||||
|
||||
ODesc file_handle;
|
||||
zeek::ODesc file_handle;
|
||||
file_handle.Add(common.Description());
|
||||
file_handle.Add(1);
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ refine flow RDP_Flow += {
|
|||
%{
|
||||
const bytestring& cert = ${x509.cert};
|
||||
|
||||
ODesc file_handle;
|
||||
zeek::ODesc file_handle;
|
||||
file_handle.AddRaw("Analyzer::ANALYZER_RDP");
|
||||
file_handle.Add(connection()->bro_analyzer()->Conn()->StartTime());
|
||||
connection()->bro_analyzer()->Conn()->IDString(&file_handle);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
if ( certificates->size() == 0 )
|
||||
return true;
|
||||
|
||||
ODesc common;
|
||||
zeek::ODesc common;
|
||||
common.AddRaw("Analyzer::ANALYZER_SSL");
|
||||
common.Add(bro_analyzer()->Conn()->StartTime());
|
||||
common.AddRaw(is_orig ? "T" : "F", 1);
|
||||
|
@ -22,7 +22,7 @@
|
|||
continue;
|
||||
}
|
||||
|
||||
ODesc file_handle;
|
||||
zeek::ODesc file_handle;
|
||||
file_handle.Add(common.Description());
|
||||
file_handle.Add(i);
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ refine connection Handshake_Conn += {
|
|||
|
||||
function proc_certificate_status(rec : HandshakeRecord, status_type: uint8, response: bytestring) : bool
|
||||
%{
|
||||
ODesc common;
|
||||
zeek::ODesc common;
|
||||
common.AddRaw("Analyzer::ANALYZER_SSL");
|
||||
common.Add(bro_analyzer()->Conn()->StartTime());
|
||||
common.AddRaw("F");
|
||||
|
@ -303,7 +303,7 @@ refine connection Handshake_Conn += {
|
|||
|
||||
if ( status_type == 1 && response.length() > 0 ) // ocsp
|
||||
{
|
||||
ODesc file_handle;
|
||||
zeek::ODesc file_handle;
|
||||
file_handle.Add(common.Description());
|
||||
file_handle.Add("ocsp");
|
||||
|
||||
|
|
|
@ -1130,7 +1130,7 @@ broker::data& bro_broker::opaque_field_to_data(zeek::RecordVal* v, zeek::detail:
|
|||
return static_cast<DataVal*>(d.get())->data;
|
||||
}
|
||||
|
||||
void bro_broker::DataVal::ValDescribe(ODesc* d) const
|
||||
void bro_broker::DataVal::ValDescribe(zeek::ODesc* d) const
|
||||
{
|
||||
d->Add("broker::data{");
|
||||
d->Add(broker::to_string(data));
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "Frame.h"
|
||||
#include "Expr.h"
|
||||
|
||||
class ODesc;
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
|
||||
|
||||
namespace threading {
|
||||
struct Value;
|
||||
|
@ -104,7 +104,7 @@ public:
|
|||
: OpaqueVal(bro_broker::opaque_of_data_type), data(std::move(arg_data))
|
||||
{}
|
||||
|
||||
void ValDescribe(ODesc* d) const override;
|
||||
void ValDescribe(zeek::ODesc* d) const override;
|
||||
|
||||
zeek::ValPtr castTo(zeek::Type* t);
|
||||
bool canCastTo(zeek::Type* t) const;
|
||||
|
|
|
@ -1276,7 +1276,7 @@ bool bro_broker::Manager::ProcessLogCreate(broker::zeek::LogCreate lc)
|
|||
|
||||
if ( ! log_mgr->CreateWriterForRemoteLog(stream_id->AsEnumVal(), writer_id->AsEnumVal(), writer_info.release(), num_fields, fields) )
|
||||
{
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
stream_id->Describe(&d);
|
||||
zeek::reporter->Warning("failed to create remote log stream for %s locally", d.Description());
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ zeek::EnumValPtr query_status(bool success)
|
|||
return rval;
|
||||
}
|
||||
|
||||
void StoreHandleVal::ValDescribe(ODesc* d) const
|
||||
void StoreHandleVal::ValDescribe(zeek::ODesc* d) const
|
||||
{
|
||||
//using BifEnum::Broker::BackendType;
|
||||
d->Add("broker::store::");
|
||||
|
|
|
@ -117,7 +117,7 @@ public:
|
|||
: zeek::OpaqueVal(bro_broker::opaque_of_store_handle), store{s}, proxy{store}, store_pid{store.frontend_id()}
|
||||
{ }
|
||||
|
||||
void ValDescribe(ODesc* d) const override;
|
||||
void ValDescribe(zeek::ODesc* d) const override;
|
||||
|
||||
broker::store store;
|
||||
broker::store::proxy proxy;
|
||||
|
|
|
@ -34,7 +34,7 @@ Component::~Component()
|
|||
{
|
||||
}
|
||||
|
||||
void Component::DoDescribe(ODesc* d) const
|
||||
void Component::DoDescribe(zeek::ODesc* d) const
|
||||
{
|
||||
if ( factory )
|
||||
{
|
||||
|
|
|
@ -80,7 +80,7 @@ protected:
|
|||
/**
|
||||
* Overriden from plugin::Component.
|
||||
*/
|
||||
void DoDescribe(ODesc* d) const override;
|
||||
void DoDescribe(zeek::ODesc* d) const override;
|
||||
|
||||
private:
|
||||
friend class file_analysis::Manager;
|
||||
|
|
|
@ -24,7 +24,7 @@ Component::~Component()
|
|||
{
|
||||
}
|
||||
|
||||
void Component::DoDescribe(ODesc* d) const
|
||||
void Component::DoDescribe(zeek::ODesc* d) const
|
||||
{
|
||||
d->Add("Input::READER_");
|
||||
d->Add(CanonicalName());
|
||||
|
|
|
@ -54,7 +54,7 @@ protected:
|
|||
/**
|
||||
* Overriden from plugin::Component.
|
||||
*/
|
||||
void DoDescribe(ODesc* d) const override;
|
||||
void DoDescribe(zeek::ODesc* d) const override;
|
||||
|
||||
private:
|
||||
factory_callback factory;
|
||||
|
|
|
@ -364,8 +364,8 @@ bool Manager::CreateEventStream(zeek::RecordVal* fval)
|
|||
{
|
||||
if ( ! same_type(args[i + 2], fields->GetFieldType(i) ) )
|
||||
{
|
||||
ODesc desc1;
|
||||
ODesc desc2;
|
||||
zeek::ODesc desc1;
|
||||
zeek::ODesc desc2;
|
||||
args[i + 2]->Describe(&desc1);
|
||||
fields->GetFieldType(i)->Describe(&desc2);
|
||||
|
||||
|
@ -390,8 +390,8 @@ bool Manager::CreateEventStream(zeek::RecordVal* fval)
|
|||
|
||||
if ( ! same_type(args[2], fields ) )
|
||||
{
|
||||
ODesc desc1;
|
||||
ODesc desc2;
|
||||
zeek::ODesc desc1;
|
||||
zeek::ODesc desc2;
|
||||
args[2]->Describe(&desc1);
|
||||
fields->Describe(&desc2);
|
||||
zeek::reporter->Error("Input stream %s: Incompatible type '%s':%s for event, which needs type '%s':%s\n",
|
||||
|
@ -495,8 +495,8 @@ bool Manager::CreateTableStream(zeek::RecordVal* fval)
|
|||
|
||||
if ( ! same_type(idx->GetFieldType(j), tl[j]) )
|
||||
{
|
||||
ODesc desc1;
|
||||
ODesc desc2;
|
||||
zeek::ODesc desc1;
|
||||
zeek::ODesc desc2;
|
||||
idx->GetFieldType(j)->Describe(&desc1);
|
||||
tl[j]->Describe(&desc2);
|
||||
|
||||
|
@ -535,8 +535,8 @@ bool Manager::CreateTableStream(zeek::RecordVal* fval)
|
|||
|
||||
if ( ! same_type(table_yield, compare_type) )
|
||||
{
|
||||
ODesc desc1;
|
||||
ODesc desc2;
|
||||
zeek::ODesc desc1;
|
||||
zeek::ODesc desc2;
|
||||
compare_type->Describe(&desc1);
|
||||
table_yield->Describe(&desc2);
|
||||
zeek::reporter->Error("Input stream %s: Table type does not match value type. Need type '%s', got '%s'",
|
||||
|
@ -596,8 +596,8 @@ bool Manager::CreateTableStream(zeek::RecordVal* fval)
|
|||
|
||||
if ( ! same_type(args[2], idx) )
|
||||
{
|
||||
ODesc desc1;
|
||||
ODesc desc2;
|
||||
zeek::ODesc desc1;
|
||||
zeek::ODesc desc2;
|
||||
idx->Describe(&desc1);
|
||||
args[2]->Describe(&desc2);
|
||||
zeek::reporter->Error("Input stream %s: Table event's index attributes do not match. Need '%s', got '%s'",
|
||||
|
@ -610,8 +610,8 @@ bool Manager::CreateTableStream(zeek::RecordVal* fval)
|
|||
{
|
||||
if ( want_record->InternalInt() == 1 && val && ! same_type(args[3], val) )
|
||||
{
|
||||
ODesc desc1;
|
||||
ODesc desc2;
|
||||
zeek::ODesc desc1;
|
||||
zeek::ODesc desc2;
|
||||
val->Describe(&desc1);
|
||||
args[3]->Describe(&desc2);
|
||||
zeek::reporter->Error("Input stream %s: Table event's value attributes do not match. Need '%s', got '%s'",
|
||||
|
@ -621,8 +621,8 @@ bool Manager::CreateTableStream(zeek::RecordVal* fval)
|
|||
else if ( want_record->InternalInt() == 0 &&
|
||||
val && !same_type(args[3], val->GetFieldType(0) ) )
|
||||
{
|
||||
ODesc desc1;
|
||||
ODesc desc2;
|
||||
zeek::ODesc desc1;
|
||||
zeek::ODesc desc2;
|
||||
val->GetFieldType(0)->Describe(&desc1);
|
||||
args[3]->Describe(&desc2);
|
||||
zeek::reporter->Error("Input stream %s: Table event's value attribute does not match. Need '%s', got '%s'",
|
||||
|
|
|
@ -65,7 +65,7 @@ PktSrcComponent::factory_callback PktSrcComponent::Factory() const
|
|||
return factory;
|
||||
}
|
||||
|
||||
void PktSrcComponent::DoDescribe(ODesc* d) const
|
||||
void PktSrcComponent::DoDescribe(zeek::ODesc* d) const
|
||||
{
|
||||
iosource::Component::DoDescribe(d);
|
||||
|
||||
|
@ -140,7 +140,7 @@ bool PktDumperComponent::HandlesPrefix(const std::string& prefix) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void PktDumperComponent::DoDescribe(ODesc* d) const
|
||||
void PktDumperComponent::DoDescribe(zeek::ODesc* d) const
|
||||
{
|
||||
zeek::plugin::Component::DoDescribe(d);
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
* Generates a human-readable description of the component. This goes
|
||||
* into the output of \c "bro -NN".
|
||||
*/
|
||||
void DoDescribe(ODesc* d) const override;
|
||||
void DoDescribe(zeek::ODesc* d) const override;
|
||||
|
||||
private:
|
||||
std::vector<std::string> prefixes;
|
||||
|
@ -160,7 +160,7 @@ public:
|
|||
* Generates a human-readable description of the component. This goes
|
||||
* into the output of \c "bro -NN".
|
||||
*/
|
||||
void DoDescribe(ODesc* d) const override;
|
||||
void DoDescribe(zeek::ODesc* d) const override;
|
||||
|
||||
private:
|
||||
std::vector<std::string> prefixes;
|
||||
|
|
|
@ -14,7 +14,7 @@ typedef struct bpf_timeval pkt_timeval;
|
|||
typedef struct timeval pkt_timeval;
|
||||
#endif
|
||||
|
||||
class ODesc;
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek);
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek);
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(IP_Hdr, zeek);
|
||||
|
|
|
@ -23,7 +23,7 @@ Component::~Component()
|
|||
{
|
||||
}
|
||||
|
||||
void Component::DoDescribe(ODesc* d) const
|
||||
void Component::DoDescribe(zeek::ODesc* d) const
|
||||
{
|
||||
d->Add("Log::WRITER_");
|
||||
d->Add(CanonicalName());
|
||||
|
|
|
@ -54,7 +54,7 @@ protected:
|
|||
/**
|
||||
* Overriden from plugin::Component.
|
||||
*/
|
||||
void DoDescribe(ODesc* d) const override;
|
||||
void DoDescribe(zeek::ODesc* d) const override;
|
||||
|
||||
private:
|
||||
factory_callback factory;
|
||||
|
|
|
@ -638,7 +638,7 @@ bool Manager::AddFilter(zeek::EnumVal* id, zeek::RecordVal* fval)
|
|||
stream->filters.push_back(filter);
|
||||
|
||||
#ifdef DEBUG
|
||||
ODesc desc;
|
||||
zeek::ODesc desc;
|
||||
writer->Describe(&desc);
|
||||
|
||||
DBG_LOG(zeek::DBG_LOGGING, "Created new filter '%s' for stream '%s'",
|
||||
|
@ -1002,7 +1002,7 @@ threading::Value* Manager::ValToLogVal(zeek::Val* val, zeek::Type* ty)
|
|||
|
||||
case zeek::TYPE_FUNC:
|
||||
{
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
const zeek::Func* f = val->AsFunc();
|
||||
f->Describe(&d);
|
||||
const char* s = d.Description();
|
||||
|
@ -1252,7 +1252,7 @@ bool Manager::WriteFromRemote(zeek::EnumVal* id, zeek::EnumVal* writer, const st
|
|||
{
|
||||
// Don't know this stream.
|
||||
#ifdef DEBUG
|
||||
ODesc desc;
|
||||
zeek::ODesc desc;
|
||||
id->Describe(&desc);
|
||||
DBG_LOG(zeek::DBG_LOGGING, "unknown stream %s in Manager::Write()",
|
||||
desc.Description());
|
||||
|
@ -1274,7 +1274,7 @@ bool Manager::WriteFromRemote(zeek::EnumVal* id, zeek::EnumVal* writer, const st
|
|||
{
|
||||
// Don't know this writer.
|
||||
#ifdef DEBUG
|
||||
ODesc desc;
|
||||
zeek::ODesc desc;
|
||||
id->Describe(&desc);
|
||||
DBG_LOG(zeek::DBG_LOGGING, "unknown writer %s in Manager::Write()",
|
||||
desc.Description());
|
||||
|
|
|
@ -240,7 +240,7 @@ void Ascii::InitConfigOptions()
|
|||
zeek::BifConst::LogAscii::meta_prefix->Len()
|
||||
);
|
||||
|
||||
ODesc tsfmt;
|
||||
zeek::ODesc tsfmt;
|
||||
zeek::BifConst::LogAscii::json_timestamps->Describe(&tsfmt);
|
||||
json_timestamps.assign(
|
||||
(const char*) tsfmt.Bytes(),
|
||||
|
|
|
@ -55,7 +55,7 @@ private:
|
|||
int fd;
|
||||
gzFile gzfile;
|
||||
std::string fname;
|
||||
ODesc desc;
|
||||
zeek::ODesc desc;
|
||||
bool ascii_done;
|
||||
|
||||
// Options set from the script-level.
|
||||
|
|
|
@ -286,7 +286,7 @@ int SQLite::AddParams(Value* val, int pos)
|
|||
|
||||
case zeek::TYPE_TABLE:
|
||||
{
|
||||
ODesc desc;
|
||||
zeek::ODesc desc;
|
||||
desc.Clear();
|
||||
desc.EnableEscaping();
|
||||
desc.AddEscapeSequence(set_separator);
|
||||
|
@ -308,7 +308,7 @@ int SQLite::AddParams(Value* val, int pos)
|
|||
|
||||
case zeek::TYPE_VECTOR:
|
||||
{
|
||||
ODesc desc;
|
||||
zeek::ODesc desc;
|
||||
desc.Clear();
|
||||
desc.EnableEscaping();
|
||||
desc.AddEscapeSequence(set_separator);
|
||||
|
|
|
@ -1400,7 +1400,7 @@ attr:
|
|||
zeek::make_intrusive<zeek::detail::ConstExpr>(zeek::IntrusivePtr{zeek::AdoptRef{}, $3}));
|
||||
else
|
||||
{
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
$3->Describe(&d);
|
||||
Unref($3);
|
||||
zeek::reporter->Error("'&deprecated=%s' must use a string literal",
|
||||
|
@ -1895,7 +1895,7 @@ opt_deprecated:
|
|||
$$ = new zeek::detail::ConstExpr({zeek::AdoptRef{}, $3});
|
||||
else
|
||||
{
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
$3->Describe(&d);
|
||||
zeek::reporter->Error("'&deprecated=%s' must use a string literal",
|
||||
d.Description());
|
||||
|
|
|
@ -28,7 +28,7 @@ component::Type Component::Type() const
|
|||
return type;
|
||||
}
|
||||
|
||||
void Component::Describe(ODesc* d) const
|
||||
void Component::Describe(zeek::ODesc* d) const
|
||||
{
|
||||
d->Add(" ");
|
||||
d->Add("[");
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "zeek-config.h"
|
||||
#include <string>
|
||||
|
||||
class ODesc;
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
|
||||
|
||||
namespace zeek::plugin {
|
||||
|
||||
|
@ -82,7 +83,7 @@ public:
|
|||
*
|
||||
* @param d The description object to use.
|
||||
*/
|
||||
void Describe(ODesc* d) const;
|
||||
void Describe(zeek::ODesc* d) const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -92,7 +93,7 @@ protected:
|
|||
*
|
||||
* @param d The description object to use.
|
||||
*/
|
||||
virtual void DoDescribe(ODesc* d) const { }
|
||||
virtual void DoDescribe(zeek::ODesc* d) const { }
|
||||
|
||||
private:
|
||||
// Disable.
|
||||
|
|
|
@ -69,7 +69,7 @@ BifItem::~BifItem()
|
|||
{
|
||||
}
|
||||
|
||||
void HookArgument::Describe(ODesc* d) const
|
||||
void HookArgument::Describe(zeek::ODesc* d) const
|
||||
{
|
||||
switch ( type ) {
|
||||
case BOOL:
|
||||
|
@ -462,7 +462,7 @@ void Plugin::InitializeComponents()
|
|||
(*i)->Initialize();
|
||||
}
|
||||
|
||||
void Plugin::Describe(ODesc* d) const
|
||||
void Plugin::Describe(zeek::ODesc* d) const
|
||||
{
|
||||
d->Add(config.name);
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
|
||||
#define BRO_PLUGIN_BRO_VERSION BRO_VERSION_FUNCTION
|
||||
|
||||
class ODesc;
|
||||
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Event, zeek);
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail);
|
||||
|
@ -360,7 +359,7 @@ public:
|
|||
*
|
||||
* @param d Description object to use for rendering.
|
||||
*/
|
||||
void Describe(ODesc* d) const;
|
||||
void Describe(zeek::ODesc* d) const;
|
||||
|
||||
private:
|
||||
Type type;
|
||||
|
@ -491,7 +490,7 @@ public:
|
|||
* is disabled, the rendering will include a list of all components
|
||||
* and BiF items.
|
||||
*/
|
||||
void Describe(ODesc* d) const;
|
||||
void Describe(zeek::ODesc* d) const;
|
||||
|
||||
/**
|
||||
* Registers an individual BiF that the plugin defines. The
|
||||
|
|
|
@ -51,8 +51,8 @@ public:
|
|||
* @return Returns true on success, false on error. Errors must also
|
||||
* be flagged via the thread.
|
||||
*/
|
||||
virtual bool Describe(ODesc* desc, int num_fields, const threading::Field* const * fields,
|
||||
threading::Value** vals) const = 0;
|
||||
virtual bool Describe(zeek::ODesc* desc, int num_fields, const threading::Field* const * fields,
|
||||
threading::Value** vals) const = 0;
|
||||
|
||||
/**
|
||||
* Convert a single threading value into an implementation-specific
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
* @return Returns true on success, false on error. Errors are also
|
||||
* flagged via the thread.
|
||||
*/
|
||||
virtual bool Describe(ODesc* desc, threading::Value* val, const std::string& name = "") const = 0;
|
||||
virtual bool Describe(zeek::ODesc* desc, threading::Value* val, const std::string& name = "") const = 0;
|
||||
|
||||
/**
|
||||
* Convert an implementation-specific textual representation of a
|
||||
|
|
|
@ -15,7 +15,7 @@ using namespace threading::formatter;
|
|||
// If the value we'd write out would match exactly the a reserved string, we
|
||||
// escape the first character so that the output won't be ambigious. If this
|
||||
// function returns true, it has added an escaped version of data to desc.
|
||||
static inline bool escapeReservedContent(ODesc* desc, const string& reserved, const char* data, int size)
|
||||
static inline bool escapeReservedContent(zeek::ODesc* desc, const string& reserved, const char* data, int size)
|
||||
{
|
||||
if ( size != (int)reserved.size() || memcmp(data, reserved.data(), size) != 0 )
|
||||
return false;
|
||||
|
@ -56,7 +56,7 @@ Ascii::~Ascii()
|
|||
{
|
||||
}
|
||||
|
||||
bool Ascii::Describe(ODesc* desc, int num_fields, const threading::Field* const * fields,
|
||||
bool Ascii::Describe(zeek::ODesc* desc, int num_fields, const threading::Field* const * fields,
|
||||
threading::Value** vals) const
|
||||
{
|
||||
for ( int i = 0; i < num_fields; i++ )
|
||||
|
@ -71,7 +71,7 @@ bool Ascii::Describe(ODesc* desc, int num_fields, const threading::Field* const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Ascii::Describe(ODesc* desc, threading::Value* val, const string& name) const
|
||||
bool Ascii::Describe(zeek::ODesc* desc, threading::Value* val, const string& name) const
|
||||
{
|
||||
if ( ! val->present )
|
||||
{
|
||||
|
|
|
@ -47,8 +47,8 @@ public:
|
|||
Ascii(threading::MsgThread* t, const SeparatorInfo& info);
|
||||
virtual ~Ascii();
|
||||
|
||||
virtual bool Describe(ODesc* desc, threading::Value* val, const std::string& name = "") const;
|
||||
virtual bool Describe(ODesc* desc, int num_fields, const threading::Field* const * fields,
|
||||
virtual bool Describe(zeek::ODesc* desc, threading::Value* val, const std::string& name = "") const;
|
||||
virtual bool Describe(zeek::ODesc* desc, int num_fields, const threading::Field* const * fields,
|
||||
threading::Value** vals) const;
|
||||
virtual threading::Value* ParseValue(const std::string& s, const std::string& name,
|
||||
zeek::TypeTag type, zeek::TypeTag subtype = zeek::TYPE_ERROR) const;
|
||||
|
|
|
@ -35,7 +35,7 @@ JSON::~JSON()
|
|||
{
|
||||
}
|
||||
|
||||
bool JSON::Describe(ODesc* desc, int num_fields, const Field* const * fields,
|
||||
bool JSON::Describe(zeek::ODesc* desc, int num_fields, const Field* const * fields,
|
||||
Value** vals) const
|
||||
{
|
||||
rapidjson::StringBuffer buffer;
|
||||
|
@ -55,7 +55,7 @@ bool JSON::Describe(ODesc* desc, int num_fields, const Field* const * fields,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool JSON::Describe(ODesc* desc, Value* val, const std::string& name) const
|
||||
bool JSON::Describe(zeek::ODesc* desc, Value* val, const std::string& name) const
|
||||
{
|
||||
if ( desc->IsBinary() )
|
||||
{
|
||||
|
|
|
@ -25,10 +25,11 @@ public:
|
|||
JSON(threading::MsgThread* t, TimeFormat tf);
|
||||
~JSON() override;
|
||||
|
||||
bool Describe(ODesc* desc, threading::Value* val, const std::string& name = "") const override;
|
||||
bool Describe(ODesc* desc, int num_fields, const threading::Field* const * fields,
|
||||
threading::Value** vals) const override;
|
||||
threading::Value* ParseValue(const std::string& s, const std::string& name, zeek::TypeTag type, zeek::TypeTag subtype = zeek::TYPE_ERROR) const override;
|
||||
bool Describe(zeek::ODesc* desc, threading::Value* val, const std::string& name = "") const override;
|
||||
bool Describe(zeek::ODesc* desc, int num_fields, const threading::Field* const * fields,
|
||||
threading::Value** vals) const override;
|
||||
threading::Value* ParseValue(const std::string& s, const std::string& name, zeek::TypeTag type,
|
||||
zeek::TypeTag subtype = zeek::TYPE_ERROR) const override;
|
||||
|
||||
class NullDoubleWriter : public rapidjson::Writer<rapidjson::StringBuffer> {
|
||||
public:
|
||||
|
|
12
src/util.cc
12
src/util.cc
|
@ -210,14 +210,14 @@ TEST_CASE("util get_escaped_string")
|
|||
{
|
||||
SUBCASE("returned ODesc")
|
||||
{
|
||||
ODesc* d = get_escaped_string(nullptr, "a bcd\n", 6, false);
|
||||
zeek::ODesc* d = get_escaped_string(nullptr, "a bcd\n", 6, false);
|
||||
CHECK(strcmp(d->Description(), "a\\x20bcd\\x0a") == 0);
|
||||
delete d;
|
||||
}
|
||||
|
||||
SUBCASE("provided ODesc")
|
||||
{
|
||||
ODesc d2;
|
||||
zeek::ODesc d2;
|
||||
get_escaped_string(&d2, "ab\\e", 4, true);
|
||||
CHECK(strcmp(d2.Description(), "\\x61\\x62\\\\\\x65") == 0);
|
||||
}
|
||||
|
@ -244,11 +244,11 @@ TEST_CASE("util get_escaped_string")
|
|||
* ASCII.
|
||||
* @return A ODesc object containing a list of escaped hex values of the form
|
||||
* \x##, which may be newly allocated if \a d was a null pointer. */
|
||||
ODesc* get_escaped_string(ODesc* d, const char* str, size_t len,
|
||||
bool escape_all)
|
||||
zeek::ODesc* get_escaped_string(zeek::ODesc* d, const char* str, size_t len,
|
||||
bool escape_all)
|
||||
{
|
||||
if ( ! d )
|
||||
d = new ODesc();
|
||||
d = new zeek::ODesc();
|
||||
|
||||
for ( size_t i = 0; i < len; ++i )
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ ODesc* get_escaped_string(ODesc* d, const char* str, size_t len,
|
|||
|
||||
std::string get_escaped_string(const char* str, size_t len, bool escape_all)
|
||||
{
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
return get_escaped_string(&d, str, len, escape_all)->Description();
|
||||
}
|
||||
|
||||
|
|
|
@ -125,10 +125,10 @@ inline void bytetohex(unsigned char byte, char* hex_out)
|
|||
|
||||
std::string get_unescaped_string(const std::string& str);
|
||||
|
||||
class ODesc;
|
||||
ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
|
||||
|
||||
ODesc* get_escaped_string(ODesc* d, const char* str, size_t len,
|
||||
bool escape_all);
|
||||
zeek::ODesc* get_escaped_string(zeek::ODesc* d, const char* str, size_t len,
|
||||
bool escape_all);
|
||||
std::string get_escaped_string(const char* str, size_t len, bool escape_all);
|
||||
|
||||
inline std::string get_escaped_string(const std::string& str, bool escape_all)
|
||||
|
|
|
@ -183,7 +183,7 @@ bool show_plugins(int level)
|
|||
return false;
|
||||
}
|
||||
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
|
||||
if ( level == 1 )
|
||||
d.SetShort();
|
||||
|
@ -785,7 +785,7 @@ zeek::detail::SetupResult zeek::detail::setup(int argc, char** argv,
|
|||
if ( ! id )
|
||||
zeek::reporter->FatalError("No such ID: %s\n", options.identifier_to_print->data());
|
||||
|
||||
ODesc desc;
|
||||
zeek::ODesc desc;
|
||||
desc.SetQuotes(true);
|
||||
desc.SetIncludeStats(true);
|
||||
id->DescribeExtended(&desc);
|
||||
|
|
20
src/zeek.bif
20
src/zeek.bif
|
@ -66,7 +66,7 @@ static int check_fmt_type(zeek::TypeTag t, zeek::TypeTag ok[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void do_fmt(const char*& fmt, zeek::Val* v, ODesc* d)
|
||||
static void do_fmt(const char*& fmt, zeek::Val* v, zeek::ODesc* d)
|
||||
{
|
||||
zeek::TypeTag t = v->GetType()->Tag();
|
||||
zeek::InternalTypeTag it = v->GetType()->InternalType();
|
||||
|
@ -126,8 +126,8 @@ static void do_fmt(const char*& fmt, zeek::Val* v, ODesc* d)
|
|||
char fmt_buf[512];
|
||||
char out_buf[512];
|
||||
|
||||
ODesc s;
|
||||
s.SetStyle(RAW_STYLE);
|
||||
zeek::ODesc s;
|
||||
s.SetStyle(zeek::RAW_STYLE);
|
||||
|
||||
if ( precision >= 0 && *fmt != 'e' && *fmt != 'f' && *fmt != 'g' )
|
||||
zeek::emit_builtin_error("precision specified for non-floating point");
|
||||
|
@ -268,7 +268,7 @@ static void do_fmt(const char*& fmt, zeek::Val* v, ODesc* d)
|
|||
++fmt;
|
||||
}
|
||||
|
||||
static int next_fmt(const char*& fmt, const zeek::Args* args, ODesc* d, int& n)
|
||||
static int next_fmt(const char*& fmt, const zeek::Args* args, zeek::ODesc* d, int& n)
|
||||
{
|
||||
const char* fp = fmt;
|
||||
|
||||
|
@ -872,7 +872,7 @@ function paraglob_equals%(p_one: opaque of paraglob, p_two: opaque of paraglob%)
|
|||
## .. zeek:see:: hrw_weight
|
||||
function fnv1a32%(input: any%): count
|
||||
%{
|
||||
ODesc desc(DESC_BINARY);
|
||||
zeek::ODesc desc(DESC_BINARY);
|
||||
input->Describe(&desc);
|
||||
auto bytes = desc.Bytes();
|
||||
|
||||
|
@ -1561,7 +1561,7 @@ function order%(v: any, ...%) : index_vec
|
|||
## Returns: A string concatentation of all arguments.
|
||||
function cat%(...%): string
|
||||
%{
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
d.SetStyle(RAW_STYLE);
|
||||
|
||||
for ( const auto& a : @ARG@ )
|
||||
|
@ -1588,7 +1588,7 @@ function cat%(...%): string
|
|||
## .. zeek:see:: cat string_cat
|
||||
function cat_sep%(sep: string, def: string, ...%): string
|
||||
%{
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
d.SetStyle(RAW_STYLE);
|
||||
|
||||
int pre_size = 0;
|
||||
|
@ -1664,7 +1664,7 @@ function fmt%(...%): string
|
|||
// checks that.
|
||||
|
||||
const char* fmt = fmt_v->AsString()->CheckString();
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
d.SetStyle(RAW_STYLE);
|
||||
|
||||
int n = 0;
|
||||
|
@ -1699,7 +1699,7 @@ function fmt%(...%): string
|
|||
## .. zeek:see:: fmt cat cat_sep string_cat to_json
|
||||
function print_raw%(...%): bool
|
||||
%{
|
||||
ODesc d(DESC_READABLE);
|
||||
zeek::ODesc d(DESC_READABLE);
|
||||
d.SetStyle(RAW_STYLE);
|
||||
describe_vals(@ARG@, &d, 0);
|
||||
printf("%.*s", d.Len(), d.Description());
|
||||
|
@ -1840,7 +1840,7 @@ function record_type_to_vector%(rt: string%): string_vec
|
|||
## Returns: The type name of *t*.
|
||||
function type_name%(t: any%): string
|
||||
%{
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
t->GetType()->Describe(&d);
|
||||
|
||||
String* s = new String(1, d.TakeBytes(), d.Len());
|
||||
|
|
|
@ -100,7 +100,7 @@ string IdentifierInfo::GetDeclaringScriptForField(const string& field) const
|
|||
|
||||
string IdentifierInfo::DoReStructuredText(bool roles_only) const
|
||||
{
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
d.SetIndentSpaces(3);
|
||||
d.SetQuotes(true);
|
||||
id->DescribeReST(&d, roles_only);
|
||||
|
|
|
@ -46,7 +46,7 @@ static vector<string> summary_comment(const vector<string>& cmnts)
|
|||
return rval;
|
||||
}
|
||||
|
||||
static void add_summary_rows(const ODesc& id_desc, const vector<string>& cmnts,
|
||||
static void add_summary_rows(const zeek::ODesc& id_desc, const vector<string>& cmnts,
|
||||
ReStructuredTextTable* table)
|
||||
{
|
||||
vector<string> row;
|
||||
|
@ -83,7 +83,7 @@ static string make_summary(const string& heading, char underline, char border,
|
|||
it != id_list.end(); ++it )
|
||||
{
|
||||
auto* id = (*it)->GetID();
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
d.SetQuotes(true);
|
||||
id->DescribeReSTShort(&d);
|
||||
add_summary_rows(d, summary_comment((*it)->GetComments()), &table);
|
||||
|
@ -106,7 +106,7 @@ static string make_redef_summary(const string& heading, char underline,
|
|||
++it )
|
||||
{
|
||||
auto* id = (*it)->GetID();
|
||||
ODesc d;
|
||||
zeek::ODesc d;
|
||||
d.SetQuotes(true);
|
||||
id->DescribeReSTShort(&d);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue