The filter_insert function inserts a filter into a filter stack, creating a new filter layer and installing the filter at that layer. The filter layer's position in the stack is determined by the order value specified when filter_create was called, and any explicit ordering configured by init-filter-order. If a filter layer with the same order value already exists in the stack, the new layer is inserted above that layer.
Parameters may be passed to the filter using the pb and data parameters. The semantics of the data parameter are defined by individual filters. However, all filters must be able to handle a data parameter of NULL.
When possible, plug-in developers should avoid calling filter_insert directly, and instead use the insert-filter SAF (applicable in Input-class directives).
int filter_insert(SYS_NETFD sd, pblock *pb, Session *sn, Request *rq, void *data, const Filter *filter);
Returns REQ_PROCEED if the specified filter was inserted successfully, or REQ_NOACTION if the specified filter was not inserted because it was not required. Any other return value indicates an error.
SYS_NETFD sd is NULL (reserved for future use).
pblock *pb is a set of parameters to pass to the specified filter's init method.
Session *sn is the Session.
Request *rq is the Request.
void *data is filter-defined private data.
const Filter *filter is the filter to insert.