separate php_http_env_response and implement content encoding
[m6w6/ext-http] / php_http.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: http |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2010, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 /* $Id: php_http.h 300300 2010-06-09 07:29:35Z mike $ */
14
15 #ifndef PHP_EXT_HTTP_H
16 #define PHP_EXT_HTTP_H
17
18 #define PHP_HTTP_EXT_VERSION "2.0.0dev"
19
20 #ifdef HAVE_CONFIG_H
21 # include "config.h"
22 #else
23 # ifndef PHP_WIN32
24 # include "php_config.h"
25 # endif
26 #endif
27
28 #include "php.h"
29 #if defined(PHP_WIN32)
30 # if defined(PHP_HTTP_EXPORTS)
31 # define PHP_HTTP_API __declspec(dllexport)
32 # elif defined(COMPILE_DL_HTTP)
33 # define PHP_HTTP_API __declspec(dllimport)
34 # else
35 # define PHP_HTTP_API
36 # endif
37 #else
38 # define PHP_HTTP_API
39 #endif
40
41 /* make functions that return SUCCESS|FAILURE more obvious */
42 typedef int STATUS;
43
44 #include "php_http_buffer.h"
45 #include "php_http_strlist.h"
46
47 #if (defined(HAVE_ICONV) || defined(PHP_HTTP_HAVE_EXT_ICONV)) && (PHP_HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV))
48 # define PHP_HTTP_HAVE_ICONV
49 #endif
50
51 #if (defined(HAVE_HASH_EXT) || defined(PHP_HTTP_HAVE_EXT_HASH)) && (PHP_HTTP_SHARED_DEPS || !defined(COMPILE_DL_HASH)) && defined(PHP_HTTP_HAVE_PHP_HASH_H)
52 # define PHP_HTTP_HAVE_HASH
53 #endif
54
55 #ifdef PHP_WIN32
56 # define CURL_STATICLIB
57 # define PHP_HTTP_HAVE_NETDB
58 # include <winsock2.h>
59 #elif defined(HAVE_NETDB_H)
60 # define PHP_HTTP_HAVE_NETDB
61 # include <netdb.h>
62 # ifdef HAVE_UNISTD_H
63 # include <unistd.h>
64 # endif
65 #endif
66
67 #include <ctype.h>
68 #define PHP_HTTP_IS_CTYPE(type, c) is##type((int) (unsigned char) (c))
69 #define PHP_HTTP_TO_CTYPE(type, c) to##type((int) (unsigned char) (c))
70
71 extern zend_module_entry http_module_entry;
72 #define phpext_http_ptr &http_module_entry
73
74 extern int http_module_number;
75
76 #if PHP_DEBUG
77 # define _DPF_STR 0
78 # define _DPF_IN 1
79 # define _DPF_OUT 2
80 extern void _dpf(int type, const char *data, size_t length);
81 #else
82 # define _dpf(t,s,l);
83 #endif
84
85 #include "php_http_misc.h"
86
87 #include "php_http_cookie.h"
88 #include "php_http_encoding.h"
89 #include "php_http_env.h"
90 #include "php_http_env_response.h"
91 #include "php_http_etag.h"
92 #include "php_http_exception.h"
93 #include "php_http_fluently_callable.h"
94 #include "php_http_filter.h"
95 #include "php_http_headers.h"
96 #include "php_http_info.h"
97 #include "php_http_header_parser.h"
98 #include "php_http_message_body.h"
99 #include "php_http_message.h"
100 #include "php_http_message_parser.h"
101 #include "php_http_negotiate.h"
102 #include "php_http_object.h"
103 #include "php_http_params.h"
104 #include "php_http_resource_factory.h"
105 #include "php_http_persistent_handle.h"
106 #include "php_http_property_proxy.h"
107 #include "php_http_querystring.h"
108 #include "php_http_request_datashare.h"
109 #include "php_http_request_factory.h"
110 #include "php_http_request.h"
111 #include "php_http_curl.h"
112 #include "php_http_neon.h"
113 #include "php_http_request_method.h"
114 #include "php_http_request_pool.h"
115 #include "php_http_url.h"
116 #include "php_http_version.h"
117
118 ZEND_BEGIN_MODULE_GLOBALS(php_http)
119 struct php_http_env_globals env;
120 struct php_http_persistent_handle_globals persistent_handle;
121 struct php_http_request_datashare_globals request_datashare;
122 #ifdef PHP_HTTP_HAVE_EVENT
123 struct php_http_request_pool_globals request_pool;
124 #endif
125 ZEND_END_MODULE_GLOBALS(php_http)
126
127 ZEND_EXTERN_MODULE_GLOBALS(php_http);
128
129 #ifdef ZTS
130 # include "TSRM/TSRM.h"
131 # define PHP_HTTP_G ((php_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(php_http_globals_id)])
132 # undef TSRMLS_FETCH_FROM_CTX
133 # define TSRMLS_FETCH_FROM_CTX(ctx) ((ctx)?(ctx):ts_resource_ex(0, NULL))
134 #else
135 # define PHP_HTTP_G (&php_http_globals)
136 #endif
137
138
139 #endif /* PHP_EXT_HTTP_H */
140
141 /*
142 * Local variables:
143 * tab-width: 4
144 * c-basic-offset: 4
145 * End:
146 * vim600: noet sw=4 ts=4 fdm=marker
147 * vim<600: noet sw=4 ts=4
148 */
149