fix for changed shutdown order in PHP-7.4
[m6w6/ext-http] / src / php_http_encoding.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: http |
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 +--------------------------------------------------------------------+
11 */
12
13 #ifndef PHP_HTTP_ENCODING_H
14 #define PHP_HTTP_ENCODING_H
15
16 extern PHP_MINIT_FUNCTION(http_encoding);
17
18 #define PHP_HTTP_ENCODING_STREAM_PERSISTENT 0x01000000
19 #define PHP_HTTP_ENCODING_STREAM_DIRTY 0x02000000
20
21 #define PHP_HTTP_ENCODING_STREAM_FLUSH_NONE 0x00000000
22 #define PHP_HTTP_ENCODING_STREAM_FLUSH_SYNC 0x00100000
23 #define PHP_HTTP_ENCODING_STREAM_FLUSH_FULL 0x00200000
24
25 #define PHP_HTTP_ENCODING_STREAM_FLUSH_FLAG(flags, full, sync, none) \
26 (((flags) & PHP_HTTP_ENCODING_STREAM_FLUSH_FULL) ? (full) : \
27 (((flags) & PHP_HTTP_ENCODING_STREAM_FLUSH_SYNC) ? (sync) : (none)))
28
29 typedef struct php_http_encoding_stream php_http_encoding_stream_t;
30
31 typedef php_http_encoding_stream_t *(*php_http_encoding_stream_init_func_t)(php_http_encoding_stream_t *s);
32 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);
33 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);
34 typedef ZEND_RESULT_CODE (*php_http_encoding_stream_flush_func_t)(php_http_encoding_stream_t *s, char **out_str, size_t *out_len);
35 typedef zend_bool (*php_http_encoding_stream_done_func_t)(php_http_encoding_stream_t *s);
36 typedef ZEND_RESULT_CODE (*php_http_encoding_stream_finish_func_t)(php_http_encoding_stream_t *s, char **out_str, size_t *out_len);
37 typedef void (*php_http_encoding_stream_dtor_func_t)(php_http_encoding_stream_t *s);
38
39 typedef struct php_http_encoding_stream_ops {
40 php_http_encoding_stream_init_func_t init;
41 php_http_encoding_stream_copy_func_t copy;
42 php_http_encoding_stream_update_func_t update;
43 php_http_encoding_stream_flush_func_t flush;
44 php_http_encoding_stream_done_func_t done;
45 php_http_encoding_stream_finish_func_t finish;
46 php_http_encoding_stream_dtor_func_t dtor;
47 } php_http_encoding_stream_ops_t;
48
49 struct php_http_encoding_stream {
50 unsigned flags;
51 void *ctx;
52 php_http_encoding_stream_ops_t *ops;
53 };
54
55
56 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);
57 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);
58 PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_stream_reset(php_http_encoding_stream_t **s);
59 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);
60 PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_stream_flush(php_http_encoding_stream_t *s, char **out_str, size_t *len);
61 PHP_HTTP_API zend_bool php_http_encoding_stream_done(php_http_encoding_stream_t *s);
62 PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_stream_finish(php_http_encoding_stream_t *s, char **out_str, size_t *len);
63 PHP_HTTP_API void php_http_encoding_stream_dtor(php_http_encoding_stream_t *s);
64 PHP_HTTP_API void php_http_encoding_stream_free(php_http_encoding_stream_t **s);
65
66 PHP_HTTP_API php_http_encoding_stream_ops_t *php_http_encoding_stream_get_dechunk_ops(void);
67 PHP_HTTP_API const char *php_http_encoding_dechunk(const char *encoded, size_t encoded_len, char **decoded, size_t *decoded_len);
68 PHP_HTTP_API zend_class_entry *php_http_get_dechunk_stream_class_entry(void);
69
70 typedef struct php_http_encoding_stream_object {
71 php_http_encoding_stream_t *stream;
72 zend_object zo;
73 } php_http_encoding_stream_object_t;
74
75 PHP_HTTP_API zend_class_entry *php_http_get_encoding_stream_class_entry(void);
76
77 zend_object *php_http_encoding_stream_object_new(zend_class_entry *ce);
78 php_http_encoding_stream_object_t *php_http_encoding_stream_object_new_ex(zend_class_entry *ce, php_http_encoding_stream_t *s);
79 zend_object *php_http_encoding_stream_object_clone(zval *object);
80 void php_http_encoding_stream_object_free(zend_object *object);
81
82 #endif
83
84 /*
85 * Local variables:
86 * tab-width: 4
87 * c-basic-offset: 4
88 * End:
89 * vim600: noet sw=4 ts=4 fdm=marker
90 * vim<600: noet sw=4 ts=4
91 */