import 2.0 devl branch, suitable for PHP-trunk
[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 #include <main/SAPI.h>
42 #include <main/fopen_wrappers.h>
43 #include <main/php_streams.h>
44 #include <main/php_variables.h>
45 #include <Zend/zend_exceptions.h>
46 #include <Zend/zend_interfaces.h>
47 #include <ext/date/php_date.h>
48 #include <ext/spl/spl_array.h>
49 #include <ext/spl/spl_iterators.h>
50 #include <ext/standard/php_lcg.h>
51 #include <ext/standard/php_string.h>
52 #include <ext/standard/url.h>
53
54 /* make functions that return SUCCESS|FAILURE more obvious */
55 typedef int STATUS;
56
57 #include "php_http_buffer.h"
58 #include "php_http_strlist.h"
59
60 #if (defined(HAVE_ICONV) || defined(PHP_HTTP_HAVE_EXT_ICONV)) && (PHP_HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV))
61 # define PHP_HTTP_HAVE_ICONV
62 # undef PHP_ATOM_INC
63 # include <ext/iconv/php_iconv.h>
64 #endif
65
66 #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)
67 # define PHP_HTTP_HAVE_HASH
68 # include "php_hash.h"
69 #endif
70
71 #ifdef PHP_WIN32
72 # define CURL_STATICLIB
73 # define PHP_HTTP_HAVE_NETDB
74 # include <winsock2.h>
75 #elif defined(HAVE_NETDB_H)
76 # define PHP_HTTP_HAVE_NETDB
77 # include <netdb.h>
78 # ifdef HAVE_UNISTD_H
79 # include <unistd.h>
80 # endif
81 #endif
82
83 #ifdef PHP_HTTP_HAVE_EVENT
84 # include <event.h>
85 #endif
86
87 #include <curl/curl.h>
88 #define PHP_HTTP_CURL_VERSION(x, y, z) (LIBCURL_VERSION_NUM >= (((x)<<16) + ((y)<<8) + (z)))
89
90 #if defined(ZTS) && defined(PHP_HTTP_HAVE_SSL)
91 # ifdef PHP_WIN32
92 # define PHP_HTTP_NEED_OPENSSL_TSL
93 # include <openssl/crypto.h>
94 # else /* !PHP_WIN32 */
95 # if defined(PHP_HTTP_HAVE_OPENSSL)
96 # define PHP_HTTP_NEED_OPENSSL_TSL
97 # include <openssl/crypto.h>
98 # elif defined(PHP_HTTP_HAVE_GNUTLS)
99 # define PHP_HTTP_NEED_GNUTLS_TSL
100 # include <gcrypt.h>
101 # else
102 # warning \
103 "libcurl was compiled with SSL support, but configure could not determine which" \
104 "library was used; thus no SSL crypto locking callbacks will be set, which may " \
105 "cause random crashes on SSL requests"
106 # endif /* PHP_HTTP_HAVE_OPENSSL || PHP_HTTP_HAVE_GNUTLS */
107 # endif /* PHP_WIN32 */
108 #endif /* ZTS && PHP_HTTP_HAVE_SSL */
109
110 #include <zlib.h>
111 #include <ctype.h>
112 #define PHP_HTTP_IS_CTYPE(type, c) is##type((int) (unsigned char) (c))
113 #define PHP_HTTP_TO_CTYPE(type, c) to##type((int) (unsigned char) (c))
114
115 extern zend_module_entry http_module_entry;
116 #define phpext_http_ptr &http_module_entry
117
118 extern int http_module_number;
119
120 #include "php_http_misc.h"
121
122 #include "php_http_cookie.h"
123 #include "php_http_encoding.h"
124 #include "php_http_env.h"
125 #include "php_http_etag.h"
126 #include "php_http_exception.h"
127 #include "php_http_filter.h"
128 #include "php_http_headers.h"
129 #include "php_http_info.h"
130 #include "php_http_header_parser.h"
131 #include "php_http_message_body.h"
132 #include "php_http_message.h"
133 #include "php_http_message_parser.h"
134 #include "php_http_negotiate.h"
135 #include "php_http_object.h"
136 #include "php_http_params.h"
137 #include "php_http_persistent_handle.h"
138 #include "php_http_property_proxy.h"
139 #include "php_http_querystring.h"
140 #include "php_http_request_datashare.h"
141 #include "php_http_request.h"
142 #include "php_http_request_method.h"
143 #include "php_http_request_pool.h"
144 #include "php_http_url.h"
145 #include "php_http_version.h"
146
147 ZEND_BEGIN_MODULE_GLOBALS(php_http)
148 struct php_http_env_globals env;
149 struct php_http_persistent_handle_globals persistent_handle;
150 struct php_http_request_datashare_globals request_datashare;
151 struct php_http_request_pool_globals request_pool;
152 ZEND_END_MODULE_GLOBALS(php_http)
153
154 ZEND_EXTERN_MODULE_GLOBALS(php_http);
155
156 #ifdef ZTS
157 # include "TSRM/TSRM.h"
158 # define PHP_HTTP_G ((zend_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(php_http_globals_id)])
159 #else
160 # define PHP_HTTP_G (&php_http_globals)
161 #endif
162
163
164 #endif /* PHP_EXT_HTTP_H */
165
166 /*
167 * Local variables:
168 * tab-width: 4
169 * c-basic-offset: 4
170 * End:
171 * vim600: noet sw=4 ts=4 fdm=marker
172 * vim<600: noet sw=4 ts=4
173 */
174