1 typedef __SIZE_TYPE__
size_t;
5 typedef struct _zval_struct zval
;
6 typedef struct _zend_guard
{
14 typedef struct _php_stream php_stream
;
15 typedef struct _php_stream_filter php_stream_filter
;
16 typedef struct _php_stream_bucket_brigade php_stream_bucket_brigade
;
18 PSFS_ERR_FATAL
, PSFS_FEED_ME
, PSFS_PASS_ON
, }
19 php_stream_filter_status_t
;
20 typedef struct _php_stream_filter_ops
{
21 php_stream_filter_status_t (*filter
)( php_stream
*stream
, php_stream_filter
*thisfilter
, php_stream_bucket_brigade
*buckets_in
, php_stream_bucket_brigade
*buckets_out
, size_t *bytes_consumed
, int flags
);
22 void (*dtor
)(php_stream_filter
*thisfilter
);
25 php_stream_filter_ops
;
26 struct _php_stream_filter
{
28 typedef struct _php_stream_filter_factory
{
29 php_stream_filter
*(*create_filter
)(const char *filtername
, zval
*filterparams
, int persistent
);
31 php_stream_filter_factory
;
32 typedef enum _php_conv_err_t
{
33 PHP_CONV_ERR_SUCCESS
= 0, PHP_CONV_ERR_UNKNOWN
, PHP_CONV_ERR_TOO_BIG
, PHP_CONV_ERR_INVALID_SEQ
, PHP_CONV_ERR_UNEXPECTED_EOS
, PHP_CONV_ERR_EXISTS
, PHP_CONV_ERR_MORE
, PHP_CONV_ERR_ALLOC
, PHP_CONV_ERR_NOT_FOUND
}
35 typedef struct _php_conv php_conv
;
36 typedef php_conv_err_t (*php_conv_convert_func
)(php_conv
*, const char **, size_t *, char **, size_t *);
38 php_conv_convert_func convert_op
;
40 php_conv_base64_decode
;
41 typedef struct _php_conv_qprint_decode
{
45 php_conv_qprint_decode
;
46 static php_conv_err_t
php_conv_qprint_decode_convert(php_conv_qprint_decode
*inst
, const char **in_pp
, size_t *in_left_p
, char **out_pp
, size_t *out_left_p
) {
48 unsigned char *ps
, *pd
;
49 unsigned int scan_stat
;
50 unsigned int lb_ptr
, lb_cnt
;
69 if (*ps
== ' ' || *ps
== '\t') {
71 else if (!inst
->lbchars
&& lb_cnt
== 0 && *ps
== '\r') {
76 else if (!inst
->lbchars
&& lb_cnt
== 0 && *ps
== '\n') {
93 out
: *in_pp
= (const char *)ps
;
95 static php_conv_err_t
php_conv_qprint_decode_ctor(php_conv_qprint_decode
*inst
, const char *lbchars
, size_t lbchars_len
, int lbchars_dup
, int persistent
) {
96 inst
->_super
.convert_op
= (php_conv_convert_func
) php_conv_qprint_decode_convert
;
98 typedef struct _php_convert_filter
{
102 static php_conv
*php_conv_open(int conv_mode
, const HashTable
*options
, int persistent
) {
103 php_conv
*retval
= ((void *)0);
106 char *lbchars
= ((void *)0);
108 if (lbchars
!= ((void *)0)) {
109 if (php_conv_qprint_decode_ctor((php_conv_qprint_decode
*)retval
, lbchars
, lbchars_len
, 1, persistent
)) {
115 static int php_convert_filter_ctor(php_convert_filter
*inst
, int conv_mode
, HashTable
*conv_opts
, const char *filtername
, int persistent
) {
116 if ((inst
->cd
= php_conv_open(conv_mode
, conv_opts
, persistent
)) == ((void *)0)) {
119 static php_stream_filter_status_t
strfilter_convert_filter( php_stream
*stream
, php_stream_filter
*thisfilter
, php_stream_bucket_brigade
*buckets_in
, php_stream_bucket_brigade
*buckets_out
, size_t *bytes_consumed
, int flags
) {
121 static void strfilter_convert_dtor(php_stream_filter
*thisfilter
) {
123 static php_stream_filter_ops strfilter_convert_ops
= {
124 strfilter_convert_filter
, strfilter_convert_dtor
, "convert.*" };
125 static php_stream_filter
*strfilter_convert_create(const char *filtername
, zval
*filterparams
, int persistent
) {
126 php_convert_filter
*inst
;
128 if (php_convert_filter_ctor(inst
, conv_mode
, (filterparams
!= ((void *)0) ? (*filterparams
).value
.ht
: ((void *)0)), filtername
, persistent
) != 0) {
131 static php_stream_filter_factory strfilter_convert_factory
= {
132 strfilter_convert_create
};
133 static const struct {
134 php_stream_filter_ops
*ops
;
135 php_stream_filter_factory
*factory
;
137 standard_filters
[] = {
139 &strfilter_convert_ops
, &strfilter_convert_factory
}
141 int zm_startup_standard_filters(int type
, int module_number
) {
144 standard_filters
[i
].ops
;