prepared for libevent2 usage in config.w32, though libevent usage seems to be broken...
[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-2013, 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/raphf/php_raphf.h>
27 #include <ext/propro/php_propro.h>
28 #include <ext/standard/php_string.h>
29 #include <ext/spl/spl_iterators.h>
30 #include <ext/date/php_date.h>
31
32 #include <zend_interfaces.h>
33
34 #ifdef PHP_WIN32
35 # define PHP_HTTP_API __declspec(dllexport)
36 #elif defined(__GNUC__) && __GNUC__ >= 4
37 # define PHP_HTTP_API __attribute__ ((visibility("default")))
38 #else
39 # define PHP_HTTP_API
40 #endif
41
42 /* make functions that return SUCCESS|FAILURE more obvious */
43 typedef int STATUS;
44
45 #if (defined(HAVE_ICONV) || defined(PHP_HTTP_HAVE_EXT_ICONV)) && (PHP_HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV))
46 # define PHP_HTTP_HAVE_ICONV
47 #endif
48
49 #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)
50 # define PHP_HTTP_HAVE_HASH
51 #endif
52
53 #if (defined(HAVE_JSON) || defined(PHP_HTTP_HAVE_EXT_JSON)) && (PHP_HTTP_SHARED_DEPS || !defined(COMPILE_DL_JSON))
54 # define PHP_HTTP_HAVE_JSON
55 #endif
56
57 #ifdef PHP_WIN32
58 # define CURL_STATICLIB
59 # define PHP_HTTP_HAVE_NETDB
60 # include <winsock2.h>
61 #elif defined(HAVE_NETDB_H)
62 # define PHP_HTTP_HAVE_NETDB
63 # include <netdb.h>
64 # ifdef HAVE_UNISTD_H
65 # include <unistd.h>
66 # endif
67 # ifdef HAVE_ERRNO_H
68 # include <errno.h>
69 # endif
70 #endif
71
72 #include <ctype.h>
73 #define PHP_HTTP_IS_CTYPE(type, c) is##type((int) (unsigned char) (c))
74 #define PHP_HTTP_TO_CTYPE(type, c) to##type((int) (unsigned char) (c))
75
76 #include "php_http.h"
77
78 #include "php_http_buffer.h"
79 #include "php_http_strlist.h"
80 #include "php_http_misc.h"
81 #include "php_http_options.h"
82
83 #include "php_http.h"
84 #include "php_http_cookie.h"
85 #include "php_http_encoding.h"
86 #include "php_http_info.h"
87 #include "php_http_message.h"
88 #include "php_http_env.h"
89 #include "php_http_env_request.h"
90 #include "php_http_env_response.h"
91 #include "php_http_etag.h"
92 #include "php_http_exception.h"
93 #include "php_http_filter.h"
94 #include "php_http_header_parser.h"
95 #include "php_http_headers.h"
96 #include "php_http_message_body.h"
97 #include "php_http_message_parser.h"
98 #include "php_http_negotiate.h"
99 #include "php_http_object.h"
100 #include "php_http_params.h"
101 #include "php_http_querystring.h"
102 #include "php_http_client.h"
103 #include "php_http_curl.h"
104 #include "php_http_client_request.h"
105 #include "php_http_client_response.h"
106 #include "php_http_client_curl.h"
107 #include "php_http_url.h"
108 #include "php_http_version.h"
109
110 ZEND_BEGIN_MODULE_GLOBALS(php_http)
111 struct php_http_env_globals env;
112 #if PHP_HTTP_HAVE_CURL && PHP_HTTP_HAVE_EVENT
113 struct php_http_curl_globals curl;
114 #endif
115 ZEND_END_MODULE_GLOBALS(php_http)
116
117 ZEND_EXTERN_MODULE_GLOBALS(php_http);
118
119 #ifdef ZTS
120 # include "TSRM/TSRM.h"
121 # define PHP_HTTP_G ((zend_php_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(php_http_globals_id)])
122 # undef TSRMLS_FETCH_FROM_CTX
123 # define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = ((ctx)?(ctx):ts_resource_ex(0, NULL))
124 #else
125 # define PHP_HTTP_G (&php_http_globals)
126 #endif
127
128 #if PHP_DEBUG
129 # define _DPF_STR 0
130 # define _DPF_IN 1
131 # define _DPF_OUT 2
132 extern void _dpf(int type, const char *data, size_t length);
133 #else
134 # define _dpf(t,s,l);
135 #endif
136
137 #endif /* PHP_HTTP_API_H */
138
139
140 /*
141 * Local variables:
142 * tab-width: 4
143 * c-basic-offset: 4
144 * End:
145 * vim600: noet sw=4 ts=4 fdm=marker
146 * vim<600: noet sw=4 ts=4
147 */