You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
4.6 KiB

27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
24 years ago
27 years ago
27 years ago
27 years ago
25 years ago
25 years ago
25 years ago
27 years ago
25 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2009 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: Zeev Suraski <zeev@zend.com> |
  16. +----------------------------------------------------------------------+
  17. */
  18. /* $Id$ */
  19. #ifndef PHP_OUTPUT_H
  20. #define PHP_OUTPUT_H
  21. typedef void (*php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC);
  22. BEGIN_EXTERN_C()
  23. PHPAPI void php_output_startup(void);
  24. PHPAPI void php_output_activate(TSRMLS_D);
  25. PHPAPI void php_output_set_status(zend_bool status TSRMLS_DC);
  26. PHPAPI void php_output_register_constants(TSRMLS_D);
  27. PHPAPI int php_default_output_func(const char *str, uint str_len TSRMLS_DC);
  28. PHPAPI int php_ub_body_write(const char *str, uint str_length TSRMLS_DC);
  29. PHPAPI int php_ub_body_write_no_header(const char *str, uint str_length TSRMLS_DC);
  30. PHPAPI int php_body_write(const char *str, uint str_length TSRMLS_DC);
  31. PHPAPI int php_header_write(const char *str, uint str_length TSRMLS_DC);
  32. PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC);
  33. PHPAPI int php_start_ob_buffer_named(const char *output_handler_name, uint chunk_size, zend_bool erase TSRMLS_DC);
  34. PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS_DC);
  35. PHPAPI void php_end_ob_buffers(zend_bool send_buffer TSRMLS_DC);
  36. PHPAPI int php_ob_get_buffer(zval *p TSRMLS_DC);
  37. PHPAPI int php_ob_get_length(zval *p TSRMLS_DC);
  38. PHPAPI void php_start_implicit_flush(TSRMLS_D);
  39. PHPAPI void php_end_implicit_flush(TSRMLS_D);
  40. PHPAPI char *php_get_output_start_filename(TSRMLS_D);
  41. PHPAPI int php_get_output_start_lineno(TSRMLS_D);
  42. PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size, char *handler_name, zend_bool erase TSRMLS_DC);
  43. PHPAPI int php_ob_handler_used(char *handler_name TSRMLS_DC);
  44. PHPAPI int php_ob_init_conflict(char *handler_new, char *handler_set TSRMLS_DC);
  45. PHPAPI int php_ob_get_buffer(zval *p TSRMLS_DC);
  46. PHPAPI int php_ob_get_length(zval *p TSRMLS_DC);
  47. END_EXTERN_C()
  48. PHP_FUNCTION(ob_start);
  49. PHP_FUNCTION(ob_flush);
  50. PHP_FUNCTION(ob_clean);
  51. PHP_FUNCTION(ob_end_flush);
  52. PHP_FUNCTION(ob_end_clean);
  53. PHP_FUNCTION(ob_get_flush);
  54. PHP_FUNCTION(ob_get_clean);
  55. PHP_FUNCTION(ob_get_contents);
  56. PHP_FUNCTION(ob_get_length);
  57. PHP_FUNCTION(ob_get_level);
  58. PHP_FUNCTION(ob_get_status);
  59. PHP_FUNCTION(ob_implicit_flush);
  60. PHP_FUNCTION(ob_list_handlers);
  61. typedef struct _php_ob_buffer {
  62. char *buffer;
  63. uint size;
  64. uint text_length;
  65. int block_size;
  66. uint chunk_size;
  67. int status;
  68. zval *output_handler;
  69. php_output_handler_func_t internal_output_handler;
  70. char *internal_output_handler_buffer;
  71. uint internal_output_handler_buffer_size;
  72. char *handler_name;
  73. zend_bool erase;
  74. } php_ob_buffer;
  75. typedef struct _php_output_globals {
  76. int (*php_body_write)(const char *str, uint str_length TSRMLS_DC); /* string output */
  77. int (*php_header_write)(const char *str, uint str_length TSRMLS_DC); /* unbuffer string output */
  78. php_ob_buffer active_ob_buffer;
  79. unsigned char implicit_flush;
  80. char *output_start_filename;
  81. int output_start_lineno;
  82. zend_stack ob_buffers;
  83. int ob_nesting_level;
  84. zend_bool ob_lock;
  85. zend_bool disable_output;
  86. } php_output_globals;
  87. #ifdef ZTS
  88. #define OG(v) TSRMG(output_globals_id, php_output_globals *, v)
  89. ZEND_API extern int output_globals_id;
  90. #else
  91. #define OG(v) (output_globals.v)
  92. ZEND_API extern php_output_globals output_globals;
  93. #endif
  94. #define PHP_OUTPUT_HANDLER_START (1<<0)
  95. #define PHP_OUTPUT_HANDLER_CONT (1<<1)
  96. #define PHP_OUTPUT_HANDLER_END (1<<2)
  97. #define PHP_OUTPUT_HANDLER_INTERNAL 0
  98. #define PHP_OUTPUT_HANDLER_USER 1
  99. PHP_FUNCTION(output_add_rewrite_var);
  100. PHP_FUNCTION(output_reset_rewrite_vars);
  101. #endif /* PHP_OUTPUT_H */