php_zlib.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2016 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. /* $Id$ */
  21. #ifndef PHP_ZLIB_H
  22. #define PHP_ZLIB_H
  23. #include <zlib.h>
  24. #define PHP_ZLIB_ENCODING_RAW -0xf
  25. #define PHP_ZLIB_ENCODING_GZIP 0x1f
  26. #define PHP_ZLIB_ENCODING_DEFLATE 0x0f
  27. #define PHP_ZLIB_ENCODING_ANY 0x2f
  28. #define PHP_ZLIB_OUTPUT_HANDLER_NAME "zlib output compression"
  29. #define PHP_ZLIB_BUFFER_SIZE_GUESS(in_len) (((size_t) ((double) in_len * (double) 1.015)) + 10 + 8 + 4 + 1)
  30. typedef struct _php_zlib_buffer {
  31. char *data;
  32. char *aptr;
  33. size_t used;
  34. size_t free;
  35. size_t size;
  36. } php_zlib_buffer;
  37. typedef struct _php_zlib_context {
  38. z_stream Z;
  39. php_zlib_buffer buffer;
  40. } php_zlib_context;
  41. ZEND_BEGIN_MODULE_GLOBALS(zlib)
  42. /* variables for transparent gzip encoding */
  43. int compression_coding;
  44. long output_compression;
  45. long output_compression_level;
  46. char *output_handler;
  47. php_zlib_context *ob_gzhandler;
  48. long output_compression_default;
  49. zend_bool handler_registered;
  50. ZEND_END_MODULE_GLOBALS(zlib);
  51. php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
  52. extern php_stream_ops php_stream_gzio_ops;
  53. extern php_stream_wrapper php_stream_gzip_wrapper;
  54. extern php_stream_filter_factory php_zlib_filter_factory;
  55. extern zend_module_entry php_zlib_module_entry;
  56. #define zlib_module_ptr &php_zlib_module_entry
  57. #define phpext_zlib_ptr zlib_module_ptr
  58. #ifdef ZTS
  59. # include "TSRM.h"
  60. # define ZLIBG(v) TSRMG(zlib_globals_id, zend_zlib_globals *, v)
  61. #else
  62. # define ZLIBG(v) (zlib_globals.v)
  63. #endif
  64. #endif /* PHP_ZLIB_H */
  65. /*
  66. * Local variables:
  67. * tab-width: 4
  68. * c-basic-offset: 4
  69. * indent-tabs-mode: t
  70. * End:
  71. */