fix build with old curl version
[m6w6/ext-http] / php_http_api.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-2011, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 #ifndef PHP_HTTP_API_H
14 #define PHP_HTTP_API_H
15
16 #ifdef HAVE_CONFIG_H
17 #include "config.h"
18 #endif
19
20 #ifndef PHP_WIN32
21 #include <php_config.h>
22 #endif
23 #include <php.h>
24 #include <SAPI.h>
25
26 #include <ext/standard/php_string.h>
27 #include <ext/spl/spl_iterators.h>
28 #include <ext/date/php_date.h>
29
30 #include <zend_interfaces.h>
31
32 #ifdef PHP_WIN32
33 # define PHP_HTTP_API __declspec(dllexport)
34 #elif defined(__GNUC__) && __GNUC__ >= 4
35 # define PHP_HTTP_API __attribute__ ((visibility("default")))
36 #else
37 # define PHP_HTTP_API
38 #endif
39
40 /* make functions that return SUCCESS|FAILURE more obvious */
41 typedef int STATUS;
42
43 #if (defined(HAVE_ICONV) || defined(PHP_HTTP_HAVE_EXT_ICONV)) && (PHP_HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV))
44 # define PHP_HTTP_HAVE_ICONV
45 #endif
46
47 #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)
48 # define PHP_HTTP_HAVE_HASH
49 #endif
50
51 #if (defined(HAVE_JSON) || defined(PHP_HTTP_HAVE_EXT_JSON)) && (PHP_HTTP_SHARED_DEPS || !defined(COMPILE_DL_JSON))
52 # define PHP_HTTP_HAVE_JSON
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 #include "php_http.h"
72
73 #include "php_http_buffer.h"
74 #include "php_http_strlist.h"
75 #include "php_http_misc.h"
76 #include "php_http_resource_factory.h"
77 #include "php_http_options.h"
78
79 #include "php_http.h"
80 #include "php_http_cookie.h"
81 #include "php_http_encoding.h"
82 #include "php_http_env.h"
83 #include "php_http_env_request.h"
84 #include "php_http_env_response.h"
85 #include "php_http_etag.h"
86 #include "php_http_exception.h"
87 #include "php_http_filter.h"
88 #include "php_http_header_parser.h"
89 #include "php_http_headers.h"
90 #include "php_http_info.h"
91 #include "php_http_message.h"
92 #include "php_http_message_body.h"
93 #include "php_http_message_parser.h"
94 #include "php_http_negotiate.h"
95 #include "php_http_object.h"
96 #include "php_http_params.h"
97 #include "php_http_persistent_handle.h"
98 #include "php_http_property_proxy.h"
99 #include "php_http_querystring.h"
100 #include "php_http_client_interface.h"
101 #include "php_http_client.h"
102 #include "php_http_curl.h"
103 #include "php_http_client_request.h"
104 #include "php_http_client_response.h"
105 #include "php_http_curl_client.h"
106 #include "php_http_client_pool.h"
107 #include "php_http_curl_client_pool.h"
108 #include "php_http_client_datashare.h"
109 #include "php_http_curl_client_datashare.h"
110 #include "php_http_client_factory.h"
111 #include "php_http_url.h"
112 #include "php_http_version.h"
113
114 ZEND_BEGIN_MODULE_GLOBALS(php_http)
115 struct php_http_env_globals env;
116 struct php_http_persistent_handle_globals persistent_handle;
117 #if PHP_HTTP_HAVE_CURL && PHP_HTTP_HAVE_EVENT
118 struct php_http_curl_globals curl;
119 #endif
120 ZEND_END_MODULE_GLOBALS(php_http)
121
122 ZEND_EXTERN_MODULE_GLOBALS(php_http);
123
124 #ifdef ZTS
125 # include "TSRM/TSRM.h"
126 # define PHP_HTTP_G ((zend_php_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(php_http_globals_id)])
127 # undef TSRMLS_FETCH_FROM_CTX
128 # define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = ((ctx)?(ctx):ts_resource_ex(0, NULL))
129 #else
130 # define PHP_HTTP_G (&php_http_globals)
131 #endif
132
133 #if PHP_DEBUG
134 # define _DPF_STR 0
135 # define _DPF_IN 1
136 # define _DPF_OUT 2
137 extern void _dpf(int type, const char *data, size_t length);
138 #else
139 # define _dpf(t,s,l);
140 #endif
141
142 #endif /* PHP_HTTP_API_H */
143
144
145 /*
146 * Local variables:
147 * tab-width: 4
148 * c-basic-offset: 4
149 * End:
150 * vim600: noet sw=4 ts=4 fdm=marker
151 * vim<600: noet sw=4 ts=4
152 */