Rename BroObj to Obj

This commit is contained in:
Tim Wojtulewicz 2020-07-02 15:42:00 -07:00
parent 736a3f53d4
commit 02cef05f93
36 changed files with 105 additions and 103 deletions

View file

@ -51,7 +51,7 @@ using AttrPtr = zeek::IntrusivePtr<Attr>;
class Attributes; class Attributes;
using AttributesPtr = zeek::IntrusivePtr<Attributes>; using AttributesPtr = zeek::IntrusivePtr<Attributes>;
class Attr final : public BroObj { class Attr final : public Obj {
public: public:
static inline const AttrPtr nil; static inline const AttrPtr nil;
@ -95,7 +95,7 @@ protected:
}; };
// Manages a collection of attributes. // Manages a collection of attributes.
class Attributes final : public BroObj { class Attributes final : public Obj {
public: public:
[[deprecated("Remove in v4.1. Construct using IntrusivePtrs instead.")]] [[deprecated("Remove in v4.1. Construct using IntrusivePtrs instead.")]]
Attributes(attr_list* a, zeek::TypePtr t, bool in_record, bool is_global); Attributes(attr_list* a, zeek::TypePtr t, bool in_record, bool is_global);

View file

@ -64,7 +64,7 @@ static inline int addr_port_canon_lt(const IPAddr& addr1, uint32_t p1,
namespace analyzer { class Analyzer; } namespace analyzer { class Analyzer; }
class Connection final : public zeek::BroObj { class Connection final : public zeek::Obj {
public: public:
Connection(NetSessions* s, const ConnIDKey& k, double t, const ConnID* id, Connection(NetSessions* s, const ConnIDKey& k, double t, const ConnID* id,
uint32_t flow, const Packet* pkt, const EncapsulationStack* arg_encap); uint32_t flow, const Packet* pkt, const EncapsulationStack* arg_encap);

View file

@ -24,7 +24,7 @@ class DFA_State;
class DFA_Machine; class DFA_Machine;
class DFA_State; class DFA_State;
class DFA_State : public zeek::BroObj { class DFA_State : public zeek::Obj {
public: public:
DFA_State(int state_num, const EquivClass* ec, DFA_State(int state_num, const EquivClass* ec,
NFA_state_list* nfa_states, AcceptingSet* accept); NFA_state_list* nfa_states, AcceptingSet* accept);
@ -109,7 +109,7 @@ private:
std::map<DigestStr, DFA_State*> states; std::map<DigestStr, DFA_State*> states;
}; };
class DFA_Machine : public zeek::BroObj { class DFA_Machine : public zeek::Obj {
public: public:
DFA_Machine(NFA_Machine* n, EquivClass* ec); DFA_Machine(NFA_Machine* n, EquivClass* ec);
~DFA_Machine() override; ~DFA_Machine() override;

View file

@ -7,7 +7,7 @@
#include "Reporter.h" #include "Reporter.h"
// Support classes // Support classes
DbgWatch::DbgWatch(zeek::BroObj* var_to_watch) DbgWatch::DbgWatch(zeek::Obj* var_to_watch)
{ {
reporter->InternalError("DbgWatch unimplemented"); reporter->InternalError("DbgWatch unimplemented");
} }

View file

@ -5,15 +5,16 @@
#include "util.h" #include "util.h"
ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail); ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(BroObj, zeek); namespace zeek { class Obj; }
using BroObj [[deprecated("Remove in v4.1. Use zeek:Obj instead.")]] = zeek::Obj;
class DbgWatch { class DbgWatch {
public: public:
explicit DbgWatch(zeek::BroObj* var_to_watch); explicit DbgWatch(zeek::Obj* var_to_watch);
explicit DbgWatch(zeek::detail::Expr* expr_to_watch); explicit DbgWatch(zeek::detail::Expr* expr_to_watch);
~DbgWatch(); ~DbgWatch();
protected: protected:
zeek::BroObj* var; zeek::Obj* var;
zeek::detail::Expr* expr; zeek::detail::Expr* expr;
}; };

View file

@ -19,7 +19,7 @@ uint64_t num_events_queued = 0;
uint64_t num_events_dispatched = 0; uint64_t num_events_dispatched = 0;
Event::Event(EventHandlerPtr arg_handler, zeek::Args arg_args, Event::Event(EventHandlerPtr arg_handler, zeek::Args arg_args,
SourceID arg_src, analyzer::ID arg_aid, BroObj* arg_obj) SourceID arg_src, analyzer::ID arg_aid, Obj* arg_obj)
: handler(arg_handler), : handler(arg_handler),
args(std::move(arg_args)), args(std::move(arg_args)),
src(arg_src), src(arg_src),
@ -95,14 +95,14 @@ EventMgr::~EventMgr()
void EventMgr::QueueEventFast(const EventHandlerPtr &h, val_list vl, void EventMgr::QueueEventFast(const EventHandlerPtr &h, val_list vl,
SourceID src, analyzer::ID aid, TimerMgr* mgr, SourceID src, analyzer::ID aid, TimerMgr* mgr,
BroObj* obj) Obj* obj)
{ {
QueueEvent(new Event(h, zeek::val_list_to_args(vl), src, aid, obj)); QueueEvent(new Event(h, zeek::val_list_to_args(vl), src, aid, obj));
} }
void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list vl, void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list vl,
SourceID src, analyzer::ID aid, SourceID src, analyzer::ID aid,
TimerMgr* mgr, BroObj* obj) TimerMgr* mgr, Obj* obj)
{ {
auto args = zeek::val_list_to_args(vl); auto args = zeek::val_list_to_args(vl);
@ -112,7 +112,7 @@ void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list vl,
void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list* vl, void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list* vl,
SourceID src, analyzer::ID aid, SourceID src, analyzer::ID aid,
TimerMgr* mgr, BroObj* obj) TimerMgr* mgr, Obj* obj)
{ {
auto args = zeek::val_list_to_args(*vl); auto args = zeek::val_list_to_args(*vl);
delete vl; delete vl;
@ -122,7 +122,7 @@ void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list* vl,
} }
void EventMgr::Enqueue(const EventHandlerPtr& h, zeek::Args vl, void EventMgr::Enqueue(const EventHandlerPtr& h, zeek::Args vl,
SourceID src, analyzer::ID aid, BroObj* obj) SourceID src, analyzer::ID aid, Obj* obj)
{ {
QueueEvent(new Event(h, std::move(vl), src, aid, obj)); QueueEvent(new Event(h, std::move(vl), src, aid, obj));
} }

View file

@ -14,11 +14,11 @@
class EventMgr; class EventMgr;
class Event final : public zeek::BroObj { class Event final : public zeek::Obj {
public: public:
Event(EventHandlerPtr handler, zeek::Args args, Event(EventHandlerPtr handler, zeek::Args args,
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0, SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
zeek::BroObj* obj = nullptr); zeek::Obj* obj = nullptr);
void SetNext(Event* n) { next_event = n; } void SetNext(Event* n) { next_event = n; }
Event* NextEvent() const { return next_event; } Event* NextEvent() const { return next_event; }
@ -41,14 +41,14 @@ protected:
zeek::Args args; zeek::Args args;
SourceID src; SourceID src;
analyzer::ID aid; analyzer::ID aid;
zeek::BroObj* obj; zeek::Obj* obj;
Event* next_event; Event* next_event;
}; };
extern uint64_t num_events_queued; extern uint64_t num_events_queued;
extern uint64_t num_events_dispatched; extern uint64_t num_events_dispatched;
class EventMgr final : public zeek::BroObj, public iosource::IOSource { class EventMgr final : public zeek::Obj, public iosource::IOSource {
public: public:
EventMgr(); EventMgr();
~EventMgr() override; ~EventMgr() override;
@ -64,7 +64,7 @@ public:
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]] [[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
void QueueEventFast(const EventHandlerPtr &h, val_list vl, void QueueEventFast(const EventHandlerPtr &h, val_list vl,
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0, SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
TimerMgr* mgr = nullptr, zeek::BroObj* obj = nullptr); TimerMgr* mgr = nullptr, zeek::Obj* obj = nullptr);
// Queues an event if there's an event handler (or remote consumer). This // Queues an event if there's an event handler (or remote consumer). This
// function always takes ownership of decrementing the reference count of // function always takes ownership of decrementing the reference count of
@ -75,7 +75,7 @@ public:
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]] [[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
void QueueEvent(const EventHandlerPtr &h, val_list vl, void QueueEvent(const EventHandlerPtr &h, val_list vl,
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0, SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
TimerMgr* mgr = nullptr, zeek::BroObj* obj = nullptr); TimerMgr* mgr = nullptr, zeek::Obj* obj = nullptr);
// Same as QueueEvent, except taking the event's argument list via a // Same as QueueEvent, except taking the event's argument list via a
// pointer instead of by value. This function takes ownership of the // pointer instead of by value. This function takes ownership of the
@ -84,7 +84,7 @@ public:
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]] [[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
void QueueEvent(const EventHandlerPtr &h, val_list* vl, void QueueEvent(const EventHandlerPtr &h, val_list* vl,
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0, SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
TimerMgr* mgr = nullptr, zeek::BroObj* obj = nullptr); TimerMgr* mgr = nullptr, zeek::Obj* obj = nullptr);
/** /**
* Adds an event to the queue. If no handler is found for the event * Adds an event to the queue. If no handler is found for the event
@ -100,7 +100,7 @@ public:
*/ */
void Enqueue(const EventHandlerPtr& h, zeek::Args vl, void Enqueue(const EventHandlerPtr& h, zeek::Args vl,
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0, SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
zeek::BroObj* obj = nullptr); zeek::Obj* obj = nullptr);
/** /**
* A version of Enqueue() taking a variable number of arguments. * A version of Enqueue() taking a variable number of arguments.

View file

@ -84,7 +84,7 @@ using ExprPtr = zeek::IntrusivePtr<Expr>;
using EventExprPtr = zeek::IntrusivePtr<EventExpr>; using EventExprPtr = zeek::IntrusivePtr<EventExpr>;
using ListExprPtr = zeek::IntrusivePtr<ListExpr>; using ListExprPtr = zeek::IntrusivePtr<ListExpr>;
class Expr : public BroObj { class Expr : public Obj {
public: public:
[[deprecated("Remove in v4.1. Use GetType().")]] [[deprecated("Remove in v4.1. Use GetType().")]]
zeek::Type* Type() const { return type.get(); } zeek::Type* Type() const { return type.get(); }

View file

@ -29,7 +29,7 @@ ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek);
class BroFile; class BroFile;
using BroFilePtr = zeek::IntrusivePtr<BroFile>; using BroFilePtr = zeek::IntrusivePtr<BroFile>;
class BroFile final : public zeek::BroObj { class BroFile final : public zeek::Obj {
public: public:
explicit BroFile(FILE* arg_f); explicit BroFile(FILE* arg_f);
BroFile(FILE* arg_f, const char* filename, const char* access); BroFile(FILE* arg_f, const char* filename, const char* access);

View file

@ -35,7 +35,7 @@ using TriggerPtr = zeek::IntrusivePtr<Trigger>;
class Frame; class Frame;
using FramePtr = zeek::IntrusivePtr<Frame>; using FramePtr = zeek::IntrusivePtr<Frame>;
class Frame : public BroObj { class Frame : public Obj {
public: public:
/** /**
* Constructs a new frame belonging to *func* with *fn_args* * Constructs a new frame belonging to *func* with *fn_args*

View file

@ -800,7 +800,7 @@ void emit_builtin_error(const char* msg, zeek::ValPtr arg)
emit_builtin_error(msg, arg.get()); emit_builtin_error(msg, arg.get());
} }
void emit_builtin_error(const char* msg, BroObj* arg) void emit_builtin_error(const char* msg, Obj* arg)
{ {
auto emit = [=](const zeek::detail::CallExpr* ce) auto emit = [=](const zeek::detail::CallExpr* ce)
{ {
@ -878,7 +878,7 @@ void builtin_error(const char* msg, zeek::ValPtr arg)
zeek::emit_builtin_error(msg, arg); zeek::emit_builtin_error(msg, arg);
} }
void builtin_error(const char* msg, zeek::BroObj* arg) void builtin_error(const char* msg, zeek::Obj* arg)
{ {
zeek::emit_builtin_error(msg, arg); zeek::emit_builtin_error(msg, arg);
} }

View file

@ -46,7 +46,7 @@ namespace zeek {
class Func; class Func;
using FuncPtr = zeek::IntrusivePtr<Func>; using FuncPtr = zeek::IntrusivePtr<Func>;
class Func : public BroObj { class Func : public Obj {
public: public:
static inline const FuncPtr nil; static inline const FuncPtr nil;
@ -282,7 +282,7 @@ extern std::string render_call_stack();
// These methods are used by BIFs, so they're in the public namespace. // These methods are used by BIFs, so they're in the public namespace.
extern void emit_builtin_error(const char* msg); extern void emit_builtin_error(const char* msg);
extern void emit_builtin_error(const char* msg, zeek::ValPtr); extern void emit_builtin_error(const char* msg, zeek::ValPtr);
extern void emit_builtin_error(const char* msg, BroObj* arg); extern void emit_builtin_error(const char* msg, Obj* arg);
} // namespace zeek } // namespace zeek
@ -309,4 +309,4 @@ extern void builtin_error(const char* msg);
[[deprecated("Remove in v4.1. Use zeek::emit_builtin_error.")]] [[deprecated("Remove in v4.1. Use zeek::emit_builtin_error.")]]
extern void builtin_error(const char* msg, zeek::ValPtr); extern void builtin_error(const char* msg, zeek::ValPtr);
[[deprecated("Remove in v4.1. Use zeek::emit_builtin_error.")]] [[deprecated("Remove in v4.1. Use zeek::emit_builtin_error.")]]
extern void builtin_error(const char* msg, zeek::BroObj* arg); extern void builtin_error(const char* msg, zeek::Obj* arg);

View file

@ -385,9 +385,9 @@ TraversalCode ID::Traverse(TraversalCallback* cb) const
HANDLE_TC_EXPR_POST(tc); HANDLE_TC_EXPR_POST(tc);
} }
void ID::Error(const char* msg, const BroObj* o2) void ID::Error(const char* msg, const Obj* o2)
{ {
BroObj::Error(msg, o2, true); Obj::Error(msg, o2, true);
SetType(error_type()); SetType(error_type());
} }

View file

@ -45,7 +45,7 @@ enum IDScope { SCOPE_FUNCTION, SCOPE_MODULE, SCOPE_GLOBAL };
class ID; class ID;
using IDPtr = zeek::IntrusivePtr<ID>; using IDPtr = zeek::IntrusivePtr<ID>;
class ID final : public BroObj, public notifier::Modifiable { class ID final : public Obj, public notifier::Modifiable {
public: public:
static inline const IDPtr nil; static inline const IDPtr nil;
@ -137,7 +137,7 @@ public:
std::string GetDeprecationWarning() const; std::string GetDeprecationWarning() const;
void Error(const char* msg, const BroObj* o2 = nullptr); void Error(const char* msg, const Obj* o2 = nullptr);
void Describe(ODesc* d) const override; void Describe(ODesc* d) const override;
// Adds type and value to description. // Adds type and value to description.

View file

@ -33,7 +33,7 @@ struct NewRef {};
* for destroying the shared object. * for destroying the shared object.
* *
* The @c IntrusivePtr works with any type that offers the two free functions, * The @c IntrusivePtr works with any type that offers the two free functions,
* but most notably is designed to work with @c BroObj and its subtypes. * but most notably is designed to work with @c Obj and its subtypes.
* *
* The same object may get managed via @c IntrusivePtr in one part of the * The same object may get managed via @c IntrusivePtr in one part of the
* code base while another part of the program manages it manually by passing * code base while another part of the program manages it manually by passing

View file

@ -25,7 +25,7 @@ using NFA_state_list = zeek::PList<NFA_State>;
#define SYM_CCL 260 #define SYM_CCL 260
class NFA_State : public zeek::BroObj { class NFA_State : public zeek::Obj {
public: public:
NFA_State(int sym, EquivClass* ec); NFA_State(int sym, EquivClass* ec);
explicit NFA_State(CCL* ccl); explicit NFA_State(CCL* ccl);
@ -82,7 +82,7 @@ public:
EpsilonState() : NFA_State(SYM_EPSILON, nullptr) { } EpsilonState() : NFA_State(SYM_EPSILON, nullptr) { }
}; };
class NFA_Machine : public zeek::BroObj { class NFA_Machine : public zeek::Obj {
public: public:
explicit NFA_Machine(NFA_State* first, NFA_State* final = nullptr); explicit NFA_Machine(NFA_State* first, NFA_State* final = nullptr);
~NFA_Machine() override; ~NFA_Machine() override;

View file

@ -53,9 +53,9 @@ bool Location::operator==(const Location& l) const
} // namespace detail } // namespace detail
int BroObj::suppress_errors = 0; int Obj::suppress_errors = 0;
BroObj::~BroObj() Obj::~Obj()
{ {
if ( notify_plugins ) if ( notify_plugins )
PLUGIN_HOOK_VOID(HOOK_BRO_OBJ_DTOR, HookBroObjDtor(this)); PLUGIN_HOOK_VOID(HOOK_BRO_OBJ_DTOR, HookBroObjDtor(this));
@ -63,7 +63,7 @@ BroObj::~BroObj()
delete location; delete location;
} }
void BroObj::Warn(const char* msg, const BroObj* 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; ODesc d;
DoMsg(&d, msg, obj2, pinpoint_only, expr_location); DoMsg(&d, msg, obj2, pinpoint_only, expr_location);
@ -71,7 +71,7 @@ void BroObj::Warn(const char* msg, const BroObj* obj2, bool pinpoint_only, const
reporter->PopLocation(); reporter->PopLocation();
} }
void BroObj::Error(const char* msg, const BroObj* obj2, bool pinpoint_only, const detail::Location* expr_location) const void Obj::Error(const char* msg, const Obj* obj2, bool pinpoint_only, const detail::Location* expr_location) const
{ {
if ( suppress_errors ) if ( suppress_errors )
return; return;
@ -82,7 +82,7 @@ void BroObj::Error(const char* msg, const BroObj* obj2, bool pinpoint_only, cons
reporter->PopLocation(); reporter->PopLocation();
} }
void BroObj::BadTag(const char* msg, const char* t1, const char* t2) const void Obj::BadTag(const char* msg, const char* t1, const char* t2) const
{ {
char out[512]; char out[512];
@ -99,7 +99,7 @@ void BroObj::BadTag(const char* msg, const char* t1, const char* t2) const
reporter->PopLocation(); reporter->PopLocation();
} }
void BroObj::Internal(const char* msg) const void Obj::Internal(const char* msg) const
{ {
ODesc d; ODesc d;
DoMsg(&d, msg); DoMsg(&d, msg);
@ -113,7 +113,7 @@ void BroObj::Internal(const char* msg) const
reporter->PopLocation(); reporter->PopLocation();
} }
void BroObj::InternalWarning(const char* msg) const void Obj::InternalWarning(const char* msg) const
{ {
ODesc d; ODesc d;
DoMsg(&d, msg); DoMsg(&d, msg);
@ -121,7 +121,7 @@ void BroObj::InternalWarning(const char* msg) const
reporter->PopLocation(); reporter->PopLocation();
} }
void BroObj::AddLocation(ODesc* d) const void Obj::AddLocation(ODesc* d) const
{ {
if ( ! location ) if ( ! location )
{ {
@ -132,7 +132,7 @@ void BroObj::AddLocation(ODesc* d) const
location->Describe(d); location->Describe(d);
} }
bool BroObj::SetLocationInfo(const detail::Location* start, const detail::Location* end) bool Obj::SetLocationInfo(const detail::Location* start, const detail::Location* end)
{ {
if ( ! start || ! end ) if ( ! start || ! end )
return false; return false;
@ -153,7 +153,7 @@ bool BroObj::SetLocationInfo(const detail::Location* start, const detail::Locati
return true; return true;
} }
void BroObj::UpdateLocationEndInfo(const detail::Location& end) void Obj::UpdateLocationEndInfo(const detail::Location& end)
{ {
if ( ! location ) if ( ! location )
SetLocationInfo(&end, &end); SetLocationInfo(&end, &end);
@ -162,7 +162,7 @@ void BroObj::UpdateLocationEndInfo(const detail::Location& end)
location->last_column = end.last_column; location->last_column = end.last_column;
} }
void BroObj::DoMsg(ODesc* d, const char s1[], const BroObj* obj2, void Obj::DoMsg(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 BroObj::DoMsg(ODesc* d, const char s1[], const BroObj* obj2,
reporter->PushLocation(GetLocationInfo(), loc2); reporter->PushLocation(GetLocationInfo(), loc2);
} }
void BroObj::PinPoint(ODesc* d, const BroObj* obj2, bool pinpoint_only) const void Obj::PinPoint(ODesc* d, const Obj* obj2, bool pinpoint_only) const
{ {
d->Add(" ("); d->Add(" (");
Describe(d); Describe(d);
@ -193,7 +193,7 @@ void BroObj::PinPoint(ODesc* d, const BroObj* obj2, bool pinpoint_only) const
d->Add(")"); d->Add(")");
} }
void BroObj::Print() const void Obj::Print() const
{ {
static BroFile fstderr(stderr); static BroFile fstderr(stderr);
ODesc d(DESC_READABLE, &fstderr); ODesc d(DESC_READABLE, &fstderr);
@ -207,14 +207,14 @@ void bad_ref(int type)
abort(); abort();
} }
void bro_obj_delete_func(void* v) void obj_delete_func(void* v)
{ {
Unref((BroObj*) v); Unref((Obj*) v);
} }
} // namespace zeek } // namespace zeek
void print(const zeek::BroObj* obj) void print(const zeek::Obj* obj)
{ {
obj->Print(); obj->Print();
} }

View file

@ -55,9 +55,9 @@ inline void set_location(const Location start, const Location end)
} // namespace detail } // namespace detail
class BroObj { class Obj {
public: public:
BroObj() Obj()
{ {
// A bit of a hack. We'd like to associate location // A bit of a hack. We'd like to associate location
// information with every object created when parsing, // information with every object created when parsing,
@ -77,18 +77,18 @@ public:
SetLocationInfo(&detail::start_location, &detail::end_location); SetLocationInfo(&detail::start_location, &detail::end_location);
} }
virtual ~BroObj(); virtual ~Obj();
/* disallow copying */ /* disallow copying */
BroObj(const BroObj &) = delete; Obj(const Obj &) = delete;
BroObj &operator=(const BroObj &) = delete; Obj &operator=(const Obj &) = delete;
// Report user warnings/errors. If obj2 is given, then it's // Report user warnings/errors. If obj2 is given, then it's
// included in the message, though if pinpoint_only is non-zero, // included in the message, though if pinpoint_only is non-zero,
// then obj2 is only used to pinpoint the location. // then obj2 is only used to pinpoint the location.
void Warn(const char* msg, const BroObj* obj2 = nullptr, void Warn(const char* msg, 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 Error(const char* msg, const BroObj* obj2 = nullptr, void Error(const char* msg, 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;
// Report internal errors. // Report internal errors.
@ -130,8 +130,8 @@ public:
// as long as there exist any instances. // as long as there exist any instances.
class SuppressErrors { class SuppressErrors {
public: public:
SuppressErrors() { ++BroObj::suppress_errors; } SuppressErrors() { ++Obj::suppress_errors; }
~SuppressErrors() { --BroObj::suppress_errors; } ~SuppressErrors() { --Obj::suppress_errors; }
}; };
void Print() const; void Print() const;
@ -142,13 +142,13 @@ protected:
private: private:
friend class SuppressErrors; friend class SuppressErrors;
void DoMsg(ODesc* d, const char s1[], const BroObj* obj2 = nullptr, void DoMsg(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 BroObj* obj2 = nullptr, void PinPoint(ODesc* d, const Obj* obj2 = nullptr,
bool pinpoint_only = false) const; bool pinpoint_only = false) const;
friend inline void Ref(BroObj* o); friend inline void Ref(Obj* o);
friend inline void Unref(BroObj* o); friend inline void Unref(Obj* o);
bool notify_plugins = false; bool notify_plugins = false;
int ref_cnt = 1; int ref_cnt = 1;
@ -158,16 +158,16 @@ private:
static int suppress_errors; static int suppress_errors;
}; };
// Sometimes useful when dealing with BroObj subclasses that have their // Sometimes useful when dealing with Obj subclasses that have their
// own (protected) versions of Error. // own (protected) versions of Error.
inline void Error(const BroObj* o, const char* msg) inline void Error(const Obj* o, const char* msg)
{ {
o->Error(msg); o->Error(msg);
} }
[[noreturn]] extern void bad_ref(int type); [[noreturn]] extern void bad_ref(int type);
inline void Ref(BroObj* o) inline void Ref(Obj* o)
{ {
if ( ++(o->ref_cnt) <= 1 ) if ( ++(o->ref_cnt) <= 1 )
bad_ref(0); bad_ref(0);
@ -175,7 +175,7 @@ inline void Ref(BroObj* o)
bad_ref(1); bad_ref(1);
} }
inline void Unref(BroObj* o) inline void Unref(Obj* o)
{ {
if ( o && --o->ref_cnt <= 0 ) if ( o && --o->ref_cnt <= 0 )
{ {
@ -184,18 +184,18 @@ inline void Unref(BroObj* o)
delete o; delete o;
// We could do the following if o were passed by reference. // We could do the following if o were passed by reference.
// o = (BroObj*) 0xcd; // o = (Obj*) 0xcd;
} }
} }
// A dict_delete_func that knows to Unref() dictionary entries. // A dict_delete_func that knows to Unref() dictionary entries.
extern void bro_obj_delete_func(void* v); extern void obj_delete_func(void* v);
} // namespace zeek } // namespace zeek
using Location [[deprecated("Remove in v4.1. Use zeek::detail::Location instead.")]] = zeek::detail::Location; using Location [[deprecated("Remove in v4.1. Use zeek::detail::Location instead.")]] = zeek::detail::Location;
using yyltype [[deprecated("Remove in v4.1. Use zeek::detail::yyltype instead.")]] = zeek::detail::yyltype; using yyltype [[deprecated("Remove in v4.1. Use zeek::detail::yyltype instead.")]] = zeek::detail::yyltype;
using BroObj [[deprecated("Remove in v4.1. Use zeek::BroObj instead.")]] = zeek::BroObj; using BroObj [[deprecated("Remove in v4.1. Use zeek::Obj instead.")]] = zeek::Obj;
[[deprecated("Remove in v4.1. Use zeek::BroObj::Print instead.")]] [[deprecated("Remove in v4.1. Use zeek::Obj::Print instead.")]]
extern void print(const zeek::BroObj* obj); extern void print(const zeek::Obj* obj);

View file

@ -251,7 +251,7 @@ private:
DataBlockMap block_map; DataBlockMap block_map;
}; };
class Reassembler : public zeek::BroObj { class Reassembler : public zeek::Obj {
public: public:
Reassembler(uint64_t init_seq, ReassemblerType reassem_type = REASSEM_UNKNOWN); Reassembler(uint64_t init_seq, ReassemblerType reassem_type = REASSEM_UNKNOWN);
~Reassembler() override {} ~Reassembler() override {}

View file

@ -31,7 +31,7 @@ using IDPtr = zeek::IntrusivePtr<ID>;
class Scope; class Scope;
using ScopePtr = zeek::IntrusivePtr<Scope>; using ScopePtr = zeek::IntrusivePtr<Scope>;
class Scope : public BroObj { class Scope : public Obj {
public: public:
explicit Scope(zeek::detail::IDPtr id, explicit Scope(zeek::detail::IDPtr id,
std::unique_ptr<std::vector<zeek::detail::AttrPtr>> al); std::unique_ptr<std::vector<zeek::detail::AttrPtr>> al);

View file

@ -53,7 +53,7 @@ Stmt::~Stmt()
bool Stmt::SetLocationInfo(const Location* start, const Location* end) bool Stmt::SetLocationInfo(const Location* start, const Location* end)
{ {
if ( ! BroObj::SetLocationInfo(start, end) ) if ( ! Obj::SetLocationInfo(start, end) )
return false; return false;
// Update the Filemap of line number -> statement mapping for // Update the Filemap of line number -> statement mapping for

View file

@ -30,7 +30,7 @@ using ListExprPtr = zeek::IntrusivePtr<ListExpr>;
class Stmt; class Stmt;
using StmtPtr = zeek::IntrusivePtr<Stmt>; using StmtPtr = zeek::IntrusivePtr<Stmt>;
class Stmt : public BroObj { class Stmt : public Obj {
public: public:
BroStmtTag Tag() const { return tag; } BroStmtTag Tag() const { return tag; }
@ -166,7 +166,7 @@ protected:
StmtPtr s2; StmtPtr s2;
}; };
class Case final : public BroObj { class Case final : public Obj {
public: public:
Case(ListExprPtr c, id_list* types, StmtPtr arg_s); Case(ListExprPtr c, id_list* types, StmtPtr arg_s);
~Case() override; ~Case() override;

View file

@ -59,7 +59,7 @@ TraversalCode zeek::detail::trigger::TriggerTraversalCallback::PreExpr(const zee
case EXPR_INDEX: case EXPR_INDEX:
{ {
const auto* e = static_cast<const zeek::detail::IndexExpr*>(expr); const auto* e = static_cast<const zeek::detail::IndexExpr*>(expr);
BroObj::SuppressErrors no_errors; Obj::SuppressErrors no_errors;
try try
{ {

View file

@ -27,7 +27,7 @@ namespace zeek::detail::trigger {
class TriggerTimer; class TriggerTimer;
class TriggerTraversalCallback; class TriggerTraversalCallback;
class Trigger final : public BroObj, public notifier::Receiver { class Trigger final : public Obj, public notifier::Receiver {
public: public:
// Don't access Trigger objects; they take care of themselves after // Don't access Trigger objects; they take care of themselves after
// instantiation. Note that if the condition is already true, the // instantiation. Note that if the condition is already true, the
@ -110,7 +110,7 @@ private:
bool delayed; // true if a function call is currently being delayed bool delayed; // true if a function call is currently being delayed
bool disabled; bool disabled;
std::vector<std::pair<BroObj *, notifier::Modifiable*>> objs; std::vector<std::pair<Obj *, notifier::Modifiable*>> objs;
using ValCache = std::map<const zeek::detail::CallExpr*, Val*>; using ValCache = std::map<const zeek::detail::CallExpr*, Val*>;
ValCache cache; ValCache cache;

View file

@ -167,7 +167,7 @@ constexpr int DOES_NOT_MATCH_INDEX = 0;
constexpr int MATCHES_INDEX_SCALAR = 1; constexpr int MATCHES_INDEX_SCALAR = 1;
constexpr int MATCHES_INDEX_VECTOR = 2; constexpr int MATCHES_INDEX_VECTOR = 2;
class Type : public BroObj { class Type : public Obj {
public: public:
static inline const TypePtr nil; static inline const TypePtr nil;

View file

@ -138,7 +138,7 @@ union BroValUnion {
: table_val(value) {} : table_val(value) {}
}; };
class Val : public BroObj { class Val : public Obj {
public: public:
static inline const ValPtr nil; static inline const ValPtr nil;
@ -1204,10 +1204,10 @@ public:
*/ */
TableValPtr GetRecordFieldsVal() const; TableValPtr GetRecordFieldsVal() const;
// This is an experiment to associate a BroObj within the // This is an experiment to associate a Obj within the
// event engine to a record value in bro script. // event engine to a record value in bro script.
void SetOrigin(BroObj* o) { origin = o; } void SetOrigin(Obj* o) { origin = o; }
BroObj* GetOrigin() const { return origin; } Obj* GetOrigin() const { return origin; }
// Returns a new value representing the value coerced to the given // Returns a new value representing the value coerced to the given
// type. If coercion is not possible, returns 0. The non-const // type. If coercion is not possible, returns 0. The non-const
@ -1241,7 +1241,7 @@ public:
protected: protected:
ValPtr DoClone(CloneState* state) override; ValPtr DoClone(CloneState* state) override;
BroObj* origin; Obj* origin;
using RecordTypeValMap = std::unordered_map<zeek::RecordType*, std::vector<RecordValPtr>>; using RecordTypeValMap = std::unordered_map<zeek::RecordType*, std::vector<RecordValPtr>>;
static RecordTypeValMap parse_time_records; static RecordTypeValMap parse_time_records;

View file

@ -122,7 +122,7 @@ static void make_var(const zeek::detail::IDPtr& id, zeek::TypePtr t,
{ {
if ( id->IsRedefinable() || (! init && attr && ! zeek::IsFunc(id->GetType()->Tag())) ) if ( id->IsRedefinable() || (! init && attr && ! zeek::IsFunc(id->GetType()->Tag())) )
{ {
zeek::BroObj* redef_obj = init ? (zeek::BroObj*) init.get() : (zeek::BroObj*) t.get(); zeek::Obj* redef_obj = init ? (zeek::Obj*) init.get() : (zeek::Obj*) t.get();
if ( dt != VAR_REDEF ) if ( dt != VAR_REDEF )
id->Warn("redefinition requires \"redef\"", redef_obj, true); id->Warn("redefinition requires \"redef\"", redef_obj, true);
} }

View file

@ -32,7 +32,7 @@ extern "C" {
namespace analyzer::arp { namespace analyzer::arp {
class ARP_Analyzer : public zeek::BroObj { class ARP_Analyzer : public zeek::Obj {
public: public:
ARP_Analyzer(); ARP_Analyzer();
~ARP_Analyzer() override; ~ARP_Analyzer() override;

View file

@ -12,7 +12,7 @@ namespace analyzer::stepping_stone {
class SteppingStoneEndpoint; class SteppingStoneEndpoint;
class SteppingStoneManager; class SteppingStoneManager;
class SteppingStoneEndpoint : public zeek::BroObj { class SteppingStoneEndpoint : public zeek::Obj {
public: public:
SteppingStoneEndpoint(tcp::TCP_Endpoint* e, SteppingStoneManager* m); SteppingStoneEndpoint(tcp::TCP_Endpoint* e, SteppingStoneManager* m);
~SteppingStoneEndpoint() override; ~SteppingStoneEndpoint() override;

View file

@ -1557,7 +1557,7 @@ void TCP_Analyzer::ExpireTimer(double t)
} }
// Connection still active, so reschedule timer. // Connection still active, so reschedule timer.
// ### if PQ_Element's were BroObj's, could just Ref the timer // ### if PQ_Element's were Obj's, could just Ref the timer
// and adjust its value here, instead of creating a new timer. // and adjust its value here, instead of creating a new timer.
ADD_ANALYZER_TIMER(&TCP_Analyzer::ExpireTimer, t + tcp_session_timer, ADD_ANALYZER_TIMER(&TCP_Analyzer::ExpireTimer, t + tcp_session_timer,
false, TIMER_TCP_EXPIRE); false, TIMER_TCP_EXPIRE);

View file

@ -578,7 +578,7 @@ void Manager::RequestEvent(EventHandlerPtr handler, Plugin* plugin)
handler->SetGenerateAlways(); handler->SetGenerateAlways();
} }
void Manager::RequestBroObjDtor(BroObj* obj, Plugin* plugin) void Manager::RequestBroObjDtor(Obj* obj, Plugin* plugin)
{ {
obj->NotifyPluginsOnDtor(); obj->NotifyPluginsOnDtor();
} }

View file

@ -214,7 +214,7 @@ public:
void RequestEvent(EventHandlerPtr handler, Plugin* plugin); void RequestEvent(EventHandlerPtr handler, Plugin* plugin);
/** /**
* Register interest in the destruction of a BroObj instance. When Bro's * Register interest in the destruction of a Obj instance. When Bro's
* reference counting triggers the objects destructor to run, the \a * reference counting triggers the objects destructor to run, the \a
* HookBroObjDtor will be called. * HookBroObjDtor will be called.
* *
@ -222,7 +222,7 @@ public:
* *
* @param plugin The plugin expressing interest. * @param plugin The plugin expressing interest.
*/ */
void RequestBroObjDtor(BroObj* obj, Plugin* plugin); void RequestBroObjDtor(Obj* obj, Plugin* plugin);
// Hook entry functions. // Hook entry functions.

View file

@ -365,7 +365,7 @@ void Plugin::RequestEvent(EventHandlerPtr handler)
plugin_mgr->RequestEvent(handler, this); plugin_mgr->RequestEvent(handler, this);
} }
void Plugin::RequestBroObjDtor(BroObj* obj) void Plugin::RequestBroObjDtor(Obj* obj)
{ {
plugin_mgr->RequestBroObjDtor(obj, this); plugin_mgr->RequestBroObjDtor(obj, this);
} }

View file

@ -25,8 +25,11 @@ ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail);
namespace zeek { namespace zeek {
template <class T> class IntrusivePtr; template <class T> class IntrusivePtr;
using ValPtr = zeek::IntrusivePtr<Val>; using ValPtr = zeek::IntrusivePtr<Val>;
class Obj;
} }
using BroObj [[deprecated("Remove in v4.1. Use zeek::Obj instead.")]] = zeek::Obj;
namespace threading { namespace threading {
struct Field; struct Field;
} }
@ -613,7 +616,7 @@ protected:
void RequestEvent(EventHandlerPtr handler); void RequestEvent(EventHandlerPtr handler);
/** /**
* Registers interest in the destruction of a BroObj instance. When * Registers interest in the destruction of a Obj instance. When
* Bro's reference counting triggers the objects destructor to run, * Bro's reference counting triggers the objects destructor to run,
* \a HookBroObjDtor will be called. * \a HookBroObjDtor will be called.
* *
@ -621,7 +624,7 @@ protected:
* *
* @param handler The object being interested in. * @param handler The object being interested in.
*/ */
void RequestBroObjDtor(zeek::BroObj* obj); void RequestBroObjDtor(zeek::Obj* obj);
// Hook functions. // Hook functions.

View file

@ -710,7 +710,7 @@ static int load_files(const char* orig_file)
yylloc.first_line = yylloc.last_line = line_number = 1; yylloc.first_line = yylloc.last_line = line_number = 1;
// Don't delete the old filename - it's pointed to by // Don't delete the old filename - it's pointed to by
// every BroObj created when parsing it. // every Obj created when parsing it.
yylloc.filename = filename = copy_string(file_path.c_str()); yylloc.filename = filename = copy_string(file_path.c_str());
return 1; return 1;
@ -923,7 +923,7 @@ int yywrap()
if ( load_files(files[0]) ) if ( load_files(files[0]) )
{ {
// Don't delete the filename - it's pointed to by // Don't delete the filename - it's pointed to by
// every BroObj created when parsing it. // every Obj created when parsing it.
(void) files.remove_nth(0); (void) files.remove_nth(0);
return 0; return 0;
} }

View file

@ -8,8 +8,6 @@
#include "iosource/IOSource.h" #include "iosource/IOSource.h"
#include "Flare.h" #include "Flare.h"
ZEEK_FORWARD_DECLARE_NAMESPACED(BroObj, zeek);
namespace threading { namespace threading {
class BasicInputMessage; class BasicInputMessage;