2 +--------------------------------------------------------------------+
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 +--------------------------------------------------------------------+
13 #ifndef PHP_HTTP_CLIENT_CURL_USER_H
14 #define PHP_HTTP_CLIENT_CURL_USER_H
16 #if PHP_HTTP_HAVE_CURL
18 typedef struct php_http_client_curl_user_context
{
19 php_http_client_t
*client
;
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
;
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
);
38 interface http\Client\Curl\User
44 const POLL_REMOVE
= 4;
49 * The callback should be run when:
51 * - a watched socket needs action
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)
55 function
init(callable $run
);
58 * Register a timeout watcher
59 * @param int $timeout_ms desired timeout with milliseconds resolution
61 function
timer(int $timeout_ms
);
64 * (Un-)Register a socket watcher
65 * @param resource $socket the fd to watch
66 * @param int $poll http\Client\Curl\Loop::POLL_* constant
68 function
socket($socket
, int $poll
);
71 * Run the loop as long as it does not block
73 * Called by http\Client::once()
78 * Wait/poll/select (block the loop) until events fire
80 * Called by http\Client::wait()
82 * @param int $timeout_ms block for maximal $timeout_ms milliseconds
84 function
wait(int $timeout_ms
= null
);
89 * Called by http\Client::send() while there are unfinished requests and
90 * no exception has occurred
103 * vim600: noet sw=4 ts=4 fdm=marker
104 * vim<600: noet sw=4 ts=4