xref: /php-src/ext/bz2/php_bz2.h (revision 01b3fc03)
1 /*
2   +----------------------------------------------------------------------+
3   | Copyright (c) The PHP Group                                          |
4   +----------------------------------------------------------------------+
5   | This source file is subject to version 3.01 of the PHP license,      |
6   | that is bundled with this package in the file LICENSE, and is        |
7   | available through the world-wide-web at the following url:           |
8   | https://www.php.net/license/3_01.txt                                 |
9   | If you did not receive a copy of the PHP license and are unable to   |
10   | obtain it through the world-wide-web, please send a note to          |
11   | license@php.net so we can mail you a copy immediately.               |
12   +----------------------------------------------------------------------+
13   | Author: Sterling Hughes <sterling@php.net>                           |
14   +----------------------------------------------------------------------+
15 */
16 
17 #ifndef PHP_BZ2_H
18 #define PHP_BZ2_H
19 
20 #ifdef HAVE_BZ2
21 
22 extern zend_module_entry bz2_module_entry;
23 #define phpext_bz2_ptr &bz2_module_entry
24 
25 /* Bzip2 includes */
26 #include <bzlib.h>
27 
28 #else
29 #define phpext_bz2_ptr NULL
30 #endif
31 
32 #ifdef PHP_WIN32
33 #	ifdef PHP_BZ2_EXPORTS
34 #		define PHP_BZ2_API __declspec(dllexport)
35 #	elif defined(COMPILE_DL_BZ2)
36 #		define PHP_BZ2_API __declspec(dllimport)
37 #	else
38 #		define PHP_BZ2_API /* nothing special */
39 #	endif
40 #elif defined(__GNUC__) && __GNUC__ >= 4
41 #	define PHP_BZ2_API __attribute__ ((visibility("default")))
42 #else
43 #	define PHP_BZ2_API
44 #endif
45 
46 #include "php_version.h"
47 #define PHP_BZ2_VERSION PHP_VERSION
48 
49 PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
50 PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz, const char *mode, php_stream *innerstream STREAMS_DC);
51 
52 #define php_stream_bz2open_from_BZFILE(bz, mode, innerstream)	_php_stream_bz2open_from_BZFILE((bz), (mode), (innerstream) STREAMS_CC)
53 #define php_stream_bz2open(wrapper, path, mode, options, opened_path)	_php_stream_bz2open((wrapper), (path), (mode), (options), (opened_path), NULL STREAMS_CC)
54 
55 extern const php_stream_filter_factory php_bz2_filter_factory;
56 extern const php_stream_ops php_stream_bz2io_ops;
57 #define PHP_STREAM_IS_BZIP2	&php_stream_bz2io_ops
58 
59 /* 400kb */
60 #define PHP_BZ2_FILTER_DEFAULT_BLOCKSIZE        4
61 
62 /* BZ2 Internal Default */
63 #define PHP_BZ2_FILTER_DEFAULT_WORKFACTOR       0
64 
65 #endif
66