mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 20:18:20 +00:00
Deprecate Plugin::HookCallFunction(), replace with HookFunctionCall()
This also changes the argument type of Func::operator() to zeek::Args* to allow plugins to be able to alter function arguments in place as was previously documented.
This commit is contained in:
parent
46c5dea733
commit
272db640aa
27 changed files with 417 additions and 77 deletions
|
@ -151,6 +151,17 @@ void HookArgument::Describe(ODesc* d) const
|
|||
d->Add("<null>");
|
||||
break;
|
||||
|
||||
case ARG_LIST:
|
||||
if ( arg.args)
|
||||
{
|
||||
d->Add("(");
|
||||
describe_vals(*arg.args, d);
|
||||
d->Add(")");
|
||||
}
|
||||
else
|
||||
d->Add("<null>");
|
||||
break;
|
||||
|
||||
case VOID:
|
||||
d->Add("<void>");
|
||||
break;
|
||||
|
@ -364,6 +375,26 @@ int Plugin::HookLoadFile(const LoadType type, const std::string& file, const std
|
|||
return -1;
|
||||
}
|
||||
|
||||
std::pair<bool, IntrusivePtr<Val>>
|
||||
Plugin::HookFunctionCall(const Func* func, Frame* parent,
|
||||
zeek::Args* args)
|
||||
{
|
||||
val_list vlargs(args->size());
|
||||
|
||||
for ( auto& v : *args )
|
||||
vlargs.push_back(v.release());
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
auto [handled, result] = HookCallFunction(func, parent, &vlargs);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
for ( auto i = 0u; i < args->size(); ++i )
|
||||
(*args)[i] = {AdoptRef{}, vlargs[i]};
|
||||
|
||||
return {handled, {AdoptRef{}, result}};
|
||||
}
|
||||
|
||||
std::pair<bool, Val*> Plugin::HookCallFunction(const Func* func, Frame *parent, val_list* args)
|
||||
{
|
||||
std::pair<bool, Val*> result(false, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue