travis: allow_failures
[m6w6/ext-http] / src / php_http_client_curl_user.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-2014, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 #ifndef PHP_HTTP_CLIENT_CURL_USER_H
14 #define PHP_HTTP_CLIENT_CURL_USER_H
15
16 #if PHP_HTTP_HAVE_LIBCURL
17
18 typedef struct php_http_client_curl_user_context {
19 php_http_client_t *client;
20 zval user;
21 zend_function closure;
22 php_http_object_method_t timer;
23 php_http_object_method_t socket;
24 php_http_object_method_t once;
25 php_http_object_method_t wait;
26 php_http_object_method_t send;
27 } php_http_client_curl_user_context_t;
28
29 PHP_HTTP_API zend_class_entry *php_http_client_curl_user_get_class_entry();
30 PHP_HTTP_API php_http_client_curl_ops_t *php_http_client_curl_user_ops_get();
31 PHP_MINIT_FUNCTION(http_client_curl_user);
32
33 #endif
34
35 #if 0
36 <?php
37
38 interface http\Client\Curl\User
39 {
40 const POLL_NONE = 0;
41 const POLL_IN = 1;
42 const POLL_OUT = 2;
43 const POLL_INOUT = 3;
44 const POLL_REMOVE = 4;
45
46 /**
47 * Initialize the loop
48 *
49 * The callback should be run when:
50 * - timeout occurs
51 * - a watched socket needs action
52 *
53 * @param callable $run callback as function(http\Client $client, resource $socket = null, int $action = http\Client\Curl\User::POLL_NONE):int (returns unfinished requests pending)
54 */
55 function init(callable $run);
56
57 /**
58 * Register a timeout watcher
59 * @param int $timeout_ms desired timeout with milliseconds resolution
60 */
61 function timer(int $timeout_ms);
62
63 /**
64 * (Un-)Register a socket watcher
65 * @param resource $socket the fd to watch
66 * @param int $poll http\Client\Curl\Loop::POLL_* constant
67 */
68 function socket($socket, int $poll);
69
70 /**
71 * Run the loop as long as it does not block
72 *
73 * Called by http\Client::once()
74 */
75 function once();
76
77 /**
78 * Wait/poll/select (block the loop) until events fire
79 *
80 * Called by http\Client::wait()
81 *
82 * @param int $timeout_ms block for maximal $timeout_ms milliseconds
83 */
84 function wait(int $timeout_ms = null);
85
86 /**
87 * Run the loop
88 *
89 * Called by http\Client::send() while there are unfinished requests and
90 * no exception has occurred
91 */
92 function send();
93 }
94 #endif
95
96 #endif
97
98 /*
99 * Local variables:
100 * tab-width: 4
101 * c-basic-offset: 4
102 * End:
103 * vim600: noet sw=4 ts=4 fdm=marker
104 * vim<600: noet sw=4 ts=4
105 */