header cleanups and fix some warnings
[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.h>
21 #include <php_config.h>
22 #include <SAPI.h>
23 #include <zend_interfaces.h>
24
25 #if defined(PHP_WIN32)
26 # if defined(PHP_HTTP_EXPORTS)
27 # define PHP_HTTP_API __declspec(dllexport)
28 # elif defined(COMPILE_DL_HTTP)
29 # define PHP_HTTP_API __declspec(dllimport)
30 # else
31 # define PHP_HTTP_API
32 # endif
33 #else
34 # define PHP_HTTP_API
35 #endif
36
37 /* make functions that return SUCCESS|FAILURE more obvious */
38 typedef int STATUS;
39
40 #if (defined(HAVE_ICONV) || defined(PHP_HTTP_HAVE_EXT_ICONV)) && (PHP_HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV))
41 # define PHP_HTTP_HAVE_ICONV
42 #endif
43
44 #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)
45 # define PHP_HTTP_HAVE_HASH
46 #endif
47
48 #ifdef PHP_WIN32
49 # define CURL_STATICLIB
50 # define PHP_HTTP_HAVE_NETDB
51 # include <winsock2.h>
52 #elif defined(HAVE_NETDB_H)
53 # define PHP_HTTP_HAVE_NETDB
54 # include <netdb.h>
55 # ifdef HAVE_UNISTD_H
56 # include <unistd.h>
57 # endif
58 #endif
59
60 #include <ctype.h>
61 #define PHP_HTTP_IS_CTYPE(type, c) is##type((int) (unsigned char) (c))
62 #define PHP_HTTP_TO_CTYPE(type, c) to##type((int) (unsigned char) (c))
63
64 #include "php_http_buffer.h"
65 #include "php_http_strlist.h"
66 #include "php_http_misc.h"
67 #include "php_http_resource_factory.h"
68
69 #include "php_http.h"
70 #include "php_http_cookie.h"
71 #include "php_http_curl.h"
72 #include "php_http_encoding.h"
73 #include "php_http_env.h"
74 #include "php_http_env_response.h"
75 #include "php_http_etag.h"
76 #include "php_http_exception.h"
77 #include "php_http_filter.h"
78 #include "php_http_header_parser.h"
79 #include "php_http_headers.h"
80 #include "php_http_info.h"
81 #include "php_http_message.h"
82 #include "php_http_message_body.h"
83 #include "php_http_message_parser.h"
84 #include "php_http_negotiate.h"
85 #include "php_http_neon.h"
86 #include "php_http_object.h"
87 #include "php_http_params.h"
88 #include "php_http_persistent_handle.h"
89 #include "php_http_property_proxy.h"
90 #include "php_http_querystring.h"
91 #include "php_http_request.h"
92 #include "php_http_request_datashare.h"
93 #include "php_http_request_factory.h"
94 #include "php_http_request_method.h"
95 #include "php_http_request_pool.h"
96 #include "php_http_serf.h"
97 #include "php_http_url.h"
98 #include "php_http_version.h"
99
100 ZEND_BEGIN_MODULE_GLOBALS(php_http)
101 struct php_http_env_globals env;
102 struct php_http_persistent_handle_globals persistent_handle;
103 struct php_http_request_datashare_globals request_datashare;
104 #if PHP_HTTP_HAVE_CURL && PHP_HTTP_HAVE_EVENT
105 struct php_http_curl_globals curl;
106 #endif
107 ZEND_END_MODULE_GLOBALS(php_http)
108
109 ZEND_EXTERN_MODULE_GLOBALS(php_http);
110
111 #ifdef ZTS
112 # include "TSRM/TSRM.h"
113 # define PHP_HTTP_G ((zend_php_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(php_http_globals_id)])
114 # undef TSRMLS_FETCH_FROM_CTX
115 # define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = ((ctx)?(ctx):ts_resource_ex(0, NULL))
116 #else
117 # define PHP_HTTP_G (&php_http_globals)
118 #endif
119
120 #endif /* PHP_HTTP_API_H */
121
122
123 /*
124 * Local variables:
125 * tab-width: 4
126 * c-basic-offset: 4
127 * End:
128 * vim600: noet sw=4 ts=4 fdm=marker
129 * vim<600: noet sw=4 ts=4
130 */