php_zlib.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
  14. | Stefan R�hrich <sr@linux.de> |
  15. | Michael Wallner <mike@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef PHP_ZLIB_H
  19. #define PHP_ZLIB_H
  20. #include "php_version.h"
  21. #define PHP_ZLIB_VERSION PHP_VERSION
  22. #include <zlib.h>
  23. #define PHP_ZLIB_ENCODING_RAW -0xf
  24. #define PHP_ZLIB_ENCODING_GZIP 0x1f
  25. #define PHP_ZLIB_ENCODING_DEFLATE 0x0f
  26. #define PHP_ZLIB_ENCODING_ANY 0x2f
  27. #define PHP_ZLIB_OUTPUT_HANDLER_NAME "zlib output compression"
  28. #define PHP_ZLIB_BUFFER_SIZE_GUESS(in_len) (((size_t) ((double) in_len * (double) 1.015)) + 10 + 8 + 4 + 1)
  29. typedef struct _php_zlib_buffer {
  30. char *data;
  31. char *aptr;
  32. size_t used;
  33. size_t free;
  34. size_t size;
  35. } php_zlib_buffer;
  36. typedef struct _php_zlib_context {
  37. z_stream Z;
  38. char *inflateDict;
  39. int status;
  40. size_t inflateDictlen;
  41. php_zlib_buffer buffer;
  42. zend_object std;
  43. } php_zlib_context;
  44. ZEND_BEGIN_MODULE_GLOBALS(zlib)
  45. /* variables for transparent gzip encoding */
  46. zend_long output_compression;
  47. zend_long output_compression_level;
  48. char *output_handler;
  49. php_zlib_context *ob_gzhandler;
  50. zend_long output_compression_default;
  51. bool handler_registered;
  52. int compression_coding;
  53. ZEND_END_MODULE_GLOBALS(zlib);
  54. #define ZLIBG(v) ZEND_MODULE_GLOBALS_ACCESSOR(zlib, v)
  55. 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);
  56. extern const php_stream_ops php_stream_gzio_ops;
  57. extern const php_stream_wrapper php_stream_gzip_wrapper;
  58. extern const php_stream_filter_factory php_zlib_filter_factory;
  59. extern zend_module_entry php_zlib_module_entry;
  60. #define zlib_module_ptr &php_zlib_module_entry
  61. #define phpext_zlib_ptr zlib_module_ptr
  62. #endif /* PHP_ZLIB_H */