Filter
store and create filters
Filters provide access to a channel's attributes and validation against the associated channel's configuration.
Type
typedef struct PC_evn_SFilter
Functions
PC_evn_create_filter
PC_Status PC_EXPORT PC_evn_create_filter( PC_evn_SFilter* pSAttrFilter, PC_evn_Proxy proxy, PC_CHAR* szAttrFilter, PC_BOOL bIsControl)
Creates a filter tree from a string attribute filter expression and associates the tree nodes with a proxy.
- pSAttrFilter
- a pointer to a variable to hold the newly-allocated filter tree
- proxy
- the proxy with which the constructed filter tree will be associated, providing access to a channel and validation against the associated channel's configuration
- szAttrFilter
- the attribute filter expression to be parsed
- bIsControl
- an indication of whether or not this filter will be used to filter control notifications
- returns
- PC_INVALID_FILTER, if there are syntactic or semantic errors in szAttrFilter (in which case pSAttrFilter is set to PC_NULL); otherwise PC_SUCCESS
PC_evn_create_compound_filter
PC_Status PC_EXPORT PC_evn_create_compound_filter( PC_evn_SFilter* pSCompoundFilter, PC_evn_Filter_Kind idKind, PC_evn_Channel_Info channel)
Creates a compound filter and associates it with a channel.
- pSCompoundFilter
- a pointer to a variable to hold the newly-allocated compound filter
- idKind
- the kind of this compound filter, either PC_AND_FILTER or PC_OR_FILTER
- channel
- the channel with which this compound filter will be associated, providing access to a channel and validation against the associated channel's configuration
- returns
- PC_INVALID_FILTER, if idKind is not PC_AND_FILTER or PC_OR_FILTER (in which case pSCompoundFilter is set to PC_NULL); otherwise PC_SUCCESS
PC_evn_clone_filter
PC_Status PC_EXPORT PC_evn_clone_filter( PC_evn_SFilter* pSAttrFilterNew, PC_evn_SFilter SAttrFilterOld)
Creates a clone of a filter.
- pSAttrFilterNew
- a pointer to a variable to hold the newly-allocated clone
- SAttrFilterOld
- the filter to be cloned
- returns
- PC_SUCCESS
PC_evn_destroy_filter
PC_Status PC_EXPORT PC_evn_destroy_filter( PC_evn_SFilter SAttrFilter)
Releases the resources associated with a filter.
- SAttrFilter
- the filter to be destroyed; the argument passed for SAttrFilter is no longer valid upon return from the function
- returns
- PC_SUCCESS
PC_evn_get_filter_string
PC_Status PC_EXPORT PC_evn_get_filter_string( PC_evn_SFilter SAttrFilter, PC_CHAR** pszAttrFilter)
Returns the string representation of a simple filter.
- SAttrFilter
- the filter whose string representation is to be returned
- pszAttrFilter
- a pointer to a variable to hold the newly-allocated string expression for this object; should be destroyed with PC_evn_destroy_filter_string
- returns
- PC_SUCCESS
PC_evn_destroy_filter_string
PC_Status PC_EXPORT PC_evn_destroy_filter_string( PC_CHAR* pszAttrFilter)
Destroys the buffer allocated in a previous call to PC_evn_get_filter_string.
- szAttrFilter
- the string buffer to be destroyed
- returns
- PC_SUCCESS
PC_evn_get_subfilters
PC_Status PC_EXPORT PC_evn_get_subfilters( PC_evn_SFilter SAttrFilter, PC_evn_SFilter** prgFilters, PC_UINT* punSize)
Returns the constituent subfilters of a compound filter.
- SAttrFilter
- the filter whose constituents are to be returned
- prgFilters
- a pointer to a variable to hold the newly-allocated array of constituent filters; should be destroyed with PC_evn_destroy_subfilters
- punSize
- a pointer to a variable to hold the number of elements in prgFilters
- returns
- PC_INVALID_FILTER, if SAttrFilter is not a compound filter (in which case prgFilters is set to PC_NULL and punSize is set to 0); otherwise PC_SUCCESS
PC_evn_destroy_subfilters
PC_Status PC_EXPORT PC_evn_destroy_subfilters( PC_evn_SFilter* rgFilters)
Destroys the buffer allocated in a previous call to PC_evn_get_subfilters.
- rgFilters
- the buffer to be destroyed
- returns
- PC_SUCCESS
PC_evn_match_filter
PC_BOOL PC_EXPORT PC_evn_match_filter( PC_evn_SFilter SAttrFilter, PC_evn_Notification notification)
Verifies whether a notification matches a filter.
- SAttrFilter
- the filter to be used for the match
- notification
- the notification to be matched
- returns
- PC_TRUE, if the notification matches the filter; otherwise, PC_FALSE
PC_evn_add_filter
PC_Status PC_EXPORT PC_evn_add_filter( PC_evn_SFilter SAttrFilter, PC_evn_SFilter SFilterToAdd)
Adds a subfilter to a compound filter.
- SAttrFilter
- the compound filter to which the new subfilter is to be added
- SFilterToAdd
- the subfilter to add
- returns
- PC_INVALID_FILTER, if SAttrFilter names an existing filter.
PC_evn_remove_filter
PC_Status PC_EXPORT PC_evn_remove_filter( PC_evn_SFilter SAttrFilter, PC_evn_SFilter SFilterToRemove)
Removes a subfilter from a compound filter.
- SAttrFilter
- the compound filter from which the subfilter is to be removed
- SFilterToAdd
- the subfilter to remove.
PC_evn_reset_filter
PC_Status PC_EXPORT PC_evn_reset_filter( PC_evn_SFilter SAttrFilter)
Removes all existing subfilters from a compound filter.
- SAttrFilter
- the compound filter to be reset
|