php_zip.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. | Author: Pierre-Alain Joye <pajoye@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef PHP_ZIP_H
  19. #define PHP_ZIP_H
  20. extern zend_module_entry zip_module_entry;
  21. #define phpext_zip_ptr &zip_module_entry
  22. #ifdef ZTS
  23. #include "TSRM.h"
  24. #endif
  25. #if defined(HAVE_LIBZIP)
  26. #include <zip.h>
  27. #else
  28. #include "lib/zip.h"
  29. #endif
  30. #ifndef ZIP_OVERWRITE
  31. #define ZIP_OVERWRITE ZIP_TRUNCATE
  32. #endif
  33. #define PHP_ZIP_VERSION "1.15.4"
  34. #define ZIP_OPENBASEDIR_CHECKPATH(filename) php_check_open_basedir(filename)
  35. typedef struct _ze_zip_rsrc {
  36. struct zip *za;
  37. int index_current;
  38. int num_files;
  39. } zip_rsrc;
  40. typedef zip_rsrc * zip_rsrc_ptr;
  41. typedef struct _ze_zip_read_rsrc {
  42. struct zip_file *zf;
  43. struct zip_stat sb;
  44. } zip_read_rsrc;
  45. #define ZIPARCHIVE_ME(name, arg_info, flags) {#name, c_ziparchive_ ##name, arg_info,(uint32_t) (sizeof(arg_info)/sizeof(struct _zend_arg_info)-1), flags },
  46. #define ZIPARCHIVE_METHOD(name) ZEND_NAMED_FUNCTION(c_ziparchive_ ##name)
  47. /* Extends zend object */
  48. typedef struct _ze_zip_object {
  49. struct zip *za;
  50. char **buffers;
  51. HashTable *prop_handler;
  52. char *filename;
  53. int filename_len;
  54. int buffers_cnt;
  55. zend_object zo;
  56. } ze_zip_object;
  57. static inline ze_zip_object *php_zip_fetch_object(zend_object *obj) {
  58. return (ze_zip_object *)((char*)(obj) - XtOffsetOf(ze_zip_object, zo));
  59. }
  60. #define Z_ZIP_P(zv) php_zip_fetch_object(Z_OBJ_P((zv)))
  61. php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
  62. php_stream *php_stream_zip_open(const char *filename, const char *path, const char *mode STREAMS_DC);
  63. extern const php_stream_wrapper php_stream_zip_wrapper;
  64. #endif /* PHP_ZIP_H */
  65. /*
  66. * Local variables:
  67. * tab-width: 4
  68. * c-basic-offset: 4
  69. * End:
  70. * vim600: noet sw=4 ts=4 fdm=marker
  71. * vim<600: noet sw=4 ts=4
  72. */