diff --git a/src/Attr.h b/src/Attr.h index b8263f0239..4439701f86 100644 --- a/src/Attr.h +++ b/src/Attr.h @@ -51,7 +51,7 @@ using AttrPtr = zeek::IntrusivePtr; class Attributes; using AttributesPtr = zeek::IntrusivePtr; -class Attr final : public BroObj { +class Attr final : public Obj { public: static inline const AttrPtr nil; @@ -95,7 +95,7 @@ protected: }; // Manages a collection of attributes. -class Attributes final : public BroObj { +class Attributes final : public Obj { public: [[deprecated("Remove in v4.1. Construct using IntrusivePtrs instead.")]] Attributes(attr_list* a, zeek::TypePtr t, bool in_record, bool is_global); diff --git a/src/Conn.h b/src/Conn.h index 64af809a5b..a8f6864335 100644 --- a/src/Conn.h +++ b/src/Conn.h @@ -64,7 +64,7 @@ static inline int addr_port_canon_lt(const IPAddr& addr1, uint32_t p1, namespace analyzer { class Analyzer; } -class Connection final : public zeek::BroObj { +class Connection final : public zeek::Obj { public: Connection(NetSessions* s, const ConnIDKey& k, double t, const ConnID* id, uint32_t flow, const Packet* pkt, const EncapsulationStack* arg_encap); diff --git a/src/DFA.h b/src/DFA.h index d35fca15e7..99aac3d47e 100644 --- a/src/DFA.h +++ b/src/DFA.h @@ -24,7 +24,7 @@ class DFA_State; class DFA_Machine; class DFA_State; -class DFA_State : public zeek::BroObj { +class DFA_State : public zeek::Obj { public: DFA_State(int state_num, const EquivClass* ec, NFA_state_list* nfa_states, AcceptingSet* accept); @@ -109,7 +109,7 @@ private: std::map states; }; -class DFA_Machine : public zeek::BroObj { +class DFA_Machine : public zeek::Obj { public: DFA_Machine(NFA_Machine* n, EquivClass* ec); ~DFA_Machine() override; diff --git a/src/DbgWatch.cc b/src/DbgWatch.cc index 1b4b338b8b..157ab70c35 100644 --- a/src/DbgWatch.cc +++ b/src/DbgWatch.cc @@ -7,7 +7,7 @@ #include "Reporter.h" // Support classes -DbgWatch::DbgWatch(zeek::BroObj* var_to_watch) +DbgWatch::DbgWatch(zeek::Obj* var_to_watch) { reporter->InternalError("DbgWatch unimplemented"); } diff --git a/src/DbgWatch.h b/src/DbgWatch.h index 4a53dbd969..a66d9d1bc1 100644 --- a/src/DbgWatch.h +++ b/src/DbgWatch.h @@ -5,15 +5,16 @@ #include "util.h" 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 { public: - explicit DbgWatch(zeek::BroObj* var_to_watch); + explicit DbgWatch(zeek::Obj* var_to_watch); explicit DbgWatch(zeek::detail::Expr* expr_to_watch); ~DbgWatch(); protected: - zeek::BroObj* var; + zeek::Obj* var; zeek::detail::Expr* expr; }; diff --git a/src/Event.cc b/src/Event.cc index 0f8c3b468b..c9012f5ed5 100644 --- a/src/Event.cc +++ b/src/Event.cc @@ -19,7 +19,7 @@ uint64_t num_events_queued = 0; uint64_t num_events_dispatched = 0; 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), args(std::move(arg_args)), src(arg_src), @@ -95,14 +95,14 @@ EventMgr::~EventMgr() void EventMgr::QueueEventFast(const EventHandlerPtr &h, val_list vl, SourceID src, analyzer::ID aid, TimerMgr* mgr, - BroObj* obj) + Obj* obj) { QueueEvent(new Event(h, zeek::val_list_to_args(vl), src, aid, obj)); } void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list vl, SourceID src, analyzer::ID aid, - TimerMgr* mgr, BroObj* obj) + TimerMgr* mgr, Obj* obj) { 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, SourceID src, analyzer::ID aid, - TimerMgr* mgr, BroObj* obj) + TimerMgr* mgr, Obj* obj) { auto args = zeek::val_list_to_args(*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, - SourceID src, analyzer::ID aid, BroObj* obj) + SourceID src, analyzer::ID aid, Obj* obj) { QueueEvent(new Event(h, std::move(vl), src, aid, obj)); } diff --git a/src/Event.h b/src/Event.h index 614ba43c3d..41620a906a 100644 --- a/src/Event.h +++ b/src/Event.h @@ -14,11 +14,11 @@ class EventMgr; -class Event final : public zeek::BroObj { +class Event final : public zeek::Obj { public: Event(EventHandlerPtr handler, zeek::Args args, SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0, - zeek::BroObj* obj = nullptr); + zeek::Obj* obj = nullptr); void SetNext(Event* n) { next_event = n; } Event* NextEvent() const { return next_event; } @@ -41,14 +41,14 @@ protected: zeek::Args args; SourceID src; analyzer::ID aid; - zeek::BroObj* obj; + zeek::Obj* obj; Event* next_event; }; extern uint64_t num_events_queued; 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: EventMgr(); ~EventMgr() override; @@ -64,7 +64,7 @@ public: [[deprecated("Remove in v4.1. Use Enqueue() instead.")]] void QueueEventFast(const EventHandlerPtr &h, val_list vl, 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 // function always takes ownership of decrementing the reference count of @@ -75,7 +75,7 @@ public: [[deprecated("Remove in v4.1. Use Enqueue() instead.")]] void QueueEvent(const EventHandlerPtr &h, val_list vl, 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 // pointer instead of by value. This function takes ownership of the @@ -84,7 +84,7 @@ public: [[deprecated("Remove in v4.1. Use Enqueue() instead.")]] void QueueEvent(const EventHandlerPtr &h, val_list* vl, 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 @@ -100,7 +100,7 @@ public: */ void Enqueue(const EventHandlerPtr& h, zeek::Args vl, 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. diff --git a/src/Expr.h b/src/Expr.h index 654d9caa47..86a9c7f023 100644 --- a/src/Expr.h +++ b/src/Expr.h @@ -84,7 +84,7 @@ using ExprPtr = zeek::IntrusivePtr; using EventExprPtr = zeek::IntrusivePtr; using ListExprPtr = zeek::IntrusivePtr; -class Expr : public BroObj { +class Expr : public Obj { public: [[deprecated("Remove in v4.1. Use GetType().")]] zeek::Type* Type() const { return type.get(); } diff --git a/src/File.h b/src/File.h index b7d6660da0..486b09d14e 100644 --- a/src/File.h +++ b/src/File.h @@ -29,7 +29,7 @@ ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); class BroFile; using BroFilePtr = zeek::IntrusivePtr; -class BroFile final : public zeek::BroObj { +class BroFile final : public zeek::Obj { public: explicit BroFile(FILE* arg_f); BroFile(FILE* arg_f, const char* filename, const char* access); diff --git a/src/Frame.h b/src/Frame.h index ff62ee6fc2..416e921b1f 100644 --- a/src/Frame.h +++ b/src/Frame.h @@ -35,7 +35,7 @@ using TriggerPtr = zeek::IntrusivePtr; class Frame; using FramePtr = zeek::IntrusivePtr; -class Frame : public BroObj { +class Frame : public Obj { public: /** * Constructs a new frame belonging to *func* with *fn_args* diff --git a/src/Func.cc b/src/Func.cc index c2f5771ba3..97272efd1b 100644 --- a/src/Func.cc +++ b/src/Func.cc @@ -800,7 +800,7 @@ void emit_builtin_error(const char* msg, zeek::ValPtr arg) 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) { @@ -878,7 +878,7 @@ void builtin_error(const char* msg, zeek::ValPtr 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); } diff --git a/src/Func.h b/src/Func.h index a9b2603e7a..2f3d703690 100644 --- a/src/Func.h +++ b/src/Func.h @@ -46,7 +46,7 @@ namespace zeek { class Func; using FuncPtr = zeek::IntrusivePtr; -class Func : public BroObj { +class Func : public Obj { public: 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. 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, BroObj* arg); +extern void emit_builtin_error(const char* msg, Obj* arg); } // namespace zeek @@ -309,4 +309,4 @@ extern void builtin_error(const char* msg); [[deprecated("Remove in v4.1. Use zeek::emit_builtin_error.")]] extern void builtin_error(const char* msg, zeek::ValPtr); [[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); diff --git a/src/ID.cc b/src/ID.cc index f4eae447db..ba184ccaec 100644 --- a/src/ID.cc +++ b/src/ID.cc @@ -385,9 +385,9 @@ TraversalCode ID::Traverse(TraversalCallback* cb) const 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()); } diff --git a/src/ID.h b/src/ID.h index a410debd4a..d1996ba695 100644 --- a/src/ID.h +++ b/src/ID.h @@ -45,7 +45,7 @@ enum IDScope { SCOPE_FUNCTION, SCOPE_MODULE, SCOPE_GLOBAL }; class ID; using IDPtr = zeek::IntrusivePtr; -class ID final : public BroObj, public notifier::Modifiable { +class ID final : public Obj, public notifier::Modifiable { public: static inline const IDPtr nil; @@ -137,7 +137,7 @@ public: 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; // Adds type and value to description. diff --git a/src/IntrusivePtr.h b/src/IntrusivePtr.h index f66ba5114a..b98761a326 100644 --- a/src/IntrusivePtr.h +++ b/src/IntrusivePtr.h @@ -33,7 +33,7 @@ struct NewRef {}; * for destroying the shared object. * * 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 * code base while another part of the program manages it manually by passing diff --git a/src/NFA.h b/src/NFA.h index 27cc7e5096..ce10aa4d08 100644 --- a/src/NFA.h +++ b/src/NFA.h @@ -25,7 +25,7 @@ using NFA_state_list = zeek::PList; #define SYM_CCL 260 -class NFA_State : public zeek::BroObj { +class NFA_State : public zeek::Obj { public: NFA_State(int sym, EquivClass* ec); explicit NFA_State(CCL* ccl); @@ -82,7 +82,7 @@ public: EpsilonState() : NFA_State(SYM_EPSILON, nullptr) { } }; -class NFA_Machine : public zeek::BroObj { +class NFA_Machine : public zeek::Obj { public: explicit NFA_Machine(NFA_State* first, NFA_State* final = nullptr); ~NFA_Machine() override; diff --git a/src/Obj.cc b/src/Obj.cc index daa8734353..b733ba0055 100644 --- a/src/Obj.cc +++ b/src/Obj.cc @@ -53,9 +53,9 @@ bool Location::operator==(const Location& l) const } // namespace detail -int BroObj::suppress_errors = 0; +int Obj::suppress_errors = 0; -BroObj::~BroObj() +Obj::~Obj() { if ( notify_plugins ) PLUGIN_HOOK_VOID(HOOK_BRO_OBJ_DTOR, HookBroObjDtor(this)); @@ -63,7 +63,7 @@ BroObj::~BroObj() 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; 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(); } -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 ) return; @@ -82,7 +82,7 @@ void BroObj::Error(const char* msg, const BroObj* obj2, bool pinpoint_only, cons 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]; @@ -99,7 +99,7 @@ void BroObj::BadTag(const char* msg, const char* t1, const char* t2) const reporter->PopLocation(); } -void BroObj::Internal(const char* msg) const +void Obj::Internal(const char* msg) const { ODesc d; DoMsg(&d, msg); @@ -113,7 +113,7 @@ void BroObj::Internal(const char* msg) const reporter->PopLocation(); } -void BroObj::InternalWarning(const char* msg) const +void Obj::InternalWarning(const char* msg) const { ODesc d; DoMsg(&d, msg); @@ -121,7 +121,7 @@ void BroObj::InternalWarning(const char* msg) const reporter->PopLocation(); } -void BroObj::AddLocation(ODesc* d) const +void Obj::AddLocation(ODesc* d) const { if ( ! location ) { @@ -132,7 +132,7 @@ void BroObj::AddLocation(ODesc* d) const 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 ) return false; @@ -153,7 +153,7 @@ bool BroObj::SetLocationInfo(const detail::Location* start, const detail::Locati return true; } -void BroObj::UpdateLocationEndInfo(const detail::Location& end) +void Obj::UpdateLocationEndInfo(const detail::Location& end) { if ( ! location ) SetLocationInfo(&end, &end); @@ -162,7 +162,7 @@ void BroObj::UpdateLocationEndInfo(const detail::Location& end) 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 { d->SetShort(); @@ -180,7 +180,7 @@ void BroObj::DoMsg(ODesc* d, const char s1[], const BroObj* obj2, 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(" ("); Describe(d); @@ -193,7 +193,7 @@ void BroObj::PinPoint(ODesc* d, const BroObj* obj2, bool pinpoint_only) const d->Add(")"); } -void BroObj::Print() const +void Obj::Print() const { static BroFile fstderr(stderr); ODesc d(DESC_READABLE, &fstderr); @@ -207,14 +207,14 @@ void bad_ref(int type) abort(); } -void bro_obj_delete_func(void* v) +void obj_delete_func(void* v) { - Unref((BroObj*) v); + Unref((Obj*) v); } } // namespace zeek -void print(const zeek::BroObj* obj) +void print(const zeek::Obj* obj) { obj->Print(); } diff --git a/src/Obj.h b/src/Obj.h index 4829a80921..e121871036 100644 --- a/src/Obj.h +++ b/src/Obj.h @@ -55,9 +55,9 @@ inline void set_location(const Location start, const Location end) } // namespace detail -class BroObj { +class Obj { public: - BroObj() + Obj() { // A bit of a hack. We'd like to associate location // information with every object created when parsing, @@ -77,18 +77,18 @@ public: SetLocationInfo(&detail::start_location, &detail::end_location); } - virtual ~BroObj(); + virtual ~Obj(); /* disallow copying */ - BroObj(const BroObj &) = delete; - BroObj &operator=(const BroObj &) = delete; + Obj(const Obj &) = delete; + Obj &operator=(const Obj &) = delete; // Report user warnings/errors. If obj2 is given, then it's // included in the message, though if pinpoint_only is non-zero, // 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; - 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; // Report internal errors. @@ -130,8 +130,8 @@ public: // as long as there exist any instances. class SuppressErrors { public: - SuppressErrors() { ++BroObj::suppress_errors; } - ~SuppressErrors() { --BroObj::suppress_errors; } + SuppressErrors() { ++Obj::suppress_errors; } + ~SuppressErrors() { --Obj::suppress_errors; } }; void Print() const; @@ -142,13 +142,13 @@ protected: private: 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; - void PinPoint(ODesc* d, const BroObj* obj2 = nullptr, + void PinPoint(ODesc* d, const Obj* obj2 = nullptr, bool pinpoint_only = false) const; - friend inline void Ref(BroObj* o); - friend inline void Unref(BroObj* o); + friend inline void Ref(Obj* o); + friend inline void Unref(Obj* o); bool notify_plugins = false; int ref_cnt = 1; @@ -158,16 +158,16 @@ private: 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. -inline void Error(const BroObj* o, const char* msg) +inline void Error(const Obj* o, const char* msg) { o->Error(msg); } [[noreturn]] extern void bad_ref(int type); -inline void Ref(BroObj* o) +inline void Ref(Obj* o) { if ( ++(o->ref_cnt) <= 1 ) bad_ref(0); @@ -175,7 +175,7 @@ inline void Ref(BroObj* o) bad_ref(1); } -inline void Unref(BroObj* o) +inline void Unref(Obj* o) { if ( o && --o->ref_cnt <= 0 ) { @@ -184,18 +184,18 @@ inline void Unref(BroObj* o) delete o; // 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. -extern void bro_obj_delete_func(void* v); +extern void obj_delete_func(void* v); } // namespace zeek 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 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.")]] -extern void print(const zeek::BroObj* obj); +[[deprecated("Remove in v4.1. Use zeek::Obj::Print instead.")]] +extern void print(const zeek::Obj* obj); diff --git a/src/Reassem.h b/src/Reassem.h index 43d0278163..3ca1bfc414 100644 --- a/src/Reassem.h +++ b/src/Reassem.h @@ -251,7 +251,7 @@ private: DataBlockMap block_map; }; -class Reassembler : public zeek::BroObj { +class Reassembler : public zeek::Obj { public: Reassembler(uint64_t init_seq, ReassemblerType reassem_type = REASSEM_UNKNOWN); ~Reassembler() override {} diff --git a/src/Scope.h b/src/Scope.h index 9b91e6fe00..522a335a08 100644 --- a/src/Scope.h +++ b/src/Scope.h @@ -31,7 +31,7 @@ using IDPtr = zeek::IntrusivePtr; class Scope; using ScopePtr = zeek::IntrusivePtr; -class Scope : public BroObj { +class Scope : public Obj { public: explicit Scope(zeek::detail::IDPtr id, std::unique_ptr> al); diff --git a/src/Stmt.cc b/src/Stmt.cc index 54544d2baa..0c306c0c24 100644 --- a/src/Stmt.cc +++ b/src/Stmt.cc @@ -53,7 +53,7 @@ Stmt::~Stmt() bool Stmt::SetLocationInfo(const Location* start, const Location* end) { - if ( ! BroObj::SetLocationInfo(start, end) ) + if ( ! Obj::SetLocationInfo(start, end) ) return false; // Update the Filemap of line number -> statement mapping for diff --git a/src/Stmt.h b/src/Stmt.h index 4b62d2a252..d73ee0c56b 100644 --- a/src/Stmt.h +++ b/src/Stmt.h @@ -30,7 +30,7 @@ using ListExprPtr = zeek::IntrusivePtr; class Stmt; using StmtPtr = zeek::IntrusivePtr; -class Stmt : public BroObj { +class Stmt : public Obj { public: BroStmtTag Tag() const { return tag; } @@ -166,7 +166,7 @@ protected: StmtPtr s2; }; -class Case final : public BroObj { +class Case final : public Obj { public: Case(ListExprPtr c, id_list* types, StmtPtr arg_s); ~Case() override; diff --git a/src/Trigger.cc b/src/Trigger.cc index a8045dda47..600a4aa84a 100644 --- a/src/Trigger.cc +++ b/src/Trigger.cc @@ -59,7 +59,7 @@ TraversalCode zeek::detail::trigger::TriggerTraversalCallback::PreExpr(const zee case EXPR_INDEX: { const auto* e = static_cast(expr); - BroObj::SuppressErrors no_errors; + Obj::SuppressErrors no_errors; try { diff --git a/src/Trigger.h b/src/Trigger.h index fe99890214..549341440a 100644 --- a/src/Trigger.h +++ b/src/Trigger.h @@ -27,7 +27,7 @@ namespace zeek::detail::trigger { class TriggerTimer; class TriggerTraversalCallback; -class Trigger final : public BroObj, public notifier::Receiver { +class Trigger final : public Obj, public notifier::Receiver { public: // Don't access Trigger objects; they take care of themselves after // 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 disabled; - std::vector> objs; + std::vector> objs; using ValCache = std::map; ValCache cache; diff --git a/src/Type.h b/src/Type.h index 2f1a5207d9..4b933d912c 100644 --- a/src/Type.h +++ b/src/Type.h @@ -167,7 +167,7 @@ constexpr int DOES_NOT_MATCH_INDEX = 0; constexpr int MATCHES_INDEX_SCALAR = 1; constexpr int MATCHES_INDEX_VECTOR = 2; -class Type : public BroObj { +class Type : public Obj { public: static inline const TypePtr nil; diff --git a/src/Val.h b/src/Val.h index 502c23f68c..8f69333d65 100644 --- a/src/Val.h +++ b/src/Val.h @@ -138,7 +138,7 @@ union BroValUnion { : table_val(value) {} }; -class Val : public BroObj { +class Val : public Obj { public: static inline const ValPtr nil; @@ -1204,10 +1204,10 @@ public: */ 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. - void SetOrigin(BroObj* o) { origin = o; } - BroObj* GetOrigin() const { return origin; } + void SetOrigin(Obj* o) { origin = o; } + Obj* GetOrigin() const { return origin; } // Returns a new value representing the value coerced to the given // type. If coercion is not possible, returns 0. The non-const @@ -1241,7 +1241,7 @@ public: protected: ValPtr DoClone(CloneState* state) override; - BroObj* origin; + Obj* origin; using RecordTypeValMap = std::unordered_map>; static RecordTypeValMap parse_time_records; diff --git a/src/Var.cc b/src/Var.cc index b944ba636c..baa4c0dae7 100644 --- a/src/Var.cc +++ b/src/Var.cc @@ -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())) ) { - 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 ) id->Warn("redefinition requires \"redef\"", redef_obj, true); } diff --git a/src/analyzer/protocol/arp/ARP.h b/src/analyzer/protocol/arp/ARP.h index 1a181473f4..9198003975 100644 --- a/src/analyzer/protocol/arp/ARP.h +++ b/src/analyzer/protocol/arp/ARP.h @@ -32,7 +32,7 @@ extern "C" { namespace analyzer::arp { -class ARP_Analyzer : public zeek::BroObj { +class ARP_Analyzer : public zeek::Obj { public: ARP_Analyzer(); ~ARP_Analyzer() override; diff --git a/src/analyzer/protocol/stepping-stone/SteppingStone.h b/src/analyzer/protocol/stepping-stone/SteppingStone.h index 9ae3fcea18..972778d2d7 100644 --- a/src/analyzer/protocol/stepping-stone/SteppingStone.h +++ b/src/analyzer/protocol/stepping-stone/SteppingStone.h @@ -12,7 +12,7 @@ namespace analyzer::stepping_stone { class SteppingStoneEndpoint; class SteppingStoneManager; -class SteppingStoneEndpoint : public zeek::BroObj { +class SteppingStoneEndpoint : public zeek::Obj { public: SteppingStoneEndpoint(tcp::TCP_Endpoint* e, SteppingStoneManager* m); ~SteppingStoneEndpoint() override; diff --git a/src/analyzer/protocol/tcp/TCP.cc b/src/analyzer/protocol/tcp/TCP.cc index 761ba6f0e9..24a4301ead 100644 --- a/src/analyzer/protocol/tcp/TCP.cc +++ b/src/analyzer/protocol/tcp/TCP.cc @@ -1557,7 +1557,7 @@ void TCP_Analyzer::ExpireTimer(double t) } // 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. ADD_ANALYZER_TIMER(&TCP_Analyzer::ExpireTimer, t + tcp_session_timer, false, TIMER_TCP_EXPIRE); diff --git a/src/plugin/Manager.cc b/src/plugin/Manager.cc index 29b1abf331..eaded40590 100644 --- a/src/plugin/Manager.cc +++ b/src/plugin/Manager.cc @@ -578,7 +578,7 @@ void Manager::RequestEvent(EventHandlerPtr handler, Plugin* plugin) handler->SetGenerateAlways(); } -void Manager::RequestBroObjDtor(BroObj* obj, Plugin* plugin) +void Manager::RequestBroObjDtor(Obj* obj, Plugin* plugin) { obj->NotifyPluginsOnDtor(); } diff --git a/src/plugin/Manager.h b/src/plugin/Manager.h index 09bdbfb65d..bb3595d648 100644 --- a/src/plugin/Manager.h +++ b/src/plugin/Manager.h @@ -214,7 +214,7 @@ public: 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 * HookBroObjDtor will be called. * @@ -222,7 +222,7 @@ public: * * @param plugin The plugin expressing interest. */ - void RequestBroObjDtor(BroObj* obj, Plugin* plugin); + void RequestBroObjDtor(Obj* obj, Plugin* plugin); // Hook entry functions. diff --git a/src/plugin/Plugin.cc b/src/plugin/Plugin.cc index da890b269c..a833637220 100644 --- a/src/plugin/Plugin.cc +++ b/src/plugin/Plugin.cc @@ -365,7 +365,7 @@ void Plugin::RequestEvent(EventHandlerPtr handler) plugin_mgr->RequestEvent(handler, this); } -void Plugin::RequestBroObjDtor(BroObj* obj) +void Plugin::RequestBroObjDtor(Obj* obj) { plugin_mgr->RequestBroObjDtor(obj, this); } diff --git a/src/plugin/Plugin.h b/src/plugin/Plugin.h index f0850401a3..c0649c2b54 100644 --- a/src/plugin/Plugin.h +++ b/src/plugin/Plugin.h @@ -25,8 +25,11 @@ ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail); namespace zeek { template class IntrusivePtr; using ValPtr = zeek::IntrusivePtr; +class Obj; } +using BroObj [[deprecated("Remove in v4.1. Use zeek::Obj instead.")]] = zeek::Obj; + namespace threading { struct Field; } @@ -613,7 +616,7 @@ protected: 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, * \a HookBroObjDtor will be called. * @@ -621,7 +624,7 @@ protected: * * @param handler The object being interested in. */ - void RequestBroObjDtor(zeek::BroObj* obj); + void RequestBroObjDtor(zeek::Obj* obj); // Hook functions. diff --git a/src/scan.l b/src/scan.l index f14d622cda..0699671085 100644 --- a/src/scan.l +++ b/src/scan.l @@ -710,7 +710,7 @@ static int load_files(const char* orig_file) yylloc.first_line = yylloc.last_line = line_number = 1; // 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()); return 1; @@ -923,7 +923,7 @@ int yywrap() if ( load_files(files[0]) ) { // 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); return 0; } diff --git a/src/threading/MsgThread.h b/src/threading/MsgThread.h index f9000f1893..ede4332a77 100644 --- a/src/threading/MsgThread.h +++ b/src/threading/MsgThread.h @@ -8,8 +8,6 @@ #include "iosource/IOSource.h" #include "Flare.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(BroObj, zeek); - namespace threading { class BasicInputMessage;