2 +--------------------------------------------------------------------+
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2014, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
13 #ifndef PHP_HTTP_ENCODING_H
14 #define PHP_HTTP_ENCODING_H
16 extern PHP_MINIT_FUNCTION(http_encoding
);
18 #define PHP_HTTP_ENCODING_STREAM_PERSISTENT 0x01000000
20 #define PHP_HTTP_ENCODING_STREAM_FLUSH_NONE 0x00000000
21 #define PHP_HTTP_ENCODING_STREAM_FLUSH_SYNC 0x00100000
22 #define PHP_HTTP_ENCODING_STREAM_FLUSH_FULL 0x00200000
24 #define PHP_HTTP_ENCODING_STREAM_FLUSH_FLAG(flags, full, sync, none) \
25 (((flags) & PHP_HTTP_ENCODING_STREAM_FLUSH_FULL) ? (full) : \
26 (((flags) & PHP_HTTP_ENCODING_STREAM_FLUSH_SYNC) ? (sync) : (none)))
28 typedef struct php_http_encoding_stream php_http_encoding_stream_t
;
30 typedef php_http_encoding_stream_t
*(*php_http_encoding_stream_init_func_t
)(php_http_encoding_stream_t
*s
);
31 typedef php_http_encoding_stream_t
*(*php_http_encoding_stream_copy_func_t
)(php_http_encoding_stream_t
*from
, php_http_encoding_stream_t
*to
);
32 typedef ZEND_RESULT_CODE (*php_http_encoding_stream_update_func_t
)(php_http_encoding_stream_t
*s
, const char *in_str
, size_t in_len
, char **out_str
, size_t *out_len
);
33 typedef ZEND_RESULT_CODE (*php_http_encoding_stream_flush_func_t
)(php_http_encoding_stream_t
*s
, char **out_str
, size_t *out_len
);
34 typedef zend_bool (*php_http_encoding_stream_done_func_t
)(php_http_encoding_stream_t
*s
);
35 typedef ZEND_RESULT_CODE (*php_http_encoding_stream_finish_func_t
)(php_http_encoding_stream_t
*s
, char **out_str
, size_t *out_len
);
36 typedef void (*php_http_encoding_stream_dtor_func_t
)(php_http_encoding_stream_t
*s
);
38 typedef struct php_http_encoding_stream_ops
{
39 php_http_encoding_stream_init_func_t init
;
40 php_http_encoding_stream_copy_func_t copy
;
41 php_http_encoding_stream_update_func_t update
;
42 php_http_encoding_stream_flush_func_t flush
;
43 php_http_encoding_stream_done_func_t done
;
44 php_http_encoding_stream_finish_func_t finish
;
45 php_http_encoding_stream_dtor_func_t dtor
;
46 } php_http_encoding_stream_ops_t
;
48 struct php_http_encoding_stream
{
51 php_http_encoding_stream_ops_t
*ops
;
55 PHP_HTTP_API php_http_encoding_stream_t
*php_http_encoding_stream_init(php_http_encoding_stream_t
*s
, php_http_encoding_stream_ops_t
*ops
, unsigned flags
);
56 PHP_HTTP_API php_http_encoding_stream_t
*php_http_encoding_stream_copy(php_http_encoding_stream_t
*from
, php_http_encoding_stream_t
*to
);
57 PHP_HTTP_API ZEND_RESULT_CODE
php_http_encoding_stream_reset(php_http_encoding_stream_t
**s
);
58 PHP_HTTP_API ZEND_RESULT_CODE
php_http_encoding_stream_update(php_http_encoding_stream_t
*s
, const char *in_str
, size_t in_len
, char **out_str
, size_t *out_len
);
59 PHP_HTTP_API ZEND_RESULT_CODE
php_http_encoding_stream_flush(php_http_encoding_stream_t
*s
, char **out_str
, size_t *len
);
60 PHP_HTTP_API zend_bool
php_http_encoding_stream_done(php_http_encoding_stream_t
*s
);
61 PHP_HTTP_API ZEND_RESULT_CODE
php_http_encoding_stream_finish(php_http_encoding_stream_t
*s
, char **out_str
, size_t *len
);
62 PHP_HTTP_API
void php_http_encoding_stream_dtor(php_http_encoding_stream_t
*s
);
63 PHP_HTTP_API
void php_http_encoding_stream_free(php_http_encoding_stream_t
**s
);
65 PHP_HTTP_API php_http_encoding_stream_ops_t
*php_http_encoding_stream_get_dechunk_ops(void);
66 PHP_HTTP_API
const char *php_http_encoding_dechunk(const char *encoded
, size_t encoded_len
, char **decoded
, size_t *decoded_len
);
67 PHP_HTTP_API zend_class_entry
*php_http_get_dechunk_stream_class_entry(void);
69 typedef struct php_http_encoding_stream_object
{
70 php_http_encoding_stream_t
*stream
;
72 } php_http_encoding_stream_object_t
;
74 PHP_HTTP_API zend_class_entry
*php_http_get_encoding_stream_class_entry(void);
76 zend_object
*php_http_encoding_stream_object_new(zend_class_entry
*ce
);
77 php_http_encoding_stream_object_t
*php_http_encoding_stream_object_new_ex(zend_class_entry
*ce
, php_http_encoding_stream_t
*s
);
78 zend_object
*php_http_encoding_stream_object_clone(zval
*object
);
79 void php_http_encoding_stream_object_free(zend_object
*object
);
88 * vim600: noet sw=4 ts=4 fdm=marker
89 * vim<600: noet sw=4 ts=4