-/* $Id: http_api.c 300299 2010-06-09 06:23:16Z mike $ */
-
-
-#include "php_http.h"
-
-STATUS php_http_new(zend_object_value *ov, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC)
-{
- if (!ce) {
- ce = parent_ce;
- } else if (parent_ce && !instanceof_function(ce, parent_ce TSRMLS_CC)) {
- php_http_error(HE_WARNING, PHP_HTTP_E_RUNTIME, "Class %s does not extend %s", ce->name, parent_ce->name);
- return FAILURE;
- }
-
- *ov = create(ce, intern_ptr, obj_ptr TSRMLS_CC);
- return SUCCESS;
-}
-
-PHP_HTTP_API zend_error_handling_t php_http_object_get_error_handling(zval *object TSRMLS_DC)
-{
- zval *zeh, *lzeh;
- long eh;
-
- zeh = zend_read_property(Z_OBJCE_P(object), object, ZEND_STRL("errorHandling"), 0 TSRMLS_CC);
- if (Z_TYPE_P(zeh) != IS_NULL) {
- lzeh = php_http_zsep(IS_LONG, zeh);
- eh = Z_LVAL_P(lzeh);
- zval_ptr_dtor(&lzeh);
- return eh;
- }
- zeh = zend_read_static_property(php_http_object_class_entry, ZEND_STRL("defaultErrorHandling"), 0 TSRMLS_CC);
- if (Z_TYPE_P(zeh) != IS_NULL) {
- lzeh = php_http_zsep(IS_LONG, zeh);
- eh = Z_LVAL_P(lzeh);
- zval_ptr_dtor(&lzeh);
- return eh;
- }
- return EH_NORMAL;
-}
-
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpObject, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpObject, method, 0)
-#define PHP_HTTP_OBJECT_ME(method, visibility) PHP_ME(HttpObject, method, PHP_HTTP_ARGS(HttpObject, method), visibility)
-
-PHP_HTTP_BEGIN_ARGS(factory, 1)
- PHP_HTTP_ARG_VAL(class_name, 0)
- PHP_HTTP_ARG_VAL(ctor_args, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(setErrorHandling, 1)
- PHP_HTTP_ARG_VAL(eh, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getErrorHandling);
-
-PHP_HTTP_BEGIN_ARGS(setDefaultErrorHandling, 1)
- PHP_HTTP_ARG_VAL(eh, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getDefaultErrorHandling);
-
-zend_class_entry *php_http_object_class_entry;
-zend_function_entry php_http_object_method_entry[] = {
- PHP_HTTP_OBJECT_ME(factory, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
-
- PHP_HTTP_OBJECT_ME(setErrorHandling, ZEND_ACC_PUBLIC)
- PHP_HTTP_OBJECT_ME(getErrorHandling, ZEND_ACC_PUBLIC)
- PHP_HTTP_OBJECT_ME(setDefaultErrorHandling, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_HTTP_OBJECT_ME(getDefaultErrorHandling, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
-
- EMPTY_FUNCTION_ENTRY
-};