Filtering I/O in Apache 2.0 Page 3
Once the filter has been registered, it must be added to the current request's filter stack before it will actually be called. This is done by calling ap_add_filter.
ap_add_filter(const char *name, void *ctx,
The first argument is the name of the filter to add. This should be the name that was registered for the desired filter. The second is a pointer to a structure that should be passed to the filter whenever it is called. This provides with a location to store any data that they may need to save between calls. The final argument is the request_rec to pass to the filter when it is called.
There are two more functions prototypes that must be discussed. The first is the prototype for filters themselves.
ap_filter_func(ap_filter_t *f, ap_bucket_brigade
The first argument is a pointer to the current filter structure. This is where the ctx passed to ap_add_filter is stored, as well as a pointer to the next filter on the stack. The second is the current bucket brigade to filter.
The second function is ap_pass_brigade. This function passes bucket brigades from the current filter to the next filter. The prototype is:
The first argument is a pointer to the next filter to call, and the second is the bucket brigade to pass to that filter.
That covers all of the basic concepts for writing filters. In next month's article we will actually write a filter that can be inserted into an Apache 2.0 server.
IT Solutions Builder TOP IT RESOURCES TO MOVE YOUR BUSINESS FORWARD
Which topic are you interested in?
What is your company size?
What is your job title?
What is your job function?
Searching our resource database to find your matches...