xref: /PHP-5.3/sapi/apache2filter/php_apache.h (revision a2045ff3)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 5                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2013 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: Sascha Schumann <sascha@schumann.cx>                         |
16    +----------------------------------------------------------------------+
17  */
18 
19 /* $Id$ */
20 
21 #ifndef PHP_APACHE_H
22 #define PHP_APACHE_H
23 
24 #include "httpd.h"
25 #include "http_config.h"
26 #include "http_core.h"
27 
28 /* Declare this so we can get to it from outside the sapi_apache2.c file */
29 extern module AP_MODULE_DECLARE_DATA php5_module;
30 
31 /* A way to specify the location of the php.ini dir in an apache directive */
32 extern char *apache2_php_ini_path_override;
33 
34 /* The server_context used by PHP */
35 typedef struct php_struct {
36 	int state;
37 	request_rec *r;
38 	ap_filter_t *f; /* downstream output filters after the PHP filter. */
39 	/* Length of post_data buffer */
40 	int post_len;
41 	/* Index for reading from buffer */
42 	int post_idx;
43 	/* stat structure of the current file */
44 	struct stat finfo;
45 	/* Buffer for request body filter */
46 	char *post_data;
47 	/* Whether or not we've processed PHP in the output filters yet. */
48 	int request_processed;
49 } php_struct;
50 
51 typedef struct _php_apr_bucket_brigade {
52 	apr_bucket_brigade *bb;
53 } php_apr_bucket_brigade;
54 
55 void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf);
56 void *create_php_config(apr_pool_t *p, char *dummy);
57 char *get_php_config(void *conf, char *name, size_t name_len);
58 void apply_config(void *);
59 extern const command_rec php_dir_cmds[];
60 
61 static size_t php_apache_read_stream(void *, char *, size_t TSRMLS_DC);
62 static size_t php_apache_fsizer_stream(void * TSRMLS_DC);
63 
64 #define APR_ARRAY_FOREACH_OPEN(arr, key, val) 		\
65 {													\
66 	apr_table_entry_t *elts;						\
67 	int i;											\
68 	elts = (apr_table_entry_t *) arr->elts;			\
69 	for (i = 0; i < arr->nelts; i++) {				\
70 		key = elts[i].key;							\
71 		val = elts[i].val;
72 
73 #define APR_ARRAY_FOREACH_CLOSE() }}
74 
75 /* fix for gcc4 visibility patch */
76 #ifndef PHP_WIN32
77 # undef AP_MODULE_DECLARE_DATA
78 # define AP_MODULE_DECLARE_DATA PHPAPI
79 #endif
80 
81 #endif /* PHP_APACHE_H */
82