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