attempt to fix trunk build
[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-2010, 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 #ifdef ZEND_ENGINE_2
19
20 typedef struct _http_request_pool_t {
21 CURLM *ch;
22 zend_llist finished;
23 zend_llist handles;
24 int unfinished;
25 #ifdef ZTS
26 void ***tsrm_ls;
27 #endif
28 #ifdef HTTP_HAVE_EVENT
29 struct event *timeout;
30 unsigned useevents:1;
31 unsigned runsocket:1;
32 #endif
33 } http_request_pool;
34
35 typedef int (*http_request_pool_apply_func)(http_request_pool *pool, zval *request);
36 typedef int (*http_request_pool_apply_with_arg_func)(http_request_pool *pool, zval *request, void *arg);
37
38 PHP_MINIT_FUNCTION(http_request_pool);
39 #ifdef HTTP_HAVE_EVENT
40 PHP_RINIT_FUNCTION(http_request_pool);
41 #endif
42
43 #define http_request_pool_timeout _http_request_pool_timeout
44 extern struct timeval *_http_request_pool_timeout(http_request_pool *pool, struct timeval *timeout);
45
46 #define http_request_pool_responsehandler _http_request_pool_responsehandler
47 extern void _http_request_pool_responsehandler(http_request_pool *pool);
48
49 #define http_request_pool_apply_responsehandler _http_request_pool_responsehandler
50 extern int _http_request_pool_apply_responsehandler(http_request_pool *pool, zval *req, void *ch);
51
52 #define http_request_pool_init(p) _http_request_pool_init((p) TSRMLS_CC)
53 PHP_HTTP_API http_request_pool *_http_request_pool_init(http_request_pool *pool TSRMLS_DC);
54
55 #define http_request_pool_attach(p, r) _http_request_pool_attach((p), (r))
56 PHP_HTTP_API STATUS _http_request_pool_attach(http_request_pool *pool, zval *request);
57
58 #define http_request_pool_detach(p, r) _http_request_pool_detach((p), (r))
59 PHP_HTTP_API STATUS _http_request_pool_detach(http_request_pool *pool, zval *request);
60
61 #define http_request_pool_apply(p, f) _http_request_pool_apply((p), (f))
62 PHP_HTTP_API void _http_request_pool_apply(http_request_pool *pool, http_request_pool_apply_func cb);
63
64 #define http_request_pool_apply_with_arg(p, f, a) _http_request_pool_apply_with_arg((p), (f), (a))
65 PHP_HTTP_API void _http_request_pool_apply_with_arg(http_request_pool *pool, http_request_pool_apply_with_arg_func cb, void *arg);
66
67 #define http_request_pool_detach_all(p) _http_request_pool_detach_all((p))
68 PHP_HTTP_API void _http_request_pool_detach_all(http_request_pool *pool);
69
70 #define http_request_pool_send(p) _http_request_pool_send((p))
71 PHP_HTTP_API STATUS _http_request_pool_send(http_request_pool *pool);
72
73 #define http_request_pool_select _http_request_pool_select
74 PHP_HTTP_API STATUS _http_request_pool_select(http_request_pool *pool);
75
76 #define http_request_pool_select_ex _http_request_pool_select_ex
77 PHP_HTTP_API STATUS _http_request_pool_select_ex(http_request_pool *pool, struct timeval *custom_timeout);
78
79 #define http_request_pool_perform(p) _http_request_pool_perform((p))
80 PHP_HTTP_API int _http_request_pool_perform(http_request_pool *pool);
81
82 #define http_request_pool_dtor(p) _http_request_pool_dtor((p))
83 PHP_HTTP_API void _http_request_pool_dtor(http_request_pool *pool);
84
85 #endif
86 #endif
87 #endif
88
89 /*
90 * Local variables:
91 * tab-width: 4
92 * c-basic-offset: 4
93 * End:
94 * vim600: noet sw=4 ts=4 fdm=marker
95 * vim<600: noet sw=4 ts=4
96 */
97