#include "phpstr/phpstr.h"
+#define HTTP_BEGIN_ARGS(method, req_args) HTTP_BEGIN_ARGS_EX(HttpMessage, method, ZEND_RETURN_REFERENCE_AGNOSTIC, req_args)
+#define HTTP_EMPTY_ARGS(method, ret_ref) HTTP_EMPTY_ARGS_EX(HttpMessage, method, ret_ref)
+#define HTTP_MESSAGE_ME(method, visibility) PHP_ME(HttpMessage, method, HTTP_ARGS(HttpMessage, method), visibility)
+
+HTTP_BEGIN_ARGS(__construct, 0)
+ HTTP_ARG_VAL(message, 0)
+HTTP_END_ARGS;
+
+HTTP_BEGIN_ARGS(fromString, 1)
+ HTTP_ARG_VAL(message, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getBody, 0);
+HTTP_EMPTY_ARGS(getHeaders, 0);
+HTTP_BEGIN_ARGS(setHeaders, 1)
+ HTTP_ARG_VAL(headers, 0)
+HTTP_END_ARGS;
+
+HTTP_BEGIN_ARGS(addHeaders, 1)
+ HTTP_ARG_VAL(headers, 0)
+ HTTP_ARG_VAL(append, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getType, 0);
+HTTP_BEGIN_ARGS(setType, 1)
+ HTTP_ARG_VAL(type, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getResponseCode, 0);
+HTTP_BEGIN_ARGS(setResponseCode, 1)
+ HTTP_ARG_VAL(response_code, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getRequestMethod, 0);
+HTTP_BEGIN_ARGS(setRequestMethod, 1)
+ HTTP_ARG_VAL(request_method, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getRequestUri, 0);
+HTTP_BEGIN_ARGS(setRequestUri, 1)
+ HTTP_ARG_VAL(uri, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getHttpVersion, 0);
+HTTP_BEGIN_ARGS(setHttpVersion, 1)
+ HTTP_ARG_VAL(http_version, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getParentMessage, 1);
+HTTP_EMPTY_ARGS(send, 0);
+HTTP_BEGIN_ARGS(toString, 0)
+ HTTP_ARG_VAL(include_parent, 0)
+HTTP_END_ARGS;
+
#define http_message_object_declare_default_properties() _http_message_object_declare_default_properties(TSRMLS_C)
static inline void _http_message_object_declare_default_properties(TSRMLS_D);
#define http_message_object_read_prop _http_message_object_read_prop
zend_class_entry *http_message_object_ce;
zend_function_entry http_message_object_fe[] = {
- PHP_ME(HttpMessage, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_ME(HttpMessage, getBody, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, getHeaders, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, setHeaders, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, addHeaders, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, getType, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, setType, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, getResponseCode, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, setResponseCode, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, getRequestMethod, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, setRequestMethod, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, getRequestUri, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, setRequestUri, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, getHttpVersion, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, setHttpVersion, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, getParentMessage, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, send, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessage, toString, NULL, ZEND_ACC_PUBLIC)
-
- ZEND_MALIAS(HttpMessage, __toString, toString, NULL, ZEND_ACC_PUBLIC)
-
- PHP_ME(HttpMessage, fromString, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ HTTP_MESSAGE_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ HTTP_MESSAGE_ME(getBody, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(getHeaders, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(setHeaders, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(addHeaders, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(getType, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(setType, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(getResponseCode, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(setResponseCode, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(getRequestMethod, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(setRequestMethod, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(getRequestUri, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(setRequestUri, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(getHttpVersion, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(setHttpVersion, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(getParentMessage, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(send, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(toString, ZEND_ACC_PUBLIC)
+
+ ZEND_MALIAS(HttpMessage, __toString, toString, HTTP_ARGS(HttpMessage, toString), ZEND_ACC_PUBLIC)
+
+ HTTP_MESSAGE_ME(fromString, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
{NULL, NULL, NULL}
};
static zend_object_handlers http_message_object_handlers;
#endif
#include <curl/curl.h>
-HTTP_DECLARE_ARG_PASS_INFO();
+#define HTTP_BEGIN_ARGS(method, req_args) HTTP_BEGIN_ARGS_EX(HttpRequestPool, method, ZEND_RETURN_REFERENCE_AGNOSTIC, req_args)
+#define HTTP_EMPTY_ARGS(method, ret_ref) HTTP_EMPTY_ARGS_EX(HttpRequestPool, method, ret_ref)
+#define HTTP_REQPOOL_ME(method, visibility) PHP_ME(HttpRequestPool, method, HTTP_ARGS(HttpRequestPool, method), visibility)
+
+HTTP_BEGIN_ARGS_AR(HttpRequestPool, __construct, 0, 0)
+ HTTP_ARG_OBJ(HttpRequest, request0, 0)
+ HTTP_ARG_OBJ(HttpRequest, request1, 0)
+ HTTP_ARG_OBJ(HttpRequest, requestN, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(__destruct, 0);
+HTTP_EMPTY_ARGS(reset, 0);
+
+HTTP_BEGIN_ARGS(attach, 1)
+ HTTP_ARG_OBJ(HttpRequest, request, 0)
+HTTP_END_ARGS;
+
+HTTP_BEGIN_ARGS(detach, 1)
+ HTTP_ARG_OBJ(HttpRequest, request, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(send, 0);
+HTTP_EMPTY_ARGS(socketSend, 0);
+HTTP_EMPTY_ARGS(socketSelect, 0);
+HTTP_EMPTY_ARGS(socketRead, 0);
+
#define http_requestpool_object_declare_default_properties() _http_requestpool_object_declare_default_properties(TSRMLS_C)
static inline void _http_requestpool_object_declare_default_properties(TSRMLS_D);
zend_class_entry *http_requestpool_object_ce;
zend_function_entry http_requestpool_object_fe[] = {
- PHP_ME(HttpRequestPool, __construct, http_arg_pass_ref_all, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_ME(HttpRequestPool, __destruct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR)
- PHP_ME(HttpRequestPool, attach, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequestPool, detach, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequestPool, send, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpRequestPool, reset, NULL, ZEND_ACC_PUBLIC)
-
- PHP_ME(HttpRequestPool, socketSend, NULL, ZEND_ACC_PROTECTED)
- PHP_ME(HttpRequestPool, socketSelect, NULL, ZEND_ACC_PROTECTED)
- PHP_ME(HttpRequestPool, socketRead, NULL, ZEND_ACC_PROTECTED)
+ HTTP_REQPOOL_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ HTTP_REQPOOL_ME(__destruct, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR)
+ HTTP_REQPOOL_ME(attach, ZEND_ACC_PUBLIC)
+ HTTP_REQPOOL_ME(detach, ZEND_ACC_PUBLIC)
+ HTTP_REQPOOL_ME(send, ZEND_ACC_PUBLIC)
+ HTTP_REQPOOL_ME(reset, ZEND_ACC_PUBLIC)
+
+ HTTP_REQPOOL_ME(socketSend, ZEND_ACC_PROTECTED)
+ HTTP_REQPOOL_ME(socketSelect, ZEND_ACC_PROTECTED)
+ HTTP_REQPOOL_ME(socketRead, ZEND_ACC_PROTECTED)
{NULL, NULL, NULL}
};
#include "missing.h"
+#define HTTP_BEGIN_ARGS(method, req_args) HTTP_BEGIN_ARGS_EX(HttpResponse, method, 0, req_args)
+#define HTTP_EMPTY_ARGS(method, ret_ref) HTTP_EMPTY_ARGS_EX(HttpResponse, method, ret_ref)
+#define HTTP_RESPONSE_ME(method, visibility) PHP_ME(HttpResponse, method, HTTP_ARGS(HttpResponse, method), visibility)
+
+HTTP_BEGIN_ARGS(__construct, 0)
+ HTTP_ARG_VAL(cache, 0)
+ HTTP_ARG_VAL(gzip, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getETag, 0);
+HTTP_BEGIN_ARGS(setETag, 1)
+ HTTP_ARG_VAL(etag, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getCache, 0);
+HTTP_BEGIN_ARGS(setCache, 1)
+ HTTP_ARG_VAL(cache, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getGzip, 0);
+HTTP_BEGIN_ARGS(setGzip, 1)
+ HTTP_ARG_VAL(gzip, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getCacheControl, 0);
+HTTP_BEGIN_ARGS(setCacheControl, 1)
+ HTTP_ARG_VAL(cache_control, 0)
+ HTTP_ARG_VAL(raw, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getContentType, 0);
+HTTP_BEGIN_ARGS(setContentType, 1)
+ HTTP_ARG_VAL(content_type, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getContentDisposition, 0);
+HTTP_BEGIN_ARGS(setContentDisposition, 1)
+ HTTP_ARG_VAL(filename, 0)
+ HTTP_ARG_VAL(send_inline, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getThrottleDelay, 0);
+HTTP_BEGIN_ARGS(setThrottleDelay, 1)
+ HTTP_ARG_VAL(seconds, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getSendBuffersize, 0);
+HTTP_BEGIN_ARGS(setSendBuffersize, 1)
+ HTTP_ARG_VAL(bytes, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getData, 0);
+HTTP_BEGIN_ARGS(setData, 1)
+ HTTP_ARG_VAL(data, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getStream, 0);
+HTTP_BEGIN_ARGS(setStream, 1)
+ HTTP_ARG_VAL(stream, 0)
+HTTP_END_ARGS;
+
+HTTP_EMPTY_ARGS(getFile, 0);
+HTTP_BEGIN_ARGS(setFile, 1)
+ HTTP_ARG_VAL(filepath, 0)
+HTTP_END_ARGS;
+
+HTTP_BEGIN_ARGS(send, 0)
+ HTTP_ARG_VAL(clean_ob, 0)
+HTTP_END_ARGS;
+
#define http_response_object_declare_default_properties() _http_response_object_declare_default_properties(TSRMLS_C)
static inline void _http_response_object_declare_default_properties(TSRMLS_D);
zend_class_entry *http_response_object_ce;
zend_function_entry http_response_object_fe[] = {
- PHP_ME(HttpResponse, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ HTTP_RESPONSE_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_ME(HttpResponse, setETag, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, getETag, NULL, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(setETag, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(getETag, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, setContentDisposition, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, getContentDisposition, NULL, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(setContentDisposition, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(getContentDisposition, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, setContentType, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, getContentType, NULL, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(setContentType, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(getContentType, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, setCache, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, getCache, NULL, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(setCache, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(getCache, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, setCacheControl, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, getCacheControl, NULL, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(setCacheControl, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(getCacheControl, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, setGzip, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, getGzip, NULL, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(setGzip, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(getGzip, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, setThrottleDelay, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, getThrottleDelay, NULL, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(setThrottleDelay, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(getThrottleDelay, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, setSendBuffersize, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, getSendBuffersize, NULL, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(setSendBuffersize, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(getSendBuffersize, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, setData, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, getData, NULL, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(setData, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(getData, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, setFile, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, getFile, NULL, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(setFile, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(getFile, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, setStream, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, getStream, NULL, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(setStream, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(getStream, ZEND_ACC_PUBLIC)
- PHP_ME(HttpResponse, send, NULL, ZEND_ACC_PUBLIC)
+ HTTP_RESPONSE_ME(send, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
#define HTTP_E_URL 7L
#define HTTP_E_MSG 8L
+#ifdef ZEND_ENGINE_2
+# define HTTP_BEGIN_ARGS_EX(class, method, ret_ref, req_args) static ZEND_BEGIN_ARG_INFO_EX(args_for_ ##class## _ ##method , 0, ret_ref, req_args)
+# define HTTP_BEGIN_ARGS_AR(class, method, ret_ref, req_args) static ZEND_BEGIN_ARG_INFO_EX(args_for_ ##class## _ ##method , 1, ret_ref, req_args)
+# define HTTP_END_ARGS }
+# define HTTP_EMPTY_ARGS_EX(class, method, ret_ref) HTTP_BEGIN_ARGS_EX(class, method, ret_ref, 0) HTTP_END_ARGS
+# define HTTP_ARGS(class, method) args_for_ ##class## _ ##method
+# define HTTP_ARG_VAL(name, pass_ref) ZEND_ARG_INFO(pass_ref, name)
+# define HTTP_ARG_OBJ(class, name, allow_null) ZEND_ARG_OBJ_INFO(1, name, class, allow_null)
+#endif
+
#ifdef HTTP_HAVE_CURL
# ifdef ZEND_ENGINE_2
# define HTTP_DECLARE_ARG_PASS_INFO() \