php_zlib.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
  16. | Stefan R�hrich <sr@linux.de> |
  17. | Michael Wallner <mike@php.net> |
  18. +----------------------------------------------------------------------+
  19. */
  20. #ifndef PHP_ZLIB_H
  21. #define PHP_ZLIB_H
  22. #include "php_version.h"
  23. #define PHP_ZLIB_VERSION PHP_VERSION
  24. #include <zlib.h>
  25. #define PHP_ZLIB_ENCODING_RAW -0xf
  26. #define PHP_ZLIB_ENCODING_GZIP 0x1f
  27. #define PHP_ZLIB_ENCODING_DEFLATE 0x0f
  28. #define PHP_ZLIB_ENCODING_ANY 0x2f
  29. #define PHP_ZLIB_OUTPUT_HANDLER_NAME "zlib output compression"
  30. #define PHP_ZLIB_BUFFER_SIZE_GUESS(in_len) (((size_t) ((double) in_len * (double) 1.015)) + 10 + 8 + 4 + 1)
  31. typedef struct _php_zlib_buffer {
  32. char *data;
  33. char *aptr;
  34. size_t used;
  35. size_t free;
  36. size_t size;
  37. } php_zlib_buffer;
  38. typedef struct _php_zlib_context {
  39. z_stream Z;
  40. char *inflateDict;
  41. int status;
  42. size_t inflateDictlen;
  43. php_zlib_buffer buffer;
  44. } php_zlib_context;
  45. ZEND_BEGIN_MODULE_GLOBALS(zlib)
  46. /* variables for transparent gzip encoding */
  47. zend_long output_compression;
  48. zend_long output_compression_level;
  49. char *output_handler;
  50. php_zlib_context *ob_gzhandler;
  51. zend_long output_compression_default;
  52. zend_bool handler_registered;
  53. int compression_coding;
  54. ZEND_END_MODULE_GLOBALS(zlib);
  55. #define ZLIBG(v) ZEND_MODULE_GLOBALS_ACCESSOR(zlib, v)
  56. php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
  57. extern const php_stream_ops php_stream_gzio_ops;
  58. extern const php_stream_wrapper php_stream_gzip_wrapper;
  59. extern const php_stream_filter_factory php_zlib_filter_factory;
  60. extern zend_module_entry php_zlib_module_entry;
  61. #define zlib_module_ptr &php_zlib_module_entry
  62. #define phpext_zlib_ptr zlib_module_ptr
  63. #endif /* PHP_ZLIB_H */
  64. /*
  65. * Local variables:
  66. * tab-width: 4
  67. * c-basic-offset: 4
  68. * indent-tabs-mode: t
  69. * End:
  70. */