The option built-in functions allow the scripting layer to change the value of option-values and to be notified when option values change.

Namespaces:GLOBAL, Option
Source File:/scripts/base/bif/option.bif.bro



Option::set: function Sets an option to a new value.
Option::set_change_handler: function Set the change handler for the option ID.

Detailed Interface


Type:function (ID: string, val: any, location: string &default = "" &optional) : bool

Sets an option to a new value. This change will also cause the option change handlers to be called.

ID:The ID of the option to update.
Val:The new value of the option.
Location:optional parameter detailing where this change originated from.
Returns:true on success, false when an error occured.

See also: Option::set_change_handler

Type:function (ID: string, on_change: any, priority: int &default = 0 &optional) : bool

Set the change handler for the option ID. The change handler will be called anytime Option::set is called fot ID.

ID:The ID of the option for which change notifications are desired.
On_change:The function that will be called when a change occurs. The function can choose to receive two or three parameters: the first parameter is a string containing ID, the second parameter is the new option value. The third, optional, parameter is the location string as passed to Option::set. Note that the global value is not yet changed when the function is called. The passed function has to return the new value that it wants the option to be set to. This enables it to reject changes, or change values that are being set. When several change handlers are set for an option they are chained; the second change handler will see the return value of the first change handler as the “new value”.
Priority:The priority of the function that was added; functions with higher priority are called first, functions with the same priority are called in the order in which they were added.
Returns:true when the change handler was set, false when an error occurred.

See also: Option::set

Previous Page


Copyright 2016, The Bro Project. Last updated on February 20, 2018. Created using Sphinx 1.5.2.