Move Location to zeek::detail and BroObj to zeek

This commit is contained in:
Tim Wojtulewicz 2020-06-24 13:09:43 -07:00
parent 58c6e10b62
commit 40ecede4ea
41 changed files with 158 additions and 131 deletions

View file

@ -31,7 +31,7 @@ void Brofiler::AddStmt(zeek::detail::Stmt* s)
if ( ignoring != 0 ) if ( ignoring != 0 )
return; return;
::Ref(s); zeek::Ref(s);
stmts.push_back(s); stmts.push_back(s);
} }

View file

@ -65,7 +65,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 BroObj { class Connection final : public zeek::BroObj {
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 BroObj { class DFA_State : public zeek::BroObj {
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 BroObj { class DFA_Machine : public zeek::BroObj {
public: public:
DFA_Machine(NFA_Machine* n, EquivClass* ec); DFA_Machine(NFA_Machine* n, EquivClass* ec);
~DFA_Machine() override; ~DFA_Machine() override;

View file

@ -153,7 +153,7 @@ bool DbgBreakpoint::SetLocation(ParseLocationRec plr, std::string_view loc_str)
function_name = make_full_var_name(zeek::detail::current_module.c_str(), function_name = make_full_var_name(zeek::detail::current_module.c_str(),
loc_s.c_str()); loc_s.c_str());
at_stmt = plr.stmt; at_stmt = plr.stmt;
const Location* loc = at_stmt->GetLocationInfo(); const zeek::detail::Location* loc = at_stmt->GetLocationInfo();
snprintf(description, sizeof(description), "%s at %s:%d", snprintf(description, sizeof(description), "%s at %s:%d",
function_name.c_str(), loc->filename, loc->last_line); function_name.c_str(), loc->filename, loc->last_line);
@ -176,7 +176,7 @@ bool DbgBreakpoint::SetLocation(zeek::detail::Stmt* stmt)
SetEnable(true); SetEnable(true);
AddToGlobalMap(); AddToGlobalMap();
const Location* loc = stmt->GetLocationInfo(); const zeek::detail::Location* loc = stmt->GetLocationInfo();
snprintf(description, sizeof(description), "%s:%d", snprintf(description, sizeof(description), "%s:%d",
loc->filename, loc->last_line); loc->filename, loc->last_line);
@ -356,7 +356,7 @@ void DbgBreakpoint::PrintHitMsg()
if ( func ) if ( func )
func->DescribeDebug (&d, f->GetFuncArgs()); func->DescribeDebug (&d, f->GetFuncArgs());
const Location* loc = at_stmt->GetLocationInfo(); const zeek::detail::Location* loc = at_stmt->GetLocationInfo();
debug_msg("Breakpoint %d, %s at %s:%d\n", debug_msg("Breakpoint %d, %s at %s:%d\n",
GetID(), d.Description(), GetID(), d.Description(),

View file

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

View file

@ -4,17 +4,16 @@
#include "util.h" #include "util.h"
class BroObj;
ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail); ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(BroObj, zeek);
class DbgWatch { class DbgWatch {
public: public:
explicit DbgWatch(BroObj* var_to_watch); explicit DbgWatch(zeek::BroObj* var_to_watch);
explicit DbgWatch(zeek::detail::Expr* expr_to_watch); explicit DbgWatch(zeek::detail::Expr* expr_to_watch);
~DbgWatch(); ~DbgWatch();
protected: protected:
BroObj* var; zeek::BroObj* var;
zeek::detail::Expr* expr; zeek::detail::Expr* expr;
}; };

View file

@ -136,7 +136,7 @@ int TraceState::LogTrace(const char* fmt, ...)
fprintf(trace_file, "%.6f ", network_time); fprintf(trace_file, "%.6f ", network_time);
const zeek::detail::Stmt* stmt; const zeek::detail::Stmt* stmt;
Location loc; zeek::detail::Location loc;
loc.filename = nullptr; loc.filename = nullptr;
if ( g_frame_stack.size() > 0 && g_frame_stack.back() ) if ( g_frame_stack.size() > 0 && g_frame_stack.back() )
@ -174,7 +174,7 @@ int TraceState::LogTrace(const char* fmt, ...)
// Helper functions. // Helper functions.
void get_first_statement(zeek::detail::Stmt* list, zeek::detail::Stmt*& first, Location& loc) void get_first_statement(zeek::detail::Stmt* list, zeek::detail::Stmt*& first, zeek::detail::Location& loc)
{ {
if ( ! list ) if ( ! list )
{ {
@ -244,7 +244,7 @@ static void parse_function_name(vector<ParseLocationRec>& result,
for ( unsigned int i = 0; i < bodies.size(); ++i ) for ( unsigned int i = 0; i < bodies.size(); ++i )
{ {
zeek::detail::Stmt* first; zeek::detail::Stmt* first;
Location stmt_loc; zeek::detail::Location stmt_loc;
get_first_statement(bodies[i].stmts.get(), first, stmt_loc); get_first_statement(bodies[i].stmts.get(), first, stmt_loc);
debug_msg("[%d] %s:%d\n", i+1, stmt_loc.filename, stmt_loc.first_line); debug_msg("[%d] %s:%d\n", i+1, stmt_loc.filename, stmt_loc.first_line);
} }
@ -287,7 +287,7 @@ static void parse_function_name(vector<ParseLocationRec>& result,
// Find first atomic (non-STMT_LIST) statement // Find first atomic (non-STMT_LIST) statement
zeek::detail::Stmt* first; zeek::detail::Stmt* first;
Location stmt_loc; zeek::detail::Location stmt_loc;
if ( body ) if ( body )
{ {
@ -738,7 +738,7 @@ string get_context_description(const zeek::detail::Stmt* stmt, const zeek::detai
else else
d.Add("<unknown function>", 0); d.Add("<unknown function>", 0);
Location loc; zeek::detail::Location loc;
if ( stmt ) if ( stmt )
loc = *stmt->GetLocationInfo(); loc = *stmt->GetLocationInfo();
else else
@ -780,7 +780,7 @@ int dbg_handle_debug_input()
if ( ! stmt ) if ( ! stmt )
reporter->InternalError("Assertion failed: stmt != 0"); reporter->InternalError("Assertion failed: stmt != 0");
const Location loc = *stmt->GetLocationInfo(); const zeek::detail::Location loc = *stmt->GetLocationInfo();
if ( ! step_or_next_pending || g_frame_stack.back() != last_frame ) if ( ! step_or_next_pending || g_frame_stack.back() != last_frame )
{ {

View file

@ -89,7 +89,7 @@ public:
bool already_did_list; // did we already do a 'list' command? bool already_did_list; // did we already do a 'list' command?
Location last_loc; // used by 'list'; the last location listed zeek::detail::Location last_loc; // used by 'list'; the last location listed
BPIDMapType breakpoints; // BPID -> Breakpoint BPIDMapType breakpoints; // BPID -> Breakpoint
std::vector<DbgWatch*> watches; std::vector<DbgWatch*> watches;
@ -111,14 +111,14 @@ private:
class StmtLocMapping { class StmtLocMapping {
public: public:
StmtLocMapping() { } StmtLocMapping() { }
StmtLocMapping(const Location* l, zeek::detail::Stmt* s) { loc = *l; stmt = s; } StmtLocMapping(const zeek::detail::Location* l, zeek::detail::Stmt* s) { loc = *l; stmt = s; }
bool StartsAfter(const StmtLocMapping* m2); bool StartsAfter(const StmtLocMapping* m2);
const Location& Loc() const { return loc; } const zeek::detail::Location& Loc() const { return loc; }
zeek::detail::Stmt* Statement() const { return stmt; } zeek::detail::Stmt* Statement() const { return stmt; }
protected: protected:
Location loc; zeek::detail::Location loc;
zeek::detail::Stmt* stmt; zeek::detail::Stmt* stmt;
}; };

View file

@ -336,7 +336,7 @@ int dbg_cmd_frame(DebugCmd cmd, const vector<string>& args)
if ( ! stmt ) if ( ! stmt )
reporter->InternalError("Assertion failed: %s", "stmt != 0"); reporter->InternalError("Assertion failed: %s", "stmt != 0");
const Location loc = *stmt->GetLocationInfo(); const zeek::detail::Location loc = *stmt->GetLocationInfo();
g_debugger_state.last_loc = loc; g_debugger_state.last_loc = loc;
g_debugger_state.already_did_list = false; g_debugger_state.already_did_list = false;

View file

@ -14,11 +14,11 @@
class EventMgr; class EventMgr;
class Event final : public BroObj { class Event final : public zeek::BroObj {
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,
BroObj* obj = nullptr); zeek::BroObj* 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;
BroObj* obj; zeek::BroObj* 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 BroObj, public iosource::IOSource { class EventMgr final : public zeek::BroObj, 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, BroObj* obj = nullptr); TimerMgr* mgr = nullptr, zeek::BroObj* 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, BroObj* obj = nullptr); TimerMgr* mgr = nullptr, zeek::BroObj* 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, BroObj* obj = nullptr); TimerMgr* mgr = nullptr, zeek::BroObj* 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,
BroObj* obj = nullptr); zeek::BroObj* obj = nullptr);
/** /**
* A version of Enqueue() taking a variable number of arguments. * A version of Enqueue() taking a variable number of arguments.

View file

@ -98,7 +98,7 @@ public:
BroExprTag Tag() const { return tag; } BroExprTag Tag() const { return tag; }
Expr* Ref() { ::Ref(this); return this; } Expr* Ref() { zeek::Ref(this); return this; }
// Evaluates the expression and returns a corresponding Val*, // Evaluates the expression and returns a corresponding Val*,
// or nil if the expression's value isn't fixed. // or nil if the expression's value isn't fixed.

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 BroObj { class BroFile final : public zeek::BroObj {
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

@ -55,7 +55,7 @@ Frame::~Frame()
void Frame::AddFunctionWithClosureRef(BroFunc* func) void Frame::AddFunctionWithClosureRef(BroFunc* func)
{ {
::Ref(func); zeek::Ref(func);
if ( ! functions_with_closure_frame_reference ) if ( ! functions_with_closure_frame_reference )
functions_with_closure_frame_reference = std::make_unique<std::vector<BroFunc*>>(); functions_with_closure_frame_reference = std::make_unique<std::vector<BroFunc*>>();
@ -493,7 +493,7 @@ void Frame::CaptureClosure(Frame* c, id_list arg_outer_ids)
outer_ids = std::move(arg_outer_ids); outer_ids = std::move(arg_outer_ids);
for ( auto& i : outer_ids ) for ( auto& i : outer_ids )
::Ref(i); zeek::Ref(i);
closure = c; closure = c;
if ( closure ) if ( closure )

View file

@ -876,7 +876,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, BroObj* arg) void builtin_error(const char* msg, zeek::BroObj* arg)
{ {
zeek::emit_builtin_error(msg, arg); zeek::emit_builtin_error(msg, arg);
} }

View file

@ -305,4 +305,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, BroObj* arg); extern void builtin_error(const char* msg, zeek::BroObj* arg);

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 BroObj { class NFA_State : public zeek::BroObj {
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 BroObj { class NFA_Machine : public zeek::BroObj {
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

@ -10,6 +10,9 @@
#include "File.h" #include "File.h"
#include "plugin/Manager.h" #include "plugin/Manager.h"
namespace zeek {
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);
@ -48,6 +51,8 @@ bool Location::operator==(const Location& l) const
return false; return false;
} }
} // namespace detail
int BroObj::suppress_errors = 0; int BroObj::suppress_errors = 0;
BroObj::~BroObj() BroObj::~BroObj()
@ -58,7 +63,7 @@ BroObj::~BroObj()
delete location; delete location;
} }
void BroObj::Warn(const char* msg, const BroObj* obj2, bool pinpoint_only, const Location* expr_location) const void BroObj::Warn(const char* msg, const BroObj* 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);
@ -66,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 Location* expr_location) const void BroObj::Error(const char* msg, const BroObj* obj2, bool pinpoint_only, const detail::Location* expr_location) const
{ {
if ( suppress_errors ) if ( suppress_errors )
return; return;
@ -127,7 +132,7 @@ void BroObj::AddLocation(ODesc* d) const
location->Describe(d); location->Describe(d);
} }
bool BroObj::SetLocationInfo(const Location* start, const Location* end) bool BroObj::SetLocationInfo(const detail::Location* start, const detail::Location* end)
{ {
if ( ! start || ! end ) if ( ! start || ! end )
return false; return false;
@ -135,20 +140,20 @@ bool BroObj::SetLocationInfo(const Location* start, const Location* end)
if ( end->filename && ! streq(start->filename, end->filename) ) if ( end->filename && ! streq(start->filename, end->filename) )
return false; return false;
if ( location && (start == &no_location || end == &no_location) ) if ( location && (start == &zeek::detail::no_location || end == &zeek::detail::no_location) )
// We already have a better location, so don't use this one. // We already have a better location, so don't use this one.
return true; return true;
delete location; delete location;
location = new Location(start->filename, location = new detail::Location(start->filename,
start->first_line, end->last_line, start->first_line, end->last_line,
start->first_column, end->last_column); start->first_column, end->last_column);
return true; return true;
} }
void BroObj::UpdateLocationEndInfo(const Location& end) void BroObj::UpdateLocationEndInfo(const detail::Location& end)
{ {
if ( ! location ) if ( ! location )
SetLocationInfo(&end, &end); SetLocationInfo(&end, &end);
@ -158,15 +163,15 @@ void BroObj::UpdateLocationEndInfo(const Location& end)
} }
void BroObj::DoMsg(ODesc* d, const char s1[], const BroObj* obj2, void BroObj::DoMsg(ODesc* d, const char s1[], const BroObj* obj2,
bool pinpoint_only, const Location* expr_location) const bool pinpoint_only, const detail::Location* expr_location) const
{ {
d->SetShort(); d->SetShort();
d->Add(s1); d->Add(s1);
PinPoint(d, obj2, pinpoint_only); PinPoint(d, obj2, pinpoint_only);
const Location* loc2 = nullptr; const detail::Location* loc2 = nullptr;
if ( obj2 && obj2->GetLocationInfo() != &no_location && if ( obj2 && obj2->GetLocationInfo() != &zeek::detail::no_location &&
*obj2->GetLocationInfo() != *GetLocationInfo() ) *obj2->GetLocationInfo() != *GetLocationInfo() )
loc2 = obj2->GetLocationInfo(); loc2 = obj2->GetLocationInfo();
else if ( expr_location ) else if ( expr_location )
@ -188,11 +193,11 @@ void BroObj::PinPoint(ODesc* d, const BroObj* obj2, bool pinpoint_only) const
d->Add(")"); d->Add(")");
} }
void print(const BroObj* obj) void BroObj::Print() const
{ {
static BroFile fstderr(stderr); static BroFile fstderr(stderr);
ODesc d(DESC_READABLE, &fstderr); ODesc d(DESC_READABLE, &fstderr);
obj->Describe(&d); Describe(&d);
d.Add("\n"); d.Add("\n");
} }
@ -206,3 +211,10 @@ void bro_obj_delete_func(void* v)
{ {
Unref((BroObj*) v); Unref((BroObj*) v);
} }
} // namespace zeek
void print(const zeek::BroObj* obj)
{
obj->Print();
}

View file

@ -6,8 +6,12 @@
class ODesc; class ODesc;
namespace zeek {
namespace detail {
class Location final { class Location final {
public: public:
constexpr Location(const char* fname, int line_f, int line_l, constexpr Location(const char* fname, int line_f, int line_l,
int col_f, int col_l) noexcept int col_f, int col_l) noexcept
:filename(fname), first_line(line_f), last_line(line_l), :filename(fname), first_line(line_f), last_line(line_l),
@ -26,7 +30,7 @@ public:
int first_column = 0, last_column = 0; int first_column = 0, last_column = 0;
}; };
#define YYLTYPE yyltype #define YYLTYPE zeek::detail::yyltype
typedef Location yyltype; typedef Location yyltype;
YYLTYPE GetCurrentLocation(); YYLTYPE GetCurrentLocation();
@ -49,6 +53,8 @@ inline void set_location(const Location start, const Location end)
end_location = end; end_location = end;
} }
} // namespace detail
class BroObj { class BroObj {
public: public:
BroObj() BroObj()
@ -67,8 +73,8 @@ public:
// of 0, which should only happen if it's been assigned // of 0, which should only happen if it's been assigned
// to no_location (or hasn't been initialized at all). // to no_location (or hasn't been initialized at all).
location = nullptr; location = nullptr;
if ( start_location.first_line != 0 ) if ( detail::start_location.first_line != 0 )
SetLocationInfo(&start_location, &end_location); SetLocationInfo(&detail::start_location, &detail::end_location);
} }
virtual ~BroObj(); virtual ~BroObj();
@ -81,9 +87,9 @@ public:
// 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 BroObj* obj2 = nullptr,
bool pinpoint_only = false, const 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 BroObj* obj2 = nullptr,
bool pinpoint_only = false, const Location* expr_location = nullptr) const; bool pinpoint_only = false, const detail::Location* expr_location = nullptr) const;
// Report internal errors. // Report internal errors.
void BadTag(const char* msg, const char* t1 = nullptr, void BadTag(const char* msg, const char* t1 = nullptr,
@ -102,18 +108,18 @@ public:
void AddLocation(ODesc* d) const; void AddLocation(ODesc* d) const;
// Get location info for debugging. // Get location info for debugging.
const Location* GetLocationInfo() const const detail::Location* GetLocationInfo() const
{ return location ? location : &no_location; } { return location ? location : &detail::no_location; }
virtual bool SetLocationInfo(const Location* loc) virtual bool SetLocationInfo(const detail::Location* loc)
{ return SetLocationInfo(loc, loc); } { return SetLocationInfo(loc, loc); }
// Location = range from start to end. // Location = range from start to end.
virtual bool SetLocationInfo(const Location* start, const Location* end); virtual bool SetLocationInfo(const detail::Location* start, const detail::Location* end);
// Set new end-of-location information. This is used to // Set new end-of-location information. This is used to
// extend compound objects such as statement lists. // extend compound objects such as statement lists.
virtual void UpdateLocationEndInfo(const Location& end); virtual void UpdateLocationEndInfo(const detail::Location& end);
// Enable notification of plugins when this objects gets destroyed. // Enable notification of plugins when this objects gets destroyed.
void NotifyPluginsOnDtor() { notify_plugins = true; } void NotifyPluginsOnDtor() { notify_plugins = true; }
@ -128,14 +134,16 @@ public:
~SuppressErrors() { --BroObj::suppress_errors; } ~SuppressErrors() { --BroObj::suppress_errors; }
}; };
void Print() const;
protected: protected:
Location* location; // all that matters in real estate detail::Location* location; // all that matters in real estate
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 BroObj* obj2 = nullptr,
bool pinpoint_only = false, const 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 BroObj* obj2 = nullptr,
bool pinpoint_only = false) const; bool pinpoint_only = false) const;
@ -150,11 +158,6 @@ private:
static int suppress_errors; static int suppress_errors;
}; };
// Prints obj to stderr, primarily for debugging.
extern void print(const BroObj* obj);
[[noreturn]] extern void bad_ref(int type);
// Sometimes useful when dealing with BroObj subclasses that have their // Sometimes useful when dealing with BroObj 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 BroObj* o, const char* msg)
@ -162,6 +165,8 @@ inline void Error(const BroObj* o, const char* msg)
o->Error(msg); o->Error(msg);
} }
[[noreturn]] extern void bad_ref(int type);
inline void Ref(BroObj* o) inline void Ref(BroObj* o)
{ {
if ( ++(o->ref_cnt) <= 1 ) if ( ++(o->ref_cnt) <= 1 )
@ -185,3 +190,12 @@ inline void Unref(BroObj* o)
// 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 bro_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;
[[deprecated("Remove in v4.1. Use zeek::BroObj::Print instead.")]]
extern void print(const zeek::BroObj* obj);

View file

@ -2,6 +2,7 @@
#pragma once #pragma once
#include <string.h>
#include <iterator> #include <iterator>
// Queue.h -- // Queue.h --

View file

@ -251,7 +251,7 @@ private:
DataBlockMap block_map; DataBlockMap block_map;
}; };
class Reassembler : public BroObj { class Reassembler : public zeek::BroObj {
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

@ -165,7 +165,7 @@ void Reporter::ExprRuntimeError(const zeek::detail::Expr* expr, const char* fmt,
throw InterpreterException(); throw InterpreterException();
} }
void Reporter::RuntimeError(const Location* location, const char* fmt, ...) void Reporter::RuntimeError(const zeek::detail::Location* location, const char* fmt, ...)
{ {
++errors; ++errors;
PushLocation(location); PushLocation(location);
@ -469,11 +469,11 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out,
{ {
ODesc d; ODesc d;
std::pair<const Location*, const Location*> locs = locations.back(); std::pair<const zeek::detail::Location*, const zeek::detail::Location*> locs = locations.back();
if ( locs.first ) if ( locs.first )
{ {
if ( locs.first != &no_location ) if ( locs.first != &zeek::detail::no_location )
locs.first->Describe(&d); locs.first->Describe(&d);
else else
@ -483,7 +483,7 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out,
{ {
d.Add(" and "); d.Add(" and ");
if ( locs.second != &no_location ) if ( locs.second != &zeek::detail::no_location )
locs.second->Describe(&d); locs.second->Describe(&d);
else else

View file

@ -18,7 +18,6 @@
namespace analyzer { class Analyzer; } namespace analyzer { class Analyzer; }
namespace file_analysis { class File; } namespace file_analysis { class File; }
class Connection; class Connection;
class Location;
class Reporter; class Reporter;
class EventHandlerPtr; class EventHandlerPtr;
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek);
@ -30,6 +29,8 @@ using RecordValPtr = zeek::IntrusivePtr<RecordVal>;
using StringValPtr = zeek::IntrusivePtr<StringVal>; using StringValPtr = zeek::IntrusivePtr<StringVal>;
} }
ZEEK_FORWARD_DECLARE_NAMESPACED(Location, zeek::detail);
// One cannot raise this exception directly, go through the // One cannot raise this exception directly, go through the
// Reporter's methods instead. // Reporter's methods instead.
@ -94,7 +95,7 @@ public:
// Report a runtime error in evaluating a Bro script expression. This // Report a runtime error in evaluating a Bro script expression. This
// function will not return but raise an InterpreterException. // function will not return but raise an InterpreterException.
[[noreturn]] void RuntimeError(const Location* location, const char* fmt, ...) __attribute__((format(printf, 3, 4))); [[noreturn]] void RuntimeError(const zeek::detail::Location* location, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
// Report a traffic weirdness, i.e., an unexpected protocol situation // Report a traffic weirdness, i.e., an unexpected protocol situation
// that may lead to incorrectly processing a connnection. // that may lead to incorrectly processing a connnection.
@ -130,11 +131,11 @@ public:
// stack of location so that the most recent is always the one that // stack of location so that the most recent is always the one that
// will be assumed to be the current one. The pointer must remain // will be assumed to be the current one. The pointer must remain
// valid until the location is popped. // valid until the location is popped.
void PushLocation(const Location* location) void PushLocation(const zeek::detail::Location* location)
{ locations.push_back(std::pair<const Location*, const Location*>(location, 0)); } { locations.push_back(std::pair<const zeek::detail::Location*, const zeek::detail::Location*>(location, 0)); }
void PushLocation(const Location* loc1, const Location* loc2) void PushLocation(const zeek::detail::Location* loc1, const zeek::detail::Location* loc2)
{ locations.push_back(std::pair<const Location*, const Location*>(loc1, loc2)); } { locations.push_back(std::pair<const zeek::detail::Location*, const zeek::detail::Location*>(loc1, loc2)); }
// Removes the top-most location information from stack. // Removes the top-most location information from stack.
void PopLocation() void PopLocation()
@ -288,7 +289,7 @@ private:
bool after_zeek_init; bool after_zeek_init;
bool abort_on_scripting_errors = false; bool abort_on_scripting_errors = false;
std::list<std::pair<const Location*, const Location*> > locations; std::list<std::pair<const zeek::detail::Location*, const zeek::detail::Location*> > locations;
uint64_t weird_count; uint64_t weird_count;
WeirdCountMap weird_count_by_type; WeirdCountMap weird_count_by_type;

View file

@ -19,7 +19,7 @@ using rule_dict = std::map<std::string, Rule*>;
class Rule { class Rule {
public: public:
Rule(const char* arg_id, const Location& arg_location) Rule(const char* arg_id, const zeek::detail::Location& arg_location)
{ {
id = copy_string(arg_id); id = copy_string(arg_id);
idx = rule_counter++; idx = rule_counter++;
@ -47,7 +47,7 @@ public:
uint32_t offset = 0, uint32_t depth = INT_MAX); uint32_t offset = 0, uint32_t depth = INT_MAX);
void AddRequires(const char* id, bool opposite_direction, bool negate); void AddRequires(const char* id, bool opposite_direction, bool negate);
const Location& GetLocation() const { return location; } const zeek::detail::Location& GetLocation() const { return location; }
void PrintDebug(); void PrintDebug();
@ -98,7 +98,7 @@ private:
Rule* next; // Linkage within RuleHdrTest tree: Rule* next; // Linkage within RuleHdrTest tree:
// Ptr to next rule using the same RuleHdrTests // Ptr to next rule using the same RuleHdrTests
Location location; zeek::detail::Location location;
// Rules and payloads are numbered individually. // Rules and payloads are numbered individually.
static unsigned int rule_counter; static unsigned int rule_counter;

View file

@ -319,7 +319,7 @@ void ProfileLogger::Log()
} }
} }
void ProfileLogger::SegmentProfile(const char* name, const Location* loc, void ProfileLogger::SegmentProfile(const char* name, const zeek::detail::Location* loc,
double dtime, int dmem) double dtime, int dmem)
{ {
if ( name ) if ( name )
@ -358,14 +358,14 @@ void SampleLogger::FunctionSeen(const zeek::detail::Func* func)
load_samples->Assign(std::move(idx), nullptr); load_samples->Assign(std::move(idx), nullptr);
} }
void SampleLogger::LocationSeen(const Location* loc) void SampleLogger::LocationSeen(const zeek::detail::Location* loc)
{ {
auto idx = zeek::make_intrusive<zeek::StringVal>(loc->filename); auto idx = zeek::make_intrusive<zeek::StringVal>(loc->filename);
load_samples->Assign(std::move(idx), nullptr); load_samples->Assign(std::move(idx), nullptr);
} }
void SampleLogger::SegmentProfile(const char* /* name */, void SampleLogger::SegmentProfile(const char* /* name */,
const Location* /* loc */, const zeek::detail::Location* /* loc */,
double dtime, int dmem) double dtime, int dmem)
{ {
if ( load_sample ) if ( load_sample )

View file

@ -9,11 +9,11 @@
#include <sys/resource.h> #include <sys/resource.h>
#include <stdint.h> #include <stdint.h>
class Location;
class BroFile; class BroFile;
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek::detail); ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(TableVal, zeek); ZEEK_FORWARD_DECLARE_NAMESPACED(TableVal, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Location, zeek::detail);
// Object called by SegmentProfiler when it is done and reports its // Object called by SegmentProfiler when it is done and reports its
// cumulative CPU/memory statistics. // cumulative CPU/memory statistics.
@ -22,7 +22,7 @@ public:
SegmentStatsReporter() { } SegmentStatsReporter() { }
virtual ~SegmentStatsReporter() { } virtual ~SegmentStatsReporter() { }
virtual void SegmentProfile(const char* name, const Location* loc, virtual void SegmentProfile(const char* name, const zeek::detail::Location* loc,
double dtime, int dmem) = 0; double dtime, int dmem) = 0;
}; };
@ -44,7 +44,7 @@ public:
} }
SegmentProfiler(SegmentStatsReporter* arg_reporter, SegmentProfiler(SegmentStatsReporter* arg_reporter,
const Location* arg_loc) const zeek::detail::Location* arg_loc)
: reporter(arg_reporter), name(), loc(arg_loc), initial_rusage() : reporter(arg_reporter), name(), loc(arg_loc), initial_rusage()
{ {
if ( reporter ) if ( reporter )
@ -63,7 +63,7 @@ protected:
SegmentStatsReporter* reporter; SegmentStatsReporter* reporter;
const char* name; const char* name;
const Location* loc; const zeek::detail::Location* loc;
struct rusage initial_rusage; struct rusage initial_rusage;
}; };
@ -77,7 +77,7 @@ public:
BroFile* File() { return file; } BroFile* File() { return file; }
protected: protected:
void SegmentProfile(const char* name, const Location* loc, void SegmentProfile(const char* name, const zeek::detail::Location* loc,
double dtime, int dmem) override; double dtime, int dmem) override;
private: private:
@ -95,10 +95,10 @@ public:
// These are called to report that a given function or location // These are called to report that a given function or location
// has been seen during the sampling. // has been seen during the sampling.
void FunctionSeen(const zeek::detail::Func* func); void FunctionSeen(const zeek::detail::Func* func);
void LocationSeen(const Location* loc); void LocationSeen(const zeek::detail::Location* loc);
protected: protected:
void SegmentProfile(const char* name, const Location* loc, void SegmentProfile(const char* name, const zeek::detail::Location* loc,
double dtime, int dmem) override; double dtime, int dmem) override;
zeek::TableVal* load_samples; zeek::TableVal* load_samples;

View file

@ -38,7 +38,7 @@ public:
virtual ValPtr Exec(Frame* f, stmt_flow_type& flow) const = 0; virtual ValPtr Exec(Frame* f, stmt_flow_type& flow) const = 0;
Stmt* Ref() { ::Ref(this); return this; } Stmt* Ref() { zeek::Ref(this); return this; }
bool SetLocationInfo(const Location* loc) override bool SetLocationInfo(const Location* loc) override
{ return Stmt::SetLocationInfo(loc, loc); } { return Stmt::SetLocationInfo(loc, loc); }

View file

@ -2076,7 +2076,7 @@ const TypePtr& base_type(zeek::TypeTag tag)
{ {
base_types[tag] = zeek::make_intrusive<Type>(tag, true); base_types[tag] = zeek::make_intrusive<Type>(tag, true);
// Give the base types a pseudo-location for easier identification. // Give the base types a pseudo-location for easier identification.
Location l(type_name(tag), 0, 0, 0, 0); zeek::detail::Location l(type_name(tag), 0, 0, 0, 0);
base_types[tag]->SetLocationInfo(&l); base_types[tag]->SetLocationInfo(&l);
} }

View file

@ -350,7 +350,7 @@ public:
return tag == TYPE_TABLE && Yield(); return tag == TYPE_TABLE && Yield();
} }
Type* Ref() { ::Ref(this); return this; } Type* Ref() { zeek::Ref(this); return this; }
void Describe(ODesc* d) const override; void Describe(ODesc* d) const override;
virtual void DescribeReST(ODesc* d, bool roles_only = false) const; virtual void DescribeReST(ODesc* d, bool roles_only = false) const;

View file

@ -3191,7 +3191,7 @@ void VectorVal::ValDescribe(ODesc* d) const
ValPtr check_and_promote(ValPtr v, ValPtr check_and_promote(ValPtr v,
const Type* t, const Type* t,
bool is_init, bool is_init,
const Location* expr_location) const zeek::detail::Location* expr_location)
{ {
if ( ! v ) if ( ! v )
return nullptr; return nullptr;

View file

@ -172,7 +172,7 @@ public:
~Val() override; ~Val() override;
Val* Ref() { ::Ref(this); return this; } Val* Ref() { zeek::Ref(this); return this; }
ValPtr Clone(); ValPtr Clone();
bool IsZero() const; bool IsZero() const;
@ -1376,7 +1376,7 @@ protected:
// true, then the checking is done in the context of an initialization. // true, then the checking is done in the context of an initialization.
extern ValPtr check_and_promote( extern ValPtr check_and_promote(
ValPtr v, const zeek::Type* t, bool is_init, ValPtr v, const zeek::Type* t, bool is_init,
const Location* expr_location = nullptr); const zeek::detail::Location* expr_location = nullptr);
extern bool same_val(const Val* v1, const Val* v2); extern bool same_val(const Val* v1, const Val* v2);
extern bool same_atomic_val(const Val* v1, const Val* v2); extern bool same_atomic_val(const Val* v1, const Val* v2);

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())) )
{ {
BroObj* redef_obj = init ? (BroObj*) init.get() : (BroObj*) t.get(); zeek::BroObj* redef_obj = init ? (zeek::BroObj*) init.get() : (zeek::BroObj*) 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);
} }
@ -336,8 +336,8 @@ zeek::detail::StmtPtr add_local(
id->Error("can't use += / -= for initializations of local variables"); id->Error("can't use += / -= for initializations of local variables");
// copy Location to the stack, because AssignExpr may free "init" // copy Location to the stack, because AssignExpr may free "init"
const Location location = init->GetLocationInfo() ? const zeek::detail::Location location = init->GetLocationInfo() ?
*init->GetLocationInfo() : no_location; *init->GetLocationInfo() : zeek::detail::no_location;
auto name_expr = zeek::make_intrusive<zeek::detail::NameExpr>(id, dt == VAR_CONST); auto name_expr = zeek::make_intrusive<zeek::detail::NameExpr>(id, dt == VAR_CONST);
auto assign_expr = zeek::make_intrusive<zeek::detail::AssignExpr>(std::move(name_expr), auto assign_expr = zeek::make_intrusive<zeek::detail::AssignExpr>(std::move(name_expr),

View file

@ -30,9 +30,9 @@ extern "C" {
#include <pcap.h> #include <pcap.h>
} }
namespace analyzer { namespace arp { namespace analyzer::arp {
class ARP_Analyzer : public BroObj { class ARP_Analyzer : public zeek::BroObj {
public: public:
ARP_Analyzer(); ARP_Analyzer();
~ARP_Analyzer() override; ~ARP_Analyzer() override;
@ -57,4 +57,4 @@ protected:
void Corrupted(const char* string); void Corrupted(const char* string);
}; };
} } // namespace analyzer::* } // namespace analyzer::arp

View file

@ -7,12 +7,12 @@
class NetSessions; class NetSessions;
namespace analyzer { namespace stepping_stone { namespace analyzer::stepping_stone {
class SteppingStoneEndpoint; class SteppingStoneEndpoint;
class SteppingStoneManager; class SteppingStoneManager;
class SteppingStoneEndpoint : public BroObj { class SteppingStoneEndpoint : public zeek::BroObj {
public: public:
SteppingStoneEndpoint(tcp::TCP_Endpoint* e, SteppingStoneManager* m); SteppingStoneEndpoint(tcp::TCP_Endpoint* e, SteppingStoneManager* m);
~SteppingStoneEndpoint() override; ~SteppingStoneEndpoint() override;
@ -81,4 +81,4 @@ protected:
int endp_cnt = 0; int endp_cnt = 0;
}; };
} } // namespace analyzer::* } // namespace analyzer::stepping_stone

View file

@ -126,8 +126,6 @@ extern zeek::detail::Expr* g_curr_debug_expr;
extern bool in_debug; extern bool in_debug;
extern const char* g_curr_debug_error; extern const char* g_curr_debug_error;
#define YYLTYPE yyltype
static int in_hook = 0; static int in_hook = 0;
int in_init = 0; int in_init = 0;
int in_record = 0; int in_record = 0;
@ -135,7 +133,7 @@ bool resolving_global_ID = false;
bool defining_global_ID = false; bool defining_global_ID = false;
std::vector<int> saved_in_init; std::vector<int> saved_in_init;
static Location func_hdr_location; static zeek::detail::Location func_hdr_location;
zeek::EnumType* cur_enum_type = nullptr; zeek::EnumType* cur_enum_type = nullptr;
static zeek::detail::ID* cur_decl_type_id = nullptr; static zeek::detail::ID* cur_decl_type_id = nullptr;
@ -267,7 +265,7 @@ bro:
// Any objects creates from here on out should not // Any objects creates from here on out should not
// have file positions associated with them. // have file positions associated with them.
set_location(no_location); set_location(zeek::detail::no_location);
} }
| |
/* Silly way of allowing the debugger to call yyparse() /* Silly way of allowing the debugger to call yyparse()

View file

@ -866,7 +866,8 @@ bool Manager::HookLogWrite(const std::string& writer,
bool Manager::HookReporter(const std::string& prefix, const EventHandlerPtr event, bool Manager::HookReporter(const std::string& prefix, const EventHandlerPtr event,
const Connection* conn, const val_list* addl, bool location, const Connection* conn, const val_list* addl, bool location,
const Location* location1, const Location* location2, const zeek::detail::Location* location1,
const zeek::detail::Location* location2,
bool time, const std::string& message) bool time, const std::string& message)
{ {

View file

@ -389,7 +389,7 @@ public:
*/ */
bool HookReporter(const std::string& prefix, const EventHandlerPtr event, bool HookReporter(const std::string& prefix, const EventHandlerPtr event,
const Connection* conn, const val_list* addl, bool location, const Connection* conn, const val_list* addl, bool location,
const Location* location1, const Location* location2, const zeek::detail::Location* location1, const zeek::detail::Location* location2,
bool time, const std::string& message); bool time, const std::string& message);
/** /**

View file

@ -441,7 +441,8 @@ bool Plugin::HookLogWrite(const std::string& writer, const std::string& filter,
bool Plugin::HookReporter(const std::string& prefix, const EventHandlerPtr event, bool Plugin::HookReporter(const std::string& prefix, const EventHandlerPtr event,
const Connection* conn, const val_list* addl, bool location, const Connection* conn, const val_list* addl, bool location,
const Location* location1, const Location* location2, const zeek::detail::Location* location1,
const zeek::detail::Location* location2,
bool time, const std::string& message) bool time, const std::string& message)
{ {
return true; return true;

View file

@ -251,7 +251,7 @@ public:
/** /**
* Constructor with a location argument. * Constructor with a location argument.
*/ */
explicit HookArgument(const Location* location) { type = LOCATION; arg.loc = location; } explicit HookArgument(const zeek::detail::Location* location) { type = LOCATION; arg.loc = location; }
/** /**
* Constructor with a zeek::Args argument. * Constructor with a zeek::Args argument.
@ -374,7 +374,7 @@ private:
const zeek::Args* args; const zeek::Args* args;
const void* voidp; const void* voidp;
const logging::WriterBackend::WriterInfo* winfo; const logging::WriterBackend::WriterInfo* winfo;
const Location* loc; const zeek::detail::Location* loc;
} arg; } arg;
// Outside union because these have dtors. // Outside union because these have dtors.
@ -621,7 +621,7 @@ protected:
* *
* @param handler The object being interested in. * @param handler The object being interested in.
*/ */
void RequestBroObjDtor(BroObj* obj); void RequestBroObjDtor(zeek::BroObj* obj);
// Hook functions. // Hook functions.
@ -829,7 +829,7 @@ protected:
*/ */
virtual bool HookReporter(const std::string& prefix, const EventHandlerPtr event, virtual bool HookReporter(const std::string& prefix, const EventHandlerPtr event,
const Connection* conn, const val_list* addl, bool location, const Connection* conn, const val_list* addl, bool location,
const Location* location1, const Location* location2, const zeek::detail::Location* location1, const zeek::detail::Location* location2,
bool time, const std::string& message); bool time, const std::string& message);
// Meta hooks. // Meta hooks.

View file

@ -104,7 +104,7 @@ rule_list:
rule: rule:
TOK_SIGNATURE TOK_IDENT TOK_SIGNATURE TOK_IDENT
{ {
Location l(current_rule_file, rules_line_number+1, 0, 0, 0); zeek::detail::Location l(current_rule_file, rules_line_number+1, 0, 0, 0);
current_rule = new Rule(yylval.str, l); current_rule = new Rule(yylval.str, l);
} }
'{' rule_attr_list '}' '{' rule_attr_list '}'
@ -440,7 +440,7 @@ void rules_error(const char* msg, const char* addl)
void rules_error(Rule* r, const char* msg) void rules_error(Rule* r, const char* msg)
{ {
const Location& l = r->GetLocation(); const zeek::detail::Location& l = r->GetLocation();
reporter->Error("Error in signature %s (%s:%d): %s\n", reporter->Error("Error in signature %s (%s:%d): %s\n",
r->ID(), l.filename, l.first_line, msg); r->ID(), l.filename, l.first_line, msg);
rule_matcher->SetParseError(); rule_matcher->SetParseError();

View file

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

View file

@ -252,7 +252,7 @@ void Manager::StartType(zeek::detail::IDPtr id)
if ( disabled ) if ( disabled )
return; return;
if ( id->GetLocationInfo() == &no_location ) if ( id->GetLocationInfo() == &zeek::detail::no_location )
{ {
DbgAndWarn(fmt("Can't generate zeekygen doumentation for %s, " DbgAndWarn(fmt("Can't generate zeekygen doumentation for %s, "
"no location available", id->Name())); "no location available", id->Name()));
@ -313,7 +313,7 @@ void Manager::Identifier(zeek::detail::IDPtr id)
return; return;
} }
if ( id->GetLocationInfo() == &no_location ) if ( id->GetLocationInfo() == &zeek::detail::no_location )
{ {
// Internally-created identifier (e.g. file/proto analyzer enum tags). // Internally-created identifier (e.g. file/proto analyzer enum tags).
// Handled specially since they don't have a script location. // Handled specially since they don't have a script location.