Move ODesc to zeek namespace

This commit is contained in:
Tim Wojtulewicz 2020-07-22 09:46:46 -07:00
parent fdcb2760b2
commit 4e9a5e9d98
53 changed files with 162 additions and 143 deletions

View file

@ -627,7 +627,7 @@ unsigned int Connection::MemoryAllocationConnVal() const
return conn_val ? conn_val->MemoryAllocation() : 0; 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(start_time);
d->Add("("); d->Add("(");
@ -674,7 +674,7 @@ void Connection::Describe(ODesc* d) const
d->NL(); d->NL();
} }
void Connection::IDString(ODesc* d) const void Connection::IDString(zeek::ODesc* d) const
{ {
d->Add(orig_addr); d->Add(orig_addr);
d->AddRaw(":", 1); d->AddRaw(":", 1);

View file

@ -261,8 +261,8 @@ public:
return true; return true;
} }
void Describe(ODesc* d) const override; void Describe(zeek::ODesc* d) const override;
void IDString(ODesc* d) const; void IDString(zeek::ODesc* d) const;
// Statistics. // Statistics.

View file

@ -16,6 +16,8 @@
#define DEFAULT_SIZE 128 #define DEFAULT_SIZE 128
#define SLOP 10 #define SLOP 10
namespace zeek {
ODesc::ODesc(desc_type t, zeek::File* arg_f) ODesc::ODesc(desc_type t, zeek::File* arg_f)
{ {
type = t; type = t;
@ -424,3 +426,5 @@ bool ODesc::FindType(const zeek::Type* type)
return false; return false;
} }
} // namespace zeek

View file

