Back to index

php5  5.3.10
php_output.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Author: Zeev Suraski <zeev@zend.com>                                 |
00016    +----------------------------------------------------------------------+
00017 */
00018 
00019 /* $Id: php_output.h 321634 2012-01-01 13:15:04Z felipe $ */
00020 
00021 #ifndef PHP_OUTPUT_H
00022 #define PHP_OUTPUT_H
00023 
00024 typedef void (*php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC);
00025 
00026 BEGIN_EXTERN_C()
00027 PHPAPI void php_output_startup(void);
00028 PHPAPI void php_output_activate(TSRMLS_D);
00029 PHPAPI void php_output_set_status(zend_bool status TSRMLS_DC);
00030 PHPAPI void php_output_register_constants(TSRMLS_D);
00031 PHPAPI int  php_default_output_func(const char *str, uint str_len TSRMLS_DC);
00032 PHPAPI int  php_ub_body_write(const char *str, uint str_length TSRMLS_DC);
00033 PHPAPI int  php_ub_body_write_no_header(const char *str, uint str_length TSRMLS_DC);
00034 PHPAPI int  php_body_write(const char *str, uint str_length TSRMLS_DC);
00035 PHPAPI int  php_header_write(const char *str, uint str_length TSRMLS_DC);
00036 PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC);
00037 PHPAPI int php_start_ob_buffer_named(const char *output_handler_name, uint chunk_size, zend_bool erase TSRMLS_DC);
00038 PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS_DC);
00039 PHPAPI void php_end_ob_buffers(zend_bool send_buffer TSRMLS_DC);
00040 PHPAPI int php_ob_get_buffer(zval *p TSRMLS_DC);
00041 PHPAPI int php_ob_get_length(zval *p TSRMLS_DC);
00042 PHPAPI void php_start_implicit_flush(TSRMLS_D);
00043 PHPAPI void php_end_implicit_flush(TSRMLS_D);
00044 PHPAPI char *php_get_output_start_filename(TSRMLS_D);
00045 PHPAPI int php_get_output_start_lineno(TSRMLS_D);
00046 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);
00047 PHPAPI int php_ob_handler_used(char *handler_name TSRMLS_DC);
00048 PHPAPI int php_ob_init_conflict(char *handler_new, char *handler_set TSRMLS_DC);
00049 PHPAPI int php_ob_get_buffer(zval *p TSRMLS_DC);
00050 PHPAPI int php_ob_get_length(zval *p TSRMLS_DC);
00051 END_EXTERN_C()
00052 
00053 PHP_FUNCTION(ob_start);
00054 PHP_FUNCTION(ob_flush);
00055 PHP_FUNCTION(ob_clean);
00056 PHP_FUNCTION(ob_end_flush);
00057 PHP_FUNCTION(ob_end_clean);
00058 PHP_FUNCTION(ob_get_flush);
00059 PHP_FUNCTION(ob_get_clean);
00060 PHP_FUNCTION(ob_get_contents);
00061 PHP_FUNCTION(ob_get_length);
00062 PHP_FUNCTION(ob_get_level);
00063 PHP_FUNCTION(ob_get_status);
00064 PHP_FUNCTION(ob_implicit_flush);
00065 PHP_FUNCTION(ob_list_handlers);
00066 
00067 typedef struct _php_ob_buffer {
00068        char *buffer;
00069        uint size;
00070        uint text_length;
00071        int block_size;
00072        uint chunk_size;
00073        int status;
00074        zval *output_handler;
00075        php_output_handler_func_t internal_output_handler;
00076        char *internal_output_handler_buffer;
00077        uint internal_output_handler_buffer_size;
00078        char *handler_name;
00079        zend_bool erase;
00080 } php_ob_buffer;
00081 
00082 typedef struct _php_output_globals {
00083        int (*php_body_write)(const char *str, uint str_length TSRMLS_DC);           /* string output */
00084        int (*php_header_write)(const char *str, uint str_length TSRMLS_DC);  /* unbuffer string output */
00085        php_ob_buffer active_ob_buffer;
00086        unsigned char implicit_flush;
00087        char *output_start_filename;
00088        int output_start_lineno;
00089        zend_stack ob_buffers;
00090        int ob_nesting_level;
00091        zend_bool ob_lock;
00092        zend_bool disable_output;
00093 } php_output_globals;
00094 
00095 #ifdef ZTS
00096 #define OG(v) TSRMG(output_globals_id, php_output_globals *, v)
00097 ZEND_API extern int output_globals_id;
00098 #else
00099 #define OG(v) (output_globals.v)
00100 ZEND_API extern php_output_globals output_globals;
00101 #endif
00102 
00103 #define PHP_OUTPUT_HANDLER_START          (1<<0)
00104 #define PHP_OUTPUT_HANDLER_CONT                  (1<<1)
00105 #define PHP_OUTPUT_HANDLER_END                   (1<<2)
00106 
00107 #define PHP_OUTPUT_HANDLER_INTERNAL     0
00108 #define PHP_OUTPUT_HANDLER_USER        1
00109 
00110 PHP_FUNCTION(output_add_rewrite_var);
00111 PHP_FUNCTION(output_reset_rewrite_vars);
00112 
00113 
00114 #endif /* PHP_OUTPUT_H */