etag test & fixes; set default etag mode for temp streams to crc32(b)
[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 #include <php_config.h>
21 #include <php.h>
22 #include <SAPI.h>
23
24 #include <ext/standard/php_string.h>
25 #include <ext/spl/spl_iterators.h>
26 #include <ext/date/php_date.h>
27
28 #include <zend_interfaces.h>
29
30 #if defined(PHP_WIN32)
31 # if defined(PHP_HTTP_EXPORTS)
32 # define PHP_HTTP_API __declspec(dllexport)
33 # elif defined(COMPILE_DL_HTTP)
34 # define PHP_HTTP_API __declspec(dllimport)
35 # else
36 # define PHP_HTTP_API
37 # endif
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 #ifdef PHP_WIN32
54 # define CURL_STATICLIB
55 # define PHP_HTTP_HAVE_NETDB
56 # include <winsock2.h>
57 #elif defined(HAVE_NETDB_H)
58 # define PHP_HTTP_HAVE_NETDB
59 # include <netdb.h>
60 # ifdef HAVE_UNISTD_H
61 # include <unistd.h>
62 # endif
63 #endif
64
65 #include <ctype.h>
66 #define PHP_HTTP_IS_CTYPE(type, c) is##type((int) (unsigned char) (c))
67 #define PHP_HTTP_TO_CTYPE(type, c) to##type((int) (unsigned char) (c))
68
69 #include "php_http.h"
70
71 #include "php_http_buffer.h"
72 #include "php_http_strlist.h"
73 #include "php_http_misc.h"
74 #include "php_http_resource_factory.h"
75
76 #include "php_http.h"
77 #include "php_http_cookie.h"
78 #include "php_http_curl.h"
79 #include "php_http_encoding.h"
80 #include "php_http_env.h"
81 #include "php_http_env_response.h"
82 #include "php_http_etag.h"
83 #include "php_http_exception.h"
84 #include "php_http_filter.h"
85 #include "php_http_header_parser.h"
86 #include "php_http_headers.h"
87 #include "php_http_info.h"
88 #include "php_http_message.h"
89 #include "php_http_message_body.h"
90 #include "php_http_message_parser.h"
91 #include "php_http_negotiate.h"
92 #include "php_http_object.h"
93 #include "php_http_params.h"
94 #include "php_http_persistent_handle.h"
95 #include "php_http_property_proxy.h"
96 #include "php_http_querystring.h"
97 #include "php_http_request.h"
98 #include "php_http_request_datashare.h"
99 #include "php_http_request_factory.h"
100 #include "php_http_request_method.h"
101 #include "php_http_request_pool.h"
102 #include "php_http_serf.h"
103 #include "php_http_url.h"
104 #include "php_http_version.h"
105
106 ZEND_BEGIN_MODULE_GLOBALS(php_http)
107 struct php_http_env_globals env;
108 struct php_http_persistent_handle_globals persistent_handle;
109 struct php_http_request_datashare_globals request_datashare;
110 #if PHP_HTTP_HAVE_CURL && PHP_HTTP_HAVE_EVENT
111 struct php_http_curl_globals curl;
112 #endif
113 ZEND_END_MODULE_GLOBALS(php_http)
114
115 ZEND_EXTERN_MODULE_GLOBALS(php_http);
116
117 #ifdef ZTS
118 # include "TSRM/TSRM.h"
119 # define PHP_HTTP_G ((zend_php_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(php_http_globals_id)])
120 # undef TSRMLS_FETCH_FROM_CTX
121 # define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = ((ctx)?(ctx):ts_resource_ex(0, NULL))
122 #else
123 # define PHP_HTTP_G (&php_http_globals)
124 #endif
125
126 #if PHP_DEBUG
127 # define _DPF_STR 0
128 # define _DPF_IN 1
129 # define _DPF_OUT 2
130 extern void _dpf(int type, const char *data, size_t length);
131 #else
132 # define _dpf(t,s,l);
133 #endif
134
135 #endif /* PHP_HTTP_API_H */
136
137
138 /*
139 * Local variables:
140 * tab-width: 4
141 * c-basic-offset: 4
142 * End:
143 * vim600: noet sw=4 ts=4 fdm=marker
144 * vim<600: noet sw=4 ts=4
145 */