HP-UX Event ManagerProgrammer's Guide
events on a single connection. The combined string can then be discarded, but the original set
of strings must be retained. It can be used to resubscribe later if the connection has to be
re-established, or if the filter has to change. However, when an event arrives, you need to know
which of the original filter strings it matches, so that you can decide about how to handle the
events. You can use an EVM filter evaluator to do this.
A filter evaluator is an object that can be created, loaded with a filter string, and then pass series
of events to determine which (if any) of the events match the filter. If you maintain a separate
evaluator for each of the original filter strings, you can apply each incoming event to each of the
evaluators to decide which evaluators match the event.
Example 4-8 demonstrates this technique by using three simple filter strings and by printing a
different message according to which of the filters, if any, each incoming event matches.
The example introduces the following functions:
• EvmFilterCreate — Establishes an instance of a filter evaluator and returns a handle.
For more information about this function, see EvmFilterCreate(3) and EvmFilter(5).
• EvmFilterSet — Passes a filter string to the filter evaluator to be used in subsequent
matches. For more information about this function, see EvmFilterSet(3) and EvmFilter(5).
• EvmFilterTest — Compares a specified event with the filter string that are currently
associated with the filter evaluator. If the event matches the filter string, EvmFilterTest
returns EvmTRUE; otherwise, it returns EvmFALSE. For more information about this function,
see EvmFilterTest(3) and EvmFilter(5).
• EvmFilterDestroy — Destroys a filter evaluator, freeing up all associated resources. For
more information about this function, see EvmFilterDestroy(3) and EvmFilter(5).
Using Filter Evaluators 49