mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 07:08:19 +00:00
Plugin API: minor change (adding parent frame) to support calling methods from hook. Also declare network time update argument to be const because good practice.
This commit is contained in:
parent
daae28c72e
commit
2446a942e0
5 changed files with 12 additions and 11 deletions
|
@ -331,7 +331,7 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
|
|||
if ( sample_logger )
|
||||
sample_logger->FunctionSeen(this);
|
||||
|
||||
Val* plugin_result = PLUGIN_HOOK_WITH_RESULT(HOOK_CALL_FUNCTION, HookCallFunction(this, args), 0);
|
||||
Val* plugin_result = PLUGIN_HOOK_WITH_RESULT(HOOK_CALL_FUNCTION, HookCallFunction(this, parent, args), 0);
|
||||
|
||||
if ( plugin_result )
|
||||
return HandlePluginResult(plugin_result, args, Flavor());
|
||||
|
@ -548,7 +548,7 @@ Val* BuiltinFunc::Call(val_list* args, Frame* parent) const
|
|||
if ( sample_logger )
|
||||
sample_logger->FunctionSeen(this);
|
||||
|
||||
Val* plugin_result = PLUGIN_HOOK_WITH_RESULT(HOOK_CALL_FUNCTION, HookCallFunction(this, args), 0);
|
||||
Val* plugin_result = PLUGIN_HOOK_WITH_RESULT(HOOK_CALL_FUNCTION, HookCallFunction(this, parent, args), 0);
|
||||
|
||||
if ( plugin_result )
|
||||
return HandlePluginResult(plugin_result, args, FUNC_FLAVOR_FUNCTION);
|
||||
|
|
|
@ -559,13 +559,14 @@ int Manager::HookLoadFile(const string& file)
|
|||
return rc;
|
||||
}
|
||||
|
||||
Val* Manager::HookCallFunction(const Func* func, val_list* vargs) const
|
||||
Val* Manager::HookCallFunction(const Func* func, Frame* parent, val_list* vargs) const
|
||||
{
|
||||
HookArgumentList args;
|
||||
|
||||
if ( HavePluginForHook(META_HOOK_PRE) )
|
||||
{
|
||||
args.push_back(HookArgument(func));
|
||||
args.push_back(HookArgument(parent));
|
||||
args.push_back(HookArgument(vargs));
|
||||
MetaHookPre(HOOK_CALL_FUNCTION, args);
|
||||
}
|
||||
|
@ -579,7 +580,7 @@ Val* Manager::HookCallFunction(const Func* func, val_list* vargs) const
|
|||
{
|
||||
Plugin* p = (*i).second;
|
||||
|
||||
v = p->HookCallFunction(func, vargs);
|
||||
v = p->HookCallFunction(func, parent, vargs);
|
||||
|
||||
if ( v )
|
||||
break;
|
||||
|
@ -644,7 +645,7 @@ void Manager::HookDrainEvents() const
|
|||
|
||||
}
|
||||
|
||||
void Manager::HookUpdateNetworkTime(double network_time) const
|
||||
void Manager::HookUpdateNetworkTime(const double network_time) const
|
||||
{
|
||||
HookArgumentList args;
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ public:
|
|||
* functions and events, it may be any Val and must be ignored). If no
|
||||
* plugin handled the call, the method returns null.
|
||||
*/
|
||||
Val* HookCallFunction(const Func* func, val_list* args) const;
|
||||
Val* HookCallFunction(const Func* func, Frame *parent, val_list* args) const;
|
||||
|
||||
/**
|
||||
* Hook that filters the queuing of an event.
|
||||
|
@ -261,7 +261,7 @@ public:
|
|||
*
|
||||
* @param network_time The new network time.
|
||||
*/
|
||||
void HookUpdateNetworkTime(double network_time) const;
|
||||
void HookUpdateNetworkTime(const double network_time) const;
|
||||
|
||||
/**
|
||||
* Hook that informs plugins that the event queue is being drained.
|
||||
|
|
|
@ -271,7 +271,7 @@ int Plugin::HookLoadFile(const std::string& file, const std::string& ext)
|
|||
return -1;
|
||||
}
|
||||
|
||||
Val* Plugin::HookCallFunction(const Func* func, val_list* args)
|
||||
Val* Plugin::HookCallFunction(const Func* func, Frame *parent, val_list* args)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ void Plugin::HookDrainEvents()
|
|||
{
|
||||
}
|
||||
|
||||
void Plugin::HookUpdateNetworkTime(double network_time)
|
||||
void Plugin::HookUpdateNetworkTime(const double network_time)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -573,7 +573,7 @@ protected:
|
|||
* ignored; best to use a \c TYPE_ANY). If the plugin did not handle
|
||||
* the call, it must return null.
|
||||
*/
|
||||
virtual Val* HookCallFunction(const Func* func, val_list* args);
|
||||
virtual Val* HookCallFunction(const Func* func, Frame *parent, val_list* args);
|
||||
|
||||
/**
|
||||
* Hook into raising events. Whenever the script interpreter is about
|
||||
|
@ -607,7 +607,7 @@ protected:
|
|||
*
|
||||
* @param networkt_time The new network time.
|
||||
*/
|
||||
virtual void HookUpdateNetworkTime(double network_time);
|
||||
virtual void HookUpdateNetworkTime(const double network_time);
|
||||
|
||||
/**
|
||||
* Hook for destruction of objects registered with
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue