Following is a list of C prototypes for the filter methods:
int insert(FilterLayer *layer, pblock *pb); void remove(FilterLayer *layer); int flush(FilterLayer *layer); int read(FilterLayer *layer, void *buf, int amount, int timeout); int write(FilterLayer *layer, const void *buf, int amount); int writev(FilterLayer *layer, const struct iovec *iov, int iov_size); int sendfile(FilterLayer *layer, sendfiledata *sfd);
The layer parameter is a pointer to a FilterLayer data structure, which contains variables related to a particular instance of a filter. Following is a list of the most important fields in the FilterLayer data structure:
context->sn: Contains information relating to a single TCP/IP session (the same sn pointer that’s passed to SAFs).
context->rq: Contains information relating to the current request (the same rq pointer that’s passed to SAFs).
lower: A platform-independent socket descriptor used to communicate with the next filter in the stack.
The meaning of the context->data field is defined by the filter developer. Filters that must maintain state information across filter method calls can use context->data to store that information.
For more information about FilterLayer, see FilterLayer