NAME
EvmFilterCreate(), EvmFilterDestroy(), EvmFilterIsFile(), EvmFilterReadFile(), EvmFilterSet(), EvmFilterTest() — event filter evaluator routines
SYNOPSIS
#include <evm/evm.h>
EvmStatus_t EvmFilterCreate(
EvmFilter_t *filter_evaluator );
EvmStatus_t EvmFilterDestroy(:
EvmFilter_t filter_evaluator );
EvmBoolean_t EvmFilterIsFile(
const char *filter_string );
char * EvmFilterReadFile(
const char *filter_string );
EvmStatus_t EvmFilterSet(
EvmFilter_t filter_evaluator,
const EvmString_t filter_string );
EvmStatus_t EvmFilterTest(
EvmFilter_t filter_evaluator,
EvmEvent_t event,
EvmBoolean_t *matchFlag );
Library
EVM Support Library
(libevm.so).
Parameters
- filter_evaluator
For
EvmFilterCreate(),
filter_evaluator
is the return handle of an established filter evaluator.
For
EvmFilterSet()
filter_evaluator ,
identifies the filter evaluator that uses the
filter_string
in subsequent matches.
For
EvmFilterTest(),
filter_evaluator
identifies the filter evaluator that
compares the supplied event with the filter string.
For
EvmFilterDestroy(),
filter_evaluator
identifies the filter evaluator to be destroyed.
- filter_string
The filter string used by the filter evaluator in subsequent matches.
See the
EvmFilter(5)
manpage for the syntax.
- event
The event to be compared with the filter string currently associated
with the filter evaluator.
- matchFlag
The result obtained when the supplied event is compared with the filter
string currently associated with the filter evaluator.
Possible return values are as follows:
- EvmTRUE
The event matches the
filter_string.
- EvmFALSE
The event does not match the
filter_string.
DESCRIPTION
The filter evaluation routines check whether an event matches a
given event filter.
These functions
are useful to clients that pass a complex filter to the EVM daemon.
Then the clients test incoming events against subcomponents of
the filter to determine the appropriate action.
The
EvmFilterCreate()
routine establishes an instance of a filter evaluator,
returning a handle in
filter_evaluator.
The
EvmFilterSet()
routine passes a
filter_string
to the
filter_evaluator
for subsequent matches.
The
EvmFilterTest()
routine compares the supplied event with the
filter_string
currently associated with the
filter_evaluator.
The result is returned in
matchFlag.
Possible return values are as follows:
- EvmTRUE
The event matches the
filter_string.
- EvmFALSE
The event does not match the
filter_string.
The indirect filter syntax,
@filename,
is supported by the
EvmFilterIsFile()
and
EvmFilterReadFile()
routines.
Programs which support indirect filters may use
EvmFilterIsFile()
to determine whether a user-supplied filter string is indirect.
If so, then use
EvmFilterReadFile()
to expand the file to a regular filter string.
EvmFilterIsFile()
returns
EvmTRUE
if the supplied
filter_string
uses indirect filter notation, and
returns
EvmFALSE
otherwise.
EvmFilterReadFile()
interprets the supplied
filter_string,
and attempts to open and read the referenced file.
EvmFilterReadFile()
returns a pointer to heap space memory containing the expanded filter string.
The caller is responsible for freeing the memory when it is no longer needed.
NULL is returned if an error occurs while reading the file.
Note that
EvmFilterReadFile()
does not attempt to validate the filter string contained in the file.
The
EvmFilterDestroy()
routine destroys the
filter_evaluator,
freeing all associated resources.
RETURN VALUE
- EvmERROR_NONE
The operation completed without error.
- EvmERROR_FILTER_NOT_VALID
A filter string that is syntactically invalid passed to the filter evaluator.
- EvmERROR_INVALID_ARGUMENT
One of the arguments to the function is invalid.
- EvmERROR_INVALID_VALUE
A value in a structure member is invalid.
- EvmERROR_NO_MEMORY
An operation failed because an attempt to acquire heap memory failed.
- EvmERROR_NOT_INITIALIZED
An attempt was made to use a filter evaluator without first calling
EvmFilterSet()
which provides an initial filter string.
- NULL
An attempt to read a filter file failed.
ERRORS
The value of
errno
is not set.