- final bits incl. timeouts
[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-2007, 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 #endif
31 } http_request_pool;
32
33 typedef int (*http_request_pool_apply_func)(http_request_pool *pool, zval *request);
34 typedef int (*http_request_pool_apply_with_arg_func)(http_request_pool *pool, zval *request, void *arg);
35
36 PHP_MINIT_FUNCTION(http_request_pool);
37 #ifdef HTTP_HAVE_EVENT
38 PHP_RINIT_FUNCTION(http_request_pool);
39 #endif
40
41 #define http_request_pool_timeout _http_request_pool_timeout
42 extern struct timeval *_http_request_pool_timeout(http_request_pool *pool, struct timeval *timeout);
43
44 #define http_request_pool_responsehandler _http_request_pool_responsehandler
45 extern void _http_request_pool_response_handler(http_request_pool *pool);
46
47 #define http_request_pool_apply_responsehandler _http_request_pool_responsehandler
48 extern int _http_request_pool_apply_responsehandler(http_request_pool *pool, zval *req, void *ch);
49
50 #define http_request_pool_init(p) _http_request_pool_init((p) TSRMLS_CC)
51 PHP_HTTP_API http_request_pool *_http_request_pool_init(http_request_pool *pool TSRMLS_DC);
52
53 #define http_request_pool_attach(p, r) _http_request_pool_attach((p), (r))
54 PHP_HTTP_API STATUS _http_request_pool_attach(http_request_pool *pool, zval *request);
55
56 #define http_request_pool_detach(p, r) _http_request_pool_detach((p), (r))
57 PHP_HTTP_API STATUS _http_request_pool_detach(http_request_pool *pool, zval *request);
58
59 #define http_request_pool_apply(p, f) _http_request_pool_apply((p), (f))
60 PHP_HTTP_API void _http_request_pool_apply(http_request_pool *pool, http_request_pool_apply_func cb);
61
62 #define http_request_pool_apply_with_arg(p, f, a) _http_request_pool_apply_with_arg((p), (f), (a))
63 PHP_HTTP_API void _http_request_pool_apply_with_arg(http_request_pool *pool, http_request_pool_apply_with_arg_func cb, void *arg);
64
65 #define http_request_pool_detach_all(p) _http_request_pool_detach_all((p))
66 PHP_HTTP_API void _http_request_pool_detach_all(http_request_pool *pool);
67
68 #define http_request_pool_send(p) _http_request_pool_send((p))
69 PHP_HTTP_API STATUS _http_request_pool_send(http_request_pool *pool);
70
71 #define http_request_pool_select _http_request_pool_select
72 PHP_HTTP_API STATUS _http_request_pool_select(http_request_pool *pool);
73
74 #define http_request_pool_perform(p) _http_request_pool_perform((p))
75 PHP_HTTP_API int _http_request_pool_perform(http_request_pool *pool);
76
77 #define http_request_pool_dtor(p) _http_request_pool_dtor((p))
78 PHP_HTTP_API void _http_request_pool_dtor(http_request_pool *pool);
79
80 #endif
81 #endif
82 #endif
83
84 /*
85 * Local variables:
86 * tab-width: 4
87 * c-basic-offset: 4
88 * End:
89 * vim600: noet sw=4 ts=4 fdm=marker
90 * vim<600: noet sw=4 ts=4
91 */
92