The insert filter method is called when a filter is inserted into a filter stack by the filter_insert function or insert-filter SAF.
int insert(FilterLayer *layer, pblock *pb);
REQ_PROCEED if the filter should be inserted into the filter stack, REQ_NOACTION if the filter should not be inserted because it is not required, or REQ_ABORTED if the filter should not be inserted because of an error.
FilterLayer *layer is the filter layer at which the filter is being inserted.
pblock *pb is the set of parameters passed to filter_insert or specified by the fn="insert-filter" directive.
int myfilter_insert(FilterLayer *layer, pblock *pb)
{
if (pblock_findval("dont-insert-filter", pb))
return REQ_NOACTION;
return REQ_PROCEED;
}
...
FilterMethods myfilter_methods = FILTER_METHODS_INITIALIZER;
const Filter *myfilter;
myfilter_methods.insert = &myfilter_insert;
myfilter = filter_create("myfilter", &myfilter_methods);
...