- allow to disable zlib support
[m6w6/ext-http] / php_http_request_pool_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-2005, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 /* $Id$ */
14
15 #ifndef PHP_HTTP_REQUEST_POOL_API_H
16 #define PHP_HTTP_REQUEST_POOL_API_H
17 #ifdef HTTP_HAVE_CURL
18
19 typedef struct {
20 CURLM *ch;
21 zend_llist finished;
22 zend_llist handles;
23 int unfinished;
24 } http_request_pool;
25
26 #define http_request_pool_responsehandler _http_request_pool_responsehandler
27 extern void _http_request_pool_responsehandler(zval **req, CURL *ch TSRMLS_DC);
28
29 #define http_request_pool_try \
30 { \
31 zval *old_exception = EG(exception); \
32 EG(exception) = NULL;
33 #define http_request_pool_catch() \
34 if (EG(exception)) { \
35 http_request_pool_wrap_exception(old_exception, EG(exception)); \
36 } else { \
37 EG(exception) = old_exception; \
38 } \
39 }
40 #define http_request_pool_final() \
41 if (EG(exception)) { \
42 zval *exception; \
43 http_request_pool_wrap_exception(NULL, EG(exception)); \
44 exception = EG(exception); \
45 EG(exception) = NULL; \
46 zend_throw_exception_object(exception TSRMLS_CC); \
47 }
48
49 #define http_request_pool_wrap_exception(o, n) _http_request_pool_wrap_exception((o), (n) TSRMLS_CC)
50 extern void _http_request_pool_wrap_exception(zval *old_exception, zval *new_exception TSRMLS_DC);
51
52
53 #define http_request_pool_init(p) _http_request_pool_init((p) TSRMLS_CC)
54 PHP_HTTP_API http_request_pool *_http_request_pool_init(http_request_pool *pool TSRMLS_DC);
55
56 #define http_request_pool_attach(p, r) _http_request_pool_attach((p), (r) TSRMLS_CC)
57 PHP_HTTP_API STATUS _http_request_pool_attach(http_request_pool *pool, zval *request TSRMLS_DC);
58
59 #define http_request_pool_detach(p, r) _http_request_pool_detach((p), (r) TSRMLS_CC)
60 PHP_HTTP_API STATUS _http_request_pool_detach(http_request_pool *pool, zval *request TSRMLS_DC);
61
62 #define http_request_pool_detach_all(p) _http_request_pool_detach_all((p) TSRMLS_CC)
63 PHP_HTTP_API void _http_request_pool_detach_all(http_request_pool *pool TSRMLS_DC);
64
65 #define http_request_pool_send(p) _http_request_pool_send((p) TSRMLS_CC)
66 PHP_HTTP_API STATUS _http_request_pool_send(http_request_pool *pool TSRMLS_DC);
67
68 #define http_request_pool_select _http_request_pool_select
69 PHP_HTTP_API STATUS _http_request_pool_select(http_request_pool *pool);
70
71 #define http_request_pool_perform(p) _http_request_pool_perform((p) TSRMLS_CC)
72 PHP_HTTP_API int _http_request_pool_perform(http_request_pool *pool TSRMLS_DC);
73
74 #define http_request_pool_dtor(p) _http_request_pool_dtor((p) TSRMLS_CC)
75 PHP_HTTP_API void _http_request_pool_dtor(http_request_pool *pool TSRMLS_DC);
76
77 #endif
78 #endif
79
80 /*
81 * Local variables:
82 * tab-width: 4
83 * c-basic-offset: 4
84 * End:
85 * vim600: noet sw=4 ts=4 fdm=marker
86 * vim<600: noet sw=4 ts=4
87 */
88