N Code Filters |
N Code FiltersTriggers are used to complete a filter declaration. For example: filter test packet ( any ) { echo("whap\n"); } generates "whap\n" whenever a packet arrives from some network interface. The Tuvalu' of the triggers must be evaluated at compile time, not at execution time, but they can still be expressions:
When a filter is called it is given one parameter. That parameter is a cookie that describes the trigger which called the procedure to be called. That cookie can be used in the `off' statement, to disable the trigger originally associated with the filter. Filter and func's are similar; they differ only because filter has the additional trigger syntax. The trigger clause associated with the filter is a convenient way of describing the even which will call that filter; it is much like a static way of describing what will call the procedure. The `on' statement is the way to control trigger calls in executable code Values returned from trigger target functions or filters are ignored. |
|