@ -11,17 +11,6 @@
#include <sys/types.h> // for u_char #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; } namespace zeek { class File; }
using BroFile [[deprecated("Remove in v4.1. Use zeek::File.")]] = zeek::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; } namespace zeek { class Type; }
using BroType [[deprecated("Remove in v4.1. Use zeek::Type instead.")]] = zeek::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 { class ODesc {
public: public:
explicit ODesc(desc_type t=DESC_READABLE, zeek::File* f=nullptr); explicit ODesc(desc_type t=DESC_READABLE, zeek::File* f=nullptr);
@ -210,3 +212,15 @@ protected:
std::set<const zeek::Type*> encountered_types; 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;

View file

@ -16,7 +16,7 @@ namespace detail {
Location start_location("<start uninitialized>", 0, 0, 0, 0); Location start_location("<start uninitialized>", 0, 0, 0, 0);
Location end_location("<end 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 ) 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 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); DoMsg(&d, msg, obj2, pinpoint_only, expr_location);
zeek::reporter->Warning("%s", d.Description()); zeek::reporter->Warning("%s", d.Description());
zeek::reporter->PopLocation(); zeek::reporter->PopLocation();
@ -76,7 +76,7 @@ void Obj::Error(const char* msg, const Obj* obj2, bool pinpoint_only, const deta
if ( suppress_errors ) if ( suppress_errors )
return; return;
ODesc d; zeek::ODesc d;
DoMsg(&d, msg, obj2, pinpoint_only, expr_location); DoMsg(&d, msg, obj2, pinpoint_only, expr_location);
zeek::reporter->Error("%s", d.Description()); zeek::reporter->Error("%s", d.Description());
zeek::reporter->PopLocation(); zeek::reporter->PopLocation();
@ -93,7 +93,7 @@ void Obj::BadTag(const char* msg, const char* t1, const char* t2) const
else else
snprintf(out, sizeof(out), "%s", msg); snprintf(out, sizeof(out), "%s", msg);
ODesc d; zeek::ODesc d;
DoMsg(&d, out); DoMsg(&d, out);
zeek::reporter->FatalErrorWithCore("%s", d.Description()); zeek::reporter->FatalErrorWithCore("%s", d.Description());
zeek::reporter->PopLocation(); 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 void Obj::Internal(const char* msg) const
{ {
ODesc d; zeek::ODesc d;
DoMsg(&d, msg); DoMsg(&d, msg);
auto rcs = zeek::render_call_stack(); auto rcs = zeek::render_call_stack();
@ -115,13 +115,13 @@ void Obj::Internal(const char* msg) const
void Obj::InternalWarning(const char* msg) const void Obj::InternalWarning(const char* msg) const
{ {
ODesc d; zeek::ODesc d;
DoMsg(&d, msg); DoMsg(&d, msg);
zeek::reporter->InternalWarning("%s", d.Description()); zeek::reporter->InternalWarning("%s", d.Description());
zeek::reporter->PopLocation(); zeek::reporter->PopLocation();
} }
void Obj::AddLocation(ODesc* d) const void Obj::AddLocation(zeek::ODesc* d) const
{ {
if ( ! location ) if ( ! location )
{ {
@ -162,7 +162,7 @@ void Obj::UpdateLocationEndInfo(const detail::Location& end)
location->last_column = end.last_column; location->last_column = end.last_column;
} }
void Obj::DoMsg(ODesc* d, const char s1[], const Obj* obj2, void Obj::DoMsg(zeek::ODesc* d, const char s1[], const Obj* obj2,
bool pinpoint_only, const detail::Location* expr_location) const bool pinpoint_only, const detail::Location* expr_location) const
{ {
d->SetShort(); d->SetShort();
@ -180,7 +180,7 @@ void Obj::DoMsg(ODesc* d, const char s1[], const Obj* obj2,
zeek::reporter->PushLocation(GetLocationInfo(), loc2); 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(" ("); d->Add(" (");
Describe(d); Describe(d);
@ -196,7 +196,7 @@ void Obj::PinPoint(ODesc* d, const Obj* obj2, bool pinpoint_only) const
void Obj::Print() const void Obj::Print() const
{ {
static zeek::File fstderr(stderr); static zeek::File fstderr(stderr);
ODesc d(DESC_READABLE, &fstderr); zeek::ODesc d(DESC_READABLE, &fstderr);
Describe(&d); Describe(&d);
d.Add("\n"); d.Add("\n");
} }

View file

@ -2,9 +2,11 @@
#pragma once #pragma once
#include "zeek-config.h"
#include <limits.h> #include <limits.h>
class ODesc; ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
namespace zeek { namespace zeek {
namespace detail { namespace detail {
@ -19,7 +21,7 @@ public:
Location() = default; 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;
bool operator!=(const Location& l) const bool operator!=(const Location& l) const
@ -103,9 +105,9 @@ public:
[[noreturn]] void Internal(const char* msg) const; [[noreturn]] void Internal(const char* msg) const;
void InternalWarning(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. // Get location info for debugging.
const detail::Location* GetLocationInfo() const const detail::Location* GetLocationInfo() const
@ -142,9 +144,9 @@ protected:
private: private:
friend class SuppressErrors; friend class SuppressErrors;
void DoMsg(ODesc* d, const char s1[], const Obj* obj2 = nullptr, void DoMsg(zeek::ODesc* d, const char s1[], const Obj* obj2 = nullptr,
bool pinpoint_only = false, const detail::Location* expr_location = nullptr) const; bool pinpoint_only = false, const detail::Location* expr_location = nullptr) const;
void PinPoint(ODesc* d, const Obj* obj2 = nullptr, void PinPoint(zeek::ODesc* d, const Obj* obj2 = nullptr,
bool pinpoint_only = false) const; bool pinpoint_only = false) const;
friend inline void Ref(Obj* o); friend inline void Ref(Obj* o);

View file

@ -369,7 +369,7 @@ uint64_t Reassembler::TotalSize() const
return block_list.DataSize() + old_block_list.DataSize(); return block_list.DataSize() + old_block_list.DataSize();
} }
void Reassembler::Describe(ODesc* d) const void Reassembler::Describe(zeek::ODesc* d) const
{ {
d->Add("reassembler"); d->Add("reassembler");
} }
@ -384,4 +384,3 @@ uint64_t Reassembler::MemoryAllocation(ReassemblerType rtype)
{ {
return Reassembler::sizes[rtype]; return Reassembler::sizes[rtype];
} }

View file

@ -279,7 +279,7 @@ public:
uint64_t TotalSize() const; // number of bytes buffered up 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. // Sum over all data buffered in some reassembler.
static uint64_t TotalMemoryAllocation() { return total_size; } static uint64_t TotalMemoryAllocation() { return total_size; }

View file

@ -7,7 +7,7 @@
#include <stdint.h> #include <stdint.h>
class ODesc; ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
namespace zeek::detail { namespace zeek::detail {

View file

@ -10,8 +10,7 @@
#include "util.h" #include "util.h"
#include "IntrusivePtr.h" #include "IntrusivePtr.h"
class ODesc; ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail); ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail); ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail);

View file

@ -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->Add("<ARP analyzer>");
d->NL(); d->NL();

View file

@ -39,7 +39,7 @@ public:
void NextPacket(double t, const zeek::Packet* pkt); 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, void RREvent(zeek::EventHandlerPtr e, const u_char* src, const u_char* dst,
const char* spa, const char* sha, const char* spa, const char* sha,
const char* tpa, const char* tha); const char* tpa, const char* tha);

View file

@ -452,7 +452,7 @@ bool ICMP_Analyzer::IsReuse(double /* t */, const u_char* /* pkt */)
return false; return false;
} }
void ICMP_Analyzer::Describe(ODesc* d) const void ICMP_Analyzer::Describe(zeek::ODesc* d) const
{ {
d->Add(Conn()->StartTime()); d->Add(Conn()->StartTime());
d->Add("("); d->Add("(");

View file

@ -52,7 +52,7 @@ protected:
void RouterSolicit(double t, const struct icmp* icmpp, int len, void RouterSolicit(double t, const struct icmp* icmpp, int len,
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr); 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, zeek::RecordValPtr BuildICMPVal(const struct icmp* icmpp, int len,
int icmpv6, const zeek::IP_Hdr* ip_hdr); int icmpv6, const zeek::IP_Hdr* ip_hdr);

View file

@ -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(); const bytestring& cert = element->pa_data_element()->pa_pk_as_req()->cert();
ODesc common; zeek::ODesc common;
common.AddRaw("Analyzer::ANALYZER_KRB"); common.AddRaw("Analyzer::ANALYZER_KRB");
common.Add(bro_analyzer->Conn()->StartTime()); common.Add(bro_analyzer->Conn()->StartTime());
// Request means is_orig=T // Request means is_orig=T
common.AddRaw("T", 1); common.AddRaw("T", 1);
bro_analyzer->Conn()->IDString(&common); bro_analyzer->Conn()->IDString(&common);
ODesc file_handle; zeek::ODesc file_handle;
file_handle.Add(common.Description()); file_handle.Add(common.Description());
file_handle.Add(0); 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(); const bytestring& cert = element->pa_data_element()->pa_pk_as_rep()->cert();
ODesc common; zeek::ODesc common;
common.AddRaw("Analyzer::ANALYZER_KRB"); common.AddRaw("Analyzer::ANALYZER_KRB");
common.Add(bro_analyzer->Conn()->StartTime()); common.Add(bro_analyzer->Conn()->StartTime());
// Response means is_orig=F // Response means is_orig=F
common.AddRaw("F", 1); common.AddRaw("F", 1);
bro_analyzer->Conn()->IDString(&common); bro_analyzer->Conn()->IDString(&common);
ODesc file_handle; zeek::ODesc file_handle;
file_handle.Add(common.Description()); file_handle.Add(common.Description());
file_handle.Add(1); file_handle.Add(1);

View file

@ -208,7 +208,7 @@ refine flow RDP_Flow += {
%{ %{
const bytestring& cert = ${x509.cert}; const bytestring& cert = ${x509.cert};
ODesc file_handle; zeek::ODesc file_handle;
file_handle.AddRaw("Analyzer::ANALYZER_RDP"); file_handle.AddRaw("Analyzer::ANALYZER_RDP");
file_handle.Add(connection()->bro_analyzer()->Conn()->StartTime()); file_handle.Add(connection()->bro_analyzer()->Conn()->StartTime());
connection()->bro_analyzer()->Conn()->IDString(&file_handle); connection()->bro_analyzer()->Conn()->IDString(&file_handle);

View file

@ -3,7 +3,7 @@
if ( certificates->size() == 0 ) if ( certificates->size() == 0 )
return true; return true;
ODesc common; zeek::ODesc common;
common.AddRaw("Analyzer::ANALYZER_SSL"); common.AddRaw("Analyzer::ANALYZER_SSL");
common.Add(bro_analyzer()->Conn()->StartTime()); common.Add(bro_analyzer()->Conn()->StartTime());
common.AddRaw(is_orig ? "T" : "F", 1); common.AddRaw(is_orig ? "T" : "F", 1);
@ -22,7 +22,7 @@
continue; continue;
} }
ODesc file_handle; zeek::ODesc file_handle;
file_handle.Add(common.Description()); file_handle.Add(common.Description());
file_handle.Add(i); file_handle.Add(i);

View file

@ -295,7 +295,7 @@ refine connection Handshake_Conn += {
function proc_certificate_status(rec : HandshakeRecord, status_type: uint8, response: bytestring) : bool function proc_certificate_status(rec : HandshakeRecord, status_type: uint8, response: bytestring) : bool
%{ %{
ODesc common; zeek::ODesc common;
common.AddRaw("Analyzer::ANALYZER_SSL"); common.AddRaw("Analyzer::ANALYZER_SSL");
common.Add(bro_analyzer()->Conn()->StartTime()); common.Add(bro_analyzer()->Conn()->StartTime());
common.AddRaw("F"); common.AddRaw("F");
@ -303,7 +303,7 @@ refine connection Handshake_Conn += {
if ( status_type == 1 && response.length() > 0 ) // ocsp if ( status_type == 1 && response.length() > 0 ) // ocsp
{ {
ODesc file_handle; zeek::ODesc file_handle;
file_handle.Add(common.Description()); file_handle.Add(common.Description());
file_handle.Add("ocsp"); file_handle.Add("ocsp");

View file

@ -1130,7 +1130,7 @@ broker::data& bro_broker::opaque_field_to_data(zeek::RecordVal* v, zeek::detail:
return static_cast<DataVal*>(d.get())->data; 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::data{");
d->Add(broker::to_string(data)); d->Add(broker::to_string(data));

View file

@ -5,7 +5,7 @@
#include "Frame.h" #include "Frame.h"
#include "Expr.h" #include "Expr.h"
class ODesc; ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
namespace threading { namespace threading {
struct Value; struct Value;
@ -104,7 +104,7 @@ public:
: OpaqueVal(bro_broker::opaque_of_data_type), data(std::move(arg_data)) : 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); zeek::ValPtr castTo(zeek::Type* t);
bool canCastTo(zeek::Type* t) const; bool canCastTo(zeek::Type* t) const;

View file

@ -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) ) 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); stream_id->Describe(&d);
zeek::reporter->Warning("failed to create remote log stream for %s locally", d.Description()); zeek::reporter->Warning("failed to create remote log stream for %s locally", d.Description());
} }

View file

@ -24,7 +24,7 @@ zeek::EnumValPtr query_status(bool success)
return rval; return rval;
} }
void StoreHandleVal::ValDescribe(ODesc* d) const void StoreHandleVal::ValDescribe(zeek::ODesc* d) const
{ {
//using BifEnum::Broker::BackendType; //using BifEnum::Broker::BackendType;
d->Add("broker::store::"); d->Add("broker::store::");

View file

@ -117,7 +117,7 @@ public:
: zeek::OpaqueVal(bro_broker::opaque_of_store_handle), store{s}, proxy{store}, store_pid{store.frontend_id()} : 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 store;
broker::store::proxy proxy; broker::store::proxy proxy;

View file

@ -34,7 +34,7 @@ Component::~Component()
{ {
} }
void Component::DoDescribe(ODesc* d) const void Component::DoDescribe(zeek::ODesc* d) const
{ {
if ( factory ) if ( factory )
{ {

View file

@ -80,7 +80,7 @@ protected:
/** /**
* Overriden from plugin::Component. * Overriden from plugin::Component.
*/ */
void DoDescribe(ODesc* d) const override; void DoDescribe(zeek::ODesc* d) const override;
private: private:
friend class file_analysis::Manager; friend class file_analysis::Manager;

View file

@ -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("Input::READER_");
d->Add(CanonicalName()); d->Add(CanonicalName());

View file

@ -54,7 +54,7 @@ protected:
/** /**
* Overriden from plugin::Component. * Overriden from plugin::Component.
*/ */
void DoDescribe(ODesc* d) const override; void DoDescribe(zeek::ODesc* d) const override;
private: private:
factory_callback factory; factory_callback factory;

View file

@ -364,8 +364,8 @@ bool Manager::CreateEventStream(zeek::RecordVal* fval)
{ {
if ( ! same_type(args[i + 2], fields->GetFieldType(i) ) ) if ( ! same_type(args[i + 2], fields->GetFieldType(i) ) )
{ {
ODesc desc1; zeek::ODesc desc1;
ODesc desc2; zeek::ODesc desc2;
args[i + 2]->Describe(&desc1); args[i + 2]->Describe(&desc1);
fields->GetFieldType(i)->Describe(&desc2); fields->GetFieldType(i)->Describe(&desc2);
@ -390,8 +390,8 @@ bool Manager::CreateEventStream(zeek::RecordVal* fval)
if ( ! same_type(args[2], fields ) ) if ( ! same_type(args[2], fields ) )
{ {
ODesc desc1; zeek::ODesc desc1;
ODesc desc2; zeek::ODesc desc2;
args[2]->Describe(&desc1); args[2]->Describe(&desc1);
fields->Describe(&desc2); fields->Describe(&desc2);
zeek::reporter->Error("Input stream %s: Incompatible type '%s':%s for event, which needs type '%s':%s\n", 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]) ) if ( ! same_type(idx->GetFieldType(j), tl[j]) )
{ {
ODesc desc1; zeek::ODesc desc1;
ODesc desc2; zeek::ODesc desc2;
idx->GetFieldType(j)->Describe(&desc1); idx->GetFieldType(j)->Describe(&desc1);
tl[j]->Describe(&desc2); tl[j]->Describe(&desc2);
@ -535,8 +535,8 @@ bool Manager::CreateTableStream(zeek::RecordVal* fval)
if ( ! same_type(table_yield, compare_type) ) if ( ! same_type(table_yield, compare_type) )
{ {
ODesc desc1; zeek::ODesc desc1;
ODesc desc2; zeek::ODesc desc2;
compare_type->Describe(&desc1); compare_type->Describe(&desc1);
table_yield->Describe(&desc2); table_yield->Describe(&desc2);
zeek::reporter->Error("Input stream %s: Table type does not match value type. Need type '%s', got '%s'", 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) ) if ( ! same_type(args[2], idx) )
{ {
ODesc desc1; zeek::ODesc desc1;
ODesc desc2; zeek::ODesc desc2;
idx->Describe(&desc1); idx->Describe(&desc1);
args[2]->Describe(&desc2); args[2]->Describe(&desc2);
zeek::reporter->Error("Input stream %s: Table event's index attributes do not match. Need '%s', got '%s'", 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) ) if ( want_record->InternalInt() == 1 && val && ! same_type(args[3], val) )
{ {
ODesc desc1; zeek::ODesc desc1;
ODesc desc2; zeek::ODesc desc2;
val->Describe(&desc1); val->Describe(&desc1);
args[3]->Describe(&desc2); args[3]->Describe(&desc2);
zeek::reporter->Error("Input stream %s: Table event's value attributes do not match. Need '%s', got '%s'", 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 && else if ( want_record->InternalInt() == 0 &&
val && !same_type(args[3], val->GetFieldType(0) ) ) val && !same_type(args[3], val->GetFieldType(0) ) )
{ {
ODesc desc1; zeek::ODesc desc1;
ODesc desc2; zeek::ODesc desc2;
val->GetFieldType(0)->Describe(&desc1); val->GetFieldType(0)->Describe(&desc1);
args[3]->Describe(&desc2); args[3]->Describe(&desc2);
zeek::reporter->Error("Input stream %s: Table event's value attribute does not match. Need '%s', got '%s'", zeek::reporter->Error("Input stream %s: Table event's value attribute does not match. Need '%s', got '%s'",

View file

@ -65,7 +65,7 @@ PktSrcComponent::factory_callback PktSrcComponent::Factory() const
return factory; return factory;
} }
void PktSrcComponent::DoDescribe(ODesc* d) const void PktSrcComponent::DoDescribe(zeek::ODesc* d) const
{ {
iosource::Component::DoDescribe(d); iosource::Component::DoDescribe(d);
@ -140,7 +140,7 @@ bool PktDumperComponent::HandlesPrefix(const std::string& prefix) const
return false; return false;
} }
void PktDumperComponent::DoDescribe(ODesc* d) const void PktDumperComponent::DoDescribe(zeek::ODesc* d) const
{ {
zeek::plugin::Component::DoDescribe(d); zeek::plugin::Component::DoDescribe(d);

View file

@ -113,7 +113,7 @@ public:
* Generates a human-readable description of the component. This goes * Generates a human-readable description of the component. This goes
* into the output of \c "bro -NN". * into the output of \c "bro -NN".
*/ */
void DoDescribe(ODesc* d) const override; void DoDescribe(zeek::ODesc* d) const override;
private: private:
std::vector<std::string> prefixes; std::vector<std::string> prefixes;
@ -160,7 +160,7 @@ public:
* Generates a human-readable description of the component. This goes * Generates a human-readable description of the component. This goes
* into the output of \c "bro -NN". * into the output of \c "bro -NN".
*/ */
void DoDescribe(ODesc* d) const override; void DoDescribe(zeek::ODesc* d) const override;
private: private:
std::vector<std::string> prefixes; std::vector<std::string> prefixes;

View file

@ -14,7 +14,7 @@ typedef struct bpf_timeval pkt_timeval;
typedef struct timeval pkt_timeval; typedef struct timeval pkt_timeval;
#endif #endif
class ODesc; ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(IP_Hdr, zeek); ZEEK_FORWARD_DECLARE_NAMESPACED(IP_Hdr, zeek);

View file

@ -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("Log::WRITER_");
d->Add(CanonicalName()); d->Add(CanonicalName());

View file

@ -54,7 +54,7 @@ protected:
/** /**
* Overriden from plugin::Component. * Overriden from plugin::Component.
*/ */
void DoDescribe(ODesc* d) const override; void DoDescribe(zeek::ODesc* d) const override;
private: private:
factory_callback factory; factory_callback factory;

View file

@ -638,7 +638,7 @@ bool Manager::AddFilter(zeek::EnumVal* id, zeek::RecordVal* fval)
stream->filters.push_back(filter); stream->filters.push_back(filter);
#ifdef DEBUG #ifdef DEBUG
ODesc desc; zeek::ODesc desc;
writer->Describe(&desc); writer->Describe(&desc);
DBG_LOG(zeek::DBG_LOGGING, "Created new filter '%s' for stream '%s'", 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: case zeek::TYPE_FUNC:
{ {
ODesc d; zeek::ODesc d;
const zeek::Func* f = val->AsFunc(); const zeek::Func* f = val->AsFunc();
f->Describe(&d); f->Describe(&d);
const char* s = d.Description(); 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. // Don't know this stream.
#ifdef DEBUG #ifdef DEBUG
ODesc desc; zeek::ODesc desc;
id->Describe(&desc); id->Describe(&desc);
DBG_LOG(zeek::DBG_LOGGING, "unknown stream %s in Manager::Write()", DBG_LOG(zeek::DBG_LOGGING, "unknown stream %s in Manager::Write()",
desc.Description()); desc.Description());
@ -1274,7 +1274,7 @@ bool Manager::WriteFromRemote(zeek::EnumVal* id, zeek::EnumVal* writer, const st
{ {
// Don't know this writer. // Don't know this writer.
#ifdef DEBUG #ifdef DEBUG
ODesc desc; zeek::ODesc desc;
id->Describe(&desc); id->Describe(&desc);
DBG_LOG(zeek::DBG_LOGGING, "unknown writer %s in Manager::Write()", DBG_LOG(zeek::DBG_LOGGING, "unknown writer %s in Manager::Write()",
desc.Description()); desc.Description());

View file

@ -240,7 +240,7 @@ void Ascii::InitConfigOptions()
zeek::BifConst::LogAscii::meta_prefix->Len() zeek::BifConst::LogAscii::meta_prefix->Len()
); );
ODesc tsfmt; zeek::ODesc tsfmt;
zeek::BifConst::LogAscii::json_timestamps->Describe(&tsfmt); zeek::BifConst::LogAscii::json_timestamps->Describe(&tsfmt);
json_timestamps.assign( json_timestamps.assign(
(const char*) tsfmt.Bytes(), (const char*) tsfmt.Bytes(),

View file

@ -55,7 +55,7 @@ private:
int fd; int fd;
gzFile gzfile; gzFile gzfile;
std::string fname; std::string fname;
ODesc desc; zeek::ODesc desc;
bool ascii_done; bool ascii_done;
// Options set from the script-level. // Options set from the script-level.

View file

@ -286,7 +286,7 @@ int SQLite::AddParams(Value* val, int pos)
case zeek::TYPE_TABLE: case zeek::TYPE_TABLE:
{ {
ODesc desc; zeek::ODesc desc;
desc.Clear(); desc.Clear();
desc.EnableEscaping(); desc.EnableEscaping();
desc.AddEscapeSequence(set_separator); desc.AddEscapeSequence(set_separator);
@ -308,7 +308,7 @@ int SQLite::AddParams(Value* val, int pos)
case zeek::TYPE_VECTOR: case zeek::TYPE_VECTOR:
{ {
ODesc desc; zeek::ODesc desc;
desc.Clear(); desc.Clear();
desc.EnableEscaping(); desc.EnableEscaping();
desc.AddEscapeSequence(set_separator); desc.AddEscapeSequence(set_separator);

View file

@ -1400,7 +1400,7 @@ attr:
zeek::make_intrusive<zeek::detail::ConstExpr>(zeek::IntrusivePtr{zeek::AdoptRef{}, $3})); zeek::make_intrusive<zeek::detail::ConstExpr>(zeek::IntrusivePtr{zeek::AdoptRef{}, $3}));
else else
{ {
ODesc d; zeek::ODesc d;
$3->Describe(&d); $3->Describe(&d);
Unref($3); Unref($3);
zeek::reporter->Error("'&deprecated=%s' must use a string literal", zeek::reporter->Error("'&deprecated=%s' must use a string literal",
@ -1895,7 +1895,7 @@ opt_deprecated:
$$ = new zeek::detail::ConstExpr({zeek::AdoptRef{}, $3}); $$ = new zeek::detail::ConstExpr({zeek::AdoptRef{}, $3});
else else
{ {
ODesc d; zeek::ODesc d;
$3->Describe(&d); $3->Describe(&d);
zeek::reporter->Error("'&deprecated=%s' must use a string literal", zeek::reporter->Error("'&deprecated=%s' must use a string literal",
d.Description()); d.Description());

View file

@ -28,7 +28,7 @@ component::Type Component::Type() const
return type; return type;
} }
void Component::Describe(ODesc* d) const void Component::Describe(zeek::ODesc* d) const
{ {
d->Add(" "); d->Add(" ");
d->Add("["); d->Add("[");

View file

@ -2,9 +2,10 @@
#pragma once #pragma once
#include "zeek-config.h"
#include <string> #include <string>
class ODesc; ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek);
namespace zeek::plugin { namespace zeek::plugin {
@ -82,7 +83,7 @@ public:
* *
* @param d The description object to use. * @param d The description object to use.
*/ */
void Describe(ODesc* d) const; void Describe(zeek::ODesc* d) const;
protected: protected:
/** /**
@ -92,7 +93,7 @@ protected:
* *
* @param d The description object to use. * @param d The description object to use.
*/ */
virtual void DoDescribe(ODesc* d) const { } virtual void DoDescribe(zeek::ODesc* d) const { }
private: private:
// Disable. // Disable.

View file

@ -69,7 +69,7 @@ BifItem::~BifItem()
{ {
} }
void HookArgument::Describe(ODesc* d) const void HookArgument::Describe(zeek::ODesc* d) const
{ {
switch ( type ) { switch ( type ) {
case BOOL: case BOOL:
@ -462,7 +462,7 @@ void Plugin::InitializeComponents()
(*i)->Initialize(); (*i)->Initialize();
} }
void Plugin::Describe(ODesc* d) const void Plugin::Describe(zeek::ODesc* d) const
{ {
d->Add(config.name); d->Add(config.name);

View file

@ -16,8 +16,7 @@
#define BRO_PLUGIN_BRO_VERSION BRO_VERSION_FUNCTION #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(Event, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek); ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail); ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail);
@ -360,7 +359,7 @@ public:
* *
* @param d Description object to use for rendering. * @param d Description object to use for rendering.
*/ */
void Describe(ODesc* d) const; void Describe(zeek::ODesc* d) const;
private: private:
Type type; Type type;
@ -491,7 +490,7 @@ public:
* is disabled, the rendering will include a list of all components * is disabled, the rendering will include a list of all components
* and BiF items. * and BiF items.
*/ */
void Describe(ODesc* d) const; void Describe(zeek::ODesc* d) const;
/** /**
* Registers an individual BiF that the plugin defines. The * Registers an individual BiF that the plugin defines. The

View file

@ -51,7 +51,7 @@ public:
* @return Returns true on success, false on error. Errors must also * @return Returns true on success, false on error. Errors must also
* be flagged via the thread. * be flagged via the thread.
*/ */
virtual bool Describe(ODesc* desc, int num_fields, const threading::Field* const * fields, virtual bool Describe(zeek::ODesc* desc, int num_fields, const threading::Field* const * fields,
threading::Value** vals) const = 0; threading::Value** vals) const = 0;
/** /**
@ -67,7 +67,7 @@ public:
* @return Returns true on success, false on error. Errors are also * @return Returns true on success, false on error. Errors are also
* flagged via the thread. * 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 * Convert an implementation-specific textual representation of a

View file

@ -15,7 +15,7 @@ using namespace threading::formatter;
// If the value we'd write out would match exactly the a reserved string, we // 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 // 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. // 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 ) if ( size != (int)reserved.size() || memcmp(data, reserved.data(), size) != 0 )
return false; 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 threading::Value** vals) const
{ {
for ( int i = 0; i < num_fields; i++ ) 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; 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 ) if ( ! val->present )
{ {

View file

@ -47,8 +47,8 @@ public:
Ascii(threading::MsgThread* t, const SeparatorInfo& info); Ascii(threading::MsgThread* t, const SeparatorInfo& info);
virtual ~Ascii(); virtual ~Ascii();
virtual bool Describe(ODesc* desc, threading::Value* val, const std::string& name = "") const; virtual bool Describe(zeek::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, int num_fields, const threading::Field* const * fields,
threading::Value** vals) const; threading::Value** vals) const;
virtual threading::Value* ParseValue(const std::string& s, const std::string& name, virtual threading::Value* ParseValue(const std::string& s, const std::string& name,
zeek::TypeTag type, zeek::TypeTag subtype = zeek::TYPE_ERROR) const; zeek::TypeTag type, zeek::TypeTag subtype = zeek::TYPE_ERROR) const;

View file

@ -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 Value** vals) const
{ {
rapidjson::StringBuffer buffer; rapidjson::StringBuffer buffer;
@ -55,7 +55,7 @@ bool JSON::Describe(ODesc* desc, int num_fields, const Field* const * fields,
return true; 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() ) if ( desc->IsBinary() )
{ {

View file

@ -25,10 +25,11 @@ public:
JSON(threading::MsgThread* t, TimeFormat tf); JSON(threading::MsgThread* t, TimeFormat tf);
~JSON() override; ~JSON() override;
bool Describe(ODesc* desc, threading::Value* val, const std::string& name = "") const override; bool Describe(zeek::ODesc* desc, threading::Value* val, const std::string& name = "") const override;
bool Describe(ODesc* desc, int num_fields, const threading::Field* const * fields, bool Describe(zeek::ODesc* desc, int num_fields, const threading::Field* const * fields,
threading::Value** vals) const override; 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; 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> { class NullDoubleWriter : public rapidjson::Writer<rapidjson::StringBuffer> {
public: public:

View file

@ -210,14 +210,14 @@ TEST_CASE("util get_escaped_string")
{ {
SUBCASE("returned ODesc") 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); CHECK(strcmp(d->Description(), "a\\x20bcd\\x0a") == 0);
delete d; delete d;
} }
SUBCASE("provided ODesc") SUBCASE("provided ODesc")
{ {
ODesc d2; zeek::ODesc d2;
get_escaped_string(&d2, "ab\\e", 4, true); get_escaped_string(&d2, "ab\\e", 4, true);
CHECK(strcmp(d2.Description(), "\\x61\\x62\\\\\\x65") == 0); CHECK(strcmp(d2.Description(), "\\x61\\x62\\\\\\x65") == 0);
} }
@ -244,11 +244,11 @@ TEST_CASE("util get_escaped_string")
* ASCII. * ASCII.
* @return A ODesc object containing a list of escaped hex values of the form * @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. */ * \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, zeek::ODesc* get_escaped_string(zeek::ODesc* d, const char* str, size_t len,
bool escape_all) bool escape_all)
{ {
if ( ! d ) if ( ! d )
d = new ODesc(); d = new zeek::ODesc();
for ( size_t i = 0; i < len; ++i ) 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) 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(); return get_escaped_string(&d, str, len, escape_all)->Description();
} }

View file

@ -125,9 +125,9 @@ inline void bytetohex(unsigned char byte, char* hex_out)
std::string get_unescaped_string(const std::string& str); 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, zeek::ODesc* get_escaped_string(zeek::ODesc* d, const char* str, size_t len,
bool escape_all); bool escape_all);
std::string get_escaped_string(const char* str, size_t len, bool escape_all); std::string get_escaped_string(const char* str, size_t len, bool escape_all);

View file

@ -183,7 +183,7 @@ bool show_plugins(int level)
return false; return false;
} }
ODesc d; zeek::ODesc d;
if ( level == 1 ) if ( level == 1 )
d.SetShort(); d.SetShort();
@ -785,7 +785,7 @@ zeek::detail::SetupResult zeek::detail::setup(int argc, char** argv,
if ( ! id ) if ( ! id )
zeek::reporter->FatalError("No such ID: %s\n", options.identifier_to_print->data()); zeek::reporter->FatalError("No such ID: %s\n", options.identifier_to_print->data());
ODesc desc; zeek::ODesc desc;
desc.SetQuotes(true); desc.SetQuotes(true);
desc.SetIncludeStats(true); desc.SetIncludeStats(true);
id->DescribeExtended(&desc); id->DescribeExtended(&desc);

View file

@ -66,7 +66,7 @@ static int check_fmt_type(zeek::TypeTag t, zeek::TypeTag ok[])
return 0; 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::TypeTag t = v->GetType()->Tag();
zeek::InternalTypeTag it = v->GetType()->InternalType(); 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 fmt_buf[512];
char out_buf[512]; char out_buf[512];
ODesc s; zeek::ODesc s;
s.SetStyle(RAW_STYLE); s.SetStyle(zeek::RAW_STYLE);
if ( precision >= 0 && *fmt != 'e' && *fmt != 'f' && *fmt != 'g' ) if ( precision >= 0 && *fmt != 'e' && *fmt != 'f' && *fmt != 'g' )
zeek::emit_builtin_error("precision specified for non-floating point"); 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; ++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; 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 ## .. zeek:see:: hrw_weight
function fnv1a32%(input: any%): count function fnv1a32%(input: any%): count
%{ %{
ODesc desc(DESC_BINARY); zeek::ODesc desc(DESC_BINARY);
input->Describe(&desc); input->Describe(&desc);
auto bytes = desc.Bytes(); auto bytes = desc.Bytes();
@ -1561,7 +1561,7 @@ function order%(v: any, ...%) : index_vec
## Returns: A string concatentation of all arguments. ## Returns: A string concatentation of all arguments.
function cat%(...%): string function cat%(...%): string
%{ %{
ODesc d; zeek::ODesc d;
d.SetStyle(RAW_STYLE); d.SetStyle(RAW_STYLE);
for ( const auto& a : @ARG@ ) for ( const auto& a : @ARG@ )
@ -1588,7 +1588,7 @@ function cat%(...%): string
## .. zeek:see:: cat string_cat ## .. zeek:see:: cat string_cat
function cat_sep%(sep: string, def: string, ...%): string function cat_sep%(sep: string, def: string, ...%): string
%{ %{
ODesc d; zeek::ODesc d;
d.SetStyle(RAW_STYLE); d.SetStyle(RAW_STYLE);
int pre_size = 0; int pre_size = 0;
@ -1664,7 +1664,7 @@ function fmt%(...%): string
// checks that. // checks that.
const char* fmt = fmt_v->AsString()->CheckString(); const char* fmt = fmt_v->AsString()->CheckString();
ODesc d; zeek::ODesc d;
d.SetStyle(RAW_STYLE); d.SetStyle(RAW_STYLE);
int n = 0; int n = 0;
@ -1699,7 +1699,7 @@ function fmt%(...%): string
## .. zeek:see:: fmt cat cat_sep string_cat to_json ## .. zeek:see:: fmt cat cat_sep string_cat to_json
function print_raw%(...%): bool function print_raw%(...%): bool
%{ %{
ODesc d(DESC_READABLE); zeek::ODesc d(DESC_READABLE);
d.SetStyle(RAW_STYLE); d.SetStyle(RAW_STYLE);
describe_vals(@ARG@, &d, 0); describe_vals(@ARG@, &d, 0);
printf("%.*s", d.Len(), d.Description()); 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*. ## Returns: The type name of *t*.
function type_name%(t: any%): string function type_name%(t: any%): string
%{ %{
ODesc d; zeek::ODesc d;
t->GetType()->Describe(&d); t->GetType()->Describe(&d);
String* s = new String(1, d.TakeBytes(), d.Len()); String* s = new String(1, d.TakeBytes(), d.Len());

View file

@ -100,7 +100,7 @@ string IdentifierInfo::GetDeclaringScriptForField(const string& field) const
string IdentifierInfo::DoReStructuredText(bool roles_only) const string IdentifierInfo::DoReStructuredText(bool roles_only) const
{ {
ODesc d; zeek::ODesc d;
d.SetIndentSpaces(3); d.SetIndentSpaces(3);
d.SetQuotes(true); d.SetQuotes(true);
id->DescribeReST(&d, roles_only); id->DescribeReST(&d, roles_only);

View file

@ -46,7 +46,7 @@ static vector<string> summary_comment(const vector<string>& cmnts)
return rval; 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) ReStructuredTextTable* table)
{ {
vector<string> row; vector<string> row;
@ -83,7 +83,7 @@ static string make_summary(const string& heading, char underline, char border,
it != id_list.end(); ++it ) it != id_list.end(); ++it )
{ {
auto* id = (*it)->GetID(); auto* id = (*it)->GetID();
ODesc d; zeek::ODesc d;
d.SetQuotes(true); d.SetQuotes(true);
id->DescribeReSTShort(&d); id->DescribeReSTShort(&d);
add_summary_rows(d, summary_comment((*it)->GetComments()), &table); add_summary_rows(d, summary_comment((*it)->GetComments()), &table);
@ -106,7 +106,7 @@ static string make_redef_summary(const string& heading, char underline,
++it ) ++it )
{ {
auto* id = (*it)->GetID(); auto* id = (*it)->GetID();
ODesc d; zeek::ODesc d;
d.SetQuotes(true); d.SetQuotes(true);
id->DescribeReSTShort(&d); id->DescribeReSTShort(&d);