Move Func up to zeek namespace, rename BroFunc to ScriptFunc

This commit is contained in:
Tim Wojtulewicz 2020-07-02 14:10:04 -07:00
parent 86fdf0eaa9
commit a2bc42dd93
36 changed files with 190 additions and 184 deletions

View file

@ -849,7 +849,7 @@ const char* CompositeHash::RecoverOneVal(
const uint32_t* const kp = AlignType<uint32_t>(kp0);
kp1 = reinterpret_cast<const char*>(kp+1);
const auto& f = zeek::detail::Func::GetFuncPtrByID(*kp);
const auto& f = zeek::Func::GetFuncPtrByID(*kp);
if ( ! f )
reporter->InternalError("failed to look up unique function id %" PRIu32 " in CompositeHash::RecoverOneVal()", *kp);

View file

@ -16,7 +16,6 @@
class EventHandler;
class DNS_Mgr_Request;
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordType, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(ListVal, zeek);

View file

@ -351,7 +351,7 @@ void DbgBreakpoint::PrintHitMsg()
{
ODesc d;
zeek::detail::Frame* f = g_frame_stack.back();
const zeek::detail::BroFunc* func = f->GetFunction();
const zeek::detail::ScriptFunc* func = f->GetFunction();
if ( func )
func->DescribeDebug (&d, f->GetFuncArgs());

View file

@ -146,7 +146,7 @@ int TraceState::LogTrace(const char* fmt, ...)
loc = *stmt->GetLocationInfo();
else
{
const zeek::detail::BroFunc* f = g_frame_stack.back()->GetFunction();
const zeek::detail::ScriptFunc* f = g_frame_stack.back()->GetFunction();
if ( f )
loc = *f->GetLocationInfo();
}
@ -221,8 +221,8 @@ static void parse_function_name(vector<ParseLocationRec>& result,
return;
}
const zeek::detail::Func* func = id->GetVal()->AsFunc();
const vector<zeek::detail::Func::Body>& bodies = func->GetBodies();
const zeek::Func* func = id->GetVal()->AsFunc();
const vector<zeek::Func::Body>& bodies = func->GetBodies();
if ( bodies.size() == 0 )
{
@ -731,7 +731,7 @@ static char* get_prompt(bool reset_counter = false)
string get_context_description(const zeek::detail::Stmt* stmt, const zeek::detail::Frame* frame)
{
ODesc d;
const zeek::detail::BroFunc* func = frame ? frame->GetFunction() : nullptr;
const zeek::detail::ScriptFunc* func = frame ? frame->GetFunction() : nullptr;
if ( func )
func->DescribeDebug(&d, frame->GetFuncArgs());
@ -770,7 +770,7 @@ int dbg_handle_debug_input()
}
zeek::detail::Frame* curr_frame = g_frame_stack.back();
const zeek::detail::BroFunc* func = curr_frame->GetFunction();
const zeek::detail::ScriptFunc* func = curr_frame->GetFunction();
if ( func )
zeek::detail::current_module = extract_module_name(func->Name());
else
@ -963,7 +963,7 @@ zeek::ValPtr dbg_eval_expr(const char* expr)
if ( ! (frame) )
reporter->InternalError("Assertion failed: frame");
const zeek::detail::BroFunc* func = frame->GetFunction();
const zeek::detail::ScriptFunc* func = frame->GetFunction();
if ( func )
{
Ref(func->GetScope());

View file

@ -8,10 +8,10 @@
class IP_Hdr;
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek);
namespace zeek::detail {
namespace zeek {
using FuncPtr = zeek::IntrusivePtr<Func>;
}
@ -27,10 +27,10 @@ public:
protected:
zeek::Val* BuildData(const u_char* data, int hdrlen, int len, int caplen);
zeek::detail::FuncPtr check_ip;
zeek::detail::FuncPtr check_tcp;
zeek::detail::FuncPtr check_udp;
zeek::detail::FuncPtr check_icmp;
zeek::FuncPtr check_ip;
zeek::FuncPtr check_tcp;
zeek::FuncPtr check_udp;
zeek::FuncPtr check_icmp;
// Maximum amount of application data passed to filtering functions.
int discarder_maxlen;

View file

@ -44,10 +44,10 @@ const zeek::FuncTypePtr& EventHandler::GetType(bool check_export)
return type;
}
void EventHandler::SetFunc(zeek::detail::FuncPtr f)
void EventHandler::SetFunc(zeek::FuncPtr f)
{ local = std::move(f); }
void EventHandler::SetLocalHandler(zeek::detail::Func* f)
void EventHandler::SetLocalHandler(zeek::Func* f)
{ SetFunc({zeek::NewRef{}, f}); }
void EventHandler::Call(zeek::Args* vl, bool no_remote)

View file

@ -9,9 +9,9 @@
#include <unordered_set>
#include <string>
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek::detail);
namespace zeek::detail {
using FuncPtr = zeek::IntrusivePtr<zeek::detail::Func>;
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
namespace zeek {
using FuncPtr = zeek::IntrusivePtr<zeek::Func>;
}
class EventHandler {
@ -20,11 +20,11 @@ public:
const char* Name() { return name.data(); }
const zeek::detail::FuncPtr& GetFunc()
const zeek::FuncPtr& GetFunc()
{ return local; }
[[deprecated("Remove in v4.1. Use GetFunc().")]]
zeek::detail::Func* LocalHandler() { return local.get(); }
zeek::Func* LocalHandler() { return local.get(); }
const zeek::FuncTypePtr& GetType(bool check_export = true);
@ -32,10 +32,10 @@ public:
zeek::FuncType* FType(bool check_export = true)
{ return GetType().get(); }
void SetFunc(zeek::detail::FuncPtr f);
void SetFunc(zeek::FuncPtr f);
[[deprecated("Remove in v4.1. Use SetFunc().")]]
void SetLocalHandler(zeek::detail::Func* f);
void SetLocalHandler(zeek::Func* f);
void AutoPublish(std::string topic)
{
@ -71,7 +71,7 @@ private:
void NewEvent(zeek::Args* vl); // Raise new_event() meta event.
std::string name;
zeek::detail::FuncPtr local;
zeek::FuncPtr local;
zeek::FuncTypePtr type;
bool used; // this handler is indeed used somewhere
bool enabled;

View file

@ -4051,8 +4051,8 @@ CallExpr::CallExpr(ExprPtr arg_func, ListExprPtr arg_args, bool in_hook)
did_builtin_init &&
(func_val = func->Eval(nullptr)) )
{
zeek::detail::Func* f = func_val->AsFunc();
if ( f->GetKind() == zeek::detail::Func::BUILTIN_FUNC &&
zeek::Func* f = func_val->AsFunc();
if ( f->GetKind() == zeek::Func::BUILTIN_FUNC &&
! check_built_in_call((BuiltinFunc*) f, this) )
SetError();
}
@ -4072,7 +4072,7 @@ bool CallExpr::IsPure() const
if ( ! func_val )
return false;
zeek::detail::Func* f = func_val->AsFunc();
zeek::Func* f = func_val->AsFunc();
// Only recurse for built-in functions, as recursing on script
// functions can lead to infinite recursion if the function being
@ -4080,7 +4080,7 @@ bool CallExpr::IsPure() const
// or indirectly).
bool pure = false;
if ( f->GetKind() == zeek::detail::Func::BUILTIN_FUNC )
if ( f->GetKind() == zeek::Func::BUILTIN_FUNC )
pure = f->IsPure() && args->IsPure();
return pure;
@ -4114,7 +4114,7 @@ ValPtr CallExpr::Eval(Frame* f) const
if ( func_val && v )
{
const zeek::detail::Func* funcv = func_val->AsFunc();
const zeek::Func* funcv = func_val->AsFunc();
const CallExpr* current_call = f ? f->GetCall() : nullptr;
if ( f )
@ -4168,7 +4168,7 @@ LambdaExpr::LambdaExpr(std::unique_ptr<function_ingredients> arg_ing,
// Install a dummy version of the function globally for use only
// when broker provides a closure.
auto dummy_func = zeek::make_intrusive<BroFunc>(
auto dummy_func = zeek::make_intrusive<ScriptFunc>(
ingredients->id,
ingredients->body,
ingredients->inits,
@ -4219,7 +4219,7 @@ Scope* LambdaExpr::GetScope() const
ValPtr LambdaExpr::Eval(Frame* f) const
{
auto lamb = zeek::make_intrusive<BroFunc>(
auto lamb = zeek::make_intrusive<ScriptFunc>(
ingredients->id,
ingredients->body,
ingredients->inits,

View file

@ -15,7 +15,7 @@ std::vector<zeek::detail::Frame*> g_frame_stack;
namespace zeek::detail {
Frame::Frame(int arg_size, const BroFunc* func, const zeek::Args* fn_args)
Frame::Frame(int arg_size, const ScriptFunc* func, const zeek::Args* fn_args)
{
size = arg_size;
frame = std::make_unique<Element[]>(size);
@ -53,12 +53,12 @@ Frame::~Frame()
ClearElement(i);
}
void Frame::AddFunctionWithClosureRef(BroFunc* func)
void Frame::AddFunctionWithClosureRef(ScriptFunc* func)
{
zeek::Ref(func);
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<ScriptFunc*>>();
functions_with_closure_frame_reference->emplace_back(func);
}
@ -174,7 +174,7 @@ Frame* Frame::Clone() const
return other;
}
static bool val_is_func(const zeek::ValPtr& v, BroFunc* func)
static bool val_is_func(const zeek::ValPtr& v, ScriptFunc* func)
{
if ( v->GetType()->Tag() != zeek::TYPE_FUNC )
return false;
@ -182,7 +182,7 @@ static bool val_is_func(const zeek::ValPtr& v, BroFunc* func)
return v->AsFunc() == func;
}
void Frame::CloneNonFuncElement(int offset, BroFunc* func, Frame* other) const
void Frame::CloneNonFuncElement(int offset, ScriptFunc* func, Frame* other) const
{
const auto& v = frame[offset].val;
@ -199,7 +199,7 @@ void Frame::CloneNonFuncElement(int offset, BroFunc* func, Frame* other) const
other->SetElement(offset, std::move(rval));
}
Frame* Frame::SelectiveClone(const id_list& selection, BroFunc* func) const
Frame* Frame::SelectiveClone(const id_list& selection, ScriptFunc* func) const
{
if ( selection.length() == 0 )
return nullptr;

View file

@ -16,10 +16,12 @@
#include <broker/data.hh>
#include <broker/expected.hh>
ZEEK_FORWARD_DECLARE_NAMESPACED(BroFunc, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(CallExpr, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Trigger, zeek::detail::trigger);
namespace zeek::detail { class ScriptFunc; }
using BroFunc [[deprecated("Remove in v4.1. Use zeek::detail::ScriptFunc instead.")]] = zeek::detail::ScriptFunc;
namespace zeek {
using ValPtr = zeek::IntrusivePtr<Val>;
@ -43,7 +45,7 @@ public:
* @param func the function that is creating this frame
* @param fn_args the arguments being passed to that function.
*/
Frame(int size, const BroFunc* func, const zeek::Args* fn_args);
Frame(int size, const ScriptFunc* func, const zeek::Args* fn_args);
/**
* Deletes the frame. Unrefs its trigger, the values that it
@ -111,7 +113,7 @@ public:
/**
* @return the function that the frame is associated with.
*/
const BroFunc* GetFunction() const { return function; }
const ScriptFunc* GetFunction() const { return function; }
/**
* @return the arguments passed to the function that this frame
@ -124,7 +126,7 @@ public:
*
* @param func the function for the frame to be associated with.
*/
void SetFunction(BroFunc* func) { function = func; }
void SetFunction(ScriptFunc* func) { function = func; }
/**
* Sets the next statement to be executed in the context of the frame.
@ -173,7 +175,7 @@ public:
* *selection* have been cloned. All other values are made to be
* null.
*/
Frame* SelectiveClone(const id_list& selection, BroFunc* func) const;
Frame* SelectiveClone(const id_list& selection, ScriptFunc* func) const;
/**
* Serializes the Frame into a Broker representation.
@ -246,7 +248,7 @@ public:
* weak references prevents unbreakable circular references that
* otherwise cause memory leaks.
*/
void AddFunctionWithClosureRef(BroFunc* func);
void AddFunctionWithClosureRef(ScriptFunc* func);
private:
@ -276,7 +278,7 @@ private:
* function (in that case just assigna weak reference). Used to break
* circular references between lambda functions and closure frames.
*/
void CloneNonFuncElement(int offset, BroFunc* func, Frame* other) const;
void CloneNonFuncElement(int offset, ScriptFunc* func, Frame* other) const;
/**
* Resets the value at offset 'n' frame (by decrementing reference
@ -327,7 +329,7 @@ private:
std::unique_ptr<OffsetMap> offset_map;
/** The function this frame is associated with. */
const BroFunc* function;
const ScriptFunc* function;
/** The arguments to the function that this Frame is associated with. */
const zeek::Args* func_args;
@ -337,7 +339,7 @@ private:
zeek::detail::trigger::TriggerPtr trigger;
const zeek::detail::CallExpr* call;
std::unique_ptr<std::vector<BroFunc*>> functions_with_closure_frame_reference;
std::unique_ptr<std::vector<ScriptFunc*>> functions_with_closure_frame_reference;
};
} // namespace detail

View file

@ -71,23 +71,23 @@
extern RETSIGTYPE sig_handler(int signo);
namespace zeek {
namespace detail {
namespace zeek::detail {
std::vector<CallInfo> call_stack;
bool did_builtin_init = false;
static const std::pair<bool, zeek::ValPtr> empty_hook_result(false, nullptr);
} // namespace zeek::detail
namespace zeek {
std::string render_call_stack()
{
std::string rval;
int lvl = 0;
if ( ! call_stack.empty() )
if ( ! detail::call_stack.empty() )
rval += "| ";
for ( auto it = call_stack.rbegin(); it != call_stack.rend(); ++it )
for ( auto it = detail::call_stack.rbegin(); it != detail::call_stack.rend(); ++it )
{
if ( lvl > 0 )
rval += " | ";
@ -119,7 +119,7 @@ std::string render_call_stack()
++lvl;
}
if ( ! call_stack.empty() )
if ( ! detail::call_stack.empty() )
rval += " |";
return rval;
@ -151,7 +151,7 @@ void Func::SetScope(zeek::detail::ScopePtr newscope)
scope = std::move(newscope);
}
zeek::detail::FuncPtr Func::DoClone()
zeek::FuncPtr Func::DoClone()
{
// By default, ok just to return a reference. Func does not have any state
// that is different across instances.
@ -203,7 +203,7 @@ TraversalCode Func::Traverse(TraversalCallback* cb) const
HANDLE_TC_STMT_PRE(tc);
// FIXME: Traverse arguments to builtin functions, too.
if ( kind == BRO_FUNC && scope )
if ( kind == SCRIPT_FUNC && scope )
{
tc = scope->Traverse(cb);
HANDLE_TC_STMT_PRE(tc);
@ -236,7 +236,7 @@ void Func::CopyStateInto(Func* other) const
void Func::CheckPluginResult(bool handled, const zeek::ValPtr& hook_result,
zeek::FunctionFlavor flavor) const
{
// Helper function factoring out this code from BroFunc:Call() for
// Helper function factoring out this code from ScriptFunc:Call() for
// better readability.
if ( ! handled )
@ -286,10 +286,18 @@ void Func::CheckPluginResult(bool handled, const zeek::ValPtr& hook_result,
}
}
BroFunc::BroFunc(const zeek::detail::IDPtr& arg_id, zeek::detail::StmtPtr arg_body,
zeek::Val* Func::Call(val_list* args, zeek::detail::Frame* parent) const
{
auto zargs = zeek::val_list_to_args(*args);
return Invoke(&zargs, parent).release();
};
namespace detail {
ScriptFunc::ScriptFunc(const zeek::detail::IDPtr& arg_id, zeek::detail::StmtPtr arg_body,
const std::vector<zeek::detail::IDPtr>& aggr_inits,
size_t arg_frame_size, int priority)
: Func(BRO_FUNC)
: Func(SCRIPT_FUNC)
{
name = arg_id->Name();
type = arg_id->GetType<zeek::FuncType>();
@ -304,25 +312,19 @@ BroFunc::BroFunc(const zeek::detail::IDPtr& arg_id, zeek::detail::StmtPtr arg_bo
}
}
BroFunc::~BroFunc()
ScriptFunc::~ScriptFunc()
{
if ( ! weak_closure_ref )
Unref(closure);
}
bool BroFunc::IsPure() const
bool ScriptFunc::IsPure() const
{
return std::all_of(bodies.begin(), bodies.end(),
[](const Body& b) { return b.stmts->IsPure(); });
}
zeek::Val* Func::Call(val_list* args, zeek::detail::Frame* parent) const
{
auto zargs = zeek::val_list_to_args(*args);
return Invoke(&zargs, parent).release();
};
zeek::ValPtr BroFunc::Invoke(zeek::Args* args, zeek::detail::Frame* parent) const
zeek::ValPtr ScriptFunc::Invoke(zeek::Args* args, zeek::detail::Frame* parent) const
{
#ifdef PROFILE_BRO_FUNCTIONS
DEBUG_MSG("Function: %s\n", Name());
@ -467,7 +469,7 @@ zeek::ValPtr BroFunc::Invoke(zeek::Args* args, zeek::detail::Frame* parent) cons
return result;
}
void BroFunc::AddBody(zeek::detail::StmtPtr new_body,
void ScriptFunc::AddBody(zeek::detail::StmtPtr new_body,
const std::vector<zeek::detail::IDPtr>& new_inits,
size_t new_frame_size, int priority)
{
@ -496,7 +498,7 @@ void BroFunc::AddBody(zeek::detail::StmtPtr new_body,
sort(bodies.begin(), bodies.end());
}
void BroFunc::AddClosure(id_list ids, zeek::detail::Frame* f)
void ScriptFunc::AddClosure(id_list ids, zeek::detail::Frame* f)
{
if ( ! f )
return;
@ -505,7 +507,7 @@ void BroFunc::AddClosure(id_list ids, zeek::detail::Frame* f)
SetClosureFrame(f);
}
bool BroFunc::StrengthenClosureReference(zeek::detail::Frame* f)
bool ScriptFunc::StrengthenClosureReference(zeek::detail::Frame* f)
{
if ( closure != f )
return false;
@ -518,10 +520,10 @@ bool BroFunc::StrengthenClosureReference(zeek::detail::Frame* f)
return true;
}
void BroFunc::SetClosureFrame(zeek::detail::Frame* f)
void ScriptFunc::SetClosureFrame(zeek::detail::Frame* f)
{
if ( closure )
reporter->InternalError("Tried to override closure for BroFunc %s.",
reporter->InternalError("Tried to override closure for ScriptFunc %s.",
Name());
// Have to use weak references initially because otherwise Ref'ing the
@ -536,7 +538,7 @@ void BroFunc::SetClosureFrame(zeek::detail::Frame* f)
f->AddFunctionWithClosureRef(this);
}
bool BroFunc::UpdateClosure(const broker::vector& data)
bool ScriptFunc::UpdateClosure(const broker::vector& data)
{
auto result = zeek::detail::Frame::Unserialize(data);
@ -558,11 +560,11 @@ bool BroFunc::UpdateClosure(const broker::vector& data)
}
zeek::detail::FuncPtr BroFunc::DoClone()
zeek::FuncPtr ScriptFunc::DoClone()
{
// BroFunc could hold a closure. In this case a clone of it must
// ScriptFunc could hold a closure. In this case a clone of it must
// store a copy of this closure.
auto other = zeek::IntrusivePtr{zeek::AdoptRef{}, new BroFunc()};
auto other = zeek::IntrusivePtr{zeek::AdoptRef{}, new ScriptFunc()};
CopyStateInto(other.get());
@ -574,12 +576,12 @@ zeek::detail::FuncPtr BroFunc::DoClone()
return other;
}
broker::expected<broker::data> BroFunc::SerializeClosure() const
broker::expected<broker::data> ScriptFunc::SerializeClosure() const
{
return zeek::detail::Frame::Serialize(closure, outer_ids);
}
void BroFunc::Describe(ODesc* d) const
void ScriptFunc::Describe(ODesc* d) const
{
d->Add(Name());
@ -592,7 +594,7 @@ void BroFunc::Describe(ODesc* d) const
}
}
zeek::detail::StmtPtr BroFunc::AddInits(
zeek::detail::StmtPtr ScriptFunc::AddInits(
zeek::detail::StmtPtr body,
const std::vector<zeek::detail::IDPtr>& inits)
{

View file

@ -25,6 +25,12 @@ ZEEK_FORWARD_DECLARE_NAMESPACED(ID, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(FuncType, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail);
namespace zeek::detail {
using ScopePtr = zeek::IntrusivePtr<detail::Scope>;
using IDPtr = zeek::IntrusivePtr<ID>;
using StmtPtr = zeek::IntrusivePtr<Stmt>;
}
namespace caf {
template <class> class expected;
}
@ -37,19 +43,16 @@ using caf::expected;
namespace zeek {
namespace detail {
using ScopePtr = zeek::IntrusivePtr<zeek::detail::Scope>;
using IDPtr = zeek::IntrusivePtr<ID>;
using StmtPtr = zeek::IntrusivePtr<Stmt>;
class Func;
using FuncPtr = zeek::IntrusivePtr<Func>;
class Func : public BroObj {
public:
static inline const FuncPtr nil;
enum Kind { BRO_FUNC, BUILTIN_FUNC };
enum Kind { SCRIPT_FUNC, BUILTIN_FUNC };
static constexpr auto BRO_FUNC [[deprecated("Remove in v4.1. Use Func::SCRIPT_FUNC instead.")]] = SCRIPT_FUNC;
explicit Func(Kind arg_kind);
@ -142,21 +145,22 @@ protected:
static inline std::vector<FuncPtr> unique_ids;
};
namespace detail {
class BroFunc final : public Func {
class ScriptFunc final : public zeek::Func {
public:
BroFunc(const zeek::detail::IDPtr& id, zeek::detail::StmtPtr body,
ScriptFunc(const zeek::detail::IDPtr& id, zeek::detail::StmtPtr body,
const std::vector<zeek::detail::IDPtr>& inits,
size_t frame_size, int priority);
~BroFunc() override;
~ScriptFunc() override;
bool IsPure() const override;
zeek::ValPtr Invoke(zeek::Args* args, zeek::detail::Frame* parent) const override;
/**
* Adds adds a closure to the function. Closures are cloned and
* future calls to BroFunc methods will not modify *f*.
* future calls to ScriptFunc methods will not modify *f*.
*
* @param ids IDs that are captured by the closure.
* @param f the closure to be captured.
@ -194,7 +198,7 @@ public:
void Describe(ODesc* d) const override;
protected:
BroFunc() : Func(BRO_FUNC) {}
ScriptFunc() : zeek::Func(SCRIPT_FUNC) {}
zeek::detail::StmtPtr AddInits(
zeek::detail::StmtPtr body,
const std::vector<zeek::detail::IDPtr>& inits);
@ -202,7 +206,7 @@ protected:
/**
* Clones this function along with its closures.
*/
FuncPtr DoClone() override;
zeek::FuncPtr DoClone() override;
/**
* Performs a selective clone of *f* using the IDs that were
@ -217,14 +221,14 @@ private:
// List of the outer IDs used in the function.
id_list outer_ids;
// The frame the BroFunc was initialized in.
// The frame the ScriptFunc was initialized in.
zeek::detail::Frame* closure = nullptr;
bool weak_closure_ref = false;
};
using built_in_func = BifReturnVal (*)(zeek::detail::Frame* frame, const zeek::Args* args);
class BuiltinFunc final : public Func {
class BuiltinFunc final : public zeek::Func {
public:
BuiltinFunc(built_in_func func, const char* name, bool is_pure);
~BuiltinFunc() override;
@ -250,7 +254,7 @@ struct CallInfo {
const zeek::Args& args;
};
// Struct that collects all the specifics defining a Func. Used for BroFuncs
// Struct that collects all the specifics defining a Func. Used for ScriptFuncs
// with closures.
struct function_ingredients {
@ -268,13 +272,13 @@ struct function_ingredients {
extern std::vector<CallInfo> call_stack;
extern std::string render_call_stack();
// This is set to true after the built-in functions have been initialized.
extern bool did_builtin_init;
} // namespace detail
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);
@ -282,14 +286,14 @@ extern void emit_builtin_error(const char* msg, BroObj* arg);
} // namespace zeek
using Func [[deprecated("Remove in v4.1. Use zeek::detail::Func.")]] = zeek::detail::Func;
using BroFunc [[deprecated("Remove in v4.1. Use zeek::detail::BroFunc.")]] = zeek::detail::BroFunc;
using BuiltinFunc [[deprecated("Remove in v4.1. Use zeek::detail::BroFunc.")]] = zeek::detail::BuiltinFunc;
using Func [[deprecated("Remove in v4.1. Use zeek::Func.")]] = zeek::Func;
using BroFunc [[deprecated("Remove in v4.1. Use zeek::detail::ScriptFunc.")]] = zeek::detail::ScriptFunc;
using BuiltinFunc [[deprecated("Remove in v4.1. Use zeek::detail::BuiltinFunc.")]] = zeek::detail::BuiltinFunc;
using CallInfo [[deprecated("Remove in v4.1. Use zeek::detail::CallInfo.")]] = zeek::detail::CallInfo;
using function_ingredients [[deprecated("Remove in v4.1. Use zeek::detail::function_ingredients.")]] = zeek::detail::function_ingredients;
constexpr auto check_built_in_call [[deprecated("Remove in v4.1. Use zeek::detail::check_built_in_call.")]] = zeek::detail::check_built_in_call;
constexpr auto render_call_stack [[deprecated("Remove in v4.1. Use zeek::detail::render_call_stack.")]] = zeek::detail::render_call_stack;
constexpr auto render_call_stack [[deprecated("Remove in v4.1. Use zeek::render_call_stack.")]] = zeek::render_call_stack;
// TODO: these are still here because of how all of the bif code gets included in Func.c. There could be a
// renamed version inside the namespace, but the way that the code gets included complicates the matter. It

View file

@ -74,7 +74,7 @@ const zeek::ValPtr& zeek::id::find_const(std::string_view name)
return id->GetVal();
}
zeek::detail::FuncPtr zeek::id::find_func(std::string_view name)
zeek::FuncPtr zeek::id::find_func(std::string_view name)
{
const auto& v = zeek::id::find_val(name);
@ -643,7 +643,7 @@ void ID::UpdateValID()
}
#endif
void ID::AddOptionHandler(zeek::detail::FuncPtr callback, int priority)
void ID::AddOptionHandler(zeek::FuncPtr callback, int priority)
{
option_handlers.emplace(priority, std::move(callback));
}

View file

@ -13,7 +13,7 @@
#include <string_view>
#include <vector>
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordType, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(TableType, zeek);
@ -28,6 +28,7 @@ using TableTypePtr = zeek::IntrusivePtr<zeek::TableType>;
using VectorTypePtr = zeek::IntrusivePtr<zeek::VectorType>;
using EnumTypePtr = zeek::IntrusivePtr<zeek::EnumType>;
using ValPtr = zeek::IntrusivePtr<zeek::Val>;
using FuncPtr = zeek::IntrusivePtr<zeek::Func>;
}
using BroType [[deprecated("Remove in v4.1. Use zeek::Type instead.")]] = zeek::Type;
@ -37,7 +38,6 @@ namespace zeek::detail {
class Attributes;
class Expr;
using ExprPtr = zeek::IntrusivePtr<Expr>;
using FuncPtr = zeek::IntrusivePtr<zeek::detail::Func>;
enum InitClass { INIT_NONE, INIT_FULL, INIT_EXTRA, INIT_REMOVE, };
enum IDScope { SCOPE_FUNCTION, SCOPE_MODULE, SCOPE_GLOBAL };
@ -156,7 +156,7 @@ public:
bool HasOptionHandlers() const
{ return !option_handlers.empty(); }
void AddOptionHandler(zeek::detail::FuncPtr callback, int priority);
void AddOptionHandler(zeek::FuncPtr callback, int priority);
std::vector<Func*> GetOptionHandlers() const;
protected:
@ -176,7 +176,7 @@ protected:
ValPtr val;
AttributesPtr attrs;
// contains list of functions that are called when an option changes
std::multimap<int, zeek::detail::FuncPtr> option_handlers;
std::multimap<int, zeek::FuncPtr> option_handlers;
};
@ -254,7 +254,7 @@ zeek::IntrusivePtr<T> find_const(std::string_view name)
* @param name The identifier name to lookup
* @return The current function value the identifier references.
*/
zeek::detail::FuncPtr find_func(std::string_view name);
zeek::FuncPtr find_func(std::string_view name);
extern RecordTypePtr conn_id;
extern RecordTypePtr endpoint;

View file

@ -9,7 +9,7 @@ class CCL;
class NFA_State;
class EquivClass;
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
using NFA_state_list = zeek::PList<NFA_State>;

View file

@ -103,7 +103,7 @@ void BroObj::Internal(const char* msg) const
{
ODesc d;
DoMsg(&d, msg);
auto rcs = zeek::detail::render_call_stack();
auto rcs = zeek::render_call_stack();
if ( rcs.empty() )
reporter->InternalError("%s", d.Description());

View file

@ -352,7 +352,7 @@ SampleLogger::~SampleLogger()
Unref(load_samples);
}
void SampleLogger::FunctionSeen(const zeek::detail::Func* func)
void SampleLogger::FunctionSeen(const zeek::Func* func)
{
auto idx = zeek::make_intrusive<zeek::StringVal>(func->Name());
load_samples->Assign(std::move(idx), nullptr);

View file

@ -11,7 +11,7 @@
class BroFile;
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(TableVal, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Location, zeek::detail);
@ -94,7 +94,7 @@ public:
// These are called to report that a given function or location
// has been seen during the sampling.
void FunctionSeen(const zeek::detail::Func* func);
void FunctionSeen(const zeek::Func* func);
void LocationSeen(const zeek::detail::Location* loc);
protected:

View file

@ -4,7 +4,7 @@
#include "TraverseTypes.h"
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Scope, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail);
@ -15,8 +15,8 @@ public:
TraversalCallback() { current_scope = nullptr; }
virtual ~TraversalCallback() {}
virtual TraversalCode PreFunction(const zeek::detail::Func*) { return TC_CONTINUE; }
virtual TraversalCode PostFunction(const zeek::detail::Func*) { return TC_CONTINUE; }
virtual TraversalCode PreFunction(const zeek::Func*) { return TC_CONTINUE; }
virtual TraversalCode PostFunction(const zeek::Func*) { return TC_CONTINUE; }
virtual TraversalCode PreStmt(const zeek::detail::Stmt*) { return TC_CONTINUE; }
virtual TraversalCode PostStmt(const zeek::detail::Stmt*) { return TC_CONTINUE; }

View file

@ -44,10 +44,10 @@ using namespace std;
namespace zeek {
Val::Val(zeek::detail::Func* f) : Val({NewRef{}, f})
Val::Val(zeek::Func* f) : Val({NewRef{}, f})
{}
Val::Val(zeek::detail::FuncPtr f)
Val::Val(zeek::FuncPtr f)
: val(f.release()), type(val.func_val->GetType())
{}
@ -155,7 +155,7 @@ ValPtr Val::DoClone(CloneState* state)
return nullptr;
}
zeek::detail::FuncPtr Val::AsFuncPtr() const
zeek::FuncPtr Val::AsFuncPtr() const
{
CHECK_TAG(type->Tag(), TYPE_FUNC, "Val::Func", type_name)
return {NewRef{}, val.func_val};
@ -1858,7 +1858,7 @@ ValPtr TableVal::Default(const ValPtr& index)
return nullptr;
}
const zeek::detail::Func* f = def_val->AsFunc();
const zeek::Func* f = def_val->AsFunc();
Args vl;
if ( index->GetType()->Tag() == TYPE_LIST )
@ -2056,7 +2056,7 @@ void TableVal::CallChangeFunc(const Val* index,
return;
}
const zeek::detail::Func* f = thefunc->AsFunc();
const zeek::Func* f = thefunc->AsFunc();
auto lv = index->AsListVal();
Args vl;
@ -2514,7 +2514,7 @@ double TableVal::CallExpireFunc(ListValPtr idx)
return 0;
}
const zeek::detail::Func* f = vf->AsFunc();
const zeek::Func* f = vf->AsFunc();
Args vl;
const auto& func_args = f->GetType()->ParamList()->GetTypes();

View file

@ -33,8 +33,10 @@ template<typename T> using PDict [[deprecated("Remove in v4.1. Use zeek::PDict i
ZEEK_FORWARD_DECLARE_NAMESPACED(IterCookie, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(BroString, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(BroFunc, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
namespace zeek::detail { class ScriptFunc; }
using BroFunc [[deprecated("Remove in v4.1. Use zeek::detail::ScriptFunc instead.")]] = zeek::detail::ScriptFunc;
class BroFile;
class PrefixTable;
@ -50,10 +52,7 @@ extern double bro_start_network_time;
namespace zeek {
namespace detail {
using FuncPtr = zeek::IntrusivePtr<Func>;
}
using BroFilePtr = zeek::IntrusivePtr<BroFile>;
class Val;
@ -98,7 +97,7 @@ union BroValUnion {
double double_val;
BroString* string_val;
zeek::detail::Func* func_val;
zeek::Func* func_val;
BroFile* file_val;
RE_Matcher* re_val;
zeek::PDict<TableEntryVal>* table_val;
@ -125,7 +124,7 @@ union BroValUnion {
constexpr BroValUnion(BroString* value) noexcept
: string_val(value) {}
constexpr BroValUnion(zeek::detail::Func* value) noexcept
constexpr BroValUnion(zeek::Func* value) noexcept
: func_val(value) {}
constexpr BroValUnion(BroFile* value) noexcept
@ -148,8 +147,8 @@ public:
{}
[[deprecated("Remove in v4.1. Construct from IntrusivePtr instead.")]]
explicit Val(zeek::detail::Func* f);
explicit Val(zeek::detail::FuncPtr f);
explicit Val(zeek::Func* f);
explicit Val(zeek::FuncPtr f);
[[deprecated("Remove in v4.1. Construct from IntrusivePtr instead.")]]
explicit Val(BroFile* f);
@ -238,7 +237,7 @@ public:
CONST_ACCESSOR2(zeek::TYPE_INTERVAL, double, double_val, AsInterval)
CONST_ACCESSOR2(zeek::TYPE_ENUM, int, int_val, AsEnum)
CONST_ACCESSOR(zeek::TYPE_STRING, BroString*, string_val, AsString)
CONST_ACCESSOR(zeek::TYPE_FUNC, zeek::detail::Func*, func_val, AsFunc)
CONST_ACCESSOR(zeek::TYPE_FUNC, zeek::Func*, func_val, AsFunc)
CONST_ACCESSOR(zeek::TYPE_TABLE, zeek::PDict<TableEntryVal>*, table_val, AsTable)
CONST_ACCESSOR(zeek::TYPE_RECORD, std::vector<ValPtr>*, record_val, AsRecord)
CONST_ACCESSOR(zeek::TYPE_FILE, BroFile*, file_val, AsFile)
@ -274,12 +273,12 @@ public:
// Accessors for mutable values are called AsNonConst* and
// are protected to avoid external state changes.
// ACCESSOR(zeek::TYPE_STRING, BroString*, string_val, AsString)
ACCESSOR(zeek::TYPE_FUNC, zeek::detail::Func*, func_val, AsFunc)
ACCESSOR(zeek::TYPE_FUNC, zeek::Func*, func_val, AsFunc)
ACCESSOR(zeek::TYPE_FILE, BroFile*, file_val, AsFile)
ACCESSOR(zeek::TYPE_PATTERN, RE_Matcher*, re_val, AsPattern)
ACCESSOR(zeek::TYPE_VECTOR, std::vector<ValPtr>*, vector_val, AsVector)
zeek::detail::FuncPtr AsFuncPtr() const;
zeek::FuncPtr AsFuncPtr() const;
const IPPrefix& AsSubNet()
{

View file

@ -307,7 +307,7 @@ static void make_var(const zeek::detail::IDPtr& id, zeek::TypePtr t,
// we can later access the ID even if no implementations have been
// defined.
std::vector<zeek::detail::IDPtr> inits;
auto f = zeek::make_intrusive<zeek::detail::BroFunc>(id, nullptr, inits, 0, 0);
auto f = zeek::make_intrusive<zeek::detail::ScriptFunc>(id, nullptr, inits, 0, 0);
id->SetVal(zeek::make_intrusive<zeek::Val>(std::move(f)));
}
}
@ -655,7 +655,7 @@ void end_func(zeek::detail::StmtPtr body)
ingredients->priority);
else
{
auto f = zeek::make_intrusive<zeek::detail::BroFunc>(
auto f = zeek::make_intrusive<zeek::detail::ScriptFunc>(
ingredients->id,
ingredients->body,
ingredients->inits,
@ -781,7 +781,7 @@ zeek::Type* internal_type(const char* name)
return zeek::id::find_type(name).get();
}
zeek::detail::Func* internal_func(const char* name)
zeek::Func* internal_func(const char* name)
{
const auto& v = zeek::id::find_val(name);

View file

@ -86,7 +86,7 @@ extern zeek::ListVal* internal_list_val(const char* name);
extern zeek::Type* internal_type(const char* name);
[[deprecated("Remove in v4.1. Use zeek::id::find_func().")]]
extern zeek::detail::Func* internal_func(const char* name);
extern zeek::Func* internal_func(const char* name);
[[deprecated("Remove in v4.1. Use event_registry->Register().")]]
extern EventHandlerPtr internal_handler(const char* name);

View file

@ -370,7 +370,7 @@ struct val_converter {
if ( ! frame )
return nullptr;
auto* b = dynamic_cast<zeek::detail::BroFunc*>(rval->AsFunc());
auto* b = dynamic_cast<zeek::detail::ScriptFunc*>(rval->AsFunc());
if ( ! b )
return nullptr;
@ -852,7 +852,7 @@ broker::expected<broker::data> bro_broker::val_to_data(const zeek::Val* v)
return {string(v->AsFile()->Name())};
case zeek::TYPE_FUNC:
{
const zeek::detail::Func* f = v->AsFunc();
const zeek::Func* f = v->AsFunc();
std::string name(f->Name());
broker::vector rval;
@ -860,8 +860,8 @@ broker::expected<broker::data> bro_broker::val_to_data(const zeek::Val* v)
if ( name.find("lambda_<") == 0 )
{
// Only BroFuncs have closures.
if ( auto b = dynamic_cast<const zeek::detail::BroFunc*>(f) )
// Only ScriptFuncs have closures.
if ( auto b = dynamic_cast<const zeek::detail::ScriptFunc*>(f) )
{
auto bc = b->SerializeClosure();
if ( ! bc )
@ -871,7 +871,7 @@ broker::expected<broker::data> bro_broker::val_to_data(const zeek::Val* v)
}
else
{
reporter->InternalWarning("Closure with non-BroFunc");
reporter->InternalWarning("Closure with non-ScriptFunc");
return broker::ec::invalid_data;
}
}

View file

@ -704,7 +704,7 @@ zeek::RecordVal* Manager::MakeEvent(val_list* args, zeek::detail::Frame* frame)
auto rval = new zeek::RecordVal(zeek::BifType::Record::Broker::Event);
auto arg_vec = zeek::make_intrusive<zeek::VectorVal>(vector_of_data_type);
rval->Assign(1, arg_vec);
zeek::detail::Func* func = nullptr;
zeek::Func* func = nullptr;
scoped_reporter_location srl{frame};
for ( auto i = 0; i < args->length(); ++i )

View file

@ -21,7 +21,7 @@
#include "iosource/IOSource.h"
#include "logging/WriterBackend.h"
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(VectorType, zeek);
@ -400,7 +400,7 @@ private:
int peer_count;
size_t log_batch_size;
zeek::detail::Func* log_topic_func;
zeek::Func* log_topic_func;
zeek::VectorTypePtr vector_of_data_type;
zeek::EnumType* log_id_type;
zeek::EnumType* writer_id_type;

View file

@ -182,7 +182,7 @@ type Cluster::Pool: record;
## Returns: true if the message is sent.
function Cluster::publish_rr%(pool: Pool, key: string, ...%): bool
%{
static zeek::detail::Func* topic_func = nullptr;
static zeek::Func* topic_func = nullptr;
if ( ! topic_func )
topic_func = zeek::detail::global_scope()->Find("Cluster::rr_topic")->GetVal()->AsFunc();
@ -219,7 +219,7 @@ function Cluster::publish_rr%(pool: Pool, key: string, ...%): bool
## Returns: true if the message is sent.
function Cluster::publish_hrw%(pool: Pool, key: any, ...%): bool
%{
static zeek::detail::Func* topic_func = nullptr;
static zeek::Func* topic_func = nullptr;
if ( ! topic_func )
topic_func = zeek::detail::global_scope()->Find("Cluster::hrw_topic")->GetVal()->AsFunc();

View file

@ -123,7 +123,7 @@ public:
/**
* Sets the callback when a certificate cache hit is encountered
*/
static void SetCertificateCacheHitCallback(zeek::detail::FuncPtr func)
static void SetCertificateCacheHitCallback(zeek::FuncPtr func)
{ cache_hit_callback = std::move(func); }
protected:
@ -142,7 +142,7 @@ private:
/** X509 stores associated with global script-layer values */
inline static std::map<zeek::Val*, X509_STORE*> x509_stores = std::map<zeek::Val*, X509_STORE*>();
inline static zeek::TableValPtr certificate_cache = nullptr;
inline static zeek::detail::FuncPtr cache_hit_callback = nullptr;
inline static zeek::FuncPtr cache_hit_callback = nullptr;
};
/**

View file

@ -102,7 +102,7 @@ public:
zeek::PDict<InputHash>* currDict;
zeek::PDict<InputHash>* lastDict;
zeek::detail::Func* pred;
zeek::Func* pred;
EventHandlerPtr event;
@ -320,7 +320,7 @@ bool Manager::CreateEventStream(zeek::RecordVal* fval)
auto want_record = fval->GetFieldOrDefault("want_record");
auto ev_val = fval->GetFieldOrDefault("ev");
zeek::detail::Func* event = ev_val->AsFunc();
zeek::Func* event = ev_val->AsFunc();
const auto& etype = event->GetType();
@ -409,7 +409,7 @@ bool Manager::CreateEventStream(zeek::RecordVal* fval)
assert(false);
auto error_event_val = fval->GetFieldOrDefault("error_ev");
zeek::detail::Func* error_event = error_event_val ? error_event_val->AsFunc() : nullptr;
zeek::Func* error_event = error_event_val ? error_event_val->AsFunc() : nullptr;
if ( ! CheckErrorEventTypes(stream_name, error_event, false) )
return false;
@ -545,7 +545,7 @@ bool Manager::CreateTableStream(zeek::RecordVal* fval)
}
auto event_val = fval->GetFieldOrDefault("ev");
zeek::detail::Func* event = event_val ? event_val->AsFunc() : nullptr;
zeek::Func* event = event_val ? event_val->AsFunc() : nullptr;
if ( event )
{
@ -618,7 +618,7 @@ bool Manager::CreateTableStream(zeek::RecordVal* fval)
}
auto error_event_val = fval->GetFieldOrDefault("error_ev");
zeek::detail::Func* error_event = error_event_val ? error_event_val->AsFunc() : nullptr;
zeek::Func* error_event = error_event_val ? error_event_val->AsFunc() : nullptr;
if ( ! CheckErrorEventTypes(stream_name, error_event, true) )
return false;
@ -691,7 +691,7 @@ bool Manager::CreateTableStream(zeek::RecordVal* fval)
return true;
}
bool Manager::CheckErrorEventTypes(const std::string& stream_name, const zeek::detail::Func* ev, bool table) const
bool Manager::CheckErrorEventTypes(const std::string& stream_name, const zeek::Func* ev, bool table) const
{
if ( ev == nullptr )
return true;
@ -1756,7 +1756,7 @@ bool Manager::Delete(ReaderFrontend* reader, Value* *vals)
return success;
}
bool Manager::CallPred(zeek::detail::Func* pred_func, const int numvals, ...) const
bool Manager::CallPred(zeek::Func* pred_func, const int numvals, ...) const
{
bool result = false;
zeek::Args vl;

View file

@ -185,7 +185,7 @@ private:
// Check if the types of the error_ev event are correct. If table is
// true, check for tablestream type, otherwhise check for eventstream
// type.
bool CheckErrorEventTypes(const std::string& stream_name, const zeek::detail::Func* error_event, bool table) const;
bool CheckErrorEventTypes(const std::string& stream_name, const zeek::Func* error_event, bool table) const;
// SendEntry implementation for Table stream.
int SendEntryTable(Stream* i, const threading::Value* const *vals);
@ -209,7 +209,7 @@ private:
void SendEndOfData(const Stream *i);
// Call predicate function and return result.
bool CallPred(zeek::detail::Func* pred_func, const int numvals, ...) const;
bool CallPred(zeek::Func* pred_func, const int numvals, ...) const;
// Get a hashkey for a set of threading::Values.
HashKey* HashValues(const int num_elements, const threading::Value* const *vals) const;

View file

@ -34,8 +34,8 @@ struct Manager::Filter {
zeek::Val* fval;
string name;
zeek::EnumVal* id;
zeek::detail::Func* pred;
zeek::detail::Func* path_func;
zeek::Func* pred;
zeek::Func* path_func;
string path;
zeek::Val* path_val;
zeek::EnumVal* writer;
@ -43,12 +43,12 @@ struct Manager::Filter {
zeek::TableVal* field_name_map;
string scope_sep;
string ext_prefix;
zeek::detail::Func* ext_func;
zeek::Func* ext_func;
int num_ext_fields;
bool local;
bool remote;
double interval;
zeek::detail::Func* postprocessor;
zeek::Func* postprocessor;
int num_fields;
threading::Field** fields;
@ -66,7 +66,7 @@ struct Manager::WriterInfo {
double open_time;
Timer* rotation_timer;
double interval;
zeek::detail::Func* postprocessor;
zeek::Func* postprocessor;
WriterFrontend* writer;
WriterBackend::WriterInfo* info;
bool from_remote;
@ -264,7 +264,7 @@ bool Manager::CreateStream(zeek::EnumVal* id, zeek::RecordVal* sval)
}
const auto& event_val = sval->GetField("ev");
zeek::detail::Func* event = event_val ? event_val->AsFunc() : nullptr;
zeek::Func* event = event_val ? event_val->AsFunc() : nullptr;
if ( event )
{
@ -997,7 +997,7 @@ threading::Value* Manager::ValToLogVal(zeek::Val* val, zeek::Type* ty)
case zeek::TYPE_FUNC:
{
ODesc d;
const zeek::detail::Func* f = val->AsFunc();
const zeek::Func* f = val->AsFunc();
f->Describe(&d);
const char* s = d.Description();
lval->val.string_val.data = copy_string(s);
@ -1517,7 +1517,7 @@ bool Manager::FinishedRotation(WriterFrontend* writer, const char* new_name, con
info->Assign(4, zeek::make_intrusive<zeek::TimeVal>(close));
info->Assign(5, zeek::val_mgr->Bool(terminating));
zeek::detail::Func* func = winfo->postprocessor;
zeek::Func* func = winfo->postprocessor;
if ( ! func )
{
const auto& id = zeek::detail::global_scope()->Find("Log::__default_rotation_postprocessor");

View file

@ -617,7 +617,7 @@ int Manager::HookLoadFile(const Plugin::LoadType type, const string& file, const
}
std::pair<bool, zeek::ValPtr>
Manager::HookCallFunction(const zeek::detail::Func* func, zeek::detail::Frame* parent,
Manager::HookCallFunction(const zeek::Func* func, zeek::detail::Frame* parent,
zeek::Args* vecargs) const
{
HookArgumentList args;

View file

@ -256,7 +256,7 @@ public:
* the method returns null.
*/
std::pair<bool, ValPtr>
HookCallFunction(const zeek::detail::Func* func, zeek::detail::Frame* parent, zeek::Args* args) const;
HookCallFunction(const zeek::Func* func, zeek::detail::Frame* parent, zeek::Args* args) const;
/**
* Hook that filters the queuing of an event.

View file

@ -376,7 +376,7 @@ int Plugin::HookLoadFile(const LoadType type, const std::string& file, const std
}
std::pair<bool, zeek::ValPtr>
Plugin::HookFunctionCall(const zeek::detail::Func* func, zeek::detail::Frame* parent,
Plugin::HookFunctionCall(const zeek::Func* func, zeek::detail::Frame* parent,
zeek::Args* args)
{
val_list vlargs(args->size());
@ -396,7 +396,7 @@ Plugin::HookFunctionCall(const zeek::detail::Func* func, zeek::detail::Frame* pa
}
std::pair<bool, zeek::Val*> Plugin::HookCallFunction(
const zeek::detail::Func* func, zeek::detail::Frame *parent, val_list* args)
const zeek::Func* func, zeek::detail::Frame *parent, val_list* args)
{
std::pair<bool, zeek::Val*> result(false, NULL);
return result;

View file

@ -19,7 +19,7 @@
class ODesc;
class Event;
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek::detail);
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail);
namespace zeek {
@ -201,7 +201,7 @@ public:
/**
* Constructor with a function argument.
*/
explicit HookArgument(const zeek::detail::Func* a) { type = FUNC; arg.func = a; }
explicit HookArgument(const zeek::Func* a) { type = FUNC; arg.func = a; }
/**
* Constructor with an integer argument.
@ -286,7 +286,7 @@ public:
* Returns the value for a function argument. The argument's type must
* match accordingly.
*/
const zeek::detail::Func* AsFunc() const { assert(type == FUNC); return arg.func; }
const zeek::Func* AsFunc() const { assert(type == FUNC); return arg.func; }
/**
* Returns the value for an integer argument. The argument's type must
@ -366,7 +366,7 @@ private:
double double_;
const Event* event;
const Connection* conn;
const zeek::detail::Func* func;
const zeek::Func* func;
const zeek::detail::Frame* frame;
int int_;
const Val* val;
@ -674,10 +674,10 @@ protected:
* pair with the first member set to 'false' and null result value.
*/
virtual std::pair<bool, ValPtr>
HookFunctionCall(const zeek::detail::Func* func, zeek::detail::Frame* parent, zeek::Args* args);
HookFunctionCall(const zeek::Func* func, zeek::detail::Frame* parent, zeek::Args* args);
[[deprecated("Remove in v4.1. Use HookFunctionCall()")]]
virtual std::pair<bool, Val*> HookCallFunction(const zeek::detail::Func* func, zeek::detail::Frame *parent, val_list* args);
virtual std::pair<bool, Val*> HookCallFunction(const zeek::Func* func, zeek::detail::Frame *parent, val_list* args);
/**
* Hook into raising events. Whenever the script interpreter is about

View file

@ -1327,7 +1327,7 @@ function all_set%(v: any%) : bool
%}
%%{
static zeek::detail::Func* sort_function_comp = nullptr;
static zeek::Func* sort_function_comp = nullptr;
static std::vector<const zeek::ValPtr*> index_map; // used for indirect sorting to support order()
bool sort_function(const zeek::ValPtr& a, const zeek::ValPtr& b)
@ -1410,7 +1410,7 @@ function sort%(v: any, ...%) : any
}
const auto& elt_type = v->GetType()->Yield();
zeek::detail::Func* comp = nullptr;
zeek::Func* comp = nullptr;
if ( @ARG@.size() > 2 )
zeek::emit_builtin_error("sort() called with extraneous argument");
@ -1480,7 +1480,7 @@ function order%(v: any, ...%) : index_vec
}
const auto& elt_type = v->GetType()->Yield();
zeek::detail::Func* comp = nullptr;
zeek::Func* comp = nullptr;
if ( @ARG@.size() > 2 )
zeek::emit_builtin_error("order() called with extraneous argument");