Apache HTTPD
util_filter.h
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
22#ifndef AP_FILTER_H
23#define AP_FILTER_H
24
25#include "apr.h"
26#include "apr_buckets.h"
27
28#include "httpd.h"
29
30#if APR_HAVE_STDARG_H
31#include <stdarg.h>
32#endif
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
64
93/* forward declare the filter type */
94typedef struct ap_filter_t ap_filter_t;
95
140 apr_off_t readbytes);
142
147
185
201
251
282
297 apr_bucket_brigade *bucket,
300 apr_off_t readbytes);
301
315 apr_bucket_brigade *bucket);
316
333 apr_bucket_brigade *bucket,
334 const char *fmt,
335 ...)
336 __attribute__((format(printf,3,4)));
337
353 ap_in_filter_func filter_func,
355 ap_filter_type ftype);
356
359 ap_out_filter_func filter_func,
361 ap_filter_type ftype);
362
363/* For httpd-?.? I suggest replacing the above with
364#define ap_register_output_filter(name,ffunc,init,ftype) \
365 ap_register_output_filter_protocol(name,ffunc,init,ftype,0)
366*/
367
385 const char *name,
386 ap_out_filter_func filter_func,
388 ap_filter_type ftype,
389 unsigned int proto_flags);
390
411
422 void *ctx,
423 request_rec *r,
424 conn_rec *c);
425
432
447
462 void *ctx,
463 request_rec *r,
464 conn_rec *c);
465
472
480
488
497 const char *handle);
506 const char *handle);
507
508/* The next two filters are for abstraction purposes only. They could be
509 * done away with, but that would require that we break modules if we ever
510 * want to change our filter registration method. The basic idea, is that
511 * all filters have a place to store data, the ctx pointer. These functions
512 * fill out that pointer with a bucket brigade, and retrieve that data on
513 * the next call. The nice thing about these functions, is that they
514 * automatically concatenate the bucket brigades together for you. This means
515 * that if you have already stored a brigade in the filters ctx pointer, then
516 * when you add more it will be tacked onto the end of that brigade. When
517 * you retrieve data, if you pass in a bucket brigade to the get function,
518 * it will append the current brigade onto the one that you are retrieving.
519 */
520
532 apr_bucket_brigade **save_to,
534
544 void *ctx);
545
552
560#define ap_fwrite(f, bb, data, nbyte) \
561 apr_brigade_write(bb, ap_filter_flush, f, data, nbyte)
562
569#define ap_fputs(f, bb, str) \
570 apr_brigade_write(bb, ap_filter_flush, f, str, strlen(str))
571
578#define ap_fputc(f, bb, c) \
579 apr_brigade_putc(bb, ap_filter_flush, f, c)
580
589 ...)
591
601 const char *fmt,
602 ...)
603 __attribute__((format(printf,3,4)));
604
611AP_DECLARE(void) ap_filter_protocol(ap_filter_t* f, unsigned int proto_flags);
612
614#define AP_FILTER_PROTO_CHANGE 0x1
615
617#define AP_FILTER_PROTO_CHANGE_LENGTH 0x2
618
620#define AP_FILTER_PROTO_NO_BYTERANGE 0x4
621
623#define AP_FILTER_PROTO_NO_PROXY 0x8
624
626#define AP_FILTER_PROTO_NO_CACHE 0x10
627
629#define AP_FILTER_PROTO_TRANSFORM 0x20
630
635#ifdef __cplusplus
636}
637#endif
638
639#endif /* !AP_FILTER_H */
#define AP_DECLARE_NONSTD(type)
Definition ap_config.h:77
#define AP_FN_ATTR_SENTINEL
Definition ap_config.h:185
#define AP_DECLARE(type)
Definition ap_config.h:67
APR-UTIL Buckets/Bucket Brigades.
request_rec * r
ap_filter_rec_t * ap_get_input_filter_handle(const char *name)
apr_status_t ap_fflush(ap_filter_t *f, apr_bucket_brigade *bb)
ap_filter_rec_t * ap_get_output_filter_handle(const char *name)
void ap_remove_input_filter(ap_filter_t *f)
ap_filter_rec_t * ap_register_output_filter_protocol(const char *name, ap_out_filter_func filter_func, ap_init_filter_func filter_init, ap_filter_type ftype, unsigned int proto_flags)
apr_status_t(* ap_out_filter_func)(ap_filter_t *f, apr_bucket_brigade *b)
ap_filter_type
apr_status_t ap_pass_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket)
int(* ap_init_filter_func)(ap_filter_t *f)
ap_filter_t * ap_add_input_filter(const char *name, void *ctx, request_rec *r, conn_rec *c)
apr_status_t ap_remove_input_filter_byhandle(ap_filter_t *next, const char *handle)
apr_status_t(* ap_in_filter_func)(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes)
apr_status_t ap_remove_output_filter_byhandle(ap_filter_t *next, const char *handle)
ap_filter_t * ap_add_input_filter_handle(ap_filter_rec_t *f, void *ctx, request_rec *r, conn_rec *c)
apr_status_t ap_save_brigade(ap_filter_t *f, apr_bucket_brigade **save_to, apr_bucket_brigade **b, apr_pool_t *p)
ap_filter_rec_t * ap_register_output_filter(const char *name, ap_out_filter_func filter_func, ap_init_filter_func filter_init, ap_filter_type ftype)
apr_status_t ap_filter_flush(apr_bucket_brigade *bb, void *ctx)
ap_filter_t * ap_add_output_filter(const char *name, void *ctx, request_rec *r, conn_rec *c)
apr_status_t ap_fputstrs(ap_filter_t *f, apr_bucket_brigade *bb,...)
apr_status_t ap_filter_rec_t * ap_register_input_filter(const char *name, ap_in_filter_func filter_func, ap_init_filter_func filter_init, ap_filter_type ftype)
apr_status_t ap_pass_brigade_fchk(request_rec *r, apr_bucket_brigade *bucket, const char *fmt,...) __attribute__((format(printf
ap_filter_t * ap_add_output_filter_handle(ap_filter_rec_t *f, void *ctx, request_rec *r, conn_rec *c)
apr_status_t ap_fprintf(ap_filter_t *f, apr_bucket_brigade *bb, const char *fmt,...) __attribute__((format(printf
apr_status_t ap_get_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes)
apr_status_t void ap_filter_protocol(ap_filter_t *f, unsigned int proto_flags)
void ap_remove_output_filter(ap_filter_t *f)
@ AP_FTYPE_TRANSCODE
@ AP_FTYPE_CONTENT_SET
@ AP_FTYPE_NETWORK
@ AP_FTYPE_CONNECTION
@ AP_FTYPE_PROTOCOL
@ AP_FTYPE_RESOURCE
apr_file_t * f
apr_read_type_e
Definition apr_buckets.h:57
apr_brigade_flush void * ctx
apr_dbd_transaction_t int mode
Definition apr_dbd.h:261
apr_pool_t const char apr_dbd_t ** handle
Definition apr_dbd.h:142
int apr_status_t
Definition apr_errno.h:44
const char * format
apr_vformatter_buff_t const char * fmt
Definition apr_lib.h:175
apr_vformatter_buff_t * c
Definition apr_lib.h:175
apr_pool_t * b
Definition apr_pools.h:529
const char apr_status_t(*) apr_pool_t *poo __attribute__)((nonnull(2, 4)))
Definition apr_pools.h:567
HTTP Daemon routines.
apr_pool_t * p
Definition md_event.c:32
static int filter_init(ap_filter_t *f)
Definition mod_filter.c:100
char * name
is a filter provider, as defined and implemented by mod_filter.
Definition mod_filter.c:38
This structure is used for recording information about the registered filters. It associates a name w...
ap_filter_type ftype
ap_filter_provider_t * providers
ap_init_filter_func filter_init_func
ap_filter_func filter_func
unsigned int proto_flags
struct ap_filter_rec_t * next
const char * name
The representation of a filter chain.
request_rec * r
ap_filter_rec_t * frec
ap_filter_t * next
conn_rec * c
Structure to store things which are per connection.
Definition httpd.h:1152
A structure that represents the current request.
Definition httpd.h:845
ap_out_filter_func out_func
ap_in_filter_func in_func
ap_input_mode_t
input filtering modes
Definition util_filter.h:41
@ AP_MODE_SPECULATIVE
Definition util_filter.h:53
@ AP_MODE_READBYTES
Definition util_filter.h:43
@ AP_MODE_INIT
Definition util_filter.h:62
@ AP_MODE_EXHAUSTIVE
Definition util_filter.h:58
@ AP_MODE_GETLINE
Definition util_filter.h:48
@ AP_MODE_EATCRLF
Definition util_filter.h:50
typedef int(WSAAPI *apr_winapi_fpt_WSAPoll)(IN OUT LPWSAPOLLFD fdArray